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
|
---|---|---|---|---|
boot.asm | olawlor/OS-L | 0 | 88472 | <reponame>olawlor/OS-L
;
; Operating System - Lawlor (OS-L)
; x86 BIOS bootup process
;
BITS 16 ; awful segmented memory
ORG 0x07C00 ; bios loads this boot block to linear address 0x07C00
start:
cli ; turn off interrupts until we get the machine running
cld ; make string instructions run normal direction (+)
; Zero out all the segment registers
xor ax, ax ; ax=0
mov ds, ax
mov es, ax
mov ss, ax
mov sp, 0x7000 ; stack pointer starts just below our boot block
sti ; restore interrupts
mov al,'O' ; dribble out boot text, so if we lock up, you can see where
call printchar
call enter_unreal_mode
mov al,'S'
call printchar
call chain_load
hang: jmp hang
; ***************** Chain Load **************
; Chain load: load the bulk of our operating system code.
; We load it right after this boot sector, so hopefully
; jumps and calls still work right.
%define CHAINLOAD_ADDRESS (0x7C00+512)
%define CHAINLOAD_BYTES (30*1024) ; size of chainload area
%define CHAINLOAD_SIGNATURE 0xC0DE ; "code"
; Default path uses Logical Block Addressing (LBA)
chain_load:
; Do disk read using linear block addressing: BIOS INT 13,42:
; https://en.wikipedia.org/wiki/INT_13H
mov ah,0x42 ;function number for LBA disk read
mov si,read_DAP ;memory location of Disk Address Packet (DAP)
; The boot drive is actually loaded to register dl on startup
; mov dl,0x80 ;drive (0x80 is hard drive, 0 is A:, 1 is B:)
int 0x13 ;read the disk
jc chain_load_CHS ; Error on LBA? Try fallback.
jmp chain_load_post
; LBA Disk Address Packet (DAP) identifies the data to read.
read_DAP:
db 0x10 ; Size of this DAP in bytes
db 0 ; unused
dw CHAINLOAD_BYTES/512 ; sector read count
dw CHAINLOAD_ADDRESS ; memory target: offset
dw 0 ; memory target: segment
dq 1 ; 0-based disk sector number to read
; Fallback cylinder-head-sector (CHS) load
chain_load_CHS:
mov al,'h'
call printchar
mov bx,CHAINLOAD_ADDRESS ;target location in memory
mov ah,0x02 ;function number for disk read
mov al,CHAINLOAD_BYTES/512 ;number of sectors (maximum 63 because BIOS)
mov ch,0x00 ;cylinder (0-based)
mov cl,0x02 ;first sector (1-based; boot block is sector 1)
mov dh,0x00 ;head (0-based)
; The boot drive is actually loaded to register dl on startup
; mov dl,0x80 ;drive (0x80 is hard drive, 0 is A:, 1 is B:)
int 0x13 ;read sectors to es:bx
chain_load_post:
mov al,'-'
call printchar
; Check first bytes for our signature:
mov si,CHAINLOAD_ADDRESS
mov ax,WORD[ds:si]
cmp ax,CHAINLOAD_SIGNATURE
jne bad_load
mov al,'L'
call printchar
; Hopefully this code exists now!
jmp chainload_start
bad_load:
mov si,bad_load_str
call printstrln
jmp hang
bad_load_str:
db "Chainload bad",0
;************* Utility: Text output functions ****************
; Print one character, passed in al.
; Trashes: none
printchar:
pusha ; save all registers
mov bx, 0x0007 ; 'output character' selector
mov ah, 0x0e; Output a character
int 0x10 ; "output character" interrupt
popa
ret
; Print a string (from the pointer si), then a newline
printstrln:
call printstr
; no ret, so falls through!
println: ; print just the newline
push ax
mov al,13 ; CR
call printchar
mov al,10 ; LF
call printchar
pop ax
ret
; Print a string, starting address in si
; Trashes: si
printstr:
lodsb ; = mov al, BYTE [ds:si]
cmp al,0
je print_done
call printchar
jmp printstr
print_done: ret
;******* Utility: GDT Load for Unreal Mode **********
; Switches from real mode (where the BIOS works) to protected
; mode, to initialize the 32-bit address hardware, and SSE hardware.
; It then switches back, so the BIOS keeps working.
enter_unreal_mode:
lgdt [flat_gdt_ptr]
cli ; no interrupts
; Switch to 32-bit mode
mov eax,cr0
or al,1 ; <- set low bit
mov cr0,eax
; Do data load
mov ax, 8 ; 8 bytes into the GDT (plus ring 0)
mov ds, ax ; initialize 32-bit address hardware
; While we're in protected mode, turn on SSE via CR4 bit 9 (OSFXSR)
mov ecx,cr4
or cx,1<<9
mov cr4,ecx
; Back to 16-bit mode (so BIOS works)
mov eax,cr0
and al,0xfe ; <- clear low bit
mov cr0,eax
xor ax,ax ; ax=0, back to segment 0
mov ds,ax
sti ; allow interrupts
ret
flat_gdt_ptr:
dw 2*8 -1 ; length in bytes (minus 1)
dd gdt_entries ; ptr to gdt
; These are the bytes of our global descriptor table (GDT):
gdt_entries:
dq 0 ; must start with an invalid entry, 8 bytes long
dw 0xffff ; limit (length of memory)
dw 0 ; base address
db 0 ; first leftover byte of base address
db 10010010b ; Access Byte: Pr, ring 0, code/data, read/write
db 11001111b ; Flags for 4K limit units, , and high bits of limit
db 0 ; high bits of base address
; pad to make this boot sector exactly 512 bytes long total
times 512-4-2-64-2-($-start) db 0x90
; Official PC boot record format:
dd 'HiM$' ; disk signature (any 4-byte string)
times 2 db 0 ; null bytes
; These 64 bytes are the "MBR Partition Table":
; four 16-byte records describing the first 4 disk partitions (primary partitions).
times 64 db 0
; A boot sector's last two bytes must contain this magic flag.
; This tells the BIOS it's OK to boot here; without this,
; you'll get the BIOS "Operating system not found" error.
dw 0xAA55 ; Magic value needed by BIOS
; End of boot sector
; -----------------------------------------------------
; Start of chainload sectors (immediately follows boot sector on disk)
chainload_signature:
dw CHAINLOAD_SIGNATURE ; our boot signature
chainload_start:
call println
mov si,full_splash_message
call printstrln
cmdloop:
call cmdline_run_cmd
jmp cmdloop
full_splash_message:
db 'Welcome to OS-L, the OS with NO RULES and NO useful features! (v0.2)',0
%include "commands.asm"
%include "utility.asm"
; Round up size to full CHAINLOAD_BYTES (VirtualBox wants full 512-byte sectors)
times (CHAINLOAD_BYTES - ($-chainload_signature)) db 0x90
|
bvs/BvsGetConfig.asm | osfree-project/FamilyAPI | 0 | 247374 | <filename>bvs/BvsGetConfig.asm
;/*!
; @file
;
; @brief BvsGetConfig DOS wrapper
;
; (c) osFree Project 2008-2022, <http://www.osFree.org>
; for licence see licence.txt in root directory, or project website
;
; This is Family API implementation for DOS, used with BIND tools
; to link required API
;
; @author <NAME> (<EMAIL>)
;
; * 0 NO_ERROR
; * 421 ERROR_VIO_INVALID_PARMS
; * 436 ERROR_VIO_INVALID_HANDLE
; * 438 ERROR_VIO_INVALID_LENGTH
; * 465 ERROR_VIO_DETACHED
;
; @todo add vioconfiginfo length check
;
;*/
.8086
; Helpers
INCLUDE helpers.inc
INCLUDE dos.inc
INCLUDE bios.inc
INCL_VIO EQU 1
INCLUDE bseerr.inc
INCLUDE bsesub.inc
_TEXT SEGMENT BYTE PUBLIC 'CODE' USE16
@BVSPROLOG BVSGETCONFIG
VIOHANDLE DW ? ; VIDEO HANDLE
VIOCONFIG DD ? ; Config structure
VIOCONFIGID DW ? ; Configuration ID
@BVSSTART BVSGETCONFIG
EXTERN VIOCHECKHANDLE: PROC
MOV BX,[DS:BP].ARGS.VIOHANDLE ; GET HANDLE
CALL VIOCHECKHANDLE
JNZ EXIT
@GetMode ;GET MODE
XOR DX,DX
CMP AL,7 ;80X25 MONO?
JE VGATEXT
INC DX
CMP AL,2 ;80X25
JE VGATEXT
CMP AL,3 ;80X25
JE VGATEXT
MOV DL,5
CMP AL,8 ;
JE VGATEXT
CMP AL,0EH
MOV AX, ERROR_VIO_DETACHED
JNE EXIT
VGATEXT:
XCHG DH,DL
@GetDisplay
CMP AL,01AH
JNE TRYEGA ; Not VGA adapter
PUSH BX ; Check adapter is not later EGA
MOV CX, 1
@GetVideoState
CMP AL,01CH
POP BX
JNE TRYEGA ; Not VGA adapter
CMP BL,7
JE ISVGA
CMP BL,8
JE ISVGA
CMP BL,4
JE ISEGA
CMP BL,5
JNE ISMDACGA
ISEGA: ; EGA display
MOV DL,2
JMP SETRET
ISVGA: ; VGA display
MOV DL,3
JMP SETRET
TRYEGA:
@GetEGAInfo
CMP BL,10H
JNE ISEGA
ISMDACGA: ; MDA/CGA display
CMP DH,1
JNE SETRET
INC DX
SETRET:
LDS BX,[DS:BP].ARGS.VIOCONFIG
XOR AH,AH
MOV AL,DL
MOV [DS:BX].VIOCONFIGINFO.VIOIN_ADAPTER,AX ;ADAPTER TYPE
MOV AL,DH
MOV [DS:BX].VIOCONFIGINFO.VIOIN_DISPLAY,AX ;DISPLAY TYPE
XOR AX,AX
EXIT:
@BVSEPILOG BVSGETCONFIG
_TEXT ENDS
END
|
oeis/305/A305292.asm | neoneye/loda-programs | 11 | 176982 | <reponame>neoneye/loda-programs<filename>oeis/305/A305292.asm
; A305292: Numbers k such that k-1 is a square and k+1 is a triangular number.
; Submitted by <NAME>
; 2,5,65,170,2210,5777,75077,196250,2550410,6666725,86638865,226472402,2943171002,7693394945,99981175205,261348955730,3396416785970,8878171099877,115378189547777,301596468440090,3919462027838450,10245401755863185,133146330756959525,348042063230908202,4523055783708785402,11823184748095015685,153650750315341744145,401640239371999625090,5219602454937910515530,13643944953899892237377,177312832717573615783877,463492488193224336445730,6023416709942565026136290,15745100653615727546917445
mov $1,$0
seq $1,77241 ; Combined Diophantine Chebyshev sequences A054488 and A077413.
pow $1,2
mov $0,$1
add $0,1
|
gcc-gcc-7_3_0-release/gcc/ada/alloc.ads | best08618/asylo | 7 | 13234 | <filename>gcc-gcc-7_3_0-release/gcc/ada/alloc.ads
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- A L L O C --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- 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 contains definitions for initial sizes and growth increments
-- for the various dynamic arrays used for the main compiler data structures.
-- The indicated initial size is allocated for the start of each file, and
-- the increment factor is a percentage used to increase the table size when
-- it needs expanding (e.g. a value of 100 = 100% increase = double)
-- Note: the initial values here are multiplied by Table_Factor as set by the
-- -gnatTnn switch. This variable is defined in Opt, as is the default value
-- for the table factor.
package Alloc is
-- The comment shows the unit in which the table is defined
All_Interp_Initial : constant := 1_000; -- Sem_Type
All_Interp_Increment : constant := 100;
Branches_Initial : constant := 1_000; -- Sem_Warn
Branches_Increment : constant := 100;
Conditionals_Initial : constant := 1_000; -- Sem_Warn
Conditionals_Increment : constant := 100;
Conditional_Stack_Initial : constant := 50; -- Sem_Warn
Conditional_Stack_Increment : constant := 100;
Elists_Initial : constant := 200; -- Elists
Elists_Increment : constant := 100;
Elmts_Initial : constant := 1_200; -- Elists
Elmts_Increment : constant := 100;
File_Name_Chars_Initial : constant := 10_000; -- Osint
File_Name_Chars_Increment : constant := 100;
In_Out_Warnings_Initial : constant := 100; -- Sem_Warn
In_Out_Warnings_Increment : constant := 100;
Ignored_Ghost_Units_Initial : constant := 20; -- Sem_Util
Ignored_Ghost_Units_Increment : constant := 50;
Inlined_Initial : constant := 100; -- Inline
Inlined_Increment : constant := 100;
Inlined_Bodies_Initial : constant := 50; -- Inline
Inlined_Bodies_Increment : constant := 200;
Interp_Map_Initial : constant := 200; -- Sem_Type
Interp_Map_Increment : constant := 100;
Lines_Initial : constant := 500; -- Sinput
Lines_Increment : constant := 150;
Linker_Option_Lines_Initial : constant := 5; -- Lib
Linker_Option_Lines_Increment : constant := 200;
Lists_Initial : constant := 4_000; -- Nlists
Lists_Increment : constant := 200;
Load_Stack_Initial : constant := 10; -- Lib
Load_Stack_Increment : constant := 100;
Name_Chars_Initial : constant := 50_000; -- Namet
Name_Chars_Increment : constant := 100;
Name_Qualify_Units_Initial : constant := 200; -- Exp_Dbug
Name_Qualify_Units_Increment : constant := 300;
Names_Initial : constant := 6_000; -- Namet
Names_Increment : constant := 100;
Nodes_Initial : constant := 50_000; -- Atree
Nodes_Increment : constant := 100;
Nodes_Release_Threshold : constant := 100_000;
Notes_Initial : constant := 100; -- Lib
Notes_Increment : constant := 200;
Obsolescent_Warnings_Initial : constant := 50; -- Sem_Prag
Obsolescent_Warnings_Increment : constant := 200;
Orig_Nodes_Initial : constant := 50_000; -- Atree
Orig_Nodes_Increment : constant := 100;
Orig_Nodes_Release_Threshold : constant := 100_000;
Pending_Instantiations_Initial : constant := 10; -- Inline
Pending_Instantiations_Increment : constant := 100;
Rep_Table_Initial : constant := 1000; -- Repinfo
Rep_Table_Increment : constant := 200;
Scope_Stack_Initial : constant := 10; -- Sem
Scope_Stack_Increment : constant := 200;
SFN_Table_Initial : constant := 10; -- Fname
SFN_Table_Increment : constant := 200;
Source_File_Initial : constant := 10; -- Sinput
Source_File_Increment : constant := 200;
String_Chars_Initial : constant := 2_500; -- Stringt
String_Chars_Increment : constant := 150;
Strings_Initial : constant := 5_00; -- Stringt
Strings_Increment : constant := 150;
Successors_Initial : constant := 2_00; -- Inline
Successors_Increment : constant := 100;
Udigits_Initial : constant := 10_000; -- Uintp
Udigits_Increment : constant := 100;
Uints_Initial : constant := 5_000; -- Uintp
Uints_Increment : constant := 100;
Units_Initial : constant := 30; -- Lib
Units_Increment : constant := 100;
Ureals_Initial : constant := 200; -- Urealp
Ureals_Increment : constant := 100;
Unreferenced_Entities_Initial : constant := 1_000; -- Sem_Warn
Unreferenced_Entities_Increment : constant := 100;
Warnings_Off_Pragmas_Initial : constant := 500; -- Sem_Warn
Warnings_Off_Pragmas_Increment : constant := 100;
With_List_Initial : constant := 10; -- Features
With_List_Increment : constant := 300;
Xrefs_Initial : constant := 5_000; -- Cross-refs
Xrefs_Increment : constant := 300;
Drefs_Initial : constant := 5; -- Dereferences
Drefs_Increment : constant := 1_000;
end Alloc;
|
raid/pq_check_sse.asm | hzhuang1/isa-l | 344 | 102561 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright(c) 2011-2015 Intel Corporation All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in
; the documentation and/or other materials provided with the
; distribution.
; * Neither the name of Intel Corporation nor the names of its
; contributors may be used to endorse or promote products derived
; from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Optimized pq of N source vectors using SSE3
;;; int pq_check_sse(int vects, int len, void **array)
;;; Generates P+Q parity vector from N (vects-2) sources in array of pointers
;;; (**array). Last two pointers are the P and Q destinations respectively.
;;; Vectors must be aligned to 16 bytes. Length must be 16 byte aligned.
%include "reg_sizes.asm"
%ifidn __OUTPUT_FORMAT__, elf64
%define arg0 rdi
%define arg1 rsi
%define arg2 rdx
%define arg3 rcx
%define arg4 r8
%define arg5 r9
%define tmp r11
%define tmp3 arg4
%define return rax
%define func(x) x: endbranch
%define FUNC_SAVE
%define FUNC_RESTORE
%endif
%ifidn __OUTPUT_FORMAT__, win64
%define arg0 rcx
%define arg1 rdx
%define arg2 r8
%define arg3 r9
%define tmp r11
%define tmp3 r10
%define return rax
%define stack_size 7*16 + 8 ; must be an odd multiple of 8
%define func(x) proc_frame x
%macro FUNC_SAVE 0
alloc_stack stack_size
save_xmm128 xmm6, 0*16
save_xmm128 xmm7, 1*16
save_xmm128 xmm8, 2*16
save_xmm128 xmm9, 3*16
save_xmm128 xmm10, 4*16
save_xmm128 xmm11, 5*16
save_xmm128 xmm15, 6*16
end_prolog
%endmacro
%macro FUNC_RESTORE 0
movdqa xmm6, [rsp + 0*16]
movdqa xmm7, [rsp + 1*16]
movdqa xmm8, [rsp + 2*16]
movdqa xmm9, [rsp + 3*16]
movdqa xmm10, [rsp + 4*16]
movdqa xmm11, [rsp + 5*16]
movdqa xmm15, [rsp + 9*16]
add rsp, stack_size
%endmacro
%endif
%define vec arg0
%define len arg1
%define ptr arg3
%define pos return
%define xp1 xmm0
%define xq1 xmm1
%define xtmp1 xmm2
%define xs1 xmm3
%define xp2 xmm4
%define xq2 xmm5
%define xtmp2 xmm6
%define xs2 xmm7
%define xp3 xmm8
%define xq3 xmm9
%define xtmp3 xmm10
%define xs3 xmm11
%define xpoly xmm15
;;; Use Non-temporal load/stor
%ifdef NO_NT_LDST
%define XLDR movdqa
%define XSTR movdqa
%else
%define XLDR movdqa
%define XSTR movntdq
%endif
default rel
[bits 64]
section .text
align 16
mk_global pq_check_sse, function
func(pq_check_sse)
FUNC_SAVE
sub vec, 3 ;Keep as offset to last source
jng return_fail ;Must have at least 2 sources
cmp len, 0
je return_pass
test len, (16-1) ;Check alignment of length
jnz return_fail
mov pos, 0
movdqa xpoly, [poly]
cmp len, 48
jl loop16
len_aligned_32bytes:
sub len, 48 ;Do end of vec first and run backward
loop48:
mov ptr, [arg2+8+vec*8] ;Get address of P parity vector
mov tmp, [arg2+(2*8)+vec*8] ;Get address of Q parity vector
XLDR xp1, [ptr+pos] ;Initialize xp1 with P1 src
XLDR xp2, [ptr+pos+16] ;Initialize xp2 with P2 src + 16B ahead
XLDR xp3, [ptr+pos+32] ;Initialize xp3 with P2 src + 32B ahead
pxor xq1, xq1 ;q1 = 0
pxor xq2, xq2 ;q2 = 0
pxor xq3, xq3 ;q3 = 0
mov ptr, [arg2+vec*8] ;Fetch last source pointer
mov tmp, vec ;Set tmp to point back to last vector
XLDR xs1, [ptr+pos] ;Preload last vector (source)
XLDR xs2, [ptr+pos+16] ;Preload last vector (source)
XLDR xs3, [ptr+pos+32] ;Preload last vector (source)
next_vect:
sub tmp, 1 ;Inner loop for each source vector
mov ptr, [arg2+tmp*8] ; get pointer to next vect
pxor xp1, xs1 ; p1 ^= s1
pxor xp2, xs2 ; p2 ^= s2
pxor xp3, xs3 ; p3 ^= s2
pxor xq1, xs1 ; q1 ^= s1
pxor xq2, xs2 ; q2 ^= s2
pxor xq3, xs3 ; q3 ^= s3
pxor xtmp1, xtmp1 ; xtmp1 = 0 - for compare to 0
pxor xtmp2, xtmp2 ; xtmp2 = 0
pxor xtmp3, xtmp3 ; xtmp3 = 0
pcmpgtb xtmp1, xq1 ; xtmp1 = mask 0xff or 0x00 if bit7 set
pcmpgtb xtmp2, xq2 ; xtmp2 = mask 0xff or 0x00 if bit7 set
pcmpgtb xtmp3, xq3 ; xtmp3 = mask 0xff or 0x00 if bit7 set
pand xtmp1, xpoly ; xtmp1 = poly or 0x00
pand xtmp2, xpoly ; xtmp2 = poly or 0x00
pand xtmp3, xpoly ; xtmp3 = poly or 0x00
XLDR xs1, [ptr+pos] ; Get next vector (source data1)
XLDR xs2, [ptr+pos+16] ; Get next vector (source data2)
XLDR xs3, [ptr+pos+32] ; Get next vector (source data3)
paddb xq1, xq1 ; q1 = q1<<1
paddb xq2, xq2 ; q2 = q2<<1
paddb xq3, xq3 ; q3 = q3<<1
pxor xq1, xtmp1 ; q1 = q1<<1 ^ poly_masked
pxor xq2, xtmp2 ; q2 = q2<<1 ^ poly_masked
pxor xq3, xtmp3 ; q3 = q3<<1 ^ poly_masked
jg next_vect ; Loop for each vect except 0
pxor xp1, xs1 ;p1 ^= s1[0] - last source is already loaded
pxor xq1, xs1 ;q1 ^= 1 * s1[0]
pxor xp2, xs2 ;p2 ^= s2[0]
pxor xq2, xs2 ;q2 ^= 1 * s2[0]
pxor xp3, xs3 ;p3 ^= s3[0]
pxor xq3, xs3 ;q3 ^= 1 * s3[0]
mov tmp, [arg2+(2*8)+vec*8] ;Get address of Q parity vector
XLDR xtmp1, [tmp+pos] ;re-init xq1 with Q1 src
XLDR xtmp2, [tmp+pos+16] ;re-init xq2 with Q2 src + 16B ahead
XLDR xtmp3, [tmp+pos+32] ;re-init xq3 with Q2 src + 32B ahead
pxor xq1, xtmp1 ;xq1 = q1 calculated ^ q1 saved
pxor xq2, xtmp2
pxor xq3, xtmp3
por xp1, xq1 ;Confirm that all P&Q parity are 0
por xp1, xp2
por xp1, xq2
por xp1, xp3
por xp1, xq3
ptest xp1, xp1
jnz return_fail
add pos, 48
cmp pos, len
jle loop48
;; ------------------------------
;; Do last 16 or 32 Bytes remaining
add len, 48
cmp pos, len
je return_pass
loop16:
mov ptr, [arg2+8+vec*8] ;Get address of P parity vector
mov tmp, [arg2+(2*8)+vec*8] ;Get address of Q parity vector
XLDR xp1, [ptr+pos] ;Initialize xp1 with P1 src
pxor xq1, xq1 ;q = 0
mov ptr, [arg2+vec*8] ;Fetch last source pointer
mov tmp, vec ;Set tmp to point back to last vector
XLDR xs1, [ptr+pos] ;Preload last vector (source)
next_vect16:
sub tmp, 1 ;Inner loop for each source vector
mov ptr, [arg2+tmp*8] ; get pointer to next vect
pxor xq1, xs1 ; q ^= s
pxor xtmp1, xtmp1 ; xtmp = 0
pcmpgtb xtmp1, xq1 ; xtmp = mask 0xff or 0x00 if bit7 set
pand xtmp1, xpoly ; xtmp = poly or 0x00
pxor xp1, xs1 ; p ^= s
paddb xq1, xq1 ; q = q<<1
pxor xq1, xtmp1 ; q = q<<1 ^ poly_masked
XLDR xs1, [ptr+pos] ; Get next vector (source data)
jg next_vect16 ; Loop for each vect except 0
pxor xp1, xs1 ;p ^= s[0] - last source is already loaded
pxor xq1, xs1 ;q ^= 1 * s[0]
mov tmp, [arg2+(2*8)+vec*8] ;Get address of Q parity vector
XLDR xtmp1, [tmp+pos] ;re-init tmp with Q1 src
pxor xq1, xtmp1 ;xq1 = q1 calculated ^ q1 saved
por xp1, xq1 ;Confirm that all P&Q parity are = 0
ptest xp1, xp1
jnz return_fail
add pos, 16
cmp pos, len
jl loop16
return_pass:
mov return, 0
FUNC_RESTORE
ret
return_fail:
mov return, 1
FUNC_RESTORE
ret
endproc_frame
section .data
align 16
poly:
dq 0x1d1d1d1d1d1d1d1d, 0x1d1d1d1d1d1d1d1d
;;; func core, ver, snum
slversion pq_check_sse, 00, 06, 0033
|
oeis/142/A142624.asm | neoneye/loda-programs | 11 | 5552 | ; A142624: Primes congruent to 32 mod 55.
; Submitted by <NAME>
; 197,307,857,967,1187,1297,1627,1847,2287,2617,2837,3167,3607,4157,4597,4817,5147,5477,5807,6247,6577,6907,7127,7237,7457,8117,8447,8887,9437,9547,9767,10427,10867,11087,11197,11527,12517,13177,13397,14057,14387,14717,14827,15377,15817,16477,17027,17137,17467,18127,18457,18787,19447,19777,19997,20107,20327,21317,21647,21757,21977,22307,22637,23297,23627,23957,25057,25717,26267,26597,26927,27367,27697,27917,28027,28687,29017,29347,29567,30557,31327,31547,31657,32537,32647,33637,33857,33967,34297
mov $1,43
mov $2,$0
add $2,2
pow $2,2
lpb $2
sub $2,1
mov $3,$1
mul $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,55
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mov $0,$1
mul $0,2
sub $0,109
|
Fields/CauchyCompletion/BaseExpansion.agda | Smaug123/agdaproofs | 4 | 1474 | <filename>Fields/CauchyCompletion/BaseExpansion.agda
{-# OPTIONS --safe --warning=error --without-K --guardedness #-}
open import Setoids.Setoids
open import Rings.Definition
open import Rings.Lemmas
open import Rings.Orders.Partial.Definition
open import Rings.Orders.Total.Definition
open import Groups.Definition
open import Groups.Lemmas
open import Fields.Fields
open import Sets.EquivalenceRelations
open import Sequences
open import Setoids.Orders.Partial.Definition
open import Setoids.Orders.Total.Definition
open import Functions.Definition
open import LogicalFormulae
open import Numbers.Naturals.Semiring
open import Numbers.Naturals.Order
open import Numbers.Naturals.Order.Lemmas
open import Semirings.Definition
open import Numbers.Modulo.Definition
open import Orders.Total.Definition
module Fields.CauchyCompletion.BaseExpansion {m n o : _} {A : Set m} {S : Setoid {m} {n} A} {_+_ : A → A → A} {_*_ : A → A → A} {_<_ : Rel {m} {o} A} {pOrder : SetoidPartialOrder S _<_} {R : Ring S _+_ _*_} {pRing : PartiallyOrderedRing R pOrder} (order : TotallyOrderedRing pRing) (F : Field R) where
open Setoid S
open SetoidTotalOrder (TotallyOrderedRing.total order)
open SetoidPartialOrder pOrder
open Equivalence eq
open PartiallyOrderedRing pRing
open Ring R
open Group additiveGroup
open Field F
open import Fields.Orders.Limits.Definition {F = F} (record { oRing = order })
open import Fields.Orders.Total.Lemmas {F = F} (record { oRing = order })
open import Fields.Orders.Limits.Lemmas {F = F} (record { oRing = order })
open import Fields.Lemmas F
open import Fields.Orders.Lemmas {F = F} record { oRing = order }
open import Rings.Orders.Total.Lemmas order
open import Rings.Orders.Total.AbsoluteValue order
open import Rings.Orders.Partial.Lemmas pRing
open import Fields.CauchyCompletion.Definition order F
open import Fields.CauchyCompletion.Setoid order F
open import Fields.CauchyCompletion.Addition order F
open import Fields.CauchyCompletion.Comparison order F
open import Fields.CauchyCompletion.Approximation order F
open import Rings.InitialRing R
open import Rings.Orders.Partial.Bounded pRing
open import Rings.Orders.Total.Bounded order
open import Rings.Orders.Total.Cauchy order
-- TODO this is not necessarily true :( the bounded sequence could oscillate between 1 and -1
cauchyTimesBoundedIsCauchy : {s : Sequence A} → cauchy s → {t : Sequence A} → Bounded t → cauchy (apply _*_ s t)
cauchyTimesBoundedIsCauchy {s} cau {t} (K , bounded) e 0<e with allInvertible K (boundNonzero (K , bounded))
... | 1/K , prK with cau (1/K * e) (orderRespectsMultiplication (reciprocalPositive K 1/K (boundGreaterThanZero (K , bounded)) (transitive *Commutative prK)) 0<e)
... | N , cauPr = N , ans
where
ans : {m n : ℕ} (N<m : N <N m) (N<n : N <N n) → (abs (index (apply _*_ s t) m + inverse (index (apply _*_ s t) n))) < e
ans N<m N<n with cauPr N<m N<n
... | r = {!!}
boundedTimesCauchyIsCauchy : {s : Sequence A} → cauchy s → {t : Sequence A} → Bounded t → cauchy (apply _*_ t s)
boundedTimesCauchyIsCauchy {s} cau {t} bou = cauchyWellDefined (ans s t) (cauchyTimesBoundedIsCauchy cau bou)
where
ans : (s t : Sequence A) (m : ℕ) → index (apply _*_ s t) m ∼ index (apply _*_ t s) m
ans s t m rewrite indexAndApply t s _*_ {m} | indexAndApply s t _*_ {m} = *Commutative
private
digitExpansionSeq : {n : ℕ} → .(0<n : 0 <N n) → Sequence (ℤn n 0<n) → Sequence A
Sequence.head (digitExpansionSeq {n} 0<n seq) = fromN (ℤn.x (Sequence.head seq))
Sequence.tail (digitExpansionSeq {n} 0<n seq) = digitExpansionSeq 0<n (Sequence.tail seq)
powerSeq : (i : A) → (start : A) → Sequence A
Sequence.head (powerSeq i start) = start
Sequence.tail (powerSeq i start) = powerSeq i (start * i)
powerSeqInduction : (i : A) (start : A) → (m : ℕ) → (index (powerSeq i start) (succ m)) ∼ i * (index (powerSeq i start) m)
powerSeqInduction i start zero = *Commutative
powerSeqInduction i start (succ m) = powerSeqInduction i (start * i) m
ofBaseExpansionSeq : {n : ℕ} → .(0<n : 0 <N n) → Sequence (ℤn n 0<n) → Sequence A
ofBaseExpansionSeq {succ n} 0<n seq = apply _*_ (digitExpansionSeq 0<n seq) (powerSeq pow pow)
where
pow : A
pow = underlying (allInvertible (fromN (succ n)) (charNotN n))
powerSeqPositive : {i : A} → (0R < i) → {s : A} → (0R < s) → (m : ℕ) → 0R < index (powerSeq i s) m
powerSeqPositive {i} 0<i {s} 0<s zero = 0<s
powerSeqPositive {i} 0<i {s} 0<s (succ m) = <WellDefined reflexive (symmetric (powerSeqInduction i s m)) (orderRespectsMultiplication 0<i (powerSeqPositive 0<i 0<s m))
powerSeqConvergesTo0 : (i : A) → (0R < i) → (i < 1R) → {s : A} → (0R < s) → (powerSeq i s) ~> 0G
powerSeqConvergesTo0 i 0<i i<1 {s} 0<s e 0<e = {!!}
powerSeqConverges : (i : A) → (0R < i) → (i < 1R) → {s : A} → (0R < s) → cauchy (powerSeq i s)
powerSeqConverges i 0<i i<1 {s} 0<s = convergentSequenceCauchy nontrivial {r = 0R} (powerSeqConvergesTo0 i 0<i i<1 0<s)
0<n : {n : ℕ} → 1 <N n → 0 <N n
0<n 1<n = TotalOrder.<Transitive ℕTotalOrder (le 0 refl) 1<n
digitExpansionBoundedLemma : {n : ℕ} → .(0<n : 0 <N n) → (seq : Sequence (ℤn n 0<n)) → (m : ℕ) → index (digitExpansionSeq _ seq) m < fromN n
digitExpansionBoundedLemma {n} 0<n seq zero with Sequence.head seq
... | record { x = x ; xLess = xLess } = fromNPreservesOrder (0<1 nontrivial) {x} {n} ((squash<N xLess))
digitExpansionBoundedLemma 0<n seq (succ m) = digitExpansionBoundedLemma 0<n (Sequence.tail seq) m
digitExpansionBoundedLemma2 : {n : ℕ} → .(0<n : 0 <N n) → (seq : Sequence (ℤn n 0<n)) → (m : ℕ) → inverse (fromN n) < index (digitExpansionSeq 0<n seq) m
digitExpansionBoundedLemma2 {n} 0<n seq zero = <WellDefined identLeft (transitive (symmetric +Associative) (transitive (+WellDefined reflexive invRight) identRight)) (orderRespectsAddition {_} {fromN (ℤn.x (Sequence.head seq)) + fromN n} (<WellDefined reflexive (fromNPreserves+ (ℤn.x (Sequence.head seq)) n) (fromNPreservesOrder (0<1 nontrivial) {0} {ℤn.x (Sequence.head seq) +N n} (canAddToOneSideOfInequality' _ (squash<N 0<n)))) (inverse (fromN n)))
digitExpansionBoundedLemma2 0<n seq (succ m) = digitExpansionBoundedLemma2 0<n (Sequence.tail seq) m
digitExpansionBounded : {n : ℕ} → .(0<n : 0 <N n) → (seq : Sequence (ℤn n 0<n)) → Bounded (digitExpansionSeq 0<n seq)
digitExpansionBounded {n} 0<n seq = fromN n , λ m → ((digitExpansionBoundedLemma2 0<n seq m) ,, digitExpansionBoundedLemma 0<n seq m)
private
1/nPositive : (n : ℕ) → 0R < underlying (allInvertible (fromN (succ n)) (charNotN n))
1/nPositive n with allInvertible (fromN (succ n)) (charNotN n)
... | a , b = reciprocalPositive (fromN (succ n)) a (fromNPreservesOrder (0<1 nontrivial) (succIsPositive n)) (transitive *Commutative b)
1/n<1 : (n : ℕ) → (0 <N n) → underlying (allInvertible (fromN (succ n)) (charNotN n)) < 1R
1/n<1 n 1<n with allInvertible (fromN (succ n)) (charNotN n)
... | a , b = reciprocal<1 (fromN (succ n)) a (<WellDefined identRight reflexive (fromNPreservesOrder (0<1 nontrivial) {1} {succ n} (succPreservesInequality 1<n))) (transitive *Commutative b)
-- Construct the real that is the given base-n expansion between 0 and 1.
ofBaseExpansion : {n : ℕ} → .(1<n : 1 <N n) → (fromN n ∼ 0R → False) → Sequence (ℤn n (0<n 1<n)) → CauchyCompletion
ofBaseExpansion {succ n} 1<n charNotN seq = record { elts = ofBaseExpansionSeq (0<n 1<n) seq ; converges = boundedTimesCauchyIsCauchy (powerSeqConverges _ (1/nPositive n) (1/n<1 n (canRemoveSuccFrom<N (squash<N 1<n))) (1/nPositive n)) (digitExpansionBounded (0<n 1<n) seq)}
toBaseExpansion : {n : ℕ} → .(1<n : 1 <N n) → (fromN n ∼ 0R → False) → (a : CauchyCompletion) → 0R r<C a → a <Cr 1R → Sequence (ℤn n (0<n 1<n))
Sequence.head (toBaseExpansion {n} 1<n charNotN c 0<c c<1) = {!!}
-- TOOD: approximate c to within 1/n^2, extract the first decimal of the result.
Sequence.tail (toBaseExpansion {n} 1<n charNotN c 0<c c<1) = toBaseExpansion 1<n charNotN {!!} {!!} {!!}
baseExpansionProof : {n : ℕ} → .{1<n : 1 <N n} → {charNotN : fromN n ∼ 0R → False} → (as : CauchyCompletion) → (0<a : 0R r<C as) → (a<1 : as <Cr 1R) → Setoid._∼_ cauchyCompletionSetoid (ofBaseExpansion 1<n charNotN (toBaseExpansion 1<n charNotN as 0<a a<1)) as
baseExpansionProof = {!!}
|
src/util-encoders.ads | Letractively/ada-util | 0 | 18438 | -----------------------------------------------------------------------
-- util-encoders -- Encode/Decode streams and strings from one format to another
-- Copyright (C) 2009, 2010, 2011, 2012 <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.Streams;
with Ada.Finalization;
with Ada.Strings.Unbounded;
with Interfaces;
-- The <b>Util.Encoders</b> package defines the <b>Encoder</b> object
-- which represents a mechanism to transform a stream from one format into
-- another format.
package Util.Encoders is
pragma Preelaborate;
Not_Supported : exception;
Encoding_Error : exception;
-- Encoder/decoder for Base64 (RFC 4648)
BASE_64 : constant String := "base64";
-- Encoder/decoder for Base64 (RFC 4648) using the URL alphabet
-- (+ and / are replaced by - and _)
BASE_64_URL : constant String := "base64url";
-- Encoder/decoder for Base16 (RFC 4648)
BASE_16 : constant String := "base16";
HEX : constant String := "hex";
-- Encoder for SHA1 (RFC 3174)
HASH_SHA1 : constant String := "sha1";
-- ------------------------------
-- Encoder context object
-- ------------------------------
-- The <b>Encoder</b> provides operations to encode and decode
-- strings or stream of data from one format to another.
-- The <b>Encoded</b> contains two <b>Transformer</b>
-- which either <i>encodes</i> or <i>decodes</i> the stream.
type Encoder is tagged limited private;
-- 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;
-- 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;
-- Create the encoder object for the specified encoding format.
function Create (Name : String) return Encoder;
-- ------------------------------
-- Stream Transformation interface
-- ------------------------------
-- The <b>Transformer</b> interface defines the operation to transform
-- a stream from one data format to another.
type Transformer is limited interface;
type Transformer_Access is access all Transformer'Class;
-- Transform the input stream represented by <b>Data</b> into
-- the output stream <b>Into</b>. The transformation made by
-- the object can be of any nature (Hex encoding, Base64 encoding,
-- Hex decoding, Base64 decoding, ...).
--
-- If the transformer does not have enough room to write the result,
-- it must return in <b>Encoded</b> the index of the last encoded
-- position in the <b>Data</b> stream.
--
-- The transformer returns in <b>Last</b> the last valid position
-- in the output stream <b>Into</b>.
--
-- The <b>Encoding_Error</b> exception is raised if the input
-- stream cannot be transformed.
procedure Transform (E : in Transformer;
Data : in Ada.Streams.Stream_Element_Array;
Into : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset;
Encoded : out Ada.Streams.Stream_Element_Offset) is abstract;
procedure Transform (E : in Transformer;
Data : in String;
Result : out Ada.Strings.Unbounded.Unbounded_String) is null;
-- 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;
-- 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 Ada.Streams.Stream_Element_Array) return String;
-- 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);
-- 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);
private
type Encoder is new Ada.Finalization.Limited_Controlled with record
Encode : Transformer_Access := null;
Decode : Transformer_Access := null;
end record;
-- Delete the transformers
overriding
procedure Finalize (E : in out Encoder);
end Util.Encoders;
|
array_utils/tests/src/array_utils-test_cases.ads | jgrivera67/projects-with-amy | 0 | 13621 | <filename>array_utils/tests/src/array_utils-test_cases.ads
with AUnit;
with AUnit.Test_Fixtures;
package Array_Utils.Test_Cases is
type Test_Case is new AUnit.Test_Fixtures.Test_Fixture with null record;
procedure Test_Linear_Search_Element_Found_First_Entry (T : in out Test_Case);
procedure Test_Linear_Search_Element_Found_Last_Entry (T : in out Test_Case);
procedure Test_Linear_Search_Element_Found_Middle_Entry (T : in out Test_Case);
procedure Test_Linear_Search_Element_Not_Found (T : in out Test_Case);
-- TODO: Add unit tests for Binary_Search
end Array_Utils.Test_Cases; |
s1/sfx-original/SndA4 - Skid.asm | Cancer52/flamedriver | 9 | 88909 | <filename>s1/sfx-original/SndA4 - Skid.asm
SndA4_Skid_Header:
smpsHeaderStartSong 1
smpsHeaderVoice SndA4_Skid_Voices
smpsHeaderTempoSFX $01
smpsHeaderChanSFX $02
smpsHeaderSFXChannel cPSG2, SndA4_Skid_PSG2, $F4, $00
smpsHeaderSFXChannel cPSG3, SndA4_Skid_PSG3, $F4, $00
; PSG2 Data
SndA4_Skid_PSG2:
smpsPSGvoice $00
dc.b nBb3, $01, nRst, nBb3, nRst, $03
SndA4_Skid_Loop01:
dc.b nBb3, $01, nRst, $01
smpsLoop $00, $0B, SndA4_Skid_Loop01
smpsStop
; PSG3 Data
SndA4_Skid_PSG3:
smpsPSGvoice $00
dc.b nRst, $01, nAb3, nRst, nAb3, nRst, $03
SndA4_Skid_Loop00:
dc.b nAb3, $01, nRst, $01
smpsLoop $00, $0B, SndA4_Skid_Loop00
smpsStop
; Song seems to not use any FM voices
SndA4_Skid_Voices:
|
alloy4fun_models/trainstlt/models/1/MnJfvnbbyXpL3aK3H.als | Kaixi26/org.alloytools.alloy | 0 | 947 | open main
pred idMnJfvnbbyXpL3aK3H_prop2 {
always all s: Signal | eventually s in Green
}
pred __repair { idMnJfvnbbyXpL3aK3H_prop2 }
check __repair { idMnJfvnbbyXpL3aK3H_prop2 <=> prop2o } |
attic/asis/find_entities/adam-assist-query-find_entities-element_processing.ads | charlie5/aIDE | 3 | 5992 | <reponame>charlie5/aIDE<filename>attic/asis/find_entities/adam-assist-query-find_entities-element_processing.ads
-- This package contains routines for ASIS Elements processing.
with Asis;
package AdaM.Assist.Query.find_Entities.element_Processing is
procedure Process_Construct (The_Element : Asis.Element);
-- This is the template for the procedure which is supposed to
-- perform the analysis of its argument Element (The_Element) based on
-- the recursive traversing of the Element hierarchy rooted by
-- The_Element. It calls the instantiation of the ASIS Traverse_Element
-- generic procedure for The_Element.
--
-- This procedure should not be called for Nil_Element;
--
-- Note, that the instantiation of Traverse_Element and the way how it is
-- called is no more then a template. It uses a dummy enumeration type
-- as the actual type for the state of the traversal, and it uses
-- dummy procedures which do nothing as actual procedures for Pre- and
-- Post-operations. The Control parameter of the traversal is set
-- to Continue and it is not changed by actual Pre- or Post-operations.
-- All this things will definitely require revising when using this
-- set of templates to build any real application. (At least you will
-- have to provide real Pre- and/or Post-operation)
--
-- See the package body for more details.
end AdaM.Assist.Query.find_Entities.element_Processing;
|
test/Succeed/UniqueFloatNaN.agda | hborum/agda | 2 | 2058 | <filename>test/Succeed/UniqueFloatNaN.agda
module UniqueFloatNaN where
-- See Issue: Inconsistency: Rounding op differentiates NaNs #3749
-- https://github.com/agda/agda/issues/3749
open import Agda.Builtin.Float
renaming ( primRound to round
; primFloor to floor
; primCeiling to ceiling
; primFloatNegate to -_
; primFloatDiv to _/_)
open import Agda.Builtin.Equality
PNaN : Float
PNaN = 0.0 / 0.0
NNaN : Float
NNaN = - (0.0 / 0.0)
f : round PNaN ≡ round NNaN
f = refl
g : floor PNaN ≡ floor NNaN
g = refl
h : ceiling PNaN ≡ ceiling NNaN
h = refl
|
oeis/287/A287793.asm | neoneye/loda-programs | 11 | 161786 | <gh_stars>10-100
; A287793: Eight steps forward, seven steps back.
; Submitted by <NAME>(s3)
; 0,1,2,3,4,5,6,7,8,7,6,5,4,3,2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,4,5,6,7,8,9,10,11,10,9,8,7,6,5,4,5,6,7,8,9,10,11,12,11,10,9,8,7,6,5,6,7,8,9,10,11
lpb $0
sub $0,5
add $1,1
add $2,10
trn $2,$0
trn $0,10
add $0,$2
lpe
add $0,$1
|
PRG/objects/5-5.asm | narfman0/smb3_pp1 | 0 | 9148 | <gh_stars>0
.byte $01 ; Unknown purpose
.byte OBJ_BONUSCONTROLLER, $00, $1C
.byte OBJ_PARATROOPAGREENHOP, $12, $15
.byte OBJ_PARATROOPAGREENHOP, $17, $15
.byte OBJ_PARAGOOMBAWITHMICROS, $14, $17
.byte OBJ_PARATROOPAGREENHOP, $2D, $16
.byte OBJ_VENUSFIRETRAP_CEIL, $30, $11
.byte OBJ_VENUSFIRETRAP, $37, $17
.byte OBJ_PARAGOOMBAWITHMICROS, $4E, $17
.byte OBJ_FIRECHOMP, $52, $13
.byte OBJ_REDPIRANHA, $54, $17
.byte OBJ_VENUSFIRETRAP_CEIL, $69, $10
.byte OBJ_PARATROOPAGREENHOP, $70, $15
.byte OBJ_PARAGOOMBAWITHMICROS, $78, $17
.byte OBJ_ENDLEVELCARD, $98, $15
.byte $FF ; Terminator
|
libsrc/target/nc100/kmsetyellow.asm | jpoikela/z88dk | 640 | 4498 |
SECTION code_clib
PUBLIC kmsetyellow
PUBLIC _kmsetyellow
; fastcall
.kmsetyellow
._kmsetyellow
ld b, h
ld c, l
jp 0xb8d5
|
Sandbox/IndRec.agda | banacorn/numeral | 1 | 1172 | module Sandbox.IndRec where
-- Ornamental Algebras, Algebraic Ornaments, CONOR McBRIDE
-- https://personal.cis.strath.ac.uk/conor.mcbride/pub/OAAO/Ornament.pdf
-- A Finite Axiomtization of Inductive-Recursion definitions, <NAME>, <NAME>
-- http://www.cse.chalmers.se/~peterd/papers/Finite_IR.pdf
open import Data.Product using (_×_; Σ; _,_)
open import Data.Bool
open import Data.Unit
open import Data.Empty
open import Relation.Binary.PropositionalEquality
open ≡-Reasoning
data Desc : Set₁ where
arg : (A : Set) -- a bag of tags to choose constructors with
→ (A → Desc) -- given a tag, return the description of the constructor it corresponds to
→ Desc
rec : Desc → Desc -- recursive subnode
ret : Desc -- stop
-- the "decoder", "interpreter"
⟦_⟧ : Desc → Set → Set
⟦ arg A D ⟧ R = Σ A (λ a → ⟦ D a ⟧ R)
⟦ rec D ⟧ R = R × ⟦ D ⟧ R
⟦ ret ⟧ R = ⊤
-- "μ" in some other literature
data Data (D : Desc) : Set where
⟨_⟩ : ⟦ D ⟧ (Data D) → Data D -- or "in"
out : ∀ {D} → Data D → ⟦ D ⟧ (Data D)
out ⟨ x ⟩ = x
map : ∀ {A B} → (d : Desc) → (A → B) → ⟦ d ⟧ A → ⟦ d ⟧ B
map (arg A d) f (a , y) = a , (map (d a) f y)
map (rec desc) f (a , x) = (f a) , (map desc f x)
map (ret) f tt = tt
-- fold : ∀ {A} → (F : Desc) → (⟦ F ⟧ A → A) → Data F → A
-- fold F alg ⟨ x ⟩ = alg (map F (fold F alg) x)
-- mapFold F alg x = map F (fold F alg) x
-- fold F alg x = alg (mapFold F alg (out x))
-- mapFold F alg x = map F (λ y → alg (mapFold F alg (out y))) x
mapFold : ∀ {A} (F G : Desc) → (⟦ G ⟧ A → A) → ⟦ F ⟧ (Data G) → ⟦ F ⟧ A
mapFold (arg T decoder) G alg (t , cnstrctr) = t , (mapFold (decoder t) G alg cnstrctr)
mapFold (rec F) G alg (⟨ x ⟩ , xs) = alg (mapFold G G alg x) , mapFold F G alg xs
mapFold ret G alg x = tt
fold : ∀ {A} → (F : Desc) → (⟦ F ⟧ A → A) → Data F → A
fold F alg ⟨ x ⟩ = alg (mapFold F F alg x)
-- ℕ
ℕDesc : Desc
ℕDesc = arg Bool λ { false → ret
; true → rec ret }
ℕ : Set
ℕ = Data ℕDesc
zero : ℕ
zero = ⟨ (false , tt) ⟩
suc : ℕ → ℕ
suc n = ⟨ (true , (n , tt)) ⟩
-- induction principle on ℕ
indℕ : (P : ℕ → Set)
→ (P zero)
→ ((n : ℕ) → (P n) → (P (suc n)))
→ (x : ℕ)
→ P x
indℕ P base step ⟨ true , n-1 , _ ⟩ = step n-1 (indℕ P base step n-1)
indℕ P base step ⟨ false , _ ⟩ = base
_+_ : ℕ → ℕ → ℕ
x + y = indℕ (λ _ → ℕ) y (λ n x → suc x) x
-- Maybe
MaybeDesc : Set → Desc
MaybeDesc A = arg Bool (λ { false → ret ; true → arg A (λ x → ret) })
Maybe : Set → Set
Maybe A = Data (MaybeDesc A)
nothing : ∀ {A} → Maybe A
nothing = ⟨ (false , tt) ⟩
just : ∀ {A} → A → Maybe A
just a = ⟨ (true , (a , tt)) ⟩
mapMaybe : ∀ {A B} → (A → B) → Maybe A → Maybe B
mapMaybe f ⟨ true , a , tt ⟩ = ⟨ (true , ((f a) , tt)) ⟩
mapMaybe f ⟨ false , tt ⟩ = ⟨ false , tt ⟩
-- List
ListDesc : Set → Desc
ListDesc A = arg Bool (λ { false → ret ; true → arg A (λ _ → rec ret )})
List : Set → Set
List A = Data (ListDesc A)
nil : ∀ {A} → List A
nil = ⟨ (false , tt) ⟩
cons : ∀ {A} → A → List A → List A
cons x xs = ⟨ (true , (x , (xs , tt))) ⟩
foldList : ∀ {A B} (f : A → B → B) → B → List A → B
foldList {A} {B} f e xs = fold (ListDesc A) alg xs
where alg : ⟦ ListDesc A ⟧ B → B
alg (true , n , acc , tt) = f n acc
alg (false , tt) = e
|
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48_notsx.log_2_1009.asm | ljhsiun2/medusa | 9 | 28592 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r15
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x3100, %rsi
lea addresses_D_ht+0x11d00, %rdi
nop
nop
nop
and %r15, %r15
mov $80, %rcx
rep movsb
nop
sub $39180, %r13
lea addresses_D_ht+0x3d00, %rsi
lea addresses_WC_ht+0x7e00, %rdi
clflush (%rsi)
sub $32020, %rax
mov $121, %rcx
rep movsq
nop
xor %rax, %rax
lea addresses_UC_ht+0x1ac0, %rsi
lea addresses_UC_ht+0x1906c, %rdi
clflush (%rsi)
nop
nop
xor %r13, %r13
mov $88, %rcx
rep movsl
nop
nop
nop
nop
nop
xor %r13, %r13
lea addresses_WC_ht+0x1380, %rcx
nop
cmp %rdx, %rdx
movb $0x61, (%rcx)
nop
nop
nop
nop
nop
xor %rax, %rax
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r13
push %rbp
push %rbx
push %rdi
// Store
mov $0x4428480000000700, %rdi
nop
nop
nop
inc %rbp
movw $0x5152, (%rdi)
nop
nop
nop
nop
cmp %r13, %r13
// Store
lea addresses_RW+0x4500, %rbp
nop
nop
dec %r12
movb $0x51, (%rbp)
and %rbx, %rbx
// Store
lea addresses_D+0x3600, %rdi
nop
nop
nop
add $59541, %r11
mov $0x5152535455565758, %r13
movq %r13, %xmm7
vmovups %ymm7, (%rdi)
nop
nop
nop
nop
nop
sub $30825, %rbx
// Faulty Load
lea addresses_A+0x8d00, %rbp
nop
nop
nop
nop
sub %rdi, %rdi
mov (%rbp), %r12d
lea oracles, %r10
and $0xff, %r12
shlq $12, %r12
mov (%r10,%r12,1), %r12
pop %rdi
pop %rbx
pop %rbp
pop %r13
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_A', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_NC', 'congruent': 9}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_RW', 'congruent': 8}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D', 'congruent': 4}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_A', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 10, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}}
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'congruent': 2, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_UC_ht'}}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 1, 'type': 'addresses_WC_ht', 'congruent': 7}, 'OP': 'STOR'}
{'00': 2}
00 00
*/
|
Cats/Category/Op.agda | alessio-b-zak/cats | 0 | 9336 | <filename>Cats/Category/Op.agda
module Cats.Category.Op where
open import Relation.Binary using (Rel ; _Preserves₂_⟶_⟶_)
open import Relation.Binary.PropositionalEquality as ≡
open import Level
open import Cats.Category
open import Cats.Category.Cat using (Cat)
module _ {lo la l≈} (C : Category lo la l≈) where
infixr 9 _∘_
infixr 4 _≈_
private
module C = Category C
module ≈ = C.≈
Obj : Set lo
Obj = C.Obj
_⇒_ : Obj → Obj → Set la
A ⇒ B = B C.⇒ A
id : ∀ {A} → A ⇒ A
id = C.id
_∘_ : ∀ {A B C : Obj} → (B ⇒ C) → (A ⇒ B) → A ⇒ C
f ∘ g = g C.∘ f
_≈_ : ∀ {A B} → Rel (A ⇒ B) l≈
_≈_ = C._≈_
∘-resp : ∀ {A B C} → _∘_ {A} {B} {C} Preserves₂ _≈_ ⟶ _≈_ ⟶ _≈_
∘-resp {x = f} {g} {h} {i} f≈g h≈i = C.∘-resp h≈i f≈g
assoc : ∀ {A B C D} {f : C ⇒ D} {g : B ⇒ C} {h : A ⇒ B}
→ (f ∘ g) ∘ h ≈ f ∘ (g ∘ h)
assoc = C.unassoc
_ᵒᵖ : Category lo la l≈
_ᵒᵖ = record
{ Obj = Obj
; _⇒_ = _⇒_
; _≈_ = _≈_
; id = id
; _∘_ = λ f g → g C.∘ f
; equiv = C.equiv
; ∘-resp = ∘-resp
; id-r = C.id-l
; id-l = C.id-r
; assoc = assoc
}
module _ {lo la l≈ : Level} where
private module Cat = Category (Cat lo la l≈)
op-involution : {C : Category lo la l≈} → ((C ᵒᵖ) ᵒᵖ) Cat.≅ C
op-involution {C} = record
{ forth = record
{ fobj = λ x → x
; fmap = λ f → f
; fmap-resp = λ eq → eq
; fmap-id = C.≈.reflexive ≡.refl
; fmap-∘ = C.≈.reflexive ≡.refl
}
; back = record
{ fobj = λ x → x
; fmap = λ f → f
; fmap-resp = λ eq → eq
; fmap-id = C.≈.reflexive ≡.refl
; fmap-∘ = C.≈.reflexive ≡.refl
}
-- TODO This sort of natural iso comes up all the time. Can we abstract it
-- out?
; back-forth = record
{ iso = Coo.≅.refl
; forth-natural = C.≈.trans C.id-l (C.≈.sym C.id-r)
}
; forth-back = record
{ iso = C.≅.refl
; forth-natural = C.≈.trans C.id-l (C.≈.sym C.id-r)
}
}
where
module C = Category C
module Coo = Category ((C ᵒᵖ)ᵒᵖ)
module ≈ = C.≈
|
1A/S5/PIM/tps/pr1/mesure_temps.adb | MOUDDENEHamza/ENSEEIHT | 4 | 21260 | with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Calendar; use Ada.Calendar;
procedure Mesure_Temps is
N: Integer; -- un entier lu au clavier
Debut: Time; -- heure de début de l'opération
Fin: Time; -- heure de fin de l'opération
Delai : Duration; -- durée de l'opération
begin
-- récupérer l'heure (heure de début)
Debut := Clock;
-- réaliser l'opération
Put_Line ("Début");
Put ("Valeur : ");
Get (N);
Put_Line ("Fin");
-- récupérer l'heure (heure de fin)
Fin := Clock;
-- calculer la durée de l'opération
Delai := Fin - Debut;
-- Afficher la durée de opération
Put ("Durée :" & Duration'Image(Delai));
end Mesure_Temps;
|
programs/oeis/075/A075353.asm | neoneye/loda | 22 | 26512 | ; A075353: Initial term of n-th group in A075352.
; 1,2,3,5,7,10,13,17,21,26,31,37,43,49,56,63,71,79,88,97,107,117,128,139,151,163,175,188,201,215,229,244,259,275,291,308,325,343,361,380,399,418,438,458,479,500,522,544,567,590,614,638,663,688,714,740,767,794
mov $2,$0
add $2,1
mov $4,$0
lpb $2
mov $0,$4
sub $2,1
sub $0,$2
mov $5,$0
add $5,1
mov $6,0
mov $7,$0
lpb $5
mov $0,$7
mov $3,0
sub $5,1
sub $0,$5
add $3,$0
add $3,25
seq $3,263919 ; Triangle read by rows giving successive states of cellular automaton generated by "Rule 163" initiated with a single ON (black) cell.
add $6,$3
lpe
add $1,$6
lpe
mov $0,$1
|
libsrc/_DEVELOPMENT/adt/wa_stack/c/sdcc_iy/wa_stack_capacity.asm | meesokim/z88dk | 0 | 5016 |
; size_t wa_stack_capacity(wa_stack_t *s)
SECTION code_adt_wa_stack
PUBLIC _wa_stack_capacity
EXTERN _w_array_capacity
defc _wa_stack_capacity = _w_array_capacity
|
src/Quasigroup/Structures.agda | Akshobhya1234/agda-NonAssociativeAlgebra | 2 | 4597 | <filename>src/Quasigroup/Structures.agda
{-# OPTIONS --without-K --safe #-}
open import Relation.Binary using (Rel; Setoid; IsEquivalence)
module Quasigroup.Structures
{a ℓ} {A : Set a} -- The underlying set
(_≈_ : Rel A ℓ) -- The underlying equality relation
where
open import Algebra.Core
open import Level using (_⊔_)
open import Data.Product using (_,_; proj₁; proj₂)
open import Algebra.Definitions _≈_
open import Algebra.Structures _≈_
open import Quasigroup.Definitions _≈_
record IsPique (∙ \\ // : Op₂ A) (ε : A) : Set (a ⊔ ℓ) where
field
isQuasigroup : IsQuasigroup ∙ \\ //
idem : Idempotent ∙
open IsQuasigroup isQuasigroup public
|
Lab Assessment Submission/Lab 2/Lab2_1620070042.asm | soha221/CSE331L-Section-10-Fall20-NSU-1 | 0 | 163896 | <reponame>soha221/CSE331L-Section-10-Fall20-NSU-1
org 100h
K1 EQU 2
K2 EQU 1
K3 EQU 2
MOV AX,K1
ADD AX,K2
ADD AX,K3
MOV BX,AX
ret |
programs/oeis/011/A011891.asm | neoneye/loda | 22 | 160202 | ; A011891: a(n) = floor( n*(n-1)*(n-2)/9 ).
; 0,0,0,0,2,6,13,23,37,56,80,110,146,190,242,303,373,453,544,646,760,886,1026,1180,1349,1533,1733,1950,2184,2436,2706,2996,3306,3637,3989,4363,4760,5180,5624,6092,6586,7106,7653,8227,8829,9460,10120,10810,11530,12282,13066,13883,14733,15617,16536,17490,18480,19506,20570,21672,22813,23993,25213,26474,27776,29120,30506,31936,33410,34929,36493,38103,39760,41464,43216,45016,46866,48766,50717,52719,54773,56880,59040,61254,63522,65846,68226,70663,73157,75709,78320,80990,83720,86510,89362,92276,95253,98293,101397,104566
bin $0,3
mul $0,2
div $0,3
|
Transynther/x86/_processed/NC/_st_zr_sm_/i7-7700_9_0xca_notsx.log_21829_1870.asm | ljhsiun2/medusa | 9 | 168941 | .global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0xd123, %rax
nop
nop
nop
nop
nop
and $49221, %rdx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm2
movups %xmm2, (%rax)
nop
xor %r14, %r14
lea addresses_WC_ht+0x1c8a3, %r15
nop
sub %rcx, %rcx
mov (%r15), %r9w
nop
sub $39599, %r15
lea addresses_normal_ht+0x15523, %rax
nop
nop
nop
nop
nop
cmp $46007, %rdx
mov (%rax), %r14
nop
nop
nop
nop
nop
add $59787, %r14
lea addresses_A_ht+0xe319, %rcx
nop
nop
nop
nop
nop
xor $4567, %rax
movl $0x61626364, (%rcx)
nop
inc %rcx
lea addresses_WT_ht+0xa523, %rsi
lea addresses_WT_ht+0x11123, %rdi
nop
nop
and %rdx, %rdx
mov $71, %rcx
rep movsl
nop
sub $46947, %r14
lea addresses_D_ht+0x46df, %rsi
lea addresses_WC_ht+0x197b3, %rdi
and %r9, %r9
mov $43, %rcx
rep movsw
nop
nop
nop
nop
nop
lfence
lea addresses_WT_ht+0xcd57, %rsi
nop
nop
add $50519, %r15
movb $0x61, (%rsi)
nop
nop
xor %rsi, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r15
push %r9
push %rcx
push %rdi
// Store
mov $0xfa3, %rdi
nop
nop
nop
nop
dec %r14
mov $0x5152535455565758, %rcx
movq %rcx, %xmm3
vmovups %ymm3, (%rdi)
nop
nop
nop
nop
nop
add %r9, %r9
// Store
lea addresses_D+0x15f23, %r15
nop
nop
cmp %r13, %r13
movw $0x5152, (%r15)
nop
nop
nop
and $64464, %r14
// Store
lea addresses_WC+0x18123, %r9
nop
add $48983, %r15
mov $0x5152535455565758, %rdi
movq %rdi, %xmm1
vmovntdq %ymm1, (%r9)
nop
nop
sub %r9, %r9
// Store
lea addresses_D+0xce75, %r15
nop
add $5432, %r14
movb $0x51, (%r15)
nop
nop
nop
nop
add $29499, %r15
// Store
lea addresses_WT+0x17b23, %r13
nop
nop
and $63292, %r15
movw $0x5152, (%r13)
nop
nop
nop
nop
nop
xor %r11, %r11
// Store
mov $0x68c98400000008df, %r13
nop
nop
nop
nop
xor %r11, %r11
mov $0x5152535455565758, %r15
movq %r15, (%r13)
cmp %r11, %r11
// Store
mov $0x6e3cda0000000923, %r14
nop
nop
nop
xor %r9, %r9
mov $0x5152535455565758, %r15
movq %r15, %xmm4
movups %xmm4, (%r14)
nop
nop
nop
nop
and %rdi, %rdi
// Faulty Load
mov $0x6e3cda0000000923, %rdi
nop
add %r11, %r11
movb (%rdi), %r14b
lea oracles, %r13
and $0xff, %r14
shlq $12, %r14
mov (%r13,%r14,1), %r14
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 7, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 9, 'same': False, 'type': 'addresses_WT'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 2, 'same': False, 'type': 'addresses_NC'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_NC'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': True, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 1, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 0, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 2, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'00': 237, '58': 21592}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 00 58 58 58 58 58 58 58 58 58 00 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1481.asm | ljhsiun2/medusa | 9 | 170675 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_1481.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r15
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x16129, %rsi
nop
nop
nop
nop
inc %rdx
movw $0x6162, (%rsi)
nop
nop
nop
nop
cmp %r9, %r9
lea addresses_normal_ht+0x1acb9, %rsi
lea addresses_normal_ht+0x57ad, %rdi
nop
nop
nop
nop
nop
sub $48811, %rbp
mov $114, %rcx
rep movsl
nop
nop
nop
nop
and %rbp, %rbp
lea addresses_A_ht+0x141d9, %rsi
lea addresses_WC_ht+0x11ec9, %rdi
clflush (%rdi)
nop
mfence
mov $79, %rcx
rep movsl
nop
nop
add %rsi, %rsi
lea addresses_WT_ht+0xb059, %r11
nop
nop
xor $65048, %rdi
movb (%r11), %r9b
sub %r11, %r11
lea addresses_D_ht+0x90d9, %r11
clflush (%r11)
nop
sub $37708, %rdx
mov (%r11), %cx
nop
nop
nop
nop
dec %r11
lea addresses_normal_ht+0x543a, %rsi
lea addresses_A_ht+0x11561, %rdi
nop
nop
nop
nop
add $61387, %r11
mov $46, %rcx
rep movsb
nop
nop
nop
nop
cmp $35564, %r15
lea addresses_D_ht+0x1583b, %r9
clflush (%r9)
nop
nop
nop
nop
and $13553, %rsi
mov $0x6162636465666768, %rbp
movq %rbp, %xmm4
vmovups %ymm4, (%r9)
nop
cmp $57997, %r15
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r15
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r15
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
// REPMOV
lea addresses_UC+0x54d9, %rsi
lea addresses_A+0x9633, %rdi
nop
nop
nop
nop
xor %r9, %r9
mov $17, %rcx
rep movsl
nop
xor %rdi, %rdi
// Store
lea addresses_WT+0x1b359, %rdi
nop
nop
nop
nop
and %r11, %r11
mov $0x5152535455565758, %rdx
movq %rdx, (%rdi)
nop
nop
nop
add %rdx, %rdx
// Faulty Load
lea addresses_UC+0xfed9, %r11
nop
nop
nop
cmp $55296, %r15
mov (%r11), %r9
lea oracles, %rdx
and $0xff, %r9
shlq $12, %r9
mov (%rdx,%r9,1), %r9
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A', 'congruent': 0, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 8, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_UC_ht', 'same': True, 'size': 2, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 1, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
resources/example-backgrounds/obj-oam.asm | undisbeliever/snes-test-roms | 7 | 20341 | // OAM for the `obj-4bpp-tiles.png` sprite image
//
// Copyright (c) 2020, <NAME> <<EMAIL>>.
// Distributed under The MIT License: https://opensource.org/licenses/MIT
constant tileSize = 32
constant width = 4
constant height = 2
constant startX = (256 - (width * tileSize)) / 2
constant startY = (224 - (height * tileSize)) / 2
variable tile = 0
variable nextTileRow = 16
variable y = 0
while y < height {
variable x = 0
while x < width {
db startX + x * tileSize
db startY + y * tileSize
dw tile | 0x3000 // highest priority
tile = tile + tileSize / 8
if tile >= nextTileRow {
nextTileRow = nextTileRow + (tileSize / 8) * 16
tile = nextTileRow - 16
}
x = x + 1
}
y = y + 1
}
// vim: ft=bass-65816 ts=4 sw=4 et:
|
10.asm | AsadKhalil/Assembly_x86 | 0 | 178408 | <filename>10.asm
[org 0x0100]
jmp start
message: db 'hello_word'
printstr:
;parameters order of pushing
;x pos, ypos, attribute, message, length
push bp
mov bp, sp
;saving registers
push ax
push cx
push di
push si
push es
mov ax, 0xb800
mov es, ax ;point es to video base
mov al, 80 ;load al with coloumns per row
mul byte [bp + 10] ;multiplying with ypos
add ax, [bp + 12] ;adding x pos
shl ax, 1 ;turn into byte offset by multiplying by 2
mov di, ax ;moving ax to di to point di to the required location
mov si, [bp + 6] ;pointing si to the parameter string
mov cx, [bp + 4] ;moving parameter length into cx
mov ah, [bp + 8] ;moving parameter attribute into ah
keepprintstr:
mov al, [si] ;moving current char of string into al
;a char is the size of a byte
mov [es:di], ax ;moving the char(al) with the attribute(ah) in video memory
add di, 2 ;moving di to the next location in the video memory
add si, 1 ;moving si to the next char
loop keepprintstr ;repeat the loop cx times
pop es
pop si
pop di
pop cx
pop ax
pop bp
;there are 5 parameters so ret 10
ret 10
printnum:
;parameters order of pushing
;x pos, ypos, attribute, number, base
push bp
mov bp, sp
push ax
push bx
push cx
push dx
push di
push es
mov ax, 0xb800
mov es, ax ;pointing es to video base
mov ax, [bp + 6] ;loading number in ax
mov bx, [bp + 4] ;moving base in bx for division
mov cx, 0 ;intialize count of digits
nextdigit:
mov dx, 0 ;zero upper half of dividend
div bx ;divide by bx
add dl, 0x30 ;convert digit into ASCII value
push dx ;save ASCII value on stack
inc cx ;incrememnt count of values
cmp ax, 0 ;is the quotient zero
jnz nextdigit ;if no divide it again
mov ax, 0xb800
mov es, ax ;pointing es to video base
mov al, 80 ;load al with coloumns per row
mul byte [bp+ 10] ;multiplying with ypos
add ax, [bp + 12] ;adding xpos
shl ax, 1 ;turn into byte offset by multiplying by 2
mov di, ax ;moving ax to di to point di to the required location
keepprintnum:
pop dx
mov dh, [bp + 8]
mov [es:di], dx
add di, 2
loop keepprintnum
pop es
pop di
pop dx
pop cx
pop bx
pop ax
pop bp
ret 10
start:
mov ax, 40 ;xpos
push ax
mov ax, 12 ;ypos
push ax
mov ax, 0x07 ;attribute
push ax
mov ax, message ;string/number
push ax
mov ax, 10 ;size/base
push ax
call printstr
finish:
mov ax, 0x04c00
int 21h |
utils/glutils.ads | Lucretia/old_nehe_ada95 | 0 | 11836 | <reponame>Lucretia/old_nehe_ada95<gh_stars>0
---------------------------------------------------------------------------------
-- Copyright 2004-2005 © <NAME>
--
-- This code is to be used for tutorial purposes only.
-- You may not redistribute this code in any form without my express permission.
---------------------------------------------------------------------------------
package GLUtils is
function GL_Vendor return String;
function GL_Version return String;
function GL_Renderer return String;
function GL_Extensions return String;
function GLU_Version return String;
function GLU_Extensions return String;
function IsExtensionAvailable(ExtensionToFind : in String) return Boolean;
generic
type ELEMENT is private;
function GetProc(Name : in String) return ELEMENT;
end GLUtils;
|
gcc-gcc-7_3_0-release/gcc/ada/a-cfinve.adb | best08618/asylo | 7 | 12916 | <reponame>best08618/asylo
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.CONTAINERS.FORMAL_INDEFINITE_VECTORS --
-- --
-- B o d y --
-- --
-- Copyright (C) 2014-2015, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
------------------------------------------------------------------------------
package body Ada.Containers.Formal_Indefinite_Vectors with
SPARK_Mode => Off
is
function H (New_Item : Element_Type) return Holder renames To_Holder;
function E (Container : Holder) return Element_Type renames Get;
---------
-- "=" --
---------
function "=" (Left, Right : Vector) return Boolean is
(Left.V = Right.V);
------------
-- Append --
------------
procedure Append (Container : in out Vector; New_Item : Vector) is
begin
Append (Container.V, New_Item.V);
end Append;
procedure Append
(Container : in out Vector;
New_Item : Element_Type)
is
begin
Append (Container.V, H (New_Item));
end Append;
------------
-- Assign --
------------
procedure Assign (Target : in out Vector; Source : Vector) is
begin
Assign (Target.V, Source.V);
end Assign;
--------------
-- Capacity --
--------------
function Capacity (Container : Vector) return Capacity_Range is
(Capacity (Container.V));
-----------
-- Clear --
-----------
procedure Clear (Container : in out Vector) is
begin
Clear (Container.V);
end Clear;
--------------
-- Contains --
--------------
function Contains
(Container : Vector;
Item : Element_Type) return Boolean
is
(Contains (Container.V, H (Item)));
----------
-- Copy --
----------
function Copy
(Source : Vector;
Capacity : Capacity_Range := 0) return Vector
is
((if Capacity = 0 then Length (Source) else Capacity),
V => Copy (Source.V, Capacity));
---------------------
-- Current_To_Last --
---------------------
function Current_To_Last
(Container : Vector;
Current : Index_Type) return Vector is
begin
return (Length (Container), Current_To_Last (Container.V, Current));
end Current_To_Last;
-----------------
-- Delete_Last --
-----------------
procedure Delete_Last
(Container : in out Vector)
is
begin
Delete_Last (Container.V);
end Delete_Last;
-------------
-- Element --
-------------
function Element
(Container : Vector;
Index : Index_Type) return Element_Type is
(E (Element (Container.V, Index)));
----------------
-- Find_Index --
----------------
function Find_Index
(Container : Vector;
Item : Element_Type;
Index : Index_Type := Index_Type'First) return Extended_Index
is
(Find_Index (Container.V, H (Item), Index));
-------------------
-- First_Element --
-------------------
function First_Element (Container : Vector) return Element_Type is
(E (First_Element (Container.V)));
-----------------
-- First_Index --
-----------------
function First_Index (Container : Vector) return Index_Type is
(First_Index (Container.V));
-----------------------
-- First_To_Previous --
-----------------------
function First_To_Previous
(Container : Vector;
Current : Index_Type) return Vector is
begin
return (Length (Container), First_To_Previous (Container.V, Current));
end First_To_Previous;
---------------------
-- Generic_Sorting --
---------------------
package body Generic_Sorting with SPARK_Mode => Off is
function "<" (X, Y : Holder) return Boolean is (E (X) < E (Y));
package Def_Sorting is new Def.Generic_Sorting ("<");
use Def_Sorting;
---------------
-- Is_Sorted --
---------------
function Is_Sorted (Container : Vector) return Boolean is
(Is_Sorted (Container.V));
----------
-- Sort --
----------
procedure Sort (Container : in out Vector) is
begin
Sort (Container.V);
end Sort;
end Generic_Sorting;
-----------------
-- Has_Element --
-----------------
function Has_Element
(Container : Vector;
Position : Extended_Index) return Boolean
is
(Has_Element (Container.V, Position));
--------------
-- Is_Empty --
--------------
function Is_Empty (Container : Vector) return Boolean is
(Is_Empty (Container.V));
------------------
-- Last_Element --
------------------
function Last_Element (Container : Vector) return Element_Type is
(E (Last_Element (Container.V)));
----------------
-- Last_Index --
----------------
function Last_Index (Container : Vector) return Extended_Index is
(Last_Index (Container.V));
------------
-- Length --
------------
function Length (Container : Vector) return Capacity_Range is
(Length (Container.V));
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element
(Container : in out Vector;
Index : Index_Type;
New_Item : Element_Type)
is
begin
Replace_Element (Container.V, Index, H (New_Item));
end Replace_Element;
----------------------
-- Reserve_Capacity --
----------------------
procedure Reserve_Capacity
(Container : in out Vector;
Capacity : Capacity_Range)
is
begin
Reserve_Capacity (Container.V, Capacity);
end Reserve_Capacity;
----------------------
-- Reverse_Elements --
----------------------
procedure Reverse_Elements (Container : in out Vector) is
begin
Reverse_Elements (Container.V);
end Reverse_Elements;
------------------------
-- Reverse_Find_Index --
------------------------
function Reverse_Find_Index
(Container : Vector;
Item : Element_Type;
Index : Index_Type := Index_Type'Last) return Extended_Index
is
(Reverse_Find_Index (Container.V, H (Item), Index));
----------
-- Swap --
----------
procedure Swap (Container : in out Vector; I, J : Index_Type) is
begin
Swap (Container.V, I, J);
end Swap;
---------------
-- To_Vector --
---------------
function To_Vector
(New_Item : Element_Type;
Length : Capacity_Range) return Vector
is
begin
return (Length, To_Vector (H (New_Item), Length));
end To_Vector;
end Ada.Containers.Formal_Indefinite_Vectors;
|
Sources/Globe_3d/globe_3d-stars_sky.adb | ForYouEyesOnly/Space-Convoy | 1 | 23703 | with GLOBE_3D.Math;
pragma Elaborate_All (GLOBE_3D.Math);
with Ada.Numerics.Float_Random; use Ada.Numerics.Float_Random;
package body GLOBE_3D.Stars_sky is
Star_Colours : array (1 .. No_of_Stars) of GL.RGB_Color;
Star_Positions : array (1 .. No_of_Stars) of Point_3D; -- normalized position on sphere
procedure Display (Rotation : Matrix_33) is
use GLOBE_3D.Math;
begin
PushMatrix;
Set_GL_Matrix (Rotation);
Disable (TEXTURE_2D);
for i in 1 .. No_of_Stars loop
Color (Star_Colours (i));
GL_Begin (GL.POINTS);
Vertex (Star_Positions (i));
GL_End;
end loop;
PopMatrix;
end Display;
procedure Reset is
seed : Generator;
v : Vector_3D;
int : Real;
use REF, GLOBE_3D.Math;
function Amas return Real is -- expected tendencies : keep near or go far
r : Real;
begin
r := Real (Random (seed));
r := r * 2.0 - 1.0; -- r in - 1 .. 1
r := r ** 8; -- almost always ~0
r := Exp (r * 1.8) - 1.0;
return r;
end Amas;
begin
Reset (seed);
v := (far_side, 0.0, 0.0);
for i in 1 .. No_of_Stars loop
v := XYZ_rotation (Amas, Amas, Amas) * v;
Star_Positions (i) := v;
int := Real (Random (seed)) * 0.3;
Star_Colours (i) := (int + 0.15 * Real (Random (seed)),
int + 0.12 * Real (Random (seed)),
int + 0.12 * Real (Random (seed)));
end loop;
end Reset;
begin
Reset;
end GLOBE_3D.Stars_sky;
|
Lista2/Lista2/Parte2/Programa20.asm | GustavoLR548/ACII-GLR | 1 | 246620 | .data
x: .word 10 # Declarando "x" como 10
y: .word 15 # Declarando "y" como 15
k: .word -1 # Declarando "k" como -1
.text
ori $t0,$zero,0x1001 # t0 = 1000
sll $t0,$t0,16 # t0 = 10000000
lw $s0, 0($t0) # s0 = x = 10
lw $s1, 4($t0) # s1 = y = 15
mult $s0,$s1 # Multiplicar o conteudo em s0 com s1
mflo $s2 # Carregar o conteudo em LO em s2
#Salvando o valor de k na mémoria
sw $s2,8($t0)
|
programs/oeis/301/A301727.asm | neoneye/loda | 22 | 173283 | ; A301727: Partial sums of A301726.
; 1,6,17,33,54,81,114,152,195,244,298,357,422,492,567,648,735,827,924,1027,1135,1248,1367,1491,1620,1755,1896,2042,2193,2350,2512,2679,2852,3030,3213,3402,3597,3797,4002,4213,4429,4650,4877,5109,5346,5589,5838,6092,6351,6616,6886,7161,7442,7728,8019,8316,8619,8927
lpb $0
mov $2,$0
sub $0,1
seq $2,301726 ; Coordination sequence for node of type V2 in "kra" 2-D tiling (or net).
add $1,$2
lpe
add $1,1
mov $0,$1
|
programs/oeis/304/A304611.asm | karttu/loda | 1 | 96008 | <gh_stars>1-10
; A304611: a(n) = 155*n - 38.
; 117,272,427,582,737,892,1047,1202,1357,1512,1667,1822,1977,2132,2287,2442,2597,2752,2907,3062,3217,3372,3527,3682,3837,3992,4147,4302,4457,4612,4767,4922,5077,5232,5387,5542,5697,5852,6007,6162,6317,6472,6627,6782,6937,7092,7247,7402,7557,7712,7867,8022,8177,8332,8487,8642,8797,8952,9107,9262,9417,9572,9727,9882,10037,10192,10347,10502,10657,10812,10967,11122,11277,11432,11587,11742,11897,12052,12207,12362,12517,12672,12827,12982,13137,13292,13447,13602,13757,13912,14067,14222,14377,14532,14687,14842,14997,15152,15307,15462,15617,15772,15927,16082,16237,16392,16547,16702,16857,17012,17167,17322,17477,17632,17787,17942,18097,18252,18407,18562,18717,18872,19027,19182,19337,19492,19647,19802,19957,20112,20267,20422,20577,20732,20887,21042,21197,21352,21507,21662,21817,21972,22127,22282,22437,22592,22747,22902,23057,23212,23367,23522,23677,23832,23987,24142,24297,24452,24607,24762,24917,25072,25227,25382,25537,25692,25847,26002,26157,26312,26467,26622,26777,26932,27087,27242,27397,27552,27707,27862,28017,28172,28327,28482,28637,28792,28947,29102,29257,29412,29567,29722,29877,30032,30187,30342,30497,30652,30807,30962,31117,31272,31427,31582,31737,31892,32047,32202,32357,32512,32667,32822,32977,33132,33287,33442,33597,33752,33907,34062,34217,34372,34527,34682,34837,34992,35147,35302,35457,35612,35767,35922,36077,36232,36387,36542,36697,36852,37007,37162,37317,37472,37627,37782,37937,38092,38247,38402,38557,38712
mov $1,$0
mul $1,155
add $1,117
|
platforms/macos/dmg/support/template.applescript | markusb/qlcplus | 158 | 1264 | <reponame>markusb/qlcplus
on run -- for testing in script editor
process_disk_image("Adium X 1.0b20", "/Users/evands/adium-1.0/Release/Artwork")
end run
on process_disk_image(volumeName)
tell application "Finder"
tell disk (volumeName as string)
open
set theXOrigin to WINX
set theYOrigin to WINY
set theWidth to WINW
set theHeight to WINH
set theBottomRightX to (theXOrigin + theWidth)
set theBottomRightY to (theYOrigin + theHeight)
set dsStore to "\"" & "/Volumes/" & volumeName & "/" & ".DS_STORE\""
-- do shell script "rm " & dsStore
tell container window
set current view to icon view
set toolbar visible to false
set statusbar visible to false
set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY}
set statusbar visible to false
end tell
set opts to the icon view options of container window
tell opts
set icon size to ICON_SIZE
set arrangement to not arranged
end tell
-- set background picture of opts to file ".background:background.png"
BACKGROUND_CLAUSE
-- Positioning
POSITION_CLAUSE
-- set position of item "Adium.app" to {196, 273}
-- Custom icons
-- my copyIconOfTo(artPath & "/ApplicationsIcon", "/Volumes/" & volumeName & "/Applications")
-- Label colors
-- set label index of item "Adium.app" to 6
-- set label index of item "License.txt" to 7
-- set label index of item "Changes.txt" to 7
-- set label index of item "Applications" to 4
update without registering applications
-- Force saving of the size
delay 1
tell container window
set statusbar visible to false
set the bounds to {theXOrigin, theYOrigin, theBottomRightX - 10, theBottomRightY - 10}
end tell
update without registering applications
end tell
delay 1
tell disk (volumeName as string)
tell container window
set statusbar visible to false
set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY}
end tell
update without registering applications
end tell
--give the finder some time to write the .DS_Store file
delay 3
set waitTime to 0
set ejectMe to false
repeat while ejectMe is false
delay 1
set waitTime to waitTime + 1
if (do shell script "[ -f " & dsStore & " ]; echo $?") = "0" then set ejectMe to true
end repeat
log "waited " & waitTime & " seconds for .DS_STORE to be created."
end tell
end process_disk_image
on copyIconOfTo(aFileOrFolderWithIcon, aFileOrFolder)
tell application "Finder" to set f to POSIX file aFileOrFolderWithIcon as alias
-- grab the file's icon
my CopyOrPaste(f, "c")
-- now the icon is in the clipboard
tell application "Finder" to set c to POSIX file aFileOrFolder as alias
my CopyOrPaste(result, "v")
end copyIconOfTo
on CopyOrPaste(i, cv)
tell application "Finder"
activate
open information window of i
end tell
tell application "System Events" to tell process "Finder" to tell window 1
keystroke tab -- select icon button
keystroke (cv & "w") using command down (* (copy or paste) + close window *)
end tell -- window 1 then process Finder then System Events
end CopyOrPaste |
oeis/130/A130869.asm | neoneye/loda-programs | 11 | 28161 | <gh_stars>10-100
; A130869: Partial sums of A130752.
; Submitted by <NAME>
; 2,7,16,32,63,126,254,511,1024,2048,4095,8190,16382,32767,65536,131072,262143,524286,1048574,2097151,4194304,8388608,16777215,33554430,67108862,134217727,268435456,536870912,1073741823,2147483646
add $0,2
seq $0,281166 ; a(n) = 3*a(n-1) - 3*a(n-2) + 2*a(n-3) for n>2, a(0)=a(1)=1, a(2)=3.
sub $0,1
|
src/Native/Runtime/arm64/AllocFast.asm | guptay1/corert | 0 | 94026 | <filename>src/Native/Runtime/arm64/AllocFast.asm
;; Licensed to the .NET Foundation under one or more agreements.
;; The .NET Foundation licenses this file to you under the MIT license.
#include "AsmMacros.h"
TEXTAREA
;; Allocate non-array, non-finalizable object. If the allocation doesn't fit into the current thread's
;; allocation context then automatically fallback to the slow allocation path.
;; x0 == EEType
LEAF_ENTRY RhpNewFast
;; x1 = GetThread(), TRASHES x2
INLINE_GETTHREAD x1, x2
;;
;; x0 contains EEType pointer
;;
ldr w2, [x0, #OFFSETOF__EEType__m_uBaseSize]
;;
;; x0: EEType pointer
;; x1: Thread pointer
;; x2: base size
;;
;; Load potential new object address into x12.
ldr x12, [x1, #OFFSETOF__Thread__m_alloc_context__alloc_ptr]
;; Determine whether the end of the object would lie outside of the current allocation context. If so,
;; we abandon the attempt to allocate the object directly and fall back to the slow helper.
add x2, x2, x12
ldr x13, [x1, #OFFSETOF__Thread__m_alloc_context__alloc_limit]
cmp x2, x13
bhi RhpNewFast_RarePath
;; Update the alloc pointer to account for the allocation.
str x2, [x1, #OFFSETOF__Thread__m_alloc_context__alloc_ptr]
;; Set the new object's EEType pointer
str x0, [x12, #OFFSETOF__Object__m_pEEType]
mov x0, x12
ret
RhpNewFast_RarePath
mov x1, #0
b RhpNewObject
LEAF_END RhpNewFast
INLINE_GETTHREAD_CONSTANT_POOL
;; Allocate non-array object with finalizer.
;; x0 == EEType
LEAF_ENTRY RhpNewFinalizable
mov x1, #GC_ALLOC_FINALIZE
b RhpNewObject
LEAF_END RhpNewFinalizable
;; Allocate non-array object.
;; x0 == EEType
;; x1 == alloc flags
NESTED_ENTRY RhpNewObject
PUSH_COOP_PINVOKE_FRAME x3
;; x3: transition frame
;; Preserve the EEType in x19
mov x19, x0
ldr w2, [x0, #OFFSETOF__EEType__m_uBaseSize]
;; Call the rest of the allocation helper.
;; void* RhpGcAlloc(EEType *pEEType, UInt32 uFlags, UIntNative cbSize, void * pTransitionFrame)
bl RhpGcAlloc
;; Set the new object's EEType pointer on success.
cbz x0, NewOutOfMemory
str x19, [x0, #OFFSETOF__Object__m_pEEType]
;; If the object is bigger than RH_LARGE_OBJECT_SIZE, we must publish it to the BGC
ldr w1, [x19, #OFFSETOF__EEType__m_uBaseSize]
movz x2, #(RH_LARGE_OBJECT_SIZE & 0xFFFF)
movk x2, #(RH_LARGE_OBJECT_SIZE >> 16), lsl #16
cmp x1, x2
blo New_SkipPublish
;; x0: object
;; x1: already contains object size
bl RhpPublishObject ;; x0: this function returns the object that was passed-in
New_SkipPublish
POP_COOP_PINVOKE_FRAME
EPILOG_RETURN
NewOutOfMemory
;; This is the OOM failure path. We're going to tail-call to a managed helper that will throw
;; an out of memory exception that the caller of this allocator understands.
mov x0, x19 ; EEType pointer
mov x1, 0 ; Indicate that we should throw OOM.
POP_COOP_PINVOKE_FRAME
EPILOG_NOP b RhExceptionHandling_FailedAllocation
NESTED_END RhpNewObject
;; Allocate a string.
;; x0 == EEType
;; x1 == element/character count
LEAF_ENTRY RhNewString
;; Make sure computing the overall allocation size won't overflow
;; TODO: this should be actually MAX_STRING_LENGTH
mov x2, 0x7FFFFFFF
cmp x1, x2
bhi StringSizeOverflow
;; Compute overall allocation size (align(base size + (element size * elements), 8)).
mov w2, #STRING_COMPONENT_SIZE
mov x3, #(STRING_BASE_SIZE + 7)
umaddl x2, w1, w2, x3 ; x2 = w1 * w2 + x3
and x2, x2, #-8
; x0 == EEType
; x1 == element count
; x2 == string size
INLINE_GETTHREAD x3, x5
;; Load potential new object address into x12.
ldr x12, [x3, #OFFSETOF__Thread__m_alloc_context__alloc_ptr]
;; Determine whether the end of the object would lie outside of the current allocation context. If so,
;; we abandon the attempt to allocate the object directly and fall back to the slow helper.
add x2, x2, x12
ldr x12, [x3, #OFFSETOF__Thread__m_alloc_context__alloc_limit]
cmp x2, x12
bhi RhpNewArrayRare
;; Reload new object address into r12.
ldr x12, [x3, #OFFSETOF__Thread__m_alloc_context__alloc_ptr]
;; Update the alloc pointer to account for the allocation.
str x2, [x3, #OFFSETOF__Thread__m_alloc_context__alloc_ptr]
;; Set the new object's EEType pointer and element count.
str x0, [x12, #OFFSETOF__Object__m_pEEType]
str x1, [x12, #OFFSETOF__Array__m_Length]
;; Return the object allocated in x0.
mov x0, x12
ret
StringSizeOverflow
; We get here if the length of the final string object can't be represented as an unsigned
; 32-bit value. We're going to tail-call to a managed helper that will throw
; an OOM exception that the caller of this allocator understands.
; x0 holds EEType pointer already
mov x1, #1 ; Indicate that we should throw OverflowException
b RhExceptionHandling_FailedAllocation
LEAF_END RhNewString
INLINE_GETTHREAD_CONSTANT_POOL
;; Allocate one dimensional, zero based array (SZARRAY).
;; x0 == EEType
;; x1 == element count
LEAF_ENTRY RhpNewArray
;; We want to limit the element count to the non-negative 32-bit int range.
;; If the element count is <= 0x7FFFFFFF, no overflow is possible because the component
;; size is <= 0xffff (it's an unsigned 16-bit value), and the base size for the worst
;; case (32 dimensional MdArray) is less than 0xffff, and thus the product fits in 64 bits.
mov x2, #0x7FFFFFFF
cmp x1, x2
bhi ArraySizeOverflow
ldrh w2, [x0, #OFFSETOF__EEType__m_usComponentSize]
umull x2, w1, w2
ldr w3, [x0, #OFFSETOF__EEType__m_uBaseSize]
add x2, x2, x3
add x2, x2, #7
and x2, x2, #-8
; x0 == EEType
; x1 == element count
; x2 == array size
INLINE_GETTHREAD x3, x5
;; Load potential new object address into x12.
ldr x12, [x3, #OFFSETOF__Thread__m_alloc_context__alloc_ptr]
;; Determine whether the end of the object would lie outside of the current allocation context. If so,
;; we abandon the attempt to allocate the object directly and fall back to the slow helper.
add x2, x2, x12
ldr x12, [x3, #OFFSETOF__Thread__m_alloc_context__alloc_limit]
cmp x2, x12
bhi RhpNewArrayRare
;; Reload new object address into x12.
ldr x12, [x3, #OFFSETOF__Thread__m_alloc_context__alloc_ptr]
;; Update the alloc pointer to account for the allocation.
str x2, [x3, #OFFSETOF__Thread__m_alloc_context__alloc_ptr]
;; Set the new object's EEType pointer and element count.
str x0, [x12, #OFFSETOF__Object__m_pEEType]
str x1, [x12, #OFFSETOF__Array__m_Length]
;; Return the object allocated in r0.
mov x0, x12
ret
ArraySizeOverflow
; We get here if the size of the final array object can't be represented as an unsigned
; 32-bit value. We're going to tail-call to a managed helper that will throw
; an overflow exception that the caller of this allocator understands.
; x0 holds EEType pointer already
mov x1, #1 ; Indicate that we should throw OverflowException
b RhExceptionHandling_FailedAllocation
LEAF_END RhpNewArray
INLINE_GETTHREAD_CONSTANT_POOL
;; Allocate one dimensional, zero based array (SZARRAY) using the slow path that calls a runtime helper.
;; x0 == EEType
;; x1 == element count
;; x2 == array size + Thread::m_alloc_context::alloc_ptr
;; x3 == Thread
NESTED_ENTRY RhpNewArrayRare
; Recover array size by subtracting the alloc_ptr from x2.
PROLOG_NOP ldr x12, [x3, #OFFSETOF__Thread__m_alloc_context__alloc_ptr]
PROLOG_NOP sub x2, x2, x12
PUSH_COOP_PINVOKE_FRAME x3
; Preserve data we'll need later into the callee saved registers
mov x19, x0 ; Preserve EEType
mov x20, x1 ; Preserve element count
mov x21, x2 ; Preserve array size
mov x1, #0
;; void* RhpGcAlloc(EEType *pEEType, UInt32 uFlags, UIntNative cbSize, void * pTransitionFrame)
bl RhpGcAlloc
; Set the new object's EEType pointer and length on success.
cbz x0, ArrayOutOfMemory
; Success, set the array's type and element count in the new object.
str x19, [x0, #OFFSETOF__Object__m_pEEType]
str x20, [x0, #OFFSETOF__Array__m_Length]
;; If the object is bigger than RH_LARGE_OBJECT_SIZE, we must publish it to the BGC
movz x2, #(RH_LARGE_OBJECT_SIZE & 0xFFFF)
movk x2, #(RH_LARGE_OBJECT_SIZE >> 16), lsl #16
cmp x21, x2
blo NewArray_SkipPublish
;; x0 = newly allocated array. x1 = size
mov x1, x21
bl RhpPublishObject
NewArray_SkipPublish
POP_COOP_PINVOKE_FRAME
EPILOG_RETURN
ArrayOutOfMemory
;; This is the OOM failure path. We're going to tail-call to a managed helper that will throw
;; an out of memory exception that the caller of this allocator understands.
mov x0, x19 ; EEType Pointer
mov x1, 0 ; Indicate that we should throw OOM.
POP_COOP_PINVOKE_FRAME
EPILOG_NOP b RhExceptionHandling_FailedAllocation
NESTED_END RhpNewArrayRare
END
|
oeis/267/A267848.asm | neoneye/loda-programs | 11 | 12061 | <gh_stars>10-100
; A267848: Triangle read by rows giving successive states of cellular automaton generated by "Rule 229" initiated with a single ON (black) cell.
; Submitted by <NAME>
; 1,0,1,0,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0
mov $1,3
lpb $0
sub $1,$0
trn $1,$0
add $1,$0
sub $0,1
trn $0,$2
add $2,2
lpe
mov $0,$1
mod $0,2
|
dimension/devtool/u3fsdb/guest/dummy.asm | ekscrypto/Unununium | 7 | 27538 | <gh_stars>1-10
;; Dummy Guest FS cell
section .text
_mount:
stc
retn
;section .c_init
global __init_entry_point
__init_entry_point:
mov edx, __FS_TYPE_EXT2__
mov eax, _mount
externfunc vfs.register_fs_driver
retn
|
project/testRoms/apu/test_apu_sweep/sweep_sub.asm | zzqqqzzz/WebNES | 75 | 163113 |
; NES APU Sweep Subtract Test
; Tests NES APU sweep subtract mode. When run, a continuous note
; should play (with slight periodic clicks). Half way through it should
; lower very slightly in pitch (refer to sweep_sub.wav).
main:
sei
lda #250 ; wait for hardware
jsr delay_msec
lda #$c0 ; synchronize APU
sta $4017
lda #$01 ; enable square 1
sta $4015
lda #$bf ; square volume = 15
sta $4000
lda #0 ; final low byte of period = $ff
jsr run_test
lda #1 ; final low byte of period = $00
jsr run_test
lda #$00 ; silence
sta $4015
forever:
jmp forever
run_test:
sta 0
ldy #7
loop1:
lda table_l,y
clc
adc 0
sta $4002
lda table_h,y
sta $4003
tya
ora #$88
sta $4001
lda #$c0 ; clock sweep
sta $4017
lda 0
clc
adc #1
sta $4003
lda #$00 ; disable sweep
sta $4001
lda #200
jsr delay_msec
dey
bne loop1
rts
table_h: .byte 1, 4, 2, 2, 2, 2, 2, 2
table_l: .byte $ff,$00,$aa,$49,$22,$10,$08,$04
; Delay a milliseconds
; Preserved: x, y
delay_msec:
pha ; 3
lda #253 ; 2
sec ; 2
dmslp:
nop ; 2
adc #-2 ; 2
bne dmslp ; 3
; -1
pla ; 4
clc ; 2
adc #-1 ; 2
bne delay_msec ; 3
rts
irq:
nmi: rti
.org $fffa
.word nmi
.word main
.word irq
|
specs/ada/common/tkmrpc-response-ike-tkm_limits-convert.ads | DrenfongWong/tkm-rpc | 0 | 29000 | with Ada.Unchecked_Conversion;
package Tkmrpc.Response.Ike.Tkm_Limits.Convert is
function To_Response is new Ada.Unchecked_Conversion (
Source => Tkm_Limits.Response_Type,
Target => Response.Data_Type);
function From_Response is new Ada.Unchecked_Conversion (
Source => Response.Data_Type,
Target => Tkm_Limits.Response_Type);
end Tkmrpc.Response.Ike.Tkm_Limits.Convert;
|
annis-service/src/main/antlr4/annis/ql/AqlParser.g4 | commul/ANNIS | 0 | 1819 | /*
* Copyright 2013 SFB 632.
*
* 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.
*/
parser grammar AqlParser;
options
{
language=Java;
tokenVocab=AqlLexer;
}
start
: exprTop EOF
;
textSpec
: START_TEXT_PLAIN END_TEXT_PLAIN # EmptyExactTextSpec
| START_TEXT_PLAIN content=TEXT_PLAIN END_TEXT_PLAIN # ExactTextSpec
| START_TEXT_REGEX END_TEXT_REGEX #EmptyRegexTextSpec
| START_TEXT_REGEX content=TEXT_REGEX END_TEXT_REGEX # RegexTextSpec
;
rangeSpec
: min=DIGITS (COMMA max=DIGITS)?
;
qName
: namespace=ID COLON name=ID
| name=ID
;
edgeAnno
: name=qName op=(EQ|NEQ) value=textSpec
;
edgeSpec
: BRACKET_OPEN edgeAnno+ BRACKET_CLOSE
;
refOrNode
: REF # ReferenceRef
| VAR_DEF? variableExpr # ReferenceNode
;
precedence
: (PRECEDENCE | NAMED_PRECEDENCE) # DirectPrecedence
| (PRECEDENCE | NAMED_PRECEDENCE) STAR # IndirectPrecedence
| (PRECEDENCE | NAMED_PRECEDENCE) COMMA? rangeSpec #RangePrecedence
;
near
: (NEAR | NAMED_NEAR) # DirectNear
| (NEAR | NAMED_NEAR) STAR # IndirectNear
| (NEAR | NAMED_NEAR)COMMA? rangeSpec #RangeNear
;
dominance
: (DOMINANCE | NAMED_DOMINANCE) (LEFT_CHILD | RIGHT_CHILD)? (anno=edgeSpec)? # DirectDominance
| (DOMINANCE | NAMED_DOMINANCE) STAR # IndirectDominance
| (DOMINANCE | NAMED_DOMINANCE) COMMA? rangeSpec # RangeDominance
;
pointing
: POINTING (anno=edgeSpec)? # DirectPointing
| POINTING (anno=edgeSpec)? STAR # IndirectPointing
| POINTING (anno=edgeSpec)? COMMA? rangeSpec # RangePointing
;
spanrelation
: IDENT_COV # IdenticalCoverage
| LEFT_ALIGN # LeftAlign
| RIGHT_ALIGN # RightAlign
| INCLUSION # Inclusion
| OVERLAP # Overlap
| RIGHT_OVERLAP # RightOverlap
| LEFT_OVERLAP # LeftOverlap
;
commonparent
: COMMON_PARENT (label=ID)?
;
commonancestor
: COMMON_PARENT (label=ID)? STAR
;
identity
: IDENTITY
;
equalvalue
: EQ_VAL
;
notequalvalue
: NEQ
;
operator
: precedence
| near
| spanrelation
| dominance
| pointing
| commonparent
| commonancestor
| identity
| equalvalue
| notequalvalue
;
n_ary_linguistic_term
: refOrNode (operator refOrNode)+ # Relation
;
unary_linguistic_term
: left=REF ROOT # RootTerm
| left=REF ARITY EQ rangeSpec # ArityTerm
| left=REF TOKEN_ARITY EQ rangeSpec # TokenArityTerm
;
variableExpr
: qName op=(EQ|NEQ) txt=textSpec # AnnoEqTextExpr
| TOK # TokOnlyExpr
| NODE # NodeExpr
| TOK op=(EQ|NEQ) txt=textSpec # TokTextExpr
| txt=textSpec # TextOnly // shortcut for tok="..."
| qName # AnnoOnlyExpr
;
expr
: VAR_DEF variableExpr # NamedVariableTermExpr
| variableExpr # VariableTermExpr
| unary_linguistic_term # UnaryTermExpr
| n_ary_linguistic_term # BinaryTermExpr
| META DOUBLECOLON id=qName op=(EQ|NEQ) txt=textSpec # MetaTermExpr
;
andTopExpr
: ((expr (AND expr)*) | (BRACE_OPEN expr (AND expr)* BRACE_CLOSE)) # AndExpr
;
exprTop
: andTopExpr (OR andTopExpr)* # OrTop
;
|
programs/oeis/085/A085524.asm | neoneye/loda | 22 | 168358 | ; A085524: a(0) = 0; a(n) = n^(2*n-1) for n > 0.
; 0,1,8,243,16384,1953125,362797056,96889010407,35184372088832,16677181699666569,10000000000000000000,7400249944258160101211,6624737266949237011120128,7056410014866816666030739693,8819763977946281130444984418304,12783403948858939111232757568359375
mov $1,$0
sub $1,2
sub $2,$0
sub $0,$2
trn $1,$2
pow $2,$1
mul $0,$2
div $0,2
|
oeis/054/A054100.asm | neoneye/loda-programs | 11 | 101503 | ; A054100: T(n,n), array T as in A054098.
; Submitted by <NAME>
; 1,2,2,4,10,34,144,748,4606,32874,266968,2431612,24554190,272289634,3289836256,43017800316,605289111694,9119314568458,146474344313976,2498617856687404
mov $1,1
mov $3,$0
lpb $3
add $1,$4
mul $2,-1
add $2,$1
div $1,2
mod $4,$2
add $4,2
mul $1,$4
sub $3,1
lpe
mov $0,$2
add $0,1
|
programs/oeis/025/A025784.asm | jmorken/loda | 1 | 21642 | <reponame>jmorken/loda<filename>programs/oeis/025/A025784.asm
; A025784: Expansion of 1/((1-x)(1-x^7)(1-x^8)).
; 1,1,1,1,1,1,1,2,3,3,3,3,3,3,4,5,6,6,6,6,6,7,8,9,10,10,10,10,11,12,13,14,15,15,15,16,17,18,19,20,21,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,37,38,39,40,41,42,43,45,47,48,49,50,51,52,54,56,58,59,60,61,62,64,66,68,70,71,72,73,75,77,79,81,83,84,85,87,89,91,93,95,97,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,129,131,133,135,137,139,141,144,147,149,151,153,155,157,160,163,166,168,170,172,174,177,180,183,186,188,190,192,195,198,201,204,207,209,211,214,217,220,223,226,229,231,234,237,240,243,246,249,252,255,258,261,264,267,270,273,277,280,283,286,289,292,295,299,303,306,309,312,315,318,322,326,330,333,336,339,342,346,350,354,358,361,364,367,371,375,379,383,387,390,393,397,401,405,409,413,417,420,424,428,432,436,440,444,448,452,456,460,464,468,472,476,481,485,489,493,497,501,505,510,515,519,523,527,531,535,540,545,550,554,558,562,566,571,576,581,586,590
mov $2,$0
lpb $0
trn $0,6
trn $1,$2
add $1,$0
sub $0,1
sub $2,4
trn $2,4
lpe
add $1,1
|
src/support_utils/support_utils-word_support_package.adb | spr93/whitakers-words | 3 | 1731 | <gh_stars>1-10
-- WORDS, a Latin dictionary, by <NAME> (USAF, Retired)
--
-- Copyright <NAME> (1936–2010)
--
-- This is a free program, which means it is proper to copy it and pass
-- it on to your friends. Consider it a developmental item for which
-- there is no charge. However, just for form, it is Copyrighted
-- (c). Permission is hereby freely given for any and all use of program
-- and data. You can sell it as your own, but at least tell me.
--
-- This version is distributed without obligation, but the developer
-- would appreciate comments and suggestions.
--
-- All parts of the WORDS system, source code and data files, are made freely
-- available to anyone who wishes to use them, for whatever purpose.
with Latin_Utils.Latin_File_Names; use Latin_Utils.Latin_File_Names;
with Latin_Utils.Strings_Package; use Latin_Utils.Strings_Package;
with Latin_Utils.Config;
with Latin_Utils.Preface;
use Latin_Utils;
package body Support_Utils.Word_Support_Package is
function Len (S : String) return Integer is
begin
return Trim (S)'Length;
end Len;
function Eff_Part (Part : Part_Of_Speech_Type) return Part_Of_Speech_Type is
begin
if Part = Vpar then
return V;
elsif Part = Supine then
return V;
else
return Part;
end if;
end Eff_Part;
function Adj_Comp_From_Key (Key : Stem_Key_Type) return Comparison_Type is
begin
case Key is
when 0 | 1 | 2 => return Pos;
when 3 => return Comp;
when 4 => return Super;
when others => return X;
end case;
end Adj_Comp_From_Key;
function Adv_Comp_From_Key (Key : Stem_Key_Type) return Comparison_Type is
begin
case Key is
when 1 => return Pos;
when 2 => return Comp;
when 3 => return Super;
when others => return X;
end case;
end Adv_Comp_From_Key;
function Num_Sort_From_Key (Key : Stem_Key_Type) return Numeral_Sort_Type is
begin
case Key is
when 1 => return Card;
when 2 => return Ord;
when 3 => return Dist;
when 4 => return Adverb;
when others => return X;
end case;
end Num_Sort_From_Key;
function First_Index
(Input_Word : String;
D_K : Dictionary_File_Kind := Default_Dictionary_File_Kind)
return Stem_Io.Count is
Wd : constant String := Trim (Input_Word); -- String may not start at 1
begin
if D_K = Local then
return Ddlf (Wd (Wd'First), 'a', D_K);
elsif Wd'Length < 2 then
return 0; -- BDLF (WD (WD'FIRST), ' ', D_K);
else
return Ddlf (Wd (Wd'First), Wd (Wd'First + 1), D_K);
end if;
end First_Index;
function Last_Index
(Input_Word : String;
D_K : Dictionary_File_Kind := Default_Dictionary_File_Kind)
return Stem_Io.Count is
Wd : constant String := Trim (Input_Word);
begin -- remember the String may not start at 1
if D_K = Local then
return Ddll (Wd (Wd'First), 'a', D_K);
elsif Wd'Length < 2 then
return 0; -- BDLL (WD (WD'FIRST), ' ', D_K);
else
return Ddll (Wd (Wd'First), Wd (Wd'First + 1), D_K);
end if;
end Last_Index;
procedure Load_Bdl_From_Disk is
use Stem_Io;
Ds : Dictionary_Stem;
Index_First,
Index_Last : Stem_Io.Count := 0;
K : Integer := 0;
begin
if Dictionary_Available (General) then
-- The blanks are on the GENERAL dictionary
Loading_Bdl_From_Disk :
declare
D_K : constant Dictionary_Kind := General;
begin
if not Is_Open (Stem_File (D_K)) then
Open (Stem_File (D_K), Stem_Io.In_File,
Add_File_Name_Extension (Stem_File_Name,
Dictionary_Kind'Image (D_K)));
end if;
Index_First := Bblf (' ', ' ', D_K);
Index_Last := Bbll (' ', ' ', D_K);
Set_Index (Stem_File (D_K), Stem_Io.Positive_Count (Index_First));
for J in Index_First .. Index_Last loop
Read (Stem_File (D_K), Ds);
K := K + 1;
Bdl (K) := Ds;
end loop;
Close (Stem_File (D_K));
exception
when Name_Error =>
Ada.Text_IO.Put_Line
("LOADING BDL FROM DISK had NAME_ERROR on " &
Add_File_Name_Extension (Stem_File_Name,
Dictionary_Kind'Image (D_K)));
Ada.Text_IO.Put_Line ("The will be no blank stems loaded");
when Use_Error =>
Ada.Text_IO.Put_Line ("LOADING BDL FROM DISK had USE_ERROR on " &
Add_File_Name_Extension (Stem_File_Name,
Dictionary_Kind'Image (D_K)));
Ada.Text_IO.Put_Line ("There will be no blank stems loaded");
end Loading_Bdl_From_Disk;
end if;
-- Now load the stems of just one letter
for D_K in General .. Dictionary_Kind'Last loop
if Dictionary_Available (D_K) then
exit when D_K = Local;
--TEXT_IO.PUT_LINE ("OPENING BDL STEMFILE " & EXT (D_K));
if not Is_Open (Stem_File (D_K)) then
--PUT_LINE ("LOADING_BDL is going to OPEN " &
--ADD_FILE_NAME_EXTENSION (STEM_FILE_NAME,
--DICTIONARY_KIND'IMAGE (D_K)));
Open (Stem_File (D_K), Stem_Io.In_File,
Add_File_Name_Extension (Stem_File_Name,
Dictionary_Kind'Image (D_K)));
--STEMFILE." & EXT (D_K));
--PUT_LINE ("OPENing was successful");
end if;
for I in Character range 'a' .. 'z' loop
Index_First := Bdlf (I, ' ', D_K);
Index_Last := Bdll (I, ' ', D_K);
if Index_First > 0 then
Set_Index (Stem_File (D_K),
Stem_Io.Positive_Count (Index_First));
for J in Index_First .. Index_Last loop
Read (Stem_File (D_K), Ds);
K := K + 1;
Bdl (K) := Ds;
end loop;
end if;
end loop;
Close (Stem_File (D_K));
end if;
end loop;
Bdl_Last := K;
--TEXT_IO.PUT ("FINISHED LOADING BDL FROM DISK BDL_LAST = ");
--TEXT_IO.PUT (INTEGER'IMAGE (BDL_LAST));
--TEXT_IO.NEW_LINE;
end Load_Bdl_From_Disk;
procedure Load_Indices_From_Indx_File (D_K : Dictionary_Kind) is
use Ada.Text_IO;
use Stem_Io;
use Count_Io;
Ch : String (1 .. 2);
M, N : Stem_Io.Count;
Number_Of_Blank_Stems,
Number_Of_Non_Blank_Stems : Stem_Io.Count := 0;
S : String (1 .. 100) := (others => ' ');
Last, L : Integer := 0;
begin
Open (Indx_File (D_K), Ada.Text_IO.In_File,
Add_File_Name_Extension (Indx_File_Name,
Dictionary_Kind'Image (D_K)));
--"INDXFILE." & EXT (D_K)); -- $$$$$$$$$$$$
Preface.Put (Dictionary_Kind'Image (D_K));
Preface.Put (" Dictionary loading");
if D_K = General then
Get_Line (Indx_File (D_K), S, Last);
Ch := S (1 .. 2);
Get (S (4 .. Last), M, L);
Bblf (Ch (1), Ch (2), D_K) := M;
Get (S (L + 1 .. Last), N, L);
Bbll (Ch (1), Ch (2), D_K) := N;
Number_Of_Blank_Stems := Stem_Io.Count'Max (Number_Of_Blank_Stems, N);
end if;
while not End_Of_File (Indx_File (D_K)) loop
Get_Line (Indx_File (D_K), S, Last);
exit when Last = 0;
Ch := S (1 .. 2);
Get (S (4 .. Last), M, L);
if Ch (2) = ' ' then
Bdlf (Ch (1), Ch (2), D_K) := M;
else
Ddlf (Ch (1), Ch (2), D_K) := M;
end if;
Get (S (L + 1 .. Last), N, L);
if Ch (2) = ' ' then
Bdll (Ch (1), Ch (2), D_K) := N;
Number_Of_Blank_Stems := Stem_Io.Count'Max
(Number_Of_Blank_Stems, N);
else
Ddll (Ch (1), Ch (2), D_K) := N;
Number_Of_Non_Blank_Stems := Stem_Io.Count'Max
(Number_Of_Non_Blank_Stems, N);
end if;
end loop;
Close (Indx_File (D_K));
Preface.Set_Col (33); Preface.Put ("-- ");
if not Config.Suppress_Preface then
Put (Number_Of_Non_Blank_Stems, 6);
end if; -- Kludge for when TEXT_IO.COUNT too small
Preface.Put (" stems");
Preface.Set_Col (55); Preface.Put_Line ("-- Loaded correctly");
end Load_Indices_From_Indx_File;
end Support_Utils.Word_Support_Package;
|
Categories/Object/Exponential.agda | copumpkin/categories | 98 | 17006 | <reponame>copumpkin/categories<filename>Categories/Object/Exponential.agda
{-# OPTIONS --universe-polymorphism #-}
open import Categories.Category
module Categories.Object.Exponential {o ℓ e} (C : Category o ℓ e) where
open Category C
open import Level
open import Categories.Square
import Categories.Object.Product
open Categories.Object.Product C
hiding (repack; repack≡id; repack∘; repack-cancel; up-to-iso; transport-by-iso)
import Categories.Object.Product.Morphisms
open Categories.Object.Product.Morphisms C
import Categories.Morphisms as Morphisms
record Exponential (A B : Obj) : Set (o ⊔ ℓ ⊔ e) where
field
B^A : Obj
product : Product B^A A
module product = Product product
B^A×A : Obj
B^A×A = product.A×B
field
eval : B^A×A ⇒ B
λg : {X : Obj} → (X×A : Product X A) → (Product.A×B X×A ⇒ B) → (X ⇒ B^A)
.β
: {X : Obj} → (X×A : Product X A)
→ {g : Product.A×B X×A ⇒ B}
→ (eval ∘ [ X×A ⇒ product ]first (λg X×A g) ≡ g)
.λ-unique
: {X : Obj} → (X×A : Product X A)
→ {g : Product.A×B X×A ⇒ B}
→ {h : X ⇒ B^A}
→ (eval ∘ [ X×A ⇒ product ]first h ≡ g)
→ (h ≡ λg X×A g)
.η
: ∀ {X : Obj} (X×A : Product X A)
{f : X ⇒ B^A }
→ λg X×A (eval ∘ [ X×A ⇒ product ]first f) ≡ f
η X×A {f} = sym (λ-unique X×A refl)
where open Equiv
.λ-cong
: {X : Obj}(X×A : Product X A)
→ ∀{f g}
→ (f ≡ g)
→ (λg X×A f ≡ λg X×A g)
λ-cong X×A {f}{g} f≡g = λ-unique X×A (trans (β X×A) f≡g)
where
open Equiv
.subst : ∀ {C D}
→ (p₂ : Product C A)
→ (p₃ : Product D A)
→ {f : Product.A×B p₃ ⇒ B}{g : C ⇒ D}
→ λg p₃ f ∘ g
≡ λg p₂ (f ∘ [ p₂ ⇒ p₃ ]first g)
subst {C}{D} p₂ p₃ {f}{g} = λ-unique p₂ subst-commutes
where
open HomReasoning
open Equiv
subst-commutes =
let p₁ = product in
begin
eval ∘ [ p₂ ⇒ p₁ ]first (λg p₃ f ∘ g)
↑⟨ refl ⟩∘⟨ [ p₂ ⇒ p₃ ⇒ p₁ ]first∘first ⟩
eval
∘ [ p₃ ⇒ p₁ ]first (λg p₃ f)
∘ [ p₂ ⇒ p₃ ]first g
↑⟨ assoc ⟩
(eval ∘ [ p₃ ⇒ p₁ ]first (λg p₃ f))
∘ [ p₂ ⇒ p₃ ]first g
↓⟨ β p₃ ⟩∘⟨ refl ⟩
f ∘ [ p₂ ⇒ p₃ ]first g
∎
.η-id : λg product eval ≡ id
η-id =
begin
λg product eval
↑⟨ identityʳ ⟩
λg product eval ∘ id
↓⟨ subst _ _ ⟩
λg product (eval ∘ [ product ⇒ product ]first id)
↓⟨ η product ⟩
id
∎
where
open Equiv
open HomReasoning
open Morphisms C
-- some aliases to make proof signatures less ugly
[_]eval : ∀{A B}(e₁ : Exponential A B) → Exponential.B^A×A e₁ ⇒ B
[ e₁ ]eval = Exponential.eval e₁
[_]λ : ∀{A B}(e₁ : Exponential A B)
→ {X : Obj} → (X×A : Product X A) → (Product.A×B X×A ⇒ B) → (X ⇒ Exponential.B^A e₁)
[ e₁ ]λ = Exponential.λg e₁
.λ-distrib : ∀ {A B C D}
→ (e₁ : Exponential C B)
→ (e₂ : Exponential A B)
→ (p₃ : Product D C)
→ (p₄ : Product D A)
→ (p₅ : Product (Exponential.B^A e₂) C)
→ {f : C ⇒ A}{g : Product.A×B p₄ ⇒ B}
→ [ e₁ ]λ p₃ (g ∘ [ p₃ ⇒ p₄ ]second f)
≡ [ e₁ ]λ p₅ ([ e₂ ]eval ∘ [ p₅ ⇒ Exponential.product e₂ ]second f)
∘ [ e₂ ]λ p₄ g
λ-distrib {A}{B}{C}{D} e₁ e₂ p₃ p₄ p₅ {f}{g} =
begin
[ e₁ ]λ p₃ (g ∘ [ p₃ ⇒ p₄ ]second f)
↑⟨ e₁.λ-cong p₃ eval∘second∘first ⟩
[ e₁ ]λ p₃ (([ e₂ ]eval ∘ [ p₅ ⇒ Exponential.product e₂ ]second f) ∘ [ p₃ ⇒ p₅ ]first ([ e₂ ]λ p₄ g))
↑⟨ e₁.subst p₃ p₅ ⟩
[ e₁ ]λ p₅ ([ e₂ ]eval ∘ [ p₅ ⇒ Exponential.product e₂ ]second f)
∘ [ e₂ ]λ p₄ g
∎
where
open HomReasoning
open Equiv
module e₁ = Exponential e₁
module e₂ = Exponential e₂
eval∘second∘first =
let p₁ = e₁.product in
let p₂ = e₂.product in
begin
([ e₂ ]eval ∘ [ p₅ ⇒ Exponential.product e₂ ]second f) ∘ [ p₃ ⇒ p₅ ]first ([ e₂ ]λ p₄ g)
↓⟨ assoc ⟩
[ e₂ ]eval
∘ [ p₅ ⇒ p₂ ]second f
∘ [ p₃ ⇒ p₅ ]first ([ e₂ ]λ p₄ g)
↑⟨ refl ⟩∘⟨ [ p₄ ⇒ p₂ , p₃ ⇒ p₅ ]first↔second ⟩
[ e₂ ]eval
∘ [ p₄ ⇒ p₂ ]first ([ e₂ ]λ p₄ g)
∘ [ p₃ ⇒ p₄ ]second f
↑⟨ assoc ⟩
([ e₂ ]eval ∘ [ p₄ ⇒ p₂ ]first ([ e₂ ]λ p₄ g))
∘ [ p₃ ⇒ p₄ ]second f
↓⟨ e₂.β p₄ ⟩∘⟨ refl ⟩
g ∘ [ p₃ ⇒ p₄ ]second f
∎
repack : ∀{A B} (e₁ e₂ : Exponential A B) → Exponential.B^A e₁ ⇒ Exponential.B^A e₂
repack e₁ e₂ = e₂.λg e₁.product e₁.eval
where
module e₁ = Exponential e₁
module e₂ = Exponential e₂
.repack≡id : ∀{A B} (e : Exponential A B) → repack e e ≡ id
repack≡id e = Exponential.η-id e
.repack∘ : ∀{A B} (e₁ e₂ e₃ : Exponential A B) → repack e₂ e₃ ∘ repack e₁ e₂ ≡ repack e₁ e₃
repack∘ {A} {B} e₁ e₂ e₃ =
let p₁ = product e₁ in
let p₂ = product e₂ in
begin
[ e₃ ]λ p₂ [ e₂ ]eval
∘ [ e₂ ]λ p₁ [ e₁ ]eval
↓⟨ λ-cong e₃ p₂ (introʳ (second-id p₂)) ⟩∘⟨ refl ⟩
[ e₃ ]λ p₂ ([ e₂ ]eval ∘ [ p₂ ⇒ p₂ ]second id)
∘ [ e₂ ]λ p₁ [ e₁ ]eval
↑⟨ λ-distrib e₃ e₂ p₁ p₁ p₂ ⟩
[ e₃ ]λ p₁ ([ e₁ ]eval ∘ [ p₁ ⇒ p₁ ]second id)
↑⟨ λ-cong e₃ p₁ (introʳ (second-id p₁)) ⟩
[ e₃ ]λ p₁ [ e₁ ]eval
∎
where
open Equiv
open Exponential
open HomReasoning
open GlueSquares C
.repack-cancel : ∀{A B} (e₁ e₂ : Exponential A B) → repack e₁ e₂ ∘ repack e₂ e₁ ≡ id
repack-cancel e₁ e₂ = Equiv.trans (repack∘ e₂ e₁ e₂) (repack≡id e₂)
up-to-iso : ∀{A B} (e₁ e₂ : Exponential A B) → Exponential.B^A e₁ ≅ Exponential.B^A e₂
up-to-iso e₁ e₂ = record
{ f = repack e₁ e₂
; g = repack e₂ e₁
; iso = record
{ isoˡ = repack-cancel e₂ e₁
; isoʳ = repack-cancel e₁ e₂
}
}
transport-by-iso : ∀{A B} (e : Exponential A B) → ∀ {X} → Exponential.B^A e ≅ X → Exponential A B
transport-by-iso e {X} e≅X = record
{ B^A = X
; product = X×A
; eval = e.eval
; λg = λ Y×A y → f ∘ e.λg Y×A y
; β = λ Y×A → let open HomReasoning in let open GlueSquares C in let open Equiv in begin
e.eval ∘ [ Y×A ⇒ X×A ]first (f ∘ e.λg Y×A _)
↓⟨ ∘-resp-≡ʳ (e.product.⟨⟩-cong₂ (pullˡ (cancelLeft isoˡ)) (pullˡ identityˡ)) ⟩
e.eval ∘ [ Y×A ⇒ e.product ]first (e.λg Y×A _)
↓⟨ (e.β Y×A) ⟩
_
∎
; λ-unique = λ Y×A y → let open GlueSquares C in
switch-gfˡ e≅X
(e.λ-unique Y×A
(Equiv.trans
(∘-resp-≡ʳ
(e.product.⟨⟩-cong₂
assoc
(Equiv.sym (pullˡ identityˡ))))
y)) -- look ma i can write lisp in agda --xplat
}
where
module e = Exponential e
X×A = Mobile e.product e≅X idⁱ
open _≅_ e≅X
|
Tejas-Simulator/PIN/pin-2.14/source/tools/ToolUnitTests/analysis_flag_overwrite_tool3_win.asm | markoshorro/tejas_knl | 17 | 1933 | PUBLIC WriteFlags_asm
.686
.model flat, c
.code
WriteFlags_asm PROC
mov eax, 0
add eax, eax
ret
WriteFlags_asm ENDP
end |
oeis/163/A163348.asm | neoneye/loda-programs | 11 | 14462 | ; A163348: a(n) = 6*a(n-1) - 7*a(n-2) for n > 1; a(0) = 1, a(1) = 7.
; Submitted by <NAME>
; 1,7,35,161,721,3199,14147,62489,275905,1218007,5376707,23734193,104768209,462469903,2041441955,9011362409,39778080769,175588947751,775087121123,3421400092481,15102790707025,66666943594783,294282126619523,1299024154553657,5734170040985281,25311851164036087,111731916697319555,493208542035664721,2177127835332751441,9610307217746855599,42421948459151873507,187259540230683251849,826603602170036396545,3648804831405435616327,16106603773242358922147,71097988819616104218593,313841706505000112856529
lpb $0
sub $0,1
mul $1,3
add $3,3
add $1,$3
add $2,$3
sub $2,1
mov $3,$1
add $3,$2
lpe
mov $0,$1
mul $0,2
add $0,1
|
ais-lib-communication/src/main/java/dk/dma/internal/ais/generated/parser/expressionfilter/ExpressionFilter.g4 | wojciechk/AisLib | 127 | 4569 | <gh_stars>100-1000
grammar ExpressionFilter;
filter: filterExpression EOF;
filterExpression:
//
// Tokens related to source
//
SRC_ID (in|notin) stringList # sourceIdIn
| SRC_BASESTATION compareTo INT # sourceBasestation
| SRC_BASESTATION (in|notin) (intRange|intList) # sourceBasestationIn
| SRC_COUNTRY (in|notin) stringList # sourceCountryIn
| SRC_TYPE (in|notin) stringList # sourceTypeIn
| SRC_REGION (in|notin) stringList # sourceRegionIn
//
// Tokens related to message contents
//
| MSG_MSGID compareTo INT # messageId
| MSG_MSGID (in|notin) (intRange|intList) # messageIdIn
| MSG_MMSI compareTo INT # messageMmsi
| MSG_MMSI (in|notin) (intRange|intList) # messageMmsiIn
| MSG_IMO compareTo INT # messageImo
| MSG_IMO (in|notin) (intRange|intList) # messageImoIn
| MSG_TYPE compareTo string # messageShiptype
| MSG_TYPE (in|notin) (intRange|intList|stringList) # messageShiptypeIn
| MSG_COUNTRY (in|notin) stringList # messageCountryIn
| MSG_NAVSTAT compareTo string # messageNavigationalStatus
| MSG_NAVSTAT (in|notin) (intRange|intList|stringList) # messageNavigationalStatusIn
| MSG_NAME (compareTo|LIKE) string # messageName
| MSG_NAME (in|notin) stringList # messageNameIn
| MSG_CALLSIGN (compareTo|LIKE) string # messageCallsign
| MSG_CALLSIGN (in|notin) stringList # messageCallsignIn
| MSG_SPEED compareTo number # messageSpeedOverGround
| MSG_SPEED (in|notin) numberRange # messageSpeedOverGroundIn
| MSG_COURSE compareTo number # messageCourseOverGround
| MSG_COURSE (in|notin) numberRange # messageCourseOverGroundIn
| MSG_HEADING compareTo INT # messageTrueHeading
| MSG_HEADING (in|notin) intRange # messageTrueHeadingIn
| MSG_DRAUGHT compareTo number # messageDraught
| MSG_DRAUGHT (in|notin) numberRange # messageDraughtIn
| MSG_LATITUDE compareTo number # messageLatitude
| MSG_LATITUDE (in|notin) numberRange # messageLatitudeIn
| MSG_LONGITUDE compareTo number # messageLongitude
| MSG_LONGITUDE (in|notin) numberRange # messageLongitudeIn
| MSG_POSITION WITHIN (circle|bbox) # messagePositionInside
| MSG_TIME_YEAR compareTo INT # messageTimeYear
| MSG_TIME_MONTH compareTo (INT|string) # messageTimeMonth
| MSG_TIME_DAY compareTo INT # messageTimeDay
| MSG_TIME_WEEKDAY compareTo (INT|string) # messageTimeWeekday
| MSG_TIME_HOUR compareTo INT # messageTimeHour
| MSG_TIME_MINUTE compareTo INT # messageTimeMinute
| MSG_TIME_YEAR (in|notin) (intRange|intList) # messageTimeYearIn
| MSG_TIME_MONTH (in|notin) (intRange|intList|stringList) # messageTimeMonthIn
| MSG_TIME_DAY (in|notin) (intRange|intList) # messageTimeDayIn
| MSG_TIME_WEEKDAY (in|notin) (intRange|intList|stringList) # messageTimeWeekdayIn
| MSG_TIME_HOUR (in|notin) (intRange|intList) # messageTimeHourIn
| MSG_TIME_MINUTE (in|notin) (intRange|intList) # messageTimeMinuteIn
//
// Tokens related to target
//
| TGT_IMO compareTo INT # targetImo
| TGT_IMO (in|notin) (intRange|intList) # targetImoIn
| TGT_TYPE compareTo string # targetShiptype
| TGT_TYPE (in|notin) (intRange|intList|stringList) # targetShiptypeIn
| TGT_COUNTRY (in|notin) stringList # targetCountryIn
| TGT_NAVSTAT compareTo string # targetNavigationalStatus
| TGT_NAVSTAT (in|notin) (intRange|intList|stringList) # targetNavigationalStatusIn
| TGT_NAME (compareTo|LIKE) string # targetName
| TGT_NAME (in|notin) stringList # targetNameIn
| TGT_CALLSIGN (compareTo|LIKE) string # targetCallsign
| TGT_CALLSIGN (in|notin) stringList # targetCallsignIn
| TGT_SPEED compareTo number # targetSpeedOverGround
| TGT_SPEED (in|notin) numberRange # targetSpeedOverGroundIn
| TGT_COURSE compareTo number # targetCourseOverGround
| TGT_COURSE (in|notin) numberRange # targetCourseOverGroundIn
| TGT_HEADING compareTo INT # targetTrueHeading
| TGT_HEADING (in|notin) intRange # targetTrueHeadingIn
| TGT_DRAUGHT compareTo number # targetDraught
| TGT_DRAUGHT (in|notin) numberRange # targetDraughtIn
| TGT_LATITUDE compareTo number # targetLatitude
| TGT_LATITUDE (in|notin) numberRange # targetLatitudeIn
| TGT_LONGITUDE compareTo number # targetLongitude
| TGT_LONGITUDE (in|notin) numberRange # targetLongitudeIn
| TGT_POSITION WITHIN (circle|bbox) # targetPositionInside
//
// Other tokens
//
| 'messagetype' in stringList # AisMessagetype
| filterExpression (op=(AND|OR) filterExpression)+ # OrAnd
| '(' filterExpression ')' # parens
;
compareTo : '!='|'='|'>'|'>='|'<='|'<' ;
in : '@'|'in'|'IN'|'=' ;
notin : '!@'|'not in'|'NOT IN'|'!=';
intList : '('? INT (',' INT)* ')'? ;
stringList : '('? string (',' string)* ')'? ;
intRange : '('? INT RANGE INT ')'? ;
numberRange : '('? number RANGE number ')'? ;
number : INT|FLOAT;
string : number|STRING;
bbox : BBOX '('? number ',' number ',' number ',' number ')'? ;
circle : CIRCLE '('? number ',' number ',' number ')'? ;
AND : '&' ;
OR : '|' ;
RANGE : '..';
LIKE : [Ll][Ii][Kk][Ee]|'~' ;
BBOX : [Bb][Bb][Oo][Xx] ;
CIRCLE : [Cc][Ii][Rr][Cc][Ll][Ee] ;
WITHIN : [Ww][Ii][Tt][Hh][Ii][Nn] ;
INT : '-'? [0-9]+;
FLOAT : '-'? [0-9]* '.' [0-9]+ ;
STRING : [a-zA-Z0-9_?\*]+ | '\'' .*? '\'' ;
WS : [ \n\r\t]+ -> skip ; // toss out whitespace
PREFIX_SOURCE : 's.';
PREFIX_MESSAGE : 'm.';
PREFIX_TARGET : 't.';
SRC_ID : PREFIX_SOURCE 'id';
SRC_BASESTATION : PREFIX_SOURCE 'bs';
SRC_COUNTRY : PREFIX_SOURCE 'country';
SRC_TYPE : PREFIX_SOURCE 'type';
SRC_REGION : PREFIX_SOURCE 'region';
MSG_MSGID : PREFIX_MESSAGE 'id';
MSG_MMSI : PREFIX_MESSAGE 'mmsi';
MSG_IMO : PREFIX_MESSAGE 'imo';
MSG_TYPE : PREFIX_MESSAGE 'type';
MSG_COUNTRY : PREFIX_MESSAGE 'country';
MSG_NAVSTAT : PREFIX_MESSAGE 'navstat';
MSG_NAME : PREFIX_MESSAGE 'name';
MSG_CALLSIGN : PREFIX_MESSAGE 'cs';
MSG_SPEED : PREFIX_MESSAGE 'sog';
MSG_COURSE : PREFIX_MESSAGE 'cog';
MSG_HEADING : PREFIX_MESSAGE 'hdg';
MSG_DRAUGHT : PREFIX_MESSAGE 'draught';
MSG_LATITUDE : PREFIX_MESSAGE 'lat';
MSG_LONGITUDE : PREFIX_MESSAGE 'lon';
MSG_POSITION : PREFIX_MESSAGE 'pos';
MSG_TIME_YEAR : PREFIX_MESSAGE 'year';
MSG_TIME_MONTH : PREFIX_MESSAGE 'month';
MSG_TIME_DAY : PREFIX_MESSAGE 'dom';
MSG_TIME_WEEKDAY: PREFIX_MESSAGE 'dow';
MSG_TIME_HOUR : PREFIX_MESSAGE 'hour';
MSG_TIME_MINUTE : PREFIX_MESSAGE 'minute';
TGT_IMO : PREFIX_TARGET 'imo';
TGT_TYPE : PREFIX_TARGET 'type';
TGT_COUNTRY : PREFIX_TARGET 'country';
TGT_NAVSTAT : PREFIX_TARGET 'navstat';
TGT_NAME : PREFIX_TARGET 'name';
TGT_CALLSIGN : PREFIX_TARGET 'cs';
TGT_SPEED : PREFIX_TARGET 'sog';
TGT_COURSE : PREFIX_TARGET 'cog';
TGT_HEADING : PREFIX_TARGET 'hdg';
TGT_DRAUGHT : PREFIX_TARGET 'draught';
TGT_LATITUDE : PREFIX_TARGET 'lat';
TGT_LONGITUDE : PREFIX_TARGET 'lon';
TGT_POSITION : PREFIX_TARGET 'pos';
|
test/cases/clang-static.asm | malcolmr/gcc-explorer | 4 | 174898 | Char:
.byte 128 # 0x80
.size Char, 1
.type Short,@object # @Short
.globl Short
.align 2
Short:
.short 4660 # 0x1234
.size Short, 2
.type Int,@object # @Int
.globl Int
.align 4
Int:
.long 123 # 0x7b
.size Int, 4
.type Long,@object # @Long
.globl Long
.align 8
Long:
.quad 2345 # 0x929
.size Long, 8
.type LongLong,@object # @LongLong
.globl LongLong
.align 8
|
oeis/328/A328683.asm | neoneye/loda-programs | 11 | 177778 | <gh_stars>10-100
; A328683: Positive integers that are equal to 99...99 (repdigit with n digits 9) times the sum of their digits.
; 81,1782,26973,359964,4499955,53999946,629999937,7199999928,80999999919,899999999910,9899999999901,107999999999892,1169999999999883,12599999999999874,134999999999999865,1439999999999999856,15299999999999999847,161999999999999999838,1709999999999999999829,17999999999999999999820,188999999999999999999811,1979999999999999999999802,20699999999999999999999793,215999999999999999999999784,2249999999999999999999999775,23399999999999999999999999766,242999999999999999999999999757
add $0,1
mov $2,$0
lpb $0
sub $0,1
add $1,$2
mul $1,10
lpe
div $1,10
mul $1,81
mov $0,$1
|
wayland_ada_scanner/src/aida/aida-deepend-xml_dom_parser.adb | onox/wayland-ada | 5 | 12073 | <filename>wayland_ada_scanner/src/aida/aida-deepend-xml_dom_parser.adb<gh_stars>1-10
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2018 - 2019 <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.
package body Aida.Deepend.XML_DOM_Parser is
type State_T is
(Expecting_Object_Start, -- seems to only apply to the root start tag
-- Expecting_Attribute_Or_Text_Or_Comment_Or_CDATA_Or_Object_Start_Or_Object_End,
Expecting_Default, -- Attribute_Or_Text_Or_Comment_Or_CDATA_Or_Object_Start_Or_Object_End
End_State);
function Name (This : Attribute) return String is
(This.My_Name.all);
function Value (This : Attribute) return String is
(This.My_Value.all);
function Name (This : XML_Tag) return String is
(This.My_Name.all);
function Child_Nodes (This : aliased XML_Tag) return Child_Nodes_Ref is
((Element => This.My_Child_Nodes'Access));
function Attributes (This : aliased XML_Tag) return Attributes_Ref is
((Element => This.My_Attributes'Access));
type Argument_Type is limited record
Current_Nodes : Node_Vectors.Vector;
-- The current node is the last Node pointed to in the container
Root_Node : Node_Ptr := null;
State : State_T := Expecting_Object_Start;
end record;
procedure Handle_Start_Tag
(Argument : in out Argument_Type;
Tag_Name : String;
Call_Result : in out Aida.Call_Result) is
begin
case Argument.State is
when Expecting_Object_Start =>
if
Tag_Name'Length > 0 and
Argument.Current_Nodes.Is_Empty
then
declare
Current_Node : constant not null Node_Ptr
:= new Node;
begin
Current_Node.Tag.My_Name
:= new String'(Tag_Name);
Argument.Current_Nodes.Append (Current_Node);
Argument.Root_Node := Current_Node;
end;
Argument.State := Expecting_Default;
else
Call_Result.Initialize (-2132671123, 1966624808);
end if;
when Expecting_Default =>
if Tag_Name'Length > 0 then
declare
Current_Node : constant not null Node_Ptr := new Node;
begin
Current_Node.Tag.My_Name := new String'(Tag_Name);
if
Argument.Current_Nodes.Constant_Reference
(Argument.Current_Nodes.Last_Index).all.Id = Node_Kind_Tag
then
Argument.Current_Nodes.Constant_Reference
(Argument.Current_Nodes.Last_Index).all.Tag.
My_Child_Nodes.Append (Current_Node);
Argument.Current_Nodes.Append (Current_Node);
else
Call_Result.Initialize (1695756105, 1714042669);
end if;
end;
else
Call_Result.Initialize (-0416079960, -1464855808);
end if;
when End_State =>
Call_Result.Initialize (0561631589, 0761077416);
end case;
end Handle_Start_Tag;
procedure Handle_End_Tag
(Argument : in out Argument_Type;
Tag_Name : String;
Call_Result : in out Aida.Call_Result) is
begin
case Argument.State is
when Expecting_Default =>
if not Argument.Current_Nodes.Is_Empty and then
(Argument.Current_Nodes.Constant_Reference
(Argument.Current_Nodes.Last_Index).all.Id = Node_Kind_Tag)
then
if Argument.Current_Nodes.Constant_Reference
(Argument.Current_Nodes.Last_Index).all.Tag.My_Name.all = Tag_Name
then
Argument.Current_Nodes.Delete_Last;
if Argument.Current_Nodes.Is_Empty then
Argument.State := End_State;
end if;
else
Call_Result.Initialize (-0316487383, -2063296151);
end if;
else
Call_Result.Initialize (-1355522791, 1675536860);
end if;
when Expecting_Object_Start | End_State =>
Call_Result.Initialize (-0728861922, -0299445966);
end case;
end Handle_End_Tag;
procedure Handle_Text
(Argument : in out Argument_Type;
Value : String;
Call_Result : in out Aida.Call_Result) is
begin
case Argument.State is
when Expecting_Default =>
if
Value'Length = 0 or
(Value'Length > 0 and then
(for all I in Value'Range =>
Value (I) = ' ' or
Value (I) = Character'Val (10) or
Value (I) = Character'Val (13)))
then
null;
elsif not Argument.Current_Nodes.Is_Empty then
declare
Current_Node : constant not null Node_Ptr
:= new Node (Node_Kind_Text);
begin
Current_Node.all
:= (Id => Node_Kind_Text,
Text => new String'(Value));
if
Argument.Current_Nodes.Constant_Reference
(Argument.Current_Nodes.Last_Index).all.Id = Node_Kind_Tag
then
Argument.Current_Nodes
(Argument.Current_Nodes.Last_Index).all.Tag.
My_Child_Nodes.Append (Current_Node);
else
Call_Result.Initialize (-0944309962, -0212130363);
end if;
end;
else
Call_Result.Initialize (0536156601, 0921613311);
end if;
when Expecting_Object_Start | End_State =>
Call_Result.Initialize (0240750889, 1723362921);
end case;
end Handle_Text;
procedure Handle_Attribute
(Argument : in out Argument_Type;
Attribute_Name : String;
Attribute_Value : String;
Call_Result : in out Aida.Call_Result) is
begin
case Argument.State is
when Expecting_Default =>
if not Argument.Current_Nodes.Is_Empty then
if Attribute_Name'Length > 0 then
declare
Attr : constant not null Attribute_Ptr := new Attribute;
begin
Attr.My_Name
:= new String'(Attribute_Name);
Attr.My_Value
:= new String'(Attribute_Value);
if
Argument.Current_Nodes.Constant_Reference
(Argument.Current_Nodes.Last_Index).all.Id = Node_Kind_Tag
then
Argument.Current_Nodes
(Argument.Current_Nodes.Last_Index).all.Tag.
My_Attributes.Append (Attr);
else
Call_Result.Initialize (0612916249, -0250963769);
end if;
end;
else
Call_Result.Initialize (-1091502024, -1483543078);
end if;
else
Call_Result.Initialize (-0372407662, -1139199208);
end if;
when Expecting_Object_Start | End_State =>
Call_Result.Initialize (1103012185, 0319457400);
end case;
end Handle_Attribute;
procedure Handle_Comment
(Argument : in out Argument_Type;
Value : String;
Call_Result : in out Aida.Call_Result) is
begin
case Argument.State is
when Expecting_Default =>
if not Argument.Current_Nodes.Is_Empty then
if Value'Length > 0 then
declare
Current_Node : constant Node_Ptr
:= new Node (Node_Kind_Comment);
begin
Current_Node.all
:= (Id => Node_Kind_Comment,
Text => new String'(Value));
if
Argument.Current_Nodes.Constant_Reference
(Argument.Current_Nodes.Last_Index).all.Id = Node_Kind_Tag
then
Argument.Current_Nodes.Constant_Reference
(Argument.Current_Nodes.Last_Index).all.Tag.
My_Child_Nodes.Append (Current_Node);
else
Call_Result.Initialize (2066772500, 1193932906);
end if;
end;
else
Call_Result.Initialize (1366102371, 1421674126);
end if;
else
Call_Result.Initialize (0845969060, 0639006566);
end if;
when Expecting_Object_Start |
End_State =>
Call_Result.Initialize (-1373186804, -0874315849);
end case;
end Handle_Comment;
procedure Handle_CDATA
(Argument : in out Argument_Type;
Value : String;
Call_Result : in out Aida.Call_Result) is
begin
case Argument.State is
when Expecting_Default =>
if
not Argument.Current_Nodes.Is_Empty
then
if Value'Length > 0 then
declare
Current_Node : constant Node_Ptr
:= new Node (Node_Kind_CDATA);
begin
Current_Node.all
:= (Id => Node_Kind_CDATA,
Text => new String'(Value));
if
Argument.Current_Nodes.Constant_Reference
(Argument.Current_Nodes.Last_Index).all.Id = Node_Kind_Tag
then
Argument.Current_Nodes.Constant_Reference
(Argument.Current_Nodes.Last_Index).all.Tag.
My_Child_Nodes.Append (Current_Node);
else
Call_Result.Initialize (-2021174626, -1403249390);
end if;
end;
else
Call_Result.Initialize (1915730777, 1973598725);
end if;
else
Call_Result.Initialize (-0076965217, 0193355440);
end if;
when Expecting_Object_Start | End_State =>
Call_Result.Initialize (0698504230, -0963685542);
end case;
end Handle_CDATA;
procedure SAX_Parse is new Aida.XML_SAX_Parse
(Argument_Type,
Handle_Start_Tag,
Handle_End_Tag,
Handle_Text,
Handle_Attribute,
Handle_Comment,
Handle_CDATA);
procedure Parse
(XML_Message : String;
Call_Result : in out Aida.Call_Result;
Root_Node : out Node_Ptr)
is
Argument : Argument_Type;
begin
SAX_Parse (Argument, XML_Message, Call_Result);
Root_Node := Argument.Root_Node;
end Parse;
end Aida.Deepend.XML_DOM_Parser;
|
Variables.asm | DevEd2/ScootTheBurbs | 5 | 23999 | <reponame>DevEd2/ScootTheBurbs<gh_stars>1-10
; ================================================================
; Variables
; ================================================================
if !def(incVars)
incVars set 1
SECTION "Virtual zeropage",WRAM0
GBCFlag ds 1
GBAFlag ds 1
EmuCheck ds 1
ScrollTablePos ds 1
StatID ds 1
WindowTransitionPos1 ds 1
WindowTransitionPos2 ds 1
WindowBasePos ds 1
WindowTransitionOffset ds 1
SpritesDisabled ds 1
Gradient_CurrentRed ds 1
Gradient_CurrentGreen ds 1
Gradient_CurrentBlue ds 1
CursorPos ds 1
CharSel_CharID ds 1
CharSel_TitleTextScroll ds 1
CharSel_PicScroll ds 1
CharSel_CharTextScroll ds 1
DoExitCharSelect ds 1
SoundTest_SongID ds 1
SoundTest_SFXID ds 1
SoundTest_SampleID ds 1
SECTION "OAM buffer",WRAM0[$c100]
OAMBuffer ds $100
SECTION "RGBGrafx fade routine RAM",WRAM0[$c200]
RGBG_fade_to_color ds 1
;I know, this fuction suite is a memory hog. sorry.
RGBG_fade_work_ram_bkg:: DS 8*4*3*3 ;8 pals x 4 colors x 3 components X 3 bytes for each components
RGBG_fade_current_pals_bkg:: DS 64
RGBG_fade_status_bkg:: DS 1
RGBG_fade_steps_left_bkg:: DS 1
RGBG_pals_to_fade_bkg:: DS 1
RGBG_first_pal_to_fade_bkg:: DS 1
RGBG_fade_work_ram_obj:: DS 8*4*3*3 ;8 pals x 4 colors x 3 components X 3 bytes for each components
RGBG_fade_current_pals_obj:: DS 64
RGBG_fade_status_obj:: DS 1
RGBG_fade_steps_left_obj:: DS 1
RGBG_pals_to_fade_obj:: DS 1
RGBG_first_pal_to_fade_obj:: DS 1
SECTION "System variables",HRAM
; ================================================================
; Global variables
; ================================================================
_OAM_DMA ds 16
sys_btnHold ds 1 ; held buttons
sys_btnPress ds 1 ; pressed buttons
sys_VBlankIRQ ds 1
sys_StatIRQ ds 1
sys_TimerIRQ ds 1
sys_SerialIRQ ds 1
sys_GameMode ds 1
sys_ErrorType ds 1
SerialType ds 1
SerialTransferredData ds 1
SerialRecievedData ds 1
SamplePlaying ds 1
SamplePtr ds 2
SampleSize ds 2
SampleBank ds 1
SampleBankCount ds 1
SampleVolume ds 1
CurrentSample ds 1
ScreenTimer ds 1
; ================================================================
SECTION "Temporary register storage space",HRAM
tempAF ds 2
tempBC ds 2
tempDE ds 2
tempHL ds 2
tempBC2 ds 2
tempDE2 ds 2
tempHL2 ds 2
tempHL3 ds 2
tempSP ds 2
tempPC ds 2
tempIF ds 1
tempIE ds 1
; ================================================================
endc
|
tests/listing/Issue155_endif_listing.asm | fengjixuchui/sjasmplus | 220 | 86727 | <reponame>fengjixuchui/sjasmplus
; Wrong address calculation in listing for lines with ENDIF keyword
org 0
align 16 : if 1 : block 0, $ff : endif ; OK
align 16 : if 1 : block 1, $ff : endif ; OK
align 16 : if 1 : block 2, $ff : endif ; OK
align 16 : if 1 : block 3, $ff : endif ; OK
align 16 : if 1 : block 4, $ff : endif ; OK
align 16 : if 1 : block 5, $ff : endif ; =$44 -> WRONG, MUST BE $45
align 16 : if 1 : block 15, $ff : endif ; =$54 -> WRONG, MUST BE $5F
; nested condition
align 16 : if 1 : if 1 : block 0, $ff : endif : endif ; OK
align 16 : if 1 : if 1 : block 1, $ff : endif : endif ; OK
align 16 : if 1 : if 1 : block 2, $ff : endif : endif ; OK
align 16 : if 1 : if 1 : block 3, $ff : endif : endif ; OK
align 16 : if 1 : if 1 : block 4, $ff : endif : endif ; OK
align 16 : if 1 : if 1 : block 5, $ff : endif : endif ; =$A4 -> WRONG, MUST BE $A5
align 16 : if 1 : if 1 : block 15, $ff : endif : endif ; =$B4 -> WRONG, MUST BE $BF
|
testdata/hmc-6502/cmp_beq_bne_test.asm | tehmaze/mos65xx | 3 | 86661 | <reponame>tehmaze/mos65xx
; Tests instructions CMP (all addressing modes) & BEQ & BNE.
; Assumes that loads & stores work with all addressing modes.
; Also assumes that AND & ORA & EOR work with all addressing modes.
;
; Expected Results: $15 = 0x7F
; Note that this test does not seem to work in 6502js, but Visual 6502 gives the
; correct result
start:
; prepare memory
LDA #$00
STA $34
LDA #$FF
STA $0130
LDA #$99
STA $019D
LDA #$DB
STA $0199
LDA #$2F
STA $32
LDA #$32
STA $4F
LDA #$30
STA $33
LDA #$70
STA $AF
LDA #$18
STA $30
; imm
CMP #$18
BEQ beq1 ; taken
AND #$00 ; not done
beq1:
; zpg
ORA #$01
CMP $30
BNE bne1 ; taken
AND #$00 ; not done
bne1:
; abs
LDX #$00
CMP $0130
BEQ beq2 ; not taken
STA $40
LDX $40
beq2:
; zpx
CMP $27,X
BNE bne2 ; not taken
ORA #$84
STA $41
LDX $41
bne2:
; abx
AND #$DB
CMP $0100,X
BEQ beq3 ; taken
AND #$00 ; not done
beq3:
; aby
STA $42
LDY $42
AND #$00
CMP $0100,Y
BNE bne3 ; taken
ORA #$0F ; not done
bne3:
; idx
STA $43
LDX $43
ORA #$24
CMP ($40,X) ; TODO: Reads from $9D19, which is uninitialized...
BEQ beq4 ; not taken
ORA #$7F
beq4:
; idy
STA $44
LDY $44
EOR #$0F
CMP ($33),Y
BNE bne4 ; not taken
LDA $44
STA $15
bne4:
|
llvm-gcc-4.2-2.9/gcc/ada/gnat1drv.adb | vidkidz/crossbridge | 1 | 7014 | <reponame>vidkidz/crossbridge<filename>llvm-gcc-4.2-2.9/gcc/ada/gnat1drv.adb<gh_stars>1-10
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T 1 D R V --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2006 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Atree; use Atree;
with Back_End; use Back_End;
with Comperr;
with Csets; use Csets;
with Debug; use Debug;
with Elists;
with Errout; use Errout;
with Fmap;
with Fname; use Fname;
with Fname.UF; use Fname.UF;
with Frontend;
with Gnatvsn; use Gnatvsn;
with Hostparm;
with Inline;
with Lib; use Lib;
with Lib.Writ; use Lib.Writ;
with Lib.Xref;
with Namet; use Namet;
with Nlists;
with Opt; use Opt;
with Osint; use Osint;
with Output; use Output;
with Prepcomp;
with Repinfo; use Repinfo;
with Restrict;
with Sem;
with Sem_Ch8;
with Sem_Ch12;
with Sem_Ch13;
with Sem_Elim;
with Sem_Eval;
with Sem_Type;
with Sinfo; use Sinfo;
with Sinput.L; use Sinput.L;
with Snames;
with Sprint; use Sprint;
with Stringt;
with Targparm;
with Tree_Gen;
with Treepr; use Treepr;
with Ttypes;
with Types; use Types;
with Uintp; use Uintp;
with Uname; use Uname;
with Urealp;
with Usage;
with System.Assertions;
procedure Gnat1drv is
Main_Unit_Node : Node_Id;
-- Compilation unit node for main unit
Main_Kind : Node_Kind;
-- Kind of main compilation unit node
Back_End_Mode : Back_End.Back_End_Mode_Type;
-- Record back end mode
begin
-- This inner block is set up to catch assertion errors and constraint
-- errors. Since the code for handling these errors can cause another
-- exception to be raised (namely Unrecoverable_Error), we need two
-- nested blocks, so that the outer one handles unrecoverable error.
begin
-- Lib.Initialize need to be called before Scan_Compiler_Arguments,
-- because it initialize a table that is filled by
-- Scan_Compiler_Arguments.
Osint.Initialize;
Fmap.Reset_Tables;
Lib.Initialize;
Lib.Xref.Initialize;
Scan_Compiler_Arguments;
Osint.Add_Default_Search_Dirs;
Nlists.Initialize;
Sinput.Initialize;
Sem.Initialize;
Csets.Initialize;
Uintp.Initialize;
Urealp.Initialize;
Errout.Initialize;
Namet.Initialize;
Snames.Initialize;
Stringt.Initialize;
Inline.Initialize;
Sem_Ch8.Initialize;
Sem_Ch12.Initialize;
Sem_Ch13.Initialize;
Sem_Elim.Initialize;
Sem_Eval.Initialize;
Sem_Type.Init_Interp_Tables;
-- Acquire target parameters from system.ads (source of package System)
declare
use Sinput;
S : Source_File_Index;
N : Name_Id;
begin
Name_Buffer (1 .. 10) := "system.ads";
Name_Len := 10;
N := Name_Find;
S := Load_Source_File (N);
if S = No_Source_File then
Write_Line
("fatal error, run-time library not installed correctly");
Write_Line
("cannot locate file system.ads");
raise Unrecoverable_Error;
-- Remember source index of system.ads (which was read successfully)
else
System_Source_File_Index := S;
end if;
Targparm.Get_Target_Parameters
(System_Text => Source_Text (S),
Source_First => Source_First (S),
Source_Last => Source_Last (S));
-- Acquire configuration pragma information from Targparm
Restrict.Restrictions := Targparm.Restrictions_On_Target;
end;
-- Set Configurable_Run_Time mode if system.ads flag set
if Targparm.Configurable_Run_Time_On_Target or Debug_Flag_YY then
Configurable_Run_Time_Mode := True;
end if;
-- Set -gnatR3m mode if debug flag A set
if Debug_Flag_AA then
Back_Annotate_Rep_Info := True;
List_Representation_Info := 1;
List_Representation_Info_Mechanisms := True;
end if;
-- Output copyright notice if full list mode
if (Verbose_Mode or Full_List)
and then (not Debug_Flag_7)
then
Write_Eol;
Write_Str ("GNAT ");
Write_Str (Gnat_Version_String);
Write_Eol;
Write_Str ("Copyright 1992-" &
Current_Year &
", Free Software Foundation, Inc.");
Write_Eol;
end if;
-- Before we do anything else, adjust certain global values for
-- debug switches which modify their normal natural settings.
if Debug_Flag_8 then
Ttypes.Bytes_Big_Endian := not Ttypes.Bytes_Big_Endian;
end if;
if Debug_Flag_M then
Targparm.OpenVMS_On_Target := True;
Hostparm.OpenVMS := True;
end if;
if Debug_Flag_FF then
Targparm.Frontend_Layout_On_Target := True;
end if;
-- We take the default exception mechanism into account
if Targparm.ZCX_By_Default_On_Target then
if Targparm.GCC_ZCX_Support_On_Target then
Exception_Mechanism := Back_End_Exceptions;
else
Osint.Fail
("Zero Cost Exceptions not supported on this target");
end if;
end if;
-- Set proper status for overflow checks. We turn on overflow checks
-- if -gnatp was not specified, and either -gnato is set or the back
-- end takes care of overflow checks. Otherwise we suppress overflow
-- checks by default (since front end checks are expensive).
if not Opt.Suppress_Checks
and then (Opt.Enable_Overflow_Checks
or else
(Targparm.Backend_Divide_Checks_On_Target
and
Targparm.Backend_Overflow_Checks_On_Target))
then
Suppress_Options (Overflow_Check) := False;
else
Suppress_Options (Overflow_Check) := True;
end if;
-- Check we have exactly one source file, this happens only in the case
-- where the driver is called directly, it cannot happen when gnat1 is
-- invoked from gcc in the normal case.
if Osint.Number_Of_Files /= 1 then
Usage;
Write_Eol;
Osint.Fail ("you must provide one source file");
elsif Usage_Requested then
Usage;
end if;
Original_Operating_Mode := Operating_Mode;
Frontend;
Main_Unit_Node := Cunit (Main_Unit);
Main_Kind := Nkind (Unit (Main_Unit_Node));
-- Check for suspicious or incorrect body present if we are doing
-- semantic checking. We omit this check in syntax only mode, because
-- in that case we do not know if we need a body or not.
if Operating_Mode /= Check_Syntax
and then
((Main_Kind = N_Package_Declaration
and then not Body_Required (Main_Unit_Node))
or else (Main_Kind = N_Generic_Package_Declaration
and then not Body_Required (Main_Unit_Node))
or else Main_Kind = N_Package_Renaming_Declaration
or else Main_Kind = N_Subprogram_Renaming_Declaration
or else Nkind (Original_Node (Unit (Main_Unit_Node)))
in N_Generic_Instantiation)
then
Bad_Body : declare
Sname : Unit_Name_Type := Unit_Name (Main_Unit);
Src_Ind : Source_File_Index;
Fname : File_Name_Type;
procedure Bad_Body_Error (Msg : String);
-- Issue message for bad body found
--------------------
-- Bad_Body_Error --
--------------------
procedure Bad_Body_Error (Msg : String) is
begin
Error_Msg_N (Msg, Main_Unit_Node);
Error_Msg_Name_1 := Fname;
Error_Msg_N
("remove incorrect body in file{!", Main_Unit_Node);
end Bad_Body_Error;
-- Start of processing for Bad_Body
begin
Sname := Unit_Name (Main_Unit);
-- If we do not already have a body name, then get the body name
-- (but how can we have a body name here ???)
if not Is_Body_Name (Sname) then
Sname := Get_Body_Name (Sname);
end if;
Fname := Get_File_Name (Sname, Subunit => False);
Src_Ind := Load_Source_File (Fname);
-- Case where body is present and it is not a subunit. Exclude
-- the subunit case, because it has nothing to do with the
-- package we are compiling. It is illegal for a child unit and a
-- subunit with the same expanded name (RM 10.2(9)) to appear
-- together in a partition, but there is nothing to stop a
-- compilation environment from having both, and the test here
-- simply allows that. If there is an attempt to include both in
-- a partition, this is diagnosed at bind time. In Ada 83 mode
-- this is not a warning case.
-- Note: if weird file names are being used, we can have
-- situation where the file name that supposedly contains body,
-- in fact contains a spec, or we can't tell what it contains.
-- Skip the error message in these cases.
if Src_Ind /= No_Source_File
and then Get_Expected_Unit_Type (Fname) = Expect_Body
and then not Source_File_Is_Subunit (Src_Ind)
then
Error_Msg_Name_1 := Sname;
-- Ada 83 case of a package body being ignored. This is not an
-- error as far as the Ada 83 RM is concerned, but it is
-- almost certainly not what is wanted so output a warning.
-- Give this message only if there were no errors, since
-- otherwise it may be incorrect (we may have misinterpreted a
-- junk spec as not needing a body when it really does).
if Main_Kind = N_Package_Declaration
and then Ada_Version = Ada_83
and then Operating_Mode = Generate_Code
and then Distribution_Stub_Mode /= Generate_Caller_Stub_Body
and then not Compilation_Errors
then
Error_Msg_N
("package % does not require a body?", Main_Unit_Node);
Error_Msg_Name_1 := Fname;
Error_Msg_N
("body in file{? will be ignored", Main_Unit_Node);
-- Ada 95 cases of a body file present when no body is
-- permitted. This we consider to be an error.
else
-- For generic instantiations, we never allow a body
if Nkind (Original_Node (Unit (Main_Unit_Node)))
in N_Generic_Instantiation
then
Bad_Body_Error
("generic instantiation for % does not allow a body");
-- A library unit that is a renaming never allows a body
elsif Main_Kind in N_Renaming_Declaration then
Bad_Body_Error
("renaming declaration for % does not allow a body!");
-- Remaining cases are packages and generic packages. Here
-- we only do the test if there are no previous errors,
-- because if there are errors, they may lead us to
-- incorrectly believe that a package does not allow a body
-- when in fact it does.
elsif not Compilation_Errors then
if Main_Kind = N_Package_Declaration then
Bad_Body_Error
("package % does not allow a body!");
elsif Main_Kind = N_Generic_Package_Declaration then
Bad_Body_Error
("generic package % does not allow a body!");
end if;
end if;
end if;
end if;
end Bad_Body;
end if;
-- Exit if compilation errors detected
if Compilation_Errors then
Treepr.Tree_Dump;
Sem_Ch13.Validate_Unchecked_Conversions;
Errout.Finalize;
Namet.Finalize;
-- Generate ALI file if specially requested
if Opt.Force_ALI_Tree_File then
Write_ALI (Object => False);
Tree_Gen;
end if;
Exit_Program (E_Errors);
end if;
-- Set Generate_Code on main unit and its spec. We do this even if are
-- not generating code, since Lib-Writ uses this to determine which
-- units get written in the ali file.
Set_Generate_Code (Main_Unit);
-- If we have a corresponding spec, then we need object
-- code for the spec unit as well
if Nkind (Unit (Main_Unit_Node)) in N_Unit_Body
and then not Acts_As_Spec (Main_Unit_Node)
then
Set_Generate_Code
(Get_Cunit_Unit_Number (Library_Unit (Main_Unit_Node)));
end if;
-- Case of no code required to be generated, exit indicating no error
if Original_Operating_Mode = Check_Syntax then
Treepr.Tree_Dump;
Errout.Finalize;
Tree_Gen;
Namet.Finalize;
-- Use a goto instead of calling Exit_Program so that finalization
-- occurs normally.
goto End_Of_Program;
elsif Original_Operating_Mode = Check_Semantics then
Back_End_Mode := Declarations_Only;
-- All remaining cases are cases in which the user requested that code
-- be generated (i.e. no -gnatc or -gnats switch was used). Check if
-- we can in fact satisfy this request.
-- Cannot generate code if someone has turned off code generation for
-- any reason at all. We will try to figure out a reason below.
elsif Operating_Mode /= Generate_Code then
Back_End_Mode := Skip;
-- We can generate code for a subprogram body unless there were missing
-- subunits. Note that we always generate code for all generic units (a
-- change from some previous versions of GNAT).
elsif Main_Kind = N_Subprogram_Body
and then not Subunits_Missing
then
Back_End_Mode := Generate_Object;
-- We can generate code for a package body unless there are subunits
-- missing (note that we always generate code for generic units, which
-- is a change from some earlier versions of GNAT).
elsif Main_Kind = N_Package_Body
and then not Subunits_Missing
then
Back_End_Mode := Generate_Object;
-- We can generate code for a package declaration or a subprogram
-- declaration only if it does not required a body.
elsif (Main_Kind = N_Package_Declaration
or else
Main_Kind = N_Subprogram_Declaration)
and then
(not Body_Required (Main_Unit_Node)
or else
Distribution_Stub_Mode = Generate_Caller_Stub_Body)
then
Back_End_Mode := Generate_Object;
-- We can generate code for a generic package declaration of a generic
-- subprogram declaration only if does not require a body.
elsif (Main_Kind = N_Generic_Package_Declaration
or else
Main_Kind = N_Generic_Subprogram_Declaration)
and then not Body_Required (Main_Unit_Node)
then
Back_End_Mode := Generate_Object;
-- Compilation units that are renamings do not require bodies,
-- so we can generate code for them.
elsif Main_Kind = N_Package_Renaming_Declaration
or else Main_Kind = N_Subprogram_Renaming_Declaration
then
Back_End_Mode := Generate_Object;
-- Compilation units that are generic renamings do not require bodies
-- so we can generate code for them.
elsif Main_Kind in N_Generic_Renaming_Declaration then
Back_End_Mode := Generate_Object;
-- In all other cases (specs which have bodies, generics, and bodies
-- where subunits are missing), we cannot generate code and we generate
-- a warning message. Note that generic instantiations are gone at this
-- stage since they have been replaced by their instances.
else
Back_End_Mode := Skip;
end if;
-- At this stage Call_Back_End is set to indicate if the backend should
-- be called to generate code. If it is not set, then code generation
-- has been turned off, even though code was requested by the original
-- command. This is not an error from the user point of view, but it is
-- an error from the point of view of the gcc driver, so we must exit
-- with an error status.
-- We generate an informative message (from the gcc point of view, it
-- is an error message, but from the users point of view this is not an
-- error, just a consequence of compiling something that cannot
-- generate code).
if Back_End_Mode = Skip then
Write_Str ("cannot generate code for ");
Write_Str ("file ");
Write_Name (Unit_File_Name (Main_Unit));
if Subunits_Missing then
Write_Str (" (missing subunits)");
Write_Eol;
Write_Str ("to check parent unit");
elsif Main_Kind = N_Subunit then
Write_Str (" (subunit)");
Write_Eol;
Write_Str ("to check subunit");
elsif Main_Kind = N_Subprogram_Declaration then
Write_Str (" (subprogram spec)");
Write_Eol;
Write_Str ("to check subprogram spec");
-- Generic package body in GNAT implementation mode
elsif Main_Kind = N_Package_Body and then GNAT_Mode then
Write_Str (" (predefined generic)");
Write_Eol;
Write_Str ("to check predefined generic");
-- Only other case is a package spec
else
Write_Str (" (package spec)");
Write_Eol;
Write_Str ("to check package spec");
end if;
Write_Str (" for errors, use ");
if Hostparm.OpenVMS then
Write_Str ("/NOLOAD");
else
Write_Str ("-gnatc");
end if;
Write_Eol;
Sem_Ch13.Validate_Unchecked_Conversions;
Errout.Finalize;
Treepr.Tree_Dump;
Tree_Gen;
Write_ALI (Object => False);
Namet.Finalize;
-- Exit program with error indication, to kill object file
Exit_Program (E_No_Code);
end if;
-- In -gnatc mode, we only do annotation if -gnatt or -gnatR is also
-- set as indicated by Back_Annotate_Rep_Info being set to True.
-- We don't call for annotations on a subunit, because to process those
-- the back-end requires that the parent(s) be properly compiled.
-- Annotation is suppressed for targets where front-end layout is
-- enabled, because the front end determines representations.
-- Annotation is also suppressed in the case of compiling for
-- the Java VM, since representations are largely symbolic there.
if Back_End_Mode = Declarations_Only
and then (not Back_Annotate_Rep_Info
or else Main_Kind = N_Subunit
or else Targparm.Frontend_Layout_On_Target
or else Hostparm.Java_VM)
then
Sem_Ch13.Validate_Unchecked_Conversions;
Errout.Finalize;
Write_ALI (Object => False);
Tree_Dump;
Tree_Gen;
Namet.Finalize;
return;
end if;
-- Ensure that we properly register a dependency on system.ads, since
-- even if we do not semantically depend on this, Targparm has read
-- system parameters from the system.ads file.
Lib.Writ.Ensure_System_Dependency;
-- Add dependencies, if any, on preprocessing data file and on
-- preprocessing definition file(s).
Prepcomp.Add_Dependencies;
-- Back end needs to explicitly unlock tables it needs to touch
Atree.Lock;
Elists.Lock;
Fname.UF.Lock;
Inline.Lock;
Lib.Lock;
Nlists.Lock;
Sem.Lock;
Sinput.Lock;
Namet.Lock;
Stringt.Lock;
-- Here we call the back end to generate the output code
Back_End.Call_Back_End (Back_End_Mode);
-- Once the backend is complete, we unlock the names table. This call
-- allows a few extra entries, needed for example for the file name for
-- the library file output.
Namet.Unlock;
-- Validate unchecked conversions (using the values for size and
-- alignment annotated by the backend where possible).
Sem_Ch13.Validate_Unchecked_Conversions;
-- Now we complete output of errors, rep info and the tree info. These
-- are delayed till now, since it is perfectly possible for gigi to
-- generate errors, modify the tree (in particular by setting flags
-- indicating that elaboration is required, and also to back annotate
-- representation information for List_Rep_Info.
Errout.Finalize;
List_Rep_Info;
-- Only write the library if the backend did not generate any error
-- messages. Otherwise signal errors to the driver program so that
-- there will be no attempt to generate an object file.
if Compilation_Errors then
Treepr.Tree_Dump;
Exit_Program (E_Errors);
end if;
Write_ALI (Object => (Back_End_Mode = Generate_Object));
-- Generate the ASIS tree after writing the ALI file, since in ASIS
-- mode, Write_ALI may in fact result in further tree decoration from
-- the original tree file. Note that we dump the tree just before
-- generating it, so that the dump will exactly reflect what is written
-- out.
Treepr.Tree_Dump;
Tree_Gen;
-- Finalize name table and we are all done
Namet.Finalize;
exception
-- Handle fatal internal compiler errors
when System.Assertions.Assert_Failure =>
Comperr.Compiler_Abort ("Assert_Failure");
when Constraint_Error =>
Comperr.Compiler_Abort ("Constraint_Error");
when Program_Error =>
Comperr.Compiler_Abort ("Program_Error");
when Storage_Error =>
-- Assume this is a bug. If it is real, the message will in any case
-- say Storage_Error, giving a strong hint!
Comperr.Compiler_Abort ("Storage_Error");
end;
<<End_Of_Program>>
null;
-- The outer exception handles an unrecoverable error
exception
when Unrecoverable_Error =>
Errout.Finalize;
Set_Standard_Error;
Write_Str ("compilation abandoned");
Write_Eol;
Set_Standard_Output;
Source_Dump;
Tree_Dump;
Exit_Program (E_Errors);
end Gnat1drv;
|
container/core.agda | HoTT/M-types | 27 | 15116 | <reponame>HoTT/M-types<gh_stars>10-100
{-# OPTIONS --without-K #-}
module container.core where
open import level
open import sum
open import equality
open import function
module _ {li}{I : Set li} where
-- homsets in the slice category
_→ⁱ_ : ∀ {lx ly} → (I → Set lx) → (I → Set ly) → Set _
X →ⁱ Y = (i : I) → X i → Y i
-- identity of the slice category
idⁱ : ∀ {lx}{X : I → Set lx} → X →ⁱ X
idⁱ i x = x
-- composition in the slice category
_∘ⁱ_ : ∀ {lx ly lz} {X : I → Set lx}{Y : I → Set ly}{Z : I → Set lz}
→ (Y →ⁱ Z) → (X →ⁱ Y) → (X →ⁱ Z)
(f ∘ⁱ g) i = f i ∘ g i
infixl 9 _∘ⁱ_
-- extensionality
funext-isoⁱ : ∀ {lx ly} {X : I → Set lx}{Y : (i : I) → X i → Set ly}
→ {f g : (i : I)(x : X i) → Y i x}
→ (∀ i x → f i x ≡ g i x)
≅ (f ≡ g)
funext-isoⁱ {f = f}{g = g}
= (Π-ap-iso refl≅ λ i → strong-funext-iso)
·≅ strong-funext-iso
funext-invⁱ : ∀ {lx ly} {X : I → Set lx}{Y : (i : I) → X i → Set ly}
→ {f g : (i : I)(x : X i) → Y i x}
→ f ≡ g → ∀ i x → f i x ≡ g i x
funext-invⁱ = invert funext-isoⁱ
funextⁱ : ∀ {lx ly} {X : I → Set lx}{Y : (i : I) → X i → Set ly}
→ {f g : (i : I)(x : X i) → Y i x}
→ (∀ i x → f i x ≡ g i x) → f ≡ g
funextⁱ = apply funext-isoⁱ
-- Definition 1 in Ahrens, Capriotti and Spadotti (arXiv:1504.02949v1 [cs.LO])
record Container (li la lb : Level) : Set (lsuc (li ⊔ la ⊔ lb)) where
constructor container
field
I : Set li
A : I → Set la
B : {i : I} → A i → Set lb
r : {i : I}{a : A i} → B a → I
-- Definition 2 in Ahrens, Capriotti and Spadotti (arXiv:1504.02949v1 [cs.LO])
-- functor associated to this indexed container
F : ∀ {lx} → (I → Set lx) → I → Set _
F X i = Σ (A i) λ a → (b : B a) → X (r b)
F-ap-iso : ∀ {lx ly}{X : I → Set lx}{Y : I → Set ly}
→ (∀ i → X i ≅ Y i)
→ ∀ i → F X i ≅ F Y i
F-ap-iso isom i = Σ-ap-iso refl≅ λ a
→ Π-ap-iso refl≅ λ b
→ isom (r b)
-- morphism map for the functor F
imap : ∀ {lx ly}
→ {X : I → Set lx}
→ {Y : I → Set ly}
→ (X →ⁱ Y)
→ (F X →ⁱ F Y)
imap g i (a , f) = a , λ b → g (r b) (f b)
-- action of a functor on homotopies
hmap : ∀ {lx ly}
→ {X : I → Set lx}
→ {Y : I → Set ly}
→ {f g : X →ⁱ Y}
→ (∀ i x → f i x ≡ g i x)
→ (∀ i x → imap f i x ≡ imap g i x)
hmap p i (a , u) = ap (_,_ a) (funext (λ b → p (r b) (u b)))
hmap-id : ∀ {lx ly}
→ {X : I → Set lx}
→ {Y : I → Set ly}
→ (f : X →ⁱ Y)
→ ∀ i x
→ hmap (λ i x → refl {x = f i x}) i x ≡ refl
hmap-id f i (a , u) = ap (ap (_,_ a)) (funext-id _)
|
llvm-gcc-4.2-2.9/gcc/ada/a-intnam.ads | vidkidz/crossbridge | 1 | 19776 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . I N T E R R U P T S . N A M E S --
-- --
-- S p e c --
-- --
-- This specification is adapted from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
-- The standard implementation of this spec contains only dummy interrupt
-- names. These dummy entries permit checking out code for correctness of
-- semantics, even if interrupts are not supported.
-- For specific implementations that fully support interrupts, this package
-- spec is replaced by an implementation dependent version that defines the
-- interrupts available on the system.
package Ada.Interrupts.Names is
DUMMY_INTERRUPT_1 : constant Interrupt_ID := 1;
DUMMY_INTERRUPT_2 : constant Interrupt_ID := 2;
end Ada.Interrupts.Names;
|
smsq/atari/ser/baud.asm | olifink/smsqe | 0 | 98596 | <gh_stars>0
; Atari Baud Rate 1991 <NAME> QJUMP
section sms
xdef at_baud
include 'dev8_keys_atari'
include 'dev8_keys_atari_scc'
include 'dev8_keys_sys'
include 'dev8_keys_err'
;+++
; Set Baud Rate
;
; d1 c p baud rate (n*10) + 0, 1, 2, 3, 4
;
; status return 0 or err.ipar
;---
at_baud
qbd.reg reg d1/d2/d7/a1
movem.l qbd.reg,-(sp)
move.l d1,d0
divu #19200,d0 ; check if n*19200
swap d0
subq.w #4,d0
bls.s qbd_port
move.l d1,d0 ; check if 125000 or 83333
sub.l #83333,d0
cmp.l #4,d0
bls.s qbd_port_sel
sub.l #125000-83333,d0
subq.l #4,d0
bls.s qbd_port
and.l #$ffff,d1 ; make word only
qbd_port
move.l d1,d0
divu #10,d0 ; get port
clr.w d0
swap d0
qbd_port_sel
sub.l d0,d1 ; baud rate not including port
subq.w #4,d0
bhi.l qbd_ipar
beq.s qbd_4 ; port 4
addq.w #2,d0 ; port 1, 2 or 3?
bgt.s qbd_3 ; port 3
beq.s qbd_2 ; port 2
; SER 1 MFP
lea at_mfp+mfp_ddat,a1 ; timer D
bra.s qbd13_rate
; SER 3 MFP2
qbd_3
moveq #sys.mtyp,d0
and.b sys_mtyp(a6),d0 ; machine type
cmp.b #sys.mtt,d0 ; tt
bne.l qbd_ipar ; ... no
lea at_mfp2+mfp_ddat,a1 ; timer D
qbd13_rate
moveq #1,d0 ; assume highest speed
tst.w d1 ; any rate?
beq.s qbd1_set
move.w #19200*2,d0 ; 19200 is rate 1
divu d1,d0
addq.w #1,d0 ; round
lsr.w #1,d0
qbd1_set
move.b d0,(a1) ; set rate
bra.l qbd_exok
; SER 2 SCC channel B
qbd_2
move.w sr,d7
lea scc_ctrb,a1
moveq #sccm.lstp+sccm.cl16,d2 ; divide by 16
moveq #sys.mtyp,d0
and.b sys_mtyp(a6),d0 ; machine type
subq.b #sys.mmste,d0 ; mega ste
blt.l qbd_ipar ; ... no
move.l d1,d0
beq.s qbd_2max
divu #38400,d0 ; for direct, check multiple of 38400
swap d0
tst.w d0 ; remainder?
beq.s qbd_2dir ; ... no
qbd_2mste
move.l #8000000/32*2,d0 ; 250000 is rate 1 (unobtainable)
bra.s qbd24_setr ; ... yes
qbd_2max
moveq #1,d0
swap d0 ; rate 1
qbd_2dir
moveq #sccc.tctr+sccc.rctr,d1 ; clock direct from TRxCB
swap d0
subq.w #4,d0 ; 38400*4?
beq.s qbd24_sets ; ... yes
bgt.s qbd_ipar2
moveq #$ffffff00+sccm.lstp+sccm.cl32,d2 ; divide by 32
addq.w #2,d0 ; 38400*2?
beq.s qbd24_sets ; ... yes
qbd_ipar2
bgt.s qbd_ipar
moveq #$ffffff00+sccm.lstp+sccm.cl64,d2 ; divide by 64
bra.s qbd24_sets
; SER 4 SCC channel A
qbd_4
moveq #sccm.lstp+sccm.cl16,d2 ; divide by 16
moveq #sys.mtyp,d0
and.b sys_mtyp(a6),d0 ; machine type
subq.b #sys.mmste,d0 ; mega ste
blt.s qbd_ipar ; ... no
move.w sr,d7
lea scc_ctra,a1
move.l #3672000/32*2,d0 ; 114600 (app) is rate 1 (unobtainable)
tst.w d1 ; any rate?
bne.s qbd24_setr ; ... yes
moveq #sccc.tcrt+sccc.rcrt,d1 ; clock direct from RTxCA
bra.s qbd24_sets ; set source
qbd24_setr
add.l d1,d0 ; round
lsr.l #1,d0
qbd24_dchk
cmp.l #$ffff,d1 ; to large for divu?
bls.s qbd24_div
lsr.l #3,d0
lsr.l #3,d1
qbd24_div
divu d1,d0
subq.w #2,d0 ; -2 for counter!!
bge.s qbd24_setb
moveq #0,d0 ; highest rate
qbd24_setb
moveq #sccc.tcbd+sccc.rcbd,d1 ; clock from baud rate gen
move.w #$2700,sr ; atomic accessing please
move.b #scc_divl,(a1)
move.b d0,(a1) ; set rate lsb
move.w d7,sr
lsr.w #8,d0
move.w #$2700,sr ; atomic accessing please
move.b #scc_divh,(a1)
move.b d0,(a1) ; set rate msb
move.w d7,sr
qbd24_sets
move.w #$2700,sr ; atomic accessing please
move.b #scc_wclk,(a1)
move.b d1,(a1) ; set clock source
move.w d7,sr
move.w #$2700,sr ; atomic accessing please
move.b #scc_wmode,(a1)
move.b d2,(a1) ; set divider
move.w d7,sr
qbd_exok
moveq #0,d0
qbd_exit
movem.l (sp)+,qbd.reg
rts
qbd_ipar
moveq #err.ipar,d0
bra.s qbd_exit
end
|
search_english.adb | ddugovic/words | 4 | 2737 | with TEXT_IO; use TEXT_IO;
with Strings_Package; use Strings_Package;
with LATIN_FILE_NAMES; use LATIN_FILE_NAMES;
with CONFIG;
with WORD_PARAMETERS; use WORD_PARAMETERS;
with Inflections_Package; use Inflections_Package;
with Dictionary_Package; use Dictionary_Package;
with DEVELOPER_PARAMETERS; use DEVELOPER_PARAMETERS;
with WORD_PACKAGE; use WORD_PACKAGE;
with ENGLISH_SUPPORT_PACKAGE; use ENGLISH_SUPPORT_PACKAGE;
with DICTIONARY_FORM;
procedure SEARCH_ENGLISH(INPUT_ENGLISH_WORD : STRING; POFS : PART_OF_SPEECH_TYPE := X) is
use EWDS_DIRECT_IO;
INPUT_WORD : EWORD := LOWER_CASE(HEAD(INPUT_ENGLISH_WORD, EWORD_SIZE));
INPUT_POFS : PART_OF_SPEECH_TYPE := POFS;
OUTPUT_ARRAY : EWDS_ARRAY(1..500) := (others => NULL_EWDS_RECORD);
NUMBER_OF_HITS : INTEGER := 0;
J1, J2, J, JJ : EWDS_DIRECT_IO.COUNT := 0;
D_K : DICTIONARY_KIND := GENERAL; -- For the moment
EWDS : EWDS_RECORD := NULL_EWDS_RECORD;
FIRST_TRY, SECOND_TRY : BOOLEAN := TRUE;
procedure LOAD_OUTPUT_ARRAY(EWDS : in EWDS_RECORD) is
begin
--PUT("LOAD a " & PART_OF_SPEECH_TYPE'IMAGE(INPUT_POFS));
--PUT("LOAD b " & PART_OF_SPEECH_TYPE'IMAGE(INPUT_POFS));
if EWDS.POFS <= INPUT_POFS then
NUMBER_OF_HITS := NUMBER_OF_HITS + 1;
OUTPUT_ARRAY(NUMBER_OF_HITS) := EWDS;
-- PUT("$ " & INTEGER'IMAGE(NUMBER_OF_HITS));
-- EWDS_RECORD_IO.PUT(OUTPUT_ARRAY(NUMBER_OF_HITS));
-- TEXT_IO.NEW_LINE;
end if;
end LOAD_OUTPUT_ARRAY;
--procedure TRIM_OUTPUT_ARRAY is
procedure SORT_OUTPUT_ARRAY is
HITS : INTEGER := 0;
begin
-- Bubble sort
HIT_LOOP:
loop
HITS := 0;
SWITCH:
declare
DW, EW : EWDS_RECORD := NULL_EWDS_RECORD;
begin
INNER_LOOP: -- Order by RANK, FREQ, SEMI
for I in 1..NUMBER_OF_HITS-1 loop
if OUTPUT_ARRAY(I+1).RANK > OUTPUT_ARRAY(I).RANK or else
(OUTPUT_ARRAY(I+1).RANK = OUTPUT_ARRAY(I).RANK and then
OUTPUT_ARRAY(I+1).FREQ < OUTPUT_ARRAY(I).FREQ) or else
(OUTPUT_ARRAY(I+1).RANK = OUTPUT_ARRAY(I).RANK and then
OUTPUT_ARRAY(I+1).FREQ = OUTPUT_ARRAY(I).FREQ and then
OUTPUT_ARRAY(I+1).SEMI < OUTPUT_ARRAY(I).SEMI) then
DW := OUTPUT_ARRAY(I);
OUTPUT_ARRAY(I) := OUTPUT_ARRAY(I+1);
OUTPUT_ARRAY(I+1) := DW;
HITS := HITS + 1;
--PUT_LINE("HITS " & INTEGER'IMAGE(HITS));
end if;
end loop INNER_LOOP;
end SWITCH;
exit when HITS = 0;
end loop HIT_LOOP;
end SORT_OUTPUT_ARRAY;
-- begin
-- SORT_OUTPUT_ARRAY;
-- end TRIM_OUTPUT_ARRAY;
procedure DUMP_OUTPUT_ARRAY(OUTPUT : in TEXT_IO.FILE_TYPE) is
DE : DICTIONARY_ENTRY := NULL_DICTIONARY_ENTRY;
NUMBER_TO_SHOW : INTEGER := NUMBER_OF_HITS;
ONE_SCREEN : INTEGER := 6;
begin
--TEXT_IO.PUT_LINE("DUMP_OUTPUT");
if NUMBER_OF_HITS = 0 then
TEXT_IO.PUT_LINE(OUTPUT, "No Match");
else
--PUT_LINE("Unsorted EWDS");
--for I in 1..NUMBER_TO_SHOW loop
-- PUT(INTEGER'IMAGE(I)); PUT("*"); EWDS_RECORD_IO.PUT(OUTPUT_ARRAY(I)); NEW_LINE;
--end loop;
SORT_OUTPUT_ARRAY;
--TEXT_IO.PUT_LINE("DUMP_OUTPUT SORTED");
TRIMMED := FALSE;
if WORDS_MODE(TRIM_OUTPUT) then
if NUMBER_OF_HITS > ONE_SCREEN then
NUMBER_TO_SHOW := ONE_SCREEN;
TRIMMED := TRUE;
else
NUMBER_TO_SHOW := NUMBER_OF_HITS;
end if;
end if;
for I in 1..NUMBER_TO_SHOW loop
TEXT_IO.NEW_LINE(OUTPUT);
DO_PAUSE:
begin
--PUT(INTEGER'IMAGE(INTEGER(TEXT_IO.LINE(OUTPUT))) & " ");
--PUT(INTEGER'IMAGE(INTEGER(SCROLL_LINE_NUMBER)) & " ");
--PUT(INTEGER'IMAGE(INTEGER(CONFIG.OUTPUT_SCREEN_SIZE)) & " ");
if (INTEGER(TEXT_IO.LINE(OUTPUT)) >
SCROLL_LINE_NUMBER + CONFIG.OUTPUT_SCREEN_SIZE) then
PAUSE(OUTPUT);
SCROLL_LINE_NUMBER := INTEGER(TEXT_IO.LINE(OUTPUT));
end if;
end DO_PAUSE;
-- EWDS_RECORD_IO.PUT(OUTPUT_ARRAY(I));
-- TEXT_IO.NEW_LINE;
DICT_IO.READ(DICT_FILE(GENERAL), DE, DICT_IO.COUNT(OUTPUT_ARRAY(I).N));
--TEXT_IO.PUT_LINE("DUMP_OUTPUT READ");
-- DICTIONARY_ENTRY_IO.PUT(DE); TEXT_IO.NEW_LINE;
PUT(OUTPUT, DICTIONARY_FORM(DE));
TEXT_IO.PUT(OUTPUT, " ");
--PART_ENTRY_IO.PUT(OUTPUT, DE.PART);
--TEXT_IO.PUT_LINE("DUMP_OUTPUT PART");
if DE.PART.POFS = N then
TEXT_IO.PUT(OUTPUT, " "); DECN_RECORD_IO.PUT(OUTPUT, DE.PART.N.DECL);
TEXT_IO.PUT(OUTPUT, " " & GENDER_TYPE'IMAGE(DE.PART.N.GENDER) & " ");
end if;
if (DE.PART.POFS = V) then
TEXT_IO.PUT(OUTPUT, " "); DECN_RECORD_IO.PUT(OUTPUT, DE.PART.V.CON);
end if;
if (DE.PART.POFS = V) and then (DE.PART.V.KIND in GEN..PERFDEF) then
TEXT_IO.PUT(OUTPUT, " " & VERB_KIND_TYPE'IMAGE(DE.PART.V.KIND) & " ");
end if;
--TEXT_IO.PUT_LINE("DUMP_OUTPUT CODE");
if WORDS_MDEV(SHOW_DICTIONARY_CODES) then
TEXT_IO.PUT(OUTPUT, " [");
AGE_TYPE_IO.PUT(OUTPUT, DE.TRAN.AGE);
AREA_TYPE_IO.PUT(OUTPUT, DE.TRAN.AREA);
GEO_TYPE_IO.PUT(OUTPUT, DE.TRAN.GEO);
FREQUENCY_TYPE_IO.PUT(OUTPUT, DE.TRAN.FREQ);
SOURCE_TYPE_IO.PUT(OUTPUT, DE.TRAN.SOURCE);
TEXT_IO.PUT(OUTPUT, "] ");
end if;
if WORDS_MDEV(SHOW_DICTIONARY) then
TEXT_IO.PUT(OUTPUT, EXT(D_K) & ">");
end if;
--TEXT_IO.PUT_LINE("DUMP_OUTPUT SHOW");
if WORDS_MDEV(SHOW_DICTIONARY_LINE) then
TEXT_IO.PUT(OUTPUT, "("
& TRIM(INTEGER'IMAGE(OUTPUT_ARRAY(I).N)) & ")");
end if;
TEXT_IO.NEW_LINE(OUTPUT);
--TEXT_IO.PUT_LINE("DUMP_OUTPUT MEAN");
TEXT_IO.PUT(OUTPUT, TRIM(DE.MEAN));
TEXT_IO.NEW_LINE(OUTPUT);
end loop;
--TEXT_IO.PUT_LINE("DUMP_OUTPUT TRIMMED");
if TRIMMED then
PUT_LINE(OUTPUT, "*");
end if;
end if; -- On HITS = 0
exception
when others =>
null; -- If N not in DICT_FILE
end DUMP_OUTPUT_ARRAY;
begin
J1 := 1;
J2 := SIZE(EWDS_FILE);
FIRST_TRY := TRUE;
SECOND_TRY := TRUE;
J := (J1 + J2) / 2;
BINARY_SEARCH:
loop
-- TEXT_IO.PUT_LINE("J = " & INTEGER'IMAGE(INTEGER(J)));
if (J1 = J2-1) or (J1 = J2) then
if FIRST_TRY then
-- TEXT_IO.PUT_LINE("FIRST_TRY");
J := J1;
FIRST_TRY := FALSE;
elsif SECOND_TRY then
-- TEXT_IO.PUT_LINE("SECOND_TRY");
J := J2;
SECOND_TRY := FALSE;
else
-- TEXT_IO.PUT_LINE("THIRD_TRY exit BINARY_SEARCH");
JJ := J;
exit BINARY_SEARCH;
end if;
end if;
-- Should D_K
SET_INDEX(EWDS_FILE, EWDS_DIRECT_IO.COUNT(J));
READ(EWDS_FILE, EWDS);
-- EWDS_RECORD_IO.PUT(EWDS);
-- TEXT_IO.NEW_LINE;
-- PUT_LINE(LOWER_CASE(EWDS.W));
-- PUT_LINE(INPUT_WORD);
-- TEXT_IO.PUT_LINE("J = " & INTEGER'IMAGE(INTEGER(J)) &
-- " J1 = " & INTEGER'IMAGE(INTEGER(J1)) &
-- " J2 = " & INTEGER'IMAGE(INTEGER(J2)));
--
if "<"(LOWER_CASE(EWDS.W), INPUT_WORD) then -- Not LTU, not u=v
J1 := J;
J := (J1 + J2) / 2;
elsif ">"(LOWER_CASE(EWDS.W), INPUT_WORD) then
J2 := J;
J := (J1 + J2) / 2;
else
for I in reverse J1..J loop
SET_INDEX(EWDS_FILE, EWDS_DIRECT_IO.COUNT(I));
READ(EWDS_FILE, EWDS); -- Reads and advances index!!
if "="(LOWER_CASE(EWDS.W), INPUT_WORD) then
JJ := I;
-- PUT(INTEGER'IMAGE(INTEGER(I))); PUT("-"); EWDS_RECORD_IO.PUT(EWDS); NEW_LINE;
LOAD_OUTPUT_ARRAY(EWDS);
else
exit;
end if;
end loop;
for I in J+1..J2 loop
SET_INDEX(EWDS_FILE, EWDS_DIRECT_IO.COUNT(I));
READ(EWDS_FILE, EWDS);
if "="(LOWER_CASE(EWDS.W), INPUT_WORD) then
JJ := I;
-- PUT(INTEGER'IMAGE(INTEGER(I))); PUT("+"); EWDS_RECORD_IO.PUT(EWDS); NEW_LINE;
LOAD_OUTPUT_ARRAY(EWDS);
else
exit BINARY_SEARCH;
end if;
end loop;
exit BINARY_SEARCH;
end if;
end loop BINARY_SEARCH;
if WORDS_MODE(WRITE_OUTPUT_TO_FILE) then
DUMP_OUTPUT_ARRAY(OUTPUT);
else
DUMP_OUTPUT_ARRAY(CURRENT_OUTPUT);
end if;
-- DUMP_OUTPUT_ARRAY(;
-- TEXT_IO.PUT_LINE("Leaving SEARCH NUMBER_OF_HITS = " &
-- INTEGER'IMAGE(NUMBER_OF_HITS));
exception
when others =>
TEXT_IO.PUT_LINE("exception SEARCH NUMBER_OF_HITS = " &
INTEGER'IMAGE(NUMBER_OF_HITS));
raise;
end SEARCH_ENGLISH;
|
Ada/src/Problem_21.adb | Tim-Tom/project-euler | 0 | 22816 | <reponame>Tim-Tom/project-euler
with Ada.Integer_Text_IO;
with Ada.Text_IO;
with PrimeUtilities;
package body Problem_21 is
package IO renames Ada.Text_IO;
package I_IO renames Ada.Integer_Text_IO;
procedure Solve is
subtype subset is Integer range 1 .. 10_000;
package Subset_Primes is new PrimeUtilities(Num => subset);
sieve : constant Subset_Primes.sieve := Subset_Primes.Generate_Sieve(subset'Last);
d : Array (2 .. subset'Last) of Integer;
sum : Integer := 0;
procedure sum_divisors(num : in subset; sum : out Natural) is
divisors : constant Subset_Primes.Proper_Divisors := Subset_Primes.Generate_Proper_Divisors(num, sieve);
begin
sum := 0;
for index in divisors'Range loop
sum := sum + divisors(index);
end loop;
end sum_divisors;
begin
for n in d'Range loop
sum_divisors(n, d(n));
end loop;
for n in d'Range loop
if (d(n) <= d'Last and d(n) >= d'First) and then d(d(n)) = n then
sum := sum + n;
end if;
end loop;
I_IO.Put(sum);
IO.New_Line;
end Solve;
end Problem_21;
|
oeis/255/A255296.asm | neoneye/loda-programs | 11 | 171044 | <gh_stars>10-100
; A255296: a(n) = A255295(2^n-1).
; Submitted by <NAME>
; 1,6,24,92,340,1236,4452,15956,57028,203508,725604,2585876,9212932,32818740,116898468,416365652,1482959428,5281740660,18811402980,66998214548,238618498180,849854020788,3026803253028,10780126189268,38394001851076,136742291486196,487014945269604,1734529552998932,6177618817971460,22001916096783156,78360987000034212,279086795341152596,993982364318493508,3540120692227720308,12608326822500017124,44905221886315230356,159932319372665202052,569607402028065020340,2028686845104403372068
mov $1,3
mov $2,1
lpb $0
sub $0,1
sub $1,1
add $1,$4
mul $1,2
mul $2,2
mov $3,$4
mov $4,$2
add $2,$3
add $4,$2
lpe
add $4,$1
mov $0,$4
sub $0,2
|
macOS/blink_script.applescript | mwilczek-net/utils-and-automators | 0 | 1730 | <filename>macOS/blink_script.applescript
#!/usr/bin/osascript
# Script requires ctrl+option+command+8 keyborard short cut.
# By default this short cut inverts colors.
tell application "System Events" to repeat 2 times
key code 28 using {command down, control down, option down}
delay 0
end repeat |
oeis/274/A274094.asm | neoneye/loda-programs | 11 | 163410 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A274094: a(0)=0; thereafter (-1)^(n+1)*n appears n times.
; Submitted by <NAME>, https://github.com/ckrause
; 0,1,-2,-2,3,3,3,-4,-4,-4,-4,5,5,5,5,5,-6,-6,-6,-6,-6,-6,7,7,7,7,7,7,7,-8,-8,-8,-8,-8,-8,-8,-8,9,9,9,9,9,9,9,9,9,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,11,11,11,11,11,11,11,11,11,11,11,-12,-12,-12,-12,-12,-12,-12,-12,-12,-12,-12,-12,13,13,13,13,13,13,13,13,13,13,13,13,13,-14,-14,-14,-14,-14,-14,-14,-14
lpb $0
pow $1,0
sub $1,3
bin $1,$2
add $2,1
trn $0,$2
lpe
mov $0,$1
|
SiriRemote/AppleRemote_SCREEN.applescript | guileschool/SiriRemoteBTT | 20 | 650 | <reponame>guileschool/SiriRemoteBTT<filename>SiriRemote/AppleRemote_SCREEN.applescript
(*
The MIT License (MIT)
Copyright (c) 2015 guileschool
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.
http://github.com/guileschool/SiriRemoteBTT
*)
-- iTunes's screen is on between dual monitors
try
tell application "System Events"
if exists process "iTunes" then
tell application "iTunes"
activate
set frontmost to true
tell application "Keyboard Maestro Engine"
set aMonitor to get value of variable "MONITOR"
if aMonitor is equal to "1" then
make variable with properties {name:"MONITOR", value:2}
tell application "iTunes" to set bounds of front window to {0, 20, 2560, 1440}
else if aMonitor is equal to "2" then
make variable with properties {name:"MONITOR", value:1}
tell application "iTunes" to set bounds of front window to {2560, 20, 2560 * 2, 1440}
else
display dialog "Invalid value : " & aMonitor
end if
end tell
end tell
end if
end tell
on error
end try |
src/Categories/Category/Finite/Fin.agda | MirceaS/agda-categories | 0 | 1688 | <reponame>MirceaS/agda-categories
{-# OPTIONS --without-K --safe #-}
module Categories.Category.Finite.Fin where
open import Level
open import Data.Nat using (ℕ)
open import Data.Vec as Vec using (Vec)
open import Data.List
open import Data.Fin
open import Data.Fin.Properties
open import Axiom.UniquenessOfIdentityProofs
open import Relation.Binary using (Rel ; Decidable)
open import Relation.Binary.PropositionalEquality as ≡
open import Categories.Category
record Arrow (n : ℕ) (∣_⇒_∣ : Fin n → Fin n → ℕ) : Set where
field
dom : Fin n
cod : Fin n
arr : Fin ∣ dom ⇒ cod ∣
-- a hasShape of a finite catgegory
--
-- Classically, a finite category has a finite number of objects and a finite number
-- of morphisms. However, in this library, we cannot conveniently count the number of
-- objects and morphisms, because morphisms are identified up to the underlying
-- equivalence and objects have no general notion of identity. As a result, the
-- classical definition fails.
--
-- Nevetheless, if we know precisely what the objects and morphisms are, then we might
-- be able to count them. As a result, finite categories are just adjoint equivalent
-- to some category with a finite hasShape. Motivated by this idea, we can consider a
-- category with both objects and morphisms represented by Fin. We know Fin has
-- decidable equality and consequently also UIP. This allows us to operate
-- classically. We additionally require categorical axioms and thus ensure all shapes
-- form categories.
record HasFinCatShape (n : ℕ) (∣_⇒_∣ : Fin n → Fin n → ℕ) : Set where
infix 4 _⇒_
infixr 9 _∘_
_⇒_ : Rel (Fin n) 0ℓ
a ⇒ b = Fin ∣ a ⇒ b ∣
field
id : ∀ {a} → a ⇒ a
_∘_ : ∀ {a b c} → b ⇒ c → a ⇒ b → a ⇒ c
field
assoc : ∀ {a b c d} {f : a ⇒ b} {g : b ⇒ c} {h : c ⇒ d} → (h ∘ g) ∘ f ≡ h ∘ (g ∘ f)
identityˡ : ∀ {a b} {f : a ⇒ b} → id ∘ f ≡ f
identityʳ : ∀ {a b} {f : a ⇒ b} → f ∘ id ≡ f
objects : List (Fin n)
objects = allFin n
wrap-arr : ∀ {d c} (f : Fin ∣ d ⇒ c ∣) → Arrow n ∣_⇒_∣
wrap-arr f = record { arr = f }
morphisms : List (Arrow n ∣_⇒_∣)
morphisms = concatMap (λ d → concatMap (λ c → tabulate (wrap-arr {d} {c})) objects) objects
Obj-≟ : Decidable {A = Fin n} _≡_
Obj-≟ = _≟_
objects-vec : Vec (Fin n) n
objects-vec = Vec.allFin n
⇒-≟ : ∀ {a b} → Decidable {A = a ⇒ b} _≡_
⇒-≟ = _≟_
Obj-UIP : UIP (Fin n)
Obj-UIP = Decidable⇒UIP.≡-irrelevant Obj-≟
⇒-UIP : ∀ {a b} → UIP (a ⇒ b)
⇒-UIP = Decidable⇒UIP.≡-irrelevant ⇒-≟
record FinCatShape : Set where
infix 9 ∣_⇒_∣
field
size : ℕ
∣_⇒_∣ : Fin size → Fin size → ℕ
hasShape : HasFinCatShape size ∣_⇒_∣
open HasFinCatShape hasShape public
FinCategory : FinCatShape → Category 0ℓ 0ℓ 0ℓ
FinCategory s = record
{ Obj = Fin size
; _⇒_ = _⇒_
; _≈_ = _≡_
; id = id
; _∘_ = _∘_
; assoc = assoc
; sym-assoc = sym assoc
; identityˡ = identityˡ
; identityʳ = identityʳ
; identity² = identityˡ
; equiv = ≡.isEquivalence
; ∘-resp-≈ = cong₂ _∘_
}
where open FinCatShape s
|
Example/Test.agda | omelkonian/setup-agda | 2 | 13041 | module Example.Test where
open import Data.Maybe using (Is-just)
open import Prelude.Init
open import Prelude.DecEq
open import Prelude.Decidable
_ : (¬ ¬ ((true , true) ≡ (true , true)))
× (8 ≡ 18 ∸ 10)
_ = auto
|
CS410-Indexed.agda | clarkdm/CS410 | 0 | 4809 | {-# OPTIONS --copatterns #-}
module CS410-Indexed where
open import CS410-Prelude
open import CS410-Nat
-- some notation for working with indexed sets
_-:>_ _*:_ _+:_ : {I : Set}(S T : I -> Set) -> I -> Set
(S -:> T) i = S i -> T i -- index-respecting functions
(S *: T) i = S i * T i -- index-matching pairs
(S +: T) i = S i + T i -- index-consistent choice
infixr 3 _-:>_
infixr 5 _*:_
-- wrapping in the brackets means "works for all indices"
[_] : {I : Set}(X : I -> Set) -> Set
[ X ] = forall {i} -> X i
-- each set I gives us a category, I -> Set, whose objects are
-- indexed sets A : I -> Set, and whose arrows are
-- things in [ A -:> B ]
-- what is a functor between categories of indexed sets?
record FunctorIx {I J : Set}(F : (I -> Set) -> (J -> Set)) : Set1 where
field
mapIx : {A B : I -> Set} -> [ A -:> B ] -> [ F A -:> F B ]
-- what is a monad on indexed sets?
-- it's the usual kit for monads, instantiated for the kinds of
-- "arrows" that we use for indexed sets, the index-respecting functions
record MonadIx {W : Set}(F : (W -> Set) -> (W -> Set)) : Set1 where
field
retIx : forall {P} -> [ P -:> F P ]
extendIx : forall {P Q} -> [ P -:> F Q ] -> [ F P -:> F Q ]
_?>=_ : forall {P Q w} ->
F P w -> (forall {v} -> P v -> F Q v) -> F Q w
fp ?>= k = extendIx k fp
-- every MonadIx gives a FunctorIx
monadFunctorIx : forall {W}{F} -> MonadIx {W} F -> FunctorIx {W}{W} F
monadFunctorIx M = record { mapIx = \ f -> extendIx (retIx o f) }
where open MonadIx M
-- indexed containers, also known as interaction strutures, give us
-- functors
record _=>_ (I J : Set) : Set1 where
constructor _<!_/_
field
Shape : J -> Set
Position : (j : J) -> Shape j -> Set
index : (j : J)(s : Shape j) -> Position j s -> I
IC : forall {I J} -> I => J -> (I -> Set) -> (J -> Set)
IC {I}{J} C X j = Sg (Shape j) \ s -> (p : Position j s) -> X (index j s p)
where open _=>_ C
icFunctorIx : forall {I J}(C : I => J) -> FunctorIx (IC C)
icFunctorIx C = record { mapIx = \ {f (s , k) -> s , \ p -> f (k p) } }
where open _=>_ C
-- iterating an indexed container whose input (child) and output (parent) index
-- types are the same gives us "strategy trees"
data FreeIx {I}(C : I => I)(X : I -> Set)(i : I) : Set where
ret : (X -:> FreeIx C X) i
do : (IC C (FreeIx C X) -:> FreeIx C X) i
-- and they're monadic
freeMonadIx : forall {I}(C : I => I) -> MonadIx (FreeIx C)
freeMonadIx C = record { retIx = ret ; extendIx = graft } where
graft : forall {P Q} -> [ P -:> FreeIx C Q ] -> [ FreeIx C P -:> FreeIx C Q ]
graft k (ret p) = k p
graft k (do (s , f)) = do (s , \ p -> graft k (f p))
-- potentially infinite strategies
data Iterating {I}(C : I => I)(X : I -> Set)(i : I) : Set
record IterIx {I}(C : I => I)(X : I -> Set)(i : I) : Set where
coinductive
constructor step
field
force : Iterating C X i
open IterIx public
data Iterating {i} C X i where
ret : (X -:> Iterating C X) i
do : (IC C (IterIx C X) -:> Iterating C X) i
iterMonadIx : forall {I}(C : I => I) -> MonadIx (IterIx C)
iterMonadIx C = record { retIx = retHelp ; extendIx = extHelp } where
open _=>_ C
retHelp : forall {P} -> [ P -:> IterIx C P ]
force (retHelp p) = ret p
extHelp : forall {P Q} -> [ P -:> IterIx C Q ] -> [ IterIx C P -:> IterIx C Q ]
force (extHelp k t) with force t
force (extHelp k t) | ret p = force (k p)
force (extHelp k t) | do (s , f) = do (s , \ p -> extHelp k (f p))
|
programs/oeis/280/A280014.asm | karttu/loda | 0 | 244120 | <reponame>karttu/loda
; A280014: Numbers n == +- 2 (mod 10) but not n == 2 (mod 6).
; 12,18,22,28,42,48,52,58,72,78,82,88,102,108,112,118,132,138,142,148,162,168,172,178,192,198,202,208,222,228,232,238,252,258,262,268,282,288,292,298,312,318,322,328,342,348,352,358,372,378,382,388,402,408,412,418,432,438,442,448,462,468,472,478,492,498,502,508,522,528,532,538,552,558,562,568,582,588,592,598,612,618,622,628,642,648,652,658,672,678,682,688,702,708,712,718,732,738,742,748,762,768,772,778,792,798,802,808,822,828,832,838,852,858,862,868,882,888,892,898,912,918,922,928,942,948,952,958,972,978,982,988,1002,1008,1012,1018,1032,1038,1042,1048,1062,1068,1072,1078,1092,1098,1102,1108,1122,1128,1132,1138,1152,1158,1162,1168,1182,1188,1192,1198,1212,1218,1222,1228,1242,1248,1252,1258,1272,1278,1282,1288,1302,1308,1312,1318,1332,1338,1342,1348,1362,1368,1372,1378,1392,1398,1402,1408,1422,1428,1432,1438,1452,1458,1462,1468,1482,1488,1492,1498,1512,1518,1522,1528,1542,1548,1552,1558,1572,1578,1582,1588,1602,1608,1612,1618,1632,1638,1642,1648,1662,1668,1672,1678,1692,1698,1702,1708,1722,1728,1732,1738,1752,1758,1762,1768,1782,1788,1792,1798,1812,1818,1822,1828,1842,1848,1852,1858,1872,1878
mov $1,$0
mov $2,$0
add $2,2
mov $3,$0
add $0,3
lpb $0,1
sub $0,1
trn $0,1
mov $4,2
add $4,$2
mov $2,4
add $2,$0
add $2,$1
sub $2,$0
add $2,2
sub $4,5
mov $5,0
add $5,$4
mov $1,$5
lpe
mul $1,2
lpb $3,1
add $1,4
sub $3,1
lpe
add $1,6
|
tools/SPARK2005/preprocessor/src/context_processing.ads | michalkonecny/polypaver | 1 | 6590 | <filename>tools/SPARK2005/preprocessor/src/context_processing.ads<gh_stars>1-10
------------------------------------------------------------------------------
-- --
-- ASIS APPLICATION TEMPLATE COMPONENTS --
-- --
-- C O N T E X T _ P R O C E S S I N G --
-- --
-- S p e c --
-- --
-- Copyright (c) 2000, Free Software Foundation, Inc. --
-- --
-- ASIS Application Templates are free software; you can redistribute it --
-- and/or modify it under terms of the GNU General Public License as --
-- published by the Free Software Foundation; either version 2, or (at your --
-- option) any later version. ASIS Application Templates are distributed in --
-- the hope that they will be useful, but WITHOUT ANY WARRANTY; without --
-- even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR --
-- PURPOSE. See the GNU General Public License for more details. You should --
-- have received a copy of the GNU General Public License distributed with --
-- distributed with GNAT; see file COPYING. If not, write to the Free --
-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, --
-- USA. --
-- --
-- ASIS Application Templates were developed and are now maintained by Ada --
-- Core Technologies Inc (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
-- This package contains routines for high-level processing of
-- (terating through) an ASIS Context
with Asis;
package Context_Processing is
procedure Process_Context
(The_Context : Asis.Context;
Trace : Boolean := False;
Output_Path : String);
-- This procedure iterates through the whole content of its argument
-- Context and it calls a unit processing routine for those ASIS
-- Compilation Units which are of An_Application_Unit origin (that is,
-- user-defined units). If Trace parameter is set ON, it generate the
-- simple trace of the unit processing (consisting of the names of the
-- units in the Context being processed or skipped).
end Context_Processing;
|
oeis/297/A297443.asm | neoneye/loda-programs | 11 | 244786 | <gh_stars>10-100
; A297443: a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3) + 3*a(n-4) - 3*a(n-5), where a(0) = 1, a(1) = 3, a(2) = 6, a(3) = 11, a(4) = 20, a(5) = 33.
; Submitted by <NAME>(s3)
; 1,3,6,11,20,33,60,101,182,303,546,911,1640,2733,4920,8201,14762,24603,44286,73811,132860,221433,398580,664301,1195742,1992903,3587226,5978711,10761680,17936133,32285040,53808401,96855122,161425203,290565366,484275611,871696100,1452826833,2615088300,4358480501,7845264902,13075441503,23535794706,39226324511,70607384120,117678973533,211822152360,353036920601,635466457082,1059110761803,1906399371246,3177332285411,5719198113740,9531996856233,17157594341220,28595990568701,51472783023662
mov $3,2
lpb $0
sub $0,1
mov $2,$3
add $2,$1
add $2,2
sub $3,$1
sub $3,$1
mov $1,$3
add $3,$2
lpe
add $3,$2
mov $1,$3
div $1,4
mov $0,$1
add $0,1
|
src/ada-pulse/src/pulse-volume.ads | mstewartgallus/linted | 0 | 21467 | -- Copyright 2016 <NAME>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-- implied. See the License for the specific language governing
-- permissions and limitations under the License.
with System;
with Interfaces.C;
with Interfaces.C.Strings;
with Libc.Stdint;
with Libc.Stddef;
with Pulse.Channelmap;
limited with Pulse.Sample;
package Pulse.Volume with
Spark_Mode => Off is
subtype pa_volume_t is
Libc.Stdint.uint32_t; -- /usr/include/pulse/volume.h:107
PA_VOLUME_NORM : constant pa_volume_t := 16#10000#;
PA_VOLUME_MUTED : constant pa_volume_t := 0;
-- unsupported macro: PA_VOLUME_MAX ((pa_volume_t) UINT32_MAX/2)
-- unsupported macro: PA_VOLUME_UI_MAX (pa_sw_volume_from_dB(+11.0))
-- unsupported macro: PA_VOLUME_INVALID ((pa_volume_t) UINT32_MAX)
-- arg-macro: function PA_VOLUME_IS_VALID (v)
-- return (v) <= PA_VOLUME_MAX;
-- arg-macro: function PA_CLAMP_VOLUME (v)
-- return PA_CLAMP_UNLIKELY((v), PA_VOLUME_MUTED, PA_VOLUME_MAX);
-- arg-macro: procedure pa_cvolume_reset (a, n)
-- pa_cvolume_set((a), (n), PA_VOLUME_NORM)
-- arg-macro: procedure pa_cvolume_mute (a, n)
-- pa_cvolume_set((a), (n), PA_VOLUME_MUTED)
-- unsupported macro: PA_CVOLUME_SNPRINT_MAX 320
-- unsupported macro: PA_SW_CVOLUME_SNPRINT_DB_MAX 448
-- unsupported macro: PA_VOLUME_SNPRINT_MAX 10
-- unsupported macro: PA_SW_VOLUME_SNPRINT_DB_MAX 10
-- arg-macro: procedure pa_cvolume_is_muted (a)
-- pa_cvolume_channels_equal_to((a), PA_VOLUME_MUTED)
-- arg-macro: procedure pa_cvolume_is_norm (a)
-- pa_cvolume_channels_equal_to((a), PA_VOLUME_NORM)
-- unsupported macro: PA_DECIBEL_MININFTY ((double) -200.0)
type pa_cvolume_values_array is array (0 .. 31) of aliased pa_volume_t;
type pa_cvolume is record
channels : aliased Libc.Stdint
.uint8_t; -- /usr/include/pulse/volume.h:136
values : aliased pa_cvolume_values_array; -- /usr/include/pulse/volume.h:137
end record;
pragma Convention
(C_Pass_By_Copy,
pa_cvolume); -- /usr/include/pulse/volume.h:135
function pa_cvolume_equal
(a : System.Address;
b : System.Address)
return Interfaces.C.int; -- /usr/include/pulse/volume.h:141
pragma Import (C, pa_cvolume_equal, "pa_cvolume_equal");
function pa_cvolume_init
(a : access pa_cvolume)
return access pa_cvolume; -- /usr/include/pulse/volume.h:146
pragma Import (C, pa_cvolume_init, "pa_cvolume_init");
function pa_cvolume_set
(a : access pa_cvolume;
channels : Interfaces.C.unsigned;
v : pa_volume_t)
return access pa_cvolume; -- /usr/include/pulse/volume.h:155
pragma Import (C, pa_cvolume_set, "pa_cvolume_set");
function pa_cvolume_snprint
(s : Interfaces.C.Strings.chars_ptr;
l : Libc.Stddef.size_t;
c : System.Address)
return Interfaces.C.Strings.chars_ptr; -- /usr/include/pulse/volume.h:165
pragma Import (C, pa_cvolume_snprint, "pa_cvolume_snprint");
function pa_sw_cvolume_snprint_dB
(s : Interfaces.C.Strings.chars_ptr;
l : Libc.Stddef.size_t;
c : System.Address)
return Interfaces.C.Strings.chars_ptr; -- /usr/include/pulse/volume.h:175
pragma Import (C, pa_sw_cvolume_snprint_dB, "pa_sw_cvolume_snprint_dB");
function pa_volume_snprint
(s : Interfaces.C.Strings.chars_ptr;
l : Libc.Stddef.size_t;
v : pa_volume_t)
return Interfaces.C.Strings.chars_ptr; -- /usr/include/pulse/volume.h:185
pragma Import (C, pa_volume_snprint, "pa_volume_snprint");
function pa_sw_volume_snprint_dB
(s : Interfaces.C.Strings.chars_ptr;
l : Libc.Stddef.size_t;
v : pa_volume_t)
return Interfaces.C.Strings.chars_ptr; -- /usr/include/pulse/volume.h:195
pragma Import (C, pa_sw_volume_snprint_dB, "pa_sw_volume_snprint_dB");
function pa_cvolume_avg
(a : System.Address)
return pa_volume_t; -- /usr/include/pulse/volume.h:198
pragma Import (C, pa_cvolume_avg, "pa_cvolume_avg");
function pa_cvolume_avg_mask
(a : System.Address;
cm : access constant Pulse.Channelmap.pa_channel_map;
mask : Pulse.Channelmap.pa_channel_position_mask_t)
return pa_volume_t; -- /usr/include/pulse/volume.h:205
pragma Import (C, pa_cvolume_avg_mask, "pa_cvolume_avg_mask");
function pa_cvolume_max
(a : System.Address)
return pa_volume_t; -- /usr/include/pulse/volume.h:208
pragma Import (C, pa_cvolume_max, "pa_cvolume_max");
function pa_cvolume_max_mask
(a : System.Address;
cm : access constant Pulse.Channelmap.pa_channel_map;
mask : Pulse.Channelmap.pa_channel_position_mask_t)
return pa_volume_t; -- /usr/include/pulse/volume.h:215
pragma Import (C, pa_cvolume_max_mask, "pa_cvolume_max_mask");
function pa_cvolume_min
(a : System.Address)
return pa_volume_t; -- /usr/include/pulse/volume.h:218
pragma Import (C, pa_cvolume_min, "pa_cvolume_min");
function pa_cvolume_min_mask
(a : System.Address;
cm : access constant Pulse.Channelmap.pa_channel_map;
mask : Pulse.Channelmap.pa_channel_position_mask_t)
return pa_volume_t; -- /usr/include/pulse/volume.h:225
pragma Import (C, pa_cvolume_min_mask, "pa_cvolume_min_mask");
function pa_cvolume_valid
(v : System.Address)
return Interfaces.C.int; -- /usr/include/pulse/volume.h:228
pragma Import (C, pa_cvolume_valid, "pa_cvolume_valid");
function pa_cvolume_channels_equal_to
(a : System.Address;
v : pa_volume_t)
return Interfaces.C.int; -- /usr/include/pulse/volume.h:231
pragma Import
(C,
pa_cvolume_channels_equal_to,
"pa_cvolume_channels_equal_to");
function pa_sw_volume_multiply
(a : pa_volume_t;
b : pa_volume_t) return pa_volume_t; -- /usr/include/pulse/volume.h:242
pragma Import (C, pa_sw_volume_multiply, "pa_sw_volume_multiply");
function pa_sw_cvolume_multiply
(dest : access pa_cvolume;
a : System.Address;
b : System.Address)
return access pa_cvolume; -- /usr/include/pulse/volume.h:247
pragma Import (C, pa_sw_cvolume_multiply, "pa_sw_cvolume_multiply");
function pa_sw_cvolume_multiply_scalar
(dest : access pa_cvolume;
a : System.Address;
b : pa_volume_t)
return access pa_cvolume; -- /usr/include/pulse/volume.h:253
pragma Import
(C,
pa_sw_cvolume_multiply_scalar,
"pa_sw_cvolume_multiply_scalar");
function pa_sw_volume_divide
(a : pa_volume_t;
b : pa_volume_t) return pa_volume_t; -- /usr/include/pulse/volume.h:259
pragma Import (C, pa_sw_volume_divide, "pa_sw_volume_divide");
function pa_sw_cvolume_divide
(dest : access pa_cvolume;
a : System.Address;
b : System.Address)
return access pa_cvolume; -- /usr/include/pulse/volume.h:264
pragma Import (C, pa_sw_cvolume_divide, "pa_sw_cvolume_divide");
function pa_sw_cvolume_divide_scalar
(dest : access pa_cvolume;
a : System.Address;
b : pa_volume_t)
return access pa_cvolume; -- /usr/include/pulse/volume.h:270
pragma Import
(C,
pa_sw_cvolume_divide_scalar,
"pa_sw_cvolume_divide_scalar");
function pa_sw_volume_from_dB
(f : Interfaces.C.double)
return pa_volume_t; -- /usr/include/pulse/volume.h:273
pragma Import (C, pa_sw_volume_from_dB, "pa_sw_volume_from_dB");
function pa_sw_volume_to_dB
(v : pa_volume_t)
return Interfaces.C.double; -- /usr/include/pulse/volume.h:276
pragma Import (C, pa_sw_volume_to_dB, "pa_sw_volume_to_dB");
function pa_sw_volume_from_linear
(v : Interfaces.C.double)
return pa_volume_t; -- /usr/include/pulse/volume.h:280
pragma Import (C, pa_sw_volume_from_linear, "pa_sw_volume_from_linear");
function pa_sw_volume_to_linear
(v : pa_volume_t)
return Interfaces.C.double; -- /usr/include/pulse/volume.h:283
pragma Import (C, pa_sw_volume_to_linear, "pa_sw_volume_to_linear");
function pa_cvolume_remap
(v : access pa_cvolume;
from : access constant Pulse.Channelmap.pa_channel_map;
to : access constant Pulse.Channelmap.pa_channel_map)
return access pa_cvolume; -- /usr/include/pulse/volume.h:293
pragma Import (C, pa_cvolume_remap, "pa_cvolume_remap");
function pa_cvolume_compatible
(v : System.Address;
ss : Pulse.Sample.pa_sample_spec)
return Interfaces.C.int; -- /usr/include/pulse/volume.h:297
pragma Import (C, pa_cvolume_compatible, "pa_cvolume_compatible");
function pa_cvolume_compatible_with_channel_map
(v : System.Address;
cm : access constant Pulse.Channelmap.pa_channel_map)
return Interfaces.C.int; -- /usr/include/pulse/volume.h:301
pragma Import
(C,
pa_cvolume_compatible_with_channel_map,
"pa_cvolume_compatible_with_channel_map");
function pa_cvolume_get_balance
(v : System.Address;
map : access constant Pulse.Channelmap.pa_channel_map)
return Interfaces.C.C_float; -- /usr/include/pulse/volume.h:308
pragma Import (C, pa_cvolume_get_balance, "pa_cvolume_get_balance");
function pa_cvolume_set_balance
(v : access pa_cvolume;
map : access constant Pulse.Channelmap.pa_channel_map;
new_balance : Interfaces.C.C_float)
return access pa_cvolume; -- /usr/include/pulse/volume.h:319
pragma Import (C, pa_cvolume_set_balance, "pa_cvolume_set_balance");
function pa_cvolume_get_fade
(v : System.Address;
map : access constant Pulse.Channelmap.pa_channel_map)
return Interfaces.C.C_float; -- /usr/include/pulse/volume.h:326
pragma Import (C, pa_cvolume_get_fade, "pa_cvolume_get_fade");
function pa_cvolume_set_fade
(v : access pa_cvolume;
map : access constant Pulse.Channelmap.pa_channel_map;
new_fade : Interfaces.C.C_float)
return access pa_cvolume; -- /usr/include/pulse/volume.h:337
pragma Import (C, pa_cvolume_set_fade, "pa_cvolume_set_fade");
function pa_cvolume_scale
(v : access pa_cvolume;
max : pa_volume_t)
return access pa_cvolume; -- /usr/include/pulse/volume.h:342
pragma Import (C, pa_cvolume_scale, "pa_cvolume_scale");
function pa_cvolume_scale_mask
(v : access pa_cvolume;
max : pa_volume_t;
cm : access Pulse.Channelmap.pa_channel_map;
mask : Pulse.Channelmap.pa_channel_position_mask_t)
return access pa_cvolume; -- /usr/include/pulse/volume.h:348
pragma Import (C, pa_cvolume_scale_mask, "pa_cvolume_scale_mask");
function pa_cvolume_set_position
(cv : access pa_cvolume;
map : access constant Pulse.Channelmap.pa_channel_map;
t : Pulse.Channelmap.pa_channel_position_t;
v : pa_volume_t)
return access pa_cvolume; -- /usr/include/pulse/volume.h:355
pragma Import (C, pa_cvolume_set_position, "pa_cvolume_set_position");
function pa_cvolume_get_position
(cv : access pa_cvolume;
map : access constant Pulse.Channelmap.pa_channel_map;
t : Pulse.Channelmap.pa_channel_position_t)
return pa_volume_t; -- /usr/include/pulse/volume.h:361
pragma Import (C, pa_cvolume_get_position, "pa_cvolume_get_position");
function pa_cvolume_merge
(dest : access pa_cvolume;
a : System.Address;
b : System.Address)
return access pa_cvolume; -- /usr/include/pulse/volume.h:366
pragma Import (C, pa_cvolume_merge, "pa_cvolume_merge");
function pa_cvolume_inc_clamp
(v : access pa_cvolume;
inc : pa_volume_t;
limit : pa_volume_t)
return access pa_cvolume; -- /usr/include/pulse/volume.h:370
pragma Import (C, pa_cvolume_inc_clamp, "pa_cvolume_inc_clamp");
function pa_cvolume_inc
(v : access pa_cvolume;
inc : pa_volume_t)
return access pa_cvolume; -- /usr/include/pulse/volume.h:374
pragma Import (C, pa_cvolume_inc, "pa_cvolume_inc");
function pa_cvolume_dec
(v : access pa_cvolume;
dec : pa_volume_t)
return access pa_cvolume; -- /usr/include/pulse/volume.h:378
pragma Import (C, pa_cvolume_dec, "pa_cvolume_dec");
end Pulse.Volume;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/controlled_record.adb | best08618/asylo | 7 | 3313 | <gh_stars>1-10
-- { dg-do compile }
-- { dg-options "-O2" }
with Ada.Text_IO; use Ada.Text_IO;
with Assert;
package body Controlled_Record is
procedure Assert_Invariants (PA : Point_T) is
PB : Point_T;
begin
Assert.Assert (PB.Pos = PA.Pos);
end;
end Controlled_Record;
|
src/main/antlr4/org/cryptocoinpartners/command/Csv.g4 | douggie/cointrader | 399 | 2238 | grammar Csv;
import Base;
args:
filename ('from' startDate)? (('to'|'til') endDate)? ('by' tickDuration)?
;
filename: String ;
startDate: String ;
endDate: String ;
tickDuration: String ; |
src/amd64/display.asm | sts-q/OSDevAsm | 0 | 91187 | <filename>src/amd64/display.asm
;============================================================================
; :file: display.asm
;============================================================================
; :chapter: display
;------------------------------------------
%macro clear_screen 0 ; ( -- )
call clear_screenF
%endmacro
clear_screenF:
mov eax, vga_mem
mov ebx, [vga_attr]
mov ecx, 2000
.loop:
mov [eax], bx
add eax, 2
dec ecx
cmp ecx, 0
jnz .loop
ret
;------------------------------------------
%macro cprint 1-* ; ( chr -- )
%rep %0
mov eax, %1
call cprintF
%rotate 1
%endrep
%endmacro
cprintF:
push rax
mov eax, [vga_line]
mov ebx, 80
imul ebx
add eax, [vga_col]
shl eax, 1
add eax, vga_mem
pop rbx
add ebx, [vga_attr]
mov [eax], bx
inc dword [vga_col]
ret
%macro spc 0 ; ( -- )
cprint 32
%endmacro
;------------------------------------------
%macro printat 2 ; ( line col -- )
mov eax, %1
mov ebx, %2
call printatF
%endmacro
printatF:
mov [vga_line], eax
mov [vga_col], ebx
ret
;------------------------------------------
printattrF:
shl eax, 8
mov [vga_attr], eax
ret
%macro ink_std 0
mov eax, 0x1f
call printattrF
%endmacro
%macro ink_headline 0
mov eax, 0x2a
call printattrF
%endmacro
%macro ink_comment 0
mov eax, 0x17
call printattrF
%endmacro
%macro ink_error 0
mov eax, 0x50
call printattrF
%endmacro
;------------------------------------------
%macro abc 0
call abcF
%endmacro
abcF:
printat 0, 20
cprint 65
cprint 66
ink_headline
cprint 67
spc
cprint 67
cprint 67
spc
cprint 67
ink_std
cprint 66
cprint 65
printat 24, 20
cprint 65
cprint 66
ink_comment
cprint 67
spc
cprint 67
cprint 67
spc
cprint 67
ink_std
cprint 66
cprint 65
ret
;============================================================================
main:
ink_std
clear_screen
abc
ret
;============================================================================
|
runtime/win32/dbl.asm | pedroreissantos/compact | 1 | 25770 | <reponame>pedroreissantos/compact
[global _readr]
[section .text]
_readr:
push edi
push ebp
mov ebp,esp
sub esp,byte 96
push dword 80
lea edi,[ebp + (-80)]
push dword edi
call _readln
add esp,8
mov edi,eax
cmp edi,0
jne near L2
mov eax,0
jmp L1
L2:
lea edi,[ebp + (-80)]
push dword edi
call _atod
add esp,4
fstp qword [ebp + (-96)]
fld qword [ebp + (-96)]
fstp dword [ebp + (-84)]
mov edi,dword [ebp + (-84)]
mov dword [ebp + (-88)],edi
mov eax,dword [ebp + (-88)]
L1:
mov esp,ebp
pop ebp
pop edi
ret
[global _printr]
_printr:
push edi
push ebp
mov ebp,esp
%define P_i 12
sub esp,byte 84
mov edi,dword [ebp + (P_i)]
mov dword [ebp + (-4)],edi
lea edi,[ebp + (-84)]
push dword edi
push dword 7
fld dword [ebp + (-4)]
sub esp,8
fstp qword [esp]
call _dtoa
add esp,16
mov edi,eax
push dword edi
call _prints
add esp,4
L4:
mov esp,ebp
pop ebp
pop edi
ret
[global _readd]
_readd:
push edi
push ebp
mov ebp,esp
sub esp,byte 96
push dword 80
lea edi,[ebp + (-80)]
push dword edi
call _readln
add esp,8
mov edi,eax
cmp edi,0
jne near L6
fld qword [(L8)]
jmp L5
L6:
lea edi,[ebp + (-80)]
push dword edi
call _atod
add esp,4
fstp qword [ebp + (-96)]
fld qword [ebp + (-96)]
fstp qword [ebp + (-88)]
fld qword [ebp + (-88)]
L5:
mov esp,ebp
pop ebp
pop edi
ret
[global _printd]
_printd:
push edi
push ebp
mov ebp,esp
%define P_d 12
sub esp,byte 80
lea edi,[ebp + (-80)]
push dword edi
push dword 7
fld qword [ebp + (P_d)]
sub esp,8
fstp qword [esp]
call _dtoa
add esp,16
mov edi,eax
push dword edi
call _prints
add esp,4
L9:
mov esp,ebp
pop ebp
pop edi
ret
[global _atod]
_atod:
push esi
push edi
push ebp
mov ebp,esp
%define P_s 16
sub esp,byte 20
fld qword [(L8)]
fstp qword [ebp + (-8)]
mov dword [ebp + (-12)],0
mov dword [ebp + (-16)],0
mov dword [ebp + (-20)],1
jmp L12
L11:
inc dword [ebp + (P_s)]
L12:
mov edi,dword [ebp + (P_s)]
movsx edi,byte [edi]
cmp edi,32
je near L11
mov edi,dword [ebp + (P_s)]
movsx edi,byte [edi]
cmp edi,45
jne near L17
mov dword [ebp + (-20)],-1
inc dword [ebp + (P_s)]
jmp L17
L16:
inc dword [ebp + (P_s)]
L17:
mov edi,dword [ebp + (P_s)]
movsx edi,byte [edi]
cmp edi,48
je near L16
jmp L20
L19:
mov edi,dword [ebp + (P_s)]
lea esi,[edi + (1)]
mov dword [ebp + (P_s)],esi
fld qword [(L22)]
fmul qword [ebp + (-8)]
movsx edi,byte [edi]
sub edi,48
push edi
fild dword [esp]
add esp,4
faddp st1
fstp qword [ebp + (-8)]
L20:
mov edi,dword [ebp + (P_s)]
movsx edi,byte [edi]
cmp edi,48
jl near L23
cmp edi,57
jle near L19
L23:
mov edi,dword [ebp + (P_s)]
movsx edi,byte [edi]
cmp edi,46
jne near L24
inc dword [ebp + (P_s)]
jmp L27
L26:
mov edi,dword [ebp + (P_s)]
lea esi,[edi + (1)]
mov dword [ebp + (P_s)],esi
fld qword [(L22)]
fmul qword [ebp + (-8)]
movsx edi,byte [edi]
sub edi,48
push edi
fild dword [esp]
add esp,4
faddp st1
fstp qword [ebp + (-8)]
cmp dword [ebp + (-16)],0
jg near L29
dec dword [ebp + (-16)]
L29:
L27:
mov edi,dword [ebp + (P_s)]
movsx edi,byte [edi]
cmp edi,48
jl near L31
cmp edi,57
jle near L26
L31:
L24:
mov edi,dword [ebp + (P_s)]
movsx edi,byte [edi]
cmp edi,69
je near L34
cmp edi,101
jne near L32
L34:
mov edi,dword [ebp + (P_s)]
lea edi,[edi + (1)]
push dword edi
call _atoi
add esp,4
mov dword [ebp + (-12)],eax
L32:
mov edi,dword [ebp + (-16)]
add dword [ebp + (-12)],edi
cmp dword [ebp + (-12)],0
jle near L41
jmp L38
L37:
fld qword [(L22)]
fmul qword [ebp + (-8)]
fstp qword [ebp + (-8)]
L38:
mov edi,dword [ebp + (-12)]
mov esi,edi
sub esi,1
mov dword [ebp + (-12)],esi
cmp edi,0
jg near L37
jmp L36
L40:
fld qword [ebp + (-8)]
fdiv qword [(L22)]
fstp qword [ebp + (-8)]
L41:
mov edi,dword [ebp + (-12)]
lea esi,[edi + (1)]
mov dword [ebp + (-12)],esi
cmp edi,0
jl near L40
L36:
cmp dword [ebp + (-20)],0
jge near L43
fld qword [ebp + (-8)]
fchs
fstp qword [ebp + (-8)]
L43:
fld qword [ebp + (-8)]
L10:
mov esp,ebp
pop ebp
pop edi
pop esi
ret
[section .bss]
resb ($-$$) & 0
L46:
resb 32
[global _dtoa]
[section .text]
_dtoa:
push ebx
push esi
push edi
push ebp
mov ebp,esp
%define P_d 20
%define P_ndig 28
%define P_s 32
sub esp,byte 24
mov dword [ebp + (-4)],0
mov edi,dword [ebp + (P_s)]
cmp edi,0
jne near L47
lea edi,[(L46)]
mov dword [ebp + (P_s)],edi
L47:
fld qword [(L8)]
fcomp qword [ebp + (P_d)]
fstsw ax
sahf
jne near L49
mov edi,dword [ebp + (P_s)]
mov byte [edi],48
mov edi,dword [ebp + (P_s)]
mov byte [edi + (1)],0
mov eax,dword [ebp + (P_s)]
jmp L45
L49:
fld qword [(L8)]
fcomp qword [ebp + (P_d)]
fstsw ax
sahf
jbe near L51
mov edi,dword [ebp + (-4)]
lea esi,[edi + (1)]
mov dword [ebp + (-4)],esi
mov esi,dword [ebp + (P_s)]
mov byte [esi + edi],45
fld qword [ebp + (P_d)]
fchs
fstp qword [ebp + (P_d)]
L51:
fld qword [(L55)]
fcomp qword [ebp + (P_d)]
fstsw ax
sahf
ja near L53
fld qword [(L55)]
fstp qword [ebp + (-12)]
mov dword [ebp + (-20)],0
jmp L59
L56:
fld qword [(L22)]
fmul qword [ebp + (-12)]
fld qword [ebp + (P_d)]
fcompp
fstsw ax
sahf
jae near L60
jmp L54
L60:
L57:
fld qword [(L22)]
fmul qword [ebp + (-12)]
fstp qword [ebp + (-12)]
inc dword [ebp + (-20)]
L59:
fld qword [(L62)]
fcomp qword [ebp + (-12)]
fstsw ax
sahf
ja near L56
jmp L54
L53:
fld qword [(L67)]
fstp qword [ebp + (-12)]
mov dword [ebp + (-20)],-1
jmp L66
L63:
fld qword [ebp + (P_d)]
fcomp qword [ebp + (-12)]
fstsw ax
sahf
jb near L68
jmp L65
L68:
L64:
fld qword [ebp + (-12)]
fdiv qword [(L22)]
fstp qword [ebp + (-12)]
dec dword [ebp + (-20)]
L66:
fld qword [(L8)]
fcomp qword [ebp + (-12)]
fstsw ax
sahf
jb near L63
L65:
L54:
fld qword [ebp + (P_d)]
fdiv qword [ebp + (-12)]
fstp qword [ebp + (P_d)]
mov dword [ebp + (-16)],0
jmp L73
L70:
fld qword [ebp + (P_d)]
sub esp,byte 4
fistp dword [esp]
pop eax
mov dword [ebp + (-24)],eax
fild dword [ebp + (-24)]
fld qword [ebp + (P_d)]
fcompp
fstsw ax
sahf
jae near L74
dec dword [ebp + (-24)]
L74:
mov edi,dword [ebp + (-4)]
lea esi,[edi + (1)]
mov dword [ebp + (-4)],esi
mov esi,dword [ebp + (P_s)]
mov ebx,dword [ebp + (-24)]
lea ebx,[ebx + (48)]
mov byte [esi + edi],bl
cmp dword [ebp + (-16)],0
jne near L76
mov edi,dword [ebp + (-4)]
lea esi,[edi + (1)]
mov dword [ebp + (-4)],esi
mov esi,dword [ebp + (P_s)]
mov byte [esi + edi],46
L76:
fld qword [(L22)]
fld qword [ebp + (P_d)]
fild dword [ebp + (-24)]
fsubp st1
fmulp st1
fstp qword [ebp + (P_d)]
L71:
inc dword [ebp + (-16)]
L73:
mov edi,dword [ebp + (P_ndig)]
cmp dword [ebp + (-16)],edi
jge near L78
fld qword [(L8)]
fcomp qword [ebp + (P_d)]
fstsw ax
sahf
jne near L70
L78:
fld qword [(L81)]
fcomp qword [ebp + (P_d)]
fstsw ax
sahf
ja near L90
jmp L83
L82:
dec dword [ebp + (-4)]
L83:
mov edi,dword [ebp + (-4)]
sub edi,1
mov esi,dword [ebp + (P_s)]
movsx edi,byte [esi + edi]
cmp edi,57
je near L82
mov edi,dword [ebp + (-4)]
sub edi,1
mov esi,dword [ebp + (P_s)]
movsx edi,byte [esi + edi]
cmp edi,46
je near L85
mov edi,dword [ebp + (-4)]
sub edi,1
mov esi,dword [ebp + (P_s)]
lea edi,[esi + edi]
movsx esi,byte [edi]
lea esi,[esi + (1)]
mov ebx,esi
mov byte [edi],bl
jmp L80
L85:
dec dword [ebp + (-4)]
mov edi,dword [ebp + (-4)]
sub edi,1
mov esi,dword [ebp + (P_s)]
movsx edi,byte [esi + edi]
cmp edi,57
je near L87
mov edi,dword [ebp + (-4)]
sub edi,1
mov esi,dword [ebp + (P_s)]
lea edi,[esi + edi]
movsx esi,byte [edi]
lea esi,[esi + (1)]
mov ebx,esi
mov byte [edi],bl
jmp L80
L87:
mov edi,dword [ebp + (-4)]
sub edi,1
mov esi,dword [ebp + (P_s)]
mov byte [esi + edi],49
inc dword [ebp + (-20)]
jmp L80
L89:
dec dword [ebp + (-4)]
L90:
mov edi,dword [ebp + (-4)]
sub edi,1
mov esi,dword [ebp + (P_s)]
movsx edi,byte [esi + edi]
cmp edi,48
je near L89
L80:
mov edi,dword [ebp + (-4)]
sub edi,1
mov esi,dword [ebp + (P_s)]
movsx edi,byte [esi + edi]
cmp edi,46
jne near L92
dec dword [ebp + (-4)]
L92:
cmp dword [ebp + (-20)],0
je near L94
mov edi,dword [ebp + (-4)]
lea esi,[edi + (1)]
mov dword [ebp + (-4)],esi
mov esi,dword [ebp + (P_s)]
mov byte [esi + edi],69
cmp dword [ebp + (-20)],0
jge near L96
mov edi,dword [ebp + (-4)]
lea esi,[edi + (1)]
mov dword [ebp + (-4)],esi
mov esi,dword [ebp + (P_s)]
mov byte [esi + edi],45
neg dword [ebp + (-20)]
L96:
cmp dword [ebp + (-20)],100
jle near L98
mov edi,dword [ebp + (-4)]
lea esi,[edi + (1)]
mov dword [ebp + (-4)],esi
mov esi,dword [ebp + (P_s)]
mov eax,dword [ebp + (-20)]
mov ebx,100
cdq
idiv ebx
lea ebx,[eax + (48)]
mov byte [esi + edi],bl
mov eax,dword [ebp + (-20)]
mov edi,100
cdq
idiv edi
mov dword [ebp + (-20)],edx
mov edi,dword [ebp + (-4)]
lea esi,[edi + (1)]
mov dword [ebp + (-4)],esi
mov esi,dword [ebp + (P_s)]
mov eax,dword [ebp + (-20)]
mov ebx,10
cdq
idiv ebx
lea ebx,[eax + (48)]
mov byte [esi + edi],bl
mov eax,dword [ebp + (-20)]
mov edi,10
cdq
idiv edi
mov dword [ebp + (-20)],edx
mov edi,dword [ebp + (-4)]
lea esi,[edi + (1)]
mov dword [ebp + (-4)],esi
mov esi,dword [ebp + (P_s)]
mov ebx,dword [ebp + (-20)]
lea ebx,[ebx + (48)]
mov byte [esi + edi],bl
jmp L99
L98:
cmp dword [ebp + (-20)],10
jle near L100
mov edi,dword [ebp + (-4)]
lea esi,[edi + (1)]
mov dword [ebp + (-4)],esi
mov esi,dword [ebp + (P_s)]
mov eax,dword [ebp + (-20)]
mov ebx,10
cdq
idiv ebx
lea ebx,[eax + (48)]
mov byte [esi + edi],bl
mov eax,dword [ebp + (-20)]
mov edi,10
cdq
idiv edi
mov dword [ebp + (-20)],edx
mov edi,dword [ebp + (-4)]
lea esi,[edi + (1)]
mov dword [ebp + (-4)],esi
mov esi,dword [ebp + (P_s)]
mov ebx,dword [ebp + (-20)]
lea ebx,[ebx + (48)]
mov byte [esi + edi],bl
jmp L101
L100:
mov edi,dword [ebp + (-4)]
lea esi,[edi + (1)]
mov dword [ebp + (-4)],esi
mov esi,dword [ebp + (P_s)]
mov ebx,dword [ebp + (-20)]
lea ebx,[ebx + (48)]
mov byte [esi + edi],bl
L101:
L99:
L94:
mov edi,dword [ebp + (-4)]
mov esi,dword [ebp + (P_s)]
mov byte [esi + edi],0
mov eax,dword [ebp + (P_s)]
L45:
mov esp,ebp
pop ebp
pop edi
pop esi
pop ebx
ret
[global _atof]
_atof:
push edi
push ebp
mov ebp,esp
%define P_s 12
sub esp,byte 8
mov edi,dword [ebp + (P_s)]
push dword edi
call _atod
add esp,4
fstp qword [ebp + (-8)]
fld qword [ebp + (-8)]
sub esp,4
fstp dword [esp]
fld dword [esp]
add esp,4
L102:
mov esp,ebp
pop ebp
pop edi
ret
[global _ftoa]
_ftoa:
push edi
push ebp
mov ebp,esp
%define P_f 12
%define P_ndig 16
%define P_s 20
mov edi,dword [ebp + (P_s)]
push dword edi
mov edi,dword [ebp + (P_ndig)]
push dword edi
fld dword [ebp + (P_f)]
sub esp,8
fstp qword [esp]
call _dtoa
add esp,16
mov edi,eax
L103:
mov esp,ebp
pop ebp
pop edi
ret
[extern _prints]
[extern _readln]
[extern _atoi]
[section .data]
times ($-$$) & 3 db 0
L81:
dd 00H
dd 040140000H
times ($-$$) & 3 db 0
L67:
dd 09999999aH
dd 03fb99999H
times ($-$$) & 3 db 0
L62:
dd 0fffffffeH
dd 07fefffffH
times ($-$$) & 3 db 0
L55:
dd 00H
dd 03ff00000H
times ($-$$) & 3 db 0
L22:
dd 00H
dd 040240000H
times ($-$$) & 3 db 0
L8:
dd 00H
dd 00H
|
programs/oeis/165/A165662.asm | karttu/loda | 1 | 86185 | ; A165662: Period 5: repeat 4,4,8,6,8.
; 4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8,4,4,8,6,8
bin $0,2
mul $0,7
mod $0,5
mov $1,$0
mul $1,2
add $1,4
|
Task/Ackermann-function/AppleScript/ackermann-function.applescript | LaudateCorpus1/RosettaCodeData | 1 | 2407 | <gh_stars>1-10
on ackermann(m, n)
if m is equal to 0 then return n + 1
if n is equal to 0 then return ackermann(m - 1, 1)
return ackermann(m - 1, ackermann(m, n - 1))
end ackermann
|
Task/Arithmetic-Complex/Ada/arithmetic-complex.ada | mullikine/RosettaCodeData | 1 | 15679 | with Ada.Numerics.Generic_Complex_Types;
with Ada.Text_IO.Complex_IO;
procedure Complex_Operations is
-- Ada provides a pre-defined generic package for complex types
-- That package contains definitions for composition,
-- negation, addition, subtraction, multiplication, division,
-- conjugation, exponentiation, and absolute value, as well as
-- basic comparison operations.
-- Ada provides a second pre-defined package for sin, cos, tan, cot,
-- arcsin, arccos, arctan, arccot, and the hyperbolic versions of
-- those trigonometric functions.
-- The package Ada.Numerics.Generic_Complex_Types requires definition
-- with the real type to be used in the complex type definition.
package Complex_Types is new Ada.Numerics.Generic_Complex_Types (Long_Float);
use Complex_Types;
package Complex_IO is new Ada.Text_IO.Complex_IO (Complex_Types);
use Complex_IO;
use Ada.Text_IO;
A : Complex := Compose_From_Cartesian (Re => 1.0, Im => 1.0);
B : Complex := Compose_From_Polar (Modulus => 1.0, Argument => 3.14159);
C : Complex;
begin
-- Addition
C := A + B;
Put("A + B = "); Put(C);
New_Line;
-- Multiplication
C := A * B;
Put("A * B = "); Put(C);
New_Line;
-- Inversion
C := 1.0 / A;
Put("1.0 / A = "); Put(C);
New_Line;
-- Negation
C := -A;
Put("-A = "); Put(C);
New_Line;
-- Conjugation
C := Conjugate (C);
end Complex_Operations;
|
examples/protected_lf.adb | ytomino/drake | 33 | 10051 | with Ada;
procedure protected_lf is
protected prot is
pragma Lock_Free;
procedure w (arg : Integer);
function r return Integer;
private
value : Integer := 0;
end prot;
protected body prot is
procedure w (arg: Integer) is
begin
value := arg;
end w;
function r return Integer is
begin
return value;
end r;
end prot;
V : Integer;
begin
prot.w (100);
V := prot.r;
pragma Assert (V = 100);
pragma Debug (Ada.Debug.Put ("OK"));
end protected_lf;
|
factorial.asm | danielzy95/x86-funz | 0 | 19480 | mov eax, 1 ; fact = 1
mov ebx, 6 ; n = 6
mov ecx, 1 ; for i = 1
loop:
cmp ebx, ecx
jl show_result
imul eax, ecx ; fact = fact * i
inc ecx
jmp loop
show_result:
#show eax ; EasyASM directive
|
alloy4fun_models/trashltl/models/1/Qtqtizo6pWpHDmm8g.als | Kaixi26/org.alloytools.alloy | 0 | 2215 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idQtqtizo6pWpHDmm8g_prop2 {
no File
}
pred __repair { idQtqtizo6pWpHDmm8g_prop2 }
check __repair { idQtqtizo6pWpHDmm8g_prop2 <=> prop2o } |
programs/oeis/244/A244477.asm | jmorken/loda | 1 | 86803 | <filename>programs/oeis/244/A244477.asm
; A244477: a(1)=3, a(2)=2, a(3)=1; thereafter a(n) = a(n-a(n-1)) + a(n-a(n-2)).
; 3,2,1,3,5,4,3,8,7,3,11,10,3,14,13,3,17,16,3,20,19,3,23,22,3,26,25,3,29,28,3,32,31,3,35,34,3,38,37,3,41,40,3,44,43,3,47,46,3,50,49,3,53,52,3,56,55,3,59,58,3,62,61,3,65,64,3,68,67,3,71,70,3,74,73,3,77,76,3,80,79,3,83,82,3,86,85,3,89,88,3,92,91,3,95,94,3,98,97,3,101,100,3,104,103,3,107,106,3,110,109,3,113,112,3,116,115,3,119,118,3,122,121,3,125,124,3,128,127,3,131,130,3,134,133,3,137,136,3,140,139,3,143,142,3,146,145,3,149,148,3,152,151,3,155,154,3,158,157,3,161,160,3,164,163,3,167,166,3,170,169,3,173,172,3,176,175,3,179,178,3,182,181,3,185,184,3,188,187,3,191,190,3,194,193,3,197,196,3,200,199,3,203,202,3,206,205,3,209,208,3,212,211,3,215,214,3,218,217,3,221,220,3,224,223,3,227,226,3,230,229,3,233,232,3,236,235,3,239,238,3,242,241,3,245,244,3,248,247,3
mov $1,$0
add $1,4
mov $0,$1
add $1,5
mov $2,$0
mul $0,2
lpb $0
mod $0,3
trn $0,1
mod $2,3
mov $3,$1
mov $1,11
add $3,1
add $2,$3
lpe
add $0,$2
mov $1,$0
sub $1,11
|
source/nodes/program-nodes-attribute_references.adb | optikos/oasis | 0 | 21537 | <gh_stars>0
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Program.Nodes.Attribute_References is
function Create
(Prefix : not null Program.Elements.Expressions
.Expression_Access;
Apostrophe_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Attribute_Designator : not null Program.Elements.Identifiers
.Identifier_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Expressions : Program.Elements.Expressions.Expression_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access)
return Attribute_Reference is
begin
return Result : Attribute_Reference :=
(Prefix => Prefix, Apostrophe_Token => Apostrophe_Token,
Attribute_Designator => Attribute_Designator,
Left_Bracket_Token => Left_Bracket_Token, Expressions => Expressions,
Right_Bracket_Token => Right_Bracket_Token, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Prefix : not null Program.Elements.Expressions
.Expression_Access;
Attribute_Designator : not null Program.Elements.Identifiers
.Identifier_Access;
Expressions : Program.Elements.Expressions.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Attribute_Reference is
begin
return Result : Implicit_Attribute_Reference :=
(Prefix => Prefix, Attribute_Designator => Attribute_Designator,
Expressions => Expressions,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Prefix
(Self : Base_Attribute_Reference)
return not null Program.Elements.Expressions.Expression_Access is
begin
return Self.Prefix;
end Prefix;
overriding function Attribute_Designator
(Self : Base_Attribute_Reference)
return not null Program.Elements.Identifiers.Identifier_Access is
begin
return Self.Attribute_Designator;
end Attribute_Designator;
overriding function Expressions
(Self : Base_Attribute_Reference)
return Program.Elements.Expressions.Expression_Access is
begin
return Self.Expressions;
end Expressions;
overriding function Apostrophe_Token
(Self : Attribute_Reference)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Apostrophe_Token;
end Apostrophe_Token;
overriding function Left_Bracket_Token
(Self : Attribute_Reference)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Left_Bracket_Token;
end Left_Bracket_Token;
overriding function Right_Bracket_Token
(Self : Attribute_Reference)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Right_Bracket_Token;
end Right_Bracket_Token;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Attribute_Reference)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Attribute_Reference)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Attribute_Reference)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
procedure Initialize
(Self : aliased in out Base_Attribute_Reference'Class) is
begin
Set_Enclosing_Element (Self.Prefix, Self'Unchecked_Access);
Set_Enclosing_Element (Self.Attribute_Designator, Self'Unchecked_Access);
if Self.Expressions.Assigned then
Set_Enclosing_Element (Self.Expressions, Self'Unchecked_Access);
end if;
null;
end Initialize;
overriding function Is_Attribute_Reference_Element
(Self : Base_Attribute_Reference)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Attribute_Reference_Element;
overriding function Is_Expression_Element
(Self : Base_Attribute_Reference)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Expression_Element;
overriding procedure Visit
(Self : not null access Base_Attribute_Reference;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Attribute_Reference (Self);
end Visit;
overriding function To_Attribute_Reference_Text
(Self : aliased in out Attribute_Reference)
return Program.Elements.Attribute_References
.Attribute_Reference_Text_Access is
begin
return Self'Unchecked_Access;
end To_Attribute_Reference_Text;
overriding function To_Attribute_Reference_Text
(Self : aliased in out Implicit_Attribute_Reference)
return Program.Elements.Attribute_References
.Attribute_Reference_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Attribute_Reference_Text;
end Program.Nodes.Attribute_References;
|
test/nform.agda | jonaprieto/agda-prop | 13 | 3405 | <reponame>jonaprieto/agda-prop
module nform where
open import Data.PropFormula (3) public
open import Data.PropFormula.NormalForms 3 public
open import Relation.Binary.PropositionalEquality using (_≡_; refl)
p : PropFormula
p = Var (# 0)
q : PropFormula
q = Var (# 1)
r : PropFormula
r = Var (# 2)
φ : PropFormula
φ = ¬ ((p ∧ (p ⊃ q)) ⊃ q) -- (p ∧ q) ∨ (¬ r)
cnfφ : PropFormula
cnfφ = ¬ q ∧ (p ∧ (¬ p ∨ q))
postulate
p1 : ∅ ⊢ φ
p2 : ∅ ⊢ cnfφ
p2 = cnf-lem p1 -- thm-cnf p1
{-
p3 : cnf φ ≡ cnfφ
p3 = refl
ψ : PropFormula
ψ = (¬ r) ∨ (p ∧ q)
cnfψ : PropFormula
cnfψ = (¬ r ∨ p) ∧ (¬ r ∨ q)
p5 : cnf ψ ≡ cnfψ
p5 = refl
-}
to5 = (¬ p) ∨ ((¬ q) ∨ r)
from5 = (¬ p) ∨ (r ∨ ((¬ q) ∧ p))
test : ⌊ eq (cnf from5) to5 ⌋ ≡ false
test = refl
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2199.asm | ljhsiun2/medusa | 9 | 91347 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x13776, %r12
dec %rdi
mov $0x6162636465666768, %r9
movq %r9, %xmm6
and $0xffffffffffffffc0, %r12
vmovaps %ymm6, (%r12)
inc %r10
lea addresses_A_ht+0xdff0, %rsi
lea addresses_UC_ht+0x1d6b6, %rdi
clflush (%rdi)
nop
nop
add $5613, %r8
mov $10, %rcx
rep movsw
cmp $41881, %rsi
lea addresses_normal_ht+0x140b6, %r12
nop
nop
nop
nop
add $20850, %r8
movw $0x6162, (%r12)
add %rcx, %rcx
lea addresses_normal_ht+0x1da8e, %r12
nop
nop
nop
sub $56143, %r8
mov $0x6162636465666768, %rsi
movq %rsi, (%r12)
cmp %r10, %r10
lea addresses_D_ht+0x182b6, %rsi
lea addresses_WT_ht+0x1ab6, %rdi
clflush (%rsi)
clflush (%rdi)
and %rdx, %rdx
mov $32, %rcx
rep movsq
nop
nop
sub %rcx, %rcx
lea addresses_UC_ht+0x8b36, %r10
nop
nop
cmp $41124, %rsi
mov $0x6162636465666768, %r12
movq %r12, %xmm5
movups %xmm5, (%r10)
nop
nop
sub $3266, %r9
lea addresses_WC_ht+0x13eb6, %rcx
nop
nop
nop
nop
lfence
movb (%rcx), %r10b
nop
nop
nop
nop
inc %r9
lea addresses_WC_ht+0xdc36, %r10
nop
nop
nop
nop
xor %rdx, %rdx
mov $0x6162636465666768, %r12
movq %r12, %xmm7
vmovups %ymm7, (%r10)
add %rcx, %rcx
lea addresses_D_ht+0x7eb6, %rdi
nop
nop
nop
and $7222, %r10
movl $0x61626364, (%rdi)
nop
nop
nop
nop
nop
sub %r10, %r10
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r8
push %rax
push %rdi
push %rdx
// Store
lea addresses_A+0xd934, %r11
sub %rdi, %rdi
mov $0x5152535455565758, %rdx
movq %rdx, %xmm6
movups %xmm6, (%r11)
nop
nop
nop
nop
nop
xor %r10, %r10
// Faulty Load
lea addresses_D+0x26b6, %r8
cmp $60018, %rdi
movups (%r8), %xmm2
vpextrq $1, %xmm2, %rdx
lea oracles, %rax
and $0xff, %rdx
shlq $12, %rdx
mov (%rax,%rdx,1), %rdx
pop %rdx
pop %rdi
pop %rax
pop %r8
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_D', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 16, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_D', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 32, 'congruent': 4, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 11, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
src/asf-components-ajax-includes.adb | jquorning/ada-asf | 12 | 17202 | <filename>src/asf-components-ajax-includes.adb<gh_stars>10-100
-----------------------------------------------------------------------
-- components-ajax-includes -- AJAX Include component
-- Copyright (C) 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 ASF.Applications.Main;
with ASF.Applications.Views;
with ASF.Components.Root;
with ASF.Contexts.Writer;
package body ASF.Components.Ajax.Includes is
-- ------------------------------
-- Get the HTML layout that must be used for the include container.
-- The default layout is a "div".
-- Returns "div", "span", "pre", "b".
-- ------------------------------
function Get_Layout (UI : in UIInclude;
Context : in ASF.Contexts.Faces.Faces_Context'Class) return String is
Layout : constant String := UI.Get_Attribute (Name => LAYOUT_ATTR_NAME,
Context => Context,
Default => "div");
begin
if Layout = "div" or Layout = "span" or Layout = "pre" or Layout = "b" then
return Layout;
else
return "div";
end if;
end Get_Layout;
-- ------------------------------
-- The included XHTML file is rendered according to the <b>async</b> attribute:
--
-- When <b>async</b> is false, render the specified XHTML file in such a way that inner
-- forms will be posted on the included view.
--
-- When <b>async</b> is true, trigger an AJAX call to include the specified
-- XHTML view when the page is loaded.
--
--
-- ------------------------------
overriding
procedure Encode_Children (UI : in UIInclude;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
begin
if not UI.Is_Rendered (Context) then
return;
end if;
declare
App : constant ASF.Contexts.Faces.Application_Access := Context.Get_Application;
View_Handler : constant access ASF.Applications.Views.View_Handler'Class
:= App.Get_View_Handler;
Id : constant Ada.Strings.Unbounded.Unbounded_String := UI.Get_Client_Id;
Layout : constant String := UIInclude'Class (UI).Get_Layout (Context);
Async : constant Boolean := UI.Get_Attribute (Name => ASYNC_ATTR_NAME,
Context => Context,
Default => False);
Page : constant String := UI.Get_Attribute (Name => SRC_ATTR_NAME,
Context => Context,
Default => "");
Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer;
begin
Writer.Start_Element (Layout);
UI.Render_Attributes (Context, Writer);
-- In Async mode, generate the javascript code to trigger the async update of
-- the generated div/span.
if Async then
Writer.Write_Attribute ("id", Id);
Writer.Queue_Script ("ASF.Update(null,""");
Writer.Queue_Script (View_Handler.Get_Action_URL (Context, Page));
Writer.Queue_Script (""", ""#");
Writer.Queue_Script (Id);
Writer.Queue_Script (""");");
else
-- Include the view content as if the user fetched the patch. This has almost the
-- same final result except that the inner content is returned now and not by
-- another async http GET request.
declare
View : constant ASF.Components.Root.UIViewRoot := Context.Get_View_Root;
Include_View : ASF.Components.Root.UIViewRoot;
Is_Ajax : constant Boolean := Context.Is_Ajax_Request;
Content_Type : constant String := Context.Get_Response.Get_Content_Type;
begin
Context.Set_Ajax_Request (True);
View_Handler.Restore_View (Page, Context, Include_View);
Context.Set_View_Root (Include_View);
View_Handler.Render_View (Context, Include_View);
Context.Get_Response.Set_Content_Type (Content_Type);
Context.Set_View_Root (View);
Context.Set_Ajax_Request (Is_Ajax);
exception
when others =>
Context.Get_Response.Set_Content_Type (Content_Type);
Context.Set_View_Root (View);
Context.Set_Ajax_Request (Is_Ajax);
raise;
end;
end if;
Writer.End_Element (Layout);
end;
end Encode_Children;
end ASF.Components.Ajax.Includes;
|
gyak/gyak6/B1/duplication.ads | balintsoos/LearnAda | 0 | 30197 | generic
type Elem is private;
type Index is (<>);
type Tomb is array (Index range <>) of Elem;
function Duplication (T: in out Tomb) return Boolean;
|
programs/oeis/157/A157651.asm | neoneye/loda | 22 | 3665 | ; A157651: a(n) = 100*n^2 - 49*n + 6.
; 57,308,759,1410,2261,3312,4563,6014,7665,9516,11567,13818,16269,18920,21771,24822,28073,31524,35175,39026,43077,47328,51779,56430,61281,66332,71583,77034,82685,88536,94587,100838,107289,113940,120791,127842,135093,142544,150195,158046,166097,174348,182799,191450,200301,209352,218603,228054,237705,247556,257607,267858,278309,288960,299811,310862,322113,333564,345215,357066,369117,381368,393819,406470,419321,432372,445623,459074,472725,486576,500627,514878,529329,543980,558831,573882,589133,604584,620235,636086,652137,668388,684839,701490,718341,735392,752643,770094,787745,805596,823647,841898,860349,879000,897851,916902,936153,955604,975255,995106
mov $1,$0
mul $0,10
pow $0,2
add $0,57
mov $2,$1
mul $2,151
add $0,$2
|
maps/Route16.asm | Dev727/ancientplatinum | 28 | 9551 | Route16_MapScripts:
db 0 ; scene scripts
db 1 ; callbacks
callback MAPCALLBACK_NEWMAP, .AlwaysOnBike
.AlwaysOnBike:
readvar VAR_YCOORD
ifless 5, .CanWalk
readvar VAR_XCOORD
ifgreater 13, .CanWalk
setflag ENGINE_ALWAYS_ON_BIKE
return
.CanWalk:
clearflag ENGINE_ALWAYS_ON_BIKE
return
CyclingRoadSign:
jumptext CyclingRoadSignText
CyclingRoadSignText:
text "CYCLING ROAD"
para "DOWNHILL COASTING"
line "ALL THE WAY!"
done
Route16_MapEvents:
db 0, 0 ; filler
db 5 ; warp events
warp_event 3, 1, ROUTE_16_FUCHSIA_SPEECH_HOUSE, 1
warp_event 14, 6, ROUTE_16_GATE, 3
warp_event 14, 7, ROUTE_16_GATE, 4
warp_event 9, 6, ROUTE_16_GATE, 1
warp_event 9, 7, ROUTE_16_GATE, 2
db 0 ; coord events
db 1 ; bg events
bg_event 5, 5, BGEVENT_READ, CyclingRoadSign
db 0 ; object events
|
programs/oeis/010/A010016.asm | karttu/loda | 1 | 82144 | ; A010016: a(0) = 1, a(n) = 26*n^2 + 2 for n>0.
; 1,28,106,236,418,652,938,1276,1666,2108,2602,3148,3746,4396,5098,5852,6658,7516,8426,9388,10402,11468,12586,13756,14978,16252,17578,18956,20386,21868,23402,24988,26626,28316,30058,31852,33698,35596,37546,39548,41602,43708,45866,48076,50338,52652,55018,57436,59906,62428,65002,67628,70306,73036,75818,78652,81538,84476,87466,90508,93602,96748,99946,103196,106498,109852,113258,116716,120226,123788,127402,131068,134786,138556,142378,146252,150178,154156,158186,162268,166402,170588,174826,179116,183458,187852,192298,196796,201346,205948,210602,215308,220066,224876,229738,234652,239618,244636,249706,254828,260002,265228,270506,275836,281218,286652,292138,297676,303266,308908,314602,320348,326146,331996,337898,343852,349858,355916,362026,368188,374402,380668,386986,393356,399778,406252,412778,419356,425986,432668,439402,446188,453026,459916,466858,473852,480898,487996,495146,502348,509602,516908,524266,531676,539138,546652,554218,561836,569506,577228,585002,592828,600706,608636,616618,624652,632738,640876,649066,657308,665602,673948,682346,690796,699298,707852,716458,725116,733826,742588,751402,760268,769186,778156,787178,796252,805378,814556,823786,833068,842402,851788,861226,870716,880258,889852,899498,909196,918946,928748,938602,948508,958466,968476,978538,988652,998818,1009036,1019306,1029628,1040002,1050428,1060906,1071436,1082018,1092652,1103338,1114076,1124866,1135708,1146602,1157548,1168546,1179596,1190698,1201852,1213058,1224316,1235626,1246988,1258402,1269868,1281386,1292956,1304578,1316252,1327978,1339756,1351586,1363468,1375402,1387388,1399426,1411516,1423658,1435852,1448098,1460396,1472746,1485148,1497602,1510108,1522666,1535276,1547938,1560652,1573418,1586236,1599106,1612028
pow $1,$0
gcd $1,2
mov $3,$0
mul $3,$0
mov $2,$3
mul $2,26
add $1,$2
|
text/unused_names.asm | etdv-thevoid/pokemon-rgb-enhanced | 9 | 21531 | UnusedNames::
db "かみなりバッヂ@"
db "かいがらバッヂ@"
db "おじぞうバッヂ@"
db "はやぶさバッヂ@"
db "ひんやりバッヂ@"
db "なかよしバッヂ@"
db "バラバッヂ@"
db "ひのたまバッヂ@"
db "ゴールドバッヂ@"
db "たまご@"
db "ひよこ@"
db "ブロンズ@"
db "シルバー@"
db "ゴールド@"
db "プチキャプテン@"
db "キャプテン@"
db "プチマスター@"
db "マスター@"
db "エクセレント"
|
agda/topic/order/2013-04-01-sorting-francesco-mazzo/x2-Sort.agda | haroldcarr/learn-haskell-coq-ml-etc | 36 | 15832 | open import x1-Base
module x2-Sort
{X : Set}
{_≈_ : Rel X}
{_≤_ : Rel X}
(_≤?_ : Decidable _≤_)
(ord : TotalOrder _≈_ _≤_)
where
open TotalOrder ord using (total; equivalence)
open Equivalence equivalence using (refl)
-- represent bounded lists, but want bounds to be open
-- so lift X in a type that contains a top and bottom elements
data ⊥X⊤ : Set where
⊤ ⊥ : ⊥X⊤
⟦_⟧ : X → ⊥X⊤
-- lift ordering to work with ⊥X⊤
data _≤̂_ : Rel ⊥X⊤ where
⊥≤̂ : ∀ {x} → ⊥ ≤̂ x
≤̂⊤ : ∀ {x} → x ≤̂ ⊤
≤-lift : ∀ {x y} → x ≤ y → ⟦ x ⟧ ≤̂ ⟦ y ⟧
-- bounded, ordered lists
-- elements ordered according to ≤ relation
data OList (l u : ⊥X⊤) : Set where
-- nil works with any bounds l ≤ u
nil : l ≤̂ u
→ OList l u
-- cons x to a list with x as a lower bound,
-- return a list with lower bound l, l ≤̂ ⟦ x ⟧
cons : ∀ x
(xs : OList ⟦ x ⟧ u)
→ l ≤̂ ⟦ x ⟧
→ OList l u
toList : ∀ {l u} → OList l u → List X
toList (nil _) = []
toList (cons x xs _) = x ∷ toList xs
insert : ∀ {l u} x
→ OList l u
→ l ≤̂ ⟦ x ⟧
→ ⟦ x ⟧ ≤̂ u
→ OList l u
insert x (nil _) l≤̂⟦x⟧ ⟦x⟧≤̂u =
cons x (nil ⟦x⟧≤̂u)
l≤̂⟦x⟧
insert x L@(cons x' xs l≤̂⟦x'⟧) l≤̂⟦x⟧ ⟦x⟧≤̂u with x ≤? x'
... | left x≤x' =
cons x (cons x' xs (≤-lift x≤x'))
l≤̂⟦x⟧
... | (right x≤x'→Empty) =
cons x' (insert x xs ([ ≤-lift
, (λ y≤x → absurd (x≤x'→Empty y≤x)) ]
(total x' x))
⟦x⟧≤̂u)
l≤̂⟦x'⟧
-- Insertion sort uses OList ⊥ ⊤ to represent a sorted list with open bounds:
isort' : List X → OList ⊥ ⊤
isort' = foldr (λ x xs → insert x xs ⊥≤̂ ≤̂⊤) (nil ⊥≤̂)
isort : List X → List X
isort xs = toList (isort' xs)
------------------------------------------------------------------------------
-- Tree sort (more efficient)
-- bounded, ordered binary tree
data Tree (l u : ⊥X⊤) : Set where
leaf : l ≤̂ u
→ Tree l u
node : (x : X)
→ Tree l ⟦ x ⟧
→ Tree ⟦ x ⟧ u
→ Tree l u
t-insert : ∀ {l u}
→ (x : X)
→ Tree l u
→ l ≤̂ ⟦ x ⟧
→ ⟦ x ⟧ ≤̂ u
→ Tree l u
t-insert x (leaf _) l≤x x≤u =
node x (leaf l≤x) (leaf x≤u)
t-insert x (node y ly yu) l≤x x≤u with x ≤? y
... | left x≤y =
node y (t-insert x ly l≤x (≤-lift x≤y)) yu
... | right x>y =
node y ly (t-insert x yu ([ (λ x≤y → absurd (x>y x≤y)) , ≤-lift ] (total x y)) x≤u)
t-fromList : List X → Tree ⊥ ⊤
t-fromList = foldr (λ x xs → t-insert x xs ⊥≤̂ ≤̂⊤) (leaf ⊥≤̂)
-- OList concatenation, including inserting a new element in the middle
_⇒_++_ : ∀ {l u} x
→ OList l ⟦ x ⟧
→ OList ⟦ x ⟧ u
→ OList l u
x ⇒ nil l≤u ++ xu = cons x xu l≤u
x ⇒ cons y yx l≤y ++ xu = cons y (x ⇒ yx ++ xu) l≤y
t-flatten : ∀ {l u} → Tree l u → OList l u
t-flatten (leaf l≤u) = (nil l≤u)
t-flatten (node x lx xu) = x ⇒ t-flatten lx ++ t-flatten xu
t-sort' : List X → OList ⊥ ⊤
t-sort' xs = t-flatten (foldr (λ x xs → t-insert x xs ⊥≤̂ ≤̂⊤) (leaf ⊥≤̂) xs)
t-sort : List X → List X
t-sort xs = toList (t-sort' xs)
|
awa/src/awa-events-queues-persistents.adb | My-Colaborations/ada-awa | 81 | 7582 | -----------------------------------------------------------------------
-- awa-events-queues-persistents -- AWA Event Queues
-- Copyright (C) 2012, 2013, 2014, 2017, 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 Ada.Calendar;
with Util.Log.Loggers;
with Util.Serialize.Tools;
with AWA.Services.Contexts;
with AWA.Applications;
with AWA.Events.Services;
with AWA.Users.Models;
with ADO;
with ADO.Sessions;
with ADO.SQL;
package body AWA.Events.Queues.Persistents is
package ASC renames AWA.Services.Contexts;
use Util.Log;
Log : constant Loggers.Logger := Loggers.Create ("AWA.Events.Queues.Persistents");
-- ------------------------------
-- Get the queue name.
-- ------------------------------
overriding
function Get_Name (From : in Persistent_Queue) return String is
begin
return From.Name;
end Get_Name;
-- ------------------------------
-- Get the model queue reference object.
-- Returns a null object if the queue is not persistent.
-- ------------------------------
overriding
function Get_Queue (From : in Persistent_Queue) return Models.Queue_Ref is
begin
return From.Queue;
end Get_Queue;
-- ------------------------------
-- Queue the event. The event is saved in the database with a relation to
-- the user, the user session, the event queue and the event type.
-- ------------------------------
overriding
procedure Enqueue (Into : in out Persistent_Queue;
Event : in AWA.Events.Module_Event'Class) is
procedure Set_Event (Manager : in out AWA.Events.Services.Event_Manager);
Ctx : constant ASC.Service_Context_Access := ASC.Current;
App : constant AWA.Applications.Application_Access := Ctx.Get_Application;
DB : ADO.Sessions.Master_Session := ASC.Get_Master_Session (Ctx);
Msg : AWA.Events.Models.Message_Ref;
procedure Set_Event (Manager : in out AWA.Events.Services.Event_Manager) is
begin
Manager.Set_Message_Type (Msg, Event.Get_Event_Kind);
end Set_Event;
begin
App.Do_Event_Manager (Set_Event'Access);
Ctx.Start;
Msg.Set_Queue (Into.Queue);
Msg.Set_User (Ctx.Get_User);
Msg.Set_Session (Ctx.Get_User_Session);
Msg.Set_Create_Date (Event.Get_Time);
Msg.Set_Status (AWA.Events.Models.QUEUED);
Msg.Set_Entity_Id (Event.Get_Entity_Identifier);
Msg.Set_Entity_Type (Event.Entity_Type);
-- Collect the event parameters in a string and format the result in JSON.
Msg.Set_Parameters (Util.Serialize.Tools.To_JSON (Event.Props));
Msg.Save (DB);
Ctx.Commit;
Log.Info ("Event {0} created", ADO.Identifier'Image (Msg.Get_Id));
end Enqueue;
overriding
procedure Dequeue (From : in out Persistent_Queue;
Process : access procedure (Event : in Module_Event'Class)) is
-- Prepare the message by indicating in the database it is going
-- to be processed by the given server and task.
procedure Prepare_Message (Msg : in out Models.Message_Ref);
-- Dispatch the event.
procedure Dispatch_Message (Msg : in out Models.Message_Ref);
-- Finish processing the message by marking it as being processed.
procedure Finish_Message (Msg : in out Models.Message_Ref);
Ctx : constant ASC.Service_Context_Access := ASC.Current;
DB : ADO.Sessions.Master_Session := ASC.Get_Master_Session (Ctx);
Messages : Models.Message_Vector;
Query : ADO.SQL.Query;
Task_Id : constant Integer := 0;
procedure Prepare_Message (Msg : in out Models.Message_Ref) is
begin
Msg.Set_Status (Models.PROCESSING);
Msg.Set_Server_Id (From.Server_Id);
Msg.Set_Task_Id (Task_Id);
Msg.Set_Processing_Date
(ADO.Nullable_Time '(Is_Null => False,
Value => Ada.Calendar.Clock));
Msg.Save (DB);
end Prepare_Message;
procedure Dispatch_Message (Msg : in out Models.Message_Ref) is
User : constant AWA.Users.Models.User_Ref'Class := Msg.Get_User;
Session : constant AWA.Users.Models.Session_Ref'Class := Msg.Get_Session;
Name : constant String := Msg.Get_Message_Type.Get_Name;
Event : Module_Event;
procedure Action;
procedure Action is
begin
Process (Event);
end Action;
procedure Run is new AWA.Services.Contexts.Run_As (Action);
begin
Event.Set_Event_Kind (AWA.Events.Find_Event_Index (Name));
Util.Serialize.Tools.From_JSON (Msg.Get_Parameters, Event.Props);
Event.Set_Entity_Identifier (Msg.Get_Entity_Id);
Event.Entity_Type := Msg.Get_Entity_Type;
if not User.Is_Null then
Log.Info ("Dispatching event {0} for user{1} session{2}", Name,
ADO.Identifier'Image (User.Get_Id),
ADO.Identifier'Image (Session.Get_Id));
else
Log.Info ("Dispatching event {0}", Name);
end if;
-- Run the Process action on behalf of the user associated
-- with the message.
Run (AWA.Users.Models.User_Ref (User),
AWA.Users.Models.Session_Ref (Session));
exception
when E : others =>
Log.Error ("Exception when processing event " & Name, E, True);
end Dispatch_Message;
-- ------------------------------
-- Finish processing the message by marking it as being processed.
-- ------------------------------
procedure Finish_Message (Msg : in out Models.Message_Ref) is
begin
Msg.Set_Status (Models.PROCESSED);
Msg.Set_Finish_Date (ADO.Nullable_Time '(Is_Null => False,
Value => Ada.Calendar.Clock));
Msg.Save (DB);
end Finish_Message;
Count : Natural;
begin
Ctx.Start;
Query.Set_Filter ("o.status = 0 AND o.queue_id = :queue "
& "ORDER BY o.priority DESC, "
& "o.id ASC LIMIT :max");
Query.Bind_Param ("queue", From.Queue.Get_Id);
Query.Bind_Param ("max", From.Max_Batch);
Models.List (Messages, DB, Query);
Count := Natural (Messages.Length);
-- Prepare the event messages by marking them in the database.
-- This makes sure that no other server or task (if any), will process them.
if Count > 0 then
for I in 1 .. Count loop
Messages.Update_Element (Index => I,
Process => Prepare_Message'Access);
end loop;
end if;
Ctx.Commit;
if Count = 0 then
return;
end if;
Log.Info ("Dispatching {0} events", Natural'Image (Count));
-- Dispatch each event.
for I in 1 .. Count loop
Messages.Update_Element (Index => I,
Process => Dispatch_Message'Access);
end loop;
-- After having dispatched the events, mark them as dispatched in the queue.
Ctx.Start;
for I in 1 .. Count loop
Messages.Update_Element (Index => I,
Process => Finish_Message'Access);
end loop;
Ctx.Commit;
end Dequeue;
-- ------------------------------
-- Create the queue associated with the given name and configure it by using
-- the configuration properties.
-- ------------------------------
function Create_Queue (Name : in String;
Props : in EL.Beans.Param_Vectors.Vector;
Context : in EL.Contexts.ELContext'Class) return Queue_Access is
pragma Unreferenced (Props, Context);
Ctx : constant ASC.Service_Context_Access := ASC.Current;
Session : ADO.Sessions.Master_Session := ASC.Get_Master_Session (Ctx);
Queue : AWA.Events.Models.Queue_Ref;
Query : ADO.SQL.Query;
Found : Boolean;
begin
Session.Begin_Transaction;
-- Find the queue instance which matches the name.
Query.Set_Filter ("o.name = ?");
Query.Add_Param (Name);
Queue.Find (Session => Session,
Query => Query,
Found => Found);
-- But create the queue instance if it does not exist.
if not Found then
Log.Info ("Creating database queue {0}", Name);
Queue.Set_Name (Name);
Queue.Save (Session);
else
Log.Info ("Using database queue {0}", Name);
end if;
Session.Commit;
return new Persistent_Queue '(Name_Length => Name'Length,
Name => Name,
Queue => Queue,
others => <>);
end Create_Queue;
end AWA.Events.Queues.Persistents;
|
oeis/045/A045375.asm | neoneye/loda-programs | 11 | 89617 | <filename>oeis/045/A045375.asm
; A045375: Primes congruent to {1, 2} mod 6.
; Submitted by <NAME>
; 2,7,13,19,31,37,43,61,67,73,79,97,103,109,127,139,151,157,163,181,193,199,211,223,229,241,271,277,283,307,313,331,337,349,367,373,379,397,409,421,433,439,457,463,487,499,523,541,547,571,577,601,607,613,619,631,643,661,673,691
mov $2,$0
pow $2,2
lpb $2
mov $3,$1
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,6
mov $4,$0
max $4,1
cmp $4,$0
mul $2,$4
sub $2,1
lpe
sub $1,$0
mov $0,$1
add $0,2
|
src/qweyboard/qweyboard.ads | kqr/qweyboard | 33 | 2506 | with Unicode_Strings; use Unicode_Strings;
with Ada.Containers.Ordered_Sets;
package Qweyboard is
use Unbounded;
-- Letter keys declared in the order they're likely to appear in words
--
-- Quoted from patent, although not strictly followed here...
--
-- > For example, in English, the initial consonants of the syllable are
-- > ordered according to the following priority scheme or rule: "X, Z, S, B,
-- > P, G, QU, Q, C, D, T, V, W, F, J, H, K, L, M, R, N". The final consonants
-- > are sorted according to the following priority rules: "V, L, M, R, W, N,
-- > G, K, C, X, B, P, H, D, S, E, F, T, Y, Z", where the E is meant as a final
-- > mute "E" at the end of word
type Softkey is
(LZ, LS, LF, LC, LT, LP, LR, LJ, LK, LL, LN,
LE, LO, LI, MY, MA, MU, MAPO, RO, RI, RE,
RN, RL, RK, RJ, RR, RP, RT, RC, RF, RS, RZ,
-- Special keys that exist on the real hardware
MSHI, CAPI, NOSP,
-- Special keys we want (backspace, suspend and "no modifier pressed")
SUSP, NOKEY);
package Key_Sets is new Ada.Containers.Ordered_Sets (Element_Type => Softkey);
type Key_Event_Variant_Type is (Key_Press, Key_Release);
type Key_Event is record
Key : Softkey;
Key_Event_Variant : Key_Event_Variant_Type;
end record;
type Output_Variant is (Nothing, Syllable, Erase);
type Output (Variant : Output_Variant := Nothing) is record
case Variant is
when Nothing =>
null;
when Syllable =>
Text : Unbounded_Wide_Wide_String;
Continues_Word : Boolean;
when Erase =>
Amount : Positive;
end case;
end record;
end Qweyboard;
|
src/bplm/bplm.g4 | uxnt/bplm | 1 | 3530 | grammar bplm;
options {
language = Cpp;
}
//Ignores
WS: [\t\n\r ]+->skip;
LineComment: ('//'|'#').*?[\n\r]->skip;
BlockComment: '/*'.*?'*/'->skip;
//Keys
Import: 'plug';
Export: 'export';
Of: 'of';
Static: 'static';
Extern: 'extern';
True: 'true';
False: 'false';
Null: 'null';
Func: 'func';
Class: 'class';
Struct: 'struct';
Enum: 'enum';
Interface: 'interface';
Template: 'template';
Abstract: 'abstract';
Override: 'override';
Public: 'public';
Protected: 'protected';
Private: 'private';
Internal: 'internal';
Friendly: 'friendly';
Friend: 'friend';
If: 'if';
Else: 'else';
Elif: 'elif';
Switch: 'switch';
For: 'for';
Foreach: 'foreach';
While: 'while';
Do: 'do';
Break: 'break';
Continue: 'continue';
Return: 'return';
Yield: 'yield';
//Native Types
Num: 'num';
Byte: 'byte';
Short: 'short';
Int: 'int';
Long: 'long';
Float: 'float';
Double: 'double';
Bool: 'bool';
String: 'string';
Char: 'char';
Var: 'var';
Point: 'point';
Function: 'function';
Reference: 'reference';
Object: 'object';
//Symbols
Comma: ',';
Question : '?';
SemiColon : ';';
Colon: ':';
LeftParen: '(';
RightParen: ')';
LeftBracket: '[';
RightBracket: ']';
LeftBrace: '{';
RightBrace: '}';
LeftShift : '<<';
ARightShift : '>>';
LRightShift : '>>>';
Plus : '+';
Increase : '++';
Minus : '-';
Decrease : '--';
Star : '*';
Div : '/';
Mod : '%';
And : '&';
LogicAnd : '&&';
Or : '|';
LogicOr : '||';
Xor : '^';
Not : '!';
Tilde : '~';
Assign : '=';
MulAssign : '*=';
DivAssign : '/=';
ModAssign : '%=';
PlusAssign : '+=';
MinusAssign : '-=';
LeftShiftAssign : '<<=';
ARightShiftAssign : '>>=';
LRightShiftAssign : '>>>=';
AndAssign : '&=';
XorAssign : '^=';
OrAssign : '|=';
Less : '<';
LessEqual : '<=';
Greater : '>';
GreaterEqual : '>=';
Equal : '==';
NotEqual : '!=';
Arrow : '->';
Dot : '.';
Ellipsis : '...';
Dollar: '$';
//Constants
BinNum: '-'?'1'([0-1])*'b';
OctNum: '-'?'0'([1-7])([0-7])*;
DecNum: '-'?([1-9])([0-9])* | '0';
HexNum: '-'?'0x'([1-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])*;
FloatNum: '-'?([1-9])([0-9])*'.'([0-9])*;
Identifier: ([a-z]|[A-Z]|'_')([0-9]|[a-z]|[A-Z]|'_')*;
StringConstant: '"'.*?'"';
//Grammars
num: BinNum | OctNum | DecNum | HexNum | FloatNum;
constant: StringConstant | num;
primExpr
: constant
| Identifier
| '('expr')'
;
postExpr
: primExpr
(postOp)*
(incOrDecOp)*
;
postOp
: '['expr']'
| '('args')'
| ('.') Identifier
;
unaryExpr
:
(incOrDecOp)*
( postExpr
| unaryOp castExpr
)
;
unaryOp
: '-'|'~'|'!'
;
incOrDecOp
: '++' | '--'
;
castExpr
: unaryExpr
| num
;
mulExpr
: castExpr (mulOp castExpr)*
;
mulOp
: '*' | '/' | '%'
;
addExpr
: mulExpr (addOp mulExpr)*
;
addOp
: '+' | '-'
;
shiftExpr
: addExpr (shiftOp addExpr)*
;
shiftOp
: '<<' | '>>' | '>>>'
;
cmpExpr
: shiftExpr (cmpOp shiftExpr)*
;
cmpOp
: '<'|'>'|'<='|'>='|'=='|'!='
;
andExpr
: cmpExpr ( '&' cmpExpr)*
;
xorExpr
: andExpr ('^' andExpr)*
;
orExpr
: xorExpr ('|' xorExpr)*
;
logicAndExpr
: orExpr ('&&' orExpr)*
;
logicOrExpr
: logicAndExpr ( '||' logicAndExpr)*
;
quesExpr
: logicOrExpr ('?' expr ':' quesExpr)?
;
sigmaExpr
:
;
assignExpr
: constant
| postExpr assignOp assignExpr
| quesExpr
;
assignOp
: '='|'*='|'/='|'%='|'+='|'-='|'<<='|'>>='|'&='|'^='|'|='|'>>>='
;
args
: (expr(','expr)*)?
;
expr
: assignExpr
;
library
: Identifier('.'Identifier)*
;
importStmt
: 'import' library ';'
;
type
: 'num'
| 'byte'
| 'short'
| 'int'
| 'long'
| 'bool'
| 'string'
| 'float'
| 'double'
| 'char'
| 'var'
| 'point'
| 'function''('type*')'':'type
| library
| type'[]'
;
argsNeed
: (type Identifier(','type Identifier)*)?
;
program
: stmt*
;
stmt
: expr';'
| ';'
| defVarStmt
| returnStmt
| ifStmt
| forStmt
| whileStmt
| doWhileStmt
| breakStmt
| continueStmt
;
returnStmt
: 'return' expr? ';'
;
defVarStmt
: type Identifier('='expr)?';'
;
stmtBody
:'{' program '}'
| stmt
;
ifStmt
: 'if' '(' logicOrExpr ')' stmtBody
('elif' '(' logicOrExpr ')' stmtBody)*
('else' stmtBody)?
;
forStmt
: 'for' '(' stmt logicOrExpr ';' expr ')' stmtBody
;
whileStmt
: 'while' '('logicOrExpr')' stmtBody
;
doWhileStmt
: 'do' '{' program '}' 'while' '('logicOrExpr')'';'
;
breakStmt
: 'break'';'
;
continueStmt
: 'continue'';'
;
defFuncStmt
: 'export'? 'func' Identifier '('argsNeed')' (':'type)? '{'program'}'
;
defGlobalVarStmt
: 'export'? defVarStmt
;
externFuncStmt
: 'extern' 'func' Identifier '('argsNeed')' (':'type)';'
;
stat
: importStmt*statStmts*
;
statStmts
: defGlobalVarStmt
| defFuncStmt
| externFuncStmt
;
|
Task/Topological-sort/Ada/topological-sort-4.ada | LaudateCorpus1/RosettaCodeData | 1 | 15575 | <filename>Task/Topological-sort/Ada/topological-sort-4.ada
package body Set_Of_Names is
use type Ada.Containers.Count_Type, Vecs.Cursor;
function Start(Names: Set) return Index_Type is
begin
if Names.Length = 0 then
return 1;
else
return Names.First_Index;
end if;
end Start;
function Stop(Names: Set) return Index_Type_With_Null is
begin
if Names.Length=0 then
return 0;
else
return Names.Last_Index;
end if;
end Stop;
function Size(Names: Set) return Index_Type_With_Null is
begin
return Index_Type_With_Null(Names.Length);
end Size;
procedure Add(Names: in out Set; Name: String; Index: out Index_Type) is
I: Index_Type_With_Null := Names.Idx(Name);
begin
if I = 0 then -- Name is not yet in Set
Names.Append(Name);
Index := Names.Stop;
else
Index := I;
end if;
end Add;
procedure Add(Names: in out Set; Name: String) is
I: Index_Type;
begin
Names.Add(Name, I);
end Add;
procedure Sub(Names: in out Set; Name: String) is
I: Index_Type_With_Null := Names.Idx(Name);
begin
if I /= 0 then -- Name is in set
Names.Delete(I);
end if;
end Sub;
function Idx(Names: Set; Name: String) return Index_Type_With_Null is
begin
for I in Names.First_Index .. Names.Last_Index loop
if Names.Element(I) = Name then
return I;
end if;
end loop;
return 0;
end Idx;
function Name(Names: Set; Index: Index_Type) return String is
begin
return Names.Element(Index);
end Name;
end Set_Of_Names;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.