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
src/natools-s_expressions-enumeration_io.adb
faelys/natools
0
27194
<gh_stars>0 ------------------------------------------------------------------------------ -- Copyright (c) 2015-2019, <NAME> -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ with Ada.Characters.Handling; with Ada.Strings.Fixed; package body Natools.S_Expressions.Enumeration_IO is function To_Atom (Enumeration_Image : in String) return Atom is Result : Atom := S_Expressions.To_Atom (Ada.Strings.Fixed.Translate (Enumeration_Image, Ada.Characters.Handling.To_Lower'Access)); begin for I in Result'Range loop if Result (I) = Character'Pos ('_') then Result (I) := Character'Pos ('-'); end if; end loop; return Result; end To_Atom; function To_Image (Data : in Atom) return String is Result : String := Ada.Strings.Fixed.Translate (To_String (Data), Ada.Characters.Handling.To_Upper'Access); begin for I in Result'Range loop if Result (I) = '-' then Result (I) := '_'; end if; end loop; return Result; end To_Image; package body Typed_IO is function Image (T : Enum) return Atom is begin return To_Atom (Enum'Image (T)); end Image; function Value (Data : Atom) return Enum is begin return Enum'Value (To_Image (Data)); end Value; function Value (Data : Atom; Fallback : Enum) return Enum is Img : constant String := To_Image (Data); begin return Enum'Value (Img); exception when Constraint_Error => return Fallback; end Value; end Typed_IO; end Natools.S_Expressions.Enumeration_IO;
bits/src/bitoperations-types.ads
vasil-sd/ada-tlsf
3
4415
generic type Modular_Type is mod <>; package BitOperations.Types With SPARK_Mode, Pure is Pragma Assert (Modular_Type'Last = 2 ** Modular_Type'Size - 1); subtype Modular is Modular_Type; subtype Bit_Position is Natural range 0 .. Modular'Size - 1; subtype Mask_Size is Natural range 1 .. Modular'Size; end BitOperations.Types;
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0xca_notsx.log_4492_1673.asm
ljhsiun2/medusa
9
81438
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r15 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_UC_ht+0x1ad66, %rcx nop nop cmp %rax, %rax mov (%rcx), %r15d nop nop nop sub %rbp, %rbp lea addresses_A_ht+0x13476, %rdi clflush (%rdi) nop add $18326, %r13 movb (%rdi), %r11b nop nop nop nop sub %rax, %rax lea addresses_WC_ht+0x1bd76, %rbp nop nop nop nop nop dec %r13 movw $0x6162, (%rbp) nop nop cmp $45377, %rcx lea addresses_UC_ht+0xee66, %r11 nop nop sub $2603, %rcx movl $0x61626364, (%r11) nop nop nop nop nop inc %rcx lea addresses_WC_ht+0x1d566, %rcx nop nop nop nop xor %rax, %rax movw $0x6162, (%rcx) nop nop nop nop nop add %rcx, %rcx lea addresses_WC_ht+0x173c4, %rsi lea addresses_UC_ht+0x46e6, %rdi nop nop and %r15, %r15 mov $93, %rcx rep movsw nop xor $12482, %rax lea addresses_normal_ht+0x4cc6, %rsi lea addresses_D_ht+0x595a, %rdi nop cmp %rax, %rax mov $39, %rcx rep movsq nop nop nop xor %r11, %r11 lea addresses_D_ht+0xea86, %r11 nop nop nop nop nop dec %r15 movb (%r11), %cl nop nop nop nop xor $40081, %rax lea addresses_A_ht+0x2cb2, %rdi nop nop nop nop sub %rax, %rax mov (%rdi), %r11d nop nop nop nop nop xor %rax, %rax lea addresses_WC_ht+0x1c566, %rax nop sub %r15, %r15 vmovups (%rax), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $0, %xmm3, %rbp nop inc %r11 lea addresses_WC_ht+0x1e556, %rax nop nop nop nop xor %r11, %r11 movl $0x61626364, (%rax) nop sub $56983, %rdi lea addresses_WC_ht+0x1d966, %rdi nop nop inc %rax movups (%rdi), %xmm1 vpextrq $0, %xmm1, %r15 nop cmp $53296, %r15 lea addresses_WT_ht+0x1426, %rax nop nop nop nop nop cmp %r11, %r11 movb $0x61, (%rax) nop nop nop nop sub $6049, %r15 pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r15 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r13 push %r15 push %r8 push %rbp push %rbx push %rdi push %rdx // Load mov $0x2d4, %rbp nop nop nop inc %r8 mov (%rbp), %rbx nop nop nop nop cmp %rbx, %rbx // Load lea addresses_A+0x15b76, %r15 nop nop nop nop xor %r13, %r13 mov (%r15), %ebx nop nop nop nop nop cmp $4318, %rbx // Load lea addresses_normal+0x3566, %rdx nop and $30005, %rbp movups (%rdx), %xmm1 vpextrq $1, %xmm1, %r8 nop nop nop and $64969, %rdi // Store lea addresses_D+0xf86, %rdx nop nop nop and $19731, %r8 mov $0x5152535455565758, %r15 movq %r15, (%rdx) and $49650, %rbx // Store lea addresses_WC+0x17566, %rdx nop nop nop nop and $8738, %rdi movb $0x51, (%rdx) nop cmp $5636, %rbp // Store lea addresses_WT+0x4a2c, %r13 nop nop nop nop add $18413, %rdx movl $0x51525354, (%r13) add $61609, %r8 // Faulty Load lea addresses_normal+0x3566, %rbx nop nop nop inc %rdx mov (%rbx), %di lea oracles, %rbp and $0xff, %rdi shlq $12, %rdi mov (%rbp,%rdi,1), %rdi pop %rdx pop %rdi pop %rbx pop %rbp pop %r8 pop %r15 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': True, 'type': 'addresses_normal', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_P', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_A', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_normal', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_D', 'size': 8, 'AVXalign': True}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_WC', 'size': 1, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WT', 'size': 4, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_normal', 'size': 2, 'AVXalign': True}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': True, 'congruent': 4, 'NT': False, 'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': True}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}} {'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}} {'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': True, 'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False}} {'src': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False}} {'34': 4492} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0.log_21829_801.asm
ljhsiun2/medusa
9
81197
<filename>Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xa0.log_21829_801.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r8 push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0x18f53, %rsi lea addresses_WT_ht+0x1484f, %rdi nop add %r10, %r10 mov $93, %rcx rep movsl nop cmp %rdi, %rdi lea addresses_D_ht+0x19f33, %rsi lea addresses_UC_ht+0x19f9b, %rdi clflush (%rdi) nop nop nop inc %r14 mov $87, %rcx rep movsb nop add %rcx, %rcx lea addresses_UC_ht+0xe433, %rbx nop sub %r8, %r8 movups (%rbx), %xmm2 vpextrq $1, %xmm2, %rcx cmp $5343, %rdi pop %rsi pop %rdi pop %rcx pop %rbx pop %r8 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r8 push %rbx push %rcx push %rdx // Faulty Load mov $0x77a1b30000000733, %rbx nop nop nop nop nop sub $38604, %r8 movb (%rbx), %r13b lea oracles, %rbx and $0xff, %r13 shlq $12, %r13 mov (%rbx,%r13,1), %r13 pop %rdx pop %rcx pop %rbx pop %r8 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': True, 'size': 32}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': True, 'congruent': 5, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WT_ht'}} {'src': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 3, 'type': 'addresses_UC_ht'}} {'src': {'NT': False, 'same': True, 'congruent': 8, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
private/shell/win16/shell16/shstart.asm
King0987654/windows2000
11
2196
page ,132 ;-----------------------------Module-Header-----------------------------; ; Module Name: LIBINIT.ASM ; ; library stub to do local init for a Dynamic linked library ; ; Created: 06-27-89 ; Author: <NAME> [ToddLa] ; ; Exported Functions: none ; ; Public Functions: none ; ; Public Data: none ; ; General Description: ; ; Restrictions: ; ; This must be the first object file in the LINK line, this assures ; that the reserved parameter block is at the *base* of DGROUP ; ;-----------------------------------------------------------------------; ?PLM=1 ; PASCAL Calling convention is DEFAULT ?WIN=1 ; Windows calling convention .286p .xlist include cmacros.inc .list ifndef SEGNAME SEGNAME equ <_TEXT> endif createSeg %SEGNAME, CodeSeg, word, public, CODE ;-----------------------------------------------------------------------; ; external functions ; externFP LocalInit ; in KERNEL externFP LibMain ; C code to do DLL init ;-----------------------------------------------------------------------; ; ; Stuff needed to avoid the C runtime coming in, and init the windows ; reserved parameter block at the base of DGROUP ; %out link me first!! sBegin Data assumes DS,Data org 0 ; base of DATA segment! DD 0 ; So null pointers get 0 maxRsrvPtrs = 5 DW maxRsrvPtrs usedRsrvPtrs = 0 labelDP <PUBLIC,rsrvptrs> DefRsrvPtr MACRO name globalW name,0 usedRsrvPtrs = usedRsrvPtrs + 1 ENDM DefRsrvPtr pLocalHeap ; Local heap pointer DefRsrvPtr pAtomTable ; Atom table pointer DefRsrvPtr pStackTop ; top of stack DefRsrvPtr pStackMin ; minimum value of SP DefRsrvPtr pStackBot ; bottom of stack if maxRsrvPtrs-usedRsrvPtrs DW maxRsrvPtrs-usedRsrvPtrs DUP (0) endif public __acrtused __acrtused = 1 sEnd Data ;-----------------------------------------------------------------------; sBegin CodeSeg assumes cs,CodeSeg ;--------------------------Private-Routine-----------------------------; ; ; LibEntry - called when DLL is loaded ; ; Entry: ; CX = size of heap ; DI = module handle ; DS = automatic data segment ; ES:SI = address of command line (not used) ; ; Returns: ; AX = TRUE if success ; Error Returns: ; AX = FALSE if error (ie fail load process) ; Registers Preserved: ; SI,DI,DS,BP ; Registers Destroyed: ; AX,BX,CX,DX,ES,FLAGS ; Calls: ; None ; History: ; ; 06-27-89 -by- <NAME> [ToddLa] ; Created. ;-----------------------------------------------------------------------; cProc LibEntry,<FAR,PUBLIC,NODATA>,<> cBegin ; ; Push frame for LibMain (hModule,cbHeap,lpszCmdLine) ; push di push cx push es push si ; ; Init the local heap (if one is declared in the .def file) ; jcxz no_heap cCall LocalInit,<0,0,cx> no_heap: cCall LibMain cEnd sEnd CodeSeg end LibEntry
oeis/026/A026391.asm
neoneye/loda-programs
11
168917
; A026391: Expansion of 1/((1-2x)(1-6x)(1-7x)(1-10x)). ; Submitted by <NAME> ; 1,25,407,5489,66759,762321,8356279,89114113,932519687,9629963057,98523692631,1001349555297,10129549127335,102127457330833,1027215881948663,10314453257429441,103444825304722503 mov $1,1 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 sub $2,1 sub $0,$2 seq $0,16304 ; Expansion of 1/((1-2*x)*(1-6*x)*(1-7*x)). mul $1,10 add $1,$0 lpe mov $0,$1
oeis/087/A087743.asm
neoneye/loda-programs
11
26448
<reponame>neoneye/loda-programs<filename>oeis/087/A087743.asm ; A087743: Numbers n >= 3 with property that the remainder when n is divided by k (for 3 <= k <= n-2) is not 1. ; Submitted by <NAME> ; 3,4,5,6,8,12,14,18,20,24,30,32,38,42,44,48,54,60,62,68,72,74,80,84,90,98,102,104,108,110,114,128,132,138,140,150,152,158,164,168,174,180,182,192,194,198,200,212,224,228,230,234,240,242,252,258,264,270 sub $0,1 mov $2,2 max $2,$0 add $0,$2 seq $0,173919 ; Numbers that are prime or one less than a prime. add $0,1
ADC/adc.asm
xfrings/8051-Experiments
0
165008
;ADC 0848 CHECK RUN CODE ;08/07/2008 :: 23:00 HRS :::::::: LAST UPDATED : 09/07/2008 ;ASTER ;PIN CONFIG: PORT 1 : DB0 ---- DB7 ADC ; PORT 3 : OUTPUT LEDS ; PORT 2 : CONTROL PINS :::: P2.0- INTR(BAR) ; P2.1- WR(BAR) ; P2.2- CS(BAR) ; P2.3- RD(BAR) :::: ;PROGRAM RUN -SUCCESS ON ADC0848CCN ORG 0000H SJMP 0030H ORG 0030H START: MOV P1,#00H MOV P2,#0AH MOV P3,#00H MOV P1,#08H ; SINGLE ENDED CHANNEL 1 :: 0000 1000 ACALL WRITE ; START CONVERSION ;WAIT: NOP ; JB P2.0,WAIT ACALL READY ; CHECK IF CONVERSION IS DONE :: INTR BAR IS LOW ACALL READ ; READ DB0 TO DB7 AND PLACE IN R0 MOV P3,R0 ; OUTPUT DIGITAL CONVERSION ACALL DELAY STOP: SJMP START WRITE: SETB P2.3 CLR P2.2 ; CLEAR CS BAR SETB P2.1 ; SET WR BAR NOP CLR P2.1 ; CLEAR WR BAR NOP NOP NOP SETB P2.1 ; RISING EDGE ON WR BAR RET READY: SETB P2.1 CLR P2.2 SETB P2.3 SETB P3.7 ; WATCH BITS SETB P3.6 WAIT: JB P2.0,WAIT ; WAIT TILL INTR BAR IS LOW CLR P3.7 CLR P3.6 NOP RET READ: SETB P2.1 CLR P2.2 ; CS BAR LOW CLR P2.3 ; RD BAR LOW NOP NOP MOV P1,#0FFH ;CONFIGURE PORT FOR INPUT::: DONT FORGET THIS MOV R0,P1 NOP NOP RET DELAY: MOV R7,#08H MOV R6,#0FFH MOV R5,#0FFH DJNZ R5,$ DJNZ R6,$-2 DJNZ R7,$-4 RET END
oeis/082/A082181.asm
neoneye/loda-programs
11
167881
; A082181: a(0)=1; for n>=1, a(n) = sum(k=0..n, 9^k*N(n,k)), where N(n,k) =1/n*C(n,k)*C(n,k+1) are the Narayana numbers (A001263). ; Submitted by <NAME> ; 1,1,10,109,1270,15562,198100,2596645,34825150,475697854,6595646860,92590323058,1313427716380,18798095833012,271118225915560,3936516861402901,57494017447915150,844109420603623030,12450759123400155100,184419491302065776518,2741920337983270198420,40906056234083127141196,612171571653789513771160,9187477819399898263302274,138247080089176661934491020,2085273149751535157858448172,31523770050233613991719643000,477541467393619970108496204100,7248008748375939650946600907000 mov $1,1 mov $3,$0 mov $4,1 lpb $3 mul $4,$3 sub $3,1 mul $4,$3 add $5,$1 add $1,1 div $4,2 div $4,$5 mul $4,9 add $2,$4 lpe mov $0,$2 add $0,1
HoTT/Base/Inspect.agda
michaelforney/hott
0
17475
<reponame>michaelforney/hott {-# OPTIONS --without-K #-} open import HoTT.Base module HoTT.Base.Inspect where open variables data Inspect {i j} {A : 𝒰 i} {P : A → 𝒰 j} (f : Π A P) (x : A) (y : P x) : 𝒰 (i ⊔ j) where [_] : y == f x → Inspect f x y inspect : (f : Π A P) (x : A) → Inspect f x (f x) inspect f x = [ refl ]
evernote/quit-evernote.applescript
kinshuk4/evernote-automation
4
3358
-- https://github.com/IceHe/applescript-for-evernote/blob/e5c52437267e1faec3e3e14f6122bb9ac461d6ed/evernote_quit.applescript if application "Evernote" is running then tell application "Evernote" quit end tell return true end if return false
examples/usart_interruptive_echo_issue_dbg/src/avr-interrupts.ads
pvrego/adaino
8
14669
with System; -- ============================================================================= -- Package body AVR.INTERRUPTS -- -- Maps the interrupts for the MCU micro-controller. -- To attach an interrupt, proceed like -- procedure Receive_Handler; -- pragma Machine_Attribute -- (Entity => Receive_Handler, -- Attribute_Name => "signal"); -- pragma Export -- (Convention => C, -- Entity => Receive_Handler, -- External_Name => <interrupt_vector_name>); -- ============================================================================= package AVR.INTERRUPTS is type External_Interrupt_Control_Type is array (0 .. 7) of Bit_Array_Type (0 .. 1); pragma Pack (External_Interrupt_Control_Type); for External_Interrupt_Control_Type'Size use 2 * BYTE_SIZE; Reg_EICR : External_Interrupt_Control_Type; for Reg_EICR'Address use System'To_Address (16#69#); type External_Interrupt_Mask_Register is new Bit_Array_Type (0 .. 7); Reg_EIMSK : External_Interrupt_Mask_Register; for Reg_EIMSK'Address use System'To_Address (16#3D#); type External_Interrupt_Flag_Type is new Bit_Array_Type (0 .. 7); Reg_EIFR : External_Interrupt_Flag_Type; for Reg_EIFR'Address use System'To_Address (16#3C#); type Pin_Change_Interrupt_Control_Register_Type is new Bit_Array_Type (0 .. 7); Reg_PCICR : Pin_Change_Interrupt_Control_Register_Type; for Reg_PCICR'Address use System'To_Address (16#68#); type Pin_Change_Interrupt_Flag_Type is new Bit_Array_Type (0 .. 7); Reg_PCIFR : Pin_Change_Interrupt_Flag_Type; for Reg_PCIFR'Address use System'To_Address (16#3B#); type Pin_Change_Mask_Type is new Bit_Array_Type (0 .. 23); Reg_PCMSK : Pin_Change_Mask_Type; for Reg_PCMSK'Address use System'To_Address (16#6B#); #if MCU="ATMEGA2560" then RESET : constant String := "__vector_0"; -- External Pin, Power-on, Brown-out, Watchdog and JTAG AVR Reset INT0 : constant String := "__vector_1"; -- External Interrupt Request 0 INT1 : constant String := "__vector_2"; -- External Interrupt Request 1 INT2 : constant String := "__vector_3"; -- External Interrupt Request 2 INT3 : constant String := "__vector_4"; -- External Interrupt Request 3 INT4 : constant String := "__vector_5"; -- External Interrupt Request 4 INT5 : constant String := "__vector_6"; -- External Interrupt Request 5 INT6 : constant String := "__vector_7"; -- External Interrupt Request 6 INT7 : constant String := "__vector_8"; -- External Interrupt Request 7 PCINT0 : constant String := "__vector_9"; -- Pin Change Interrupt Request 0 PCINT1 : constant String := "__vector_10"; -- Pin Change Interrupt Request 1 PCINT2 : constant String := "__vector_11"; -- Pin Change Interrupt Request 2 WDT : constant String := "__vector_12"; -- Watchdog Time-out Interrupt TIMER2_COMPA : constant String := "__vector_13"; -- Timer/Counter2 Compare Match A TIMER2_COMPB : constant String := "__vector_14"; -- Timer/Counter2 Compare Match B TIMER2_OVF : constant String := "__vector_15"; -- Timer/Counter2 Overflow TIMER1_CAPT : constant String := "__vector_16"; -- Timer/Counter1 Capture Event TIMER1_COMPA : constant String := "__vector_17"; -- Timer/Counter1 Compare Match A TIMER1_COMPB : constant String := "__vector_18"; -- Timer/Counter1 Compare Match B TIMER1_COMPC : constant String := "__vector_19"; -- Timer/Counter1 Compare Match C TIMER1_OVF : constant String := "__vector_20"; -- Timer/Counter1 Overflow TIMER0_COMPA : constant String := "__vector_21"; -- Timer/Counter0 Compare Match A TIMER0_COMPB : constant String := "__vector_22"; -- Timer/Counter0 Compare match B TIMER0_OVF : constant String := "__vector_23"; -- Timer/Counter0 Overflow SPI_STC : constant String := "__vector_24"; -- SPI Serial Transfer Complete USART0_RX : constant String := "__vector_25"; -- USART0 Rx Complete USART0_UDRE : constant String := "__vector_26"; -- USART0 Data Register Empty USART0_TX : constant String := "__vector_27"; -- USART0 Tx Complete ANALOG_COMP : constant String := "__vector_28"; -- Analog Comparator ADC : constant String := "__vector_29"; -- ADC Conversion Complete EE_READY : constant String := "__vector_30"; -- EEPROM Ready TIMER3_CAPT : constant String := "__vector_31"; -- Timer/Counter3 Capture Event TIMER3_COMPA : constant String := "__vector_32"; -- Timer/Counter3 Compare Match A TIMER3_COMPB : constant String := "__vector_33"; -- Timer/Counter3 Compare Match B TIMER3_COMPC : constant String := "__vector_34"; -- Timer/Counter3 Compare Match C TIMER3_OVF : constant String := "__vector_35"; -- Timer/Counter3 Overflow USART1_RX : constant String := "__vector_36"; -- USART1 Rx Complete USART1_UDRE : constant String := "__vector_37"; -- USART1 Data Register Empty USART1_TX : constant String := "__vector_38"; -- USART1 Tx Complete TWI : constant String := "__vector_39"; -- 2-wire Serial Interface SPM_READY : constant String := "__vector_40"; -- Store Program Memory Ready TIMER4_CAPT : constant String := "__vector_41"; -- Timer/Counter4 Capture Event TIMER4_COMPA : constant String := "__vector_42"; -- Timer/Counter4 Compare Match A TIMER4_COMPB : constant String := "__vector_43"; -- Timer/Counter4 Compare Match B TIMER4_COMPC : constant String := "__vector_44"; -- Timer/Counter4 Compare Match C TIMER4_OVF : constant String := "__vector_45"; -- Timer/Counter4 Overflow TIMER5_CAPT : constant String := "__vector_46"; -- Timer/Counter5 Capture Event TIMER5_COMPA : constant String := "__vector_47"; -- Timer/Counter5 Compare Match A TIMER5_COMPB : constant String := "__vector_48"; -- Timer/Counter5 Compare Match B TIMER5_COMPC : constant String := "__vector_49"; -- Timer/Counter5 Compare Match C TIMER5_OVF : constant String := "__vector_50"; -- Timer/Counter5 Overflow USART2_RX : constant String := "__vector_51"; -- USART2 Rx Complete USART2_UDRE : constant String := "__vector_52"; -- USART2 Data Register Empty USART2_TX : constant String := "__vector_53"; -- USART2 Tx Complete USART3_RX : constant String := "__vector_54"; -- USART3 Rx Complete USART3_UDRE : constant String := "__vector_55"; -- USART3 Data Register Empty USART3_TX : constant String := "__vector_56"; -- USART3 Tx Complete #end if; #if MCU="ATMEGA328P" then RESET : constant String := "__vector_0"; -- External Pin, Power-on, Brown-out, Watchdog and System Reset INT0 : constant String := "__vector_1"; -- External Interrupt Request 0 INT1 : constant String := "__vector_2"; -- External Interrupt Request 1 PCINT0 : constant String := "__vector_3"; -- Pin Change Interrupt Request 0 PCINT1 : constant String := "__vector_4"; -- Pin Change Interrupt Request 1 PCINT2 : constant String := "__vector_5"; -- Pin Change Interrupt Request 2 WDT : constant String := "__vector_6"; -- Watchdog Time-out Interrupt TIMER2_COMPA : constant String := "__vector_7"; -- Timer/Counter2 Compare Match A TIMER2_COMPB : constant String := "__vector_8"; -- Timer/Counter2 Compare Match B TIMER2_OVF : constant String := "__vector_9"; -- Timer/Counter2 Overflow TIMER1_CAPT : constant String := "__vector_10"; -- Timer/Counter1 Capture Event TIMER1_COMPA : constant String := "__vector_11"; -- Timer/Counter1 Compare Match A TIMER1_COMPB : constant String := "__vector_12"; -- Timer/Counter1 Compare Match B TIMER1_OVF : constant String := "__vector_13"; -- Timer/Counter1 Overflow TIMER0_COMPA : constant String := "__vector_14"; -- Timer/Counter0 Compare Match A TIMER0_COMPB : constant String := "__vector_15"; -- Timer/Counter0 Compare match B TIMER0_OVF : constant String := "__vector_16"; -- Timer/Counter0 Overflow SPI_STC : constant String := "__vector_17"; -- SPI Serial Transfer Complete USART0_RX : constant String := "__vector_18"; -- USART0 Rx Complete USART0_UDRE : constant String := "__vector_19"; -- USART0 Data Register Empty USART0_TX : constant String := "__vector_20"; -- USART0 Tx Complete ADC : constant String := "__vector_21"; -- ADC Conversion Complete EE_READY : constant String := "__vector_22"; -- EEPROM Ready ANALOG_COMP : constant String := "__vector_23"; -- Analog Comparator TWI : constant String := "__vector_24"; -- 2-wire Serial Interface SPM_READY : constant String := "__vector_25"; -- Store Program Memory Ready #end if; procedure Enable; procedure Disable; procedure Handle_Interrupt_RESET is null; pragma Machine_Attribute (Entity => Handle_Interrupt_RESET, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_RESET, External_Name => RESET); procedure Handle_Interrupt_INT0 is null; pragma Machine_Attribute (Entity => Handle_Interrupt_INT0, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_INT0, External_Name => INT0); procedure Handle_Interrupt_INT1 is null; pragma Machine_Attribute (Entity => Handle_Interrupt_INT1, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_INT1, External_Name => INT1); #if MCU="ATMEGA2560" then procedure Handle_Interrupt_INT2 is null; pragma Machine_Attribute (Entity => Handle_Interrupt_INT2, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_INT2, External_Name => INT2); procedure Handle_Interrupt_INT3 is null; pragma Machine_Attribute (Entity => Handle_Interrupt_INT3, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_INT3, External_Name => INT3); procedure Handle_Interrupt_INT4 is null; pragma Machine_Attribute (Entity => Handle_Interrupt_INT4, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_INT4, External_Name => INT4); procedure Handle_Interrupt_INT5 is null; pragma Machine_Attribute (Entity => Handle_Interrupt_INT5, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_INT5, External_Name => INT5); procedure Handle_Interrupt_INT6 is null; pragma Machine_Attribute (Entity => Handle_Interrupt_INT6, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_INT6, External_Name => INT6); procedure Handle_Interrupt_INT7 is null; pragma Machine_Attribute (Entity => Handle_Interrupt_INT7, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_INT7, External_Name => INT7); #end if; procedure Handle_Interrupt_PCINT0 is null; pragma Machine_Attribute (Entity => Handle_Interrupt_PCINT0, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_PCINT0, External_Name => PCINT0); procedure Handle_Interrupt_PCINT1 is null; pragma Machine_Attribute (Entity => Handle_Interrupt_PCINT1, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_PCINT1, External_Name => PCINT1); procedure Handle_Interrupt_PCINT2 is null; pragma Machine_Attribute (Entity => Handle_Interrupt_PCINT2, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_PCINT2, External_Name => PCINT2); procedure Handle_Interrupt_WDT is null; pragma Machine_Attribute (Entity => Handle_Interrupt_WDT, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_WDT, External_Name => WDT); procedure Handle_Interrupt_TIMER2_COMPA is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER2_COMPA, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER2_COMPA, External_Name => TIMER2_COMPA); procedure Handle_Interrupt_TIMER2_COMPB is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER2_COMPB, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER2_COMPB, External_Name => TIMER2_COMPB); procedure Handle_Interrupt_TIMER2_OVF is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER2_OVF, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER2_OVF, External_Name => TIMER2_OVF); procedure Handle_Interrupt_TIMER1_CAPT is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER1_CAPT, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER1_CAPT, External_Name => TIMER1_CAPT); procedure Handle_Interrupt_TIMER1_COMPA is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER1_COMPA, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER1_COMPA, External_Name => TIMER1_COMPA); procedure Handle_Interrupt_TIMER1_COMPB is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER1_COMPB, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER1_COMPB, External_Name => TIMER1_COMPB); #if MCU="ATMEGA2560" then procedure Handle_Interrupt_TIMER1_COMPC is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER1_COMPC, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER1_COMPC, External_Name => TIMER1_COMPC); #end if; procedure Handle_Interrupt_TIMER1_OVF is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER1_OVF, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER1_OVF, External_Name => TIMER1_OVF); procedure Handle_Interrupt_TIMER0_COMPA is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER0_COMPA, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER0_COMPA, External_Name => TIMER0_COMPA); procedure Handle_Interrupt_TIMER0_COMPB is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER0_COMPB, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER0_COMPB, External_Name => TIMER0_COMPB); procedure Handle_Interrupt_TIMER0_OVF is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER0_OVF, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER0_OVF, External_Name => TIMER0_OVF); procedure Handle_Interrupt_SPI_STC is null; pragma Machine_Attribute (Entity => Handle_Interrupt_SPI_STC, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_SPI_STC, External_Name => SPI_STC); procedure Handle_Interrupt_USART0_RX; pragma Machine_Attribute (Entity => Handle_Interrupt_USART0_RX, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_USART0_RX, External_Name => USART0_RX); procedure Handle_Interrupt_USART0_UDRE is null; pragma Machine_Attribute (Entity => Handle_Interrupt_USART0_UDRE, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_USART0_UDRE, External_Name => USART0_UDRE); procedure Handle_Interrupt_USART0_TX is null; pragma Machine_Attribute (Entity => Handle_Interrupt_USART0_TX, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_USART0_TX, External_Name => USART0_TX); procedure Handle_Interrupt_ANALOG_COMP is null; pragma Machine_Attribute (Entity => Handle_Interrupt_ANALOG_COMP, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_ANALOG_COMP, External_Name => ANALOG_COMP); procedure Handle_Interrupt_ADC is null; pragma Machine_Attribute (Entity => Handle_Interrupt_ADC, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_ADC, External_Name => ADC); procedure Handle_Interrupt_EE_READY is null; pragma Machine_Attribute (Entity => Handle_Interrupt_EE_READY, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_EE_READY, External_Name => EE_READY); #if MCU="ATMEGA2560" then procedure Handle_Interrupt_TIMER3_CAPT is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER3_CAPT, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER3_CAPT, External_Name => TIMER3_CAPT); procedure Handle_Interrupt_TIMER3_COMPA is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER3_COMPA, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER3_COMPA, External_Name => TIMER3_COMPA); procedure Handle_Interrupt_TIMER3_COMPB is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER3_COMPB, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER3_COMPB, External_Name => TIMER3_COMPB); procedure Handle_Interrupt_TIMER3_COMPC is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER3_COMPC, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER3_COMPC, External_Name => TIMER3_COMPC); procedure Handle_Interrupt_TIMER3_OVF is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER3_OVF, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER3_OVF, External_Name => TIMER3_OVF); procedure Handle_Interrupt_USART1_UDRE is null; pragma Machine_Attribute (Entity => Handle_Interrupt_USART1_UDRE, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_USART1_UDRE, External_Name => USART1_UDRE); procedure Handle_Interrupt_USART1_TX is null; pragma Machine_Attribute (Entity => Handle_Interrupt_USART1_TX, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_USART1_TX, External_Name => USART1_TX); #end if; procedure Handle_Interrupt_TWI; pragma Machine_Attribute (Entity => Handle_Interrupt_TWI, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TWI, External_Name => TWI); procedure Handle_Interrupt_SPM_READY is null; pragma Machine_Attribute (Entity => Handle_Interrupt_SPM_READY, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_SPM_READY, External_Name => SPM_READY); #if MCU="ATMEGA2560" then procedure Handle_Interrupt_TIMER4_CAPT is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER4_CAPT, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER4_CAPT, External_Name => TIMER4_CAPT); procedure Handle_Interrupt_TIMER4_COMPA is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER4_COMPA, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER4_COMPA, External_Name => TIMER4_COMPA); procedure Handle_Interrupt_TIMER4_COMPB is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER4_COMPB, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER4_COMPB, External_Name => TIMER4_COMPB); procedure Handle_Interrupt_TIMER4_COMPC is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER4_COMPC, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER4_COMPC, External_Name => TIMER4_COMPC); procedure Handle_Interrupt_TIMER4_OVF is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER4_OVF, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER4_OVF, External_Name => TIMER4_OVF); procedure Handle_Interrupt_TIMER5_CAPT is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER5_CAPT, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER5_CAPT, External_Name => TIMER5_CAPT); procedure Handle_Interrupt_TIMER5_COMPA is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER5_COMPA, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER5_COMPA, External_Name => TIMER5_COMPA); procedure Handle_Interrupt_TIMER5_COMPB is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER5_COMPB, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER5_COMPB, External_Name => TIMER5_COMPB); procedure Handle_Interrupt_TIMER5_COMPC is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER5_COMPC, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER5_COMPC, External_Name => TIMER5_COMPC); procedure Handle_Interrupt_TIMER5_OVF is null; pragma Machine_Attribute (Entity => Handle_Interrupt_TIMER5_OVF, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_TIMER5_OVF, External_Name => TIMER5_OVF); procedure Handle_Interrupt_USART2_RX; pragma Machine_Attribute (Entity => Handle_Interrupt_USART2_RX, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_USART2_RX, External_Name => USART2_RX); procedure Handle_Interrupt_USART2_UDRE is null; pragma Machine_Attribute (Entity => Handle_Interrupt_USART2_UDRE, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_USART2_UDRE, External_Name => USART2_UDRE); procedure Handle_Interrupt_USART2_TX is null; pragma Machine_Attribute (Entity => Handle_Interrupt_USART2_TX, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_USART2_TX, External_Name => USART2_TX); procedure Handle_Interrupt_USART3_RX; pragma Machine_Attribute (Entity => Handle_Interrupt_USART3_RX, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_USART3_RX, External_Name => USART3_RX); procedure Handle_Interrupt_USART3_UDRE is null; pragma Machine_Attribute (Entity => Handle_Interrupt_USART3_UDRE, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_USART3_UDRE, External_Name => USART3_UDRE); procedure Handle_Interrupt_USART3_TX is null; pragma Machine_Attribute (Entity => Handle_Interrupt_USART3_TX, Attribute_Name => "signal"); pragma Export (Convention => C, Entity => Handle_Interrupt_USART3_TX, External_Name => USART3_TX); #end if; end AVR.INTERRUPTS;
oeis/106/A106854.asm
neoneye/loda-programs
11
168113
; A106854: Expansion of 1/(1-x*(1-5*x)). ; 1,1,-4,-9,11,56,1,-279,-284,1111,2531,-3024,-15679,-559,77836,80631,-308549,-711704,831041,4389561,234356,-21713449,-22885229,85682016,200108161,-228301919,-1228842724,-87333129,6056880491,6493546136,-23790856319,-56258586999,62695694596,343988629591,30510156611,-1689432991344,-1841983774399,6605181182321,15815100054316,-17210805857289,-96286306128869,-10232276842424,471199253801921,522360638014041,-1833635630995564,-4445438821065769,4722739333912051,26949933439240896,3336236769680641 mul $0,2 mov $1,1 lpb $0 sub $0,2 sub $1,$2 add $2,$1 mul $2,5 lpe mov $0,$1
Type/Cubical/InductivePath.agda
Lolirofle/stuff-in-agda
6
16809
{-# OPTIONS --cubical #-} module Type.Cubical.InductivePath where open import Functional import Lvl open import Type import Type.Cubical as Cubical open import Type.Cubical.InductiveInterval private variable ℓ : Lvl.Level private variable A B P : Type{ℓ} private variable x y z : A data Path {P : Type{ℓ}} : P → P → Type{ℓ} where intro : (p : Interval → P) → Path(p(𝟎)) (p(𝟏)) point : (x : P) → Path x x point x = intro(const x) pointOn : ∀{x y : A} → Path x y → (Interval → A) pointOn (intro p) = p reverse : Path x y → Path y x reverse(intro f) = intro(f ∘ flip) spaceMap : Path A B → (A → B) spaceMap (intro p) = transp p {- concat : Path x y → Path y z → Path x z concat xy yz = {!xy yz!} -} module _ where private variable X : Type{ℓ} private variable Y : X → Type{ℓ} {- TODO: Define an eliminator for Path and use it to prove this? mapping : ∀{f g : (x : X) → Y(x)} → (∀{x} → Path(f(x)) (g(x))) → Path f g mapping {X = X}{Y = Y}{f = f}{g = g} ppt = intro(i ↦ x ↦ {!pointOn(ppt{x}) i!}) where p : (∀{x} → Path(f(x)) (g(x))) → Interval → (x : X) → Y(x) p ppt i x with ppt{x} ... | q = {!q!} -} mappingPoint : ∀{f g : (x : X) → Y(x)} → Path f g → (∀{x} → Path(f(x)) (g(x))) mappingPoint (intro pfg) {x} = intro (i ↦ pfg i x) module _ where private variable X X₁ X₂ Y Y₁ Y₂ : Type{ℓ} map : (f : X → Y) → ∀{a b} → Path a b → Path (f(a)) (f(b)) map f (intro ab) = intro(f ∘ ab) liftedSpaceMap : (S : X → Type{ℓ}) → ∀{a b} → Path a b → S(a) → S(b) liftedSpaceMap S p = spaceMap(map S p)
source/web-ui-widgets-spin_boxes-generic_floats.ads
godunko/adawebui
2
21727
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2017-2020, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the 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: 5733 $ $Date: 2017-01-28 14:53:14 +0300 (Sat, 28 Jan 2017) $ ------------------------------------------------------------------------------ with Web.Strings; with Web.Core.Connectables.Slots_0.Slots_1.Generic_Emitters; generic type Data_Type is digits <>; with package Float_Slots is new Web.Core.Connectables.Slots_0.Slots_1 (Data_Type); with package Float_Emitters is new Float_Slots.Generic_Emitters; package Web.UI.Widgets.Spin_Boxes.Generic_Floats is type Float_Spin_Box is new Web.UI.Widgets.Spin_Boxes.Abstract_Spin_Box with private; type Float_Spin_Box_Access is access all Float_Spin_Box'Class with Storage_Size => 0; function Get_Value (Self : Float_Spin_Box'Class) return Data_Type; not overriding procedure Set_Value (Self : in out Float_Spin_Box; To : Data_Type); -- Available as slot. ------------- -- Signals -- ------------- function Value_Changed_Signal (Self : in out Float_Spin_Box'Class) return not null access Float_Slots.Signal'Class; ----------- -- Slots -- ----------- function Set_Value_Slot (Self : in out Float_Spin_Box'Class) return Float_Slots.Slot'Class; package Constructors is procedure Initialize (Self : in out Float_Spin_Box'Class; Element : Web.HTML.Inputs.HTML_Input_Element'Class); function Create (Element : Web.HTML.Inputs.HTML_Input_Element'Class) return not null Float_Spin_Box_Access; function Create (Id : Web.Strings.Web_String) return not null Float_Spin_Box_Access; end Constructors; private type Float_Spin_Box is new Web.UI.Widgets.Spin_Boxes.Abstract_Spin_Box with record Last_Value : Data_Type; -- Last valid value. Value_Changed : aliased Float_Emitters.Emitter (Float_Spin_Box'Unchecked_Access); end record; -- overriding procedure Step_Down (Self : in out Float_Spin_Box); -- -- overriding procedure Step_Up (Self : in out Float_Spin_Box); overriding procedure Input_Event (Self : in out Float_Spin_Box); overriding procedure Change_Event (Self : in out Float_Spin_Box); ----------- -- Slots -- ----------- package Set_Value_Slots is new Float_Slots.Generic_Slots (Float_Spin_Box, Set_Value); function Set_Value_Slot (Self : in out Float_Spin_Box'Class) return Float_Slots.Slot'Class renames Set_Value_Slots.To_Slot; end Web.UI.Widgets.Spin_Boxes.Generic_Floats;
gcc-gcc-7_3_0-release/gcc/ada/gnatbind.adb
best08618/asylo
7
19128
<filename>gcc-gcc-7_3_0-release/gcc/ada/gnatbind.adb ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- G N A T B I N D -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2016, 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. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with ALI; use ALI; with ALI.Util; use ALI.Util; with Bcheck; use Bcheck; with Binde; use Binde; with Binderr; use Binderr; with Bindgen; use Bindgen; with Bindusg; with Casing; use Casing; with Csets; with Debug; use Debug; with Fmap; with Namet; use Namet; with Opt; use Opt; with Osint; use Osint; with Osint.B; use Osint.B; with Output; use Output; with Rident; use Rident; with Snames; with Switch; use Switch; with Switch.B; use Switch.B; with Targparm; use Targparm; with Types; use Types; with System.Case_Util; use System.Case_Util; with System.OS_Lib; use System.OS_Lib; with Ada.Command_Line.Response_File; use Ada.Command_Line; procedure Gnatbind is Total_Errors : Nat := 0; -- Counts total errors in all files Total_Warnings : Nat := 0; -- Total warnings in all files Main_Lib_File : File_Name_Type; -- Current main library file First_Main_Lib_File : File_Name_Type := No_File; -- The first library file, that should be a main subprogram if neither -n -- nor -z are used. Text : Text_Buffer_Ptr; Output_File_Name_Seen : Boolean := False; Output_File_Name : String_Ptr := new String'(""); Mapping_File : String_Ptr := null; procedure Add_Artificial_ALI_File (Name : String); -- Artificially add ALI file Name in the closure function Gnatbind_Supports_Auto_Init return Boolean; -- Indicates if automatic initialization of elaboration procedure through -- the constructor mechanism is possible on the platform. function Is_Cross_Compiler return Boolean; -- Returns True iff this is a cross-compiler procedure List_Applicable_Restrictions; -- List restrictions that apply to this partition if option taken procedure Scan_Bind_Arg (Argv : String); -- Scan and process binder specific arguments. Argv is a single argument. -- All the one character arguments are still handled by Switch. This -- routine handles -aO -aI and -I-. The lower bound of Argv must be 1. generic with procedure Action (Argv : String); procedure Generic_Scan_Bind_Args; -- Iterate through the args calling Action on each one, taking care of -- response files. procedure Write_Arg (S : String); -- Passed to Generic_Scan_Bind_Args to print args ----------------------------- -- Add_Artificial_ALI_File -- ----------------------------- procedure Add_Artificial_ALI_File (Name : String) is Id : ALI_Id; pragma Warnings (Off, Id); Std_Lib_File : File_Name_Type; -- Standard library begin Name_Len := Name'Length; Name_Buffer (1 .. Name_Len) := Name; Std_Lib_File := Name_Find; Text := Read_Library_Info (Std_Lib_File, True); Id := Scan_ALI (F => Std_Lib_File, T => Text, Ignore_ED => False, Err => False, Ignore_Errors => Debug_Flag_I); Free (Text); end Add_Artificial_ALI_File; --------------------------------- -- Gnatbind_Supports_Auto_Init -- --------------------------------- function Gnatbind_Supports_Auto_Init return Boolean is function gnat_binder_supports_auto_init return Integer; pragma Import (C, gnat_binder_supports_auto_init, "__gnat_binder_supports_auto_init"); begin return gnat_binder_supports_auto_init /= 0; end Gnatbind_Supports_Auto_Init; ----------------------- -- Is_Cross_Compiler -- ----------------------- function Is_Cross_Compiler return Boolean is Cross_Compiler : Integer; pragma Import (C, Cross_Compiler, "__gnat_is_cross_compiler"); begin return Cross_Compiler = 1; end Is_Cross_Compiler; ---------------------------------- -- List_Applicable_Restrictions -- ---------------------------------- procedure List_Applicable_Restrictions is -- Define those restrictions that should be output if the gnatbind -- -r switch is used. Not all restrictions are output for the reasons -- given below in the list, and this array is used to test whether -- the corresponding pragma should be listed. True means that it -- should not be listed. No_Restriction_List : constant array (All_Restrictions) of Boolean := (No_Standard_Allocators_After_Elaboration => True, -- This involves run-time conditions not checkable at compile time No_Anonymous_Allocators => True, -- Premature, since we have not implemented this yet No_Exception_Propagation => True, -- Modifies code resulting in different exception semantics No_Exceptions => True, -- Has unexpected Suppress (All_Checks) effect No_Implicit_Conditionals => True, -- This could modify and pessimize generated code No_Implicit_Dynamic_Code => True, -- This could modify and pessimize generated code No_Implicit_Loops => True, -- This could modify and pessimize generated code No_Recursion => True, -- Not checkable at compile time No_Reentrancy => True, -- Not checkable at compile time Max_Entry_Queue_Length => True, -- Not checkable at compile time Max_Storage_At_Blocking => True, -- Not checkable at compile time -- The following three should not be partition-wide, so the -- following tests are junk to be removed eventually ??? No_Specification_Of_Aspect => True, -- Requires a parameter value, not a count No_Use_Of_Attribute => True, -- Requires a parameter value, not a count No_Use_Of_Pragma => True, -- Requires a parameter value, not a count others => False); Additional_Restrictions_Listed : Boolean := False; -- Set True if we have listed header for restrictions function Restriction_Could_Be_Set (R : Restriction_Id) return Boolean; -- Returns True if the given restriction can be listed as an additional -- restriction that could be set. ------------------------------ -- Restriction_Could_Be_Set -- ------------------------------ function Restriction_Could_Be_Set (R : Restriction_Id) return Boolean is CR : Restrictions_Info renames Cumulative_Restrictions; begin case R is -- Boolean restriction when All_Boolean_Restrictions => -- The condition for listing a boolean restriction as an -- additional restriction that could be set is that it is -- not violated by any unit, and not already set. return CR.Violated (R) = False and then CR.Set (R) = False; -- Parameter restriction when All_Parameter_Restrictions => -- If the restriction is violated and the level of violation is -- unknown, the restriction can definitely not be listed. if CR.Violated (R) and then CR.Unknown (R) then return False; -- We can list the restriction if it is not set elsif not CR.Set (R) then return True; -- We can list the restriction if is set to a greater value -- than the maximum value known for the violation. else return CR.Value (R) > CR.Count (R); end if; -- No other values for R possible when others => raise Program_Error; end case; end Restriction_Could_Be_Set; -- Start of processing for List_Applicable_Restrictions begin -- Loop through restrictions for R in All_Restrictions loop if not No_Restriction_List (R) and then Restriction_Could_Be_Set (R) then if not Additional_Restrictions_Listed then Write_Eol; Write_Line ("The following additional restrictions may be applied to " & "this partition:"); Additional_Restrictions_Listed := True; end if; Write_Str ("pragma Restrictions ("); declare S : constant String := Restriction_Id'Image (R); begin Name_Len := S'Length; Name_Buffer (1 .. Name_Len) := S; end; Set_Casing (Mixed_Case); Write_Str (Name_Buffer (1 .. Name_Len)); if R in All_Parameter_Restrictions then Write_Str (" => "); Write_Int (Int (Cumulative_Restrictions.Count (R))); end if; Write_Str (");"); Write_Eol; end if; end loop; end List_Applicable_Restrictions; ------------------- -- Scan_Bind_Arg -- ------------------- procedure Scan_Bind_Arg (Argv : String) is pragma Assert (Argv'First = 1); begin -- Now scan arguments that are specific to the binder and are not -- handled by the common circuitry in Switch. if Opt.Output_File_Name_Present and then not Output_File_Name_Seen then Output_File_Name_Seen := True; if Argv'Length = 0 or else (Argv'Length >= 1 and then Argv (1) = '-') then Fail ("output File_Name missing after -o"); else Output_File_Name := new String'(Argv); end if; elsif Argv'Length >= 2 and then Argv (1) = '-' then -- -I- if Argv (2 .. Argv'Last) = "I-" then Opt.Look_In_Primary_Dir := False; -- -Idir elsif Argv (2) = 'I' then Add_Src_Search_Dir (Argv (3 .. Argv'Last)); Add_Lib_Search_Dir (Argv (3 .. Argv'Last)); -- -Ldir elsif Argv (2) = 'L' then if Argv'Length >= 3 then Opt.Bind_For_Library := True; Opt.Ada_Init_Name := new String'(Argv (3 .. Argv'Last) & Opt.Ada_Init_Suffix); Opt.Ada_Final_Name := new String'(Argv (3 .. Argv'Last) & Opt.Ada_Final_Suffix); Opt.Ada_Main_Name := new String'(Argv (3 .. Argv'Last) & Opt.Ada_Main_Name_Suffix); -- This option (-Lxxx) implies -n Opt.Bind_Main_Program := False; else Fail ("Prefix of initialization and finalization procedure names " & "missing in -L"); end if; -- -Sin -Slo -Shi -Sxx -Sev elsif Argv'Length = 4 and then Argv (2) = 'S' then declare C1 : Character := Argv (3); C2 : Character := Argv (4); begin -- Fold to upper case if C1 in 'a' .. 'z' then C1 := Character'Val (Character'Pos (C1) - 32); end if; if C2 in 'a' .. 'z' then C2 := Character'Val (Character'Pos (C2) - 32); end if; -- Test valid option and set mode accordingly if C1 = 'E' and then C2 = 'V' then null; elsif C1 = 'I' and then C2 = 'N' then null; elsif C1 = 'L' and then C2 = 'O' then null; elsif C1 = 'H' and then C2 = 'I' then null; elsif (C1 in '0' .. '9' or else C1 in 'A' .. 'F') and then (C2 in '0' .. '9' or else C2 in 'A' .. 'F') then null; -- Invalid -S switch, let Switch give error, set default of IN else Scan_Binder_Switches (Argv); C1 := 'I'; C2 := 'N'; end if; Initialize_Scalars_Mode1 := C1; Initialize_Scalars_Mode2 := C2; end; -- -aIdir elsif Argv'Length >= 3 and then Argv (2 .. 3) = "aI" then Add_Src_Search_Dir (Argv (4 .. Argv'Last)); -- -aOdir elsif Argv'Length >= 3 and then Argv (2 .. 3) = "aO" then Add_Lib_Search_Dir (Argv (4 .. Argv'Last)); -- -nostdlib elsif Argv (2 .. Argv'Last) = "nostdlib" then Opt.No_Stdlib := True; -- -nostdinc elsif Argv (2 .. Argv'Last) = "nostdinc" then Opt.No_Stdinc := True; -- -static elsif Argv (2 .. Argv'Last) = "static" then Opt.Shared_Libgnat := False; -- -shared elsif Argv (2 .. Argv'Last) = "shared" then Opt.Shared_Libgnat := True; -- -F=mapping_file elsif Argv'Length >= 4 and then Argv (2 .. 3) = "F=" then if Mapping_File /= null then Fail ("cannot specify several mapping files"); end if; Mapping_File := new String'(Argv (4 .. Argv'Last)); -- -Mname elsif Argv'Length >= 3 and then Argv (2) = 'M' then if not Is_Cross_Compiler then Write_Line ("gnatbind: -M not expected to be used on native platforms"); end if; Opt.Bind_Alternate_Main_Name := True; Opt.Alternate_Main_Name := new String'(Argv (3 .. Argv'Last)); -- All other options are single character and are handled by -- Scan_Binder_Switches. else Scan_Binder_Switches (Argv); end if; -- Not a switch, so must be a file name (if non-empty) elsif Argv'Length /= 0 then if Argv'Length > 4 and then Argv (Argv'Last - 3 .. Argv'Last) = ".ali" then Add_File (Argv); else Add_File (Argv & ".ali"); end if; end if; end Scan_Bind_Arg; ---------------------------- -- Generic_Scan_Bind_Args -- ---------------------------- procedure Generic_Scan_Bind_Args is Next_Arg : Positive := 1; begin -- Use low level argument routines to avoid dragging in secondary stack while Next_Arg < Arg_Count loop declare Next_Argv : String (1 .. Len_Arg (Next_Arg)); begin Fill_Arg (Next_Argv'Address, Next_Arg); if Next_Argv'Length > 0 then if Next_Argv (1) = '@' then if Next_Argv'Length > 1 then declare Arguments : constant Argument_List := Response_File.Arguments_From (Response_File_Name => Next_Argv (2 .. Next_Argv'Last), Recursive => True, Ignore_Non_Existing_Files => True); begin for J in Arguments'Range loop Action (Arguments (J).all); end loop; end; end if; else Action (Next_Argv); end if; end if; end; Next_Arg := Next_Arg + 1; end loop; end Generic_Scan_Bind_Args; --------------- -- Write_Arg -- --------------- procedure Write_Arg (S : String) is begin Write_Str (" " & S); end Write_Arg; procedure Check_Version_And_Help is new Check_Version_And_Help_G (Bindusg.Display); procedure Put_Bind_Args is new Generic_Scan_Bind_Args (Write_Arg); procedure Scan_Bind_Args is new Generic_Scan_Bind_Args (Scan_Bind_Arg); -- Start of processing for Gnatbind begin -- Set default for Shared_Libgnat option declare Shared_Libgnat_Default : Character; pragma Import (C, Shared_Libgnat_Default, "__gnat_shared_libgnat_default"); SHARED : constant Character := 'H'; STATIC : constant Character := 'T'; begin pragma Assert (Shared_Libgnat_Default = SHARED or else Shared_Libgnat_Default = STATIC); Shared_Libgnat := (Shared_Libgnat_Default = SHARED); end; -- Carry out package initializations. These are initializations which -- might logically be performed at elaboration time, and we decide to be -- consistent. Like elaboration, the order in which these calls are made -- is in some cases important. Csets.Initialize; Snames.Initialize; -- Scan the switches and arguments. Note that Snames must already be -- initialized (for processing of the -V switch). -- First, scan to detect --version and/or --help Check_Version_And_Help ("GNATBIND", "1992"); -- We need to Scan_Bind_Args first, to set Verbose_Mode, so we know whether -- to Put_Bind_Args. Scan_Bind_Args; if Verbose_Mode then Write_Str (Command_Name); Put_Bind_Args; Write_Eol; end if; if Use_Pragma_Linker_Constructor then if Bind_Main_Program then Fail ("switch -a must be used in conjunction with -n or -Lxxx"); elsif not Gnatbind_Supports_Auto_Init then Fail ("automatic initialisation of elaboration not supported on this " & "platform"); end if; end if; -- Test for trailing -o switch if Opt.Output_File_Name_Present and then not Output_File_Name_Seen then Fail ("output file name missing after -o"); end if; -- Output usage if requested if Usage_Requested then Bindusg.Display; end if; -- Check that the binder file specified has extension .adb if Opt.Output_File_Name_Present and then Output_File_Name_Seen then Check_Extensions : declare Length : constant Natural := Output_File_Name'Length; Last : constant Natural := Output_File_Name'Last; begin if Length <= 4 or else Output_File_Name (Last - 3 .. Last) /= ".adb" then Fail ("output file name should have .adb extension"); end if; end Check_Extensions; end if; Osint.Add_Default_Search_Dirs; -- Acquire target parameters Targparm.Get_Target_Parameters; -- Initialize Cumulative_Restrictions with the restrictions on the target -- scanned from the system.ads file. Then as we read ALI files, we will -- accumulate additional restrictions specified in other files. Cumulative_Restrictions := Targparm.Restrictions_On_Target; -- Acquire configurable run-time mode if Configurable_Run_Time_On_Target then Configurable_Run_Time_Mode := True; end if; -- Output copyright notice if in verbose mode if Verbose_Mode then Write_Eol; Display_Version ("GNATBIND", "1995"); end if; -- Output usage information if no arguments if not More_Lib_Files then if Argument_Count = 0 then Bindusg.Display; else Write_Line ("try ""gnatbind --help"" for more information."); end if; Exit_Program (E_Fatal); end if; -- If a mapping file was specified, initialize the file mapping if Mapping_File /= null then Fmap.Initialize (Mapping_File.all); end if; -- The block here is to catch the Unrecoverable_Error exception in the -- case where we exceed the maximum number of permissible errors or some -- other unrecoverable error occurs. begin -- Initialize binder packages Initialize_Binderr; Initialize_ALI; Initialize_ALI_Source; if Verbose_Mode then Write_Eol; end if; -- Input ALI files while More_Lib_Files loop Main_Lib_File := Next_Main_Lib_File; if First_Main_Lib_File = No_File then First_Main_Lib_File := Main_Lib_File; end if; if Verbose_Mode then if Check_Only then Write_Str ("Checking: "); else Write_Str ("Binding: "); end if; Write_Name (Main_Lib_File); Write_Eol; end if; Text := Read_Library_Info (Main_Lib_File, True); declare Id : ALI_Id; pragma Warnings (Off, Id); begin Id := Scan_ALI (F => Main_Lib_File, T => Text, Ignore_ED => False, Err => False, Ignore_Errors => Debug_Flag_I, Directly_Scanned => True); end; Free (Text); end loop; -- No_Run_Time mode if No_Run_Time_Mode then -- Set standard configuration parameters Suppress_Standard_Library_On_Target := True; Configurable_Run_Time_Mode := True; end if; -- For main ALI files, even if they are interfaces, we get their -- dependencies. To be sure, we reset the Interface flag for all main -- ALI files. for Index in ALIs.First .. ALIs.Last loop ALIs.Table (Index).SAL_Interface := False; end loop; -- Add System.Standard_Library to list to ensure that these files are -- included in the bind, even if not directly referenced from Ada code -- This is suppressed if the appropriate targparm switch is set. Be sure -- in any case that System is in the closure, as it may contain linker -- options. Note that it will be automatically added if s-stalib is -- added. if not Suppress_Standard_Library_On_Target then Add_Artificial_ALI_File ("s-stalib.ali"); else Add_Artificial_ALI_File ("system.ali"); end if; -- Load ALIs for all dependent units for Index in ALIs.First .. ALIs.Last loop Read_Withed_ALIs (Index); end loop; -- Quit if some file needs compiling if No_Object_Specified then raise Unrecoverable_Error; end if; -- Quit with message if we had a GNATprove file if GNATprove_Mode_Specified then Error_Msg ("one or more files compiled in GNATprove mode"); raise Unrecoverable_Error; end if; -- Output list of ALI files in closure if Output_ALI_List then if ALI_List_Filename /= null then Set_List_File (ALI_List_Filename.all); end if; for Index in ALIs.First .. ALIs.Last loop declare Full_Afile : constant File_Name_Type := Find_File (ALIs.Table (Index).Afile, Library); begin Write_Name (Full_Afile); Write_Eol; end; end loop; if ALI_List_Filename /= null then Close_List_File; end if; end if; -- Build source file table from the ALI files we have read in Set_Source_Table; -- If there is main program to bind, set Main_Lib_File to the first -- library file, and the name from which to derive the binder generate -- file to the first ALI file. if Bind_Main_Program then Main_Lib_File := First_Main_Lib_File; Set_Current_File_Name_Index (To => 1); end if; -- Check that main library file is a suitable main program if Bind_Main_Program and then ALIs.Table (ALIs.First).Main_Program = None and then not No_Main_Subprogram then Get_Name_String (Units.Table (ALIs.Table (ALIs.First).First_Unit).Uname); declare Unit_Name : String := Name_Buffer (1 .. Name_Len - 2); begin To_Mixed (Unit_Name); Get_Name_String (ALIs.Table (ALIs.First).Sfile); Add_Str_To_Name_Buffer (":1: "); Add_Str_To_Name_Buffer (Unit_Name); Add_Str_To_Name_Buffer (" cannot be used as a main program"); Write_Line (Name_Buffer (1 .. Name_Len)); Errors_Detected := Errors_Detected + 1; end; end if; -- Perform consistency and correctness checks. Disable these in CodePeer -- mode where we want to be more flexible. if not CodePeer_Mode then Check_Duplicated_Subunits; Check_Versions; Check_Consistency; Check_Configuration_Consistency; end if; -- List restrictions that could be applied to this partition if List_Restrictions then List_Applicable_Restrictions; end if; -- Complete bind if no errors if Errors_Detected = 0 then declare Elab_Order : Unit_Id_Table; use Unit_Id_Tables; begin Find_Elab_Order (Elab_Order, First_Main_Lib_File); if Errors_Detected = 0 and then not Check_Only then Gen_Output_File (Output_File_Name.all, Elab_Order => Elab_Order.Table (First .. Last (Elab_Order))); end if; end; end if; Total_Errors := Total_Errors + Errors_Detected; Total_Warnings := Total_Warnings + Warnings_Detected; exception when Unrecoverable_Error => Total_Errors := Total_Errors + Errors_Detected; Total_Warnings := Total_Warnings + Warnings_Detected; end; -- All done. Set the proper exit status. Finalize_Binderr; Namet.Finalize; if Total_Errors > 0 then Exit_Program (E_Errors); elsif Total_Warnings > 0 then Exit_Program (E_Warnings); else -- Do not call Exit_Program (E_Success), so that finalization occurs -- normally. null; end if; end Gnatbind;
sort_Assembler/sort.asm
marbros/Programing-Memories
0
168208
<filename>sort_Assembler/sort.asm #SimuProc 1.4.3.0 ;-ordena los enteros en la posicion 500+ ;-ordena los flotantes en la posicion 800+ ;-los numeros enteros son precedidos por un 0 ;-los numeros flotantes son precedidos por un 1 ;-si se encuentra un un numero 2 (10) en la posicion ; de la diferenciacion, se finaliza el programa mov bx,202 ;bx = recorrido ldb 300 ;ax = memoria[300+recorrido] cmp 200 ;if(ax==cEntero) jeq 9 ;then goto 9 cmp 201 ;if(ax==cFlotante) jeq 015 ;then goto 015 cmp 205 ;if(ax==terminación) jeq 27 ;then goto 27 hlt ;end ;lectura entero() lda 200 ;ax = cEntero mov bx,203 ;bx = posicionamientoEntero stb 500 ;memoria[500+posicionamientoEnteros]=ax inc 203 ;posicionamientoEntero++ inc 202 ;recorrido++ mov bx,202 ;bx = recorrido ldb 300 ;ax = memoria[300+bx] mov bx,203 ;bx = posicionamientoEntero stb 500 ;memoria[500+posicionamientoEnteros]=ax inc 203 ;posicionamientoEntero++ inc 202 ;recorrido++ jmp 0 ;goto 0 ;lectura flotante() lda 201 ;ax = cFlotante mov bx,204 ;bx = posicionamientoFlotante stb 800 ;memoria[800+posicionamientoEnteros]=ax inc 204 ;posicionamientoFlotante++ inc 202 ;recorrido++ mov bx,202 ;bx = recorrido ldb 300 ;ax = memoria[300+bx] mov bx,204 ;bx = posicionamientoFlotante stb 800 ;memoria[800+posicionamientoFlotante]=ax inc 204 ;posicionamientoFlotante++ inc 202 ;recorrido++ mov bx,202 ;bx = recorrido ldb 300 ;ax = memoria[300+bx] mov bx,204 ;bx = posicionamientoFlotante stb 800 ;memoria[800+posicionamientoFlotante]=ax inc 204 ;posicionamientoFlotante++ inc 202 ;recorrido++ jmp 0 ;goto 0 ;poner terminaciones() lda 205 ;ax = terminación mov bx,203 ;bx = posicionamientoEntero stb 500 ;memoria[500+posicionamientoEnteros]=ax lda 205 ;ax = terminación mov bx,204 ;bx = posicionamientoFlotante stb 800 ;memoria[800+posicionamientoEnteros]=ax ;booble sort int() mov bx,206 ;bx=recorridoIntBooble ldb 500 ; ax = memoria[bx + 500] sta 20A ; aux1 = ax lda 205 ; ax = terminacion cmp 20A ; jeq 063 ;* mov bx,206 ; bx = ldb 500 sta 20A lda 205 cmp 20A jeq 05B ;z inc 206 mov bx,206 ldb 500 sta 208 inc 206 mov bx,206 ldb 500 sta 20A lda 205 cmp 20A jeq 05B ;goto z inc 206 mov bx,206 ldb 500 sta 209 lda 208 cmp 209 jma 04D ;goto x jme 059 ;goto y jeq 059 ;goto y ;cambio ;aqui x dec 206 dec 206 lda 209 mov bx,206 stb 500 inc 206 inc 206 lda 208 mov bx,206 stb 500 dec 206 jmp 033 ;no cambia ;aqui y dec 206 jmp 033 ;fin iteración ;aqui z dec 206 dec 206 lda 205 mov bx,206 stb 500 lda 200 sta 206 jmp 02D ;booble sort FLotante() mov bx,207;v ;aqui v ;bx=recorrido flotante Booble ldb 800 ; ax = memoria[bx + 800] sta 20A ; aux1 = ax lda 205 ; ax = terminacion cmp 20A ; jeq 0B5 ;* cargar numero mov bx,207 ldb 800 sta 20A lda 205 cmp 20A ;compara indicador1 con terminal jeq 0ab ;goto z inc 207 ;int1 mov bx,207 ldb 800 ;carga entero1 sta 208 ;guarda en temp1 inc 207 ;deci1 mov bx,207 ldb 800 ;carga decimal1 sta 20C ;guarda en decimal1 inc 207 ;indicador2 mov bx,207 ldb 800 ;carga indicador2 sta 20A ;guarda en auxiliar1 inc 207 ;int 2 lda 205 cmp 20A ;compara indicador2 con terminal jeq 0ab ;goto z mov bx,207 ldb 800 ;carga entero2 sta 209 ;guarda en temp2 inc 207 ;decimal 2 mov bx,207 ldb 800 ;carga deci2 sta 20D ;guarda en decimal2 lda 209 cmp 208 ;comparacion entre parte entera jma 0a2 ;goto x jme 08b ;goto y jeq 0a5 ;goto w ;cambio ;aqui x mayor dec 207 ;int2 dec 207 ;indi2 dec 207 ;deci1 dec 207 ;int1 lda 209 mov bx,207 stb 800 ;entrega a int1 tmp2 inc 207 ;deci1 lda 20D mov bx,207 stb 800 ;entrega a decimal1 deci2 inc 207 ;indica2 inc 207 ;int2 lda 208 mov bx,207 stb 800 ;entrega a int2 tmp1 inc 207 ;dec2 lda 20C mov bx,207 stb 800 ;entrega a decimal2 deci1 dec 207 ;int2 dec 207 ;indica2 jmp 069 ;go to * ;no cambia ;aqui y dec 207 ;int2 dec 207 ;ind2 jmp 069 ;aqui w lda 20C cmp 20D ;comparacion entre parte decimal jma 08b ;goto x jme 0a2 ;goto y jeq 0a2 ;goto y jmp 069 ;go to * ;variables y constantes #200 0 ;constante cEntero 200 1 ;constante cFlotantes 201 0 ;variable recorrido 202 0 ;variable posicionamientoEntero 203 0 ;variable posicionamientoFlotante 204 10 ;constante terminación 205 0 ;variable recorrido entero sort 206 ;numeros a analizar #300 0 101 0 11 0 1 1 110 101 1 1101111 101111 1 11011 11111 10
Working Disassembly/General/Sprites/Monitors/Map - Monitor.asm
TeamASM-Blur/Sonic-3-Blue-Balls-Edition
0
18351
<filename>Working Disassembly/General/Sprites/Monitors/Map - Monitor.asm Map_Monitor: dc.w word_1DBBA-Map_Monitor dc.w word_1DBC2-Map_Monitor dc.w word_1DBD0-Map_Monitor dc.w word_1DBDE-Map_Monitor dc.w word_1DBEC-Map_Monitor dc.w word_1DBFA-Map_Monitor dc.w word_1DC08-Map_Monitor dc.w word_1DC16-Map_Monitor dc.w word_1DC24-Map_Monitor dc.w word_1DC32-Map_Monitor dc.w word_1DC40-Map_Monitor dc.w word_1DC4E-Map_Monitor word_1DBBA: dc.w 1 ; DATA XREF: ROM:0001DBA2o dc.b $F0, $F, 0, 0, $FF, $F0 word_1DBC2: dc.w 2 ; DATA XREF: ROM:0001DBA2o dc.b $F3, 5, 0, $18, $FF, $F8 dc.b $F0, $F, 0, 0, $FF, $F0 word_1DBD0: dc.w 2 ; DATA XREF: ROM:0001DBA2o dc.b $F3, 5, 3, $10, $FF, $F8 dc.b $F0, $F, 0, 0, $FF, $F0 word_1DBDE: dc.w 2 ; DATA XREF: ROM:0001DBA2o dc.b $F3, 5, 0, $1C, $FF, $F8 dc.b $F0, $F, 0, 0, $FF, $F0 word_1DBEC: dc.w 2 ; DATA XREF: ROM:0001DBA2o dc.b $F3, 5, $20, $20, $FF, $F8 dc.b $F0, $F, 0, 0, $FF, $F0 word_1DBFA: dc.w 2 ; DATA XREF: ROM:0001DBA2o dc.b $F3, 5, 0, $24, $FF, $F8 dc.b $F0, $F, 0, 0, $FF, $F0 word_1DC08: dc.w 2 ; DATA XREF: ROM:0001DBA2o dc.b $F3, 5, 0, $30, $FF, $F8 dc.b $F0, $F, 0, 0, $FF, $F0 word_1DC16: dc.w 2 ; DATA XREF: ROM:0001DBA2o dc.b $F3, 5, 0, $2C, $FF, $F8 dc.b $F0, $F, 0, 0, $FF, $F0 word_1DC24: dc.w 2 ; DATA XREF: ROM:0001DBA2o dc.b $F3, 5, 0, $34, $FF, $F8 dc.b $F0, $F, 0, 0, $FF, $F0 word_1DC32: dc.w 2 ; DATA XREF: ROM:0001DBA2o dc.b $F3, 5, 0, $28, $FF, $F8 dc.b $F0, $F, 0, 0, $FF, $F0 word_1DC40: dc.w 2 ; DATA XREF: ROM:0001DBA2o dc.b $F3, 5, 0, $38, $FF, $F8 dc.b $F0, $F, 0, 0, $FF, $F0 word_1DC4E: dc.w 1 ; DATA XREF: ROM:0001DBA2o dc.b 0, $D, 0, $10, $FF, $F0
src/numerics-sparse_matrices.adb
sciencylab/lagrangian-solver
0
29744
<filename>src/numerics-sparse_matrices.adb package body Numerics.Sparse_Matrices is procedure Dense (Sp : in Sparse_Matrix; A : out Real_Matrix) is Offset_1 : constant Integer := A'First (1) - 1; Offset_2 : constant Integer := A'First (2) - 1; begin for X of A loop X := 0.0; end loop; for J in 1 .. N_Col (Sp) loop for P in Sp.P (J) .. Sp.P (J + 1) - 1 loop A (Sp.I (P) + Offset_1, J + Offset_2) := Sp.X (P); end loop; end loop; end Dense; function Dense (Sp : in Sparse_Matrix) return Real_Matrix is A : Real_Matrix (1 .. N_Row (Sp), 1 .. N_Col (Sp)); begin Dense (Sp, A); return A; end Dense; procedure Print (Mat : in Sparse_Matrix) is separate; ------------------------------------------------------------------ ------------------------------------------------------------------ ------- Basic Getter Functions ----------------------------------- function Norm2 (Item : in Sparse_Matrix) return Real is separate; function N_Row (Mat : in Sparse_Matrix) return Pos is separate; function N_Col (Mat : in Sparse_Matrix) return Pos is separate; ------------------------------------------------------------------ ------------------------------------------------------------------ ------- Functions for Creating Sparse Matrices ------------------- function Sparse (X : in Real_Matrix; Tol : in Real := 10.0 * Real'Small) return Sparse_Matrix is use Ada.Containers; Y : Sparse_Matrix; N : constant Count_Type := Count_Type (X'Length (1) * X'Length (2)); Offset_1 : constant Integer := 1 - X'First (1); Offset_2 : constant Integer := 1 - X'First (2); begin Y.N_Row := X'Length (1); Y.N_Col := X'Length (2); Y.Format := Triplet; Y.I.Reserve_Capacity (N); Y.P.Reserve_Capacity (N); Y.X.Reserve_Capacity (N); for I in X'Range (1) loop for J in X'Range (2) loop if abs (X (I, J)) > Tol then Y.X.Append (X (I, J)); Y.I.Append (I + Offset_1); Y.P.Append (J + Offset_2); end if; end loop; end loop; Compress (Y); return Y; end Sparse; function As_Matrix (X : in Sparse_Vector) return Sparse_Matrix is A : Sparse_Matrix; Eps : constant Real := 10.0 * Real'Small; begin A.Format := CSC; A.N_Col := 1; A.N_Row := X.NMax; A.X := X.X; A.I := X.I; A.P.Reserve_Capacity (2); A.P.Append (1); A.P.Append (Pos (X.I.Length) + 1); return A; end As_Matrix; function "*" (Left, Right : in Sparse_Vector) return Sparse_Matrix is A : constant Sparse_Matrix := As_Matrix (Left); B : constant Sparse_Matrix := As_Matrix (Right); begin return A * Transpose (B); end "*"; function Triplet_To_Matrix (I : in Int_Array; J : in Int_Array; X : in Real_Vector; N_Row : in Pos := 0; N_Col : in Pos := 0; Format : in Sparse_Matrix_Format := CSC) return Sparse_Matrix is separate; ------------------------------------------------------------------ ------------------------------------------------------------------ -------- Essential Tools ----------------------------------------- procedure Remove_Duplicates (Mat : in out Sparse_Matrix) is separate; procedure Compress (Mat : in out Sparse_Matrix) is separate; procedure Convert (Mat : in out Sparse_Matrix) is separate; function Convert (Mat : in Sparse_Matrix) return Sparse_Matrix is Result : Sparse_Matrix := Mat; begin Convert (Result); return Result; end Convert; ------------------------------------------------------------------ ------------------------------------------------------------------ ------- Testing Functions ----------------------------------- function Is_Square_Matrix (A : in Sparse_Matrix) return Boolean is separate; function Has_Same_Dimensions (Left, Right : in Sparse_Matrix) return Boolean is separate; ------------------------------------------------------------------ ------------------------------------------------------------------ ------- Matrix Operations ----------------------------------- function Eye (N : in Pos) return Sparse_Matrix is separate; function Zero (N : in Pos) return Sparse_Matrix is separate; function Omega (N : in Nat; M : in Pos := 0) return Sparse_Matrix is separate; procedure Transposed (Mat : in out Sparse_Matrix) is separate; function Transpose (Mat : in Sparse_Matrix) return Sparse_Matrix is separate; function Mult (Left, Right : in Sparse_Matrix) return Sparse_Matrix is separate; function Plus (Left : in Sparse_Matrix; Right : in Sparse_Matrix) return Sparse_Matrix is separate; function Minus (Left : in Sparse_Matrix; Right : in Sparse_Matrix) return Sparse_Matrix is separate; function Kronecker (A, B : in Sparse_Matrix) return Sparse_Matrix is separate; function Direct_Sum (A, B : in Sparse_Matrix) return Sparse_Matrix is separate; function Permute_By_Col (Mat : in Sparse_Matrix; P : in Int_Array) return Sparse_Matrix is separate; function Permute (Mat : in Sparse_Matrix; P : in Int_Array; By : in Permute_By_Type := Column) return Sparse_Matrix is separate; -- function BiCGSTAB (A : in Sparse_Matrix; -- B : in RVector; -- X0 : in RVector; -- Err : out Real; -- Tol : in Real := 1.0e-10) -- return RVector is separate; function Number_Of_Elements (X : in Sparse_Matrix) return Integer is (Pos (X.X.Length)); function Is_Valid (Mat : in Sparse_Matrix) return Boolean is use IV_Package, RV_Package; begin if Mat.I = IV_Package.Empty_Vector or else Mat.P = IV_Package.Empty_Vector or else Mat.X = RV_Package.Empty_Vector or else Mat.N_Row = 0 or else Mat.N_Col = 0 then return False; end if; return True; end Is_Valid; procedure Triplet_To_Matrix (Result : out Sparse_Matrix; I : in IVector; J : in IVector; X : in RVector; N_Row : in Pos := 0; N_Col : in Pos := 0) is begin Result.N_Row := Pos'Max (N_Row, Max (I)); Result.N_Col := Pos'Max (N_Col, Max (J)); Result.Format := Triplet; Result.X := X; Result.I := I; Result.P := J; Compress (Result); -- turns it into CSC format end Triplet_To_Matrix; function Read_Sparse_Triplet (File_Name : in String; Offset : in Integer := 0) return Sparse_Matrix is use Ada.Text_IO, Ada.Containers, Real_IO, Int_IO; N_Lines : Count_Type := 0; I_Vec : IVector; J_Vec : IVector; X_Vec : RVector; Int_Input : Integer; Real_Input : Real; File : File_Type; Result : Sparse_Matrix; begin Open (File => File, Mode => In_File, Name => File_Name); while not End_Of_File (File) loop Get (File, Int_Input); I_Vec.Append (Int_Input + 1 - Offset); Get (File, Int_Input); J_Vec.Append (Int_Input + 1 - Offset); Get (File, Real_Input); X_Vec.Append (Real_Input); N_Lines := N_Lines + 1; end loop; Close (File); I_Vec.Reserve_Capacity (N_Lines); J_Vec.Reserve_Capacity (N_Lines); X_Vec.Reserve_Capacity (N_Lines); Triplet_To_Matrix (Result, I_Vec, J_Vec, X_Vec); IV_Package.Clear (I_Vec); IV_Package.Reserve_Capacity (I_Vec, 0); IV_Package.Clear (J_Vec); IV_Package.Reserve_Capacity (J_Vec, 0); RV_Package.Clear (X_Vec); RV_Package.Reserve_Capacity (X_Vec, 0); return Result; end Read_Sparse_Triplet; procedure Cumulative_Sum (Item : in out Int_Array) is separate; procedure Add (Mat : in out Sparse_Matrix; I, J : in Nat; X : in Real) is use Ada.Containers; Ind : Pos; begin pragma Assert (Mat.Format = CSC); -- Check if Mat (I, J) exists for K in Mat.P (J) .. Mat.P (J + 1) - 1 loop if Mat.I (K) = I then -- If exists, then add X to Mat (I, J) Mat.X (K) := Mat.X (K) + X; return; end if; end loop; -- Reserve space for 1 more element Mat.X.Reserve_Capacity (Mat.X.Length + 1); Mat.I.Reserve_Capacity (Mat.I.Length + 1); Ind := Mat.P (J); -- need this since for-loop may not occur for P in Mat.P (J) .. Mat.P (J + 1) - 1 loop if Mat.I (P) > I then Ind := P; exit; end if; end loop; -- Insert elements into I and X if Ind <= Pos (Mat.X.Length) then Mat.X.Insert (Before => Ind, New_Item => X); Mat.I.Insert (Before => Ind, New_Item => I); else Mat.X.Append (X); Mat.I.Append (I); end if; -- Fix P for P in J + 1 .. Mat.N_Col + 1 loop Mat.P (P) := Mat.P (P) + 1; end loop; end Add; procedure Set (Mat : in out Sparse_Matrix; I, J : in Nat; X : in Real) is use Ada.Containers; Ind : Pos; begin pragma Assert (Mat.Format = CSC); -- Check if Mat (I, J) exists for K in Mat.P (J) .. Mat.P (J + 1) - 1 loop if Mat.I (K) = I then -- If exists, then set Mat (I, J) to X Mat.X (K) := X; return; end if; end loop; -- Reserve space for 1 more element Mat.X.Reserve_Capacity (Mat.X.Length + 1); Mat.I.Reserve_Capacity (Mat.I.Length + 1); Ind := Mat.P (J); -- need this since for-loop may not occur for P in Mat.P (J) .. Mat.P (J + 1) - 1 loop if Mat.I (P) > I then Ind := P; exit; end if; end loop; -- Insert elements into I and X if Ind <= Pos (Mat.X.Length) then Mat.X.Insert (Before => Ind, New_Item => X); Mat.I.Insert (Before => Ind, New_Item => I); else Mat.X.Append (X); Mat.I.Append (I); end if; -- Fix P for P in J + 1 .. Mat.N_Col + 1 loop Mat.P (P) := Mat.P (P) + 1; end loop; end Set; procedure Scatter (A : in Sparse_Matrix; J : in Integer; β : in Real; W : in out Int_Array; X : in out Real_Vector; Mark : in Integer; C : in out Sparse_Matrix; Nz : in out Integer) is use IV_Package; I : Integer; Cur : Cursor; L, R : Pos; begin Cur := To_Cursor (A.P, J); L := A.P (Cur); Next (Cur); R := A.P (Cur) - 1; for P in L .. R loop I := A.I (P); if W (I) < Mark then C.I.Append (I); X (I) := β * A.X (P); Nz := Nz + 1; W (I) := Mark; else X (I) := X (I) + β * A.X (P); end if; end loop; end Scatter; function Mult_M_SV (A : in Sparse_Matrix; X : in Sparse_Vector) return Sparse_Vector is separate; function Diag (X : in Sparse_Matrix) return Sparse_Vector is Y : Sparse_Vector; begin Set_Length (Y, X.N_Col); for P in 1 .. X.N_Col loop for I in X.P (P) .. X.P (P + 1) - 1 loop if X.I (I) = P then Set (Y, P, X.X (I)); exit; end if; end loop; end loop; return Y; end Diag; function Diag (X : in Sparse_Vector) return Sparse_Matrix is Y : Sparse_Matrix; begin Triplet_To_Matrix (Y, X.I, X.I, X.X, X.NMax, X.NMax); return Y; end Diag; procedure Set_Diag (X : in out Sparse_Matrix; To : in Sparse_Vector) is K : Integer; begin for I in 1 .. Integer (To.I.Length) loop K := To.I (I); Set (X, K, K, To.X (I)); end loop; end Set_Diag; function "-" (X : in Sparse_Matrix) return Sparse_Matrix is Y : Sparse_Matrix := X; begin for Item of Y.X loop Item := -Item; end loop; return Y; end "-"; function "*" (Left : in Real; Right : in Sparse_Matrix) return Sparse_Matrix is C : Sparse_Matrix := Right; begin for X of C.X loop X := X * Left; end loop; return C; end "*"; function Add_Column (X : in Sparse_Matrix; V : in Sparse_Vector) return Sparse_Matrix is use Ada.Containers; Y : Sparse_Matrix := X; N : Nat := Nat (X.X.Length); P : Nat := Nat (X.P.Length); M : Nat := Nat (V.X.Length); begin pragma Assert (X.N_Row = V.NMax); Y.N_Col := X.N_Col + 1; Y.X.Reserve_Capacity (Count_Type (N + V.NMax)); Y.I.Reserve_Capacity (Count_Type (N + V.NMax)); Y.P.Reserve_Capacity (Count_Type (P + 1)); Y.P.Append (X.P (P) + M); for J in 1 .. M loop Y.X.Append (V.X (J)); Y.I.Append (V.I (J)); end loop; return Y; end Add_Column; procedure To_Triplet (A : in Sparse_Matrix; I : out IVector; J : out IVector; X : out RVector; N_Row : out Pos; N_Col : out Pos) is use Ada.Containers; N : constant Count_Type := A.X.Length; begin N_Row := A.N_Row; N_Col := A.N_Col; I.Reserve_Capacity (N); J.Reserve_Capacity (N); X.Reserve_Capacity (N); for P in 1 .. N_Col loop for K in A.P (P) .. A.P (P + 1) - 1 loop J.Append (P); I.Append (A.I (K)); X.Append (A.X (K)); end loop; end loop; end To_Triplet; function Remove_1st_N (A : in Sparse_Matrix; N : in Pos) return Sparse_Matrix is use Ada.Containers; B : Sparse_Matrix; K : Pos := 1; begin B.Format := A.Format; pragma Assert (A.N_Col > N); pragma Assert (A.N_Row > N); B.N_Row := A.N_Row - N; B.N_Col := A.N_Col - N; B.P.Reserve_Capacity (A.P.Length - Count_Type (N)); B.I.Reserve_Capacity (A.I.Length); B.X.Reserve_Capacity (A.X.Length); B.P.Append (1); for J in N + 1 .. Pos (A.P.Length) - 1 loop for I in A.P (J) .. A.P (J + 1) - 1 loop if A.I (I) > N then K := K + 1; B.I.Append (A.I (I) - N); B.X.Append (A.X (I)); end if; end loop; B.P.Append (K); end loop; B.P.Reserve_Capacity (B.P.Length); B.I.Reserve_Capacity (B.I.Length); B.X.Reserve_Capacity (B.X.Length); return B; end Remove_1st_N; procedure Testing_Stuff (A : in Sparse_Matrix) is use Real_IO, Int_IO, Ada.Text_IO; I, J : IVector; X : RVector; N_Row, N_Col : Pos; begin New_Line; Put_Line ("Testing stuf . . ."); Put ("N_Row = "); Put (A.N_Row); New_Line; Put ("N_Col = "); Put (A.N_Col); New_Line; Put ("x.length = "); Put (Pos (A.X.Length)); New_Line; Put ("i.length = "); Put (Pos (A.I.Length)); New_Line; Put ("p.length = "); Put (Pos (A.P.Length)); New_Line; New_Line; To_Triplet (A, I, J, X, N_Row, N_Col); for K in 1 .. Pos (I.Length) loop Put (I (K)); Put (" "); Put (J (K)); Put (" "); Put (X (K)); New_Line; end loop; Put_Line ("finished testing stuff."); New_Line; end Testing_Stuff; function "*" (A : in Sparse_Matrix; X : in Real_Vector) return Sparse_Vector is Y : Sparse_Vector := Sparse (X); begin return A * Y; end "*"; end Numerics.Sparse_Matrices;
dos/mssw.asm
minblock/msdos
0
15330
; ; Microsoft Confidential ; Copyright (C) Microsoft Corporation 1991 ; All Rights Reserved. ; ; SCCSID = @(#)ibmsw.asm 1.1 85/04/10 IBM EQU ibmver WANG EQU FALSE ; Set this switch to cause DOS to move itself to the end of memory HIGHMEM EQU FALSE ; Turn on switch below to allow testing disk code with DEBUG. It sets ; up a different stack for disk I/O (functions > 11) than that used for ; character I/O which effectively makes the DOS re-entrant. IF IBM ESCCH EQU 0 ; character to begin escape seq. CANCEL EQU 27 ;Cancel with escape TOGLPRN EQU TRUE ;One key toggles printer echo ZEROEXT EQU TRUE ELSE ESCCH EQU 1BH CANCEL EQU "X"-"@" ;Cancel with Ctrl-X TOGLPRN EQU FALSE ;Separate keys for printer echo on ;and off ZEROEXT EQU TRUE ENDIF 
src/offmt_lib-detection.ads
Fabien-Chouteau/offmt-tool
0
15285
<filename>src/offmt_lib-detection.ads with Libadalang.Analysis; package Offmt_Lib.Detection is package LAL renames Libadalang.Analysis; function Check_Defmt_Log_Call (Node : LAL.Call_Stmt'Class; Call : out LAL.Call_Expr) return Boolean; -- Return True if Node is a valid Offmt.Log (<fmt>) call statement end Offmt_Lib.Detection;
programs/oeis/078/A078633.asm
neoneye/loda
22
29660
<reponame>neoneye/loda ; A078633: Smallest number of sticks of length 1 needed to construct n squares with sides of length 1. ; 4,7,10,12,15,17,20,22,24,27,29,31,34,36,38,40,43,45,47,49,52,54,56,58,60,63,65,67,69,71,74,76,78,80,82,84,87,89,91,93,95,97,100,102,104,106,108,110,112,115,117,119,121,123,125,127,130,132,134,136,138,140,142,144,147,149,151,153,155,157,159,161,164,166,168,170,172,174,176,178,180,183,185,187,189,191,193,195,197,199,202,204,206,208,210,212,214,216,218,220 mul $0,4 mov $1,$0 mov $2,1 lpb $1 add $0,2 add $2,2 sub $1,$2 lpe div $0,2 add $0,4
oeis/015/A015459.asm
neoneye/loda-programs
11
177492
<reponame>neoneye/loda-programs<filename>oeis/015/A015459.asm ; A015459: q-Fibonacci numbers for q=2. ; Submitted by <NAME> ; 0,1,1,3,7,31,143,1135,10287,155567,2789039,82439343,2938415279,171774189743,12207523172527,1419381685547183,201427441344229551,46711726513354322095,13247460522448782176431,6135846878080826487812271,3478878138074894381346140335,3220429766153315252023466078383,3651088552276173766066433913991343,6757381813500233561177582367127056559,15320532700979664965268685613556672966831,56700347672483546918128025551154520340246703,257092586707071734276863364600283985126224769199 mov $1,3 lpb $0 sub $0,1 mov $2,$3 add $3,$1 mov $1,2 pow $1,$0 mul $1,$2 lpe mov $0,$3 div $0,3
libvpx/build/asm_enc_offsets.asm
ooyanglinoo/Plugin_Videoplayer
4
6471
<filename>libvpx/build/asm_enc_offsets.asm vp8_block_coeff EQU 8 vp8_block_zbin EQU 40 vp8_block_round EQU 56 vp8_block_quant EQU 16 vp8_block_quant_fast EQU 24 vp8_block_zbin_extra EQU 64 vp8_block_zrun_zbin_boost EQU 48 vp8_block_quant_shift EQU 32 vp8_blockd_qcoeff EQU 0 vp8_blockd_dequant EQU 24 vp8_blockd_dqcoeff EQU 8 vp8_blockd_eob EQU 40 vp8_block_base_src EQU 72 vp8_block_src EQU 80 vp8_block_src_diff EQU 0 vp8_block_src_stride EQU 84 vp8_blockd_predictor EQU 16 vp8_writer_lowvalue EQU 0 vp8_writer_range EQU 4 vp8_writer_count EQU 8 vp8_writer_pos EQU 12 vp8_writer_buffer EQU 16 vp8_writer_buffer_end EQU 24 vp8_writer_error EQU 32 tokenextra_token EQU 10 tokenextra_extra EQU 8 tokenextra_context_tree EQU 0 tokenextra_skip_eob_node EQU 11 TOKENEXTRA_SZ EQU 16 vp8_extra_bit_struct_sz EQU 24 vp8_token_value EQU 0 vp8_token_len EQU 4 vp8_extra_bit_struct_tree EQU 0 vp8_extra_bit_struct_prob EQU 8 vp8_extra_bit_struct_len EQU 16 vp8_extra_bit_struct_base_val EQU 20 vp8_comp_tplist EQU 173104 vp8_comp_common EQU 105920 vp8_comp_bc EQU 118400 vp8_writer_sz EQU 48 tokenlist_start EQU 0 tokenlist_stop EQU 8 TOKENLIST_SZ EQU 16 vp8_common_mb_rows EQU 2536 END
bugs/bug04.ada
daveshields/AdaEd
3
29950
generic package gene is end gene; with text_io; package body gene is -- Different error message with/without line below commented out --package flt_io is new text_io.float_io(float); procedure test is begin text_io.new_line; end; end gene; with gene; procedure bug1 is package my_pkg is new gene; begin null; end bug1;
thirdparty/adasdl/thin/adasdl/AdaSDL_mixer/sdl_mixer.ads
Lucretia/old_nehe_ada95
0
28548
-- ----------------------------------------------------------------- -- -- ASDL_Mixer -- -- Binding to SDL mixer lib -- -- Copyright (C) 2001 A.M.F.Vargas -- -- <NAME> -- -- <NAME> - Azores - Portugal -- -- E-mail: <EMAIL> -- -- ----------------------------------------------------------------- -- -- -- -- 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. -- -- ----------------------------------------------------------------- -- -- **************************************************************** -- -- This is an Ada binding to SDL_mixer lib from Sam Lantinga at -- -- www.libsld.org -- -- **************************************************************** -- -- In order to help the Ada programmer, the comments in this file -- -- are, in great extent, a direct copy of the original text in the -- -- SDL_mixer header files. -- -- **************************************************************** -- with System; with Interfaces.C.Strings; with SDL.Audio; with SDL.Types; use SDL.Types; with SDL.RWops; with SDL.Error; package SDL_Mixer is package A renames SDL.Audio; package C renames Interfaces.C; package RW renames SDL.RWops; package CS renames Interfaces.C.Strings; package Er renames SDL.Error; -- The default mixer has 8 simultaneous mixing channels MIX_CHANNELS : constant := 8; -- Good default values for a PC soundcard MIX_DEFAULT_FREQUENCY : constant := 22050; MIX_DEFAULT_FORMAT : constant := A.AUDIO_S16; MIX_DEFAULT_CHANNELS : constant := 2; MIX_MAX_VOLUME : constant := 128; -- Volume of a chunk -- The internal format for an audion chunk type Chunk is record allocated : C.int; abuf : Uint8_ptr; alen : Uint32; volume : Uint8; -- Per-sample volume, 0-128 end record; pragma Convention (C, Chunk); type Chunk_ptr is access Chunk; pragma Convention (C, Chunk_ptr); null_Chunk_ptr : constant Chunk_ptr := null; -- The different fading types supported type Fading is ( NO_FADING, FADING_OUT, FADING_IN); pragma Convention (C, Fading); -- The internal format for a music chunk interpreted via mikmod type Music_ptr is new System.Address; null_Music_ptr : constant Music_ptr := Music_ptr (System.Null_Address); -- Open the mixer with a certain audio format function OpenAudio ( frequency : C.int; format : A.Format_Flag; channels : C.int; chunksize : C.int) return C.int; pragma Import (C, OpenAudio, "Mix_OpenAudio"); -- Dynamically change the number of channels managed by the mixer. -- If decreasing the number of channels, the upper channels are -- stopped. -- This function returns the new number of allocated channels. function AllocateChannels (numchans : C.int) return C.int; pragma Import (C, AllocateChannels, "Mix_AllocateChannels"); -- Find out what the actual audio device parameters are. -- This function returns 1 if the audio has been opened, 0 otherwise. function QuerySpec ( frequency : int_ptr; format : A.Format_Flag_ptr; -- Uint16_ptr; channels : int_ptr) return C.int; pragma Import (C, QuerySpec, "Mix_QuerySpec"); procedure Query_Spec ( frequency : out C.int; format : out A.Format_Flag; channels : out C.int); pragma Import (C, Query_Spec, "Mix_QuerySpec"); procedure Query_Spec_VP ( Result : out C.int; frequency : out C.int; format : out A.Format_Flag_ptr; -- Uint16; channels : out C.int); pragma Import (C, Query_Spec_VP, "Mix_QuerySpec"); pragma Import_Valued_Procedure (Query_Spec_VP); -- Load a wave file or a music (.mod .s3m .it .xm) file function LoadWAV_RW ( src : RW.RWops_ptr; freesrc : C.int) return Chunk_ptr; pragma Import (C, LoadWAV_RW, "Mix_LoadWAV_RW"); function LoadWAV (file : CS.chars_ptr) return Chunk_ptr; pragma Inline (LoadWAV); function Load_WAV (file : String) return Chunk_ptr; pragma Inline (Load_WAV); function LoadMUS (file : CS.chars_ptr) return Music_ptr; pragma Import (C, LoadMUS, "Mix_LoadMUS"); function Load_MUS (file : String) return Music_ptr; pragma Inline (Load_MUS); -- This hasn't been hooked into music.c yet -- Load a music file from an SDL_RWop object (MikMod-specific currently) -- <NAME> (<EMAIL>) April 2000 -- function LoadMUS_RW (r_w : RW.RWops_ptr) return Music_ptr; -- Load a wave file of the mixer format from a memory buffer function QuickLoad_WAV (mem : Uint8_ptr) return Chunk_ptr; pragma Import (C, QuickLoad_WAV, "Mix_QuickLoad_WAV"); -- Free an audio chunk previously loaded procedure FreeChunk (chunk : Chunk_ptr); pragma Import (C, FreeChunk, "Mix_FreeChunk"); procedure FreeMusic (music : Music_ptr); pragma Import (C, FreeMusic, "Mix_FreeMusic"); -- Set a function that is called after all mixing is performed. -- This can be used to provide real-time visual display of the audio stream -- or add a custom mixer filter for the stream data. type Mix_Proc_Type is access procedure (udata : System.Address; stream : Uint8_ptr; len : C.int); pragma Convention (C, Mix_Proc_Type); procedure SetPostMix ( mix_proc : Mix_Proc_Type; arg : System.Address); pragma Import (C, SetPostMix, "Mix_SetPostMix"); -- Add your own music player or additional mixer function. -- If 'mix_func' is NULL, the default music player is re-enabled. procedure HookMusic ( mix_proc : Mix_Proc_Type; arg : System.Address); pragma Import (C, HookMusic, "Mix_HookMusic"); type Music_Finished_Type is access procedure; -- Add your own callback when the music has finished playing. procedure HookMusicFinished ( music_finished : Music_Finished_Type); pragma Import (C, HookMusicFinished, "Mix_HookMusicFinished"); -- Get a pointer to the user data for the current music hook function GetMusicHookData return System.Address; pragma Import (C, GetMusicHookData, "Mix_GetMusicHookData"); -- Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate -- them dynamically to the next sample if requested with a -1 value below. -- Returns the number of reserved channels. function ReservChannels (num : C.int) return C.int; pragma Import (C, ReservChannels, "Mix_ReservChannels"); -- Channel grouping functions -- Attach a tag to a channel. A tag can be assigned to several mixer -- channels, to form groups of channels. -- If 'tag' is -1, the tag is removed (actually -1 is the tag used to -- represent the group of all the channels). -- Returns true if everything was OK. function GroupChannel ( which : C.int; tag : C.int) return C.int; pragma Import (C, GroupChannel, "Mix_GroupChannel"); -- Assign several consecutive channels to a group function GroupChannels ( from : C.int; to : C.int; tag : C.int) return C.int; pragma Import (C, GroupChannels, "Mix_GroupChannels"); -- Finds the first available channel in a group of channels function GroupAvailable (tag : C.int) return C.int; pragma Import (C, GroupAvailable, "Mix_GroupAvailable"); -- Returns the number of channels in a group. This is also a subtle -- way to get the total number of channels when 'tag' is -1 function GroupCount (tag : C.int) return C.int; pragma Import (C, GroupCount, "Mix_GroupCount"); -- Finds the "oldest" sample playing in a group of channels function GroupOldest (tag : C.int) return C.int; pragma Import (C, GroupOldest, "Mix_GroupOldest"); -- Finds the "most recent" (i.e. last) sample playing in a group of channels function GroupNewer (tag : C.int) return C.int; pragma Import (C, GroupNewer, "Mix_GroupNewer"); -- Play an audio chunk on a specific channel. -- If the specified channel is -1, play on the first free channel. -- If 'loops' is greater than zero, loop the sound that many times. -- If 'loops' is -1, loop inifinitely (~65000 times). -- Returns which channel was used to play the sound. function PlayChannel ( channel : C.int; chunk : Chunk_ptr; loops : C.int) return C.int; procedure PlayChannel ( channel : C.int; chunk : Chunk_ptr; loops : C.int); pragma Inline (PlayChannel); -- The same as above, but the sound is played at most 'ticks' milliseconds function PlayChannelTimed ( channel : C.int; chunk : Chunk_ptr; loops : C.int; ticks : C.int) return C.int; procedure PlayChannelTimed ( channel : C.int; chunk : Chunk_ptr; loops : C.int; ticks : C.int); pragma Import (C, PlayChannelTimed, "Mix_PlayChannelTimed"); function PlayMusic ( music : Music_ptr; loops : C.int) return C.int; procedure PlayMusic ( music : Music_ptr; loops : C.int); pragma Import (C, PlayMusic, "Mix_PlayMusic"); -- Fade in music or a channel over "ms" milliseconds, same semantics -- as the "Play" functions function FadeInMusic ( music : Music_ptr; loops : C.int; ms : C.int) return C.int; procedure FadeInMusic ( music : Music_ptr; loops : C.int; ms : C.int); pragma Import (C, FadeInMusic, "Mix_FadeInMusic"); function FadeInChannel ( channel : C.int; chunk : Chunk_ptr; loops : C.int; ms : C.int) return C.int; pragma Inline (FadeInChannel); function FadeInChannelTimed ( channel : C.int; chunk : Chunk_ptr; loops : C.int; ms : C.int; ticks : C.int) return C.int; pragma Import (C, FadeInChannelTimed, "Mix_FadeInChannelTimed"); -- Set the volume in the range of 0-128 of a specific channel or chunk. -- If the specified channel is -1, set volume for all channels. -- Returns the original volume. -- If the specified volume is -1, just return the current volume. function Volume ( channel : C.int; volume : C.int) return C.int; pragma Import (C, Volume, "Mix_Volume"); function VolumeChunk ( chunk : Chunk_ptr; volume : C.int) return C.int; pragma Import (C, VolumeChunk, "Mix_VolumeChunk"); function VolumeMusic (volume : C.int) return C.int; pragma Import (C, VolumeMusic, "Mix_VolumeMusic"); -- Halt playing of a particular channel function HaltChannel (channel : C.int) return C.int; pragma Import (C, HaltChannel, "Mix_HaltChannel"); function HaltGroup (tag : C.int) return C.int; pragma Import (C, HaltGroup, "Mix_HaltGroup"); function HaltMusic return C.int; procedure HaltMusic; pragma Import (C, HaltMusic, "Mix_HaltMusic"); -- Change the expiration delay for a particular channel. -- The sample will stop playing after the 'ticks' milliseconds have elapsed, -- or remove the expiration if 'ticks' is -1 function ExpireChannel ( channel : C.int; ticks : C.int) return C.int; pragma Import (C, ExpireChannel, "Mix_ExpireChannel"); -- Halt a channel, fading it out progressively till it's silent -- The ms parameter indicates the number of milliseconds the fading -- will take. function FadeOutChannel ( which : C.int; ms : C.int) return C.int; procedure FadeOutChannel ( which : C.int; ms : C.int); pragma Import (C, FadeOutChannel, "Mix_FadeOutChannel"); function FadeOutGroup ( tag : C.int; ms : C.int) return C.int; pragma Import (C, FadeOutGroup, "Mix_FadeOutGroup"); function FadeOutMusic (ms : C.int) return C.int; procedure FadeOutMusic (ms : C.int); pragma Import (C, FadeOutMusic, "Mix_FadeOutMusic"); -- Query the fading status of a cYhannel function FadingMusic return Fading; pragma Import (C, FadingMusic, "Mix_FadingMusic"); function FadingChannel (which : C.int) return Fading; pragma Import (C, FadingChannel, "Mix_FadingChannel"); -- Pause/Resume a particular channel procedure Pause (channel : C.int); pragma Import (C, Pause, "Mix_Pause"); procedure Resume (channel : C.int); pragma Import (C, Resume, "Mix_Resume"); function Paused (channel : C.int) return C.int; pragma Import (C, Paused, "Mix_Paused"); -- Pause/Resume the music stream procedure PauseMusic; pragma Import (C, PauseMusic, "Mix_PauseMusic"); procedure ResumeMusic; pragma Import (C, ResumeMusic, "Mix_ResumeMusic"); procedure RewindMusic; pragma Import (C, RewindMusic, "Mix_RewindMusic"); function PausedMusic return C.int; pragma Import (C, PausedMusic, "Mix_PausedMusic"); -- Check the status of a specific channel. -- If the specified channel is -1, check all channels. function Playing (channel : C.int) return C.int; pragma Import (C, Playing, "Mix_Playing"); function PlayingMusic return C.int; pragma Import (C, PlayingMusic, "Mix_PlayingMusic"); -- Stop music and set external music playback command function SetMusicCMD (command : CS.chars_ptr) return C.int; procedure SetMusicCMD (command : CS.chars_ptr); pragma Import (C, SetMusicCMD, "Mix_SetMusicCMD"); function Set_Music_CMD (command : String) return Integer; pragma Inline (Set_Music_CMD); procedure Set_Music_CMD (command : String); pragma Inline (Set_Music_CMD); procedure CloseAudio; pragma Import (C, CloseAudio, "Mix_CloseAudio"); -- We'll use SDL for reporting errors procedure SetError (fmt : CS.chars_ptr) renames Er.SetError; procedure Set_Error (fmt : String) renames Er.Set_Error; function GetError return CS.chars_ptr renames Er.GetError; function Get_Error return String renames Er.Get_Error; end SDL_Mixer;
Definition/LogicalRelation/Substitution/Introductions/Transp.agda
CoqHott/logrel-mltt
2
8363
{-# OPTIONS --safe #-} open import Definition.Typed.EqualityRelation module Definition.LogicalRelation.Substitution.Introductions.Transp {{eqrel : EqRelSet}} where open EqRelSet {{...}} open import Definition.Untyped as U hiding (wk) open import Definition.Untyped.Properties open import Definition.Typed open import Definition.Typed.Properties open import Definition.Typed.Weakening as T hiding (wk; wkTerm; wkEqTerm) open import Definition.Typed.RedSteps open import Definition.LogicalRelation open import Definition.LogicalRelation.ShapeView open import Definition.LogicalRelation.Irrelevance as I open import Definition.LogicalRelation.Weakening open import Definition.LogicalRelation.Properties open import Definition.LogicalRelation.Application open import Definition.LogicalRelation.Substitution open import Definition.LogicalRelation.Substitution.Properties open import Definition.LogicalRelation.Substitution.Irrelevance as S open import Definition.LogicalRelation.Substitution.Reflexivity open import Definition.LogicalRelation.Substitution.Introductions.Sigma open import Definition.LogicalRelation.Substitution.Introductions.Fst open import Definition.LogicalRelation.Substitution.Introductions.Pi open import Definition.LogicalRelation.Substitution.Introductions.Lambda open import Definition.LogicalRelation.Substitution.Introductions.Application open import Definition.LogicalRelation.Substitution.Introductions.Cast open import Definition.LogicalRelation.Substitution.Introductions.Id open import Definition.LogicalRelation.Substitution.Introductions.SingleSubst open import Definition.LogicalRelation.Substitution.MaybeEmbed open import Definition.LogicalRelation.Substitution.Escape open import Definition.LogicalRelation.Substitution.Introductions.Universe open import Definition.LogicalRelation.Substitution.Reduction open import Definition.LogicalRelation.Substitution.Weakening open import Definition.LogicalRelation.Substitution.ProofIrrelevance open import Tools.Product import Tools.PropositionalEquality as PE IdSymᵗᵛ : ∀ {A l t u e Γ} ([Γ] : ⊩ᵛ Γ) ([U] : Γ ⊩ᵛ⟨ ∞ ⟩ U l ^ [ ! , next l ] / [Γ]) ([AU] : Γ ⊩ᵛ⟨ ∞ ⟩ A ∷ U l ^ [ ! , next l ] / [Γ] / [U]) ([A] : Γ ⊩ᵛ⟨ ∞ ⟩ A ^ [ ! , ι l ] / [Γ]) ([t] : Γ ⊩ᵛ⟨ ∞ ⟩ t ∷ A ^ [ ! , ι l ] / [Γ] / [A]) ([u] : Γ ⊩ᵛ⟨ ∞ ⟩ u ∷ A ^ [ ! , ι l ] / [Γ] / [A]) ([Id] : Γ ⊩ᵛ⟨ ∞ ⟩ Id A t u ^ [ % , ι l ] / [Γ]) → ([Idinv] : Γ ⊩ᵛ⟨ ∞ ⟩ Id A u t ^ [ % , ι l ] / [Γ]) → ([e] : Γ ⊩ᵛ⟨ ∞ ⟩ e ∷ Id A t u ^ [ % , ι l ] / [Γ] / [Id] ) → Γ ⊩ᵛ⟨ ∞ ⟩ Idsym A t u e ∷ Id A u t ^ [ % , ι l ] / [Γ] / [Idinv] IdSymᵗᵛ {A} {l} {t} {u} {e} {Γ} [Γ] [U] [AU] [A] [t] [u] [Id] [Idinv] [e] = validityIrr {A = Id A u t} {t = Idsym A t u e} [Γ] [Idinv] λ {Δ} {σ} ⊢Δ [σ] → PE.subst (λ X → Δ ⊢ X ∷ subst σ (Id A u t) ^ [ % , ι l ] ) (PE.sym (subst-Idsym σ A t u e)) (Idsymⱼ {A = subst σ A} {x = subst σ t} {y = subst σ u} (escapeTerm (proj₁ ([U] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([AU] ⊢Δ [σ]))) (escapeTerm (proj₁ ([A] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([t] ⊢Δ [σ]))) (escapeTerm (proj₁ ([A] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([u] ⊢Δ [σ]))) (escapeTerm (proj₁ ([Id] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([e] ⊢Δ [σ])))) abstract transpᵗᵛ : ∀ {A P l t s u e Γ} ([Γ] : ⊩ᵛ Γ) ([A] : Γ ⊩ᵛ⟨ ∞ ⟩ A ^ [ ! , l ] / [Γ]) ([P] : Γ ∙ A ^ [ ! , l ] ⊩ᵛ⟨ ∞ ⟩ P ^ [ % , l ] / (_∙_ {A = A} [Γ] [A])) ([t] : Γ ⊩ᵛ⟨ ∞ ⟩ t ∷ A ^ [ ! , l ] / [Γ] / [A]) ([s] : Γ ⊩ᵛ⟨ ∞ ⟩ s ∷ P [ t ] ^ [ % , l ] / [Γ] / substS {A} {P} {t} [Γ] [A] [P] [t]) ([u] : Γ ⊩ᵛ⟨ ∞ ⟩ u ∷ A ^ [ ! , l ] / [Γ] / [A]) ([Id] : Γ ⊩ᵛ⟨ ∞ ⟩ Id A t u ^ [ % , l ] / [Γ]) → ([e] : Γ ⊩ᵛ⟨ ∞ ⟩ e ∷ Id A t u ^ [ % , l ] / [Γ] / [Id] ) → Γ ⊩ᵛ⟨ ∞ ⟩ transp A P t s u e ∷ P [ u ] ^ [ % , l ] / [Γ] / substS {A} {P} {u} [Γ] [A] [P] [u] transpᵗᵛ {A} {P} {l} {t} {s} {u} {e} {Γ} [Γ] [A] [P] [t] [s] [u] [Id] [e] = validityIrr {A = P [ u ]} {t = transp A P t s u e } [Γ] (substS {A} {P} {u} [Γ] [A] [P] [u]) λ {Δ} {σ} ⊢Δ [σ] → let [liftσ] = liftSubstS {F = A} [Γ] ⊢Δ [A] [σ] [A]σ = proj₁ ([A] {Δ} {σ} ⊢Δ [σ]) [P[t]]σ = I.irrelevance′ (singleSubstLift P t) (proj₁ (substS {A} {P} {t} [Γ] [A] [P] [t] {Δ} {σ} ⊢Δ [σ])) X = transpⱼ (escape [A]σ) (escape (proj₁ ([P] {Δ ∙ subst σ A ^ [ ! , l ]} {liftSubst σ} (⊢Δ ∙ (escape [A]σ)) [liftσ]))) (escapeTerm [A]σ (proj₁ ([t] ⊢Δ [σ]))) (escapeTerm [P[t]]σ (I.irrelevanceTerm′ (singleSubstLift P t) PE.refl PE.refl (proj₁ (substS {A} {P} {t} [Γ] [A] [P] [t] {Δ} {σ} ⊢Δ [σ])) [P[t]]σ (proj₁ ([s] ⊢Δ [σ])))) (escapeTerm [A]σ (proj₁ ([u] ⊢Δ [σ]))) (escapeTerm (proj₁ ([Id] {Δ} {σ} ⊢Δ [σ])) (proj₁ ([e] ⊢Δ [σ]))) in PE.subst (λ X → Δ ⊢ transp (subst σ A) ( subst (liftSubst σ) P) (subst σ t) (subst σ s) (subst σ u) (subst σ e) ∷ X ^ [ % , l ] ) (PE.sym (singleSubstLift P u)) X
tools/scitools/conf/understand/ada/ada12/a-cfhase.ads
brucegua/moocos
1
24873
<reponame>brucegua/moocos<filename>tools/scitools/conf/understand/ada/ada12/a-cfhase.ads<gh_stars>1-10 ------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- A D A . C O N T A I N E R S . F O R M A L _ H A S H E D _ S E T S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2004-2011, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- -- apply solely to the contents of the part following the private keyword. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- ------------------------------------------------------------------------------ -- This spec is derived from package Ada.Containers.Bounded_Hashed_Sets in the -- Ada 2012 RM. The modifications are to facilitate formal proofs by making it -- easier to express properties. -- The modifications are: -- A parameter for the container is added to every function reading the -- content of a container: Element, Next, Query_Element, Has_Element, Key, -- Iterate, Equivalent_Elements. This change is motivated by the need to -- have cursors which are valid on different containers (typically a -- container C and its previous version C'Old) for expressing properties, -- which is not possible if cursors encapsulate an access to the underlying -- container. -- There are three new functions: -- function Strict_Equal (Left, Right : Set) return Boolean; -- function Left (Container : Set; Position : Cursor) return Set; -- function Right (Container : Set; Position : Cursor) return Set; -- See detailed specifications for these subprograms private with Ada.Containers.Hash_Tables; private with Ada.Streams; generic type Element_Type is private; with function Hash (Element : Element_Type) return Hash_Type; with function Equivalent_Elements (Left, Right : Element_Type) return Boolean; with function "=" (Left, Right : Element_Type) return Boolean is <>; package Ada.Containers.Formal_Hashed_Sets is pragma Pure; type Set (Capacity : Count_Type; Modulus : Hash_Type) is tagged private; -- why is this commented out ??? -- pragma Preelaborable_Initialization (Set); type Cursor is private; pragma Preelaborable_Initialization (Cursor); Empty_Set : constant Set; No_Element : constant Cursor; function "=" (Left, Right : Set) return Boolean; function Equivalent_Sets (Left, Right : Set) return Boolean; function To_Set (New_Item : Element_Type) return Set; function Capacity (Container : Set) return Count_Type; procedure Reserve_Capacity (Container : in out Set; Capacity : Count_Type); function Length (Container : Set) return Count_Type; function Is_Empty (Container : Set) return Boolean; procedure Clear (Container : in out Set); procedure Assign (Target : in out Set; Source : Set); function Copy (Source : Set; Capacity : Count_Type := 0) return Set; function Element (Container : Set; Position : Cursor) return Element_Type; procedure Replace_Element (Container : in out Set; Position : Cursor; New_Item : Element_Type); procedure Query_Element (Container : in out Set; Position : Cursor; Process : not null access procedure (Element : Element_Type)); procedure Move (Target : in out Set; Source : in out Set); procedure Insert (Container : in out Set; New_Item : Element_Type; Position : out Cursor; Inserted : out Boolean); procedure Insert (Container : in out Set; New_Item : Element_Type); procedure Include (Container : in out Set; New_Item : Element_Type); procedure Replace (Container : in out Set; New_Item : Element_Type); procedure Exclude (Container : in out Set; Item : Element_Type); procedure Delete (Container : in out Set; Item : Element_Type); procedure Delete (Container : in out Set; Position : in out Cursor); procedure Union (Target : in out Set; Source : Set); function Union (Left, Right : Set) return Set; function "or" (Left, Right : Set) return Set renames Union; procedure Intersection (Target : in out Set; Source : Set); function Intersection (Left, Right : Set) return Set; function "and" (Left, Right : Set) return Set renames Intersection; procedure Difference (Target : in out Set; Source : Set); function Difference (Left, Right : Set) return Set; function "-" (Left, Right : Set) return Set renames Difference; procedure Symmetric_Difference (Target : in out Set; Source : Set); function Symmetric_Difference (Left, Right : Set) return Set; function "xor" (Left, Right : Set) return Set renames Symmetric_Difference; function Overlap (Left, Right : Set) return Boolean; function Is_Subset (Subset : Set; Of_Set : Set) return Boolean; function First (Container : Set) return Cursor; function Next (Container : Set; Position : Cursor) return Cursor; procedure Next (Container : Set; Position : in out Cursor); function Find (Container : Set; Item : Element_Type) return Cursor; function Contains (Container : Set; Item : Element_Type) return Boolean; function Has_Element (Container : Set; Position : Cursor) return Boolean; function Equivalent_Elements (Left : Set; CLeft : Cursor; Right : Set; CRight : Cursor) return Boolean; function Equivalent_Elements (Left : Set; CLeft : Cursor; Right : Element_Type) return Boolean; function Equivalent_Elements (Left : Element_Type; Right : Set; CRight : Cursor) return Boolean; procedure Iterate (Container : Set; Process : not null access procedure (Container : Set; Position : Cursor)); function Default_Modulus (Capacity : Count_Type) return Hash_Type; generic type Key_Type (<>) is private; with function Key (Element : Element_Type) return Key_Type; with function Hash (Key : Key_Type) return Hash_Type; with function Equivalent_Keys (Left, Right : Key_Type) return Boolean; package Generic_Keys is function Key (Container : Set; Position : Cursor) return Key_Type; function Element (Container : Set; Key : Key_Type) return Element_Type; procedure Replace (Container : in out Set; Key : Key_Type; New_Item : Element_Type); procedure Exclude (Container : in out Set; Key : Key_Type); procedure Delete (Container : in out Set; Key : Key_Type); function Find (Container : Set; Key : Key_Type) return Cursor; function Contains (Container : Set; Key : Key_Type) return Boolean; procedure Update_Element_Preserving_Key (Container : in out Set; Position : Cursor; Process : not null access procedure (Element : in out Element_Type)); end Generic_Keys; function Strict_Equal (Left, Right : Set) return Boolean; -- Strict_Equal returns True if the containers are physically equal, i.e. -- they are structurally equal (function "=" returns True) and that they -- have the same set of cursors. function Left (Container : Set; Position : Cursor) return Set; function Right (Container : Set; Position : Cursor) return Set; -- Left returns a container containing all elements preceding Position -- (excluded) in Container. Right returns a container containing all -- elements following Position (included) in Container. These two new -- functions can be used to express invariant properties in loops which -- iterate over containers. Left returns the part of the container already -- scanned and Right the part not scanned yet. private pragma Inline (Next); type Node_Type is record Element : Element_Type; Next : Count_Type; Has_Element : Boolean := False; end record; package HT_Types is new Ada.Containers.Hash_Tables.Generic_Bounded_Hash_Table_Types (Node_Type); type Set (Capacity : Count_Type; Modulus : Hash_Type) is new HT_Types.Hash_Table_Type (Capacity, Modulus) with null record; use HT_Types; use Ada.Streams; type Cursor is record Node : Count_Type; end record; procedure Write (Stream : not null access Root_Stream_Type'Class; Item : Cursor); for Cursor'Write use Write; procedure Read (Stream : not null access Root_Stream_Type'Class; Item : out Cursor); for Cursor'Read use Read; No_Element : constant Cursor := (Node => 0); procedure Write (Stream : not null access Root_Stream_Type'Class; Container : Set); for Set'Write use Write; procedure Read (Stream : not null access Root_Stream_Type'Class; Container : out Set); for Set'Read use Read; Empty_Set : constant Set := (Capacity => 0, Modulus => 0, others => <>); end Ada.Containers.Formal_Hashed_Sets;
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c6/c67005a.ada
best08618/asylo
7
24925
<gh_stars>1-10 -- C67005A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- CHECK IF A RENAMING DECLARATION DECLARES AN EQUALITY OPERATOR, THE -- TYPES OF THE PARAMETERS NEED NOT BE LIMITED TYPES. -- JBG 9/28/83 WITH REPORT; USE REPORT; PROCEDURE C67005A IS BEGIN TEST ("C67005A", "CHECK THAT AN EQUALITY OPERATOR DECLARED BY " & "A RENAMING DECLARATION NEED NOT HAVE " & "PARAMETERS OF A LIMITED TYPE"); DECLARE GENERIC TYPE LP IS LIMITED PRIVATE; WITH FUNCTION EQUAL (L, R : LP) RETURN BOOLEAN; PACKAGE EQUALITY_OPERATOR IS FUNCTION "=" (L, R : LP) RETURN BOOLEAN; END EQUALITY_OPERATOR; PACKAGE BODY EQUALITY_OPERATOR IS FUNCTION "=" (L, R : LP) RETURN BOOLEAN IS BEGIN RETURN EQUAL(L, R); END "="; END EQUALITY_OPERATOR; PACKAGE POLAR_COORDINATES IS TYPE POLAR_COORD IS RECORD R : INTEGER; THETA : INTEGER; END RECORD; FUNCTION EQUAL (L, R : POLAR_COORD) RETURN BOOLEAN; PACKAGE POLAR_EQUAL IS NEW EQUALITY_OPERATOR (POLAR_COORD, EQUAL); FUNCTION "=" (L, R : POLAR_COORD) RETURN BOOLEAN RENAMES POLAR_EQUAL."="; END POLAR_COORDINATES; PACKAGE BODY POLAR_COORDINATES IS FUNCTION EQUAL (L, R : POLAR_COORD) RETURN BOOLEAN IS BEGIN RETURN (L.THETA MOD 360) = (R.THETA MOD 360) AND L.R = R.R; END EQUAL; END POLAR_COORDINATES; USE POLAR_COORDINATES; PACKAGE VARIABLES IS P270 : POLAR_COORD := (R => 3, THETA => 270); P360 : POLAR_COORD := (R => 3, THETA => IDENT_INT(360)); END VARIABLES; USE VARIABLES; BEGIN IF P270 /= (3, -90) THEN FAILED ("INCORRECT INEQUALITY OPERATOR"); END IF; IF P360 = (3, 0) THEN NULL; ELSE FAILED ("INCORRECT EQUALITY OPERATOR"); END IF; RESULT; END; END C67005A;
ymodem.asm
mastmees/z-two
4
101781
; The MIT License (MIT) ; ; Copyright (c) 2018 <NAME> <<EMAIL>> ; ; Permission is hereby granted, free of charge, to any person obtaining a copy ; of this software and associated documentation files (the "Software"), to deal ; in the Software without restriction, including without limitation the rights ; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the Software is ; furnished to do so, subject to the following conditions: ; ; The above copyright notice and this permission notice shall be included in all ; copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ; SOFTWARE. ; include "avr.inc" org 0x100 SOH: equ 0x01 STX: equ 0x02 EOT: equ 0x04 ACK: equ 0x06 NAK: equ 0x15 CAN: equ 0x18 ld sp,stack jp main aux_open: ld a,0x86 ; 19200 bps out (A_AUXS),a auxopn1: in a,(A_AUXS) and 0x40 ret z in a,(A_AUXD) jr auxopn1 ; get a byte with 3 second timeout ; return nz if times out ; aux_get: push bc ld b,30 aux_g1: in a,(A_AUXS) and 0x40 ;rxrdy? jr nz,aux_g2 call sleep100 djnz aux_g1 inc b ; make NZ pop bc ret aux_g2: call aux_receive ld b,a xor a ; set Z ld a,b pop bc ret aux_close: ld a,0x05 out (A_AUXS),a ret ; wait until all data sent ; aux_flush: ld b,30 aux_f1: call aux_empty ret z call sleep100 djnz aux_f1 ret ; wait until room in transmitter and send byte from A ; aux_send: push af aux_s1: in a,(A_AUXS) and 0x10 jr nz,aux_s1 pop af out (A_AUXD),a ret ; check if transmitter is empty ; returns Z if empty aux_empty: in a,(A_AUXS) and 0x20 ret ; returns Z if data is waiting to ; be received aux_ready: ;check if aux input data ready in a,(A_AUXS) and 0x40 ;rxrdy? cp 0x40 ret ; wait for byte to arrive and return it in A aux_receive: in a,(A_AUXS) and 0x40 ;rxrdy? jr z,aux_receive in a,(A_AUXD) ret main: call aux_open call crlfprint db "Y","M","O","D","E","M"," ","b","a","t","c","h"," " db "r","e","c","e","i","v","e","r",13,10 db "C","o","p","y","r","i","g","h","t"," ","(","C",")"," " db "M","a","d","i","s"," ","K","a","a","l"," ","2","0","1","8",13,10,10,0 mainloop: call crlfprint db "R","e","a","d","y"," ","t","o"," ","r","e","c","e","i","v","e" db " ","a","t"," ","1","9","2","0","0","N","8","1" db 13,10,"P","r","e","s","s"," ","a","n","y"," ","k","e","y"," ","t","o"," ","e","x","i","t",0 call ymserver ld c,11 call 5 ;get console status or a jr z,mainloop ld c,1 call 5 ;eat the char call aux_close ld c,0 call 5 ymserver: ld hl,_init ld (state),hl yms1: ld c,11 ;exit if any key pressed call 5 or a ret nz ld hl,yms1 ;otherwise push return address push hl ld hl,(state) jp (hl) ;and 'call' the state handler ;this state terminates the ymserver _endserver: call closefile pop hl ret state: dw 0 ; initial state for server, set to the variables _init: xor a ld (havefile),a ld (ymodem),a ;begin by sending 'C' few times _begin: ld a,5 ld (counter),a ld hl,_trycrc ld (state),hl ret ;send "C" to indicate crc capability, then listen for incoming packet ;stay in this state for 5 tries, then switch to checksum mode ; _trycrc: ld a,1 ld (xmcrc),a ld a,"C" call aux_send ld hl,recbuf call xmrecv call z,_checkff ;got something, check what it is ret z ;satisfied ld a,(counter) dec a ld (counter),a ret nz ld a,2 ld (counter),a ld hl,_trynak ld (state),hl ret ;sender did not respond to "C", perhaps only supports checksums ;so try sending NAK few times too ; _trynak: xor a ld (xmcrc),a ld a,NAK call aux_send ld hl,recbuf call xmrecv call z,_checkff ret z ld a,(counter) dec a ld (counter),a ret nz ld a,5 ld (counter),a ld hl,_trycrc ;no response, back to trying crc ld (state),hl ret ;got first valid packet, see what it is ;return Z if satisfied to indicate go-ahead ; _checkff: ld a,(packettype) cp EOT jr nz,_chkff1 ld hl,_finish ;if EOT received then done ld (state),hl xor a ret _chkff1: cp SOH jr z,_chkff2 cp STX jr z,_chkff2 ld hl,_begin ld (state),hl ;unknown packet, start over (return NZ) ret ;got valid data packet, now see if it is ymodem name packet _chkff2: ld a,(packetnum) or a jr z,_chkff3 ;got name ld hl,_begin ld (state),hl dec a ;see if it is #1 ret nz ;otherwise start over ;the first packet is data packet, assume xmodem ;need to generate filename call crlfprint db "X","M","O","D","E","M"," ",0 ld hl,tempfname call createfile jr z,_chkff4 call writerec jr z,_chkff4 call notify ld a,1 ld (epacket),a ld hl,_ackpacket ld (state),hl xor a ret ;got filename packet, create file _chkff3: ld a,1 ld (ymodem),a call crlfprint db "Y","M","O","D","E","M"," ",0 ld hl,recbuf call createfile jr z,_chkff4 ld a,ACK call aux_send ; acknowledge filename ld a,5 ld (counter),a call notify ld hl,_waitdata ld (state),hl xor a ret _chkff4: ld hl,_abort ld (state),hl xor a inc a ret notify: call sprint db "r","e","c","e","i","v","i","n","g"," ",0 call printfn call crlfprint db 0 ret tempfname: db "T","E","M","P",".","$","$","$",0 ;start sending "C" again after getting filename _waitdata: ld a,"C" call aux_send ld hl,recbuf call xmrecv jr z,_wda1 _wda2: ld a,(counter) dec a ld (counter),a ret nz ld hl,_abort ld (state),hl ret _wda1: ld a,(packettype) cp EOT jr z,_wda3 ld a,(packetnum) cp 1 jr nz,_wda2 call writerec jr z,_wda4 ld a,1 ld (epacket),a ld hl,_ackpacket ld (state),hl ret _wda3: ld hl,_finish ld (state),hl ret _wda4: ld hl,_abort ld (state),hl ret _nakpacket: ld a,NAK call aux_send ld hl,_waitnext ld (state),hl ret ;packet received and written, ack and advance to next _ackpacket: call printkb ld a,(epacket) inc a ld (epacket),a jr _ack1 ;acknowledge packet that we already have (dont advance) _reackpacket: _ack1: ld a,ACK call aux_send ld a,3 ld (counter),a ld hl,_waitnext ld (state),hl ret ;print KB received printkb: ld hl,(rrecords) ld b,3 pkb1: or a ld a,h rra ld h,a ld a,l rra ld l,a djnz pkb1 ;divide by 8 to get kbytes ld a,13 call putc call pdec16 call sprint db "K","B",0 ret ; wait for another data packet _waitnext: ld hl,recbuf call xmrecv jr z,_wn1 ld a,(counter) dec a ld (counter),a jr z,_wn5 ld hl,_nakpacket ld (state),hl ret _wn5: ld hl,_abort ld (state),hl ret ;see if EOT? _wn1: ld a,(packettype) cp EOT jr nz,_wn4 ld hl,_finish ;yes, we are done with the file ld (state),hl ret ;another data packet, verify that it is the one we expect _wn4: ld a,(packetnum) ld hl,epacket cp (hl) ;expected packet? jr z,_wn2 ;yes, write and ack dec a cp (hl) ;resent previous? jr z,_wn3 ld hl,_nakpacket ld (state),hl ret _wn2: call writerec jr z,_wn6 ld hl,_ackpacket ld (state),hl xor a ret _wn3: ld hl,_reackpacket ld (state),hl xor a ret _wn6: ld hl,_abort ld (state),hl xor a inc a ret ; abort processing, sent 4 CAN bytes to abort _abort: call crlfprint db "A","b","o","r","t","i","n","g",0 ld a,CAN call terminate ld hl,_endserver ld (state),hl ret ; finish processing - send ACK for EOT and close file _finish:ld a,ACK call term1 call crlfprint db "D","o","n","e",0 ld hl,_endserver ld (state),hl ret ; send 4 times byte from A, then close file if open terminate: call aux_send call aux_send call aux_send term1: call aux_send call aux_flush call closefile ret ;------------------------------------------------------------------- ; receive xmodem packet to recbuf ; return Z if good packet received ; ; xerrno set to: ; 0 no error ; 1 timeout waiting for packet ; 2 timeout waiting for packet # ; 3 timeout waiting for rame # complement ; 4 packet number does not match its complement ; 5 timeout during packet data ; 6 timeout waiting for checksum or first crc byte ; 7 invalid checksum ; 8 invalid crc ; 9 timeout waiting for second crc byte ; xmrecv: ld hl,recbuf ld a,1 ld (xerrno),a xor a ld (packettype),a call aux_get ret nz ld (packettype),a xor a ld (xerrno),a ld a,(packettype) cp EOT ret z cp CAN ret z cp SOH jr z,xmsoh cp STX jr nz,xmrecv ld a,8 ld (rcount),a jr xmr1 xmsoh: ld a,1 ld (rcount),a xmr1: ld a,2 ld (xerrno),a call aux_get ret nz ld b,a ld (packetnum),a ld a,3 ld (xerrno),a call aux_get ret nz cpl push af ld a,4 ld (xerrno),a pop af cp b ret nz ; packet # mismatch ld a,5 ld (xerrno),a ld c,0 xmrl2: ld b,128 xmrl: call aux_get ret nz ld (hl),a add a,c ld c,a ; update checksum inc hl djnz xmrl ld a,(rcount) dec a ld (rcount),a jr nz,xmrl2 ld a,6 ld (xerrno),a call aux_get ret nz ld b,a ld a,(xmcrc) or a ; crc mode? jr nz,xmrc ; yes, get one more byte ld a,7 ld (xerrno),a ld a,c cp b ; otherwise check checksum ret nz xor a ld (xerrno),a ret xmrc: ld d,b ld a,9 call aux_get ; get crc low byte ret nz ld e,a ; DE is now received crc push de ld hl,recbuf ld de,0 ld c,1 ld a,(packettype) cp STX jr nz,xmrc1 ld c,8 xmrc1: ld b,128 xmrc2: ld a,(hl) inc hl call crc16de djnz xmrc2 dec c jr nz,xmrc1 pop hl ld a,8 ld (xerrno),a ld a,h ; check crc high byte cp d ret nz ld a,l cp e ret nz xor a ld (xerrno),a ret ; send xmodem packet (packet number in A) at HL, BC is number of ; data bytes (128 or 1024) ; xmsend: push af ld a,1 ld (rcount),a ld a,b or a ld a,SOH jr z,xmsml ld a,8 ld (rcount),a ld a,STX xmsml: call aux_send pop af call aux_send ; packet # cpl call aux_send ; complemented packet # ld c,0 ;checksum clear ld de,0 ;crc clear xms2: ld b,128 xms1: ld a,(hl) call aux_send push af call crc16de pop af add a,c ld c,a inc hl djnz xms1 ld a,(rcount) dec a ld (rcount),a jr nz,xms2 ld a,(xmcrc) or a jr nz,xmsc ld a,c call aux_send ret xmsc: ld a,d call aux_send ld a,e call aux_send ret ; update CRC16 in DE with byte in A ; derived from http://mdfs.net/Info/Comp/Comms/CRC16.htm ; crc16de: push bc xor d ld b,8 ;bit counter crcl: sla e adc a,a jr nc,crc0 ld d,a ld a,e xor 0x21 ld e,a ld a,d xor 0x10 crc0: djnz crcl ld d,a pop bc ret ; write record from recbuf to file, writes 128 or 1024 based on record type ; return Z on failure ; writerec: ld a,1 ld (rcount),a ld de,recbuf ld a,(packettype) cp STX jr nz,wrrec1 ld a,8 ld (rcount),a wrrec1: push de ld c,26 call 5 ld de,fcb ld c,21 call 5 pop de or a jr z,fook push af call crlfprint db "w","r","i","t","e"," ","e","r","r",0 pop af call phex xor a ;set Z for failure ret fook: ld hl,(rrecords) inc hl ld (rrecords),hl ld hl,128 add hl,de ex de,hl ld a,(rcount) dec a ld (rcount),a jr nz,wrrec1 xor a inc a ret ;read record from file, HL points to buffer ;return Z on failure readrec: ex de,hl ld c,26 call 5 ld de,fcb ld c,20 call 5 or a jr z,rfook xor a ;set Z on failure ret rfook: inc a ret ;delete file, HL points to file name ; deletefile: call parsefn ld a,1 ld (havefile),a ld de,fcb ld c,19 call 5 ;try erasing first ret ;0xff when fails ;creates or overwrites a file ;returns Z on failure. on success sets (havefile) to nonzero ; createfile: push hl call deletefile ld hl,0 ld (rrecords),hl pop hl call parsefn ld de,fcb ld c,22 call 5 push af xor a ld (fcb+32),a ;zero current record pop af cp 0xff ret nz push af push af call crlfprint db "C","r","e","a","t","e"," ","f","a","i","l","e","d",":",0 call printfn pop af call phex xor a ld (havefile),a pop af ret ; open existing file, HL points to file name, terminated by space or zero ; FCB set up at fcb ; returns Z on failure ; openfile: call parsefn ld a,1 ld (havefile),a ld de,fcb ld c,15 call 5 push af xor a ld (fcb+32),a ;zero current record pop af cp 0xff ret nz push af push af call crlfprint db "O","p","e","n"," ","f","a","i","l","e","d",":",0 call printfn pop af call phex xor a ld (havefile),a pop af ret ; close file, FCB expected at fcb ; returns Z on failure closefile: ld a,(havefile) or a ret z xor a ld (havefile),a ld de,fcb ld c,16 call 5 cp 0xff ret nz push af push af call crlfprint db "C","l","o","s","e"," ","f","a","i","l","e","d",":",0 pop af call phex pop af ret ;clear FCB at DE clrfcb: push bc push hl ld h,d ld l,e xor a ld (hl),a inc hl ld a," " ld b,11 clrfcb1: ld (hl),a inc hl djnz clrfcb1 xor a ld b,24 clrfcb2: ld (hl),a inc hl djnz clrfcb2 pop hl pop bc ret ; parse file name pointed by HL, put name and extension in default FCB ; at fcb parsefn: ld de,fcb call clrfcb call parsedr ;check for drive letter inc de ld b,8 call parsenp ;up to 8 characters for name ld a,8 add a,e ld e,a ld a,0 adc a,d ld d,a ld b,3 call parsenp ;up to 3 characters for extension ret parsedr: xor a ld (de),a ; default drive push hl inc hl ld a,(hl) pop hl cp ":" ; check if drive letter included ret nz ld a,(hl) call ucase sub "A"-1 ld (de),a ;if drive letter, then store explicit drive inc hl inc hl ;and skip the drive part ret parsenp: push de np1: ld a,(hl) cp " " jr z,npe cp "." jr z,npe or a jr z,npe call ucase ld (de),a inc de inc hl djnz np1 np2: ld a,(hl) cp " " jr z,npe cp "." jr z,npe or a jr z,npe inc hl jr np2 npe: pop de ld a,(hl) or a ret z inc hl ret ucase: cp "a" ret c cp "z"+1 ret nc sub 0x20 ret printfn: ld hl,fcb ld a,(hl) or a jr z,prfn1 add a,"A"-1 call putc ld a,":" call putc prfn1: ld b,8 prfn2: inc hl ld a,(hl) cp " " call nz,putc djnz prfn2 inc hl ld a,(hl) cp " " ret z ld a,"." call putc ld b,3 prfn3: ld a,(hl) cp " " ret z call putc inc hl djnz prfn3 ret ; wait until next 10ms tick sleep10: push af push bc ld a,4 out (A_MSCC),a ; read time counter in a,(A_MSCD) ; take only lowest byte ld b,a sl10: ld a,4 out (A_MSCC),a in a,(A_MSCD) cp b jr nz,sl11 in a,(A_AUXS) and 0x40 jr z,sl10 sl11: pop bc pop af ret ; about 100ms delay, cut short if receive data is ready ; sleep100: push af in a,(A_AUXS) and 0x40 jr nz,slp3 push bc ld c,10 slp1: call sleep10 in a,(A_AUXS) and 0x40 jr nz,slp2 dec c jr nz,slp1 slp2: pop bc slp3: pop af ret ; multiply DE*BC, result in DEHL ; div/mul routines from http://z80-heaven.wikidot.com/math ; demulbc: ld hl,0 ld a,16 dml1: add hl,hl rl e rl d jr nc,dml2 add hl,bc jr nc,dml2 inc de dml2: dec a jr nz,dml1 ret ; multiply DEHL by 10, return result in DEHL dehlmul10: add hl,hl push hl push hl ld h,d ld l,e adc hl,de ex de,hl pop hl push de ;DEHL=DEHL*2, copy in stack add hl,hl push hl ld h,d ld l,e adc hl,hl ex de,hl pop hl ;DEHL=DEHL*4 add hl,hl push hl ld h,d ld l,e adc hl,hl ex de,hl pop hl ;DEHL=DEHL*8 pop ix pop bc add hl,bc push hl push ix pop hl adc hl,de ex de,hl pop hl ret ; divides DEHL by C, returns result in DEHL, remainder in A ; dehldivc: ld b,32 xor a divc2: add hl,hl rl e rl d rla cp c jr c,divc1 inc l sub c divc1: djnz divc2 ret putc: push bc push de push hl ld c,2 ld e,a call 5 pop hl pop de pop bc ret getc: push bc push de push hl ld c,1 call 5 pop hl pop de pop bc ret ; print HL as decimal number pdec16: ld a,h or a jr nz,pdc161 ld a,l cp 10 jr nc,pdc161 pdc162: add a,"0" call putc ret pdc161: ld de,0 ld c,10 call dehldivc push af call pdec16 pop af jr pdc162 ; print HL as hex phex16: ld a,h call phex ld a,l ; print A as hex phex: push af push af rra rra rra rra call pdigit pop af call pdigit pop af ret pdigit: and 0x0f add "0" cp "9"+1 jr c,pd1 add 7 pd1: call putc ret ; print zero terminated string at HL pstr: ld a,(hl) and a ret z call putc inc hl jr pstr crlfprint: ld a,13 call putc ld a,10 call putc ; print zero terminated string following the call sprint: pop hl call pstr inc hl jp (hl) xmcrc: db 0 ; crc mode? ymodem: db 0 ; ymodem mode? packetnum: db 0 ; received packet # packettype: db 0 ; received packet type (SOH,STX,EOT) counter: db 0 ; generic counter xerrno: db 0 ; xmodem receiver error code rrecords: dw 0 ; number of successfully received 128 byte records ; epacket: db 0 ; expected packet # rcount: db 1 ; 128 byte record count in packet being received havefile: db 0 ; nz if file has been opened fcb: ds 36 ds 128 stack: recbuf: ds 1024
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca_notsx.log_21829_293.asm
ljhsiun2/medusa
9
101383
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r14 push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x71f8, %rsi lea addresses_UC_ht+0x83b8, %rdi nop xor $20059, %rdx mov $44, %rcx rep movsb nop nop nop nop nop and %r14, %r14 lea addresses_D_ht+0x9678, %rsi lea addresses_A_ht+0xc5f8, %rdi nop nop cmp $18550, %r11 mov $116, %rcx rep movsq nop xor $8931, %rsi lea addresses_WC_ht+0x1a478, %rsi lea addresses_UC_ht+0x12818, %rdi nop nop dec %r12 mov $81, %rcx rep movsl nop nop nop nop cmp $43245, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %r14 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r15 push %rax push %rbx push %rsi // Faulty Load lea addresses_WC+0x1bdf8, %r11 nop cmp %rsi, %rsi mov (%r11), %rax lea oracles, %r11 and $0xff, %rax shlq $12, %rax mov (%r11,%rax,1), %rax pop %rsi pop %rbx pop %rax pop %r15 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WC', 'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'dst': {'same': True, 'congruent': 4, 'type': 'addresses_UC_ht'}} {'OP': 'REPM', 'src': {'same': True, 'congruent': 6, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_A_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_UC_ht'}} {'38': 21829} 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 */
oeis/021/A021764.asm
neoneye/loda-programs
11
244560
<reponame>neoneye/loda-programs<filename>oeis/021/A021764.asm ; A021764: Expansion of 1/((1-x)(1-4x)(1-5x)(1-8x)). ; Submitted by <NAME> ; 1,18,215,2160,19821,172638,1456915,12056220,98541641,799142058,6448579215,51871439880,416407919461,3338534836278,26744994007115,214144960297140,1714090450201281,13717400347223298,109762678131820615,878219168328612000,7026343529014635101,56213705008107791118,449724447401063939715,3597869709714511808460,28783328705546064868921,230268486284718246747738,1842157179484294116124415,14737303905926291652350520,117898663693746818886150741,943190472165964147628221158,7545529591944889836529974715 mov $1,1 mov $2,1 mov $3,2 lpb $0 sub $0,1 mul $1,5 mul $3,8 add $3,2 add $1,$3 mul $2,4 add $2,1 sub $1,$2 lpe mov $0,$1
old/Homotopy/Cover/Def.agda
timjb/HoTT-Agda
294
6379
{-# OPTIONS --without-K #-} open import Base module Homotopy.Cover.Def {i} (A : Set i) where record covering : Set (suc i) where constructor cov[_,_] field fiber : A → Set i fiber-is-set : ∀ a → is-set (fiber a) open import Homotopy.Truncation open import Homotopy.Connected open import Homotopy.PathTruncation -- In terms of connectedness is-universal : covering → Set i is-universal cov[ fiber , _ ] = is-connected ⟨1⟩ $ Σ A fiber -- In terms of connectedness universal-covering : Set (suc i) universal-covering = Σ covering is-universal tracing : ∀ cov → let open covering cov in ∀ {a₁ a₂} → fiber a₁ → a₁ ≡₀ a₂ → fiber a₂ tracing cov[ fiber , fiber-is-set ] y = π₀-extend-nondep ⦃ fiber-is-set _ ⦄ (λ p → transport fiber p y) compose-tracing : ∀ cov → let open covering cov in ∀ {a₁ a₂ a₃} y (p₁ : a₁ ≡₀ a₂) (p₂ : a₂ ≡₀ a₃) → tracing cov (tracing cov y p₁) p₂ ≡ tracing cov y (p₁ ∘₀ p₂) compose-tracing cov y = let open covering cov in π₀-extend ⦃ λ _ → Π-is-set λ _ → ≡-is-set $ fiber-is-set _ ⦄ (λ p₁ → π₀-extend ⦃ λ _ → ≡-is-set $ fiber-is-set _ ⦄ (λ p₂ → compose-trans fiber p₂ p₁ y)) covering-eq : ∀ {co₁ co₂ : covering} → covering.fiber co₁ ≡ covering.fiber co₂ → co₁ ≡ co₂ covering-eq {cov[ _ , set₁ ]} {cov[ ._ , set₂ ]} refl = ap (λ set → cov[ _ , set ]) (prop-has-all-paths (Π-is-prop λ _ → is-set-is-prop) _ _)
Z80Assembler/resource/Z80Assembler.g4
wilddog1979/Asmr
0
1440
grammar Z80Assembler; @header { package org.eaSTars.z80asm.parser; } z80compilationUnit : ((z80assemblerline | z80directives) EOL+)* | EOF ; z80directives : (WS | EOL)* (directive WS*)? COMMENT? ; directive : ('org' WS+ Hex16Bits) # ORG | (LABEL ':' WS* 'equ' WS* expression) # EQU ; z80assemblerline : (WS | EOL)* (LABEL ':' WS*)? (instruction WS*)? COMMENT? ; COMMENT: '#' ~[\r\n]*; LABEL: '@' Letter (Letter | [0-9])* ; fragment Letter: [a-zA-Z_]; instruction : 'NOP' # NOP | ('LD' WS+ instructionLDparameters) # LD | ('INC' WS+ instructionINCDECparameters) # INC | 'RLCA' # RLCA | ('EX' WS+ instructionEXparameters) # EX | ('ADD' WS+ instructionADDparameters) # ADD | ('DEC' WS+ instructionINCDECparameters) # DEC | 'RRCA' # RRCA | 'RLA' # RLA | 'RRA' # RRA | 'DAA' # DAA | 'CPL' # CPL | 'SCF' # SCF | 'CCF' # CCF | 'HALT' # HALT | ('ADC' WS+ instructionADCSBCparameters) # ADC | ('SUB' WS+ instructionSUBANDXORORCPparameters) # SUB | ('SBC' WS+ instructionADCSBCparameters) # SBC | ('AND' WS+ instructionSUBANDXORORCPparameters) # AND | ('XOR' WS+ instructionSUBANDXORORCPparameters) # XOR | ('OR' WS+ instructionSUBANDXORORCPparameters) # OR | ('CP' WS+ instructionSUBANDXORORCPparameters) # CP | ('POP' WS+ instructionPUSHPOPparameters) # POP | ('PUSH' WS+ instructionPUSHPOPparameters) # PUSH | instructionRETparameters # RET | ('RST' WS+ instructionRSTparameters) # RST | 'EXX' # EXX | instruictionJPparameters # JP | 'DI' # DI | 'EI' # EI | ('DJNZ' WS+ instructionDJNZparameters) # DJNZ | instructionJRparameters # JR | ('RLC' WS+ instructionBitRotatingparameters) # RLC | ('RRC' WS+ instructionBitRotatingparameters) # RRC | ('RR' WS+ instructionBitRotatingparameters) # RR | ('RL' WS+ instructionBitRotatingparameters) # RL | ('SLA' WS+ instructionBitRotatingparameters) # SLA | ('SRA' WS+ instructionBitRotatingparameters) # SRA | ('SRL' WS+ instructionBitRotatingparameters) # SRL | ('BIT' WS+ instructionBITRESSETparameters) # BIT | ('RES' WS+ instructionBITRESSETparameters) # RES | ('SET' WS+ instructionBITRESSETparameters) # SET | ('OUT' WS+ instructionOUTparameters) # OUT | ('IN' WS+ instructionINparameters) # IN | 'NEG' # NEG | 'IM0' # IM0 | 'RETN' # RETN | 'RETI' # RETI | 'IM1' # IM1 | 'IM2' # IM2 | 'RRD' # RRD | 'RLD' # RLD | 'LDI' # LDI | 'CPI' # CPI | 'INI' # INI | 'OUTI' # OUTI | 'LDD' # LDD | 'CPD' # CPD | 'IND' # IND | 'OUTD' # OUTD | 'LDIR' # LDIR | 'CPIR' # CPIR | 'INIR' # INIR | 'OTIR' # OTIR | 'LDDR' # LDDR | 'CPDR' # CPDR | 'INDR' # INDR | 'OTDR' # OTDR | instructionCALLparameters # CALL ; instructionLDparameters : ((refbc='[' WS* 'BC' WS* ']' | refde='[' WS* 'DE' WS* ']') WS* ',' WS* source='A') # LDfromAToAddress | (target='A' WS* ',' WS* (refbc='[' WS* 'BC' WS* ']' | refde='[' WS* 'DE' WS* ']')) # LDfromAddressToA | ('HL' WS* ',' WS* '[' WS* hex16bits WS* ']') # LDhlrefnum16 | ('A' WS* ',' WS* '[' WS* hex16bits WS* ']') # LDarefnum16 | (registerSS WS* ',' WS* '[' WS* hex16bits WS* ']') # LDssrefnum16 | ('IX' WS* ',' WS* '[' WS* hex16bits WS* ']') # LDixrefnum16 | ('IY' WS* ',' WS* '[' WS* hex16bits WS* ']') # LDiyrefnum16 | ('[' WS* 'HL' WS* ']' WS* ',' WS* registers) # LDregtorefhl | (registers WS* ',' WS* '[' WS* 'HL' WS* ']') # LDrefhltoreg | (registers WS* ',' WS* registersmarked) # LDregregmarked | ('SP' WS* ',' WS* 'HL') # LDsphl | (registersWithReference WS* ',' WS* hex8bits) # LDrhnum8 | ('SP' WS* ',' WS* 'IX') # LDspix | ('SP' WS* ',' WS* 'IY') # LDspiy | ('I' WS* ',' WS* 'A') # LDia | ('A' WS* ',' WS* 'I') # LDai | ('R' WS* ',' WS* 'A') # LDra | ('A' WS* ',' WS* 'R') # LDar | (registerSS WS* ',' WS* hex16bits) # LDssnum16 | ('[' WS* hex16bits WS* ']' WS* ',' WS* 'HL') # LDrefnum16hl | ('[' WS* hex16bits WS* ']' WS* ',' WS* 'A') # LDrefnum16a | (indexedReference WS* ',' WS* registers) # LDidxregs | (registers WS* ',' WS* indexedReference) # LDregsidx | (indexedReference WS* ',' WS* hex8bits) # LDidxnum8 | ('[' WS* hex16bits WS* ']' WS* ',' WS* registerSS) # LDrefnum16ss | ('IX' WS* ',' WS* hex16bits) # LDixnum16 | ('IY' WS* ',' WS* hex16bits) # LDiynum16 | ('[' WS* hex16bits WS* ']' WS* ',' WS* 'IX') # LDrefnum16ix | ('[' WS* hex16bits WS* ']' WS* ',' WS* 'IY') # LDrefnum16iy ; instructionINCDECparameters : registerSS | registersWithReference | IX='IX' | IY='IY' | indexedReference ; instructionADDparameters : (HL='HL' WS* ',' WS* registerSS) | (A='A' WS* ',' WS* registersWithReference) | (A='A' WS* ',' WS* hex8bits) | (IX='IX' WS* ',' WS* registerPP) | (IY='IY' WS* ',' WS* registerRR) | (A='A' WS* ',' WS* indexedReference) ; instructionEXparameters : ('AF' WS* ',' WS* 'AF\'') # exafafmarked | ('[' WS* 'SP' WS* ']' WS* ',' WS* 'HL') # exrefsphl | ('DE' WS* ',' WS* 'HL') # exdehl | ('[' WS* 'SP' WS* ']' WS* ',' WS* 'IX') # exrefspix | ('[' WS* 'SP' WS* ']' WS* ',' WS* 'IY') # exrefspiy ; instructionADCSBCparameters : (A='A' WS* ',' WS* registersWithReference) | (A='A' WS* ',' WS* hex8bits) | (HL='HL' WS* ',' WS* registerSS) | (A='A' WS* ',' WS* indexedReference) ; instructionSUBANDXORORCPparameters : registersWithReference | hex8bits | indexedReference ; instructionPUSHPOPparameters : registerQQ | IX='IX' | IY='IY' ; instructionRSTparameters : parameterT ; instructionRETparameters : 'RET' | NZ='RETNZ' | Z='RETZ' | NC='RETNC' | C='RETC' | PO='RETPO' | PE='RETPE' | P='RETP' | M='RETM' ; instruictionJPparameters : 'JP' WS+ '[' WS* HL='HL' WS* ']' | 'JP' WS+ '[' WS* IX='IX' WS* ']' | 'JP' WS+ '[' WS* IY='IY' WS* ']' | ('JP' | NZ='JPNZ' | Z='JPZ' | NC='JPNC' | C='JPC' | PO='JPPO' | PE='JPPE' | P='JPP' | M='JPM')? WS+ hex16bits ; instructionCALLparameters : ('CALL' | NZ='CALLNZ' | Z='CALLZ' | NC='CALLNC' | C='CALLC' | PO='CALLPO' | PE='CALLPE' | P='CALLP' | M='CALLM')? WS+ hex16bits ; instructionJRparameters : (('JR' | NZ='JRNZ' | Z='JRZ' | NC='JRNC' | C='JRC') WS+ hex8bits) ; instructionDJNZparameters : hex8bits ; instructionBitRotatingparameters : registersWithReference | indexedReference ; instructionBITRESSETparameters : (hex3bits WS* ',' WS* registersWithReference) | (hex3bits WS* ',' WS* indexedReference) ; instructionOUTparameters : (hex8bits WS* ',' WS* A='A') | (C='C' WS* ',' WS* registers) ; instructionINparameters : A='A' WS* ',' WS* hex8bits | registers WS* ',' WS* C='C' ; registerSS : BC='BC' | DE='DE' | HL='HL' | SP='SP' ; registerQQ : BC='BC' | DE='DE' | HL='HL' | AF='AF' ; registerPP : BC='BC' | DE='DE' | IX='IX' | SP='SP' ; registerRR : BC='BC' | DE='DE' | IY='IY' | SP='SP' ; parameterT : x00h='00' | x08h='08' | x10h='10' | x18h='18' | x20h='20' | x28h='28' | x30h='30' | x38h='38' ; parameterCC : NZ='NZ' | Z='Z' | NC='NC' | C='C' | PO='PO' | PE='PE' | P='P' | M='M' ; registers : B='B' | C='C' | D='D' | E='E' | H='H' | L='L' | A='A' ; registersmarked : B='B\'' | C='C\'' | D='D\'' | E='E\'' | H='H\'' | L='L\'' | A='A\'' ; registersWithReference : B='B' | C='C' | D='D' | E='E' | H='H' | L='L' | ('[' WS* refHL='HL' WS* ']') | A='A' ; indexedReference : '[' WS* (IX='IX' | IY='IY') WS* '+' WS* hex8bits WS* ']' ; hex3bits: expression; //Hex3Bits | LABEL; hex8bits: expression; //Hex8Bits | LABEL; hex16bits: expression; //Hex16Bits | LABEL; PLUS: '+'; MINUS: '-'; STAR: '*'; DIV: '/'; SHLEFT: '<<'; SHRIGHT: '>>'; BITAND: '&'; BITXOR: '^'; BITOR: '|'; BITNOT: '!'; expression: left=bitwisexorExpression (WS* or=BITOR WS* right=bitwisexorExpression)*; bitwisexorExpression: left=bitwiseandExpression (WS* xor=BITXOR WS* right=bitwiseandExpression)*; bitwiseandExpression: left=bitwiseshiftExpression (WS* and=BITAND WS* right=bitwiseshiftExpression)*; bitwiseshiftExpression: left=additiveExpression (WS* (shl=SHLEFT | WS* shr=SHRIGHT) WS* right=additiveExpression)*; additiveExpression: left=multiplicativeExpression (WS* (plus=PLUS | minus=MINUS) WS* right=multiplicativeExpression)*; multiplicativeExpression: left=unaryExpression (WS* (mul=STAR | div=DIV ) WS* right=unaryExpression)*; unaryExpression : (minus=MINUS | not=BITNOT) WS* unaryExpression | primaryExpression ; primaryExpression : Hex16Bits | LABEL | '(' WS* expression WS* ')' ; Hex3Bits: [0-7]'h'; Hex8Bits: Hexdigit Hexdigit 'h'; Hex16Bits: Hexdigit Hexdigit Hexdigit Hexdigit 'h'; fragment Hexdigit: [0-9A-Fa-f]; EOL : ('\r'* '\n'); WS: [ \t];
programs/oeis/244/A244727.asm
karttu/loda
1
86865
<reponame>karttu/loda<filename>programs/oeis/244/A244727.asm ; A244727: a(n) = 7*n^3. ; 0,7,56,189,448,875,1512,2401,3584,5103,7000,9317,12096,15379,19208,23625,28672,34391,40824,48013,56000,64827,74536,85169,96768,109375,123032,137781,153664,170723,189000,208537,229376,251559,275128,300125,326592,354571,384104,415233,448000,482447,518616,556549,596288,637875,681352,726761,774144,823543,875000,928557,984256,1042139,1102248,1164625,1229312,1296351,1365784,1437653,1512000,1588867,1668296,1750329,1835008,1922375,2012472,2105341,2201024,2299563,2401000,2505377,2612736,2723119,2836568,2953125,3072832,3195731,3321864,3451273,3584000,3720087,3859576,4002509,4148928,4298875,4452392,4609521,4770304,4934783,5103000,5274997,5450816,5630499,5814088,6001625,6193152,6388711,6588344,6792093,7000000,7212107,7428456,7649089,7874048,8103375,8337112,8575301,8817984,9065203,9317000,9573417,9834496,10100279,10370808,10646125,10926272,11211291,11501224,11796113,12096000,12400927,12710936,13026069,13346368,13671875,14002632,14338681,14680064,15026823,15379000,15736637,16099776,16468459,16842728,17222625,17608192,17999471,18396504,18799333,19208000,19622547,20043016,20469449,20901888,21340375,21784952,22235661,22692544,23155643,23625000,24100657,24582656,25071039,25565848,26067125,26574912,27089251,27610184,28137753,28672000,29212967,29760696,30315229,30876608,31444875,32020072,32602241,33191424,33787663,34391000,35001477,35619136,36244019,36876168,37515625,38162432,38816631,39478264,40147373,40824000,41508187,42199976,42899409,43606528,44321375,45043992,45774421,46512704,47258883,48013000,48775097,49545216,50323399,51109688,51904125,52706752,53517611,54336744,55164193,56000000,56844207,57696856,58557989,59427648,60305875,61192712,62088201,62992384,63905303,64827000,65757517,66696896,67645179,68602408,69568625,70543872,71528191,72521624,73524213,74536000,75557027,76587336,77626969,78675968,79734375,80802232,81879581,82966464,84062923,85169000,86284737,87410176,88545359,89690328,90845125,92009792,93184371,94368904,95563433,96768000,97982647,99207416,100442349,101687488,102942875,104208552,105484561,106770944,108067743 mov $1,$0 pow $1,3 mul $1,7
src/common/sp-memory.adb
jquorning/septum
236
28347
package body SP.Memory is function Make (Allocated : T_Access) return Arc is begin return Arc' (Ada.Finalization.Controlled with Block => new Control_Block' ( Value => Allocated, Count => Atomic_Integer.Init (1))); end Make; function Make_Null return Arc is begin return Self : Arc do null; end return; end Make_Null; function Get (Self : Arc) return Reference_Type is begin return (Element => Self.Block.Value); end Get; function Is_Valid (Self : Arc) return Boolean is begin return Self.Block /= null and then Self.Block.Value /= null and then Atomic_Integer.Load (Self.Block.Count) > 0; end Is_Valid; procedure Reset (Self : aliased in out Arc) is begin if Self.Block /= null then if Atomic_Integer.Add_Fetch (Self.Block.Count, -1) = 0 then Free (Self.Block.Value); Free (Self.Block); else Self.Block := null; end if; end if; end Reset; function Count (Self : aliased in out Arc) return Reference_Count is begin if Self.Block /= null then return Atomic_Integer.Load (Self.Block.Count); else return 0; end if; end Count; procedure Increment (Self : in out Arc) is begin if Self.Block /= null then Atomic_Integer.Add (Self.Block.Count, 1); end if; end Increment; overriding procedure Initialize (Self : in out Arc) is begin Increment (Self); end Initialize; overriding procedure Adjust (Self : in out Arc) is begin Increment (Self); end Adjust; overriding procedure Finalize (Self : in out Arc) is begin Reset (Self); end Finalize; end SP.Memory;
programs/oeis/024/A024084.asm
neoneye/loda
22
7105
<filename>programs/oeis/024/A024084.asm<gh_stars>10-100 ; A024084: a(n) = 7^n - n^9. ; 1,6,-463,-19340,-259743,-1936318,-9960047,-39530064,-128452927,-347066882,-717524751,-380620948,8681506849,86284511034,657562026065,4709118150568,33164211092865,232511926110710,1628215238620081,11398572497675364,79791754297612001,558545069803237426,3909819841313770257,27368745538928254880,191581228738758874177,1341068615849267635182,9387480332218250626673,65712362355908682654556,459986536534161505023393,3219905755798672580861738,22539340290672575087863249,157775382034819366992882072,1104427674243885461933210369,7730993719707398112652692454,54116956037952050951966894385,378818692265664702867078954068,2651730845859653370219066713185,18562115921017574172491423876130,129934811447123019951956044435601,909543680129861140611476658730384,6366805760909027985479291139224001,44567640326363195899862664040174046,311973482284542371300923650438126577 mov $1,7 pow $1,$0 pow $0,9 sub $1,$0 mov $0,$1
test/Succeed/OverloadedNat.agda
cruhland/agda
1,989
17552
<reponame>cruhland/agda<filename>test/Succeed/OverloadedNat.agda open import Common.Prelude record IsNumber (A : Set) : Set where field fromNat : Nat → A open IsNumber {{...}} public {-# BUILTIN FROMNAT fromNat #-} instance IsNumberNat : IsNumber Nat IsNumberNat = record { fromNat = λ n → n } record IsNegative (A : Set) : Set where field fromNeg : Nat → A open IsNegative {{...}} public {-# BUILTIN FROMNEG fromNeg #-} data Int : Set where pos : Nat → Int neg : Nat → Int instance IsNumberInt : IsNumber Int IsNumberInt = record { fromNat = pos } IsNegativeInt : IsNegative Int IsNegativeInt = record { fromNeg = neg } fiveN : Nat fiveN = 5 fiveZ : Int fiveZ = 5 minusFive : Int minusFive = -5 open import Common.Equality thm : pos 5 ≡ 5 thm = refl thm′ : neg 5 ≡ -5 thm′ = refl
vendor/stdlib/src/Data/Vec1.agda
isabella232/Lemmachine
56
3401
<filename>vendor/stdlib/src/Data/Vec1.agda ------------------------------------------------------------------------ -- Vectors parameterised on types in Set₁ ------------------------------------------------------------------------ -- I want universe polymorphism. module Data.Vec1 where infixr 5 _∷_ open import Data.Nat open import Data.Vec using (Vec; []; _∷_) open import Data.Fin ------------------------------------------------------------------------ -- The type data Vec₁ (a : Set₁) : ℕ → Set₁ where [] : Vec₁ a zero _∷_ : ∀ {n} (x : a) (xs : Vec₁ a n) → Vec₁ a (suc n) ------------------------------------------------------------------------ -- Some operations map : ∀ {a b n} → (a → b) → Vec₁ a n → Vec₁ b n map f [] = [] map f (x ∷ xs) = f x ∷ map f xs map₀₁ : ∀ {a b n} → (a → b) → Vec a n → Vec₁ b n map₀₁ f [] = [] map₀₁ f (x ∷ xs) = f x ∷ map₀₁ f xs map₁₀ : ∀ {a b n} → (a → b) → Vec₁ a n → Vec b n map₁₀ f [] = [] map₁₀ f (x ∷ xs) = f x ∷ map₁₀ f xs lookup : ∀ {a n} → Fin n → Vec₁ a n → a lookup zero (x ∷ xs) = x lookup (suc i) (x ∷ xs) = lookup i xs
programs/oeis/057/A057054.asm
jmorken/loda
1
241801
; A057054: Let R(i,j) be the rectangle with antidiagonals 1; 2,3; 4,5,6; ...; n^3 is in antidiagonal a(n). ; 1,4,7,11,16,21,26,32,38,45,52,59,66,74,82,91,99,108,117,126,136,146,156,166,177,187,198,210,221,232,244,256,268,280,293,305,318,331,344,358,371,385,399,413,427,441,456,470,485,500 mov $3,$0 add $0,7 mov $1,$3 mov $2,$0 lpb $2 add $1,1 lpb $1 mov $2,1 mov $4,$1 sub $1,$1 lpe pow $4,3 lpb $4 add $1,$2 trn $4,$1 lpe lpe
dehrust_ix.asm
uniabis/z80depacker
25
86735
<reponame>uniabis/z80depacker<filename>dehrust_ix.asm ; Z80 HRUST depacker. ; ; in: HL - from ; DE - to ; kills: AF, BC,DE,HL, BC',DE',HL', IX ; does not move anything before depacking, unlike dehrust_*_hdr.asm ; ; Uses IX to get packed stream, so somewhat slower than *_stk_* versions, but ; it could be freely interrupted. ; ; you must USE -hst switch and must NOT USE -zxh switch to mhmt in order to get ; correct packed stream for this depacker! ; length is 234 bytes, non-relocatable DEHRUST PUSH HL POP IX LD B,0 EXX LD D,#BF LD C,#10 CALL LL4115 LL4036 LD A,(IX+#00) INC IX EXX LL403C LD (DE),A INC DE LL403E EXX LL403F ADD HL,HL DJNZ LL4045 CALL LL4115 LL4045 JR C,LL4036 LD E,#01 LL4049 LD A,#80 LL404B ADD HL,HL DJNZ LL4051 CALL LL4115 LL4051 RLA JR C,LL404B CP #03 JR C,LL405D ADD A,E LD E,A XOR C JR NZ,LL4049 LL405D ADD A,E CP #04 JR Z,LL40C4 ADC A,#FF CP #02 EXX LL4067 LD C,A LL4068 EXX LD A,#BF JR C,LL4082 LL406D ADD HL,HL DJNZ LL4073 CALL LL4115 LL4073 RLA JR C,LL406D JR Z,LL407D INC A ADD A,D JR NC,LL4084 SUB D LL407D INC A JR NZ,LL408D LD A,#EF LL4082 RRCA CP A LL4084 ADD HL,HL DJNZ LL408A CALL LL4115 LL408A RLA JR C,LL4084 LL408D EXX LD H,#FF JR Z,LL409B LD H,A INC A LD A,(IX+#00) INC IX JR Z,LL40A6 LL409B LD L,A ADD HL,DE LDIR LL409F JR LL403E LL40A1 EXX RRC D JR LL403F LL40A6 CP #E0 JR C,LL409B RLCA XOR C INC A JR Z,LL40A1 SUB #10 LL40B1 LD L,A LD C,A LD H,#FF ADD HL,DE LDI LD A,(IX+#00) INC IX LD (DE),A INC HL INC DE LD A,(HL) JP LL403C LL40C4 LD A,#80 LL40C6 ADD HL,HL DJNZ LL40CC CALL LL4115 LL40CC ADC A,A JR NZ,LL40F3 JR C,LL40C6 LD A,#FC JR LL40F6 LL40D5 LD B,A LD C,(IX+#00) INC IX CCF JR LL4068 LL40DE CP #0F JR C,LL40D5 JR NZ,LL4067 RET LL40F3 SBC A,A LD A,#EF LL40F6 ADD HL,HL DJNZ LL40FC CALL LL4115 LL40FC RLA JR C,LL40F6 EXX JR NZ,LL40B1 BIT 7,A JR Z,LL40DE SUB #EA ADD A,A LD B,A LL410A LD A,(IX+#00) INC IX LD (DE),A INC DE DJNZ LL410A JR LL409F LL4115 LD B,C LD L,(IX+#00) INC IX LD H,(IX+#00) INC IX RET
asg/asm/rdmurmur2.asm
asgkafka/librdkafka
0
17794
*PROCESS DUPALIAS * * Compiled by DCC Version 2.25.07 Mar 6 2021 08:51:07 * on Fri Apr 30 15:36:20 2021 * WXTRN @@ZARCH# * * * * Code Section * @CODE ALIAS C'@RDMURMUR2' @CODE CSECT @CODE AMODE ANY @CODE RMODE ANY @DATA ALIAS C'@rdmurmur2' fprintf ALIAS C'fprintf' EXTRN fprintf __assert ALIAS C'@@ASSERT' EXTRN __assert __stderrp ALIAS C'@@STDERP' __stderrp DXD 0F rd_unittest_assert_on_failure ALIAS X'99846DA49589A3A385A2A36D81A2A2859* 9A36D96956D86818993A49985' rd_unittest_assert_on_failure DXD 0F * * * * ....... start of rd_murmur2 rd_murmur2 ALIAS X'99846D94A49994A499F2' @LNAME760 DS 0H DC X'0000000A' DC C'rd_murmur2' DC X'00' rd_murmur2 DCCPRLG CINDEX=760,BASER=12,FRAME=176,SAVEAREA=NO,ENTRY=YES,* ARCH=ZARCH,LNAMEADDR=@LNAME760 * ******* End of Prologue * * * *** const uint32_t seed = 0x9747b28c; LG 15,0(0,1) ; key LG 1,8(0,1) ; len IILF 4,X'9747B28C' ; -1756908916 * *** const uint32_t m = 0x5bd1e995; IILF 2,X'5BD1E995' ; 1540483477 * *** const int r = 24; LHI 3,24 ; 24 * *** uint32_t h = seed ^ (uint32_t)len; XR 4,1 * *** const unsigned char *tail; * *** * *** if (((((intptr_t)key & 0x3) == 0))) { LGR 5,15 NG 5,@lit_760_3 LTGR 5,5 BNE @L44 * *** * *** const uint32_t *data = (const uint32_t *)key; * *** * *** while (len >= 4) { B @L48 DS 0D @lit_760_3 DC FD'3' 0x0000000000000003 @L47 DS 0H * *** uint32_t k = __builtin_bswap32(*(uint3\ * 2_t *)data); LRV 5,0(0,15) * *** * *** { k *= m; k ^= k >> r; k *= m; h *= m;\ * h ^= k; }; MSR 5,2 LR 6,5 SRL 6,0(3) XR 5,6 MSR 5,2 MSR 4,2 XR 4,5 * *** * *** data++; LA 15,4(0,15) * *** len -= 4; AGHI 1,-4 * *** } @L48 DS 0H CLGFI 1,X'00000004' BNL @L47 * *** * *** tail = (const unsigned char *)data; * *** * *** } else { B @L54 @L44 DS 0H * *** * *** const unsigned char *data = (const unsigned ch\ * ar *)key; * *** * *** while (len >= 4) { B @L53 @L52 DS 0H * *** uint32_t k; * *** * *** k = data[0]; LLC 5,0(0,15) * *** k |= data[1] << 8; LLC 6,1(0,15) SLL 6,8(0) OR 5,6 * *** k |= data[2] << 16; LLC 6,2(0,15) SLL 6,16(0) OR 5,6 * *** k |= data[3] << 24; LLC 6,3(0,15) SLL 6,24(0) OR 5,6 * *** * *** { k *= m; k ^= k >> r; k *= m; h *= m;\ * h ^= k; }; MSR 5,2 LR 6,5 SRL 6,0(3) XR 5,6 MSR 5,2 MSR 4,2 XR 4,5 * *** * *** data += 4; LA 15,4(0,15) * *** len -= 4; AGHI 1,-4 * *** } @L53 DS 0H CLGFI 1,X'00000004' BNL @L52 * *** * *** tail = data; * *** } @L49 DS 0H * *** * *** * *** switch(len) B @L54 * *** { * *** case 3: h ^= tail[2] << 16; @L56 DS 0H LLC 1,2(0,15) SLL 1,16(0) XR 4,1 * *** case 2: h ^= tail[1] << 8; @L57 DS 0H LLC 1,1(0,15) SLL 1,8(0) XR 4,1 * *** case 1: h ^= tail[0]; @L58 DS 0H LLC 15,0(0,15) XR 4,15 * *** h *= m; MSR 4,2 * *** }; B @L55 @L54 DS 0H CLGFI 1,X'00000001' BL @L55 CLGFI 1,X'00000001' BE @L58 CLGFI 1,X'00000002' BE @L57 CLGFI 1,X'00000003' BE @L56 @L55 DS 0H * *** * *** h ^= h >> 13; LR 15,4 SRL 15,13(0) XR 4,15 * *** h *= m; MSR 4,2 * *** h ^= h >> 15; LR 15,4 SRL 15,15(0) XR 4,15 * *** * *** * *** * *** return h; LLGFR 15,4 * *** } * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "rd_murmur2" * (FUNCTION #760) * @AUTO#rd_murmur2 DSECT DS XL168 rd_murmur2#k#5 DS 1F ; k ORG @AUTO#rd_murmur2+168 rd_murmur2#k#2 DS 1F ; k ORG @AUTO#rd_murmur2+168 rd_murmur2#h#0 DS 1F ; h ORG @AUTO#rd_murmur2+168 rd_murmur2#r#0 DS 1F ; r ORG @AUTO#rd_murmur2+168 rd_murmur2#m#0 DS 1F ; m ORG @AUTO#rd_murmur2+168 rd_murmur2#seed#0 DS 1F ; seed * @CODE CSECT * * * * ....... start of unittest_murmur2 unittest_murmur2 ALIAS X'A49589A3A385A2A36D94A49994A499F2' @LNAME761 DS 0H DC X'00000010' DC C'unittest_murmur2' DC X'00' unittest_murmur2 DCCPRLG CINDEX=761,BASER=12,FRAME=352,ENTRY=YES,ARCH=Z* ARCH,LNAMEADDR=@LNAME761 DCCPRV REG=4 ; Get PRV from DVT * ******* End of Prologue * * * *** const char *short_unaligned = "1234"; LG 15,@lit_761_4 * *** const char *unaligned = "PreAmbleWillBeRemoved,ThePreP\ * artThatIs"; LA 1,6(0,15) * *** const char *keysToTest[] = { * *** "kafka", LA 2,46(0,15) STG 2,168(0,13) * *** "giberish123456789", LA 2,52(0,15) STG 2,176(0,13) * *** short_unaligned, STG 15,184(0,13) * *** short_unaligned+1, LA 2,1(0,15) STG 2,192(0,13) * *** short_unaligned+2, LA 2,2(0,15) STG 2,200(0,13) * *** short_unaligned+3, LA 2,3(0,15) STG 2,208(0,13) * *** unaligned, STG 1,216(0,13) * *** unaligned+1, LA 2,1(0,1) STG 2,224(0,13) * *** unaligned+2, LA 2,2(0,1) STG 2,232(0,13) * *** unaligned+3, LA 1,3(0,1) STG 1,240(0,13) * *** "", LA 15,70(0,15) STG 15,248(0,13) * *** ((void *)0), * *** }; * setting 8 bytes to 0x00 XC 256(8,13),256(13) * *** * *** const int32_t java_murmur2_results[] = { * *** 0xd067cf64, IILF 15,X'D067CF64' ; -798503068 ST 15,264(0,13) * *** 0x8f552b0c, IILF 15,X'8F552B0C' ; -1890243828 ST 15,268(0,13) * *** 0x9fc97b14, IILF 15,X'9FC97B14' ; -1614185708 ST 15,272(0,13) * *** 0xe7c009ca, IILF 15,X'E7C009CA' ; -406844982 ST 15,276(0,13) * *** 0x873930da, IILF 15,X'873930DA' ; -2026295078 ST 15,280(0,13) * *** 0x5a4b5ca1, IILF 15,X'5A4B5CA1' ; 1514888353 ST 15,284(0,13) * *** 0x78424f1c, IILF 15,X'78424F1C' ; 2017611548 ST 15,288(0,13) * *** 0x4a62b377, IILF 15,X'4A62B377' ; 1247982455 ST 15,292(0,13) * *** 0xe0e4e09e, IILF 15,X'E0E4E09E' ; -521871202 ST 15,296(0,13) * *** 0x62b8b43f, IILF 15,X'62B8B43F' ; 1656271935 ST 15,300(0,13) * *** 0x106e08d9, IILF 15,X'106E08D9' ; 275646681 ST 15,304(0,13) * *** 0x106e08d9, ST 15,308(0,13) * *** }; * *** * *** size_t i; * *** for (i = 0; i < (sizeof((keysToTest)) / sizeof(*(keysT\ * oTest))); i++) { LGHI 2,0 ; 0 B @L60 DS 0D @FRAMESIZE_761 DC F'352' @lit_761_4 DC AD(@strings@) @lit_761_19 DC AD(rd_murmur2) @lit_761_23 DC AD(fprintf) @lit_761_22 DC AD(@DATA) @lit_761_20 DC Q(__stderrp) @lit_761_28 DC Q(rd_unittest_assert_on_failure) @lit_761_29 DC AD(__assert) @L59 DS 0H * *** uint32_t h = rd_murmur2(keysToTest[i], * *** keysToTest[i] ? SLLG 15,2,3(0) ; *0x8 LTG 15,168(15,13) BZ @L63 * *** __strlen(keysToTest[i]\ * ) : 0); SLLG 15,2,3(0) ; *0x8 LG 15,168(15,13) LGR 1,15 LGHI 0,0 @@gen_label4 DS 0H SRST 0,15 BC 1,@@gen_label4 SLGR 0,1 B @L64 @L63 DS 0H LGHI 0,0 ; 0 @L64 DS 0H SLLG 15,2,3(0) ; *0x8 LG 15,168(15,13) STMG 15,0,312(13) LA 1,312(0,13) LG 15,@lit_761_19 ; rd_murmur2 @@gen_label5 DS 0H BALR 14,15 @@gen_label6 DS 0H LR 3,15 * *** do { if (!((int32_t)h == java_murmur2_results[\ * i])) { fprintf(__stderrp, "\033[31mRDUT: FAIL: %s:%d: %s: " "assert \ * failed: " "(int32_t)h == java_murmur2_results[i]" ": ", "C:\\asgkafk\ * a\\librdkafka\\src\\rdmurmur2.c", 153, __FUNCTION__); fprintf(__stde\ * rrp, "Calculated murmur2 hash 0x%x for \"%s\", " "expected 0x%x", h,\ * keysToTest[i], java_murmur2_results[i]); fprintf(__stderrp, "\033[0\ * m\n"); if (rd_unittest_assert_on_failure) (((int32_t)h == java_murmu\ * r2_results[i]) ? (void)0 : __assert(__func__, "C:\\asgkafka\\librdka\ * fka\\src\\rdmurmur2.c", 153, "(int32_t)h == java_murmur2_results[i]"\ * )); return 1; } } while (0); @L65 DS 0H SLLG 15,2,2(0) ; *0x4 C 3,264(15,13) BE @L68 LLGF 5,@lit_761_20 ; __stderrp LG 15,0(5,4) ; __stderrp STG 15,312(0,13) LG 6,@lit_761_4 LA 15,72(0,6) STG 15,320(0,13) LA 15,156(0,6) STG 15,328(0,13) MVGHI 336(13),153 LG 7,@lit_761_22 LA 15,70(0,7) STG 15,344(0,13) LA 1,312(0,13) LG 8,@lit_761_23 ; fprintf LGR 15,8 @@gen_label8 DS 0H BALR 14,15 @@gen_label9 DS 0H LG 15,0(5,4) ; __stderrp STG 15,312(0,13) LA 15,196(0,6) STG 15,320(0,13) LLGFR 15,3 STG 15,328(0,13) SLLG 15,2,3(0) ; *0x8 LG 15,168(15,13) STG 15,336(0,13) SLLG 15,2,2(0) ; *0x4 LGF 15,264(15,13) STG 15,344(0,13) LA 1,312(0,13) LGR 15,8 @@gen_label10 DS 0H BALR 14,15 @@gen_label11 DS 0H LG 15,0(5,4) ; __stderrp STG 15,312(0,13) LA 15,250(0,6) STG 15,320(0,13) LA 1,312(0,13) LGR 15,8 @@gen_label12 DS 0H BALR 14,15 @@gen_label13 DS 0H LLGF 15,@lit_761_28 ; rd_unittest_assert_on_failure LA 15,0(15,4) CLI 0(15),0 BE @L69 SLLG 15,2,2(0) ; *0x4 C 3,264(15,13) BE @L69 @L70 DS 0H LA 15,70(0,7) STG 15,312(0,13) LA 15,156(0,6) STG 15,320(0,13) MVGHI 328(13),153 LA 15,256(0,6) STG 15,336(0,13) LA 1,312(0,13) LG 15,@lit_761_29 ; __assert @@gen_label16 DS 0H BALR 14,15 @@gen_label17 DS 0H @L71 DS 0H @L69 DS 0H LGHI 15,1 ; 1 B @ret_lab_761 @L68 DS 0H * *** * *** * *** * *** } AGHI 2,1 @L60 DS 0H CLGFI 2,X'0000000C' BL @L59 * *** do { fprintf(__stderrp, "\033[32mRDUT: PASS: %s:%d: %s\ * \033[0m\n", "C:\\asgkafka\\librdkafka\\src\\rdmurmur2.c", 158, __FUN\ * CTION__); return 0; } while (0); @L72 DS 0H LLGF 15,@lit_761_20 ; __stderrp LG 15,0(15,4) ; __stderrp STG 15,312(0,13) LG 15,@lit_761_4 LA 1,294(0,15) STG 1,320(0,13) LA 15,156(0,15) STG 15,328(0,13) MVGHI 336(13),158 LG 15,@lit_761_22 LA 15,70(0,15) STG 15,344(0,13) LA 1,312(0,13) LG 15,@lit_761_23 ; fprintf @@gen_label19 DS 0H BALR 14,15 @@gen_label20 DS 0H LGHI 15,0 ; 0 * *** } @ret_lab_761 DS 0H * * **** Start of Epilogue DCCEPIL * * **** End of Epilogue DROP 12 * * DSECT for automatic variables in "unittest_murmur2" * (FUNCTION #761) * @AUTO#unittest_murmur2 DSECT DS XL168 unittest_murmur2#h#1 DS 1F ; h ORG @AUTO#unittest_murmur2+168 unittest_murmur2#i#0 DS 8XL1 ; i ORG @AUTO#unittest_murmur2+168 unittest_murmur2#keys$To$Test#0 DS 96XL1 ; keysToTest ORG @AUTO#unittest_murmur2+264 unittest_murmur2#java_murmur2_results#0 DS 48XL1 ; java_murmur2_results * @CODE CSECT @@STATIC ALIAS X'7C998494A49994A499F250' @@STATIC DXD 64D * * Non-Re-Entrant Data Section * @DATA CSECT @DATA RMODE ANY @DATA AMODE ANY @@T349 DC X'99846D838193939683' rd.calloc DC 1X'00' @@T34D DC X'99846D948193939683' rd.malloc DC 1X'00' @@T352 DC X'99846D99858193939683' rd.realloc DC 2X'00' @@T358 DC X'99846DA2A39984A497' rd.strdup DC 1X'00' @@T35D DC X'99846DA2A3999584A497' rd.strndup DC 2X'00' @@T365 DC X'99846D9985868395A36DA2A482F0' rd.refcnt.sub0 DC 2X'00' @@T37E DC X'A49589A3A385A2A36D94A49994A499F2' unittest.murmur2 DC 1X'00' @strings@ DS 0H DC X'F1F2F3F40000D79985C194829385E689' 1234..PreAmbleWi DC X'9393C285D9859496A585846BE38885D7' llBeRemoved.TheP DC X'9985D78199A3E38881A3C9A200009281' rePartThatIs..ka DC X'86928100878982859989A288F1F2F3F4' fka.giberish1234 DC X'F5F6F7F8F90000001BADF3F194D9C4E4' 56789.....31mRDU DC X'E37A40C6C1C9D37A406CA27A6C847A40' T..FAIL...s..d.. DC X'6CA27A4081A2A28599A3408681899385' .s..assert.faile DC X'847A404D8995A3F3F26DA35D88407E7E' d...int32.t.h... DC X'409181A5816D94A49994A499F26D9985' .java.murmur2.re DC X'A2A493A3A2AD89BD7A400000C37AE081' sults.i.....C..a DC X'A2879281869281E09389829984928186' sgkafka.librdkaf DC X'9281E0A29983E0998494A49994A499F2' ka.src.rdmurmur2 DC X'4B830000C3819383A49381A385844094' .c..Calculated.m DC X'A49994A499F2408881A28840F0A76CA7' urmur2.hash.0x.x DC X'40869699407F6CA27F6B4085A7978583' .for...s...expec DC X'A3858440F0A76CA700001BADF0941500' ted.0x.x....0m.. DC X'4D8995A3F3F26DA35D88407E7E409181' .int32.t.h....ja DC X'A5816D94A49994A499F26D9985A2A493' va.murmur2.resul DC X'A3A2AD89BD001BADF3F294D9C4E4E37A' ts.i....32mRDUT. DC X'40D7C1E2E27A406CA27A6C847A406CA2' .PASS...s..d...s DC X'1BADF0941500' ..0m.. @Erd_unittest_assert_on_failure ALIAS X'99846DA49589A3A385A2A36D81A2A28* 599A36D96956D86818993A49985' EXTRN @Erd_unittest_assert_on_failure @E__stderrp ALIAS C'@@STDERP' EXTRN @E__stderrp * * * Re-entrant Data Initialization Section * @@INIT@ ALIAS C'rdmurmur2:' @@INIT@ CSECT @@INIT@ AMODE ANY @@INIT@ RMODE ANY DC XL1'5' DC AL3(0) DC AL4(288) DC 4X'00' DC Q(@@STATIC) DC X'00000000' DC X'00000001' DC X'00000000' DC X'000000FF' DC X'0102039C09867F978D8E0B0C0D0E0F10' .....f.p........ DC X'1112139D8508871819928F1C1D1E1F80' ....e.g..k...... DC X'818283840A171B88898A8B8C05060790' abcd...hi....... DC X'9116939495960498999A9B14159E1A20' j.lmno.qr....... DC X'A0E2E4E0E1E3E5E7F1A22E3C282B7C26' .SU..TVX1s...... DC X'E9EAEBE8EDEEEFECDF21242A293B5E2D' Z..Y............ DC X'2FC2C4C0C1C3C5C7D1A62C255F3E3FF8' .BD.ACEGJw.....8 DC X'C9CACBC8CDCECFCC603A2340273D22D8' I..H...........Q DC X'616263646566676869ABBBF0FDFEB1B0' ...........0.... DC X'6A6B6C6D6E6F707172AABAE6B8C6A4B5' ...........W.Fu. DC X'7E737475767778797AA1BFD05BDEAEAC' ................ DC X'A3A5B7A9A7B6BCBDBEDDA8AF5DB4D77B' tv.zx.....y...P. DC X'414243444546474849ADF4F6F2F3F57D' ..........46235. DC X'4A4B4C4D4E4F505152B9FBFCF9FAFF5C' ............9... DC X'F7535455565758595AB2D4D6D2D3D530' 7.........MOKLN. DC X'313233343536373839B3DBDCD9DA9F40' ............R... * DC XL1'5' DC AL3(0) DC AL4(480) DC 4X'00' DC Q(@@STATIC) DC X'00000000' DC X'00000101' DC X'00000000' DC X'000000A0' DC X'010203372D2E2F1605150B0C0D0E0F10' ................ DC X'1112133C3D322618193F271C1D1E1F40' ................ DC X'5A7F7B5B6C507D4D5D5C4E6B604B61F0' ...............0 DC X'F1F2F3F4F5F6F7F8F97A5E4C7E6E6F7C' 123456789....... DC X'C1C2C3C4C5C6C7C8C9D1D2D3D4D5D6D7' ABCDEFGHIJKLMNOP DC X'D8D9E2E3E4E5E6E7E8E9ADE0BD5F6D79' QRSTUVWXYZ...... DC X'81828384858687888991929394959697' abcdefghijklmnop DC X'9899A2A3A4A5A6A7A8A9C04FD0A10720' qrstuvwxyz...... DC X'2122232425061728292A2B2C090A1B30' ................ DC X'311A333435360838393A3B04143EFF80' ................ * DC XL1'5' DC AL3(0) DC AL4(520) DC 4X'00' DC Q(@@STATIC) DC X'00000000' DC X'000001C0' DC X'00000000' DC X'00000001' DC X'8A40404040404040' ........ * DC XL1'5' DC AL3(0) DC AL4(0) DC 4X'00' DC Q(@@STATIC) DC X'00000000' DC X'000001E0' DC X'00000000' DC X'00000001' DC X'8B40404040404040' ........ * END
src/_demo/output_sink_as_shared_instance/apsepp_demo_osasi_instance_client.ads
thierr26/ada-apsepp
0
13979
<reponame>thierr26/ada-apsepp -- Copyright (C) 2019 <NAME> <<EMAIL>> -- MIT license. Please refer to the LICENSE file. package Apsepp_Demo_OSASI_Instance_Client is procedure Output_Sink_Client; end Apsepp_Demo_OSASI_Instance_Client;
HlslDecompiler.Tests/ShaderAssembly/ps_float4_construct.asm
TBirdSoars/HlslDecompiler
20
89251
ps_3_0 def c0, 1, 0, 2, 0 dcl_texcoord v0 mov oC0, v0 mul oC1, c0.xxxy, v0.xyzx mad oC2, v0.xyxx, c0.xxyy, c0.yyyx mad oC3, v0.x, c0.xyyy, c0.yyxz
VPL.g4
lamhacker/VPL-Compiler
2
7649
// Define a grammar called VPL grammar VPL; program : function_declaration program | EOF // not sure about this ; function_declaration : FUNC IDENT parameter variable_declaration statement END ; parameter : '(' name ')' ; name : IDENT # parameterName | IDENT ',' name # multParameterName ; variable_declaration : VAR name ';' | ; statement : IF compare THEN statement ENDIF nest_statement # condition | WHILE compare DO statement ENDWHILE nest_statement # whileloop | IDENT '=' expression nest_statement # assign | # noneStatement ; nest_statement : ';' statement nest_statement | ; expression : ADD '(' expression ',' expression ')' # addExpression | MINUS '(' expression ',' expression ')' # minusExpression | MULT '(' expression ',' expression ')' # multExpression | DIV '(' expression ',' expression ')' # divExpression | MIN '(' expression ',' expression ')' # minExpression | '(' expression ')' # parenthesisExpression | IDENT # idenetExpression | NUM # numExpression ; compare : expression '<' NUM # lessThan | expression '>=' NUM # largeThan ; fragment LETTER : [a-zA-Z] ; fragment DIGIT : [0-9] ; FUNC : 'func' ; END : 'end' ; VAR : 'var' ; IF : 'if' ; THEN : 'then' ; ENDIF : 'endif' ; ENDWHILE : 'endwhile' ; WHILE : 'while' ; DO : 'do' ; ADD : 'add' ; MINUS : 'minus' ; MULT : 'mult' ; DIV : 'div' ; MIN : 'min' ; IDENT : (LETTER | '_') (LETTER | '_' | DIGIT)* ; NUM : DIGIT+ ('.' DIGIT+)? ; WS : (' ' | '\t'| '\n') -> channel(HIDDEN);
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/フランス_PAL/Fra_asm1/zel_bgwt.asm
prismotizm/gigaleak
0
105492
<filename>other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/フランス_PAL/Fra_asm1/zel_bgwt.asm Name: zel_bgwt.asm Type: file Size: 295027 Last-Modified: '2016-05-13T04:20:48Z' SHA-1: AF7D060673D620353D9379CB10C9B3B4F6788395 Description: null
programs/oeis/074/A074929.asm
neoneye/loda
22
102133
; A074929: a(n)>0 such that p(n)*p(n+1)-a(n) is a maximal square. ; 2,6,10,13,22,25,34,37,42,58,58,73,82,85,90,102,118,118,133,142,142,157,162,169,193,202,205,214,217,190,253,258,274,262,298,298,310,325,330,342,358,346,382,385,394,373,397,445,454,457,462,478,466,498,510 seq $0,6094 ; Products of 2 successive primes. seq $0,53186 ; Square excess of n: difference between n and largest square <= n.
src/Control/Monad/Error.agda
andreasabel/cubical
0
14930
<filename>src/Control/Monad/Error.agda open import Function using (id) renaming (_∘′_ to _∘_) open import Relation.Binary.PropositionalEquality open ≡-Reasoning open import Control.Monad module Control.Monad.Error (E : Set) where -- The Error monad. data Error (A : Set) : Set where fail : (e : E) → Error A return : (a : A) → Error A -- The following are axiliary definitions for the constructor of errorIsMonad. module Local where -- Bind. _>>=_ : ∀ {A B} (m : Error A) (k : A → Error B) → Error B fail e >>= k = fail e return a >>= k = k a bind = _>>=_ -- Laws of bind. beta : ∀ {A B} (k : A → Error B) (a : A) → return a >>= k ≡ k a beta k a = refl eta : ∀ {A} (m : Error A) → m >>= return ≡ m eta (fail e) = refl eta (return a) = refl assoc : ∀ {A B C} (m : Error A) {k : A → Error B} {l : B → Error C} → (m >>= k) >>= l ≡ m >>= λ a → (k a >>= l) assoc (fail e) = refl assoc (return a) = refl open Local public -- The monad instance of Error. errorIsMonad : IsMonad Error errorIsMonad = record { ops = record { return = return ; _>>=_ = bind } ; laws = record { bind-β = beta ; bind-η = eta ; bind-assoc = assoc } }
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_261.asm
ljhsiun2/medusa
9
13307
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r14 push %r8 push %rcx push %rdi push %rsi lea addresses_D_ht+0xcca4, %r14 nop xor %rdi, %rdi mov $0x6162636465666768, %r10 movq %r10, %xmm3 and $0xffffffffffffffc0, %r14 vmovaps %ymm3, (%r14) nop nop nop nop add %r8, %r8 lea addresses_D_ht+0x7624, %rsi lea addresses_UC_ht+0xb6a4, %rdi nop nop nop nop nop xor $32408, %r13 mov $107, %rcx rep movsq nop nop nop nop cmp $47823, %r13 lea addresses_D_ht+0xaea4, %r13 sub $57076, %r14 movb (%r13), %cl nop sub $441, %r13 lea addresses_D_ht+0xc4a4, %r8 nop nop nop and $42126, %r10 mov $0x6162636465666768, %rsi movq %rsi, (%r8) nop nop nop nop cmp %r8, %r8 lea addresses_UC_ht+0x8a64, %rcx nop nop nop nop inc %r13 movb (%rcx), %r8b nop nop add $5995, %r14 pop %rsi pop %rdi pop %rcx pop %r8 pop %r14 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %r8 push %r9 push %rbx push %rdi push %rsi // Store lea addresses_UC+0x1e124, %r13 nop nop nop cmp $10396, %rdi movb $0x51, (%r13) nop nop nop xor %r13, %r13 // Faulty Load lea addresses_WC+0x8ca4, %rbx inc %rdi mov (%rbx), %r13d lea oracles, %rsi and $0xff, %r13 shlq $12, %r13 mov (%rsi,%r13,1), %r13 pop %rsi pop %rdi pop %rbx pop %r9 pop %r8 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_UC'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': True, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_D_ht'}} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': True, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_D_ht'}} {'src': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 1, 'NT': True, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
programs/oeis/247/A247049.asm
jmorken/loda
1
3275
<gh_stars>1-10 ; A247049: Rectangular array read upwards by columns: T = T(n,k) = number of paths from (0,0) to (n,k), where 0 >= k <= 2, consisting of segments given by the vectors (1,1), (1,2), (1,-1). ; 1,0,0,0,1,1,1,1,1,1,2,2,2,3,3,3,5,5,5,8,8,8,13,13,13,21,21,21,34,34,34,55,55,55,89,89,89,144,144,144,233,233,233,377,377,377,610,610,610,987,987,987,1597,1597,1597,2584,2584,2584,4181,4181,4181,6765,6765,6765,10946,10946,10946,17711,17711,17711,28657,28657,28657,46368,46368,46368,75025,75025,75025,121393,121393,121393,196418,196418,196418,317811,317811,317811,514229,514229,514229,832040,832040,832040,1346269,1346269,1346269,2178309,2178309,2178309,3524578,3524578,3524578,5702887,5702887,5702887,9227465,9227465,9227465,14930352,14930352,14930352,24157817,24157817,24157817,39088169,39088169,39088169,63245986,63245986,63245986,102334155,102334155,102334155,165580141,165580141,165580141,267914296,267914296,267914296,433494437,433494437,433494437,701408733,701408733,701408733,1134903170,1134903170,1134903170,1836311903,1836311903,1836311903,2971215073,2971215073,2971215073,4807526976,4807526976,4807526976,7778742049,7778742049,7778742049,12586269025,12586269025,12586269025,20365011074,20365011074,20365011074,32951280099,32951280099,32951280099,53316291173,53316291173,53316291173,86267571272,86267571272,86267571272,139583862445,139583862445,139583862445,225851433717,225851433717,225851433717,365435296162,365435296162,365435296162,591286729879,591286729879,591286729879,956722026041,956722026041,956722026041,1548008755920,1548008755920,1548008755920,2504730781961,2504730781961,2504730781961,4052739537881,4052739537881,4052739537881,6557470319842,6557470319842,6557470319842,10610209857723,10610209857723,10610209857723,17167680177565,17167680177565,17167680177565,27777890035288,27777890035288,27777890035288,44945570212853,44945570212853,44945570212853,72723460248141,72723460248141,72723460248141,117669030460994,117669030460994,117669030460994,190392490709135,190392490709135,190392490709135,308061521170129,308061521170129,308061521170129,498454011879264,498454011879264,498454011879264,806515533049393,806515533049393,806515533049393,1304969544928657,1304969544928657,1304969544928657,2111485077978050,2111485077978050,2111485077978050,3416454622906707,3416454622906707,3416454622906707,5527939700884757,5527939700884757,5527939700884757,8944394323791464,8944394323791464,8944394323791464 mov $1,1 lpb $0 trn $0,3 mov $2,$3 add $3,$1 mov $1,$2 lpe
Task/Mutual-recursion/AppleScript/mutual-recursion-2.applescript
LaudateCorpus1/RosettaCodeData
1
1672
<gh_stars>1-10 {{1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 8, 8, 9, 9, 10, 11, 11, 12}, {0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12}}
programs/oeis/007/A007611.asm
karttu/loda
0
80334
<gh_stars>0 ; A007611: a(n) = n! + 2^n. ; 2,3,6,14,40,152,784,5168,40576,363392,3629824,39918848,479005696,6227028992,87178307584,1307674400768,20922789953536,355687428227072,6402373705990144 mov $2,2 mov $1,$0 fac $1 pow $2,$0 add $1,$2
test/Fail/RewritingNotSafe.agda
redfish64/autonomic-agda
0
13279
<reponame>redfish64/autonomic-agda -- Andreas, 2015-08-26 {-# OPTIONS --rewriting #-} -- Should give error open import Common.Equality {-# BUILTIN REWRITE _≡_ #-} {-# REWRITE refl #-}
models/DescTT.agda
mietek/epigram
48
16168
<reponame>mietek/epigram {-# OPTIONS --type-in-type #-} module DescTT where --******************************************** -- Prelude --******************************************** -- Some preliminary stuffs, to avoid relying on the stdlib --**************** -- Sigma and friends --**************** data Sigma (A : Set) (B : A -> Set) : Set where _,_ : (x : A) (y : B x) -> Sigma A B _*_ : (A : Set)(B : Set) -> Set A * B = Sigma A \_ -> B fst : {A : Set}{B : A -> Set} -> Sigma A B -> A fst (a , _) = a snd : {A : Set}{B : A -> Set} (p : Sigma A B) -> B (fst p) snd (a , b) = b data Zero : Set where data Unit : Set where Void : Unit --**************** -- Sum and friends --**************** data _+_ (A : Set)(B : Set) : Set where l : A -> A + B r : B -> A + B --**************** -- Equality --**************** data _==_ {A : Set}(x : A) : A -> Set where refl : x == x cong : {A B : Set}(f : A -> B){x y : A} -> x == y -> f x == f y cong f refl = refl cong2 : {A B C : Set}(f : A -> B -> C){x y : A}{z t : B} -> x == y -> z == t -> f x z == f y t cong2 f refl refl = refl postulate reflFun : {A : Set}{B : A -> Set}(f : (a : A) -> B a)(g : (a : A) -> B a)-> ((a : A) -> f a == g a) -> f == g --******************************************** -- Desc code --******************************************** data Desc : Set where id : Desc const : Set -> Desc prod : Desc -> Desc -> Desc sigma : (S : Set) -> (S -> Desc) -> Desc pi : (S : Set) -> (S -> Desc) -> Desc --******************************************** -- Desc interpretation --******************************************** [|_|]_ : Desc -> Set -> Set [| id |] Z = Z [| const X |] Z = X [| prod D D' |] Z = [| D |] Z * [| D' |] Z [| sigma S T |] Z = Sigma S (\s -> [| T s |] Z) [| pi S T |] Z = (s : S) -> [| T s |] Z --******************************************** -- Fixpoint construction --******************************************** data Mu (D : Desc) : Set where con : [| D |] (Mu D) -> Mu D --******************************************** -- Predicate: All --******************************************** All : (D : Desc)(X : Set)(P : X -> Set) -> [| D |] X -> Set All id X P x = P x All (const Z) X P x = Unit All (prod D D') X P (d , d') = (All D X P d) * (All D' X P d') All (sigma S T) X P (a , b) = All (T a) X P b All (pi S T) X P f = (s : S) -> All (T s) X P (f s) all : (D : Desc)(X : Set)(P : X -> Set)(R : (x : X) -> P x)(x : [| D |] X) -> All D X P x all id X P R x = R x all (const Z) X P R z = Void all (prod D D') X P R (d , d') = all D X P R d , all D' X P R d' all (sigma S T) X P R (a , b) = all (T a) X P R b all (pi S T) X P R f = \ s -> all (T s) X P R (f s) --******************************************** -- Map --******************************************** map : (D : Desc)(X Y : Set)(f : X -> Y)(v : [| D |] X) -> [| D |] Y map id X Y sig x = sig x map (const Z) X Y sig z = z map (prod D D') X Y sig (d , d') = map D X Y sig d , map D' X Y sig d' map (sigma S T) X Y sig (a , b) = (a , map (T a) X Y sig b) map (pi S T) X Y sig f = \x -> map (T x) X Y sig (f x) proof-map-id : (D : Desc)(X : Set)(v : [| D |] X) -> map D X X (\x -> x) v == v proof-map-id id X v = refl proof-map-id (const Z) X v = refl proof-map-id (prod D D') X (v , v') = cong2 (\x y -> (x , y)) (proof-map-id D X v) (proof-map-id D' X v') proof-map-id (sigma S T) X (a , b) = cong (\x -> (a , x)) (proof-map-id (T a) X b) proof-map-id (pi S T) X f = reflFun (\a -> map (T a) X X (\x -> x) (f a)) f (\a -> proof-map-id (T a) X (f a)) proof-map-compos : (D : Desc)(X Y Z : Set) (f : X -> Y)(g : Y -> Z) (v : [| D |] X) -> map D X Z (\x -> g (f x)) v == map D Y Z g (map D X Y f v) proof-map-compos id X Y Z f g v = refl proof-map-compos (const K) X Y Z f g v = refl proof-map-compos (prod D D') X Y Z f g (v , v') = cong2 (\x y -> (x , y)) (proof-map-compos D X Y Z f g v) (proof-map-compos D' X Y Z f g v') proof-map-compos (sigma S T) X Y Z f g (a , b) = cong (\x -> (a , x)) (proof-map-compos (T a) X Y Z f g b) proof-map-compos (pi S T) X Y Z f g fc = reflFun (\a -> map (T a) X Z (\x -> g (f x)) (fc a)) (\a -> map (T a) Y Z g (map (T a) X Y f (fc a))) (\a -> proof-map-compos (T a) X Y Z f g (fc a)) --******************************************** -- Elimination principle: induction --******************************************** {- induction : (D : Desc) (P : Mu D -> Set) -> ( (x : [| D |] (Mu D)) -> All D (Mu D) P x -> P (con x)) -> (v : Mu D) -> P v induction D P ms (con xs) = ms xs (all D (Mu D) P (\x -> induction D P ms x) xs) -} module Elim (D : Desc) (P : Mu D -> Set) (ms : (x : [| D |] (Mu D)) -> All D (Mu D) P x -> P (con x)) where mutual induction : (x : Mu D) -> P x induction (con xs) = ms xs (hyps D xs) hyps : (D' : Desc) (xs : [| D' |] (Mu D)) -> All D' (Mu D) P xs hyps id x = induction x hyps (const Z) z = Void hyps (prod D D') (d , d') = hyps D d , hyps D' d' hyps (sigma S T) (a , b) = hyps (T a) b hyps (pi S T) f = \s -> hyps (T s) (f s) induction : (D : Desc) (P : Mu D -> Set) -> ( (x : [| D |] (Mu D)) -> All D (Mu D) P x -> P (con x)) -> (v : Mu D) -> P v induction D P ms x = Elim.induction D P ms x --******************************************** -- Examples --******************************************** --**************** -- Nat --**************** data NatConst : Set where Ze : NatConst Suc : NatConst natCases : NatConst -> Desc natCases Ze = const Unit natCases Suc = id NatD : Desc NatD = sigma NatConst natCases Nat : Set Nat = Mu NatD ze : Nat ze = con (Ze , Void) suc : Nat -> Nat suc n = con (Suc , n) --**************** -- List --**************** data ListConst : Set where Nil : ListConst Cons : ListConst listCases : Set -> ListConst -> Desc listCases X Nil = const Unit listCases X Cons = sigma X (\_ -> id) ListD : Set -> Desc ListD X = sigma ListConst (listCases X) List : Set -> Set List X = Mu (ListD X) nil : {X : Set} -> List X nil = con ( Nil , Void ) cons : {X : Set} -> X -> List X -> List X cons x t = con ( Cons , ( x , t )) --**************** -- Tree --**************** data TreeConst : Set where Leaf : TreeConst Node : TreeConst treeCases : Set -> TreeConst -> Desc treeCases X Leaf = const Unit treeCases X Node = sigma X (\_ -> prod id id) TreeD : Set -> Desc TreeD X = sigma TreeConst (treeCases X) Tree : Set -> Set Tree X = Mu (TreeD X) leaf : {X : Set} -> Tree X leaf = con (Leaf , Void) node : {X : Set} -> X -> Tree X -> Tree X -> Tree X node x le ri = con (Node , (x , (le , ri))) --******************************************** -- Finite sets --******************************************** EnumU : Set EnumU = Nat nilE : EnumU nilE = ze consE : EnumU -> EnumU consE e = suc e {- data EnumU : Set where nilE : EnumU consE : EnumU -> EnumU -} data EnumT : (e : EnumU) -> Set where EZe : {e : EnumU} -> EnumT (consE e) ESu : {e : EnumU} -> EnumT e -> EnumT (consE e) casesSpi : (xs : [| NatD |] Nat) -> All NatD Nat (\e -> (P' : EnumT e -> Set) -> Set) xs -> (P' : EnumT (con xs) -> Set) -> Set casesSpi (Ze , Void) hs P' = Unit casesSpi (Suc , n) hs P' = P' EZe * hs (\e -> P' (ESu e)) spi : (e : EnumU)(P : EnumT e -> Set) -> Set spi e P = induction NatD (\e -> (P : EnumT e -> Set) -> Set) casesSpi e P {- spi : (e : EnumU)(P : EnumT e -> Set) -> Set spi nilE P = Unit spi (consE e) P = P EZe * spi e (\e -> P (ESu e)) -} casesSwitch : (xs : [| NatD |] Nat) -> All NatD Nat (\e -> (P' : EnumT e -> Set)(b' : spi e P')(x' : EnumT e) -> P' x') xs -> (P' : EnumT (con xs) -> Set)(b' : spi (con xs) P')(x' : EnumT (con xs)) -> P' x' casesSwitch (Ze , Void) hs P' b' () casesSwitch (Suc , n) hs P' b' EZe = fst b' casesSwitch (Suc , n) hs P' b' (ESu e') = hs (\e -> P' (ESu e)) (snd b') e' switch : (e : EnumU)(P : EnumT e -> Set)(b : spi e P)(x : EnumT e) -> P x switch e P b x = induction NatD (\e -> (P : EnumT e -> Set)(b : spi e P)(x : EnumT e) -> P x) casesSwitch e P b x {- switch : (e : EnumU)(P : EnumT e -> Set)(b : spi e P)(x : EnumT e) -> P x switch nilE P b () switch (consE e) P b EZe = fst b switch (consE e) P b (ESu n) = switch e (\e -> P (ESu e)) (snd b) n -} --******************************************** -- Tagged description --******************************************** TagDesc : Set TagDesc = Sigma EnumU (\e -> spi e (\_ -> Desc)) toDesc : TagDesc -> Desc toDesc (B , F) = sigma (EnumT B) (\e -> switch B (\_ -> Desc) F e) --******************************************** -- Catamorphism --******************************************** cata : (D : Desc) (T : Set) -> ([| D |] T -> T) -> (Mu D) -> T cata D T phi x = induction D (\_ -> T) (\x ms -> phi (replace D T x ms)) x where replace : (D' : Desc)(T : Set)(xs : [| D' |] (Mu D))(ms : All D' (Mu D) (\_ -> T) xs) -> [| D' |] T replace id T x y = y replace (const Z) T z z' = z replace (prod D D') T (x , x') (y , y') = replace D T x y , replace D' T x' y' replace (sigma A B) T (a , b) t = a , replace (B a) T b t replace (pi A B) T f t = \s -> replace (B s) T (f s) (t s) --******************************************** -- Free monad construction --******************************************** _**_ : TagDesc -> (X : Set) -> TagDesc (e , D) ** X = consE e , (const X , D) --******************************************** -- Substitution --******************************************** apply : (D : TagDesc)(X Y : Set) -> (X -> Mu (toDesc (D ** Y))) -> [| toDesc (D ** X) |] (Mu (toDesc (D ** Y))) -> Mu (toDesc (D ** Y)) apply (E , B) X Y sig (EZe , x) = sig x apply (E , B) X Y sig (ESu n , t) = con (ESu n , t) subst : (D : TagDesc)(X Y : Set) -> Mu (toDesc (D ** X)) -> (X -> Mu (toDesc (D ** Y))) -> Mu (toDesc (D ** Y)) subst D X Y x sig = cata (toDesc (D ** X)) (Mu (toDesc (D ** Y))) (apply D X Y sig) x
source/webdriver-remote-elements.adb
reznikmm/webdriver
2
15201
<filename>source/webdriver-remote-elements.adb -- Copyright (c) 2017 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with League.JSON.Arrays; with League.JSON.Values; separate (WebDriver.Remote) package body Elements is function "+" (Text : Wide_Wide_String) return League.Strings.Universal_String renames League.Strings.To_Universal_String; function To_Path (Self : access Element; Command : Wide_Wide_String; Suffix : League.Strings.Universal_String := League.Strings.Empty_Universal_String) return League.Strings.Universal_String; ----------- -- Clear -- ----------- overriding procedure Clear (Self : access Element) is Command : WebDriver.Remote.Command; Response : WebDriver.Remote.Response; pragma Unreferenced (Response); begin Command.Method := Get; Command.Path := To_Path (Self, "/clear"); Response := Self.Executor.Execute (Command); end Clear; ----------- -- Click -- ----------- overriding procedure Click (Self : access Element) is Command : WebDriver.Remote.Command; Response : WebDriver.Remote.Response; pragma Unreferenced (Response); begin Command.Method := Get; Command.Path := To_Path (Self, "/click"); Response := Self.Executor.Execute (Command); end Click; ------------------- -- Get_Attribute -- ------------------- overriding function Get_Attribute (Self : access Element; Name : League.Strings.Universal_String) return League.Strings.Universal_String is Command : WebDriver.Remote.Command; Response : WebDriver.Remote.Response; begin Command.Method := Get; Command.Path := To_Path (Self, "/attribute", Name); Response := Self.Executor.Execute (Command); return Response.Value (+"value").To_String; end Get_Attribute; ------------------- -- Get_CSS_Value -- ------------------- overriding function Get_CSS_Value (Self : access Element; Name : League.Strings.Universal_String) return League.Strings.Universal_String is Command : WebDriver.Remote.Command; Response : WebDriver.Remote.Response; begin Command.Method := Get; Command.Path := To_Path (Self, "/css", Name); Response := Self.Executor.Execute (Command); return Response.Value (+"value").To_String; end Get_CSS_Value; ------------------ -- Get_Property -- ------------------ overriding function Get_Property (Self : access Element; Name : League.Strings.Universal_String) return League.Strings.Universal_String is Command : WebDriver.Remote.Command; Response : WebDriver.Remote.Response; begin Command.Method := Get; Command.Path := To_Path (Self, "/property", Name); Response := Self.Executor.Execute (Command); return Response.Value (+"value").To_String; end Get_Property; ------------------ -- Get_Tag_Name -- ------------------ overriding function Get_Tag_Name (Self : access Element) return League.Strings.Universal_String is Command : WebDriver.Remote.Command; Response : WebDriver.Remote.Response; begin Command.Method := Get; Command.Path := To_Path (Self, "/name"); Response := Self.Executor.Execute (Command); return Response.Value (+"value").To_String; end Get_Tag_Name; -------------- -- Get_Text -- -------------- overriding function Get_Text (Self : access Element) return League.Strings.Universal_String is Command : WebDriver.Remote.Command; Response : WebDriver.Remote.Response; begin Command.Method := Get; Command.Path := To_Path (Self, "/text"); Response := Self.Executor.Execute (Command); return Response.Value (+"value").To_String; end Get_Text; ---------------- -- Is_Enabled -- ---------------- overriding function Is_Enabled (Self : access Element) return Boolean is Command : WebDriver.Remote.Command; Response : WebDriver.Remote.Response; begin Command.Method := Get; Command.Path := To_Path (Self, "/enabled"); Response := Self.Executor.Execute (Command); return Response.Value (+"value").To_Boolean; end Is_Enabled; ----------------- -- Is_Selected -- ----------------- overriding function Is_Selected (Self : access Element) return Boolean is Command : WebDriver.Remote.Command; Response : WebDriver.Remote.Response; begin Command.Method := Get; Command.Path := To_Path (Self, "/selected"); Response := Self.Executor.Execute (Command); return Response.Value (+"value").To_Boolean; end Is_Selected; --------------- -- Send_Keys -- --------------- overriding procedure Send_Keys (Self : access Element; Text : League.String_Vectors.Universal_String_Vector) is Command : WebDriver.Remote.Command; Response : WebDriver.Remote.Response; List : League.JSON.Arrays.JSON_Array; pragma Unreferenced (Response); begin Command.Method := Post; Command.Path := To_Path (Self, "/value"); for J in 1 .. Text.Length loop List.Append (League.JSON.Values.To_JSON_Value (Text.Element (J))); end loop; Command.Parameters.Insert (+"value", List.To_JSON_Value); Response := Self.Executor.Execute (Command); end Send_Keys; ------------- -- To_Path -- ------------- function To_Path (Self : access Element; Command : Wide_Wide_String; Suffix : League.Strings.Universal_String := League.Strings.Empty_Universal_String) return League.Strings.Universal_String is Result : League.Strings.Universal_String; begin Result.Append ("/session/"); Result.Append (Self.Session_Id); Result.Append ("/element/"); Result.Append (Self.Element_Id); Result.Append (Command); if not Suffix.Is_Empty then Result.Append ("/"); Result.Append (Suffix); end if; return Result; end To_Path; end Elements;
unittests/32Bit_ASM/X87/D9_05.asm
cobalt2727/FEX
628
23332
<gh_stars>100-1000 %ifdef CONFIG { "Mode": "32BIT" } %endif mov edx, 0xe0000000 ; Just to ensure execution fldcw [edx] hlt
hello/asm1.asm
revprez/tutorial-asm-soliduscode
0
25344
<reponame>revprez/tutorial-asm-soliduscode<filename>hello/asm1.asm SECTION .data ;initalized data msg: db "Hello, World. This is assembler." ;our message SECTION .text ;asm code extern printf global main main: push ebp mov ebp, esp push msg call printf mov esp, ebp pop ebp ret
labe.asm
zaoad/assembly-
0
92526
segment .data ;a : dq 0 ;b : dq 0 fmt : db "%d %d %d %d",0 fmt2 : db "%d %d %d %d",10,0 segment .bss a : resq 1 b : resq 1 c : resq 1 d : resq 1 segment .text global main extern printf extern scanf main: push RBP mov RDI ,fmt mov rsi, a mov rdx ,b mov rcx ,c mov r8, d mov rax,0 call scanf mov rdi ,fmt2 mov rsi ,[a] mov rdx ,[b] mov rcx, [c] mov r8 ,[d] mov rax,0 call printf mov rax,0 pop rbp ret
src/fltk-widgets-inputs-float.ads
micahwelf/FLTK-Ada
1
22742
package FLTK.Widgets.Inputs.Float is type Float_Input is new Input with private; type Float_Input_Reference (Data : not null access Float_Input'Class) is limited null record with Implicit_Dereference => Data; package Forge is function Create (X, Y, W, H : in Integer; Text : in String) return Float_Input; end Forge; function Get_Value (This : in Float_Input) return Standard.Float; procedure Draw (This : in out Float_Input); function Handle (This : in out Float_Input; Event : in Event_Kind) return Event_Outcome; private type Float_Input is new Input with null record; overriding procedure Finalize (This : in out Float_Input); pragma Inline (Get_Value); pragma Inline (Draw); pragma Inline (Handle); end FLTK.Widgets.Inputs.Float;
mobile/mobile_45_sprite_engine.asm
Dev727/ancientplatinum
28
87251
<filename>mobile/mobile_45_sprite_engine.asm Function115d99: ld de, GFX_11601a ld hl, vTiles0 tile $60 lb bc, BANK(GFX_11601a), 20 call Get2bpp xor a ld [wc305], a ld [wc306], a ld [wc309], a ld [wc30a], a ld [wc30b], a ld [wc30c], a ld a, $10 ld [wc307], a ld a, $18 ld [wc308], a ret Function115dc3: xor a ld [wc305], a ld a, $a0 ld hl, wVirtualOAMSprite31 ld bc, 8 * SPRITEOAMSTRUCT_LENGTH call ByteFill ret Function115dd3: ld a, [wc305] and a ret z ld a, $a0 ld hl, wVirtualOAMSprite31 ld bc, 8 * SPRITEOAMSTRUCT_LENGTH call ByteFill call Function115e22 ld a, [wc309] sla a ld c, a ld b, 0 ld hl, Unknown_115e86 add hl, bc ld a, [hli] ld e, a ld a, [hl] ld d, a push de pop hl ld de, wVirtualOAMSprite31 ld a, [wc307] ld c, a ld a, [wc308] ld b, a ld a, [hli] .asm_115e04 push af ld a, [hli] add b ld [de], a ; y inc de ld a, [hli] add c ld [de], a ; x inc de ld a, [hli] ld [de], a ; tile id inc de ld a, [hli] ld [de], a ; attributes inc de pop af dec a jr nz, .asm_115e04 ret Function115e18: ld a, c ld [wc30a], a xor a ld [wc30b], a jr Function115e2b Function115e22: ld hl, wc30c dec [hl] ret nz ld hl, wc30b inc [hl] Function115e2b: ld a, [wc30a] sla a ld c, a ld b, 0 ld hl, Unknown_115e59 add hl, bc ld a, [hli] ld e, a ld a, [hli] ld d, a push de pop hl ld a, [wc30b] sla a ld c, a ld b, $0 add hl, bc ld a, [hli] cp $ff jr nz, .not_end xor a ld [wc30b], a jr Function115e2b .not_end ld [wc309], a ld a, [hl] ld [wc30c], a ret Unknown_115e59: dw Unknown_115e61 dw Unknown_115e6c dw Unknown_115e76 dw Unknown_115e79 ; OAM idx (see Unknown_115e86), flip flags/duration Unknown_115e61: db $04, $08 db $05, $08 db $06, $08 db $07, $08 db $08, $08 db -1 Unknown_115e6c: db $01, $08 db $02, $08 db $03, $08 db $09, $08 db $0a, $08 Unknown_115e76: db $00, $08 db -1 Unknown_115e79: db $0b, $08 db $0c, $08 db $0d, $08 db $0e, $08 db $0f, $08 db $00, $08 db -1 Unknown_115e86: dw Unknown_115ea6 dw Unknown_115eb7 dw Unknown_115ecc dw Unknown_115ee1 dw Unknown_115ef6 dw Unknown_115f13 dw Unknown_115f30 dw Unknown_115f4d dw Unknown_115f6a dw Unknown_115f87 dw Unknown_115f9c dw Unknown_115fb1 dw Unknown_115fc6 dw Unknown_115fdb dw Unknown_115ff0 dw Unknown_116005 Unknown_115ea6: db 4 dsprite 1, 0, 0, 0, $60, $01 dsprite 1, 0, 1, 0, $61, $01 dsprite 2, 0, 0, 0, $62, $01 dsprite 2, 0, 1, 0, $63, $01 Unknown_115eb7: db 5 dsprite 0, 0, 1, 0, $64, $00 dsprite 1, 0, 0, 0, $60, $01 dsprite 1, 0, 1, 0, $61, $01 dsprite 2, 0, 0, 0, $62, $01 dsprite 2, 0, 1, 0, $63, $01 Unknown_115ecc: db 5 dsprite 0, 0, 1, 0, $65, $00 dsprite 1, 0, 0, 0, $60, $01 dsprite 1, 0, 1, 0, $61, $01 dsprite 2, 0, 0, 0, $62, $01 dsprite 2, 0, 1, 0, $63, $01 Unknown_115ee1: db 5 dsprite 0, 0, 1, 0, $66, $00 dsprite 1, 0, 0, 0, $60, $01 dsprite 1, 0, 1, 0, $61, $01 dsprite 2, 0, 0, 0, $62, $01 dsprite 2, 0, 1, 0, $63, $01 Unknown_115ef6: db 7 dsprite 0, 0, 0, 0, $67, $01 dsprite 1, 0, 0, 0, $68, $01 dsprite 2, 0, 0, 0, $6d, $00 dsprite 2, 0, 1, 0, $69, $00 dsprite 2, 0, 2, 0, $6a, $00 dsprite 3, 0, 1, 0, $6b, $00 dsprite 3, 0, 2, 0, $6c, $00 Unknown_115f13: db 7 dsprite 0, 0, 0, 0, $67, $01 dsprite 1, 0, 0, 0, $68, $01 dsprite 2, 0, 0, 0, $6e, $00 dsprite 2, 0, 1, 0, $69, $00 dsprite 2, 0, 2, 0, $6a, $00 dsprite 3, 0, 1, 0, $6b, $00 dsprite 3, 0, 2, 0, $6c, $00 Unknown_115f30: db 7 dsprite 0, 0, 0, 0, $67, $01 dsprite 1, 0, 0, 0, $68, $01 dsprite 2, 0, 0, 0, $6f, $00 dsprite 2, 0, 1, 0, $69, $00 dsprite 2, 0, 2, 0, $6a, $00 dsprite 3, 0, 1, 0, $6b, $00 dsprite 3, 0, 2, 0, $6c, $00 Unknown_115f4d: db 7 dsprite 0, 0, 0, 0, $67, $01 dsprite 1, 0, 0, 0, $68, $01 dsprite 2, 0, 0, 0, $70, $00 dsprite 2, 0, 1, 0, $69, $00 dsprite 2, 0, 2, 0, $6a, $00 dsprite 3, 0, 1, 0, $6b, $00 dsprite 3, 0, 2, 0, $6c, $00 Unknown_115f6a: db 7 dsprite 0, 0, 0, 0, $67, $01 dsprite 1, 0, 0, 0, $68, $01 dsprite 2, 0, 0, 0, $71, $00 dsprite 2, 0, 1, 0, $69, $00 dsprite 2, 0, 2, 0, $6a, $00 dsprite 3, 0, 1, 0, $6b, $00 dsprite 3, 0, 2, 0, $6c, $00 Unknown_115f87: db 5 dsprite 0, 0, 1, 0, $72, $00 dsprite 1, 0, 0, 0, $60, $01 dsprite 1, 0, 1, 0, $61, $01 dsprite 2, 0, 0, 0, $62, $01 dsprite 2, 0, 1, 0, $63, $01 Unknown_115f9c: db 5 dsprite 0, 0, 1, 0, $73, $00 dsprite 1, 0, 0, 0, $60, $01 dsprite 1, 0, 1, 0, $61, $01 dsprite 2, 0, 0, 0, $62, $01 dsprite 2, 0, 1, 0, $63, $01 Unknown_115fb1: db 5 dsprite 0, 1, 1, 0, $64, $60 dsprite 1, 0, 0, 0, $60, $01 dsprite 1, 0, 1, 0, $61, $01 dsprite 2, 0, 0, 0, $62, $01 dsprite 2, 0, 1, 0, $63, $01 Unknown_115fc6: db 5 dsprite 0, 1, 1, 0, $65, $60 dsprite 1, 0, 0, 0, $60, $01 dsprite 1, 0, 1, 0, $61, $01 dsprite 2, 0, 0, 0, $62, $01 dsprite 2, 0, 1, 0, $63, $01 Unknown_115fdb: db 5 dsprite 0, 1, 1, 0, $66, $60 dsprite 1, 0, 0, 0, $60, $01 dsprite 1, 0, 1, 0, $61, $01 dsprite 2, 0, 0, 0, $62, $01 dsprite 2, 0, 1, 0, $63, $01 Unknown_115ff0: db 5 dsprite 0, 1, 1, 0, $72, $60 dsprite 1, 0, 0, 0, $60, $01 dsprite 1, 0, 1, 0, $61, $01 dsprite 2, 0, 0, 0, $62, $01 dsprite 2, 0, 1, 0, $63, $01 Unknown_116005: db 5 dsprite 0, 1, 1, 0, $73, $60 dsprite 1, 0, 0, 0, $60, $01 dsprite 1, 0, 1, 0, $61, $01 dsprite 2, 0, 0, 0, $62, $01 dsprite 2, 0, 1, 0, $63, $01 GFX_11601a:: INCBIN "gfx/unknown/11601a.2bpp" Function11615a: xor a ld [wc30d], a ld [$c319], a ld [wc310], a ld [wc311], a ld [wc312], a ld [wc313], a ld [wc314], a ld [wc314 + 1], a ld [wc314 + 4], a ld [wc3f6], a ld [wc3f8], a ld [wc3f2], a ld [wc3f4], a ld a, $24 ld [wc3f5], a ld a, $7 ld [wc3f7], a ld a, $b0 ld [wc30e], a ld [wc3f1], a ld a, $48 ld [wc30f], a ld [wc3f3], a ret Function11619d: ld a, [wc30d] and a ret z ld a, [$c319] cp $2 jr c, .asm_1161b4 ld a, $a0 ld hl, wVirtualOAM ld bc, 25 * SPRITEOAMSTRUCT_LENGTH call ByteFill .asm_1161b4 call Function1161b8 ret Function1161b8: ld a, [$c319] ld e, a ld d, 0 ld hl, .Jumptable add hl, de add hl, de ld a, [hli] ld h, [hl] ld l, a jp hl .Jumptable: dw Function1161d5 dw Function116294 dw Function1162cb dw Function1162f2 dw Function1163c0 dw Function11636e dw Function116441 Function1161d5: ldh a, [rSVBK] push af ld a, $6 ldh [rSVBK], a ld hl, Unknown_117356 ld de, wDecompressScratch ld bc, $0300 call CopyBytes di .wait_for_vblank ; Wait until a vblank would occur had interrupts not just been disabled. ldh a, [rLY] cp LY_VBLANK + 1 jr nz, .wait_for_vblank ld a, $d0 ldh [rHDMA1], a ld a, $0 ldh [rHDMA2], a ld a, $1c ldh [rHDMA3], a xor a ldh [rHDMA4], a ld a, $8 ldh [rHDMA5], a ld a, $d0 ldh [rHDMA1], a ld a, $80 ldh [rHDMA2], a ld a, $1c ldh [rHDMA3], a ld a, $80 ldh [rHDMA4], a ld a, $8 ldh [rHDMA5], a ld a, $d1 ldh [rHDMA1], a ld a, $0 ldh [rHDMA2], a ld a, $1d ldh [rHDMA3], a xor a ldh [rHDMA4], a ld a, $8 ldh [rHDMA5], a ld a, $1 ldh [rVBK], a ld a, $d1 ldh [rHDMA1], a ld a, $80 ldh [rHDMA2], a ld a, $1c ldh [rHDMA3], a xor a ldh [rHDMA4], a ld a, $8 ldh [rHDMA5], a ld a, $d2 ldh [rHDMA1], a ld a, $0 ldh [rHDMA2], a ld a, $1c ldh [rHDMA3], a ld a, $80 ldh [rHDMA4], a ld a, $8 ldh [rHDMA5], a ld a, $d2 ldh [rHDMA1], a ld a, $80 ldh [rHDMA2], a ld a, $1d ldh [rHDMA3], a xor a ldh [rHDMA4], a ld a, $8 ldh [rHDMA5], a xor a ldh [rVBK], a ei pop af ldh [rSVBK], a farcall ReloadMapPart ld a, $8 ld [wMusicFade], a ld de, MUSIC_MOBILE_ADAPTER ld a, e ld [wMusicFadeID], a ld a, d ld [wMusicFadeID + 1], a ld a, [$c319] inc a ld [$c319], a ret MenuHeader_11628c: db MENU_BACKUP_TILES ; flags menu_coords 0, 6, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 dw NULL db 0 ; default option Function116294: farcall Function170d02 ld a, [$c319] inc a ld [$c319], a ldh a, [rSVBK] push af ld a, $5 ldh [rSVBK], a ld hl, wBGPals1 palette 6 ld de, $c320 ld bc, 2 palettes call CopyBytes ld hl, Palette_11734e ld de, wBGPals1 palette 7 ld bc, 1 palettes call CopyBytes call SetPalettes pop af ldh [rSVBK], a ld a, $30 ldh [hWY], a ret Function1162cb: farcall Function170cc6 ld a, [$c319] inc a ld [$c319], a ldh a, [rSVBK] push af ld a, $5 ldh [rSVBK], a ld hl, Palette_11730e ld de, wOBPals1 + 2 palettes ld bc, 6 palettes call CopyBytes call SetPalettes pop af ldh [rSVBK], a ret Function1162f2: call Function11659d call Function116758 call Function1167a6 ld a, [wc310] cp EGG ret z sla a ld c, a ld b, 0 ld hl, Unknown_1168c5 add hl, bc ld a, [hli] ld e, a ld a, [hl] ld d, a push de pop hl ld a, [wc30e] ld c, a ld a, [wc30f] ld b, a ld a, [wc314 + 4] ld e, a ld a, [hli] sub e ld de, wVirtualOAMSprite09 .asm_116321 push af ld a, [hli] add b ld [de], a ; y inc de ld a, [hli] add c ld [de], a ; x inc de ld a, [hli] ld [de], a ; tile id inc de ld a, [hli] ld [de], a ; attributes inc de pop af dec a jr nz, .asm_116321 call Function116468 ld a, [wc3f5] sla a ld c, a ld b, 0 ld hl, Unknown_1168c5 add hl, bc ld a, [hli] ld e, a ld a, [hl] ld d, a push de pop hl ld a, [wc3f1] ld c, a ld a, [wc3f3] ld b, a ld a, [wc3f8] ld e, a ld a, [hli] sub e ld de, wVirtualOAMSprite00 .asm_11635a push af ld a, [hli] add b ld [de], a ; y inc de ld a, [hli] add c ld [de], a ; x inc de ld a, [hli] ld [de], a ; tile id inc de ld a, [hli] ld [de], a ; attributes inc de pop af dec a jr nz, .asm_11635a ret Function11636e: ldh a, [rSVBK] push af ld a, $5 ldh [rSVBK], a ld hl, wBGPals2 ld de, wBGPals1 ld bc, 8 palettes call CopyBytes pop af ldh [rSVBK], a call SetPalettes ldh a, [rSVBK] push af ld a, $1 ldh [rSVBK], a ld a, $a0 ld hl, wVirtualOAM ld bc, 16 * SPRITEOAMSTRUCT_LENGTH call ByteFill ld a, $90 ldh [hWY], a call UpdateSprites pop af ldh [rSVBK], a farcall ReloadMapPart ld a, $8 ld [wMusicFade], a ld a, [wMapMusic] ld [wMusicFadeID], a xor a ld [wMusicFadeID + 1], a xor a ld [$c319], a ld [wc30d], a ret Function1163c0: ldh a, [rSVBK] push af ld a, $1 ldh [rSVBK], a ld a, $a0 ld hl, wVirtualOAM ld bc, 16 * SPRITEOAMSTRUCT_LENGTH call ByteFill call DelayFrame farcall Function14146 ld b, SCGB_MAPPALS call GetSGBLayout ldh a, [rSVBK] push af ld a, $5 ldh [rSVBK], a ld hl, $c320 ld de, wd030 ld bc, $0010 call CopyBytes pop af ldh [rSVBK], a call SetPalettes call DelayFrame ld a, $90 ldh [hWY], a call UpdateSprites farcall Function14157 pop af ldh [rSVBK], a farcall ReloadMapPart ld a, [wLinkMode] cp $4 jr z, .asm_11642a ld a, $8 ld [wMusicFade], a ld a, [wMapMusic] ld [wMusicFadeID], a xor a ld [wMusicFadeID + 1], a jr .asm_116439 .asm_11642a ld a, $8 ld [wMusicFade], a ld a, $0 ld [wMusicFadeID], a ld a, $0 ld [wMusicFadeID + 1], a .asm_116439 xor a ld [$c319], a ld [wc30d], a ret Function116441: farcall Function17d405 ld a, $90 ldh [hWY], a farcall ReloadMapPart ld a, $8 ld [wMusicFade], a ld a, [wMapMusic] ld [wMusicFadeID], a xor a ld [wMusicFadeID + 1], a xor a ld [$c319], a ld [wc30d], a ret Function116468: call Function116567 ld a, [wc314] cp $d jr nz, .asm_1164a8 ld hl, wc30e ld a, [hl] cp $50 jr nc, .asm_116484 ld a, $50 sub [hl] add $50 ld [wc3f1], a jr .asm_11648d .asm_116484 sub $50 ld c, a ld a, $50 sub c ld [wc3f1], a .asm_11648d ld hl, wc30f ld a, [hl] cp $60 jr nc, .asm_11649e ld a, $60 sub [hl] add $60 ld [wc3f3], a ret .asm_11649e sub $60 ld c, a ld a, $60 sub c ld [wc3f3], a ret .asm_1164a8 ld hl, wc30e ld a, $b0 cp [hl] jr nc, .asm_1164b8 ld a, [wc3f1] and a jr z, .asm_11650b jr .asm_1164f2 .asm_1164b8 ld a, [wc3f1] sub [hl] jr nc, .asm_1164c1 xor $ff inc a .asm_1164c1 ld b, a ld c, $0 ld a, $5 .asm_1164c6 srl b rr c dec a jr nz, .asm_1164c6 ld a, c ld [wc3fa], a ld a, b ld [wc3f9], a ld a, [wc3f1] sub [hl] jr c, .asm_1164f2 ld c, $0 ld a, [wc3fa] xor $ff add $1 rl c ld [wc3fa], a ld a, [wc3f9] xor $ff add c ld [wc3f9], a .asm_1164f2 ld a, [wc3f2] ld l, a ld a, [wc3f1] ld h, a ld a, [wc3fa] ld e, a ld a, [wc3f9] ld d, a add hl, de ld a, l ld [wc3f2], a ld a, h ld [wc3f1], a .asm_11650b ld hl, wc30f ld a, $b0 cp [hl] jr c, .asm_11654d ld a, [wc3f3] sub [hl] jr nc, .asm_11651c xor $ff inc a .asm_11651c ld b, a ld c, $0 ld a, $5 .asm_116521 srl b rr c dec a jr nz, .asm_116521 ld a, c ld [wc3fc], a ld a, b ld [wc3fb], a ld a, [wc3f3] sub [hl] jr c, .asm_11654d ld c, $0 ld a, [wc3fc] xor $ff add $1 rl c ld [wc3fc], a ld a, [wc3fb] xor $ff add c ld [wc3fb], a .asm_11654d ld a, [wc3f4] ld l, a ld a, [wc3f3] ld h, a ld a, [wc3fc] ld e, a ld a, [wc3fb] ld d, a add hl, de ld a, l ld [wc3f4], a ld a, h ld [wc3f3], a ret
zombie.asm
joeofportland/project4final
0
172365
_zombie: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.h" int main(void) { 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(fork() > 0) 9: e8 75 02 00 00 call 283 <fork> e: 85 c0 test %eax,%eax 10: 7e 0c jle 1e <main+0x1e> sleep(5); // Let child exit before parent. 12: c7 04 24 05 00 00 00 movl $0x5,(%esp) 19: e8 fd 02 00 00 call 31b <sleep> exit(); 1e: e8 68 02 00 00 call 28b <exit> 00000023 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 23: 55 push %ebp 24: 89 e5 mov %esp,%ebp 26: 57 push %edi 27: 53 push %ebx asm volatile("cld; rep stosb" : 28: 8b 4d 08 mov 0x8(%ebp),%ecx 2b: 8b 55 10 mov 0x10(%ebp),%edx 2e: 8b 45 0c mov 0xc(%ebp),%eax 31: 89 cb mov %ecx,%ebx 33: 89 df mov %ebx,%edi 35: 89 d1 mov %edx,%ecx 37: fc cld 38: f3 aa rep stos %al,%es:(%edi) 3a: 89 ca mov %ecx,%edx 3c: 89 fb mov %edi,%ebx 3e: 89 5d 08 mov %ebx,0x8(%ebp) 41: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 44: 5b pop %ebx 45: 5f pop %edi 46: 5d pop %ebp 47: c3 ret 00000048 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 48: 55 push %ebp 49: 89 e5 mov %esp,%ebp 4b: 83 ec 10 sub $0x10,%esp char *os; os = s; 4e: 8b 45 08 mov 0x8(%ebp),%eax 51: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 54: 90 nop 55: 8b 45 08 mov 0x8(%ebp),%eax 58: 8d 50 01 lea 0x1(%eax),%edx 5b: 89 55 08 mov %edx,0x8(%ebp) 5e: 8b 55 0c mov 0xc(%ebp),%edx 61: 8d 4a 01 lea 0x1(%edx),%ecx 64: 89 4d 0c mov %ecx,0xc(%ebp) 67: 0f b6 12 movzbl (%edx),%edx 6a: 88 10 mov %dl,(%eax) 6c: 0f b6 00 movzbl (%eax),%eax 6f: 84 c0 test %al,%al 71: 75 e2 jne 55 <strcpy+0xd> ; return os; 73: 8b 45 fc mov -0x4(%ebp),%eax } 76: c9 leave 77: c3 ret 00000078 <strcmp>: int strcmp(const char *p, const char *q) { 78: 55 push %ebp 79: 89 e5 mov %esp,%ebp while(*p && *p == *q) 7b: eb 08 jmp 85 <strcmp+0xd> p++, q++; 7d: 83 45 08 01 addl $0x1,0x8(%ebp) 81: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 85: 8b 45 08 mov 0x8(%ebp),%eax 88: 0f b6 00 movzbl (%eax),%eax 8b: 84 c0 test %al,%al 8d: 74 10 je 9f <strcmp+0x27> 8f: 8b 45 08 mov 0x8(%ebp),%eax 92: 0f b6 10 movzbl (%eax),%edx 95: 8b 45 0c mov 0xc(%ebp),%eax 98: 0f b6 00 movzbl (%eax),%eax 9b: 38 c2 cmp %al,%dl 9d: 74 de je 7d <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; 9f: 8b 45 08 mov 0x8(%ebp),%eax a2: 0f b6 00 movzbl (%eax),%eax a5: 0f b6 d0 movzbl %al,%edx a8: 8b 45 0c mov 0xc(%ebp),%eax ab: 0f b6 00 movzbl (%eax),%eax ae: 0f b6 c0 movzbl %al,%eax b1: 29 c2 sub %eax,%edx b3: 89 d0 mov %edx,%eax } b5: 5d pop %ebp b6: c3 ret 000000b7 <strlen>: uint strlen(char *s) { b7: 55 push %ebp b8: 89 e5 mov %esp,%ebp ba: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) bd: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) c4: eb 04 jmp ca <strlen+0x13> c6: 83 45 fc 01 addl $0x1,-0x4(%ebp) ca: 8b 55 fc mov -0x4(%ebp),%edx cd: 8b 45 08 mov 0x8(%ebp),%eax d0: 01 d0 add %edx,%eax d2: 0f b6 00 movzbl (%eax),%eax d5: 84 c0 test %al,%al d7: 75 ed jne c6 <strlen+0xf> ; return n; d9: 8b 45 fc mov -0x4(%ebp),%eax } dc: c9 leave dd: c3 ret 000000de <memset>: void* memset(void *dst, int c, uint n) { de: 55 push %ebp df: 89 e5 mov %esp,%ebp e1: 83 ec 0c sub $0xc,%esp stosb(dst, c, n); e4: 8b 45 10 mov 0x10(%ebp),%eax e7: 89 44 24 08 mov %eax,0x8(%esp) eb: 8b 45 0c mov 0xc(%ebp),%eax ee: 89 44 24 04 mov %eax,0x4(%esp) f2: 8b 45 08 mov 0x8(%ebp),%eax f5: 89 04 24 mov %eax,(%esp) f8: e8 26 ff ff ff call 23 <stosb> return dst; fd: 8b 45 08 mov 0x8(%ebp),%eax } 100: c9 leave 101: c3 ret 00000102 <strchr>: char* strchr(const char *s, char c) { 102: 55 push %ebp 103: 89 e5 mov %esp,%ebp 105: 83 ec 04 sub $0x4,%esp 108: 8b 45 0c mov 0xc(%ebp),%eax 10b: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 10e: eb 14 jmp 124 <strchr+0x22> if(*s == c) 110: 8b 45 08 mov 0x8(%ebp),%eax 113: 0f b6 00 movzbl (%eax),%eax 116: 3a 45 fc cmp -0x4(%ebp),%al 119: 75 05 jne 120 <strchr+0x1e> return (char*)s; 11b: 8b 45 08 mov 0x8(%ebp),%eax 11e: eb 13 jmp 133 <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 120: 83 45 08 01 addl $0x1,0x8(%ebp) 124: 8b 45 08 mov 0x8(%ebp),%eax 127: 0f b6 00 movzbl (%eax),%eax 12a: 84 c0 test %al,%al 12c: 75 e2 jne 110 <strchr+0xe> if(*s == c) return (char*)s; return 0; 12e: b8 00 00 00 00 mov $0x0,%eax } 133: c9 leave 134: c3 ret 00000135 <gets>: char* gets(char *buf, int max) { 135: 55 push %ebp 136: 89 e5 mov %esp,%ebp 138: 83 ec 28 sub $0x28,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 13b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 142: eb 4c jmp 190 <gets+0x5b> cc = read(0, &c, 1); 144: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 14b: 00 14c: 8d 45 ef lea -0x11(%ebp),%eax 14f: 89 44 24 04 mov %eax,0x4(%esp) 153: c7 04 24 00 00 00 00 movl $0x0,(%esp) 15a: e8 44 01 00 00 call 2a3 <read> 15f: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 162: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 166: 7f 02 jg 16a <gets+0x35> break; 168: eb 31 jmp 19b <gets+0x66> buf[i++] = c; 16a: 8b 45 f4 mov -0xc(%ebp),%eax 16d: 8d 50 01 lea 0x1(%eax),%edx 170: 89 55 f4 mov %edx,-0xc(%ebp) 173: 89 c2 mov %eax,%edx 175: 8b 45 08 mov 0x8(%ebp),%eax 178: 01 c2 add %eax,%edx 17a: 0f b6 45 ef movzbl -0x11(%ebp),%eax 17e: 88 02 mov %al,(%edx) if(c == '\n' || c == '\r') 180: 0f b6 45 ef movzbl -0x11(%ebp),%eax 184: 3c 0a cmp $0xa,%al 186: 74 13 je 19b <gets+0x66> 188: 0f b6 45 ef movzbl -0x11(%ebp),%eax 18c: 3c 0d cmp $0xd,%al 18e: 74 0b je 19b <gets+0x66> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 190: 8b 45 f4 mov -0xc(%ebp),%eax 193: 83 c0 01 add $0x1,%eax 196: 3b 45 0c cmp 0xc(%ebp),%eax 199: 7c a9 jl 144 <gets+0xf> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 19b: 8b 55 f4 mov -0xc(%ebp),%edx 19e: 8b 45 08 mov 0x8(%ebp),%eax 1a1: 01 d0 add %edx,%eax 1a3: c6 00 00 movb $0x0,(%eax) return buf; 1a6: 8b 45 08 mov 0x8(%ebp),%eax } 1a9: c9 leave 1aa: c3 ret 000001ab <stat>: int stat(char *n, struct stat *st) { 1ab: 55 push %ebp 1ac: 89 e5 mov %esp,%ebp 1ae: 83 ec 28 sub $0x28,%esp int fd; int r; fd = open(n, O_RDONLY); 1b1: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 1b8: 00 1b9: 8b 45 08 mov 0x8(%ebp),%eax 1bc: 89 04 24 mov %eax,(%esp) 1bf: e8 07 01 00 00 call 2cb <open> 1c4: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 1c7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 1cb: 79 07 jns 1d4 <stat+0x29> return -1; 1cd: b8 ff ff ff ff mov $0xffffffff,%eax 1d2: eb 23 jmp 1f7 <stat+0x4c> r = fstat(fd, st); 1d4: 8b 45 0c mov 0xc(%ebp),%eax 1d7: 89 44 24 04 mov %eax,0x4(%esp) 1db: 8b 45 f4 mov -0xc(%ebp),%eax 1de: 89 04 24 mov %eax,(%esp) 1e1: e8 fd 00 00 00 call 2e3 <fstat> 1e6: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 1e9: 8b 45 f4 mov -0xc(%ebp),%eax 1ec: 89 04 24 mov %eax,(%esp) 1ef: e8 bf 00 00 00 call 2b3 <close> return r; 1f4: 8b 45 f0 mov -0x10(%ebp),%eax } 1f7: c9 leave 1f8: c3 ret 000001f9 <atoi>: int atoi(const char *s) { 1f9: 55 push %ebp 1fa: 89 e5 mov %esp,%ebp 1fc: 83 ec 10 sub $0x10,%esp int n; n = 0; 1ff: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 206: eb 25 jmp 22d <atoi+0x34> n = n*10 + *s++ - '0'; 208: 8b 55 fc mov -0x4(%ebp),%edx 20b: 89 d0 mov %edx,%eax 20d: c1 e0 02 shl $0x2,%eax 210: 01 d0 add %edx,%eax 212: 01 c0 add %eax,%eax 214: 89 c1 mov %eax,%ecx 216: 8b 45 08 mov 0x8(%ebp),%eax 219: 8d 50 01 lea 0x1(%eax),%edx 21c: 89 55 08 mov %edx,0x8(%ebp) 21f: 0f b6 00 movzbl (%eax),%eax 222: 0f be c0 movsbl %al,%eax 225: 01 c8 add %ecx,%eax 227: 83 e8 30 sub $0x30,%eax 22a: 89 45 fc mov %eax,-0x4(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 22d: 8b 45 08 mov 0x8(%ebp),%eax 230: 0f b6 00 movzbl (%eax),%eax 233: 3c 2f cmp $0x2f,%al 235: 7e 0a jle 241 <atoi+0x48> 237: 8b 45 08 mov 0x8(%ebp),%eax 23a: 0f b6 00 movzbl (%eax),%eax 23d: 3c 39 cmp $0x39,%al 23f: 7e c7 jle 208 <atoi+0xf> n = n*10 + *s++ - '0'; return n; 241: 8b 45 fc mov -0x4(%ebp),%eax } 244: c9 leave 245: c3 ret 00000246 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 246: 55 push %ebp 247: 89 e5 mov %esp,%ebp 249: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 24c: 8b 45 08 mov 0x8(%ebp),%eax 24f: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 252: 8b 45 0c mov 0xc(%ebp),%eax 255: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 258: eb 17 jmp 271 <memmove+0x2b> *dst++ = *src++; 25a: 8b 45 fc mov -0x4(%ebp),%eax 25d: 8d 50 01 lea 0x1(%eax),%edx 260: 89 55 fc mov %edx,-0x4(%ebp) 263: 8b 55 f8 mov -0x8(%ebp),%edx 266: 8d 4a 01 lea 0x1(%edx),%ecx 269: 89 4d f8 mov %ecx,-0x8(%ebp) 26c: 0f b6 12 movzbl (%edx),%edx 26f: 88 10 mov %dl,(%eax) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 271: 8b 45 10 mov 0x10(%ebp),%eax 274: 8d 50 ff lea -0x1(%eax),%edx 277: 89 55 10 mov %edx,0x10(%ebp) 27a: 85 c0 test %eax,%eax 27c: 7f dc jg 25a <memmove+0x14> *dst++ = *src++; return vdst; 27e: 8b 45 08 mov 0x8(%ebp),%eax } 281: c9 leave 282: c3 ret 00000283 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 283: b8 01 00 00 00 mov $0x1,%eax 288: cd 40 int $0x40 28a: c3 ret 0000028b <exit>: SYSCALL(exit) 28b: b8 02 00 00 00 mov $0x2,%eax 290: cd 40 int $0x40 292: c3 ret 00000293 <wait>: SYSCALL(wait) 293: b8 03 00 00 00 mov $0x3,%eax 298: cd 40 int $0x40 29a: c3 ret 0000029b <pipe>: SYSCALL(pipe) 29b: b8 04 00 00 00 mov $0x4,%eax 2a0: cd 40 int $0x40 2a2: c3 ret 000002a3 <read>: SYSCALL(read) 2a3: b8 05 00 00 00 mov $0x5,%eax 2a8: cd 40 int $0x40 2aa: c3 ret 000002ab <write>: SYSCALL(write) 2ab: b8 10 00 00 00 mov $0x10,%eax 2b0: cd 40 int $0x40 2b2: c3 ret 000002b3 <close>: SYSCALL(close) 2b3: b8 15 00 00 00 mov $0x15,%eax 2b8: cd 40 int $0x40 2ba: c3 ret 000002bb <kill>: SYSCALL(kill) 2bb: b8 06 00 00 00 mov $0x6,%eax 2c0: cd 40 int $0x40 2c2: c3 ret 000002c3 <exec>: SYSCALL(exec) 2c3: b8 07 00 00 00 mov $0x7,%eax 2c8: cd 40 int $0x40 2ca: c3 ret 000002cb <open>: SYSCALL(open) 2cb: b8 0f 00 00 00 mov $0xf,%eax 2d0: cd 40 int $0x40 2d2: c3 ret 000002d3 <mknod>: SYSCALL(mknod) 2d3: b8 11 00 00 00 mov $0x11,%eax 2d8: cd 40 int $0x40 2da: c3 ret 000002db <unlink>: SYSCALL(unlink) 2db: b8 12 00 00 00 mov $0x12,%eax 2e0: cd 40 int $0x40 2e2: c3 ret 000002e3 <fstat>: SYSCALL(fstat) 2e3: b8 08 00 00 00 mov $0x8,%eax 2e8: cd 40 int $0x40 2ea: c3 ret 000002eb <link>: SYSCALL(link) 2eb: b8 13 00 00 00 mov $0x13,%eax 2f0: cd 40 int $0x40 2f2: c3 ret 000002f3 <mkdir>: SYSCALL(mkdir) 2f3: b8 14 00 00 00 mov $0x14,%eax 2f8: cd 40 int $0x40 2fa: c3 ret 000002fb <chdir>: SYSCALL(chdir) 2fb: b8 09 00 00 00 mov $0x9,%eax 300: cd 40 int $0x40 302: c3 ret 00000303 <dup>: SYSCALL(dup) 303: b8 0a 00 00 00 mov $0xa,%eax 308: cd 40 int $0x40 30a: c3 ret 0000030b <getpid>: SYSCALL(getpid) 30b: b8 0b 00 00 00 mov $0xb,%eax 310: cd 40 int $0x40 312: c3 ret 00000313 <sbrk>: SYSCALL(sbrk) 313: b8 0c 00 00 00 mov $0xc,%eax 318: cd 40 int $0x40 31a: c3 ret 0000031b <sleep>: SYSCALL(sleep) 31b: b8 0d 00 00 00 mov $0xd,%eax 320: cd 40 int $0x40 322: c3 ret 00000323 <uptime>: SYSCALL(uptime) 323: b8 0e 00 00 00 mov $0xe,%eax 328: cd 40 int $0x40 32a: c3 ret 0000032b <date>: SYSCALL(date) 32b: b8 16 00 00 00 mov $0x16,%eax 330: cd 40 int $0x40 332: c3 ret 00000333 <timem>: SYSCALL(timem) 333: b8 17 00 00 00 mov $0x17,%eax 338: cd 40 int $0x40 33a: c3 ret 0000033b <getuid>: SYSCALL(getuid) 33b: b8 18 00 00 00 mov $0x18,%eax 340: cd 40 int $0x40 342: c3 ret 00000343 <getgid>: SYSCALL(getgid) 343: b8 19 00 00 00 mov $0x19,%eax 348: cd 40 int $0x40 34a: c3 ret 0000034b <getppid>: SYSCALL(getppid) 34b: b8 1a 00 00 00 mov $0x1a,%eax 350: cd 40 int $0x40 352: c3 ret 00000353 <setuid>: SYSCALL(setuid) 353: b8 1b 00 00 00 mov $0x1b,%eax 358: cd 40 int $0x40 35a: c3 ret 0000035b <setgid>: SYSCALL(setgid) 35b: b8 1c 00 00 00 mov $0x1c,%eax 360: cd 40 int $0x40 362: c3 ret 00000363 <getprocs>: SYSCALL(getprocs) 363: b8 1d 00 00 00 mov $0x1d,%eax 368: cd 40 int $0x40 36a: c3 ret 0000036b <setpriority>: SYSCALL(setpriority) 36b: b8 1e 00 00 00 mov $0x1e,%eax 370: cd 40 int $0x40 372: c3 ret 00000373 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 373: 55 push %ebp 374: 89 e5 mov %esp,%ebp 376: 83 ec 18 sub $0x18,%esp 379: 8b 45 0c mov 0xc(%ebp),%eax 37c: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 37f: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 386: 00 387: 8d 45 f4 lea -0xc(%ebp),%eax 38a: 89 44 24 04 mov %eax,0x4(%esp) 38e: 8b 45 08 mov 0x8(%ebp),%eax 391: 89 04 24 mov %eax,(%esp) 394: e8 12 ff ff ff call 2ab <write> } 399: c9 leave 39a: c3 ret 0000039b <printint>: static void printint(int fd, int xx, int base, int sgn) { 39b: 55 push %ebp 39c: 89 e5 mov %esp,%ebp 39e: 56 push %esi 39f: 53 push %ebx 3a0: 83 ec 30 sub $0x30,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 3a3: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 3aa: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 3ae: 74 17 je 3c7 <printint+0x2c> 3b0: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 3b4: 79 11 jns 3c7 <printint+0x2c> neg = 1; 3b6: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 3bd: 8b 45 0c mov 0xc(%ebp),%eax 3c0: f7 d8 neg %eax 3c2: 89 45 ec mov %eax,-0x14(%ebp) 3c5: eb 06 jmp 3cd <printint+0x32> } else { x = xx; 3c7: 8b 45 0c mov 0xc(%ebp),%eax 3ca: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 3cd: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 3d4: 8b 4d f4 mov -0xc(%ebp),%ecx 3d7: 8d 41 01 lea 0x1(%ecx),%eax 3da: 89 45 f4 mov %eax,-0xc(%ebp) 3dd: 8b 5d 10 mov 0x10(%ebp),%ebx 3e0: 8b 45 ec mov -0x14(%ebp),%eax 3e3: ba 00 00 00 00 mov $0x0,%edx 3e8: f7 f3 div %ebx 3ea: 89 d0 mov %edx,%eax 3ec: 0f b6 80 6c 0a 00 00 movzbl 0xa6c(%eax),%eax 3f3: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) }while((x /= base) != 0); 3f7: 8b 75 10 mov 0x10(%ebp),%esi 3fa: 8b 45 ec mov -0x14(%ebp),%eax 3fd: ba 00 00 00 00 mov $0x0,%edx 402: f7 f6 div %esi 404: 89 45 ec mov %eax,-0x14(%ebp) 407: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 40b: 75 c7 jne 3d4 <printint+0x39> if(neg) 40d: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 411: 74 10 je 423 <printint+0x88> buf[i++] = '-'; 413: 8b 45 f4 mov -0xc(%ebp),%eax 416: 8d 50 01 lea 0x1(%eax),%edx 419: 89 55 f4 mov %edx,-0xc(%ebp) 41c: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) while(--i >= 0) 421: eb 1f jmp 442 <printint+0xa7> 423: eb 1d jmp 442 <printint+0xa7> putc(fd, buf[i]); 425: 8d 55 dc lea -0x24(%ebp),%edx 428: 8b 45 f4 mov -0xc(%ebp),%eax 42b: 01 d0 add %edx,%eax 42d: 0f b6 00 movzbl (%eax),%eax 430: 0f be c0 movsbl %al,%eax 433: 89 44 24 04 mov %eax,0x4(%esp) 437: 8b 45 08 mov 0x8(%ebp),%eax 43a: 89 04 24 mov %eax,(%esp) 43d: e8 31 ff ff ff call 373 <putc> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 442: 83 6d f4 01 subl $0x1,-0xc(%ebp) 446: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 44a: 79 d9 jns 425 <printint+0x8a> putc(fd, buf[i]); } 44c: 83 c4 30 add $0x30,%esp 44f: 5b pop %ebx 450: 5e pop %esi 451: 5d pop %ebp 452: c3 ret 00000453 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 453: 55 push %ebp 454: 89 e5 mov %esp,%ebp 456: 83 ec 38 sub $0x38,%esp char *s; int c, i, state; uint *ap; state = 0; 459: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 460: 8d 45 0c lea 0xc(%ebp),%eax 463: 83 c0 04 add $0x4,%eax 466: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 469: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 470: e9 7c 01 00 00 jmp 5f1 <printf+0x19e> c = fmt[i] & 0xff; 475: 8b 55 0c mov 0xc(%ebp),%edx 478: 8b 45 f0 mov -0x10(%ebp),%eax 47b: 01 d0 add %edx,%eax 47d: 0f b6 00 movzbl (%eax),%eax 480: 0f be c0 movsbl %al,%eax 483: 25 ff 00 00 00 and $0xff,%eax 488: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 48b: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 48f: 75 2c jne 4bd <printf+0x6a> if(c == '%'){ 491: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 495: 75 0c jne 4a3 <printf+0x50> state = '%'; 497: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 49e: e9 4a 01 00 00 jmp 5ed <printf+0x19a> } else { putc(fd, c); 4a3: 8b 45 e4 mov -0x1c(%ebp),%eax 4a6: 0f be c0 movsbl %al,%eax 4a9: 89 44 24 04 mov %eax,0x4(%esp) 4ad: 8b 45 08 mov 0x8(%ebp),%eax 4b0: 89 04 24 mov %eax,(%esp) 4b3: e8 bb fe ff ff call 373 <putc> 4b8: e9 30 01 00 00 jmp 5ed <printf+0x19a> } } else if(state == '%'){ 4bd: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 4c1: 0f 85 26 01 00 00 jne 5ed <printf+0x19a> if(c == 'd'){ 4c7: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 4cb: 75 2d jne 4fa <printf+0xa7> printint(fd, *ap, 10, 1); 4cd: 8b 45 e8 mov -0x18(%ebp),%eax 4d0: 8b 00 mov (%eax),%eax 4d2: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp) 4d9: 00 4da: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) 4e1: 00 4e2: 89 44 24 04 mov %eax,0x4(%esp) 4e6: 8b 45 08 mov 0x8(%ebp),%eax 4e9: 89 04 24 mov %eax,(%esp) 4ec: e8 aa fe ff ff call 39b <printint> ap++; 4f1: 83 45 e8 04 addl $0x4,-0x18(%ebp) 4f5: e9 ec 00 00 00 jmp 5e6 <printf+0x193> } else if(c == 'x' || c == 'p'){ 4fa: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 4fe: 74 06 je 506 <printf+0xb3> 500: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 504: 75 2d jne 533 <printf+0xe0> printint(fd, *ap, 16, 0); 506: 8b 45 e8 mov -0x18(%ebp),%eax 509: 8b 00 mov (%eax),%eax 50b: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 512: 00 513: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 51a: 00 51b: 89 44 24 04 mov %eax,0x4(%esp) 51f: 8b 45 08 mov 0x8(%ebp),%eax 522: 89 04 24 mov %eax,(%esp) 525: e8 71 fe ff ff call 39b <printint> ap++; 52a: 83 45 e8 04 addl $0x4,-0x18(%ebp) 52e: e9 b3 00 00 00 jmp 5e6 <printf+0x193> } else if(c == 's'){ 533: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 537: 75 45 jne 57e <printf+0x12b> s = (char*)*ap; 539: 8b 45 e8 mov -0x18(%ebp),%eax 53c: 8b 00 mov (%eax),%eax 53e: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 541: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 545: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 549: 75 09 jne 554 <printf+0x101> s = "(null)"; 54b: c7 45 f4 1f 08 00 00 movl $0x81f,-0xc(%ebp) while(*s != 0){ 552: eb 1e jmp 572 <printf+0x11f> 554: eb 1c jmp 572 <printf+0x11f> putc(fd, *s); 556: 8b 45 f4 mov -0xc(%ebp),%eax 559: 0f b6 00 movzbl (%eax),%eax 55c: 0f be c0 movsbl %al,%eax 55f: 89 44 24 04 mov %eax,0x4(%esp) 563: 8b 45 08 mov 0x8(%ebp),%eax 566: 89 04 24 mov %eax,(%esp) 569: e8 05 fe ff ff call 373 <putc> s++; 56e: 83 45 f4 01 addl $0x1,-0xc(%ebp) } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 572: 8b 45 f4 mov -0xc(%ebp),%eax 575: 0f b6 00 movzbl (%eax),%eax 578: 84 c0 test %al,%al 57a: 75 da jne 556 <printf+0x103> 57c: eb 68 jmp 5e6 <printf+0x193> putc(fd, *s); s++; } } else if(c == 'c'){ 57e: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 582: 75 1d jne 5a1 <printf+0x14e> putc(fd, *ap); 584: 8b 45 e8 mov -0x18(%ebp),%eax 587: 8b 00 mov (%eax),%eax 589: 0f be c0 movsbl %al,%eax 58c: 89 44 24 04 mov %eax,0x4(%esp) 590: 8b 45 08 mov 0x8(%ebp),%eax 593: 89 04 24 mov %eax,(%esp) 596: e8 d8 fd ff ff call 373 <putc> ap++; 59b: 83 45 e8 04 addl $0x4,-0x18(%ebp) 59f: eb 45 jmp 5e6 <printf+0x193> } else if(c == '%'){ 5a1: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 5a5: 75 17 jne 5be <printf+0x16b> putc(fd, c); 5a7: 8b 45 e4 mov -0x1c(%ebp),%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 b7 fd ff ff call 373 <putc> 5bc: eb 28 jmp 5e6 <printf+0x193> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 5be: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp) 5c5: 00 5c6: 8b 45 08 mov 0x8(%ebp),%eax 5c9: 89 04 24 mov %eax,(%esp) 5cc: e8 a2 fd ff ff call 373 <putc> putc(fd, c); 5d1: 8b 45 e4 mov -0x1c(%ebp),%eax 5d4: 0f be c0 movsbl %al,%eax 5d7: 89 44 24 04 mov %eax,0x4(%esp) 5db: 8b 45 08 mov 0x8(%ebp),%eax 5de: 89 04 24 mov %eax,(%esp) 5e1: e8 8d fd ff ff call 373 <putc> } state = 0; 5e6: 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++){ 5ed: 83 45 f0 01 addl $0x1,-0x10(%ebp) 5f1: 8b 55 0c mov 0xc(%ebp),%edx 5f4: 8b 45 f0 mov -0x10(%ebp),%eax 5f7: 01 d0 add %edx,%eax 5f9: 0f b6 00 movzbl (%eax),%eax 5fc: 84 c0 test %al,%al 5fe: 0f 85 71 fe ff ff jne 475 <printf+0x22> putc(fd, c); } state = 0; } } } 604: c9 leave 605: c3 ret 00000606 <free>: static Header base; static Header *freep; void free(void *ap) { 606: 55 push %ebp 607: 89 e5 mov %esp,%ebp 609: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 60c: 8b 45 08 mov 0x8(%ebp),%eax 60f: 83 e8 08 sub $0x8,%eax 612: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 615: a1 88 0a 00 00 mov 0xa88,%eax 61a: 89 45 fc mov %eax,-0x4(%ebp) 61d: eb 24 jmp 643 <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 61f: 8b 45 fc mov -0x4(%ebp),%eax 622: 8b 00 mov (%eax),%eax 624: 3b 45 fc cmp -0x4(%ebp),%eax 627: 77 12 ja 63b <free+0x35> 629: 8b 45 f8 mov -0x8(%ebp),%eax 62c: 3b 45 fc cmp -0x4(%ebp),%eax 62f: 77 24 ja 655 <free+0x4f> 631: 8b 45 fc mov -0x4(%ebp),%eax 634: 8b 00 mov (%eax),%eax 636: 3b 45 f8 cmp -0x8(%ebp),%eax 639: 77 1a ja 655 <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) 63b: 8b 45 fc mov -0x4(%ebp),%eax 63e: 8b 00 mov (%eax),%eax 640: 89 45 fc mov %eax,-0x4(%ebp) 643: 8b 45 f8 mov -0x8(%ebp),%eax 646: 3b 45 fc cmp -0x4(%ebp),%eax 649: 76 d4 jbe 61f <free+0x19> 64b: 8b 45 fc mov -0x4(%ebp),%eax 64e: 8b 00 mov (%eax),%eax 650: 3b 45 f8 cmp -0x8(%ebp),%eax 653: 76 ca jbe 61f <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 655: 8b 45 f8 mov -0x8(%ebp),%eax 658: 8b 40 04 mov 0x4(%eax),%eax 65b: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 662: 8b 45 f8 mov -0x8(%ebp),%eax 665: 01 c2 add %eax,%edx 667: 8b 45 fc mov -0x4(%ebp),%eax 66a: 8b 00 mov (%eax),%eax 66c: 39 c2 cmp %eax,%edx 66e: 75 24 jne 694 <free+0x8e> bp->s.size += p->s.ptr->s.size; 670: 8b 45 f8 mov -0x8(%ebp),%eax 673: 8b 50 04 mov 0x4(%eax),%edx 676: 8b 45 fc mov -0x4(%ebp),%eax 679: 8b 00 mov (%eax),%eax 67b: 8b 40 04 mov 0x4(%eax),%eax 67e: 01 c2 add %eax,%edx 680: 8b 45 f8 mov -0x8(%ebp),%eax 683: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 686: 8b 45 fc mov -0x4(%ebp),%eax 689: 8b 00 mov (%eax),%eax 68b: 8b 10 mov (%eax),%edx 68d: 8b 45 f8 mov -0x8(%ebp),%eax 690: 89 10 mov %edx,(%eax) 692: eb 0a jmp 69e <free+0x98> } else bp->s.ptr = p->s.ptr; 694: 8b 45 fc mov -0x4(%ebp),%eax 697: 8b 10 mov (%eax),%edx 699: 8b 45 f8 mov -0x8(%ebp),%eax 69c: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 69e: 8b 45 fc mov -0x4(%ebp),%eax 6a1: 8b 40 04 mov 0x4(%eax),%eax 6a4: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 6ab: 8b 45 fc mov -0x4(%ebp),%eax 6ae: 01 d0 add %edx,%eax 6b0: 3b 45 f8 cmp -0x8(%ebp),%eax 6b3: 75 20 jne 6d5 <free+0xcf> p->s.size += bp->s.size; 6b5: 8b 45 fc mov -0x4(%ebp),%eax 6b8: 8b 50 04 mov 0x4(%eax),%edx 6bb: 8b 45 f8 mov -0x8(%ebp),%eax 6be: 8b 40 04 mov 0x4(%eax),%eax 6c1: 01 c2 add %eax,%edx 6c3: 8b 45 fc mov -0x4(%ebp),%eax 6c6: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 6c9: 8b 45 f8 mov -0x8(%ebp),%eax 6cc: 8b 10 mov (%eax),%edx 6ce: 8b 45 fc mov -0x4(%ebp),%eax 6d1: 89 10 mov %edx,(%eax) 6d3: eb 08 jmp 6dd <free+0xd7> } else p->s.ptr = bp; 6d5: 8b 45 fc mov -0x4(%ebp),%eax 6d8: 8b 55 f8 mov -0x8(%ebp),%edx 6db: 89 10 mov %edx,(%eax) freep = p; 6dd: 8b 45 fc mov -0x4(%ebp),%eax 6e0: a3 88 0a 00 00 mov %eax,0xa88 } 6e5: c9 leave 6e6: c3 ret 000006e7 <morecore>: static Header* morecore(uint nu) { 6e7: 55 push %ebp 6e8: 89 e5 mov %esp,%ebp 6ea: 83 ec 28 sub $0x28,%esp char *p; Header *hp; if(nu < 4096) 6ed: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 6f4: 77 07 ja 6fd <morecore+0x16> nu = 4096; 6f6: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 6fd: 8b 45 08 mov 0x8(%ebp),%eax 700: c1 e0 03 shl $0x3,%eax 703: 89 04 24 mov %eax,(%esp) 706: e8 08 fc ff ff call 313 <sbrk> 70b: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) 70e: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 712: 75 07 jne 71b <morecore+0x34> return 0; 714: b8 00 00 00 00 mov $0x0,%eax 719: eb 22 jmp 73d <morecore+0x56> hp = (Header*)p; 71b: 8b 45 f4 mov -0xc(%ebp),%eax 71e: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 721: 8b 45 f0 mov -0x10(%ebp),%eax 724: 8b 55 08 mov 0x8(%ebp),%edx 727: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 72a: 8b 45 f0 mov -0x10(%ebp),%eax 72d: 83 c0 08 add $0x8,%eax 730: 89 04 24 mov %eax,(%esp) 733: e8 ce fe ff ff call 606 <free> return freep; 738: a1 88 0a 00 00 mov 0xa88,%eax } 73d: c9 leave 73e: c3 ret 0000073f <malloc>: void* malloc(uint nbytes) { 73f: 55 push %ebp 740: 89 e5 mov %esp,%ebp 742: 83 ec 28 sub $0x28,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 745: 8b 45 08 mov 0x8(%ebp),%eax 748: 83 c0 07 add $0x7,%eax 74b: c1 e8 03 shr $0x3,%eax 74e: 83 c0 01 add $0x1,%eax 751: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ 754: a1 88 0a 00 00 mov 0xa88,%eax 759: 89 45 f0 mov %eax,-0x10(%ebp) 75c: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 760: 75 23 jne 785 <malloc+0x46> base.s.ptr = freep = prevp = &base; 762: c7 45 f0 80 0a 00 00 movl $0xa80,-0x10(%ebp) 769: 8b 45 f0 mov -0x10(%ebp),%eax 76c: a3 88 0a 00 00 mov %eax,0xa88 771: a1 88 0a 00 00 mov 0xa88,%eax 776: a3 80 0a 00 00 mov %eax,0xa80 base.s.size = 0; 77b: c7 05 84 0a 00 00 00 movl $0x0,0xa84 782: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 785: 8b 45 f0 mov -0x10(%ebp),%eax 788: 8b 00 mov (%eax),%eax 78a: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ 78d: 8b 45 f4 mov -0xc(%ebp),%eax 790: 8b 40 04 mov 0x4(%eax),%eax 793: 3b 45 ec cmp -0x14(%ebp),%eax 796: 72 4d jb 7e5 <malloc+0xa6> if(p->s.size == nunits) 798: 8b 45 f4 mov -0xc(%ebp),%eax 79b: 8b 40 04 mov 0x4(%eax),%eax 79e: 3b 45 ec cmp -0x14(%ebp),%eax 7a1: 75 0c jne 7af <malloc+0x70> prevp->s.ptr = p->s.ptr; 7a3: 8b 45 f4 mov -0xc(%ebp),%eax 7a6: 8b 10 mov (%eax),%edx 7a8: 8b 45 f0 mov -0x10(%ebp),%eax 7ab: 89 10 mov %edx,(%eax) 7ad: eb 26 jmp 7d5 <malloc+0x96> else { p->s.size -= nunits; 7af: 8b 45 f4 mov -0xc(%ebp),%eax 7b2: 8b 40 04 mov 0x4(%eax),%eax 7b5: 2b 45 ec sub -0x14(%ebp),%eax 7b8: 89 c2 mov %eax,%edx 7ba: 8b 45 f4 mov -0xc(%ebp),%eax 7bd: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 7c0: 8b 45 f4 mov -0xc(%ebp),%eax 7c3: 8b 40 04 mov 0x4(%eax),%eax 7c6: c1 e0 03 shl $0x3,%eax 7c9: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; 7cc: 8b 45 f4 mov -0xc(%ebp),%eax 7cf: 8b 55 ec mov -0x14(%ebp),%edx 7d2: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 7d5: 8b 45 f0 mov -0x10(%ebp),%eax 7d8: a3 88 0a 00 00 mov %eax,0xa88 return (void*)(p + 1); 7dd: 8b 45 f4 mov -0xc(%ebp),%eax 7e0: 83 c0 08 add $0x8,%eax 7e3: eb 38 jmp 81d <malloc+0xde> } if(p == freep) 7e5: a1 88 0a 00 00 mov 0xa88,%eax 7ea: 39 45 f4 cmp %eax,-0xc(%ebp) 7ed: 75 1b jne 80a <malloc+0xcb> if((p = morecore(nunits)) == 0) 7ef: 8b 45 ec mov -0x14(%ebp),%eax 7f2: 89 04 24 mov %eax,(%esp) 7f5: e8 ed fe ff ff call 6e7 <morecore> 7fa: 89 45 f4 mov %eax,-0xc(%ebp) 7fd: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 801: 75 07 jne 80a <malloc+0xcb> return 0; 803: b8 00 00 00 00 mov $0x0,%eax 808: eb 13 jmp 81d <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){ 80a: 8b 45 f4 mov -0xc(%ebp),%eax 80d: 89 45 f0 mov %eax,-0x10(%ebp) 810: 8b 45 f4 mov -0xc(%ebp),%eax 813: 8b 00 mov (%eax),%eax 815: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } 818: e9 70 ff ff ff jmp 78d <malloc+0x4e> } 81d: c9 leave 81e: c3 ret
Laburi/Lab3/4-sets/sets.asm
DanBrezeanu/IOCLA
2
105472
%include "io.inc" section .text global CMAIN CMAIN: ;cele doua multimi se gasesc in eax si ebx mov eax, 139 mov ebx, 169 PRINT_DEC 4, eax ; afiseaza prima multime NEWLINE PRINT_DEC 4, ebx ; afiseaza cea de-a doua multime NEWLINE ; TODO1: reuniunea a doua multimi or eax, ebx PRINT_DEC 4, eax NEWLINE ; TODO2: adaugarea unui element in multime mov ebx, 1 shl ebx, 4 or eax, ebx PRINT_DEC 4, eax NEWLINE ; TODO3: intersectia a doua multimi and eax, ebx PRINT_DEC 4, eax NEWLINE ; TODO4: complementul unei multimi not eax PRINT_DEC 4, eax NEWLINE ; TODO5: eliminarea unui element not eax xor eax, ebx PRINT_UDEC 4, eax NEWLINE ; TODO6: diferenta de multimi EAX-EBX mov eax, 139 mov ebx, 169 xor ebx, eax and eax, ebx PRINT_UDEC 4, eax NEWLINE xor eax, eax ret
programs/oeis/152/A152743.asm
karttu/loda
1
20772
; A152743: 6 times pentagonal numbers: a(n) = 3*n*(3*n-1). ; 0,6,30,72,132,210,306,420,552,702,870,1056,1260,1482,1722,1980,2256,2550,2862,3192,3540,3906,4290,4692,5112,5550,6006,6480,6972,7482,8010,8556,9120,9702,10302,10920,11556,12210,12882,13572,14280,15006,15750,16512,17292,18090,18906,19740,20592,21462,22350,23256,24180,25122,26082,27060,28056,29070,30102,31152,32220,33306,34410,35532,36672,37830,39006,40200,41412,42642,43890,45156,46440,47742,49062,50400,51756,53130,54522,55932,57360,58806,60270,61752,63252,64770,66306,67860,69432,71022,72630,74256,75900,77562,79242,80940,82656,84390,86142,87912,89700,91506,93330,95172,97032,98910,100806,102720,104652,106602,108570,110556,112560,114582,116622,118680,120756,122850,124962,127092,129240,131406,133590,135792,138012,140250,142506,144780,147072,149382,151710,154056,156420,158802,161202,163620,166056,168510,170982,173472,175980,178506,181050,183612,186192,188790,191406,194040,196692,199362,202050,204756,207480,210222,212982,215760,218556,221370,224202,227052,229920,232806,235710,238632,241572,244530,247506,250500,253512,256542,259590,262656,265740,268842,271962,275100,278256,281430,284622,287832,291060,294306,297570,300852,304152,307470,310806,314160,317532,320922,324330,327756,331200,334662,338142,341640,345156,348690,352242,355812,359400,363006,366630,370272,373932,377610,381306,385020,388752,392502,396270,400056,403860,407682,411522,415380,419256,423150,427062,430992,434940,438906,442890,446892,450912,454950,459006,463080,467172,471282,475410,479556,483720,487902,492102,496320,500556,504810,509082,513372,517680,522006,526350,530712,535092,539490,543906,548340,552792,557262 mul $0,3 mov $1,$0 bin $1,2 mul $1,2
tests/nonsmoke/functional/CompileTests/experimental_ada_tests/tests/taskarray.adb
ouankou/rose
488
5124
<gh_stars>100-1000 procedure TaskArray is G : Integer := 0; TASK T IS ENTRY E; END T; TASK BODY T IS TYPE RT IS RECORD M : BOOLEAN := BOOLEAN'VAL(G); N : CHARACTER := CHARACTER'VAL(G); END RECORD; TYPE ART IS ARRAY (1 .. 1) OF RT; begin null; END T; begin null; end TaskArray;
boot/early/eltorito.asm
Tiihala/Dancy
11
99425
;; ;; Copyright (c) 2018 <NAME> ;; ;; Permission to use, copy, modify, and/or distribute this software for any ;; purpose with or without fee is hereby granted, provided that the above ;; copyright notice and this permission notice appear in all copies. ;; ;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ;; ;; eltorito.asm ;; El Torito boot loader (ISO 9660 CD-ROM) ;; ;; Build instructions ;; nasm -f bin -o eltorito.bin eltorito.asm ;; BITS 16 CPU 8086 ORG 0x7400 ElToritoBoot: mov ax, 'EL' ; signature jmp short .L1 ; (16-bit mode continues) hlt ; (32-bit mode) jmp short ElToritoBoot ; (32-bit mode halts) ; This first part of code is position-independent. times 32 - ($ - $$) db 0 .L1: xor ax, ax ; ax = 0x0000 mov es, ax ; es = 0x0000 mov ds, ax ; ds = 0x0000 mov cx, 2048 / 2 ; cx = bytes to copy / 2 mov si, 0x7C00 ; ds:si = source mov di, 0x7400 ; es:di = destination cli ; disable interrupts mov ss, ax ; ss = 0x0000 ("uninterruptible") mov sp, di ; sp = 0x7400 sti ; enable interrupts cld ; clear direction flag rep movsw ; relocate this code mov bp, 0x0000 ; bp = 0x0000 jmp 0x0000:.L2 ; jump to relocated code ; (0x0000:0x7400) .L2: ; This part of code is position-dependent. CheckExtensions: push ax ; push 0x0000 (for es) push ax ; push 0x0000 (for ds) push dx ; save register dx stc ; set carry flag mov bx, 0x55AA ; bx = magic number mov ah, 0x41 ; ah = 0x41, installation check int 0x13 ; bios call sti ; enable interrupts cld ; clear direction flag pop dx ; restore register dx pop ds ; ds = 0x0000 pop es ; es = 0x0000 jc short .Err shr cx, 1 ; move bit 0 (ext. available) to cf adc bx, 0x55AA ; check magic number ; (0xAA55 + 0x55AA + 0x0001 == 0x0000) jz short FindBootImage .Err: mov si, Err1 ; "read functions not supported" jmp near Error ; If disk read extensions are available, the CPU is assumed to ; be 80386 compatible and 32-bit instructions can be used. CPU 386 FindBootImage: xor ebx, ebx ; ebx = 0x00000000 mov dh, 0x06 ; dh = general retry counter mov bl, 0x10 ; read primary volume descriptor mov bp, 0x0001 ; bp = 0x0001, read one block mov si, Err2 ; si = error message, "I/O" mov di, 0x7C00 ; di = 0x7C00 .Read: call ReadBlocks ; read one block jc short .Read ; (this is not an endless loop) cmp word [di+128], 2048 ; test block size jne short JumpToError mov si, Err3 ; si = error message, "ISO 9660" mov ecx, 0x00000800 ; ecx = 0x00000800 mov ebx, [di+156+2] ; ebx = "location of extent" mov eax, [di+156+10] ; eax = "data length" add eax, 0x000007FF ; add 0x000007FF and eax, 0xFFFFF800 ; eax = "data length" (full blocks) shr eax, 11 ; eax = blocks to read jz short JumpToError ; (defensive programming) mov ebp, 0x00000010 ; bp = 16 (maximum) cmp eax, ebp ; limit the maximum size ja short ReadRootDirectory mov ebp, eax ; bp = blocks to read ReadRootDirectory: mov al, 0x00 ; al = 0x00 mov cx, 0x8400 ; cx = 0x8400 cld ; clear direction flag rep stosb ; clear memory from 0x7C00 to 0xFFFF mov si, Err2 ; si = error message, "I/O" .Read: call ReadBlocks ; read blocks jc short .Read ; (this is not an endless loop) FindImageFile: mov cl, [ImageFileStruct] ; cx = size of "ImageFileStruct" mov si, ImageFileStruct ; si = address of "ImageFileStruct" mov di, 0x7C20 ; di = 0x7C20 .Check: test byte [di-7], 0x02 ; test directory flag jnz short .Next cmp cl, [di] ; test one byte first jne short .Next pusha ; save all registers cld ; clear direction flag rep cmpsb ; compare bytes popa ; restore all registers je short ImageFileFound .Next: xor ax, ax ; ax = 0x0000 or al, [di-0x20] ; al = size of directory record jz short .Stop add di, ax ; di = next record jmp short .Check .Stop: mov si, Err4 ; si = error message, "file not found" JumpToError: jmp near Error ImageFileFound: mov ebx, [di-0x1E] ; ebx = "location of extent" mov bp, 0x0001 ; bp = 0x0001, read one block mov si, Err2 ; si = error message, "I/O" .Read: call ReadBlocks ; read one block jc short .Read ; (this is not an endless loop) mov dh, 0x00 ; dh = 0x00 mov si, Err5 ; si = error message, "image format" cmp word [0x7C00], 0x3CEB ; test jump instruction jne short Error cmp word [0x7C0B], 0x0800 ; test block size jne short Error ; This is the end of this El Torito boot loader. One of the key things ; is to update the "hidden sectors" value so that the next phase knows ; its absolute location on the media. Otherwise, it should work just ; like a "partitioned" hard disk drive with 2048-byte sectors. mov [0x7C1C], ebx ; update "hidden sectors" xor ax, ax ; ax = 0x0000 xor cx, cx ; cx = 0x0000 xor si, si ; si = 0x0000 xor di, di ; di = 0x0000 jmp near 0x7C00 ; jump to the boot sector align 16 ReadBlocks: pushad ; save all registers mov ax, 0x7200 ; ax = 0x7200 mov cx, 0x0020 ; cx = 0x0020 (buffer size + extra) mov di, 0x7200 ; di = 0x7200 (buffer address) cld ; clear direction flag (critical) rep stosb ; clear buffer and some extra bytes mov si, ax ; si = 0x7200 mov byte [byte si+0x00], 0x10 ; size mov word [byte si+0x02], bp ; number of blocks mov byte [byte si+0x05], 0x7C ; transfer buffer (0x7C00) mov dword [byte si+0x08], ebx ; lba stc ; set carry flag mov dh, 0x00 ; dl = drive number, dh = 0x00 mov ah, 0x42 ; ah = 0x42 (al = 0x00), extended read int 0x13 ; bios call sti ; enable interrupts popad ; restore all registers jnc short .L1 dec dh ; decrement counter (preserve cf) jz short Error .L1: ret Error: ; This part is 8086 compatible. CPU 8086 mov ah, 0x0F ; get active page -> register bh ; The code below assumes that direction flag is cleared because ; it was explicitly cleared at the beginning of this code. Also, ; the code below assumes that register bx (bh = active page) is ; preserved. Both of these things are not considered to be very ; critical (or likely to happen) because this is a non-return ; error handler. .L1: push si ; save register si int 0x10 ; bios call sti ; enable interrupts (for halt loop) mov bl, 0x07 ; bl = color, bh = active page pop si ; restore register si lodsb ; al = [si++] (character) and al, 0xFF ; test zero mov ah, 0x0E ; teletype output jnz short .L1 ; loop .Halt: hlt ; halt jmp short .Halt ; endless loop (interrupts enabled) Err1: db '! INT 0x13, AH=0x42 is not supported', 13, 0 Err2: db '! I/O error', 13, 0 Err3: db '! ISO 9660 error', 13, 0 Err4: db '! Image not available', 13, 0 Err5: db '! Image format error', 13, 0 ImageFileStruct: db (ImageFileStructEnd - ImageFileName) ImageFileName: db 'DANCY.IMG;1' ImageFileStructEnd: times 510 - ($ - $$) db 0 BootSignature: db 0x55, 0xAA times 2048 - ($ - $$) db 0 ElToritoBootEnd:
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0x48.log_21829_1468.asm
ljhsiun2/medusa
9
91277
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r9 push %rcx push %rdi push %rsi lea addresses_D_ht+0xe070, %rsi lea addresses_WC_ht+0x17a20, %rdi cmp %r12, %r12 mov $33, %rcx rep movsl nop nop xor $37690, %r9 pop %rsi pop %rdi pop %rcx pop %r9 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r8 push %r9 push %rbp push %rbx push %rcx push %rdi // Store mov $0x207a480000000e90, %rbx nop nop nop nop add $47464, %rbp mov $0x5152535455565758, %rdi movq %rdi, (%rbx) nop nop and %rcx, %rcx // Store lea addresses_US+0x154fd, %rcx nop nop nop xor $45005, %r9 mov $0x5152535455565758, %rbp movq %rbp, (%rcx) nop nop xor $24262, %rbx // Load mov $0xeb0, %r9 dec %r11 vmovups (%r9), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %rdi nop cmp $24551, %r9 // Faulty Load lea addresses_RW+0x185b0, %rdi and %rbp, %rbp mov (%rdi), %r11w lea oracles, %r8 and $0xff, %r11 shlq $12, %r11 mov (%r8,%r11,1), %r11 pop %rdi pop %rcx pop %rbx pop %rbp pop %r9 pop %r8 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 5, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 8, 'size': 32, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
src/tools/invstems.adb
spr93/whitakers-words
204
30483
-- WORDS, a Latin dictionary, by <NAME> (USAF, Retired) -- -- Copyright <NAME> (1936–2010) -- -- This is a free program, which means it is proper to copy it and pass -- it on to your friends. Consider it a developmental item for which -- there is no charge. However, just for form, it is Copyrighted -- (c). Permission is hereby freely given for any and all use of program -- and data. You can sell it as your own, but at least tell me. -- -- This version is distributed without obligation, but the developer -- would appreciate comments and suggestions. -- -- All parts of the WORDS system, source code and data files, are made freely -- available to anyone who wishes to use them, for whatever purpose. with Text_IO; use Text_IO; with Latin_Utils.Strings_Package; use Latin_Utils.Strings_Package; procedure Invstems is Line : String (1 .. 250); Ll : Integer; subtype Stem is String (1 .. 18); Blank_Stem : constant Stem := (others => ' '); Sts : array (1 .. 4) of Stem; Input, Output : File_Type; function Invert (S : String) return String is T : String (S'First .. S'Last); begin if S (S'First) = ' ' then return Blank_Stem; else for I in S'Range loop T (I) := S (S'Last - I + 1); end loop; return Head (Trim (T), 18); end if; end Invert; begin Put_Line ("Inverts the 4 stems of a DICTLINE form file " & "INVERT_S.IN -> INVERT_S.OUT"); Create (Output, Out_File, "INVERT_S.OUT"); Open (Input, In_File, "INVERT_S.IN"); while not End_Of_File (Input) loop Get_Line (Input, Line, Ll); Sts (1) := Line (1 .. 18); Sts (2) := Line (20 .. 37); Sts (3) := Line (39 .. 56); Sts (4) := Line (58 .. 75); for I in 1 .. 4 loop Sts (I) := Invert (Sts (I)); end loop; Line (1 .. 18) := Sts (1); Line (20 .. 37) := Sts (2); Line (39 .. 56) := Sts (3); Line (58 .. 75) := Sts (4); Put_Line (Output, Line (1 .. Ll)); end loop; Close (Output); end Invstems;
programs/oeis/017/A017391.asm
karttu/loda
1
5818
; A017391: a(n) = (11*n)^3. ; 0,1331,10648,35937,85184,166375,287496,456533,681472,970299,1331000,1771561,2299968,2924207,3652264,4492125,5451776,6539203,7762392,9129329,10648000,12326391,14172488,16194277,18399744,20796875,23393656,26198073,29218112,32461759,35937000,39651821,43614208,47832147,52313624,57066625,62099136,67419143,73034632,78953589,85184000,91733851,98611128,105823817,113379904,121287375,129554216,138188413,147197952,156590819,166375000,176558481,187149248,198155287,209584584,221445125,233744896,246491883,259694072,273359449,287496000,302111711,317214568,332812557,348913664,365525875,382657176,400315553,418508992,437245479,456533000,476379541,496793088,517781627,539353144,561515625,584277056,607645423,631628712,656234909,681472000,707347971,733870808,761048497,788889024,817400375,846590536,876467493,907039232,938313739,970299000,1003003001,1036433728,1070599167,1105507304,1141166125,1177583616,1214767763,1252726552,1291467969,1331000000,1371330631,1412467848,1454419637,1497193984,1540798875,1585242296,1630532233,1676676672,1723683599,1771561000,1820316861,1869959168,1920495907,1971935064,2024284625,2077552576,2131746903,2186875592,2242946629,2299968000,2357947691,2416893688,2476813977,2537716544,2599609375,2662500456,2726397773,2791309312,2857243059,2924207000,2992209121,3061257408,3131359847,3202524424,3274759125,3348071936,3422470843,3497963832,3574558889,3652264000,3731087151,3811036328,3892119517,3974344704,4057719875,4142253016,4227952113,4314825152,4402880119,4492125000,4582567781,4674216448,4767078987,4861163384,4956477625,5053029696,5150827583,5249879272,5350192749,5451776000,5554637011,5658783768,5764224257,5870966464,5979018375,6088387976,6199083253,6311112192,6424482779,6539203000,6655280841,6772724288,6891541327,7011739944,7133328125,7256313856,7380705123,7506509912,7633736209,7762392000,7892485271,8024024008,8157016197,8291469824,8427392875,8564793336,8703679193,8844058432,8985939039,9129329000,9274236301,9420668928,9568634867,9718142104,9869198625,10021812416,10175991463,10331743752,10489077269,10648000000,10808519931,10970645048,11134383337,11299742784,11466731375,11635357096,11805627933,11977551872,12151136899,12326391000,12503322161,12681938368,12862247607,13044257864,13227977125,13413413376,13600574603,13789468792,13980103929,14172488000,14366628991,14562534888,14760213677,14959673344,15160921875,15363967256,15568817473,15775480512,15983964359,16194277000,16406426421,16620420608,16836267547,17053975224,17273551625,17495004736,17718342543,17943573032,18170704189,18399744000,18630700451,18863581528,19098395217,19335149504,19573852375,19814511816,20057135813,20301732352,20548309419 mov $1,$0 pow $1,3 mul $1,1331
libsrc/_DEVELOPMENT/input/zx/c/sccz80/in_key_pressed.asm
jpoikela/z88dk
640
82411
<gh_stars>100-1000 ; int in_key_pressed(uint16_t scancode) SECTION code_clib SECTION code_input PUBLIC in_key_pressed EXTERN asm_in_key_pressed defc in_key_pressed = asm_in_key_pressed
core/words.asm
paulscottrobson/nextForth
2
161043
WordID_1044_Entry: ; *** ! *** pop ix pop hl ex de,hl ld (hl),e inc hl ld (hl),d pop de jp (ix) WordID_1044_Exit: WordID_1026_Entry: ; *** * *** pop ix pop bc ; BC,DE mult values ld hl,0 ; Result __Mult0:bit 0,c ; check LSB BC jr z,__Mult1 add hl,de ; if non zero add DE to result __Mult1:srl b ; shift BC right rr c ex de,hl ; shift DE left add hl,hl ex de,hl ld a,b ; go back if BC non zero or c jr nz,__Mult0 ex de,hl ; result to TOS jp (ix) WordID_1026_Exit: WordID_1009_Entry: ; *** + *** pop ix pop hl add hl,de ex de,hl jp (ix) WordID_1009_Exit: WordID_1010_Entry: ; *** +! *** pop ix pop hl ld a,(de) add a,l ld (de),a inc de ld a,(de) adc a,h ld (de),a pop de jp (ix) WordID_1010_Exit: WordID_1040_Entry: ; *** - *** pop ix pop hl xor a sbc hl,de ex de,hl jp (ix) WordID_1040_Exit: WordID_1001_Entry: ; *** 0< *** pop hl bit 7,d ld de,$0000 jr z,__0Less dec de __0Less: jp (hl) WordID_1001_Exit: WordID_1000_Entry: ; *** 0= *** pop hl ld a,d or e ld de,$0000 jr nz,__0Equals dec de __0Equals: jp (hl) WordID_1000_Exit: WordID_1003_Entry: ; *** 1+ *** inc de ret WordID_1003_Exit: WordID_1002_Entry: ; *** 1- *** dec de ret WordID_1002_Exit: WordID_1042_Entry: ; *** 2* *** ex de,hl add hl,hl ex de,hl ret WordID_1042_Exit: WordID_1007_Entry: ; *** 2+ *** inc de inc de ret WordID_1007_Exit: WordID_1006_Entry: ; *** 2- *** dec de dec de ret WordID_1006_Exit: WordID_1014_Entry: ; *** 2/ *** sra d rr e ret WordID_1014_Exit: WordID_1004_Entry: ; *** 2drop *** pop hl pop de pop de jp (hl) WordID_1004_Exit: WordID_1005_Entry: ; *** 2dup *** pop ix pop hl push hl push de push hl jp (ix) WordID_1005_Exit: WordID_1024_Entry: ; *** < *** pop ix pop hl xor a sbc hl,de ld de,0 bit 7,h jr z,__Less dec de __Less: jp (ix) WordID_1024_Exit: WordID_1018_Entry: ; *** = *** pop ix pop hl xor a sbc hl,de ld a,h or l ld de,0 jr nz,__Equals dec de __Equals: jp (ix) WordID_1018_Exit: WordID_1021_Entry: ; *** > *** pop ix pop hl xor a ex de,hl sbc hl,de ld de,0 bit 7,h jr z,__Greater dec de __Greater: jp (ix) WordID_1021_Exit: WordID_1032_Entry: ; *** ?dup *** pop ix ld a,d or e jr z,__QDup push de __QDup: jp (ix) WordID_1032_Exit: WordID_1033_Entry: ; *** @ *** ex de,hl ld e,(hl) inc hl ld d,(hl) ret WordID_1033_Exit: WordID_1019_Entry: ; *** [expand.macro] *** __ExpandMacro: jr __ExpandMacro WordID_1019_Exit: WordID_1008_Entry: ; *** abs *** pop ix bit 7,d jr z,__Abs xor a ld l,a ld h,a sbc hl,de ex de,hl __Abs: jp (ix) WordID_1008_Exit: WordID_1011_Entry: ; *** and *** pop hl pop bc ld a,d and b ld d,a ld a,e and c ld e,a jp (hl) WordID_1011_Exit: WordID_1045_Entry: ; *** c! *** pop ix pop hl ld a,l ld (de),a pop de jp (ix) WordID_1045_Exit: WordID_1034_Entry: ; *** c@ *** ex de,hl ld e,(hl) ld d,0 ret WordID_1034_Exit: WordID_1012_Entry: ; *** clear.screen *** pop hl call IO_ClearScreen jp (hl) WordID_1012_Exit: WordID_1038_Entry: ; *** colour! *** pop hl ld a,e ld (IOWC_Colour),a pop de jp (hl) WordID_1038_Exit: WordID_1039_Entry: ; *** cursor! *** pop ix ex de,hl call IO_SetCursor pop de jp (ix) WordID_1039_Exit: WordID_1013_Entry: ; *** debug *** db $DD,$01 ret WordID_1013_Exit: WordID_1015_Entry: ; *** drop *** pop hl pop de jp (hl) WordID_1015_Exit: WordID_1016_Entry: ; *** dump.stack *** pop ix push de call IO_DumpStack pop de jp (ix) WordID_1016_Exit: WordID_1017_Entry: ; *** dup *** pop hl push de jp (hl) WordID_1017_Exit: WordID_1020_Entry: ; *** fill *** pop ix pop bc ; # to copy pop hl ; target address __Fill0:ld a,b ; check copy # zero or c jr z,__Fill1 dec bc ; dec counter ld (hl),e ; copy one character inc hl jr __Fill0 __Fill1:pop de jp (ix) WordID_1020_Exit: WordID_1022_Entry: ; *** halt *** __Halt00: halt jr __Halt00 WordID_1022_Exit: WordID_1023_Entry: ; *** i.fetch *** pop ix push de ; save current TOS ld e,(hl) ; get address where the count is. inc hl ld d,(hl) ex de,hl ; get the count ld e,(hl) inc hl ld d,(hl) jp (ix) WordID_1023_Exit: WordID_1035_Entry: ; *** keyboard@ *** pop hl call IO_ScanKeyboard push de ld e,a ld d,0 jp (hl) WordID_1035_Exit: WordID_1025_Entry: ; *** move *** pop ix pop bc ; target pop hl ; source __Move0:ld a,d ; check count zero or e jr z,__Move1 dec de ; dec count ld a,(hl) ; copy source inc hl ld (bc),a ; to target inc bc jr __Move0 __Move1: pop de jp (ix) WordID_1025_Exit: WordID_1027_Entry: ; *** negate *** pop ix xor a ld l,a ld h,a sbc hl,de ex de,hl jp (ix) WordID_1027_Exit: WordID_1028_Entry: ; *** nip *** pop hl pop bc jp (hl) WordID_1028_Exit: WordID_1029_Entry: ; *** not *** pop hl ld a,d or e ld de,$0000 jr nz,__Not dec de __Not: jp (hl) WordID_1029_Exit: WordID_1030_Entry: ; *** or *** pop hl pop bc ld a,d or b ld d,a ld a,e or c ld e,a jp (hl) WordID_1030_Exit: WordID_1031_Entry: ; *** over *** pop ix pop hl ; 2nd on stack push hl ; push back push de ; push TOS ex de,hl ; 2nd to TOS jp (ix) WordID_1031_Exit: WordID_1036_Entry: ; *** rot *** pop ix pop bc ; 2nd pop hl ; 3rd ex de,hl ; 3rd to TOS, TOS->HL push bc ; push value that was 2nd push hl ; push old TOS jp (ix) WordID_1036_Exit: WordID_1037_Entry: ; *** screen! *** pop ix ex de,hl pop de ld a,e call IO_WriteCharacter pop de jp (ix) WordID_1037_Exit: WordID_1041_Entry: ; *** swap *** pop ix pop hl push de ex de,hl jp (ix) WordID_1041_Exit: WordID_1043_Entry: ; *** u< *** pop ix pop hl xor a sbc hl,de ld de,0 jr nc,__ULess dec de __ULess: jp (ix) WordID_1043_Exit: WordID_1046_Entry: ; *** xor *** pop hl pop bc ld a,d xor b ld d,a ld a,e xor c ld e,a jp (hl) WordID_1046_Exit:
Routing/Route click tracks to channels.applescript
bsmith96/Qlab-Scripts
1
2341
<filename>Routing/Route click tracks to channels.applescript -- @description Route click tracks to channels -- @author <NAME> -- @link bensmithsound.uk -- @version 1.0 -- @testedmacos 10.13.6 -- @testedqlab 4.6.9 -- @about Create a version of this script for each track you are using, and run each using a different hotkey. -- @separateprocess TRUE -- USER DEFINED VARIABLES ----------------- set userChannels to {12, 13} -- the qlab output tracks for this stem or click set userLevel to 0 -- the level for click tracks to route at ---------- END OF USER DEFINED VARIABLES -- ---- RUN SCRIPT --------------------------- tell application id "com.figure53.Qlab.4" to tell front workspace set selectedCues to (selected as list) repeat with eachCue in selectedCues set cueType to q type of eachCue if cueType is "Audio" then repeat with eachChannel in userChannels setLevel eachCue row 0 column eachChannel db userLevel end repeat end if end repeat end tell
libsrc/_DEVELOPMENT/math/float/math32/c/sdcc/cm32_sdcc_dload.asm
Frodevan/z88dk
640
21914
<reponame>Frodevan/z88dk SECTION code_clib SECTION code_fp_math32 PUBLIC cm32_sdcc_dload .cm32_sdcc_dload ; sdcc float primitive ; Load float pointed to by HL into DEHL' ; ; enter : HL = float* (sdcc_float) ; ; exit : DEHL' = float (sdcc_float) ; (exx set is swapped) ; ; uses : bc, de, hl, bc', de', hl' ld c,(hl) inc hl ld b,(hl) inc hl ld e,(hl) inc hl ld d,(hl) ; DEBC = sdcc_float ld l,c ld h,b exx ret ; DEHL' = sdcc_float
code/editor/gui/gui-file-save.asm
abekermsx/skooted
3
174709
<gh_stars>1-10 save_file: ld hl,gui_layout + 8 ld a,(hl) cp '.' jr z,save_file_error_missing_filename ld de,fname ld b,8 copy_filename_loop: ld a,(hl) cp '.' jr nz,copy_filename_loop2 ld a,' ' copy_filename_loop2: ld (de),a inc hl inc de djnz copy_filename_loop ex de,hl ld (hl),'S' inc hl ld (hl),'H' inc hl ld (hl),'T' call save_sheets or a jr nz,save_file_error_disk_error jp gui_file_action save_file_error_missing_filename: ld de,save_file_error_missing_filename_message call display_error_message jp gui_file_action save_file_error_missing_filename_message: db 24, "Please enter a filename!" save_file_error_disk_error: ld a,(bdos_error) or a jp nz,gui_file_error ld de,save_file_error_disk_error_message call display_error_message jp gui save_file_error_disk_error_message: db 18, "Error saving file!"
Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca.log_21829_1577.asm
ljhsiun2/medusa
9
3570
<filename>Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca.log_21829_1577.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r13 push %r15 push %rax push %rcx push %rdi push %rsi lea addresses_WC_ht+0x65db, %rsi lea addresses_normal_ht+0x621b, %rdi nop sub $7457, %rax mov $27, %rcx rep movsw nop sub %r15, %r15 lea addresses_A_ht+0x8edb, %rsi lea addresses_WC_ht+0x18fa7, %rdi nop nop nop nop nop cmp $30879, %r11 mov $112, %rcx rep movsb nop nop inc %r11 lea addresses_WC_ht+0x1741b, %r15 nop nop and $30614, %r10 movw $0x6162, (%r15) nop nop nop nop add $22076, %rdi lea addresses_UC_ht+0x1b6eb, %rsi lea addresses_WC_ht+0x1585b, %rdi clflush (%rdi) nop and $8007, %r11 mov $41, %rcx rep movsb nop nop nop nop inc %r15 lea addresses_WC_ht+0x9a7, %rcx nop nop nop sub $38952, %rax and $0xffffffffffffffc0, %rcx vmovaps (%rcx), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $1, %xmm1, %rsi nop nop nop nop nop xor %rax, %rax lea addresses_WT_ht+0x16697, %rsi lea addresses_normal_ht+0xf9db, %rdi nop nop nop and $50313, %r13 mov $122, %rcx rep movsq nop xor $51467, %r15 pop %rsi pop %rdi pop %rcx pop %rax pop %r15 pop %r13 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %r8 push %rax push %rbp push %rcx push %rdi // Load lea addresses_D+0x65db, %rcx add $23944, %r8 mov (%rcx), %ax inc %rbp // Store lea addresses_A+0x1993b, %r8 nop nop nop and $46839, %rdi mov $0x5152535455565758, %rbp movq %rbp, %xmm0 vmovups %ymm0, (%r8) nop nop nop nop nop cmp %rdi, %rdi // Faulty Load lea addresses_US+0x3bdb, %rdi and $40042, %r8 mov (%rdi), %r12w lea oracles, %r15 and $0xff, %r12 shlq $12, %r12 mov (%r15,%r12,1), %r12 pop %rdi pop %rcx pop %rbp pop %rax pop %r8 pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_US'}, 'OP': 'LOAD'} {'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_D'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_US'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}} {'src': {'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 4, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 2, 'AVXalign': True, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_normal_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 */
software/collapseos/doc/hw/arduinouno/code/at28dump.asm
Noah1989/micro-21
1
85033
<filename>software/collapseos/doc/hw/arduinouno/code/at28dump.asm<gh_stars>1-10 ; Use this as a debug companion to at28wr. This simply dumps, TTY-escaped, the ; contents of the AT28. ; ; TODO: not always, but sometimes, the output starts with a spurious 0xFF. But ; otherwise, the rest of the contents is good, albeit offset by 1 (that is, the ; byte after the spurious 0xFF is the contents at addr 0). Weird, to fix. .include "m328Pdef.inc" ; *** Pins *** .equ SRCP = PORTB2 .equ SRDS = PORTB1 .equ FLWE = PORTB3 .equ FLOE = PORTB4 .equ FLCE = PORTB5 ; WARNING: same as LED ; *** Consts *** .equ BAUD_PRESCALE = 103 ; 9600 bauds at 16mhz rjmp main ; *** Code *** ; Sends char in r20 to UART ; Perform TTY-escape transparently. uartwr: lds r16, UCSR0A sbrs r16, UDRE0 ; wait until send buffer is empty rjmp uartwr ; should we escape? cpi r20, 0x21 brsh uartwr_0 ; r20 >= 0x21, skip ; escape ori r20, 0x80 ldi r16, 0x20 sts UDR0, r16 rjmp uartwr uartwr_0: sts UDR0, r20 ret ; send r23 to addr shift register. ; We send highest bits first so that Q7 is the MSB and Q0 is the LSB sendaddr: ldi r16, 8 ; we will loop 8 times cbi PORTB, SRDS sbrc r23, 7 ; if latest bit isn't cleared, set SER_DP high sbi PORTB, SRDS ; toggle SRCP, not waiting between pulses. The CD74AC164 at 5V has a ; 5.9ns CP min pulse width. We can't match that at 16mhz. No need to ; wait. cbi PORTB, SRCP sbi PORTB, SRCP lsl r23 ; shift our data left dec r16 brne sendaddr+1 ; not zero yet? loop! (+1 to avoid reset) ret ; push r20 to the rom and increase the memory counter nextaddr: ; first, set up addr mov r23, r21 rcall sendaddr mov r23, r22 rcall sendaddr inc r22 brne nextaddr_0 ; no overflow? skip inc r21 nextaddr_0: ret ; read EEPROM's I/O7:0 through PD7:2 and PB1:0 into r20 readdata: cbi PORTB, FLCE cbi PORTB, FLOE nop ; 70ns max delay on at28 nop nop nop ; read bits 7:2 in r20, PIND andi r20, 0xfc ; read bits 1:0 in r16, PINB andi r16, 0x03 or r20, r16 sbi PORTB, FLOE sbi PORTB, FLCE ret ; Set PD7:2 and PB1:0 to output ioout: ldi r16, 0xfc ; PD7:2 out DDRD, r16 ldi r16, 0x3f ; PB5:0 (CP, WE, OE and CE too) out DDRB, r16 ret ; Set PD7:2 and PB1:0 to input ioin: ldi r16, 0x03 ; PD7:2 out DDRD, r16 ldi r16, 0x3c ; PB1:0 out DDRB, r16 ret main: ldi r16, low(RAMEND) out SPL, r16 ldi r16, high(RAMEND) out SPH, r16 ; We begin with WE and OE disabled (high), but CE stays enabled (low) ; the whole time. sbi PORTB, FLWE sbi PORTB, FLOE sbi PORTB, FLCE ; Clear counters and flags clr r21 clr r22 ; Setup UART ldi R16, low(BAUD_PRESCALE) sts UBRR0L, r16 ldi r16, high(BAUD_PRESCALE) sts UBRR0H, r16 ldi r16, (1<<TXEN0) sts UCSR0B, r16 loop: rcall ioout rcall nextaddr rcall ioin rcall readdata rcall uartwr rjmp loop
II-sem/Microprocessor/Assembly Language Programs/printCharacter.asm
ASHD27/JMI-MCA
3
84905
.model small .stack 100h .data msg1 db 'Enter a character :$' msg2 db 'Entered character is :$' c db ? .code main proc mov ax, @data mov ds, ax lea dx, msg1 ; print : 'Enter a character : ' mov ah, 09h int 21h mov ah,01h ; read value int 21h mov c, al ; store vlaue mov dl, 10 ; linefeed mov ah, 02h int 21h mov dl, 13 ; carriage return mov ah, 02h int 21h lea dx, msg2 ; print : 'Entered character is : ' mov ah, 09h int 21h mov dl, c mov ah, 02h int 21h mov ax, 4ch int 21h main endp end main
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1456.asm
ljhsiun2/medusa
9
89344
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r13 push %r15 push %r9 push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0xdde9, %r9 nop nop nop add $15319, %rdx mov (%r9), %r15 xor $6077, %r12 lea addresses_WT_ht+0x16069, %r12 nop dec %r9 movw $0x6162, (%r12) nop lfence lea addresses_A_ht+0xb5a9, %rdi clflush (%rdi) nop nop inc %r13 mov $0x6162636465666768, %r10 movq %r10, (%rdi) dec %r9 lea addresses_WC_ht+0x67e9, %rdx nop nop nop nop nop dec %r15 mov $0x6162636465666768, %rdi movq %rdi, %xmm7 vmovups %ymm7, (%rdx) nop nop nop nop nop cmp %rdi, %rdi lea addresses_normal_ht+0x1c0a9, %r15 nop nop inc %rdi mov (%r15), %r9 inc %r10 lea addresses_UC_ht+0xa4e9, %r10 nop nop sub %rdx, %rdx movl $0x61626364, (%r10) nop add $11669, %r15 lea addresses_UC_ht+0x120a9, %r15 clflush (%r15) nop nop nop nop add $24395, %r13 mov $0x6162636465666768, %r12 movq %r12, %xmm4 movups %xmm4, (%r15) cmp %r10, %r10 lea addresses_D_ht+0x729, %rdx nop nop nop cmp $23552, %r15 mov (%rdx), %rdi nop nop nop nop sub $4436, %r13 lea addresses_UC_ht+0x18799, %rsi lea addresses_D_ht+0x8af, %rdi mfence mov $14, %rcx rep movsl sub %r10, %r10 pop %rsi pop %rdx pop %rdi pop %rcx pop %r9 pop %r15 pop %r13 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r9 push %rax push %rbp push %rdi push %rsi // Store lea addresses_D+0x1b0a9, %rbp nop and %rsi, %rsi mov $0x5152535455565758, %rax movq %rax, %xmm5 vmovups %ymm5, (%rbp) nop nop nop add $8319, %rdi // Faulty Load lea addresses_D+0x10a9, %r10 nop and $21128, %r9 mov (%r10), %ax lea oracles, %rdi and $0xff, %rax shlq $12, %rax mov (%rdi,%rax,1), %rax pop %rsi pop %rdi pop %rbp pop %rax pop %r9 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 11}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 5}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 5}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 5}} {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 9}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 9}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
oeis/005/A005267.asm
neoneye/loda-programs
11
24343
; A005267: a(n) = -1 + a(0)a(1)...a(n-1) if n>0. a(0)=3. ; Submitted by <NAME> ; 3,2,5,29,869,756029,571580604869,326704387862983487112029,106735757048926752040856495274871386126283608869,11392521832807516835658052968328096177131218666695418950023483907701862019030266123104859068029,129789553710995942584535932496451675399852648220377603870312675341032212198287113245560612086017910022423113676287523392956911461849060436665838686793696809116084927033287853405015309012869 mov $1,3 mov $2,1 lpb $0 sub $0,1 mul $1,$2 mov $3,$1 sub $1,1 mov $2,$3 lpe mov $0,$1
unittests/32Bit_ASM/X87/DD_C0.asm
cobalt2727/FEX
628
245974
<reponame>cobalt2727/FEX<filename>unittests/32Bit_ASM/X87/DD_C0.asm %ifdef CONFIG { "Mode": "32BIT" } %endif ; Just to ensure execution ffree st0 ffree st1 ffree st2 ffree st3 ffree st4 ffree st5 ffree st6 ffree st7 hlt
src/tower/maps.asm
hallorant/bitmit
6
98997
<reponame>hallorant/bitmit<gh_stars>1-10 ifndef INCLUDE_MAPS INCLUDE_MAPS equ 1 ; _ __ ___ __ _ _ __ ___ ;| '_ ` _ \ / _` | '_ \/ __| ;| | | | | | (_| | |_) \__ \ ;|_| |_| |_|\__,_| .__/|___/ ; | | ; |_| ; Checks if the bit in byte is the value we should return. Reduces pos by one ; and logical shifts byte right one bit to get ready for the next call. ; Returns if the correct bit is found. ; ; byte is the tabel lookup byte. ; pos position 1-8 of bit in byte. check_bit macro byte,pos,?ret0value,?cont dec pos jr nz,?cont bit 0,byte jr z,?ret0value ld a,1 ret ?ret0value: ld a,0 ret ?cont: srl byte endm ; Checks if the passed row and column are a wall in the world. ; Enter: l The row in the world (y value). ; c The column in the world (x value). ; Exit: a Wall value (0 or $FF). ; ; Note: currently not called but inlined in cast.asm is_wall: ld a,high($6000) add l ld h,a ld l,c ld a,(hl) ret ; Called once to convert the world map bits into page-aligned array ; of bytes. ; This allows the ; map to be easier for humans to work on and is only done at program ; start so it won't hurt performance of the raycaster. active_map_address equ $ea00 ; Entry: hl pointer to map to load load_map: ld d,high(active_map_address) ld c,21 ; rows in a map _ylp: ld b,3 ; bytes per column in a map ld e,low(active_map_address) _xlp: scf rl (hl) _blp: sbc a,a ld (de),a inc e sla (hl) jr nz,_blp inc hl djnz _xlp inc d dec c jr nz,_ylp ret ; --------------- ; -- GAME MAPS -- ; --------------- map_empty defb 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1 ; 0 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 1 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 2 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 3 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 4 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 5 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 6 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 7 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 8 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 9 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 10 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 11 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 12 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 13 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 14 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 15 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 16 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 17 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 18 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 19 defb 1,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,1 ; 20 defb 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1 ; 21 endif ; INCLUDE_MAPS
llvm-gcc-4.2-2.9/gcc/ada/exp_ch2.adb
vidkidz/crossbridge
1
30055
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ C H 2 -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Einfo; use Einfo; with Elists; use Elists; with Errout; use Errout; with Exp_Smem; use Exp_Smem; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Exp_VFpt; use Exp_VFpt; with Nmake; use Nmake; with Opt; use Opt; with Sem; use Sem; with Sem_Eval; use Sem_Eval; with Sem_Res; use Sem_Res; with Sem_Util; use Sem_Util; with Sem_Warn; use Sem_Warn; with Sinfo; use Sinfo; with Snames; use Snames; with Tbuild; use Tbuild; with Uintp; use Uintp; package body Exp_Ch2 is ----------------------- -- Local Subprograms -- ----------------------- procedure Expand_Current_Value (N : Node_Id); -- N is a node for a variable whose Current_Value field is set. If N is -- node is for a discrete type, replaces node with a copy of the referenced -- value. This provides a limited form of value propagation for variables -- which are initialized or assigned not been further modified at the time -- of reference. The call has no effect if the Current_Value refers to a -- conditional with condition other than equality. procedure Expand_Discriminant (N : Node_Id); -- An occurrence of a discriminant within a discriminated type is replaced -- with the corresponding discriminal, that is to say the formal parameter -- of the initialization procedure for the type that is associated with -- that particular discriminant. This replacement is not performed for -- discriminants of records that appear in constraints of component of the -- record, because Gigi uses the discriminant name to retrieve its value. -- In the other hand, it has to be performed for default expressions of -- components because they are used in the record init procedure. See Einfo -- for more details, and Exp_Ch3, Exp_Ch9 for examples of use. For -- discriminants of tasks and protected types, the transformation is more -- complex when it occurs within a default expression for an entry or -- protected operation. The corresponding default_expression_function has -- an additional parameter which is the target of an entry call, and the -- discriminant of the task must be replaced with a reference to the -- discriminant of that formal parameter. procedure Expand_Entity_Reference (N : Node_Id); -- Common processing for expansion of identifiers and expanded names procedure Expand_Entry_Index_Parameter (N : Node_Id); -- A reference to the identifier in the entry index specification of -- protected entry body is modified to a reference to a constant definition -- equal to the index of the entry family member being called. This -- constant is calculated as part of the elaboration of the expanded code -- for the body, and is calculated from the object-wide entry index -- returned by Next_Entry_Call. procedure Expand_Entry_Parameter (N : Node_Id); -- A reference to an entry parameter is modified to be a reference to the -- corresponding component of the entry parameter record that is passed by -- the runtime to the accept body procedure procedure Expand_Formal (N : Node_Id); -- A reference to a formal parameter of a protected subprogram is expanded -- to the corresponding formal of the unprotected procedure used to -- represent the protected subprogram within the protected object. procedure Expand_Protected_Private (N : Node_Id); -- A reference to a private object of a protected type is expanded to a -- component selected from the record used to implement the protected -- object. Such a record is passed to all operations on a protected object -- in a parameter named _object. Such an object is a constant within a -- function, and a variable otherwise. procedure Expand_Renaming (N : Node_Id); -- For renamings, just replace the identifier by the corresponding -- name expression. Note that this has been evaluated (see routine -- Exp_Ch8.Expand_N_Object_Renaming.Evaluate_Name) so this gives -- the correct renaming semantics. -------------------------- -- Expand_Current_Value -- -------------------------- procedure Expand_Current_Value (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); E : constant Entity_Id := Entity (N); CV : constant Node_Id := Current_Value (E); T : constant Entity_Id := Etype (N); Val : Node_Id; Op : Node_Kind; -- Start of processing for Expand_Current_Value begin if True -- No replacement if value raises constraint error and then Nkind (CV) /= N_Raise_Constraint_Error -- Do this only for discrete types and then Is_Discrete_Type (T) -- Do not replace biased types, since it is problematic to -- consistently generate a sensible constant value in this case. and then not Has_Biased_Representation (T) -- Do not replace lvalues and then not Is_Lvalue (N) -- Check that entity is suitable for replacement and then OK_To_Do_Constant_Replacement (E) -- Do not replace occurrences in pragmas (where names typically -- appear not as values, but as simply names. If there are cases -- where values are required, it is only a very minor efficiency -- issue that they do not get replaced when they could be). and then Nkind (Parent (N)) /= N_Pragma_Argument_Association -- Same for Asm_Input and Asm_Output attribute references and then not (Nkind (Parent (N)) = N_Attribute_Reference and then (Attribute_Name (Parent (N)) = Name_Asm_Input or else Attribute_Name (Parent (N)) = Name_Asm_Output)) then -- Case of Current_Value is a compile time known value if Nkind (CV) in N_Subexpr then Val := CV; -- Case of Current_Value is a conditional expression reference else Get_Current_Value_Condition (N, Op, Val); if Op /= N_Op_Eq then return; end if; end if; -- If constant value is an occurrence of an enumeration literal, -- then we just make another occurence of the same literal. if Is_Entity_Name (Val) and then Ekind (Entity (Val)) = E_Enumeration_Literal then Rewrite (N, Unchecked_Convert_To (T, New_Occurrence_Of (Entity (Val), Loc))); -- Otherwise get the value, and convert to appropriate type else Rewrite (N, Unchecked_Convert_To (T, Make_Integer_Literal (Loc, Intval => Expr_Rep_Value (Val)))); end if; Analyze_And_Resolve (N, T); Set_Is_Static_Expression (N, False); end if; end Expand_Current_Value; ------------------------- -- Expand_Discriminant -- ------------------------- procedure Expand_Discriminant (N : Node_Id) is Scop : constant Entity_Id := Scope (Entity (N)); P : Node_Id := N; Parent_P : Node_Id := Parent (P); In_Entry : Boolean := False; begin -- The Incomplete_Or_Private_Kind happens while resolving the -- discriminant constraint involved in a derived full type, -- such as: -- type D is private; -- type D(C : ...) is new T(C); if Ekind (Scop) = E_Record_Type or Ekind (Scop) in Incomplete_Or_Private_Kind then -- Find the origin by walking up the tree till the component -- declaration while Present (Parent_P) and then Nkind (Parent_P) /= N_Component_Declaration loop P := Parent_P; Parent_P := Parent (P); end loop; -- If the discriminant reference was part of the default expression -- it has to be "discriminalized" if Present (Parent_P) and then P = Expression (Parent_P) then Set_Entity (N, Discriminal (Entity (N))); end if; elsif Is_Concurrent_Type (Scop) then while Present (Parent_P) and then Nkind (Parent_P) /= N_Subprogram_Body loop P := Parent_P; if Nkind (P) = N_Entry_Declaration then In_Entry := True; end if; Parent_P := Parent (Parent_P); end loop; -- If the discriminant occurs within the default expression for a -- formal of an entry or protected operation, create a default -- function for it, and replace the discriminant with a reference to -- the discriminant of the formal of the default function. The -- discriminant entity is the one defined in the corresponding -- record. if Present (Parent_P) and then Present (Corresponding_Spec (Parent_P)) then declare Loc : constant Source_Ptr := Sloc (N); D_Fun : constant Entity_Id := Corresponding_Spec (Parent_P); Formal : constant Entity_Id := First_Formal (D_Fun); New_N : Node_Id; Disc : Entity_Id; begin -- Verify that we are within a default function: the type of -- its formal parameter is the same task or protected type. if Present (Formal) and then Etype (Formal) = Scope (Entity (N)) then Disc := CR_Discriminant (Entity (N)); New_N := Make_Selected_Component (Loc, Prefix => New_Occurrence_Of (Formal, Loc), Selector_Name => New_Occurrence_Of (Disc, Loc)); Set_Etype (New_N, Etype (N)); Rewrite (N, New_N); else Set_Entity (N, Discriminal (Entity (N))); end if; end; elsif Nkind (Parent (N)) = N_Range and then In_Entry then Set_Entity (N, CR_Discriminant (Entity (N))); else Set_Entity (N, Discriminal (Entity (N))); end if; else Set_Entity (N, Discriminal (Entity (N))); end if; end Expand_Discriminant; ----------------------------- -- Expand_Entity_Reference -- ----------------------------- procedure Expand_Entity_Reference (N : Node_Id) is E : constant Entity_Id := Entity (N); begin -- Defend against errors if No (E) and then Total_Errors_Detected /= 0 then return; end if; if Ekind (E) = E_Discriminant then Expand_Discriminant (N); elsif Is_Entry_Formal (E) then Expand_Entry_Parameter (N); elsif Ekind (E) = E_Component and then Is_Protected_Private (E) then -- Protect against junk use of tasking in no run time mode if No_Run_Time_Mode then return; end if; Expand_Protected_Private (N); elsif Ekind (E) = E_Entry_Index_Parameter then Expand_Entry_Index_Parameter (N); elsif Is_Formal (E) then Expand_Formal (N); elsif Is_Renaming_Of_Object (E) then Expand_Renaming (N); elsif Ekind (E) = E_Variable and then Is_Shared_Passive (E) then Expand_Shared_Passive_Variable (N); elsif (Ekind (E) = E_Variable or else Ekind (E) = E_In_Out_Parameter or else Ekind (E) = E_Out_Parameter) and then Present (Current_Value (E)) then Expand_Current_Value (N); -- We do want to warn for the case of a boolean variable (not a -- boolean constant) whose value is known at compile time. if Is_Boolean_Type (Etype (N)) then Warn_On_Known_Condition (N); end if; end if; end Expand_Entity_Reference; ---------------------------------- -- Expand_Entry_Index_Parameter -- ---------------------------------- procedure Expand_Entry_Index_Parameter (N : Node_Id) is begin Set_Entity (N, Entry_Index_Constant (Entity (N))); end Expand_Entry_Index_Parameter; ---------------------------- -- Expand_Entry_Parameter -- ---------------------------- procedure Expand_Entry_Parameter (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Ent_Formal : constant Entity_Id := Entity (N); Ent_Spec : constant Entity_Id := Scope (Ent_Formal); Parm_Type : constant Entity_Id := Entry_Parameters_Type (Ent_Spec); Acc_Stack : constant Elist_Id := Accept_Address (Ent_Spec); Addr_Ent : constant Entity_Id := Node (Last_Elmt (Acc_Stack)); P_Comp_Ref : Entity_Id; function In_Assignment_Context (N : Node_Id) return Boolean; -- Check whether this is a context in which the entry formal may be -- assigned to. --------------------------- -- In_Assignment_Context -- --------------------------- function In_Assignment_Context (N : Node_Id) return Boolean is begin if Nkind (Parent (N)) = N_Procedure_Call_Statement or else Nkind (Parent (N)) = N_Entry_Call_Statement or else (Nkind (Parent (N)) = N_Assignment_Statement and then N = Name (Parent (N))) then return True; elsif Nkind (Parent (N)) = N_Parameter_Association then return In_Assignment_Context (Parent (N)); elsif (Nkind (Parent (N)) = N_Selected_Component or else Nkind (Parent (N)) = N_Indexed_Component or else Nkind (Parent (N)) = N_Slice) and then In_Assignment_Context (Parent (N)) then return True; else return False; end if; end In_Assignment_Context; -- Start of processing for Expand_Entry_Parameter begin if Is_Task_Type (Scope (Ent_Spec)) and then Comes_From_Source (Ent_Formal) then -- Before replacing the formal with the local renaming that is used -- in the accept block, note if this is an assignment context, and -- note the modification to avoid spurious warnings, because the -- original entity is not used further. If formal is unconstrained, -- we also generate an extra parameter to hold the Constrained -- attribute of the actual. No renaming is generated for this flag. if Ekind (Entity (N)) /= E_In_Parameter and then In_Assignment_Context (N) then Note_Possible_Modification (N); end if; Rewrite (N, New_Occurrence_Of (Renamed_Object (Entity (N)), Loc)); return; end if; -- What we need is a reference to the corresponding component of the -- parameter record object. The Accept_Address field of the entry entity -- references the address variable that contains the address of the -- accept parameters record. We first have to do an unchecked conversion -- to turn this into a pointer to the parameter record and then we -- select the required parameter field. P_Comp_Ref := Make_Selected_Component (Loc, Prefix => Make_Explicit_Dereference (Loc, Unchecked_Convert_To (Parm_Type, New_Reference_To (Addr_Ent, Loc))), Selector_Name => New_Reference_To (Entry_Component (Ent_Formal), Loc)); -- For all types of parameters, the constructed parameter record object -- contains a pointer to the parameter. Thus we must dereference them to -- access them (this will often be redundant, since the needed deference -- is implicit, but no harm is done by making it explicit). Rewrite (N, Make_Explicit_Dereference (Loc, P_Comp_Ref)); Analyze (N); end Expand_Entry_Parameter; ------------------- -- Expand_Formal -- ------------------- procedure Expand_Formal (N : Node_Id) is E : constant Entity_Id := Entity (N); Subp : constant Entity_Id := Scope (E); begin if Is_Protected_Type (Scope (Subp)) and then not Is_Init_Proc (Subp) and then Present (Protected_Formal (E)) then Set_Entity (N, Protected_Formal (E)); end if; end Expand_Formal; ---------------------------- -- Expand_N_Expanded_Name -- ---------------------------- procedure Expand_N_Expanded_Name (N : Node_Id) is begin Expand_Entity_Reference (N); end Expand_N_Expanded_Name; ------------------------- -- Expand_N_Identifier -- ------------------------- procedure Expand_N_Identifier (N : Node_Id) is begin Expand_Entity_Reference (N); end Expand_N_Identifier; --------------------------- -- Expand_N_Real_Literal -- --------------------------- procedure Expand_N_Real_Literal (N : Node_Id) is begin if Vax_Float (Etype (N)) then Expand_Vax_Real_Literal (N); end if; end Expand_N_Real_Literal; ------------------------------ -- Expand_Protected_Private -- ------------------------------ procedure Expand_Protected_Private (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); E : constant Entity_Id := Entity (N); Op : constant Node_Id := Protected_Operation (E); Scop : Entity_Id; Lo : Node_Id; Hi : Node_Id; D_Range : Node_Id; begin if Nkind (Op) /= N_Subprogram_Body or else Nkind (Specification (Op)) /= N_Function_Specification then Set_Ekind (Prival (E), E_Variable); else Set_Ekind (Prival (E), E_Constant); end if; -- If the private component appears in an assignment (either lhs or -- rhs) and is a one-dimensional array constrained by a discriminant, -- rewrite as P (Lo .. Hi) with an explicit range, so that discriminal -- is directly visible. This solves delicate visibility problems. if Comes_From_Source (N) and then Is_Array_Type (Etype (E)) and then Number_Dimensions (Etype (E)) = 1 and then not Within_Init_Proc then Lo := Type_Low_Bound (Etype (First_Index (Etype (E)))); Hi := Type_High_Bound (Etype (First_Index (Etype (E)))); if Nkind (Parent (N)) = N_Assignment_Statement and then ((Is_Entity_Name (Lo) and then Ekind (Entity (Lo)) = E_In_Parameter) or else (Is_Entity_Name (Hi) and then Ekind (Entity (Hi)) = E_In_Parameter)) then D_Range := New_Node (N_Range, Loc); if Is_Entity_Name (Lo) and then Ekind (Entity (Lo)) = E_In_Parameter then Set_Low_Bound (D_Range, Make_Identifier (Loc, Chars (Entity (Lo)))); else Set_Low_Bound (D_Range, Duplicate_Subexpr (Lo)); end if; if Is_Entity_Name (Hi) and then Ekind (Entity (Hi)) = E_In_Parameter then Set_High_Bound (D_Range, Make_Identifier (Loc, Chars (Entity (Hi)))); else Set_High_Bound (D_Range, Duplicate_Subexpr (Hi)); end if; Rewrite (N, Make_Slice (Loc, Prefix => New_Occurrence_Of (E, Loc), Discrete_Range => D_Range)); Analyze_And_Resolve (N, Etype (E)); return; end if; end if; -- The type of the reference is the type of the prival, which may differ -- from that of the original component if it is an itype. Set_Entity (N, Prival (E)); Set_Etype (N, Etype (Prival (E))); Scop := Current_Scope; -- Find entity for protected operation, which must be on scope stack while not Is_Protected_Type (Scope (Scop)) loop Scop := Scope (Scop); end loop; Append_Elmt (N, Privals_Chain (Scop)); end Expand_Protected_Private; --------------------- -- Expand_Renaming -- --------------------- procedure Expand_Renaming (N : Node_Id) is E : constant Entity_Id := Entity (N); T : constant Entity_Id := Etype (N); begin Rewrite (N, New_Copy_Tree (Renamed_Object (E))); -- We mark the copy as unanalyzed, so that it is sure to be reanalyzed -- at the top level. This is needed in the packed case since we -- specifically avoided expanding packed array references when the -- renaming declaration was analyzed. Reset_Analyzed_Flags (N); Analyze_And_Resolve (N, T); end Expand_Renaming; ------------------ -- Param_Entity -- ------------------ -- This would be trivial, simply a test for an identifier that was a -- reference to a formal, if it were not for the fact that a previous call -- to Expand_Entry_Parameter will have modified the reference to the -- identifier. A formal of a protected entity is rewritten as -- typ!(recobj).rec.all'Constrained -- where rec is a selector whose Entry_Formal link points to the formal -- For a formal of a task entity, the formal is rewritten as a local -- renaming. -- In addition, a formal that is marked volatile because it is aliased -- through an address clause is rewritten as dereference as well. function Param_Entity (N : Node_Id) return Entity_Id is begin -- Simple reference case if Nkind (N) = N_Identifier or else Nkind (N) = N_Expanded_Name then if Is_Formal (Entity (N)) then return Entity (N); elsif Nkind (Parent (Entity (N))) = N_Object_Renaming_Declaration and then Nkind (Parent (Parent (Entity (N)))) = N_Accept_Statement then return Entity (N); end if; else if Nkind (N) = N_Explicit_Dereference then declare P : constant Node_Id := Prefix (N); S : Node_Id; begin if Nkind (P) = N_Selected_Component then S := Selector_Name (P); if Present (Entry_Formal (Entity (S))) then return Entry_Formal (Entity (S)); end if; elsif Nkind (Original_Node (N)) = N_Identifier then return Param_Entity (Original_Node (N)); end if; end; end if; end if; return (Empty); end Param_Entity; end Exp_Ch2;
src/syscalls/debug.asm
moneytech/BareMetal-kernel
289
101521
; ============================================================================= ; BareMetal -- a 64-bit OS written in Assembly for x86-64 systems ; Copyright (C) 2008-2020 Return Infinity -- see LICENSE.TXT ; ; Debug Functions ; ============================================================================= ; ----------------------------------------------------------------------------- ; os_debug_dump_(rax|eax|ax|al) -- Dump content of RAX, EAX, AX, or AL ; IN: RAX = content to dump ; OUT: Nothing, all registers preserved os_debug_dump_rax: rol rax, 8 call os_debug_dump_al rol rax, 8 call os_debug_dump_al rol rax, 8 call os_debug_dump_al rol rax, 8 call os_debug_dump_al rol rax, 32 os_debug_dump_eax: rol eax, 8 call os_debug_dump_al rol eax, 8 call os_debug_dump_al rol eax, 16 os_debug_dump_ax: rol ax, 8 call os_debug_dump_al rol ax, 8 os_debug_dump_al: push rbx push rax mov rbx, hextable push rax ; Save RAX since we work in 2 parts shr al, 4 ; Shift high 4 bits into low 4 bits xlatb mov [tchar+0], al pop rax and al, 0x0f ; Clear the high 4 bits xlatb mov [tchar+1], al push rsi push rcx mov rsi, tchar mov rcx, 2 call b_output pop rcx pop rsi pop rax pop rbx ret ; ----------------------------------------------------------------------------- ; ----------------------------------------------------------------------------- ; os_debug_dump_mem -- Dump content of memory in hex format ; IN: RSI = starting address of memory to dump ; RCX = number of bytes ; OUT: Nothing, all registers preserved os_debug_dump_mem: push rsi push rcx ; Counter push rdx ; Total number of bytes to display push rax test rcx, rcx ; Bail out if no bytes were requested jz os_debug_dump_mem_done push rsi ; Output '0x' push rcx mov rsi, os_debug_dump_mem_chars mov rcx, 2 call b_output pop rcx pop rsi mov rax, rsi ; Output the memory address call os_debug_dump_rax call os_debug_dump_mem_newline nextline: mov dx, 0 nextchar: cmp rcx, 0 je os_debug_dump_mem_done_newline push rsi ; Output ' ' push rcx mov rsi, os_debug_dump_mem_chars+3 mov rcx, 1 call b_output pop rcx pop rsi lodsb call os_debug_dump_al dec rcx inc rdx cmp dx, 16 ; End of line yet? jne nextchar call os_debug_dump_mem_newline cmp rcx, 0 je os_debug_dump_mem_done jmp nextline os_debug_dump_mem_done_newline: call os_debug_dump_mem_newline os_debug_dump_mem_done: pop rax pop rcx pop rdx pop rsi ret os_debug_dump_mem_newline: push rsi ; Output newline push rcx mov rsi, newline mov rcx, 1 call b_output pop rcx pop rsi ret os_debug_dump_mem_chars: db '0x: ' ; ----------------------------------------------------------------------------- ; ============================================================================= ; EOF
Qsi.Cql/Antlr/CqlParserInternal.g4
ScriptBox99/chequer-qsi
36
3074
parser grammar CqlParserInternal; options { tokenVocab=CqlLexerInternal; } @header { using Qsi.Data; using Qsi.Tree; using Qsi.Cql.Tree; using Qsi.Cql.Schema; } root : cqlStatements? MINUSMINUS? EOF ; cqlStatements : (cqlStatement MINUSMINUS? SEMI? | emptyStatement)* (cqlStatement (MINUSMINUS? SEMI)? | emptyStatement) ; emptyStatement : SEMI ; cqlStatement : selectStatement | insertStatement | updateStatement | deleteStatement | useStatement | createMaterializedViewStatement ; /* * USE <KEYSPACE>; */ useStatement : K_USE ks=keyspaceName ; /** * SELECT [JSON] [DISTINCT] <expression> * FROM <CF> * [ WHERE KEY = "key1" AND COL > 1 AND COL < 100 ] * [ PER PARTITION LIMIT <NUMBER> ] * [ LIMIT <NUMBER> ] * [ ALLOW FILTERING ] */ selectStatement returns [ bool json, bool distinct, bool allowFiltering ] : K_SELECT ( K_JSON { $json = true; } )? ( K_DISTINCT { $distinct = true; } )? selectors K_FROM columnFamilyName ( w=K_WHERE whereClause )? ( g=K_GROUP K_BY groupByClause ( ',' groupByClause )* )? ( o=K_ORDER K_BY orderByClause ( ',' orderByClause )* )? ( p=K_PER K_PARTITION K_LIMIT perLimit=intValue )? ( l=K_LIMIT limit=intValue )? ( K_ALLOW K_FILTERING { $allowFiltering = true; } )? ; selectors : selector (',' selector)* | '*' ; selector : unaliasedSelector alias? ; unaliasedSelector : selectionAddition ; selectionAddition : left=selectionMultiplication (additionOperator selectionMultiplication)* ; selectionMultiplication : left=selectionGroup (multiplicationOperator selectionGroup)* ; selectionGroup : selectionGroupWithField | selectionGroupWithoutField | unary='-' selectionGroup ; selectionGroupWithField : selectionGroupWithoutField selectorModifier ; selectorModifier : fieldSelectorModifier selectorModifier? #fieldAccess | '[' collectionSubSelection ']' selectorModifier? #rangeAccess ; fieldSelectorModifier : '.' fident ; collectionSubSelection returns [bool range] : ( t1=term ( RANGE (t2=term)? { $range = true; } )? | RANGE t2=term { $range = true; } ) ; selectionGroupWithoutField : simpleUnaliasedSelector | selectionTypeHint | selectionTupleOrNestedSelector | selectionList | selectionMapOrSet // UDTs are equivalent to maps from the syntax point of view, so the final decision will be done in Selectable.WithMapOrUdt ; selectionTypeHint : '(' comparatorType ')' selectionGroupWithoutField ; selectionList : '[' ( unaliasedSelector ( ',' unaliasedSelector )* )? ']' ; selectionMapOrSet : '{' unaliasedSelector ( m=selectionMap | s=selectionSet ) '}' | '{' '}' ; selectionMap : ':' unaliasedSelector ( ',' unaliasedSelector ':' unaliasedSelector )* ; selectionSet : ( ',' unaliasedSelector )* ; selectionTupleOrNestedSelector : '(' list+=unaliasedSelector (',' list+=unaliasedSelector )* ')' ; additionOperator : '-' | '+' ; multiplicationOperator : '*' | '/' | '%' ; /* * A single selection. The core of it is selecting a column, but we also allow any term and function, as well as * sub-element selection for UDT. */ simpleUnaliasedSelector : sident | selectionLiteral | selectionFunction ; selectionFunction : K_COUNT '(' '*' ')' #countFunction | K_WRITETIME '(' c=sident ')' #writetimeFunction | K_TTL '(' c=sident ')' #ttlFunction | K_CAST '(' sn=unaliasedSelector K_AS t=native_type ')' #castFunction | n=functionName args=selectionFunctionArgs #userFunction ; selectionLiteral : c=constant | n=K_NULL | b=bindParameter ; selectionFunctionArgs : '(' (s1=unaliasedSelector ( ',' sn=unaliasedSelector )*)? ')' ; alias returns [QsiAliasNode node] : K_AS n=noncol_ident { $node = new QsiAliasNode { Name = $n.id }; } ; sident returns [QsiIdentifier id] : i=ident { $id = $i.id; } ; whereClause : relationOrExpression (K_AND relationOrExpression)* ; relationOrExpression : relation | customIndexExpression ; customIndexExpression : K_EXPR '(' idxName ',' t=term ')' ; orderByClause returns [bool isDescending] : cident (K_ASC | K_DESC { $isDescending = true; })? ; groupByClause : cident ; /** * INSERT INTO <CF> (<column>, <column>, <column>, ...) * VALUES (<value>, <value>, <value>, ...) * USING TIMESTAMP <long>; * */ insertStatement : K_INSERT K_INTO cf=columnFamilyName ( st1=normalInsertStatement | K_JSON st2=jsonInsertStatement) ; normalInsertStatement returns [bool ifNotExists] : '(' cidentList ')' K_VALUES '(' values+=term ( ',' values+=term )* ')' ( K_IF K_NOT K_EXISTS { $ifNotExists = true; })? ( usingClause )? ; jsonInsertStatement returns [string defaultValue, bool ifNotExists] : val=jsonValue ( K_DEFAULT ( k=K_NULL { $defaultValue = $k.text; } | ( k=K_UNSET { $defaultValue = $k.text; }) ) )? ( K_IF K_NOT K_EXISTS { $ifNotExists = true; })? ( usingClause )? ; jsonValue : s=stringLiteral | bindParameter ; usingClause : K_USING usingClauseObjective ( K_AND usingClauseObjective )* ; usingClauseObjective returns [CqlUsingType type, int time] @after { $time = int.Parse($t.text); } : K_TIMESTAMP t=intValue { $type = CqlUsingType.Timestamp; } | K_TTL t=intValue { $type = CqlUsingType.Ttl; } ; /** * UPDATE <CF> * USING TIMESTAMP <long> * SET name1 = value1, name2 = value2 * WHERE key = value; * [IF (EXISTS | name = value, ...)]; */ updateStatement : K_UPDATE cf=columnFamilyName ( usingClause )? K_SET columnOperation (',' columnOperation)* w=K_WHERE wclause=whereClause ( K_IF ( K_EXISTS | conditions=updateConditions ))? ; updateConditions : list+=columnCondition ( K_AND list+=columnCondition )* ; /** * DELETE name1, name2 * FROM <CF> * USING TIMESTAMP <long> * WHERE KEY = keyname [IF (EXISTS | name = value, ...)]; */ deleteStatement : K_DELETE ( dels=deleteSelection )? K_FROM cf=columnFamilyName ( usingClauseDelete )? w=K_WHERE wclause=whereClause ( K_IF ( K_EXISTS | conditions=updateConditions ))? ; deleteSelection : deleteOp (',' deleteOp)* ; deleteOp : c=cident #deleteSingle | c=cident '[' t=term ']' #deleteIndex | c=cident '.' field=fident #deleteField ; usingClauseDelete : K_USING K_TIMESTAMP ts=intValue ; /** * CREATE MATERIALIZED VIEW <viewName> AS * SELECT <columns> * FROM <CF> * WHERE <pkColumns> IS NOT NULL * PRIMARY KEY (<pkColumns>) * WITH <property> = <value> AND ...; */ createMaterializedViewStatement : K_CREATE K_MATERIALIZED K_VIEW (K_IF K_NOT K_EXISTS)? cf=columnFamilyName K_AS K_SELECT sclause=selectors K_FROM basecf=columnFamilyName (w=K_WHERE wclause=whereClause)? viewPrimaryKey ( K_WITH viewProperty ( K_AND viewProperty )*)? ; viewPrimaryKey : K_PRIMARY K_KEY '(' viewPartitionKey (',' c=ident )* ')' ; viewPartitionKey : keys+=ident | '(' keys+=ident ( ',' keys+=ident )* ')' ; viewProperty : property | K_COMPACT K_STORAGE | K_CLUSTERING K_ORDER K_BY '(' viewClusteringOrder (',' viewClusteringOrder)* ')' ; viewClusteringOrder : k=ident (K_ASC | K_DESC) ; fullMapLiteral : '{' ( k1=term ':' v1=term ( ',' kn=term ':' vn=term )* )? '}' ; setOrMapLiteral : m=mapLiteral | s=setLiteral ; setLiteral : ( ',' tn=term )* ; mapLiteral : ':' v=term ( ',' kn=term ':' vn=term )* ; collectionLiteral : l=listLiteral | '{' t=term v=setOrMapLiteral '}' // Note that we have an ambiguity between maps and set for "{}". So we force it to a set literal, // and deal with it later based on the type of the column (SetLiteral.java). | '{' '}' ; listLiteral : '[' ( t1=term ( ',' tn=term )* )? ']' ; usertypeLiteral // We don't allow empty literals because that conflicts with sets/maps and is currently useless since we don't allow empty user types : '{' k1=fident ':' v1=term ( ',' kn=fident ':' vn=term )* '}' ; tupleLiteral : '(' list+=term ( ',' list+=term )* ')' ; value : c=constant | l=collectionLiteral | u=usertypeLiteral | t=tupleLiteral | n=K_NULL | bindParameter ; intValue : t=INTEGER | bindParameter ; bindParameter returns [int index] : ':' id=noncol_ident { $index = -1; } | QMARK { $index = NextBindParameterIndex(); } ; functionName returns [QsiQualifiedIdentifier id] @init { QsiIdentifier first = null; } : (f=keyspaceName '.' { first = $f.id; } )? second=allowedFunctionName { if (first == null) $id = new QsiQualifiedIdentifier($second.id); else $id = new QsiQualifiedIdentifier(first, $second.id); } ; allowedFunctionName returns [QsiIdentifier id] : t=IDENT { $id = new QsiIdentifier($t.text.ToLower(), false); } | t=QUOTED_NAME { $id = new QsiIdentifier($t.text, true); } | k=unreserved_function_keyword { $id = new QsiIdentifier($k.text.ToLower(), false); } | t=K_TOKEN { $id = new QsiIdentifier($t.text.ToLower(), false); } | t=K_COUNT { $id = new QsiIdentifier($t.text.ToLower(), false); } ; cidentList returns [List<QsiIdentifier> list] @init { $list = new List<QsiIdentifier>(); } : i=cident { $list.Add($i.id); } ( ',' i=cident { $list.Add($i.id); })* ; /** DEFINITIONS **/ // Like ident, but for case where we take a column name that can be the legacy super column empty name. Importantly, // this should not be used in DDL statements, as we don't want to let users create such column. cident returns [QsiIdentifier id] : e=EMPTY_QUOTED_NAME { $id = new QsiIdentifier(string.Empty, false); } | i=ident { $id = $i.id; } ; ident returns [QsiIdentifier id] : t=IDENT { $id = new QsiIdentifier($t.text.ToLower(), false); } | t=QUOTED_NAME { $id = new QsiIdentifier($t.text, true); } | k=unreserved_keyword { $id = new QsiIdentifier($k.text.ToLower(), false); } ; fident returns [QsiIdentifier id] : i=ident { $id = $i.id; } ; // Identifiers that do not refer to columns noncol_ident returns [QsiIdentifier id] : i=ident { $id = $i.id; } ; // Keyspace & Column family names keyspaceName returns [QsiIdentifier id] : n=ksName { $id = $n.id; } ; indexName returns [QsiQualifiedIdentifier id] @init { QsiIdentifier first = null; } : (f=ksName DOT { first = $f.id; } )? second=idxName { if (first == null) $id = new QsiQualifiedIdentifier($second.id); else $id = new QsiQualifiedIdentifier(first, $second.id); } ; columnFamilyName returns [QsiQualifiedIdentifier id] @init { QsiIdentifier first = null; } : (f=ksName DOT { first = $f.id; } )? second=cfName { if (first == null) $id = new QsiQualifiedIdentifier($second.id); else $id = new QsiQualifiedIdentifier(first, $second.id); } ; userTypeName returns [CqlUserType type] @init { QsiIdentifier first = null; } : (f=noncol_ident DOT { first = $f.id; } )? second=non_type_ident { if (first == null) $type = new CqlUserType(new QsiQualifiedIdentifier($second.id)); else $type = new CqlUserType(new QsiQualifiedIdentifier(first, $second.id)); } ; userOrRoleName : roleName ; ksName returns [QsiIdentifier id] : i=ident { $id = $i.id; } | QMARK { AddRecognitionError("Bind variables cannot be used for keyspace names"); } ; cfName returns [QsiIdentifier id] : i=ident { $id = $i.id; } | QMARK { AddRecognitionError("Bind variables cannot be used for table names"); } ; idxName returns [QsiIdentifier id] : i=ident { $id = $i.id; } | QMARK { AddRecognitionError("Bind variables cannot be used for index names"); } ; roleName returns [QsiIdentifier id] : i=ident { $id = $i.id; } | QMARK { AddRecognitionError("Bind variables cannot be used for role names"); } ; constant : s=stringLiteral #literalString | INTEGER #literalInteger | FLOAT #literalFloat | BOOLEAN #literalBoolean | DURATION #literalDuration | UUID #literalUuid | HEXNUMBER #literalHexnumber | K_POSITIVE_NAN #literalPositiveNan | K_NEGATIVE_NAN #literalNegativeNan | K_POSITIVE_INFINITY #literalPositiveInfinity | K_NEGATIVE_INFINITY #literalNegativeInfinity ; function : n=functionName '(' ')' | n=functionName '(' args=functionArgs ')' ; functionArgs : t1=term ( ',' tn=term )* ; term : t=termAddition ; termAddition : left=termMultiplication (additionOperator termMultiplication)* ; termMultiplication : left=termGroup (multiplicationOperator termGroup)* ; termGroup : t=simpleTerm | u='-' t=simpleTerm ; simpleTerm : v=value | f=function | '(' c=comparatorType ')' t=simpleTerm ; columnOperation returns [CqlSetOperator op] : l=cident '=' r=normalColumnOperation #simpleColumnOp | l=cident ( '+=' { $op = CqlSetOperator.AdditionAssignment; } | '-=' { $op = CqlSetOperator.SubtractionAssignment; } ) r=term #additionAssignColumnOp | l=cident '[' k=term ']' '=' r=term #collectionColumnOp | l=cident '.' field=fident '=' r=term #fieldColumnOp ; normalColumnOperation : l=term ('+' r=cident )? #normalColumnOperation1 | l=cident sig=('+' | '-') r=term #normalColumnOperation2 | /* c=cident */ i=INTEGER #normalColumnOperation3 ; // <cident> columnCondition // Note: we'll reject duplicates later : l=cident ( op=relationType r1=term | K_IN (r2=singleColumnInValues | bindParameter) | '[' element=term ']' ( op=relationType r1=term | K_IN (r2=singleColumnInValues | bindParameter) ) | '.' field=fident ( op=relationType r1=term | K_IN (r2=singleColumnInValues | bindParameter) ) ) ; properties : property (K_AND property)* ; property : k=noncol_ident '=' simple=propertyValue | k=noncol_ident '=' map=fullMapLiteral ; propertyValue : c=constant | u=unreserved_keyword ; relationType : '=' | '<' | '<=' | '>' | '>=' | '!=' ; relation : l=cident op=relationType r=term #logicalExpr1 | l=cident K_LIKE r=term #likeExpr | l=cident K_IS K_NOT K_NULL #isNotNulExpr | K_TOKEN l=tupleOfIdentifiers op=relationType r=term #tokenExpr | l=cident K_IN r=bindParameter #inExpr1 | l=cident K_IN r=singleColumnInValues #inExpr2 | l=cident op=containsOperator r=term #containsExpr | l=cident '[' key=term ']' op=relationType r=term #logicalExpr2 | l=tupleOfIdentifiers ( K_IN ( /* (a, b, c) IN () */ '(' ')' /* (a, b, c) IN ? */ | tupleInMarker=bindParameter /* (a, b, c) IN ((1, 2, 3), (4, 5, 6), ...) */ | literals=tupleOfTupleLiterals /* (a, b, c) IN (?, ?, ...) */ | markers=tupleOfMarkersForTuples ) /* (a, b, c) > (1, 2, 3) or (a, b, c) > (?, ?, ?) */ | op=relationType literal=tupleLiteral /* (a, b, c) >= ? */ | op=relationType tupleMarker=bindParameter ) #tupleExpr | '(' relation ')' #groupExpr ; containsOperator returns [bool key] : K_CONTAINS (K_KEY { $key = true; } )? ; tupleOfIdentifiers : '(' cidentList ')' ; singleColumnInValues : '(' ( list+=term (',' list+=term)* )? ')' ; tupleOfTupleLiterals : '(' list+=tupleLiteral (',' list+=tupleLiteral)* ')' ; tupleOfMarkersForTuples : '(' list+=bindParameter (',' list+=bindParameter)* ')' ; comparatorType returns [CqlType type] : nt=native_type { $type = $nt.type; } | ct=collection_type { $type = $ct.type; } | tt=tuple_type { $type = $tt.type; } | ut=userTypeName { $type = $ut.type; } | K_FROZEN '<' ft=comparatorType '>' { $type = new CqlFrozenType($ft.type); } ; native_type returns [CqlNativeType type] : K_ASCII { $type = CqlAsciiType.Default; } | K_BIGINT { $type = CqlBigIntType.Default; } | K_BLOB { $type = CqlBlobType.Default; } | K_BOOLEAN { $type = CqlBooleanType.Default; } | K_COUNTER { $type = CqlCounterType.Default; } | K_DECIMAL { $type = CqlDecimalType.Default; } | K_DOUBLE { $type = CqlDoubleType.Default; } | K_DURATION { $type = CqlDurationType.Default; } | K_FLOAT { $type = CqlFloatType.Default; } | K_INET { $type = CqlInetType.Default; } | K_INT { $type = CqlIntType.Default; } | K_SMALLINT { $type = CqlSmallIntType.Default; } | K_TEXT { $type = CqlTextType.Default; } | K_TIMESTAMP { $type = CqlTimestampType.Default; } | K_TINYINT { $type = CqlTinyintType.Default; } | K_UUID { $type = CqlUuidType.Default; } | K_VARCHAR { $type = CqlVarcharType.Default; } | K_VARINT { $type = CqlVarintType.Default; } | K_TIMEUUID { $type = CqlTimeUuidType.Default; } | K_DATE { $type = CqlDateType.Default; } | K_TIME { $type = CqlTimeType.Default; } ; collection_type returns [CqlCollectionType type] : K_MAP '<' g1=comparatorType ',' g2=comparatorType '>' { $type = new CqlMapType($g1.type, $g2.type); } | K_LIST '<' g1=comparatorType '>' { $type = new CqlListType($g1.type); } | K_SET '<' g1=comparatorType '>' { $type = new CqlSetType($g1.type); } ; tuple_type returns [CqlTupleType type] : K_TUPLE '<' f=comparatorType ',' s=comparatorType '>' { $type = new CqlTupleType($f.type, $s.type); } ; username : IDENT | stringLiteral | QUOTED_NAME { AddRecognitionError("Quoted strings are are not supported for user names and USER is deprecated, please use ROLE"); } ; stringLiteral returns [string raw] : t=STRING_LITERAL { $raw = $t.text[1..^1].Replace("''", "'"); } | t=DOLLAR_STRING_LITERAL { $raw = $t.text[2..^2]; } ; non_type_ident returns [QsiIdentifier id] : t=IDENT { VerifyReservedTypeName($t.text); $id = new QsiIdentifier($t.text.ToLower(), false); } | t=QUOTED_NAME { $id = new QsiIdentifier($t.text, true); } | k=basic_unreserved_keyword { $id = new QsiIdentifier($k.text.ToLower(), false); } | t=K_KEY { $id = new QsiIdentifier($t.text.ToLower(), false); } ; unreserved_keyword : unreserved_function_keyword | (K_TTL | K_COUNT | K_WRITETIME | K_KEY | K_CAST | K_JSON | K_DISTINCT) ; unreserved_function_keyword : basic_unreserved_keyword | native_type ; basic_unreserved_keyword : K_KEYS | K_AS | K_CLUSTER | K_CLUSTERING | K_COMPACT | K_STORAGE | K_TABLES | K_TYPE | K_TYPES | K_VALUES | K_MAP | K_LIST | K_FILTERING | K_PERMISSION | K_PERMISSIONS | K_KEYSPACES | K_ALL | K_USER | K_USERS | K_ROLE | K_ROLES | K_SUPERUSER | K_NOSUPERUSER | K_LOGIN | K_NOLOGIN | K_OPTIONS | K_PASSWORD | K_EXISTS | K_CUSTOM | K_TRIGGER | K_CONTAINS | K_INTERNALS | K_ONLY | K_STATIC | K_FROZEN | K_TUPLE | K_FUNCTION | K_FUNCTIONS | K_AGGREGATE | K_AGGREGATES | K_SFUNC | K_STYPE | K_FINALFUNC | K_INITCOND | K_RETURNS | K_LANGUAGE | K_CALLED | K_INPUT | K_LIKE | K_PER | K_PARTITION | K_GROUP ;
base/mvdm/wow16/gdi/sort.asm
npocmaka/Windows-Server-2003
17
171225
<reponame>npocmaka/Windows-Server-2003 ;----------------------M O D U L E H E A D E R----------------------------; ; ; ; Module Name: SORT.ASM ; ; ; ; History: SORT.C ; ; Created by <NAME> 12/30/1986 ; ; Modified by <NAME> 08/05/1987 ; ; ; ; SORT.ASM - translation of SORT.C ; ; CreateModule <NAME> ; ; Other Modules <NAME> 08/09/1988 ; ; ; ; Copyright (c) 1985 - 1988 Microsoft Corporation ; ; ; ; General Description: ; ; ; ; The SORT module creates and maintains a tree of nodes, each node ; ; having a KEY value and a TAG field. The KEY field is used to or- ; ; -ganize the tree into a heap. ; ; The heap tree is implemented using an array, where if ; ; parent node occurs in position i, its left child will be at index ; ; (2 * i) and the right chaild at index (2 * i + 1). ; ; The Module ensures that at any instant, the root node ; ; of any subtree has the least key value in the subtree. ; ; First few positions in the array are used for storing ; ; a header for the tree. ; ; ; ; SubModules: ; ; ; ; 1. CreatePQ: ; ; Allocates space for the heaptree and its header ; ; and initializes the header. ; ; 2. InsertPQ: ; ; Inserts a node into the heap ensuring that the heap ; ; property is not violated. ; ; 3. MinPQ: ; ; Returns the tag value associated with the lowest ; ; key in the heap. (node is not deleted) ; ; 4. ExtractPQ: ; ; Return the tag value associated with the lowest key ; ; in the heap and deletes the node. The heap is then ; ; reconstructed with the remaining nodes. ; ; 5. DeletePQ: ; ; Deletes the entire heap by freeing the allocated ; ; area. ; ; 6. SizePQ: ; ; Increases the size of the heap by adding space ; ; for a requested number of entries ; ; Heap Data Structure: ; ; ; ; The heap data structure has two parts, a header and a set of nodes and ; ; these are blocked one after the other. ; ; The header maintains: ; ; (i) A pointer to the next available node slot ; ; relative to start of the node area ; ; (ii) A pointer to the first valid node slot ; ; node slots between the header and this pointer ; ; are actually deleted nodes ; ; (iii) A pointer past the last allocated node slot ; ; (iv) A last key value, which either holds the largest; ; key value as long as the nodes are sequentially ; ; ordered, or a very large value to indicate there; ; is no sequential ordering ; ; ; ; ---------------- ; ; | INDEX | ---- Pointer to next available node slot ; ; ---------------- ; ; | MAXENTRY | ---- Pointer past last allocated node slot ; ; ---------------- ; ; START | LASTKEY | ---- Aslong as possible holds max key ; ; NODE | START | ---- pointer to first active node slot ; ; ---------------- ; ; | KEY | ---- Node 1. ; ; | TAG | ; ; //---------------// ; ; | KEY | ---- Last allocated node slot ; ; | TAG | ; ; ---------------- ; ; ; ; All pointers to nodes are relative to node 1 (pointer to node 1 is ZERO) ; ;----------------------------------------------------------------------------; ;----------------------------------------------------------------------------; ; Include File Section and definitions: ; ; ; .xlist include cmacros.inc include gdimacro.inc include gdimem.inc .286p .list START equ SIZE PQ - SIZE ENTRY ; The header includes Node 0 VERYLARGE equ 4000h ; assumed to be larger than any key PQERROR equ -1 ; return value on error TRUE equ 1 FALSE equ 0 Entry struc e_key dw ? ; key value of node e_tag dw ? ; corresponding tag value Entry ends PQ struc ; HEAP Header Structure + Start Node pq_index dw ? pq_maxentry dw ? ; excludes START NODE pq_lastkey dw ? pq_start dw ? PQ ends externFP GlobalLock externFP GlobalUnlock externFP GlobalReAlloc externFP GlobalFree externFP GlobalAlloc ; Defined in HELPER.ASM createSeg _SORT,SORT,byte,public,CODE sBegin SORT ;-----------------------------------------------------------------------------; ; ; ;CreatePQ: ; ; Inputs: ; ; Max Number of entries the tree will hold ; ; Outputs: ; ; HANDLE to Heap -- if creation successful ; ; PQERROR if failure ; ; Registers Preserved: ; ; DI,SI ; ; ; ; -by- <NAME> [davidw] ; ; ; ;-----------------------------------------------------------------------------; assumes cs,SORT assumes ds,nothing cProc farGDIGlobalAlloc,<FAR,PUBLIC> parmd amount cBegin cCall GlobalAlloc,<GMEM_MOVEABLE+GMEM_SHARE,amount> cEnd cProc CreatePQ,<FAR,PUBLIC,NODATA>,<di,si> parmW cEntries cBegin mov ax,cEntries ; max no of nodes the tree will hold shl ax,1 shl ax,1 ; ax <---- ax * SIZE ENTRY .errnz (SIZE ENTRY - 4) mov si,ax ; save number of bytes in node array add ax, SIZE PQ ; size of header including NODE 0 xor dx,dx cCall farGDIGlobalAlloc,<dx,ax> mov bx,ax ; Handle returned dec ax ; set to -1 if handle returned == 0 .errnz (-1 - PQERROR) or bx,bx ; test for succesfull memory allocation jz cPQ_Done ; error return. push bx cCall GlobalLock,<bx> ; lock handle get back segment pop bx mov es,dx mov di,ax ; es:di points to start of structure ; now initialize the header part of the structure with values ; si has size of the node array stosw ; index set to zero .errnz (0 - pq_index) mov ax,si ; pointer past end of node array stosw ; max no of entries .errnz (2 - pq_maxentry) xor ax,ax ; last key = 0, as heap empty stosw .errnz (4 - pq_lastkey) stosw ; START = 0, implies no deleted slot .errnz (6 - pq_start) push bx cCall GlobalUnlock,<bx> ; unlock the handle to heap pop ax ; return the handle cPQ_Done: cEnd ;-----------------------------------------------------------------------------; ; ; ; InsertPQ: ; ; Inputs: ; ; hPQ -- handle to heap structure segment ; ; tag -- tag value for new node ; ; key -- key value for new node ; ; Outputs: ; ; return TRUE if insertion was successful ; ; return PQERROR if heap was already packed ; ; Preserves: ; ; DS,SI ; ; ; ; -by- <NAME> [amitc] Tue Aug 9 10:45:25 ; ;----------------------------------------------------------------------------- assumes cs,SORT assumes ds,nothing cProc InsertPQ,<FAR,PUBLIC,NODATA>,<di,si> parmW hPQ parmW tag parmW key cBegin mov di,hPQ cCall GlobalLock,<di> ; lock heap and get back segment addres or ax,dx ; Invalid handle causes zero return jz Ins_Cant_Proceed mov es,dx xor si,si ; offset in segment always zero mov ax,es:[si] ; pointer to next available slot sub ax,es:[si].pq_start ; convert it relative to 1st active node cmp ax,es:[si].pq_maxentry ; compare with pointer past last slot jb Insertion_Possible cCall GlobalUnlock,<di> Ins_Cant_Proceed: mov ax,PQERROR ; error return jmp cInsert_Done Insertion_Possible: push es ; HEAP structure segment smov es,ds ; save local segment in es pop ds ; change DS to heap segment mov ax,[si].pq_index ; next available slot in node area cmp ax,[si].pq_maxentry jb Enough_Space_Atend ; insertion possible w/o compaction ; Deleted nodes exist near the head of the tree, compaction necessary call CompactList ; removes all deleted elements ; LASTKEY still holds the max key value in the tree Enough_Space_Atend: mov bx,[si].pq_index ; pointer to next available slot mov dx,bx ; save value in register add bx,SIZE PQ ; area for header mov ax,tag mov [si][bx].e_tag,ax ; insert new tag and key mov ax,key mov [si][bx].e_key,ax ; key in ax will be used below mov bx,dx ; bx points to last occupied slot add dx,SIZE ENTRY ; available slot points to next node mov [si].pq_index,dx ; save in the structure ; Now test whether the heap property is valid still. ; ax has key, dx has pointer to next slot after addition ; bx points to last valid node cmp ax,[si].pq_lastkey ; compare with new key jb Heap_Violated mov [si].pq_lastkey,ax ; new key is the largest key in tree jmp short Heap_Restructured ; Insertion over comment ~ node i has lchild at 2*i and rchild at 2*i+1. But we maintain their address relative to start of node array. [ie node 1 has addr 0, node 2 has 4, node 3 12 and so on.] so if x happens to be the address of a node, the address of its parent is (x/2 -2) AND 0fffch. if x is the address of a parent, the address of its lchild is 2*x + 4 and that of its rchild is 2*x + 8 end comment ~ Heap_Violated: call CompactList ; make sure heap is compacted first! mov [si].pq_lastkey,VERYLARGE ; to imply heap nolonger seq. ordered mov bx,[si].pq_index ; bx = offset of inserted elem. sub bx,SIZE ENTRY Heap_Walk_Loop: cmp bx,[si].pq_start ; traversed to top of heap ? jz Heap_Restructured mov cx,bx shr cx,1 ; cx points to parent of current node dec cx dec cx and cx,0fffch ; refer to comment above .errnz (SIZE ENTRY - 4) ; Test whether current node has to move up or not, if not it resets carry ; else it swaps the two nodes and sets carry call TestShuffle mov bx,cx ; next node to inspect ifnec. is parent jc Heap_Walk_Loop Heap_Restructured: smov ds,es ; get back own segment in ds cCall GlobalUnlock,<di> ; di still has the handle mov ax,di ; return true cInsert_Done: cEnd ;-----------------------------------------------------------------------------; ; TestShuffle: ; ; ; ; Takes as input the node addresses of a parent and on of it's childs. If the; ; key of the parent is >= key of the child, it returns with carry clear, else; ; it swaps the two nodes and returns with carry set. ; ; ; ; bx has current node address in HEAP, relative to start NODE 1 ; ; cx has address of parent node of bx ; ; ; ; -by- <NAME>ee [amitc] Tue Aug 9 12:00:00 ; ;-----------------------------------------------------------------------------; cProc TestShuffle,<NEAR,PUBLIC>,<si,di> cBegin lea di,[si][SIZE PQ] ; di points to node 1 add di,cx ; di points to parent lea si,[bx].SIZE PQ ; si points to child node mov ax,[si].e_key ; childs key cmp ax,[di].e_key ; key of parent jb Nodes_Tobe_Swapped ; ; Carry cleared by comparision, use for return ; jmp short TestShuffle_Ret Nodes_Tobe_Swapped: ; ; Carry has been set by comparision, use for return ; xchg ax,[di].e_key mov [si].e_key,ax mov ax,[si].e_tag xchg ax,[di].e_tag mov [si].e_tag,ax ; swap complete TestShuffle_Ret: cEnd ;-----------------------------------------------------------------------------; ; MinPQ: ; ; Inputs: ; ; hPQ -- Handle to the heap structure ; ; Outputs: ; ; minimum tag value in the tree or PQERROR(if invalid handle) ; ; ; ; Calls Local Procedure GetMinPQ. ; ; GetMinPQ takes the handle and a flag as parameter. ; ; If the flag is TRUE, the node with the least key is deleted ; ; GetMinPQ also returns the tag value of least key in AX ; ; ; ; ; ; -by- <NAME> [amitc] Tue Aug 9 12:46:10 ; ;-----------------------------------------------------------------------------; assumes cs,SORT assumes ds,nothing cProc MinPQ,<FAR,PUBLIC,NODATA> ; parmW hPQ cBegin nogen mov cl,FALSE ; to imply node not to be deleted jmpnext ; fall through trick, refer cmacros cEnd nogen ;-----------------------------------------------------------------------------; ; ExtractPQ: ; ; Inputs: ; ; hPQ -- Handle to the heap structure ; ; Outputs: ; ; minimum tag value if heap handle is valid and heap not empty ; ; return PQERROR otherwise ; ; The node with min key is deleted ; ; Calls Local Procedure GetMinPQ ; ; ; ; -by- <NAME> [amitc] Tue Aug 9 12:54:00 ; ;-----------------------------------------------------------------------------; assumes cs,SORT assumes ds,nothing cProc ExtractPQ,<FAR,PUBLIC,NODATA> ; parmW hPQ cBegin nogen mov cl,TRUE ; to imply that node to be deleted jmpnext stop ; fall through trick, refer cmacros cEnd nogen ;-----------------------------------------------------------------------------; ; GetMinPQ: ; ; ; ; One of the inputs is a flag. If the flag is FALSE it simply returns the tag ; ; associated with the lease key value in the heap. If the flag is TRUE besides; ; returnning the above tag value it also deletes the node. ; ; ; ; ; ; hPQ --- handle of HEAP segment ; ; cl --- Deletion Flag ( Delete node if TRUE) ; ; ; ; -by- <NAME> [amitc] Tue Aug 9 13:00:00 ; ;-----------------------------------------------------------------------------; cProc GetMinPQ,<FAR,PUBLIC,NODATA>,<di,si> parmW hPQ cBegin mov di,hPQ push cx ; save flag cCall GlobalLock,<di> pop cx ; get back flag into cl or dx,ax ; invalid handle implies zero return jz Min_Cant_Proceed mov es,dx mov si,ax ; ds:si points to heap start mov bx,es:[si].pq_start ; pointer to 1st. available slot cmp bx,es:[si].pq_index ; empty if equal to next available node jb Heap_Not_Empty cCall GlobalUnlock,<di> Min_Cant_Proceed: mov ax,PQERROR jmp cGetMin_Done ; error return ; bx still has [si].pq_start Heap_Not_Empty: push es ; save heap segment smov es,ds ; save local segment is es pop ds ; ds:si points to start of heap lea dx,[si][SIZE PQ] add dx,bx ; points past deleted nodes xchg di,dx ; save di in dx and use dx's value mov ax,[di].e_tag ; get the tag associated with least key xchg di,dx ; get back values or cl,cl ; test for bl = FALSE .errnz (0 - FALSE) jnz Delete_Node ; TRUE implies get tag and delete node jmp cGetMin_Ret ; return after unlocking heap Delete_Node: ; bx retains [si].start add bx,SIZE ENTRY ; one more node deleted cmp bx,[si].pq_index ; is tree empty ? jb Tree_Not_Empty xor cx,cx mov [si].pq_lastkey,cx ; initialize for empty tree mov [si].pq_start,cx ; initialize for empty tree mov [si].pq_index,cx jmp cGetMin_Ret ; return after unlocking heap Tree_Not_Empty: ; ax has return tag value ; bx has [si].pq_start + SIZE ENTRY cmp [si].pq_lastkey,VERYLARGE ; implies keys in random order jae Min_Restructure_Heap ; maybe restructuring necessary mov [si].pq_start,bx ; updates past deleted entry jmp cGetMin_Ret Min_Restructure_Heap: ; dx still has offset to NODE 1, because ; if LASTKEY = VERYLARGE, pq_start has to be zero push ax ; save return tag value mov bx,dx ; offset to first active node xchg di,dx ; get pointer into di ,save di add di,[si].pq_index ; dx points to next available slot sub di,SIZE ENTRY ; point to last filled node mov ax,di ; last node being moved upfront sub ax,SIZE PQ ; point ax one node ahead of last mov [si].pq_index,ax ; update it mov cx,[di].e_key mov [bx].e_key,cx ; move from last position to NODE 1 mov cx,[di].e_tag mov [bx].e_tag,cx xchg di,dx ; restore di,dx xor cx,cx ; start traversing heap from root Min_Traverse_Heap: mov bx,cx shl bx,1 add bx,SIZE ENTRY ; bx has left child addr of parent in cx cmp bx,[si].pq_index ; compare with next available slot jae Min_Heap_Fixed ; heap restored push cx ; save current parent mov cx,bx ; have lchild in cx add cx,SIZE ENTRY ; cx now get address of rchild cmp cx,[si].pq_index ; test against last node jae Right_Child_Not_Present call GetLesserChild ; gets child with lesser key in bx Right_Child_Not_Present: pop cx ; get back parent ; ; cx has node number of parent node and bx has node no of child node with ; least key. If parents key value is greater it should be swapped ; call TestShuffle ; swaps the two nodes if necessary. mov cx,bx ; lesser child is next parent jmp Min_Traverse_Heap Min_Heap_Fixed: pop ax ; get back return tag value cGetMin_Ret: push ax ; save return value smov ds,es ; get back own ds cCall GlobalUnlock,<di> ; unlock heap pop ax ; get back return value cGetMin_Done: cEnd ;-----------------------------------------------------------------------------; ; GetLesserChild: ; ; ; ; Given two child node numbers, it returns the child which has a lesser key ; ; ; ; cx has RCHILD NODE address ; ; bx has LCHILD NODE address ; ; si points to start of heap ; ; will return node address of lesser child in bx ; ; ; ; -by- <NAME> [amitc] Tue Aug 9 13:50 ; ;-----------------------------------------------------------------------------; cProc GetLesserChild,<NEAR,PUBLIC,NODATA>,<di,si> cBegin lea di,[si][SIZE PQ] ; dx now points to NODE 1 mov si,di ; si also points to start of NODE 1 add di,cx ; di get address of rchild mov ax,[si+bx].e_key ; rchilds key cmp ax,[di].e_key ; compare with rchild jb Right_Child_Lesser ; bx still has the correct child no. mov bx,cx ; get RCHILD address into bx Right_Child_Lesser: cEnd ; ;-----------------------------------------------------------------------------; ; DeletePQ: ; ; Inputs: ; ; hPQ --- handle to a heap structure ; ; OutPuts: nothing ; ; Preserves: DI ; ; ; ; -by- <NAME> [amitc] Tue Aug 9 14:15:45 ; ;----------------------------------------------------------------------------- ; assumes cs,SORT assumes ds,nothing cProc DeletePQ,<FAR,PUBLIC,NODATA> parmW hPQ cBegin cCall GlobalFree,<hPQ> ; free the handle cEnd ;-----------------------------------------------------------------------------; ;SizePQ: ; ; Input: ; ; hPQ --- Handle to a heap structure ; ; entry --- number of nodes by which heap is to be expanded ; ; Output: ; ; Returns the total number of node slots in new heap, if successful ; else return PQERROR ; ; ; ; -by- <NAME> [amitc] Tue Aug 9 14:31:40 ; ;----------------------------------------------------------------------------- assumes cs,SORT assumes ds,nothing cProc SizePQ,<FAR,PUBLIC,NODATA>,<si,di> parmW hPQ parmW cEntry cBegin mov di,hPQ cCall GlobalLock,<di> ; lock to get back segment address or ax,dx ; Invalid handle implies NULL return jz Siz_Cant_Proceed mov es,dx xor si,si ; offset will always be zro mov ax,cEntry ; additional nodes or ax,ax ; if zero return original numof nodes jnz Size_Tobe_Increased mov ax,es:[si].pq_maxentry ; offset past last node shr ax,1 shr ax,1 ; ax <--- ax / SIZE ENTRY .errnz (SIZE ENTRY - 4) jmp short cSize_Ret ; return after unlocking handle Size_Tobe_Increased: shl ax,1 shl ax,1 ; ax <-- ax * SIZE ENTRY, = extra bytes .errnz (SIZE ENTRY - 4) add ax,es:[si].pq_maxentry ; number of byte for new node array cmp ax,es:[si].pq_index ; next available slot jae Valid_Increase mov ax,PQERROR ; error code jmp short cSize_Ret ; return after releasing handle Valid_Increase: push ax ; save number of bytes in node block add ax,SIZE PQ ; size of header push ax cCall GlobalUnlock,<di> ; unlock handle xor dx,dx ; high word for size pop ax ; get back size cCall GlobalReAlloc,<di,dx,ax,GMEM_MOVEABLE> or ax,ax jz Siz_Cant_Proceed mov di,ax ; new handle cCall GlobalLock,<ax> ; lock it mov es,dx ; set new segment pop cx ; get back total no of nodes into cx jmp short Reloc_Successful Siz_Cant_Proceed: pop cx ; balance stack dec ax .errnz (-1 - PQERROR) jmp short cSize_End Reloc_Successful: mov es:[si].pq_maxentry,cx ; total number of slots now shr cx,1 shr cx,1 ; no of nodes = bytes / SIZE ENTRY .errnz (SIZE ENTRY - 4) mov ax,cx ; return value cSize_Ret: cCall GlobalUnlock,<di> cSize_End: cEnd ;-----------------------------------------------------------------------------; ;CompactList: ; ; Input: ; ; ds:si --- pointer to heap structure ; ; Output: ; ; all deleted elements are removed from heap structure ; ; Registers trashed: ; AX,BX,CX,DX ; ; -by- <NAME> [kensy] Tue Nov 12 1991 10:20:00am ; ;----------------------------------------------------------------------------- CompactList proc near mov ax,[si].pq_index ; next available slot in node area sub ax,[si].pq_start ; ax had pointer to available slot mov [si].pq_index,ax ; next available slot will come up lea dx,[si][SIZE PQ] ; points to NODE 1 mov ax,[si].pq_start ; pointer to 1st active node rel to 1 add ax,dx ; ax has offset to first valid node. mov bx,ax mov cx,[si].pq_maxentry ; pointer past end of node slots sub cx,[si].pq_start ; pointer to strt of active block shr cx,1 ; will do a REP MOVSW .errnz (1 and SIZE ENTRY) push es ; es has local segment smov es,ds ; moth es ds point to heap segment push si push di ; save start to heap and its handle mov si,bx ; si points to start of valid nodes mov di,dx ; dx points to node 1 cld rep movsw ; Compacted pop di pop si pop es ; restore local segment in es mov [si].pq_start,cx ; after compaction deleted nodes = 0 ret CompactList endp ;-----------------------------------------------------------------------------; sEnd SORT end
src/dnscatcher/dns/processor/rdata/dnscatcher-dns-processor-rdata-opt_parser.adb
DNSCatcher/DNSCatcher
4
12954
-- Copyright 2019 <NAME> <<EMAIL>> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to -- deal in the Software without restriction, including without limitation the -- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -- sell copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. with Interfaces; use Interfaces; package body DNSCatcher.DNS.Processor.RData.OPT_Parser is -- EDNS is a pretty harry beast and incorporates a lot of stuff in ways -- different from all other packets. As such parsing is quite a bit more -- complicated than it is for other packet types. procedure From_Parsed_RR (This : in out Parsed_OPT_RData; DNS_Header : DNS_Packet_Header; Parsed_RR : Parsed_DNS_Resource_Record) is Top_Half_TTL : Interfaces.Unsigned_16; Bottom_Half_TTL : Interfaces.Unsigned_16; Full_RCode : Interfaces.Unsigned_16 := 0; begin -- RClass is the UDP requester size This.Requester_UDP_Size := Parsed_RR.RClass; --!pp off -- TTL is subdivided into the following parts -- 0..7 - Extended RCode -- 8..16 - EDNS Version (must be zero) -- -- The remainder is a 16-bit flags register set by -- IANA. At the time of writing, only a single flag, -- DO, is specified. The registry is available here: -- https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-13 -- -- EDNS Flags: -- 17 - DO -- 18..32 - Must be zero -- -- The horseshit however continues. Despite being a 32-bit int, it's -- essentially two 16-bit ones, so we need to split this into a high -- and low half and then compare it. My brain is already hurting ... --!pp on -- To get the full RCode, we need to take the 4-bit "normal" RCode, then -- tack on the EDNS ones at the top for 12 bits total -- Since we're network byte order, load the high half first from the -- bottom bits Top_Half_TTL := Interfaces.Unsigned_16 (Shift_Right (Interfaces.Unsigned_32 (Parsed_RR.TTL), 16)); Bottom_Half_TTL := Interfaces.Unsigned_16 (Parsed_RR.TTL and 16#ffff#); -- 0..7 MSB is our RCode Full_RCode := Top_Half_TTL and 16#ff00#; Full_RCode := Shift_Right (Full_RCode, 4); Full_RCode := Full_RCode or Interfaces.Unsigned_16 (DNS_Header.Response_Code); This.Extended_RCode := RCodes'Enum_Val (Full_RCode); -- Grab the EDNS version. It should be zero This.EDNS_Version := Interfaces.C.Extensions.Unsigned_8 (Top_Half_TTL and 16#ff#); -- Easiest way to fish out these bits is doing ANDs This.DNSSEC_OK := (Bottom_Half_TTL and 16#8000#) /= 0; This.Z_Section := Unsigned_15 (Bottom_Half_TTL and 16#7FF#); -- Mask off top bits end From_Parsed_RR; function RData_To_String (This : in Parsed_OPT_RData) return String is begin return "RCode: " & This.Extended_RCode'Image & " Version: " & This.EDNS_Version'Image & " DO: " & This.DNSSEC_OK'Image & " Z: " & This.Z_Section'Image; end RData_To_String; function Print_Packet (This : in Parsed_OPT_RData) return String is begin return "OPT " & RData_To_String (This); end Print_Packet; -- Obliberate ourselves procedure Delete (This : in out Parsed_OPT_RData) is begin null; end Delete; end DNSCatcher.DNS.Processor.RData.OPT_Parser;
programs/oeis/005/A005571.asm
neoneye/loda
22
241049
<reponame>neoneye/loda ; A005571: Number of walks on cubic lattice. ; 76,288,700,1376,2380,3776,5628,8000,10956,14560,18876,23968,29900,36736,44540,53376,63308,74400,86716,100320,115276,131648,149500,168896,189900,212576,236988,263200,291276,321280,353276,387328,423500,461856,502460,545376 mov $6,$0 mul $0,2 add $0,5 mov $2,5 add $2,$0 mov $3,6 mov $4,$0 sub $0,2 mov $5,1 add $5,$4 add $5,5 lpb $0 sub $0,1 add $3,$2 add $2,$1 mov $1,5 sub $2,4 mov $4,2 add $5,5 add $2,$5 lpe mov $1,3 sub $3,$4 mov $4,$3 add $4,1 add $1,$4 lpb $6 add $1,8 sub $6,1 lpe sub $1,8 mov $0,$1
Projects/PJZ2/PreCalcMinimal/IntroPreCalc.asm
jonathanbennett73/amiga-pjz-planet-disco-balls
21
163428
***************************************************************************** ; Name : IntroSharedData.i ; Coded by : Antiriad (<NAME> <<EMAIL>) ; Description : Resources that need to be shared between parts. ; generally music files, screen buffers, and fonts. ; CPU Required : MC68000 or better ; ChipSet Required : OCS or better ***************************************************************************** RasterTest set 0 ;color00 timing bar, 0=off, 1=overall, 2=show blitwaits ifeq RasterTest tmpcolor00 set color00 else tmpcolor00 set $1fe ;dummy endif ***************************************************************************** include "hardware/custom.i" include "hardware/intbits.i" include "../IntroConfig.i" include "../Framework/CustomExtra.i" include "../Framework/CustomMacros.i" include "../Framework/IntroFramework_xref.i" include "../Framework/IntroLibrary.i" include "../Framework/IntroLibrary_xref.i" ifne FW_MUSIC_AMIGAKLANG xref AMIGAKLANG_Progress endif ***************************************************************************** ;Only assemble this file if enabled ifne FW_PRECALC_LONG ***************************************************************************** section FW_PublicCode,code ;Code section in Public memory ***************************************************************************** * Starts the precalc routine lev3 and then returns. * Doesn't touch Dma so set separately. * IN: * OUT: * TRASHED: d0-d1/a0-a1 ***************************************************************************** xdef PRC_Init PRC_Init: movem.l d2-d7/a2-a6,-(sp) lea _custom,a6 ; Activate copper and irq next frame lea P0_CL_Phys,a0 lea P0_FrameIrq(pc),a1 jsr FW_SetCopperIrq_A6 movem.l (sp)+,d2-d7/a2-a6 rts ***************************************************************************** P0_FrameIrq: ;Blank template VERTB/COP interrupt TIMERON movem.l d0-d7/a0-a6,-(sp) lea _custom,a6 lea Controller_Info(pc),a5 jsr FW_VBlankProxy ;Update frame counter .checkdone: ; Check if all precalc finished tst.w FW_Precalc_Done beq.s .stillprecalcing ; Set base irq (leave screen on) jsr FW_SetBaseIrq move.w #1,CTRL_FINISHED(a5) move.w #100,FW_Precalc_Progress bra.s .draw .stillprecalcing: ;If running amigaklang precalc work out the progress ifne FW_MUSIC_AMIGAKLANG ;Progress is stored in first byte as $0-1f (num samples) moveq #0,d0 move.b AMIGAKLANG_Progress,d0 mulu #100,d0 lsr.w #5,d0 ;/32, Percentage move.w d0,FW_Precalc_Progress endif .draw: bsr Progress_Draw .exit: ;Reset interrupt moveq #FW_FRAME_IRQ_TYPE,d0 move.w d0,intreq(a6) move.w d0,intreq(a6) ;A4000 compat movem.l (sp)+,d0-d7/a0-a6 TIMEROFF rte ***************************************************************************** * Draws a progress each frame. * IN: a5, Controller_Info * OUT: * TRASHED: d0-d3/a0-a1 ***************************************************************************** Progress_Draw: moveq #0,d0 ;clear hiword move.w FW_Precalc_Progress,d0 lsl.w #5,d0 ;*32 divu #100,d0 ;/100. Range is 0-32 lea P0_CL_Cols+2,a0 ;first color lea P0_CL_Cols2+2,a1 ;first color moveq #32,d1 sub.w d0,d1 ;d0=light,d1=dark .light subq.w #1,d0 ;-1 for dbf bmi.s .dark move.w #PROGRESSCOLLIGHT,d2 .l1: move.w d2,(a0) move.w d2,(a1) addq.w #4,a0 ;next color addq.w #4,a1 ;next color dbf d0,.l1 .dark: subq.w #1,d1 ;-1 for dbf bmi.s .exit move.w #PROGRESSCOLDARK,d2 .d1: move.w d2,(a0) move.w d2,(a1) addq.w #4,a0 ;next color addq.w #4,a1 ;next color dbf d1,.d1 .exit rts ***************************************************************************** xdef PRC_Finished rsreset CTRL_ZERODATA_SIZE rs.w 0 ;size of all zeroed data - START OF NONZERO CTRL_FINISHED rs.w 1 CTRL_SIZE rs.w 0 Controller_Info: dcb.b CTRL_ZERODATA_SIZE,0 ;Init all to zero by default PRC_Finished: ;xdef for outside access dc.w 0 ;CTRL_FINISHED ***************************************************************************** ***************************************************************************** ***************************************************************************** section FW_ChipData_Copper,data_c ;Chip Data Section for gfx/music ***************************************************************************** PROGRESSCOLDARK equ $333 PROGRESSCOLLIGHT equ $fff PROGRESSCOLBKG equ $001 P0_CL_Phys: ; Trigger copper interrupt if P0_SCANLINE_EOF = 0 ifne FW_FRAME_IRQ_NEEDTRIG CMOVE intreq,INTF_SETCLR|FW_FRAME_IRQ_TYPE endif CMOVE bplcon0,$0200 ;bpl off CWAIT $ab,$4f P0_CL_Cols: rept 32 CMOVE tmpcolor00,PROGRESSCOLDARK endr CMOVE tmpcolor00,PROGRESSCOLBKG CWAIT $ac,$4f P0_CL_Cols2: rept 32 CMOVE tmpcolor00,PROGRESSCOLDARK endr CMOVE tmpcolor00,PROGRESSCOLBKG COPPEREND P0_CL_End: rsreset CL_PROGRESS_BPLCON0 rs.l 1 CL_PROGRESS_WAIT1 rs.l 1 CL_PROGRESS_COL rs.l 32 CL_PROGRESS_BKG rs.l 1 CL_PROGRESS_WAIT2 rs.l 1 CL_PROGRESS_COL2 rs.l 32 CL_PROGRESS_BKG2 rs.l 1 CL_PROGRESS_COPPEREND rs.l 1 CL_PROGRESS_SIZEOF rs.w 0 ***************************************************************************** ***************************************************************************** ***************************************************************************** ; section FW_ChipBss,bss_c ***************************************************************************** ;CUR_CHIP_BUF set FW_Chip_Buffer_1 ;BPL_Phys equ CUR_CHIP_BUF ;CUR_CHIP_BUF set CUR_CHIP_BUF+BPL_BUF_SIZE ;1bpl ;BPL_Log1 equ CUR_CHIP_BUF ;CUR_CHIP_BUF set CUR_CHIP_BUF+BPL_BUF_TOTALSIZE ;5bpl ;P0_CL_Log1 equ CUR_CHIP_BUF ;CUR_CHIP_BUF set CUR_CHIP_BUF+P0_CL_SIZE ***************************************************************************** ***************************************************************************** ***************************************************************************** ifne _VERBOSE ;This actually prints the size as at print time FW_Chip_Buffer_1 = 0 ;printt "CUR_CHIP_BUF:" ;printv CUR_CHIP_BUF ;This actually prints the size as at print time FW_Chip_Buffer_1 = 0 ;printt "CUR_PUB_BUF:" ;printv CUR_PUB_BUF endif ***************************************************************************** endif ;FW_PRECALC_LONG
src/test01/src/convert.ads
hannesb0/rtpl18
0
18514
<filename>src/test01/src/convert.ads -- Task 2 of RTPL WS17/18 -- Team members: <NAME>. and <NAME>. package convert with SPARK_Mode is -- Procedure for option 2 procedure opt2; -- Procedure for option 3 procedure opt3; private -- Float values for user input F1 : Float := 1.0; F2 : Float := 2.0; -- Convert Celsius to Fahrenheit function myCel2Fahr (cel : Float) return Float with Pre => cel >= -273.15, Post => myCel2Fahr'Result >= -459.67, Global => null, Depends => (myCel2Fahr'Result => cel); -- Convert Celsius to Fahrenheit function myFahr2Cel (fahr : Float) return Float with Pre => fahr >= -459.67, Post => myFahr2Cel'Result >= -273.15, Global => null, Depends => (myFahr2Cel'Result => fahr); end convert;
integer_exponentiation.adb
ASTR0NAUTJ0NES/IntegerExponentiation
0
5683
<reponame>ASTR0NAUTJ0NES/IntegerExponentiation --logic for exponents to work correctly package body Integer_Exponentiation is -- int^int procedure Exponentiate (Argument : in Integer; Exponent : in Natural; Result : out Integer) is begin Result := 1; for Counter in 1 .. Exponent loop Result := Result * Argument; end loop; end Exponentiate; function "**" (Left : Integer; Right : Natural) return Integer is Result : Integer; begin Exponentiate (Argument => Left, Exponent => Right, Result => Result); return Result; end "**"; -- real^int procedure Exponentiate (Argument : in Float; Exponent : in Integer; Result : out Float) is begin Result := 1.0; if Exponent < 0 then for Counter in Exponent .. -1 loop Result := Result / Argument; end loop; else for Counter in 1 .. Exponent loop Result := Result * Argument; end loop; end if; end Exponentiate; function "**" (Left : Float; Right : Integer) return Float is Result : Float; begin Exponentiate (Argument => Left, Exponent => Right, Result => Result); return Result; end "**"; end Integer_Exponentiation;
source/numerics/machine-pc-freebsd/s-llcefu.adb
ytomino/drake
33
20126
with Ada.Numerics; with System.Long_Long_Elementary_Functions; package body System.Long_Long_Complex_Elementary_Functions is -- libgcc function mulxc3 (Left_Re, Left_Im, Right_Re, Right_Im : Long_Long_Float) return Long_Long_Complex with Import, Convention => C, External_Name => "__mulxc3"; function divxc3 (Left_Re, Left_Im, Right_Re, Right_Im : Long_Long_Float) return Long_Long_Complex with Import, Convention => C, External_Name => "__divxc3"; pragma Pure_Function (mulxc3); pragma Pure_Function (divxc3); function "-" (Left : Long_Long_Float; Right : Long_Long_Complex) return Long_Long_Complex with Convention => Intrinsic; function "*" (Left : Long_Long_Float; Right : Long_Long_Complex) return Long_Long_Complex with Convention => Intrinsic; function "*" (Left, Right : Long_Long_Complex) return Long_Long_Complex with Convention => Intrinsic; function "/" (Left, Right : Long_Long_Complex) return Long_Long_Complex with Convention => Intrinsic; pragma Inline_Always ("-"); pragma Inline_Always ("*"); pragma Inline_Always ("/"); function "-" (Left : Long_Long_Float; Right : Long_Long_Complex) return Long_Long_Complex is begin return (Re => Left - Right.Re, Im => -Right.Im); end "-"; function "*" (Left : Long_Long_Float; Right : Long_Long_Complex) return Long_Long_Complex is begin return (Re => Left * Right.Re, Im => Left * Right.Im); end "*"; function "*" (Left, Right : Long_Long_Complex) return Long_Long_Complex is begin return mulxc3 (Left.Re, Left.Im, Right.Re, Right.Im); end "*"; function "/" (Left, Right : Long_Long_Complex) return Long_Long_Complex is begin return divxc3 (Left.Re, Left.Im, Right.Re, Right.Im); end "/"; -- Complex function To_Complex (X : Long_Long_Complex) return Complex; function To_Complex (X : Long_Long_Complex) return Complex is begin return (Re => Float (X.Re), Im => Float (X.Im)); end To_Complex; function To_Long_Long_Complex (X : Complex) return Long_Long_Complex; function To_Long_Long_Complex (X : Complex) return Long_Long_Complex is begin return (Re => Long_Long_Float (X.Re), Im => Long_Long_Float (X.Im)); end To_Long_Long_Complex; function Fast_Log (X : Complex) return Complex is begin return To_Complex (Fast_Log (To_Long_Long_Complex (X))); end Fast_Log; function Fast_Exp (X : Complex) return Complex is begin return To_Complex (Fast_Exp (To_Long_Long_Complex (X))); end Fast_Exp; function Fast_Exp (X : Imaginary) return Complex is begin return To_Complex (Fast_Exp (Long_Long_Imaginary (X))); end Fast_Exp; function Fast_Pow (Left, Right : Complex) return Complex is begin return To_Complex ( Fast_Pow (To_Long_Long_Complex (Left), To_Long_Long_Complex (Right))); end Fast_Pow; function Fast_Sin (X : Complex) return Complex is begin return To_Complex (Fast_Sin (To_Long_Long_Complex (X))); end Fast_Sin; function Fast_Cos (X : Complex) return Complex is begin return To_Complex (Fast_Cos (To_Long_Long_Complex (X))); end Fast_Cos; function Fast_Tan (X : Complex) return Complex is begin return To_Complex (Fast_Tan (To_Long_Long_Complex (X))); end Fast_Tan; function Fast_Arcsin (X : Complex) return Complex is begin return To_Complex (Fast_Arcsin (To_Long_Long_Complex (X))); end Fast_Arcsin; function Fast_Arccos (X : Complex) return Complex is begin return To_Complex (Fast_Arccos (To_Long_Long_Complex (X))); end Fast_Arccos; function Fast_Arctan (X : Complex) return Complex is begin return To_Complex (Fast_Arctan (To_Long_Long_Complex (X))); end Fast_Arctan; function Fast_Sinh (X : Complex) return Complex is begin return To_Complex (Fast_Sinh (To_Long_Long_Complex (X))); end Fast_Sinh; function Fast_Cosh (X : Complex) return Complex is begin return To_Complex (Fast_Cosh (To_Long_Long_Complex (X))); end Fast_Cosh; function Fast_Tanh (X : Complex) return Complex is begin return To_Complex (Fast_Tanh (To_Long_Long_Complex (X))); end Fast_Tanh; function Fast_Arcsinh (X : Complex) return Complex is begin return To_Complex (Fast_Arcsinh (To_Long_Long_Complex (X))); end Fast_Arcsinh; function Fast_Arccosh (X : Complex) return Complex is begin return To_Complex (Fast_Arccosh (To_Long_Long_Complex (X))); end Fast_Arccosh; function Fast_Arctanh (X : Complex) return Complex is begin return To_Complex (Fast_Arctanh (To_Long_Long_Complex (X))); end Fast_Arctanh; -- Long_Complex function To_Long_Complex (X : Long_Long_Complex) return Long_Complex; function To_Long_Complex (X : Long_Long_Complex) return Long_Complex is begin return (Re => Long_Float (X.Re), Im => Long_Float (X.Im)); end To_Long_Complex; function To_Long_Long_Complex (X : Long_Complex) return Long_Long_Complex; function To_Long_Long_Complex (X : Long_Complex) return Long_Long_Complex is begin return (Re => Long_Long_Float (X.Re), Im => Long_Long_Float (X.Im)); end To_Long_Long_Complex; function Fast_Log (X : Long_Complex) return Long_Complex is begin return To_Long_Complex (Fast_Log (To_Long_Long_Complex (X))); end Fast_Log; function Fast_Exp (X : Long_Complex) return Long_Complex is begin return To_Long_Complex (Fast_Exp (To_Long_Long_Complex (X))); end Fast_Exp; function Fast_Exp (X : Long_Imaginary) return Long_Complex is begin return To_Long_Complex (Fast_Exp (Long_Long_Imaginary (X))); end Fast_Exp; function Fast_Pow (Left, Right : Long_Complex) return Long_Complex is begin return To_Long_Complex ( Fast_Pow (To_Long_Long_Complex (Left), To_Long_Long_Complex (Right))); end Fast_Pow; function Fast_Sin (X : Long_Complex) return Long_Complex is begin return To_Long_Complex (Fast_Sin (To_Long_Long_Complex (X))); end Fast_Sin; function Fast_Cos (X : Long_Complex) return Long_Complex is begin return To_Long_Complex (Fast_Cos (To_Long_Long_Complex (X))); end Fast_Cos; function Fast_Tan (X : Long_Complex) return Long_Complex is begin return To_Long_Complex (Fast_Tan (To_Long_Long_Complex (X))); end Fast_Tan; function Fast_Arcsin (X : Long_Complex) return Long_Complex is begin return To_Long_Complex (Fast_Arcsin (To_Long_Long_Complex (X))); end Fast_Arcsin; function Fast_Arccos (X : Long_Complex) return Long_Complex is begin return To_Long_Complex (Fast_Arccos (To_Long_Long_Complex (X))); end Fast_Arccos; function Fast_Arctan (X : Long_Complex) return Long_Complex is begin return To_Long_Complex (Fast_Arctan (To_Long_Long_Complex (X))); end Fast_Arctan; function Fast_Sinh (X : Long_Complex) return Long_Complex is begin return To_Long_Complex (Fast_Sinh (To_Long_Long_Complex (X))); end Fast_Sinh; function Fast_Cosh (X : Long_Complex) return Long_Complex is begin return To_Long_Complex (Fast_Cosh (To_Long_Long_Complex (X))); end Fast_Cosh; function Fast_Tanh (X : Long_Complex) return Long_Complex is begin return To_Long_Complex (Fast_Tanh (To_Long_Long_Complex (X))); end Fast_Tanh; function Fast_Arcsinh (X : Long_Complex) return Long_Complex is begin return To_Long_Complex (Fast_Arcsinh (To_Long_Long_Complex (X))); end Fast_Arcsinh; function Fast_Arccosh (X : Long_Complex) return Long_Complex is begin return To_Long_Complex (Fast_Arccosh (To_Long_Long_Complex (X))); end Fast_Arccosh; function Fast_Arctanh (X : Long_Complex) return Long_Complex is begin return To_Long_Complex (Fast_Arctanh (To_Long_Long_Complex (X))); end Fast_Arctanh; -- Long_Long_Complex Pi : constant := Ada.Numerics.Pi; Pi_Div_2 : constant := Pi / 2.0; Sqrt_2 : constant := 1.4142135623730950488016887242096980785696; Log_2 : constant := 0.6931471805599453094172321214581765680755; Square_Root_Epsilon : constant Long_Long_Float := Sqrt_2 ** (1 - Long_Long_Float'Model_Mantissa); Inv_Square_Root_Epsilon : constant Long_Long_Float := Sqrt_2 ** (Long_Long_Float'Model_Mantissa - 1); Root_Root_Epsilon : constant Long_Long_Float := Sqrt_2 ** ((1 - Long_Long_Float'Model_Mantissa) / 2); Log_Inverse_Epsilon_2 : constant Long_Long_Float := Long_Long_Float (Long_Long_Float'Model_Mantissa - 1) / 2.0; function Fast_Log (X : Long_Long_Complex) return Long_Long_Complex is begin if abs (1.0 - X.Re) < Root_Root_Epsilon and then abs X.Im < Root_Root_Epsilon then declare Z : constant Long_Long_Complex := (Re => X.Re - 1.0, Im => X.Im); -- X - 1.0 Result : constant Long_Long_Complex := (1.0 - (1.0 / 2.0 - (1.0 / 3.0 - (1.0 / 4.0) * Z) * Z) * Z) * Z; begin return Result; end; else declare Result_Re : constant Long_Long_Float := Long_Long_Elementary_Functions.Fast_Log ( Long_Long_Complex_Types.Fast_Modulus (X)); Result_Im : constant Long_Long_Float := Long_Long_Elementary_Functions.Fast_Arctan (X.Im, X.Re); begin if Result_Im > Pi then return (Re => Result_Re, Im => Result_Im - 2.0 * Pi); else return (Re => Result_Re, Im => Result_Im); end if; end; end if; end Fast_Log; function Fast_Exp (X : Long_Long_Complex) return Long_Long_Complex is Y : constant Long_Long_Float := Long_Long_Elementary_Functions.Fast_Exp (X.Re); begin return ( Re => Y * Long_Long_Elementary_Functions.Fast_Cos (X.Im), Im => Y * Long_Long_Elementary_Functions.Fast_Sin (X.Im)); end Fast_Exp; function Fast_Exp (X : Long_Long_Imaginary) return Long_Long_Complex is begin return ( Re => Long_Long_Elementary_Functions.Fast_Cos (Long_Long_Float (X)), Im => Long_Long_Elementary_Functions.Fast_Sin (Long_Long_Float (X))); end Fast_Exp; function Fast_Pow (Left, Right : Long_Long_Complex) return Long_Long_Complex is begin if (Left.Re = 0.0 or else Left.Re = 1.0) and then Left.Im = 0.0 then return Left; else return Fast_Exp (Right * Fast_Log (Left)); end if; end Fast_Pow; function Fast_Sin (X : Long_Long_Complex) return Long_Long_Complex is begin if abs X.Re < Square_Root_Epsilon and then abs X.Im < Square_Root_Epsilon then return X; else return ( Re => Long_Long_Elementary_Functions.Fast_Sin (X.Re) * Long_Long_Elementary_Functions.Fast_Cosh (X.Im), Im => Long_Long_Elementary_Functions.Fast_Cos (X.Re) * Long_Long_Elementary_Functions.Fast_Sinh (X.Im)); end if; end Fast_Sin; function Fast_Cos (X : Long_Long_Complex) return Long_Long_Complex is begin return ( Re => Long_Long_Elementary_Functions.Fast_Cos (X.Re) * Long_Long_Elementary_Functions.Fast_Cosh (X.Im), Im => -(Long_Long_Elementary_Functions.Fast_Sin (X.Re) * Long_Long_Elementary_Functions.Fast_Sinh (X.Im))); end Fast_Cos; function Fast_Tan (X : Long_Long_Complex) return Long_Long_Complex is begin if abs X.Re < Square_Root_Epsilon and then abs X.Im < Square_Root_Epsilon then return X; elsif X.Im > Log_Inverse_Epsilon_2 then return (Re => 0.0, Im => 1.0); elsif X.Im < -Log_Inverse_Epsilon_2 then return (Re => 0.0, Im => -1.0); else return Fast_Sin (X) / Fast_Cos (X); end if; end Fast_Tan; function Fast_Arcsin (X : Long_Long_Complex) return Long_Long_Complex is begin if abs X.Re < Square_Root_Epsilon and then abs X.Im < Square_Root_Epsilon then return X; elsif abs X.Re > Inv_Square_Root_Epsilon or else abs X.Im > Inv_Square_Root_Epsilon then declare iX : constant Long_Long_Complex := (Re => -X.Im, Im => X.Re); Log_2i : constant Long_Long_Complex := Fast_Log ((Re => 0.0, Im => 2.0)); A : constant Long_Long_Complex := (Re => iX.Re + Log_2i.Re, Im => iX.Im + Log_2i.Im); -- iX + Log_2i Result : constant Long_Long_Complex := (Re => A.Im, Im => -A.Re); -- -i * A begin if Result.Im > Pi_Div_2 then return (Re => Result.Re, Im => Pi - X.Im); elsif Result.Im < -Pi_Div_2 then return (Re => Result.Re, Im => -(Pi + X.Im)); else return Result; end if; end; else declare iX : constant Long_Long_Complex := (Re => -X.Im, Im => X.Re); X_X : constant Long_Long_Complex := X * X; A : constant Long_Long_Complex := (Re => 1.0 - X_X.Re, Im => -X_X.Im); -- 1.0 - X_X Sqrt_A : constant Long_Long_Complex := Fast_Sqrt (A); B : constant Long_Long_Complex := (Re => iX.Re + Sqrt_A.Re, Im => iX.Im + Sqrt_A.Im); -- iX + Sqrt_A Log_B : constant Long_Long_Complex := Fast_Log (B); Result : constant Long_Long_Complex := (Re => Log_B.Im, Im => -Log_B.Re); -- -i * Log_B begin if X.Re = 0.0 then return (Re => X.Re, Im => Result.Im); elsif X.Im = 0.0 and then abs X.Re <= 1.00 then return (Re => Result.Re, Im => X.Im); else return Result; end if; end; end if; end Fast_Arcsin; function Fast_Arccos (X : Long_Long_Complex) return Long_Long_Complex is begin if X.Re = 1.0 and then X.Im = 0.0 then return (Re => 0.0, Im => 0.0); elsif abs X.Re < Square_Root_Epsilon and then abs X.Im < Square_Root_Epsilon then return (Re => Pi_Div_2 - X.Re, Im => -X.Im); elsif abs X.Re > Inv_Square_Root_Epsilon or else abs X.Im > Inv_Square_Root_Epsilon then declare A : constant Long_Long_Complex := (Re => 1.0 - X.Re, Im => -X.Im); -- 1.0 - X B : constant Long_Long_Complex := (Re => A.Re / 2.0, Im => A.Im / 2.0); -- A / 2.0 Sqrt_B : constant Long_Long_Complex := Fast_Sqrt (B); i_Sqrt_B : constant Long_Long_Complex := (Re => -Sqrt_B.Im, Im => Sqrt_B.Re); C : constant Long_Long_Complex := (Re => 1.0 + X.Re, Im => X.Im); -- 1.0 + X D : constant Long_Long_Complex := (Re => C.Re / 2.0, Im => C.Im / 2.0); -- C / 2.0 Sqrt_D : constant Long_Long_Complex := Fast_Sqrt (D); E : constant Long_Long_Complex := (Re => Sqrt_D.Re + i_Sqrt_B.Re, Im => Sqrt_D.Im + i_Sqrt_B.Im); -- Sqrt_D + i_Sqrt_B Log_E : constant Long_Long_Complex := Fast_Log (E); Result : constant Long_Long_Complex := (Re => 2.0 * Log_E.Im, Im => -2.0 * Log_E.Re); -- -2.0 * i * Log_E begin return Result; end; else declare X_X : constant Long_Long_Complex := X * X; A : constant Long_Long_Complex := (Re => 1.0 - X_X.Re, Im => -X_X.Im); -- 1.0 - X_X Sqrt_A : constant Long_Long_Complex := Fast_Sqrt (A); i_Sqrt_A : constant Long_Long_Complex := (Re => -Sqrt_A.Im, Im => Sqrt_A.Re); B : constant Long_Long_Complex := (Re => X.Re + i_Sqrt_A.Re, Im => X.Im + i_Sqrt_A.Im); -- X + i_Sqrt_A Log_B : constant Long_Long_Complex := Fast_Log (B); Result : constant Long_Long_Complex := (Re => Log_B.Im, Im => -Log_B.Re); -- -i * Log_B begin if X.Im = 0.0 and then abs X.Re <= 1.00 then return (Re => Result.Re, Im => X.Im); else return Result; end if; end; end if; end Fast_Arccos; function Fast_Arctan (X : Long_Long_Complex) return Long_Long_Complex is begin if abs X.Re < Square_Root_Epsilon and then abs X.Im < Square_Root_Epsilon then return X; else declare iX : constant Long_Long_Complex := (Re => -X.Im, Im => X.Re); A : constant Long_Long_Complex := (Re => 1.0 + iX.Re, Im => iX.Im); -- 1.0 + iX Log_A : constant Long_Long_Complex := Fast_Log (A); B : constant Long_Long_Complex := (Re => 1.0 - iX.Re, Im => -iX.Im); -- 1.0 - iX Log_B : constant Long_Long_Complex := Fast_Log (B); C : constant Long_Long_Complex := (Re => Log_A.Re - Log_B.Re, Im => Log_A.Im - Log_B.Im); -- Log_A - Log_B Result : constant Long_Long_Complex := (Re => C.Im / 2.0, Im => -C.Re / 2.0); -- -i * C / 2.0 begin return Result; end; end if; end Fast_Arctan; function Fast_Sinh (X : Long_Long_Complex) return Long_Long_Complex is begin if abs X.Re < Square_Root_Epsilon and then abs X.Re < Square_Root_Epsilon then return X; else return ( Re => Long_Long_Elementary_Functions.Fast_Sinh (X.Re) * Long_Long_Elementary_Functions.Fast_Cos (X.Im), Im => Long_Long_Elementary_Functions.Fast_Cosh (X.Re) * Long_Long_Elementary_Functions.Fast_Sin (X.Im)); end if; end Fast_Sinh; function Fast_Cosh (X : Long_Long_Complex) return Long_Long_Complex is begin return ( Re => Long_Long_Elementary_Functions.Fast_Cosh (X.Re) * Long_Long_Elementary_Functions.Fast_Cos (X.Im), Im => Long_Long_Elementary_Functions.Fast_Sinh (X.Re) * Long_Long_Elementary_Functions.Fast_Sin (X.Im)); end Fast_Cosh; function Fast_Tanh (X : Long_Long_Complex) return Long_Long_Complex is begin if abs X.Re < Square_Root_Epsilon and then abs X.Im < Square_Root_Epsilon then return X; elsif X.Re > Log_Inverse_Epsilon_2 then return (Re => 1.0, Im => 0.0); elsif X.Re < -Log_Inverse_Epsilon_2 then return (Re => -1.0, Im => 0.0); else return Fast_Sinh (X) / Fast_Cosh (X); end if; end Fast_Tanh; function Fast_Arcsinh (X : Long_Long_Complex) return Long_Long_Complex is begin if abs X.Re < Square_Root_Epsilon and then abs X.Im < Square_Root_Epsilon then return X; elsif abs X.Re > Inv_Square_Root_Epsilon or else abs X.Im > Inv_Square_Root_Epsilon then declare Log_X : constant Long_Long_Complex := Fast_Log (X); Result : constant Long_Long_Complex := (Re => Log_2 + Log_X.Re, Im => Log_X.Im); -- Log_2 + Log_X begin if (X.Re < 0.0 and then Result.Re > 0.0) or else (X.Re > 0.0 and then Result.Re < 0.0) then return (Re => -Result.Re, Im => Result.Im); else return Result; end if; end; else declare X_X : constant Long_Long_Complex := X * X; A : constant Long_Long_Complex := (Re => 1.0 + X_X.Re, Im => X_X.Im); -- 1.0 + X_X Sqrt_A : constant Long_Long_Complex := Fast_Sqrt (A); B : constant Long_Long_Complex := (Re => X.Re + Sqrt_A.Re, Im => X.Im + Sqrt_A.Im); -- X + Sqrt_A Result : constant Long_Long_Complex := Fast_Log (B); begin if X.Re = 0.0 then return (Re => X.Re, Im => Result.Im); elsif X.Im = 0.0 then return (Re => Result.Re, Im => X.Im); else return Result; end if; end; end if; end Fast_Arcsinh; function Fast_Arccosh (X : Long_Long_Complex) return Long_Long_Complex is begin if X.Re = 1.0 and then X.Im = 0.0 then return (Re => 0.0, Im => 0.0); elsif abs X.Re < Square_Root_Epsilon and then abs X.Im < Square_Root_Epsilon then declare Result : constant Long_Long_Complex := (Re => -X.Im, Im => X.Re - Pi_Div_2); -- i * X - i * (Pi / 2) begin if Result.Re <= 0.0 then return (Re => -Result.Re, Im => -Result.Im); else return Result; end if; end; elsif abs X.Re > Inv_Square_Root_Epsilon or else abs X.Im > Inv_Square_Root_Epsilon then declare Log_X : constant Long_Long_Complex := Fast_Log (X); Result : constant Long_Long_Complex := (Re => Log_2 + Log_X.Re, Im => Log_X.Im); -- Log_2 + Log_X begin if Result.Re <= 0.0 then return (Re => -Result.Re, Im => -Result.Im); else return Result; end if; end; else declare A : constant Long_Long_Complex := (Re => X.Re + 1.0, Im => X.Im); -- X + 1.0 B : constant Long_Long_Complex := (Re => A.Re / 2.0, Im => A.Im / 2.0); -- A / 2.0 Sqrt_B : constant Long_Long_Complex := Fast_Sqrt (B); C : constant Long_Long_Complex := (Re => X.Re - 1.0, Im => X.Im); -- X - 1.0 D : constant Long_Long_Complex := (Re => C.Re / 2.0, Im => C.Im / 2.0); -- C / 2.0 Sqrt_D : constant Long_Long_Complex := Fast_Sqrt (D); E : constant Long_Long_Complex := (Re => Sqrt_B.Re + Sqrt_D.Re, Im => Sqrt_B.Im + Sqrt_D.Im); -- Sqrt_B + Sqrt_D Log_E : constant Long_Long_Complex := Fast_Log (E); Result : constant Long_Long_Complex := (Re => 2.0 * Log_E.Re, Im => 2.0 * Log_E.Im); -- 2.0 * Log_E begin if Result.Re <= 0.0 then return (Re => -Result.Re, Im => -Result.Im); else return Result; end if; end; end if; end Fast_Arccosh; function Fast_Arctanh (X : Long_Long_Complex) return Long_Long_Complex is begin if abs X.Re < Square_Root_Epsilon and then abs X.Im < Square_Root_Epsilon then return X; else declare A : constant Long_Long_Complex := (Re => 1.0 + X.Re, Im => X.Im); -- 1.0 + X Log_A : constant Long_Long_Complex := Fast_Log (A); B : constant Long_Long_Complex := (Re => 1.0 - X.Re, Im => -X.Im); -- 1.0 - X Log_B : constant Long_Long_Complex := Fast_Log (B); C : constant Long_Long_Complex := (Re => Log_A.Re - Log_B.Re, Im => Log_A.Im - Log_B.Im); -- Log_A - Log_B Result : constant Long_Long_Complex := (Re => C.Re / 2.0, Im => C.Im / 2.0); -- C / 2.0 begin return Result; end; end if; end Fast_Arctanh; end System.Long_Long_Complex_Elementary_Functions;
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xa0_notsx.log_21829_1255.asm
ljhsiun2/medusa
9
81619
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r8 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0x14e31, %r9 nop nop nop nop nop add $2159, %rdi vmovups (%r9), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $1, %xmm1, %rbx nop nop nop add %r8, %r8 lea addresses_normal_ht+0x64a0, %rdi nop nop nop add %r12, %r12 mov $0x6162636465666768, %rdx movq %rdx, (%rdi) nop nop nop nop add $38151, %rdx lea addresses_A_ht+0xdc29, %rsi lea addresses_WC_ht+0x8c69, %rdi nop nop nop nop sub %r12, %r12 mov $64, %rcx rep movsq nop nop nop nop and $48468, %rdi lea addresses_D_ht+0x3e89, %rdx cmp %r9, %r9 mov $0x6162636465666768, %rbx movq %rbx, (%rdx) nop xor $14255, %rcx lea addresses_WT_ht+0x1b6a8, %rbx xor $60654, %r9 movups (%rbx), %xmm2 vpextrq $0, %xmm2, %rdx nop nop nop nop nop inc %rdi lea addresses_WT_ht+0x4669, %rsi lea addresses_UC_ht+0x136e9, %rdi clflush (%rdi) nop nop nop and %rbx, %rbx mov $119, %rcx rep movsb nop nop cmp %rdi, %rdi lea addresses_UC_ht+0x73e9, %r9 nop inc %r8 mov (%r9), %esi and $16553, %rdi lea addresses_D_ht+0x2a69, %rbx nop and %rsi, %rsi mov (%rbx), %r9d nop cmp %r9, %r9 lea addresses_D_ht+0x1a469, %rbx nop nop add %r8, %r8 mov (%rbx), %ecx nop nop add $38918, %rsi lea addresses_WT_ht+0xdf79, %rsi lea addresses_normal_ht+0x6709, %rdi nop nop nop nop inc %r8 mov $15, %rcx rep movsb nop nop nop cmp $32926, %r12 lea addresses_WC_ht+0x11169, %rcx nop nop nop xor %rdx, %rdx mov $0x6162636465666768, %rdi movq %rdi, %xmm6 movups %xmm6, (%rcx) nop nop nop nop cmp $8188, %r12 lea addresses_normal_ht+0xb369, %rdi nop nop nop nop nop cmp $21914, %rdx movw $0x6162, (%rdi) nop nop nop nop nop sub $55245, %rbx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r8 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r14 push %r15 push %rcx push %rdi push %rsi // REPMOV lea addresses_normal+0x6aa9, %rsi lea addresses_D+0x1fb19, %rdi clflush (%rsi) nop nop nop nop nop add %r14, %r14 mov $34, %rcx rep movsq nop nop nop nop add $30677, %rdi // Store mov $0x5f2cb80000000469, %r14 nop nop nop add $24867, %r15 mov $0x5152535455565758, %rsi movq %rsi, %xmm3 vmovups %ymm3, (%r14) nop nop sub $62721, %r13 // Faulty Load mov $0x1e36600000000069, %rsi nop xor %r14, %r14 mov (%rsi), %r15w lea oracles, %r11 and $0xff, %r15 shlq $12, %r15 mov (%r11,%r15,1), %r15 pop %rsi pop %rdi pop %rcx pop %r15 pop %r14 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D', 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 10}} [Faulty Load] {'src': {'type': 'addresses_NC', 'AVXalign': True, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 3}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}} {'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 3}} {'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}} {'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 10}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 3}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 4}} {'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 */
test/Succeed/Issue3301.agda
shlevy/agda
1,989
14910
{-# OPTIONS --allow-unsolved-metas #-} postulate Nat : Set variable A : _ F : _ → _
agda/BubbleSort/Everything.agda
bgbianchi/sorting
6
2322
open import Relation.Binary.Core module BubbleSort.Everything {A : Set} (_≤_ : A → A → Set) (tot≤ : Total _≤_) (trans≤ : Transitive _≤_) where open import BubbleSort.Correctness.Order _≤_ tot≤ trans≤ open import BubbleSort.Correctness.Permutation _≤_ tot≤
alloy4fun_models/trashltl/models/12/wrwyJqP9hdm6iR5AK.als
Kaixi26/org.alloytools.alloy
0
1533
<reponame>Kaixi26/org.alloytools.alloy<filename>alloy4fun_models/trashltl/models/12/wrwyJqP9hdm6iR5AK.als open main pred idwrwyJqP9hdm6iR5AK_prop13 { File in Trash implies once no Trash } pred __repair { idwrwyJqP9hdm6iR5AK_prop13 } check __repair { idwrwyJqP9hdm6iR5AK_prop13 <=> prop13o }
src/gen/cups-netinet_in_h.ads
persan/a-cups
0
30170
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with CUPS.stdint_h; with CUPS.bits_sockaddr_h; with CUPS.bits_socket_h; with System; with CUPS.unistd_h; private package CUPS.netinet_in_h is -- unsupported macro: IPPROTO_IP IPPROTO_IP -- unsupported macro: IPPROTO_ICMP IPPROTO_ICMP -- unsupported macro: IPPROTO_IGMP IPPROTO_IGMP -- unsupported macro: IPPROTO_IPIP IPPROTO_IPIP -- unsupported macro: IPPROTO_TCP IPPROTO_TCP -- unsupported macro: IPPROTO_EGP IPPROTO_EGP -- unsupported macro: IPPROTO_PUP IPPROTO_PUP -- unsupported macro: IPPROTO_UDP IPPROTO_UDP -- unsupported macro: IPPROTO_IDP IPPROTO_IDP -- unsupported macro: IPPROTO_TP IPPROTO_TP -- unsupported macro: IPPROTO_DCCP IPPROTO_DCCP -- unsupported macro: IPPROTO_IPV6 IPPROTO_IPV6 -- unsupported macro: IPPROTO_RSVP IPPROTO_RSVP -- unsupported macro: IPPROTO_GRE IPPROTO_GRE -- unsupported macro: IPPROTO_ESP IPPROTO_ESP -- unsupported macro: IPPROTO_AH IPPROTO_AH -- unsupported macro: IPPROTO_MTP IPPROTO_MTP -- unsupported macro: IPPROTO_BEETPH IPPROTO_BEETPH -- unsupported macro: IPPROTO_ENCAP IPPROTO_ENCAP -- unsupported macro: IPPROTO_PIM IPPROTO_PIM -- unsupported macro: IPPROTO_COMP IPPROTO_COMP -- unsupported macro: IPPROTO_SCTP IPPROTO_SCTP -- unsupported macro: IPPROTO_UDPLITE IPPROTO_UDPLITE -- unsupported macro: IPPROTO_MPLS IPPROTO_MPLS -- unsupported macro: IPPROTO_RAW IPPROTO_RAW -- unsupported macro: IPPROTO_HOPOPTS IPPROTO_HOPOPTS -- unsupported macro: IPPROTO_ROUTING IPPROTO_ROUTING -- unsupported macro: IPPROTO_FRAGMENT IPPROTO_FRAGMENT -- unsupported macro: IPPROTO_ICMPV6 IPPROTO_ICMPV6 -- unsupported macro: IPPROTO_NONE IPPROTO_NONE -- unsupported macro: IPPROTO_DSTOPTS IPPROTO_DSTOPTS -- unsupported macro: IPPROTO_MH IPPROTO_MH -- arg-macro: function IN_CLASSA ((((in_addr_t)(a)) and 16#80000000#) = 0 -- return (((in_addr_t)(a)) and 16#80000000#) = 0; IN_CLASSA_NET : constant := 16#ff000000#; -- netinet/in.h:167 IN_CLASSA_NSHIFT : constant := 24; -- netinet/in.h:168 -- unsupported macro: IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) IN_CLASSA_MAX : constant := 128; -- netinet/in.h:170 -- arg-macro: function IN_CLASSB ((((in_addr_t)(a)) and 16#c0000000#) = 16#80000000# -- return (((in_addr_t)(a)) and 16#c0000000#) = 16#80000000#; IN_CLASSB_NET : constant := 16#ffff0000#; -- netinet/in.h:173 IN_CLASSB_NSHIFT : constant := 16; -- netinet/in.h:174 -- unsupported macro: IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) IN_CLASSB_MAX : constant := 65536; -- netinet/in.h:176 -- arg-macro: function IN_CLASSC ((((in_addr_t)(a)) and 16#e0000000#) = 16#c0000000# -- return (((in_addr_t)(a)) and 16#e0000000#) = 16#c0000000#; IN_CLASSC_NET : constant := 16#ffffff00#; -- netinet/in.h:179 IN_CLASSC_NSHIFT : constant := 8; -- netinet/in.h:180 -- unsupported macro: IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) -- arg-macro: function IN_CLASSD ((((in_addr_t)(a)) and 16#f0000000#) = 16#e0000000# -- return (((in_addr_t)(a)) and 16#f0000000#) = 16#e0000000#; -- arg-macro: procedure IN_MULTICAST IN_CLASSD(a) -- IN_CLASSD(a) -- arg-macro: function IN_EXPERIMENTAL ((((in_addr_t)(a)) and 16#e0000000#) = 16#e0000000# -- return (((in_addr_t)(a)) and 16#e0000000#) = 16#e0000000#; -- arg-macro: function IN_BADCLASS ((((in_addr_t)(a)) and 16#f0000000#) = 16#f0000000# -- return (((in_addr_t)(a)) and 16#f0000000#) = 16#f0000000#; -- unsupported macro: INADDR_ANY ((in_addr_t) 0x00000000) -- unsupported macro: INADDR_BROADCAST ((in_addr_t) 0xffffffff) -- unsupported macro: INADDR_NONE ((in_addr_t) 0xffffffff) IN_LOOPBACKNET : constant := 127; -- netinet/in.h:197 -- unsupported macro: INADDR_LOOPBACK ((in_addr_t) 0x7f000001) -- unsupported macro: INADDR_UNSPEC_GROUP ((in_addr_t) 0xe0000000) -- unsupported macro: INADDR_ALLHOSTS_GROUP ((in_addr_t) 0xe0000001) -- unsupported macro: INADDR_ALLRTRS_GROUP ((in_addr_t) 0xe0000002) -- unsupported macro: INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) -- unsupported macro: s6_addr __in6_u.__u6_addr8 -- unsupported macro: s6_addr16 __in6_u.__u6_addr16 -- unsupported macro: s6_addr32 __in6_u.__u6_addr32 -- unsupported macro: IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } -- unsupported macro: IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } INET_ADDRSTRLEN : constant := 16; -- netinet/in.h:234 INET6_ADDRSTRLEN : constant := 46; -- netinet/in.h:235 -- arg-macro: function IP_MSFILTER_SIZE (sizeof (struct ip_msfilter) - sizeof (struct in_addr) + (numsrc) * sizeof (struct in_addr) -- return sizeof (struct ip_msfilter) - sizeof (struct in_addr) + (numsrc) * sizeof (struct in_addr); -- arg-macro: function GROUP_FILTER_SIZE (sizeof (struct group_filter) - sizeof (struct sockaddr_storage) + ((numsrc) * sizeof (struct sockaddr_storage)) -- return sizeof (struct group_filter) - sizeof (struct sockaddr_storage) + ((numsrc) * sizeof (struct sockaddr_storage)); -- arg-macro: function IN6_IS_ADDR_UNSPECIFIED (__extension__ ({ const struct in6_addr *__a := (const struct in6_addr *) (a); __a.s6_addr32(0) = 0 and then __a.s6_addr32(1) = 0 and then __a.s6_addr32(2) = 0 and then __a.s6_addr32(3) = 0; }) -- return __extension__ ({ const struct in6_addr *__a := (const struct in6_addr *) (a); __a.s6_addr32(0) = 0 and then __a.s6_addr32(1) = 0 and then __a.s6_addr32(2) = 0 and then __a.s6_addr32(3) = 0; }); -- arg-macro: function IN6_IS_ADDR_LOOPBACK (__extension__ ({ const struct in6_addr *__a := (const struct in6_addr *) (a); __a.s6_addr32(0) = 0 and then __a.s6_addr32(1) = 0 and then __a.s6_addr32(2) = 0 and then __a.s6_addr32(3) = htonl (1); }) -- return __extension__ ({ const struct in6_addr *__a := (const struct in6_addr *) (a); __a.s6_addr32(0) = 0 and then __a.s6_addr32(1) = 0 and then __a.s6_addr32(2) = 0 and then __a.s6_addr32(3) = htonl (1); }); -- arg-macro: function IN6_IS_ADDR_LINKLOCAL (__extension__ ({ const struct in6_addr *__a := (const struct in6_addr *) (a); (__a.s6_addr32(0) and htonl (16#ffc00000#)) = htonl (16#fe800000#); }) -- return __extension__ ({ const struct in6_addr *__a := (const struct in6_addr *) (a); (__a.s6_addr32(0) and htonl (16#ffc00000#)) = htonl (16#fe800000#); }); -- arg-macro: function IN6_IS_ADDR_SITELOCAL (__extension__ ({ const struct in6_addr *__a := (const struct in6_addr *) (a); (__a.s6_addr32(0) and htonl (16#ffc00000#)) = htonl (16#fec00000#); }) -- return __extension__ ({ const struct in6_addr *__a := (const struct in6_addr *) (a); (__a.s6_addr32(0) and htonl (16#ffc00000#)) = htonl (16#fec00000#); }); -- arg-macro: function IN6_IS_ADDR_V4MAPPED (__extension__ ({ const struct in6_addr *__a := (const struct in6_addr *) (a); __a.s6_addr32(0) = 0 and then __a.s6_addr32(1) = 0 and then __a.s6_addr32(2) = htonl (16#ffff#); }) -- return __extension__ ({ const struct in6_addr *__a := (const struct in6_addr *) (a); __a.s6_addr32(0) = 0 and then __a.s6_addr32(1) = 0 and then __a.s6_addr32(2) = htonl (16#ffff#); }); -- arg-macro: function IN6_IS_ADDR_V4COMPAT (__extension__ ({ const struct in6_addr *__a := (const struct in6_addr *) (a); __a.s6_addr32(0) = 0 and then __a.s6_addr32(1) = 0 and then __a.s6_addr32(2) = 0 and then ntohl (__a.s6_addr32(3)) > 1; }) -- return __extension__ ({ const struct in6_addr *__a := (const struct in6_addr *) (a); __a.s6_addr32(0) = 0 and then __a.s6_addr32(1) = 0 and then __a.s6_addr32(2) = 0 and then ntohl (__a.s6_addr32(3)) > 1; }); -- arg-macro: function IN6_ARE_ADDR_EQUAL (__extension__ ({ const struct in6_addr *__a := (const struct in6_addr *) (a); const struct in6_addr *__b := (const struct in6_addr *) (b); __a.s6_addr32(0) = __b.s6_addr32(0) and then __a.s6_addr32(1) = __b.s6_addr32(1) and then __a.s6_addr32(2) = __b.s6_addr32(2) and then __a.s6_addr32(3) = __b.s6_addr32(3); }) -- return __extension__ ({ const struct in6_addr *__a := (const struct in6_addr *) (a); const struct in6_addr *__b := (const struct in6_addr *) (b); __a.s6_addr32(0) = __b.s6_addr32(0) and then __a.s6_addr32(1) = __b.s6_addr32(1) and then __a.s6_addr32(2) = __b.s6_addr32(2) and then __a.s6_addr32(3) = __b.s6_addr32(3); }); -- arg-macro: function IN6_IS_ADDR_MULTICAST (((const uint8_t *) (a))(0) = 16#ff# -- return ((const uint8_t *) (a))(0) = 16#ff#; -- arg-macro: function IN6_IS_ADDR_MC_NODELOCAL (IN6_IS_ADDR_MULTICAST(a) and then ((((const uint8_t *) (a))(1) and 16#f#) = 16#1#) -- return IN6_IS_ADDR_MULTICAST(a) and then ((((const uint8_t *) (a))(1) and 16#f#) = 16#1#); -- arg-macro: function IN6_IS_ADDR_MC_LINKLOCAL (IN6_IS_ADDR_MULTICAST(a) and then ((((const uint8_t *) (a))(1) and 16#f#) = 16#2#) -- return IN6_IS_ADDR_MULTICAST(a) and then ((((const uint8_t *) (a))(1) and 16#f#) = 16#2#); -- arg-macro: function IN6_IS_ADDR_MC_SITELOCAL (IN6_IS_ADDR_MULTICAST(a) and then ((((const uint8_t *) (a))(1) and 16#f#) = 16#5#) -- return IN6_IS_ADDR_MULTICAST(a) and then ((((const uint8_t *) (a))(1) and 16#f#) = 16#5#); -- arg-macro: function IN6_IS_ADDR_MC_ORGLOCAL (IN6_IS_ADDR_MULTICAST(a) and then ((((const uint8_t *) (a))(1) and 16#f#) = 16#8#) -- return IN6_IS_ADDR_MULTICAST(a) and then ((((const uint8_t *) (a))(1) and 16#f#) = 16#8#); -- arg-macro: function IN6_IS_ADDR_MC_GLOBAL (IN6_IS_ADDR_MULTICAST(a) and then ((((const uint8_t *) (a))(1) and 16#f#) = 16#e#) -- return IN6_IS_ADDR_MULTICAST(a) and then ((((const uint8_t *) (a))(1) and 16#f#) = 16#e#); -- Copyright (C) 1991-2016 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- The GNU C 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 -- Lesser General Public License for more details. -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, see -- <http://www.gnu.org/licenses/>. -- Internet address. subtype in_addr_t is CUPS.stdint_h.uint32_t; -- netinet/in.h:30 type in_addr is record s_addr : aliased in_addr_t; -- netinet/in.h:33 end record; pragma Convention (C_Pass_By_Copy, in_addr); -- netinet/in.h:31 -- Get system-specific definitions. -- Standard well-defined IP protocols. -- Dummy protocol for TCP. -- Internet Control Message Protocol. -- Internet Group Management Protocol. -- IPIP tunnels (older KA9Q tunnels use 94). -- Transmission Control Protocol. -- Exterior Gateway Protocol. -- PUP protocol. -- User Datagram Protocol. -- XNS IDP protocol. -- SO Transport Protocol Class 4. -- Datagram Congestion Control Protocol. -- IPv6 header. -- Reservation Protocol. -- General Routing Encapsulation. -- encapsulating security payload. -- authentication header. -- Multicast Transport Protocol. -- IP option pseudo header for BEET. -- Encapsulation Header. -- Protocol Independent Multicast. -- Compression Header Protocol. -- Stream Control Transmission Protocol. -- UDP-Lite protocol. -- MPLS in IP. -- Raw IP packets. -- If __USE_KERNEL_IPV6_DEFS is defined then the user has included the kernel -- network headers first and we should use those ABI-identical definitions -- instead of our own. -- IPv6 Hop-by-Hop options. -- IPv6 routing header. -- IPv6 fragmentation header. -- ICMPv6. -- IPv6 no next header. -- IPv6 destination options. -- IPv6 mobility header. -- Type to represent a port. subtype in_port_t is CUPS.stdint_h.uint16_t; -- netinet/in.h:119 -- Standard well-known ports. -- Echo service. -- Discard transmissions service. -- System status service. -- Time of day service. -- Network status service. -- File Transfer Protocol. -- Telnet protocol. -- Simple Mail Transfer Protocol. -- Timeserver service. -- Domain Name Service. -- Internet Whois service. -- Trivial File Transfer Protocol. -- Finger service. -- SUPDUP protocol. -- execd service. -- rlogind service. -- UDP ports. -- Ports less than this value are reserved for privileged processes. -- Ports greater this value are reserved for (non-privileged) servers. -- Definitions of the bits in an Internet address integer. -- On subnets, host and network parts are found according to -- the subnet mask, not these masks. -- Address to accept any incoming messages. -- Address to send to all hosts. -- Address indicating an error return. -- Network number for local host loopback. -- Address to loopback in software to local host. -- Defines for Multicast INADDR. -- IPv6 address type in6_addr; type in6_addr_uu_u6_addr8_array is array (0 .. 15) of aliased CUPS.stdint_h.uint8_t; type in6_addr_uu_u6_addr16_array is array (0 .. 7) of aliased CUPS.stdint_h.uint16_t; type in6_addr_uu_u6_addr32_array is array (0 .. 3) of aliased CUPS.stdint_h.uint32_t; type anon_32 (discr : unsigned := 0) is record case discr is when 0 => uu_u6_addr8 : aliased in6_addr_uu_u6_addr8_array; -- netinet/in.h:215 when 1 => uu_u6_addr16 : aliased in6_addr_uu_u6_addr16_array; -- netinet/in.h:217 when others => uu_u6_addr32 : aliased in6_addr_uu_u6_addr32_array; -- netinet/in.h:218 end case; end record; pragma Convention (C_Pass_By_Copy, anon_32); pragma Unchecked_Union (anon_32);type in6_addr is record uu_in6_u : aliased anon_32; -- netinet/in.h:220 end record; pragma Convention (C_Pass_By_Copy, in6_addr); -- netinet/in.h:211 -- :: in6addr_any : aliased in6_addr; -- netinet/in.h:229 pragma Import (C, in6addr_any, "in6addr_any"); -- ::1 in6addr_loopback : aliased in6_addr; -- netinet/in.h:230 pragma Import (C, in6addr_loopback, "in6addr_loopback"); -- Structure describing an Internet socket address. type sockaddr_in_sin_zero_array is array (0 .. 7) of aliased unsigned_char; type sockaddr_in is record sin_family : aliased CUPS.bits_sockaddr_h.sa_family_t; -- netinet/in.h:241 sin_port : aliased in_port_t; -- netinet/in.h:242 sin_addr : aliased in_addr; -- netinet/in.h:243 sin_zero : aliased sockaddr_in_sin_zero_array; -- netinet/in.h:249 end record; pragma Convention (C_Pass_By_Copy, sockaddr_in); -- netinet/in.h:239 -- Port number. -- Internet address. -- Pad to size of `struct sockaddr'. -- Ditto, for IPv6. type sockaddr_in6 is record sin6_family : aliased CUPS.bits_sockaddr_h.sa_family_t; -- netinet/in.h:256 sin6_port : aliased in_port_t; -- netinet/in.h:257 sin6_flowinfo : aliased CUPS.stdint_h.uint32_t; -- netinet/in.h:258 sin6_addr : aliased in6_addr; -- netinet/in.h:259 sin6_scope_id : aliased CUPS.stdint_h.uint32_t; -- netinet/in.h:260 end record; pragma Convention (C_Pass_By_Copy, sockaddr_in6); -- netinet/in.h:254 -- Transport layer port # -- IPv6 flow information -- IPv6 address -- IPv6 scope-id -- IPv4 multicast request. -- IP multicast address of group. type ip_mreq is record imr_multiaddr : aliased in_addr; -- netinet/in.h:269 imr_interface : aliased in_addr; -- netinet/in.h:272 end record; pragma Convention (C_Pass_By_Copy, ip_mreq); -- netinet/in.h:266 -- Local IP address of interface. -- IP multicast address of group. type ip_mreq_source is record imr_multiaddr : aliased in_addr; -- netinet/in.h:278 imr_interface : aliased in_addr; -- netinet/in.h:281 imr_sourceaddr : aliased in_addr; -- netinet/in.h:284 end record; pragma Convention (C_Pass_By_Copy, ip_mreq_source); -- netinet/in.h:275 -- IP address of source. -- IP address of interface. -- Likewise, for IPv6. -- IPv6 multicast address of group type ipv6_mreq is record ipv6mr_multiaddr : aliased in6_addr; -- netinet/in.h:293 ipv6mr_interface : aliased unsigned; -- netinet/in.h:296 end record; pragma Convention (C_Pass_By_Copy, ipv6_mreq); -- netinet/in.h:290 -- Address data. -- Structure large enough to hold any socket address (with the historical -- exception of AF_UNIX). -- Address family, etc. subtype sockaddr_storage_uu_ss_padding_array is Interfaces.C.char_array (0 .. 117); type sockaddr_storage is record ss_family : aliased CUPS.bits_sockaddr_h.sa_family_t; -- bits/socket.h:168 uu_ss_padding : aliased sockaddr_storage_uu_ss_padding_array; -- bits/socket.h:169 uu_ss_align : aliased unsigned_long; -- bits/socket.h:170 end record; pragma Convention (C_Pass_By_Copy, sockaddr_storage); -- bits/socket.h:166 -- local interface -- Multicast group request. -- Interface index. type group_req is record gr_interface : aliased CUPS.stdint_h.uint32_t; -- netinet/in.h:305 gr_group : aliased sockaddr_storage; -- netinet/in.h:308 end record; pragma Convention (C_Pass_By_Copy, group_req); -- netinet/in.h:302 -- Group address. -- Interface index. type group_source_req is record gsr_interface : aliased CUPS.stdint_h.uint32_t; -- netinet/in.h:314 gsr_group : aliased sockaddr_storage; -- netinet/in.h:317 gsr_source : aliased sockaddr_storage; -- netinet/in.h:320 end record; pragma Convention (C_Pass_By_Copy, group_source_req); -- netinet/in.h:311 -- Group address. -- Source address. -- Full-state filter operations. -- IP multicast address of group. type ip_msfilter_imsf_slist_array is array (0 .. 0) of aliased in_addr; type ip_msfilter is record imsf_multiaddr : aliased in_addr; -- netinet/in.h:328 imsf_interface : aliased in_addr; -- netinet/in.h:331 imsf_fmode : aliased CUPS.stdint_h.uint32_t; -- netinet/in.h:334 imsf_numsrc : aliased CUPS.stdint_h.uint32_t; -- netinet/in.h:337 imsf_slist : aliased ip_msfilter_imsf_slist_array; -- netinet/in.h:339 end record; pragma Convention (C_Pass_By_Copy, ip_msfilter); -- netinet/in.h:325 -- Local IP address of interface. -- Filter mode. -- Number of source addresses. -- Source addresses. -- Interface index. type group_filter_gf_slist_array is array (0 .. 0) of aliased sockaddr_storage; type group_filter is record gf_interface : aliased CUPS.stdint_h.uint32_t; -- netinet/in.h:349 gf_group : aliased sockaddr_storage; -- netinet/in.h:352 gf_fmode : aliased CUPS.stdint_h.uint32_t; -- netinet/in.h:355 gf_numsrc : aliased CUPS.stdint_h.uint32_t; -- netinet/in.h:358 gf_slist : aliased group_filter_gf_slist_array; -- netinet/in.h:360 end record; pragma Convention (C_Pass_By_Copy, group_filter); -- netinet/in.h:346 -- Group address. -- Filter mode. -- Number of source addresses. -- Source addresses. -- Functions to convert between host and network byte order. -- Please note that these functions normally take `unsigned long int' or -- `unsigned short int' values as arguments and also return them. But -- this was a short-sighted decision since on different systems the types -- may have different representations but the values are always the same. function ntohl (uu_netlong : CUPS.stdint_h.uint32_t) return CUPS.stdint_h.uint32_t; -- netinet/in.h:376 pragma Import (C, ntohl, "ntohl"); function ntohs (uu_netshort : CUPS.stdint_h.uint16_t) return CUPS.stdint_h.uint16_t; -- netinet/in.h:377 pragma Import (C, ntohs, "ntohs"); function htonl (uu_hostlong : CUPS.stdint_h.uint32_t) return CUPS.stdint_h.uint32_t; -- netinet/in.h:379 pragma Import (C, htonl, "htonl"); function htons (uu_hostshort : CUPS.stdint_h.uint16_t) return CUPS.stdint_h.uint16_t; -- netinet/in.h:381 pragma Import (C, htons, "htons"); -- Get machine dependent optimized versions of byte swapping functions. -- We can optimize calls to the conversion functions. Either nothing has -- to be done or we are using directly the byte-swapping functions which -- often can be inlined. -- The host byte order is the same as network byte order, -- so these functions are all just identity. -- Bind socket to a privileged IP port. function bindresvport (uu_sockfd : int; uu_sock_in : access sockaddr_in) return int; -- netinet/in.h:503 pragma Import (C, bindresvport, "bindresvport"); -- The IPv6 version of this function. function bindresvport6 (uu_sockfd : int; uu_sock_in : access sockaddr_in6) return int; -- netinet/in.h:506 pragma Import (C, bindresvport6, "bindresvport6"); -- Forward declaration. -- IPv6 packet information. -- src/dst IPv6 address type in6_pktinfo is record ipi6_addr : aliased in6_addr; -- netinet/in.h:539 ipi6_ifindex : aliased unsigned; -- netinet/in.h:540 end record; pragma Convention (C_Pass_By_Copy, in6_pktinfo); -- netinet/in.h:537 -- send/recv interface index -- IPv6 MTU information. -- dst address including zone ID type ip6_mtuinfo is record ip6m_addr : aliased sockaddr_in6; -- netinet/in.h:546 ip6m_mtu : aliased CUPS.stdint_h.uint32_t; -- netinet/in.h:547 end record; pragma Convention (C_Pass_By_Copy, ip6_mtuinfo); -- netinet/in.h:544 -- path MTU in host byte order -- Obsolete hop-by-hop and Destination Options Processing (RFC 2292). function inet6_option_space (uu_nbytes : int) return int; -- netinet/in.h:552 pragma Import (C, inet6_option_space, "inet6_option_space"); function inet6_option_init (uu_bp : System.Address; uu_cmsgp : System.Address; uu_type : int) return int; -- netinet/in.h:554 pragma Import (C, inet6_option_init, "inet6_option_init"); function inet6_option_append (uu_cmsg : access CUPS.bits_socket_h.cmsghdr; uu_typep : access CUPS.stdint_h.uint8_t; uu_multx : int; uu_plusy : int) return int; -- netinet/in.h:556 pragma Import (C, inet6_option_append, "inet6_option_append"); function inet6_option_alloc (uu_cmsg : access CUPS.bits_socket_h.cmsghdr; uu_datalen : int; uu_multx : int; uu_plusy : int) return access CUPS.stdint_h.uint8_t; -- netinet/in.h:559 pragma Import (C, inet6_option_alloc, "inet6_option_alloc"); function inet6_option_next (uu_cmsg : access constant CUPS.bits_socket_h.cmsghdr; uu_tptrp : System.Address) return int; -- netinet/in.h:562 pragma Import (C, inet6_option_next, "inet6_option_next"); function inet6_option_find (uu_cmsg : access constant CUPS.bits_socket_h.cmsghdr; uu_tptrp : System.Address; uu_type : int) return int; -- netinet/in.h:565 pragma Import (C, inet6_option_find, "inet6_option_find"); -- Hop-by-Hop and Destination Options Processing (RFC 3542). function inet6_opt_init (uu_extbuf : System.Address; uu_extlen : CUPS.unistd_h.socklen_t) return int; -- netinet/in.h:571 pragma Import (C, inet6_opt_init, "inet6_opt_init"); function inet6_opt_append (uu_extbuf : System.Address; uu_extlen : CUPS.unistd_h.socklen_t; uu_offset : int; uu_type : CUPS.stdint_h.uint8_t; uu_len : CUPS.unistd_h.socklen_t; uu_align : CUPS.stdint_h.uint8_t; uu_databufp : System.Address) return int; -- netinet/in.h:572 pragma Import (C, inet6_opt_append, "inet6_opt_append"); function inet6_opt_finish (uu_extbuf : System.Address; uu_extlen : CUPS.unistd_h.socklen_t; uu_offset : int) return int; -- netinet/in.h:575 pragma Import (C, inet6_opt_finish, "inet6_opt_finish"); function inet6_opt_set_val (uu_databuf : System.Address; uu_offset : int; uu_val : System.Address; uu_vallen : CUPS.unistd_h.socklen_t) return int; -- netinet/in.h:577 pragma Import (C, inet6_opt_set_val, "inet6_opt_set_val"); function inet6_opt_next (uu_extbuf : System.Address; uu_extlen : CUPS.unistd_h.socklen_t; uu_offset : int; uu_typep : access CUPS.stdint_h.uint8_t; uu_lenp : access CUPS.unistd_h.socklen_t; uu_databufp : System.Address) return int; -- netinet/in.h:579 pragma Import (C, inet6_opt_next, "inet6_opt_next"); function inet6_opt_find (uu_extbuf : System.Address; uu_extlen : CUPS.unistd_h.socklen_t; uu_offset : int; uu_type : CUPS.stdint_h.uint8_t; uu_lenp : access CUPS.unistd_h.socklen_t; uu_databufp : System.Address) return int; -- netinet/in.h:582 pragma Import (C, inet6_opt_find, "inet6_opt_find"); function inet6_opt_get_val (uu_databuf : System.Address; uu_offset : int; uu_val : System.Address; uu_vallen : CUPS.unistd_h.socklen_t) return int; -- netinet/in.h:585 pragma Import (C, inet6_opt_get_val, "inet6_opt_get_val"); -- Routing Header Option (RFC 3542). function inet6_rth_space (uu_type : int; uu_segments : int) return CUPS.unistd_h.socklen_t; -- netinet/in.h:590 pragma Import (C, inet6_rth_space, "inet6_rth_space"); function inet6_rth_init (uu_bp : System.Address; uu_bp_len : CUPS.unistd_h.socklen_t; uu_type : int; uu_segments : int) return System.Address; -- netinet/in.h:591 pragma Import (C, inet6_rth_init, "inet6_rth_init"); function inet6_rth_add (uu_bp : System.Address; uu_addr : access constant in6_addr) return int; -- netinet/in.h:593 pragma Import (C, inet6_rth_add, "inet6_rth_add"); function inet6_rth_reverse (uu_in : System.Address; uu_out : System.Address) return int; -- netinet/in.h:594 pragma Import (C, inet6_rth_reverse, "inet6_rth_reverse"); function inet6_rth_segments (uu_bp : System.Address) return int; -- netinet/in.h:595 pragma Import (C, inet6_rth_segments, "inet6_rth_segments"); function inet6_rth_getaddr (uu_bp : System.Address; uu_index : int) return access in6_addr; -- netinet/in.h:596 pragma Import (C, inet6_rth_getaddr, "inet6_rth_getaddr"); -- Multicast source filter support. -- Get IPv4 source filter. function getipv4sourcefilter (uu_s : int; uu_interface_addr : in_addr; uu_group : in_addr; uu_fmode : access CUPS.stdint_h.uint32_t; uu_numsrc : access CUPS.stdint_h.uint32_t; uu_slist : access in_addr) return int; -- netinet/in.h:603 pragma Import (C, getipv4sourcefilter, "getipv4sourcefilter"); -- Set IPv4 source filter. function setipv4sourcefilter (uu_s : int; uu_interface_addr : in_addr; uu_group : in_addr; uu_fmode : CUPS.stdint_h.uint32_t; uu_numsrc : CUPS.stdint_h.uint32_t; uu_slist : access constant in_addr) return int; -- netinet/in.h:609 pragma Import (C, setipv4sourcefilter, "setipv4sourcefilter"); -- Get source filter. function getsourcefilter (uu_s : int; uu_interface_addr : CUPS.stdint_h.uint32_t; uu_group : access constant CUPS.bits_socket_h.sockaddr; uu_grouplen : CUPS.unistd_h.socklen_t; uu_fmode : access CUPS.stdint_h.uint32_t; uu_numsrc : access CUPS.stdint_h.uint32_t; uu_slist : access sockaddr_storage) return int; -- netinet/in.h:617 pragma Import (C, getsourcefilter, "getsourcefilter"); -- Set source filter. function setsourcefilter (uu_s : int; uu_interface_addr : CUPS.stdint_h.uint32_t; uu_group : access constant CUPS.bits_socket_h.sockaddr; uu_grouplen : CUPS.unistd_h.socklen_t; uu_fmode : CUPS.stdint_h.uint32_t; uu_numsrc : CUPS.stdint_h.uint32_t; uu_slist : access constant sockaddr_storage) return int; -- netinet/in.h:624 pragma Import (C, setsourcefilter, "setsourcefilter"); end CUPS.netinet_in_h;
mips_generator/Rose.g4
ian910297/compiler
0
5046
grammar Rose; options { language = Java; } @header { import java.util.*; import java.io.*; } @members { private int label = 0; private int reg = 0; private int if_index = 0; private int [] if_true = new int [100]; private int [] if_false = new int [100]; private int [] if_break = new int [100]; private int for_index = 0; private int [] for_start = new int [100]; private int [] for_end = new int [100]; private int debugPrintReg(int target) { System.out.println("move\t\$a0, \$t" + (target)); System.out.println("li\t\$v0, 1"); System.out.println("syscall"); //ascii code for LF, if you have any trouble try 0xD for CR. System.out.println("addi\t\$a0, \$0, 0xA"); //syscall 11 prints the lower 8 bits of \$a0 as an ascii character. System.out.println("addi\t\$v0, \$0, 0xB"); System.out.println("syscall"); return 0; } private int newline() { //ascii code for LF, if you have any trouble try 0xD for CR. System.out.println("addi\t\$a0, \$0, 0xA"); //syscall 11 prints the lower 8 bits of \$a0 as an ascii character. System.out.println("addi\t\$v0, \$0, 0xB"); System.out.println("syscall"); return 0; } } // Parser Rules program : PROCEDURE Identifier IS { System.out.println(".data"); } DECLARE variables { System.out.println(".text"); System.out.println("main:"); } BEGIN statements END Semi; variables : variables variable | /* eplison */ ; variable : Identifier ':' 'integer' ';' { System.out.println($Identifier.text + ":\t.word\t0"); } ; statements : statements statement | /* eplison */ ; statement : ( assignment_statement | if_statement | for_statement | exit_statement | read_statement | write_statement ) ; assignment_statement : Identifier { System.out.println("la\t\$t" + reg + ", " + $Identifier.text); reg++; } ':=' arith_expression ';' { System.out.println("sw\t\$t" + (reg-1) + ", 0(\$t" + (reg-2) + ")"); reg = reg - 2; } ; if_statement : ( 'if' bool_expression 'then' { if_true[if_index] = label++; if_false[if_index] = label++; if_break[if_index] = label++; reg--; System.out.println("bne\t\$t" + reg + ", \$zero, L" + if_true[if_index]); System.out.println("j L" + if_break[if_index]); System.out.println("L" + if_true[if_index] + ":"); if_index++; } statements { if_index--; System.out.println("L" + if_break[if_index] + ":"); } 'end' 'if' ';' | 'if' bool_expression 'then' { if_true[if_index] = label++; if_false[if_index] = label++; if_break[if_index] = label++; reg--; System.out.println("bne\t\$t" + reg + ", \$zero, L" + if_true[if_index]); System.out.println("j L" + if_false[if_index]); System.out.println("L" + if_true[if_index] + ":"); if_index++; } statements 'else' { if_index--; System.out.println("j L" + if_break[if_index]); System.out.println("L" + if_false[if_index] + ":"); if_index++; } statements 'end' 'if' ';' { if_index--; System.out.println("L" + if_break[if_index] + ":"); } ) ; for_statement : 'for' Identifier 'in' arith_expression '..' arith_expression 'loop' { for_start[for_index] = label++; for_end[for_index] = label++; System.out.println("la\t\$t" + reg + ", " + $Identifier.text); System.out.println("sw\t\$t" + (reg-2) + ", 0(\$t" + reg + ")"); System.out.println("beq\t\$t" + (reg-2) + ", \$t" + (reg-1) + ", L" + for_end[for_index]); System.out.println("L" + for_start[for_index] + ":"); for_index++; } statements { for_index--; System.out.println("la\t\$t" + reg + ", " + $Identifier.text); System.out.println("lw\t\$t" + (reg-2) + ", 0(\$t" + reg + ")"); System.out.println("sub\t\$t" + (reg+1) + ", \$t" + (reg-2) + ", \$t" + (reg-1)); System.out.println("bgtz\t\$t" + (reg+1) + ", L" + for_end[for_index]); System.out.println("addi\t\$t" + (reg-2) + ", \$t" + (reg-2) + ", 1"); System.out.println("sw\t\$t" + (reg-2) + ", 0(\$t" + reg + ")"); System.out.println("sub\t\$t" + (reg+1) + ", \$t" + (reg-2) + ", \$t" + (reg-1)); System.out.println("bgtz\t\$t" + (reg+1) + ", L" + for_end[for_index]); System.out.println("j L" + for_start[for_index]); System.out.println("L" + for_end[for_index] + ":"); reg -= 2; } 'end' 'loop' ';' ; exit_statement : 'exit' ';' { System.out.println("li\t\$v0, 10"); System.out.println("syscall"); } ; read_statement : 'read' Identifier ';' { System.out.println("li\t\$v0, 5"); System.out.println("syscall"); System.out.println("la\t\$t" + reg + ", " + $Identifier.text); System.out.println("sw\t\$v0, 0(\$t" + reg + ")"); } ; write_statement : 'write' arith_expression ';' { System.out.println("move \t\$a0, \$t" + (reg-1)); System.out.println("li\t\$v0, 1"); System.out.println("syscall"); reg--; } ; bool_expression : bool_term bool_expression_R ; bool_expression_R : '||' bool_term bool_expression_R { System.out.println("or\t\$t" + (reg-2) + ", \$t" + (reg-2) + ", \$t" + (reg-1)); reg--; } | ; bool_term : bool_factor bool_term_R ; bool_term_R : '&&' bool_factor bool_term_R { System.out.println("and\t\$t" + (reg-2) + ", \$t" + (reg-2) + ", \$t" + (reg-1)); reg--; } | ; bool_factor : ( '!' bool_primary { System.out.println("beq\t\$zero, \$t" + (reg-1) + ", L" + label); System.out.println("j L" + (label+1)); System.out.println("L" + label + ":"); System.out.println("addi\t\$t" + (reg-1) + ", \$zero, 1"); System.out.println("j L" + (label+2)); System.out.println("L" + (label+1) + ":"); System.out.println("add\t\$t" + (reg-1) + ", \$zero, \$zero"); System.out.println("L" + (label+2) + ":"); label += 3; } | bool_primary ) ; bool_primary : arith_expression relation_op arith_expression { // TRUE RETURN 1 System.out.println("sub\t\$t" + (reg-2) + ", \$t" + (reg-2) + ", \$t" + (reg-1)); if($relation_op.text.equals("=")) { System.out.println("beq\t\$zero, \$t" + (reg-2) + ", L" + label); } else if($relation_op.text.equals("<>")) { System.out.println("bne\t\$zero, \$t" + (reg-2) + ", L" + label); } else if($relation_op.text.equals("<")) { System.out.println("bltz\t\$t" + (reg-2) + ", L" + label); } else if($relation_op.text.equals(">")) { System.out.println("bgtz\t\$t" + (reg-2) + ", L" + label); } else if($relation_op.text.equals("<=")) { System.out.println("blez\t\$t" + (reg-2) + ", L" + label); } else if($relation_op.text.equals(">=")) { System.out.println("bgez\t\$t" + (reg-2) + ", L" + label); } System.out.println("j L" + (label+1)); System.out.println("L" + label + ":"); System.out.println("addi\t\$t" + (reg-2) + ", \$zero, 1"); System.out.println("j L" + (label+2)); System.out.println("L" + (label+1) + ":"); System.out.println("add\t\$t" + (reg-2) + ", \$zero, \$zero"); System.out.println("L" + (label+2) + ":"); label += 3; reg--; } ; relation_op : '=' | '<>' | '>' | '>=' | '<' | '<=' ; arith_expression : arith_term arith_expression_R ; arith_expression_R : '+' arith_term arith_expression_R { System.out.println("add\t\$t" + (reg-2) + ", \$t" + (reg-2) + ", \$t" + (reg-1)); reg--; } | '-' arith_term arith_expression_R { System.out.println("sub\t\$t" + (reg-2) + ", \$t" + (reg-2) + ", \$t" + (reg-1)); reg--; } | ; arith_term : arith_factor arith_term_R ; arith_term_R : '*' arith_factor arith_term_R { System.out.println("mult\t\$t" + (reg-2) + ", \$t" + (reg-1)); System.out.println("mflo\t\$t" + (reg-2)); reg--; } | '/' arith_factor arith_term_R { System.out.println("div\t\$t" + (reg-2) + ", \$t" + (reg-1)); System.out.println("mflo\t\$t" + (reg-2)); reg--; } | '%' arith_factor arith_term_R { System.out.println("div\t\$t" + (reg-2) + ", \$t" + (reg-1)); System.out.println("mfhi\t\$t" + (reg-2)); reg--; } | ; arith_factor : ( '-' arith_primary { System.out.println("li\t\$t" + reg + ", 0"); System.out.println("sub\t\$t" + (reg-1) + ", \$t" + (reg-1) + ", \$t" + (reg-1)); System.out.println("sub\t\$t" + (reg-1) + ", \$t" + (reg-1) + ", \$t" + (reg-1)); } | arith_primary ) ; arith_primary : ( Constant { System.out.println("li\t\$t" + reg + ", " + $Constant.text); reg++; } | Identifier { System.out.println("la\t\$t" + (reg+1) + ", " +$Identifier.text); System.out.println("lw\t\$t" + reg + ", 0(\$t" + (reg+1) + ")"); reg++; } | '(' arith_expression ')' ) ; Identifier : ( Uppercase | '_' ) ( Uppercase | '_' | Digit )* ; Constant : ( NonzeroDigit Digit* | Digit ) ; // Lexer Rule // Identifier Element fragment Uppercase : [A-Z] ; fragment Underscore : '_' ; fragment NonzeroDigit : [1-9] ; fragment Digit : [0-9] ; // Keywords PROCEDURE: 'procedure'; IS: 'is'; DECLARE: 'declare'; BEGIN: 'begin'; END: 'end'; // Operators LeftParen : '('; RightParen : ')'; Assign : ':='; Colon : ':'; Semi : ';'; DotDot : '..'; Plus : '+'; Minus : '-'; Star : '*'; Div : '/'; Mod : '%'; Less : '<'; LessEqual : '<='; Greater : '>'; GreaterEqual : '>='; Not : '!'; AndAnd : '&&'; OrOr : '||'; // Skip Whitespace : [ \t]+ -> skip ; Newline : ( '\r''\n'? | '\n' ) ->skip ; BlockComment : '/*' .*? '*/' -> skip ; LineComment : '//' ~[\r\n]* -> skip ;
test/asset/agda-stdlib-1.0/Data/Product/Relation/Binary/Pointwise/Dependent.agda
omega12345/agda-mode
5
1188
------------------------------------------------------------------------ -- The Agda standard library -- -- Pointwise lifting of binary relations to sigma types ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.Product.Relation.Binary.Pointwise.Dependent where open import Data.Product as Prod open import Level open import Function open import Relation.Binary as B using (_⇒_; Setoid; IsEquivalence) open import Relation.Binary.Indexed.Heterogeneous as I using (IREL; IRel; IndexedSetoid; IsIndexedEquivalence) open import Relation.Binary.PropositionalEquality as P using (_≡_) ------------------------------------------------------------------------ -- Pointwise lifting infixr 4 _,_ record POINTWISE {a₁ a₂ b₁ b₂ ℓ₁ ℓ₂} {A₁ : Set a₁} (B₁ : A₁ → Set b₁) {A₂ : Set a₂} (B₂ : A₂ → Set b₂) (_R₁_ : B.REL A₁ A₂ ℓ₁) (_R₂_ : IREL B₁ B₂ ℓ₂) (xy₁ : Σ A₁ B₁) (xy₂ : Σ A₂ B₂) : Set (a₁ ⊔ a₂ ⊔ b₁ ⊔ b₂ ⊔ ℓ₁ ⊔ ℓ₂) where constructor _,_ field proj₁ : (proj₁ xy₁) R₁ (proj₁ xy₂) proj₂ : (proj₂ xy₁) R₂ (proj₂ xy₂) open POINTWISE public Pointwise : ∀ {a b ℓ₁ ℓ₂} {A : Set a} (B : A → Set b) (_R₁_ : B.Rel A ℓ₁) (_R₂_ : IRel B ℓ₂) → B.Rel (Σ A B) _ Pointwise B = POINTWISE B B ------------------------------------------------------------------------ -- Pointwise preserves many relational properties module _ {a b ℓ₁ ℓ₂} {A : Set a} {B : A → Set b} {R : B.Rel A ℓ₁} {S : IRel B ℓ₂} where private R×S = Pointwise B R S refl : B.Reflexive R → I.Reflexive B S → B.Reflexive R×S refl refl₁ refl₂ = (refl₁ , refl₂) symmetric : B.Symmetric R → I.Symmetric B S → B.Symmetric R×S symmetric sym₁ sym₂ (x₁Rx₂ , y₁Ry₂) = (sym₁ x₁Rx₂ , sym₂ y₁Ry₂) transitive : B.Transitive R → I.Transitive B S → B.Transitive R×S transitive trans₁ trans₂ (x₁Rx₂ , y₁Ry₂) (x₂Rx₃ , y₂Ry₃) = (trans₁ x₁Rx₂ x₂Rx₃ , trans₂ y₁Ry₂ y₂Ry₃) isEquivalence : IsEquivalence R → IsIndexedEquivalence B S → IsEquivalence R×S isEquivalence eq₁ eq₂ = record { refl = refl Eq.refl IEq.refl ; sym = symmetric Eq.sym IEq.sym ; trans = transitive Eq.trans IEq.trans } where module Eq = IsEquivalence eq₁ module IEq = IsIndexedEquivalence eq₂ module _ {a b ℓ₁ ℓ₂} where setoid : (A : Setoid a ℓ₁) → IndexedSetoid (Setoid.Carrier A) b ℓ₂ → Setoid _ _ setoid s₁ s₂ = record { isEquivalence = isEquivalence Eq.isEquivalence IEq.isEquivalence } where module Eq = Setoid s₁ module IEq = IndexedSetoid s₂ ------------------------------------------------------------------------ -- DEPRECATED NAMES ------------------------------------------------------------------------ -- Please use the new names as continuing support for the old names is -- not guaranteed. -- Version 0.15 Rel = Pointwise {-# WARNING_ON_USAGE Rel "Warning: Rel was deprecated in v0.15. Please use Pointwise instead." #-} -- Version 0.15 REL = POINTWISE {-# WARNING_ON_USAGE REL "Warning: REL was deprecated in v1.0. Please use POINTWISE instead." #-}
Task/XML-Input/Ada/xml-input-7.ada
LaudateCorpus1/RosettaCodeData
1
26625
with Ada.Wide_Wide_Text_IO; package body Handlers is use type League.Strings.Universal_String; function "+" (Item : Wide_Wide_String) return League.Strings.Universal_String renames League.Strings.To_Universal_String; ------------------ -- Error_String -- ------------------ overriding function Error_String (Self : Handler) return League.Strings.Universal_String is begin return League.Strings.Empty_Universal_String; end Error_String; ------------------- -- Start_Element -- ------------------- overriding procedure Start_Element (Self : in out Handler; Namespace_URI : League.Strings.Universal_String; Local_Name : League.Strings.Universal_String; Qualified_Name : League.Strings.Universal_String; Attributes : XML.SAX.Attributes.SAX_Attributes; Success : in out Boolean) is begin if Qualified_Name = +"Student" then Ada.Wide_Wide_Text_IO.Put_Line (Attributes.Value (+"Name").To_Wide_Wide_String); end if; end Start_Element; end Handlers;
oeis/065/A065652.asm
neoneye/loda-programs
11
166983
<filename>oeis/065/A065652.asm ; A065652: a(0) = 0 and a(n+1) = if a(n) - 1 is new and > 0 then a(n) - 1 else a(n)*a(n) + 1 for n >= 0. ; Submitted by <NAME> ; 0,1,2,5,4,3,10,9,8,7,6,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,122,121,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,99,98,97 lpb $0 sub $0,1 sub $0,$3 add $2,1 mul $4,2 sub $4,$3 mov $3,$4 mov $4,$2 add $2,$3 bin $4,2 lpe sub $2,$0 mov $0,$2
Task/Distributed-programming/Ada/distributed-programming-2.ada
LaudateCorpus1/RosettaCodeData
1
10142
<filename>Task/Distributed-programming/Ada/distributed-programming-2.ada package body Server is Count : Natural := 0; procedure Foo is begin Count := Count + 1; end Foo; function Bar return Natural is begin return Count; end Bar; end Server;