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
3-mid/opengl/source/lean/model/opengl-model-arrow.ads
charlie5/lace
20
566
<filename>3-mid/opengl/source/lean/model/opengl-model-arrow.ads<gh_stars>10-100 package openGL.Model.arrow -- -- Models an arrow. -- is type Item is abstract new openGL.Model.item with private; private type Item is abstract new openGL.Model.item with null record; end openGL.Model.arrow;
Applications/Google-Chrome/window/front window/front window.applescript
looking-for-a-job/applescript-examples
1
2277
<reponame>looking-for-a-job/applescript-examples<filename>Applications/Google-Chrome/window/front window/front window.applescript tell application "Google Chrome" if count of windows>0 then get properties of front window zoomed of front window presenting of front window minimized of front window name of front window active tab of front window active tab of front window minimizable of front window mode of front window minimizable of front window class of front window closeable of front window resizable of front window visible of front window zoomable of front window bounds of front window index of front window active tab index of front window else return "no windows" end if end tell
Categories/Functor/Algebra.agda
copumpkin/categories
98
15062
<filename>Categories/Functor/Algebra.agda {-# OPTIONS --universe-polymorphism #-} module Categories.Functor.Algebra where open import Level hiding (lift) open import Categories.Category open import Categories.Functor record F-Algebra {o ℓ e} {C : Category o ℓ e} (F : Endofunctor C) : Set (o ⊔ ℓ) where constructor _,_ open Category C open Functor F field A : Obj α : F₀ A ⇒ A lift : ∀ {o ℓ e} {C : Category o ℓ e} {F : Endofunctor C} → F-Algebra F → F-Algebra F lift {F = F} (A , α) = record { A = F₀ A; α = F₁ α } where open Functor F
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1808.asm
ljhsiun2/medusa
9
3123
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r14 push %r8 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_D_ht+0x1d53f, %r13 nop nop nop nop nop sub $51579, %rbp vmovups (%r13), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $0, %xmm6, %rax nop nop nop sub %rsi, %rsi lea addresses_WC_ht+0x18fbf, %r14 nop nop dec %r8 movb (%r14), %r11b nop nop nop nop xor $21753, %r13 lea addresses_D_ht+0xd35f, %rsi lea addresses_A_ht+0x198bf, %rdi clflush (%rsi) nop nop nop nop nop inc %r13 mov $87, %rcx rep movsq and %r13, %r13 lea addresses_WT_ht+0x6751, %r8 clflush (%r8) nop nop nop cmp %rsi, %rsi mov (%r8), %eax nop nop nop add $30547, %r14 lea addresses_normal_ht+0xa1, %r13 nop nop sub %rcx, %rcx movw $0x6162, (%r13) nop add %r13, %r13 lea addresses_A_ht+0x9bc3, %r11 sub $62739, %rdi mov (%r11), %rsi sub $10508, %rdi lea addresses_WC_ht+0xcb3f, %rbp nop nop nop nop and $60063, %r14 mov $0x6162636465666768, %rcx movq %rcx, %xmm7 vmovups %ymm7, (%rbp) nop nop add %r13, %r13 lea addresses_normal_ht+0x1353f, %rax nop add %rdi, %rdi mov $0x6162636465666768, %r14 movq %r14, %xmm6 movups %xmm6, (%rax) nop nop nop nop nop cmp %rcx, %rcx lea addresses_A_ht+0x4d1f, %rcx nop nop sub %r14, %r14 mov $0x6162636465666768, %rbp movq %rbp, (%rcx) nop nop nop sub $43668, %rbp lea addresses_D_ht+0xa1af, %r13 nop nop nop dec %rcx mov $0x6162636465666768, %rsi movq %rsi, %xmm1 vmovups %ymm1, (%r13) nop nop nop nop nop add %r13, %r13 lea addresses_A_ht+0x323f, %rsi clflush (%rsi) nop nop nop nop sub $55323, %r14 mov $0x6162636465666768, %r8 movq %r8, %xmm2 movups %xmm2, (%rsi) nop dec %r8 lea addresses_A_ht+0x1dc4b, %rsi lea addresses_WT_ht+0x17d97, %rdi inc %rbp mov $0, %rcx rep movsb nop nop nop nop cmp %rdi, %rdi lea addresses_D_ht+0x1d73f, %rsi lea addresses_WC_ht+0x8f3f, %rdi nop nop cmp $6740, %r11 mov $23, %rcx rep movsq nop add $59939, %rcx pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r8 pop %r14 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r14 push %rdx push %rsi // Faulty Load lea addresses_WC+0x1823f, %r14 nop nop nop nop nop add %r10, %r10 mov (%r14), %r13 lea oracles, %rdx and $0xff, %r13 shlq $12, %r13 mov (%rdx,%r13,1), %r13 pop %rsi pop %rdx pop %r14 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_WC', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_WC', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_D_ht', 'same': True, 'size': 32, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 2, 'NT': True, 'AVXalign': True}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'} {'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 */
programs/xtc.asm
re0ah/nameless-OS16
0
22024
;https://www.youtube.com/watch?v=Sck7ufPfOWY ;it is port of demo, author is https://www.pouet.net/prod.php?which=85670 %include "../source/syscall.inc" mov ax, 0x0100 mov bx, SYSCALL_PIT_SET_FREQUENCY int 0x20 mov si, 0x0100 push 0xa000 pop es mov ax, 0x4f02 mov bx, si int 0x10 mov bh, 0xf0 S: mov di, -1 mov bp, di mov dx, 440 Y: mov cx, 640 X: pusha mov si, dx add dx, cx sub cx, si sub dx, 560 jns G neg dx G: inc dx sub cx, byte 80 jns G2 neg cx G2: inc cx mov ax, dx cmp ax, cx jle F mov ax, cx F: push dx cwd xchg si, ax imul ax, bx, byte -16 div si pop dx imul cx, ax imul dx, ax add ax, bx or dx, cx xor al, dh sar ax, 5 and al, 3 imul ax, byte 24 push bx shr bx, 9 add ax, bx pop bx add al, -40-24-24 QQ: stosb popa inc di test di, di jnz ns inc bp pusha mov ax, 0x4f05 xor bx, bx mov dx, bp int 0x10 popa ns: loop X hlt pusha mov bx, SYSCALL_GET_KEYBOARD_DATA int 0x20 cmp al, 1 ;ESC je exit_esc popa dec dx jnz Y nm: add bx, byte 6 in al, 0x60 dec al hlt ja S jmp exit exit_esc: popa exit: ;set back video mode push 0xb800 pop es mov ax, 0x0003 int 0x10 xor ax, ax ;exit status retf
vp9/common/arm/neon/vp9_loopfilter_8_neon_asm.asm
jacklicn/webm.libvpx
25
102571
; ; Copyright (c) 2013 The WebM project authors. All Rights Reserved. ; ; Use of this source code is governed by a BSD-style license ; that can be found in the LICENSE file in the root of the source ; tree. An additional intellectual property rights grant can be found ; in the file PATENTS. All contributing project authors may ; be found in the AUTHORS file in the root of the source tree. ; EXPORT |vp9_lpf_horizontal_8_neon| EXPORT |vp9_lpf_vertical_8_neon| ARM AREA ||.text||, CODE, READONLY, ALIGN=2 ; Currently vp9 only works on iterations 8 at a time. The vp8 loop filter ; works on 16 iterations at a time. ; TODO(fgalligan): See about removing the count code as this function is only ; called with a count of 1. ; ; void vp9_lpf_horizontal_8_neon(uint8_t *s, int p, ; const uint8_t *blimit, ; const uint8_t *limit, ; const uint8_t *thresh, ; int count) ; r0 uint8_t *s, ; r1 int p, /* pitch */ ; r2 const uint8_t *blimit, ; r3 const uint8_t *limit, ; sp const uint8_t *thresh, ; sp+4 int count |vp9_lpf_horizontal_8_neon| PROC push {r4-r5, lr} vld1.8 {d0[]}, [r2] ; duplicate *blimit ldr r12, [sp, #16] ; load count ldr r2, [sp, #12] ; load thresh add r1, r1, r1 ; double pitch cmp r12, #0 beq end_vp9_mblf_h_edge vld1.8 {d1[]}, [r3] ; duplicate *limit vld1.8 {d2[]}, [r2] ; duplicate *thresh count_mblf_h_loop sub r3, r0, r1, lsl #1 ; move src pointer down by 4 lines add r2, r3, r1, lsr #1 ; set to 3 lines down vld1.u8 {d3}, [r3@64], r1 ; p3 vld1.u8 {d4}, [r2@64], r1 ; p2 vld1.u8 {d5}, [r3@64], r1 ; p1 vld1.u8 {d6}, [r2@64], r1 ; p0 vld1.u8 {d7}, [r3@64], r1 ; q0 vld1.u8 {d16}, [r2@64], r1 ; q1 vld1.u8 {d17}, [r3@64] ; q2 vld1.u8 {d18}, [r2@64], r1 ; q3 sub r3, r3, r1, lsl #1 sub r2, r2, r1, lsl #2 bl vp9_mbloop_filter_neon vst1.u8 {d0}, [r2@64], r1 ; store op2 vst1.u8 {d1}, [r3@64], r1 ; store op1 vst1.u8 {d2}, [r2@64], r1 ; store op0 vst1.u8 {d3}, [r3@64], r1 ; store oq0 vst1.u8 {d4}, [r2@64], r1 ; store oq1 vst1.u8 {d5}, [r3@64], r1 ; store oq2 add r0, r0, #8 subs r12, r12, #1 bne count_mblf_h_loop end_vp9_mblf_h_edge pop {r4-r5, pc} ENDP ; |vp9_lpf_horizontal_8_neon| ; void vp9_lpf_vertical_8_neon(uint8_t *s, ; int pitch, ; const uint8_t *blimit, ; const uint8_t *limit, ; const uint8_t *thresh, ; int count) ; ; r0 uint8_t *s, ; r1 int pitch, ; r2 const uint8_t *blimit, ; r3 const uint8_t *limit, ; sp const uint8_t *thresh, ; sp+4 int count |vp9_lpf_vertical_8_neon| PROC push {r4-r5, lr} vld1.8 {d0[]}, [r2] ; duplicate *blimit ldr r12, [sp, #16] ; load count vld1.8 {d1[]}, [r3] ; duplicate *limit ldr r3, [sp, #12] ; load thresh sub r2, r0, #4 ; move s pointer down by 4 columns cmp r12, #0 beq end_vp9_mblf_v_edge vld1.8 {d2[]}, [r3] ; duplicate *thresh count_mblf_v_loop vld1.u8 {d3}, [r2], r1 ; load s data vld1.u8 {d4}, [r2], r1 vld1.u8 {d5}, [r2], r1 vld1.u8 {d6}, [r2], r1 vld1.u8 {d7}, [r2], r1 vld1.u8 {d16}, [r2], r1 vld1.u8 {d17}, [r2], r1 vld1.u8 {d18}, [r2] ;transpose to 8x16 matrix vtrn.32 d3, d7 vtrn.32 d4, d16 vtrn.32 d5, d17 vtrn.32 d6, d18 vtrn.16 d3, d5 vtrn.16 d4, d6 vtrn.16 d7, d17 vtrn.16 d16, d18 vtrn.8 d3, d4 vtrn.8 d5, d6 vtrn.8 d7, d16 vtrn.8 d17, d18 sub r2, r0, #3 add r3, r0, #1 bl vp9_mbloop_filter_neon ;store op2, op1, op0, oq0 vst4.8 {d0[0], d1[0], d2[0], d3[0]}, [r2], r1 vst4.8 {d0[1], d1[1], d2[1], d3[1]}, [r2], r1 vst4.8 {d0[2], d1[2], d2[2], d3[2]}, [r2], r1 vst4.8 {d0[3], d1[3], d2[3], d3[3]}, [r2], r1 vst4.8 {d0[4], d1[4], d2[4], d3[4]}, [r2], r1 vst4.8 {d0[5], d1[5], d2[5], d3[5]}, [r2], r1 vst4.8 {d0[6], d1[6], d2[6], d3[6]}, [r2], r1 vst4.8 {d0[7], d1[7], d2[7], d3[7]}, [r2] ;store oq1, oq2 vst2.8 {d4[0], d5[0]}, [r3], r1 vst2.8 {d4[1], d5[1]}, [r3], r1 vst2.8 {d4[2], d5[2]}, [r3], r1 vst2.8 {d4[3], d5[3]}, [r3], r1 vst2.8 {d4[4], d5[4]}, [r3], r1 vst2.8 {d4[5], d5[5]}, [r3], r1 vst2.8 {d4[6], d5[6]}, [r3], r1 vst2.8 {d4[7], d5[7]}, [r3] add r0, r0, r1, lsl #3 ; s += pitch * 8 subs r12, r12, #1 subne r2, r0, #4 ; move s pointer down by 4 columns bne count_mblf_v_loop end_vp9_mblf_v_edge pop {r4-r5, pc} ENDP ; |vp9_lpf_vertical_8_neon| ; void vp9_mbloop_filter_neon(); ; This is a helper function for the loopfilters. The invidual functions do the ; necessary load, transpose (if necessary) and store. The function does not use ; registers d8-d15. ; ; Inputs: ; r0-r3, r12 PRESERVE ; d0 blimit ; d1 limit ; d2 thresh ; d3 p3 ; d4 p2 ; d5 p1 ; d6 p0 ; d7 q0 ; d16 q1 ; d17 q2 ; d18 q3 ; ; Outputs: ; d0 op2 ; d1 op1 ; d2 op0 ; d3 oq0 ; d4 oq1 ; d5 oq2 |vp9_mbloop_filter_neon| PROC ; filter_mask vabd.u8 d19, d3, d4 ; m1 = abs(p3 - p2) vabd.u8 d20, d4, d5 ; m2 = abs(p2 - p1) vabd.u8 d21, d5, d6 ; m3 = abs(p1 - p0) vabd.u8 d22, d16, d7 ; m4 = abs(q1 - q0) vabd.u8 d23, d17, d16 ; m5 = abs(q2 - q1) vabd.u8 d24, d18, d17 ; m6 = abs(q3 - q2) ; only compare the largest value to limit vmax.u8 d19, d19, d20 ; m1 = max(m1, m2) vmax.u8 d20, d21, d22 ; m2 = max(m3, m4) vabd.u8 d25, d6, d4 ; m7 = abs(p0 - p2) vmax.u8 d23, d23, d24 ; m3 = max(m5, m6) vabd.u8 d26, d7, d17 ; m8 = abs(q0 - q2) vmax.u8 d19, d19, d20 vabd.u8 d24, d6, d7 ; m9 = abs(p0 - q0) vabd.u8 d27, d3, d6 ; m10 = abs(p3 - p0) vabd.u8 d28, d18, d7 ; m11 = abs(q3 - q0) vmax.u8 d19, d19, d23 vabd.u8 d23, d5, d16 ; a = abs(p1 - q1) vqadd.u8 d24, d24, d24 ; b = abs(p0 - q0) * 2 ; abs () > limit vcge.u8 d19, d1, d19 ; only compare the largest value to thresh vmax.u8 d25, d25, d26 ; m4 = max(m7, m8) vmax.u8 d26, d27, d28 ; m5 = max(m10, m11) vshr.u8 d23, d23, #1 ; a = a / 2 vmax.u8 d25, d25, d26 ; m4 = max(m4, m5) vqadd.u8 d24, d24, d23 ; a = b + a vmax.u8 d20, d20, d25 ; m2 = max(m2, m4) vmov.u8 d23, #1 vcge.u8 d24, d0, d24 ; a > blimit vcgt.u8 d21, d21, d2 ; (abs(p1 - p0) > thresh)*-1 vcge.u8 d20, d23, d20 ; flat vand d19, d19, d24 ; mask vcgt.u8 d23, d22, d2 ; (abs(q1 - q0) > thresh)*-1 vand d20, d20, d19 ; flat & mask vmov.u8 d22, #0x80 vorr d23, d21, d23 ; hev ; This instruction will truncate the "flat & mask" masks down to 4 bits ; each to fit into one 32 bit arm register. The values are stored in ; q10.64[0]. vshrn.u16 d30, q10, #4 vmov.u32 r4, d30[0] ; flat & mask 4bits adds r5, r4, #1 ; Check for all 1's ; If mask and flat are 1's for all vectors, then we only need to execute ; the power branch for all vectors. beq power_branch_only cmp r4, #0 ; Check for 0, set flag for later ; mbfilter() function ; filter() function ; convert to signed veor d21, d7, d22 ; qs0 veor d24, d6, d22 ; ps0 veor d25, d5, d22 ; ps1 veor d26, d16, d22 ; qs1 vmov.u8 d27, #3 vsub.s8 d28, d21, d24 ; ( qs0 - ps0) vqsub.s8 d29, d25, d26 ; filter = clamp(ps1-qs1) vmull.s8 q15, d28, d27 ; 3 * ( qs0 - ps0) vand d29, d29, d23 ; filter &= hev vaddw.s8 q15, q15, d29 ; filter + 3 * (qs0 - ps0) vmov.u8 d29, #4 ; filter = clamp(filter + 3 * ( qs0 - ps0)) vqmovn.s16 d28, q15 vand d28, d28, d19 ; filter &= mask vqadd.s8 d30, d28, d27 ; filter2 = clamp(filter+3) vqadd.s8 d29, d28, d29 ; filter1 = clamp(filter+4) vshr.s8 d30, d30, #3 ; filter2 >>= 3 vshr.s8 d29, d29, #3 ; filter1 >>= 3 vqadd.s8 d24, d24, d30 ; op0 = clamp(ps0 + filter2) vqsub.s8 d21, d21, d29 ; oq0 = clamp(qs0 - filter1) ; outer tap adjustments: ++filter1 >> 1 vrshr.s8 d29, d29, #1 vbic d29, d29, d23 ; filter &= ~hev vqadd.s8 d25, d25, d29 ; op1 = clamp(ps1 + filter) vqsub.s8 d26, d26, d29 ; oq1 = clamp(qs1 - filter) ; If mask and flat are 0's for all vectors, then we only need to execute ; the filter branch for all vectors. beq filter_branch_only ; If mask and flat are mixed then we must perform both branches and ; combine the data. veor d24, d24, d22 ; *f_op0 = u^0x80 veor d21, d21, d22 ; *f_oq0 = u^0x80 veor d25, d25, d22 ; *f_op1 = u^0x80 veor d26, d26, d22 ; *f_oq1 = u^0x80 ; At this point we have already executed the filter branch. The filter ; branch does not set op2 or oq2, so use p2 and q2. Execute the power ; branch and combine the data. vmov.u8 d23, #2 vaddl.u8 q14, d6, d7 ; r_op2 = p0 + q0 vmlal.u8 q14, d3, d27 ; r_op2 += p3 * 3 vmlal.u8 q14, d4, d23 ; r_op2 += p2 * 2 vbif d0, d4, d20 ; op2 |= p2 & ~(flat & mask) vaddw.u8 q14, d5 ; r_op2 += p1 vbif d1, d25, d20 ; op1 |= f_op1 & ~(flat & mask) vqrshrn.u16 d30, q14, #3 ; r_op2 vsubw.u8 q14, d3 ; r_op1 = r_op2 - p3 vsubw.u8 q14, d4 ; r_op1 -= p2 vaddw.u8 q14, d5 ; r_op1 += p1 vaddw.u8 q14, d16 ; r_op1 += q1 vbif d2, d24, d20 ; op0 |= f_op0 & ~(flat & mask) vqrshrn.u16 d31, q14, #3 ; r_op1 vsubw.u8 q14, d3 ; r_op0 = r_op1 - p3 vsubw.u8 q14, d5 ; r_op0 -= p1 vaddw.u8 q14, d6 ; r_op0 += p0 vaddw.u8 q14, d17 ; r_op0 += q2 vbit d0, d30, d20 ; op2 |= r_op2 & (flat & mask) vqrshrn.u16 d23, q14, #3 ; r_op0 vsubw.u8 q14, d3 ; r_oq0 = r_op0 - p3 vsubw.u8 q14, d6 ; r_oq0 -= p0 vaddw.u8 q14, d7 ; r_oq0 += q0 vbit d1, d31, d20 ; op1 |= r_op1 & (flat & mask) vaddw.u8 q14, d18 ; oq0 += q3 vbit d2, d23, d20 ; op0 |= r_op0 & (flat & mask) vqrshrn.u16 d22, q14, #3 ; r_oq0 vsubw.u8 q14, d4 ; r_oq1 = r_oq0 - p2 vsubw.u8 q14, d7 ; r_oq1 -= q0 vaddw.u8 q14, d16 ; r_oq1 += q1 vbif d3, d21, d20 ; oq0 |= f_oq0 & ~(flat & mask) vaddw.u8 q14, d18 ; r_oq1 += q3 vbif d4, d26, d20 ; oq1 |= f_oq1 & ~(flat & mask) vqrshrn.u16 d6, q14, #3 ; r_oq1 vsubw.u8 q14, d5 ; r_oq2 = r_oq1 - p1 vsubw.u8 q14, d16 ; r_oq2 -= q1 vaddw.u8 q14, d17 ; r_oq2 += q2 vaddw.u8 q14, d18 ; r_oq2 += q3 vbif d5, d17, d20 ; oq2 |= q2 & ~(flat & mask) vqrshrn.u16 d7, q14, #3 ; r_oq2 vbit d3, d22, d20 ; oq0 |= r_oq0 & (flat & mask) vbit d4, d6, d20 ; oq1 |= r_oq1 & (flat & mask) vbit d5, d7, d20 ; oq2 |= r_oq2 & (flat & mask) bx lr power_branch_only vmov.u8 d27, #3 vmov.u8 d21, #2 vaddl.u8 q14, d6, d7 ; op2 = p0 + q0 vmlal.u8 q14, d3, d27 ; op2 += p3 * 3 vmlal.u8 q14, d4, d21 ; op2 += p2 * 2 vaddw.u8 q14, d5 ; op2 += p1 vqrshrn.u16 d0, q14, #3 ; op2 vsubw.u8 q14, d3 ; op1 = op2 - p3 vsubw.u8 q14, d4 ; op1 -= p2 vaddw.u8 q14, d5 ; op1 += p1 vaddw.u8 q14, d16 ; op1 += q1 vqrshrn.u16 d1, q14, #3 ; op1 vsubw.u8 q14, d3 ; op0 = op1 - p3 vsubw.u8 q14, d5 ; op0 -= p1 vaddw.u8 q14, d6 ; op0 += p0 vaddw.u8 q14, d17 ; op0 += q2 vqrshrn.u16 d2, q14, #3 ; op0 vsubw.u8 q14, d3 ; oq0 = op0 - p3 vsubw.u8 q14, d6 ; oq0 -= p0 vaddw.u8 q14, d7 ; oq0 += q0 vaddw.u8 q14, d18 ; oq0 += q3 vqrshrn.u16 d3, q14, #3 ; oq0 vsubw.u8 q14, d4 ; oq1 = oq0 - p2 vsubw.u8 q14, d7 ; oq1 -= q0 vaddw.u8 q14, d16 ; oq1 += q1 vaddw.u8 q14, d18 ; oq1 += q3 vqrshrn.u16 d4, q14, #3 ; oq1 vsubw.u8 q14, d5 ; oq2 = oq1 - p1 vsubw.u8 q14, d16 ; oq2 -= q1 vaddw.u8 q14, d17 ; oq2 += q2 vaddw.u8 q14, d18 ; oq2 += q3 vqrshrn.u16 d5, q14, #3 ; oq2 bx lr filter_branch_only ; TODO(fgalligan): See if we can rearange registers so we do not need to ; do the 2 vswp. vswp d0, d4 ; op2 vswp d5, d17 ; oq2 veor d2, d24, d22 ; *op0 = u^0x80 veor d3, d21, d22 ; *oq0 = u^0x80 veor d1, d25, d22 ; *op1 = u^0x80 veor d4, d26, d22 ; *oq1 = u^0x80 bx lr ENDP ; |vp9_mbloop_filter_neon| END
_tests/trkleene/t4.g4
SKalt/Domemtech.Trash
16
1528
grammar t4; xx : 'a' xx | 'a'; yy : yy 'b' | 'b' ; zz : | 'a' | 'a' zz; z2 : | 'b' | z2 'b';
src/spawn_manager-server.ads
persan/spawn-manager
1
962
private package Spawn_Manager.Server is function Spawn (Request : Spawn_Request) return Spawn_Response; end Spawn_Manager.Server;
ProgramA.asm
MostafaEbrahimi/OnlineCoffeeMIPS-OCM-
0
21180
.code addi $a0,$a0,10 test: addi $v0,$zero,20 addi $v1,$zero,3 syscall addi $t0,$zero,10 addi $v0,$zero,10 syscall .data 11 12 13 14 15
alloy4fun_models/trashltl/models/9/JRignmCgF9RBGdxJx.als
Kaixi26/org.alloytools.alloy
0
1793
<gh_stars>0 open main pred idJRignmCgF9RBGdxJx_prop10 { always( all f:Protected | always f in Protected) } pred __repair { idJRignmCgF9RBGdxJx_prop10 } check __repair { idJRignmCgF9RBGdxJx_prop10 <=> prop10o }
src/LibraBFT/Impl/Consensus/PendingVotes.agda
LaudateCorpus1/bft-consensus-agda
0
6413
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9. Copyright (c) 2021, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl -} import LibraBFT.Impl.Consensus.ConsensusTypes.Vote as Vote import LibraBFT.Impl.Consensus.ConsensusTypes.TimeoutCertificate as TimeoutCertificate open import LibraBFT.Impl.OBM.Rust.RustTypes import LibraBFT.Impl.Types.CryptoProxies as CryptoProxies import LibraBFT.Impl.Types.LedgerInfoWithSignatures as LedgerInfoWithSignatures import LibraBFT.Impl.Types.ValidatorVerifier as ValidatorVerifier open import LibraBFT.ImplShared.Consensus.Types open import LibraBFT.ImplShared.Util.Crypto open import LibraBFT.ImplShared.Util.Dijkstra.All open import Optics.All open import Util.Hash import Util.KVMap as Map open import Util.Prelude module LibraBFT.Impl.Consensus.PendingVotes where insertVoteM : Vote → ValidatorVerifier → LBFT VoteReceptionResult insertVoteM vote vv = do let liDigest = hashLI (vote ^∙ vLedgerInfo) atv ← use (lPendingVotes ∙ pvAuthorToVote) caseMD Map.lookup (vote ^∙ vAuthor) atv of λ where (just previouslySeenVote) → ifD liDigest ≟Hash (hashLI (previouslySeenVote ^∙ vLedgerInfo)) then (do let newTimeoutVote = Vote.isTimeout vote ∧ not (Vote.isTimeout previouslySeenVote) if not newTimeoutVote then pure DuplicateVote else continue1 liDigest) else pure EquivocateVote nothing → continue1 liDigest where continue2 : U64 → LBFT VoteReceptionResult continue1 : HashValue → LBFT VoteReceptionResult continue1 liDigest = do pv ← use lPendingVotes lPendingVotes ∙ pvAuthorToVote %= Map.kvm-insert-Haskell (vote ^∙ vAuthor) vote let liWithSig = CryptoProxies.addToLi (vote ^∙ vAuthor) (vote ^∙ vSignature) (fromMaybe (LedgerInfoWithSignatures∙new (vote ^∙ vLedgerInfo) Map.empty) (Map.lookup liDigest (pv ^∙ pvLiDigestToVotes))) lPendingVotes ∙ pvLiDigestToVotes %= Map.kvm-insert-Haskell liDigest liWithSig case⊎D ValidatorVerifier.checkVotingPower vv (Map.kvm-keys (liWithSig ^∙ liwsSignatures)) of λ where (Right unit) → pure (NewQuorumCertificate (QuorumCert∙new (vote ^∙ vVoteData) liWithSig)) (Left (ErrVerify (TooLittleVotingPower votingPower _))) → continue2 votingPower (Left _) → pure VRR_TODO continue2 qcVotingPower = caseMD vote ^∙ vTimeoutSignature of λ where (just timeoutSignature) → do pv ← use lPendingVotes let partialTc = TimeoutCertificate.addSignature (vote ^∙ vAuthor) timeoutSignature (fromMaybe (TimeoutCertificate∙new (Vote.timeout vote)) (pv ^∙ pvMaybePartialTC)) lPendingVotes ∙ pvMaybePartialTC %= const (just partialTc) case⊎D ValidatorVerifier.checkVotingPower vv (Map.kvm-keys (partialTc ^∙ tcSignatures)) of λ where (Right unit) → pure (NewTimeoutCertificate partialTc) (Left (ErrVerify (TooLittleVotingPower votingPower _))) → pure (TCVoteAdded votingPower) (Left _) → pure VRR_TODO nothing → pure (QCVoteAdded qcVotingPower)
Sem4/AEIE_LAB/my1sim85-0.6.2/asm/testz5.asm
SOUMEE2000/Heritage-CSE-Codes
0
93908
; program for up/down 7-segment counter ; - with run/pause select and blinking decimal point ; - requires only ONE table ; - 7-segment is common-cathode (i/o board) ; - sseg pin on i/o board need to be pulsed ; - c0 is the common pin (pulled LO to enable) ; ; connections: ; - PA0-PA7 (8255) => D0-D7 (IOB) ; - PB0 => up/down select, 1=up, 0=down ; - PB1 => run/pause select, 1=run, 0 = pause ; - PC0 => sseg (IOB) ; - PC1 => c0 (IOB) ; ; note: this code can still be optimized... cpu "8085.tbl" org 2000h lxi sp, 4000h mvi a, 82h out 83h ; en @ LO, c0 @ LO, the rest HI mvi a, 0fch out 82h start_up: lxi h, table mvi b, 10 jmp loop start_dn: lxi h, table1 mvi b, 0 dcx h inr b loop: mvi d, 6 rep: call go_datab call delay call go_data call delay sw: in 81h ani 03h mov c, a ; save it first ani 02h jz rep dcr d jnz rep mov a, c ani 01h jz go_dn go_up: mov a,b ora a jz start_up inx h dcr b jnz loop jmp start_up go_dn: mov a,b cpi 10 jz start_dn dcx h inr b mov a,b cpi 11 jc loop jmp start_dn go_datab: mov a, m xri 01h jmp latch go_data: mov a, m latch: out 80h ;latch seven segment data mvi a, 00h out 83h mvi a, 01h out 83h ret delay: push psw push b lxi b, 10000 loop1: dcx b mov a, b ora c jnz loop1 pop b pop psw ret table: dfb 0fch, 60h, 0dah, 0f2h, 066h, dfb 0b6h, 0beh, 0e0h, 0feh, 0e6h table1: dfb 00h
sources/ippcp/asm_intel64/pcprij128encryptctr128pipee9as.asm
ymarkovitch/ipp-crypto
0
162889
<gh_stars>0 ;=============================================================================== ; Copyright 2015-2019 Intel Corporation ; All Rights Reserved. ; ; If this software was obtained under the Intel Simplified Software License, ; the following terms apply: ; ; The source code, information and material ("Material") contained herein is ; owned by Intel Corporation or its suppliers or licensors, and title to such ; Material remains with Intel Corporation or its suppliers or licensors. The ; Material contains proprietary information of Intel or its suppliers and ; licensors. The Material is protected by worldwide copyright laws and treaty ; provisions. No part of the Material may be used, copied, reproduced, ; modified, published, uploaded, posted, transmitted, distributed or disclosed ; in any way without Intel's prior express written permission. No license under ; any patent, copyright or other intellectual property rights in the Material ; is granted to or conferred upon you, either expressly, by implication, ; inducement, estoppel or otherwise. Any license under such intellectual ; property rights must be express and approved by Intel in writing. ; ; Unless otherwise agreed by Intel in writing, you may not remove or alter this ; notice or any other notice embedded in Materials by Intel or Intel's ; suppliers or licensors in any way. ; ; ; If this software was obtained under the Apache License, Version 2.0 (the ; "License"), the following terms apply: ; ; You may not use this file except in compliance with the License. You may ; obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 ; ; ; Unless required by applicable law or agreed to in writing, software ; distributed under the License is distributed on an "AS IS" BASIS, WITHOUT ; WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ; ; See the License for the specific language governing permissions and ; limitations under the License. ;=============================================================================== ; ; ; Purpose: Cryptography Primitive. ; Rijndael Cipher function ; ; Content: ; EncryptCTR_RIJ128pipe_AES_NI() ; ; include asmdefs.inc include ia_32e.inc include ia_32e_regs.inc include pcpvariant.inc IF (_AES_NI_ENABLING_ EQ _FEATURE_ON_) OR (_AES_NI_ENABLING_ EQ _FEATURE_TICKTOCK_) IF (_IPP32E GE _IPP32E_Y8) IPPCODE SEGMENT 'CODE' ALIGN (IPP_ALIGN_FACTOR) ;*************************************************************** ;* Purpose: pipelined RIJ128 CTR128 encryption/decryption ;* ;* ;* void EncryptStreamCTR32_AES_NI(const Ipp8u* inpBlk, ;* Ipp8u* outBlk, ;* int nr, ;* const Ipp8u* pRKey, ;* int length, ;* Ipp8u* pIV) ;*************************************************************** AES_BLOCK = (16) ALIGN IPP_ALIGN_FACTOR IPPASM EncryptStreamCTR32_AES_NI PROC PUBLIC FRAME USES_GPR rsi,rdi,rbx LOCAL_FRAME = sizeof(oword)*8 USES_XMM xmm6,xmm7,xmm8,xmm9 COMP_ABI 6 ;; rdi: pInpBlk: PTR BYTE ; pointer to the input ;; rsi: pOutBlk: PTR BYTE ; pointer to the output ;; rdx: nr: DWORD ; number of rounds ;; rcx pKey: PTR BYTE ; key material address ;; r8d length: DWORD ; length of the input ;; r9 pIV : PTR BYTE ; pointer to the iv (BE string counter representation) SC equ (4) movdqu xmm0, oword ptr[r9] ; input IV movsxd r8, r8d ; length lea r11, [r8+AES_BLOCK-1] ; r11 = blocks = ceil(len/AES_BLOCK) shr r11, 4 mov rax, qword ptr[r9+sizeof(qword)] ; input IV mov rbx, qword ptr[r9] bswap rax bswap rbx mov r10d, eax ; save ctr32 add rax, r11 ; +blocks adc rbx, 0 bswap rax bswap rbx mov qword ptr[r9+sizeof(qword)], rax ; update IV mov qword ptr[r9], rbx mov r11d, dword ptr[rcx+AES_BLOCK-sizeof(dword)] ; get whitening keys corresponding to ctr32 pxor xmm0, oword ptr[rcx] ; apply whitening keys add rcx, AES_BLOCK ; mov pointer to the round keys movdqa oword ptr[rsp+0*AES_BLOCK], xmm0 ; store unchanged part of ctr128 movdqa oword ptr[rsp+1*AES_BLOCK], xmm0 movdqa oword ptr[rsp+2*AES_BLOCK], xmm0 movdqa oword ptr[rsp+3*AES_BLOCK], xmm0 movdqa oword ptr[rsp+4*AES_BLOCK], xmm0 movdqa oword ptr[rsp+5*AES_BLOCK], xmm0 movdqa oword ptr[rsp+6*AES_BLOCK], xmm0 movdqa oword ptr[rsp+7*AES_BLOCK], xmm0 mov r9, rsp cmp r8, AES_BLOCK ; test if single block processed jle short123_input movdqa xmm1, xmm0 movdqa xmm2, xmm0 movdqa xmm3, xmm0 lea ebx, [r10d+1] ; init ctr32+1 lea eax, [r10d+2] ; init ctr32+2 lea r9d, [r10d+3] ; init ctr32+3 bswap ebx bswap eax bswap r9d xor ebx, r11d pinsrd xmm1, ebx, 3 xor eax, r11d pinsrd xmm2, eax, 3 xor r9d, r11d pinsrd xmm3, r9d, 3 movdqa oword ptr[rsp+1*AES_BLOCK], xmm1 movdqa oword ptr[rsp+2*AES_BLOCK], xmm2 movdqa oword ptr[rsp+3*AES_BLOCK], xmm3 mov r9, rsp movdqa xmm4, oword ptr[rcx+0*AES_BLOCK] ; pre load operation's keys movdqa xmm5, oword ptr[rcx+1*AES_BLOCK] cmp r8, (4*AES_BLOCK) ; test if 1-2-3 blocks processed jl short123_input jz short_input lea eax, [r10d+4] ; init ctr32+4 lea ebx, [r10d+5] ; init ctr32+5 bswap eax bswap ebx xor ebx, r11d xor eax, r11d mov dword ptr[rsp+4*AES_BLOCK+AES_BLOCK-sizeof(dword)], eax mov dword ptr[rsp+5*AES_BLOCK+AES_BLOCK-sizeof(dword)], ebx lea eax, [r10d+6] ; init ctr32+6 lea ebx, [r10d+7] ; init ctr32+7 bswap eax bswap ebx xor eax, r11d xor ebx, r11d mov dword ptr[rsp+6*AES_BLOCK+AES_BLOCK-sizeof(dword)], eax mov dword ptr[rsp+7*AES_BLOCK+AES_BLOCK-sizeof(dword)], ebx cmp r8, (8*AES_BLOCK) jl short_input ;; ;; 8-blocks processing alaivalbe ;; sub rsp, sizeof(oword)*4 ; save xmm registers movdqa oword ptr [rsp+0*sizeof(oword)], xmm10 movdqa oword ptr [rsp+1*sizeof(oword)], xmm11 movdqa oword ptr [rsp+2*sizeof(oword)], xmm12 movdqa oword ptr [rsp+3*sizeof(oword)], xmm13 push rcx ; store pointer to the key material push rdx ; store number of rounds sub r8, (8*AES_BLOCK) ALIGN IPP_ALIGN_FACTOR blk8_loop: ; movdqa xmm4, oword ptr[rcx+0*AES_BLOCK] ; pre load operation's keys ; movdqa xmm5, oword ptr[rcx+1*AES_BLOCK] add rcx, (2*AES_BLOCK) add r10d, 8 ; next counter value sub rdx, 4 ; rounds -= 4 movdqa xmm6, oword ptr[r9+4*AES_BLOCK] ; load current ctr32 movdqa xmm7, oword ptr[r9+5*AES_BLOCK] movdqa xmm8, oword ptr[r9+6*AES_BLOCK] movdqa xmm9, oword ptr[r9+7*AES_BLOCK] mov eax, r10d ; improve next 2 ctr32 values in advance aesenc xmm0, xmm4 lea ebx, [r10d+1] aesenc xmm1, xmm4 bswap eax aesenc xmm2, xmm4 bswap ebx aesenc xmm3, xmm4 xor eax, r11d aesenc xmm6, xmm4 xor ebx, r11d aesenc xmm7, xmm4 mov dword ptr[r9+0*AES_BLOCK+AES_BLOCK-sizeof(dword)], eax aesenc xmm8, xmm4 mov dword ptr[r9+1*AES_BLOCK+AES_BLOCK-sizeof(dword)], ebx aesenc xmm9, xmm4 movdqa xmm4, oword ptr[rcx] ; pre load operation's keys lea eax, [r10d+2] ; improve next 2 ctr32 values in advance aesenc xmm0, xmm5 lea ebx, [r10d+3] aesenc xmm1, xmm5 bswap eax aesenc xmm2, xmm5 bswap ebx aesenc xmm3, xmm5 xor eax, r11d aesenc xmm6, xmm5 xor ebx, r11d aesenc xmm7, xmm5 mov dword ptr[r9+2*AES_BLOCK+AES_BLOCK-sizeof(dword)], eax aesenc xmm8, xmm5 mov dword ptr[r9+3*AES_BLOCK+AES_BLOCK-sizeof(dword)], ebx aesenc xmm9, xmm5 movdqa xmm5, oword ptr [rcx+AES_BLOCK] ; pre load operation's keys ALIGN IPP_ALIGN_FACTOR cipher_loop: add rcx, (2*AES_BLOCK) sub rdx, 2 aesenc xmm0, xmm4 aesenc xmm1, xmm4 aesenc xmm2, xmm4 aesenc xmm3, xmm4 aesenc xmm6, xmm4 aesenc xmm7, xmm4 aesenc xmm8, xmm4 aesenc xmm9, xmm4 movdqa xmm4, oword ptr[rcx] ; pre load operation's keys aesenc xmm0, xmm5 aesenc xmm1, xmm5 aesenc xmm2, xmm5 aesenc xmm3, xmm5 aesenc xmm6, xmm5 aesenc xmm7, xmm5 aesenc xmm8, xmm5 aesenc xmm9, xmm5 movdqa xmm5, oword ptr [rcx+AES_BLOCK] ; pre load operation's keys jnz cipher_loop lea eax, [r10d+4] ; improve next 2 ctr32 values in advance aesenc xmm0, xmm4 lea ebx, [r10d+5] aesenc xmm1, xmm4 bswap eax aesenc xmm2, xmm4 bswap ebx aesenc xmm3, xmm4 xor eax, r11d aesenc xmm6, xmm4 xor ebx, r11d aesenc xmm7, xmm4 mov dword ptr[r9+4*AES_BLOCK+AES_BLOCK-sizeof(dword)], eax aesenc xmm8, xmm4 mov dword ptr[r9+5*AES_BLOCK+AES_BLOCK-sizeof(dword)], ebx aesenc xmm9, xmm4 lea eax, [r10d+6] ; improve next 2 ctr32 values in advance aesenclast xmm0, xmm5 lea ebx, [r10d+7] aesenclast xmm1, xmm5 bswap eax aesenclast xmm2, xmm5 bswap ebx aesenclast xmm3, xmm5 xor eax, r11d aesenclast xmm6, xmm5 xor ebx, r11d aesenclast xmm7, xmm5 mov dword ptr[r9+6*AES_BLOCK+AES_BLOCK-sizeof(dword)], eax aesenclast xmm8, xmm5 mov dword ptr[r9+7*AES_BLOCK+AES_BLOCK-sizeof(dword)], ebx aesenclast xmm9, xmm5 movdqu xmm10, oword ptr[rdi+0*AES_BLOCK] movdqu xmm11, oword ptr[rdi+1*AES_BLOCK] movdqu xmm12, oword ptr[rdi+2*AES_BLOCK] movdqu xmm13, oword ptr[rdi+3*AES_BLOCK] pxor xmm0, xmm10 pxor xmm1, xmm11 pxor xmm2, xmm12 pxor xmm3, xmm13 movdqu oword ptr[rsi+0*AES_BLOCK], xmm0 movdqu oword ptr[rsi+1*AES_BLOCK], xmm1 movdqu oword ptr[rsi+2*AES_BLOCK], xmm2 movdqu oword ptr[rsi+3*AES_BLOCK], xmm3 movdqu xmm10, oword ptr[rdi+4*AES_BLOCK] movdqu xmm11, oword ptr[rdi+5*AES_BLOCK] movdqu xmm12, oword ptr[rdi+6*AES_BLOCK] movdqu xmm13, oword ptr[rdi+7*AES_BLOCK] pxor xmm6, xmm10 pxor xmm7, xmm11 pxor xmm8, xmm12 pxor xmm9, xmm13 movdqu oword ptr[rsi+4*AES_BLOCK], xmm6 movdqu oword ptr[rsi+5*AES_BLOCK], xmm7 movdqu oword ptr[rsi+6*AES_BLOCK], xmm8 movdqu oword ptr[rsi+7*AES_BLOCK], xmm9 mov rcx, qword ptr[rsp+sizeof(qword)] ; restore pointer to the key material mov rdx, qword ptr[rsp] ; restore number of rounds movdqa xmm0, oword ptr[r9+0*AES_BLOCK] ; load next current ctr32 movdqa xmm1, oword ptr[r9+1*AES_BLOCK] movdqa xmm2, oword ptr[r9+2*AES_BLOCK] movdqa xmm3, oword ptr[r9+3*AES_BLOCK] movdqa xmm4, oword ptr[rcx+0*AES_BLOCK] ; pre load operation's keys movdqa xmm5, oword ptr[rcx+1*AES_BLOCK] ; pre load operation's keys add rdi, 8*AES_BLOCK add rsi, 8*AES_BLOCK sub r8, 8*AES_BLOCK jge blk8_loop pop rdx pop rcx movdqa xmm10,oword ptr [rsp+0*sizeof(oword)] ; resrore xmm registers movdqa xmm11,oword ptr [rsp+1*sizeof(oword)] movdqa xmm12,oword ptr [rsp+2*sizeof(oword)] movdqa xmm13,oword ptr [rsp+3*sizeof(oword)] add rsp, sizeof(oword)*4 ; release stack add r8, 8*AES_BLOCK jz quit ALIGN IPP_ALIGN_FACTOR short_input: ;; ;; test if 4-blocks processing alaivalbe ;; cmp r8, (4*AES_BLOCK) jl short123_input mov rbx, rcx ; pointer to the key material lea r10, [rdx-2] ; rounds -= 2 ALIGN IPP_ALIGN_FACTOR cipher_loop4: add rbx, (2*AES_BLOCK) sub r10, 2 aesenc xmm0, xmm4 ; regular round aesenc xmm1, xmm4 aesenc xmm2, xmm4 aesenc xmm3, xmm4 movdqa xmm4, oword ptr[rbx] ; pre load operation's keys aesenc xmm0, xmm5 aesenc xmm1, xmm5 aesenc xmm2, xmm5 aesenc xmm3, xmm5 movdqa xmm5, oword ptr [rbx+AES_BLOCK] ; pre load operation's keys jnz cipher_loop4 movdqu xmm6, oword ptr[rdi+0*AES_BLOCK] movdqu xmm7, oword ptr[rdi+1*AES_BLOCK] movdqu xmm8, oword ptr[rdi+2*AES_BLOCK] movdqu xmm9, oword ptr[rdi+3*AES_BLOCK] add rdi, (4*AES_BLOCK) aesenc xmm0, xmm4 aesenc xmm1, xmm4 aesenc xmm2, xmm4 aesenc xmm3, xmm4 aesenclast xmm0, xmm5 aesenclast xmm1, xmm5 aesenclast xmm2, xmm5 aesenclast xmm3, xmm5 pxor xmm0, xmm6 movdqu oword ptr[rsi+0*AES_BLOCK], xmm0 pxor xmm1, xmm7 movdqu oword ptr[rsi+1*AES_BLOCK], xmm1 pxor xmm2, xmm8 movdqu oword ptr[rsi+2*AES_BLOCK], xmm2 pxor xmm3, xmm9 movdqu oword ptr[rsi+3*AES_BLOCK], xmm3 add rsi, (4*AES_BLOCK) add r9, (4*AES_BLOCK) sub r8, (4*AES_BLOCK) jz quit ;; ;; block-by-block processing ;; short123_input: ; get actual address of key material: pRKeys += (nr-9) * SC lea rbx,[rdx*4] lea rbx, [rcx+rbx*4-10*(SC)*4] ; AES-128 round keys single_blk: movdqa xmm0, oword ptr[r9] ; counter from the stack add r9, AES_BLOCK cmp rdx,12 ; switch according to number of rounds jl key_128_s jz key_192_s key_256_s: aesenc xmm0,oword ptr[rbx-4*4*SC] aesenc xmm0,oword ptr[rbx-3*4*SC] key_192_s: aesenc xmm0,oword ptr[rbx-2*4*SC] aesenc xmm0,oword ptr[rbx-1*4*SC] key_128_s: aesenc xmm0,oword ptr[rbx+0*4*SC] aesenc xmm0,oword ptr[rbx+1*4*SC] aesenc xmm0,oword ptr[rbx+2*4*SC] aesenc xmm0,oword ptr[rbx+3*4*SC] aesenc xmm0,oword ptr[rbx+4*4*SC] aesenc xmm0,oword ptr[rbx+5*4*SC] aesenc xmm0,oword ptr[rbx+6*4*SC] aesenc xmm0,oword ptr[rbx+7*4*SC] aesenc xmm0,oword ptr[rbx+8*4*SC] aesenclast xmm0,oword ptr[rbx+9*4*SC] cmp r8, AES_BLOCK ; test if partial bloak jl partial_block movdqu xmm1, oword ptr[rdi] ; input data block add rdi, AES_BLOCK pxor xmm0, xmm1 ; output block movdqu oword ptr[rsi], xmm0 ; save output block add rsi, AES_BLOCK sub r8, AES_BLOCK jz quit jmp single_blk partial_block: pextrb eax, xmm0, 0 psrldq xmm0, 1 movzx edx, byte ptr[rdi] inc rdi xor rax, rdx mov byte ptr[rsi], al inc rsi dec r8 jnz partial_block quit: pxor xmm4, xmm4 pxor xmm5, xmm5 REST_XMM REST_GPR ret IPPASM EncryptStreamCTR32_AES_NI ENDP ENDIF ;; _IPP32E_Y8 ENDIF ;; _AES_NI_ENABLING_ END
msu.asm
joshuadhowe/z3randomizer
0
782
<reponame>joshuadhowe/z3randomizer<gh_stars>0 ;======================================= ; ; MSU-1 Enhanced Audio Patch ; <NAME> - Kamigami no Triforce ; Modified for VT Randomizer ; ; Author: qwertymodo ; ; Free space used: 0x77DDD-0x77F8A ; ;======================================= !REG_MSU_STATUS = $2000 !REG_MSU_ID_0 = $2002 !REG_MSU_ID_1 = $2003 !REG_MSU_ID_2 = $2004 !REG_MSU_ID_3 = $2005 !REG_MSU_ID_4 = $2006 !REG_MSU_ID_5 = $2007 !REG_MSU_ID_01 = $2002 !REG_MSU_ID_23 = $2004 !REG_MSU_ID_45 = $2006 !VAL_MSU_ID_0 = #$53 ; 'S' !VAL_MSU_ID_1 = #$2D ; '-' !VAL_MSU_ID_2 = #$4D ; 'M' !VAL_MSU_ID_3 = #$53 ; 'S' !VAL_MSU_ID_4 = #$55 ; 'U' !VAL_MSU_ID_5 = #$31 ; '1' !VAL_MSU_ID_01 = #$2D53 ; 'S-' !VAL_MSU_ID_23 = #$534D ; 'MS' !VAL_MSU_ID_45 = #$3155 ; 'U1' !REG_MSU_TRACK = $2004 !REG_MSU_TRACK_LO = $2004 !REG_MSU_TRACK_HI = $2005 !REG_MSU_VOLUME = $2006 !REG_MSU_CONTROL = $2007 !FLAG_MSU_PLAY = #$01 !FLAG_MSU_REPEAT = #$02 !FLAG_MSU_STATUS_TRACK_MISSING = #$08 !FLAG_MSU_STATUS_AUDIO_PLAYING = #$10 !FLAG_MSU_STATUS_AUDIO_REPEATING = #$20 !FLAG_MSU_STATUS_AUDIO_BUSY = #$40 !FLAG_MSU_STATUS_DATA_BUSY = #$80 !REG_CURRENT_VOLUME = $0127 !REG_TARGET_VOLUME = $0129 !REG_CURRENT_MSU_TRACK = $012B !REG_MUSIC_CONTROL = $012C !REG_CURRENT_TRACK = $0130 !REG_CURRENT_COMMAND = $0133 !REG_MSU_LOAD_FLAG = $7F509B !REG_SPC_CONTROL = $2140 !REG_NMI_FLAGS = $4210 !VAL_COMMAND_FADE_OUT = #$F1 !VAL_COMMAND_FADE_HALF = #$F2 !VAL_COMMAND_FULL_VOLUME = #$F3 !VAL_COMMAND_LOAD_NEW_BANK = #$FF !VAL_VOLUME_INCREMENT = #$10 !VAL_VOLUME_DECREMENT = #$02 !VAL_VOLUME_HALF = #$80 !VAL_VOLUME_FULL = #$FF msu_main: SEP #$20 ; set 8-bit accumulator LDA $4210 ; thing we wrote over REP #$20 ; set 16-bit accumulator LDA !REG_MSU_ID_01 CMP !VAL_MSU_ID_01 BEQ .continue .nomsu SEP #$30 JML spc_continue .continue LDA !REG_MSU_ID_23 CMP !VAL_MSU_ID_23 BNE .nomsu LDA !REG_MSU_ID_45 CMP !VAL_MSU_ID_45 BNE .nomsu SEP #$30 LDX !REG_MUSIC_CONTROL BNE command_ff LDA !REG_MSU_LOAD_FLAG BEQ do_fade msu_check_busy: LDA !REG_MSU_STATUS BIT !FLAG_MSU_STATUS_AUDIO_BUSY BEQ .ready JML spc_continue .ready LDA !REG_MSU_STATUS BIT !FLAG_MSU_STATUS_TRACK_MISSING BNE spc_fallback LDA !VAL_VOLUME_FULL STA !REG_TARGET_VOLUME STA !REG_CURRENT_VOLUME STA !REG_MSU_VOLUME LDA !REG_MSU_LOAD_FLAG STA !REG_MSU_CONTROL LDA #$00 STA !REG_MSU_LOAD_FLAG JML spc_continue spc_fallback: STZ !REG_MSU_CONTROL STZ !REG_CURRENT_MSU_TRACK STZ !REG_TARGET_VOLUME STZ !REG_CURRENT_VOLUME STZ !REG_MSU_VOLUME JML spc_continue do_fade: LDA !REG_CURRENT_VOLUME CMP !REG_TARGET_VOLUME BNE .continue JML spc_continue .continue BCC .increment .decrement SBC !VAL_VOLUME_DECREMENT BCS .set .mute STZ !REG_CURRENT_VOLUME STZ !REG_MSU_CONTROL STZ !REG_CURRENT_MSU_TRACK BRA .set .increment ADC !VAL_VOLUME_INCREMENT BCC .set LDA !VAL_VOLUME_FULL .set STA !REG_CURRENT_VOLUME STA !REG_MSU_VOLUME JML spc_continue command_ff: CPX !VAL_COMMAND_LOAD_NEW_BANK BNE command_f3 JML spc_continue command_f3: CPX !VAL_COMMAND_FULL_VOLUME BNE command_f2 STX !REG_SPC_CONTROL LDA !VAL_VOLUME_FULL STA !REG_TARGET_VOLUME JML spc_continue command_f2: CPX !VAL_COMMAND_FADE_HALF BNE command_f1 STX !REG_SPC_CONTROL LDA !VAL_VOLUME_HALF STA !REG_TARGET_VOLUME JML spc_continue command_f1: CPX !VAL_COMMAND_FADE_OUT BNE load_track STX !REG_SPC_CONTROL STZ !REG_TARGET_VOLUME JML spc_continue load_track: CPX !REG_CURRENT_MSU_TRACK BNE .continue CPX #$1B BEQ .continue JML spc_continue .continue STX !REG_MSU_TRACK_LO STZ !REG_MSU_TRACK_HI STZ !REG_MSU_CONTROL LDA.l MSUTrackList,x STA !REG_MSU_LOAD_FLAG STX !REG_CURRENT_MSU_TRACK JML spc_continue ending_wait: rep #$20 lda !REG_MSU_ID_01 cmp !VAL_MSU_ID_01 bne .done lda !REG_MSU_ID_23 cmp !VAL_MSU_ID_23 bne .done lda !REG_MSU_ID_45 cmp !VAL_MSU_ID_45 bne .done sep #$20 .wait lda !REG_MSU_STATUS bit !FLAG_MSU_STATUS_AUDIO_PLAYING bne .wait .done sep #$20 lda #$22 rtl
src/natools-web-comment_cookies.adb
faelys/natools-web
1
6960
<reponame>faelys/natools-web ------------------------------------------------------------------------------ -- Copyright (c) 2017, <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 Natools.S_Expressions.Atom_Buffers; with Natools.S_Expressions.Atom_Ref_Constructors; with Natools.S_Expressions.Encodings; with Natools.S_Expressions.Interpreter_Loop; with Natools.S_Expressions.Parsers; with Natools.S_Expressions.Printers.Pretty; package body Natools.Web.Comment_Cookies is Parameters : constant Natools.S_Expressions.Printers.Pretty.Parameters := (Width => 0, Newline_At => (others => (others => False)), Space_At => (others => (others => False)), Tab_Stop => <>, Indentation => 0, Indent => <>, Quoted => S_Expressions.Printers.Pretty.When_Shorter, Token => S_Expressions.Printers.Pretty.Extended_Token, Hex_Casing => S_Expressions.Encodings.Lower, Quoted_Escape => S_Expressions.Printers.Pretty.Hex_Escape, Char_Encoding => S_Expressions.Printers.Pretty.Latin, Fallback => S_Expressions.Printers.Pretty.Verbatim, Newline => S_Expressions.Printers.Pretty.LF); function Create (A : S_Expressions.Atom) return S_Expressions.Atom_Refs.Immutable_Reference renames S_Expressions.Atom_Ref_Constructors.Create; procedure Set_Atom (Info : in out Comment_Info; Context : in Meaningless_Type; Name : in S_Expressions.Atom; Arguments : in out S_Expressions.Lockable.Descriptor'Class); function To_Atom (Kind : in Atom_Kind) return S_Expressions.Atom; procedure Initialize is new S_Expressions.Interpreter_Loop (Comment_Info, Meaningless_Type, Set_Atom); ------------------------------ -- Local Helper Subprograms -- ------------------------------ procedure Set_Atom (Info : in out Comment_Info; Context : in Meaningless_Type; Name : in S_Expressions.Atom; Arguments : in out S_Expressions.Lockable.Descriptor'Class) is pragma Unreferenced (Context); use type S_Expressions.Events.Event; Kind : Atom_Kind; begin if Arguments.Current_Event /= S_Expressions.Events.Add_Atom then return; end if; declare S_Name : constant String := S_Expressions.To_String (Name); begin Kind := Atom_Kind'Value (S_Name); exception when Constraint_Error => Log (Severities.Error, "Unknown comment atom kind """ & S_Name & '"'); end; Info.Refs (Kind) := Create (Arguments.Current_Atom); end Set_Atom; function To_Atom (Kind : in Atom_Kind) return S_Expressions.Atom is begin case Kind is when Name => return (Character'Pos ('N'), Character'Pos ('a'), Character'Pos ('m'), Character'Pos ('e')); when Mail => return (Character'Pos ('M'), Character'Pos ('a'), Character'Pos ('i'), Character'Pos ('l')); when Link => return (Character'Pos ('L'), Character'Pos ('n'), Character'Pos ('n'), Character'Pos ('k')); when Filter => return (Character'Pos ('F'), Character'Pos ('i'), Character'Pos ('l'), Character'Pos ('t'), Character'Pos ('e'), Character'Pos ('r')); end case; end To_Atom; ----------------------------------- -- Comment Info Public Interface -- ----------------------------------- function Create (Name : in S_Expressions.Atom_Refs.Immutable_Reference; Mail : in S_Expressions.Atom_Refs.Immutable_Reference; Link : in S_Expressions.Atom_Refs.Immutable_Reference; Filter : in S_Expressions.Atom_Refs.Immutable_Reference) return Comment_Info is begin return (Refs => (Comment_Cookies.Name => Name, Comment_Cookies.Mail => Mail, Comment_Cookies.Link => Link, Comment_Cookies.Filter => Filter)); end Create; function Create (Expression : in out S_Expressions.Lockable.Descriptor'Class) return Comment_Info is use type S_Expressions.Events.Event; Result : Comment_Info := Null_Info; Event : S_Expressions.Events.Event; begin case Expression.Current_Event is when S_Expressions.Events.Add_Atom => for Kind in Result.Refs'Range loop Result.Refs (Kind) := Create (Expression.Current_Atom); Expression.Next (Event); exit when Event /= S_Expressions.Events.Add_Atom; end loop; when S_Expressions.Events.Open_List => Initialize (Expression, Result, Meaningless_Value); when S_Expressions.Events.Close_List | S_Expressions.Events.End_Of_Input | S_Expressions.Events.Error => null; end case; return Result; end Create; function Named_Serialization (Info : in Comment_Info) return S_Expressions.Atom is Buffer : aliased S_Expressions.Atom_Buffers.Atom_Buffer; Printer : S_Expressions.Printers.Pretty.Stream_Printer (Buffer'Access); begin Printer.Set_Parameters (Parameters); Buffer.Preallocate (120); for Kind in Atom_Kind loop if not Info.Refs (Kind).Is_Empty then Printer.Open_List; Printer.Append_Atom (To_Atom (Kind)); Printer.Append_Atom (Info.Refs (Kind).Query); Printer.Close_List; end if; end loop; return Buffer.Data; end Named_Serialization; function Positional_Serialization (Info : in Comment_Info) return S_Expressions.Atom is Buffer : aliased S_Expressions.Atom_Buffers.Atom_Buffer; Printer : S_Expressions.Printers.Pretty.Stream_Printer (Buffer'Access); Last : Atom_Kind; begin Printer.Set_Parameters (Parameters); Buffer.Preallocate (120); Last := Atom_Kind'Last; while Info.Refs (Last).Is_Empty loop if Last = Atom_Kind'First then return S_Expressions.Null_Atom; else Last := Atom_Kind'Pred (Last); end if; end loop; for Kind in Atom_Kind'First .. Last loop if Info.Refs (Kind).Is_Empty then Printer.Append_Atom (S_Expressions.Null_Atom); else Printer.Append_Atom (Info.Refs (Kind).Query); end if; end loop; return Buffer.Data; end Positional_Serialization; ------------------------------- -- Codec DB Public Interface -- ------------------------------- function Decode (DB : in Codec_DB; Cookie : in String) return Comment_Info is Cursor : Decoder_Maps.Cursor; begin if Cookie'Length = 0 then return Null_Info; end if; Cursor := DB.Dec.Find (Cookie (Cookie'First)); if not Decoder_Maps.Has_Element (Cursor) then return Null_Info; end if; declare use type S_Expressions.Atom; Parser : S_Expressions.Parsers.Memory_Parser := S_Expressions.Parsers.Create (Decoder_Maps.Element (Cursor).all (Cookie) & (1 => 0)); begin Parser.Next; return Create (Parser); end; end Decode; function Encode (DB : in Codec_DB; Info : in Comment_Info) return String is begin if DB.Enc = null then raise Program_Error with "Comment_Cookie.Encode called before Set_Encoder"; end if; case DB.Serialization is when Named => return DB.Enc.all (Named_Serialization (Info)); when Positional => return DB.Enc.all (Positional_Serialization (Info)); end case; end Encode; procedure Register (DB : in out Codec_DB; Key : in Character; Filter : in not null Decoder) is begin DB.Dec := Decoder_Maps.Include (DB.Dec, Key, Filter); end Register; procedure Set_Encoder (DB : in out Codec_DB; Filter : in not null Encoder; Serialization : in Serialization_Kind) is begin DB.Enc := Filter; DB.Serialization := Serialization; end Set_Encoder; end Natools.Web.Comment_Cookies;
Laburi/Lab7/1-max/max.asm
DanBrezeanu/IOCLA
2
175204
<reponame>DanBrezeanu/IOCLA %include "io.inc" section .text global CMAIN CMAIN: ; cele doua numere se gasesc in eax si ebx mov eax, 4 mov ebx, 1 ; TODO: aflati maximul folosind doar o instructiune de salt si push/pop cmp eax, ebx jle print push ebx mov ebx, eax pop eax print: PRINT_DEC 4, eax ; afiseaza minimul NEWLINE ret
oeis/259/A259057.asm
neoneye/loda-programs
11
101259
<gh_stars>10-100 ; A259057: One-third of the even-indexed entries of A259056. ; Submitted by <NAME> ; -1,20,-560,20160,-887040,46126080,-2767564800,188194406400,-14302774886400,1201433090457600,-110531844322099200,11053184432209920000,-1193743918678671360000,138474294566725877760000,-17170812526274008842240000 add $0,3 mov $1,-1 pow $1,$0 seq $0,52714 ; a(n) = 2^(n-1) * n! * Catalan(n-1) for n > 0 with a(0) = 0. mul $1,2 mul $0,$1 div $0,96
programs/oeis/226/A226858.asm
neoneye/loda
22
83860
; A226858: Numbers n such that there are six distinct triples (k, k+n, k+2n) of squares. ; 258594336000,1034377344000,2327349024000,4137509376000,6464858400000,9309396096000,12671122464000,16550037504000,20946141216000,25859433600000 add $0,1 pow $0,2 mul $0,258594336000
src/test/resources/quickfixes/CreateRuleFix/missingRule.g4
roggenbrot/intellij-plugin-v4
351
2992
<gh_stars>100-1000 grammar missingRule; myRule: newRule;
src/q_gen_shuffle.adb
jfuica/bingada
4
25279
<gh_stars>1-10 with Ada.Numerics.Discrete_Random; package body Q_Gen_Shuffle is procedure P_Shuffle (List : in out Array_Type) is package Discrete_Random is new Ada.Numerics.Discrete_Random (Result_Subtype => Positive); use Discrete_Random; K : Positive; G : Generator; T : Element_Type; begin Reset (G); for I in reverse List'Range loop K := (Random(G) mod I) + 1; T := List(I); List(I) := List(K); List(K) := T; end loop; end P_Shuffle; end Q_Gen_Shuffle;
programs/oeis/137/A137937.asm
neoneye/loda
22
28254
; A137937: A137904(n) - A137575(n). ; 0,0,3,4,5,6,7,8,9,10,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86 seq $0,138100 ; The atomic numbers read along the odd-indexed rows of the Janet table of the elements. trn $0,2
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/div_no_warning.adb
best08618/asylo
7
6252
-- { dg-do compile } procedure div_no_warning is Flag : constant Boolean := False; Var : Boolean := True; function F return Boolean is begin return Var; end F; Int : Integer := 0; begin if Flag and then F then Int := Int / 0; end if; end div_no_warning;
Mips/Studies/printingArray.asm
otavreis/-Computer-Architecture-and-Organization
1
162316
.data myArray: .space 12 # 4 bytes for interger; 12 <- 3 position newLine: .asciiz "\n" .text main: addi $s0, $zero, 4 addi $s1, $zero, 10 addi $s2, $zero, 12 # Index = $t0 addi $t0, $zero, 0 sw $s0, myArray($t0) #store $s0 in $t0 addi $t0, $t0, 4 sw $s1, myArray($t0) addi $t0, $t0, 4 sw $s2, myArray($t0) # Clear $t0 to 0 addi $t0, $zero, 0 while: beq $t0, 12, exit lw $t6, myArray($t0) addi $t0, $t0, 4 # $t0 goes to next position #Print current number li $v0, 1 move $a0, $t6 syscall #Print a new line li $v0, 4 la $a0, newLine syscall j while exit: # Tell system this is end of program li $v0, 10 syscall
Task/Topic-variable/AppleScript/topic-variable-1.applescript
LaudateCorpus1/RosettaCodeData
1
59
<filename>Task/Topic-variable/AppleScript/topic-variable-1.applescript<gh_stars>1-10 on run 1 + 2 ap({square, squareRoot}, {result}) --> {9, 1.732050807569} end run -- square :: Num a => a -> a on square(x) x * x end square -- squareRoot :: Num a, Float b => a -> b on squareRoot(x) x ^ 0.5 end squareRoot -- GENERIC FUNCTIONS ---------------------------------------------------------- -- A list of functions applied to a list of arguments -- (<*> | ap) :: [(a -> b)] -> [a] -> [b] on ap(fs, xs) set lst to {} repeat with f in fs tell mReturn(contents of f) repeat with x in xs set end of lst to |λ|(contents of x) end repeat end tell end repeat return lst end ap -- Lift 2nd class handler function into 1st class script wrapper -- mReturn :: Handler -> Script on mReturn(f) if class of f is script then f else script property |λ| : f end script end if end mReturn
programs/oeis/175/A175780.asm
neoneye/loda
22
98906
<gh_stars>10-100 ; A175780: Partial sums of floor(n^2/24). ; 0,0,0,0,0,1,2,4,6,9,13,18,24,31,39,48,58,70,83,98,114,132,152,174,198,224,252,282,314,349,386,426,468,513,561,612,666,723,783,846,912,982,1055,1132,1212,1296,1384,1476,1572,1672,1776,1884,1996,2113,2234,2360,2490,2625,2765,2910,3060,3215,3375,3540,3710,3886,4067,4254,4446,4644,4848,5058,5274,5496,5724,5958,6198,6445,6698,6958,7224,7497,7777,8064,8358,8659,8967,9282,9604,9934,10271,10616,10968,11328,11696,12072,12456,12848,13248,13656 mov $3,$0 add $3,1 lpb $3 mov $0,$2 sub $3,1 sub $0,$3 pow $0,2 div $0,24 add $1,$0 lpe mov $0,$1
lib/rkplat/src/riscv64/new_stack.asm
OSH-2022/runikraft
0
165837
<filename>lib/rkplat/src/riscv64/new_stack.asm .text # 切换栈: 早期引导栈->引导栈,对应_libkvmplat_newstack .globl __rkplat_newstack # fn __rkplat_newstack(stack_top: *mut u8, tramp: extern fn(*mut u8)->!, arg: *mut u8)->!; __rkplat_newstack: csrw sscratch, sp mv sp,a0 mv a0,a2 jr a1
libsrc/_DEVELOPMENT/threads/context/__thread_critical_section_begin.asm
jpoikela/z88dk
640
15135
<reponame>jpoikela/z88dk SECTION code_clib SECTION code_threads PUBLIC __thread_critical_section_begin EXTERN asm_cpu_push_di defc __thread_critical_section_begin = asm_cpu_push_di
libsrc/_DEVELOPMENT/stdio/z80/input_helpers/__stdio_scanf_s.asm
jpoikela/z88dk
640
8955
SECTION code_clib SECTION code_stdio PUBLIC __stdio_scanf_s PUBLIC __stdio_scanf_s_tail EXTERN __stdio_recv_input_eat_ws_repeat, __stdio_recv_input_eatc, __stdio_scanf_sm_string __stdio_scanf_s: ; %s converter called from vfscanf() ; ; enter : ix = FILE * ; bc = field width (0 means default) ; hl = void *p (0 means assignment suppression) ; ; exit : carry set if error ; ; uses : all except ix ; CONSUME LEADING WHITESPACE push bc push hl call __stdio_recv_input_eat_ws_repeat ; stack = field width, void *buffer ; READ STREAM CHARS INTO BUFFER pop bc ; bc = void *buffer ld hl,__stdio_scanf_sm_string ; hl = string state machine exx pop bc ; bc = field width ld a,b or c jr nz, width_specified ; if field width was supplied dec bc ; otherwise consume all string chars from stream width_specified: call __stdio_recv_input_eatc exx __stdio_scanf_s_tail: jr c, stream_error zero_terminate: ; ZERO TERMINATE THE STRING ; if bc != 0 (assignment not suppressed), terminate the string ld a,b or c ret z ; if assignment suppressed exx ld a,b or c jr z, no_chars inc hl ; if at least one char consumed from stream, num items assigned++ no_chars: exx xor a ld (bc),a ; zero terminate string ret stream_error: push af ; save error type and carry set call zero_terminate ; always zero terminate string pop af ret
Library/Chart/Utils/utilsFile.asm
steakknife/pcgeos
504
14732
<gh_stars>100-1000 COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: utilsFile.asm AUTHOR: <NAME> METHODS: Name Description ---- ----------- FUNCTIONS: Scope Name Description ----- ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 2/19/92 Initial version. DESCRIPTION: File utilities $Id: utilsFile.asm,v 1.1 97/04/04 17:47:45 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% UtilGetVMFile %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Get the VM file holding the passed block CALLED BY: GLOBAL within chart PASS: ds - segment of a block in the VM file RETURN: bx - vm file handle DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- CDB 2/19/92 Initial version. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ UtilGetVMFile proc far uses ax .enter mov bx, ds:[LMBH_handle] mov ax, MGIT_OWNER_OR_VM_FILE_HANDLE call MemGetInfo mov bx, ax ; VM file handle .leave ret UtilGetVMFile endp
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/ドイツ_PAL/Ger_asm/z11_bg30.asm
prismotizm/gigaleak
0
103185
<reponame>prismotizm/gigaleak<filename>other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/ドイツ_PAL/Ger_asm/z11_bg30.asm Name: z11_bg30.asm Type: file Size: 84215 Last-Modified: '2016-05-13T04:23:03Z' SHA-1: E0074DBDBC3CCA6796559E88A1958D25CAF72AF4 Description: null
3-mid/physics/interface/source/private/bullet/bullet_physics-space.ads
charlie5/lace
20
19745
with physics.Space, physics.Model; private with bullet_c, bullet_c.Pointers, bullet_Physics.Object, physics.Shape, physics.Object, physics.Joint.ball, physics.Joint.slider, physics.Joint.hinge, physics.Joint.cone_twist, physics.Joint.DoF6, ada.Containers.hashed_Maps; package bullet_Physics.Space -- -- Provides a Bullet3D implementation of a physical space. -- is type Item is new physics.Space.item with private; type View is access all Item'Class; -- TODO: Place this in a nested Forge package. function to_Space return Item; overriding function manifold_Count (Self : in Item) return Natural; overriding function Manifold (Self : access Item; Index : in Positive) return physics.space.a_Manifold; private function Hash (the_C_Object : in bullet_c.Pointers.Object_Pointer) return ada.Containers.Hash_type; use type bullet_c.Pointers.Object_pointer; use type bullet_Physics.Object.view; package c_Object_Maps_of_Object is new ada.Containers.hashed_Maps (Key_type => bullet_c.Pointers.Object_Pointer, Element_type => bullet_Physics.Object.view, Hash => Hash, equivalent_Keys => "=", "=" => "="); type Item is new physics.Space.item with record C : bullet_c.Pointers.Space_Pointer; object_Map : c_Object_Maps_of_Object.Map; end record; use Math; ---------------- --- Joint Cursor -- type joint_Cursor is new physics.Space.joint_Cursor with null record; overriding procedure next (Cursor : in out joint_Cursor); overriding function has_Element (Cursor : in joint_Cursor) return Boolean; overriding function Element (Cursor : in joint_Cursor) return physics.Joint.view; overriding function first_Joint (Self : in Item) return physics.Space.joint_Cursor'Class; ---------- --- Forge -- overriding procedure destruct (Self : in out Item); --------- --- Shape -- overriding function new_Shape (Self : access Item; Model : in physics.Model.view) return physics.Shape.view; overriding function new_sphere_Shape (Self : access Item; Radius : in Real := 0.5) return physics.Shape.view; overriding function new_box_Shape (Self : access Item; half_Extents : in Vector_3 := (0.5, 0.5, 0.5)) return physics.Shape.view; overriding function new_capsule_Shape (Self : access Item; Radius : in Real := 0.5; Height : in Real) return physics.Shape.view; overriding function new_cone_Shape (Self : access Item; Radius : in Real := 0.5; Height : in Real := 1.0) return physics.Shape.view; overriding function new_cylinder_Shape (Self : access Item; half_Extents : in Vector_3 := (0.5, 0.5, 0.5)) return physics.Shape.view; overriding function new_heightfield_Shape (Self : access Item; Heightfield : in out physics.Heightfield; Scale : in Vector_3) return physics.Shape.view; overriding function new_multisphere_Shape (Self : access Item; Sites : in physics.Vector_3_array; Radii : in Vector) return physics.Shape.view; overriding function new_plane_Shape (Self : access Item; Normal : in Vector_3 := (0.0, 1.0, 0.0); Offset : in Real := 0.0) return physics.Shape.view; overriding function new_convex_hull_Shape (Self : access Item; Points : in physics.Vector_3_array) return physics.Shape.view; overriding function new_mesh_Shape (Self : access Item; Points : access Physics.Geometry_3D.a_Model) return physics.Shape.view; overriding function new_circle_Shape (Self : access Item; Radius : in Real := 0.5) return physics.Shape.view; overriding function new_polygon_Shape (Self : access Item; Vertices : in physics.Space.polygon_Vertices) return physics.Shape.view; ---------- --- Object -- overriding function new_Object (Self : access Item; of_Shape : in physics.Shape .view; of_Mass : in Real; Friction : in Real; Restitution : in Real; at_Site : in Vector_3; is_Kinematic : in Boolean) return physics.Object.view; overriding function object_Count (Self : in Item) return Natural; --------- --- Joint -- overriding function new_hinge_Joint (Self : access Item; Object_A, Object_B : in physics.Object.view; Anchor_in_A, Anchor_in_B : in Vector_3; pivot_Axis : in Vector_3; low_Limit, high_Limit : in Real; collide_Connected : in Boolean) return physics.Joint.hinge.view; overriding function new_hinge_Joint (Self : access Item; Object_A, Object_B : in physics.Object.view; Frame_A, Frame_B : in Matrix_4x4; low_Limit, high_Limit : in Real; collide_Connected : in Boolean) return physics.Joint.hinge.view; overriding function new_hinge_Joint (Self : access Item; Object_A : in physics.Object.view; Frame_A : in Matrix_4x4) return physics.Joint.hinge.view; overriding function new_DoF6_Joint (Self : access Item; Object_A, Object_B : in physics.Object.view; Frame_A, Frame_B : in Matrix_4x4) return physics.Joint.DoF6.view; overriding function new_ball_Joint (Self : access Item; Object_A, Object_B : in physics.Object.view; Pivot_in_A, Pivot_in_B : in Vector_3) return physics.Joint.ball.view; overriding function new_slider_Joint (Self : access Item; Object_A, Object_B : in physics.Object.view; Frame_A, Frame_B : in Matrix_4x4) return physics.Joint.slider.view; overriding function new_cone_twist_Joint (Self : access Item; Object_A, Object_B : in physics.Object.view; Frame_A, Frame_B : in Matrix_4x4) return physics.Joint.cone_twist.view; --------------- --- Operations -- overriding procedure add (Self : in out Item; Object : in physics.Object.view); overriding procedure rid (Self : in out Item; Object : in physics.Object.view); overriding function cast_Ray (Self : access Item; From, To : in Vector_3) return physics.Space.ray_Collision; overriding procedure evolve (Self : in out Item; By : in Duration); overriding function Gravity (Self : in Item) return Vector_3; overriding procedure Gravity_is (Self : in out Item; Now : in Vector_3); overriding procedure add (Self : in out Item; Joint : in physics.Joint.view); overriding procedure rid (Self : in out Item; Joint : in physics.Joint.view); overriding procedure update_Bounds (Self : in out Item; of_Obect : in physics.Object.view); overriding procedure set_Joint_local_Anchor (Self : in out Item; the_Joint : in physics.Joint.view; is_Anchor_A : in Boolean; local_Anchor : in Vector_3); end bullet_Physics.Space;
AssemblyLanguage_Lab/ASB_LAB_6/Lab6/scr/ins13.asm
strawberrylin/Hust_CS_Lab
1
240735
.386 code segment use16 assume cs:code,ss:stack OLD_INT DW ?,? ;新中断处理程序 NEW01H: cmp al, 'a' je newb cmp al, 'A' je newb cmp al, 'b' je newa cmp al, 'B' je newa jmp dword ptr OLD_INT newa: push bp mov bp, sp mov dl, 42h mov ah, 2 int 21h pop bp iret newb: push bp mov bp, sp mov dl, 41h mov ah, 2 int 21h pop bp iret ;初始化(安装新中断矢量并常驻内存)程序 start: xor ax, ax mov ds, ax mov ax, ds:[21h*4] mov OLD_INT, AX MOV AX, ds:[21h*4+2] mov OLD_INT+2, ax CLI mov word ptr ds:[21h*4], offset NEW01H mov ds:[01h*4+2], cs STI mov dx, offset start+15 mov cl, 4 shr dx, cl add dx, 10h mov al, 0 mov ah, 31h int 21h code ends stack segment use16 stack db 200 dup(0) stack ends end start
Task/Knuth-shuffle/AppleScript/knuth-shuffle-2.applescript
LaudateCorpus1/RosettaCodeData
1
3105
<filename>Task/Knuth-shuffle/AppleScript/knuth-shuffle-2.applescript {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25}, {14, 25, 3, 1, 12, 18, 11, 20, 16, 15, 21, 5, 22, 19, 2, 24, 8, 10, 13, 6, 17, 23, 9, 7, 4}}
PiFrac/AuxLemmas.agda
DreamLinuxer/popl21-artifact
5
10979
module PiFrac.AuxLemmas where open import Data.Empty open import Data.Unit hiding (_≟_) open import Data.Sum open import Data.Product open import Relation.Binary.Core open import Relation.Binary open import Relation.Nullary open import Relation.Binary.PropositionalEquality open import Function using (_∘_) open import PiFrac.Syntax open import PiFrac.Opsem Lemma₁ : ∀ {A B C D v v' κ κ'} {c : A ↔ B} {c' : C ↔ D} → ⟨ c ∣ v ∣ κ ⟩ ↦ [ c' ∣ v' ∣ κ' ] → (A ≡ C × B ≡ D) Lemma₁ ↦₁ = refl , refl Lemma₁ ↦₂ = refl , refl Lemma₁ ↦η = refl , refl Lemma₁ ↦ε₁ = refl , refl Lemma₂ : ∀ {A B v v' κ κ'} {c c' : A ↔ B} → ⟨ c ∣ v ∣ κ ⟩ ↦ [ c' ∣ v' ∣ κ' ] → c ≡ c' × κ ≡ κ' Lemma₂ ↦₁ = refl , refl Lemma₂ ↦₂ = refl , refl Lemma₂ ↦η = refl , refl Lemma₂ ↦ε₁ = refl , refl Lemma₃ : ∀ {A B v v' κ} {c : A ↔ B} → (r : ⟨ c ∣ v ∣ κ ⟩ ↦ [ c ∣ v' ∣ κ ]) → base c ⊎ dual c ⊎ A ≡ B Lemma₃ (↦₁ {b = b}) = inj₁ b Lemma₃ ↦₂ = inj₂ (inj₂ refl) Lemma₃ ↦η = inj₂ (inj₁ tt) Lemma₃ ↦ε₁ = inj₂ (inj₁ tt) Lemma₄ : ∀ {A v v' κ} {c : A ↔ A} → (r : ⟨ c ∣ v ∣ κ ⟩ ↦ [ c ∣ v' ∣ κ ]) → base c ⊎ c ≡ id↔ Lemma₄ {c = swap₊} ↦₁ = inj₁ tt Lemma₄ {c = swap⋆} ↦₁ = inj₁ tt Lemma₄ ↦₂ = inj₂ refl Lemma₅ : ∀ {A B v v' b κ} {c : A ↔ B ×ᵤ 𝟙/ b} → (r : ⟨ c ∣ v ∣ κ ⟩ ↦ [ c ∣ v' ∣ κ ]) → base c ⊎ (b , ↻) ≡ v' ⊎ ¬ (dual c) Lemma₅ (↦₁ {b = b}) = inj₁ b Lemma₅ ↦₂ = inj₂ (inj₂ (λ ())) Lemma₅ ↦η = inj₂ (inj₁ refl) Lemma₆ : ∀ {A v v' κ} → v ≢ v' → ∄[ st' ] (st' ↦ [ ηₓ {A} v ∣ v' , ↻ ∣ κ ]) Lemma₆ neq (⟨ _ ∣ v ∣ _ ⟩ , r) with Lemma₁ r ... | refl , refl with Lemma₂ r ... | refl , refl with Lemma₅ r ... | inj₂ (inj₁ refl) = neq refl ... | inj₂ (inj₂ nd) = nd tt
programs/oeis/005/A005058.asm
neoneye/loda
22
101738
<reponame>neoneye/loda ; A005058: a(n) = 5^n - 3^n. ; 0,2,16,98,544,2882,14896,75938,384064,1933442,9706576,48650978,243609184,1219108802,6098732656,30503229218,152544843904,762810312962,3814309845136,19072324066658,95363944856224,476826697849922,2384154409956016,11920834811899298,59604362345854144,298022376588343682,1490113577518937296,7450572971326343138,37252880107826685664,186264446292718338242,931322368724346420976,4656612255403996294178,23283062512366774038784,116415316267874247897602,582076592457492372599056,2910382995641825262328418,14551915078272216509641504,72759575691550353142205762,363797879358319577493023536,1818989399493301322811101858,9094947005571616920093461824,45474735052173415518581166722,227373675333813070347247406416,1136868376887903329999261750498,5684341885096030584785382907744,28421709427449694728294137004482,142108547143157099054572352419696,710542735733511371512166764290338,3552713678720734486278748828027264,17763568393763205317547489159863042,88817841969294625246198680858495376,444089209847908922206377109470017378 mov $1,5 pow $1,$0 mov $2,3 pow $2,$0 sub $1,$2 mov $0,$1
musiced/editpattern.asm
nanoflite/victracker
1
165995
;************************************************************************** ;* ;* FILE editpattern.asm ;* Copyright (c) 1994, 2003 <NAME> <<EMAIL>> ;* Written by <NAME> <<EMAIL>> ;* $Id: editpattern.asm,v 1.17 2003/08/07 13:47:07 tlr Exp $ ;* ;* DESCRIPTION ;* The pattern editor. (relies on editor.asm for the dirty work) ;* ;****** PattZP EQU $fb VoiceZP EQU $fd VoiceZP2 EQU $f9 ConvZP EQU $f8 ;************************************************************************** ;* ;* EditPattern ;* ;****** EditPattern: jsr UnEdit ldx #4 edp_lp2: lda pl_vd_PatternTabLow,x sta PattZP lda pl_vd_PatternTabHigh,x sta PattZP+1 ldy epl_CurrentLine lda (PattZP),y and #MAXNUMPATTERNS_MASK sta EditRow,x dex bpl edp_lp2 ; only edit the length specified ldy epl_CurrentLine lda pl_LengthTab,y and #$1f ; Max pattern length sta edp_Length ldy #2 ldx #0 edp_lp3: jsr edp_GetPatternAddr lda PattZP sta edp_AddressTabLOW,y sta edp_AddressTabLOW+1,y lda PattZP+1 sta edp_AddressTabHIGH,y sta edp_AddressTabHIGH+1,y iny iny inc PattZP bne edp_skp1 inc PattZP+1 edp_skp1: lda PattZP sta edp_AddressTabLOW,y sta edp_AddressTabLOW+1,y lda PattZP+1 sta edp_AddressTabHIGH,y sta edp_AddressTabHIGH+1,y iny iny inx cpx #5 bne edp_lp3 ldx #0 edp_lp1: lda edp_INFOBLOCK,x sta INFOBLOCK,x inx cpx #ib_sizeof bne edp_lp1 jsr StartEdit rts UnEditPattern: ldx #0 uedp_lp1: lda INFOBLOCK,x sta edp_INFOBLOCK,x inx cpx #ib_sizeof bne uedp_lp1 rts edp_Screen: ldy #0 lda epl_CurrentLine jsr PutHex ldx #0 edps_lp1: lda #30 ;pilupp sta (ScreenZP),y iny lda EditRow,x jsr PutHex lda #" " sta (ScreenZP),y iny inx cpx #5 bne edps_lp1 rts edp_Update: rts ;************************************************************************** ;* ;* NAME edp_CheckKeys ;* ;* DESCRIPTION ;* Check all pattern editor keys. ;* This gets called as a call back from the main editor. ;* ;* KNOWN BUGS ;* none ;* ;****** edp_CheckKeys: cmp #"R" ;R beq edpc_Arp cmp #"S" ;S beq edpc_Sound cmp #13 ;RETURN beq edpc_Edit cmp #95 ;<- beq edpc_Find cmp #170 ; C= N beq edpc_PattlistRowUp cmp #167 ; C= M beq edpc_PattlistRowDown cmp #181 ; C= J beq edpc_PatternUp cmp #161 ; C= K beq edpc_PatternDown jmp edp_CheckClipBoardKeys ; Switch back to Pattlist Edit edpc_Edit: ; calculate which position in the pattlist editor corresponds to ; which position in the pattern editor jsr edp_GetVoiceNum ;Acc=voicenumber sta MultTmp asl clc adc MultTmp ;Acc=voicenumber*3 clc adc #4 ;Acc=voicenumber*3+4 sta epl_CurrentColumn ;Initiate the pattlist editor jsr EditPattList jsr ToggleCursor jmp edpc_ex1 ; Switch to Arpeggio Edit edpc_Arp: jsr EditArp jsr ToggleCursor jmp edpc_ex1 ; Switch to Sound Edit edpc_Sound: jsr EditSound jsr ToggleCursor jmp edpc_ex1 ; Find first unused pattern edpc_Find: jsr FindFirstUnused bcs edpc_ex1 ;no pattern could be found pha jsr edp_GetPattListAddr pla sta (PattZP),y ;Store into pattlist jmp edpc_ex2 ; Increase/decrease pattern number in pattlist. edpc_PatternUp: jsr edp_GetPattListAddr lda (PattZP),y clc adc #1 and #MAXNUMPATTERNS_MASK sta (PattZP),y jmp edpc_ex2 edpc_PatternDown: jsr edp_GetPattListAddr lda (PattZP),y sec sbc #1 and #MAXNUMPATTERNS_MASK sta (PattZP),y jmp edpc_ex2 ; Increase/decrease which row in the pattlist we are editing. edpc_PattlistRowUp: inc epl_CurrentLine jmp edpc_ex2 edpc_PattlistRowDown: dec epl_CurrentLine edpc_ex2: jsr EditPattern jsr ToggleCursor edpc_ex1: lda #0 rts ;************************************************************************** ;* ;* NAME edp_CheckClipBoardKeys ;* ;* DESCRIPTION ;* Check keys for clipboard functions. ;* ;* KNOWN BUGS ;* none ;* ;****** edp_CheckClipBoardKeys: cmp #191 ; C= B beq edpc_Begin cmp #188 ; C= C beq edpc_Copy cmp #189 ; C= X beq edpc_Cut cmp #190 ; C= V beq edpc_Paste jmp edp_CheckInsertKeys ;************************************************************************** ;* ;* NAME edpc_Begin,edpc_Cut,edpc_Copy ;* ;* DESCRIPTION ;* Handles the pattern clipboard. ;* ;* KNOWN BUGS ;* none ;* ;****** ;Set the begin marker. edpc_Begin: lda CurrentLine sta edp_ClipBoardBegin lda #0 sta edp_ClipBoardLen jmp edpc_ex1 edpc_Cut: lda #1 dc.b $2c ; bit $xxxx edpc_Copy: lda #0 sta edp_CutFlag jsr edp_GetVoiceNum tax jsr edp_GetPatternAddr ; load data into the clipboard. ldx #0 ldy edp_ClipBoardBegin edpcc_lp1: tya pha asl tay lda (PattZP),y sta edp_ClipBoardNote,x iny lda (PattZP),y sta edp_ClipBoardParam,x lda edp_CutFlag ; shall we cut the data? beq edpcc_skp2 ; no, skip clearing lda #0 sta (PattZP),y dey sta (PattZP),y edpcc_skp2: pla tay cpy edp_Length ; Are we at the last pattern step bne edpcc_skp1 ; no... skip. ldy #$ff ; yes, start over. edpcc_skp1: inx iny cpy CurrentLine bne edpcc_lp1 stx edp_ClipBoardLen jmp edpc_ex2 edpc_Paste: lda edp_ClipBoardLen beq edpc_ex1 ; nothing to paste, get out! jsr edp_GetVoiceNum tax jsr edp_GetPatternAddr ; paste data from the clipboard. ; load data into the clipboard. ldx #0 ldy CurrentLine edpcp_lp1: tya pha asl tay lda edp_ClipBoardNote,x sta (PattZP),y iny lda edp_ClipBoardParam,x sta (PattZP),y pla tay cpy edp_Length ; Are we at the last pattern step bne edpcp_skp1 ; no... skip. ldy #$ff ; yes, start over. edpcp_skp1: inx iny cpx edp_ClipBoardLen bne edpcp_lp1 jmp edpc_ex2 ;************************************************************************** ;* ;* NAME edp_CheckInsertKeys ;* ;* DESCRIPTION ;* Check keys for Insert/Delete Clear functions. ;* ;* KNOWN BUGS ;* none ;* ;****** edp_CheckInsertKeys: cmp #147 ; SHIFT-CLR/HOME beq edpc_Clear jmp edp_CheckTransposeKeys ;************************************************************************** ;* ;* NAME edp_Clear ;* ;* DESCRIPTION ;* Clears the pattern under cursor. (after asking) ;* ;* KNOWN BUGS ;* none ;* ;****** edpc_Clear: jsr AreYouSure beq edpcl_ex1 jsr edp_GetVoiceNum tax jsr edp_GetPatternAddr ldx edp_Length ; The number of lines in the pattern-1 lda #0 tay edpcl_lp1: sta (PattZP),y iny sta (PattZP),y iny dex bpl edpcl_lp1 ; Are we finished? jmp edpc_ex2 edpcl_ex1: jmp edpc_ex1 ;************************************************************************** ;* ;* NAME edp_CheckTransposeKeys ;* ;* DESCRIPTION ;* Check keys for transpose functions. ;* ;* KNOWN BUGS ;* none ;* ;****** edp_CheckTransposeKeys: cmp #163 ; C= T beq edpc_TransUp cmp #183 ; C= Y beq edpc_TransDown cmp #0 rts ;************************************************************************** ;* ;* NAME edp_TransDown,edp_TransUp ;* ;* DESCRIPTION ;* Transposes the pattern under cursor up or down. ;* ;* KNOWN BUGS ;* Does not handle notes outside the normal range correctly. ;* Does not handle a noise channel pattern correctly ;* ;****** edpc_TransDown: lda #1 dc.b $2c ; bit $xxxx edpc_TransUp: lda #0 sta edp_TransDownFlag jsr edp_GetVoiceNum tax jsr edp_GetPatternAddr ldx edp_Length ldy #0 edpct_lp1: lda (PattZP),y pha and #$80 sta edp_TransMask pla pha and #$70 sta edp_TransOct pla pha and #$0f sta edp_TransNote pla and #$7f beq edpct_skp1 ;Do nothing for ties and empties lda edp_TransDownFlag bne edpct_skp4 ; Transpose this note up! lda edp_TransNote clc adc #1 cmp #$c bne edpct_skp2 lda edp_TransOct clc adc #$10 cmp #$80 bne edpct_skp3 lda #$10 edpct_skp3: sta edp_TransOct lda #0 edpct_skp2: sta edp_TransNote jmp edpct_skp5 ; Transpose this note down! edpct_skp4: lda edp_TransNote sec sbc #1 cmp #$ff bne edpct_skp6 lda edp_TransOct sec sbc #$10 bne edpct_skp7 lda #$70 edpct_skp7: sta edp_TransOct lda #$b edpct_skp6: sta edp_TransNote ; Reassemble the note! edpct_skp5: lda edp_TransMask ora edp_TransOct ora edp_TransNote sta (PattZP),y edpct_skp1: iny iny dex bpl edpct_lp1 jmp edpc_ex2 edp_TransDownFlag: ds.b 1 edp_TransMask: ds.b 1 edp_TransOct: ds.b 1 edp_TransNote: ds.b 1 ;************************************************************************** ;* ;* NAME edp_GetVoiceNum ;* ;* DESCRIPTION ;* returns the voicenumber corresponding to the current cursor position. ;* Acc=VoiceNum ;* ;****** edp_GetVoiceNum: lda CurrentColumn sec sbc #2 lsr lsr ;Acc=voicenumber rts ;************************************************************************** ;* ;* NAME edp_GetPattListAddr ;* ;* DESCRIPTION ;* Sets PattZP to the address of the pattlist corresponding to the voicenum. ;* PattZP=address of pattlist edited in the current voice. ;* Y=row. ;* ;****** edp_GetPattListAddr: jsr edp_GetVoiceNum clc adc #>pl_Tab1 sta PattZP+1 lda #<pl_Tab1 sta PattZP ;PattZP=pl_Tab{VoiceNum} ldy epl_CurrentLine rts ;************************************************************************** ;* ;* NAME edp_GetPatternAddr ;* ;* DESCRIPTION ;* Sets PattZP to the address of the pattern corresponding to the voicenum. ;* PattZP=address of pattern edited in voice X. ;* ;****** edp_GetPatternAddr: lda #0 sta PattZP+1 lda EditRow,x asl rol PattZP+1 asl rol PattZP+1 asl rol PattZP+1 asl rol PattZP+1 asl rol PattZP+1 asl rol PattZP+1 clc adc #<pl_PatternData sta PattZP lda PattZP+1 adc #>pl_PatternData sta PattZP+1 rts ; The clipboard edp_ClipBoardBegin: dc.b 0 edp_ClipBoardNote: ds.b 32 edp_ClipBoardParam: ds.b 32 edp_ClipBoardLen: dc.b 0 edp_CutFlag: ; Temporary dc.b 0 ; patterns currently under editing EditRow: dc.b 0,0,0,0,0 MultTmp: dc.b 0 edp_INFOBLOCK: ;*** THE INFO BLOCK *** edp_EditMode: dc.b EDIT_PATTERN ; The line we are editing (in the middle of the edit area) edp_CurrentLine: dc.b 0 ; The column we are editing edp_CurrentColumn: dc.b 2 ; When a character was entered where should we go? ; any nonzero here will make it down else right edp_AdvanceMode: dc.b 0 edp_EditStep: dc.b 1 edp_InitRoutine: dc.w EditPattern edp_ScreenRoutine: dc.w edp_Screen edp_UpdateRoutine: dc.w edp_Update edp_KeyRoutine: dc.w edp_CheckKeys edp_TermRoutine: dc.w UnEditPattern edp_Length: dc.b 32-1 ; Number of shifts edp_Step: dc.b 1 edp_ColorTab: dc.b LineNumColor,LineNumColor dc.b Edit1Color,Edit1Color,Edit1Color,Edit1Color dc.b Edit2Color,Edit2Color,Edit2Color,Edit2Color dc.b Edit1Color,Edit1Color,Edit1Color,Edit1Color dc.b Edit2Color,Edit2Color,Edit2Color,Edit2Color dc.b Edit1Color,Edit1Color,Edit1Color,Edit1Color edp_CursorTab: dc.b CT_HIGHNYBBLE|CT_LINENUM,CT_LINENUM dc.b CT_HIGHNYBBLE|CT_DATA|CT_NOTE,CT_DATA|CT_NOTE dc.b CT_HIGHNYBBLE|CT_DATA,CT_DATA dc.b CT_HIGHNYBBLE|CT_DATA|CT_NOTE,CT_DATA|CT_NOTE dc.b CT_HIGHNYBBLE|CT_DATA,CT_DATA dc.b CT_HIGHNYBBLE|CT_DATA|CT_NOTE,CT_DATA|CT_NOTE dc.b CT_HIGHNYBBLE|CT_DATA,CT_DATA dc.b CT_HIGHNYBBLE|CT_DATA|CT_NOTE,CT_DATA|CT_NOTE dc.b CT_HIGHNYBBLE|CT_DATA,CT_DATA dc.b CT_HIGHNYBBLE|CT_DATA,CT_DATA dc.b CT_HIGHNYBBLE|CT_DATA,CT_DATA edp_AddressTabLOW: ds.b 22 edp_AddressTabHIGH: ds.b 22 ; eof
dino/lcs/enemy/4A.asm
zengfr/arcade_game_romhacking_sourcecode_top_secret_data
6
8857
<filename>dino/lcs/enemy/4A.asm<gh_stars>1-10 copyright zengfr site:http://github.com/zengfr/romhack 00042A move.l D1, (A0)+ 00042C dbra D0, $42a 004D3C move.l D0, (A4)+ 004D3E move.l D0, (A4)+ 0128FA move.b ($4a,A2), D2 0128FE add.w D2, D2 [123p+ 4A, enemy+4A, item+4A] 012900 or.b ($4a,A3), D2 012904 add.w D2, D2 [123p+ 4A, enemy+4A, etc+4A, item+4A] 0338AE clr.b ($4a,A6) [enemy+44, enemy+46] 0338B2 bsr $35812 [enemy+4A] 0338E2 clr.b ($4a,A6) [enemy+44, enemy+46] 0338E6 bsr $35812 033916 clr.b ($4a,A6) [enemy+44, enemy+46] 03391A bsr $35812 0359C8 clr.b ($4a,A6) [enemy+44, enemy+46] 0359CC moveq #$7, D0 03B2F8 clr.b ($4a,A6) [enemy+44, enemy+46] 03B2FC move.b #$54, ($58,A6) 03B872 clr.b ($4a,A6) [enemy+44, enemy+46] 03B876 move.b #$a, ($78,A6) [enemy+4A] 03DE74 clr.b ($4a,A6) [enemy+44, enemy+46] 03DE78 moveq #$8, D0 04033A clr.b ($4a,A6) [enemy+44, enemy+46] 04033E moveq #$7, D0 042134 clr.b ($4a,A6) [enemy+44, enemy+46] 042138 jsr $12cb4.l 04262E clr.b ($4a,A6) [enemy+44, enemy+46] 042632 move.b #$b, ($78,A6) 04582C clr.b ($4a,A6) [enemy+44, enemy+46] 045830 move.b #$a, ($78,A6) 0483C8 move.b #$1, ($4a,A6) [enemy+44, enemy+46] 0483CE move.b #$a, ($78,A6) [enemy+4A] 04D928 clr.b ($4a,A6) [enemy+44, enemy+46] 04D92C move.w #$14, ($6a,A6) 04DD42 move.b #$1, ($4a,A6) [enemy+44, enemy+46] 04DD48 move.b #$a, ($78,A6) [enemy+4A] 04FD82 clr.b ($4a,A6) [enemy+44, enemy+46] 04FD86 move.l A6, -(A7) 0512D2 clr.b ($4a,A6) [enemy+44, enemy+46] 0512D6 move.b #$2, ($0,A6) 053458 clr.b ($4a,A6) [enemy+44, enemy+46] 05345C move.b #$a, ($78,A6) 0558B2 clr.b ($4a,A6) [enemy+44, enemy+46] 0558B6 move.b #$1, ($0,A6) 055B48 clr.b ($4a,A6) [enemy+44, enemy+46] 055B4C move.b #$ff, ($7d,A6) 0572B4 clr.b ($4a,A6) [enemy+44, enemy+46] 0572B8 move.b #$2, ($0,A6) 0578C0 clr.b ($4a,A6) [enemy+44, enemy+46] 0578C4 move.w #$14, ($6a,A6) 057FD0 clr.b ($4a,A6) [enemy+44, enemy+46] 057FD4 move.b #$b, ($58,A6) 0580E2 clr.b ($4a,A6) [enemy+44, enemy+46] 0580E6 move.b #$1e, ($58,A6) 0584DC clr.b ($4a,A6) [enemy+44, enemy+46] 0584E0 moveq #$7, D0 05A4CA clr.b ($4a,A6) [enemy+44, enemy+46] 05A4CE move.b #$2a, ($58,A6) 05AADA clr.b ($4a,A6) [enemy+44, enemy+46] 05AADE moveq #$7, D0 05B0B4 clr.b ($4a,A6) [enemy+44, enemy+46] 05B0B8 moveq #$0, D0 05B938 clr.b ($4a,A6) [enemy+44, enemy+46] 05B93C moveq #$0, D0 05C3E0 clr.b ($4a,A6) [enemy+44, enemy+46] 05C3E4 moveq #$0, D0 05EE54 clr.b ($4a,A6) [enemy+44, enemy+46] 05EE58 moveq #$0, D0 05F622 clr.b ($4a,A6) [enemy+44, enemy+46] 05F626 move.b #$a, ($78,A6) 06A226 clr.b ($4a,A6) [enemy+44, enemy+46] 06A22A move.b #$b, ($58,A6) 0AAACA move.l (A0), D2 0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAACE move.w D0, ($2,A0) 0AAAD2 cmp.l (A0), D0 0AAAD4 bne $aaafc 0AAAD8 move.l D2, (A0)+ 0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAE6 move.l (A0), D2 0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] 0AAAF4 move.l D2, (A0)+ 0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1] copyright zengfr site:http://github.com/zengfr/romhack
src/display-fx.asm
kieranhj/funky-fresh
0
13169
\ -*- mode:beebasm -*- \ ****************************************************************** \ * DISPLAY FX \ ****************************************************************** \\ TODO: Support Display FX code in SWRAM banks. .display_fx_table { equw do_nothing, fx_static_image_draw, SLOT_BANK2 ; &00 equw fx_static_image_main_update, fx_static_image_draw, SLOT_BANK2 ; &01 equw fx_static_image_shadow_update, fx_static_image_draw, SLOT_BANK2 ; &02 equw fx_vertical_stretch_update, fx_vertical_stretch_draw, SLOT_BANK2 ; &03 equw fx_chunky_twister_update, fx_chunky_twister_draw, SLOT_BANK2 ; &04 equw fx_frequency_update, fx_frequency_draw, SLOT_BANK2 ; &05 equw fx_stretch_grid_update, fx_stretch_grid_draw, SLOT_BANK2 ; &06 equw fx_frak_zoomer_update, fx_frak_zoomer_draw, SLOT_BANK2 ; &07 ; v---------------------------------------------------------------------------- ; update DISPLAY_FX_MAX! } DISPLAY_FX_MAX = 8 .display_fx_update { lda rocket_track_display_fx+1 cmp display_fx beq return IF _DEBUG cmp #DISPLAY_FX_MAX ; protect against live editing errors! bcs return ENDIF \\ Set Display FX callbacks in IRQ. sta display_fx asl a:asl a clc adc display_fx:adc display_fx tax lda display_fx_table+0, X sta call_fx_update_fn+1 lda display_fx_table+1, X sta call_fx_update_fn+2 lda display_fx_table+2, X sta call_fx_draw_fn+1 lda display_fx_table+3, X sta call_fx_draw_fn+2 lda display_fx_table+4, X sta call_fx_update_slot+1 sta call_fx_draw_slot+1 .return rts }
asm/tests/delay.asm
mlndz28/selector-623
0
91794
<gh_stars>0 #include ../registers.inc #include ../init.asm #include ../isr.asm #include ../utilities.asm org UserTimerCh4 dw #OC4_ISR ; set user routine for timer org $3000 bset DDRB,$FF ; configure port B for output bset DDRJ,$02 ; configure PJ1 pin for output bclr PTJ,$02 ; enable bset DDRP,$0F ; set off 7 seg display bset TSCR1,$90 ; enable the timer module bset TSCR2,$03 ; set prescaler to 2^3 bset TIOS,$10 ; enable interruptions for channel 4 bset TIE,$10 cli bset ATD0CTL2,$C2 ; enable ATD interruptions with automatic flag clearing movb D5mS,Cont_Delay jsr DELAY movb D5mS,Cont_Delay jsr DELAY movb #$28,ATD0CTL3 ; 5 conversion cycles movb #$97,ATD0CTL4 ; 8 bit resolution, 2 clock cycles per leds to light lds #STACK movb #$B9,BIN1 movb #$BB,BIN2 movb #99,BRILLO clr LEDS TEST_L1: ; the leds change every second ;ldd #$13 ; (a little bit longer than that, actually) ldd #$83 ; (a little bit longer than that, actually) TEST_L2: ; 13 * 255 *2^3 * 20 / (24x10^6 ) [s] movb #$FF,Cont_Delay jsr DELAY cpd #0 dbne D,TEST_L2 inc LEDS ;movb #$FF,LEDS ;movb LEDS,PORTB bra TEST_L1 ;test ;from dbug12 import Debugger ;import os ;print(os.getcwd()) ;debugger = Debugger() ;debugger.load(open("asm/bin/delay_test.s19", "r").read()) ;debugger.run(0x3000) ;print("The LED's binary value should be incrementing by one every second")
oeis/056/A056109.asm
neoneye/loda-programs
11
176300
<filename>oeis/056/A056109.asm ; A056109: Fifth spoke of a hexagonal spiral. ; 1,6,17,34,57,86,121,162,209,262,321,386,457,534,617,706,801,902,1009,1122,1241,1366,1497,1634,1777,1926,2081,2242,2409,2582,2761,2946,3137,3334,3537,3746,3961,4182,4409,4642,4881,5126,5377,5634,5897,6166,6441,6722,7009,7302,7601,7906,8217,8534,8857,9186,9521,9862,10209,10562,10921,11286,11657,12034,12417,12806,13201,13602,14009,14422,14841,15266,15697,16134,16577,17026,17481,17942,18409,18882,19361,19846,20337,20834,21337,21846,22361,22882,23409,23942,24481,25026,25577,26134,26697,27266,27841 mov $1,3 mul $1,$0 add $1,2 mul $1,$0 add $1,1 mov $0,$1
alloy4fun_models/trashltl/models/13/zF28rZhit5fJLS4FB.als
Kaixi26/org.alloytools.alloy
0
2435
<gh_stars>0 open main pred idzF28rZhit5fJLS4FB_prop14 { all p: (Protected & Trash) | after p not in Protected } pred __repair { idzF28rZhit5fJLS4FB_prop14 } check __repair { idzF28rZhit5fJLS4FB_prop14 <=> prop14o }
Quiz and Lab Assessment/Solution/1.asm
afra-tech/CSE331L-Section-1-Fall20-NSU
0
105191
.MODEL SMALL .STACK 100H .DATA MSG1 DB 13, 10, "Please Enter a String: $" MSG2 DB 13, 10, "Palindrome of the String: $" .CODE MAIN PROC MOV AX, @DATA MOV DS, AX LEA DX, MSG1 MOV AH, 9 INT 21H MOV AH, 2 INT 21H MOV BL,AL @EXIT: MOV AH, 4CH INT 21H MAIN ENDP END MAIN
programs/oeis/037/A037483.asm
karttu/loda
1
244096
; A037483: Base 6 digits are, in order, the first n terms of the periodic sequence with initial period 1,2. ; 1,8,49,296,1777,10664,63985,383912,2303473,13820840,82925041,497550248,2985301489,17911808936,107470853617,644825121704,3868950730225,23213704381352,139282226288113,835693357728680,5014160146372081 mov $1,6 mov $3,$0 add $3,2 mov $2,$3 sub $2,1 pow $1,$2 mov $4,$1 div $4,7 add $1,$4 sub $1,6 div $1,5 add $1,1
test/Fail/Issue2067b.agda
shlevy/agda
1,989
1658
module _ where open import Agda.Builtin.Nat module M (n : Nat) where postulate A : Set module M₁ (m : Nat) where open module Mm = M m -- bar : M.A (m + 1) -- bar = m -- Nat !=< M.A (m + 1) postulate n : Nat foo : M.A n foo = n -- Nat !=< M.A n
base/init/assembly.asm
imsouza/low-level-programming
0
26936
<reponame>imsouza/low-level-programming bits 64 global assembly assembly: mov eax, 777 ret
tests/tests/device/iface_setup_dispatch/main.adb
JeremyGrosser/usb_embedded
0
11489
<filename>tests/tests/device/iface_setup_dispatch/main.adb -- Check that interface setup request are dispatched to the right class with USB_Testing; use USB_Testing; with USB_Testing.UDC_Stub; use USB_Testing.UDC_Stub; with USB_Testing.UDC_Scenarios; with HAL; use HAL; with USB.HAL.Device; use USB.HAL.Device; with USB; use USB; procedure Main is -- The Stub classes only have one interface each, so the interface IDs -- should be: -- -- Class 1 -> interface ID 0 -- -- Class 2 -> interface ID 1 Scenario : aliased constant UDC_Stub.Stub_Scenario := UDC_Scenarios.Enumeration (Verbose => False) & Stub_Scenario'(1 => (Kind => Set_Verbose, Verbose => True), 2 => (Kind => UDC_Event_E, Evt => (Kind => Setup_Request, Req => ((Iface, 0, Stand, Host_To_Device), 0, 0, 0, -- Interface ID of class 1 0), Req_EP => 0)), 3 => (Kind => UDC_Event_E, Evt => (Kind => Setup_Request, Req => ((Iface, 0, Stand, Host_To_Device), 0, 0, 1, -- Interface ID of class 2 0), Req_EP => 0)), 4 => (Kind => UDC_Event_E, Evt => (Kind => Setup_Request, Req => ((Iface, 0, Stand, Host_To_Device), 0, 0, 2, -- Invalid interface ID 0), Req_EP => 0)) ); RX_Data : aliased constant UInt8_Array := (0 .. 1 => 0); begin USB_Testing.UDC_Scenarios.Two_Classes_UDC_Test (Scenario, RX_Data); end Main;
ser.asm
dylancarlson/citplus
1
175924
; Ser.asm Updated 1/27/88 (c) Anticlimactic Teleservices Ltd. ; com3/4 support added Mar92/Brent Bottles - untested ; according to some silly contract, this update is copyright by Autodesk, Inc. ; as i wrote it on a computer belonging to Autodesk. but I don't care. ; use it all you want. ; 19200/38400 baud support and CTS checking added May92/Brent Bottles ; 57600 support Jun92/Brent Bottles ; 115200 support Nov92/Brent Bottles PAGE 60,132 TITLE RS232 utilities for the IBM Comment / ****************************************************************** ** ** ** Copyright 1986 <NAME> ** ** ** ** Permission is granted to use this module for any ** ** personal purposes. Permission is not granted for ** ** use of monetary gain or favor without the express ** ** written permission of the author, <NAME>. ** ** ** ** Regardless of the purpose of use, removal of the ** ** copyright message within the DATA segment violates ** ** all previous rights of use. In doing so, the user ** ** gives up all rights to the use of this module in any ** ** form. ** ** ** ****************************************************************** ****************************************************************** ** To convert back to small model, change all 'Far's to ** ** 'Near's. Change RetAdd 'dd' in StackFrame to 'dw'. ** *****************************************************************/ ifndef WINCIT RS232_INT Equ 0014h RING_BUF_SIZE Equ 4096d COM1PORT Equ 3f8h COM2PORT Equ 2f8h StackFrame Struc OldBP dw ? ; saved BP value RetAdd dd ? ; dw for small memory model Arg1 dw ? ; first argument passed Arg2 dw ? ; second argument passed Arg3 dw ? ; third argument passed Arg4 dw ? ; fourth argument passed Arg5 dw ? ; fifth argument passed Arg6 dw ? ; sixth argument passed StackFrame EndS ; ; These are currently set to support the small model of the ; Microsoft C compiler. ; IGROUP Group _Text DGROUP Group _Data Assume cs:IGROUP, ds:DGROUP, es:Nothing, ss:DGROUP SUBTTL Data area PAGE _Data Segment Word Public 'DATA' db 'Copyright 1986 <NAME>' CommX dw 0 RS_Base dw 0 OldRS_Off dw 0 OldRS_Seg dw 0 Head dw 0 Tail dw 0 InputBuffer db RING_BUF_SIZE dup(0) checkCTS db 0 _Data EndS SUBTTL Public declarations PAGE _Text Segment Byte Public 'CODE' Public _InitRS Public _DeInitRS Public _FlushRS Public _StatRS Public _GetRS Public _PutRS Public _DtrRS Public _CarrStatRS Public _RingStatRS Public _StatCON Public _GetCON ; Public _PutCON SUBTTL RS232 support routines PAGE ;****************************************************************************** ; ; Name: _InitRS ; ; Synopsis: void = InitRS(Port, Baud, Stops, Parity, Length, cCTS); ; ; int Port; 0 = COMM1 ; 1 = COMM2 ; 2 = COMM3 ; 3 = COMM4 ; int Baud; 0 = 110 ; 1 = 150 ; 2 = 300 ; 3 = 600 ; 4 = 1200 ; 5 = 2400 ; 6 = 4800 ; 7 = 9600 ; 8 = 19200 ; 9 = 38400 ; A = 57600 ; B = 115200 ; int Stops; 0 = 1 stop bit ; 1 = 2 stop bits ; int Parity; 0 = none ; 1 = odd ; 2 = none ; 3 = even ; int Length; 0 = 5 bit data length ; 1 = 6 bit data length ; 2 = 7 bit data length ; 3 = 8 bit data length ; int cCTS 0 = don't check CTS on output ; 1 = check CTS on output ; ; Description: Initialize one of the COMM ports based upon the passed ; parameters. ; ; Cautions: NOTE! ; There is no error checking on the passed parameters, ; only that each is masked for the number of bits that ; will be used for each one. ; ;****************************************************************************** RsInitRecord Record Rate:3, Parity:2, Stops:1, WLen:2 _InitRS Proc Far push bp mov bp, sp mov bx, [bp].Arg6 mov checkCTS, bl push es mov ax, 40h ; BIOS data area mov es, ax mov bx, [bp].Arg1 ; get the COMM number and bx, 11b ; mask everything else off mov CommX, bx ; save it for INT control cmp bx, 1 ja good_set or bx, bx jz is_com1 mov RS_Base, COM2PORT jmp short done_set is_com1: mov RS_Base, COM1PORT jmp short done_set good_set: shl bx, 1 ; make it a word value mov bx, es:[bx] ; get the base port number mov RS_Base, bx ; save it done_set: pop es mov dx, [bp].Arg1 ; get the COMM number sub bl, bl ; clear it for building RsInitRecord mov ax, [bp].Arg2 ; get the baud rate mov cl, Rate ; get the shift factor shl ax, cl ; shift it into place and ax, mask Rate ; mask the rate or bl, al ; OR it into RsInitRecord mov ax, [bp].Arg3 ; get the stop bits mov cl, Stops ; get the shift factor shl ax, cl ; shift it into place and ax, mask Stops ; mask the stop bits or bl, al ; OR it into RsInitRecord mov ax, [bp].Arg4 ; get the parity mov cl, Parity ; get the shift factor shl ax, cl ; shift it into place and ax, mask Parity ; mask the parity or bl, al ; OR it into RsInitRecord mov ax, [bp].Arg5 ; get the word length mov cl, WLen ; get the shift factor shl ax, cl ; shift it into place and ax, mask WLen ; mask the length or al, bl ; get the rest of RsInitRecord ; ; OK......now: ; AH = 0 ; AL = initialization bit pattern ; DX = comm number (0 or 1) ; int RS232_INT ; let BIOS do it ; we have to do 57600/19200/38400 baud manually... mov ax, [bp].Arg2 cmp ax, 8 jb no_special cmp ax, 9 je do_38400 cmp ax, 10 je do_57600 cmp ax, 11 je do_115200 ; do 19200 mov bl, 6 jmp short set_HS do_38400: mov bl, 3 jmp short set_HS do_57600: mov bl, 2 jmp short set_HS do_115200: mov bl, 1 set_HS: mov dx, RS_Base add dx, 3 in al, dx or al, 10000000b out dx, al mov dx, RS_Base mov al, bl out dx, al mov al, 0 inc dx out dx, al inc dx inc dx in al, dx and al, 01111111b out dx, al ; ; Set up the ring buffer pointers, our interrupt vector, ; set the UART to interrupt on data available, then set ; the interrupt controller to handle the UART requests. ; no_special: mov Head, 0 ; set the head... mov Tail, 0 ;...and the tail pointers push es sub ax, ax mov es, ax ; point to the INT vectors mov bx, 1 ; preset it mov cx, CommX and cx, 1 sub bx, cx ; COMM1 = 1, COMM2 = 0, 3 = 1, 4 = 0 add bx, 0bh ; add in the base INT number shl bx, 1 ; x4 to adjust it to point to the INT shl bx, 1 mov ax, es:[bx] ; get the offset mov OldRS_Off, ax ; save it mov ax, es:[bx + Word] ; get the segment mov OldRS_Seg, ax ; save it lea ax, _Service_RS ; point to the interrupt routine pushf ; save the flag status cli ; no interrupts during this mov es:[bx], ax ; install the offset mov es:[bx + Word], cs ; install the vector popf ; restore int. flag to entry status pop es ; ; Enable UART to generate interrupts on input. ; mov dx, RS_Base ; get the port address inc dx ; InterruptEnableRegister mov al, 1 ; enable data available mask out dx, al ; RS232 data in is now interrupt driven ; ; Set the OUT2 bit in Modem Control Register (enables interrupt line) ; And RTS ; mov dx, RS_Base ; get the port address in al, dx ; read the serial port to clear it add dx, 4 ; ModemControlRegister in al, dx ; get contents of ModemControlRegister or al, 10 ; set the OUT2 bit (enables interrupts) ; and rts out dx, al ; Interrupts will be handled properly ; ; Enable the interrupt controller to respond to the UART requests. ; mov bx, 1 ; preset it mov ax, CommX and ax, 1 sub bx, ax ; COMM1 = 1, COMM2 = 0, 3 = 1, 4 = 0 inc bx ; set bit 0 or 1 shl bx, 1 ; shift it out to bit 3 or 4 shl bx, 1 shl bx, 1 not bl ; invert the mask pushf ; save the flag status cli ; no interrupts when setting controller in al, 21h ; get current status and al, bl ; mask out the COMM bit out 21h, al ; reset the controller popf ; restore int. flag to entry status pop bp ret _InitRS EndP ;****************************************************************************** ; ; Name: _DeInitRS ; ; Synopsis: void = DeInitRS(); ; ; Description: Restores the saved INT vector set during _InitRS, ; resets the UART not to generate interrupts, and ; resets the interrupt controller not to respond to ; the UART. ; ;****************************************************************************** _DeInitRS Proc Far mov dx, RS_Base ; get the port address or dx, dx jz dirs_ret inc dx ; InterruptEnableRegister sub al, al ; disable all RS232 interrupts out dx, al ; its done ; ; Turn off OUT2 bit in Modem Control Register (disables interrupt line) ; mov dx, RS_Base ; get the port address add dx, 4 ; ModemControlRegister in al, dx ; get contents of ModemControlRegister and al, 0F7h ; set the OUT2 bit (disables interrupts) out dx, al ; Interrupts will be disabled mov bx, 1 ; preset it mov cx, CommX and cx, 1 sub bx, cx ; COMM1 = 1, COMM2 = 0, 3 = 1, 4 = 0 inc bx ; set bit 0 or 1 shl bx, 1 ; shift it out to bit 3 or 4 shl bx, 1 shl bx, 1 pushf ; save the flag status cli ; no interrupts when setting controller in al, 21h ; get current status or al, bl ; force the COMM bit on for disable out 21h, al ; reset the controller popf ; restore int. flag to entry status push es sub ax, ax mov es, ax ; point to the INT vectors mov bx, 1 ; preset it mov cx, CommX and cx, 1 sub bx, cx ; COMM1 = 1, COMM2 = 0, 3 = 1, 4 = 0 add bx, 0bh ; add in the base INT number shl bx, 1 ; adjust it to point to the INT shl bx, 1 mov ax, OldRS_Off ; get the offset mov cx, OldRS_Seg ; get the segment pushf ; save the flag status cli ; no interrupts during this mov es:[bx], ax ; reset the offset mov es:[bx + Word], cx ; reset the segment popf ; restore int. flag to entry status pop es mov RS_Base, 0 dirs_ret: ret _DeInitRS EndP ;****************************************************************************** ; ; Name: _FlushRS ; ; Synopsis: void FlushRS(); ; ; Description: Reset the RS232 input buffer to empty. ; ;****************************************************************************** _FlushRS Proc Far sub ax, ax ; clear it to zero mov Head, ax ; clear the head mov Tail, ax ; clear the tail ret _FlushRS EndP ;****************************************************************************** ; ; Name: _StatRS ; ; Synopsis: Status = StatRS(); ; ; int Status; current COMM status ; ; Description: If Status = 0, then the ring buffer is empty, else ; there is at least one character waiting. ; ;****************************************************************************** _StatRS Proc Far mov ax, Head ; get the head pointer sub ax, Tail ; if they are the same, its empty ret _StatRS EndP ;****************************************************************************** ; ; Name: _GetRS ; ; Synopsis: Character = GetRS(); ; ; int Character; byte from RS232 RX buffer ; ; Description: Gets the next character from the input ring buffer. ; ; Cautions: If there is nothing there, it will wait for one. ; ;****************************************************************************** _GetRS Proc Far mov dx, RS_Base or dx, dx jz Exit_GetRS wait_rs: mov ax, Head ; get the head pointer sub ax, Tail ; if they are the same, its empty jz wait_rs ; wait for something mov bx, Tail ; get the tail pointer mov al, InputBuffer[bx] ; get whats there sub ah, ah ; clear the MSB inc bx ; bump the pointer cmp bx, RING_BUF_SIZE ; about to wrap? jne SetTheTail ; nope sub bx, bx ; reset for the wrap SetTheTail: mov Tail, bx ; update the pointer Exit_GetRS: ret _GetRS EndP ;****************************************************************************** ; ; Name: _PutRS ; ; Synopsis: void = PutRS(Character); ; ; char Character; byte for RS232 TX buffer ; ; Description: Stuffs a character into THRE. ; ;****************************************************************************** _PutRS Proc Far mov dx, RS_Base ; get the base address or dx, dx jz prs_ret push bp mov bp, sp add dx, 5 ; line status register THRE_Status: in al, dx ; get the line status test al, 20h ; THRE empty? jz THRE_Status ; not yet inc dx cmp checkCTS, 0 je no_CTS CTS_Status: in al, dx test al, 10h jz CTS_Status no_CTS: sub dx, 6 ; back to the base register mov ax, [bp].Arg1 ; get the character out dx, al ; send it out pop bp prs_ret: ret _PutRS EndP ;****************************************************************************** ; ; Name: _DtrRS ; ; Synopsis: void = DtrRS(Dtr); ; ; int Port; 0 = dtr off ; 1 = dtr on ; ; Description: Sets bit 0:DTR of ModemControlRegister according to Dtr. ; ;****************************************************************************** _DtrRS Proc Far mov dx, RS_Base ; get the port address or dx, dx jz drs_ret push bp mov bp, sp ; ; Change the DTR bit in Modem Control Register ; add dx, 4 ; ModemControlRegister in al, dx ; get contents of ModemControlRegister cmp [bp].Arg1, 0 ; Dtr on? or Off. je DtrOff ; Off, jump to DtrOff or al, 1 ; DtrOn, turn bit 0:DTR on jmp short EndOfDtrRS ; Jump to set bit DtrOff: and al, 0FEh ; DtrOff, turn bit 0:DTR off EndOfDtrRS: out dx, al pop bp drs_ret: ret _DtrRS EndP ;****************************************************************************** ; ; Name: _CarrStatRS ; ; Synopsis: Status = CarrStatRS(); ; ; int Status; current COMM carrier status ; ; Description: If Status = 0, then carrier is not present ; else there is carrier detected. ; ;****************************************************************************** _CarrStatRS Proc Far mov dx, RS_Base ; get the port address or dx, dx jz csrs_ret ; push bp ; mov bp, sp add dx, 6 ; ModemStatusRegister in al, dx ; get contents of ModemStatusRegister and al, 080h ; mask out all but bit 7:CD bit cmp al, 080h ; test cd bit mov ax, 0 ; assume status is zero jne EndOfCarrStatRS ; don't set AX inc ax EndOfCarrStatRS: ; pop bp csrs_ret: ret _CarrStatRS EndP ;****************************************************************************** ; ; Name: _RingStatRS ; ; Synopsis: Status = RingStatRS(); ; ; int Status; current COMM ring status ; ; Description: If Status = 0, then ring indicator bit is false ; else ring indicator bit is true. ; ;****************************************************************************** _RingStatRS Proc Far mov dx, RS_Base ; get the port address or dx, dx jz rsrs_end push bp mov bp, sp add dx, 6 ; ModemStatusRegister in al, dx ; get contents of ModemStatusRegister and al, 040h ; mask out all but bit 6:RI bit cmp al, 040h ; test ri bit mov ax, 0 ; assume status is zero jne EndOfRingStatRS ; don't set AX mov ax, 1 EndOfRingStatRS: pop bp rsrs_end: ret _RingStatRS EndP SUBTTL RS232 interrupt handler PAGE ;****************************************************************************** ; R S 2 3 2 I N T E R R U P T H A N D L E R ;****************************************************************************** _Service_RS Proc Far sti ; interrupts back on push ds push dx push cx push bx push ax mov ax, DGROUP mov ds, ax ; get pointer to our data mov dx, RS_Base ; base address of COMM port in al, dx ; get the character mov bx, Head ; point to the head of the buffer mov cx, bx ; get the offset inc cx ; bump it cmp cx, RING_BUF_SIZE ; about to wrap? jne NoWrapYet ; nope sub cx, cx ; reset for the wrap NoWrapYet: cmp cx, Tail ; about to overflow? je Short EndOfRS232Service ; yup, get out mov InputBuffer[bx], al ; save the character mov Head, cx ; reset the buffer head EndOfRS232Service: mov al, 20h ; EOI command out 20h, al ; tell the interrupt controller pop ax pop bx pop cx pop dx pop ds iret _Service_RS EndP ;****************************************************************************** ; ; Name: _StatCON ; ; Synopsis: Status = StatCON(); ; ; int Status; current CON status ; ; Description: If Status = 0, the keyboard buffer is empty, else not ; ;****************************************************************************** _StatCON Proc Far mov ah, 1 ; read keyboard status int 16h ; BIOS keyboard service jnz Char ; is there a character? xor ax, ax ; no character, return zero ret Char: ;========================================================================== mov ax, 1 ; character, return non zero ret ;========================================================================== _StatCON EndP ;****************************************************************************** ; ; Name: _GetCON ; ; Synopsis: Character = GetCON(); ; ; int Character; int from keyboard buffer ; ; Description: Gets the next character and scan code from the keyboard buffer. ; Is not affected by Ctrl-C, Ctrl-S etc. ; ; Cautions: If there is nothing there, it will wait for one. ; ;****************************************************************************** _GetCON Proc Far mov ah, 0 ; read keyboard character int 16h ; BIOS keyboard service or al, al ; extended character? je Extended xor ah, ah ; no, zero high byte Extended: ret _GetCON EndP ifdef GOODBYE ;****************************************************************************** ; ; Name: _PutCON ; ; Synopsis: void = PutCON(Character); ; ; char Character; byte to be written to display ; ; Description: Writes character but is not affected by Ctrl-C, Ctrl-S etc. ; ;****************************************************************************** _PutCON Proc Far push bp mov bp, sp mov ax, [bp].Arg1 ; character to display mov ah, 0eh ; write text in teletype mode mov bh, 0 ; page zero int 10h ; BIOS video service pop bp ret _PutCON EndP endif _Text Ends endif End
libsrc/_DEVELOPMENT/l/z80/longlong/fast/l_fast_lsr_dehldehl.asm
jpoikela/z88dk
640
246628
<filename>libsrc/_DEVELOPMENT/l/z80/longlong/fast/l_fast_lsr_dehldehl.asm<gh_stars>100-1000 SECTION code_clib SECTION code_l PUBLIC l_fast_lsr_dehldehl EXTERN l_lsr_dehl EXTERN error_lznc l_fast_lsr_dehldehl: ; logical shift right 64-bit number ; ; enter : dehl'dehl = 64-bit number ; a = shift amount ; ; exit : dehl'dehl = dehl'dehl >> a ; ; uses : af, b, de, hl, de', hl' or a ret z sub 32 jr c, shift_64 ; shift at least 32 bits call error_lznc exx jp l_lsr_dehl shift_64: add a,32 loop: sub 8 jr c, fine_shift ld b,a exx ld a,l ld l,h ld h,e ld e,d ld d,0 exx ld l,h ld h,e ld e,d ld d,a ld a,b jr loop fine_shift: add a,8 ret z ld b,a ld a,e shift_loop: exx srl d rr e rr h rr l exx rr d rra rr h rr l djnz shift_loop ld e,a ret
tests/mobs-protomobrecord_test_data.adb
thindil/steamsky
80
6692
-- This package is intended to set up and tear down the test environment. -- Once created by GNATtest, this package will never be overwritten -- automatically. Contents of this package can be modified in any way -- except for sections surrounded by a 'read only' marker. package body Mobs.ProtoMobRecord_Test_Data is -- Local_ProtoMobRecord : aliased GNATtest_Generated.GNATtest_Standard.Mobs.ProtoMobRecord; procedure Set_Up(Gnattest_T: in out Test_ProtoMobRecord) is begin GNATtest_Generated.GNATtest_Standard.Crew.Mob_Record_Test_Data .Mob_Record_Tests .Set_Up (GNATtest_Generated.GNATtest_Standard.Crew.Mob_Record_Test_Data .Mob_Record_Tests .Test_Mob_Record (Gnattest_T)); null; -- Gnattest_T.Fixture := Local_ProtoMobRecord'Access; end Set_Up; procedure Tear_Down(Gnattest_T: in out Test_ProtoMobRecord) is begin GNATtest_Generated.GNATtest_Standard.Crew.Mob_Record_Test_Data .Mob_Record_Tests .Tear_Down (GNATtest_Generated.GNATtest_Standard.Crew.Mob_Record_Test_Data .Mob_Record_Tests .Test_Mob_Record (Gnattest_T)); end Tear_Down; end Mobs.ProtoMobRecord_Test_Data;
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sdcc/exp2_fastcall.asm
jpoikela/z88dk
640
101648
SECTION code_fp_math32 PUBLIC _exp2_fastcall EXTERN _m32_exp2f defc _exp2_fastcall = _m32_exp2f
libsrc/_DEVELOPMENT/target/zx/driver/terminal/zx_01_output_char_32_tty_z88dk/zx_01_output_char_32_tty_z88dk_01_scroll.asm
jpoikela/z88dk
640
86954
SECTION code_driver SECTION code_driver_terminal_output PUBLIC zx_01_output_char_32_tty_z88dk_01_scroll EXTERN console_01_output_char_proc_putchar_scroll_adjust zx_01_output_char_32_tty_z88dk_01_scroll: ; scroll window upward one row ld a,1 jp console_01_output_char_proc_putchar_scroll_adjust
xuanYue-seach/src/main/resources/BitQ.g4
guanhaixie/bitQL
1
6092
grammar BitQ; @header { package com.xuanyue.db.xuan.antlr; } @lexer::members{ private int parallel = 1; java.util.regex.Pattern parallelReg = java.util.regex.Pattern.compile("parallel\\s*?\\(\\s*?(\\d+?)\\s*?\\)"); java.util.regex.Pattern p = java.util.regex.Pattern.compile("/\\*(.*?)\\*/"); public int getParallel(){ return this.parallel; } void showme(){ java.util.regex.Matcher m = p.matcher(this.getText()); if(m.find()){ java.util.regex.Matcher m2 = parallelReg.matcher(m.group(1)); if(m2.find()) { parallel = Integer.parseInt(m2.group(1)); if(parallel<1){ parallel=1; }else if(parallel>20){ parallel =20; } } } skip(); } } @parser::members{ @Override public Token match(int ttype) throws RecognitionException { Token t = getCurrentToken(); if ( t.getType()==ttype ) { if ( ttype==Token.EOF ) { matchedEOF = true; } _errHandler.reportMatch(this); consume(); return t; } else { throw new RuntimeException("miss "+ _SYMBOLIC_NAMES[ttype]); } } } query : expr; //expr : SELECT result FROM repo (WHERE orCondition groupBy? sortBy? mix? limit? SEMI)?; expr : SELECT result FROM repo (WHERE orCondition)? sortBy? mix? limit? saveAsFile? SEMI?; //groupBy:Group By fullName (Having function op=('=' | '!='|'>='|'>'|'<='|'<') NUM)?; //function: op=(Sum|Max|Min|Count|Avg) '(' (fullName|NUM) ')'; repo: fullName (',' fullName)*; saveAsFile: SAVE AS STRING; tablePart: tjoinPart|fullName; tjoinPart: fullName ((LEFT|RIGHT) JOIN fullName ON orCondition)*; orCondition : NOT? andCondition (operator=orNot andCondition)*; andCondition : conditionElement (operator=andNot conditionElement)*; conditionElement: groupCondition|conditionExpr; groupCondition: '(' orCondition ')'; conditionExpr : fullName op=('=' | '!='|'>='|'>'|'<='|'<'|Contains|PositionMatch) values|phone_seach; values:to_date|STRING|NUM|fullName|boolTF|TransArrt; to_date:TO_DATE '(' STRING COMMA STRING ')'; //date_attr:STRING; result:fullName(','fullName)*; //result:fullName(','fullName)*|function(','function)*; fullName:NAME ('.'NAME)*; boolTF: TRUE|FALSE; TransArrt:'?'[a-zA-Z_0-9]+; orNot:OR NOT?; andNot:AND NOT?; phone_seach:Phone_seach '(' fullName ',' op=(PositionMatch|Contains|Has_Every_Char) ','STRING ')'; sortE: fullName('[' STRING ']')? (DESC|ASC)?; sortBy: Order By sortE (','sortE)*; limit:LIMIT NUM(','NUM)?; mix:MIX fullName ('[' NUM (','NUM)* ']')?; //Sum:[Ss][Uu][Mm]; //Max:[Mm][Aa][Xx]; //Min:[Mm][Ii][Nn]; //Avg:[Aa][Vv][Gg]; //Count:[Cc][Oo][Uu][Nn][Tt]; //Having:[Hh][Aa][Vv][Ii][Nn][Gg]; //Group:[Gg][Rr][Oo][Uu][Pp]; SAVE:[Ss][Aa][Vv][Ee]; AS:[Aa][Ss]; MIX:[Mm][Ii][Xx]; DESC:[Dd][Ee][Ss][Cc]; ASC:[Aa][Ss][Cc]; Phone_seach:[Pp][Hh][Oo][Nn][Ee]'_'[Ss][Ee][Aa][Cc][Hh]; PositionMatch:[Pp][Oo][Ss][Ii][Tt][Ii][Oo][Nn][Mm][Aa][Tt][Cc][Hh]; Contains:[Cc][Oo][Nn][Tt][Aa][Ii][Nn][Ss]; Has_Every_Char:[Hh][Aa][Ss]'_'[Ee][Vv][Ee][Rr][Yy]'_'[Cc][Hh][Aa][Rr]; SELECT : [Ss][Ee][Ll][Ee][Cc][Tt]; FROM : [Ff][Rr][Oo][Mm]; WHERE : [Ww][Hh][Ee][Rr][Ee]; ON:[Oo][Nn]; LEFT:[Ll][Ee][Ff][Tt]; RIGHT:[Rr][Ii][Gg][Hh][Tt]; JOIN:[Jj][Oo][Ii][Nn]; AND : [Aa][Nn][Dd]; OR : [Oo][Rr]; NOT : [Nn][Oo][Tt]; TO_DATE:[Tt][Oo]'_'[Dd][Aa][Tt][Ee]; ExprNot:'!'; COMMA : ','; SEMI : ';'; LIMIT:[Ll][Ii][Mm][Ii][Tt]; Order:[Oo][Rr][Dd][Ee][Rr]; By:[Bb][Yy]; NAME:[a-zA-Z][a-zA-Z_0-9]*; DOT:'.'; Brackets_L:'('; Brackets_R:')'; STRING : '\'' ( ~('\''|'\\') | ('\\' .) )* '\'' | '"' ( ~('"'|'\\') | ('\\' .) )* '"' ; //INT : '0'..'9'+; NUM: '0'..'9'+(DOT '0'..'9'+ )?('l'|'f')?; TRUE:[Tt][Rr][Uu][Ee]; FALSE:[Ff][Aa][Ll][Ss][Ee]; WS : [ \t\n\r]+ -> skip ; SQL_COMMENT : '/*' .*? '*/' { showme(); };
antlr-basics/src/main/java/com/poc/chapter_05_part03/LogDetectionPart1.g4
cgonul/antlr-poc
0
1251
grammar LogDetectionPart1; file : NL+ ; STUFF : ~'\n'+ -> skip ; NL : '\n' ;
libsrc/_DEVELOPMENT/alloc/malloc/c/sdcc_iy/free_fastcall.asm
jpoikela/z88dk
640
90510
; void free_fastcall(void *p) INCLUDE "config_private.inc" SECTION code_clib SECTION code_alloc_malloc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IF __CLIB_OPT_MULTITHREAD & $01 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PUBLIC _free_fastcall EXTERN asm_free defc _free_fastcall = asm_free ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ELSE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PUBLIC _free_fastcall EXTERN _free_unlocked_fastcall defc _free_fastcall = _free_unlocked_fastcall ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ENDIF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_446.asm
ljhsiun2/medusa
9
166538
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r9 push %rbp push %rbx push %rcx push %rdi push %rdx lea addresses_D_ht+0x1567f, %r10 nop nop nop nop nop and %rcx, %rcx mov (%r10), %di nop nop nop nop dec %rbx lea addresses_UC_ht+0x85a7, %rdx nop and %r9, %r9 and $0xffffffffffffffc0, %rdx movntdqa (%rdx), %xmm1 vpextrq $1, %xmm1, %rbp nop nop nop nop nop and $39529, %rdi lea addresses_WC_ht+0x3ca7, %rcx nop nop nop nop nop add $11013, %r10 mov (%rcx), %r9w nop and %rbx, %rbx lea addresses_WC_ht+0x44a7, %rdx nop nop nop add %rbx, %rbx mov $0x6162636465666768, %rcx movq %rcx, %xmm0 movups %xmm0, (%rdx) and $9740, %rdi lea addresses_WT_ht+0xd2a7, %rbx nop nop nop dec %r9 mov $0x6162636465666768, %rbp movq %rbp, %xmm4 movups %xmm4, (%rbx) nop sub %rdx, %rdx lea addresses_normal_ht+0x546c, %r10 nop nop cmp $55307, %rbx movups (%r10), %xmm3 vpextrq $1, %xmm3, %r9 nop nop nop nop sub $24933, %rdx lea addresses_A_ht+0xe803, %r10 xor $18528, %rdx mov (%r10), %r9w nop nop cmp $12526, %rdx lea addresses_WC_ht+0xcaa7, %rcx clflush (%rcx) nop nop nop cmp %rdx, %rdx movb $0x61, (%rcx) nop cmp $17553, %rbp lea addresses_A_ht+0x19843, %r9 and %rdx, %rdx mov $0x6162636465666768, %rbx movq %rbx, %xmm1 vmovups %ymm1, (%r9) dec %r10 pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r9 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r15 push %r9 push %rcx push %rdi // Faulty Load lea addresses_normal+0x1b4a7, %r15 nop nop nop nop nop sub %r9, %r9 vmovups (%r15), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $1, %xmm2, %rdi lea oracles, %r15 and $0xff, %rdi shlq $12, %rdi mov (%r15,%rdi,1), %rdi pop %rdi pop %rcx pop %r9 pop %r15 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 8, 'size': 16, 'same': False, 'NT': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 7, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 11, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 9, 'size': 16, 'same': True, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 8, 'size': 1, 'same': False, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 2, 'size': 32, 'same': False, 'NT': False}} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
examples/chrome_tabs.scpt
disruptek/gene.nim
9
2605
#!/usr/bin/env osascript set _output to "" set sep to tab set newline to " " -- CSV header row set _output to _output & "window" & sep & "tab" & sep & "url" & sep & "title" & newline tell application "Google Chrome" set _window_index to 1 repeat with _window in windows try set _tab_count to (count of tabs in _window) set _tab_index to 1 repeat with _tab in tabs of _window set _output to _output & (_window_index as string) & sep & (_tab_index as string) & sep & url of _tab & sep & title of _tab & newline set _tab_index to _tab_index + 1 end repeat end try set _window_index to _window_index + 1 end repeat end tell _output
oeis/227/A227265.asm
neoneye/loda-programs
11
20937
<reponame>neoneye/loda-programs<gh_stars>10-100 ; A227265: Number of n X 2 0,1 arrays indicating 2 X 2 subblocks of some larger (n+1) X 3 binary array having a sum of three or less, with rows and columns of the latter in lexicographically nondecreasing order. ; 3,8,16,30,54,93,153,241,365,534,758,1048,1416,1875,2439,3123,3943,4916,6060,7394,8938,10713,12741,15045,17649,20578,23858,27516,31580,36079,41043,46503,52491,59040,66184,73958,82398,91541,101425,112089,123573,135918,149166,163360,178544,194763,212063,230491,250095,270924,293028,316458,341266,367505,395229,424493,455353,487866,522090,558084,595908,635623,677291,720975,766739,814648,864768,917166,971910,1029069,1088713,1150913,1215741,1283270,1353574,1426728,1502808,1581891,1664055,1749379 add $0,3 mov $1,4 mul $1,$0 bin $0,4 add $1,$0 sub $1,9 mov $0,$1
kernel/kernel.asm
paulscottrobson/MZ-Compiler
0
6468
<filename>kernel/kernel.asm ; *************************************************************************************** ; *************************************************************************************** ; ; Name : kernel.asm ; Author : <NAME> (<EMAIL>) ; Date : 8th November 2018 ; Purpose : MZ Kernel ; ; *************************************************************************************** ; *************************************************************************************** StackTop = $7EF0 ; Top of stack DictionaryPage = $20 ; dictionary page FirstCodePage = $22 opt zxnextreg org $8000 jr Boot org $8004 dw SystemInformation Boot: ld sp,(SIStack) ; reset Z80 Stack di ; enable interrupts nextreg 7,2 ; set turbo port (7) to 2 (14Mhz) call SetMode48k ; initialise and clear screen. ld a,(SIBootCodePage) ; get the page to start nextreg $56,a inc a nextreg $57,a dec a ex af,af' ; set the current code page in A' ld hl,(SIBootCodeAddress) jp (hl) include "support/multiply.asm" ; support functions include "support/divide.asm" include "support/keyboard.asm" AlternateFont: include "font.inc" include "__words.asm" include "data.asm" org $C000 db 0 ; start of dictionary, which is empty.
libpok/ada/arinc653/apex-timing.ads
sinkinben/pok
2
20073
-- --------------------------------------------------------------------------- -- -- -- TIME constant and type definitions and management services -- -- -- -- --------------------------------------------------------------------------- package APEX.Timing is procedure Timed_Wait (Delay_Time : in System_Time_Type; Return_Code : out Return_Code_Type); procedure Periodic_Wait (Return_Code : out Return_Code_Type); procedure Get_Time (System_Time : out System_Time_Type; Return_Code : out Return_Code_Type); procedure Replenish (Budget_Time : in System_Time_Type; Return_Code : out Return_Code_Type); -- POK BINDINGS pragma Import (C, Timed_Wait, "TIMED_WAIT"); pragma Import (C, Periodic_Wait, "PERIODIC_WAIT"); pragma Import (C, Get_Time, "GET_TIME"); pragma Import (C, Replenish, "REPLENISH"); -- END OF POK BINDINGS end Apex.Timing;
oeis/161/A161583.asm
neoneye/loda-programs
11
381
<filename>oeis/161/A161583.asm ; A161583: The list of the k values in the common solutions to the 2 equations 15*k+1=A^2, 19*k+1=B^2. ; Submitted by <NAME> ; 0,17,4896,1405152,403273745,115738159680,33216448554432,9533004996962321,2735939217679631712,785205022469057339040,225351105509401776672785,64674982076175840847750272,18561494504756956921527655296,5327084247883170460637589319697 mov $3,1 lpb $0 sub $0,1 mov $1,$3 mul $1,15 add $2,$1 add $3,$2 lpe pow $3,2 mov $0,$3 div $0,15
source/slim-messages-grfe.adb
reznikmm/slimp
0
5132
-- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with Slim.Message_Visiters; package body Slim.Messages.grfe is List : constant Field_Description_Array := ((Uint_16_Field, 1), -- Offset (Uint_8_Field, 1), -- Transition (Uint_8_Field, 1), -- Param (Custom_Field, 1)); -- Data ---------- -- Data -- ---------- not overriding function Data (Self : Grfe_Message) return Ada.Streams.Stream_Element_Array is begin return Self.Data.To_Stream_Element_Array; end Data; ---------- -- Read -- ---------- overriding function Read (Data : not null access League.Stream_Element_Vectors.Stream_Element_Vector) return Grfe_Message is begin return Result : Grfe_Message do Read_Fields (Result, List, Data.all); end return; end Read; ----------------------- -- Read_Custom_Field -- ----------------------- overriding procedure Read_Custom_Field (Self : in out Grfe_Message; Index : Positive; Input : in out Ada.Streams.Stream_Element_Offset; Data : League.Stream_Element_Vectors.Stream_Element_Vector) is use type Ada.Streams.Stream_Element_Offset; Content : constant Ada.Streams.Stream_Element_Array (1 .. Data.Length) := Data.To_Stream_Element_Array; begin pragma Assert (Index = 1); Self.Data.Clear; Self.Data.Append (Content (Input .. Content'Last)); Input := Content'Last + 1; end Read_Custom_Field; ---------------- -- Initialize -- ---------------- not overriding procedure Initialize (Self : in out Grfe_Message; Value : Ada.Streams.Stream_Element_Array; Transition : Slim.Players.Displays.Transition_Kind := Slim.Players.Displays.None; Offset : Natural := 0) is use Slim.Players.Displays; Map : constant array (Transition_Kind) of Interfaces.Unsigned_8 := (None => Character'Pos ('c'), Left => Character'Pos ('l'), Right => Character'Pos ('r'), Up => Character'Pos ('u'), Down => Character'Pos ('d')); begin Self.Data_16 (1) := Interfaces.Unsigned_16 (Offset); Self.Data_8 (1) := Map (Transition); -- Transition Self.Data_8 (2) := Interfaces.Unsigned_8 (Offset); -- Param Self.Data.Clear; Self.Data.Append (Value); end Initialize; ----------- -- Visit -- ----------- overriding procedure Visit (Self : not null access Grfe_Message; Visiter : in out Slim.Message_Visiters.Visiter'Class) is begin Visiter.grfe (Self); end Visit; ----------- -- Write -- ----------- overriding procedure Write (Self : Grfe_Message; Tag : out Message_Tag; Data : out League.Stream_Element_Vectors.Stream_Element_Vector) is begin Tag := "grfe"; Write_Fields (Self, List, Data); end Write; ------------------------ -- Write_Custom_Field -- ------------------------ overriding procedure Write_Custom_Field (Self : Grfe_Message; Index : Positive; Data : in out League.Stream_Element_Vectors.Stream_Element_Vector) is begin pragma Assert (Index = 1); Data.Append (Self.Data); end Write_Custom_Field; end Slim.Messages.grfe;
programs/oeis/086/A086500.asm
neoneye/loda
22
23503
<filename>programs/oeis/086/A086500.asm ; A086500: Group the natural numbers such that the n-th group sum is divisible by the n-th triangular number: (1), (2, 3, 4), (5, 6, 7), (8, 9, 10, 11, 12), (13, 14, 15, 16, 17), (18, 19, 20, 21, 22, 23, 24), ... Sequence contains the group sum. ; 1,9,18,50,75,147,196,324,405,605,726,1014,1183,1575,1800,2312,2601,3249,3610,4410,4851,5819,6348,7500,8125,9477,10206,11774,12615,14415,15376,17424,18513,20825,22050,24642,26011,28899,30420,33620,35301 add $0,2 mov $1,$0 bin $0,2 pow $0,2 div $1,2 div $0,$1
dd/dev/init.asm
olifink/smsqe
0
8806
<reponame>olifink/smsqe ; DEV initialisation V2.00  1985 <NAME> QJUMP section dev xdef dev_init xdef dev_name xref.l dev_vers xref gu_achpp xref dev_open xref ut_procdef xref dev_xinit include 'dev8_mac_proc' include 'dev8_keys_iod' include 'dev8_keys_qdos_sms' include 'dev8_keys_err' include 'dev8_dd_dev_data' ;+++ ; Initialise DEV_USE and DEV device. ; ; status return standard ;--- dev_init lea proctab,a1 jsr ut_procdef move.l #dvd_end,d0 ; allocate linkage jsr gu_achpp move.l a0,a3 lea dev_open,a1 move.l a1,iod_open(a3) ; just open lea dev_nimp,a1 move.l a1,iod_frmt(a3) ; and format lea iod_plen(a3),a1 move.l #dvd.plen,(a1)+ ; physical linkage move.l a1,a0 ; drive name move.w #3,(a0)+ move.l dev_name,(a0)+ move.w (a1)+,(a0)+ move.l (a1),(a0) lea iod_iolk(a3),a0 ; link in moveq #sms.lfsd,d0 trap #do.sms2 jmp dev_xinit ; extra init dev_nimp moveq #err.nimp,d0 rts dev_name dc.l 'DEV0' section procs proctab proc_stt proc_def DEV_USE proc_def DEV_USEN proc_def DEV_LIST proc_end proc_stt proc_def DEV_USE$ proc_def DEV_NEXT proc_end end
src/Categories/Category/Construction/Properties/Functors.agda
Trebor-Huang/agda-categories
279
11009
<gh_stars>100-1000 {-# OPTIONS --without-K --safe #-} module Categories.Category.Construction.Properties.Functors where open import Categories.Category.Complete.Properties using ( Functors-Complete ; evalF-Continuous) public open import Categories.Category.Cocomplete.Properties using (Functors-Cocomplete) public
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_430_638.asm
ljhsiun2/medusa
9
101970
<filename>Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_430_638.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r12 push %r14 push %r9 push %rcx push %rdi push %rsi lea addresses_normal_ht+0x10bef, %r9 nop nop nop and $62957, %rsi movb $0x61, (%r9) nop nop nop mfence lea addresses_A_ht+0x204f, %r12 nop and %r10, %r10 movb $0x61, (%r12) and $1469, %rsi lea addresses_WC_ht+0xaef, %r11 nop nop nop nop xor %r9, %r9 vmovups (%r11), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $1, %xmm7, %r10 and $16097, %rdi lea addresses_D_ht+0x1b74f, %rsi nop nop xor $34396, %r14 mov (%rsi), %r10 nop nop nop nop cmp %r11, %r11 lea addresses_WC_ht+0x12963, %r9 clflush (%r9) nop inc %rdi mov (%r9), %r14w nop nop nop nop cmp $60311, %rdi lea addresses_normal_ht+0x13c4f, %rsi lea addresses_A_ht+0x77ef, %rdi nop nop nop nop dec %r12 mov $47, %rcx rep movsw add %r11, %r11 lea addresses_UC_ht+0x14f4f, %r12 nop sub $63747, %rcx movb (%r12), %r11b nop and $55057, %r14 lea addresses_normal_ht+0x1734f, %rsi lea addresses_WT_ht+0xd4f, %rdi nop nop nop cmp $48583, %r12 mov $106, %rcx rep movsl nop nop nop add %rdi, %rdi lea addresses_UC_ht+0x1cdd7, %rsi lea addresses_WT_ht+0x9107, %rdi nop nop nop xor %r14, %r14 mov $86, %rcx rep movsq and $29966, %r14 lea addresses_UC_ht+0xdde7, %rsi lea addresses_WC_ht+0xc20f, %rdi nop dec %r9 mov $61, %rcx rep movsw nop nop nop nop add %r14, %r14 lea addresses_normal_ht+0x6a91, %rsi lea addresses_normal_ht+0x1269f, %rdi nop nop and $26691, %r10 mov $46, %rcx rep movsw nop sub $63706, %rdi lea addresses_normal_ht+0x1526f, %r10 nop inc %rdi movb $0x61, (%r10) nop nop nop nop nop add %r12, %r12 lea addresses_WC_ht+0x4f42, %rdi nop nop sub $8407, %r14 mov (%rdi), %r10w nop nop nop nop nop cmp %rdi, %rdi lea addresses_WC_ht+0x1b54f, %r12 nop nop cmp $37457, %rdi mov $0x6162636465666768, %rcx movq %rcx, %xmm2 movups %xmm2, (%r12) nop nop nop nop and $60710, %rcx lea addresses_UC_ht+0x10c17, %rsi lea addresses_normal_ht+0x1a83, %rdi nop nop nop nop nop add $48037, %r12 mov $76, %rcx rep movsl nop nop cmp %r9, %r9 pop %rsi pop %rdi pop %rcx pop %r9 pop %r14 pop %r12 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r8 push %rax push %rbp push %rbx push %rcx // Store lea addresses_A+0x5b4f, %r12 nop xor $33229, %rbp mov $0x5152535455565758, %r11 movq %r11, %xmm3 movups %xmm3, (%r12) nop nop dec %rax // Store lea addresses_D+0x53f, %rcx nop nop nop nop nop inc %rbx mov $0x5152535455565758, %r11 movq %r11, (%rcx) nop nop nop dec %rax // Store lea addresses_D+0x54f, %rcx nop nop nop nop xor %r8, %r8 mov $0x5152535455565758, %rbx movq %rbx, (%rcx) nop nop nop inc %r12 // Store lea addresses_UC+0xcccf, %r8 nop nop nop nop nop and $10008, %rax movw $0x5152, (%r8) nop nop nop nop add $39482, %r8 // Faulty Load lea addresses_A+0xbf4f, %r12 nop nop nop dec %r8 vmovups (%r12), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $0, %xmm6, %rbp lea oracles, %rbx and $0xff, %rbp shlq $12, %rbp mov (%rbx,%rbp,1), %rbp pop %rcx pop %rbx pop %rbp pop %rax pop %r8 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}} {'00': 430} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
CSC 35/lab4.asm
jvniorrr/CSUS-Computer-Science
0
175228
<filename>CSC 35/lab4.asm # First Last # Lab 4 # Section # # # 1. Assemble: as -o lab4.o lab4.asm # 2. Linker: ld -o a.out lab4.o csc35.o # 3. Output: ./a.out .intel_syntax noprefix .data description: .ascii "Sutter's Mill Contract\n\n\0" orderedTrees: .ascii "How many trees were ordered?\n\0" cutTrees: .ascii "How many trees were cut down?\n\0" rejectedTrees: .ascii "How many trees were rejected?\n\0" lostTrees: .ascii "How many trees were lost down the river?\n\0" harvestedTrees: .ascii "\nThey harvested \0" harvestedTreesTwo: .ascii " trees.\n\0" success: .ascii "\nThey SUCCESSFULLY fulfilled the contract!\n\0" failure: .ascii "\nThey FAILED to fulfill the contract!\n\0" .text .global _start _start: lea rcx, description # print the description of the program; rcx = some string loaded call PrintStringZ lea rcx, orderedTrees # How many trees were ordered? call PrintStringZ call ScanInt mov rbx, rcx # store the total num of trees ordered; rbx = input("Total # trees") lea rcx, cutTrees # How many trees were cut dowwn? call PrintStringZ call ScanInt mov rax, rcx # store the cut down trees; rax = input("How many trees were cut down") lea rcx, rejectedTrees # How many trees were rejected? call PrintStringZ call ScanInt mov rdx, rcx # store the rejected trees; rdx = input("How many trees rejected") sub rax, rdx # subtract the rejected trees from the total cut down here; TotalTrees - rejected lea rcx, lostTrees # How many trees were lost down the river? call PrintStringZ call ScanInt sub rax, rcx # subtract the lost trees from the total trees here; TotalTrees - lostTrees lea rcx, harvestedTrees # now the LOGICAL OPERATIONS call PrintStringZ mov rcx, rax # copy the total number of trees which are valid; rcx = TotalTrees call PrintInt # print the number of trees; TotalTrees printed lea rcx, harvestedTreesTwo call PrintStringZ cmp rax, rbx jge successState # if the totalTrees >= ammount ordered; jump to success label lea rcx, failure # else we will continue here call PrintStringZ jmp end successState: lea rcx, success call PrintStringZ jmp end failureState: lea rcx, failure call PrintStringZ jmp end end: call Exit
programs/oeis/027/A027861.asm
neoneye/loda
22
15203
<gh_stars>10-100 ; A027861: Numbers k such that k^2 + (k+1)^2 is prime. ; 1,2,4,5,7,9,12,14,17,19,22,24,25,29,30,32,34,35,39,42,47,50,60,65,69,70,72,79,82,84,85,87,90,97,99,100,102,104,109,110,115,122,130,135,137,139,144,149,154,157,160,162,164,167,172,174,185,187,189,195,199,202,204,207,212,217,220,222,224,225,229,230,235,259,260,264,267,272,279,284,285,287,289,290,297,304,315,319,320,324,330,334,342,344,347,349,355,357,369,372 seq $0,129307 ; Intersection of A000217 and A005098. seq $0,25676 ; Exponent of 8 (value of i) in n-th number of form 8^i*9^j.
libsrc/_DEVELOPMENT/adt/wv_stack/c/sccz80/wv_stack_push_callee.asm
jpoikela/z88dk
640
171451
<gh_stars>100-1000 ; int wv_stack_push(wv_stack_t *s, void *item) SECTION code_clib SECTION code_adt_wv_stack PUBLIC wv_stack_push_callee EXTERN w_vector_append_callee defc wv_stack_push_callee = w_vector_append_callee ; SDCC bridge for Classic IF __CLASSIC PUBLIC _wv_stack_push_callee defc _wv_stack_push_callee = wv_stack_push_callee ENDIF
commons-codeassist/src/main/java/io/onedev/commons/codeassist/test/CodeAssistTest7.g4
mhoffrog/onedev-commons
1
4061
grammar CodeAssistTest7; query : criteria1 'order-by' EOF | criteria2 EOF ; query2 : Created | CreatedBy | CreatedByMe ; query3 : 'issues' WS+ CreatedByMe ; criteria1 : criteria ; criteria2 : criteria ; criteria : 'created-by-me' | criteria 'and' criteria | criteria 'or' criteria ; Created : 'created' ; CreatedBy : 'created' WS+ 'by' ; CreatedByMe : 'created' WS+ 'by' WS+ 'me' ; WS : ' ' ;
libsrc/z80_crt0s/z80_emu/afswap.asm
meesokim/z88dk
0
175918
<reponame>meesokim/z88dk<gh_stars>0 ; ; Replacement for "ex af,af" ; ; $Id: afswap.asm,v 1.2 2014/04/26 00:03:52 pauloscustodio Exp $: PUBLIC afswap .af1 defw 0 .afswap ;EX AF,AF' push hl push af ld hl,(af1) ex (sp),hl ld (af1),hl pop af pop hl ret
scripts/seating/models_20210203/sat_7_28_7_6_3_7.als
eskang/alloy-maxsat-benchmark
0
4393
<filename>scripts/seating/models_20210203/sat_7_28_7_6_3_7.als abstract sig Person { tags: set Tag } one sig P0,P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16,P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27 extends Person {} abstract sig Tag {} one sig T0,T1,T2,T3,T4,T5,T6 extends Tag {} fact { tags = P0->T3+P0->T4+P0->T5+P0->T6+ P1->T1+P1->T2+ P2->T3+ P3->T3+P3->T4+P3->T5+P3->T6+ P4->T2+P4->T3+P4->T4+P4->T5+ P5->T0+P5->T1+P5->T5+ P9->T0+P9->T3+P9->T4+ P10->T0+P10->T1+P10->T2+P10->T3+P10->T4+P10->T5+P10->T6+ P11->T0+P11->T2+P11->T3+P11->T5+P11->T6+ P12->T0+P12->T1+P12->T2+P12->T5+ P13->T0+P13->T1+P13->T2+P13->T3+P13->T4+P13->T5+P13->T6+ P14->T0+P14->T1+P14->T6+ P15->T0+P15->T1+P15->T2+P15->T3+P15->T4+P15->T5+P15->T6+ P17->T2+P17->T3+P17->T4+P17->T6+ P18->T0+P18->T1+P18->T2+P18->T3+P18->T4+P18->T5+P18->T6+ P19->T0+P19->T1+P19->T2+P19->T3+P19->T4+P19->T5+P19->T6+ P20->T0+P20->T1+P20->T3+P20->T4+P20->T5+P20->T6+ P21->T0+P21->T3+P21->T4+P21->T5+P21->T6+ P22->T0+P22->T1+P22->T2+P22->T3+P22->T4+P22->T5+ P23->T0+P23->T2+P23->T3+P23->T4+P23->T5+ P25->T2+P25->T3+P25->T4+P25->T6+ P26->T0+P26->T1+P26->T2+P26->T3+P26->T4+P26->T5+ P27->T0+P27->T2+P27->T3 } sig Table { seat: set Person, } { #seat < 8 #seat > 2 } fact { all p: Person | one seat.p } run {} for exactly 6 Table, 5 int
oeis/024/A024394.asm
neoneye/loda-programs
11
245640
; A024394: a(n) is the sum of squares of the first n positive integers congruent to 2 mod 3. ; Submitted by <NAME> ; 4,29,93,214,410,699,1099,1628,2304,3145,4169,5394,6838,8519,10455,12664,15164,17973,21109,24590,28434,32659,37283,42324,47800,53729,60129,67018,74414,82335,90799,99824,109428,119629,130445,141894,153994,166763,180219,194380,209264,224889,241273,258434,276390,295159,314759,335208,356524,378725,401829,425854,450818,476739,503635,531524,560424,590353,621329,653370,686494,720719,756063,792544,830180,868989,908989,950198,992634,1036315,1081259,1127484,1175008,1223849,1274025,1325554,1378454,1432743 mul $0,3 add $0,3 mov $1,$0 pow $0,2 add $1,2 mul $0,$1 bin $1,2 sub $0,$1 div $0,9 add $0,1
dv3/qlsd/initwq.asm
olifink/smsqe
0
164827
<filename>dv3/qlsd/initwq.asm ; QLSD init code 1.01  <NAME> + <NAME> 2018 ; With QUB driver ; ; 2020-04-10 1.02 Removed CARD_INIT (wl) ; 2018-29-05 1.01 Output the recognised hardware revison (MK) section init include 'dev8_dv3_qlsd_keys' include 'dev8_keys_qdos_sms' include 'dev8_keys_qlv' include 'dev8_keys_sys' include 'dev8_mac_proc' include 'dev8_mac_text' include 'dev8_mac_assert' xdef init xref win_init xref qub_init xref dv3_addfd xref qw1_table xref inicrd inirgs reg d7/a0/a3 ini.d7 equ 0 ini.a0 equ 4 ; d7: 0 = ROM start, 1 = RESPR start init movem.l inirgs,-(a7) lea qw1_table,a1 ; *** jsr dv3_addfd ; return d7 = "thing" jsr win_init jsr qub_init ; *** preserve a3, put own block in a4 moveq #sms.info,d0 trap #1 move.l a0,qlsd_sysvars(a3) ; save so we don't need sms.info again assert qlsd.smsq,0 ; so we can reuse d0=0 cmp.l #sysid.sq,(a0) ; SMSQ/E beq.s set_os moveq #qlsd.minerva,d0 move.l sys_chtt(a0),a1 ; Minerva extension block lives here cmp.l #'JSL1',$46(a1) ; Magic beq.s set_os ; Yes, Minerva moveq #qlsd.qdos,d0 ; Otherwise we assume QDOS set_os move.b d0,qlsd_os(a3) move.b d0,qlsd_os(a4) ; *** set it for QUB moveq #1,d5 ; init drive 1 jsr inicrd move.l d0,d7 ; remember error for later ; Output hardware version information move.l ini.a0(sp),a0 ; channel ID move.w ut.wtext,a2 lea txt.hw(pc),a1 ; "QLSD" jsr (a2) lea if_base,a1 move.b if_enable(a1),d1 ; Reference ROM byte move.b if_version(a1),d0 ; Read hardware version register lea txt.v1(pc),a1 ; "v1" cmp.b d0,d1 ; v1 has ROM at if_version... beq.s write_hw ; ... so it should match if_enable andi.b #if.ver_mask+if.io_mode,d0 lea txt.sw(pc),a1 ; "v2 (switch)" cmp.b #if.ver_v2+if.io_mode,d0 beq.s write_hw lea txt.sp(pc),a1 ; "v2 (SPI)" cmp.b #if.ver_v2,d0 beq.s write_hw lea txt.un(pc),a1 ; "unknown" write_hw jsr (a2) ; HW revision lea txt.c1(pc),a1 ; "card 1" jsr (a2) lea txt.nf(pc),a1 ; "not found" tst.l d7 bne.s write_msg ; no card, don't mess with driver name lea txt.in(pc),a1 ; "initialised" tst.l ini.d7(sp) ; ROM start? bne.s write_msg ; ... no, don't fake MDV name assert qlsd.smsq,0 tst.b qlsd_os(a3) ; SMSQ? beq.s write_msg ; ... yes, don't fake MDV name move.l #'MDV0',ddl_dnuse+2(a3) ; Fake MDV name so we can auto-boot st qlsd_fake(a3) ; Remember that we faked it write_msg jsr (a2) movem.l (a7)+,inirgs lea procs,a1 move.w sb.inipr,a2 jmp (a2) procs proc_stt proc_def WIN_DRIVE proc_def WIN_USE proc_def WIN_CHECK proc_end proc_stt proc_end txt.hw mkstr {H/W } txt.v1 mkstr {v1} txt.sw mkstr {v2 (Sw)} txt.sp mkstr {v2 (SPI)} txt.un mkstr {unknown} txt.c1 mkstr {: Card 1 } txt.nf mkstr {not found\} txt.in mkstr {initialised\} end
oeis/244/A244845.asm
neoneye/loda-programs
11
27705
; A244845: Binary representation of 4^n - 2^(n+1) - 1. ; 111,101111,11011111,1110111111,111101111111,11111011111111,1111110111111111,111111101111111111,11111111011111111111,1111111110111111111111,111111111101111111111111,11111111111011111111111111,1111111111110111111111111111,111111111111101111111111111111,11111111111111011111111111111111,1111111111111110111111111111111111,111111111111111101111111111111111111,11111111111111111011111111111111111111,1111111111111111110111111111111111111111,111111111111111111101111111111111111111111 add $0,1 mov $1,10 pow $1,$0 sub $1,4 bin $1,2 div $1,45 mul $1,1000 add $1,111 mov $0,$1
w_gen.adb
Spohn/LegendOfZelba
2
29258
<gh_stars>1-10 with Ada.Text_IO; with Screen; use Ada.Text_IO; PACKAGE BODY w_gen IS ------------------------------- -- Name: <NAME> -- <NAME> -- w_gen Package ------------------------------- --------------------------------------------------------- -- clears the screen PROCEDURE clr_scr IS R, C : Integer := 1; BEGIN move_to (1,1); WHILE R < 44 LOOP WHILE C < 79 LOOP Put (" "); C := C + 1; END LOOP; R := R + 1; C := 1; New_Line; END LOOP; END clr_scr; --------------------------------------------------------- -- moves cursor to independent position PROCEDURE move_to (gCol : IN col; gRow : IN row) IS BEGIN Screen.Movecursor(gCol, gRow); END move_to; --------------------------------------------------------- -- makes border around a designated window PROCEDURE mk_border (sCol : IN col; sRow : IN row; height : IN row; width : IN col) IS num : Integer := 1; BEGIN move_to (gCol => sCol, gRow => sRow); FOR CMove IN 1..width LOOP Put ("-"); END LOOP; New_Line; move_to (gCol => sCol, gRow => (sRow + num)); FOR RMove IN 1..(height - 1) LOOP num := num + 1; Put ("|"); FOR CMove2 IN 1..(width - 2) LOOP Put (" "); END LOOP; Put ("|"); New_Line; move_to (gCol => sCol, gRow => (sRow + num)); END LOOP; FOR CMove3 IN 1..width LOOP Put ("-"); END LOOP; END mk_border; --------------------------------------------------------- -- fill a designated window with text from file PROCEDURE fill (C : IN col; R : IN row; H : IN row; W : IN col; fName : IN String) IS fileVar : File_Type; current : Character; lCount : Integer := 1; BEGIN Open (File => fileVar, Mode => In_File, Name => fName); Get (File => fileVar, Item => current); move_to (gCol => (C + 3), gRow =>(R + 1)); LOOP IF current /= '%' THEN Put (Item => current); END IF; IF current = '%' THEN -- operator EOL character move_to (gCol =>(C + 3), gRow => (R + 1 + lcount)); lCount := lCount + 1; ELSIF End_of_Line(fileVar) THEN move_to (gCol =>(C + 3), gRow => (R + 1 + lCount)); lCount := lCount + 1; END IF; EXIT WHEN End_of_File(fileVar); Get (File => fileVar, Item => current); END LOOP; Close(fileVar); END fill; --------------------------------------------------------- -- clear a designated window of all characters PROCEDURE blank_box (sCol : IN col; sRow : IN row; height : IN row; width : IN col) IS BEGIN move_to (gCol => sCol, gRow => sRow); FOR row_move IN 1..(height + 1) LOOP FOR col_move IN 1..width LOOP Put (" "); END LOOP; move_to (gCol => sCol, gRow => (sRow + row_move)); END LOOP; END blank_box; --------------------------------------------------------- END w_gen;
source/hash/a-swbwha.adb
ytomino/drake
33
29152
<filename>source/hash/a-swbwha.adb with Ada.Strings.Wide_Hash; function Ada.Strings.Wide_Bounded.Wide_Hash ( Key : Bounded.Bounded_Wide_String) return Containers.Hash_Type is begin return Strings.Wide_Hash (Key.Element (1 .. Key.Length)); end Ada.Strings.Wide_Bounded.Wide_Hash;
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c43204h.ada
best08618/asylo
7
7160
-- C43204H.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT AN AGGREGATE WITH AN OTHERS CLAUSE CAN APPEAR AS A -- CONSTRAINED FORMAL PARAMETER OF A GENERIC UNIT, AND THAT THE -- BOUNDS OF THE AGGREGATE ARE DETERMINED CORRECTLY. -- HISTORY: -- JET 08/15/88 CREATED ORIGINAL TEST. WITH REPORT; USE REPORT; PROCEDURE C43204H IS TYPE ARR11 IS ARRAY (INTEGER RANGE -3 .. 3) OF INTEGER; TYPE ARR12 IS ARRAY (IDENT_INT(-3) .. IDENT_INT(3)) OF INTEGER; TYPE ARR13 IS ARRAY (IDENT_INT(1) .. IDENT_INT(-1)) OF INTEGER; TYPE ARR21 IS ARRAY (INTEGER RANGE -1 .. 1, INTEGER RANGE -1 .. 1) OF INTEGER; TYPE ARR22 IS ARRAY (IDENT_INT(-1) .. IDENT_INT(1), IDENT_INT(-1) .. IDENT_INT(1)) OF INTEGER; TYPE ARR23 IS ARRAY (INTEGER RANGE -1 .. 1, IDENT_INT(-1) .. IDENT_INT(1)) OF INTEGER; TYPE ARR24 IS ARRAY (IDENT_INT(1) .. IDENT_INT(-1), IDENT_INT(-1) .. IDENT_INT(1)) OF INTEGER; GENERIC GA11 : ARR11 := (1,1,1,1,1, OTHERS => IDENT_INT(2)); GA12 : ARR12 := (OTHERS => IDENT_INT(2)); GA13 : ARR13 := (OTHERS => IDENT_INT(2)); GA21 : ARR21 := ((1,1,1), (1,1,1), (OTHERS => IDENT_INT(2))); GA22 : ARR22 := ((1,1,1), (OTHERS => IDENT_INT(2)), (1,1,1)); GA23 : ARR23 := ((1,1,1), (OTHERS => IDENT_INT(2)), (1,1,1)); GA24 : ARR24 := (OTHERS => (OTHERS => IDENT_INT(2))); PROCEDURE GEN; PROCEDURE GEN IS BEGIN IF GA11 /= (1, 1, 1, 1, 1, 2, 2) THEN FAILED("INCORRECT VALUE OF GA11"); END IF; IF GA12 /= (2, 2, 2, 2, 2, 2, 2) THEN FAILED("INCORRECT VALUE OF GA12"); END IF; IF GA13'LENGTH /= 0 THEN FAILED("INCORRECT VALUE OF GA13"); END IF; IF GA21 /= ((1,1,1), (1,1,1), (2,2,2)) THEN FAILED("INCORRECT VALUE OF GA21"); END IF; IF GA22 /= ((1,1,1), (2,2,2), (1,1,1)) THEN FAILED("INCORRECT VALUE OF GA22"); END IF; IF GA23 /= ((1,1,1), (2,2,2), (1,1,1)) THEN FAILED("INCORRECT VALUE OF GA23"); END IF; IF GA24'LENGTH /= 0 OR GA24'LENGTH(2) /= 3 THEN FAILED("INCORRECT VALUE OF GA24"); END IF; END GEN; PROCEDURE PROCG IS NEW GEN; BEGIN TEST ("C43204H", "CHECK THAT AN AGGREGATE WITH AN OTHERS CLAUSE " & "CAN APPEAR AS A CONSTRAINED FORMAL PARAMETER " & "OF A GENERIC UNIT, AND THAT THE BOUNDS OF " & "THE AGGREGATE ARE DETERMINED CORRECTLY"); PROCG; RESULT; EXCEPTION WHEN OTHERS => FAILED ("UNEXPECTED CONSTRAINT_ERROR OR OTHER EXCEPTION " & "RAISED"); RESULT; END C43204H;
libsrc/_DEVELOPMENT/adt/p_forward_list_alt/c/sccz80/p_forward_list_alt_push_front.asm
jpoikela/z88dk
640
244581
<reponame>jpoikela/z88dk ; void p_forward_list_alt_push_front(p_forward_list_alt_t *list, void *item) SECTION code_clib SECTION code_adt_p_forward_list_alt PUBLIC p_forward_list_alt_push_front EXTERN asm_p_forward_list_alt_push_front p_forward_list_alt_push_front: pop af pop de pop bc push bc push de push af jp asm_p_forward_list_alt_push_front ; SDCC bridge for Classic IF __CLASSIC PUBLIC _p_forward_list_alt_push_front defc _p_forward_list_alt_push_front = p_forward_list_alt_push_front ENDIF
oeis/056/A056555.asm
neoneye/loda-programs
11
24727
; A056555: Smallest number k (k>0) such that n*k is a perfect 4th power. ; Submitted by <NAME> ; 1,8,27,4,125,216,343,2,9,1000,1331,108,2197,2744,3375,1,4913,72,6859,500,9261,10648,12167,54,25,17576,3,1372,24389,27000,29791,8,35937,39304,42875,36,50653,54872,59319,250,68921,74088,79507,5324,1125,97336,103823,27,49,200,132651,8788,148877,24,166375,686,185193,195112,205379,13500,226981,238328,3087,4,274625,287496,300763,19652,328509,343000,357911,18,389017,405224,675,27436,456533,474552,493039,125,1,551368,571787,37044,614125,636056,658503,2662,704969,9000,753571,48668,804357,830584,857375 add $0,1 mov $1,$0 lpb $1 mov $2,$0 pow $2,3 mov $3,$1 pow $3,4 lpb $2 mov $1,1 dif $2,$3 lpe sub $1,1 lpe mov $0,$2
tools/Set Default Scores.applescript
aureliojargas/emomemory
1
2883
on join(theList, theSeparator) set AppleScript's text item delimiters to theSeparator set theText to theList as text set AppleScript's text item delimiters to "" return theText end join tell application "EmoMemory" -- KID: 1 min: smart child set theNumbers to {{30, 45, 60}, {80, 100, 120}, {180, 210, 240}} -- beta 1 (!memorizing) set theNumbers to {{30, 45, 60}, {90, 110, 135}, {180, 210, 240}} repeat with i from 1 to count theNumbers repeat with j from 1 to count item i of theNumbers -- encode_score set theDate to do shell script "date +%s" -- today -- sourceforge: date --date "20070101" +"%s" -- anyday set theDate to "1167638400" set encoded to do shell script "echo " & theDate & "-" & item j of item i of theNumbers & "| sed \"y/1234567890-/RWMXZYDNQKH/\" | rev" set item j of item i of theNumbers to encoded end repeat end repeat set multiWorm to theNumbers repeat with i from 1 to count multiWorm set item i of multiWorm to my join(item i of multiWorm, "T") end repeat set theWorm to my join(multiWorm, "V") end tell
EjerciciosClase/ejerBe03a.asm
adeandak/OPC
0
168481
<reponame>adeandak/OPC<filename>EjerciciosClase/ejerBe03a.asm<gh_stars>0 TITLE ejerBC03a ; Uso de instrucciones, Directivas data y operadores. ; Irvine Library procedures and functions INCLUDE \masm32\Irvine\Irvine32.inc INCLUDELIB \masm32\Irvine\Irvine32.lib INCLUDELIB \masm32\Irvine\User32.lib INCLUDELIB \masm32\Irvine\Kernel32.lib ; End Irvine .DATA rever1 DWORD 2, 11h, 18 miCr = 0Dh ; Carriage return symbol miLf = 0Ah ; Line feed symbol txtr11 BYTE miCr, miLf, "Contenido de rever1: ", 0 txtr12 BYTE miCr, miLf, "Caracteristicas de rever1: ", 0 .CODE main PROC ; Escriba comentarios ; rever1, elementos del arreglo mov EDX, OFFSET txtr11 call WriteString mov EAX, rever1 mov EBX, rever1+4 mov ECX, rever1+8 call DumpRegs ; rever1, algunas caracteristicas del arreglo mov EDX, OFFSET txtr12 call WriteString mov ESI, OFFSET rever1 mov EAX, TYPE rever1 mov EBX, LENGTHOF rever1 mov ECX, SIZEOF rever1 call DumpRegs exit main ENDP END main
test/backend/formatting/raw.g4
mrd1996/vscode-antlr4
294
5385
/* * An initial comment */ /** * */ grammar raw; /** * 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.*/ unusualCode: xyz; /* 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.*/ // 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. // A separate comment. //------------------------------------------------------------------------------------------------- // $antlr-format minEmptyLines 0 options// Trailing comment, that moves behind the opening brace. { /*Inline comment that stays before the non-comment content.*/superClass= Base1 ;superClass=Base2; /* Another such comment. The previous code moved to an own line. */ superClass = Base3; // trailing comment /* Comment stays as it is. Min-empty-line-setting only has an effect on top level elements. */ superClass = /* Multiple lines of a single command with embedded comments is combined to a single line. */ Base4 /* inline comment */ ; // Single line comment, non-trailing. Stays as is without separator line. /*Standalone comment (indentation needs correction)*/} channels { CommentsChannel, DirectiveChannel } // Trailing comment. tokens {// Trailing comment, which only gets a space in front. DUMMY, Blah, // Empty-lines-to-keep defaults to 1, so the previous empty line is kept as is. AnotherToken, YetAnotherOneWithLongName // And another trailing comment. } // $antlr-format minEmptyLines 1 options// Trailing comment. { /*Other comment.*/superClass= Base1 ;superClass=Base2; /* comment */ superClass = Base3; // trailing comment /* another comment */ superClass = /* inline comment */ Base4 /* inline comment */ ; // Single line comment, non-trailing /*final comment*/} channels { CommentsChannel, DirectiveChannel } // Tokens comment. tokens {// Trailing comment. DUMMY, Blah, // Description of these tokens. AnotherToken, YetAnotherOneWithLongName // This is important. } import Blah; // These are all supported parser sections: // Parser file header. Appears at the top in all parser related files. Use e.g. for copyrights. @ parser :: header {/* parser/listener/visitor header section */} // Appears before any #include in h + cpp files. @parser::preinclude {/* parser precinclude section */} // Appears in the private part of the parser in the h file. // The function bodies could also appear in the definitions section, but I want to maximize // Java compatibility, so we can also create a Java parser from this grammar. // Still, some tweaking is necessary after the Java file generation (e.g. bool -> boolean). @parser::members { /* public parser declarations/members section */ bool myAction() { return true; } bool doesItBlend() { return true; } void cleanUp() {} void doInit() {} void doAfter() {} } // Appears in the public part of the parser in the h file. @parser::declarations {/* private parser declarations section */} // Appears in line with the other class member definitions in the cpp file. @parser::definitions {/* parser definitions section */} //------------------------------------------------------------------------------------------------------------------ // $antlr-format maxEmptyLinesToKeep: 8, minEmptyLines 0 @parser::listenerpreinclude {/* listener preinclude section */}@parser::listenerpostinclude {/* listener postinclude section */} @parser::listenerdeclarations {/* listener public declarations/members section */} @parser::listenermembers {/* listener private declarations/members section */} @parser::listenerdefinitions {/* listener definitions section */} @parser::baselistenerpreinclude {/* base listener preinclude section */} @parser::baselistenerpostinclude {/* base listener postinclude section */} @parser::baselistenerdeclarations {/* base listener public declarations/members section */} @parser::baselistenermembers {/* base listener private declarations/members section */} @parser::baselistenerdefinitions {/* base listener definitions section */} @parser::visitorpreinclude {/* visitor preinclude section */} @parser::visitorpostinclude {/* visitor postinclude section */} @parser::visitordeclarations {/* visitor public declarations/members section */} @parser::visitormembers {/* visitor private declarations/members section */} @parser::visitordefinitions {/* visitor definitions section */} @parser::basevisitorpreinclude {/* base visitor preinclude section */} @parser::basevisitorpostinclude {/* base visitor postinclude section */} @parser::basevisitordeclarations {/* base visitor public declarations/members section */} @parser::basevisitormembers {/* base visitor private declarations/members section */} @parser::basevisitordefinitions {/* base visitor definitions section */} //------------------------------------------------------------------------------------------------------------------ // $antlr-format maxEmptyLinesToKeep: 5, minEmptyLines 1 @parser::listenerpreinclude {/* listener preinclude section */}@parser::listenerpostinclude {/* listener postinclude section */} @parser::listenerdeclarations {/* listener public declarations/members section */} @parser::listenermembers {/* listener private declarations/members section */} @parser::listenerdefinitions {/* listener definitions section */} @parser::baselistenerpreinclude {/* base listener preinclude section */} @parser::baselistenerpostinclude {/* base listener postinclude section */} @parser::baselistenerdeclarations {/* base listener public declarations/members section */} @parser::baselistenermembers {/* base listener private declarations/members section */} @parser::baselistenerdefinitions {/* base listener definitions section */} @parser::visitorpreinclude {/* visitor preinclude section */} @parser::visitorpostinclude {/* visitor postinclude section */} @parser::visitordeclarations {/* visitor public declarations/members section */} @parser::visitormembers {/* visitor private declarations/members section */} @parser::visitordefinitions {/* visitor definitions section */} @parser::basevisitorpreinclude {/* base visitor preinclude section */} @parser::basevisitorpostinclude {/* base visitor postinclude section */} @parser::basevisitordeclarations {/* base visitor public declarations/members section */} @parser::basevisitormembers {/* base visitor private declarations/members section */} @parser::basevisitordefinitions {/* base visitor definitions section */} //------------------------------------------------------------------------------------------------------------------ // $antlr-format maxEmptyLinesToKeep: 3, minEmptyLines 3 @parser::listenerpreinclude {/* listener preinclude section */}@parser::listenerpostinclude {/* listener postinclude section */} @parser::listenerdeclarations {/* listener public declarations/members section */} @parser::listenermembers {/* listener private declarations/members section */} @parser::listenerdefinitions {/* listener definitions section */} @parser::baselistenerpreinclude {/* base listener preinclude section */} @parser::baselistenerpostinclude {/* base listener postinclude section */} @parser::baselistenerdeclarations {/* base listener public declarations/members section */} @parser::baselistenermembers {/* base listener private declarations/members section */} @parser::baselistenerdefinitions {/* base listener definitions section */} @parser::visitorpreinclude {/* visitor preinclude section */} @parser::visitorpostinclude {/* visitor postinclude section */} @parser::visitordeclarations {/* visitor public declarations/members section */} @parser::visitormembers {/* visitor private declarations/members section */} @parser::visitordefinitions {/* visitor definitions section */} @parser::basevisitorpreinclude {/* base visitor preinclude section */} @parser::basevisitorpostinclude {/* base visitor postinclude section */} @parser::basevisitordeclarations {/* base visitor public declarations/members section */} @parser::basevisitormembers {/* base visitor private declarations/members section */} @parser::basevisitordefinitions {/* base visitor definitions section */} //------------------------------------------------------------------------------------------------------------------ // $antlr-format maxEmptyLinesToKeep: 1, minEmptyLines 5 @parser::listenerpreinclude {/* listener preinclude section */}@parser::listenerpostinclude {/* listener postinclude section */} @parser::listenerdeclarations {/* listener public declarations/members section */} @parser::listenermembers {/* listener private declarations/members section */} @parser::listenerdefinitions {/* listener definitions section */} @parser::baselistenerpreinclude {/* base listener preinclude section */} @parser::baselistenerpostinclude {/* base listener postinclude section */} @parser::baselistenerdeclarations {/* base listener public declarations/members section */} @parser::baselistenermembers {/* base listener private declarations/members section */} @parser::baselistenerdefinitions {/* base listener definitions section */} @parser::visitorpreinclude {/* visitor preinclude section */} @parser::visitorpostinclude {/* visitor postinclude section */} @parser::visitordeclarations {/* visitor public declarations/members section */} @parser::visitormembers {/* visitor private declarations/members section */} @parser::visitordefinitions {/* visitor definitions section */} @parser::basevisitorpreinclude {/* base visitor preinclude section */} @parser::basevisitorpostinclude {/* base visitor postinclude section */} @parser::basevisitordeclarations {/* base visitor public declarations/members section */} @parser::basevisitormembers {/* base visitor private declarations/members section */} @parser::basevisitordefinitions {/* base visitor definitions section */} //------------------------------------------------------------------------------------------------------------------ // $antlr-format maxEmptyLinesToKeep: 0, minEmptyLines 100 @parser::listenerpreinclude {/* listener preinclude section */}@parser::listenerpostinclude {/* listener postinclude section */} @parser::listenerdeclarations {/* listener public declarations/members section */} @parser::listenermembers {/* listener private declarations/members section */} @parser::listenerdefinitions {/* listener definitions section */} @parser::baselistenerpreinclude {/* base listener preinclude section */} @parser::baselistenerpostinclude {/* base listener postinclude section */} @parser::baselistenerdeclarations {/* base listener public declarations/members section */} @parser::baselistenermembers {/* base listener private declarations/members section */} @parser::baselistenerdefinitions {/* base listener definitions section */} @parser::visitorpreinclude {/* visitor preinclude section */} @parser::visitorpostinclude {/* visitor postinclude section */} @parser::visitordeclarations {/* visitor public declarations/members section */} @parser::visitormembers {/* visitor private declarations/members section */} @parser::visitordefinitions {/* visitor definitions section */} @parser::basevisitorpreinclude {/* base visitor preinclude section */} @parser::basevisitorpostinclude {/* base visitor postinclude section */} @parser::basevisitordeclarations {/* base visitor public declarations/members section */} @parser::basevisitormembers {/* base visitor private declarations/members section */} @parser::basevisitordefinitions {/* base visitor definitions section */} // $antlr-format reset rule1: rule2 (COMMA rule2)*; rule2: TOKEN1; and_ @init{ doInit(); } @after { doAfter(); } : And ; conquer: // Comment comment // a description divide+ | {doesItBlend()}? and_ { myAction(); } // trailing description // another description | ID (LessThan* divide)?? { $ID.text; } ; // $antlr-format ruleInternalsOnSingleLine false unused[double input = 111] returns [double calculated] locals [int _a, double _b, int _c] @init{ doInit(); } @after { doAfter(); } : stat ; catch [...] { // Replaces the standard exception handling. } finally { cleanUp(); } // $antlr-format ruleInternalsOnSingleLine: on unused[double input = 111] returns [double calculated] locals [int _a, double _b, int _c] @init{ doInit(); } @after { doAfter(); } : stat ; catch [...] { // Replaces the standard exception handling. } finally { cleanUp(); } unused2: (unused[1] .)+ (Colon | Semicolon | Plus)? ~Semicolon ; stat: expr Equal expr Semicolon | expr Semicolon ; expr: expr Star expr | expr Plus expr | OpenPar expr ClosePar | <assoc= right> expr QuestionMark expr Colon expr | <assoc =right> expr Equal expr | identifier = id | flowControl | INT | String ; flowControl: (Return expr | 'return') # Return | Continue # Continue ; id: ID; array : OpenCurly el += INT (Comma el += INT)* CloseCurly; idarray : OpenCurly element += id (Comma element += id)* CloseCurly; any: t = .; // $antlr-format alignColons: none, alignFirstTokens on, alignLexerCommands true Colon: ':'; Semicolon: ';' ; Plus: '+'; Minus: '-'; Star: '*'; OpenPar: '('; ClosePar: ')'; OpenCurly: '{'; CloseCurly: '}'; QuestionMark: '?'; Comma: ',' -> skip; Dollar: '$'; LongLongLongToken: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' -> mode(Blah); Ampersand: '&' -> type(DUMMY), mode(Blah); String: '"' .*? '"'; // $antlr-format alignColons: hanging, singleLineOverrulesHangingColon: false Foo: {canTestFoo()}? 'foo' {isItFoo()}? { myFooLexerAction(); }; // $antlr-format alignColons: hanging, singleLineOverrulesHangingColon: true Foo: {canTestFoo()}? 'foo' {isItFoo()}? { myFooLexerAction(); }; Bar: 'bar' {isItBar()}? { myBarLexerAction(); }; Any: Foo Dot Bar? DotDot Baz Bar; Comment : '#' ~[\r\n]* '\r'? '\n';// -> channel(CommentsChannel); WS: [\r\n] + -> channel(99); // A custom, but the default channel. WS2: [ \t] + -> channel(HIDDEN); // Operators EQUAL_OPERATOR: '='; // Also assign. ASSIGN_OPERATOR: ':='; NULL_SAFE_EQUAL_OPERATOR: '<=>'; GREATER_OR_EQUAL_OPERATOR: '>='; GREATER_THAN_OPERATOR: '>'; LESS_OR_EQUAL_OPERATOR: '<='; LESS_THAN_OPERATOR: '<'; NOT_EQUAL_OPERATOR: '!='; NOT_EQUAL2_OPERATOR: '<>' -> type(NOT_EQUAL_OPERATOR); PLUS_OPERATOR: '+'; MINUS_OPERATOR: '-'; MULT_OPERATOR: '*'; DIV_OPERATOR: '/'; MOD_OPERATOR: '%'; LOGICAL_NOT_OPERATOR: '!'; BITWISE_NOT_OPERATOR: '~'; SHIFT_LEFT_OPERATOR: '<<'; SHIFT_RIGHT_OPERATOR: '>>'; LOGICAL_AND_OPERATOR: '&&'; BITWISE_AND_OPERATOR: '&'; BITWISE_XOR_OPERATOR: '^'; LOGICAL_OR_OPERATOR: '||' { setType(isSqlModeActive(PipesAsConcat) ? CONCAT_PIPES_SYMBOL : LOGICAL_OR_OPERATOR); }; BITWISE_OR_OPERATOR: '|'; DOT_SYMBOL: '.'; COMMA_SYMBOL: ','; SEMICOLON_SYMBOL: ';'; COLON_SYMBOL: ':'; OPEN_PAR_SYMBOL: '('; CLOSE_PAR_SYMBOL: ')'; OPEN_CURLY_SYMBOL: '{'; CLOSE_CURLY_SYMBOL: '}'; UNDERLINE_SYMBOL: '_'; JSON_SEPARATOR_SYMBOL: '->' {serverVersion >= 50708}?; // MYSQL JSON_UNQUOTED_SEPARATOR_SYMBOL: '->>' {serverVersion >= 50713}?; // MYSQL // The MySQL server parser uses custom code in its lexer to allow base alphanum chars (and ._$) as variable name. // For this it handles user variables in 2 different ways and we have to model this to match that behavior. AT_SIGN_SYMBOL: '@'; AT_TEXT_SUFFIX: '@' SIMPLE_IDENTIFIER; AT_AT_SIGN_SYMBOL: '@@'; NULL2_SYMBOL: '\\N'; PARAM_MARKER: '?'; fragment A: [aA]; fragment B: [bB]; fragment C: [cC]; fragment D: [dD]; fragment E: [eE]; fragment F: [fF]; fragment G: [gG]; fragment H: [hH]; fragment I: [iI]; fragment J: [jJ]; fragment K: [kK]; fragment L: [lL]; fragment M: [mM]; fragment N: [nN]; fragment O: [oO]; fragment P: [pP]; fragment Q: [qQ]; fragment R: [rR]; fragment S: [sS]; fragment T: [tT]; fragment U: [uU]; fragment V: [vV]; fragment W: [wW]; fragment X: [xX]; fragment Y: [yY]; fragment Z: [zZ]; fragment DIGIT: [0-9]; fragment DIGITS: DIGIT+; fragment HEXDIGIT: [0-9a-fA-F]; // Only lower case 'x' and 'b' count for hex + bin numbers. Otherwise it's an identifier. HEX_NUMBER: ('0x' HEXDIGIT+) | ('x\'' HEXDIGIT+ '\''); BIN_NUMBER: ('0b' [01]+) | ('b\'' [01]+ '\''); NUMBER: DIGITS { setType(determineNumericType(getText())); }; // $antlr-format reset, groupedAlignments on, reflowComments off /* Tokens from MySQL 8.0 */ // $antlr-format groupedAlignments off, alignFirstTokens on, alignTrailers on, columnLimit: 150 PERSIST_SYMBOL: P E R S I S T {serverVersion >= 80000}?; ROLE_SYMBOL: R O L E {serverVersion >= 80000}?; // SQL-1999-R ADMIN_SYMBOL: A D M I N {serverVersion >= 80000}?; // SQL-1999-R INVISIBLE_SYMBOL: I N V I S I B L E {serverVersion >= 80000}?; VISIBLE_SYMBOL: V I S I B L E {serverVersion >= 80000}?; EXCEPT_SYMBOL: E X C E P T {serverVersion >= 80000}?; // SQL-1999-R COMPONENT_SYMBOL: C O M P O N E N T {serverVersion >= 80000}?; // MYSQL RECURSIVE_SYMBOL: R E C U R S I V E {serverVersion >= 80001}?; // SQL-1999-R //GRAMMAR_SELECTOR_EXPR:; // synthetic token: starts single expr. //GRAMMAR_SELECTOR_GCOL:; // synthetic token: starts generated col. //GRAMMAR_SELECTOR_PART:; // synthetic token: starts partition expr. //GRAMMAR_SELECTOR_CTE:; // synthetic token: starts CTE expr. JSON_OBJECTAGG_SYMBOL: J S O N '_' O B J E C T A G G {serverVersion >= 80000}?; // SQL-2015-R JSON_ARRAYAGG_SYMBOL: J S O N '_' A R R A Y A G G {serverVersion >= 80000}?; // SQL-2015-R OF_SYMBOL: O F {serverVersion >= 80001}?; // SQL-1999-R SKIP_SYMBOL: S K I P {serverVersion >= 80001}?; // MYSQL LOCKED_SYMBOL: L O C K E D {serverVersion >= 80001}?; // MYSQL NOWAIT_SYMBOL: N O W A I T {serverVersion >= 80001}?; // MYSQL GROUPING_SYMBOL: G R O U P I N G {serverVersion >= 80001}?; // SQL-2011-R // Additional tokens which are mapped to existing tokens. INT1_SYMBOL: I N T '1' -> type(TINYINT_SYMBOL); // Synonym INT2_SYMBOL: I N T '2' -> type(SMALLINT_SYMBOL); // Synonym INT3_SYMBOL: I N T '3' -> type(MEDIUMINT_SYMBOL); // Synonym INT4_SYMBOL: I N T '4' -> type(INT_SYMBOL); // Synonym INT8_SYMBOL: I N T '8' -> type(BIGINT_SYMBOL); // Synonym SQL_TSI_FRAC_SECOND_SYMBOL: S Q L '_' T S I '_' F R A C '_' S E C O N D {serverVersion < 50503}? -> type(FRAC_SECOND_SYMBOL); // Synonym SQL_TSI_SECOND_SYMBOL: S Q L '_' T S I '_' S E C O N D -> type(SECOND_SYMBOL); // Synonym SQL_TSI_MINUTE_SYMBOL: S Q L '_' T S I '_' M I N U T E -> type(MINUTE_SYMBOL); // Synonym SQL_TSI_HOUR_SYMBOL: S Q L '_' T S I '_' H O U R -> type(HOUR_SYMBOL); // Synonym SQL_TSI_DAY_SYMBOL: S Q L '_' T S I '_' D A Y -> type(DAY_SYMBOL); // Synonym SQL_TSI_WEEK_SYMBOL: S Q L '_' T S I '_' W E E K -> type(WEEK_SYMBOL); // Synonym SQL_TSI_MONTH_SYMBOL: S Q L '_' T S I '_' M O N T H -> type(MONTH_SYMBOL); // Synonym SQL_TSI_QUARTER_SYMBOL: S Q L '_' T S I '_' Q U A R T E R -> type(QUARTER_SYMBOL); // Synonym SQL_TSI_YEAR_SYMBOL: S Q L '_' T S I '_' Y E A R -> type(YEAR_SYMBOL); // Synonym // $antlr-format groupedAlignments on // White space handling WHITESPACE: [ \t\f\r\n] -> channel(HIDDEN); // Ignore whitespaces. // Input not covered elsewhere (unless quoted). INVALID_INPUT: [\u0001-\u0008] // Control codes. | '\u000B' // Line tabulation. | '\u000C' // Form feed. | [\u000E-\u001F] // More control codes. | '[' | ']' ; // $antlr-format columnLimit: 120 UNDERSCORE_CHARSET: UNDERLINE_SYMBOL IDENTIFIER { setType(checkCharset(getText())); }; // Identifiers might start with a digit, even tho it is discouraged, and may not consist entirely of digits only. // All keywords above are automatically excluded. IDENTIFIER: DIGITS+ [eE] (LETTER_WHEN_UNQUOTED_NO_DIGIT LETTER_WHEN_UNQUOTED*)? // Have to exclude float pattern, as this rule matches more. | DIGITS+ LETTER_WITHOUT_FLOAT_PART LETTER_WHEN_UNQUOTED* | LETTER_WHEN_UNQUOTED_NO_DIGIT LETTER_WHEN_UNQUOTED* // INT_NUMBER matches first if there are only digits. ; // $antlr-format alignTrailers off, alignActions off // Ok, here's another twist: back quoted identifiers don't support the first form (it is interpreted as two identifiers). BACK_TICK_QUOTED_ID: BACK_TICK ( {!isSqlModeActive(NoBackslashEscapes)}? (ESCAPE_SEQUENCE | ~[\\`]) | {isSqlModeActive(NoBackslashEscapes)}? ~[`] )*? BACK_TICK ; DOUBLE_QUOTED_TEXT: ( DOUBLE_QUOTE ( DOUBLE_QUOTE DOUBLE_QUOTE | {!isSqlModeActive(NoBackslashEscapes)}? (ESCAPE_SEQUENCE | ~[\\"]) | {isSqlModeActive(NoBackslashEscapes)}? ~["] )*? DOUBLE_QUOTE ); // $antlr-format breakBeforeParens: true SINGLE_QUOTED_TEXT: ( SINGLE_QUOTE ( SINGLE_QUOTE SINGLE_QUOTE | {!isSqlModeActive(NoBackslashEscapes)}? (ESCAPE_SEQUENCE | ~[\\']) | {isSqlModeActive(NoBackslashEscapes)}? ~['] )*? SINGLE_QUOTE ); fragment ESCAPE_SEQUENCE: '\\' .; // Valid chars: 0'"bnrtZ\%_; // $antlr-format breakBeforeParens: false VERSION_COMMENT_START: ('/*!' DIGITS) ( {checkVersion(getText())}? // Will set inVersionComment if the number matches. | .*? '*/' ) -> channel(HIDDEN); // $antlr-format alignTrailers off MYSQL_COMMENT_START: '/*!' { inVersionComment = true; } -> channel(HIDDEN); VERSION_COMMENT_END: '*/' {inVersionComment}? { inVersionComment = false; } -> channel(HIDDEN); BLOCK_COMMENT: ( '/**/' | '/*' ~[!] .*? '*/') -> channel(HIDDEN); POUND_COMMENT: '#' ~([\n\r])* -> channel(HIDDEN); DASHDASH_COMMENT: DOUBLE_DASH ([ \t] (~[\n\r])* | LINEBREAK | EOF) -> channel(HIDDEN); fragment DOUBLE_DASH: '--'; fragment LINEBREAK: [\n\r]; fragment SIMPLE_IDENTIFIER: (DIGIT | [a-zA-Z_$] | DOT_SYMBOL)+; fragment ML_COMMENT_HEAD: '/*'; fragment ML_COMMENT_END: '*/'; // As defined in http://dev.mysql.com/doc/refman/5.6/en/identifiers.html. fragment LETTER_WHEN_UNQUOTED: DIGIT | LETTER_WHEN_UNQUOTED_NO_DIGIT ; fragment LETTER_WHEN_UNQUOTED_NO_DIGIT: [a-zA-Z_$\u0080-\uffff] ; // Any letter but without e/E and digits (which are used to match a decimal number). fragment LETTER_WITHOUT_FLOAT_PART: [a-df-zA-DF-Z_$\u0080-\uffff] ; // $antlr-format minEmptyLines: 1 // $antlr-format columnLimit: 200, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine true, breakBeforeParens: true, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 200, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine true, breakBeforeParens: true, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 200, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine true, breakBeforeParens: false, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 200, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine true, breakBeforeParens: false, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 200, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine false, breakBeforeParens: true, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 200, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine false, breakBeforeParens: true, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 200, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine false, breakBeforeParens: false, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 200, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine false, breakBeforeParens: false, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 200, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine true, breakBeforeParens: true, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 200, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine true, breakBeforeParens: true, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 200, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine true, breakBeforeParens: false, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 200, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine true, breakBeforeParens: false, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 200, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine false, breakBeforeParens: true, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 200, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine false, breakBeforeParens: true, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 200, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine false, breakBeforeParens: false, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 200, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine false, breakBeforeParens: false, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 120, continuationIndentWidth:9, indentWidth:7, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine true, breakBeforeParens: true, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 120, continuationIndentWidth:9, indentWidth:7, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine true, breakBeforeParens: true, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 120, continuationIndentWidth:9, indentWidth:7, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine true, breakBeforeParens: false, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 120, continuationIndentWidth:9, indentWidth:7, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine true, breakBeforeParens: false, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 120, continuationIndentWidth:9, indentWidth:7, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine false, breakBeforeParens: true, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 120, continuationIndentWidth:9, indentWidth:7, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine false, breakBeforeParens: true, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 120, continuationIndentWidth:9, indentWidth:7, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine false, breakBeforeParens: false, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 120, continuationIndentWidth:9, indentWidth:7, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine false, breakBeforeParens: false, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 120, continuationIndentWidth:9, indentWidth:7, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine true, breakBeforeParens: true, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 120, continuationIndentWidth:9, indentWidth:7, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine true, breakBeforeParens: true, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 120, continuationIndentWidth:9, indentWidth:7, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine true, breakBeforeParens: false, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 120, continuationIndentWidth:9, indentWidth:7, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine true, breakBeforeParens: false, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 120, continuationIndentWidth:9, indentWidth:7, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine false, breakBeforeParens: true, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 120, continuationIndentWidth:9, indentWidth:7, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine false, breakBeforeParens: true, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 120, continuationIndentWidth:9, indentWidth:7, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine false, breakBeforeParens: false, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 120, continuationIndentWidth:9, indentWidth:7, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine false, breakBeforeParens: false, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 50, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine true, breakBeforeParens: true, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 50, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine true, breakBeforeParens: true, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 50, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine true, breakBeforeParens: false, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 50, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine true, breakBeforeParens: false, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 50, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine false, breakBeforeParens: true, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 50, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine false, breakBeforeParens: true, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 50, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine false, breakBeforeParens: false, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 50, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: true, allowShortRulesOnASingleLine false, breakBeforeParens: false, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 10, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine true, breakBeforeParens: true, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 10, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine true, breakBeforeParens: true, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 10, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine true, breakBeforeParens: false, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 10, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine true, breakBeforeParens: false, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 10, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine false, breakBeforeParens: true, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 10, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine false, breakBeforeParens: true, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 10, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine false, breakBeforeParens: false, useTab: on handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // $antlr-format columnLimit: 10, continuationIndentWidth:4, indentWidth:4, tabWidth 4, allowShortBlocksOnASingleLine: false, allowShortRulesOnASingleLine false, breakBeforeParens: false, useTab: off handlerDeclaration: DECLARE_SYMBOL (CONTINUE_SYMBOL | (SHORT | BLOCK) | UNDO_SYMBOL) HANDLER_SYMBOL FOR_SYMBOL handlerCondition ; // Testing block + comment formatting at various column limits. As a side task also spaces around assignments is checked here. // $antlr-format: columnLimit: 100, breakBeforeBraces: off, keepEmptyLinesAtTheStartOfBlocks: off, reflowComments: off, spaceBeforeAssignmentOperators: off ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 100, breakBeforeBraces: off, keepEmptyLinesAtTheStartOfBlocks: off, reflowComments: off, spaceBeforeAssignmentOperators: on ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 100, breakBeforeBraces: off, keepEmptyLinesAtTheStartOfBlocks: off, reflowComments: on, spaceBeforeAssignmentOperators: off ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 100, breakBeforeBraces: off, keepEmptyLinesAtTheStartOfBlocks: off, reflowComments: on, spaceBeforeAssignmentOperators: on ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 100, breakBeforeBraces: off, keepEmptyLinesAtTheStartOfBlocks: on, reflowComments: off, spaceBeforeAssignmentOperators: off ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 100, breakBeforeBraces: off, keepEmptyLinesAtTheStartOfBlocks: on, reflowComments: off, spaceBeforeAssignmentOperators: on ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 100, breakBeforeBraces: off, keepEmptyLinesAtTheStartOfBlocks: on, reflowComments: on, spaceBeforeAssignmentOperators: off ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 100, breakBeforeBraces: off, keepEmptyLinesAtTheStartOfBlocks: on, reflowComments: on, spaceBeforeAssignmentOperators: on ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 100, breakBeforeBraces: on, keepEmptyLinesAtTheStartOfBlocks: off, reflowComments: off, spaceBeforeAssignmentOperators: off ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 100, breakBeforeBraces: on, keepEmptyLinesAtTheStartOfBlocks: off, reflowComments: off, spaceBeforeAssignmentOperators: on ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 100, breakBeforeBraces: on, keepEmptyLinesAtTheStartOfBlocks: off, reflowComments: on, spaceBeforeAssignmentOperators: off ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 100, breakBeforeBraces: on, keepEmptyLinesAtTheStartOfBlocks: off, reflowComments: on, spaceBeforeAssignmentOperators: on ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 100, breakBeforeBraces: on, keepEmptyLinesAtTheStartOfBlocks: on, reflowComments: off, spaceBeforeAssignmentOperators: off ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 100, breakBeforeBraces: on, keepEmptyLinesAtTheStartOfBlocks: on, reflowComments: off, spaceBeforeAssignmentOperators: on ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 100, breakBeforeBraces: on, keepEmptyLinesAtTheStartOfBlocks: on, reflowComments: on, spaceBeforeAssignmentOperators: off ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 100, breakBeforeBraces: on, keepEmptyLinesAtTheStartOfBlocks: on, reflowComments: on, spaceBeforeAssignmentOperators: on ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 90, breakBeforeBraces: off, keepEmptyLinesAtTheStartOfBlocks: off, reflowComments: off, spaceBeforeAssignmentOperators: off ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 80, breakBeforeBraces: off, keepEmptyLinesAtTheStartOfBlocks: off, reflowComments: off, spaceBeforeAssignmentOperators: on ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 70, breakBeforeBraces: off, keepEmptyLinesAtTheStartOfBlocks: off, reflowComments: on, spaceBeforeAssignmentOperators: off ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 60, breakBeforeBraces: off, keepEmptyLinesAtTheStartOfBlocks: off, reflowComments: on, spaceBeforeAssignmentOperators: on ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 50, breakBeforeBraces: off, keepEmptyLinesAtTheStartOfBlocks: on, reflowComments: off, spaceBeforeAssignmentOperators: off ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 40, breakBeforeBraces: off, keepEmptyLinesAtTheStartOfBlocks: on, reflowComments: off, spaceBeforeAssignmentOperators: on ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 30, breakBeforeBraces: off, keepEmptyLinesAtTheStartOfBlocks: on, reflowComments: on, spaceBeforeAssignmentOperators: off ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( /** Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */ anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 20, breakBeforeBraces: off, keepEmptyLinesAtTheStartOfBlocks: on, reflowComments: on, spaceBeforeAssignmentOperators: on ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( /** * Lorem ipsum dolor sit amet, consectetur adipisici elit, * sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco * laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit * esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. */ anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 90, breakBeforeBraces: on, keepEmptyLinesAtTheStartOfBlocks: off, reflowComments: off, spaceBeforeAssignmentOperators: off ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 80, breakBeforeBraces: on, keepEmptyLinesAtTheStartOfBlocks: off, reflowComments: off, spaceBeforeAssignmentOperators: on ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 70, breakBeforeBraces: on, keepEmptyLinesAtTheStartOfBlocks: off, reflowComments: on, spaceBeforeAssignmentOperators: off ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 60, breakBeforeBraces: on, keepEmptyLinesAtTheStartOfBlocks: off, reflowComments: on, spaceBeforeAssignmentOperators: on ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 50, breakBeforeBraces: on, keepEmptyLinesAtTheStartOfBlocks: on, reflowComments: off, spaceBeforeAssignmentOperators: off ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 40, breakBeforeBraces: on, keepEmptyLinesAtTheStartOfBlocks: on, reflowComments: off, spaceBeforeAssignmentOperators: on ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 30, breakBeforeBraces: on, keepEmptyLinesAtTheStartOfBlocks: on, reflowComments: on, spaceBeforeAssignmentOperators: off ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // $antlr-format: columnLimit: 20, breakBeforeBraces: on, keepEmptyLinesAtTheStartOfBlocks: on, reflowComments: on, spaceBeforeAssignmentOperators: on ordinaryRule: TOKEN_ONE (aBlock | with | a | few | alts) ( // Lorem ipsum dolor sit amet, consectetur adipisici elit, // sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco // laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit // esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. anAltWithAnAction {doSomethingUseful()} | anotherAlt WITH_TOKEN /* and comment */ xyz=ANOTHER_TOKEN ) ; // Various more or less complex real world rules taken from the MySQL grammar. Reset all settings to defaults. // $antlr-format reset, columnLimit 120 alterListItem: ADD_SYMBOL COLUMN_SYMBOL? ( fieldIdentifier fieldDefinition checkOrReferences? place? | OPEN_PAR_SYMBOL tableElementList CLOSE_PAR_SYMBOL ) | ADD_SYMBOL tableConstraintDef | CHANGE_SYMBOL COLUMN_SYMBOL? columnInternalRef fieldIdentifier fieldDefinition place? | MODIFY_SYMBOL COLUMN_SYMBOL? columnInternalRef fieldDefinition place? | DROP_SYMBOL ( (INDEX_SYMBOL | KEY_SYMBOL) indexRef | COLUMN_SYMBOL? columnInternalRef restrict? | PRIMARY_SYMBOL KEY_SYMBOL | FOREIGN_SYMBOL KEY_SYMBOL ( // This part is no longer optional starting with 5.7. {serverVersion >= 50700}? columnRef | {serverVersion < 50700}? columnRef? ) ) | DISABLE_SYMBOL KEYS_SYMBOL | ENABLE_SYMBOL KEYS_SYMBOL | ALTER_SYMBOL COLUMN_SYMBOL? columnInternalRef SET_SYMBOL DEFAULT_SYMBOL signedLiteral | {serverVersion >= 80000}? ALTER_SYMBOL INDEX_SYMBOL indexRef visibility | ALTER_SYMBOL COLUMN_SYMBOL? columnInternalRef DROP_SYMBOL DEFAULT_SYMBOL | RENAME_SYMBOL (TO_SYMBOL | AS_SYMBOL)? tableName | {serverVersion >= 50700}? RENAME_SYMBOL (INDEX_SYMBOL | KEY_SYMBOL) indexRef TO_SYMBOL indexName | CONVERT_SYMBOL TO_SYMBOL charset charsetNameOrDefault (COLLATE_SYMBOL collationNameOrDefault)? | createTableOption+ // Space separated, no commas allowed. | FORCE_SYMBOL | alterOrderClause | {serverVersion >= 50708 && serverVersion < 80000}? UPGRADE_SYMBOL PARTITIONING_SYMBOL ; place: AFTER_SYMBOL identifier | FIRST_SYMBOL ; restrict: RESTRICT_SYMBOL | CASCADE_SYMBOL ; alterOrderClause: ORDER_SYMBOL BY_SYMBOL identifier direction (COMMA_SYMBOL identifier direction)* ; alterAlgorithmOption: ALGORITHM_SYMBOL EQUAL_OPERATOR? ( DEFAULT_SYMBOL | identifier ) ; alterLockOption: LOCK_SYMBOL EQUAL_OPERATOR? (DEFAULT_SYMBOL | identifier) ; indexLockAndAlgorithm: {serverVersion >= 50600}? ( alterAlgorithmOption alterLockOption? | alterLockOption alterAlgorithmOption? ) ; validation: {serverVersion >= 50706}? (WITH_SYMBOL | WITHOUT_SYMBOL) VALIDATION_SYMBOL ; removePartitioning: {serverVersion >= 50100}? REMOVE_SYMBOL PARTITIONING_SYMBOL ; allOrPartitionNameList: ALL_SYMBOL | identifierList ; reorgPartitionRule: REORGANIZE_SYMBOL PARTITION_SYMBOL noWriteToBinLog? (identifierList INTO_SYMBOL partitionDefinitions)? ; alterTablespace: TABLESPACE_SYMBOL tablespaceRef ( (ADD_SYMBOL | DROP_SYMBOL) DATAFILE_SYMBOL textLiteral (alterTablespaceOption (COMMA_SYMBOL? alterTablespaceOption)*)? // The alternatives listed below are not documented but appear in the server grammar file. | CHANGE_SYMBOL DATAFILE_SYMBOL textLiteral (changeTablespaceOption (COMMA_SYMBOL? changeTablespaceOption)*)? | (READ_ONLY_SYMBOL | READ_WRITE_SYMBOL) | NOT_SYMBOL ACCESSIBLE_SYMBOL ) ; alterTablespaceOption: INITIAL_SIZE_SYMBOL EQUAL_OPERATOR? sizeNumber | AUTOEXTEND_SIZE_SYMBOL EQUAL_OPERATOR? sizeNumber | MAX_SIZE_SYMBOL EQUAL_OPERATOR? sizeNumber | STORAGE_SYMBOL? ENGINE_SYMBOL EQUAL_OPERATOR? engineRef | (WAIT_SYMBOL | NO_WAIT_SYMBOL) ; changeTablespaceOption: INITIAL_SIZE_SYMBOL EQUAL_OPERATOR? sizeNumber | AUTOEXTEND_SIZE_SYMBOL EQUAL_OPERATOR? sizeNumber | MAX_SIZE_SYMBOL EQUAL_OPERATOR? sizeNumber ; alterView: viewAlgorithm? definerClause? viewSuid? VIEW_SYMBOL viewRef viewTail ; // This is not the full view_tail from sql_yacc.yy as we have either a view name or a view reference, // depending on whether we come from createView or alterView. Everything until this difference is duplicated in those rules. viewTail: columnInternalRefList? AS_SYMBOL viewSelect ; viewSelect: queryExpressionOrParens viewCheckOption? ; viewCheckOption: WITH_SYMBOL (CASCADED_SYMBOL | LOCAL_SYMBOL)? CHECK_SYMBOL OPTION_SYMBOL ; //-------------------------------------------------------------------------------------------------- createStatement: createDatabase | createTable | createFunction | createProcedure | createUdf | createLogfileGroup | createView | createTrigger | createIndex | createServer | createTablespace | {serverVersion >= 50100}? createEvent | {serverVersion >= 80000}? createRole ; createDatabase: CREATE_SYMBOL DATABASE_SYMBOL ifNotExists? schemaName createDatabaseOption* ; createDatabaseOption: defaultCharset | defaultCollation ; createTable: CREATE_SYMBOL TEMPORARY_SYMBOL? TABLE_SYMBOL ifNotExists? tableName ( (OPEN_PAR_SYMBOL tableElementList CLOSE_PAR_SYMBOL)? createTableOptions? partitionClause? duplicateAsQueryExpression? | LIKE_SYMBOL tableRef | OPEN_PAR_SYMBOL LIKE_SYMBOL tableRef CLOSE_PAR_SYMBOL ) ; routineOption: option = COMMENT_SYMBOL textLiteral | option = LANGUAGE_SYMBOL SQL_SYMBOL | option = NO_SYMBOL SQL_SYMBOL | option = CONTAINS_SYMBOL SQL_SYMBOL | option = READS_SYMBOL SQL_SYMBOL DATA_SYMBOL | option = MODIFIES_SYMBOL SQL_SYMBOL DATA_SYMBOL | option = SQL_SYMBOL SECURITY_SYMBOL security = (DEFINER_SYMBOL | INVOKER_SYMBOL) ; createIndex: CREATE_SYMBOL onlineOption? ( UNIQUE_SYMBOL? type = INDEX_SYMBOL indexNameAndType createIndexTarget indexOption* | type = FULLTEXT_SYMBOL INDEX_SYMBOL indexName createIndexTarget fulltextIndexOption* | type = SPATIAL_SYMBOL INDEX_SYMBOL indexName createIndexTarget spatialIndexOption* ) indexLockAndAlgorithm? ; deleteStatement: ({serverVersion >= 80001}? withClause)? DELETE_SYMBOL deleteStatementOption* ( FROM_SYMBOL ( tableAliasRefList USING_SYMBOL tableReferenceList whereClause? // Multi table variant 1. | tableRef partitionDelete? whereClause? orderClause? simpleLimitClause? // Single table delete. ) | tableAliasRefList FROM_SYMBOL tableReferenceList whereClause? // Multi table variant 2. ) ; handlerReadOrScan: (FIRST_SYMBOL | NEXT_SYMBOL) // Scan function. | identifier ( (FIRST_SYMBOL | NEXT_SYMBOL | PREV_SYMBOL | LAST_SYMBOL) | (EQUAL_OPERATOR | LESS_THAN_OPERATOR | GREATER_THAN_OPERATOR | LESS_OR_EQUAL_OPERATOR | GREATER_OR_EQUAL_OPERATOR) OPEN_PAR_SYMBOL values CLOSE_PAR_SYMBOL ) ; loadStatement: LOAD_SYMBOL dataOrXml (LOW_PRIORITY_SYMBOL | CONCURRENT_SYMBOL)? LOCAL_SYMBOL? INFILE_SYMBOL textLiteral (REPLACE_SYMBOL | IGNORE_SYMBOL)? INTO_SYMBOL TABLE_SYMBOL tableRef usePartition? charsetClause? xmlRowsIdentifiedBy? fieldsClause? linesClause? loadDataFileTail ; grant: GRANT_SYMBOL ( {serverVersion >= 80000}? roleOrPrivilegesList TO_SYMBOL userList (WITH_SYMBOL ADMIN_SYMBOL OPTION_SYMBOL)? | ( roleOrPrivilegesList | ALL_SYMBOL PRIVILEGES_SYMBOL? ) ON_SYMBOL aclType? grantIdentifier TO_SYMBOL grantList requireClause? (WITH_SYMBOL grantOption+)? | {serverVersion >= 50500}? PROXY_SYMBOL ON_SYMBOL user TO_SYMBOL grantList (WITH_SYMBOL GRANT_SYMBOL OPTION_SYMBOL)? ) ; renameUser: RENAME_SYMBOL USER_SYMBOL user TO_SYMBOL user (COMMA_SYMBOL user TO_SYMBOL user)* ; revoke: REVOKE_SYMBOL ( {serverVersion >= 80000}? roleOrPrivilegesList FROM_SYMBOL userList | roleOrPrivilegesList onTypeTo FROM_SYMBOL userList | ALL_SYMBOL PRIVILEGES_SYMBOL? ( {serverVersion >= 80001}? ON_SYMBOL aclType? grantIdentifier | COMMA_SYMBOL GRANT_SYMBOL OPTION_SYMBOL FROM_SYMBOL userList ) | {serverVersion >= 50500}? PROXY_SYMBOL ON_SYMBOL user FROM_SYMBOL userList ) ; showStatement: SHOW_SYMBOL ( {serverVersion < 50700}? value = AUTHORS_SYMBOL | value = DATABASES_SYMBOL likeOrWhere? | FULL_SYMBOL? value = TABLES_SYMBOL inDb? likeOrWhere? | FULL_SYMBOL? value = TRIGGERS_SYMBOL inDb? likeOrWhere? | value = EVENTS_SYMBOL inDb? likeOrWhere? | value = TABLE_SYMBOL STATUS_SYMBOL inDb? likeOrWhere? | value = OPEN_SYMBOL TABLES_SYMBOL inDb? likeOrWhere? | {(serverVersion >= 50105) && (serverVersion < 50500)}? value = PLUGIN_SYMBOL | {serverVersion >= 50500}? value = PLUGINS_SYMBOL | value = ENGINE_SYMBOL (engineRef | ALL_SYMBOL) (STATUS_SYMBOL | MUTEX_SYMBOL | LOGS_SYMBOL) | showFieldsType? value = COLUMNS_SYMBOL (FROM_SYMBOL | IN_SYMBOL) tableRef inDb? likeOrWhere? | (BINARY_SYMBOL | MASTER_SYMBOL) value = LOGS_SYMBOL | value = SLAVE_SYMBOL ( HOSTS_SYMBOL | STATUS_SYMBOL nonBlocking channel? ) | value = (BINLOG_SYMBOL | RELAYLOG_SYMBOL) EVENTS_SYMBOL (IN_SYMBOL textString)? (FROM_SYMBOL ulonglong_number)? limitClause? channel? | ({serverVersion >= 80001}? EXTENDED_SYMBOL)? value = (INDEX_SYMBOL | INDEXES_SYMBOL | KEYS_SYMBOL) fromOrIn tableRef inDb? whereClause? | STORAGE_SYMBOL? value = ENGINES_SYMBOL | COUNT_SYMBOL OPEN_PAR_SYMBOL MULT_OPERATOR CLOSE_PAR_SYMBOL value = (WARNINGS_SYMBOL | ERRORS_SYMBOL) | value = WARNINGS_SYMBOL limitClause? | value = ERRORS_SYMBOL limitClause? | value = PROFILES_SYMBOL | value = PROFILE_SYMBOL (profileType (COMMA_SYMBOL profileType)*)? (FOR_SYMBOL QUERY_SYMBOL INT_NUMBER)? limitClause? | optionType? value = (STATUS_SYMBOL | VARIABLES_SYMBOL) likeOrWhere? | FULL_SYMBOL? value = PROCESSLIST_SYMBOL | charset likeOrWhere? | value = COLLATION_SYMBOL likeOrWhere? | {serverVersion < 50700}? value = CONTRIBUTORS_SYMBOL | value = PRIVILEGES_SYMBOL | value = GRANTS_SYMBOL (FOR_SYMBOL user)? | {serverVersion >= 50500}? value = GRANTS_SYMBOL FOR_SYMBOL user USING_SYMBOL userList | value = MASTER_SYMBOL STATUS_SYMBOL | value = CREATE_SYMBOL ( object = DATABASE_SYMBOL ifNotExists? schemaRef | object = EVENT_SYMBOL eventRef | object = FUNCTION_SYMBOL functionRef | object = PROCEDURE_SYMBOL procedureRef | object = TABLE_SYMBOL tableRef | object = TRIGGER_SYMBOL triggerRef | object = VIEW_SYMBOL viewRef | {serverVersion >= 50704}? object = USER_SYMBOL user ) | value = PROCEDURE_SYMBOL STATUS_SYMBOL likeOrWhere? | value = FUNCTION_SYMBOL STATUS_SYMBOL likeOrWhere? | value = PROCEDURE_SYMBOL CODE_SYMBOL procedureRef | value = FUNCTION_SYMBOL CODE_SYMBOL functionRef | {serverVersion < 50500}? value = INNODB_SYMBOL STATUS_SYMBOL // Deprecated in 5.5. ) ; runtimeFunctionCall: // Function names that are keywords. name = CHAR_SYMBOL OPEN_PAR_SYMBOL exprList (USING_SYMBOL charsetName)? CLOSE_PAR_SYMBOL | name = CURRENT_USER_SYMBOL parentheses? | name = DATE_SYMBOL OPEN_PAR_SYMBOL expr CLOSE_PAR_SYMBOL | name = DAY_SYMBOL OPEN_PAR_SYMBOL expr CLOSE_PAR_SYMBOL | name = HOUR_SYMBOL OPEN_PAR_SYMBOL expr CLOSE_PAR_SYMBOL | name = INSERT_SYMBOL OPEN_PAR_SYMBOL expr COMMA_SYMBOL expr COMMA_SYMBOL expr COMMA_SYMBOL expr CLOSE_PAR_SYMBOL | name = INTERVAL_SYMBOL OPEN_PAR_SYMBOL expr (COMMA_SYMBOL expr)+ CLOSE_PAR_SYMBOL | name = LEFT_SYMBOL OPEN_PAR_SYMBOL expr COMMA_SYMBOL expr CLOSE_PAR_SYMBOL | name = MINUTE_SYMBOL OPEN_PAR_SYMBOL expr CLOSE_PAR_SYMBOL | name = MONTH_SYMBOL OPEN_PAR_SYMBOL expr CLOSE_PAR_SYMBOL | name = RIGHT_SYMBOL OPEN_PAR_SYMBOL expr COMMA_SYMBOL expr CLOSE_PAR_SYMBOL | name = SECOND_SYMBOL OPEN_PAR_SYMBOL expr CLOSE_PAR_SYMBOL | name = TIME_SYMBOL OPEN_PAR_SYMBOL expr CLOSE_PAR_SYMBOL | name = TIMESTAMP_SYMBOL OPEN_PAR_SYMBOL expr (COMMA_SYMBOL expr)? CLOSE_PAR_SYMBOL | trimFunction | name = USER_SYMBOL parentheses | name = VALUES_SYMBOL OPEN_PAR_SYMBOL expr CLOSE_PAR_SYMBOL | name = YEAR_SYMBOL OPEN_PAR_SYMBOL expr CLOSE_PAR_SYMBOL // Function names that are not keywords. | name = (ADDDATE_SYMBOL | SUBDATE_SYMBOL) OPEN_PAR_SYMBOL expr COMMA_SYMBOL (expr | INTERVAL_SYMBOL expr interval) CLOSE_PAR_SYMBOL | name = CURDATE_SYMBOL parentheses? | name = CURTIME_SYMBOL timeFunctionParameters? | name = (DATE_ADD_SYMBOL | DATE_SUB_SYMBOL) OPEN_PAR_SYMBOL expr COMMA_SYMBOL INTERVAL_SYMBOL expr interval CLOSE_PAR_SYMBOL | name = EXTRACT_SYMBOL OPEN_PAR_SYMBOL interval FROM_SYMBOL expr CLOSE_PAR_SYMBOL | name = GET_FORMAT_SYMBOL OPEN_PAR_SYMBOL dateTimeTtype COMMA_SYMBOL expr CLOSE_PAR_SYMBOL | name = NOW_SYMBOL timeFunctionParameters? | name = POSITION_SYMBOL OPEN_PAR_SYMBOL bitExpr IN_SYMBOL expr CLOSE_PAR_SYMBOL | substringFunction | name = SYSDATE_SYMBOL timeFunctionParameters? | name = (TIMESTAMP_ADD_SYMBOL | TIMESTAMP_DIFF_SYMBOL) OPEN_PAR_SYMBOL intervalTimeStamp COMMA_SYMBOL expr COMMA_SYMBOL expr CLOSE_PAR_SYMBOL | name = UTC_DATE_SYMBOL parentheses? | name = UTC_TIME_SYMBOL timeFunctionParameters? | name = UTC_TIMESTAMP_SYMBOL timeFunctionParameters? // Function calls with other conflicts. | name = ASCII_SYMBOL OPEN_PAR_SYMBOL expr CLOSE_PAR_SYMBOL | name = CHARSET_SYMBOL OPEN_PAR_SYMBOL expr CLOSE_PAR_SYMBOL | name = COALESCE_SYMBOL exprListWithParentheses | name = COLLATION_SYMBOL OPEN_PAR_SYMBOL expr CLOSE_PAR_SYMBOL | name = DATABASE_SYMBOL parentheses | name = IF_SYMBOL OPEN_PAR_SYMBOL expr COMMA_SYMBOL expr COMMA_SYMBOL expr CLOSE_PAR_SYMBOL | name = FORMAT_SYMBOL OPEN_PAR_SYMBOL expr COMMA_SYMBOL expr (COMMA_SYMBOL expr)? CLOSE_PAR_SYMBOL | name = MICROSECOND_SYMBOL OPEN_PAR_SYMBOL expr CLOSE_PAR_SYMBOL | name = MOD_SYMBOL OPEN_PAR_SYMBOL expr COMMA_SYMBOL expr CLOSE_PAR_SYMBOL | {serverVersion < 50607}? name = OLD_PASSWORD_SYMBOL OPEN_PAR_SYMBOL textLiteral CLOSE_PAR_SYMBOL | name = PASSWORD_SYMBOL OPEN_PAR_SYMBOL expr CLOSE_PAR_SYMBOL | name = QUARTER_SYMBOL OPEN_PAR_SYMBOL expr CLOSE_PAR_SYMBOL | name = REPEAT_SYMBOL OPEN_PAR_SYMBOL expr COMMA_SYMBOL expr CLOSE_PAR_SYMBOL | name = REPLACE_SYMBOL OPEN_PAR_SYMBOL expr COMMA_SYMBOL expr COMMA_SYMBOL expr CLOSE_PAR_SYMBOL | name = REVERSE_SYMBOL OPEN_PAR_SYMBOL expr CLOSE_PAR_SYMBOL | name = ROW_COUNT_SYMBOL parentheses | name = TRUNCATE_SYMBOL OPEN_PAR_SYMBOL expr COMMA_SYMBOL expr CLOSE_PAR_SYMBOL | name = WEEK_SYMBOL OPEN_PAR_SYMBOL expr (COMMA_SYMBOL expr)? CLOSE_PAR_SYMBOL | {serverVersion >= 50600}? name = WEIGHT_STRING_SYMBOL OPEN_PAR_SYMBOL expr ( (AS_SYMBOL CHAR_SYMBOL wsNumCodepoints)? ({serverVersion < 80001}? weightStringLevels)? | AS_SYMBOL BINARY_SYMBOL wsNumCodepoints | COMMA_SYMBOL ulong_number COMMA_SYMBOL ulong_number COMMA_SYMBOL ulong_number ) CLOSE_PAR_SYMBOL | geometryFunction ; dataType: type = (INT_SYMBOL | TINYINT_SYMBOL | SMALLINT_SYMBOL | MEDIUMINT_SYMBOL) fieldLength? fieldOptions? | (type = REAL_SYMBOL | type = DOUBLE_SYMBOL PRECISION_SYMBOL?) precision? fieldOptions? | type = (FLOAT_SYMBOL | DECIMAL_SYMBOL | NUMERIC_SYMBOL | FIXED_SYMBOL) floatOptions? fieldOptions? | type = BIT_SYMBOL fieldLength? | type = (BOOL_SYMBOL | BOOLEAN_SYMBOL) | type = CHAR_SYMBOL fieldLength? charsetWithOptBinary? | nchar fieldLength? BINARY_SYMBOL? | type = BINARY_SYMBOL fieldLength? | (type = CHAR_SYMBOL VARYING_SYMBOL | type = VARCHAR_SYMBOL) fieldLength charsetWithOptBinary? | ( type = NATIONAL_SYMBOL VARCHAR_SYMBOL | type = NVARCHAR_SYMBOL | type = NCHAR_SYMBOL VARCHAR_SYMBOL | type = NATIONAL_SYMBOL CHAR_SYMBOL VARYING_SYMBOL | type = NCHAR_SYMBOL VARYING_SYMBOL ) fieldLength BINARY_SYMBOL? | type = VARBINARY_SYMBOL fieldLength | type = YEAR_SYMBOL fieldLength? fieldOptions? | type = DATE_SYMBOL | type = TIME_SYMBOL typeDatetimePrecision? | type = TIMESTAMP_SYMBOL typeDatetimePrecision? | type = DATETIME_SYMBOL typeDatetimePrecision? | type = TINYBLOB_SYMBOL | type = BLOB_SYMBOL fieldLength? | type = (MEDIUMBLOB_SYMBOL | LONGBLOB_SYMBOL) | type = LONG_SYMBOL VARBINARY_SYMBOL | type = LONG_SYMBOL (CHAR_SYMBOL VARYING_SYMBOL | VARCHAR_SYMBOL)? charsetWithOptBinary? | type = TINYTEXT_SYMBOL charsetWithOptBinary? | type = TEXT_SYMBOL fieldLength? charsetWithOptBinary? | type = MEDIUMTEXT_SYMBOL charsetWithOptBinary? | type = LONGTEXT_SYMBOL charsetWithOptBinary? | type = ENUM_SYMBOL stringList charsetWithOptBinary? | type = SET_SYMBOL stringList charsetWithOptBinary? | type = SERIAL_SYMBOL | {serverVersion >= 50707}? type = JSON_SYMBOL | type = ( GEOMETRY_SYMBOL | GEOMETRYCOLLECTION_SYMBOL | POINT_SYMBOL | MULTIPOINT_SYMBOL | LINESTRING_SYMBOL | MULTILINESTRING_SYMBOL | POLYGON_SYMBOL | MULTIPOLYGON_SYMBOL ) ; // $antlr-format alignTrailingComments: true roleOrLabelKeyword: ( ACTION_SYMBOL | ADDDATE_SYMBOL | AFTER_SYMBOL | AGAINST_SYMBOL | AGGREGATE_SYMBOL | ALGORITHM_SYMBOL | ANALYSE_SYMBOL // Conditionally set in the lexer. | ANY_SYMBOL | AT_SYMBOL | AUTHORS_SYMBOL // Conditionally set in the lexer. | AUTO_INCREMENT_SYMBOL | AUTOEXTEND_SIZE_SYMBOL | AVG_ROW_LENGTH_SYMBOL | AVG_SYMBOL | BINLOG_SYMBOL | BIT_SYMBOL | BLOCK_SYMBOL | BOOL_SYMBOL | BOOLEAN_SYMBOL | BTREE_SYMBOL | CASCADED_SYMBOL | CATALOG_NAME_SYMBOL | CHAIN_SYMBOL | CHANGED_SYMBOL | CHANNEL_SYMBOL // Conditionally set in the lexer. | CIPHER_SYMBOL | CLIENT_SYMBOL | CLASS_ORIGIN_SYMBOL | COALESCE_SYMBOL | CODE_SYMBOL | COLLATION_SYMBOL | COLUMN_NAME_SYMBOL | COLUMN_FORMAT_SYMBOL | COLUMNS_SYMBOL | COMMITTED_SYMBOL | COMPACT_SYMBOL | COMPLETION_SYMBOL | COMPONENT_SYMBOL | COMPRESSED_SYMBOL // Conditionally set in the lexer. | COMPRESSION_SYMBOL // Conditionally set in the lexer. | ENCRYPTION_SYMBOL // Conditionally set in the lexer. | CONCURRENT_SYMBOL | CONNECTION_SYMBOL | CONSISTENT_SYMBOL | CONSTRAINT_CATALOG_SYMBOL | CONSTRAINT_SCHEMA_SYMBOL | CONSTRAINT_NAME_SYMBOL | CONTEXT_SYMBOL | CONTRIBUTORS_SYMBOL // Conditionally set in the lexer. | CPU_SYMBOL /* Although a reserved keyword in SQL:2003 (and :2008), not reserved in MySQL per WL#2111 specification. */ | CURRENT_SYMBOL | CURSOR_NAME_SYMBOL | DATA_SYMBOL | DATAFILE_SYMBOL | DATETIME_SYMBOL | DATE_SYMBOL | DAY_SYMBOL | DEFAULT_AUTH_SYMBOL | DEFINER_SYMBOL | DELAY_KEY_WRITE_SYMBOL | DES_KEY_FILE_SYMBOL | DIAGNOSTICS_SYMBOL | DIRECTORY_SYMBOL | DISABLE_SYMBOL | DISCARD_SYMBOL | DISK_SYMBOL | DUMPFILE_SYMBOL | DUPLICATE_SYMBOL | DYNAMIC_SYMBOL | ENDS_SYMBOL | ENUM_SYMBOL | ENGINE_SYMBOL | ENGINES_SYMBOL | ERROR_SYMBOL | ERRORS_SYMBOL | ESCAPE_SYMBOL | EVENTS_SYMBOL | EVERY_SYMBOL | EXPANSION_SYMBOL | EXPORT_SYMBOL | EXTENDED_SYMBOL | EXTENT_SIZE_SYMBOL | FAULTS_SYMBOL | FAST_SYMBOL | FOUND_SYMBOL | ENABLE_SYMBOL | FULL_SYMBOL // $antlr-format groupedAlignments: off | FILE_BLOCK_SIZE_SYMBOL // Conditionally set in the lexer. | FILTER_SYMBOL | FIRST_SYMBOL | FIXED_SYMBOL | GENERAL_SYMBOL | GEOMETRY_SYMBOL | GEOMETRYCOLLECTION_SYMBOL | GET_FORMAT_SYMBOL | GRANTS_SYMBOL | GLOBAL_SYMBOL | HASH_SYMBOL | HOSTS_SYMBOL | HOUR_SYMBOL | IDENTIFIED_SYMBOL | IGNORE_SERVER_IDS_SYMBOL | INVOKER_SYMBOL | INDEXES_SYMBOL | INITIAL_SIZE_SYMBOL | INSTANCE_SYMBOL // Conditionally deprecated in the lexer. | INNODB_SYMBOL // Conditionally deprecated in the lexer. | IO_SYMBOL | IPC_SYMBOL | ISOLATION_SYMBOL | ISSUER_SYMBOL | INSERT_METHOD_SYMBOL | JSON_SYMBOL // Conditionally set in the lexer. | KEY_BLOCK_SIZE_SYMBOL | LAST_SYMBOL | LEAVES_SYMBOL | LESS_SYMBOL | LEVEL_SYMBOL | LINESTRING_SYMBOL | LIST_SYMBOL | LOCAL_SYMBOL | LOCKED_SYMBOL // Conditionally set in the lexer. | LOCKS_SYMBOL | LOGFILE_SYMBOL | LOGS_SYMBOL | MAX_ROWS_SYMBOL | MASTER_SYMBOL | MASTER_HEARTBEAT_PERIOD_SYMBOL | MASTER_HOST_SYMBOL | MASTER_PORT_SYMBOL | MASTER_LOG_FILE_SYMBOL | MASTER_LOG_POS_SYMBOL | MASTER_USER_SYMBOL | MASTER_PASSWORD_SYMBOL | MASTER_SERVER_ID_SYMBOL | MASTER_CONNECT_RETRY_SYMBOL | MASTER_RETRY_COUNT_SYMBOL | MASTER_DELAY_SYMBOL | MASTER_SSL_SYMBOL | MASTER_SSL_CA_SYMBOL | MASTER_SSL_CAPATH_SYMBOL | MASTER_TLS_VERSION_SYMBOL // Conditionally deprecated in the lexer. | MASTER_SSL_CERT_SYMBOL | MASTER_SSL_CIPHER_SYMBOL | MASTER_SSL_CRL_SYMBOL | MASTER_SSL_CRLPATH_SYMBOL | MASTER_SSL_KEY_SYMBOL | MASTER_AUTO_POSITION_SYMBOL | MAX_CONNECTIONS_PER_HOUR_SYMBOL | MAX_QUERIES_PER_HOUR_SYMBOL | MAX_STATEMENT_TIME_SYMBOL // Conditionally deprecated in the lexer. | MAX_SIZE_SYMBOL | MAX_UPDATES_PER_HOUR_SYMBOL | MAX_USER_CONNECTIONS_SYMBOL | MEDIUM_SYMBOL | MEMORY_SYMBOL | MERGE_SYMBOL | MESSAGE_TEXT_SYMBOL | MICROSECOND_SYMBOL | MIGRATE_SYMBOL | MINUTE_SYMBOL | MIN_ROWS_SYMBOL | MODIFY_SYMBOL | MODE_SYMBOL | MONTH_SYMBOL | MULTILINESTRING_SYMBOL | MULTIPOINT_SYMBOL | MULTIPOLYGON_SYMBOL | MUTEX_SYMBOL | MYSQL_ERRNO_SYMBOL | NAME_SYMBOL | NAMES_SYMBOL | NATIONAL_SYMBOL | NCHAR_SYMBOL | NDBCLUSTER_SYMBOL | NEVER_SYMBOL | NEXT_SYMBOL | NEW_SYMBOL | NO_WAIT_SYMBOL | NODEGROUP_SYMBOL | NOWAIT_SYMBOL // Conditionally deprecated in the lexer. | NUMBER_SYMBOL | NVARCHAR_SYMBOL | OFFSET_SYMBOL | OLD_PASSWORD_SYMBOL // Conditionally deprecated in the lexer. | ONE_SHOT_SYMBOL // Conditionally deprecated in the lexer. | ONE_SYMBOL | PACK_KEYS_SYMBOL | PAGE_SYMBOL | PARTIAL_SYMBOL | PARTITIONING_SYMBOL | PARTITIONS_SYMBOL | PASSWORD_SYMBOL | PHASE_SYMBOL | PLUGIN_DIR_SYMBOL | PLUGIN_SYMBOL | PLUGINS_SYMBOL | POINT_SYMBOL | POLYGON_SYMBOL | PRESERVE_SYMBOL | PREV_SYMBOL | PRIVILEGES_SYMBOL | PROCESSLIST_SYMBOL | PROFILE_SYMBOL | PROFILES_SYMBOL | QUARTER_SYMBOL | QUERY_SYMBOL | QUICK_SYMBOL | READ_ONLY_SYMBOL | REBUILD_SYMBOL | RECOVER_SYMBOL | REDO_BUFFER_SIZE_SYMBOL | REDOFILE_SYMBOL | REDUNDANT_SYMBOL | RELAY_SYMBOL | RELAYLOG_SYMBOL | RELAY_LOG_FILE_SYMBOL | RELAY_LOG_POS_SYMBOL | RELAY_THREAD_SYMBOL | REORGANIZE_SYMBOL | REPEATABLE_SYMBOL | REPLICATE_DO_DB_SYMBOL | REPLICATE_IGNORE_DB_SYMBOL | REPLICATE_DO_TABLE_SYMBOL | REPLICATE_IGNORE_TABLE_SYMBOL | REPLICATE_WILD_DO_TABLE_SYMBOL | REPLICATE_WILD_IGNORE_TABLE_SYMBOL | REPLICATE_REWRITE_DB_SYMBOL | USER_RESOURCES_SYMBOL // Placed like in the server grammar where it is named just RESOURCES. | RESUME_SYMBOL | RETURNED_SQLSTATE_SYMBOL | RETURNS_SYMBOL | REVERSE_SYMBOL | ROLLUP_SYMBOL | ROTATE_SYMBOL // Conditionally deprecated in the lexer. | ROUTINE_SYMBOL | ROWS_SYMBOL | ROW_COUNT_SYMBOL | ROW_FORMAT_SYMBOL | ROW_SYMBOL | RTREE_SYMBOL | SCHEDULE_SYMBOL | SCHEMA_NAME_SYMBOL | SECOND_SYMBOL | SERIAL_SYMBOL | SERIALIZABLE_SYMBOL | SESSION_SYMBOL | SHARE_SYMBOL | SIMPLE_SYMBOL | SKIP_SYMBOL // Conditionally deprecated in the lexer. | SLOW_SYMBOL | SNAPSHOT_SYMBOL | SOUNDS_SYMBOL | SOURCE_SYMBOL | SQL_AFTER_GTIDS_SYMBOL | SQL_AFTER_MTS_GAPS_SYMBOL | SQL_BEFORE_GTIDS_SYMBOL | SQL_CACHE_SYMBOL | SQL_BUFFER_RESULT_SYMBOL | SQL_NO_CACHE_SYMBOL | SQL_THREAD_SYMBOL | STACKED_SYMBOL | STARTS_SYMBOL | STATS_AUTO_RECALC_SYMBOL | STATS_PERSISTENT_SYMBOL | STATS_SAMPLE_PAGES_SYMBOL | STATUS_SYMBOL | STORAGE_SYMBOL | STRING_SYMBOL | SUBCLASS_ORIGIN_SYMBOL | SUBDATE_SYMBOL | SUBJECT_SYMBOL | SUBPARTITION_SYMBOL | SUBPARTITIONS_SYMBOL | SUPER_SYMBOL | SUSPEND_SYMBOL | SWAPS_SYMBOL | SWITCHES_SYMBOL | TABLE_NAME_SYMBOL | TABLES_SYMBOL | TABLE_CHECKSUM_SYMBOL | TABLESPACE_SYMBOL | TEMPORARY_SYMBOL | TEMPTABLE_SYMBOL | TEXT_SYMBOL | THAN_SYMBOL | TRANSACTION_SYMBOL | TRIGGERS_SYMBOL | TIMESTAMP_SYMBOL | TIMESTAMP_ADD_SYMBOL | TIMESTAMP_DIFF_SYMBOL | TIME_SYMBOL | TYPES_SYMBOL | TYPE_SYMBOL | UDF_RETURNS_SYMBOL | UNCOMMITTED_SYMBOL | UNDEFINED_SYMBOL | UNDO_BUFFER_SIZE_SYMBOL | UNDOFILE_SYMBOL | UNKNOWN_SYMBOL | UNTIL_SYMBOL | USER_SYMBOL | USE_FRM_SYMBOL | VARIABLES_SYMBOL | VIEW_SYMBOL | VALUE_SYMBOL | WARNINGS_SYMBOL | WAIT_SYMBOL | WEEK_SYMBOL | WORK_SYMBOL | WEIGHT_STRING_SYMBOL | X509_SYMBOL | XID_SYMBOL | XML_SYMBOL | YEAR_SYMBOL ) // Rules that entered or left this rule in specific versions. | {serverVersion < 80001}? (IMPORT_SYMBOL | FUNCTION_SYMBOL) | {serverVersion < 50709}? SHUTDOWN_SYMBOL | {serverVersion < 80000}? CUBE_SYMBOL | {serverVersion >= 80000}? (EXCHANGE_SYMBOL | EXPIRE_SYMBOL | ONLY_SYMBOL | SUPER_SYMBOL | VALIDATION_SYMBOL | WITHOUT_SYMBOL) ; @header {/* * This program 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 program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ } @postinclude { #include "MySQLBaseRecognizer.h" }
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_1952.asm
ljhsiun2/medusa
9
101133
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r8 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_D_ht+0xad9f, %rcx nop nop nop nop add $13669, %rbp movb $0x61, (%rcx) nop nop add $22311, %r8 lea addresses_normal_ht+0x1519f, %r8 nop nop nop and %r11, %r11 mov $0x6162636465666768, %rax movq %rax, (%r8) nop nop nop xor $28734, %rax lea addresses_A_ht+0xd82b, %rsi lea addresses_UC_ht+0x519f, %rdi nop cmp %rax, %rax mov $45, %rcx rep movsb nop nop nop nop nop sub %rbp, %rbp lea addresses_WT_ht+0x10645, %rsi lea addresses_WC_ht+0xd09f, %rdi nop nop nop nop nop dec %r11 mov $126, %rcx rep movsb nop nop nop nop dec %rax lea addresses_WT_ht+0x1ef3f, %r11 nop nop nop nop and %r13, %r13 movb $0x61, (%r11) nop inc %rbp lea addresses_normal_ht+0x1809f, %rbp nop nop nop nop sub %rsi, %rsi movl $0x61626364, (%rbp) nop nop nop nop add %r11, %r11 lea addresses_WT_ht+0x19f9f, %rax and %rsi, %rsi mov $0x6162636465666768, %r8 movq %r8, %xmm0 vmovups %ymm0, (%rax) nop sub $39217, %r11 lea addresses_WT_ht+0x13809, %rsi lea addresses_D_ht+0xf113, %rdi nop nop nop and $14713, %rbp mov $48, %rcx rep movsb nop nop nop cmp $60870, %rsi lea addresses_WC_ht+0x17b9f, %rsi lea addresses_D_ht+0x1e4ff, %rdi nop nop nop and $421, %r11 mov $17, %rcx rep movsw nop nop sub %rdi, %rdi lea addresses_UC_ht+0x1b9f, %rsi lea addresses_normal_ht+0x1c3df, %rdi xor %r13, %r13 mov $14, %rcx rep movsw nop nop cmp $48747, %rax lea addresses_WT_ht+0x65f5, %rbp sub %rax, %rax mov $0x6162636465666768, %r11 movq %r11, (%rbp) xor %rbp, %rbp pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r8 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %r15 push %r8 push %r9 push %rax push %rsi // Store lea addresses_WT+0x1c44f, %r11 nop nop nop cmp $9249, %rax mov $0x5152535455565758, %r8 movq %r8, %xmm4 vmovups %ymm4, (%r11) nop nop xor %r15, %r15 // Store lea addresses_D+0x16f1f, %r11 nop nop sub %rsi, %rsi movw $0x5152, (%r11) nop nop nop nop nop and %rsi, %rsi // Store lea addresses_normal+0x205b, %rax nop nop nop nop nop cmp $1182, %r14 mov $0x5152535455565758, %r11 movq %r11, %xmm7 vmovups %ymm7, (%rax) nop add $47392, %r9 // Faulty Load lea addresses_D+0x1eb9f, %rax clflush (%rax) xor $49929, %r8 mov (%rax), %r9 lea oracles, %r14 and $0xff, %r9 shlq $12, %r9 mov (%r14,%r9,1), %r9 pop %rsi pop %rax pop %r9 pop %r8 pop %r15 pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 4, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 7, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 2, 'size': 32, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 9, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 8, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 9, 'size': 32, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 1, 'size': 8, 'same': False, 'NT': False}} {'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 */
libsrc/_DEVELOPMENT/compress/zx1/z80/asm_dzx1_smart_rcs_back.asm
ahjelm/z88dk
640
16587
<filename>libsrc/_DEVELOPMENT/compress/zx1/z80/asm_dzx1_smart_rcs_back.asm IF !__CPU_INTEL__ && !__CPU_GBZ80__ SECTION code_lib SECTION code_compress_zx1 PUBLIC asm_dzx1_smart_rcs_back asm_dzx1_smart_rcs_back: INCLUDE "dzx1_smartRCS_back.asm" ENDIF
MP/Search.asm
pratikpc/Pracs-Sem-V
0
80394
<reponame>pratikpc/Pracs-Sem-V .8086 .model small .stack 100h .data string db "Myname0" char db '3' msg_found db "Found" msg_not_found db 'Not Found' .code main: mov ax, @data mov ds, ax lea si, string mov ah, char looper: mov al, [si] ; End of String cmp al, '0' je not_found inc si cmp al, char je found jne looper found: lea dx, msg_found mov ah, 09h int 21h jmp exit not_found: lea dx, msg_not_found mov ah, 09h int 21h jmp exit exit: mov ah, 4ch int 21h end main
programs/oeis/279/A279561.asm
neoneye/loda
22
82844
<gh_stars>10-100 ; A279561: Number of length n inversion sequences avoiding the patterns 101, 102, 201, and 210. ; 1,1,2,6,21,77,287,1079,4082,15522,59280,227240,873886,3370030,13027730,50469890,195892565,761615285,2965576715,11563073315,45141073925,176423482325,690215089745,2702831489825,10593202603775,41550902139551,163099562175851 lpb $0 mov $2,$0 sub $0,2 add $2,$0 bin $2,$0 add $0,1 add $1,$2 lpe add $1,1 mov $0,$1
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0x48_notsx.log_21829_1779.asm
ljhsiun2/medusa
9
6032
.global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r8 push %rax push %rbp push %rcx push %rdi // Faulty Load lea addresses_A+0x1ccd3, %r13 and $31115, %r10 movb (%r13), %cl lea oracles, %rax and $0xff, %rcx shlq $12, %rcx mov (%rax,%rcx,1), %rcx pop %rdi pop %rcx pop %rbp pop %rax pop %r8 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_A', 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 1, 'type': 'addresses_A', 'congruent': 0}} <gen_prepare_buffer> {'35': 21829} 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 */
oeis/176/A176470.asm
neoneye/loda-programs
11
83100
<filename>oeis/176/A176470.asm<gh_stars>10-100 ; A176470: Primes of the form 5*x^2-3*y^2, where x and y are consecutive numbers. ; Submitted by <NAME> ; 5,17,53,137,173,257,677,1097,1193,1733,2237,2657,2957,4133,5297,5717,8573,8837,9377,11093,11393,12953,14957,17477,18233,18617,19793,23537,24413,29033,30497,33533,36713,40037,41177,45293,48353,50873,54773,62297,64433,68813,69557,75653,78797,81197,96353,101693,104417,109037,111857,114713,124493,129533,130553,145253,152897,161873,166457,169937,179393,186653,187877,194057,202877,205433,218453,222437,229157,268637,281993,291077,298757,309677,322397,333737,337013,358697,362093,372377,393377,405893 mov $2,332202 lpb $2 mov $3,$6 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,4 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 sub $2,18 add $5,$1 mov $6,$5 add $5,4 lpe mov $0,$5 sub $0,3
simple_http-http_message_processor.adb
annexi-strayline/ASAP-Simple_HTTP
0
925
<gh_stars>0 ------------------------------------------------------------------------------ -- -- -- Simple HTTP -- -- -- -- Basic HTTP 1.1 support for API endpoints -- -- -- -- ------------------------------------------------------------------------ -- -- -- -- Copyright (C) 2021, ANNEXI-STRAYLINE Trans-Human Ltd. -- -- All rights reserved. -- -- -- -- Original Contributors: -- -- * <NAME> (ANNEXI-STRAYLINE) -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- -- -- * Neither the name of the copyright holder nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- -- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ with Ada.Calendar; with Ada.Characters.Handling; with Ada.Strings.Maps.Constants; with Simple_HTTP.RFC_3986; with Simple_HTTP.RFC_7230_7231; package body Simple_HTTP.HTTP_Message_Processor is -- -- Header/Query Utilities -- procedure Internal_Add_Header (Target: in out Header_Set; Header: in HTTP_Header; Status: out HTTP_Message_Status); -- This automatically translate the Field component of Header to lower-case -- and then adds Header to Target. -- -- Status is set to one of: -- -- OK : Operation was successful. -- -- Header_Value_Too_Long: Header for field already exists, but appending the -- new value was not possible -- -- Too_Many_Headers : A new header could not be added because Target is -- saturated. function Header_Key (Header: HTTP_Header) return Field_Strings.Bounded_String is (Header.Field); package Field_Lookup is new Header_Sets.Generic_Keys (Key_Type => Field_Strings.Bounded_String, Key => Header_Key, Hash => Header_Field_Hash, Equivalent_Keys => Field_Strings."="); function Field_Lookup_Case_Sensitive (Container: Header_Sets.Set; Field: String) return Header_Sets.Cursor is Term: constant Field_Strings.Bounded_String := Field_Strings.To_Bounded_String (Field); begin return Field_Lookup.Find (Container, Key => Term); end; function Field_Lookup_Case_Insensitive (Container: Header_Sets.Set; Field: String) return Header_Sets.Cursor is (Field_Lookup_Case_Sensitive (Container, Field => Ada.Characters.Handling.To_Lower (Field))); -- Not to be confused from "Case_Insensitive", Field_Lookup_Case_Insensitive -- is to be used when Set is known to be case insensitive, and therefore all -- Fields within it are always lower-case -- -- Parsers -- package Parsers is procedure Read_Request_Line (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Method : out RFC_7230_7231.Request_Method; URI : out Path_Strings.Bounded_String; Status : out HTTP_Message_Status; Deadline: in Ada.Calendar.Time); -- Expects a "request-line" (RFC 7230-3.1.1), and sets Status according -- to the result. If Status is set to Bad_Version, this means everything -- else about the Request-Line was acceptable. -- -- Note that URI includes any queries, but never includes any fragments, -- which are simply discarded. procedure Read_Status_Line (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Code : out RFC_7230_7231.Response_Status; Phrase : out Phrase_Strings.Bounded_String; Status : out HTTP_Message_Status; Deadline: in Ada.Calendar.Time); -- Expects a "status-line" (RFC 7230-3.1.2), and sets Status according to -- the result. If Status is set to Bad_Version, this means everything -- else about status-line was acceptable. procedure Load_Headers (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Target : in out Header_Set; Status : out HTTP_Message_Status; Deadline: in Ada.Calendar.Time); -- Expects a set of zero or more headers that follows the Request-Line -- Sets Status according to the result. -- -- Header content is validated against RFC 7230. -- -- Note that this parser does not accept trailing whitespace after a -- field content. If more than 2 consecutive spaces appear anywhere -- between the start of the field value and the final CRLF, the headers -- will be rejected. -- -- If Status is OK, the payload will be immedately available on Stream. end Parsers; package body Parsers is separate; -- -- Query Parser Tools -- package Query_Parser_Tools is new RFC_3986.URI_Parser (Path_Strings); -- -- HTTP_Message -- --------------- -- To_Header -- --------------- function To_Header (Field, Value: String) return HTTP_Header is begin return Header: HTTP_Header do Field_Strings.Set_Bounded_String (Target => Header.Field, Source => Field); Value_Strings.Set_Bounded_String (Target => Header.Value, Source => Value); end return; end; ------------ -- Status -- ------------ function Status (Message: HTTP_Message) return HTTP_Message_Status is (Message.Status); ------------------- -- Clear_Headers -- ------------------- procedure Clear_Headers (Message: in out HTTP_Message) is begin Message.Headers.Clear; end; ------------------ -- Header_Count -- ------------------ function Header_Count (Message: HTTP_Message) return Ada.Containers.Count_Type is (Message.Headers.Length); ------------------------- -- Internal_Add_Header -- ------------------------- procedure Internal_Add_Header (Target: in out Header_Set; Header: in HTTP_Header; Status: out HTTP_Message_Status) is use type Ada.Containers.Count_Type; use Header_Sets; Existing_Header: Cursor; Lowered_Header: constant HTTP_Header := (Field => Field_Strings.Translate (Source => Header.Field, Mapping => Ada.Strings.Maps.Constants.Lower_Case_Map), Value => Header.Value); begin Existing_Header := Field_Lookup.Find (Container => Target, Key => Lowered_Header.Field); if Existing_Header /= No_Element then begin Value_Strings.Append (Source => Target(Existing_Header).Value, New_Item => ','); Value_Strings.Append (Source => Target(Existing_Header).Value, New_Item => Header.Value); exception when Ada.Strings.Length_Error => Status := Header_Value_Too_Long; end; elsif Target.Length = Target.Capacity then Status := Too_Many_Headers; else Target.Insert (Lowered_Header); Status := OK; end if; end Internal_Add_Header; ---------------- -- Add_Header -- ---------------- procedure Add_Header (Message : in out HTTP_Message; Field, Value : in String) is Status: HTTP_Message_Status; begin if Field'Length = 0 then raise Constraint_Error with "Attempt to append a header with no Field."; end if; if Value'Length = 0 then raise Constraint_Error with "Attempt to append a header with no Value."; end if; Internal_Add_Header (Target => Message.Headers, Header => To_Header (Field, Value), Status => Status); case Status is when OK => return; when Header_Value_Too_Long => raise Constraint_Error with "Header value is too long"; when Too_Many_Headers => raise Constraint_Error with "Too many headers in message"; when others => raise Constraint_Error with "Internal_Add_Header failed with Status = " & HTTP_Message_Status'Image (Status); end case; end Add_Header; ------------------ -- Header_Value -- ------------------ function Header_Value (Message: HTTP_Message; Field: String) return String is use Header_Sets; Lookup: constant Cursor := Field_Lookup_Case_Insensitive (Container => Message.Headers, Field => Field); begin if Lookup = No_Element then return ""; else return Value_Strings.To_String (Message.Headers(Lookup).Value); end if; end Header_Value; --------------------- -- Iterate_Headers -- --------------------- procedure Iterate_Headers (Message: in HTTP_Message; Process: not null access procedure (Field, Value: in String)) is begin for Header of Message.Headers loop Process (Field => Field_Strings.To_String (Header.Field), Value => Value_Strings.To_String (Header.Value)); end loop; end Iterate_Headers; -- -- HTTP_Request -- ------------ -- Method -- ------------ function Method (Request: HTTP_Request) return RFC_7230_7231.Request_Method is (Request.Method); ---------------- -- Set_Method -- ---------------- procedure Set_Method (Request: in out HTTP_Request; Method : in RFC_7230_7231.Request_Method) is begin Request.Method := Method; end; -------------- -- Base_URI -- -------------- function Base_URI (Request: HTTP_Request) return String is (Path_Strings.To_String (Request.URI)); ------------------ -- Set_URI_Path -- ------------------ procedure Set_Base_URI (Request: in out HTTP_Request; URI : in String) is begin Path_Strings.Set_Bounded_String (Target => Request.URI, Source => URI); end; ----------------- -- Query_Count -- ----------------- function Query_Count (Request: HTTP_Request) return Ada.Containers.Count_Type is (Request.Queries.Length); ------------------- -- Clear_Queries -- ------------------- procedure Clear_Queries (Request: in out HTTP_Request) is begin Request.Queries.Clear; end; --------------- -- Add_Query -- --------------- procedure Add_Query (Request : in out HTTP_Request; Field, Value: in String) is Converted_Field: constant String := (if Query_Fields_Case_Insensitive then Ada.Characters.Handling.To_Lower (Field) else Field); begin if Field'Length = 0 then raise Constraint_Error with "Attempt to append a query with no Field."; end if; -- Queries are allowed to be empty Request.Headers.Insert (To_Header (Field, Value)); end; ------------------ -- Query_Exists -- ------------------ function Query_Exists (Request: HTTP_Request; Field: String) return Boolean is use Header_Sets; begin if Query_Fields_Case_Insensitive then return Field_Lookup_Case_Insensitive (Container => Request.Queries, Field => Field) /= No_Element; else return Field_Lookup_Case_Sensitive (Container => Request.Queries, Field => Field) /= No_Element; end if; end Query_Exists; ----------- -- Query -- ----------- function Query (Request: HTTP_Request; Field: String) return String is use Header_Sets; Position: Cursor; begin if Query_Fields_Case_Insensitive then Position := Field_Lookup_Case_Insensitive (Container => Request.Queries, Field => Field); else Position := Field_Lookup_Case_Sensitive (Container => Request.Queries, Field => Field); end if; if Position = No_Element then return ""; else return Value_Strings.To_String (Request.Queries(Position).Value); end if; end Query; --------------------- -- Iterate_Queries -- --------------------- procedure Iterate_Queries (Request: in HTTP_Request; Process: not null access procedure (Field, Value: in String)) is begin for Query of Request.Queries loop Process (Field => Field_Strings.To_String (Query.Field), Value => Value_Strings.To_String (Query.Value)); end loop; end Iterate_Queries; ------------------- -- Write_Request -- ------------------- procedure Write_Request (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Request: in HTTP_Request) is use RFC_7230_7231; use type Ada.Containers.Count_Type; begin -- Request-line (RFC 2616-5.1) -- "Request-Line = Method SP Request-URI SP HTTP-Version CRLF" if Request.Status /= OK then raise Constraint_Error with "Status must be ""OK"" on output"; end if; -- Method and path String'Write (Stream, Request_Method'Image (Request.Method) & SP); String'Write (Stream, Path_Strings.To_String (Request.URI)); -- Queries if Request.Queries.Length > 0 then declare First_Query: Boolean := True; begin Character'Write (Stream, '?'); for Query of Request.Queries loop if not First_Query then Character'Write (Stream, '&'); else First_Query := False; end if; String'Write (Stream, Field_Strings.To_String (Query.Field)); if Value_Strings.Length (Query.Value) > 0 then Character'Write (Stream, '='); String'Write (Stream, Value_Strings.To_String (Query.Value)); end if; end loop; end; end if; String'Write (Stream, SP & "HTTP/1.1" & CRLF); -- Headers for Header of Request.Headers loop String'Write (Stream, Field_Strings.To_String (Header.Field)); String'Write (Stream, ": "); String'Write (Stream, Value_Strings.To_String (Header.Value)); String'Write (Stream, CRLF); end loop; -- Body preamble String'Write (Stream, CRLF); end Write_Request; ------------------ -- Read_Request -- ------------------ procedure Read_Request (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Request: out HTTP_Request) is -- Unlike Write_Request, the read process is going to be much more -- strict use type Ada.Calendar.Time; Deadline: constant Ada.Calendar.Time := Ada.Calendar.Clock + Slowloris_Timeout; Query_Start: Natural; Version_OK: Boolean; procedure Load_Queries is Query_Segment: Path_Strings.Bounded_String; Query_Actual : HTTP_Header; Next_Query: Natural; Valid: Boolean; procedure Separate_Query is Split: constant Natural := Path_Strings.Index (Source => Query_Segment, Pattern => "=", From => 1); Segment_End: constant Positive := Path_Strings.Length (Query_Segment); Field_End: constant Natural := (if Split > 0 then Split - 1 else Segment_End); Value_Start: constant Natural := (if Split > 0 then Split + 1 else 0); begin if Split = 1 then -- Queries like "?=x", with no field names are not permitted. Request.Status := Bad_Query; return; end if; Field_Strings.Set_Bounded_String (Target => Query_Actual.Field, Source => Path_Strings.Slice (Source => Query_Segment, Low => 1, High => Field_End)); if Query_Fields_Case_Insensitive then Field_Strings.Translate (Source => Query_Actual.Field, Mapping => Ada.Strings.Maps.Constants.Lower_Case_Map); end if; if Split > 0 then Value_Strings.Set_Bounded_String (Target => Query_Actual.Value, Source => Path_Strings.Slice (Source => Query_Segment, Low => Value_Start, High => Segment_End)); else Query_Actual.Value := Value_Strings.Null_Bounded_String; end if; end Separate_Query; procedure Insert_Query is Discard: Header_Sets.Cursor; Inserted: Boolean; begin Request.Queries.Insert (New_Item => Query_Actual, Position => Discard, Inserted => Inserted); if not Inserted then Request.Status := Bad_Query; else Request.Status := OK; end if; end Insert_Query; begin Query_Parser_Tools.First_Query (URI => Request.URI, Query => Query_Segment, Next_Query_Start => Next_Query, Valid => Valid); if not Valid then Request.Status := Bad_Query; return; elsif Path_Strings.Length (Query_Segment) = 0 then -- No queries return; end if; Separate_Query; Insert_Query; if Request.Status /= OK then return; end if; while Next_Query > 0 loop Query_Parser_Tools.Next_Query (URI => Request.URI, Query => Query_Segment, Next_Query_Start => Next_Query, Valid => Valid); if not Valid then Request.Status := Bad_Query; return; end if; Separate_Query; Insert_Query; if Request.Status /= OK then return; end if; end loop; end Load_Queries; begin -- Force a default init of Request Request := (HTTP_Message with others => <>); Parsers.Read_Request_Line (Stream => Stream, Method => Request.Method, URI => Request.URI, Status => Request.Status, Deadline => Deadline); if Request.Status in OK | Bad_Version then Version_OK := (Request.Status = OK); else return; end if; -- See if we have any queries, and make note of the start position -- so that we can remove it. if Path_Strings.Length (Request.URI) > 0 then Query_Start := Path_Strings.Index (Source => Request.URI, Pattern => "?", From => 1); Load_Queries; if Request.Status /= OK then return; end if; else Query_Start := 0; end if; if Query_Start > 0 then Request.URI := Path_Strings.Head (Source => Request.URI, Count => Query_Start - 1); end if; Parsers.Load_Headers (Stream => Stream, Target => Request.Headers, Status => Request.Status, Deadline => Deadline); if Request.Status /= OK then return; elsif not Version_OK then Request.Status := Bad_Version; end if; -- Headers are loaded and the stream should be exactly at the payload. end Read_Request; ------------------- -- Input_Request -- ------------------- function Input_Request (Stream: not null access Ada.Streams.Root_Stream_Type'Class) return HTTP_Request is begin return Request: HTTP_Request do Read_Request (Stream, Request); end return; end Input_Request; -- -- HTTP_Response -- ----------------- -- Status_Code -- ----------------- function Status_Code (Response: HTTP_Response) return RFC_7230_7231.Response_Status is (Response.Status_Code); ------------------- -- Reason_Phrase -- ------------------- function Reason_Phrase (Response: HTTP_Response) return String is (Phrase_Strings.To_String (Response.Reason_Phrase)); ------------------------- -- Set_Standard_Status -- ------------------------- procedure Set_Standard_Status (Response: in out HTTP_Response; Code : in RFC_7230_7231.Standard_Response_Status) is package RFC_7231 renames RFC_7230_7231; procedure Set_Phrase (Phrase: in String) with Inline is begin Phrase_Strings.Set_Bounded_String (Target => Response.Reason_Phrase, Source => Phrase); end; begin case Code is when 100 => Set_Phrase (RFC_7231.Phrase_100); when 101 => Set_Phrase (RFC_7231.Phrase_101); when 200 => Set_Phrase (RFC_7231.Phrase_200); when 201 => Set_Phrase (RFC_7231.Phrase_201); when 202 => Set_Phrase (RFC_7231.Phrase_202); when 203 => Set_Phrase (RFC_7231.Phrase_203); when 204 => Set_Phrase (RFC_7231.Phrase_204); when 205 => Set_Phrase (RFC_7231.Phrase_205); when 206 => Set_Phrase (RFC_7231.Phrase_206); when 300 => Set_Phrase (RFC_7231.Phrase_300); when 301 => Set_Phrase (RFC_7231.Phrase_301); when 302 => Set_Phrase (RFC_7231.Phrase_302); when 303 => Set_Phrase (RFC_7231.Phrase_303); when 304 => Set_Phrase (RFC_7231.Phrase_304); when 305 => Set_Phrase (RFC_7231.Phrase_305); when 307 => Set_Phrase (RFC_7231.Phrase_307); when 400 => Set_Phrase (RFC_7231.Phrase_400); when 401 => Set_Phrase (RFC_7231.Phrase_401); when 402 => Set_Phrase (RFC_7231.Phrase_402); when 403 => Set_Phrase (RFC_7231.Phrase_403); when 404 => Set_Phrase (RFC_7231.Phrase_404); when 405 => Set_Phrase (RFC_7231.Phrase_405); when 406 => Set_Phrase (RFC_7231.Phrase_406); when 407 => Set_Phrase (RFC_7231.Phrase_407); when 408 => Set_Phrase (RFC_7231.Phrase_408); when 409 => Set_Phrase (RFC_7231.Phrase_409); when 410 => Set_Phrase (RFC_7231.Phrase_410); when 411 => Set_Phrase (RFC_7231.Phrase_411); when 412 => Set_Phrase (RFC_7231.Phrase_412); when 413 => Set_Phrase (RFC_7231.Phrase_413); when 414 => Set_Phrase (RFC_7231.Phrase_414); when 415 => Set_Phrase (RFC_7231.Phrase_415); when 416 => Set_Phrase (RFC_7231.Phrase_416); when 417 => Set_Phrase (RFC_7231.Phrase_417); when 426 => Set_Phrase (RFC_7231.Phrase_426); when 500 => Set_Phrase (RFC_7231.Phrase_500); when 501 => Set_Phrase (RFC_7231.Phrase_500); when 502 => Set_Phrase (RFC_7231.Phrase_500); when 503 => Set_Phrase (RFC_7231.Phrase_500); when 504 => Set_Phrase (RFC_7231.Phrase_500); when 505 => Set_Phrase (RFC_7231.Phrase_500); when others => raise Constraint_Error with "Status code is not a standard code."; end case; Response.Status_Code := Code; end Set_Standard_Status; ------------------------- -- Set_Explicit_Status -- ------------------------- procedure Set_Explicit_Status (Response: in out HTTP_Response; Code : in RFC_7230_7231.Response_Status; Phrase : in String) is begin Response.Status_Code := Code; Phrase_Strings.Set_Bounded_String (Target => Response.Reason_Phrase, Source => Phrase); end Set_Explicit_Status; -------------------- -- Write_Response -- -------------------- procedure Write_Response (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Response: in HTTP_Response) is CRLF: String renames RFC_7230_7231.CRLF; begin -- RFC 7230, 3.1.2 - Status line String'Write (Stream, "HTTP/1.1"); String'Write (Stream, RFC_7230_7231.Response_Status'Image (Response.Status_Code) & ' '); -- Note that the image of the resonse code contains the requisite 'SP' -- that needs to follow HTTP-version String'Write (Stream, Phrase_Strings.To_String (Response.Reason_Phrase)); String'Write (Stream, CRLF); -- Headers for Header of Response.Headers loop String'Write (Stream, Field_Strings.To_String (Header.Field) & ": "); String'Write (Stream, Value_Strings.To_String (Header.Value)); String'Write (Stream, CRLF); end loop; String'Write (Stream, CRLF); end Write_Response; ------------------- -- Read_Response -- ------------------- procedure Read_Response (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Response: out HTTP_Response) is use type Ada.Calendar.Time; Deadline: constant Ada.Calendar.Time := Ada.Calendar.Clock + Slowloris_Timeout; Version_OK: Boolean; begin -- Status line Parsers.Read_Status_Line (Stream => Stream, Code => Response.Status_Code, Phrase => Response.Reason_Phrase, Status => Response.Status, Deadline => Deadline); if Response.Status in OK | Bad_Version then Version_OK := (Response.Status = OK); else return; end if; Parsers.Load_Headers (Stream => Stream, Target => Response.Headers, Status => Response.Status, Deadline => Deadline); if Response.Status /= OK then return; elsif not Version_OK then Response.Status := Bad_Version; end if; -- Headers are loaded and the stream should be exactly at the payload. end Read_Response; -------------------- -- Input_Response -- -------------------- function Input_Response (Stream: not null access Ada.Streams.Root_Stream_Type'Class) return HTTP_Response is begin return Response: HTTP_Response do Read_Response (Stream, Response); end return; end Input_Response; end Simple_HTTP.HTTP_Message_Processor;
libsrc/video/msm6255/asm_set_lcd_mode.asm
ahjelm/z88dk
640
16594
SECTION code_clib PUBLIC asm_set_lcd_mode INCLUDE "msm6255.inc" ; Set the mode of LCD controller ; 0000000x -> GRAPHICS (1), TEXT (0) ; 00000xx0 -> 4bit parallel (01) / serial (00) / serial EVEN-ODD (10) -> Bondwell 2 is EVEN-ODD ; 0000x000 -> Display ON/OFF ; 000x0000 -> TEXT Cursor blinking (e.g. 3D) ; 00x00000 -> TEXT Cursor ON/OFF ; 0x000000 -> TEXT Blinking time ; Useful modes on Bondwell 2 ; 0x75 ;DISPLAY OFF ; 0x7D ;DISPLAY ON (TEXT CSR. ON, useless on BW2) ; ; Uses: af, l, bc (on some targets) ; asm_set_lcd_mode: xor a IF address_w > 256 ld bc,address_w out (c),a ELSE out (address_w),a ENDIF IF register_w > 256 ld bc,register_w out (c),l ELSE ld a,l out (register_w),a ENDIF ret
Plain/Models.agda
frantisekfarka/lp-mod
0
6672
<gh_stars>0 module Plain.Models where open import Data.Nat open import Plain.Terms -- The (complete) Herbrand universe for Σ U' : {n : ℕ} → (Signature n) → Set U' Σ = GTerm Σ open import Relation.Unary as U open import Level -- a (complete) Herbrand interpretation record Interp {n : ℕ} (Σ : Signature n) : Set₁ where field Carrier : Pred (U' Σ) Level.zero open Interp _∩ᵢ_ : {n : ℕ} → {Σ : Signature n} → Interp Σ → Interp Σ → Interp Σ i₁ ∩ᵢ i₂ = record { Carrier = (Carrier i₁) U.∩ Carrier i₂ } _∪ᵢ_ : {n : ℕ} → {Σ : Signature n} → Interp Σ → Interp Σ → Interp Σ i₁ ∪ᵢ i₂ = record { Carrier = (Carrier i₁) U.∪ Carrier i₂ } open import Data.List as L open import Data.List.All as LAl open import Data.List.Any as LAn open import Relation.Binary.Core open Program -- | Inductive model property record IsIndModel {n : ℕ} {Σ : Signature n} (i : Interp Σ) (P : Program Σ) : Set₂ where field forwClosed : (bs' : List (GTerm Σ)) → All (λ b → b ∈ Carrier i) bs' → (σ : GSubst Σ) → (a : Term Σ Var) → (bs : List (Term Σ Var)) → Any (λ cl → cl ≡ (a :- bs)) (prg P) → (L.map (app σ) bs) ≡ bs' → (app σ a ∈ Carrier i) open IsIndModel -- | Ind Model record IndModel {n : ℕ} {Σ : Signature n} (P : Program Σ) : Set₂ where field iInterp : Interp Σ isIndModel : IsIndModel iInterp P open IndModel open import Data.Product open import Data.List.All.Properties -- using (All-map) {- -- | Model intersection _∩m_ : {n : ℕ} → {Σ : Signature n} → {P : Program Σ} → (m₁ : IndModel P) → (m₂ : IndModel P) → IndModel P _∩m_ {n} {Σ} {P} m₁ m₂ = record { interp = interp m₁ ∩ᵢ interp m₂ ; isIndModel = prop-model-intersection-pair P m₁ m₂ } -} ⋂ᵢ : {n : ℕ} → {Σ : Signature n} → (I : Set) → (I → Interp Σ) → Interp Σ ⋂ᵢ I f = record { Carrier = ⋂ I (λ i t → t ∈ Carrier (f i)) } open import Function prop-model-intersection : {n : ℕ} → {Σ : Signature n} → (P : Program Σ) → (I : Set) -- ^ is non-empty by what argument? → (mps : I → IndModel P) → IsIndModel ( ⋂ᵢ I (iInterp ∘ mps)) P prop-model-intersection P I mps = record { forwClosed = λ bs' pbs' σ a bs pcl pbs i → forwClosed (isIndModel (mps i)) bs' (LAl.map (λ k → k i) pbs') σ a bs pcl pbs } -- | Coinductive model record IsCoiModel {n : ℕ} {Σ : Signature n} (i : Interp Σ) (P : Program Σ) : Set₂ where field backClosed : {a : Term Σ Var} → {bs : List (Term Σ Var)} → (a' : GTerm Σ) → a' ∈ Carrier i → ∃ (λ (σclsp : GSubst Σ × Any (λ c → a :- bs ≡ c) (prg P)) → app (proj₁ σclsp) a ≡ a' → All (λ c → c ∈ Carrier i) (L.map (app (proj₁ σclsp)) bs)) open IsCoiModel -- | Coi Model record CoiModel {n : ℕ} {Σ : Signature n} (P : Program Σ) : Set₂ where field cInterp : Interp Σ isCoiModel : IsCoiModel cInterp P open CoiModel ⋃ᵢ : {n : ℕ} → {Σ : Signature n} → (I : Set) → (I → Interp Σ) → Interp Σ ⋃ᵢ I f = record { Carrier = λ x → ⋃ I (λ i t → t ∈ Carrier (f i)) x } open import Data.Product as DP -- | model union property prop-model-union : {n : ℕ} → {Σ : Signature n} → (P : Program Σ) → (I : Set) -- ^ is non-empty by what argument? → (mps : I → CoiModel P) → IsCoiModel ( ⋃ᵢ I (cInterp ∘ mps)) P prop-model-union P I mps = record { backClosed = λ a' x → DP.map (λ id → id) (λ x₂ x₃ → LAl.map (λ x₄ → proj₁ x , x₄) (x₂ x₃)) (backClosed (isCoiModel (mps (proj₁ x))) a' (proj₂ x)) } open import Data.Unit prop-ex-ind-model : {n : ℕ} → {Σ : Signature n} → (P : Program Σ) → IndModel P prop-ex-ind-model P = record { iInterp = record { Carrier = U } ; isIndModel = record { forwClosed = λ bs' x σ a bs x₁ x₂ → tt } } open import Data.Empty prop-ex-coi-model : {n : ℕ} → {Σ : Signature n} → (P : Program Σ) → CoiModel P prop-ex-coi-model P = record { cInterp = record { Carrier = ∅ } ; isCoiModel = record { backClosed = λ a' () } }
src/shared/generic/lsc-internal-ec_signature.adb
Componolit/libsparkcrypto
30
7715
------------------------------------------------------------------------------- -- This file is part of libsparkcrypto. -- -- Copyright (C) 2012, <NAME> -- Copyright (C) 2012, secunet Security Networks AG -- 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 author 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. ------------------------------------------------------------------------------- package body LSC.Internal.EC_Signature is pragma Warnings (Off, """V"" may be referenced before it has a value"); procedure Extract (X : in Bignum.Big_Int; X_First : in Natural; X_Last : in Natural; Z : in Bignum.Big_Int; Z_First : in Natural; V : out Bignum.Big_Int; V_First : in Natural; M : in Bignum.Big_Int; M_First : in Natural; M_Inv : in Types.Word32; RM : in Bignum.Big_Int; RM_First : in Natural; N : in Bignum.Big_Int; N_First : in Natural; N_Inv : in Types.Word32; RN : in Bignum.Big_Int; RN_First : in Natural) with Depends => (V =>+ (V_First, X, X_First, X_Last, Z, Z_First, M, M_First, M_Inv, RM, RM_First, N, N_First, N_Inv, RN, RN_First)), Pre => X_First in X'Range and then X_Last in X'Range and then X_First < X_Last and then X_Last - X_First < EC.Max_Coord_Length and then Z_First in Z'Range and then Z_First + (X_Last - X_First) in Z'Range and then V_First in V'Range and then V_First + (X_Last - X_First) in V'Range and then M_First in M'Range and then M_First + (X_Last - X_First) in M'Range and then RM_First in RM'Range and then RM_First + (X_Last - X_First) in RM'Range and then N_First in N'Range and then N_First + (X_Last - X_First) in N'Range and then RN_First in RN'Range and then RN_First + (X_Last - X_First) in RN'Range and then Bignum.Num_Of_Big_Int (X, X_First, X_Last - X_First + 1) < Bignum.Num_Of_Big_Int (M, M_First, X_Last - X_First + 1) and then Bignum.Num_Of_Big_Int (Z, Z_First, X_Last - X_First + 1) < Bignum.Num_Of_Big_Int (M, M_First, X_Last - X_First + 1) and then Math_Int.From_Word32 (1) < Bignum.Num_Of_Big_Int (M, M_First, X_Last - X_First + 1) and then 1 + M_Inv * M (M_First) = 0 and then Math_Int.From_Word32 (1) < Bignum.Num_Of_Big_Int (N, N_First, X_Last - X_First + 1) and then 1 + N_Inv * N (N_First) = 0 and then Bignum.Num_Of_Big_Int (RM, RM_First, X_Last - X_First + 1) = Bignum.Base ** (Math_Int.From_Integer (2) * Math_Int.From_Integer (X_Last - X_First + 1)) mod Bignum.Num_Of_Big_Int (M, M_First, X_Last - X_First + 1) and then Bignum.Num_Of_Big_Int (RN, RN_First, X_Last - X_First + 1) = Bignum.Base ** (Math_Int.From_Integer (2) * Math_Int.From_Integer (X_Last - X_First + 1)) mod Bignum.Num_Of_Big_Int (N, N_First, X_Last - X_First + 1), Post => Bignum.Num_Of_Big_Int (V, V_First, X_Last - X_First + 1) < Bignum.Num_Of_Big_Int (N, N_First, X_Last - X_First + 1); procedure Extract (X : in Bignum.Big_Int; X_First : in Natural; X_Last : in Natural; Z : in Bignum.Big_Int; Z_First : in Natural; V : out Bignum.Big_Int; V_First : in Natural; M : in Bignum.Big_Int; M_First : in Natural; M_Inv : in Types.Word32; RM : in Bignum.Big_Int; RM_First : in Natural; N : in Bignum.Big_Int; N_First : in Natural; N_Inv : in Types.Word32; RN : in Bignum.Big_Int; RN_First : in Natural) is L : Natural; H : EC.Coord; begin L := X_Last - X_First; EC.Invert (Z, Z_First, Z_First + L, H, H'First, RM, RM_First, M, M_First, M_Inv); Bignum.Mont_Mult (V, V_First, V_First + L, X, X_First, H, H'First, M, M_First, M_Inv); Bignum.Mont_Mult (H, H'First, H'First + L, V, V_First, EC.One, EC.One'First, N, N_First, N_Inv); Bignum.Mont_Mult (V, V_First, V_First + L, H, H'First, RN, RN_First, N, N_First, N_Inv); end Extract; pragma Warnings (On, """V"" may be referenced before it has a value"); ---------------------------------------------------------------------------- procedure Sign (Sign1 : out Bignum.Big_Int; Sign1_First : in Natural; Sign1_Last : in Natural; Sign2 : out Bignum.Big_Int; Sign2_First : in Natural; Hash : in Bignum.Big_Int; Hash_First : in Natural; Rand : in Bignum.Big_Int; Rand_First : in Natural; T : in Signature_Type; Priv : in Bignum.Big_Int; Priv_First : in Natural; BX : in Bignum.Big_Int; BX_First : in Natural; BY : in Bignum.Big_Int; BY_First : in Natural; A : in Bignum.Big_Int; A_First : in Natural; M : in Bignum.Big_Int; M_First : in Natural; M_Inv : in Types.Word32; RM : in Bignum.Big_Int; RM_First : in Natural; N : in Bignum.Big_Int; N_First : in Natural; N_Inv : in Types.Word32; RN : in Bignum.Big_Int; RN_First : in Natural; Success : out Boolean) is L : Natural; X, Y, Z, PrivR, H1, H2, H3 : EC.Coord; begin L := Sign1_Last - Sign1_First; Bignum.Mont_Mult (H1, H1'First, H1'First + L, Hash, Hash_First, EC.One, EC.One'First, N, N_First, N_Inv); Bignum.Mont_Mult (H3, H3'First, H3'First + L, H1, H1'First, RN, RN_First, N, N_First, N_Inv); pragma Warnings (Off, "unused assignment to ""Y"""); EC.Point_Mult (X1 => BX, X1_First => BX_First, X1_Last => BX_First + L, Y1 => BY, Y1_First => BY_First, Z1 => EC.One, Z1_First => EC.One'First, E => Rand, E_First => Rand_First, E_Last => Rand_First + L, X2 => X, X2_First => X'First, Y2 => Y, Y2_First => Y'First, Z2 => Z, Z2_First => Z'First, A => A, A_First => A_First, M => M, M_First => M_First, M_Inv => M_Inv); pragma Warnings (On, "unused assignment to ""Y"""); Extract (X, X'First, X'First + L, Z, Z'First, Sign1, Sign1_First, M, M_First, M_Inv, RM, RM_First, N, N_First, N_Inv, RN, RN_First); Bignum.Mont_Mult (PrivR, PrivR'First, PrivR'First + L, Priv, Priv_First, RN, RN_First, N, N_First, N_Inv); case T is when ECDSA => Bignum.Mont_Mult (H1, H1'First, H1'First + L, PrivR, PrivR'First, Sign1, Sign1_First, N, N_First, N_Inv); Bignum.Mod_Add_Inplace (H1, H1'First, H1'First + L, H3, H3'First, N, N_First); EC.Invert (Rand, Rand_First, Rand_First + L, H2, H2'First, RN, RN_First, N, N_First, N_Inv); Bignum.Mont_Mult (Sign2, Sign2_First, Sign2_First + L, H1, H1'First, H2, H2'First, N, N_First, N_Inv); when ECGDSA => Bignum.Mont_Mult (H1, H1'First, H1'First + L, Rand, Rand_First, RN, RN_First, N, N_First, N_Inv); Bignum.Mont_Mult (H2, H2'First, H2'First + L, H1, H1'First, Sign1, Sign1_First, N, N_First, N_Inv); Bignum.Mod_Sub_Inplace (H2, H2'First, H2'First + L, H3, H3'First, N, N_First); Bignum.Mont_Mult (Sign2, Sign2_First, Sign2_First + L, H2, H2'First, PrivR, PrivR'First, N, N_First, N_Inv); end case; Success := not Bignum.Is_Zero (Sign1, Sign1_First, Sign1_Last) and then not Bignum.Is_Zero (Sign2, Sign2_First, Sign2_First + L); end Sign; ---------------------------------------------------------------------------- function Verify (Sign1 : Bignum.Big_Int; Sign1_First : Natural; Sign1_Last : Natural; Sign2 : Bignum.Big_Int; Sign2_First : Natural; Hash : Bignum.Big_Int; Hash_First : Natural; T : Signature_Type; PubX : Bignum.Big_Int; PubX_First : Natural; PubY : Bignum.Big_Int; PubY_First : Natural; BX : Bignum.Big_Int; BX_First : Natural; BY : Bignum.Big_Int; BY_First : Natural; A : Bignum.Big_Int; A_First : Natural; M : Bignum.Big_Int; M_First : Natural; M_Inv : Types.Word32; RM : Bignum.Big_Int; RM_First : Natural; N : Bignum.Big_Int; N_First : Natural; N_Inv : Types.Word32; RN : Bignum.Big_Int; RN_First : Natural) return Boolean is L : Natural; Result : Boolean; H1, H2, H, X, Y, Z, V : EC.Coord; begin L := Sign1_Last - Sign1_First; if not Bignum.Is_Zero (Sign1, Sign1_First, Sign1_Last) and then Bignum.Less (Sign1, Sign1_First, Sign1_Last, N, N_First) and then not Bignum.Is_Zero (Sign2, Sign2_First, Sign2_First + L) and then Bignum.Less (Sign2, Sign2_First, Sign2_First + L, N, N_First) then case T is when ECDSA => EC.Invert (Sign2, Sign2_First, Sign2_First + L, H, H'First, RN, RN_First, N, N_First, N_Inv); Bignum.Mont_Mult (H2, H2'First, H2'First + L, Sign1, Sign1_First, H, H'First, N, N_First, N_Inv); when ECGDSA => EC.Invert (Sign1, Sign1_First, Sign1_Last, H, H'First, RN, RN_First, N, N_First, N_Inv); Bignum.Mont_Mult (H2, H2'First, H2'First + L, Sign2, Sign2_First, H, H'First, N, N_First, N_Inv); end case; Bignum.Mont_Mult (H1, H1'First, H1'First + L, Hash, Hash_First, H, H'First, N, N_First, N_Inv); pragma Warnings (Off, "unused assignment to ""Y"""); EC.Two_Point_Mult (X1 => BX, X1_First => BX_First, X1_Last => BX_First + L, Y1 => BY, Y1_First => BY_First, Z1 => EC.One, Z1_First => EC.One'First, E1 => H1, E1_First => H1'First, E1_Last => H1'First + L, X2 => PubX, X2_First => PubX_First, Y2 => PubY, Y2_First => PubY_First, Z2 => EC.One, Z2_First => EC.One'First, E2 => H2, E2_First => H2'First, X3 => X, X3_First => X'First, Y3 => Y, Y3_First => Y'First, Z3 => Z, Z3_First => Z'First, A => A, A_First => A_First, M => M, M_First => M_First, M_Inv => M_Inv); pragma Warnings (On, "unused assignment to ""Y"""); Extract (X, X'First, X'First + L, Z, Z'First, V, V'First, M, M_First, M_Inv, RM, RM_First, N, N_First, N_Inv, RN, RN_First); Result := Bignum.Equal (Sign1, Sign1_First, Sign1_Last, V, V'First); else Result := False; end if; return Result; end Verify; end LSC.Internal.EC_Signature;
src/bootsect/bootsect.asm
wangziqi2016/Kernel
3
21617
<filename>src/bootsect/bootsect.asm ; ; Boot sector for a floppy disk ; section .text org 7c00h VIDEO_SEG equ 0b800h ; Video buffer BUFFER_LEN_PER_LINE equ 00a0h ; 80 * 2 = 160 char + attr per line LOAD_SEG equ 8000h ; We start loading the sector at 0x10000 SECTOR_SIZE equ 0200h ; Each sector is 512 byte END_MARK equ 0abcdh ; Use this magic number to verify integrity of image loaded jmp start start: ; Clear interrupt before we set up the stack cli mov ax, 0003h int 10h ; AH = 00 - set mode; AL = 03h - 80*25@16 xor ax, ax mov ds, ax mov ss, ax ; Set DS=SS; ES undefined mov sp, 0FFF0h ; Set up stack end: 0x0FFF0 sti mov si, str1 call print_msg start_load: push word LOAD_SEG pop es xor bx, bx ; ES:BX = LOAD_SEG:0000 mov cx, [num_sector_to_read] ; This must equal the exact number of sectors read_next_sector: call read_sector ; This is the number of sectors we read from the 1st sector call next_sector cmp bx, 0000h ; This means we have seen an overflow of offset within the LOAD_SEG jnz test_num_sector mov ax, es add ax, 1000h mov es, ax test_num_sector: dec cx jnz read_next_sector ; If still not finished, repeat the loop push word LOAD_SEG ; Verify the content after reading pop es mov ax, [es:SECTOR_SIZE - 2] ; Check if word [LOAD_SEG + SECTOR_SIZE - 2] equals 0xAA55 cmp ax, 0aa55h jne print_verify_sector_error cmp word [es:bx - 2], END_MARK ; Check if word [CURRENT ES:BX - 2] equals 0xABCD jne print_verify_loader_error push word LOAD_SEG push word SECTOR_SIZE retf ; Jump to the code we just loaded: LOAD_SEG:SECTOR_SIZE (because the bootsector is also loaded) ; This function reads a sector into ES:BX ; using the parameter at the end of this file ; It will change BX to the next sector ; - Changes AX and DX read_sector: push bx push cx ; Retry remains push word 3 read_sector_retry: mov ax, 0201h ; DL = drive ID. DH = disk head mov dx, [boot_drive] ; Note that bit 6 and 7 in CL are actually bit ; 8 and 9 of the track. We just assume they are ; always 0 (only 80 tracks) mov cx, [current_sector] int 13h jc read_sector_reset ; AL contains the actual # of tracks read ; AH contatns the return code (00 = normal) cmp ax, 0001h jne read_sector_reset ; Return here normally pop cx pop cx pop bx add bx, SECTOR_SIZE retn read_sector_reset: ; Check whether we have run out of retries pop cx test cx, cx je print_read_sector_error ; AH = 00H to reset the device speficied by DL mov ah, 00h mov dl, [boot_drive] int 13h jc print_read_sector_error ; Decrease this number and continue execution dec cx push cx jmp read_sector_retry ; This function changes the parameters of the disk ; - Changes AX ; ; We do as the following: ; (1) Check whether we have reached the maximum sector (inclusive) ; If not then just increment the sector ; (2) Otherwise, reset sector to 1, and check whether we have reached the ; maximum head. If not just incremant the head ; (3) Otherwise, reset head to 0, and check whether we have reached the ; maximum track. If not just increment the track ; (4) Otherwise, report error, because we have reached the end of the disk next_sector: mov al, [current_sector] ; Whether we have reached the end of a track cmp al, [sector_per_track] jb inc_sector ; Reset sector (always start at 1) mov byte [current_sector], 01h ; Then check head mov al, [current_head] inc al cmp al, [head_per_disk] jne inc_head ; Reset head mov byte [current_head], 00h mov al, [current_track] inc al cmp al, [track_per_disk] jne inc_track jmp print_reach_disk_end_error inc_track: inc byte [current_track] retn inc_head: inc byte [current_head] retn inc_sector: inc byte [current_sector] retn ; This function prints a zero-terminated line whose ; length is less than 80; It always starts a new line after printing print_msg: push es push di ; Reload ES as the video buffer segment push word VIDEO_SEG pop es mov di, [video_offset] print_msg_body: mov al, [ds:si] test al, al je print_msg_ret mov [es:di], al inc si inc di inc di jmp print_msg_body print_msg_ret: ; Go to the next line add word [video_offset], BUFFER_LEN_PER_LINE pop di pop es retn print_reach_disk_end_error: mov si, str4 call print_msg jmp die print_read_sector_error: mov si, str2 call print_msg jmp die print_verify_sector_error: mov si, str3 call print_msg jmp die print_verify_loader_error: mov si, str5 call print_msg jmp die die: jmp die str1: db "Loading boot sectors...", 0 str2: db "Error reading sectors", 0 str3: db "Error verifying sectors (55AA)", 0 str4: db "Reached the end of disk", 0 str5: db "Error verifying loader (ABCD)", 0 sector_per_track: db 12h ; 18 sectors per track track_per_disk: db 50h ; 80 tracks per disk head_per_disk: db 02h ; 2 heads per disk num_sector_to_read: dw 12d ; This must be exact, otherwise verification would fail current_sector: db 01h ; CL + CH = sector + track current_track: db 00h ; Track starts with 0 boot_drive: db 0h ; DL + DH = drive ID + disk head current_head: db 00h video_offset: dw 0 times 510-($-$$) DB 0 ; Padding to 512 bytes dw 0AA55H ; Magic number
oeis/140/A140652.asm
neoneye/loda-programs
11
19017
<reponame>neoneye/loda-programs ; A140652: Partial sums of A062968. ; Submitted by <NAME> ; 1,2,4,6,10,13,19,24,31,38,48,55,67,78,90,102,118,131,149,164,182,201,223,240,263,286,310,333,361,384,414,441,471,502,534,562,598,633,669,702,742,777,819,858,898,941,987,1026,1073,1118,1166,1213,1265,1312 mov $1,1 mov $3,$0 lpb $3 mul $1,$3 cmp $2,0 add $5,$2 div $1,$5 add $4,$1 mov $1,$5 sub $3,1 lpe mov $0,$4 add $0,1
directoryWalker.asm
arturosalazar/xv6-public
0
172561
<reponame>arturosalazar/xv6-public<filename>directoryWalker.asm _directoryWalker: file format elf32-i386 Disassembly of section .text: 00000000 <main>: } int main(int argc, char *argv[]) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 57 push %edi e: 56 push %esi f: 53 push %ebx 10: 51 push %ecx 11: bb 01 00 00 00 mov $0x1,%ebx 16: 83 ec 08 sub $0x8,%esp 19: 8b 31 mov (%ecx),%esi 1b: 8b 79 04 mov 0x4(%ecx),%edi int i; if(argc < 2){ 1e: 83 fe 01 cmp $0x1,%esi 21: 7e 1f jle 42 <main+0x42> 23: 90 nop 24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi directoryWalker("."); exit(); } for(i=1; i<argc; i++) directoryWalker(argv[i]); 28: 83 ec 0c sub $0xc,%esp 2b: ff 34 9f pushl (%edi,%ebx,4) if(argc < 2){ directoryWalker("."); exit(); } for(i=1; i<argc; i++) 2e: 83 c3 01 add $0x1,%ebx directoryWalker(argv[i]); 31: e8 2a 00 00 00 call 60 <directoryWalker> if(argc < 2){ directoryWalker("."); exit(); } for(i=1; i<argc; i++) 36: 83 c4 10 add $0x10,%esp 39: 39 de cmp %ebx,%esi 3b: 75 eb jne 28 <main+0x28> directoryWalker(argv[i]); exit(); 3d: e8 40 04 00 00 call 482 <exit> main(int argc, char *argv[]) { int i; if(argc < 2){ directoryWalker("."); 42: 83 ec 0c sub $0xc,%esp 45: 68 6c 09 00 00 push $0x96c 4a: e8 11 00 00 00 call 60 <directoryWalker> exit(); 4f: e8 2e 04 00 00 call 482 <exit> 54: 66 90 xchg %ax,%ax 56: 66 90 xchg %ax,%ax 58: 66 90 xchg %ax,%ax 5a: 66 90 xchg %ax,%ax 5c: 66 90 xchg %ax,%ax 5e: 66 90 xchg %ax,%ax 00000060 <directoryWalker>: #include "user.h" #include "fs.h" void directoryWalker(char* path){ 60: 55 push %ebp char buf[512] = {0}; 61: 31 c0 xor %eax,%eax 63: b9 80 00 00 00 mov $0x80,%ecx #include "user.h" #include "fs.h" void directoryWalker(char* path){ 68: 89 e5 mov %esp,%ebp 6a: 57 push %edi 6b: 56 push %esi 6c: 53 push %ebx char buf[512] = {0}; 6d: 8d b5 e8 fd ff ff lea -0x218(%ebp),%esi #include "user.h" #include "fs.h" void directoryWalker(char* path){ 73: 81 ec 60 02 00 00 sub $0x260,%esp 79: 8b 5d 08 mov 0x8(%ebp),%ebx char buf[512] = {0}; 7c: 89 f7 mov %esi,%edi 7e: f3 ab rep stos %eax,%es:(%edi) char *p; int fd; struct dirent de; struct stat st; printf(1, "DEBUG PATH: %s\n", path); 80: 53 push %ebx 81: 68 20 09 00 00 push $0x920 86: 6a 01 push $0x1 88: e8 73 05 00 00 call 600 <printf> if((fd = open(path, 0)) < 0){ 8d: 58 pop %eax 8e: 5a pop %edx 8f: 6a 00 push $0x0 91: 53 push %ebx 92: e8 2b 04 00 00 call 4c2 <open> 97: 83 c4 10 add $0x10,%esp 9a: 85 c0 test %eax,%eax 9c: 78 52 js f0 <directoryWalker+0x90> 9e: 89 c7 mov %eax,%edi printf(2, "ls: cannot open %s\n", path); return; } if(fstat(fd, &st) < 0){ a0: 8d 85 b4 fd ff ff lea -0x24c(%ebp),%eax a6: 83 ec 08 sub $0x8,%esp a9: 50 push %eax aa: 57 push %edi ab: e8 2a 04 00 00 call 4da <fstat> b0: 83 c4 10 add $0x10,%esp b3: 85 c0 test %eax,%eax b5: 0f 88 45 01 00 00 js 200 <directoryWalker+0x1a0> printf(2, "ls: cannot stat %s\n", path); close(fd); return; } if(st.type != T_DIR){ bb: 66 83 bd b4 fd ff ff cmpw $0x1,-0x24c(%ebp) c2: 01 c3: 74 4b je 110 <directoryWalker+0xb0> printf(1, "Filename: %s \n inode number: %d\n", path, st.ino); c5: ff b5 bc fd ff ff pushl -0x244(%ebp) cb: 53 push %ebx cc: 68 88 09 00 00 push $0x988 d1: 6a 01 push $0x1 d3: e8 28 05 00 00 call 600 <printf> close(fd); d8: 89 3c 24 mov %edi,(%esp) db: e8 ca 03 00 00 call 4aa <close> return; e0: 83 c4 10 add $0x10,%esp directoryWalker(buf); p[DIRSIZ] = 0; printf(1, "inum: %d\ndir name: %s\n", de.inum, buf); } } e3: 8d 65 f4 lea -0xc(%ebp),%esp e6: 5b pop %ebx e7: 5e pop %esi e8: 5f pop %edi e9: 5d pop %ebp ea: c3 ret eb: 90 nop ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi struct stat st; printf(1, "DEBUG PATH: %s\n", path); if((fd = open(path, 0)) < 0){ printf(2, "ls: cannot open %s\n", path); f0: 83 ec 04 sub $0x4,%esp f3: 53 push %ebx f4: 68 30 09 00 00 push $0x930 f9: 6a 02 push $0x2 fb: e8 00 05 00 00 call 600 <printf> return; 100: 83 c4 10 add $0x10,%esp directoryWalker(buf); p[DIRSIZ] = 0; printf(1, "inum: %d\ndir name: %s\n", de.inum, buf); } } 103: 8d 65 f4 lea -0xc(%ebp),%esp 106: 5b pop %ebx 107: 5e pop %esi 108: 5f pop %edi 109: 5d pop %ebp 10a: c3 ret 10b: 90 nop 10c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi return; } if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){ 110: 83 ec 0c sub $0xc,%esp 113: 53 push %ebx 114: e8 a7 01 00 00 call 2c0 <strlen> 119: 83 c0 20 add $0x20,%eax 11c: 83 c4 10 add $0x10,%esp 11f: 3d 00 02 00 00 cmp $0x200,%eax 124: 0f 87 f6 00 00 00 ja 220 <directoryWalker+0x1c0> printf(1, "ls: path too long\n"); } strcpy(buf, path); 12a: 83 ec 08 sub $0x8,%esp 12d: 53 push %ebx 12e: 56 push %esi 12f: 8d 9d c8 fd ff ff lea -0x238(%ebp),%ebx 135: e8 06 01 00 00 call 240 <strcpy> p = buf+strlen(buf); 13a: 89 34 24 mov %esi,(%esp) 13d: e8 7e 01 00 00 call 2c0 <strlen> 142: 8d 14 06 lea (%esi,%eax,1),%edx *p++ = '/'; 145: 8d 44 06 01 lea 0x1(%esi,%eax,1),%eax while(read(fd, &de, sizeof(de)) == sizeof(de)){ 149: 83 c4 10 add $0x10,%esp if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){ printf(1, "ls: path too long\n"); } strcpy(buf, path); p = buf+strlen(buf); 14c: 89 95 a4 fd ff ff mov %edx,-0x25c(%ebp) *p++ = '/'; 152: 89 85 a0 fd ff ff mov %eax,-0x260(%ebp) 158: c6 02 2f movb $0x2f,(%edx) 15b: 90 nop 15c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi while(read(fd, &de, sizeof(de)) == sizeof(de)){ 160: 83 ec 04 sub $0x4,%esp 163: 6a 20 push $0x20 165: 53 push %ebx 166: 57 push %edi 167: e8 2e 03 00 00 call 49a <read> 16c: 83 c4 10 add $0x10,%esp 16f: 83 f8 20 cmp $0x20,%eax 172: 0f 85 6b ff ff ff jne e3 <directoryWalker+0x83> if(de.inum == 0) 178: 66 83 bd c8 fd ff ff cmpw $0x0,-0x238(%ebp) 17f: 00 180: 74 de je 160 <directoryWalker+0x100> continue; if(strcmp(de.name, ".") == 0 || strcmp(de.name, "..") == 0) continue; 182: 8d 85 ca fd ff ff lea -0x236(%ebp),%eax 188: 83 ec 08 sub $0x8,%esp 18b: 68 6c 09 00 00 push $0x96c 190: 50 push %eax 191: e8 da 00 00 00 call 270 <strcmp> 196: 83 c4 10 add $0x10,%esp 199: 85 c0 test %eax,%eax 19b: 74 c3 je 160 <directoryWalker+0x100> 19d: 8d 85 ca fd ff ff lea -0x236(%ebp),%eax 1a3: 83 ec 08 sub $0x8,%esp 1a6: 68 6b 09 00 00 push $0x96b 1ab: 50 push %eax 1ac: e8 bf 00 00 00 call 270 <strcmp> 1b1: 83 c4 10 add $0x10,%esp 1b4: 85 c0 test %eax,%eax 1b6: 74 a8 je 160 <directoryWalker+0x100> memmove(p, de.name, DIRSIZ); 1b8: 8d 85 ca fd ff ff lea -0x236(%ebp),%eax 1be: 83 ec 04 sub $0x4,%esp 1c1: 6a 1e push $0x1e 1c3: 50 push %eax 1c4: ff b5 a0 fd ff ff pushl -0x260(%ebp) 1ca: e8 81 02 00 00 call 450 <memmove> directoryWalker(buf); 1cf: 89 34 24 mov %esi,(%esp) 1d2: e8 89 fe ff ff call 60 <directoryWalker> p[DIRSIZ] = 0; 1d7: 8b 85 a4 fd ff ff mov -0x25c(%ebp),%eax 1dd: c6 40 1f 00 movb $0x0,0x1f(%eax) printf(1, "inum: %d\ndir name: %s\n", de.inum, buf); 1e1: 0f b7 85 c8 fd ff ff movzwl -0x238(%ebp),%eax 1e8: 56 push %esi 1e9: 50 push %eax 1ea: 68 6e 09 00 00 push $0x96e 1ef: 6a 01 push $0x1 1f1: e8 0a 04 00 00 call 600 <printf> 1f6: 83 c4 20 add $0x20,%esp 1f9: e9 62 ff ff ff jmp 160 <directoryWalker+0x100> 1fe: 66 90 xchg %ax,%ax printf(2, "ls: cannot open %s\n", path); return; } if(fstat(fd, &st) < 0){ printf(2, "ls: cannot stat %s\n", path); 200: 83 ec 04 sub $0x4,%esp 203: 53 push %ebx 204: 68 44 09 00 00 push $0x944 209: 6a 02 push $0x2 20b: e8 f0 03 00 00 call 600 <printf> close(fd); 210: 89 3c 24 mov %edi,(%esp) 213: e8 92 02 00 00 call 4aa <close> return; 218: 83 c4 10 add $0x10,%esp 21b: e9 c3 fe ff ff jmp e3 <directoryWalker+0x83> } if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){ printf(1, "ls: path too long\n"); 220: 83 ec 08 sub $0x8,%esp 223: 68 58 09 00 00 push $0x958 228: 6a 01 push $0x1 22a: e8 d1 03 00 00 call 600 <printf> 22f: 83 c4 10 add $0x10,%esp 232: e9 f3 fe ff ff jmp 12a <directoryWalker+0xca> 237: 66 90 xchg %ax,%ax 239: 66 90 xchg %ax,%ax 23b: 66 90 xchg %ax,%ax 23d: 66 90 xchg %ax,%ax 23f: 90 nop 00000240 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { 240: 55 push %ebp 241: 89 e5 mov %esp,%ebp 243: 53 push %ebx 244: 8b 45 08 mov 0x8(%ebp),%eax 247: 8b 4d 0c mov 0xc(%ebp),%ecx char *os; os = s; while((*s++ = *t++) != 0) 24a: 89 c2 mov %eax,%edx 24c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 250: 83 c1 01 add $0x1,%ecx 253: 0f b6 59 ff movzbl -0x1(%ecx),%ebx 257: 83 c2 01 add $0x1,%edx 25a: 84 db test %bl,%bl 25c: 88 5a ff mov %bl,-0x1(%edx) 25f: 75 ef jne 250 <strcpy+0x10> ; return os; } 261: 5b pop %ebx 262: 5d pop %ebp 263: c3 ret 264: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 26a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000270 <strcmp>: int strcmp(const char *p, const char *q) { 270: 55 push %ebp 271: 89 e5 mov %esp,%ebp 273: 56 push %esi 274: 53 push %ebx 275: 8b 55 08 mov 0x8(%ebp),%edx 278: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 27b: 0f b6 02 movzbl (%edx),%eax 27e: 0f b6 19 movzbl (%ecx),%ebx 281: 84 c0 test %al,%al 283: 75 1e jne 2a3 <strcmp+0x33> 285: eb 29 jmp 2b0 <strcmp+0x40> 287: 89 f6 mov %esi,%esi 289: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p++, q++; 290: 83 c2 01 add $0x1,%edx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 293: 0f b6 02 movzbl (%edx),%eax p++, q++; 296: 8d 71 01 lea 0x1(%ecx),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 299: 0f b6 59 01 movzbl 0x1(%ecx),%ebx 29d: 84 c0 test %al,%al 29f: 74 0f je 2b0 <strcmp+0x40> 2a1: 89 f1 mov %esi,%ecx 2a3: 38 d8 cmp %bl,%al 2a5: 74 e9 je 290 <strcmp+0x20> p++, q++; return (uchar)*p - (uchar)*q; 2a7: 29 d8 sub %ebx,%eax } 2a9: 5b pop %ebx 2aa: 5e pop %esi 2ab: 5d pop %ebp 2ac: c3 ret 2ad: 8d 76 00 lea 0x0(%esi),%esi } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 2b0: 31 c0 xor %eax,%eax p++, q++; return (uchar)*p - (uchar)*q; 2b2: 29 d8 sub %ebx,%eax } 2b4: 5b pop %ebx 2b5: 5e pop %esi 2b6: 5d pop %ebp 2b7: c3 ret 2b8: 90 nop 2b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 000002c0 <strlen>: uint strlen(const char *s) { 2c0: 55 push %ebp 2c1: 89 e5 mov %esp,%ebp 2c3: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 2c6: 80 39 00 cmpb $0x0,(%ecx) 2c9: 74 12 je 2dd <strlen+0x1d> 2cb: 31 d2 xor %edx,%edx 2cd: 8d 76 00 lea 0x0(%esi),%esi 2d0: 83 c2 01 add $0x1,%edx 2d3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 2d7: 89 d0 mov %edx,%eax 2d9: 75 f5 jne 2d0 <strlen+0x10> ; return n; } 2db: 5d pop %ebp 2dc: c3 ret uint strlen(const char *s) { int n; for(n = 0; s[n]; n++) 2dd: 31 c0 xor %eax,%eax ; return n; } 2df: 5d pop %ebp 2e0: c3 ret 2e1: eb 0d jmp 2f0 <memset> 2e3: 90 nop 2e4: 90 nop 2e5: 90 nop 2e6: 90 nop 2e7: 90 nop 2e8: 90 nop 2e9: 90 nop 2ea: 90 nop 2eb: 90 nop 2ec: 90 nop 2ed: 90 nop 2ee: 90 nop 2ef: 90 nop 000002f0 <memset>: void* memset(void *dst, int c, uint n) { 2f0: 55 push %ebp 2f1: 89 e5 mov %esp,%ebp 2f3: 57 push %edi 2f4: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 2f7: 8b 4d 10 mov 0x10(%ebp),%ecx 2fa: 8b 45 0c mov 0xc(%ebp),%eax 2fd: 89 d7 mov %edx,%edi 2ff: fc cld 300: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 302: 89 d0 mov %edx,%eax 304: 5f pop %edi 305: 5d pop %ebp 306: c3 ret 307: 89 f6 mov %esi,%esi 309: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000310 <strchr>: char* strchr(const char *s, char c) { 310: 55 push %ebp 311: 89 e5 mov %esp,%ebp 313: 53 push %ebx 314: 8b 45 08 mov 0x8(%ebp),%eax 317: 8b 5d 0c mov 0xc(%ebp),%ebx for(; *s; s++) 31a: 0f b6 10 movzbl (%eax),%edx 31d: 84 d2 test %dl,%dl 31f: 74 1d je 33e <strchr+0x2e> if(*s == c) 321: 38 d3 cmp %dl,%bl 323: 89 d9 mov %ebx,%ecx 325: 75 0d jne 334 <strchr+0x24> 327: eb 17 jmp 340 <strchr+0x30> 329: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 330: 38 ca cmp %cl,%dl 332: 74 0c je 340 <strchr+0x30> } char* strchr(const char *s, char c) { for(; *s; s++) 334: 83 c0 01 add $0x1,%eax 337: 0f b6 10 movzbl (%eax),%edx 33a: 84 d2 test %dl,%dl 33c: 75 f2 jne 330 <strchr+0x20> if(*s == c) return (char*)s; return 0; 33e: 31 c0 xor %eax,%eax } 340: 5b pop %ebx 341: 5d pop %ebp 342: c3 ret 343: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 349: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000350 <gets>: char* gets(char *buf, int max) { 350: 55 push %ebp 351: 89 e5 mov %esp,%ebp 353: 57 push %edi 354: 56 push %esi 355: 53 push %ebx int i, cc; char c; for(i=0; i+1 < max; ){ 356: 31 f6 xor %esi,%esi cc = read(0, &c, 1); 358: 8d 7d e7 lea -0x19(%ebp),%edi return 0; } char* gets(char *buf, int max) { 35b: 83 ec 1c sub $0x1c,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 35e: eb 29 jmp 389 <gets+0x39> cc = read(0, &c, 1); 360: 83 ec 04 sub $0x4,%esp 363: 6a 01 push $0x1 365: 57 push %edi 366: 6a 00 push $0x0 368: e8 2d 01 00 00 call 49a <read> if(cc < 1) 36d: 83 c4 10 add $0x10,%esp 370: 85 c0 test %eax,%eax 372: 7e 1d jle 391 <gets+0x41> break; buf[i++] = c; 374: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 378: 8b 55 08 mov 0x8(%ebp),%edx 37b: 89 de mov %ebx,%esi if(c == '\n' || c == '\r') 37d: 3c 0a cmp $0xa,%al for(i=0; i+1 < max; ){ cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; 37f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 383: 74 1b je 3a0 <gets+0x50> 385: 3c 0d cmp $0xd,%al 387: 74 17 je 3a0 <gets+0x50> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 389: 8d 5e 01 lea 0x1(%esi),%ebx 38c: 3b 5d 0c cmp 0xc(%ebp),%ebx 38f: 7c cf jl 360 <gets+0x10> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 391: 8b 45 08 mov 0x8(%ebp),%eax 394: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 398: 8d 65 f4 lea -0xc(%ebp),%esp 39b: 5b pop %ebx 39c: 5e pop %esi 39d: 5f pop %edi 39e: 5d pop %ebp 39f: c3 ret break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 3a0: 8b 45 08 mov 0x8(%ebp),%eax gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 3a3: 89 de mov %ebx,%esi break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 3a5: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 3a9: 8d 65 f4 lea -0xc(%ebp),%esp 3ac: 5b pop %ebx 3ad: 5e pop %esi 3ae: 5f pop %edi 3af: 5d pop %ebp 3b0: c3 ret 3b1: eb 0d jmp 3c0 <stat> 3b3: 90 nop 3b4: 90 nop 3b5: 90 nop 3b6: 90 nop 3b7: 90 nop 3b8: 90 nop 3b9: 90 nop 3ba: 90 nop 3bb: 90 nop 3bc: 90 nop 3bd: 90 nop 3be: 90 nop 3bf: 90 nop 000003c0 <stat>: int stat(const char *n, struct stat *st) { 3c0: 55 push %ebp 3c1: 89 e5 mov %esp,%ebp 3c3: 56 push %esi 3c4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 3c5: 83 ec 08 sub $0x8,%esp 3c8: 6a 00 push $0x0 3ca: ff 75 08 pushl 0x8(%ebp) 3cd: e8 f0 00 00 00 call 4c2 <open> if(fd < 0) 3d2: 83 c4 10 add $0x10,%esp 3d5: 85 c0 test %eax,%eax 3d7: 78 27 js 400 <stat+0x40> return -1; r = fstat(fd, st); 3d9: 83 ec 08 sub $0x8,%esp 3dc: ff 75 0c pushl 0xc(%ebp) 3df: 89 c3 mov %eax,%ebx 3e1: 50 push %eax 3e2: e8 f3 00 00 00 call 4da <fstat> 3e7: 89 c6 mov %eax,%esi close(fd); 3e9: 89 1c 24 mov %ebx,(%esp) 3ec: e8 b9 00 00 00 call 4aa <close> return r; 3f1: 83 c4 10 add $0x10,%esp 3f4: 89 f0 mov %esi,%eax } 3f6: 8d 65 f8 lea -0x8(%ebp),%esp 3f9: 5b pop %ebx 3fa: 5e pop %esi 3fb: 5d pop %ebp 3fc: c3 ret 3fd: 8d 76 00 lea 0x0(%esi),%esi int fd; int r; fd = open(n, O_RDONLY); if(fd < 0) return -1; 400: b8 ff ff ff ff mov $0xffffffff,%eax 405: eb ef jmp 3f6 <stat+0x36> 407: 89 f6 mov %esi,%esi 409: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 00000410 <atoi>: return r; } int atoi(const char *s) { 410: 55 push %ebp 411: 89 e5 mov %esp,%ebp 413: 53 push %ebx 414: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 417: 0f be 11 movsbl (%ecx),%edx 41a: 8d 42 d0 lea -0x30(%edx),%eax 41d: 3c 09 cmp $0x9,%al 41f: b8 00 00 00 00 mov $0x0,%eax 424: 77 1f ja 445 <atoi+0x35> 426: 8d 76 00 lea 0x0(%esi),%esi 429: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi n = n*10 + *s++ - '0'; 430: 8d 04 80 lea (%eax,%eax,4),%eax 433: 83 c1 01 add $0x1,%ecx 436: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 43a: 0f be 11 movsbl (%ecx),%edx 43d: 8d 5a d0 lea -0x30(%edx),%ebx 440: 80 fb 09 cmp $0x9,%bl 443: 76 eb jbe 430 <atoi+0x20> n = n*10 + *s++ - '0'; return n; } 445: 5b pop %ebx 446: 5d pop %ebp 447: c3 ret 448: 90 nop 449: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000450 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 450: 55 push %ebp 451: 89 e5 mov %esp,%ebp 453: 56 push %esi 454: 53 push %ebx 455: 8b 5d 10 mov 0x10(%ebp),%ebx 458: 8b 45 08 mov 0x8(%ebp),%eax 45b: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 45e: 85 db test %ebx,%ebx 460: 7e 14 jle 476 <memmove+0x26> 462: 31 d2 xor %edx,%edx 464: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 468: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 46c: 88 0c 10 mov %cl,(%eax,%edx,1) 46f: 83 c2 01 add $0x1,%edx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 472: 39 da cmp %ebx,%edx 474: 75 f2 jne 468 <memmove+0x18> *dst++ = *src++; return vdst; } 476: 5b pop %ebx 477: 5e pop %esi 478: 5d pop %ebp 479: c3 ret 0000047a <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 47a: b8 01 00 00 00 mov $0x1,%eax 47f: cd 40 int $0x40 481: c3 ret 00000482 <exit>: SYSCALL(exit) 482: b8 02 00 00 00 mov $0x2,%eax 487: cd 40 int $0x40 489: c3 ret 0000048a <wait>: SYSCALL(wait) 48a: b8 03 00 00 00 mov $0x3,%eax 48f: cd 40 int $0x40 491: c3 ret 00000492 <pipe>: SYSCALL(pipe) 492: b8 04 00 00 00 mov $0x4,%eax 497: cd 40 int $0x40 499: c3 ret 0000049a <read>: SYSCALL(read) 49a: b8 05 00 00 00 mov $0x5,%eax 49f: cd 40 int $0x40 4a1: c3 ret 000004a2 <write>: SYSCALL(write) 4a2: b8 10 00 00 00 mov $0x10,%eax 4a7: cd 40 int $0x40 4a9: c3 ret 000004aa <close>: SYSCALL(close) 4aa: b8 15 00 00 00 mov $0x15,%eax 4af: cd 40 int $0x40 4b1: c3 ret 000004b2 <kill>: SYSCALL(kill) 4b2: b8 06 00 00 00 mov $0x6,%eax 4b7: cd 40 int $0x40 4b9: c3 ret 000004ba <exec>: SYSCALL(exec) 4ba: b8 07 00 00 00 mov $0x7,%eax 4bf: cd 40 int $0x40 4c1: c3 ret 000004c2 <open>: SYSCALL(open) 4c2: b8 0f 00 00 00 mov $0xf,%eax 4c7: cd 40 int $0x40 4c9: c3 ret 000004ca <mknod>: SYSCALL(mknod) 4ca: b8 11 00 00 00 mov $0x11,%eax 4cf: cd 40 int $0x40 4d1: c3 ret 000004d2 <unlink>: SYSCALL(unlink) 4d2: b8 12 00 00 00 mov $0x12,%eax 4d7: cd 40 int $0x40 4d9: c3 ret 000004da <fstat>: SYSCALL(fstat) 4da: b8 08 00 00 00 mov $0x8,%eax 4df: cd 40 int $0x40 4e1: c3 ret 000004e2 <link>: SYSCALL(link) 4e2: b8 13 00 00 00 mov $0x13,%eax 4e7: cd 40 int $0x40 4e9: c3 ret 000004ea <mkdir>: SYSCALL(mkdir) 4ea: b8 14 00 00 00 mov $0x14,%eax 4ef: cd 40 int $0x40 4f1: c3 ret 000004f2 <chdir>: SYSCALL(chdir) 4f2: b8 09 00 00 00 mov $0x9,%eax 4f7: cd 40 int $0x40 4f9: c3 ret 000004fa <dup>: SYSCALL(dup) 4fa: b8 0a 00 00 00 mov $0xa,%eax 4ff: cd 40 int $0x40 501: c3 ret 00000502 <getpid>: SYSCALL(getpid) 502: b8 0b 00 00 00 mov $0xb,%eax 507: cd 40 int $0x40 509: c3 ret 0000050a <sbrk>: SYSCALL(sbrk) 50a: b8 0c 00 00 00 mov $0xc,%eax 50f: cd 40 int $0x40 511: c3 ret 00000512 <sleep>: SYSCALL(sleep) 512: b8 0d 00 00 00 mov $0xd,%eax 517: cd 40 int $0x40 519: c3 ret 0000051a <uptime>: SYSCALL(uptime) 51a: b8 0e 00 00 00 mov $0xe,%eax 51f: cd 40 int $0x40 521: c3 ret 00000522 <countTrap>: SYSCALL(countTrap) 522: b8 16 00 00 00 mov $0x16,%eax 527: cd 40 int $0x40 529: c3 ret 0000052a <getSharedPage>: SYSCALL(getSharedPage) 52a: b8 17 00 00 00 mov $0x17,%eax 52f: cd 40 int $0x40 531: c3 ret 00000532 <freeSharedPage>: SYSCALL(freeSharedPage) 532: b8 18 00 00 00 mov $0x18,%eax 537: cd 40 int $0x40 539: c3 ret 0000053a <callBRead>: SYSCALL(callBRead) 53a: b8 19 00 00 00 mov $0x19,%eax 53f: cd 40 int $0x40 541: c3 ret 00000542 <callSBRead>: SYSCALL(callSBRead) 542: b8 1a 00 00 00 mov $0x1a,%eax 547: cd 40 int $0x40 549: c3 ret 0000054a <seek>: SYSCALL(seek) 54a: b8 1b 00 00 00 mov $0x1b,%eax 54f: cd 40 int $0x40 551: c3 ret 00000552 <callBWrite>: 552: b8 1c 00 00 00 mov $0x1c,%eax 557: cd 40 int $0x40 559: c3 ret 55a: 66 90 xchg %ax,%ax 55c: 66 90 xchg %ax,%ax 55e: 66 90 xchg %ax,%ax 00000560 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 560: 55 push %ebp 561: 89 e5 mov %esp,%ebp 563: 57 push %edi 564: 56 push %esi 565: 53 push %ebx 566: 89 c6 mov %eax,%esi 568: 83 ec 3c sub $0x3c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 56b: 8b 5d 08 mov 0x8(%ebp),%ebx 56e: 85 db test %ebx,%ebx 570: 74 7e je 5f0 <printint+0x90> 572: 89 d0 mov %edx,%eax 574: c1 e8 1f shr $0x1f,%eax 577: 84 c0 test %al,%al 579: 74 75 je 5f0 <printint+0x90> neg = 1; x = -xx; 57b: 89 d0 mov %edx,%eax int i, neg; uint x; neg = 0; if(sgn && xx < 0){ neg = 1; 57d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) x = -xx; 584: f7 d8 neg %eax 586: 89 75 c0 mov %esi,-0x40(%ebp) } else { x = xx; } i = 0; 589: 31 ff xor %edi,%edi 58b: 8d 5d d7 lea -0x29(%ebp),%ebx 58e: 89 ce mov %ecx,%esi 590: eb 08 jmp 59a <printint+0x3a> 592: 8d b6 00 00 00 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 598: 89 cf mov %ecx,%edi 59a: 31 d2 xor %edx,%edx 59c: 8d 4f 01 lea 0x1(%edi),%ecx 59f: f7 f6 div %esi 5a1: 0f b6 92 b4 09 00 00 movzbl 0x9b4(%edx),%edx }while((x /= base) != 0); 5a8: 85 c0 test %eax,%eax x = xx; } i = 0; do{ buf[i++] = digits[x % base]; 5aa: 88 14 0b mov %dl,(%ebx,%ecx,1) }while((x /= base) != 0); 5ad: 75 e9 jne 598 <printint+0x38> if(neg) 5af: 8b 45 c4 mov -0x3c(%ebp),%eax 5b2: 8b 75 c0 mov -0x40(%ebp),%esi 5b5: 85 c0 test %eax,%eax 5b7: 74 08 je 5c1 <printint+0x61> buf[i++] = '-'; 5b9: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1) 5be: 8d 4f 02 lea 0x2(%edi),%ecx 5c1: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi 5c5: 8d 76 00 lea 0x0(%esi),%esi 5c8: 0f b6 07 movzbl (%edi),%eax #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 5cb: 83 ec 04 sub $0x4,%esp 5ce: 83 ef 01 sub $0x1,%edi 5d1: 6a 01 push $0x1 5d3: 53 push %ebx 5d4: 56 push %esi 5d5: 88 45 d7 mov %al,-0x29(%ebp) 5d8: e8 c5 fe ff ff call 4a2 <write> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 5dd: 83 c4 10 add $0x10,%esp 5e0: 39 df cmp %ebx,%edi 5e2: 75 e4 jne 5c8 <printint+0x68> putc(fd, buf[i]); } 5e4: 8d 65 f4 lea -0xc(%ebp),%esp 5e7: 5b pop %ebx 5e8: 5e pop %esi 5e9: 5f pop %edi 5ea: 5d pop %ebp 5eb: c3 ret 5ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; } else { x = xx; 5f0: 89 d0 mov %edx,%eax static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 5f2: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 5f9: eb 8b jmp 586 <printint+0x26> 5fb: 90 nop 5fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000600 <printf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 600: 55 push %ebp 601: 89 e5 mov %esp,%ebp 603: 57 push %edi 604: 56 push %esi 605: 53 push %ebx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 606: 8d 45 10 lea 0x10(%ebp),%eax } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 609: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 60c: 8b 75 0c mov 0xc(%ebp),%esi } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 60f: 8b 7d 08 mov 0x8(%ebp),%edi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 612: 89 45 d0 mov %eax,-0x30(%ebp) 615: 0f b6 1e movzbl (%esi),%ebx 618: 83 c6 01 add $0x1,%esi 61b: 84 db test %bl,%bl 61d: 0f 84 b0 00 00 00 je 6d3 <printf+0xd3> 623: 31 d2 xor %edx,%edx 625: eb 39 jmp 660 <printf+0x60> 627: 89 f6 mov %esi,%esi 629: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 630: 83 f8 25 cmp $0x25,%eax 633: 89 55 d4 mov %edx,-0x2c(%ebp) state = '%'; 636: ba 25 00 00 00 mov $0x25,%edx state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 63b: 74 18 je 655 <printf+0x55> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 63d: 8d 45 e2 lea -0x1e(%ebp),%eax 640: 83 ec 04 sub $0x4,%esp 643: 88 5d e2 mov %bl,-0x1e(%ebp) 646: 6a 01 push $0x1 648: 50 push %eax 649: 57 push %edi 64a: e8 53 fe ff ff call 4a2 <write> 64f: 8b 55 d4 mov -0x2c(%ebp),%edx 652: 83 c4 10 add $0x10,%esp 655: 83 c6 01 add $0x1,%esi int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 658: 0f b6 5e ff movzbl -0x1(%esi),%ebx 65c: 84 db test %bl,%bl 65e: 74 73 je 6d3 <printf+0xd3> c = fmt[i] & 0xff; if(state == 0){ 660: 85 d2 test %edx,%edx uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; 662: 0f be cb movsbl %bl,%ecx 665: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 668: 74 c6 je 630 <printf+0x30> if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 66a: 83 fa 25 cmp $0x25,%edx 66d: 75 e6 jne 655 <printf+0x55> if(c == 'd'){ 66f: 83 f8 64 cmp $0x64,%eax 672: 0f 84 f8 00 00 00 je 770 <printf+0x170> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 678: 81 e1 f7 00 00 00 and $0xf7,%ecx 67e: 83 f9 70 cmp $0x70,%ecx 681: 74 5d je 6e0 <printf+0xe0> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 683: 83 f8 73 cmp $0x73,%eax 686: 0f 84 84 00 00 00 je 710 <printf+0x110> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 68c: 83 f8 63 cmp $0x63,%eax 68f: 0f 84 ea 00 00 00 je 77f <printf+0x17f> putc(fd, *ap); ap++; } else if(c == '%'){ 695: 83 f8 25 cmp $0x25,%eax 698: 0f 84 c2 00 00 00 je 760 <printf+0x160> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 69e: 8d 45 e7 lea -0x19(%ebp),%eax 6a1: 83 ec 04 sub $0x4,%esp 6a4: c6 45 e7 25 movb $0x25,-0x19(%ebp) 6a8: 6a 01 push $0x1 6aa: 50 push %eax 6ab: 57 push %edi 6ac: e8 f1 fd ff ff call 4a2 <write> 6b1: 83 c4 0c add $0xc,%esp 6b4: 8d 45 e6 lea -0x1a(%ebp),%eax 6b7: 88 5d e6 mov %bl,-0x1a(%ebp) 6ba: 6a 01 push $0x1 6bc: 50 push %eax 6bd: 57 push %edi 6be: 83 c6 01 add $0x1,%esi 6c1: e8 dc fd ff ff call 4a2 <write> int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 6c6: 0f b6 5e ff movzbl -0x1(%esi),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 6ca: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 6cd: 31 d2 xor %edx,%edx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 6cf: 84 db test %bl,%bl 6d1: 75 8d jne 660 <printf+0x60> putc(fd, c); } state = 0; } } } 6d3: 8d 65 f4 lea -0xc(%ebp),%esp 6d6: 5b pop %ebx 6d7: 5e pop %esi 6d8: 5f pop %edi 6d9: 5d pop %ebp 6da: c3 ret 6db: 90 nop 6dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); 6e0: 83 ec 0c sub $0xc,%esp 6e3: b9 10 00 00 00 mov $0x10,%ecx 6e8: 6a 00 push $0x0 6ea: 8b 5d d0 mov -0x30(%ebp),%ebx 6ed: 89 f8 mov %edi,%eax 6ef: 8b 13 mov (%ebx),%edx 6f1: e8 6a fe ff ff call 560 <printint> ap++; 6f6: 89 d8 mov %ebx,%eax 6f8: 83 c4 10 add $0x10,%esp } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 6fb: 31 d2 xor %edx,%edx if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); ap++; 6fd: 83 c0 04 add $0x4,%eax 700: 89 45 d0 mov %eax,-0x30(%ebp) 703: e9 4d ff ff ff jmp 655 <printf+0x55> 708: 90 nop 709: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } else if(c == 's'){ s = (char*)*ap; 710: 8b 45 d0 mov -0x30(%ebp),%eax 713: 8b 18 mov (%eax),%ebx ap++; 715: 83 c0 04 add $0x4,%eax 718: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) s = "(null)"; 71b: b8 ac 09 00 00 mov $0x9ac,%eax 720: 85 db test %ebx,%ebx 722: 0f 44 d8 cmove %eax,%ebx while(*s != 0){ 725: 0f b6 03 movzbl (%ebx),%eax 728: 84 c0 test %al,%al 72a: 74 23 je 74f <printf+0x14f> 72c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 730: 88 45 e3 mov %al,-0x1d(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 733: 8d 45 e3 lea -0x1d(%ebp),%eax 736: 83 ec 04 sub $0x4,%esp 739: 6a 01 push $0x1 ap++; if(s == 0) s = "(null)"; while(*s != 0){ putc(fd, *s); s++; 73b: 83 c3 01 add $0x1,%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 73e: 50 push %eax 73f: 57 push %edi 740: e8 5d fd ff ff call 4a2 <write> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 745: 0f b6 03 movzbl (%ebx),%eax 748: 83 c4 10 add $0x10,%esp 74b: 84 c0 test %al,%al 74d: 75 e1 jne 730 <printf+0x130> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 74f: 31 d2 xor %edx,%edx 751: e9 ff fe ff ff jmp 655 <printf+0x55> 756: 8d 76 00 lea 0x0(%esi),%esi 759: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 760: 83 ec 04 sub $0x4,%esp 763: 88 5d e5 mov %bl,-0x1b(%ebp) 766: 8d 45 e5 lea -0x1b(%ebp),%eax 769: 6a 01 push $0x1 76b: e9 4c ff ff ff jmp 6bc <printf+0xbc> } else { putc(fd, c); } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); 770: 83 ec 0c sub $0xc,%esp 773: b9 0a 00 00 00 mov $0xa,%ecx 778: 6a 01 push $0x1 77a: e9 6b ff ff ff jmp 6ea <printf+0xea> 77f: 8b 5d d0 mov -0x30(%ebp),%ebx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 782: 83 ec 04 sub $0x4,%esp 785: 8b 03 mov (%ebx),%eax 787: 6a 01 push $0x1 789: 88 45 e4 mov %al,-0x1c(%ebp) 78c: 8d 45 e4 lea -0x1c(%ebp),%eax 78f: 50 push %eax 790: 57 push %edi 791: e8 0c fd ff ff call 4a2 <write> 796: e9 5b ff ff ff jmp 6f6 <printf+0xf6> 79b: 66 90 xchg %ax,%ax 79d: 66 90 xchg %ax,%ax 79f: 90 nop 000007a0 <free>: static Header base; static Header *freep; void free(void *ap) { 7a0: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 7a1: a1 98 0c 00 00 mov 0xc98,%eax static Header base; static Header *freep; void free(void *ap) { 7a6: 89 e5 mov %esp,%ebp 7a8: 57 push %edi 7a9: 56 push %esi 7aa: 53 push %ebx 7ab: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 7ae: 8b 10 mov (%eax),%edx void free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; 7b0: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 7b3: 39 c8 cmp %ecx,%eax 7b5: 73 19 jae 7d0 <free+0x30> 7b7: 89 f6 mov %esi,%esi 7b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 7c0: 39 d1 cmp %edx,%ecx 7c2: 72 1c jb 7e0 <free+0x40> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 7c4: 39 d0 cmp %edx,%eax 7c6: 73 18 jae 7e0 <free+0x40> static Header base; static Header *freep; void free(void *ap) { 7c8: 89 d0 mov %edx,%eax Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 7ca: 39 c8 cmp %ecx,%eax if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 7cc: 8b 10 mov (%eax),%edx free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 7ce: 72 f0 jb 7c0 <free+0x20> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 7d0: 39 d0 cmp %edx,%eax 7d2: 72 f4 jb 7c8 <free+0x28> 7d4: 39 d1 cmp %edx,%ecx 7d6: 73 f0 jae 7c8 <free+0x28> 7d8: 90 nop 7d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi break; if(bp + bp->s.size == p->s.ptr){ 7e0: 8b 73 fc mov -0x4(%ebx),%esi 7e3: 8d 3c f1 lea (%ecx,%esi,8),%edi 7e6: 39 d7 cmp %edx,%edi 7e8: 74 19 je 803 <free+0x63> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 7ea: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 7ed: 8b 50 04 mov 0x4(%eax),%edx 7f0: 8d 34 d0 lea (%eax,%edx,8),%esi 7f3: 39 f1 cmp %esi,%ecx 7f5: 74 23 je 81a <free+0x7a> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 7f7: 89 08 mov %ecx,(%eax) freep = p; 7f9: a3 98 0c 00 00 mov %eax,0xc98 } 7fe: 5b pop %ebx 7ff: 5e pop %esi 800: 5f pop %edi 801: 5d pop %ebp 802: c3 ret bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ bp->s.size += p->s.ptr->s.size; 803: 03 72 04 add 0x4(%edx),%esi 806: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 809: 8b 10 mov (%eax),%edx 80b: 8b 12 mov (%edx),%edx 80d: 89 53 f8 mov %edx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ 810: 8b 50 04 mov 0x4(%eax),%edx 813: 8d 34 d0 lea (%eax,%edx,8),%esi 816: 39 f1 cmp %esi,%ecx 818: 75 dd jne 7f7 <free+0x57> p->s.size += bp->s.size; 81a: 03 53 fc add -0x4(%ebx),%edx p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; freep = p; 81d: a3 98 0c 00 00 mov %eax,0xc98 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 822: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 825: 8b 53 f8 mov -0x8(%ebx),%edx 828: 89 10 mov %edx,(%eax) } else p->s.ptr = bp; freep = p; } 82a: 5b pop %ebx 82b: 5e pop %esi 82c: 5f pop %edi 82d: 5d pop %ebp 82e: c3 ret 82f: 90 nop 00000830 <malloc>: return freep; } void* malloc(uint nbytes) { 830: 55 push %ebp 831: 89 e5 mov %esp,%ebp 833: 57 push %edi 834: 56 push %esi 835: 53 push %ebx 836: 83 ec 0c sub $0xc,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 839: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 83c: 8b 15 98 0c 00 00 mov 0xc98,%edx malloc(uint nbytes) { Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 842: 8d 78 07 lea 0x7(%eax),%edi 845: c1 ef 03 shr $0x3,%edi 848: 83 c7 01 add $0x1,%edi if((prevp = freep) == 0){ 84b: 85 d2 test %edx,%edx 84d: 0f 84 a3 00 00 00 je 8f6 <malloc+0xc6> 853: 8b 02 mov (%edx),%eax 855: 8b 48 04 mov 0x4(%eax),%ecx base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ 858: 39 cf cmp %ecx,%edi 85a: 76 74 jbe 8d0 <malloc+0xa0> 85c: 81 ff 00 10 00 00 cmp $0x1000,%edi 862: be 00 10 00 00 mov $0x1000,%esi 867: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx 86e: 0f 43 f7 cmovae %edi,%esi 871: ba 00 80 00 00 mov $0x8000,%edx 876: 81 ff ff 0f 00 00 cmp $0xfff,%edi 87c: 0f 46 da cmovbe %edx,%ebx 87f: eb 10 jmp 891 <malloc+0x61> 881: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 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){ 888: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 88a: 8b 48 04 mov 0x4(%eax),%ecx 88d: 39 cf cmp %ecx,%edi 88f: 76 3f jbe 8d0 <malloc+0xa0> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 891: 39 05 98 0c 00 00 cmp %eax,0xc98 897: 89 c2 mov %eax,%edx 899: 75 ed jne 888 <malloc+0x58> char *p; Header *hp; if(nu < 4096) nu = 4096; p = sbrk(nu * sizeof(Header)); 89b: 83 ec 0c sub $0xc,%esp 89e: 53 push %ebx 89f: e8 66 fc ff ff call 50a <sbrk> if(p == (char*)-1) 8a4: 83 c4 10 add $0x10,%esp 8a7: 83 f8 ff cmp $0xffffffff,%eax 8aa: 74 1c je 8c8 <malloc+0x98> return 0; hp = (Header*)p; hp->s.size = nu; 8ac: 89 70 04 mov %esi,0x4(%eax) free((void*)(hp + 1)); 8af: 83 ec 0c sub $0xc,%esp 8b2: 83 c0 08 add $0x8,%eax 8b5: 50 push %eax 8b6: e8 e5 fe ff ff call 7a0 <free> return freep; 8bb: 8b 15 98 0c 00 00 mov 0xc98,%edx } freep = prevp; return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) 8c1: 83 c4 10 add $0x10,%esp 8c4: 85 d2 test %edx,%edx 8c6: 75 c0 jne 888 <malloc+0x58> return 0; 8c8: 31 c0 xor %eax,%eax 8ca: eb 1c jmp 8e8 <malloc+0xb8> 8cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) 8d0: 39 cf cmp %ecx,%edi 8d2: 74 1c je 8f0 <malloc+0xc0> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 8d4: 29 f9 sub %edi,%ecx 8d6: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 8d9: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 8dc: 89 78 04 mov %edi,0x4(%eax) } freep = prevp; 8df: 89 15 98 0c 00 00 mov %edx,0xc98 return (void*)(p + 1); 8e5: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 8e8: 8d 65 f4 lea -0xc(%ebp),%esp 8eb: 5b pop %ebx 8ec: 5e pop %esi 8ed: 5f pop %edi 8ee: 5d pop %ebp 8ef: c3 ret base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) prevp->s.ptr = p->s.ptr; 8f0: 8b 08 mov (%eax),%ecx 8f2: 89 0a mov %ecx,(%edx) 8f4: eb e9 jmp 8df <malloc+0xaf> Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; 8f6: c7 05 98 0c 00 00 9c movl $0xc9c,0xc98 8fd: 0c 00 00 900: c7 05 9c 0c 00 00 9c movl $0xc9c,0xc9c 907: 0c 00 00 base.s.size = 0; 90a: b8 9c 0c 00 00 mov $0xc9c,%eax 90f: c7 05 a0 0c 00 00 00 movl $0x0,0xca0 916: 00 00 00 919: e9 3e ff ff ff jmp 85c <malloc+0x2c>
gcc-gcc-7_3_0-release/gcc/ada/exp_ch6.ads
best08618/asylo
7
21417
<gh_stars>1-10 ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E X P _ C H 6 -- -- -- -- S p e c -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ -- Expand routines for chapter 6 constructs with Types; use Types; package Exp_Ch6 is procedure Expand_N_Extended_Return_Statement (N : Node_Id); procedure Expand_N_Function_Call (N : Node_Id); procedure Expand_N_Procedure_Call_Statement (N : Node_Id); procedure Expand_N_Simple_Return_Statement (N : Node_Id); procedure Expand_N_Subprogram_Body (N : Node_Id); procedure Expand_N_Subprogram_Body_Stub (N : Node_Id); procedure Expand_N_Subprogram_Declaration (N : Node_Id); procedure Expand_Call (N : Node_Id); -- This procedure contains common processing for Expand_N_Function_Call, -- Expand_N_Procedure_Statement, and Expand_N_Entry_Call. procedure Freeze_Subprogram (N : Node_Id); -- generate the appropriate expansions related to Subprogram freeze -- nodes (e.g. the filling of the corresponding Dispatch Table for -- Primitive Operations) -- The following type defines the various forms of allocation used for the -- results of build-in-place function calls. type BIP_Allocation_Form is (Unspecified, Caller_Allocation, Secondary_Stack, Global_Heap, User_Storage_Pool); type BIP_Formal_Kind is -- Ada 2005 (AI-318-02): This type defines the kinds of implicit extra -- formals created for build-in-place functions. The order of these -- enumeration literals matches the order in which the formals are -- declared. See Sem_Ch6.Create_Extra_Formals. (BIP_Alloc_Form, -- Present if result subtype is unconstrained or tagged. Indicates -- whether the return object is allocated by the caller or callee, and -- if the callee, whether to use the secondary stack or the heap. See -- Create_Extra_Formals. BIP_Storage_Pool, -- Present if result subtype is unconstrained or tagged. If -- BIP_Alloc_Form = User_Storage_Pool, this is a pointer to the pool -- (of type access to Root_Storage_Pool'Class). Otherwise null. BIP_Finalization_Master, -- Present if result type needs finalization. Pointer to caller's -- finalization master. BIP_Task_Master, -- Present if result type contains tasks. Master associated with -- calling context. BIP_Activation_Chain, -- Present if result type contains tasks. Caller's activation chain BIP_Object_Access); -- Present for all build-in-place functions. Address at which to place -- the return object, or null if BIP_Alloc_Form indicates allocated by -- callee. -- -- ??? We might also need to be able to pass in a constrained flag. procedure Add_Extra_Actual_To_Call (Subprogram_Call : Node_Id; Extra_Formal : Entity_Id; Extra_Actual : Node_Id); -- Adds Extra_Actual as a named parameter association for the formal -- Extra_Formal in Subprogram_Call. function BIP_Formal_Suffix (Kind : BIP_Formal_Kind) return String; -- Ada 2005 (AI-318-02): Returns a string to be used as the suffix of names -- for build-in-place formal parameters of the given kind. function Build_In_Place_Formal (Func : Entity_Id; Kind : BIP_Formal_Kind) return Entity_Id; -- Ada 2005 (AI-318-02): Locates and returns the entity for the implicit -- build-in-place formal parameter of the given kind associated with the -- function Func, and returns its Entity_Id. It is a bug if not found; the -- caller should ensure this is called only when the extra formal exists. function Build_Procedure_Body_Form (Func_Id : Entity_Id; Func_Body : Node_Id) return Node_Id; -- Create a procedure body which emulates the behavior of function Func_Id. -- Func_Body is the root of the body of the function before its analysis. -- The returned node is the root of the procedure body which will replace -- the original function body, which is not needed for the C program. function Is_Build_In_Place_Function (E : Entity_Id) return Boolean; -- Ada 2005 (AI-318-02): Returns True if E denotes a function, generic -- function, or access-to-function type whose result must be built in -- place; otherwise returns False. For Ada 2005, this is currently -- restricted to the set of functions whose result subtype is an inherently -- limited type. In Ada 95, this must be False for inherently limited -- result types (but currently returns False for all Ada 95 functions). -- Eventually we plan to support build-in-place for nonlimited types. -- Build-in-place is usually more efficient for large things, and less -- efficient for small things. However, we never use build-in-place if the -- convention is other than Ada, because that would disturb mixed-language -- programs. Note that for the non-inherently-limited cases, we must make -- the same decision for Ada 95 and 2005, so that mixed-dialect programs -- will work. function Is_Build_In_Place_Function_Call (N : Node_Id) return Boolean; -- Ada 2005 (AI-318-02): Returns True if N denotes a call to a function -- that requires handling as a build-in-place call or is a qualified -- expression applied to such a call; otherwise returns False. function Is_Null_Procedure (Subp : Entity_Id) return Boolean; -- Predicate to recognize stubbed procedures and null procedures, which -- can be inlined unconditionally in all cases. procedure Make_Build_In_Place_Call_In_Allocator (Allocator : Node_Id; Function_Call : Node_Id); -- Ada 2005 (AI-318-02): Handle a call to a build-in-place function that -- occurs as the expression initializing an allocator, by passing access -- to the allocated object as an additional parameter of the function call. -- A new access object is declared that is initialized to the result of the -- allocator, passed to the function, and the allocator is rewritten to -- refer to that access object. Function_Call must denote either an -- N_Function_Call node for which Is_Build_In_Place_Call is True, or else -- an N_Qualified_Expression node applied to such a function call. procedure Make_Build_In_Place_Call_In_Anonymous_Context (Function_Call : Node_Id); -- Ada 2005 (AI-318-02): Handle a call to a build-in-place function that -- occurs in a context that does not provide a separate object. A temporary -- object is created to act as the return object and an access to the -- temporary is passed as an additional parameter of the call. This occurs -- in contexts such as subprogram call actuals and object renamings. -- Function_Call must denote either an N_Function_Call node for which -- Is_Build_In_Place_Call is True, or else an N_Qualified_Expression node -- applied to such a function call. procedure Make_Build_In_Place_Call_In_Assignment (Assign : Node_Id; Function_Call : Node_Id); -- Ada 2005 (AI-318-02): Handle a call to a build-in-place function that -- occurs as the right-hand side of an assignment statement by passing -- access to the left-hand side as an additional parameter of the function -- call. Assign must denote a N_Assignment_Statement. Function_Call must -- denote either an N_Function_Call node for which Is_Build_In_Place_Call -- is True, or an N_Qualified_Expression node applied to such a function -- call. procedure Make_Build_In_Place_Call_In_Object_Declaration (Obj_Decl : Node_Id; Function_Call : Node_Id); -- Ada 2005 (AI-318-02): Handle a call to a build-in-place function that -- occurs as the expression initializing an object declaration by -- passing access to the declared object as an additional parameter of the -- function call. Function_Call must denote either an N_Function_Call node -- for which Is_Build_In_Place_Call is True, or an N_Qualified_Expression -- node applied to such a function call. procedure Make_CPP_Constructor_Call_In_Allocator (Allocator : Node_Id; Function_Call : Node_Id); -- Handle a call to a CPP constructor that occurs as the expression that -- initializes an allocator, by passing access to the allocated object as -- an additional parameter of the constructor call. A new access object is -- declared that is initialized to the result of the allocator, passed to -- the constructor, and the allocator is rewritten to refer to that access -- object. Function_Call must denote a call to a CPP_Constructor function. function Needs_BIP_Alloc_Form (Func_Id : Entity_Id) return Boolean; -- Ada 2005 (AI-318-02): Return True if the function needs an implicit -- BIP_Alloc_Form parameter (see type BIP_Formal_Kind). function Needs_BIP_Finalization_Master (Func_Id : Entity_Id) return Boolean; -- Ada 2005 (AI-318-02): Return True if the result subtype of function -- Func_Id might need finalization actions. This includes build-in-place -- functions with tagged result types, since they can be invoked via -- dispatching calls, and descendant types may require finalization. function Needs_Result_Accessibility_Level (Func_Id : Entity_Id) return Boolean; -- Ada 2012 (AI05-0234): Return True if the function needs an implicit -- parameter to identify the accessibility level of the function result -- "determined by the point of call". end Exp_Ch6;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/weak2.ads
best08618/asylo
7
2531
package Weak2 is Var : Integer; pragma Import (Ada, Var, "var_name"); pragma Weak_External (Var); function F return Integer; end Weak2;
test/Fail/Issue2047.agda
cruhland/agda
1,989
5578
<reponame>cruhland/agda postulate anything : ∀{a}{A : Set a} → A data N : Set where suc : (n : N) → N data Val : (n : N) → Set where valSuc : (n : N) → Val (suc n) -- valSuc : (n : N) → Val n -- internal error disappears Pred : Set₁ Pred = (n : N) → Set postulate Any : (P : Pred) → Set F : (P : Pred) → Pred anyF : {P : Pred} (S : Any P) → Any (F P) Evaluate : ∀ (n : N) (P : (w : Val n) → Set) → Set Evaluate n P = P anything LR : (n : N) → Pred LR n m = Evaluate n λ { (valSuc _) → anything} anyLR : {n : N} → Any (LR n) anyLR = anyF anything
source/regions/regions-contexts-environments.ads
reznikmm/declarative-regions
0
18184
<filename>source/regions/regions-contexts-environments.ads<gh_stars>0 -- SPDX-FileCopyrightText: 2022 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- private with Ada.Finalization; private with Regions.Shared_Lists; limited private with Regions.Contexts.Environments.Nodes; package Regions.Contexts.Environments is pragma Preelaborate; type Environment is tagged private; -- function Use_Visible -- function Directly_Visible function Nested_Regions (Self : Environment'Class) return Regions.Entity_Iterator_Interfaces.Forward_Iterator'Class; private type Environment_Node_Access is access all Regions.Contexts.Environments.Nodes.Environment_Node'Class; type Environment is new Ada.Finalization.Controlled with record Data : Environment_Node_Access; end record; overriding procedure Adjust (Self : in out Environment); overriding procedure Finalize (Self : in out Environment); package Selected_Entity_Name_Lists is new Regions.Shared_Lists (Selected_Entity_Name); end Regions.Contexts.Environments;
test/Compiler/with-stdlib/ShowNat.agda
shlevy/agda
7
11147
<filename>test/Compiler/with-stdlib/ShowNat.agda module ShowNat where open import IO open import Data.Unit open import Data.Nat.Show main = run (putStrLn (Data.Nat.Show.show 10))