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 |
|---|---|---|---|---|
source/machine-w64-mingw32/s-zetews.ads | ytomino/drake | 33 | 1923 | pragma License (Unrestricted);
-- implementation unit specialized for Windows
with C.winnt;
package System.Zero_Terminated_WStrings is
pragma Preelaborate;
-- This package targets at not Wide_String in Ada, not wchar_t in C
-- but LPWSTR in Windows.
-- convert from zero-terminated LPWSTR to UTF-8 String
function Value (Item : not null access constant C.winnt.WCHAR)
return String;
function Value (
Item : not null access constant C.winnt.WCHAR;
Length : C.size_t)
return String;
-- convert from UTF-8 String to zero-terminated LPWSTR
procedure To_C (Source : String; Result : not null access C.winnt.WCHAR);
procedure To_C (
Source : String;
Result : not null access C.winnt.WCHAR;
Result_Length : out C.size_t);
Expanding : constant := 1; -- same as Expanding_From_8_To_16
end System.Zero_Terminated_WStrings;
|
cpm2/RomWBW/Source/HBIOS/ay.asm | grancier/z180 | 0 | 13895 | ;
;======================================================================
; PSG AY-3-8910 DRIVER FOR CONSOLE BELL
; WILL ALSO WORK WITH YM2149
;======================================================================
;
AY_RSEL .EQU $9A
AY_RDAT .EQU $9B
AY_ACR .EQU $9C
AY_R0CHAP .EQU $00
AY_R1CHAP .EQU $01
AY_R2CHBP .EQU $02
AY_R3CHBP .EQU $03
AY_R7ENAB .EQU $07
AY_R8AVOL .EQU $08
AY_R9BVOL .EQU $09
;
;======================================================================
; PSG AY-3-8910 DRIVER - INITIALIZATION
;======================================================================
;
AY_INIT:
CALL NEWLINE ; FORMATTING
PRTS("AY: IO=0x$")
LD A,AY_RSEL
CALL PRTHEXBYTE
CALL AY_PROBE ; CHECK FOR HW EXISTENCE
JR Z,AY_INIT1 ; CONTINUE IF PRESENT
;
; HARDWARE NOT PRESENT
;
PRTS(" NOT PRESENT$")
OR $FF ; SIGNAL FAILURE
RET
;
AY_INIT1:
CALL AY_INIT2
CALL AY_BEEP
AY_INIT2:
LD D,AY_R7ENAB ; SET MIXER CONTROL / IO ENABLE
LD E,$FF ; $FF - 11 111 111
CALL AY_WRTPSG ; I/O PORTS DISABLED, NOISE CHANNEL C, B, A DISABLE, TONE CHANNEL C, B, A DISABLE
;
LD B,2
LD D,AY_R8AVOL ; SET VOLUME TO 0
LD E,$00
AY_QUIET:
CALL AY_WRTPSG ; CYCLING THROUGH ALL CHANNELS
INC A
DJNZ AY_QUIET
RET
;
; PLAY A BEEP TONE ON CENTER CHANNEL (LEFT AND RIGHT SPEAKERS)
;
AY_BEEP:
LD D,AY_R2CHBP ; SET TONE PERIOD
LD E,$55 ; CHANNEL B - R00 & R01
CALL AY_WRTPSG ; $0055 = XXXX0000 01010101
LD D,AY_R3CHBP
LD E,0
CALL AY_WRTPSG
;
LD D,AY_R7ENAB ; $FD = 11 111 101
LD E,$FD ; SET MIXER CONTROL / IO ENABLE
CALL AY_WRTPSG ; I/O PORTS DISABLED, NOISE CHANNEL C, B, A DISABLE, TONE CHANNEL B ENABLE
;
LD D,AY_R9BVOL
LD E,$07 ; SET CHANNEL B VOLUME TO 50% (7/16)
CALL AY_WRTPSG
;
CALL LDELAY ; HALF SECOND
RET
;
; WRITE DATA E TO PSG REG A
;
AY_WRTPSG:
HB_DI
#IF ((PLATFORM == PLT_N8) | (PLATFORM == PLT_MK4) | (PLATFORM == PLT_RC180))
IN0 A,(Z180_DCNTL) ; GET WAIT STATES
PUSH AF ; SAVE VALUE
OR %00110000 ; FORCE SLOW OPERATION (I/O W/S=3)
OUT0 (Z180_DCNTL),A ; AND UPDATE DCNTL
#ENDIF
LD A,D
OUT (AY_RSEL),A
LD A,E
OUT (AY_RDAT),A
#IF ((PLATFORM == PLT_N8) | (PLATFORM == PLT_MK4) | (PLATFORM == PLT_RC180))
POP AF ; GET SAVED DCNTL VALUE
OUT0 (Z180_DCNTL),A ; AND RESTORE IT
#ENDIF
HB_EI
RET
;
; CHECK THERE IS A DEVICE PRESENT
;
AY_PROBE:
LD A,$FF
OUT (AY_ACR),A ; INIT AUX CONTROL REG
XOR A
RET
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/stack_usage1_pkg.adb | best08618/asylo | 7 | 22677 | package body Stack_Usage1_Pkg is
function Ident_Int (X : Integer) return Integer is
begin
return X;
end Ident_Int;
procedure My_Proc (X : R) is
begin
null;
end My_Proc;
end Stack_Usage1_Pkg;
|
test/Fail/Issue4121-1.agda | cruhland/agda | 1,989 | 10040 | <reponame>cruhland/agda
module _ where
module M where
data D : Set where
c : D
private
pattern c′ = c
open M
x : D
x = c′
|
projects/batfish/src/main/antlr4/org/batfish/vendor/a10/grammar/A10Parser.g4 | Ashlippers/batfish | 0 | 1794 | <filename>projects/batfish/src/main/antlr4/org/batfish/vendor/a10/grammar/A10Parser.g4
parser grammar A10Parser;
import
A10_common,
A10_interface,
A10_ip_route,
A10_lacp_trunk,
A10_rba,
A10_trunk,
A10_vlan;
options {
superClass = 'org.batfish.grammar.BatfishParser';
tokenVocab = A10Lexer;
}
a10_configuration: NEWLINE? statement+ EOF;
statement
:
s_hostname
| s_interface
| s_ip
| s_lacp_trunk
| s_no
| s_rba
| s_trunk
| s_vlan
;
s_ip: IP si;
si: si_route;
s_no: NO sn_ip;
sn_ip: IP sni;
sni: sni_route;
s_hostname: HOSTNAME hostname NEWLINE;
|
src/hexedits.asm | helgefmi/lttphack | 28 | 105482 | <gh_stars>10-100
; == SRAM Size ==
if !FEATURE_SD2SNES
org $00FFD8
db $08 ; 256kb
else
org $00FFD8
db $05 ; 64kb
endif
; == ROM Size ==
org $00FFD7
db #11 ; 2mb
; == CTRL 2 ==
;
; Enable controller 2 CLR
; Overrides the following:
; $0083F8: 60 RTS
org $0083F8
NOP
; == FRAME ADVANCE ==
; Overrides the following
;$008039: 80 16 BRA $008051
org $008039
NOP #2
; Overrides the following
; $00803B: A5 F6 LDA $F6
; $00803D: 29 20 AND #$20
org $00803B
LDA $F5 : AND.b #$00
; Overrides the following
; $008044: A5 F6 LDA $F6
; $008046: 29 10 AND #$10
org $008044
LDA $F7 : AND.b #$00
; == BAGE CHEAT CODE ==
;
; Make it so saving on third filename slot gives you
; full equipment.
;
; NOP's out some code since originally, there were more
; requirements for this feature to happen.
org $0CDB79
CPX #$0A00 ; Checks if the player saved in third space.
SKIP 2 ; There's a BNE I didn't wanna touch here.
NOP : NOP : NOP : NOP ; AF F8 83 00 LDA.l $0083F8
NOP : NOP : NOP ; 29 FF 00 AND #$00FF
NOP : NOP : NOP ; C9 60 00 CMP #$0060
NOP : NOP ; F0 21 BEQ $0CDC49
NOP : NOP : NOP : NOP ; AF D9 03 70 LDA $7003D9
NOP : NOP : NOP ; C9 01 00 CMP #$0001
NOP : NOP ; D0 18 BNE $0CDC49
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_13560_2316.asm | ljhsiun2/medusa | 9 | 169782 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x868a, %r11
nop
nop
nop
nop
nop
and %r14, %r14
mov $0x6162636465666768, %r10
movq %r10, %xmm4
movups %xmm4, (%r11)
nop
nop
nop
nop
and %r9, %r9
lea addresses_A_ht+0x85dc, %rsi
nop
nop
nop
nop
add %rdi, %rdi
movl $0x61626364, (%rsi)
nop
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_WC_ht+0xa700, %r10
nop
nop
sub %r11, %r11
mov (%r10), %r9w
nop
nop
inc %rax
lea addresses_normal_ht+0x25bc, %rsi
lea addresses_normal_ht+0xcdbc, %rdi
nop
nop
nop
xor $25307, %rax
mov $16, %rcx
rep movsl
nop
nop
nop
dec %r14
lea addresses_UC_ht+0x12dbc, %r9
xor $29512, %r14
mov (%r9), %rcx
nop
nop
nop
inc %r11
lea addresses_D_ht+0x10dbc, %rsi
nop
and %rdi, %rdi
vmovups (%rsi), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $1, %xmm0, %r11
nop
nop
nop
sub $14974, %rdi
lea addresses_WC_ht+0x29c4, %rsi
lea addresses_D_ht+0x31bc, %rdi
nop
mfence
mov $94, %rcx
rep movsq
nop
inc %rdi
lea addresses_WC_ht+0x11f84, %rsi
lea addresses_A_ht+0x1143c, %rdi
nop
nop
sub $62985, %r9
mov $59, %rcx
rep movsb
nop
cmp %rsi, %rsi
lea addresses_UC_ht+0x1c9c, %r14
nop
nop
nop
nop
and $58978, %r11
movb (%r14), %al
inc %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r8
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_WT+0xfee0, %rdi
nop
nop
nop
nop
dec %rbx
movb $0x51, (%rdi)
nop
nop
nop
dec %r8
// Store
lea addresses_RW+0x871c, %rbp
nop
nop
sub $3250, %rdx
movw $0x5152, (%rbp)
nop
add $38773, %rbp
// REPMOV
mov $0x34631e00000005bc, %rsi
lea addresses_A+0xd246, %rdi
nop
nop
inc %r8
mov $29, %rcx
rep movsw
nop
nop
nop
nop
dec %r8
// Store
lea addresses_US+0xb8bc, %rsi
nop
nop
nop
nop
cmp $19198, %rcx
movl $0x51525354, (%rsi)
nop
nop
nop
nop
cmp %rcx, %rcx
// Store
lea addresses_A+0x1c5c, %rdx
xor $28899, %rdi
movl $0x51525354, (%rdx)
nop
add $56105, %rbx
// Faulty Load
lea addresses_PSE+0x1b5bc, %rsi
nop
nop
cmp %r8, %r8
movb (%rsi), %bl
lea oracles, %rcx
and $0xff, %rbx
shlq $12, %rbx
mov (%rcx,%rbx,1), %rbx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r8
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_RW', 'same': False, 'size': 2, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_NC', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_A', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_US', 'same': False, 'size': 4, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 4, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 4, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'same': True, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': True}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'33': 13560}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
apu/channel_2/channel_2_stop_restart.asm | endrift/SameSuite | 21 | 19409 | RESULTS_START EQU $c000
RESULTS_N_ROWS EQU 18
include "base.inc"
; This test shows that even after stopping the channel, the current
; sample index/phase remains unchanged. It is only reset by turning
; the APU off (NR52).
CorrectResults:
db $00, $00, $00, $00, $00, $00, $00, $00
db $00, $00, $00, $00, $80, $80, $80, $80
db $00, $00, $00, $00, $00, $00, $00, $00
db $00, $00, $00, $00, $80, $80, $80, $80
db $00, $00, $00, $00, $00, $00, $00, $00
db $80, $80, $80, $80, $80, $80, $80, $80
db $00, $00, $00, $00, $00, $00, $00, $00
db $80, $80, $80, $80, $80, $80, $80, $80
db $00, $00, $00, $00, $80, $80, $80, $80
db $80, $80, $80, $80, $80, $80, $80, $80
db $00, $00, $00, $00, $80, $80, $80, $80
db $80, $80, $80, $80, $80, $80, $80, $80
db $80, $80, $80, $80, $80, $80, $80, $80
db $80, $80, $80, $80, $80, $80, $80, $80
db $80, $80, $80, $80, $80, $80, $80, $80
db $80, $80, $80, $80, $80, $80, $80, $80
db $80, $80, $80, $80, $80, $80, $80, $80
db $80, $80, $80, $80, $00, $00, $00, $00
SubTest: MACRO
xor a
ld c, rNR22 & $ff
ldh [rNR52], a
cpl
ldh [rNR52], a
ld hl, rPCM12
ld a, $fc
ldh [rNR23], a
ld a, $80
ldh [rNR21], a
ldh [rNR22], a
ld a, $87
ldh [rNR24], a
nops \2
xor a
ld [c], a
ld a, $80
ld [c], a
ld a, $87
ldh [rNR24], a
nops \1
ld a, [hl]
call StoreResult
ENDM
RunTest:
ld de, $c000
SubTest $8, 0
SubTest $9, 0
SubTest $a, 0
SubTest $b, 0
SubTest $c, 0
SubTest $d, 0
SubTest $e, 0
SubTest $f, 0
SubTest $10, 0
SubTest $11, 0
SubTest $12, 0
SubTest $13, 0
SubTest $14, 0
SubTest $15, 0
SubTest $16, 0
SubTest $17, 0
SubTest $8, 2
SubTest $9, 2
SubTest $a, 2
SubTest $b, 2
SubTest $c, 2
SubTest $d, 2
SubTest $e, 2
SubTest $f, 2
SubTest $10, 2
SubTest $11, 2
SubTest $12, 2
SubTest $13, 2
SubTest $14, 2
SubTest $15, 2
SubTest $16, 2
SubTest $17, 2
SubTest $8, 3
SubTest $9, 3
SubTest $a, 3
SubTest $b, 3
SubTest $c, 3
SubTest $d, 3
SubTest $e, 3
SubTest $f, 3
SubTest $10, 3
SubTest $11, 3
SubTest $12, 3
SubTest $13, 3
SubTest $14, 3
SubTest $15, 3
SubTest $16, 3
SubTest $17, 3
SubTest $8, 6
SubTest $9, 6
SubTest $a, 6
SubTest $b, 6
SubTest $c, 6
SubTest $d, 6
SubTest $e, 6
SubTest $f, 6
SubTest $10, 6
SubTest $11, 6
SubTest $12, 6
SubTest $13, 6
SubTest $14, 6
SubTest $15, 6
SubTest $16, 6
SubTest $17, 6
SubTest $8, 7
SubTest $9, 7
SubTest $a, 7
SubTest $b, 7
SubTest $c, 7
SubTest $d, 7
SubTest $e, 7
SubTest $f, 7
SubTest $10, 7
SubTest $11, 7
SubTest $12, 7
SubTest $13, 7
SubTest $14, 7
SubTest $15, 7
SubTest $16, 7
SubTest $17, 7
SubTest $8, 10
SubTest $9, 10
SubTest $a, 10
SubTest $b, 10
SubTest $c, 10
SubTest $d, 10
SubTest $e, 10
SubTest $f, 10
SubTest $10, 10
SubTest $11, 10
SubTest $12, 10
SubTest $13, 10
SubTest $14, 10
SubTest $15, 10
SubTest $16, 10
SubTest $17, 10
SubTest $8, 11
SubTest $9, 11
SubTest $a, 11
SubTest $b, 11
SubTest $c, 11
SubTest $d, 11
SubTest $e, 11
SubTest $f, 11
SubTest $10, 11
SubTest $11, 11
SubTest $12, 11
SubTest $13, 11
SubTest $14, 11
SubTest $15, 11
SubTest $16, 11
SubTest $17, 11
SubTest $8, 14
SubTest $9, 14
SubTest $a, 14
SubTest $b, 14
SubTest $c, 14
SubTest $d, 14
SubTest $e, 14
SubTest $f, 14
SubTest $10, 14
SubTest $11, 14
SubTest $12, 14
SubTest $13, 14
SubTest $14, 14
SubTest $15, 14
SubTest $16, 14
SubTest $17, 14
SubTest $8, 15
SubTest $9, 15
SubTest $a, 15
SubTest $b, 15
SubTest $c, 15
SubTest $d, 15
SubTest $e, 15
SubTest $f, 15
SubTest $10, 15
SubTest $11, 15
SubTest $12, 15
SubTest $13, 15
SubTest $14, 15
SubTest $15, 15
SubTest $16, 15
SubTest $17, 15
ret
StoreResult::
ld [de], a
inc de
ret
CGB_MODE
|
source/encodings.ads | Vovanium/Encodings | 0 | 23961 | <reponame>Vovanium/Encodings
package Encodings is
pragma Pure;
type Coder_Base is interface;
end Encodings; |
src/util-encoders.adb | Letractively/ada-util | 0 | 11025 | -----------------------------------------------------------------------
-- util-encoders -- Encode/Decode streams and strings from one format to another
-- Copyright (C) 2009, 2010, 2011 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Unchecked_Deallocation;
with Util.Encoders.Base16;
with Util.Encoders.Base64;
with Util.Encoders.SHA1;
package body Util.Encoders is
use Ada;
use Ada.Strings.Unbounded;
use type Ada.Streams.Stream_Element_Offset;
-- ------------------------------
-- Encodes the input string <b>Data</b> using the transformation
-- rules provided by the <b>E</b> encoder.
--
-- Returns the encoded string.
--
-- Raises the <b>Encoding_Error</b> exception if the source string
-- cannot be encoded.
-- Raises the <b>Not_Supported</b> exception if the encoding is not
-- supported.
-- ------------------------------
function Encode (E : in Encoder;
Data : in String) return String is
begin
if E.Encode = null then
raise Not_Supported with "There is no encoder";
end if;
return E.Encode.Transform (Data);
end Encode;
-- ------------------------------
-- Decodes the input string <b>Data</b> using the transformation
-- rules provided by the <b>E</b> encoder.
--
-- Returns the encoded string.
--
-- Raises the <b>Encoding_Error</b> exception if the source string
-- cannot be decoded.
-- Raises the <b>Not_Supported</b> exception if the decoding is not
-- supported.
-- ------------------------------
function Decode (E : in Encoder;
Data : in String) return String is
begin
if E.Decode = null then
raise Not_Supported with "There is no decoder";
end if;
return E.Decode.Transform (Data);
end Decode;
MIN_BUFFER_SIZE : constant Streams.Stream_Element_Offset := 64;
MAX_BUFFER_SIZE : constant Streams.Stream_Element_Offset := 2_048;
function Best_Size (Length : Natural) return Streams.Stream_Element_Offset;
pragma Inline (Best_Size);
-- ------------------------------
-- Compute a good size for allocating a buffer on the stack
-- ------------------------------
function Best_Size (Length : Natural) return Streams.Stream_Element_Offset is
begin
if Length < Natural (MIN_BUFFER_SIZE) then
return MIN_BUFFER_SIZE;
elsif Length > Natural (MAX_BUFFER_SIZE) then
return MAX_BUFFER_SIZE;
else
return Streams.Stream_Element_Offset (((Length + 15) / 16) * 16);
end if;
end Best_Size;
-- ------------------------------
-- Transform the input string <b>Data</b> using the transformation
-- rules provided by the <b>E</b> transformer.
--
-- Returns the transformed string.
--
-- Raises the <b>Encoding_Error</b> exception if the source string
-- cannot be transformed
-- ------------------------------
function Transform (E : in Transformer'Class;
Data : in String) return String is
Buf_Size : constant Streams.Stream_Element_Offset := Best_Size (Data'Length);
Buf : Streams.Stream_Element_Array (1 .. Buf_Size);
Res : Streams.Stream_Element_Array (1 .. Buf_Size);
Tmp : String (1 .. Natural (Buf_Size));
Result : Ada.Strings.Unbounded.Unbounded_String;
Pos : Natural := Data'First;
begin
while Pos <= Data'Last loop
declare
Last_Encoded : Streams.Stream_Element_Offset;
First_Encoded : Streams.Stream_Element_Offset := 1;
Last : Streams.Stream_Element_Offset;
Size : Streams.Stream_Element_Offset;
Next_Pos : Natural;
begin
-- Fill the stream buffer with our input string
Size := Streams.Stream_Element_Offset (Data'Last - Pos + 1);
if Size > Buf'Length then
Size := Buf'Length;
end if;
for I in 1 .. Size loop
Buf (I) := Character'Pos (Data (Natural (I) + Pos - 1));
end loop;
Next_Pos := Pos + Natural (Size);
-- Encode that buffer and put the result in out result string.
loop
E.Transform (Data => Buf (First_Encoded .. Size),
Into => Res,
Encoded => Last_Encoded,
Last => Last);
-- If the encoder generated nothing, move the position backward
-- to take into account the remaining bytes not taken into account.
if Last < 1 then
Next_Pos := Next_Pos - Natural (Size - First_Encoded + 1);
exit;
end if;
for I in 1 .. Last loop
Tmp (Natural (I)) := Character'Val (Res (I));
end loop;
Append (Result, Tmp (1 .. Natural (Last)));
exit when Last_Encoded = Size;
First_Encoded := Last_Encoded + 1;
end loop;
-- The encoder cannot encode the data
if Pos = Next_Pos then
raise Encoding_Error with "Encoding cannot proceed";
end if;
Pos := Next_Pos;
end;
end loop;
return To_String (Result);
end Transform;
-- ------------------------------
-- Transform the input string <b>Data</b> using the transformation
-- rules provided by the <b>E</b> transformer.
--
-- Returns the transformed string.
--
-- Raises the <b>Encoding_Error</b> exception if the source string
-- cannot be transformed
-- ------------------------------
function Transform (E : in Transformer'Class;
Data : in Streams.Stream_Element_Array) return String is
Buf_Size : constant Streams.Stream_Element_Offset := Best_Size (Data'Length);
Res : Streams.Stream_Element_Array (1 .. Buf_Size);
Tmp : String (1 .. Natural (Buf_Size));
Result : Ada.Strings.Unbounded.Unbounded_String;
Last_Encoded : Streams.Stream_Element_Offset;
Last : Streams.Stream_Element_Offset;
begin
-- Encode that buffer and put the result in out result string.
E.Transform (Data => Data,
Into => Res,
Encoded => Last_Encoded,
Last => Last);
for I in 1 .. Last loop
Tmp (Natural (I)) := Character'Val (Res (I));
end loop;
Append (Result, Tmp (1 .. Natural (Last)));
return To_String (Result);
end Transform;
-- ------------------------------
-- Encode the value represented by <tt>Val</tt> in the stream array <tt>Into</tt> starting
-- at position <tt>Pos</tt> in that array. The value is encoded using LEB128 format, 7-bits
-- at a time until all non zero bits are written. The <tt>Last</tt> parameter is updated
-- to indicate the position of the last valid byte written in <tt>Into</tt>.
-- ------------------------------
procedure Encode_LEB128 (Into : in out Ada.Streams.Stream_Element_Array;
Pos : in Ada.Streams.Stream_Element_Offset;
Val : in Interfaces.Unsigned_64;
Last : out Ada.Streams.Stream_Element_Offset) is
use type Interfaces.Unsigned_64;
P : Ada.Streams.Stream_Element_Offset := Pos;
V, U : Interfaces.Unsigned_64;
begin
V := Val;
loop
if V < 16#07F# then
Into (P) := Ada.Streams.Stream_Element (V);
Last := P;
return;
end if;
U := V and 16#07F#;
Into (P) := Ada.Streams.Stream_Element (U or 16#80#);
P := P + 1;
V := Interfaces.Shift_Right (V, 7);
end loop;
end Encode_LEB128;
-- ------------------------------
-- Decode from the byte array <tt>From</tt> the value represented as LEB128 format starting
-- at position <tt>Pos</tt> in that array. After decoding, the <tt>Last</tt> index is updated
-- to indicate the last position in the byte array.
-- ------------------------------
procedure Decode_LEB128 (From : in Ada.Streams.Stream_Element_Array;
Pos : in Ada.Streams.Stream_Element_Offset;
Val : out Interfaces.Unsigned_64;
Last : out Ada.Streams.Stream_Element_Offset) is
use type Interfaces.Unsigned_64;
use type Interfaces.Unsigned_8;
P : Ada.Streams.Stream_Element_Offset := Pos;
Value : Interfaces.Unsigned_64 := 0;
V : Interfaces.Unsigned_8;
Shift : Integer := 0;
begin
loop
V := Interfaces.Unsigned_8 (From (P));
if (V and 16#80#) = 0 then
Val := Interfaces.Shift_Left (Interfaces.Unsigned_64 (V), Shift) or Value;
Last := P + 1;
return;
end if;
V := V and 16#07F#;
Value := Interfaces.Shift_Left (Interfaces.Unsigned_64 (V), Shift) or Value;
P := P + 1;
Shift := Shift + 7;
end loop;
end Decode_LEB128;
-- ------------------------------
-- Create the encoder object for the specified algorithm.
-- ------------------------------
function Create (Name : String) return Encoder is
begin
if Name = BASE_16 or Name = HEX then
return E : Encoder do
E.Encode := new Util.Encoders.Base16.Encoder;
E.Decode := new Util.Encoders.Base16.Decoder;
end return;
elsif Name = BASE_64 then
return E : Encoder do
E.Encode := new Util.Encoders.Base64.Encoder;
E.Decode := new Util.Encoders.Base64.Decoder;
end return;
elsif Name = BASE_64_URL then
return E : Encoder do
E.Encode := Util.Encoders.Base64.Create_URL_Encoder;
E.Decode := Util.Encoders.Base64.Create_URL_Decoder;
end return;
elsif Name = HASH_SHA1 then
return E : Encoder do
E.Encode := new Util.Encoders.SHA1.Encoder;
E.Decode := new Util.Encoders.Base64.Decoder;
end return;
end if;
raise Not_Supported with "Invalid encoder: " & Name;
end Create;
-- ------------------------------
-- Delete the transformers
-- ------------------------------
overriding
procedure Finalize (E : in out Encoder) is
procedure Free is
new Ada.Unchecked_Deallocation (Transformer'Class, Transformer_Access);
begin
Free (E.Encode);
Free (E.Decode);
end Finalize;
end Util.Encoders;
|
source/compiler/compiler-context.ads | mgrojo/protobuf | 0 | 4791 | -- MIT License
--
-- Copyright (c) 2020 <NAME>
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
with Ada.Containers.Hashed_Maps;
with Ada.Containers.Ordered_Sets;
with Ada_Pretty;
with League.Strings;
with League.Strings.Hash;
with Google.Protobuf.Descriptor;
with Google.Protobuf.Compiler.Plugin;
with PB_Support.Universal_String_Vectors;
package Compiler.Context is
Is_Proto_2 : Boolean := True;
-- Proto version of current file
Factory : aliased Ada_Pretty.Factory;
-- Node factory for pretty printing generated sources
package String_Sets is new Ada.Containers.Ordered_Sets
(League.Strings.Universal_String,
"<" => League.Strings."<",
"=" => League.Strings."=");
-- Set of strings
Fake : String_Sets.Set;
-- Set of id for each field that breaks circular usage.
type Ada_Type_Name is record
Package_Name : League.Strings.Universal_String;
Type_Name : League.Strings.Universal_String;
end record;
function "+" (Self : Ada_Type_Name) return League.Strings.Universal_String;
-- Join package name (if any) and type name into selected name.
function Compound_Name
(Self : Ada_Type_Name;
Current_Package : League.Strings.Universal_String)
return League.Strings.Universal_String;
-- Join package name (if any) and type name using "_" for new identifiers.
function Relative_Name
(Full_Name : League.Strings.Universal_String;
Current_Package : League.Strings.Universal_String)
return League.Strings.Universal_String;
-- Try to avoid wrong interpretation of selected Full_Name when it's
-- used from Current_Package. Example:
-- Full_Name => Conformance.Conformance.Type_Name
-- Current_Package => Conformance.Conformance
-- Result => Conformance.Type_Name
type Enumeration_Information is record
Min, Max : Integer; -- Minimum and maximum representation value
Default : League.Strings.Universal_String; -- Default value
end record;
type Named_Type (Is_Enumeration : Boolean := False) is record
Ada_Type : Ada_Type_Name;
Optional_Type : League.Strings.Universal_String;
-- Name of optional type, usually "Optional_" & Ada_Type.Type_Name
case Is_Enumeration is
when True =>
Enum : Enumeration_Information;
when False =>
null;
-- Message : Google.Protobuf.Descriptor_Proto;
end case;
end record;
package Named_Type_Maps is new Ada.Containers.Hashed_Maps
(League.Strings.Universal_String,
Named_Type,
League.Strings.Hash,
League.Strings."=");
Named_Types : Named_Type_Maps.Map;
procedure Populate_Named_Types
(Request : Google.Protobuf.Compiler.Plugin.Code_Generator_Request;
Map : in out Compiler.Context.Named_Type_Maps.Map);
-- Fill Map with type information found in Request
function Get_File
(Request : Google.Protobuf.Compiler.Plugin.Code_Generator_Request;
Name : League.Strings.Universal_String)
return Google.Protobuf.Descriptor.File_Descriptor_Proto;
-- Find file by Name in the Request
function To_Ada_Name
(Text : League.Strings.Universal_String)
return League.Strings.Universal_String;
-- Convert text to look like an Ada Name
function To_Selected_Ada_Name
(Text : League.Strings.Universal_String)
return League.Strings.Universal_String;
-- Convert text to look like a selected Ada Name
function Join
(Prefix : League.Strings.Universal_String;
Name : PB_Support.Universal_String_Vectors.Option)
return League.Strings.Universal_String;
-- Return "prefix . name"
function New_Type_Name
(Name : PB_Support.Universal_String_Vectors.Option;
Default : League.Strings.Universal_String;
Prefix : League.Strings.Universal_String;
Local : Compiler.Context.Named_Type_Maps.Map;
Used : Compiler.Context.String_Sets.Set)
return League.Strings.Universal_String;
function Is_Reserved_Word
(Name : League.Strings.Universal_String) return Boolean;
end Compiler.Context;
|
oeis/047/A047295.asm | neoneye/loda-programs | 11 | 90930 | <reponame>neoneye/loda-programs<filename>oeis/047/A047295.asm
; A047295: Numbers that are congruent to {0, 1, 2, 4, 6} mod 7.
; Submitted by <NAME>
; 0,1,2,4,6,7,8,9,11,13,14,15,16,18,20,21,22,23,25,27,28,29,30,32,34,35,36,37,39,41,42,43,44,46,48,49,50,51,53,55,56,57,58,60,62,63,64,65,67,69,70,71,72,74,76,77,78
mov $1,$0
add $1,2
add $0,$1
mul $0,3
div $0,5
div $1,5
add $0,$1
sub $0,1
|
SVD2ada/svd/stm32_svd-nvic.ads | JCGobbi/Nucleo-STM32G474RE | 0 | 9713 | <reponame>JCGobbi/Nucleo-STM32G474RE
pragma Style_Checks (Off);
-- This spec has been automatically generated from STM32G474xx.svd
pragma Restrictions (No_Elaboration_Code);
with HAL;
with System;
package STM32_SVD.NVIC is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- IPR_IPR_N array element
subtype IPR_IPR_N_Element is HAL.UInt8;
-- IPR_IPR_N array
type IPR_IPR_N_Field_Array is array (0 .. 3) of IPR_IPR_N_Element
with Component_Size => 8, Size => 32;
-- Interrupt Priority Register
type IPR_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- IPR_N as a value
Val : HAL.UInt32;
when True =>
-- IPR_N as an array
Arr : IPR_IPR_N_Field_Array;
end case;
end record
with Unchecked_Union, Size => 32, Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for IPR_Register use record
Val at 0 range 0 .. 31;
Arr at 0 range 0 .. 31;
end record;
subtype STIR_INTID_Field is HAL.UInt9;
-- Software trigger interrupt register
type STIR_Register is record
-- Software generated interrupt ID
INTID : STIR_INTID_Field := 16#0#;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for STIR_Register use record
INTID at 0 range 0 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Nested Vectored Interrupt Controller
type NVIC_Peripheral is record
-- Interrupt Set-Enable Register
ISER0 : aliased HAL.UInt32;
-- Interrupt Set-Enable Register
ISER1 : aliased HAL.UInt32;
-- Interrupt Set-Enable Register
ISER2 : aliased HAL.UInt32;
-- Interrupt Set-Enable Register
ISER3 : aliased HAL.UInt32;
-- Interrupt Clear-Enable Register
ICER0 : aliased HAL.UInt32;
-- Interrupt Clear-Enable Register
ICER1 : aliased HAL.UInt32;
-- Interrupt Clear-Enable Register
ICER2 : aliased HAL.UInt32;
-- Interrupt Clear-Enable Register
ICER3 : aliased HAL.UInt32;
-- Interrupt Set-Pending Register
ISPR0 : aliased HAL.UInt32;
-- Interrupt Set-Pending Register
ISPR1 : aliased HAL.UInt32;
-- Interrupt Set-Pending Register
ISPR2 : aliased HAL.UInt32;
-- Interrupt Set-Pending Register
ISPR3 : aliased HAL.UInt32;
-- Interrupt Clear-Pending Register
ICPR0 : aliased HAL.UInt32;
-- Interrupt Clear-Pending Register
ICPR1 : aliased HAL.UInt32;
-- Interrupt Clear-Pending Register
ICPR2 : aliased HAL.UInt32;
-- Interrupt Clear-Pending Register
ICPR3 : aliased HAL.UInt32;
-- Interrupt Active Bit Register
IABR0 : aliased HAL.UInt32;
-- Interrupt Active Bit Register
IABR1 : aliased HAL.UInt32;
-- Interrupt Active Bit Register
IABR2 : aliased HAL.UInt32;
-- Interrupt Active Bit Register
IABR3 : aliased HAL.UInt32;
-- Interrupt Priority Register
IPR0 : aliased IPR_Register;
-- Interrupt Priority Register
IPR1 : aliased IPR_Register;
-- Interrupt Priority Register
IPR2 : aliased IPR_Register;
-- Interrupt Priority Register
IPR3 : aliased IPR_Register;
-- Interrupt Priority Register
IPR4 : aliased IPR_Register;
-- Interrupt Priority Register
IPR5 : aliased IPR_Register;
-- Interrupt Priority Register
IPR6 : aliased IPR_Register;
-- Interrupt Priority Register
IPR7 : aliased IPR_Register;
-- Interrupt Priority Register
IPR8 : aliased IPR_Register;
-- Interrupt Priority Register
IPR9 : aliased IPR_Register;
-- Interrupt Priority Register
IPR10 : aliased IPR_Register;
-- Interrupt Priority Register
IPR11 : aliased IPR_Register;
-- Interrupt Priority Register
IPR12 : aliased IPR_Register;
-- Interrupt Priority Register
IPR13 : aliased IPR_Register;
-- Interrupt Priority Register
IPR14 : aliased IPR_Register;
-- Interrupt Priority Register
IPR15 : aliased IPR_Register;
-- Interrupt Priority Register
IPR16 : aliased IPR_Register;
-- Interrupt Priority Register
IPR17 : aliased IPR_Register;
-- Interrupt Priority Register
IPR18 : aliased IPR_Register;
-- Interrupt Priority Register
IPR19 : aliased IPR_Register;
-- Interrupt Priority Register
IPR20 : aliased IPR_Register;
-- Interrupt Priority Register
IPR21 : aliased HAL.UInt32;
-- Interrupt Priority Register
IPR22 : aliased HAL.UInt32;
-- Interrupt Priority Register
IPR23 : aliased HAL.UInt32;
-- Interrupt Priority Register
IPR24 : aliased HAL.UInt32;
-- Interrupt Priority Register
IPR25 : aliased HAL.UInt32;
end record
with Volatile;
for NVIC_Peripheral use record
ISER0 at 16#0# range 0 .. 31;
ISER1 at 16#4# range 0 .. 31;
ISER2 at 16#8# range 0 .. 31;
ISER3 at 16#C# range 0 .. 31;
ICER0 at 16#80# range 0 .. 31;
ICER1 at 16#84# range 0 .. 31;
ICER2 at 16#88# range 0 .. 31;
ICER3 at 16#8C# range 0 .. 31;
ISPR0 at 16#100# range 0 .. 31;
ISPR1 at 16#104# range 0 .. 31;
ISPR2 at 16#108# range 0 .. 31;
ISPR3 at 16#10C# range 0 .. 31;
ICPR0 at 16#180# range 0 .. 31;
ICPR1 at 16#184# range 0 .. 31;
ICPR2 at 16#188# range 0 .. 31;
ICPR3 at 16#18C# range 0 .. 31;
IABR0 at 16#200# range 0 .. 31;
IABR1 at 16#204# range 0 .. 31;
IABR2 at 16#208# range 0 .. 31;
IABR3 at 16#20C# range 0 .. 31;
IPR0 at 16#300# range 0 .. 31;
IPR1 at 16#304# range 0 .. 31;
IPR2 at 16#308# range 0 .. 31;
IPR3 at 16#30C# range 0 .. 31;
IPR4 at 16#310# range 0 .. 31;
IPR5 at 16#314# range 0 .. 31;
IPR6 at 16#318# range 0 .. 31;
IPR7 at 16#31C# range 0 .. 31;
IPR8 at 16#320# range 0 .. 31;
IPR9 at 16#324# range 0 .. 31;
IPR10 at 16#328# range 0 .. 31;
IPR11 at 16#32C# range 0 .. 31;
IPR12 at 16#330# range 0 .. 31;
IPR13 at 16#334# range 0 .. 31;
IPR14 at 16#338# range 0 .. 31;
IPR15 at 16#33C# range 0 .. 31;
IPR16 at 16#340# range 0 .. 31;
IPR17 at 16#344# range 0 .. 31;
IPR18 at 16#348# range 0 .. 31;
IPR19 at 16#34C# range 0 .. 31;
IPR20 at 16#350# range 0 .. 31;
IPR21 at 16#354# range 0 .. 31;
IPR22 at 16#358# range 0 .. 31;
IPR23 at 16#35C# range 0 .. 31;
IPR24 at 16#360# range 0 .. 31;
IPR25 at 16#364# range 0 .. 31;
end record;
-- Nested Vectored Interrupt Controller
NVIC_Periph : aliased NVIC_Peripheral
with Import, Address => NVIC_Base;
-- Nested vectored interrupt controller
type NVIC_STIR_Peripheral is record
-- Software trigger interrupt register
STIR : aliased STIR_Register;
end record
with Volatile;
for NVIC_STIR_Peripheral use record
STIR at 0 range 0 .. 31;
end record;
-- Nested vectored interrupt controller
NVIC_STIR_Periph : aliased NVIC_STIR_Peripheral
with Import, Address => NVIC_STIR_Base;
end STM32_SVD.NVIC;
|
programs/oeis/070/A070846.asm | neoneye/loda | 22 | 243846 | ; A070846: Smallest prime == 1 (mod 2n).
; 3,5,7,17,11,13,29,17,19,41,23,73,53,29,31,97,103,37,191,41,43,89,47,97,101,53,109,113,59,61,311,193,67,137,71,73,149,229,79,241,83,337,173,89,181,277,283,97,197,101,103,313,107,109,331,113,229,233,709,241,367,373,127,257,131,397,269,137,139,281,569,433,293,149,151,457,463,157,317,641,163,821,167,337,1021,173,349,353,179,181,547,1289,373,941,191,193,389,197,199,401
mul $0,2
add $0,1
seq $0,34694 ; Smallest prime == 1 (mod n).
|
libsrc/_DEVELOPMENT/adt/wv_priority_queue/c/sccz80/wv_priority_queue_destroy.asm | meesokim/z88dk | 0 | 6842 |
; void wv_priority_queue_destroy(wv_priority_queue_t *q)
SECTION code_adt_wv_priority_queue
PUBLIC wv_priority_queue_destroy
defc wv_priority_queue_destroy = asm_wv_priority_queue_destroy
INCLUDE "adt/wv_priority_queue/z80/asm_wv_priority_queue_destroy.asm"
|
test/asset/agda-stdlib-1.0/Data/Integer/DivMod.agda | omega12345/agda-mode | 0 | 793 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Integer division
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Integer.DivMod where
open import Data.Nat as ℕ using (ℕ)
import Data.Nat.Properties as NProp
import Data.Nat.DivMod as NDM
import Data.Sign as S
import Data.Sign.Properties as SProp
open import Data.Integer as ℤ
open import Data.Integer.Properties
open import Data.Fin as Fin using (Fin)
import Data.Fin.Properties as FProp
open import Function
open import Relation.Nullary.Decidable
open import Relation.Binary.PropositionalEquality
infixl 7 _divℕ_ _div_ _modℕ_ _mod_
_divℕ_ : (dividend : ℤ) (divisor : ℕ) {≢0 : False (divisor ℕ.≟ 0)} → ℤ
(+ n divℕ d) {d≠0} = + (n NDM.div d) {d≠0}
(-[1+ n ] divℕ d) {d≠0} with (ℕ.suc n NDM.divMod d) {d≠0}
... | NDM.result q Fin.zero eq = - (+ q)
... | NDM.result q (Fin.suc r) eq = -[1+ q ]
_div_ : (dividend divisor : ℤ) {≢0 : False (∣ divisor ∣ ℕ.≟ 0)} → ℤ
(n div d) {d≢0} = (sign d ◃ 1) ℤ.* (n divℕ ∣ d ∣) {d≢0}
_modℕ_ : (dividend : ℤ) (divisor : ℕ) {≠0 : False (divisor ℕ.≟ 0)} → ℕ
(+ n modℕ d) {d≠0} = (n NDM.% d) {d≠0}
(-[1+ n ] modℕ d) {d≠0} with (ℕ.suc n NDM.divMod d) {d≠0}
... | NDM.result q Fin.zero eq = 0
... | NDM.result q (Fin.suc r) eq = d ℕ.∸ ℕ.suc (Fin.toℕ r)
_mod_ : (dividend divisor : ℤ) {≠0 : False (∣ divisor ∣ ℕ.≟ 0)} → ℕ
(n mod d) {d≢0} = (n modℕ ∣ d ∣) {d≢0}
n%ℕd<d : ∀ n d {d≢0} → (n modℕ d) {d≢0} ℕ.< d
n%ℕd<d n ℕ.zero {()}
n%ℕd<d (+ n) sd@(ℕ.suc d) = NDM.a%n<n n d
n%ℕd<d -[1+ n ] sd@(ℕ.suc d) with ℕ.suc n NDM.divMod sd
... | NDM.result q Fin.zero eq = ℕ.s≤s ℕ.z≤n
... | NDM.result q (Fin.suc r) eq = ℕ.s≤s (NProp.n∸m≤n (Fin.toℕ r) d)
n%d<d : ∀ n d {d≢0} → (n mod d) {d≢0} ℕ.< ℤ.∣ d ∣
n%d<d n (+ 0) {()}
n%d<d n (+ ℕ.suc d) = n%ℕd<d n (ℕ.suc d)
n%d<d n -[1+ d ] = n%ℕd<d n (ℕ.suc d)
a≡a%ℕn+[a/ℕn]*n : ∀ n d {d≢0} → n ≡ + (n modℕ d) {d≢0} + (n divℕ d) {d≢0} * + d
a≡a%ℕn+[a/ℕn]*n _ ℕ.zero {()}
a≡a%ℕn+[a/ℕn]*n (+ n) sd@(ℕ.suc d) = let q = n NDM.div sd; r = n NDM.% sd in begin
+ n ≡⟨ cong +_ (NDM.a≡a%n+[a/n]*n n d) ⟩
+ (r ℕ.+ q ℕ.* sd) ≡⟨ pos-+-commute r (q ℕ.* sd) ⟩
+ r + + (q ℕ.* sd) ≡⟨ cong (_+_ (+ (+ n modℕ sd))) (sym (pos-distrib-* q sd)) ⟩
+ r + + q * + sd ∎ where open ≡-Reasoning
a≡a%ℕn+[a/ℕn]*n -[1+ n ] sd@(ℕ.suc d) with (ℕ.suc n) NDM.divMod (ℕ.suc d)
... | NDM.result q Fin.zero eq = begin
-[1+ n ] ≡⟨ cong (-_ ∘′ +_) eq ⟩
- + (q ℕ.* sd) ≡⟨ cong -_ (sym (pos-distrib-* q sd)) ⟩
- (+ q * + sd) ≡⟨ neg-distribˡ-* (+ q) (+ sd) ⟩
- (+ q) * + sd ≡⟨ sym (+-identityˡ (- (+ q) * + sd)) ⟩
+ 0 + - (+ q) * + sd ∎ where open ≡-Reasoning
... | NDM.result q (Fin.suc r) eq = begin
let sd = ℕ.suc d; sr = ℕ.suc (Fin.toℕ r); sq = ℕ.suc q in
-[1+ n ]
≡⟨ cong (-_ ∘′ +_) eq ⟩
- + (sr ℕ.+ q ℕ.* sd)
≡⟨ cong -_ (pos-+-commute sr (q ℕ.* sd)) ⟩
- (+ sr + + (q ℕ.* sd))
≡⟨ neg-distrib-+ (+ sr) (+ (q ℕ.* sd)) ⟩
- + sr - + (q ℕ.* sd)
≡⟨ cong (_-_ (- + sr)) (sym (pos-distrib-* q sd)) ⟩
- + sr - (+ q) * (+ sd)
≡⟨⟩
- + sr - pred (+ sq) * (+ sd)
≡⟨ cong (_-_ (- + sr)) (*-distribʳ-+ (+ sd) (- + 1) (+ sq)) ⟩
- + sr - (- (+ 1) * + sd + (+ sq * + sd))
≡⟨ cong (_+_ (- (+ sr))) (neg-distrib-+ (- (+ 1) * + sd) (+ sq * + sd)) ⟩
- + sr + (- (-[1+ 0 ] * + sd) + - (+ sq * + sd))
≡⟨ cong₂ (λ p q → - + sr + (- p + q)) (-1*n≡-n (+ sd))
(neg-distribˡ-* (+ sq) (+ sd)) ⟩
- + sr + ((- - + sd) + -[1+ q ] * + sd)
≡⟨ sym (+-assoc (- + sr) (- - + sd) (-[1+ q ] * + sd)) ⟩
(+ sd - + sr) + -[1+ q ] * + sd
≡⟨ cong (_+ -[1+ q ] * + sd) (fin-inv d r) ⟩
+ (sd ℕ.∸ sr) + -[1+ q ] * + sd
∎ where
open ≡-Reasoning
fin-inv : ∀ d (k : Fin d) → + (ℕ.suc d) - + ℕ.suc (Fin.toℕ k) ≡ + (d ℕ.∸ Fin.toℕ k)
fin-inv (ℕ.suc n) Fin.zero = refl
fin-inv (ℕ.suc n) (Fin.suc k) = ⊖-≥ {n} {Fin.toℕ k} (NProp.<⇒≤ (FProp.toℕ<n k))
[n/ℕd]*d≤n : ∀ n d {d≢0} → (n divℕ d) {d≢0} ℤ.* ℤ.+ d ℤ.≤ n
[n/ℕd]*d≤n n ℕ.zero {()}
[n/ℕd]*d≤n n (ℕ.suc d) = let q = n divℕ ℕ.suc d; r = n modℕ ℕ.suc d in begin
q ℤ.* ℤ.+ (ℕ.suc d) ≤⟨ n≤m+n r ⟩
ℤ.+ r ℤ.+ q ℤ.* ℤ.+ (ℕ.suc d) ≡⟨ sym (a≡a%ℕn+[a/ℕn]*n n (ℕ.suc d)) ⟩
n ∎ where open ≤-Reasoning
div-pos-is-divℕ : ∀ n d {d≢0} → (n div + d) {d≢0} ≡ (n divℕ d) {d≢0}
div-pos-is-divℕ n ℕ.zero {()}
div-pos-is-divℕ n (ℕ.suc d) = *-identityˡ (n divℕ ℕ.suc d)
div-neg-is-neg-divℕ : ∀ n d {d≢0} {∣d∣≢0} → (n div (- ℤ.+ d)) {∣d∣≢0} ≡ - (n divℕ d) {d≢0}
div-neg-is-neg-divℕ n ℕ.zero {()}
div-neg-is-neg-divℕ n (ℕ.suc d) = -1*n≡-n (n divℕ ℕ.suc d)
0≤n⇒0≤n/ℕd : ∀ n d {d≢0} → + 0 ℤ.≤ n → + 0 ℤ.≤ (n divℕ d) {d≢0}
0≤n⇒0≤n/ℕd (+ n) d (+≤+ m≤n) = +≤+ ℕ.z≤n
0≤n⇒0≤n/d : ∀ n d {d≢0} → + 0 ℤ.≤ n → + 0 ℤ.≤ d → + 0 ℤ.≤ (n div d) {d≢0}
0≤n⇒0≤n/d n (+ d) {d≢0} 0≤n (+≤+ 0≤d)
rewrite div-pos-is-divℕ n d {d≢0}
= 0≤n⇒0≤n/ℕd n d 0≤n
[n/d]*d≤n : ∀ n d {d≢0} → (n div d) {d≢0} ℤ.* d ℤ.≤ n
[n/d]*d≤n n (+ 0) {()}
[n/d]*d≤n n (+ ℕ.suc d) = begin let sd = ℕ.suc d in
n div + sd * + sd ≡⟨ cong (_* (+ sd)) (div-pos-is-divℕ n sd) ⟩
n divℕ sd * + sd ≤⟨ [n/ℕd]*d≤n n sd ⟩
n ∎ where open ≤-Reasoning
[n/d]*d≤n n -[1+ d ] = begin let sd = ℕ.suc d in
n div (- + sd) * - + sd ≡⟨ cong (_* (- + sd)) (div-neg-is-neg-divℕ n sd) ⟩
- (n divℕ sd) * - + sd ≡⟨ sym (neg-distribˡ-* (n divℕ sd) (- + sd)) ⟩
- (n divℕ sd * - + sd) ≡⟨ neg-distribʳ-* (n divℕ sd) (- + sd) ⟩
n divℕ sd * + sd ≤⟨ [n/ℕd]*d≤n n sd ⟩
n ∎ where open ≤-Reasoning
n<s[n/ℕd]*d : ∀ n d {d≢0} → n ℤ.< ℤ.suc ((n divℕ d) {d≢0}) ℤ.* ℤ.+ d
n<s[n/ℕd]*d n ℕ.zero {()}
n<s[n/ℕd]*d n sd@(ℕ.suc d) = begin
suc n ≡⟨ cong suc (a≡a%ℕn+[a/ℕn]*n n sd) ⟩
suc (ℤ.+ r ℤ.+ q ℤ.* +sd) ≤⟨ +-monoˡ-< (q ℤ.* +sd) {ℤ.+ r} (ℤ.+≤+ (n%ℕd<d n sd)) ⟩
+sd ℤ.+ q ℤ.* +sd ≡⟨ sym ([1+m]*n≡n+m*n q +sd) ⟩
ℤ.suc q ℤ.* +sd ∎ where
q = n divℕ sd; +sd = ℤ.+ sd; r = n modℕ sd
open ≤-Reasoning
a≡a%n+[a/n]*n : ∀ a n {≢0} → a ≡ + (a mod n) {≢0} + (a div n) {≢0} * n
a≡a%n+[a/n]*n n (+ 0) {()}
a≡a%n+[a/n]*n n (+ ℕ.suc d) = begin
let sd = ℕ.suc d; r = n modℕ sd; q = n divℕ sd; qsd = q * + sd in
n ≡⟨ a≡a%ℕn+[a/ℕn]*n n sd ⟩
+ r + qsd ≡⟨ cong (λ p → + r + p * + sd) (sym (div-pos-is-divℕ n sd)) ⟩
+ r + n div + sd * + sd ∎ where open ≡-Reasoning
a≡a%n+[a/n]*n n -[1+ d ] = begin
let sd = ℕ.suc d; r = n modℕ sd; q = n divℕ sd; qsd = q * + sd in
n ≡⟨ a≡a%ℕn+[a/ℕn]*n n sd ⟩
+ r + q * + sd ≡⟨⟩
+ r + q * - -[1+ d ] ≡⟨ cong (_+_ (+ r)) (sym (neg-distribʳ-* q -[1+ d ])) ⟩
+ r + - (q * -[1+ d ]) ≡⟨ cong (_+_ (+ r)) (neg-distribˡ-* q -[1+ d ]) ⟩
+ r + - q * -[1+ d ] ≡⟨ cong (_+_ (+ r) ∘′ (_* -[1+ d ])) (sym (-1*n≡-n q)) ⟩
+ r + n div -[1+ d ] * -[1+ d ] ∎ where open ≡-Reasoning
|
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/risc.lzh/risc/mak/kart-main-j.asm | prismotizm/gigaleak | 0 | 165692 | <reponame>prismotizm/gigaleak
Name: kart-main-j.asm
Type: file
Size: 18766
Last-Modified: '1992-11-17T01:07:17Z'
SHA-1: 9C343C23AB5716B786C2257BCAFD21A8F4CA3E22
Description: null
|
Transynther/x86/_processed/AVXALIGN/_st_/i7-8650U_0xd2_notsx.log_2849_742.asm | ljhsiun2/medusa | 9 | 2358 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/AVXALIGN/_st_/i7-8650U_0xd2_notsx.log_2849_742.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x1add8, %rbp
nop
nop
nop
nop
nop
inc %rdi
movw $0x6162, (%rbp)
nop
nop
nop
sub $17321, %rsi
lea addresses_D_ht+0x1cc38, %r10
nop
nop
nop
dec %rcx
mov $0x6162636465666768, %rbp
movq %rbp, %xmm7
vmovups %ymm7, (%r10)
nop
nop
nop
sub %rsi, %rsi
lea addresses_D_ht+0x1a8f8, %r11
nop
inc %rsi
mov (%r11), %cx
nop
nop
and $146, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r8
push %r9
push %rax
push %rbp
// Faulty Load
lea addresses_PSE+0x1b918, %r9
nop
nop
nop
nop
nop
xor $5347, %rbp
movb (%r9), %r8b
lea oracles, %rax
and $0xff, %r8
shlq $12, %r8
mov (%rax,%r8,1), %r8
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'33': 2849}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
programs/oeis/187/A187323.asm | karttu/loda | 1 | 242287 | <gh_stars>1-10
; A187323: Floor(n/2)+floor(n/3)+floor(n/4).
; 0,0,1,2,4,4,6,6,8,9,10,10,13,13,14,15,17,17,19,19,21,22,23,23,26,26,27,28,30,30,32,32,34,35,36,36,39,39,40,41,43,43,45,45,47,48,49,49,52,52,53,54,56,56,58,58,60,61,62,62,65,65,66,67,69,69,71,71,73,74,75,75,78,78,79,80,82,82,84,84,86,87,88,88,91,91,92,93,95,95,97,97,99,100,101,101,104,104,105,106,108,108,110,110,112,113,114,114,117,117,118,119,121,121,123,123,125,126,127,127,130
mov $1,$0
div $1,2
mov $2,$0
div $2,3
add $2,$1
div $1,2
add $1,$2
|
demos/primes3.ada | daveshields/AdaEd | 3 | 18667 | -- A pipeline version of the Sieve or Erastosthenes: we create a chain of tasks
-- each of which holds several primes. The main program feeds successive integers
-- into the pipe; each task tests the integer for divisibility by its own
-- primes, and passes it along to the next task if not divisible. Each task has
-- a pointer to its successor. The end of the pipeline creates a new task when
-- a new prime is discovered and its own complement of primes is full.
-- The value of max regulates the coarseness of the parallel computation.
package prime_dividers is
type int is range 1..1000000 ; -- for primes up to 10**6
task type divider is
entry my_first(x: int); -- To initialize the task.
entry maybe_prime(x: int) ; -- for successive tests.
end divider;
end prime_dividers ;
with text_io; use text_io;
package body prime_dividers is
type pointer is access divider ; -- who's next.
procedure initialize(ptr: in out pointer; value: int) is
begin
ptr := new divider ;
ptr.my_first(value) ;
end initialize;
task body divider is
max: constant := 10; -- number of primes per task.
subtype cap is integer range 1..max;
my_primes: array(cap) of int ;
last: cap := 1;
is_prime: boolean := false ;
next: pointer ;
candidate: int ;
begin
accept my_first(x:int) do
my_primes(last) := x ; -- now we know.
put_line("new task with prime: "& int'image(x)) ;
end ;
loop
select
accept maybe_prime(x: int) do
candidate := x;
is_prime := true ; -- maybe.
for i in 1..last loop
if candidate mod my_primes(i) = 0 then -- not a prime.
is_prime := false ;
exit ;
elsif my_primes(i)**2 > candidate then
exit ; -- must be prime.
end if ;
end loop ;
end maybe_prime ;
if is_prime then
if last < max then -- keep locally.
last := last +1 ;
my_primes(last) := candidate ;
put_line("new prime: "& int'image(candidate)) ;
elsif next = null then -- need new task.
initialize(next, candidate) ;
else
next.maybe_prime(candidate) ; -- needs further test.
end if ;
end if ;
or
terminate ;
end select ;
end loop;
end divider;
end prime_dividers;
with prime_dividers; use prime_dividers ;
with text_io; use text_io;
procedure main is
first_prime: divider ; -- Beginning of pipeline.
begin
first_prime.my_first(3) ; -- No need to test even numbers
for i in int range 2..2000 loop
first_prime.maybe_prime(2*i+1) ;
end loop;
end main ;
|
programs/oeis/057/A057588.asm | neoneye/loda | 22 | 94929 | <gh_stars>10-100
; A057588: Kummer numbers: -1 + product of first n consecutive primes.
; 1,5,29,209,2309,30029,510509,9699689,223092869,6469693229,200560490129,7420738134809,304250263527209,13082761331670029,614889782588491409,32589158477190044729,1922760350154212639069,117288381359406970983269,7858321551080267055879089,557940830126698960967415389,40729680599249024150621323469,3217644767340672907899084554129,267064515689275851355624017992789,23768741896345550770650537601358309
add $0,1
seq $0,2110 ; Primorial numbers (first definition): product of first n primes. Sometimes written prime(n)#.
sub $0,1
|
programs/oeis/045/A045895.asm | neoneye/loda | 22 | 103228 | ; A045895: Period length of pairs (a,b) where a has period 2n-2 and b has period n.
; 0,2,12,12,40,30,84,56,144,90,220,132,312,182,420,240,544,306,684,380,840,462,1012,552,1200,650,1404,756,1624,870,1860,992,2112,1122,2380,1260,2664,1406,2964,1560,3280,1722,3612,1892,3960,2070,4324,2256,4704,2450,5100,2652,5512,2862,5940,3080,6384,3306,6844,3540,7320,3782,7812,4032,8320,4290,8844,4556,9384,4830,9940,5112,10512,5402,11100,5700,11704,6006,12324,6320,12960,6642,13612,6972,14280,7310,14964,7656,15664,8010,16380,8372,17112,8742,17860,9120,18624,9506,19404,9900
mov $1,$0
add $0,1
dif $0,2
mul $0,$1
mul $0,2
|
Cubical/Foundations/Pointed/FunExt.agda | L-TChen/cubical | 0 | 10231 | <reponame>L-TChen/cubical
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Foundations.Pointed.FunExt where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Pointed.Base
open import Cubical.Foundations.Pointed.Properties
open import Cubical.Foundations.Pointed.Homotopy
private
variable
ℓ ℓ' : Level
module _ {A : Pointed ℓ} {B : typ A → Type ℓ'} {ptB : B (pt A)} where
-- pointed function extensionality
funExt∙P : {f g : Π∙ A B ptB} → f ∙∼P g → f ≡ g
funExt∙P (h , h∙) i .fst x = h x i
funExt∙P (h , h∙) i .snd = h∙ i
-- inverse of pointed function extensionality
funExt∙P⁻ : {f g : Π∙ A B ptB} → f ≡ g → f ∙∼P g
funExt∙P⁻ p .fst a i = p i .fst a
funExt∙P⁻ p .snd i = p i .snd
-- function extensionality is an isomorphism, PathP version
funExt∙PIso : (f g : Π∙ A B ptB) → Iso (f ∙∼P g) (f ≡ g)
Iso.fun (funExt∙PIso f g) = funExt∙P {f = f} {g = g}
Iso.inv (funExt∙PIso f g) = funExt∙P⁻ {f = f} {g = g}
Iso.rightInv (funExt∙PIso f g) p i j = p j
Iso.leftInv (funExt∙PIso f g) h _ = h
-- transformed to equivalence
funExt∙P≃ : (f g : Π∙ A B ptB) → (f ∙∼P g) ≃ (f ≡ g)
funExt∙P≃ f g = isoToEquiv (funExt∙PIso f g)
-- funExt∙≃ using the other kind of pointed homotopy
funExt∙≃ : (f g : Π∙ A B ptB) → (f ∙∼ g) ≃ (f ≡ g)
funExt∙≃ f g = compEquiv (∙∼≃∙∼P f g) (funExt∙P≃ f g)
-- standard pointed function extensionality and its inverse
funExt∙ : {f g : Π∙ A B ptB} → f ∙∼ g → f ≡ g
funExt∙ {f = f} {g = g} = equivFun (funExt∙≃ f g)
funExt∙⁻ : {f g : Π∙ A B ptB} → f ≡ g → f ∙∼ g
funExt∙⁻ {f = f} {g = g} = equivFun (invEquiv (funExt∙≃ f g))
|
oeis/084/A084010.asm | neoneye/loda-programs | 11 | 245086 | <reponame>neoneye/loda-programs
; A084010: a(n) = (2^n concatenated with Reverse(2^n))) divided by 11.
; 1,2,4,8,151,293,586,11711,23332,46565,931291,1862582,3724264,7447538,148949851,297898793,595787596,11915660921,23831312842,47662625675,953251523491,1906502047082,3813004003174,7626008006258,152520151025251
mov $1,2
pow $1,$0
mov $0,$1
lpb $0
mul $1,10
mov $2,$0
div $0,10
mod $2,10
add $1,$2
lpe
mov $0,$1
div $0,11
|
msp430x2/msp430g2452/svd/msp430_svd-port_1_2.ads | ekoeppen/MSP430_Generic_Ada_Drivers | 0 | 13356 | -- This spec has been automatically generated from out.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with System;
-- Port 1/2
package MSP430_SVD.PORT_1_2 is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- P1IN_P array
type P1IN_P_Field_Array is array (0 .. 7) of MSP430_SVD.Bit
with Component_Size => 1, Size => 8;
-- Port 1 Input
type P1IN_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- P as a value
Val : MSP430_SVD.Byte;
when True =>
-- P as an array
Arr : P1IN_P_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for P1IN_Register use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- P1OUT_P array
type P1OUT_P_Field_Array is array (0 .. 7) of MSP430_SVD.Bit
with Component_Size => 1, Size => 8;
-- Port 1 Output
type P1OUT_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- P as a value
Val : MSP430_SVD.Byte;
when True =>
-- P as an array
Arr : P1OUT_P_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for P1OUT_Register use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- P1DIR_P array
type P1DIR_P_Field_Array is array (0 .. 7) of MSP430_SVD.Bit
with Component_Size => 1, Size => 8;
-- Port 1 Direction
type P1DIR_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- P as a value
Val : MSP430_SVD.Byte;
when True =>
-- P as an array
Arr : P1DIR_P_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for P1DIR_Register use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- P1IFG_P array
type P1IFG_P_Field_Array is array (0 .. 7) of MSP430_SVD.Bit
with Component_Size => 1, Size => 8;
-- Port 1 Interrupt Flag
type P1IFG_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- P as a value
Val : MSP430_SVD.Byte;
when True =>
-- P as an array
Arr : P1IFG_P_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for P1IFG_Register use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- P1IES_P array
type P1IES_P_Field_Array is array (0 .. 7) of MSP430_SVD.Bit
with Component_Size => 1, Size => 8;
-- Port 1 Interrupt Edge Select
type P1IES_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- P as a value
Val : MSP430_SVD.Byte;
when True =>
-- P as an array
Arr : P1IES_P_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for P1IES_Register use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- P1IE_P array
type P1IE_P_Field_Array is array (0 .. 7) of MSP430_SVD.Bit
with Component_Size => 1, Size => 8;
-- Port 1 Interrupt Enable
type P1IE_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- P as a value
Val : MSP430_SVD.Byte;
when True =>
-- P as an array
Arr : P1IE_P_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for P1IE_Register use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- P1SEL_P array
type P1SEL_P_Field_Array is array (0 .. 7) of MSP430_SVD.Bit
with Component_Size => 1, Size => 8;
-- Port 1 Selection
type P1SEL_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- P as a value
Val : MSP430_SVD.Byte;
when True =>
-- P as an array
Arr : P1SEL_P_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for P1SEL_Register use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- P1REN_P array
type P1REN_P_Field_Array is array (0 .. 7) of MSP430_SVD.Bit
with Component_Size => 1, Size => 8;
-- Port 1 Resistor Enable
type P1REN_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- P as a value
Val : MSP430_SVD.Byte;
when True =>
-- P as an array
Arr : P1REN_P_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for P1REN_Register use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- P2IN_P array
type P2IN_P_Field_Array is array (0 .. 7) of MSP430_SVD.Bit
with Component_Size => 1, Size => 8;
-- Port 2 Input
type P2IN_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- P as a value
Val : MSP430_SVD.Byte;
when True =>
-- P as an array
Arr : P2IN_P_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for P2IN_Register use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- P2OUT_P array
type P2OUT_P_Field_Array is array (0 .. 7) of MSP430_SVD.Bit
with Component_Size => 1, Size => 8;
-- Port 2 Output
type P2OUT_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- P as a value
Val : MSP430_SVD.Byte;
when True =>
-- P as an array
Arr : P2OUT_P_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for P2OUT_Register use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- P2DIR_P array
type P2DIR_P_Field_Array is array (0 .. 7) of MSP430_SVD.Bit
with Component_Size => 1, Size => 8;
-- Port 2 Direction
type P2DIR_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- P as a value
Val : MSP430_SVD.Byte;
when True =>
-- P as an array
Arr : P2DIR_P_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for P2DIR_Register use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- P2IFG_P array
type P2IFG_P_Field_Array is array (0 .. 7) of MSP430_SVD.Bit
with Component_Size => 1, Size => 8;
-- Port 2 Interrupt Flag
type P2IFG_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- P as a value
Val : MSP430_SVD.Byte;
when True =>
-- P as an array
Arr : P2IFG_P_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for P2IFG_Register use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- P2IES_P array
type P2IES_P_Field_Array is array (0 .. 7) of MSP430_SVD.Bit
with Component_Size => 1, Size => 8;
-- Port 2 Interrupt Edge Select
type P2IES_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- P as a value
Val : MSP430_SVD.Byte;
when True =>
-- P as an array
Arr : P2IES_P_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for P2IES_Register use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- P2IE_P array
type P2IE_P_Field_Array is array (0 .. 7) of MSP430_SVD.Bit
with Component_Size => 1, Size => 8;
-- Port 2 Interrupt Enable
type P2IE_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- P as a value
Val : MSP430_SVD.Byte;
when True =>
-- P as an array
Arr : P2IE_P_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for P2IE_Register use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- P2SEL_P array
type P2SEL_P_Field_Array is array (0 .. 7) of MSP430_SVD.Bit
with Component_Size => 1, Size => 8;
-- Port 2 Selection
type P2SEL_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- P as a value
Val : MSP430_SVD.Byte;
when True =>
-- P as an array
Arr : P2SEL_P_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for P2SEL_Register use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-- P2REN_P array
type P2REN_P_Field_Array is array (0 .. 7) of MSP430_SVD.Bit
with Component_Size => 1, Size => 8;
-- Port 2 Resistor Enable
type P2REN_Register
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- P as a value
Val : MSP430_SVD.Byte;
when True =>
-- P as an array
Arr : P2REN_P_Field_Array;
end case;
end record
with Unchecked_Union, Size => 8, Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for P2REN_Register use record
Val at 0 range 0 .. 7;
Arr at 0 range 0 .. 7;
end record;
-----------------
-- Peripherals --
-----------------
-- Port 1/2
type PORT_1_2_Peripheral is record
-- Port 1 Input
P1IN : aliased P1IN_Register;
-- Port 1 Output
P1OUT : aliased P1OUT_Register;
-- Port 1 Direction
P1DIR : aliased P1DIR_Register;
-- Port 1 Interrupt Flag
P1IFG : aliased P1IFG_Register;
-- Port 1 Interrupt Edge Select
P1IES : aliased P1IES_Register;
-- Port 1 Interrupt Enable
P1IE : aliased P1IE_Register;
-- Port 1 Selection
P1SEL : aliased P1SEL_Register;
-- Port 1 Resistor Enable
P1REN : aliased P1REN_Register;
-- Port 2 Input
P2IN : aliased P2IN_Register;
-- Port 2 Output
P2OUT : aliased P2OUT_Register;
-- Port 2 Direction
P2DIR : aliased P2DIR_Register;
-- Port 2 Interrupt Flag
P2IFG : aliased P2IFG_Register;
-- Port 2 Interrupt Edge Select
P2IES : aliased P2IES_Register;
-- Port 2 Interrupt Enable
P2IE : aliased P2IE_Register;
-- Port 2 Selection
P2SEL : aliased P2SEL_Register;
-- Port 2 Resistor Enable
P2REN : aliased P2REN_Register;
-- Port 1 Selection 2
P1SEL2 : aliased P1SEL_Register;
-- Port 2 Selection 2
P2SEL2 : aliased P2SEL_Register;
end record
with Volatile;
for PORT_1_2_Peripheral use record
P1IN at 16#0# range 0 .. 7;
P1OUT at 16#1# range 0 .. 7;
P1DIR at 16#2# range 0 .. 7;
P1IFG at 16#3# range 0 .. 7;
P1IES at 16#4# range 0 .. 7;
P1IE at 16#5# range 0 .. 7;
P1SEL at 16#6# range 0 .. 7;
P1REN at 16#7# range 0 .. 7;
P2IN at 16#8# range 0 .. 7;
P2OUT at 16#9# range 0 .. 7;
P2DIR at 16#A# range 0 .. 7;
P2IFG at 16#B# range 0 .. 7;
P2IES at 16#C# range 0 .. 7;
P2IE at 16#D# range 0 .. 7;
P2SEL at 16#E# range 0 .. 7;
P2REN at 16#F# range 0 .. 7;
P1SEL2 at 16#21# range 0 .. 7;
P2SEL2 at 16#22# range 0 .. 7;
end record;
-- Port 1/2
PORT_1_2_Periph : aliased PORT_1_2_Peripheral
with Import, Address => PORT_1_2_Base;
end MSP430_SVD.PORT_1_2;
|
pong/src/01.asm | karng87/nasm_game | 0 | 4522 | <filename>pong/src/01.asm<gh_stars>0
bits 16
org 0x7c00
times 510 - ($-$$) db 0
;dw 0xaa55
db 0x55
db 0xaa
|
libsrc/math/genmath/poly.asm | andydansby/z88dk-mk2 | 1 | 178262 | <filename>libsrc/math/genmath/poly.asm
; Small C+ Math Library
; More polynomial evaluation
XLIB poly
LIB pushfa
LIB ldbchl
LIB fadd
LIB fmul
XREF dload
;
.POLY CALL PUSHFA
LD A,(HL)
INC HL
CALL DLOAD
DEFB $FE ;"ignore next byte"
.POL3 POP AF
POP BC
POP IX
POP DE
DEC A
RET Z
PUSH DE
PUSH IX
PUSH BC
PUSH AF
PUSH HL
CALL FMUL
POP HL
CALL LDBCHL
PUSH HL
CALL FADD
POP HL
JR POL3
;
|
libsrc/video/tms9918/stdio/ansi/bios/f_ansi_scrollup.asm | jpoikela/z88dk | 640 | 90575 | <reponame>jpoikela/z88dk<gh_stars>100-1000
;
; ANSI Video handling for the MSX
;
; Handles colors
;
; Scrollup
;
; <NAME> - Oct. 2017
;
; $Id: f_ansi_scrollup.asm $
;
SECTION code_clib
PUBLIC ansi_SCROLLUP
PUBLIC __tms9918_scroll_buffer
EXTERN __tms9918_attribute
IF FORmsx
EXTERN msxbios
INCLUDE "target/msx/def/msxbios.def"
ELSE
IF FORsvi
EXTERN msxbios
INCLUDE "target/svi/def/svibios.def"
ENDIF
ENDIF
.ansi_SCROLLUP
push ix
ld b,23
ld hl,256
.scloop
push bc
push hl
ld de,__tms9918_scroll_buffer
ld bc,256
ld ix,LDIRMV
call msxbios
pop hl
push hl
ld de,-256
add hl,de
ld de,__tms9918_scroll_buffer
ld bc,256
ex de,hl
ld ix,LDIRVM
call msxbios
pop hl
push hl
ld de,8192
add hl,de
push hl
ld de,__tms9918_scroll_buffer
ld bc,256
;ex de,hl
ld ix,LDIRMV
call msxbios
pop hl
ld de,-256
add hl,de
ld de,__tms9918_scroll_buffer
ld bc,256
ex de,hl
ld ix,LDIRVM
call msxbios
pop hl
inc h
pop bc
djnz scloop
dec h
xor a
ld bc,256
ld ix,FILVRM
call msxbios
pop ix
ret
SECTION bss_clib
__tms9918_scroll_buffer: defs 256
|
hookflash-core/webRTC/webRTC_ios/third_party/libvpx/source/config/linux/arm-neon/asm_enc_offsets.asm | ilin-in/OP | 1 | 12667 | <gh_stars>1-10
@ This file was created from a .asm file
@ using the ads2gas.pl script.
.equ DO1STROUNDING, 0
.equ vp8_block_coeff , 4
.equ vp8_block_zbin , 20
.equ vp8_block_round , 28
.equ vp8_block_quant , 8
.equ vp8_block_quant_fast , 12
.equ vp8_block_zbin_extra , 32
.equ vp8_block_zrun_zbin_boost , 24
.equ vp8_block_quant_shift , 16
.equ vp8_blockd_qcoeff , 0
.equ vp8_blockd_dequant , 12
.equ vp8_blockd_dqcoeff , 4
.equ vp8_blockd_eob , 20
.equ vp8_block_base_src , 36
.equ vp8_block_src , 40
.equ vp8_block_src_diff , 0
.equ vp8_block_src_stride , 44
.equ vp8_blockd_predictor , 8
.equ vp8_writer_lowvalue , 0
.equ vp8_writer_range , 4
.equ vp8_writer_count , 8
.equ vp8_writer_pos , 12
.equ vp8_writer_buffer , 16
.equ vp8_writer_buffer_end , 20
.equ vp8_writer_error , 24
.equ tokenextra_token , 6
.equ tokenextra_extra , 4
.equ tokenextra_context_tree , 0
.equ tokenextra_skip_eob_node , 7
.equ TOKENEXTRA_SZ , 8
.equ vp8_extra_bit_struct_sz , 16
.equ vp8_token_value , 0
.equ vp8_token_len , 4
.equ vp8_extra_bit_struct_tree , 0
.equ vp8_extra_bit_struct_prob , 4
.equ vp8_extra_bit_struct_len , 8
.equ vp8_extra_bit_struct_base_val , 12
.equ vp8_comp_tplist , 167104
.equ vp8_comp_common , 103296
.equ vp8_comp_bc , 112656
.equ vp8_writer_sz , 36
.equ tokenlist_start , 0
.equ tokenlist_stop , 4
.equ TOKENLIST_SZ , 8
.equ vp8_common_mb_rows , 2392
.section .note.GNU-stack,"",%progbits
|
library/fmGUI_ManageFunctions/fmGUI_CustomFunctions_FunctionNames.applescript | NYHTC/applescript-fm-helper | 1 | 1195 | <filename>library/fmGUI_ManageFunctions/fmGUI_CustomFunctions_FunctionNames.applescript
-- fmGUI_CustomFunctions_FunctionNames({})
-- <NAME>, NYHTC
-- get name of every function
(*
HISTORY:
1.2 - 2016-06-30 ( eshagdar ): wait for the window to appear.
1.1 -
1.0 - created
REQUIRES:
fmGUI_ManageDb_GoToTab
*)
on run
fmGUI_CustomFunctions_FunctionNames({})
end run
--------------------
-- START OF CODE
--------------------
on fmGUI_CustomFunctions_FunctionNames(prefs)
-- version 1.1
try
fmGUI_CustomFunctions_Open({})
tell application "System Events"
tell application process "FileMaker Pro Advanced"
value of static text 1 of every row of table 1 of scroll area 1 of window 1
end tell
end tell
return result
on error errMsg number errNum
error "Couldn't get names of custom functions - " & errMsg number errNum
end try
end fmGUI_CustomFunctions_FunctionNames
--------------------
-- END OF CODE
--------------------
on fmGUI_CustomFunctions_Open(prefs)
tell application "htcLib" to fmGUI_CustomFunctions_Open(prefs)
end fmGUI_CustomFunctions_Open
|
src/drivers/dmac_u2503/sam-dmac.ads | Fabien-Chouteau/samd51-hal | 1 | 26333 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2019, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with HAL;
with System;
package SAM.DMAC is
type Descriptor_Section;
type Descriptor_Section_Access is access all Descriptor_Section;
-- See definition below
procedure Enable (Descriptors : not null Descriptor_Section_Access;
Write_Back : not null Descriptor_Section_Access);
procedure Disable;
type Channel_Id is range 0 .. 31;
type Priority_Level is range 0 .. 3;
-- Priority level used for the DMA channel, where a high level has priority
-- over a low level.
type Trigger_Source is new HAL.UInt7;
-- See child package SAM.DMAC.Sources
type Trigger_Action is (Block, Burst, Transaction);
-- Trigger action used for a transfer
type FIFO_Threshold_Kind is (BEAT_1, BEAT_2, BEAT_4, BEAT_8);
-- Threshold from which the DMA starts to write to the destination. These
-- bits have no effect in the case of single beat transfers.
type Burst_Length is range 1 .. 16;
-- Channel actions --
procedure Configure (Id : Channel_Id;
Trig_Src : Trigger_Source;
Trig_Action : Trigger_Action;
Priority : Priority_Level;
Burst_Len : Burst_Length;
Threshold : FIFO_Threshold_Kind;
Run_In_Standby : Boolean);
procedure Enable (Id : Channel_Id);
procedure Suspend (Id : Channel_Id);
procedure Resume (Id : Channel_Id);
procedure Software_Trigger (Id : Channel_Id);
-- Channel Status --
function Pending (Id : Channel_Id) return Boolean;
function Busy (Id : Channel_Id) return Boolean;
function Fetch_Error (Id : Channel_Id) return Boolean;
function CRC_Error (Id : Channel_Id) return Boolean;
-- Channel Interrupts --
type Interrupt_Kind is (Suspend, Transfer_Complete, Transfer_Error);
procedure Enable (Id : Channel_Id; Int : Interrupt_Kind);
procedure Disable (Id : Channel_Id; Int : Interrupt_Kind);
procedure Clear (Id : Channel_Id; Int : Interrupt_Kind);
function Set (Id : Channel_Id; Int : Interrupt_Kind) return Boolean;
-- Transfer Descriptor --
type Transfer_Descriptor is private;
-- Transfer_Descriptor is declared private because setting its values is not
-- trivial (address increments in particular). Use Configure_Descriptor ()
-- and Set_Data_Transfer () to write a Transfer_Descriptor;
type Transfer_Descriptor_Access is access all Transfer_Descriptor;
type Event_Output_Kind is
(Disable, -- Event generation disabled
Block, -- Event strobe when block transfer complete
Beat) -- Event strobe when beat transfer complete
with Size => 2;
type Block_Action_Kind is
(No_Action,
-- Channel will be disabled if it is the last block transfer in the
-- transaction.
Interrupt,
-- Channel will be disabled if it is the last block transfer in the
-- transaction and block interrupt.
Suspend,
-- Channel suspend operation is completed
Both
-- Both channel suspend operation and block interrupt
)
with Size => 2;
type Beat_Size_Kind is (B_8bit, B_16bit, B_32bit)
with Size => 2;
type Step_Selection_Kind is (Destination, Source)
with Size => 1;
type Step_Size_Kind is (X1, X2, X4, X8, X16, X32, X64, X128)
with Size => 3;
type Descriptor_Section is array (Channel_Id) of Transfer_Descriptor;
procedure Configure_Descriptor
(Desc : in out Transfer_Descriptor;
Valid : Boolean;
Event_Output : Event_Output_Kind;
Block_Action : Block_Action_Kind;
Beat_Size : Beat_Size_Kind;
Src_Addr_Inc : Boolean;
Dst_Addr_Inc : Boolean;
Step_Selection : Step_Selection_Kind;
Step_Size : Step_Size_Kind;
Next_Descriptor : Transfer_Descriptor_Access := null);
procedure Set_Data_Transfer
(Desc : in out Transfer_Descriptor;
Block_Transfer_Count : HAL.UInt16;
Src_Addr : System.Address;
Dst_Addr : System.Address);
private
pragma Inline (Configure_Descriptor);
pragma Inline (Set_Data_Transfer);
pragma Inline (Enable);
for Trigger_Action use (Block => 0,
Burst => 2,
Transaction => 3);
for FIFO_Threshold_Kind use (BEAT_1 => 0,
BEAT_2 => 2,
BEAT_4 => 3,
BEAT_8 => 4);
for Event_Output_Kind use
(Disable => 0,
Block => 1,
Beat => 3);
for Block_Action_Kind use
(No_Action => 0,
Interrupt => 1,
Suspend => 2,
Both => 3);
for Beat_Size_Kind use
(B_8bit => 0,
B_16bit => 1,
B_32bit => 2);
for Step_Selection_Kind use
(Destination => 0,
Source => 1);
for Step_Size_Kind use
(X1 => 0,
X2 => 1,
X4 => 2,
X8 => 3,
X16 => 4,
X32 => 5,
X64 => 6,
X128 => 7);
type Transfer_Descriptor is record
Valid : Boolean := False;
Event_Output : Event_Output_Kind;
Block_Action : Block_Action_Kind;
Set_To_Zero : HAL.UInt3 := 0;
Beat_Size : Beat_Size_Kind;
Src_Addr_Inc : Boolean;
Dst_Addr_Inc : Boolean;
Step_Selection : Step_Selection_Kind;
Step_Size : Step_Size_Kind;
Block_Transfer_Count : HAL.UInt16;
Src_Addr : System.Address;
Dst_Addr : System.Address;
Next_Descriptor : Transfer_Descriptor_Access := null;
end record
with Volatile, Size => 128, Alignment => 8;
for Transfer_Descriptor use record
Valid at 16#0# range 0 .. 0;
Event_Output at 16#0# range 1 .. 2;
Block_Action at 16#0# range 3 .. 4;
Set_To_Zero at 16#0# range 5 .. 7;
Beat_Size at 16#0# range 8 .. 9;
Src_Addr_Inc at 16#0# range 10 .. 10;
Dst_Addr_Inc at 16#0# range 11 .. 11;
Step_Selection at 16#0# range 12 .. 12;
Step_Size at 16#0# range 13 .. 15;
Block_Transfer_Count at 16#2# range 0 .. 15;
Src_Addr at 16#4# range 0 .. 31;
Dst_Addr at 16#8# range 0 .. 31;
Next_Descriptor at 16#C# range 0 .. 31;
end record;
for Descriptor_Section'Alignment use 128;
for Descriptor_Section'Size use 32 * 128;
end SAM.DMAC;
|
iod/con2/sprite/f11.asm | olifink/smsqe | 0 | 4577 | * Sprite f11
*
* Mode 4
* +|---------+
* -ggg g g -
* |g gg gg |
* |g g g |
* |gg g g |
* |g g g |
* |g g g |
* |g g g |
* +|---------+
*
section sprite
xdef sp_f11
xref sp_zero
sp_f11
dc.w $0100,$0000
dc.w 8,7,0,0
dc.l sc4_f11-*
dc.l sp_zero-*
dc.l 0
sc4_f11
dc.w $E900,$0000
dc.w $9B00,$0000
dc.w $8900,$0000
dc.w $C900,$0000
dc.w $8900,$0000
dc.w $8900,$0000
dc.w $8900,$0000
*
end
|
oeis/136/A136506.asm | neoneye/loda-programs | 11 | 242191 | ; A136506: a(n) = binomial(2^n + 2, n).
; 1,4,15,120,3060,278256,90858768,105637584000,436355999662176,6431591598617108352,340881559632021623909760,65533747894341651530074060800,46081376018330435634530315478453248,119407315859076545156072563863598431096832,1147626132510941351319215538540322118180599296000,41139144824238986401108861452631188683244465499938914304,5526829861748872637260376979518662055700262774391551021113569280,2794230646819660318264319632120902138818188970997202090567437577772580864
mov $1,2
pow $1,$0
add $1,2
bin $1,$0
mov $0,$1
|
src/firmware-tests/Platform/Smps/IsSmpsEnabledStub.asm | pete-restall/Cluck2Sesame-Prototype | 1 | 96762 | <reponame>pete-restall/Cluck2Sesame-Prototype
#include "Platform.inc"
#include "TestDoubles.inc"
radix decimal
SmpsRam udata
stubReturnValue res 1
IsSmpsEnabledStub code
global initialiseIsSmpsEnabledStub
global isSmpsEnabled
initialiseIsSmpsEnabledStub:
banksel stubReturnValue
movwf stubReturnValue
return
isSmpsEnabled:
banksel stubReturnValue
movf stubReturnValue, W
return
end
|
oeis/025/A025440.asm | neoneye/loda-programs | 11 | 243934 | ; A025440: Expansion of 1/((1-2x)(1-3x)(1-4x)(1-6x)).
; Submitted by <NAME>
; 1,15,145,1155,8281,55755,360865,2276835,14126761,86681595,527948785,3199656915,19327384441,116486845035,701025539905,4214614099395,25321657045321,152066219226075,912943584910225,5479850073412275,32887865154533401,197362281160304715
mov $1,1
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
mul $1,2
sub $2,1
sub $0,$2
seq $0,16765 ; Expansion of 1/((1-3*x)*(1-4*x)*(1-6*x)).
add $1,$0
lpe
mov $0,$1
|
bootloader/util/io.asm | li--paul/micos | 1 | 164505 | ;
; IO 相关
;
; treelite(<EMAIL>)
;
; 从软盘读取扇区
; 使用 LAB 方式
;
; params:
; {dw} 扇区数
; {dw} 起始扇区编号
; es:bx 缓冲区地址
readSector:
push bp
; 保存当前的栈顶指针
; 方便后续访问调用参数
mov bp, sp
push ax
push cx
push dx
; 获取起始扇区编号参数
mov ax, [bp + 4]
mov dx, 0
; 计算磁头编号
div word [FL_H_LEN]
push dx
mov dh, al
; 设置磁道编号
pop ax
div byte [FL_C_LEN]
mov ch, al
; 设置起始扇区编号
add ah, 1
mov cl, ah
; 设置驱动器为软盘
mov dl, 0
; 设置需要读取的扇区数
mov al, [bp + 6]
; 设置磁盘读取的功能号
mov ah, 2
; 调用 BIOS 磁盘服务
; 对外部存储设备进行操作
int 13h
pop dx
pop cx
pop ax
pop bp
; 从栈上释放4字节的函数参数
ret 4
; 扇区大小
SECTOR_LEN dw 512
; 单磁头的扇区数
FL_H_LEN dw 1440
; 单磁道的扇区数
FL_C_LEN db 18
|
lemmas-freshness.agda | hazelgrove/hazelnut-agda | 0 | 4925 | <filename>lemmas-freshness.agda
open import Prelude
open import Nat
open import dynamics-core
open import contexts
open import lemmas-disjointness
module lemmas-freshness where
-- if x is fresh in an hexp, it's fresh in its expansion
mutual
fresh-elab-synth1 : ∀{x e τ d Γ Δ} →
x # Γ →
freshh x e →
Γ ⊢ e ⇒ τ ~> d ⊣ Δ →
fresh x d
fresh-elab-synth1 apt FHNum ESNum = FNum
fresh-elab-synth1 apt (FRHPlus x x₄) (ESPlus gapt x₁ x₂ x₃) =
FPlus (FCast (fresh-elab-ana1 apt x x₂))
(FCast (fresh-elab-ana1 apt x₄ x₃))
fresh-elab-synth1 apt (FRHAsc frsh) (ESAsc x₁) = FCast (fresh-elab-ana1 apt frsh x₁)
fresh-elab-synth1 _ (FRHVar x₂) (ESVar x₃) = FVar x₂
fresh-elab-synth1 {Γ = Γ} apt (FRHLam2 x₂ frsh) (ESLam x₃ exp) = FLam x₂ (fresh-elab-synth1 (apart-extend1 Γ x₂ apt) frsh exp)
fresh-elab-synth1 apt (FRHAp frsh frsh₁) (ESAp x₁ x₂ x₃ x₄ x₅ x₆) = FAp (FCast (fresh-elab-ana1 apt frsh x₅)) (FCast (fresh-elab-ana1 apt frsh₁ x₆))
fresh-elab-synth1 apt (FRHPair frsh frsh₁) (ESPair x x₁ x₂ x₃) = FPair (fresh-elab-synth1 apt frsh x₂) (fresh-elab-synth1 apt frsh₁ x₃)
fresh-elab-synth1 apt (FRHFst frsh) (ESFst x x₁ x₂) = FFst (FCast (fresh-elab-ana1 apt frsh x₂))
fresh-elab-synth1 apt (FRHSnd frsh) (ESSnd x x₁ x₂) = FSnd (FCast (fresh-elab-ana1 apt frsh x₂))
fresh-elab-synth1 apt FRHEHole ESEHole = FHole (EFId apt)
fresh-elab-synth1 apt (FRHNEHole frsh) (ESNEHole x₁ exp) = FNEHole (EFId apt) (fresh-elab-synth1 apt frsh exp)
fresh-elab-ana1 : ∀{x e τ d τ' Γ Δ} →
x # Γ →
freshh x e →
Γ ⊢ e ⇐ τ ~> d :: τ' ⊣ Δ →
fresh x d
fresh-elab-ana1 {Γ = Γ} apt (FRHLam1 x₁ frsh) (EALam x₂ x₃ exp) = FLam x₁ (fresh-elab-ana1 (apart-extend1 Γ x₁ apt) frsh exp )
fresh-elab-ana1 apt frsh (EASubsume x₁ x₂ x₃ x₄) = fresh-elab-synth1 apt frsh x₃
fresh-elab-ana1 apt (FRHInl frsh) (EAInl x x₁) = FInl (fresh-elab-ana1 apt frsh x₁)
fresh-elab-ana1 apt (FRHInr frsh) (EAInr x x₁) = FInr (fresh-elab-ana1 apt frsh x₁)
fresh-elab-ana1 {Γ = Γ} apt (FRHCase frsh x₁ frsh₁ x₂ frsh₂) (EACase x x₃ x₄ x₅ x₆ x₇ x₈ x₉ x₁₀ x₁₁ x₁₂ x₁₃) = FCase (FCast (fresh-elab-synth1 apt frsh x₁₀)) x₁ (FCast (fresh-elab-ana1 (apart-extend1 Γ x₁ apt) frsh₁ x₁₂)) x₂ (FCast (fresh-elab-ana1 (apart-extend1 Γ x₂ apt) frsh₂ x₁₃))
fresh-elab-ana1 apt FRHEHole EAEHole = FHole (EFId apt)
fresh-elab-ana1 apt (FRHNEHole frsh) (EANEHole x₁ x₂) = FNEHole (EFId apt) (fresh-elab-synth1 apt frsh x₂)
-- if x is fresh in the expansion of an hexp, it's fresh in that hexp
mutual
fresh-elab-synth2 : ∀{x e τ d Γ Δ} →
fresh x d →
Γ ⊢ e ⇒ τ ~> d ⊣ Δ →
freshh x e
fresh-elab-synth2 FNum ESNum = FRHNum
fresh-elab-synth2 (FPlus (FCast x) (FCast x₄)) (ESPlus apt x₁ x₂ x₃) =
FRHPlus (fresh-elab-ana2 x x₂) (fresh-elab-ana2 x₄ x₃)
fresh-elab-synth2 (FVar x₂) (ESVar x₃) = FRHVar x₂
fresh-elab-synth2 (FLam x₂ frsh) (ESLam x₃ exp) = FRHLam2 x₂ (fresh-elab-synth2 frsh exp)
fresh-elab-synth2 (FAp (FCast frsh) (FCast frsh₁)) (ESAp x₁ x₂ x₃ x₄ x₅ x₆) = FRHAp (fresh-elab-ana2 frsh x₅) (fresh-elab-ana2 frsh₁ x₆)
fresh-elab-synth2 (FPair frsh frsh₁) (ESPair x x₁ x₂ x₃) = FRHPair (fresh-elab-synth2 frsh x₂) (fresh-elab-synth2 frsh₁ x₃)
fresh-elab-synth2 (FFst (FCast frsh)) (ESFst x x₁ x₂) = FRHFst (fresh-elab-ana2 frsh x₂)
fresh-elab-synth2 (FSnd (FCast frsh)) (ESSnd x x₁ x₂) = FRHSnd (fresh-elab-ana2 frsh x₂)
fresh-elab-synth2 (FHole x₁) ESEHole = FRHEHole
fresh-elab-synth2 (FNEHole x₁ frsh) (ESNEHole x₂ exp) = FRHNEHole (fresh-elab-synth2 frsh exp)
fresh-elab-synth2 (FCast frsh) (ESAsc x₁) = FRHAsc (fresh-elab-ana2 frsh x₁)
fresh-elab-ana2 : ∀{ x e τ d τ' Γ Δ} →
fresh x d →
Γ ⊢ e ⇐ τ ~> d :: τ' ⊣ Δ →
freshh x e
fresh-elab-ana2 (FLam x₁ frsh) (EALam x₂ x₃ exp) = FRHLam1 x₁ (fresh-elab-ana2 frsh exp)
fresh-elab-ana2 frsh (EASubsume x₁ x₂ x₃ x₄) = fresh-elab-synth2 frsh x₃
fresh-elab-ana2 (FHole x₁) EAEHole = FRHEHole
fresh-elab-ana2 (FNEHole x₁ frsh) (EANEHole x₂ x₃) = FRHNEHole (fresh-elab-synth2 frsh x₃)
fresh-elab-ana2 (FInl frsh) (EAInl x x₁) = FRHInl (fresh-elab-ana2 frsh x₁)
fresh-elab-ana2 (FInr frsh) (EAInr x x₁) = FRHInr (fresh-elab-ana2 frsh x₁)
fresh-elab-ana2 (FCase (FCast frsh) x (FCast frsh₁) x₁ (FCast frsh₂)) (EACase x₂ x₃ x₄ x₅ x₆ x₇ x₈ x₉ x₁₀ x₁₁ x₁₂ x₁₃) = FRHCase (fresh-elab-synth2 frsh x₁₀) x (fresh-elab-ana2 frsh₁ x₁₂) x₁ (fresh-elab-ana2 frsh₂ x₁₃)
|
src/main/fragment/mos6502-common/vwsm1=vbsaa.asm | jbrandwood/kickc | 2 | 86978 | sta {m1}
and #$80
beq !+
lda #$ff
!:
sta {m1}+1 |
scripts/sleep.applescript | epochblue/annoy-a-tron | 63 | 1365 | <filename>scripts/sleep.applescript
#!/usr/bin/env osascript
tell application "Finder" to sleep
|
programs/oeis/177/A177277.asm | karttu/loda | 0 | 18811 | ; A177277: Partial sums of round(n^2/28).
; 0,0,0,0,1,2,3,5,7,10,14,18,23,29,36,44,53,63,75,88,102,118,135,154,175,197,221,247,275,305,337,371,408,447,488,532,578,627,679,733,790,850,913,979,1048,1120,1196,1275,1357,1443,1532,1625,1722,1822,1926,2034,2146,2262,2382,2506,2635,2768,2905,3047,3193,3344,3500,3660,3825,3995,4170,4350,4535,4725,4921,5122,5328,5540,5757,5980,6209,6443,6683,6929,7181,7439,7703,7973,8250,8533,8822,9118,9420,9729,10045,10367,10696,11032,11375,11725,12082,12446,12818,13197,13583,13977,14378,14787,15204,15628,16060,16500,16948,17404,17868,18340,18821,19310,19807,20313,20827,21350,21882,22422,22971,23529,24096,24672,25257,25851,26455,27068,27690,28322,28963,29614,30275,30945,31625,32315,33015,33725,34445,35175,35916,36667,37428,38200,38982,39775,40579,41393,42218,43054,43901,44759,45628,46508,47400,48303,49217,50143,51080,52029,52990,53962,54946,55942,56950,57970,59002,60046,61103,62172,63253,64347,65453,66572,67704,68848,70005,71175,72358,73554,74763,75985,77221,78470,79732,81008,82297,83600,84917,86247,87591,88949,90321,91707,93107,94521,95950,97393,98850,100322,101808,103309,104825,106355,107900,109460,111035,112625,114230,115850,117486,119137,120803,122485,124182,125895,127624,129368,131128,132904,134696,136504,138328,140168,142025,143898,145787,147693,149615,151554,153510,155482,157471,159477,161500,163540,165597,167671,169763,171872,173998,176142,178303,180482,182679,184893
mov $2,$0
mov $3,$0
lpb $2,1
mov $0,$3
sub $2,1
sub $0,$2
mov $4,$0
mul $4,$0
div $4,4
add $4,4
div $4,7
add $1,$4
lpe
|
examples/testbench.asm | puradox/riscv-tools | 4 | 177158 | # Testbench provided by Ronak
and x0, x0, x0 -> 0x0 # x0
addi x1, x0, 1 -> 0x1 # x1
addi x2, x0, 2 -> 0x2 # x2
addi x3, x1, 3 -> 0x4 # x3
addi x4, x1, 4 -> 0x5 # x4
addi x5, x2, 5 -> 0x7 # x5
addi x6, x2, 6 -> 0x8 # x6
addi x7, x3, 7 -> 0xB # x7
add x8, x1, x2 -> 0x3 # x8
sub x9, x8, x4 -> 0xfffffffe # x9 = -2
and x10, x2, x3 -> 0x0 # x10
or x11, x3, x4 -> 0x5 # x11
beq x4, x11, 36 -> 0x0 # branch taken to inst_mem[21]
addi x8, x1, 0 -> 0x1 # x8
bgeu x9, x7, -36 -> 0x0 # branch taken to inst_mem[13]
addi x8, x1, 1 -> 0x2 # x8
bne x3, x4, 20 -> 0xffffffff # branch taken to inst_mem[19]
addi x8, x1, 2 -> 0x3 # x8
bltu x2, x5, -24 -> 0x1 # branch taken to inst_mem[15]
addi x8, x1, 3 -> 0x4 # x8
blt x9, x1, 4 -> 0x1 # branch taken to inst_mem[17]
addi x8, x1, 4 -> 0x5 # x8
bge x7, x11, 20 -> 0x0 # branch taken to inst_mem[23]
or x13, x7, x8 -> 0xf # x13
jal x11, 24 -> 0x64 # jump to inst[30]
xor x15, x5, x7 -> 0xc # x15
srl x16, x6, x2 -> 0x2 # x16
sra x17, x9, x3 -> 0xffffffff # x17
jalr x13, 0(x11) -> 0x88 # branch taken to inst_mem[25]
sw x10, 48(x0) -> 0x30
sw x8, 352(x0) -> 0x160
lw x12, 48(x0) -> 0x0
sll x14, x2, x3 -> 0x20 # x14
beq x12, x10, 20 -> 0x0 # branch taken to inst_mem[34]
xori x10, x2, 22 -> 0x14 # x10
ori x11, x5, 46 -> 0x2f # x11
andi x12, x6, 111 -> 0x8 # x12
slli x13, x9, 3 -> 0xfffffff0 # x13
srli x14, x6, 3 -> 0x1 # x14
srai x15, x13, 2 -> 0xfffffffc # x15
slt x16, x17,x10 -> 0x1 # x16
sltu x16, x9, x10 -> 0x0 # x16
slti x16, x9, 2 -> 0x1 # x16
sltiu x16, x9, 2 -> 0x0 # x16
lui x16, 0xccccc000 -> 0xccccc000 # x16
auipc x16, 0xccccc000 -> 0xccccc0b4 # x16
sw x9, 20(x0) -> 0x14
lw x2, 20(x0) -> 0xfffffffe # x2
lb x3, 20(x0) -> 0xfffffffe # x3
lh x4, 20(x0) -> 0xfffffffe # x4
lbu x5, 20(x0) -> 0x000000fe # x5
lhu x6, 20(x0) -> 0x0000fffe # x6
slli x13, x11, 4 -> 0x2f0 # x13
sb x13, 40(x0) -> 0x28
lw x14, 40(x0) -> 0xfffffff0 # x14
sh x13, 40(x0) -> 0x28
lw x13, 40(x0) -> 0x000002f0 # x13
|
asm/halt.asm | spratt/lc2.js | 1 | 2368 | <gh_stars>1-10
;;; halt.asm
;;; HALT service routine (system call)
;;; adapted from Figure 9.6, Patt & Patel
.orig 0xfd70
st r7, SaveR7 ; Save linkage back to program
st r0, SaveR0
st r1, SaveR1
;;; Print message that the machine is halting
ld r0, nl
out
lea r0, msg
puts
ld r0, nl
out
;;; clear bit at $FFFF to stop the machine
ldi r1, MCR
ld r0, MASK
and r0, r1, r0 ; clear top bit
sti r0, MCR
;;; return from HALT routine
;;; Should never happen.
ld r0, SaveR0
ld r1, SaveR1
ld r7, SaveR7
ret
nl: .fill 0x000a ; ASCII newline
SaveR0: .fill 0x0000
SaveR1: .fill 0x0000
SaveR7: .fill 0x0000
msg: .stringz "Halting the machine."
MCR: .fill 0xffff
MASK: .fill 0x7fff
.end
|
test/parsing-test/protypo-parsing-test.adb | fintatarta/protypo | 0 | 30708 | with Protypo.Scanning;
with Protypo.Code_Trees;
with Protypo.Api.Interpreters; use Protypo.Api.Interpreters;
procedure Protypo.Parsing.Test is
S : constant Template_Type := Slurp ("test-data/parsing.txt");
Tk : Scanning.Token_List := Scanning.Tokenize (S, "");
Code : Code_Trees.Parsed_Code;
-- pragma Unreferenced (Code);
begin
Scanning.Dump (Tk);
Code := Parse_Statement_Sequence (Tk);
Code_Trees.Dump (Code);
end Protypo.Parsing.Test;
|
beast/core/antlrgrammars/FormalPropertyDescription.g4 | VeriVote/BEAST | 3 | 6098 | <gh_stars>1-10
grammar FormalPropertyDescription;
booleanExpList : booleanExpListElement*;
booleanExpListElement : booleanExp ';';
booleanExp : quantorExp | binaryRelationExp | notExp | comparisonExp | OpenBracket booleanExp ClosedBracket;
binaryRelationExp : binaryRelationExp BinaryRelationSymbol booleanExp |
quantorExp BinaryRelationSymbol booleanExp |
notExp BinaryRelationSymbol booleanExp |
comparisonExp BinaryRelationSymbol booleanExp |
'(' binaryRelationExp ')' BinaryRelationSymbol booleanExp |
'(' quantorExp ')' BinaryRelationSymbol booleanExp |
'(' notExp ')' BinaryRelationSymbol booleanExp |
'(' comparisonExp ')' BinaryRelationSymbol booleanExp;
quantorExp : Quantor passSymbVar ':' booleanExp;
notExp : '!' booleanExp;
comparisonExp : typeExp ComparisonSymbol typeExp;
typeExp : electExp | voteExp | numberExpression | symbolicVarExp | typeByPosExp;
numberExpression : '(' numberExpression ')' |
numberExpression Mult numberExpression |
numberExpression Add numberExpression |
voteSumExp |
voteSumUniqueExp |
constantExp |
integer;
typeByPosExp : voterByPosExp | candByPosExp | seatByPosExp;
voterByPosExp : 'VOTER_AT_POS' passPosition;
candByPosExp : 'CAND_AT_POS' passPosition;
seatByPosExp : 'SEAT_AT_POS' passPosition;
integer : Integer;
electExp : Elect passType*;
voteExp : Vote passType*;
passType: passSymbVar|passByPos;
constantExp : 'V' | 'C' | 'S';
voteSumExp : Votesum passType;
voteSumUniqueExp : VotesumUnique passType;
passSymbVar : OpenBracket symbolicVarExp ClosedBracket;
passPosition : OpenBracket numberExpression ClosedBracket;
passByPos : OpenBracket typeByPosExp ClosedBracket;
symbolicVarExp : Identifier;
//Lexer
Mult : '*'|'/';
Add : '+'|'-';
Vote : 'VOTES' Integer;
Elect : 'ELECT' Integer;
Votesum : 'VOTE_SUM_FOR_CANDIDATE' Integer;
VotesumUnique : 'VOTE_SUM_FOR_UNIQUE_CANDIDATE' Integer;
ClosedBracket : ')';
OpenBracket : '(';
Quantor : 'FOR_ALL_VOTERS' | 'FOR_ALL_CANDIDATES' | 'FOR_ALL_SEATS' |
'EXISTS_ONE_VOTER' | 'EXISTS_ONE_CANDIDATE' | 'EXISTS_ONE_SEAT';
ComparisonSymbol : '==' | '!=' | '<=' | '>=' | '<' | '>';
BinaryRelationSymbol : '&&' | '||' | '==>' | '<==>';
Integer : Digit+;
// same rules as C
Identifier
: IdentifierNondigit
( IdentifierNondigit
| Digit
)*
;
fragment
IdentifierNondigit
: Nondigit
| UniversalCharacterName
//| // other implementation-defined characters...
;
fragment
Nondigit
: [a-zA-Z_]
;
fragment
Digit
: [0-9]
;
fragment
UniversalCharacterName
: '\\u' HexQuad
| '\\U' HexQuad HexQuad
;
fragment
HexQuad
: HexadecimalDigit HexadecimalDigit HexadecimalDigit HexadecimalDigit
;
fragment
HexadecimalDigit
: [0-9a-fA-F]
;
Whitespace
: [ \t]+
-> skip
;
Newline
: ( '\r' '\n'?
| '\n'
)
-> skip
;
BlockComment
: '/*' .*? '*/'
-> skip
;
LineComment
: '//' ~[\r\n]*
-> skip
;
|
oeis/092/A092290.asm | neoneye/loda-programs | 11 | 85389 | ; A092290: Decimal expansion of solution to n/x = x-n for n = 7.
; Submitted by <NAME>
; 7,8,8,7,4,8,2,1,9,3,6,9,6,0,6,1,0,3,0,2,0,3,1,9,4,1,5,3,7,0,8,1,5,4,7,8,0,4,3,7,9,3,8,4,1,3,7,7,7,2,5,1,7,9,5,4,6,3,8,4,7,8,1,4,8,9,1,3,8,2,3,2,3,1,0,9,6,5,3,1,4,0,8,3,7,8,4,6,5,7,8,5,3,4,3,5,2,8,7,7
mov $1,1
mov $3,$0
mul $3,3
lpb $3
add $1,$2
add $2,$1
mul $1,6
add $2,$1
dif $1,6
sub $3,1
mov $4,10
pow $4,$0
lpe
mul $1,7
mov $5,$4
cmp $5,0
add $4,$5
div $2,$4
add $2,$5
div $1,$2
mov $0,$1
mod $0,10
|
src/001/greeter.ads | xeenta/learning-ada | 0 | 22060 | <gh_stars>0
package Greeter is
X : Integer := 1000;
pragma Assertion_Policy (Check);
procedure Greet (S : String)
with Pre => S'Length > 0;
private
Hi_Text : constant String := "Hi ";
end Greeter;
|
getPixel.asm | J0nnyCheese/PNG-Reader | 0 | 177310 |
.data
out_of_bound: .asciiz "Error in getPixel: pixel index out of bound. Program terminate."
.text
.globl get_pixel
get_pixel:
# $a0 -> image struct
# $a1 -> row number - i
# $a2 -> column number - j
################return##################
# $v0 -> value of image at (row,column) start at (0,0)
#######################################
# Add Code
move $s1, $a0 # $s1 = address of struct
#mult $a1, $a2
#mflo $s2 # $s2 offset to the first pixel
addi $s1, $s1, -4
lw $s3, ($s1) # $s3 = width = 24
addi $s1, $s1, -4
lw $s4, ($s1) # $s4 = height = 7
mult $s3, $s4
mflo $t1 # $t1 = width * height
addi $s1, $s1, -4 # $s1 align with the start of pixel
mult $a1, $s3
mflo $t0 # $t0 = i* width
add $t0, $t0, $a2 # $t0 = i * width + j
# if (i,j) if out of bound -> error; else get value
slt $t2, $t0, $t1
bne $t2, 1, error_out_of_bound
sub $s1, $s1, $t0
lb $v0, ($s1) # value of image at (i,j) = $v0
jr $ra
error_out_of_bound:
li $v0, 4
la $a0, out_of_bound
syscall
li $v0, 10
syscall
|
src/CF/Compile.agda | ajrouvoet/jvm.agda | 6 | 9033 | {-# OPTIONS --no-qualified-instances #-}
module CF.Compile where
open import Data.Product
open import Data.List hiding (null; [_])
open import Relation.Binary.PropositionalEquality hiding ([_])
open import Relation.Unary
open import Relation.Unary.PredicateTransformer using (Pt)
open import Relation.Ternary.Core
open import Relation.Ternary.Structures
open import Relation.Ternary.Structures.Syntax
open import Relation.Ternary.Monad.Possibly
open import Relation.Ternary.Monad.Weakening
open import Relation.Ternary.Data.ReflexiveTransitive
open import CF.Syntax as Src
open import CF.Contexts.Lexical
open import CF.Transform.Hoist
open import CF.Transform.UnCo
open import CF.Transform.Compile.Expressions
open import CF.Transform.Compile.Statements
open import CF.Transform.Compile.ToJVM
open import JVM.Builtins
open import JVM.Types
open import JVM.Contexts
open import JVM.Syntax.Values
open import JVM.Syntax.Instructions
open import JVM.Transform.Noooops
open import JVM.Compiler
module _ {T : Set} where
open import JVM.Model T public
compile : ∀ {r} → Src.Block r [] → ∃ λ Γ → ε[ ⟪ Γ ∣ [] ↝ [] ⟫ ]
compile bl₁ with hoist bl₁
... | _ , Possibly.possibly (intros r refl) bl₂ -- The grading of the possibility modality
-- proves that only the lexical context has been extended
with unco bl₂
... | bl₃ with execCompiler (compiler [] bl₃)
... | bl₄ with noooop bl₄
... | bl₅ = -, bl₅
|
ver0/3_osInPro/2_elfForm/hello.asm | RongbinZhuang/simpleOS | 0 | 93118 | [section .data]
strHello: db "Hello World",0ah
strLen equ $-strHello
[section .text]
global _start
_start:
mov edx ,strLen
mov ecx ,strHello
mov ebx ,1
mov eax ,4
int 80h
mov ebx ,0
mov eax ,1
int 80h
|
oeis/167/A167321.asm | neoneye/loda-programs | 11 | 9687 | ; A167321: Totally multiplicative sequence with a(p) = 2*(p+3) for prime p.
; Submitted by <NAME>
; 1,10,12,100,16,120,20,1000,144,160,28,1200,32,200,192,10000,40,1440,44,1600,240,280,52,12000,256,320,1728,2000,64,1920,68,100000,336,400,320,14400,80,440,384,16000,88,2400,92,2800,2304,520,100,120000,400,2560,480,3200,112,17280,448,20000,528,640,124,19200,128,680,2880,1000000,512,3360,140,4000,624,3200,148,144000,152,800,3072,4400,560,3840,164,160000,20736,880,172,24000,640,920,768,28000,184,23040,640,5200,816,1000,704,1200000,200,4000,4032,25600
add $0,1
mov $1,1
mov $2,2
mov $4,1
lpb $0
mul $1,$4
mov $3,$0
lpb $3
mov $4,$0
mod $4,$2
add $2,1
cmp $4,0
cmp $4,0
sub $3,$4
lpe
div $0,$2
mov $4,$2
add $4,$2
add $4,6
lpe
mov $0,$1
|
src/Lib/Sassy/tests/rm.asm | pnkfelix/larceny | 212 | 4336 | <filename>src/Lib/Sassy/tests/rm.asm
BITS 32
section .text
foo:
invlpg [dword 300+8*esi+esp]
lgdt [dword 300+8*esi+esp]
sgdt [dword 300+8*esi+esp]
lidt [dword 300+8*esi+esp]
sidt [dword 300+8*esi+esp]
|
PS.g4 | lucasvr/latex2sympy | 0 | 3006 | grammar PS;
options {
language=Python2;
}
WS: [ \t\r\n]+ -> skip;
ADD: '+';
SUB: '-';
MUL: '*';
DIV: '/';
L_PAREN: '(';
R_PAREN: ')';
L_BRACE: '{';
R_BRACE: '}';
L_BRACE_VISUAL: '\\{';
R_BRACE_VISUAL: '\\}';
L_BRACKET: '[';
R_BRACKET: ']';
L_LEFT: '\\left';
R_RIGHT: '\\right';
BAR: '|';
//functions
FUNC_LIM: '\\lim';
LIM_APPROACH_SYM: '\\to' | '\\rightarrow' | '\\Rightarrow' | '\\longrightarrow' | '\\Longrightarrow';
FUNC_INT: '\\int';
FUNC_SUM: '\\sum';
FUNC_PROD: '\\prod';
FUNC_LOG: '\\log';
FUNC_LN: '\\ln';
FUNC_SIN: '\\sin';
FUNC_COS: '\\cos';
FUNC_TAN: '\\tan';
FUNC_CSC: '\\csc';
FUNC_SEC: '\\sec';
FUNC_COT: '\\cot';
FUNC_ARCSIN: '\\arcsin';
FUNC_ARCCOS: '\\arccos';
FUNC_ARCTAN: '\\arctan';
FUNC_ARCCSC: '\\arccsc';
FUNC_ARCSEC: '\\arcsec';
FUNC_ARCCOT: '\\arccot';
FUNC_SINH: '\\sinh';
FUNC_COSH: '\\cosh';
FUNC_TANH: '\\tanh';
FUNC_ARSINH: '\\arsinh';
FUNC_ARCOSH: '\\arcosh';
FUNC_ARTANH: '\\artanh';
FUNC_ARCSINH: '\\arcsinh';
FUNC_ARCCOSH: '\\arccosh';
FUNC_ARCTANH: '\\arctanh';
FUNC_ARSINH_NAME: 'arsinh';
FUNC_ARCSINH_NAME: 'arcsinh';
FUNC_ARCOSH_NAME: 'arcosh';
FUNC_ARCCOSH_NAME: 'arccosh';
FUNC_ARTANH_NAME: 'artanh';
FUNC_ARCTANH_NAME: 'arctanh';
FUNC_SQRT: '\\sqrt';
//commands
CMD_TIMES: '\\times';
CMD_CDOT: '\\cdot';
CMD_DIV: '\\div';
CMD_FRAC: '\\frac';
CMD_BINOM: '\\binom';
CMD_CHOOSE: '\\choose';
CMD_MATHIT: '\\mathit';
CMD_OPERATORNAME: '\\operatorname';
//matrix test
MATRIX_TYPE_MATRIX: 'matrix';
MATRIX_TYPE_PMATRIX: 'pmatrix';
MATRIX_TYPE_BMATRIX: 'bmatrix';
MATRIX_TYPES: MATRIX_TYPE_MATRIX | MATRIX_TYPE_PMATRIX | MATRIX_TYPE_BMATRIX;
CMD_MATRIX_START: '\\begin' L_BRACE MATRIX_TYPES R_BRACE;
CMD_MATRIX_END: '\\end' L_BRACE MATRIX_TYPES R_BRACE;
MATRIX_DEL_COL: '&';
MATRIX_DEL_ROW: '\\\\';
//accents such as overline and hat
ACCENT_OVERLINE: '\\overline';
ACCENT_BAR: '\\bar';
UNDERSCORE: '_';
CARET: '^';
COLON: ':';
SEMICOLON: ';';
COMMA: ',';
fragment WS_CHAR: [ \t\r\n];
DIFFERENTIAL: 'd' WS_CHAR*? ([a-zA-Z] | '\\' [a-zA-Z]+);
FUNC_EXP: 'e';
LETTER: [a-df-zA-Z];//exclude e for exp
LONGNAME: ([A-Z][A-Za-z]+ | [a-z][a-z]+);
fragment DIGIT: [0-9];
NUMBER:
DIGIT+ (',' DIGIT DIGIT DIGIT)*
| DIGIT* (',' DIGIT DIGIT DIGIT)* '.' DIGIT+;
EQUAL: '=';
LT: '<';
LTE: '\\leq' | '\\le';
GT: '>';
GTE: '\\geq' | '\\ge';
UNEQUAL: '!=' | '\\ne' | '\\neq';
BANG: '!';
SYMBOL: '\\' [a-zA-Z]+;
//PLACEHOLDER in one go
PLACEHOLDER: '[!'[a-zA-Z][a-zA-Z0-9_]*'!]';
//collection of accents
accent_symbol:
ACCENT_BAR | ACCENT_OVERLINE;
math: relation | relation_list;
matrix:
CMD_MATRIX_START
matrix_row (MATRIX_DEL_ROW matrix_row)*
CMD_MATRIX_END;
matrix_row:
expr (MATRIX_DEL_COL expr)*;
relation:
relation (EQUAL | LT | LTE | GT | GTE | UNEQUAL) relation
| expr;
relation_list:
relation_list_content
| L_BRACKET relation_list_content R_BRACKET
| L_BRACE relation_list_content R_BRACE
| L_BRACE_VISUAL relation_list_content R_BRACE_VISUAL
| L_LEFT L_BRACKET relation_list_content R_RIGHT R_BRACKET
| L_LEFT L_BRACE_VISUAL relation_list_content R_RIGHT R_BRACE_VISUAL;
relation_list_content:
relation COMMA relation (COMMA relation)*
| relation SEMICOLON relation (SEMICOLON relation)*;
equality:
expr EQUAL expr;
expr: additive;
additive:
additive (ADD | SUB) additive
| mp;
// mult part
mp:
mp (MUL | CMD_TIMES | CMD_CDOT | DIV | CMD_DIV | COLON) mp
| unary;
mp_nofunc:
mp_nofunc (MUL | CMD_TIMES | CMD_CDOT | DIV | CMD_DIV | COLON) mp_nofunc
| unary_nofunc;
unary:
(ADD | SUB) unary
| postfix+;
unary_nofunc:
(ADD | SUB) unary_nofunc
| postfix postfix_nofunc*;
postfix: exp postfix_op*;
postfix_nofunc: exp_nofunc postfix_op*;
postfix_op: BANG | eval_at;
eval_at:
BAR (eval_at_sup | eval_at_sub | eval_at_sup eval_at_sub);
eval_at_sub:
UNDERSCORE L_BRACE
(expr | equality)
R_BRACE;
eval_at_sup:
CARET L_BRACE
(expr | equality)
R_BRACE;
exp:
exp CARET (atom | L_BRACE expr R_BRACE) subexpr?
| comp;
exp_nofunc:
exp_nofunc CARET (atom | L_BRACE expr R_BRACE) subexpr?
| comp_nofunc;
comp:
group
| abs_group
| func
| atom
| frac
| binom
| matrix;
comp_nofunc:
group
| abs_group
| atom
| frac
| binom
| matrix;
group:
L_PAREN expr R_PAREN
| L_BRACKET expr R_BRACKET
| L_BRACE expr R_BRACE
| L_LEFT L_PAREN expr R_RIGHT R_PAREN
| L_LEFT L_BRACKET expr R_RIGHT R_BRACKET
| L_LEFT L_BRACE expr R_RIGHT R_BRACE
| L_LEFT L_BRACE_VISUAL expr R_RIGHT R_BRACE_VISUAL;
abs_group:
BAR expr BAR
| L_LEFT BAR expr R_RIGHT BAR;
//indicate an accent
accent:
accent_symbol
L_BRACE base=expr R_BRACE;
atom: (LETTER | LONGNAME | SYMBOL | accent) subexpr? | NUMBER | DIFFERENTIAL | mathit | PLACEHOLDER;
mathit: CMD_MATHIT L_BRACE mathit_text R_BRACE;
mathit_text: (LETTER | FUNC_EXP)+;
frac:
CMD_FRAC L_BRACE
upper=expr
R_BRACE L_BRACE
lower=expr
R_BRACE;
//a binomial experssion
binom:
(CMD_BINOM | CMD_CHOOSE) L_BRACE
upper=expr
R_BRACE L_BRACE
lower=expr
R_BRACE;
func_normal_functions:
FUNC_LOG | FUNC_LN
| FUNC_SIN | FUNC_COS | FUNC_TAN
| FUNC_CSC | FUNC_SEC | FUNC_COT
| FUNC_ARCSIN | FUNC_ARCCOS | FUNC_ARCTAN
| FUNC_ARCCSC | FUNC_ARCSEC | FUNC_ARCCOT
| FUNC_SINH | FUNC_COSH | FUNC_TANH
| FUNC_ARSINH | FUNC_ARCOSH | FUNC_ARTANH
| FUNC_ARCSINH | FUNC_ARCCOSH | FUNC_ARCTANH;
func_operator_names:
FUNC_ARSINH_NAME | FUNC_ARCOSH_NAME | FUNC_ARTANH_NAME
| FUNC_ARCSINH_NAME | FUNC_ARCCOSH_NAME | FUNC_ARCTANH_NAME;
func_normal:
(func_normal_functions)
|
(CMD_OPERATORNAME L_BRACE func_operator_name=func_operator_names R_BRACE);
func:
func_normal
(subexpr? supexpr? | supexpr? subexpr?)
(L_LEFT? L_PAREN func_arg R_RIGHT? R_PAREN | func_arg_noparens)
//Do not do arbitraty functions but see as multiplications
/*| (LETTER | SYMBOL) subexpr? // e.g. f(x)
L_PAREN args R_PAREN
| (LETTER | SYMBOL) subexpr? // e.g. f(x)
L_LEFT L_PAREN args R_RIGHT R_PAREN*/
| FUNC_INT
(subexpr supexpr | supexpr subexpr | (UNDERSCORE L_BRACE R_BRACE) (CARET L_BRACE R_BRACE) | (CARET L_BRACE R_BRACE) (UNDERSCORE L_BRACE R_BRACE) )?
(additive? DIFFERENTIAL | frac | additive)
| FUNC_SQRT
(L_BRACKET root=expr R_BRACKET)?
L_BRACE base=expr R_BRACE
| (FUNC_SUM | FUNC_PROD)
(subeq supexpr | supexpr subeq)
mp
| FUNC_LIM limit_sub mp
| FUNC_EXP supexpr?;
args: (expr ',' args) | expr;
limit_sub:
UNDERSCORE L_BRACE
(LETTER | SYMBOL)
LIM_APPROACH_SYM
expr (CARET L_BRACE (ADD | SUB) R_BRACE)?
R_BRACE;
func_arg: expr | (expr ',' func_arg);
func_arg_noparens: mp_nofunc;
subexpr: UNDERSCORE (atom | L_BRACE expr R_BRACE);
supexpr: CARET (atom | L_BRACE expr R_BRACE);
subeq: UNDERSCORE L_BRACE equality R_BRACE;
supeq: UNDERSCORE L_BRACE equality R_BRACE;
|
programs/oeis/089/A089362.asm | neoneye/loda | 22 | 168993 | <gh_stars>10-100
; A089362: Numbers n such that n^2 - 5n + 5 is prime.
; 5,6,7,8,9,11,12,13,14,16,18,19,22,23,24,27,29,31,33,34,38,41,42,44,47,48,49,51,53,56,57,58,59,62,63,67,68,69,71,73,79,86,88,89,92,96,97,99,103,104,106,117,118,123,128,129,133,134,137,141,143,144,147,148,151,152,156,157,158,161,162,163,166,167,172
mov $2,$0
pow $2,2
add $2,1
mov $6,1
lpb $2
mov $3,$1
add $5,$1
add $3,$5
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,$6
add $1,1
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
sub $2,1
lpe
div $1,2
add $1,4
mov $0,$1
|
interprete/interpreter.g4 | emmadrigal/roboticFinger | 0 | 2126 | <filename>interprete/interpreter.g4
grammar interpreter;
/*
* Parser Rules
*/
interpreter : line+ EOF ;
line : drag_command positionX positionY repetitions NEWLINE | push_cmd time NEWLINE | touch_cmdxy positionX positionYt NEWLINE | touch_cmdn letter positionYt NEWLINE;
drag_command : DRAG WHITESPACE ;
push_cmd : PUSH WHITESPACE ;
touch_cmdxy : TOUCHXY WHITESPACE ;
touch_cmdn : TOUCHN WHITESPACE ;
letter : ABC WHITESPACE;
positionX : INT_NUMBER+ WHITESPACE;
positionY : INT_NUMBER+ WHITESPACE;
positionYt : INT_NUMBER+;
repetitions : INT_NUMBER+;
time : INT_NUMBER+;
INT_NUMBER : DIGIT+;
/*
* Lexer Rules
*/
fragment A : ('A') ;
fragment C : ('C') ;
fragment D : ('D') ;
fragment P : ('P') ;
fragment G : ('G') ;
fragment R : ('R') ;
fragment S : ('S') ;
fragment Y : ('Y') ;
fragment H : ('H') ;
fragment O : ('O') ;
fragment U : ('U') ;
fragment T : ('T') ;
fragment X : ('X') ;
fragment N : ('N') ;
fragment B : ('B') ;
DIGIT : [0-9];
TOUCHXY : T O U C H X Y ;
TOUCHN : T O U C H N ;
PUSH : P U S H ;
DRAG : D R A G ;
WHITESPACE : (' ');
NEWLINE : ('\r'? '\n' | '\r')+ ;
ABC : (A | B | C);
|
src/servlet-core.adb | My-Colaborations/ada-servlet | 6 | 26909 | -----------------------------------------------------------------------
-- servlet-servlets -- Servlet.Core
-- Copyright (C) 2010, 2011, 2012, 2013, 2015, 2017, 2018, 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with System.Address_Image;
with Ada.Unchecked_Deallocation;
with Servlet.Filters;
with Servlet.Streams;
with Servlet.Requests.Tools;
with Servlet.Routes.Servlets;
with EL.Objects;
with EL.Contexts.Default;
with GNAT.Traceback.Symbolic;
with Util.Strings;
with Util.Strings.Maps;
with Util.Files;
with Util.Log.Loggers;
-- The <b>Servlet.Core</b> package implements a subset of the
-- Java Servlet Specification adapted for the Ada language.
--
-- The rationale for this implementation is to provide a set of
-- interfaces and ways of developing a Web application which
-- benefit from the architecture expertise defined in Java applications.
--
-- The <b>Servlet.Core</b>, <b>Servlet.Requests</b>, <b>Servlet.Responses</b>
-- and <b>Servlet.Sessions</b> packages are independent of the web server
-- which will be used (such as <b>AWS</b>, <b>Apache</b> or <b>Lighthttpd</b>).
--
package body Servlet.Core is
-- The logger
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Servlet.Core");
No_Time : constant Ada.Calendar.Time := Ada.Calendar.Time_Of (Year => 1901,
Month => 1,
Day => 1);
-- ------------------------------
-- Get the filter name.
-- ------------------------------
function Get_Filter_Name (Config : in Filter_Config) return String is
begin
return To_String (Config.Name);
end Get_Filter_Name;
-- ------------------------------
-- Returns a String containing the value of the named context-wide initialization
-- parameter, or the default value if the parameter does not exist.
--
-- The filter parameter name is automatically prefixed by the filter name followed by '.'.
-- ------------------------------
function Get_Init_Parameter (Config : in Filter_Config;
Name : in String;
Default : in String := "") return String is
begin
return Config.Context.all.Get_Init_Parameter (To_String (Config.Name) & "." & Name, Default);
end Get_Init_Parameter;
function Get_Init_Parameter (Config : in Filter_Config;
Name : in String;
Default : in String := "")
return Ada.Strings.Unbounded.Unbounded_String is
begin
return Config.Context.all.Get_Init_Parameter (To_String (Config.Name) & "." & Name, Default);
end Get_Init_Parameter;
-- ------------------------------
-- Get the servlet context associated with the filter config.
-- ------------------------------
function Get_Servlet_Context (Config : in Filter_Config) return Servlet_Registry_Access is
begin
return Config.Context;
end Get_Servlet_Context;
-- ------------------------------
-- Get the servlet name.
-- ------------------------------
function Get_Name (Server : in Servlet) return String is
begin
return To_String (Server.Name);
end Get_Name;
-- ------------------------------
-- Get the servlet context associated with this servlet.
-- ------------------------------
function Get_Servlet_Context (Server : in Servlet) return Servlet_Registry_Access is
begin
return Server.Context;
end Get_Servlet_Context;
-- ------------------------------
-- Called by the servlet container to indicate to a servlet that the servlet
-- is being placed into service.
-- ------------------------------
procedure Initialize (Server : in out Servlet;
Context : in Servlet_Registry'Class) is
begin
null;
end Initialize;
-- ------------------------------
-- Receives standard HTTP requests from the public service method and dispatches
-- them to the Do_XXX methods defined in this class. This method is an HTTP-specific
-- version of the Servlet.service(Request, Response) method. There's no need
-- to override this method.
-- ------------------------------
procedure Service (Server : in Servlet;
Request : in out Requests.Request'Class;
Response : in out Responses.Response'Class) is
Method : constant String := Request.Get_Method;
begin
if Method = "GET" then
declare
Last_Mod : constant Ada.Calendar.Time
:= Servlet'Class (Server).Get_Last_Modified (Request);
pragma Unreferenced (Last_Mod);
begin
Servlet'Class (Server).Do_Get (Request, Response);
end;
elsif Method = "POST" then
Servlet'Class (Server).Do_Post (Request, Response);
elsif Method = "PUT" then
Servlet'Class (Server).Do_Put (Request, Response);
elsif Method = "DELETE" then
Servlet'Class (Server).Do_Delete (Request, Response);
elsif Method = "HEAD" then
Servlet'Class (Server).Do_Head (Request, Response);
elsif Method = "OPTIONS" then
Servlet'Class (Server).Do_Options (Request, Response);
elsif Method = "TRACE" then
Servlet'Class (Server).Do_Trace (Request, Response);
elsif Method = "PATCH" then
Servlet'Class (Server).Do_Patch (Request, Response);
else
Response.Send_Error (Responses.SC_NOT_IMPLEMENTED);
end if;
end Service;
-- ------------------------------
-- Returns the time the Request object was last modified, in milliseconds since
-- midnight January 1, 1970 GMT. If the time is unknown, this method returns
-- a negative number (the default).
--
-- Servlets that support HTTP GET requests and can quickly determine their
-- last modification time should override this method. This makes browser and
-- proxy caches work more effectively, reducing the load on server and network
-- resources.
-- ------------------------------
function Get_Last_Modified (Server : in Servlet;
Request : in Requests.Request'Class)
return Ada.Calendar.Time is
pragma Unreferenced (Server, Request);
begin
return No_Time;
end Get_Last_Modified;
-- ------------------------------
-- Called by the server (via the service method) to allow a servlet to handle
-- a GET request.
--
-- Overriding this method to support a GET request also automatically supports
-- an HTTP HEAD request. A HEAD request is a GET request that returns no body
-- in the response, only the request header fields.
--
-- When overriding this method, read the request data, write the response headers,
-- get the response's writer or output stream object, and finally, write the
-- response data. It's best to include content type and encoding.
-- When using a PrintWriter object to return the response, set the content type
-- before accessing the PrintWriter object.
--
-- The servlet container must write the headers before committing the response,
-- because in HTTP the headers must be sent before the response body.
--
-- Where possible, set the Content-Length header (with the
-- Response.Set_Content_Length method), to allow the servlet container
-- to use a persistent connection to return its response to the client,
-- improving performance. The content length is automatically set if the entire
-- response fits inside the response buffer.
--
-- When using HTTP 1.1 chunked encoding (which means that the response has a
-- Transfer-Encoding header), do not set the Content-Length header.
--
-- The GET method should be safe, that is, without any side effects for which
-- users are held responsible. For example, most form queries have no side effects.
-- If a client request is intended to change stored data, the request should use
-- some other HTTP method.
--
-- The GET method should also be idempotent, meaning that it can be safely repeated.
-- Sometimes making a method safe also makes it idempotent. For example, repeating
-- queries is both safe and idempotent, but buying a product online or modifying
-- data is neither safe nor idempotent.
--
-- If the request is incorrectly formatted, Do_Get returns an HTTP "Bad Request"
-- ------------------------------
procedure Do_Get (Server : in Servlet;
Request : in out Requests.Request'Class;
Response : in out Responses.Response'Class) is
pragma Unreferenced (Server, Request);
begin
Response.Send_Error (Responses.SC_METHOD_NOT_ALLOWED);
end Do_Get;
-- ------------------------------
-- Receives an HTTP HEAD request from the protected service method and handles
-- the request. The client sends a HEAD request when it wants to see only the
-- headers of a response, such as Content-Type or Content-Length. The HTTP HEAD
-- method counts the output bytes in the response to set the Content-Length header
-- accurately.
--
-- If you override this method, you can avoid computing the response body and just
-- set the response headers directly to improve performance. Make sure that the
-- Do_Head method you write is both safe and idempotent (that is, protects itself
-- from being called multiple times for one HTTP HEAD request).
--
-- If the HTTP HEAD request is incorrectly formatted, doHead returns an HTTP
-- "Bad Request" message.
-- ------------------------------
procedure Do_Head (Server : in Servlet;
Request : in out Requests.Request'Class;
Response : in out Responses.Response'Class) is
pragma Unreferenced (Server, Request);
begin
null;
end Do_Head;
-- ------------------------------
-- Called by the server (via the service method) to allow a servlet to handle
-- a POST request. The HTTP POST method allows the client to send data of unlimited
-- length to the Web server a single time and is useful when posting information
-- such as credit card numbers.
--
-- When overriding this method, read the request data, write the response headers,
-- get the response's writer or output stream object, and finally, write the
-- response data. It's best to include content type and encoding. When using
-- a PrintWriter object to return the response, set the content type before
-- accessing the PrintWriter object.
--
-- The servlet container must write the headers before committing the response,
-- because in HTTP the headers must be sent before the response body.
--
-- Where possible, set the Content-Length header (with the
-- Response.Set_Content_Length method), to allow the servlet container to use
-- a persistent connection to return its response to the client, improving
-- performance. The content length is automatically set if the entire response
-- fits inside the response buffer.
--
-- When using HTTP 1.1 chunked encoding (which means that the response has a
-- Transfer-Encoding header), do not set the Content-Length header.
--
-- This method does not need to be either safe or idempotent. Operations
-- requested through POST can have side effects for which the user can be held
-- accountable, for example, updating stored data or buying items online.
--
-- If the HTTP POST request is incorrectly formatted, doPost returns
-- an HTTP "Bad Request" message.
-- ------------------------------
procedure Do_Post (Server : in Servlet;
Request : in out Requests.Request'Class;
Response : in out Responses.Response'Class) is
pragma Unreferenced (Server, Request);
begin
Response.Send_Error (Responses.SC_METHOD_NOT_ALLOWED);
end Do_Post;
-- ------------------------------
-- Called by the server (via the service method) to allow a servlet to handle
-- a PUT request. The PUT operation allows a client to place a file on the server
-- and is similar to sending a file by FTP.
--
-- When overriding this method, leave intact any content headers sent with
-- the request (including Content-Length, Content-Type, Content-Transfer-Encoding,
-- Content-Encoding, Content-Base, Content-Language, Content-Location,
-- Content-MD5, and Content-Range). If your method cannot handle a content
-- header, it must issue an error message (HTTP 501 - Not Implemented) and
-- discard the request. For more information on HTTP 1.1, see RFC 2616 .
--
-- This method does not need to be either safe or idempotent. Operations that
-- Do_Put performs can have side effects for which the user can be held accountable.
-- When using this method, it may be useful to save a copy of the affected URL
-- in temporary storage.
--
-- If the HTTP PUT request is incorrectly formatted, Do_Put returns
-- an HTTP "Bad Request" message.
-- ------------------------------
procedure Do_Put (Server : in Servlet;
Request : in out Requests.Request'Class;
Response : in out Responses.Response'Class) is
pragma Unreferenced (Server, Request);
begin
Response.Send_Error (Responses.SC_METHOD_NOT_ALLOWED);
end Do_Put;
-- ------------------------------
-- Called by the server (via the service method) to allow a servlet to handle
-- a DELETE request. The DELETE operation allows a client to remove a document
-- or Web page from the server.
--
-- This method does not need to be either safe or idempotent. Operations requested
-- through DELETE can have side effects for which users can be held accountable.
-- When using this method, it may be useful to save a copy of the affected URL in
-- temporary storage.
--
-- If the HTTP DELETE request is incorrectly formatted, Do_Delete returns an HTTP
-- "Bad Request" message.
-- ------------------------------
procedure Do_Delete (Server : in Servlet;
Request : in out Requests.Request'Class;
Response : in out Responses.Response'Class) is
pragma Unreferenced (Server, Request);
begin
Response.Send_Error (Responses.SC_METHOD_NOT_ALLOWED);
end Do_Delete;
-- ------------------------------
-- Called by the server (via the service method) to allow a servlet to handle a
-- OPTIONS request. The OPTIONS request determines which HTTP methods the server
-- supports and returns an appropriate header. For example, if a servlet overrides
-- Do_Get, this method returns the following header:
--
-- Allow: GET, HEAD, TRACE, OPTIONS
--
-- There's no need to override this method unless the servlet implements new
-- HTTP methods, beyond those implemented by HTTP 1.1.
-- ------------------------------
procedure Do_Options (Server : in Servlet;
Request : in out Requests.Request'Class;
Response : in out Responses.Response'Class) is
pragma Unreferenced (Server, Request);
begin
Response.Send_Error (Responses.SC_METHOD_NOT_ALLOWED);
end Do_Options;
-- ------------------------------
-- Called by the server (via the service method) to allow a servlet to handle
-- a TRACE request. A TRACE returns the headers sent with the TRACE request to
-- the client, so that they can be used in debugging. There's no need to override
-- this method.
-- ------------------------------
procedure Do_Trace (Server : in Servlet;
Request : in out Requests.Request'Class;
Response : in out Responses.Response'Class) is
pragma Unreferenced (Server, Request);
begin
Response.Send_Error (Responses.SC_METHOD_NOT_ALLOWED);
end Do_Trace;
-- ------------------------------
-- Called by the server (via the service method) to allow a servlet to handle
-- a PATCH request (RFC 5789).
-- ------------------------------
procedure Do_Patch (Server : in Servlet;
Request : in out Requests.Request'Class;
Response : in out Responses.Response'Class) is
pragma Unreferenced (Server, Request);
begin
Response.Send_Error (Responses.SC_METHOD_NOT_ALLOWED);
end Do_Patch;
-- ------------------------------
-- Forwards a request from a servlet to another resource
-- (servlet, or HTML file) on the server. This method allows one servlet to do
-- preliminary processing of a request and another resource to generate the response.
--
-- For a Request_Dispatcher obtained via Get_Request_Dispatcher(),
-- the ServletRequest object has its path elements and parameters adjusted
-- to match the path of the target resource.
--
-- forward should be called before the response has been committed to the
-- client (before response body output has been flushed). If the response
-- already has been committed, this method throws an IllegalStateException.
-- Uncommitted output in the response buffer is automatically cleared before
-- the forward.
--
-- The request and response parameters must be either the same objects as were
-- passed to the calling servlet's service method or be subclasses of the
-- RequestWrapper or ResponseWrapper classes that wrap them.
-- ------------------------------
procedure Forward (Dispatcher : in Request_Dispatcher;
Request : in out Requests.Request'Class;
Response : in out Responses.Response'Class) is
begin
if Dispatcher.Servlet = null then
Response.Send_Error (Responses.SC_NOT_FOUND);
elsif Dispatcher.Filters = null then
Requests.Tools.Set_Context (Request,
Response'Unchecked_Access,
Dispatcher.Context'Unrestricted_Access);
Dispatcher.Servlet.Service (Request, Response);
else
-- If we have some filters, create the filter chain
-- and invoke the first filter.
declare
Chain : Filter_Chain;
begin
Requests.Tools.Set_Context (Request,
Response'Unchecked_Access,
Dispatcher.Context'Unrestricted_Access);
Chain.Filters := Dispatcher.Filters.all'Access;
Chain.Servlet := Dispatcher.Servlet;
Chain.Filter_Pos := Chain.Filters'Last;
Do_Filter (Chain => Chain,
Request => Request,
Response => Response);
end;
end if;
end Forward;
-- ------------------------------
-- Includes the content of a resource (servlet, or, HTML file) in the response.
-- In essence, this method enables programmatic server-side includes.
--
-- The Response object has its path elements and parameters remain
-- unchanged from the caller's. The included servlet cannot change the response
-- status code or set headers; any attempt to make a change is ignored.
--
-- The request and response parameters must be either the same objects as were
-- passed to the calling servlet's service method or be subclasses of the
-- RequestWrapper or ResponseWrapper classes that wrap them.
-- ------------------------------
procedure Include (Dispatcher : in Request_Dispatcher;
Request : in out Requests.Request'Class;
Response : in out Responses.Response'Class) is
begin
if Dispatcher.Servlet = null then
Response.Send_Error (Responses.SC_NOT_FOUND);
else
Dispatcher.Servlet.Service (Request, Response);
end if;
end Include;
-- ------------------------------
-- Returns the servlet that will be called when forwarding the request.
-- ------------------------------
function Get_Servlet (Dispatcher : in Request_Dispatcher) return Servlet_Access is
begin
return Dispatcher.Servlet;
end Get_Servlet;
-- ------------------------------
-- Returns a Request_Dispatcher object that acts as a wrapper for the resource
-- located at the given path. A Request_Dispatcher object can be used to forward
-- a request to the resource or to include the resource in a response.
-- The resource can be dynamic or static.
-- ------------------------------
function Get_Request_Dispatcher (Context : in Servlet_Registry;
Path : in String)
return Request_Dispatcher is
use type Filters.Filter_List_Access;
begin
return R : Request_Dispatcher do
Context.Routes.Find_Route (Path, R.Context);
if not Routes.Is_Null (R.Context) then
declare
use Routes.Servlets;
Route : constant Routes.Route_Type_Accessor := Routes.Get_Route (R.Context);
begin
if Route in Routes.Servlets.Servlet_Route_Type'Class then
declare
Servlet_Route : constant access Routes.Servlets.Servlet_Route_Type'Class
:= Routes.Servlets.Servlet_Route_Type'Class (Route.Element.all)'Access;
Proxy : Routes.Servlets.Proxy_Route_Type_Access;
begin
if Servlet_Route.Filters /= null then
R.Filters := Servlet_Route.Filters.all'Access;
end if;
if Servlet_Route.all in Routes.Servlets.Proxy_Route_Type'Class then
Proxy := Proxy_Route_Type'Class (Servlet_Route.all)'Access;
Routes.Change_Route (R.Context, Proxy.Route);
R.Servlet
:= Servlet_Route_Type'Class (Proxy.Route.Value.Element.all).Servlet;
else
R.Servlet := Servlet_Route.Servlet;
end if;
end;
end if;
end;
end if;
R.Pos := Routes.Get_Path_Pos (R.Context);
end return;
end Get_Request_Dispatcher;
-- ------------------------------
-- Returns a Request_Dispatcher object that acts as a wrapper for the named servlet.
--
-- Servlets may be given names via server administration or via a web application
-- deployment descriptor. A servlet instance can determine its name using
-- ServletConfig.getServletName().
-- ------------------------------
function Get_Name_Dispatcher (Context : in Servlet_Registry;
Name : in String)
return Request_Dispatcher is
Pos : constant Servlet_Maps.Cursor := Context.Servlets.Find (Name);
begin
if not Servlet_Maps.Has_Element (Pos) then
raise Servlet_Error with "No servlet " & Name;
end if;
return R : Request_Dispatcher do
R.Servlet := Servlet_Maps.Element (Pos);
end return;
end Get_Name_Dispatcher;
-- ------------------------------
-- Returns the context path of the web application.
-- The context path is the portion of the request URI that is used to select the context
-- of the request. The context path always comes first in a request URI. The path starts
-- with a "/" character but does not end with a "/" character. For servlets in the default
-- (root) context, this method returns "".
-- ------------------------------
function Get_Context_Path (Context : in Servlet_Registry) return String is
begin
return To_String (Context.Context_Path);
end Get_Context_Path;
-- ------------------------------
-- Returns a String containing the value of the named context-wide initialization
-- parameter, or null if the parameter does not exist.
--
-- This method can make available configuration information useful to an entire
-- "web application". For example, it can provide a webmaster's email address
-- or the name of a system that holds critical data.
-- ------------------------------
function Get_Init_Parameter (Context : in Servlet_Registry;
Name : in String;
Default : in String := "") return String is
begin
return Context.Config.Get (Name, Default);
end Get_Init_Parameter;
function Get_Init_Parameter (Context : in Servlet_Registry;
Name : in String;
Default : in String := "")
return Ada.Strings.Unbounded.Unbounded_String is
begin
if Context.Config.Exists (Name) then
return Context.Config.Get (Name);
else
return Ada.Strings.Unbounded.To_Unbounded_String (Default);
end if;
end Get_Init_Parameter;
-- ------------------------------
-- Set the init parameter identified by <b>Name</b> to the value <b>Value</b>.
-- ------------------------------
procedure Set_Init_Parameter (Context : in out Servlet_Registry;
Name : in String;
Value : in String) is
begin
Log.Debug ("Set {0}={1}", Name, Value);
Context.Config.Set (Name, Value);
end Set_Init_Parameter;
-- ------------------------------
-- Set the init parameters by copying the properties defined in <b>Params</b>.
-- Existing parameters will be overriding by the new values.
-- ------------------------------
procedure Set_Init_Parameters (Context : in out Servlet_Registry;
Params : in Util.Properties.Manager'Class) is
begin
Context.Config.Copy (Params);
end Set_Init_Parameters;
-- ------------------------------
-- Get access to the init parameters.
-- ------------------------------
procedure Get_Init_Parameters (Context : in Servlet_Registry;
Process : not null access
procedure (Params : in Util.Properties.Manager'Class)) is
begin
Process (Context.Config);
end Get_Init_Parameters;
-- ------------------------------
-- Returns the absolute path of the resource identified by the given relative path.
-- The resource is searched in a list of directories configured by the application.
-- The path must begin with a "/" and is interpreted as relative to the current
-- context root.
--
-- This method allows the servlet container to make a resource available to
-- servlets from any source.
--
-- This method returns an empty string if the resource could not be localized.
-- ------------------------------
function Get_Resource (Context : in Servlet_Registry;
Path : in String) return String is
Paths : constant String := Context.Get_Init_Parameter ("view.dir");
Result : constant String := Util.Files.Find_File_Path (Name => Path, Paths => Paths);
begin
if Result = Path then
return "";
else
return Result;
end if;
end Get_Resource;
-- ------------------------------
-- Registers the given servlet instance with this ServletContext under
-- the given servletName.
--
-- If this ServletContext already contains a preliminary
-- ServletRegistration for a servlet with the given servletName,
-- it will be completed (by assigning the class name of the given
-- servlet instance to it) and returned.
-- ------------------------------
procedure Add_Servlet (Registry : in out Servlet_Registry;
Name : in String;
Server : in Servlet_Access) is
begin
Log.Info ("Add servlet '{0}'", Name);
if Server.Context /= null then
Log.Error ("Servlet '{0}' already registered in a servlet registry", Server.Get_Name);
raise Servlet_Error;
end if;
Server.Name := To_Unbounded_String (Name);
Server.Context := Registry'Unchecked_Access;
Servlet_Maps.Include (Registry.Servlets, Name, Server);
end Add_Servlet;
-- ------------------------------
-- Registers the given filter instance with this Servlet context.
-- ------------------------------
procedure Add_Filter (Registry : in out Servlet_Registry;
Name : in String;
Filter : in Filter_Access) is
begin
Log.Info ("Add servlet filter '{0}'", Name);
Filter_Maps.Include (Registry.Filters, Name,
Filter.all'Unchecked_Access);
end Add_Filter;
-- ------------------------------
-- Causes the next filter in the chain to be invoked, or if the calling
-- filter is the last filter in the chain, causes the resource at the end
-- of the chain to be invoked.
-- ------------------------------
procedure Do_Filter (Chain : in out Filter_Chain;
Request : in out Requests.Request'Class;
Response : in out Responses.Response'Class) is
begin
if Chain.Filter_Pos = 0 then
Chain.Servlet.Service (Request, Response);
else
declare
Filter : constant Filters.Filter_Access := Chain.Filters (Chain.Filter_Pos);
begin
Chain.Filter_Pos := Chain.Filter_Pos - 1;
Filter.Do_Filter (Request, Response, Chain);
end;
end if;
end Do_Filter;
-- ------------------------------
-- Get the servlet context associated with the filter chain.
-- ------------------------------
function Get_Servlet_Context (Chain : in Filter_Chain) return Servlet_Registry_Access is
begin
return Chain.Servlet.Context;
end Get_Servlet_Context;
function Match_Pattern (Pattern : in String;
URI : in String) return Boolean;
function Match_Pattern (Pattern : in String;
URI : in String) return Boolean is
Pos : Natural := Pattern'First;
Last : Natural;
begin
-- *.html, /home/*.html -> True
-- /home/*.html, /home/users/:id ->False
-- /home/*.html, /home/users/:id/view.html -> True
-- /home/*.html, /home/index.html -> True
-- /home/*, /home/users/:id -> True
-- /home/*, /home/admin/*.html -> True
loop
if Pattern (Pos) = '*' then
if Pos = Pattern'Last then
return True;
end if;
Pos := Pos + 1;
if Pattern (Pos) /= '.' then
return False;
end if;
Last := Util.Strings.Rindex (URI, '.');
if Last = 0 then
return False;
end if;
if Pattern (Pos .. Pattern'Last) = URI (Last .. URI'Last) then
return True;
else
return False;
end if;
elsif Pos > URI'Last then
return False;
elsif Pattern (Pos) /= URI (Pos) then
return False;
end if;
Pos := Pos + 1;
if Pos > Pattern'Last then
if Pos > URI'Last then
return True;
else
return False;
end if;
end if;
end loop;
end Match_Pattern;
-- ------------------------------
-- Install the servlet filters after all the mappings have been registered.
-- ------------------------------
procedure Install_Filters (Registry : in out Servlet_Registry) is
procedure Process (URI : in String;
Route : in Routes.Route_Type_Accessor);
procedure Make_Route;
procedure Initialize_Filter (Key : in String;
Filter : in Filter_Access);
procedure Initialize_Servlet (Pos : in Servlet_Maps.Cursor);
procedure Process (URI : in String;
Route : in Routes.Route_Type_Accessor) is
Iter : Util.Strings.Vectors.Cursor := Registry.Filter_Patterns.First;
Servlet_Route : access Routes.Servlets.Servlet_Route_Type'Class;
begin
if not (Route in Routes.Servlets.Servlet_Route_Type'Class) then
return;
end if;
Servlet_Route := Routes.Servlets.Servlet_Route_Type'Class (Route.Element.all)'Access;
while Util.Strings.Vectors.Has_Element (Iter) loop
declare
Pattern : constant String := Util.Strings.Vectors.Element (Iter);
Filter : Filter_List_Access;
begin
if Match_Pattern (Pattern, URI) then
Filter := Registry.Filter_Rules.Element (Pattern);
for I in Filter'Range loop
Routes.Servlets.Append_Filter (Servlet_Route.all, Filter (I).all'Access);
end loop;
end if;
end;
Util.Strings.Vectors.Next (Iter);
end loop;
end Process;
-- ------------------------------
-- Setup a route for each filter mapping so that we can configure the filter
-- for the filter mapping route.
-- ------------------------------
procedure Make_Route is
Context : aliased EL.Contexts.Default.Default_Context;
Iter : Util.Strings.Vectors.Cursor := Registry.Filter_Patterns.First;
begin
while Util.Strings.Vectors.Has_Element (Iter) loop
declare
use Routes.Servlets;
procedure Insert (Ref : in out Routes.Route_Type_Ref);
Pattern : constant String := Util.Strings.Vectors.Element (Iter);
Route : Routes.Route_Context_Type;
procedure Insert (Ref : in out Routes.Route_Type_Ref) is
Proxy : Routes.Servlets.Proxy_Route_Type_Access;
begin
if Ref.Is_Null then
Proxy := new Routes.Servlets.Proxy_Route_Type;
Proxy.Route := Route.Get_Route;
-- If the route is also a proxy, get the real route pointed to by the proxy.
if Proxy.Route.Value in Proxy_Route_Type'Class then
Proxy.Route
:= Proxy_Route_Type'Class (Proxy.Route.Value.Element.all).Route;
end if;
Ref := Routes.Route_Type_Refs.Create (Proxy.all'Access);
end if;
end Insert;
begin
Registry.Routes.Find_Route (Pattern, Route);
if not Route.Is_Null then
Registry.Routes.Add_Route (Pattern, Context, Insert'Access);
end if;
end;
Util.Strings.Vectors.Next (Iter);
end loop;
end Make_Route;
Config : Filter_Config;
procedure Initialize_Filter (Key : in String;
Filter : in Filter_Access) is
begin
Config.Name := To_Unbounded_String (Key);
Filter.Initialize (Config);
end Initialize_Filter;
procedure Initialize_Servlet (Pos : in Servlet_Maps.Cursor) is
Servlet : constant Servlet_Access := Servlet_Maps.Element (Pos);
begin
Servlet.Initialize (Registry);
end Initialize_Servlet;
Iter : Filter_Maps.Cursor := Registry.Filters.First;
begin
Config.Context := Registry'Unchecked_Access;
while Filter_Maps.Has_Element (Iter) loop
Filter_Maps.Query_Element (Position => Iter, Process => Initialize_Filter'Access);
Filter_Maps.Next (Iter);
end loop;
Registry.Servlets.Iterate (Process => Initialize_Servlet'Access);
Make_Route;
Registry.Routes.Iterate (Process'Access);
end Install_Filters;
-- ------------------------------
-- Dump the routes and filter configuration in the log with the given log level.
-- ------------------------------
procedure Dump_Routes (Registry : in out Servlet_Registry;
Level : in Util.Log.Level_Type) is
use type Filters.Filter_List_Access;
use type Filters.Filter_Access;
function Get_Servlet_Name (Servlet : in Servlet_Access) return String;
function Get_Filter_Names (List : in Filters.Filter_List_Access) return String;
procedure Print_Route (URI : in String;
Route : in Routes.Route_Type_Accessor);
procedure Collect_Servlet (Pos : in Servlet_Maps.Cursor);
procedure Collect_Filter (Pos : in Filter_Maps.Cursor);
Maps : Util.Strings.Maps.Map;
function Get_Servlet_Name (Servlet : in Servlet_Access) return String is
begin
if Servlet = null then
return "null";
else
declare
N : constant String := System.Address_Image (Servlet.all'Address);
begin
if Maps.Contains (N) then
return Maps.Element (N);
else
return " ? at " & N;
end if;
end;
end if;
end Get_Servlet_Name;
function Get_Filter_Names (List : in Filters.Filter_List_Access) return String is
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
for I in List'Range loop
if Length (Result) > 0 then
Append (Result, ", ");
end if;
if List (I) = null then
Append (Result, "null");
else
declare
N : constant String := System.Address_Image (List (I).all'Address);
begin
if Maps.Contains (N) then
Append (Result, Maps.Element (N));
else
Append (Result, " ? at " & N);
end if;
end;
end if;
end loop;
return To_String (Result);
end Get_Filter_Names;
procedure Print_Route (URI : in String;
Route : in Routes.Route_Type_Accessor) is
Servlet_Route : access Routes.Servlets.Servlet_Route_Type'Class;
begin
if not (Route in Routes.Servlets.Servlet_Route_Type'Class) then
Log.Print (Level, "Route {0} to {1}", URI,
System.Address_Image (Route.Element.all'Address));
else
Servlet_Route := Routes.Servlets.Servlet_Route_Type'Class (Route.Element.all)'Access;
if Servlet_Route.Filters /= null then
Log.Print (Level, "Route {0} to {1} with filters {2}",
URI, Get_Servlet_Name (Servlet_Route.Get_Servlet),
Get_Filter_Names (Servlet_Route.Filters));
else
Log.Print (Level, "Route {0} to {1}", URI,
Get_Servlet_Name (Servlet_Route.Get_Servlet));
end if;
end if;
end Print_Route;
procedure Collect_Servlet (Pos : in Servlet_Maps.Cursor) is
Key : constant String := Servlet_Maps.Key (Pos);
Servlet : constant Servlet_Access := Servlet_Maps.Element (Pos);
begin
Maps.Include (System.Address_Image (Servlet.all'Address), Key);
end Collect_Servlet;
procedure Collect_Filter (Pos : in Filter_Maps.Cursor) is
Key : constant String := Filter_Maps.Key (Pos);
Filter : constant Filter_Access := Filter_Maps.Element (Pos);
begin
Maps.Include (System.Address_Image (Filter.all'Address), Key);
end Collect_Filter;
begin
Registry.Servlets.Iterate (Collect_Servlet'Access);
Registry.Filters.Iterate (Collect_Filter'Access);
Registry.Routes.Iterate (Print_Route'Access);
end Dump_Routes;
-- ------------------------------
-- Start the application.
-- ------------------------------
procedure Start (Registry : in out Servlet_Registry) is
begin
Registry.Status := Started;
Install_Filters (Registry);
end Start;
-- ------------------------------
-- Get the application status.
-- ------------------------------
function Get_Status (Registry : in Servlet_Registry) return Status_Type is
begin
return Registry.Status;
end Get_Status;
-- ------------------------------
-- Disable the application.
-- ------------------------------
procedure Disable (Registry : in out Servlet_Registry) is
begin
case Registry.Status is
when Ready =>
Registry.Status := Disabled;
when Started =>
Registry.Status := Suspended;
when Disabled | Suspended | Stopped =>
null;
end case;
end Disable;
-- ------------------------------
-- Enable the application.
-- ------------------------------
procedure Enable (Registry : in out Servlet_Registry) is
begin
case Registry.Status is
when Disabled =>
Registry.Status := Ready;
when Suspended =>
Registry.Status := Started;
when Ready | Started | Stopped =>
null;
end case;
end Enable;
-- ------------------------------
-- Stop the application.
-- ------------------------------
procedure Stop (Registry : in out Servlet_Registry) is
begin
case Registry.Status is
when Ready | Disabled | Stopped =>
null;
when Started | Suspended =>
Registry.Status := Stopped;
end case;
end Stop;
procedure Free is
new Ada.Unchecked_Deallocation (Object => Filters.Filter_List,
Name => Filter_List_Access);
-- ------------------------------
-- Add a filter mapping with the given pattern
-- If the URL pattern is already mapped to a different servlet,
-- no updates will be performed.
-- ------------------------------
procedure Add_Filter_Mapping (Registry : in out Servlet_Registry;
Pattern : in String;
Name : in String) is
procedure Append (Key : in String;
List : in out Filter_List_Access);
Pos : constant Filter_Maps.Cursor := Registry.Filters.Find (Name);
Rule : constant Filter_List_Maps.Cursor := Registry.Filter_Rules.Find (Pattern);
-- ------------------------------
-- Append the filter in the filter list.
-- ------------------------------
procedure Append (Key : in String;
List : in out Filter_List_Access) is
pragma Unreferenced (Key);
use Filters;
Filter : constant Filters.Filter_Access := Filter_Maps.Element (Pos).all'Access;
New_List : Filter_List_Access;
begin
-- Check that the filter is not already executed.
for I in List'Range loop
if List (I) = Filter then
return;
end if;
end loop;
New_List := new Filters.Filter_List (1 .. List'Last + 1);
New_List.all (2 .. New_List'Last) := List.all;
New_List (New_List'First) := Filter;
Free (List);
List := New_List;
end Append;
List : Filter_List_Access;
begin
Log.Info ("Add filter mapping {0} -> {1}", Pattern, Name);
if not Filter_Maps.Has_Element (Pos) then
Log.Error ("No servlet filter {0}", Name);
raise Servlet_Error with "No servlet filter " & Name;
end if;
if not Filter_List_Maps.Has_Element (Rule) then
Registry.Filter_Patterns.Append (Pattern);
List := new Filters.Filter_List (1 .. 1);
List (List'First) := Filter_Maps.Element (Pos).all'Access;
Registry.Filter_Rules.Insert (Pattern, List);
else
Registry.Filter_Rules.Update_Element (Rule, Append'Access);
end if;
end Add_Filter_Mapping;
-- ------------------------------
-- Add a servlet mapping with the given pattern
-- If the URL pattern is already mapped to a different servlet,
-- no updates will be performed.
-- ------------------------------
procedure Add_Mapping (Registry : in out Servlet_Registry;
Pattern : in String;
Name : in String) is
Pos : constant Servlet_Maps.Cursor := Registry.Servlets.Find (Name);
begin
if not Servlet_Maps.Has_Element (Pos) then
Log.Error ("No servlet {0}", Name);
raise Servlet_Error with "No servlet " & Name;
end if;
Log.Info ("Add servlet mapping {0} -> {1}", Pattern, Name);
Registry.Add_Mapping (Pattern, Servlet_Maps.Element (Pos));
end Add_Mapping;
-- ------------------------------
-- Add a servlet mapping with the given pattern
-- If the URL pattern is already mapped to a different servlet,
-- no updates will be performed.
-- ------------------------------
procedure Add_Mapping (Registry : in out Servlet_Registry;
Pattern : in String;
Server : in Servlet_Access) is
procedure Insert (Route : in out Routes.Route_Type_Ref);
procedure Insert (Route : in out Routes.Route_Type_Ref) is
To : Routes.Servlets.Servlet_Route_Type_Access;
begin
if Route.Is_Null then
To := new Routes.Servlets.Servlet_Route_Type;
To.Servlet := Server;
Route := Routes.Route_Type_Refs.Create (To.all'Access);
else
Log.Warn ("Mapping {0} already defined", Pattern);
end if;
end Insert;
Context : aliased EL.Contexts.Default.Default_Context;
begin
if Pattern'Length = 0 or Server = null then
return;
end if;
Registry.Routes.Add_Route (Pattern, Context, Insert'Access);
end Add_Mapping;
-- ------------------------------
-- Add a route associated with the given path pattern. The pattern is split into components.
-- Some path components can be a fixed string (/home) and others can be variable.
-- When a path component is variable, the value can be retrieved from the route context.
-- Once the route path is created, the <tt>Process</tt> procedure is called with the route
-- reference.
-- ------------------------------
procedure Add_Route (Registry : in out Servlet_Registry;
Pattern : in String;
ELContext : in EL.Contexts.ELContext'Class;
Process : not null access
procedure (Route : in out Routes.Route_Type_Ref)) is
begin
Registry.Routes.Add_Route (Pattern, ELContext, Process);
end Add_Route;
-- ------------------------------
-- Set the error page that will be used if a servlet returns an error.
-- ------------------------------
procedure Set_Error_Page (Server : in out Servlet_Registry;
Error : in Integer;
Page : in String) is
begin
Log.Info ("Using page {0} for http error {1}", Page, Integer'Image (Error));
Server.Error_Pages.Include (Error, Page);
end Set_Error_Page;
function Hash (N : Integer) return Ada.Containers.Hash_Type is
begin
return Ada.Containers.Hash_Type (N);
end Hash;
-- ------------------------------
-- Send the error page content defined by the response status.
-- ------------------------------
procedure Send_Error_Page (Server : in Servlet_Registry;
Request : in out Requests.Request'Class;
Response : in out Responses.Response'Class) is
URI : constant String := Request.Get_Request_URI;
Status : constant Natural := Response.Get_Status;
Pos : constant Error_Maps.Cursor := Server.Error_Pages.Find (Status);
begin
Request.Set_Attribute ("servlet.error.status_code", EL.Objects.To_Object (Integer (Status)));
Request.Set_Attribute ("servlet.error.request_uri", EL.Objects.To_Object (URI));
if Error_Maps.Has_Element (Pos) then
declare
Page : constant String := Error_Maps.Element (Pos);
Dispatcher : constant Request_Dispatcher
:= Server.Get_Request_Dispatcher (Page);
begin
Forward (Dispatcher, Request, Response);
return;
exception
when others =>
null;
end;
end if;
Response.Set_Content_Type ("text/html");
declare
Output : Streams.Print_Stream := Response.Get_Output_Stream;
Value : EL.Objects.Object;
begin
Output.Write ("<html><head><title>Server error</title>"
& "<style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;"
& "background-color:#525D76;font-size:22px;} "
& "H2 {font-family:Tahoma,Arial,sans-serif;color:white;"
& "background-color:#525D76;font-size:16px;} "
& "H3 {font-family:Tahoma,Arial,sans-serif;color:white;"
& " background-color:#525D76;font-size:14px;} "
& "BODY {font-family:Tahoma,Arial,sans-serif;color:black;"
& "background-color:white;} "
& "B {font-family:Tahoma,Arial,sans-serif;color:white;"
& "background-color:#525D76;} "
& "P {font-family:Tahoma,Arial,sans-serif;background:white;"
& "color:black;font-size:12px;}A {color : black;}"
& "table {width:100%;} table td:first-child {width:20%}"
& "table th {text-align:left;color:white;background-color:#525D76;}"
& "A.name {color : black;}HR {color : #525D76;}--></style><body>"
& "<h1>HTTP error ");
Output.Write (Status);
Output.Write ("</h1><hr size='1' noshade='noshade'></hr><table>");
Output.Write ("<tr><td>Error</td><td>");
Output.Write (Status);
Output.Write ("</td></tr><tr><td>Page</td><td>");
Output.Write (URI);
Output.Write ("</td></tr>");
Value := Request.Get_Attribute ("servlet.error.message");
if not EL.Objects.Is_Null (Value) then
Output.Write ("<tr><td>Message:</td><td>");
Output.Write (Value);
Output.Write ("</td></tr>");
end if;
Value := Request.Get_Attribute ("servlet.error.exception_type");
if not EL.Objects.Is_Null (Value) then
Output.Write ("<tr><td>Exception:</td><td>");
Output.Write (Value);
Output.Write ("</td></tr>");
end if;
Value := Request.Get_Attribute ("servlet.error.exception");
if not EL.Objects.Is_Null (Value) then
Output.Write ("<tr><td>Traceback:</td><td><pre>");
Output.Write (Value);
Output.Write ("</pre></td></tr>");
end if;
Output.Write ("<tr><td colspan='2'>");
Output.Write (Requests.Tools.To_String (Req => Request,
Html => True,
Print_Headers => True,
Print_Attributes => True));
Output.Write ("<td></tr></table></body>");
end;
end Send_Error_Page;
-- ------------------------------
-- Report an error when an exception occurred while processing the request.
-- ------------------------------
procedure Error (Registry : in Servlet_Registry;
Request : in out Requests.Request'Class;
Response : in out Responses.Response'Class;
Ex : in Ada.Exceptions.Exception_Occurrence) is
use GNAT.Traceback.Symbolic;
use Ada.Exceptions;
Name : constant String := Exception_Name (Ex);
Message : constant String := Exception_Message (Ex);
Has_Traceback : constant Boolean := True;
begin
Request.Set_Attribute ("servlet.error.exception_type",
EL.Objects.To_Object (Name));
Request.Set_Attribute ("servlet.error.message",
EL.Objects.To_Object (Message));
if Has_Traceback then
Request.Set_Attribute ("servlet.error.exception",
EL.Objects.To_Object (Symbolic_Traceback (Ex)));
end if;
Response.Set_Status (Responses.SC_INTERNAL_SERVER_ERROR);
Registry.Send_Error_Page (Request, Response);
end Error;
-- ------------------------------
-- Register the application represented by <b>Registry</b> under the base URI defined
-- by <b>URI</b>. This is called by the Web container when the application is registered.
-- The default implementation keeps track of the base URI to implement the context path
-- operation.
-- ------------------------------
procedure Register_Application (Registry : in out Servlet_Registry;
URI : in String) is
begin
Registry.Context_Path := To_Unbounded_String (URI);
end Register_Application;
-- ------------------------------
-- Finalize the servlet registry releasing the internal mappings.
-- ------------------------------
overriding
procedure Finalize (Registry : in out Servlet_Registry) is
begin
-- Release the filter mapping lists that have been allocated.
while not Registry.Filter_Rules.Is_Empty loop
declare
Pos : Filter_List_Maps.Cursor := Registry.Filter_Rules.First;
Filter : Filter_List_Access := Filter_List_Maps.Element (Pos).all'Access;
begin
Free (Filter);
Registry.Filter_Rules.Delete (Pos);
end;
end loop;
Sessions.Factory.Session_Factory (Registry).Finalize;
end Finalize;
end Servlet.Core;
|
oeis/072/A072474.asm | neoneye/loda-programs | 11 | 173859 | <filename>oeis/072/A072474.asm
; A072474: Sum of next n squares.
; Submitted by <NAME>
; 1,13,77,294,855,2071,4403,8492,15189,25585,41041,63218,94107,136059,191815,264536,357833,475797,623029,804670,1026431,1294623,1616187,1998724,2450525,2980601,3598713,4315402,5142019,6090755,7174671
add $0,1
mov $2,$0
pow $0,2
mov $1,$2
mul $1,$0
add $0,2
add $2,$1
div $2,2
add $2,$1
mul $0,$2
sub $0,6
div $0,6
add $0,1
|
Task/Sort-an-array-of-composite-structures/Ada/sort-an-array-of-composite-structures-1.ada | LaudateCorpus1/RosettaCodeData | 1 | 30846 | <gh_stars>1-10
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Containers.Generic_Array_Sort;
procedure Demo_Array_Sort is
function "+" (S : String) return Unbounded_String renames To_Unbounded_String;
type A_Composite is
record
Name : Unbounded_String;
Value : Unbounded_String;
end record;
function "<" (L, R : A_Composite) return Boolean is
begin
return L.Name < R.Name;
end "<";
procedure Put_Line (C : A_Composite) is
begin
Put_Line (To_String (C.Name) & " " & To_String (C.Value));
end Put_Line;
type An_Array is array (Natural range <>) of A_Composite;
procedure Sort is new Ada.Containers.Generic_Array_Sort (Natural, A_Composite, An_Array);
Data : An_Array := (1 => (Name => +"Joe", Value => +"5531"),
2 => (Name => +"Adam", Value => +"2341"),
3 => (Name => +"Bernie", Value => +"122"),
4 => (Name => +"Walter", Value => +"1234"),
5 => (Name => +"David", Value => +"19"));
begin
Sort (Data);
for I in Data'Range loop
Put_Line (Data (I));
end loop;
end Demo_Array_Sort;
|
src/Data/Quiver/Paths.agda | Trebor-Huang/agda-categories | 279 | 1578 | {-# OPTIONS --without-K --safe #-}
module Data.Quiver.Paths where
-- Paths in a Quiver.
--
-- This is almost the same as the 'paths' in a relation, as defined in
-- Relation.Binary.Construct.Closure.ReflexiveTransitive
-- but here the relation is typed, and that has to be respected. So this
-- is somewhat duplicated
open import Level
open import Data.Quiver
open import Relation.Binary using (Rel; IsEquivalence; Setoid)
import Relation.Binary.Reasoning.Setoid as EqR
open import Relation.Binary.Construct.Closure.ReflexiveTransitive
open import Relation.Binary.PropositionalEquality as ≡ using (_≡_)
module Paths {o ℓ e : Level} (Q : Quiver o ℓ e) where
open Quiver Q hiding (setoid)
private
variable
A B : Obj
infix 4 _≈*_
data _≈*_ : (p q : Star _⇒_ A B) → Set (o ⊔ ℓ ⊔ e) where
ε : {A : Obj} → _≈*_ {A} ε ε
_◅_ : {A B C : Obj} {x y : A ⇒ B} {p q : Star _⇒_ B C} (x≈y : x ≈ y) (p≈q : p ≈* q) → x ◅ p ≈* y ◅ q
refl : {p : Star _⇒_ A B} → p ≈* p
refl {p = ε} = ε
refl {p = x ◅ p} = Equiv.refl ◅ refl
sym : {p q : Star _⇒_ A B} → p ≈* q → q ≈* p
sym ε = ε
sym (x≈y ◅ eq) = Equiv.sym x≈y ◅ sym eq
≡⇒≈* : {p q : Star _⇒_ A B} → p ≡ q → p ≈* q
≡⇒≈* ≡.refl = refl
≡⇒≈ : {p q : A ⇒ B} → p ≡ q → p ≈ q
≡⇒≈ ≡.refl = Equiv.refl
trans : {p q r : Star _⇒_ A B} → p ≈* q → q ≈* r → p ≈* r
trans ε ε = ε
trans (x≈y ◅ ss) (y≈z ◅ tt) = Equiv.trans x≈y y≈z ◅ trans ss tt
isEquivalence : IsEquivalence (λ (p q : Star _⇒_ A B) → p ≈* q)
isEquivalence = record { refl = refl ; sym = sym ; trans = trans }
setoid : Obj → Obj → Setoid (o ⊔ ℓ) (o ⊔ ℓ ⊔ e)
setoid A B = record { _≈_ = _≈*_ ; isEquivalence = isEquivalence {A} {B} }
-- convenient to define here
--
-- FIXME: this should go into the standard library at
-- Relation.Binary.Construct.Closure.ReflexiveTransitive.Properties
◅◅-identityʳ : (f : Star _⇒_ A B) → f ◅◅ ε ≈* f
◅◅-identityʳ ε = ε
◅◅-identityʳ (x ◅ f) = Equiv.refl ◅ ◅◅-identityʳ f
module PathEqualityReasoning {A B} where
open EqR (setoid A B) public
|
oeis/117/A117998.asm | neoneye/loda-programs | 11 | 170969 | ; A117998: Decimal number generated by the binary bits of the n-th generation of the Rule 102 elementary cellular automaton.
; Submitted by <NAME>
; 1,6,20,120,272,1632,5440,32640,65792,394752,1315840,7895040,17895424,107372544,357908480,2147450880,4295032832,25770196992,85900656640,515403939840,1168248930304,7009493581824,23364978606080,140189871636480,282578800082944,1695472800497664,5651576001658880,33909456009953280,76861433622560768,461168601735364608,1537228672451215360,9223372034707292160,18446744078004518912,110680464468027113472,368934881560090378240,2213609289360542269440,5017514389217229144064,30105086335303374864384
mov $1,1
lpb $0
sub $0,1
seq $1,48724 ; Write n and 2n in binary and add them mod 2.
mul $1,2
lpe
mov $0,$1
|
programs/oeis/066/A066810.asm | jmorken/loda | 1 | 93045 | <filename>programs/oeis/066/A066810.asm
; A066810: Expansion of x^2/((1-3*x)*(1-2*x)^2).
; 0,0,1,7,33,131,473,1611,5281,16867,52905,163835,502769,1532883,4651897,14070379,42456897,127894979,384799049,1156756443,3475250065,10436235955,31330727961,94038321227,282211432673,846835624611,2540926304233,7623651327931,22872765923121,68622055865747,205873952225465,617637962803755,1852947174407809,5558910242700163
mov $1,2
mov $2,$0
add $2,2
lpb $0
sub $0,1
mul $1,3
mul $2,2
lpe
sub $1,$2
mul $1,2
div $1,4
|
tests/subnormal/src/main.adb | TUM-EI-RCS/StratoX | 12 | 13750 | with Ada.Text_IO; use Ada.Text_IO;
with Ada.Numerics.Generic_Elementary_Functions;
with Interfaces; use Interfaces;
procedure main with SPARK_Mode is
package Efuncs is new Ada.Numerics.Generic_Elementary_Functions (Interfaces.IEEE_Float_32);
package Efuncs64 is new Ada.Numerics.Generic_Elementary_Functions (Interfaces.IEEE_Float_64);
machine_has_denorm : constant Boolean := Float'Denorm;
pragma Assert (machine_has_denorm);
machine_exp_max : constant Integer := Interfaces.IEEE_Float_32'Machine_Emax;
float_32bit : constant Boolean := machine_exp_max = 128;
pragma assert (float_32bit);
-- float 32bit: 1+(significand)*2^(exp), where significand=23bit, exp=8bit signed (-127..128)
-- smallest possible significant: 1.0 => smallest possible float: 2^-126 = 1.175E-38
sub1 : Interfaces.IEEE_Float_32 := -1.1E-39; -- starting at ~-38 we get denormals here; compiler warns us
sub2 : Interfaces.IEEE_Float_32 := 100.0;
res : Interfaces.IEEE_Float_32;
sub64 : Interfaces.IEEE_Float_64 := 2.0E-308;
sub4 : Interfaces.IEEE_Float_64;
begin
-- Float Attributes: http://www.adaic.org/resources/add_content/standards/12rm/html/RM-A-5-3.html
Put_Line ("Float Info:");
Put_Line ("Machine Radix: " & Integer'Image(Float'Machine_Radix) & ", Machine Mantissa: " & Integer'Image(Float'Machine_Mantissa));
Put_Line ("Machine Exponent: " & Integer'Image(Float'Machine_Emin) & " .. " & Integer'Image(Float'Machine_Emax));
Put_Line ("Machine Denormals: " & Boolean'Image(machine_has_denorm));
Put_Line ("Machine Overflows: " & Boolean'Image(Float'Machine_Overflows));
Put_Line ("Machine Rounds: " & Boolean'Image(Float'Machine_Rounds));
Put_Line ("Signed Zeros: " & Boolean'Image(Float'Signed_Zeros));
Put_Line ("Model Epsilon: " & Float'Image(Float'Model_Epsilon));
Put_Line ("Model Small: " & Float'Image(Float'Model_Small));
Put_Line ("Model Emin: " & Integer'Image(Float'Model_Emin));
Put_Line ("Model Mantissa: " & Integer'Image(Float'Model_Mantissa));
Put_Line ("Safe Range: " & Float'Image(Float'Safe_First) & " .. " & Float'Image(Float'Safe_Last));
pragma Assert (sub1 /= 0.0); -- this is still successful with a denormal
sub4 := 1.12E-309;
sub4 := Efuncs64.Sin(sub4);
-- Put(IEEE_Float_64'Image(sub4));
sub64 := sub64 * sub4;
--res := Efuncs.cos (sub1*sub1);
--Put_Line ("exp min=" & Integer'Image(machine_exp_min));
res := sub1 - sub2; -- always okay
res := sub1 / sub2; -- also okay
res := sub1 + 1.0; -- also okay
res := sub1 * sub1;
pragma Assert (res in -1.0 .. 1.0);
res := res * sub1;
end main;
|
data/pattern/OpAppP.agda | msuperdock/agda-unused | 6 | 4707 | module OpAppP where
data Bool
: Set
where
false
: Bool
true
: Bool
_&&_
: Bool
→ Bool
→ Bool
false && _
= false
true && b
= b
|
Peano.agda | cantsin/agda-experiments | 0 | 1439 | <reponame>cantsin/agda-experiments
open import Agda.Primitive
open import Empty
open import Logic
open import Boolean
module Peano where
data ℕ : Set where
zero : ℕ
succ : ℕ → ℕ
{-# BUILTIN NATURAL ℕ #-}
pred : ℕ → ℕ
pred zero = zero
pred (succ x) = x
_+_ : ℕ → ℕ → ℕ
zero + m = m
(succ n) + m = succ (n + m)
{-# BUILTIN NATPLUS _+_ #-}
_∘_ : ℕ → ℕ → ℕ
zero ∘ _ = zero
(succ n) ∘ m = (n ∘ m) + m
{-# BUILTIN NATTIMES _∘_ #-}
data _≡_ (x : ℕ) : ℕ → Set where
refl : x ≡ x
data _≢_ : ℕ → ℕ → Set where
z≢s : ∀ {n} → zero ≢ succ n
s≢z : ∀ {n} → succ n ≢ zero
s≢s : ∀ {m n} → m ≢ n → succ m ≢ succ n
data Equal? (m n : ℕ) : Set where
yes : m ≡ n → Equal? m n
no : m ≢ n → Equal? m n
_≟_ : (m n : ℕ) → Equal? m n
_≟_ zero zero = yes refl
_≟_ zero (succ _) = no z≢s
_≟_ (succ _) zero = no s≢z
_≟_ (succ m) (succ n) with m ≟ n
_≟_ (succ m) (succ .m) | yes refl = yes refl
_≟_ (succ m) (succ n) | no p = no (s≢s p)
equality-disjoint : (m n : ℕ) → m ≡ n → m ≢ n → ⊥
equality-disjoint zero zero refl ()
equality-disjoint zero (succ _) () z≢s
equality-disjoint (succ _) zero () s≢z
equality-disjoint (succ m) (succ .m) refl (s≢s e) = equality-disjoint m m refl e
private
-- to make the last `equality-disjoint` match clearer, verify that s≢s can be nested
test-s≢s : (succ (succ (succ zero))) ≢ (succ (succ zero))
test-s≢s = s≢s (s≢s s≢z)
data Ordering : Rel ℕ where
less : ∀ m k → Ordering m (succ (m + k))
equal : ∀ m → Ordering m m
greater : ∀ m k → Ordering (succ (m + k)) m
compare : ∀ m n → Ordering m n
compare zero zero = equal zero
compare (succ m) zero = greater zero m
compare zero (succ n) = less zero n
compare (succ m) (succ n) with compare m n
compare (succ .m) (succ .(succ m + k)) | less m k = less (succ m) k
compare (succ .m) (succ .m) | equal m = equal (succ m)
compare (succ .(succ m + k)) (succ .m) | greater m k = greater (succ m) k
infix 4 _≤_ _<_ _≥_ _>_ _≰_ _≮_ _≱_ _≯_
data _≤_ : Rel ℕ where
z≤n : ∀ {n} → zero ≤ n
s≤s : ∀ {m n} (m≤n : m ≤ n) → succ m ≤ succ n
_<_ : Rel ℕ
m < n = succ m ≤ n
_≥_ : Rel ℕ
m ≥ n = n ≤ m
_>_ : Rel ℕ
m > n = n < m
_≰_ : Rel ℕ
a ≰ b = ¬ (a ≤ b)
_≮_ : Rel ℕ
a ≮ b = ¬ (a < b)
_≱_ : Rel ℕ
a ≱ b = ¬ (a ≥ b)
_≯_ : Rel ℕ
a ≯ b = ¬ (a > b)
data _even : ℕ → Set where
ZERO : zero even
STEP : ∀ {x} → x even → succ (succ x) even
private
proof₁ : succ(succ(succ(succ(zero)))) even
proof₁ = STEP (STEP ZERO)
proof₂ : (A : Set) → A → A
proof₂ _ ν = ν
proof'₂ : ℕ → ℕ
proof'₂ = proof₂ ℕ
|
gcc-gcc-7_3_0-release/gcc/ada/g-decstr.adb | best08618/asylo | 7 | 4077 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . D E C O D E _ S T R I N G --
-- --
-- S p e c --
-- --
-- Copyright (C) 2007-2014, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides a utility routine for converting from an encoded
-- string to a corresponding Wide_String or Wide_Wide_String value.
with Interfaces; use Interfaces;
with System.WCh_Cnv; use System.WCh_Cnv;
with System.WCh_Con; use System.WCh_Con;
package body GNAT.Decode_String is
-----------------------
-- Local Subprograms --
-----------------------
procedure Bad;
pragma No_Return (Bad);
-- Raise error for bad encoding
procedure Past_End;
pragma No_Return (Past_End);
-- Raise error for off end of string
---------
-- Bad --
---------
procedure Bad is
begin
raise Constraint_Error with
"bad encoding or character out of range";
end Bad;
---------------------------
-- Decode_Wide_Character --
---------------------------
procedure Decode_Wide_Character
(Input : String;
Ptr : in out Natural;
Result : out Wide_Character)
is
Char : Wide_Wide_Character;
begin
Decode_Wide_Wide_Character (Input, Ptr, Char);
if Wide_Wide_Character'Pos (Char) > 16#FFFF# then
Bad;
else
Result := Wide_Character'Val (Wide_Wide_Character'Pos (Char));
end if;
end Decode_Wide_Character;
------------------------
-- Decode_Wide_String --
------------------------
function Decode_Wide_String (S : String) return Wide_String is
Result : Wide_String (1 .. S'Length);
Length : Natural;
begin
Decode_Wide_String (S, Result, Length);
return Result (1 .. Length);
end Decode_Wide_String;
procedure Decode_Wide_String
(S : String;
Result : out Wide_String;
Length : out Natural)
is
Ptr : Natural;
begin
Ptr := S'First;
Length := 0;
while Ptr <= S'Last loop
if Length >= Result'Last then
Past_End;
end if;
Length := Length + 1;
Decode_Wide_Character (S, Ptr, Result (Length));
end loop;
end Decode_Wide_String;
--------------------------------
-- Decode_Wide_Wide_Character --
--------------------------------
procedure Decode_Wide_Wide_Character
(Input : String;
Ptr : in out Natural;
Result : out Wide_Wide_Character)
is
C : Character;
function In_Char return Character;
pragma Inline (In_Char);
-- Function to get one input character
-------------
-- In_Char --
-------------
function In_Char return Character is
begin
if Ptr <= Input'Last then
Ptr := Ptr + 1;
return Input (Ptr - 1);
else
Past_End;
end if;
end In_Char;
-- Start of processing for Decode_Wide_Wide_Character
begin
C := In_Char;
-- Special fast processing for UTF-8 case
if Encoding_Method = WCEM_UTF8 then
UTF8 : declare
U : Unsigned_32;
W : Unsigned_32;
procedure Get_UTF_Byte;
pragma Inline (Get_UTF_Byte);
-- Used to interpret 2#10xxxxxx# continuation byte in UTF-8 mode.
-- Reads a byte, and raises CE if the first two bits are not 10.
-- Otherwise shifts W 6 bits left and or's in the 6 xxxxxx bits.
------------------
-- Get_UTF_Byte --
------------------
procedure Get_UTF_Byte is
begin
U := Unsigned_32 (Character'Pos (In_Char));
if (U and 2#11000000#) /= 2#10_000000# then
Bad;
end if;
W := Shift_Left (W, 6) or (U and 2#00111111#);
end Get_UTF_Byte;
-- Start of processing for UTF8 case
begin
-- Note: for details of UTF8 encoding see RFC 3629
U := Unsigned_32 (Character'Pos (C));
-- 16#00_0000#-16#00_007F#: 0xxxxxxx
if (U and 2#10000000#) = 2#00000000# then
Result := Wide_Wide_Character'Val (Character'Pos (C));
-- 16#00_0080#-16#00_07FF#: 110xxxxx 10xxxxxx
elsif (U and 2#11100000#) = 2#110_00000# then
W := U and 2#00011111#;
Get_UTF_Byte;
if W not in 16#00_0080# .. 16#00_07FF# then
Bad;
end if;
Result := Wide_Wide_Character'Val (W);
-- 16#00_0800#-16#00_ffff#: 1110xxxx 10xxxxxx 10xxxxxx
elsif (U and 2#11110000#) = 2#1110_0000# then
W := U and 2#00001111#;
Get_UTF_Byte;
Get_UTF_Byte;
if W not in 16#00_0800# .. 16#00_FFFF# then
Bad;
end if;
Result := Wide_Wide_Character'Val (W);
-- 16#01_0000#-16#10_FFFF#: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
elsif (U and 2#11111000#) = 2#11110_000# then
W := U and 2#00000111#;
for K in 1 .. 3 loop
Get_UTF_Byte;
end loop;
if W not in 16#01_0000# .. 16#10_FFFF# then
Bad;
end if;
Result := Wide_Wide_Character'Val (W);
-- 16#0020_0000#-16#03FF_FFFF#: 111110xx 10xxxxxx 10xxxxxx
-- 10xxxxxx 10xxxxxx
elsif (U and 2#11111100#) = 2#111110_00# then
W := U and 2#00000011#;
for K in 1 .. 4 loop
Get_UTF_Byte;
end loop;
if W not in 16#0020_0000# .. 16#03FF_FFFF# then
Bad;
end if;
Result := Wide_Wide_Character'Val (W);
-- All other cases are invalid, note that this includes:
-- 16#0400_0000#-16#7FFF_FFFF#: 1111110x 10xxxxxx 10xxxxxx
-- 10xxxxxx 10xxxxxx 10xxxxxx
-- since Wide_Wide_Character does not include code values
-- greater than 16#03FF_FFFF#.
else
Bad;
end if;
end UTF8;
-- All encoding functions other than UTF-8
else
Non_UTF8 : declare
function Char_Sequence_To_UTF is
new Char_Sequence_To_UTF_32 (In_Char);
begin
-- For brackets, must test for specific case of [ not followed by
-- quotation, where we must not call Char_Sequence_To_UTF, but
-- instead just return the bracket unchanged.
if Encoding_Method = WCEM_Brackets
and then C = '['
and then (Ptr > Input'Last or else Input (Ptr) /= '"')
then
Result := '[';
-- All other cases including [" with Brackets
else
Result :=
Wide_Wide_Character'Val
(Char_Sequence_To_UTF (C, Encoding_Method));
end if;
end Non_UTF8;
end if;
end Decode_Wide_Wide_Character;
-----------------------------
-- Decode_Wide_Wide_String --
-----------------------------
function Decode_Wide_Wide_String (S : String) return Wide_Wide_String is
Result : Wide_Wide_String (1 .. S'Length);
Length : Natural;
begin
Decode_Wide_Wide_String (S, Result, Length);
return Result (1 .. Length);
end Decode_Wide_Wide_String;
procedure Decode_Wide_Wide_String
(S : String;
Result : out Wide_Wide_String;
Length : out Natural)
is
Ptr : Natural;
begin
Ptr := S'First;
Length := 0;
while Ptr <= S'Last loop
if Length >= Result'Last then
Past_End;
end if;
Length := Length + 1;
Decode_Wide_Wide_Character (S, Ptr, Result (Length));
end loop;
end Decode_Wide_Wide_String;
-------------------------
-- Next_Wide_Character --
-------------------------
procedure Next_Wide_Character (Input : String; Ptr : in out Natural) is
Discard : Wide_Character;
begin
Decode_Wide_Character (Input, Ptr, Discard);
end Next_Wide_Character;
------------------------------
-- Next_Wide_Wide_Character --
------------------------------
procedure Next_Wide_Wide_Character (Input : String; Ptr : in out Natural) is
Discard : Wide_Wide_Character;
begin
Decode_Wide_Wide_Character (Input, Ptr, Discard);
end Next_Wide_Wide_Character;
--------------
-- Past_End --
--------------
procedure Past_End is
begin
raise Constraint_Error with "past end of string";
end Past_End;
-------------------------
-- Prev_Wide_Character --
-------------------------
procedure Prev_Wide_Character (Input : String; Ptr : in out Natural) is
begin
if Ptr > Input'Last + 1 then
Past_End;
end if;
-- Special efficient encoding for UTF-8 case
if Encoding_Method = WCEM_UTF8 then
UTF8 : declare
U : Unsigned_32;
procedure Getc;
pragma Inline (Getc);
-- Gets the character at Input (Ptr - 1) and returns code in U as
-- Unsigned_32 value. On return Ptr is decremented by one.
procedure Skip_UTF_Byte;
pragma Inline (Skip_UTF_Byte);
-- Checks that U is 2#10xxxxxx# and then calls Get
----------
-- Getc --
----------
procedure Getc is
begin
if Ptr <= Input'First then
Past_End;
else
Ptr := Ptr - 1;
U := Unsigned_32 (Character'Pos (Input (Ptr)));
end if;
end Getc;
-------------------
-- Skip_UTF_Byte --
-------------------
procedure Skip_UTF_Byte is
begin
if (U and 2#11000000#) = 2#10_000000# then
Getc;
else
Bad;
end if;
end Skip_UTF_Byte;
-- Start of processing for UTF-8 case
begin
-- 16#00_0000#-16#00_007F#: 0xxxxxxx
Getc;
if (U and 2#10000000#) = 2#00000000# then
return;
-- 16#00_0080#-16#00_07FF#: 110xxxxx 10xxxxxx
else
Skip_UTF_Byte;
if (U and 2#11100000#) = 2#110_00000# then
return;
-- 16#00_0800#-16#00_ffff#: 1110xxxx 10xxxxxx 10xxxxxx
else
Skip_UTF_Byte;
if (U and 2#11110000#) = 2#1110_0000# then
return;
-- Any other code is invalid, note that this includes:
-- 16#01_0000#-16#10_FFFF#: 11110xxx 10xxxxxx 10xxxxxx
-- 10xxxxxx
-- 16#0020_0000#-16#03FF_FFFF#: 111110xx 10xxxxxx
-- 10xxxxxx 10xxxxxx
-- 10xxxxxx
-- 16#0400_0000#-16#7FFF_FFFF#: 1111110x 10xxxxxx
-- 10xxxxxx 10xxxxxx
-- 10xxxxxx 10xxxxxx
-- since Wide_Character does not allow codes > 16#FFFF#
else
Bad;
end if;
end if;
end if;
end UTF8;
-- Special efficient encoding for brackets case
elsif Encoding_Method = WCEM_Brackets then
Brackets : declare
P : Natural;
S : Natural;
begin
-- See if we have "] at end positions
if Ptr > Input'First + 1
and then Input (Ptr - 1) = ']'
and then Input (Ptr - 2) = '"'
then
P := Ptr - 2;
-- Loop back looking for [" at start
while P >= Ptr - 10 loop
if P <= Input'First + 1 then
Bad;
elsif Input (P - 1) = '"'
and then Input (P - 2) = '['
then
-- Found ["..."], scan forward to check it
S := P - 2;
P := S;
Next_Wide_Character (Input, P);
-- OK if at original pointer, else error
if P = Ptr then
Ptr := S;
return;
else
Bad;
end if;
end if;
P := P - 1;
end loop;
-- Falling through loop means more than 8 chars between the
-- enclosing brackets (or simply a missing left bracket)
Bad;
-- Here if no bracket sequence present
else
if Ptr = Input'First then
Past_End;
else
Ptr := Ptr - 1;
end if;
end if;
end Brackets;
-- Non-UTF-8/Brackets. These are the inefficient cases where we have to
-- go to the start of the string and skip forwards till Ptr matches.
else
Non_UTF_Brackets : declare
Discard : Wide_Character;
PtrS : Natural;
PtrP : Natural;
begin
PtrS := Input'First;
if Ptr <= PtrS then
Past_End;
end if;
loop
PtrP := PtrS;
Decode_Wide_Character (Input, PtrS, Discard);
if PtrS = Ptr then
Ptr := PtrP;
return;
elsif PtrS > Ptr then
Bad;
end if;
end loop;
exception
when Constraint_Error =>
Bad;
end Non_UTF_Brackets;
end if;
end Prev_Wide_Character;
------------------------------
-- Prev_Wide_Wide_Character --
------------------------------
procedure Prev_Wide_Wide_Character (Input : String; Ptr : in out Natural) is
begin
if Ptr > Input'Last + 1 then
Past_End;
end if;
-- Special efficient encoding for UTF-8 case
if Encoding_Method = WCEM_UTF8 then
UTF8 : declare
U : Unsigned_32;
procedure Getc;
pragma Inline (Getc);
-- Gets the character at Input (Ptr - 1) and returns code in U as
-- Unsigned_32 value. On return Ptr is decremented by one.
procedure Skip_UTF_Byte;
pragma Inline (Skip_UTF_Byte);
-- Checks that U is 2#10xxxxxx# and then calls Get
----------
-- Getc --
----------
procedure Getc is
begin
if Ptr <= Input'First then
Past_End;
else
Ptr := Ptr - 1;
U := Unsigned_32 (Character'Pos (Input (Ptr)));
end if;
end Getc;
-------------------
-- Skip_UTF_Byte --
-------------------
procedure Skip_UTF_Byte is
begin
if (U and 2#11000000#) = 2#10_000000# then
Getc;
else
Bad;
end if;
end Skip_UTF_Byte;
-- Start of processing for UTF-8 case
begin
-- 16#00_0000#-16#00_007F#: 0xxxxxxx
Getc;
if (U and 2#10000000#) = 2#00000000# then
return;
-- 16#00_0080#-16#00_07FF#: 110xxxxx 10xxxxxx
else
Skip_UTF_Byte;
if (U and 2#11100000#) = 2#110_00000# then
return;
-- 16#00_0800#-16#00_ffff#: 1110xxxx 10xxxxxx 10xxxxxx
else
Skip_UTF_Byte;
if (U and 2#11110000#) = 2#1110_0000# then
return;
-- 16#01_0000#-16#10_FFFF#: 11110xxx 10xxxxxx 10xxxxxx
-- 10xxxxxx
else
Skip_UTF_Byte;
if (U and 2#11111000#) = 2#11110_000# then
return;
-- 16#0020_0000#-16#03FF_FFFF#: 111110xx 10xxxxxx
-- 10xxxxxx 10xxxxxx
-- 10xxxxxx
else
Skip_UTF_Byte;
if (U and 2#11111100#) = 2#111110_00# then
return;
-- Any other code is invalid, note that this includes:
-- 16#0400_0000#-16#7FFF_FFFF#: 1111110x 10xxxxxx
-- 10xxxxxx 10xxxxxx
-- 10xxxxxx 10xxxxxx
-- since Wide_Wide_Character does not allow codes
-- greater than 16#03FF_FFFF#
else
Bad;
end if;
end if;
end if;
end if;
end if;
end UTF8;
-- Special efficient encoding for brackets case
elsif Encoding_Method = WCEM_Brackets then
Brackets : declare
P : Natural;
S : Natural;
begin
-- See if we have "] at end positions
if Ptr > Input'First + 1
and then Input (Ptr - 1) = ']'
and then Input (Ptr - 2) = '"'
then
P := Ptr - 2;
-- Loop back looking for [" at start
while P >= Ptr - 10 loop
if P <= Input'First + 1 then
Bad;
elsif Input (P - 1) = '"'
and then Input (P - 2) = '['
then
-- Found ["..."], scan forward to check it
S := P - 2;
P := S;
Next_Wide_Wide_Character (Input, P);
-- OK if at original pointer, else error
if P = Ptr then
Ptr := S;
return;
else
Bad;
end if;
end if;
P := P - 1;
end loop;
-- Falling through loop means more than 8 chars between the
-- enclosing brackets (or simply a missing left bracket)
Bad;
-- Here if no bracket sequence present
else
if Ptr = Input'First then
Past_End;
else
Ptr := Ptr - 1;
end if;
end if;
end Brackets;
-- Non-UTF-8/Brackets. These are the inefficient cases where we have to
-- go to the start of the string and skip forwards till Ptr matches.
else
Non_UTF8_Brackets : declare
Discard : Wide_Wide_Character;
PtrS : Natural;
PtrP : Natural;
begin
PtrS := Input'First;
if Ptr <= PtrS then
Past_End;
end if;
loop
PtrP := PtrS;
Decode_Wide_Wide_Character (Input, PtrS, Discard);
if PtrS = Ptr then
Ptr := PtrP;
return;
elsif PtrS > Ptr then
Bad;
end if;
end loop;
exception
when Constraint_Error =>
Bad;
end Non_UTF8_Brackets;
end if;
end Prev_Wide_Wide_Character;
--------------------------
-- Validate_Wide_String --
--------------------------
function Validate_Wide_String (S : String) return Boolean is
Ptr : Natural;
begin
Ptr := S'First;
while Ptr <= S'Last loop
Next_Wide_Character (S, Ptr);
end loop;
return True;
exception
when Constraint_Error =>
return False;
end Validate_Wide_String;
-------------------------------
-- Validate_Wide_Wide_String --
-------------------------------
function Validate_Wide_Wide_String (S : String) return Boolean is
Ptr : Natural;
begin
Ptr := S'First;
while Ptr <= S'Last loop
Next_Wide_Wide_Character (S, Ptr);
end loop;
return True;
exception
when Constraint_Error =>
return False;
end Validate_Wide_Wide_String;
end GNAT.Decode_String;
|
programs/oeis/240/A240951.asm | karttu/loda | 1 | 173830 | ; A240951: Maximum number of dividing subsets of a set of n natural numbers.
; 1,2,5,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,4294967296,8589934592
mov $1,$0
cmp $0,2
mov $2,2
pow $2,$1
add $0,$2
mov $1,$0
|
programs/oeis/157/A157990.asm | neoneye/loda | 22 | 19504 | <reponame>neoneye/loda
; A157990: a(n) = 288*n + 1.
; 289,577,865,1153,1441,1729,2017,2305,2593,2881,3169,3457,3745,4033,4321,4609,4897,5185,5473,5761,6049,6337,6625,6913,7201,7489,7777,8065,8353,8641,8929,9217,9505,9793,10081,10369,10657,10945,11233,11521,11809,12097,12385,12673,12961,13249,13537,13825,14113,14401,14689,14977,15265,15553,15841,16129,16417,16705,16993,17281,17569,17857,18145,18433,18721,19009,19297,19585,19873,20161,20449,20737,21025,21313,21601,21889,22177,22465,22753,23041,23329,23617,23905,24193,24481,24769,25057,25345,25633,25921,26209,26497,26785,27073,27361,27649,27937,28225,28513,28801
mul $0,288
add $0,289
|
src/main.adb | fionahiklas/ada_unit_test_examples | 26 | 13304 | procedure Main is
begin
-- Insert code here.
null;
end Main;
|
entity-engine/src/main/java/org/blab/mde/ee/dal/ftl/g4/FTFile.g4 | leonlee/mde | 9 | 3227 | grammar FTFile;
options {
language=Java;
}
tokens {
TRUE,FALSE
}
@parser::header {
import java.util.Collections;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import org.blab.mde.ee.dal.ftl.utils.*;
import org.blab.mde.ee.dal.ftl.*;
import java.io.File;
import org.blab.mde.core.exception.CrashedException;
}
@lexer::header {
import org.blab.mde.ee.dal.ftl.utils.*;
import org.blab.mde.ee.dal.ftl.*;
import java.io.File;
import org.blab.mde.core.exception.CrashedException;
}
@parser::members {
public FTFile ftFile;
@Override
public String getSourceName() {
String fullFileName = super.getSourceName();
File f = new File(fullFileName); // strip to simple name
return f.getName();
}
}
@lexer::members {
public FTFile ftFile;
@Override
public String getSourceName() {
String fullFileName = super.getSourceName();
File f = new File(fullFileName); // strip to simple name
return f.getName();
}
}
group[FTFile ftFile, String prefix]
@init {
FTFileLexer lexer = (FTFileLexer)_input.getTokenSource();
this.ftFile = lexer.ftFile = ftFile;
}
: oldStyleHeader?
delimiters?
('import' IDS {ftFile.importTemplates($IDS);})*?
def[prefix]*
EOF
;
oldStyleHeader
: 'group' ID ( ':' ID )?
( 'implements' ID (',' ID)* )?
';'
;
groupName returns [String name]
@init {StringBuilder buf = new StringBuilder();}
: a=ID {buf.append($a.text);} ('.' a=ID {buf.append($a.text);})*
;
delimiters
: 'delimiters' a=STRING ',' b=STRING
{
ftFile.delimiterStartChar=$a.getText().charAt(1);
ftFile.delimiterStopChar=$b.getText().charAt(1);
}
;
def[String prefix] : templateDef[prefix] ;
catch[RecognitionException re] {
}
templateDef[String prefix]
@init {
String template=null;
int n=0; // num char to strip from left, right of template def
}
: ( '@' enclosing=ID '.' name=ID
| name=ID
)
'::='
{Token templateToken = _input.LT(1);}
( STRING {template=$STRING.text; n=1;}
| BIGSTRING {template=$BIGSTRING.text; n=2;}
| BIGSTRING_NO_NL {template=$BIGSTRING_NO_NL.text; n=2;}
| {
template = "";
String msg = "missing template at '"+_input.LT(1).getText()+"'";
}
)
{
if ( $name.index >= 0 ) { // if ID missing
template = MiscUtil.strip(template, n);
String templateName = $name.text;
if ( prefix.length()>0 ) templateName = prefix+$name.text;
ftFile.defineTemplate(templateName, templateToken,
template, $name);
}
}
;
ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'-'|'_')*
;
IDS : ID ('.' ID)* ;
STRING
: '"'
( '\\' '"'
| '\\' ~'"'
| {
}
'\n'
| ~('\\'|'"'|'\n')
)*
'"'
{
String txt = getText().replaceAll("\\\\\"","\"");
setText(txt);
}
;
BIGSTRING_NO_NL
: '<%' ( . )* '%>'
// %\> is the escape to avoid end of string
{
String txt = getText().replaceAll("\\%\\\\>","\\%>");
setText(txt);
}
;
BIGSTRING
: '<<'
( '\\' '>' // \> escape
| '\\' ~'>' // allow this but don't collapse in action
| ~'\\'
)*?
'>>'
{
String txt = getText();
txt = MiscUtil.replaceEscapedRightAngle(txt); // replace \> with > unless <\\>
setText(txt);
}
;
COMMENT
: '/*' ( . )*? '*/' {skip();}
;
LINE_COMMENT
: '//' ~('\n'|'\r')* '\r'? '\n' {skip();}
;
WS : (' '|'\r'|'\t'|'\n') {skip();} ;
|
crystal.asm | marler8997/crystal | 1 | 12515 | ;
; NOTE: linux boot protocol can be found here:
;
; https://github.com/torvalds/linux/blob/master/Documentation/x86/boot.txt
;
; Crystal Memory Map
; ------------------------------------------------------------------------------
; offset | limit | size | Description
; ------------------------------------------------------------------------------
; | 0x7c00 | | The stack (grows down from 0x7c00)
; 0x7c00 | 0x7e00 | 0x0200 (512) | Bootsector load address
; 0x7e00 | 0x9c00 | 0x1e00 (512 * 15) | Crystal stage 2 load address
; 0x9c00 | 0x9e00 | 0x0200 (512) | Kernel command line load address
; 0x9e00 | 0xa000 | 0x0200 (512) | Initrd info load address
; ...
; 0x10000 | | | The location where kernel setup code is loaded (not sure why)
; 0x20000 | | | Temporary location to load kernel before copying to highmove_addr
; 0x100000| | | Location where kernel is loaded (variable highmove_addr)
; Note that it is not loaded here directly, it is loaded
; to address 0x20000 and then moved here as it is read from disk.
;
bits 16
org 0x7c00
bootloader_reserve_sector_count equ 16
bootloader_size equ bootloader_end - $$
; These values are based on the offset the register will be stored
; after running pushad
ax_fmt equ 28
cx_fmt equ 24
dx_fmt equ 20
bx_fmt equ 16
start:
; initialize segments and stack
xor ax, ax
mov ds, ax
mov ss, ax
mov esp, 0x7c00 ; the stack grows down so we put it just below the bootloader
; so it won't overwrite it
mov [boot_disk_num], dl ; save the boot disk number (used in the read_disk function)
; print start message
and dx, 0xFF
mov ax, bootloader_size
mov si, .msg_started_dx_ax
call printfln
; calculate extra sector count to read
; todo: can I calculate this at compile time?
mov ax, bootloader_size - 512
mov bx, ax
shr ax, 9 ; divide by 512
and bx, 0x01ff ; get remainder
cmp bx, 0
jz .skip_add_sector
inc ax
.skip_add_sector:
; ax already contains the sector count
mov si, .msg_loading_stage2_ax
call printfln
; read in the rest of the bootloader
; ax already contains the sector count
mov ebx, 0x0000_7e00 ; dest 0xssss_oooo s=segment, o=offset
call read_disk
mov dword [read_disk.next_sector], bootloader_reserve_sector_count
jmp second_stage
.msg_started_dx_ax: db "crystal bootloader v0.0 (drive=%",dx_fmt,", size=%",ax_fmt,")", 0
.msg_loading_stage2_ax: db "loading stage 2 (%",ax_fmt," sectors)", 0
read_disk:
push eax
push edx
mov [.sector_count], ax ; populate extra arguments
mov [.dest_segment_and_offset], ebx ;
mov edx, [.next_sector] ;
mov dword [.src_lba], edx ;
and eax, 0xffff ; increment .next_sector
add edx, eax ;
mov [.next_sector], edx ;
; call bios "extended read"
mov ah, 0x42 ; method 0x42
mov si, .disk_address_packet ;
mov dl, [boot_disk_num] ; read from the boot disk
int 0x13
mov si, .error_msg_ax ; set error message in case we failed
shr ax, 8 ; set the error code in ah to ax so it can
; be included in the error message
jc fatal_error
pop edx
pop eax
ret
.next_sector: ; static counter variable that tracks the next sector to read
; TODO: make the initial value configurable?
dd 1 ; start at sector 1
.disk_address_packet:
db 0x10 ; size of the packet
db 0 ; reserved
.sector_count:
dw 0
.dest_segment_and_offset:
dd 0
.src_lba:
dq 0; lba
.error_msg_ax db "read_disk failed (e=%",ax_fmt,")", 0
print_ecx_hex_with_prefix:
push si
mov si, print_ecx_hex.hex_prefix
call printf
pop si
print_ecx_hex:
; input: ecx = value to print
push ecx
pusha
mov ax, sp ; save stack pointer to restore it at the end
dec sp ; push terminating null onto stack
mov [esp], byte 0 ;
.loop:
mov bl, cl
and bl, 0xF
cmp bl, 0xa
jl .is_decimal
add bl, 7 ; add offset to print 'a-f' instead of '0-9'
.is_decimal:
add bl, '0' ; convert hex value to hex digit
dec sp ; push char
mov [esp], bl
shr ecx, 4
cmp ecx, 0
jnz .loop
mov si, sp
call printf
mov sp, ax
popa
pop ecx
ret
.hex_prefix: db "0x", 0
printfln:
call printf
print_newline:
push si
mov si, .newline
call printf
pop si
ret
.newline: db 13, 10, 0 ; 13='\r' 10='\n'
printf:
; input: si points to address of null-terminated string
; TODO: what do I set bh = page number to? 0?
pushad
mov ah, 0x0e ; Argument for interrupt 10 which says to
; print the character in al to the screen
.next_char:
lodsb ; load next byte from memory pointed to by si
; into al and increment si
cmp al, '%'
jne .not_format_spec
lodsb
cmp al, 'e'
jne .not_32_bit
lodsb ; it is a 32-bit value
mov ebx, 0xFFFFFFFF
jmp .print_reg
.not_32_bit:
mov ebx, 0xFFFF
.print_reg:
; the value in al should represent one of the <reg>_fmt value
; which represent the register's offset in the stack after
; executing pushad
xor edx, edx ; zero edx
mov dl, al ; set edx to the register's stack offset
add dx, sp ; add stack to edx
mov ecx, [edx] ; read the register value from the stack
and ecx, ebx ; mask the value (if we're not printing 32-bit)
call print_ecx_hex_with_prefix
jmp .next_char
.not_format_spec:
cmp al, 0
je .done ; If char is zero, end of string
.print_al:
int 10h ; Otherwise, print it
jmp .next_char
.done:
;pop ecx
;pop ebx
;pop eax
popad
ret
fatal_error:
; input: si points to address of null-terminated error message
push si
mov si, .prefix
call printf
pop si
call printfln
cli
hlt
.prefix: db "fatal error: ", 0
dev_break:
mov si, .msg
call printfln
cli
hlt
.msg: db "dev break", 0
boot_disk_num: db 0
; this line ensures the boot sector code doesn't spill into
; the partition table of the MBR
times 446 - ($-$$) db 0x00
times 510 - ($-$$) db 0xcc; special value so you can see where the partition table is
dw 0xAA55
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 2nd stage bootloader
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
second_stage:
mov si, msg_at_stage2
call printfln
; read the kernel command line sector
mov ax, 1 ; sector_count
mov ebx, 0x0000_9c00 ; dest 0xssss_oooo s=segment o=offset
call read_disk
;
; read kernel command line
;
xor bx, bx ; zero out the counter
.next_cmd_line_char:
cmp [0x9c00+bx], byte 0
jz .found_cmd_line_null
inc bx
mov si, error_msg.kernel_cmd_line_has_no_null_terminator
cmp bx, 512
je fatal_error
jmp .next_cmd_line_char
.found_cmd_line_null:
mov [kernel_cmd_line_size], bx
; print the kernel command line
mov si, msg_kernel_cmd_line_prefix_bx
call printf
mov si, 0x9c00
call printf
mov si, msg_kernel_cmd_line_suffix
call printfln
;
; get into protected mode so we can setup "unreal" mode
; to access 32-addresses and load the kernel
;
mov ax, 0x2401 ; enable A20 line
int 0x15
mov si, error_msg.enable_a20
jc fatal_error
lgdt [gdt_register_value] ; load the global descriptor table
mov eax, cr0 ; enable protected mode bit in control register
; NOTE: do not modify eax until after 'back_to_real_mode'
or eax, 1
mov cr0, eax
; jmp $+2 ; WHAT DOES THIS DO???
mov bx, 0x8 ; first descriptor in GDT
mov ds, bx
mov es, bx
mov gs, bx
and al, 0xfe ; 'back_to_real_mode'
mov cr0, eax ; disable protected mode bit in control register
; restore segments registers
xor ax, ax
mov ds, ax
mov gs, ax
mov ax, 0x1000 ; set es to segment for kernel (starts being used below at "read kernel setup sectors")
mov es, ax ;
sti
;
; now in "unreal" mode
;
; read the first sector of the kernel which tells us how many
; sectors to read for the rest of the kernel setup memory
mov ax, 1 ; sector_count
mov ebx, 0x1000_0000 ; dest 0xssss_oooo s=segment o=offset
call read_disk
;
; read kernel setup sectors
;
xor ah,ah ; zero ah so when we print ax it only shows al
mov al, [es:0x1f1] ; kernel setup size
mov si, msg_kernel_setup_sector_count_ax ; print the size
call printfln
; default to 4 sectors if we got a value of 0
cmp ax, 0
jne .skip_set_to_4
mov ax, 4
.skip_set_to_4:
mov ebx, 0x1000_0200 ; dest 0xssss_oooo s=segment, o=offset
call read_disk
;
; verify kernel boot version is >= 2.04
;
mov dx, [es:0x206]
mov si, msg_kernel_boot_version_dx
call printfln
mov si, error_msg.kernel_boot_version_too_old
cmp dx, 0x204
jb fatal_error
;
; TODO: check that the cmd_line_size is <= the maximum
; command line size defined in the kernel which
; would be found at es:0x238 (cmdline_size)
; something like
; mv si, error_msg.kernel_cmd_line_too_big_az
; mov ax, [es:0x238]
; cmp [kernel_cmd_line_size], ax
; jg fatal_error
;
; check kernel loadflags to make sure LOADED_HIGH is true
;
mov si, error_msg.kernel_not_loaded_high
test byte [es:0x211],1
jz fatal_error
; pass information to kernel
mov byte [es:0x210], 0xe1 ; 0xTV T=loader_type V=version
mov byte [es:0x211], 0x80 ; heap use? !! set bit5 to make kernel quiet
mov word [es:0x224], 0xde00 ; head_end_ptr
mov byte [es:0x227], 0x01 ; ext_loader_type / bootloader id
mov dword [es:0x228], 0x1e000 ; cmd line ptr
; copy cmd line
mov si, 0x9c00 ; kernel command line address
mov di, 0xe000
mov cx, [kernel_cmd_line_size]
rep movsb ; copy from DS:si to ES:di
; load_kernel
mov edx, [es:0x1f4] ; syssize (size of protected-mode code in 16-byte paragraphs)
shl edx, 4 ; convert to bytes
mov si, msg_loading_kernel_edx
call printfln
call loader_length_in_edx
; read initrd size
mov ax, 1 ; sector count
mov ebx, 0x0000_a000 ; dest 0xssss_oooo s=segment o=offset
call read_disk
mov edx, [0xa000] ; get initrd size
mov si, msg_loading_initrd_edx
call printfln
mov [es:0x21c], edx ; tell kernel how big initrd is
; method 1 (load initrd right after the kernel)
;mov eax, [highmove_addr] ; get the next load address, where initrd will be loaded
; method 2 (load initrd at this predefined address, qemu loads it here)
mov eax, 0x7fab000
mov [highmove_addr],eax ; tell loader to load initrd here
; end of methods
mov [es:0x218], eax ; tell the kernel where the initrd lives
call loader_length_in_edx
; start the kernel
mov si, msg_jumping_to_kernel
call printfln
cli
mov ax, 0x1000
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov sp, 0xe000
jmp 0x1020:0
jmp $
loader_length_in_edx:
.loop:
;mov si, .msg_size_left ; print progress
;call printfln
cmp edx, 512 * 127
jl .read_last_part
.read_127_sectors:
mov ax, 127
mov ebx, 0x2000_0000 ; 0xssss_oooo s=segment o=offset
call read_disk
call highmove
sub edx, 512 * 127
jmp .loop
.read_last_part:
jz .done
shr edx, 9 ; divide by 512
inc edx ; increase by one in case it wasn't divisible by 512, loading more junk sectors is OK
mov ax, dx
mov ebx, 0x2000_0000 ; 0xssss_oooo s=segment o=offset
call read_disk
call highmove
.done:
ret
.msg_size_left: db "%e",dx_fmt," bytes left to read...", 0
;; Move 127 sectors at address 0x20000 to the next address at highmove_addr
; source = 0x20000
; count = 512 * 127 fixed (note, copying junk at the end doesn't matter)
; don't think we can use rep movsb here as it won't use edi/esi in unreal mode
highmove_addr dd 0x100000
highmove:
pushad
mov esi, 0x20000
mov edi, [highmove_addr]
mov edx, 512 * 127
mov ecx, 0 ; pointer
.loop:
mov eax, [ds:esi]
mov [ds:edi], eax
add esi, 4
add edi, 4
sub edx, 4
jnz highmove.loop
mov [highmove_addr], edi
popad
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
gdt_register_value:
dw gdt_end - gdt - 1
dd gdt
gdt:
dq 0 ; first entry 0
; flat data segment
dw 0xffff ; limit[0:15] (4gb)
dw 0 ; base[0:15]
db 0 ; base[16:23]
db 0b10010010 ; access byte
db 0b11001111 ; [7..4]=flage [3..0] = limit[16:19]
db 0 ; base[24:31]
gdt_end:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
kernel_cmd_line_size: dw 0
msg_at_stage2: db "at stage 2", 0
msg_kernel_cmd_line_prefix_bx: db "kernel cmd line (%", bx_fmt, " bytes) '",0
msg_kernel_cmd_line_suffix: db "'", 0
msg_kernel_setup_sector_count_ax: db "kernel setup sector count: %",ax_fmt, 0
msg_kernel_boot_version_dx: db "kernel boot version: %",dx_fmt, 0
msg_loading_kernel_edx: db "loading kernel (%e",dx_fmt," bytes)...",0
msg_loading_initrd_edx: db "loading initrd (%e",dx_fmt," bytes)...",0
msg_jumping_to_kernel: db "jumping to kernel",0
error_msg:
.enable_a20 db "failed to enable a20 line", 0
.kernel_boot_version_too_old db "kernel version too old", 0
.kernel_not_loaded_high db "kernel LOADED_HIGH is 0", 0
.kernel_cmd_line_has_no_null_terminator db "kernel cmd line sector has no NULL terminator", 0
bootloader_end:
|
data/tilesets/viridian_forest_gate_collision.asm | Ebernacher90/pokecrystal-allworld | 0 | 14643 | <filename>data/tilesets/viridian_forest_gate_collision.asm<gh_stars>0
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 00
tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 01
tilecoll FLOOR, FLOOR, LADDER, LADDER ; 02
tilecoll WALL, FLOOR, WALL, FLOOR ; 03
tilecoll WALL, WALL, FLOOR, FLOOR ; 04
tilecoll WALL, WALL, FLOOR, FLOOR ; 05
tilecoll WALL, WALL, FLOOR, FLOOR ; 06
tilecoll WALL, DOOR, FLOOR, FLOOR ; 07
tilecoll WALL, FLOOR, WALL, FLOOR ; 08
tilecoll FLOOR, FLOOR, WALL, FLOOR ; 09
tilecoll WALL, FLOOR, FLOOR, FLOOR ; 0a
tilecoll WALL, WALL, FLOOR, WALL ; 0b
tilecoll FLOOR, WALL, WALL, WALL ; 0c
tilecoll WALL, WALL, WALL, WALL ; 0d
|
programs/oeis/178/A178681.asm | karttu/loda | 1 | 246899 | <gh_stars>1-10
; A178681: a(n) = 6^n + 6.
; 7,12,42,222,1302,7782,46662,279942,1679622,10077702,60466182,362797062,2176782342,13060694022,78364164102,470184984582,2821109907462,16926659444742,101559956668422,609359740010502,3656158440062982
mov $1,6
pow $1,$0
add $1,6
|
Transynther/x86/_processed/US/_ht_zr_/i9-9900K_12_0xca_notsx.log_21829_1951.asm | ljhsiun2/medusa | 9 | 15824 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x14b36, %r8
nop
nop
add %r14, %r14
movups (%r8), %xmm2
vpextrq $0, %xmm2, %rbx
nop
nop
nop
nop
nop
cmp $5740, %r11
lea addresses_A_ht+0x87d8, %rsi
lea addresses_WC_ht+0x1c02e, %rdi
nop
nop
nop
nop
xor $24591, %r12
mov $1, %rcx
rep movsq
nop
nop
nop
nop
nop
dec %rdi
lea addresses_WC_ht+0xecc4, %rcx
nop
nop
mfence
mov $0x6162636465666768, %r14
movq %r14, (%rcx)
cmp $21288, %rbx
lea addresses_D_ht+0x13e64, %r8
nop
nop
nop
xor %r11, %r11
movups (%r8), %xmm0
vpextrq $0, %xmm0, %r12
nop
nop
xor $25826, %rbx
lea addresses_WC_ht+0x13184, %r11
nop
nop
nop
nop
nop
cmp $42092, %rdi
mov $0x6162636465666768, %rcx
movq %rcx, (%r11)
nop
nop
cmp $52953, %r8
lea addresses_WT_ht+0x1e00c, %rsi
lea addresses_normal_ht+0x1da59, %rdi
clflush (%rsi)
and $25567, %rbx
mov $23, %rcx
rep movsq
nop
nop
nop
nop
cmp $64494, %rsi
lea addresses_D_ht+0x8644, %rsi
lea addresses_WC_ht+0x2584, %rdi
nop
nop
nop
nop
nop
cmp %r12, %r12
mov $105, %rcx
rep movsw
nop
nop
nop
nop
dec %rsi
lea addresses_A_ht+0x1956c, %rbx
sub $25119, %r11
movb $0x61, (%rbx)
nop
nop
nop
xor %rbx, %rbx
lea addresses_UC_ht+0xe304, %rsi
lea addresses_WT_ht+0x1a644, %rdi
nop
nop
nop
nop
nop
xor %r11, %r11
mov $81, %rcx
rep movsb
nop
cmp %rbx, %rbx
lea addresses_WC_ht+0x1c084, %rbx
nop
nop
cmp %rdi, %rdi
mov (%rbx), %r12w
nop
nop
nop
nop
nop
mfence
lea addresses_normal_ht+0x9e04, %rsi
lea addresses_UC_ht+0xef44, %rdi
nop
nop
nop
cmp $16949, %r14
mov $48, %rcx
rep movsq
nop
nop
and $25750, %rdi
lea addresses_A_ht+0x6c04, %r11
nop
nop
nop
nop
nop
and $9077, %r12
mov (%r11), %rcx
sub $10426, %rbx
lea addresses_D_ht+0x1d204, %r12
nop
add $57489, %rdi
movups (%r12), %xmm2
vpextrq $1, %xmm2, %r14
inc %rdi
lea addresses_UC_ht+0x1b0ac, %rsi
lea addresses_UC_ht+0x12644, %rdi
nop
nop
sub %r12, %r12
mov $60, %rcx
rep movsq
nop
nop
nop
nop
nop
add $11737, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r15
push %r8
push %rcx
push %rdx
push %rsi
// Store
lea addresses_normal+0x18644, %r8
nop
nop
nop
nop
sub %rdx, %rdx
movw $0x5152, (%r8)
nop
nop
nop
nop
dec %rsi
// Store
lea addresses_D+0x1b7bc, %r8
inc %rcx
mov $0x5152535455565758, %rdx
movq %rdx, (%r8)
nop
dec %r8
// Store
lea addresses_D+0x1da44, %rdx
nop
nop
nop
nop
and %r8, %r8
mov $0x5152535455565758, %r14
movq %r14, %xmm0
vmovups %ymm0, (%rdx)
nop
sub $50098, %r8
// Store
lea addresses_D+0xaf44, %rcx
nop
and $1195, %r8
movw $0x5152, (%rcx)
nop
sub $3664, %r13
// Store
lea addresses_normal+0xdb34, %r13
nop
nop
nop
nop
nop
xor $43031, %rsi
movw $0x5152, (%r13)
nop
nop
nop
nop
xor %r15, %r15
// Store
lea addresses_normal+0x3a44, %rdx
nop
xor $41382, %r15
mov $0x5152535455565758, %r13
movq %r13, %xmm3
movups %xmm3, (%rdx)
nop
nop
xor %r13, %r13
// Store
lea addresses_normal+0x13444, %r13
nop
nop
nop
and %rdx, %rdx
movw $0x5152, (%r13)
nop
nop
dec %rdx
// Faulty Load
lea addresses_US+0x8644, %rdx
clflush (%rdx)
nop
nop
nop
nop
xor %rcx, %rcx
vmovups (%rdx), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %rsi
lea oracles, %rcx
and $0xff, %rsi
shlq $12, %rsi
mov (%rcx,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rcx
pop %r8
pop %r15
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_US', 'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 5}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}, 'dst': {'same': True, 'congruent': 3, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}}
{'46': 507, '00': 20443, '49': 7, '44': 872}
00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 46 00 00 00 00 00 00 00 00 00 00 00 00 44 00 44 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 46 00 00 00 00 00 00 44 00 00 46 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 44 00 00 00 00 00 44 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 44 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 44 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 44 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 44 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 46 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Structure/Operator/Monoid/Proofs.agda | Lolirofle/stuff-in-agda | 6 | 10211 | module Structure.Operator.Monoid.Proofs where
import Lvl
open import Logic
open import Logic.Propositional
open import Logic.Predicate
open import Structure.Setoid
open import Structure.Operator.Monoid
open import Structure.Operator.Properties
open import Structure.Operator.Proofs
open import Type
|
courses/fundamentals_of_ada/labs/solar_system/140_access_types/answers/my_solar_system.ads | AdaCore/training_material | 15 | 12968 | with Solar_System; use Solar_System;
package My_Solar_System is
-- declare variable Bodies which is an array of Body_T
Bodies : aliased Bodies_Array_T;
end My_Solar_System;
|
tests/src/gstreamer-rtsp-url-tests.ads | persan/A-gst | 1 | 3463 | with AUnit.Test_Cases;
package GStreamer.Rtsp.url.Tests is
use AUnit;
type Test_Case is new AUnit.Test_Cases.Test_Case with null record;
function Name (Test : Test_Case) return Message_String;
procedure Register_Tests (Test : in out Test_Case);
end GStreamer.Rtsp.url.Tests;
|
test/vm02.asm | Dantistnfs/bds | 3 | 27979 |
main:
new string[]
var a
pop
pushs 'hi'
pushi 0
load a
setlist
pop
pushi 0
load a
reflist
var z
pop
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1761.asm | ljhsiun2/medusa | 9 | 19821 | <filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1761.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x42a7, %rbp
clflush (%rbp)
nop
xor %r12, %r12
movb $0x61, (%rbp)
inc %rbp
lea addresses_WC_ht+0xa93, %rax
clflush (%rax)
xor $31911, %r8
mov $0x6162636465666768, %r11
movq %r11, %xmm2
vmovups %ymm2, (%rax)
sub $14206, %rbp
lea addresses_UC_ht+0x11f5b, %rdi
nop
nop
nop
sub $58770, %r11
movw $0x6162, (%rdi)
nop
and %r12, %r12
lea addresses_normal_ht+0x10f5b, %rsi
lea addresses_D_ht+0x1aab, %rdi
nop
nop
nop
nop
nop
sub %r12, %r12
mov $98, %rcx
rep movsq
sub %r12, %r12
lea addresses_UC_ht+0x1b35b, %rsi
lea addresses_UC_ht+0x3b5b, %rdi
clflush (%rdi)
nop
add $38748, %rbp
mov $76, %rcx
rep movsl
nop
nop
nop
nop
nop
add %rbp, %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %r9
push %rax
push %rdi
push %rsi
// Store
lea addresses_PSE+0xd05b, %rsi
nop
nop
nop
sub $23974, %r12
movl $0x51525354, (%rsi)
nop
nop
and $52740, %r12
// Load
lea addresses_RW+0x535b, %r13
nop
nop
nop
nop
nop
sub %r15, %r15
mov (%r13), %ax
nop
nop
nop
xor $56868, %rax
// Store
lea addresses_WT+0x1935b, %r12
nop
add %rdi, %rdi
movb $0x51, (%r12)
nop
nop
sub %r9, %r9
// Store
lea addresses_UC+0xef5b, %rsi
nop
sub $29327, %r12
movw $0x5152, (%rsi)
xor $55922, %r15
// Load
lea addresses_WT+0x1105b, %rdi
cmp %r12, %r12
movups (%rdi), %xmm7
vpextrq $1, %xmm7, %r9
nop
nop
nop
nop
xor %r9, %r9
// Store
lea addresses_normal+0x1a892, %r12
nop
nop
nop
nop
nop
dec %r9
mov $0x5152535455565758, %r15
movq %r15, %xmm3
vmovups %ymm3, (%r12)
nop
cmp %rax, %rax
// Faulty Load
lea addresses_RW+0x535b, %r15
nop
nop
nop
nop
nop
sub %rax, %rax
vmovups (%r15), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $0, %xmm6, %r12
lea oracles, %rsi
and $0xff, %r12
shlq $12, %r12
mov (%rsi,%r12,1), %r12
pop %rsi
pop %rdi
pop %rax
pop %r9
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 8, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 11, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 10, 'same': False, 'type': 'addresses_UC'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 6, 'same': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
test/Succeed/ParenthesizedAlias.agda | cruhland/agda | 1,989 | 6316 | -- Andreas, 2015-11-28
-- Aliases in parentheses should also parse.
-- Parenthesized aliases are accepted in lets.
-- With type annotation, parenthesized aliases are accepted in wheres.
id0 : {A : Set} → A → A
id0 {A} x = let z = y in z
where
y : A
y = x
id1 : {A : Set} → A → A
id1 {A} x = let (z) = y in z
where
y : A
(y) = x
id2 : {A : Set} → A → A
id2 {A} x = let ((z)) = y in z
where
y : A
((y)) = x
works0 : {A : Set} → A → A
works0 x = let z = y in z
where
y = x
-- Without type annotation, parenthesized aliases should also be accepted in wheres.
-- Should work:
test1 : {A : Set} → A → A
test1 x = let (z) = y in z
where
(y) = x
-- Should work:
test2 : {A : Set} → A → A
test2 x = let ((z)) = y in z
where
((y)) = x
|
Themis_FW_1p0/FreeRTOS/portable/CCS/c28x/porASM.asm | ramok/Themis_ForHPSDR | 0 | 7930 | ;-------------------------------------------------------------------------------------------------
; Author: <NAME>, <EMAIL>
;
; This file follows the FreeRTOS distribution license.
;
; FreeRTOS is free software; you can redistribute it and/or modify it under
; the terms of the GNU General Public License (version 2) as published by the
; Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
;
; ***************************************************************************
; >>! NOTE: The modification to the GPL is included to allow you to !<<
; >>! distribute a combined work that includes FreeRTOS without being !<<
; >>! obliged to provide the source code for proprietary components !<<
; >>! outside of the FreeRTOS kernel. !<<
; ***************************************************************************
;
; FreeRTOS 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. Full license text is available on the following
; link: http://www.freertos.org/a00114.html
;-------------------------------------------------------------------------------------------------
.ref _pxCurrentTCB
.ref _bYield
.ref _bPreemptive
.ref _ulCriticalNesting
.ref _xTaskIncrementTick
.ref _vTaskSwitchContext
.def _portTICK_ISR
.def _portRESTORE_FIRST_CONTEXT
.if .TMS320C2800_FPU32 = 1
.def _getSTF
_getSTF
MOV32 *SP++, STF
POP ACC
LRETR
_portRESTORE_FIRST_CONTEXT
; Restore stack pointer from new task control block.
MOVL XAR0, #_pxCurrentTCB
MOVL XAR0, *XAR0
MOVL XAR0, *XAR0
MOV @SP, AR0
; Restore XAR4 and RPC from saved task stack.
; and return to main task function.
; SP should be set to stack start plus 2 before LRETR.
SUBB SP, #28
POP XAR4
SUBB SP, #14
POP RPC
SUBB SP, #10
LRETR
_portTICK_ISR:
; Save context
ASP
PUSH RB
PUSH AR1H:AR0H
PUSH RPC
MOVL *SP++, XT
MOVL *SP++, XAR2
MOVL *SP++, XAR3
MOVL *SP++, XAR4
MOVL *SP++, XAR5
MOVL *SP++, XAR6
MOVL *SP++, XAR7
MOV32 *SP++, STF
MOV32 *SP++, R0H
MOV32 *SP++, R1H
MOV32 *SP++, R2H
MOV32 *SP++, R3H
MOV32 *SP++, R4H
MOV32 *SP++, R5H
MOV32 *SP++, R6H
MOV32 *SP++, R7H
PUSH DP:ST1
; Save critical section nesting counter
MOVL XAR0, #_ulCriticalNesting
MOVL ACC, *XAR0
PUSH ACC
; Save stack pointer in the task control block.
MOVL XAR0, #_pxCurrentTCB
MOVL XAR0, *XAR0
MOVL XAR6, #0 ;set to 0 XAR6 before move the new value of pxTopOfStack
MOV AR6, @SP
MOVL *XAR0, XAR6
; Save IER on stack to avoid corruption.
; Depending on stack alignment bit IER can be found in two locations.
PUSH ST1
POP AL
TBIT AL, #4
SB SPA_BIT_SET, TC
MOV AR7, *-SP[46]
SB SAVE_IER, UNC
SPA_BIT_SET:
MOV AR7, *-SP[48]
SAVE_IER:
MOVL *SP++, XAR7
; Increment tick counter if timer tick is executed.
; Don't increment if explicitly yielded.
MOVL XAR0, #_bYield
MOV ACC, *XAR0
SB RESET_YIELD_FLAG, NEQ
LCR _xTaskIncrementTick
RESET_YIELD_FLAG:
; Save bYield in AR1 and clear it in memory.
MOV AR1, ACC
MOV ACC, #0
MOV *XAR0, ACC
; Do context switch if bYield=1 or bPreemptive=1
MOVL XAR0, #_bPreemptive
MOV ACC, *XAR0
CMPB AL, #0x1
SB CONTEXT_SWITCH, EQ
MOV ACC, AR1
CMPB AL, #0x1
SB SKIP_CONTEXT_SWITCH, NEQ
CONTEXT_SWITCH:
LCR _vTaskSwitchContext
SKIP_CONTEXT_SWITCH:
; Restore IER value from stack.
MOVL XAR7, *--SP
; Restore stack pointer from new task control block.
MOVL XAR0, #_pxCurrentTCB
MOVL XAR0, *XAR0
MOVL XAR0, *XAR0
MOV @SP, AR0
; Restore critical section nesting counter
MOVL XAR0, #_ulCriticalNesting
POP ACC
MOVL *XAR0, ACC
; Update IER value in target context.
; Depending on stack alignment bit IER can be found in two locations.
POP DP:ST1
PUSH ST1
POP AL
TBIT AL, #4
SB SPA_BIT_SET_RESTORE, TC
MOV *-SP[42], AR7
SB RESTORE_CONTEXT, UNC
SPA_BIT_SET_RESTORE:
MOV *-SP[44], AR7
RESTORE_CONTEXT:
MOV32 R7H, *--SP
MOV32 R6H, *--SP
MOV32 R5H, *--SP
MOV32 R4H, *--SP
MOV32 R3H, *--SP
MOV32 R2H, *--SP
MOV32 R1H, *--SP
MOV32 R0H, *--SP
MOV32 STF, *--SP
MOVL XAR7, *--SP
; mov xar7, mmap(@DBGSTAT)
MOVL XAR6, *--SP
MOVL XAR5, *--SP
MOVL XAR4, *--SP
MOVL XAR3, *--SP
MOVL XAR2, *--SP
MOVL XT, *--SP
POP RPC
POP AR1H:AR0H
POP RB
NASP
IRET
.else
_portRESTORE_FIRST_CONTEXT
; Restore stack pointer from new task control block.
MOVL XAR0, #_pxCurrentTCB
MOVL XAR0, *XAR0
MOVL XAR0, *XAR0
MOV @SP, AR0
; Restore XAR4 and RPC from saved task stack.
; and return to main task function.
; SP should be set to stack start plus 2 before LRETR.
SUBB SP, #10
POP XAR4
SUBB SP, #12
POP RPC
SUBB SP, #10
LRETR
_portTICK_ISR:
; Save context
ASP
PUSH AR1H:AR0H
PUSH RPC
MOVL *SP++, XT
MOVL *SP++, XAR2
MOVL *SP++, XAR3
MOVL *SP++, XAR4
MOVL *SP++, XAR5
MOVL *SP++, XAR6
MOVL *SP++, XAR7
PUSH DP:ST1
; Save critical section nesting counter
MOVL XAR0, #_ulCriticalNesting
MOVL ACC, *XAR0
PUSH ACC
; Save stack pointer in the task control block.
MOVL XAR0, #_pxCurrentTCB
MOVL XAR0, *XAR0
MOVL XAR6, #0 ;set to 0 XAR6 before move the new value of pxTopOfStack
MOV AR6, @SP
MOVL *XAR0, XAR6
; Save IER on stack to avoid corruption.
PUSH ST1
POP AL
TBIT AL, #4
SB SPA_BIT_SET, TC
MOV AR7, *-SP[26]
SB SAVE_IER, UNC
SPA_BIT_SET:
MOV AR7, *-SP[28]
SAVE_IER:
MOVL *SP++, XAR7
; Increment tick counter if timer tick is executed.
; Don't increment if explicitly yielded.
MOVL XAR0, #_bYield
MOV ACC, *XAR0
SB RESET_YIELD_FLAG, NEQ
LCR _xTaskIncrementTick
RESET_YIELD_FLAG:
; Save bYield in AR1 and clear it in memory.
MOV AR1, ACC
MOV ACC, #0
MOV *XAR0, ACC
; Do context switch if bYield=1 or bPreemptive=1
MOVL XAR0, #_bPreemptive
MOV ACC, *XAR0
CMPB AL, #0x1
SB CONTEXT_SWITCH, EQ
MOV ACC, AR1
CMPB AL, #0x1
SB SKIP_CONTEXT_SWITCH, NEQ
CONTEXT_SWITCH:
LCR _vTaskSwitchContext
SKIP_CONTEXT_SWITCH:
; Restore IER value from stack.
MOVL XAR7, *--SP
; Restore stack pointer from new task control block.
MOVL XAR0, #_pxCurrentTCB
MOVL XAR0, *XAR0
MOVL XAR0, *XAR0
MOV @SP, AR0
; Restore critical section nesting counter
MOVL XAR0, #_ulCriticalNesting
POP ACC
MOVL *XAR0, ACC
; Update IER value in target context.
POP DP:ST1
PUSH ST1
POP AL
TBIT AL, #4
SB SPA_BIT_SET_RESTORE, TC
MOV *-SP[22], AR7
SB RESTORE_CONTEXT, UNC
SPA_BIT_SET_RESTORE:
MOV *-SP[24], AR7
RESTORE_CONTEXT:
MOVL XAR7, *--SP
MOVL XAR6, *--SP
MOVL XAR5, *--SP
MOVL XAR4, *--SP
MOVL XAR3, *--SP
MOVL XAR2, *--SP
MOVL XT, *--SP
POP RPC
POP AR1H:AR0H
NASP
IRET
.endif
|
asm/execve_24byte.asm | SYANiDE-/pentesteracademy_reverse-engineering-linux-32bit-applications | 0 | 9697 | ; Author <NAME>
; execve("////bin/bash","");
; nasm -f elf32 execve_24byte.asm -o execve_24byte.o
; ld -melf_i386 execve_24byte.o -o execve_24byte.elf
; note the lack of an environment; environment will be inherited, in all it's glory
; good or bad!
global _start
section .text
_start:
mov al, 0xb
xor ecx,ecx
push ecx
; echo -n "////bin/bash" |rev |xxd -g 4 -c 4
; [#] 08/28/19 06:03:37 PM
; 00000000: 68736162 hsab
; 00000004: 2f6e6962 /nib
; 00000008: 2f2f2f2f ////
push dword 0x68736162
push dword 0x2f6e6962
push dword 0x2f2f2f2f
mov ebx, esp
int 0x80
; objdump -D execve_28byte.elf -Mintel
; echo -n """ b0 0b
; 31 c9
; 51
; 68 62 61 73 68
; 68 62 69 6e 2f
; 68 2f 2f 2f 2f
; 89 e3
; cd 80""" |xxd -r -p |wc -c
; 24
|
source/resolver/program-type_resolvers.ads | reznikmm/gela | 0 | 4405 | <gh_stars>0
-- SPDX-FileCopyrightText: 2020-2021 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Compilation_Units;
with Program.Cross_Reference_Updaters;
with Program.Elements.Expressions;
with Program.Interpretations;
with Program.Visibility;
private package Program.Type_Resolvers is
pragma Preelaborate;
procedure Resolve_Type
(Element : Program.Elements.Expressions.Expression_Access;
Context : not null Program.Visibility.Context_Access;
Setter : not null Program.Cross_Reference_Updaters
.Cross_Reference_Updater_Access;
Sets : not null Program.Interpretations.Context_Access;
Value : out Program.Visibility.View);
-- The Element is a subtype_mark. Resolve it and return corresponding
-- type view.
procedure Resolve_Type_Definition
(Element : Program.Elements.Element_Access;
Context : not null Program.Visibility.Context_Access;
Setter : not null
Program.Cross_Reference_Updaters.Cross_Reference_Updater_Access;
Sets : not null Program.Interpretations.Context_Access;
Value : out Program.Visibility.View);
-- The Element is a subtype_indication, access_definition or
-- array_type_definition. Resolve it and return corresponding type view.
end Program.Type_Resolvers;
|
dataToTestOn/asm/3/20.asm | Epacik/8051-ASM-Plugin | 1 | 243117 | TAB EQU 30H
LJMP START
ORG 100H
START:
MOV TAB,#1
MOV TAB+1,#2
MOV TAB+2,#3
MOV TAB+3,#5
MOV TAB+4,#7
MOV TAB+5,#11
MOV TAB+6,#13
MOV TAB+7,#17
MOV TAB+8,#19
MOV TAB+9,#23
MOV TAB+10,#29
MOV TAB+11,#31
MOV TAB+12,#37
MOV TAB+13,#41
MOV TAB+14,#43
MOV TAB+15,#47
MOV TAB+16,#53
MOV R0,#TAB
CALL LCD_CLR
ABCD:
MOV A,@R0
CALL HTB
CALL WRITE_HEX
MOV A,#5
CALL DELAY_100MS
CALL LCD_CLR
INC R0
CJNE R0,#TAB+17,ABCD
MOV R0,#TAB
SJMP ABCD
XRL A, @R1
CLR C
CPL C
SETB address
ANL A, @R0
ORL address, address
HTB:
MOV R1,#00h
MOV R2,#00h
CJNE A,#00h,CALC_HTB
RET
CALC_HTB:
MOV B,#100 ; dzielenie przez 100
DIV AB
MOV R1,A ; zapisz Akumulator do R0
MOV A,B
MOV B,#10 ; podziel przez 10
DIV AB
SWAP A
MOV R2,A ; zapisz dziesiątki do R1
MOV A,B
ORL A,R2
MOV R2,A ;zapisz jedności do R1
RET |
libsrc/_DEVELOPMENT/z180/c/sdcc/z180_delay_tstate.asm | jpoikela/z88dk | 640 | 18046 | <filename>libsrc/_DEVELOPMENT/z180/c/sdcc/z180_delay_tstate.asm
; void z180_delay_tstate(uint tstates)
SECTION code_clib
SECTION code_z180
PUBLIC _z180_delay_tstate
EXTERN asm_z180_delay_tstate
_z180_delay_tstate:
pop af
pop hl
push hl
push af
jp asm_z180_delay_tstate
|
Sources/Student_Packages/vehicle_message_type.ads | ForYouEyesOnly/Space-Convoy | 1 | 5776 | <reponame>ForYouEyesOnly/Space-Convoy
-- Suggestions for packages which might be useful:
with Ada.Real_Time; use Ada.Real_Time;
with Vectors_3D; use Vectors_3D;
with Swarm_Structures_Base; use Swarm_Structures_Base;
with Vehicle_Task_Type; use Vehicle_Task_Type;
-- Author : <NAME>
-- u_id : u6251843
package Vehicle_Message_Type is
-- Replace this record definition by what your vehicles need to communicate.
type Inter_Vehicle_Messages is
record
-- Vehicle_ID in the message, for recognizing the source of message
ID : Positive;
-- The message sent time
Message_Send_Time : Time;
-- Record whether the drone finds the globe or not
Energy_Globe_Find : Boolean;
-- Record the position of energy globe
Energy_Globe_Pos : Vector_3D;
-- Record the current energy level of corresponding drone
My_Energy : Vehicle_Charges;
-- Message of all the live drones' vehicle_No
Exist_Neighbours_No : No_Set;
-- Message of all the dead drones' vehicle_No
Delete_Neighbours_No : No_Set;
end record;
end Vehicle_Message_Type;
|
oeis/013/A013837.asm | neoneye/loda-programs | 11 | 85658 | <reponame>neoneye/loda-programs
; A013837: a(n) = 5^(5*n + 4).
; 625,1953125,6103515625,19073486328125,59604644775390625,186264514923095703125,582076609134674072265625,1818989403545856475830078125,5684341886080801486968994140625,17763568394002504646778106689453125,55511151231257827021181583404541015625,173472347597680709441192448139190673828125,542101086242752217003726400434970855712890625,1694065894508600678136645001359283924102783203125,5293955920339377119177015629247762262821197509765625,16543612251060553497428173841399257071316242218017578125
mul $0,5
mov $1,5
pow $1,$0
mul $1,625
mov $0,$1
|
alloy4fun_models/trashltl/models/11/hskz3DjnELH3Dj7sd.als | Kaixi26/org.alloytools.alloy | 0 | 723 | open main
pred idhskz3DjnELH3Dj7sd_prop12 {
all f : File | after f in Trash
}
pred __repair { idhskz3DjnELH3Dj7sd_prop12 }
check __repair { idhskz3DjnELH3Dj7sd_prop12 <=> prop12o } |
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver0/sfc/back_up/ys_enmy_old.asm | prismotizm/gigaleak | 0 | 174959 | <filename>other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver0/sfc/back_up/ys_enmy_old.asm
Name: ys_enmy_old.asm
Type: file
Size: 381222
Last-Modified: '2016-05-13T04:50:36Z'
SHA-1: EC11D8D4D139F174DE514254EC09A69D1AC8A3DD
Description: null
|
software/pcx86/bdsrc/test/tests.asm | jeffpar/basicdos | 59 | 93061 | <reponame>jeffpar/basicdos<filename>software/pcx86/bdsrc/test/tests.asm
;
; BASIC-DOS Miscellaneous DOS Tests
;
; @author <NAME> <<EMAIL>>
; @copyright (c) 2020-2021 <NAME>
; @license MIT <https://basicdos.com/LICENSE.txt>
;
; This file is part of PCjs, a computer emulation software project at pcjs.org
;
include macros.inc
include dosapi.inc
CODE SEGMENT
ASSUME CS:CODE, DS:CODE, ES:CODE, SS:CODE
org 5
DEFLBL DOS,near
org 100h
DEFPROC main
;
; The following REALLOC is not necessary in BASIC-DOS, because it detects
; our COMHEAP signature and resizes us automatically, but if we want to run
; with the same footprint in PC DOS, then we must still resize ourselves.
;
mov bx,offset HEAP + MINHEAP
and bl,0F0h
or bl,0Eh ; BX adjusted to top word of top paragraph
mov word ptr [bx],0 ; store a zero there so we can simply return
mov sp,bx ; lower the stack
mov cl,4
add bx,15
shr bx,cl
mov ah,DOS_MEM_REALLOC
int 21h
;
; In PC DOS 2.x, the DOS_MSC_GETVARS function (52h) sets ES:BX-2 to the
; address of the first MCB segment, ES:BX+4 points to the SFT, etc. However,
; all you can rely on in BASIC-DOS is ES:BX-2.
;
mov ah,DOS_MSC_GETVARS
int 21h ; ES:BX-2 -> mcb_head
;
; Test the CALL 5 interface.
;
mov dx,offset call5test
call print
;
; Make a series of increasingly large memory allocations.
;
mov dx,offset alloctest
call print
mov cx,3 ; perform the series CX times
m1: sub bx,bx ; start with a zero paragraph request
m2: mov ax,DOS_MEM_ALLOC SHL 8
int 21h
jc m3
mov es,ax ; ES = new segment
mov ah,DOS_MEM_FREE
int 21h
ASSERT NC
inc bx ; ask for more one paragraph
jmp m2
m3: mov dx,offset progress
call print
loop m1
mov dx,offset passed
call print
push ds
pop es
mov dx,offset execfile
mov ax,DOS_HDL_OPENRO
int 21h ; open file (and neglect to close it)
mov bx,offset execparms
mov [bx].EPB_CMDTAIL.SEG,cs
mov [bx].EPB_FCB1.SEG,cs
mov [bx].EPB_FCB2.SEG,cs
mov ax,DOS_PSP_EXEC1
mov dx,offset execfile
int 21h ; exec (but don't launch)
;
; If the exec was successful, an INT 21h termination call is the simplest
; way to clean up the process (ie, free the program's memory, handles, etc),
; because the current PSP is the new PSP. After termination, control will
; return here again, and we'll gracefully terminate ourselves.
;
; In BASIC-DOS, we could also use INT 20h here, but PC DOS requires that CS
; contain the PSP being terminated when calling INT 20h (BASIC-DOS does not).
;
mov ax,DOS_PSP_RETURN SHL 8
int 21h
ret ; a return is not necessary, but just in case
ENDPROC main
DEFPROC print
push cx
mov cl,DOS_TTY_PRINT
call DOS
pop cx
ret
ENDPROC print
call5test db "CALL 5 test "
passed db "passed",13,10,'$'
progress db ".$"
alloctest db "memory test$"
execfile db "tests.com",0
execparms EPB <0,PSP_CMDTAIL,PSP_FCB1,PSP_FCB2>
;
; COMHEAP 0 means we don't need a heap, but BASIC-DOS will still allocate a
; minimum amount of heap space, because that's where our initial stack lives.
;
COMHEAP 0 ; COMHEAP (heap size) must be the last item
CODE ENDS
end main
|
programs/oeis/005/A005248.asm | neoneye/loda | 22 | 1932 | ; A005248: Bisection of Lucas numbers: a(n) = L(2*n) = A000032(2*n).
; 2,3,7,18,47,123,322,843,2207,5778,15127,39603,103682,271443,710647,1860498,4870847,12752043,33385282,87403803,228826127,599074578,1568397607,4106118243,10749957122,28143753123,73681302247,192900153618,505019158607,1322157322203,3461452808002,9062201101803,23725150497407,62113250390418,162614600673847,425730551631123,1114577054219522,2918000611027443,7639424778862807,20000273725560978,52361396397820127,137083915467899403,358890350005878082,939587134549734843,2459871053643326447,6440026026380244498,16860207025497407047,44140595050111976643,115561578124838522882,302544139324403592003,792070839848372253127,2073668380220713167378,5428934300813767249007,14213134522220588579643,37210469265847998489922,97418273275323406890123,255044350560122222180447,667714778405043259651218,1748099984655007556773207,4576585175559979410668403,11981655542024930675232002,31368381450514812615027603,82123488809519507169850807,215002084978043708894524818,562882766124611619513723647,1473646213395791149646646123,3858055874062761829426214722,10100521408792494338631998043,26443508352314721186469779407,69230003648151669220777340178,181246502592140286475862241127,474509504128269190206809383203,1242282009792667284144565908482,3252336525249732662226888342243,8514727565956530702536099118247,22291846172619859445381409012498,58360810951903047633608127919247,152790586683089283455442974745243,400010949097364802732720796316482,1047242260609005124742719414204203,2741715832729650571495437446296127,7177905237579946589743592924684178,18791999880010189197735341327756407,49198094402450621003462431058585043,128802283327341673812651951847998722,337208755579574400434493424485411123,882823983411381527490828321608234647
mov $1,2
mov $2,1
lpb $0
sub $0,1
add $1,$2
add $2,$1
lpe
mov $0,$1
|
src/grammars/mysql/MultiQueryMySQLParser.g4 | Attsun1031/antlr4ts-sql | 16 | 579 | parser grammar MultiQueryMySQLParser;
options {
superClass=MySQLBaseParser;
tokenVocab=MySQLLexer;
}
import MySQLParser;
sql_script
: query* EOF
;
// Need to overwrite query rule so that it does not include EOF
query
: (simpleStatement | beginWork) SEMICOLON_SYMBOL?
; |
Structure/Operator/Field.agda | Lolirofle/stuff-in-agda | 6 | 10113 | module Structure.Operator.Field where
import Lvl
open import Logic
open import Logic.Propositional
open import Structure.Setoid
open import Structure.Operator.Properties
open import Structure.Operator.Ring
open import Type
record Field {ℓ ℓₑ} {T : Type{ℓ}} ⦃ _ : Equiv{ℓₑ}(T) ⦄ (_+_ : T → T → T) (_⋅_ : T → T → T) : Stmt{ℓ Lvl.⊔ ℓₑ} where
field
⦃ divisionRing ⦄ : DivisionRing(_+_)(_⋅_)
⦃ [⋅]-commutativity ⦄ : Commutativity(_⋅_)
open DivisionRing(divisionRing) public
field
-- Note: This excludes the trivial ring and is unprovable from the other field axioms, and models where this is true are always "trivial/singleton rings".
⦃ distinct-identities ⦄ : DistinctIdentities
record FieldObject {ℓ ℓₑ} : Stmt{Lvl.𝐒(ℓ Lvl.⊔ ℓₑ)} where
constructor intro
field
{T} : Type{ℓ}
⦃ equiv ⦄ : Equiv{ℓₑ}(T)
_+_ : T → T → T
_⋅_ : T → T → T
⦃ structure ⦄ : Field(_+_)(_⋅_)
open Field(structure) public
|
apps/breakfast/pde_fw/toast/examples/Assembly (CCE)/msp430x24x_uscib0_spi_10.asm | tp-freeforall/breakfast | 1 | 89000 | ;*******************************************************************************
; msp430x24x Demo - USCI_B0, SPI 3-Wire Slave Data Echo
;
; Description: SPI slave talks to SPI master using 3-wire mode. Data received
; from master is echoed back. USCI RX ISR is used to handle communication,
; CPU normally in LPM4. Prior to initial data exchange, master pulses
; slaves RST for complete reset.
; ACLK = n/a, MCLK = SMCLK = DCO ~ 1048kHz
;
; Use with SPI Master Incremented Data code example. If the slave is in
; debug mode, the reset signal from the master will conflict with slave's
; JTAG; to work around, control the
; the Master device with CCE. If breakpoints are inserted in Master slave
; must stop also.
; MSP430F249
; -----------------
; /|\| XIN|-
; | | |
; Master---|-|RST XOUT|-
; | |
; | P3.1|-> Data Out (UCB0SIMO)
; | |
; | P3.2|<- Data In (UCB0SOMI)
; | |
; | P3.3|-> Serial Clock Out (UCB0CLK)
;
; <NAME>
; Texas Instruments Inc.
; May 2008
; Built Code Composer Essentials: v3 FET
;*******************************************************************************
.cdecls C,LIST, "msp430x24x.h"
MST_Data .equ R6
SLV_Data .equ R7
;-------------------------------------------------------------------------------
.text ;Program Start
;-------------------------------------------------------------------------------
RESET mov.w #0500h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop watchdog timer
CheckCal cmp.b #0FFh,&CALBC1_1MHZ ; Calibration constants erased?
jeq Trap
cmp.b #0FFh,&CALDCO_1MHZ
jne Load
Trap jmp $ ; Trap CPU!!
Load mov.b &CALBC1_1MHZ,&BCSCTL1 ; Set DCO to 1MHz
mov.b &CALDCO_1MHZ,&DCOCTL ;
waitForMstr bit.b #08h,&P3IN ; If clock sig from mstr stays low,
jz waitForMstr ; it is not yet in SPI mode
;
SetupP3 bis.b #00Eh,&P3SEL ; P3.3,2,1 option select
SetupSPI mov.b #UCSWRST,&UCB0CTL1 ; **Put state machine in reset**
bis.b #UCCKPL+UCMSB+UCSYNC,&UCB0CTL0;3-pin, 8-bit SPI master
bic.b #UCSWRST,&UCB0CTL1 ; **Initialize USCI state machine**
bis.b #UCB0RXIE,&IE2 ; Enable USCI_B0 RX interrupt
;
Mainloop bis.b #LPM3+GIE,SR ; Enter LPM3, enable interrupts
nop ; Required for debugger only
;
;-------------------------------------------------------------------------------
USCIB0RX_ISR; Test for valid RX and TX character
;-------------------------------------------------------------------------------
TX1 bit.b #UCB0TXIFG,&IFG2 ; USCI_B0 TX buffer ready?
jz TX1 ;
mov.b &UCB0RXBUF,&UCB0TXBUF ;
reti
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".int23" ; USCI_B0 Rx Vector
.short USCIB0RX_ISR ;
.sect ".reset" ; POR, ext. Reset, Watchdog
.short RESET
.end
|
src/units/bit_set.asm | cburbridge/z80 | 18 | 172267 | <reponame>cburbridge/z80<gh_stars>10-100
BIT 0, A
BIT 0, B
BIT 0, C
BIT 0, D
BIT 0, E
BIT 0, H
BIT 0, L
BIT 1, A
BIT 1, B
BIT 1, C
BIT 1, D
BIT 1, E
BIT 1, H
BIT 1, L
BIT 2, A
BIT 2, B
BIT 2, C
BIT 2, D
BIT 2, E
BIT 2, H
BIT 2, L
BIT 3, A
BIT 3, B
BIT 3, C
BIT 3, D
BIT 3, E
BIT 3, H
BIT 3, L
BIT 4, A
BIT 4, B
BIT 4, C
BIT 4, D
BIT 4, E
BIT 4, H
BIT 4, L
BIT 5, A
BIT 5, B
BIT 5, C
BIT 5, D
BIT 5, E
BIT 5, H
BIT 5, L
BIT 6, A
BIT 6, B
BIT 6, C
BIT 6, D
BIT 6, E
BIT 6, H
BIT 6, L
BIT 7, A
BIT 7, B
BIT 7, C
BIT 7, D
BIT 7, E
BIT 7, H
BIT 7, L
BIT 0, (HL)
BIT 1, (HL)
BIT 2, (HL)
BIT 3, (HL)
BIT 4, (HL)
BIT 5, (HL)
BIT 6, (HL)
BIT 7, (HL)
BIT 0, (IX+87H)
BIT 1, (IX+87H)
BIT 2, (IX+87H)
BIT 3, (IX+87H)
BIT 4, (IX+87H)
BIT 5, (IX+87H)
BIT 6, (IX+87H)
BIT 7, (IX+87H)
BIT 0, (IY+87H)
BIT 1, (IY+87H)
BIT 2, (IY+87H)
BIT 3, (IY+87H)
BIT 4, (IY+87H)
BIT 5, (IY+87H)
BIT 6, (IY+87H)
BIT 7, (IY+87H)
SET 0, A
SET 0, B
SET 0, C
SET 0, D
SET 0, E
SET 0, H
SET 0, L
SET 1, A
SET 1, B
SET 1, C
SET 1, D
SET 1, E
SET 1, H
SET 1, L
SET 2, A
SET 2, B
SET 2, C
SET 2, D
SET 2, E
SET 2, H
SET 2, L
SET 3, A
SET 3, B
SET 3, C
SET 3, D
SET 3, E
SET 3, H
SET 3, L
SET 4, A
SET 4, B
SET 4, C
SET 4, D
SET 4, E
SET 4, H
SET 4, L
SET 5, A
SET 5, B
SET 5, C
SET 5, D
SET 5, E
SET 5, H
SET 5, L
SET 6, A
SET 6, B
SET 6, C
SET 6, D
SET 6, E
SET 6, H
SET 6, L
SET 7, A
SET 7, B
SET 7, C
SET 7, D
SET 7, E
SET 7, H
SET 7, L
SET 0, (HL)
SET 1, (HL)
SET 2, (HL)
SET 3, (HL)
SET 4, (HL)
SET 5, (HL)
SET 6, (HL)
SET 7, (HL)
SET 0, (IX+87H)
SET 1, (IX+87H)
SET 2, (IX+87H)
SET 3, (IX+87H)
SET 4, (IX+87H)
SET 5, (IX+87H)
SET 6, (IX+87H)
SET 7, (IX+87H)
SET 0, (IY+87H)
SET 1, (IY+87H)
SET 2, (IY+87H)
SET 3, (IY+87H)
SET 4, (IY+87H)
SET 5, (IY+87H)
SET 6, (IY+87H)
SET 7, (IY+87H)
RES 0, A
RES 0, B
RES 0, C
RES 0, D
RES 0, E
RES 0, H
RES 0, L
RES 1, A
RES 1, B
RES 1, C
RES 1, D
RES 1, E
RES 1, H
RES 1, L
RES 2, A
RES 2, B
RES 2, C
RES 2, D
RES 2, E
RES 2, H
RES 2, L
RES 3, A
RES 3, B
RES 3, C
RES 3, D
RES 3, E
RES 3, H
RES 3, L
RES 4, A
RES 4, B
RES 4, C
RES 4, D
RES 4, E
RES 4, H
RES 4, L
RES 5, A
RES 5, B
RES 5, C
RES 5, D
RES 5, E
RES 5, H
RES 5, L
RES 6, A
RES 6, B
RES 6, C
RES 6, D
RES 6, E
RES 6, H
RES 6, L
RES 7, A
RES 7, B
RES 7, C
RES 7, D
RES 7, E
RES 7, H
RES 7, L
RES 0, (HL)
RES 1, (HL)
RES 2, (HL)
RES 3, (HL)
RES 4, (HL)
RES 5, (HL)
RES 6, (HL)
RES 7, (HL)
RES 0, (IX+87H)
RES 1, (IX+87H)
RES 2, (IX+87H)
RES 3, (IX+87H)
RES 4, (IX+87H)
RES 5, (IX+87H)
RES 6, (IX+87H)
RES 7, (IX+87H)
RES 0, (IY+87H)
RES 1, (IY+87H)
RES 2, (IY+87H)
RES 3, (IY+87H)
RES 4, (IY+87H)
RES 5, (IY+87H)
RES 6, (IY+87H)
RES 7, (IY+87H) |
msp430-gcc-tics/msp430-gcc-7.3.1.24-source-full/gcc/gcc/testsuite/gnat.dg/uninit_array_pkg.ads | TUDSSL/TICS | 7 | 28192 | package Uninit_Array_Pkg Is
type Rec is record
B1, B2, B3, B4: Boolean;
end record;
type Arr is array (Boolean) of Rec;
function F (R : Rec) return Integer;
end Uninit_Array_Pkg;
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_18489_1790.asm | ljhsiun2/medusa | 9 | 16521 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r15
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x1228c, %r8
nop
nop
nop
and %r15, %r15
mov $0x6162636465666768, %r11
movq %r11, (%r8)
nop
nop
xor %r15, %r15
lea addresses_A_ht+0x1978c, %r14
nop
nop
nop
add $51714, %rcx
mov (%r14), %rdx
nop
nop
inc %r8
lea addresses_WT_ht+0x1164c, %rsi
lea addresses_WC_ht+0x1ef8c, %rdi
nop
inc %r8
mov $124, %rcx
rep movsl
nop
nop
add $29695, %rdi
lea addresses_WT_ht+0x11cc, %rdx
nop
nop
nop
nop
and %r14, %r14
movw $0x6162, (%rdx)
nop
nop
nop
nop
nop
cmp %r14, %r14
lea addresses_WC_ht+0xb48c, %rcx
nop
nop
inc %r14
movups (%rcx), %xmm5
vpextrq $0, %xmm5, %r15
nop
nop
nop
nop
cmp %rcx, %rcx
lea addresses_WC_ht+0xb79c, %rsi
lea addresses_UC_ht+0x1908c, %rdi
nop
nop
nop
xor %r8, %r8
mov $60, %rcx
rep movsb
nop
sub %rcx, %rcx
lea addresses_WT_ht+0xcef6, %rsi
lea addresses_UC_ht+0xc88c, %rdi
clflush (%rsi)
sub $32772, %r14
mov $6, %rcx
rep movsq
nop
and %r14, %r14
lea addresses_WC_ht+0x137ee, %rdx
nop
nop
nop
nop
nop
xor $24340, %rcx
movl $0x61626364, (%rdx)
nop
nop
nop
nop
sub $61321, %r8
lea addresses_A_ht+0xf38c, %rsi
lea addresses_normal_ht+0xaf8c, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
and $57310, %r8
mov $24, %rcx
rep movsw
and %rdi, %rdi
lea addresses_normal_ht+0x101ac, %rsi
lea addresses_UC_ht+0x1c00c, %rdi
nop
nop
cmp %r15, %r15
mov $106, %rcx
rep movsq
nop
nop
nop
nop
nop
add $42644, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %r8
push %r9
push %rbx
push %rdx
// Store
lea addresses_RW+0x1a7cc, %rbx
nop
nop
nop
nop
sub $65126, %rdx
mov $0x5152535455565758, %r8
movq %r8, %xmm4
movups %xmm4, (%rbx)
add $23314, %r8
// Store
mov $0x74acfd000000027c, %r8
nop
nop
nop
nop
add $59934, %r10
movb $0x51, (%r8)
nop
nop
nop
sub $35040, %r10
// Faulty Load
lea addresses_normal+0xc8c, %rdx
nop
nop
nop
nop
cmp $35821, %rbx
vmovups (%rdx), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $0, %xmm5, %r8
lea oracles, %rdx
and $0xff, %r8
shlq $12, %r8
mov (%rdx,%r8,1), %r8
pop %rdx
pop %rbx
pop %r9
pop %r8
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_RW'}}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_NC'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 8, 'AVXalign': True, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': True, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': True, 'type': 'addresses_UC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_UC_ht'}}
{'34': 18489}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
libsrc/target/msx/nmi_init.asm | jpoikela/z88dk | 640 | 166665 | <reponame>jpoikela/z88dk<filename>libsrc/target/msx/nmi_init.asm
SECTION code_clib
PUBLIC nmi_init
PUBLIC _nmi_init
EXTERN asm_nmi_handler
EXTERN l_push_di
EXTERN l_pop_ei
nmi_init:
_nmi_init:
ld hl,asm_nmi_handler
ld ($fdd7),hl
ld a,195
ld ($fdd6),a
ret
|
programs/oeis/059/A059978.asm | karttu/loda | 1 | 175232 | <reponame>karttu/loda<gh_stars>1-10
; A059978: a(n) = binomial(n+2,n)^6.
; 1,729,46656,1000000,11390625,85766121,481890304,2176782336,8303765625,27680640625,82653950016,225199600704,567869252041,1340095640625,2985984000000,6327518887936,12827693806929,25002110044521,47045881000000,85766121000000,151939915084881,262254607552729,442032795979776,729000000000000,1178420166015625,1870004703089601,2917096519063104,4478743609109056,6775409390765625
mov $1,-3
bin $1,$0
pow $1,6
|
OvmfPkg/ResetVector/Ia32/PageTables64.asm | ray-linn/myedk2 | 0 | 12417 | ;------------------------------------------------------------------------------
; @file
; Sets the CR3 register for 64-bit paging
;
; Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.<BR>
; Copyright (c) 2017 - 2020, Advanced Micro Devices, Inc. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
;------------------------------------------------------------------------------
BITS 32
%define PAGE_PRESENT 0x01
%define PAGE_READ_WRITE 0x02
%define PAGE_USER_SUPERVISOR 0x04
%define PAGE_WRITE_THROUGH 0x08
%define PAGE_CACHE_DISABLE 0x010
%define PAGE_ACCESSED 0x020
%define PAGE_DIRTY 0x040
%define PAGE_PAT 0x080
%define PAGE_GLOBAL 0x0100
%define PAGE_2M_MBO 0x080
%define PAGE_2M_PAT 0x01000
%define PAGE_4K_PDE_ATTR (PAGE_ACCESSED + \
PAGE_DIRTY + \
PAGE_READ_WRITE + \
PAGE_PRESENT)
%define PAGE_2M_PDE_ATTR (PAGE_2M_MBO + \
PAGE_ACCESSED + \
PAGE_DIRTY + \
PAGE_READ_WRITE + \
PAGE_PRESENT)
%define PAGE_PDP_ATTR (PAGE_ACCESSED + \
PAGE_READ_WRITE + \
PAGE_PRESENT)
%define TDX_BSP 1
%define TDX_AP 2
;
; Modified: EAX, EBX, ECX, EDX
;
SetCr3ForPageTables64:
; Check the TDX features.
; If it is TDX APs, then jump to SetCr3 directly.
; In TD guest the initialization is done by BSP, including building
; the page tables. APs will spin on until byte[TDX_WORK_AREA_PGTBL_READY]
; is set.
OneTimeCall CheckTdxFeaturesBeforeBuildPagetables
cmp eax, TDX_BSP
je ClearOvmfPageTables
cmp eax, TDX_AP
je SetCr3
; Check whether the SEV is active and populate the SevEsWorkArea
OneTimeCall CheckSevFeatures
; If SEV is enabled, the C-bit position is always above 31.
; The mask will be saved in the EDX and applied during the
; the page table build below.
OneTimeCall GetSevCBitMaskAbove31
ClearOvmfPageTables:
;
; For OVMF, build some initial page tables at
; PcdOvmfSecPageTablesBase - (PcdOvmfSecPageTablesBase + 0x6000).
;
; This range should match with PcdOvmfSecPageTablesSize which is
; declared in the FDF files.
;
; At the end of PEI, the pages tables will be rebuilt into a
; more permanent location by DxeIpl.
;
mov ecx, 6 * 0x1000 / 4
xor eax, eax
clearPageTablesMemoryLoop:
mov dword[ecx * 4 + PT_ADDR (0) - 4], eax
loop clearPageTablesMemoryLoop
;
; Top level Page Directory Pointers (1 * 512GB entry)
;
mov dword[PT_ADDR (0)], PT_ADDR (0x1000) + PAGE_PDP_ATTR
mov dword[PT_ADDR (4)], edx
;
; Next level Page Directory Pointers (4 * 1GB entries => 4GB)
;
mov dword[PT_ADDR (0x1000)], PT_ADDR (0x2000) + PAGE_PDP_ATTR
mov dword[PT_ADDR (0x1004)], edx
mov dword[PT_ADDR (0x1008)], PT_ADDR (0x3000) + PAGE_PDP_ATTR
mov dword[PT_ADDR (0x100C)], edx
mov dword[PT_ADDR (0x1010)], PT_ADDR (0x4000) + PAGE_PDP_ATTR
mov dword[PT_ADDR (0x1014)], edx
mov dword[PT_ADDR (0x1018)], PT_ADDR (0x5000) + PAGE_PDP_ATTR
mov dword[PT_ADDR (0x101C)], edx
;
; Page Table Entries (2048 * 2MB entries => 4GB)
;
mov ecx, 0x800
pageTableEntriesLoop:
mov eax, ecx
dec eax
shl eax, 21
add eax, PAGE_2M_PDE_ATTR
mov [ecx * 8 + PT_ADDR (0x2000 - 8)], eax
mov [(ecx * 8 + PT_ADDR (0x2000 - 8)) + 4], edx
loop pageTableEntriesLoop
; Clear the C-bit from the GHCB page if the SEV-ES is enabled.
OneTimeCall SevClearPageEncMaskForGhcbPage
; TDX will do some PostBuildPages task, such as setting
; byte[TDX_WORK_AREA_PGTBL_READY].
OneTimeCall TdxPostBuildPageTables
SetCr3:
;
; Set CR3 now that the paging structures are available
;
mov eax, PT_ADDR (0)
mov cr3, eax
OneTimeCallRet SetCr3ForPageTables64
|
src/NTypes.agda | vituscze/HoTT-lectures | 0 | 5434 | {-# OPTIONS --without-K #-}
module NTypes where
open import Equivalence
open import FunExt
open import GroupoidStructure
open import NTypes.Contractible
open import PathOperations
open import Transport
open import Types
isProp : ∀ {a} → Set a → Set _
isProp A = (x y : A) → x ≡ y
isSet : ∀ {a} → Set a → Set _
isSet A = (x y : A) (p q : x ≡ y) → p ≡ q
set→id-prop : ∀ {a} {A : Set a} →
isSet A → {x y : A} → isProp (x ≡ y)
set→id-prop A-set = A-set _ _
id-prop→set : ∀ {a} {A : Set a} →
({x y : A} → isProp (x ≡ y)) → isSet A
id-prop→set f _ _ = f
prop-eq : ∀ {a b} {A : Set a} {B : Set b} → A ≃ B → isProp A → isProp B
prop-eq (f , (g , α) , (h , β)) A-prop x y =
tr id
( ap (λ z → z ≡ f (g y)) (α x)
· ap (λ z → x ≡ z) (α y)
)
(ap f (A-prop (g x) (g y)))
-- Levels.
is-[_-2]-type : ℕ → ∀ {a} → Set a → Set a
is-[ n -2]-type = ind (λ _ → Set _ → Set _)
(λ _ r A → (x y : A) → r (x ≡ y))
isContr
n
-- isProp and is-(-1)-type.
prop→-1-type : ∀ {a} {A : Set a} →
isProp A → is-[ 1 -2]-type A
prop→-1-type {A = A} A-prop x y
= A-prop x y
, path
where
split-path : {x y : A} (p : x ≡ y) →
A-prop x y ≡ p · A-prop y y
split-path = J
(λ x y p → A-prop x y ≡ p · A-prop y y)
(λ _ → refl) _ _
path : {x y : A} (p : x ≡ y) → A-prop x y ≡ p
path = J
(λ x y p → A-prop x y ≡ p)
(λ x → split-path (A-prop x x ⁻¹) · p⁻¹·p (A-prop x x))
_ _
-1-type→prop : ∀ {a} {A : Set a} →
is-[ 1 -2]-type A → isProp A
-1-type→prop A-1 x y = π₁ (A-1 x y)
-- isSet and is-0-type.
set→0-type : ∀ {a} {A : Set a} →
isSet A → is-[ 2 -2]-type A
set→0-type A-set x y = prop→-1-type (A-set x y)
0-type→set : ∀ {a} {A : Set a} →
is-[ 2 -2]-type A → isSet A
0-type→set A0 x y = -1-type→prop (A0 x y)
-- Cumulativity.
n-type-suc : ∀ n {a} {A : Set a} →
is-[ n -2]-type A → is-[ suc n -2]-type A
n-type-suc n = ind
(λ n → ∀ {A} → is-[ n -2]-type A → is-[ suc n -2]-type A)
(λ _ r h x y → r (h x y))
(λ h → prop→-1-type λ x y → π₂ h x ⁻¹ · π₂ h y)
n
-- From lectures.
prop→set : ∀ {a} {A : Set a} →
isProp A → isSet A
prop→set A-prop x y p q = lem p · lem q ⁻¹
where
g : _
g = A-prop x
lem : (p : x ≡ y) → p ≡ g x ⁻¹ · g y
lem p
= id·p p ⁻¹
· ap (λ z → z · p)
(p⁻¹·p (g x)) ⁻¹
· p·q·r (g x ⁻¹) (g x) p ⁻¹
· ap (λ z → g x ⁻¹ · z)
( tr-post x p (g x) ⁻¹
· apd g p
)
isProp-is-prop : ∀ {a} {A : Set a} →
isProp (isProp A)
isProp-is-prop f g =
funext λ x →
funext λ y →
prop→set f _ _ (f x y) (g x y)
isSet-is-prop : ∀ {a} {A : Set a} →
isProp (isSet A)
isSet-is-prop f g =
funext λ x →
funext λ y →
funext λ p →
funext λ q →
prop→set (f x y) _ _ (f x y p q) (g x y p q)
|
src/main/antlr4/imports/mysql_rename.g4 | zhongyu211/maxwell | 3,362 | 6026 | <filename>src/main/antlr4/imports/mysql_rename.g4
grammar mysql_rename;
import mysql_literal_tokens, mysql_idents;
rename_table: RENAME TABLE rename_table_spec (',' rename_table_spec)*;
rename_table_spec: table_name TO table_name;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.