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 |
|---|---|---|---|---|
libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sdcc_ix/esx_ide_browser_callee.asm | jpoikela/z88dk | 640 | 176829 | ; unsigned char esx_ide_browser(uint8_t browsercaps, void *filetypes, char *help, char *dst_sfn, char *dst_lfn)
SECTION code_esxdos
PUBLIC _esx_ide_browser_callee
PUBLIC l0_esx_ide_browser_callee
EXTERN asm_esx_ide_browser
_esx_ide_browser_callee:
pop hl
dec sp
pop af
exx
pop bc
exx
pop de
pop bc
ex (sp),hl
ex de,hl
l0_esx_ide_browser_callee:
exx
push bc
exx
ex (sp),ix
push iy
call asm_esx_ide_browser
pop iy
pop ix
ret
|
source/PushDialer.popclipext/PushDialerCall.applescript | cnstntn-kndrtv/PopClip-Extensions | 1,262 | 2139 | <reponame>cnstntn-kndrtv/PopClip-Extensions<filename>source/PushDialer.popclipext/PushDialerCall.applescript
on run
set theString to "{popclip text}" as text
set theString to replace_chars(theString, "(0)", "")
set theAllowedCharacters to {"+", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ",", " ", ";", "(", ")", "-"}
set itemized to every character of theString
set theNewString to ""
tell application "Finder"
repeat with i from 1 to number of items of itemized
if theAllowedCharacters contains (item i of itemized) then
set theNewString to theNewString & item i of itemized
end if
end repeat
end tell
open location "pushdialer://" & trim(theNewString)
return theNewString
end run
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
on trim(someText)
repeat until someText does not start with " "
set someText to text 2 thru -1 of someText
end repeat
repeat until someText does not end with " "
set someText to text 1 thru -2 of someText
end repeat
return someText
end trim |
examples/asm/8x8 matrix test.asm | nickgammon/G-Pascal | 7 | 97507 | <reponame>nickgammon/G-Pascal
;---------------------------------------------
;
; Demonstration of writing a message to 8 x 64 pixel
; dot matrix display, using 8 x MAX7219 chips
;
;---------------------------------------------
jmp begin
;---------------------------------------------
; MAX7219 registers
;---------------------------------------------
MAX7219_REG_NOOP = $00 ; No operation - used for cascading multiple chips
MAX7219_REG_DIGIT0 = $01 ; Write to digit 1
MAX7219_REG_DIGIT1 = $02 ; Write to digit 2
MAX7219_REG_DIGIT2 = $03 ; Write to digit 3
MAX7219_REG_DIGIT3 = $04 ; Write to digit 4
MAX7219_REG_DIGIT4 = $05 ; Write to digit 5
MAX7219_REG_DIGIT5 = $06 ; Write to digit 6
MAX7219_REG_DIGIT6 = $07 ; Write to digit 7
MAX7219_REG_DIGIT7 = $08 ; Write to digit 8
MAX7219_REG_DECODEMODE = $09 ; Decode mode for each digit: 1 = decode, 0 = no decode (one bit per digit)
MAX7219_REG_INTENSITY = $0A ; Intensity: 0x00 to 0x0F
MAX7219_REG_SCANLIMIT = $0B ; Scan limit: 0x00 to 0x07 - how many digits to display (ie. 1 to 8)
MAX7219_REG_SHUTDOWN = $0C ; Shutdown: 0x00 = do not display, 0x01 = display
MAX7219_REG_DISPLAYTEST = $0F ; Display test: 0x00 = normal, 0x01 = display all segments
NUMBER_OF_CHIPS = 8
;---------------------------------------------
; send two bytes to Y chips:
; first in A (register), second in X (value)
; Y is count of chips - preserves Y
;---------------------------------------------
send_to_all:
phy
jsr spi_ss_low ; SS low
send_to_all_loop:
pha
jsr spi_transfer ; send first byte
txa ; get second byte
jsr spi_transfer ; send second byte
pla
dey
bne send_to_all_loop
jsr spi_ss_high ; SS high again
ply
rts
;---------------------------------------------
; send one letter to one chip.
; Letter in A, chip in X - preserves X and Y
;---------------------------------------------
send_letter:
phy
stx VALUE+2 ; which chip
; get the start of the character code by multiplying the letter we are displaying by 8 and
; adding to the start of the cp437_font address
sta VALUE ; the letter code
stz VALUE+1
asl VALUE ; times 2
rol VALUE+1
asl VALUE ; times 4
rol VALUE+1
asl VALUE ; times 8
rol VALUE+1
clc
lda #<cp437_font
adc VALUE
sta VALUE
lda #>cp437_font
adc VALUE+1
sta VALUE+1
ldy #0 ; which column
send_letter_loop:
jsr spi_ss_low ; SS low
ldx #0 ; what chip we are currently at
;
; skip unwanted chips
;
send_letter_initial_nops:
cpx VALUE+2 ; wanted chip?
beq send_letter_got_wanted_chip
phx
lda #MAX7219_REG_NOOP ; send a NOP
jsr spi_transfer
lda #MAX7219_REG_NOOP
jsr spi_transfer
plx
inx
bra send_letter_initial_nops
send_letter_got_wanted_chip:
inx
phx
lda (VALUE),Y
tax
iny ; make column 1-relative
phy
tya ; which column
jsr spi_transfer
txa ; the character to send
jsr spi_transfer
ply
plx
;
; now send more NOPs
;
send_letter_final_nops:
cpx #NUMBER_OF_CHIPS ; done all chips?
beq send_letter_done
phx
lda #MAX7219_REG_NOOP ; send a NOP
jsr spi_transfer
lda #MAX7219_REG_NOOP
jsr spi_transfer
plx
inx
bra send_letter_final_nops
send_letter_done:
jsr spi_ss_high ; SS high again
cpy #8
bne send_letter_loop
ply
ldx VALUE+2 ; get X back
rts
;
; Message to display
;
message asciiz "This is Ben's breadboard computer "
;---------------------------------------------
;
; Get next character from "message", wrap if at end and get the first one
;---------------------------------------------
get_next_char:
lda message,Y
bne get_next_char_ok
ldy #0
lda message,Y
get_next_char_ok:
iny
rts
;---------------------------------------------
; begin code
;---------------------------------------------
begin:
lda #0 ; mode 0 SPI
jsr spi_init
;
; send some NOPs to get us started
;
ldy #NUMBER_OF_CHIPS
lda #MAX7219_REG_NOOP
ldx #MAX7219_REG_NOOP
jsr send_to_all
;
; short delay
;
ldx #<1000
ldy #>1000
jsr delay
;
; initialise MAX7219 chip
;
lda #MAX7219_REG_SCANLIMIT ; show 8 digits
ldx #7
jsr send_to_all
lda #MAX7219_REG_DECODEMODE ; use bit patterns
ldx #0
jsr send_to_all
lda #MAX7219_REG_DISPLAYTEST ; no display test
ldx #0
jsr send_to_all
lda #MAX7219_REG_INTENSITY ; character intensity: range: 0 to 15
ldx #1
jsr send_to_all
lda #MAX7219_REG_SHUTDOWN ; not in shutdown mode (ie. start it up)
ldx #1
jsr send_to_all
ldy #0 ; which letter in the string we are up to
display_loop:
;
; abort on Ctrl+C
;
jsr serial_available
cmp #'C'-$40 ; ctrl+C?
bne loop_no_abort
lda #MAX7219_REG_SHUTDOWN ; shut it down
ldx #0
jsr send_to_all
rts ; we are done!
loop_no_abort:
phy
ldx #0 ; which character in the display we are sending to (0 to NUMBER_OF_CHIPS)
;
; send each letter
;
letter_loop:
jsr get_next_char
jsr send_letter
inx
cpx #NUMBER_OF_CHIPS
bne letter_loop
;
; wait briefly
;
loop_delay:
ldx #<1000
ldy #>1000
jsr delay
;
; next letter, go back to start if at 0x00 byte
;
ply
iny
lda message,Y
bne display_loop
ldy #0
bra display_loop
|
oeis/103/A103609.asm | neoneye/loda-programs | 11 | 167976 | ; A103609: Fibonacci numbers repeated (cf. A000045).
; Submitted by <NAME>
; 0,0,1,1,1,1,2,2,3,3,5,5,8,8,13,13,21,21,34,34,55,55,89,89,144,144,233,233,377,377,610,610,987,987,1597,1597,2584,2584,4181,4181,6765,6765,10946,10946,17711,17711,28657,28657,46368,46368,75025,75025,121393,121393,196418,196418,317811,317811,514229,514229,832040,832040,1346269,1346269,2178309,2178309,3524578,3524578,5702887,5702887,9227465,9227465,14930352,14930352,24157817,24157817,39088169,39088169,63245986,63245986,102334155,102334155,165580141,165580141,267914296,267914296,433494437,433494437
mov $3,1
lpb $0
sub $0,2
mov $2,$3
add $3,$1
mov $1,$2
lpe
mov $0,$1
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_21829_799.asm | ljhsiun2/medusa | 9 | 177265 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r15
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x17e7d, %r12
sub %rbx, %rbx
movb (%r12), %r9b
nop
nop
add $22096, %r11
lea addresses_A_ht+0x16c8, %rsi
nop
nop
nop
nop
add $19327, %r10
movb $0x61, (%rsi)
nop
nop
nop
nop
add %r15, %r15
lea addresses_WT_ht+0x1e888, %rsi
lea addresses_normal_ht+0x72a8, %rdi
inc %r15
mov $49, %rcx
rep movsl
nop
nop
nop
nop
sub $22383, %r12
lea addresses_UC_ht+0x8268, %rbx
nop
nop
nop
nop
nop
sub $65299, %r11
mov $0x6162636465666768, %r15
movq %r15, %xmm3
vmovups %ymm3, (%rbx)
nop
nop
nop
add %r12, %r12
lea addresses_WT_ht+0x135c8, %rcx
nop
nop
nop
nop
nop
sub $7561, %r12
movw $0x6162, (%rcx)
nop
nop
xor $31483, %rdi
lea addresses_UC_ht+0x58e6, %r11
nop
nop
nop
nop
nop
cmp %r9, %r9
movw $0x6162, (%r11)
nop
xor %r11, %r11
lea addresses_A_ht+0x14b2a, %rsi
nop
nop
cmp %r10, %r10
mov (%rsi), %edi
nop
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_WC_ht+0x19ac8, %rsi
nop
and %r12, %r12
mov $0x6162636465666768, %r15
movq %r15, %xmm1
and $0xffffffffffffffc0, %rsi
vmovntdq %ymm1, (%rsi)
nop
nop
nop
inc %r12
lea addresses_WC_ht+0x20f0, %rbx
clflush (%rbx)
nop
nop
nop
add %rdi, %rdi
mov (%rbx), %r9
nop
nop
and $63115, %r12
lea addresses_normal_ht+0xd468, %r10
clflush (%r10)
nop
nop
nop
add %r12, %r12
movb (%r10), %bl
nop
nop
xor %rbx, %rbx
lea addresses_UC_ht+0x4ac8, %rsi
lea addresses_UC_ht+0x1b348, %rdi
nop
nop
nop
nop
nop
and %r11, %r11
mov $69, %rcx
rep movsq
nop
dec %r11
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r15
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r14
push %rax
push %rbp
push %rdi
// Store
mov $0x798, %r11
nop
nop
nop
cmp %r12, %r12
movl $0x51525354, (%r11)
nop
nop
nop
nop
sub $23484, %r14
// Store
lea addresses_WT+0xacc8, %rax
clflush (%rax)
nop
nop
nop
nop
nop
sub %rbp, %rbp
movw $0x5152, (%rax)
nop
and %rax, %rax
// Load
lea addresses_A+0x9428, %rdi
clflush (%rdi)
nop
nop
nop
nop
sub %r13, %r13
mov (%rdi), %r14w
nop
nop
xor $4298, %r12
// Load
lea addresses_US+0x92c8, %r12
nop
nop
add $24507, %rbp
vmovups (%r12), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $1, %xmm2, %rdi
// Exception!!!
nop
nop
nop
nop
nop
mov (0), %rbp
nop
nop
cmp $31150, %r11
// Faulty Load
lea addresses_D+0x8ac8, %r14
nop
nop
nop
add $10223, %r12
mov (%r14), %rbp
lea oracles, %r12
and $0xff, %rbp
shlq $12, %rbp
mov (%r12,%rbp,1), %rbp
pop %rdi
pop %rbp
pop %rax
pop %r14
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 2, 'AVXalign': False, 'NT': True, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 11, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': True}}
{'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
*/
|
stringsMacros.asm | b0k0n0n/String-Primitives-and-Macros---MASM | 0 | 1531 | <filename>stringsMacros.asm<gh_stars>0
TITLE Project 6 - String Primitives and Macros
; Author: <NAME>
;
; Description: Implements and tests two macros for string processing:
; mGetString - displays prompt & gets user's input into memory location
; mDisplayString - prints the string which is stored in specified memory location
; Implements and tests two procedures for signed integers which use string primitive instructions:
; ReadVal - invokes mGetString, converts string of ASCII to numeric value (SDWORD), validates user entry
; WriteVal - covnerts numeric SDWORD to string of ASCII to string of ASCII digits, invokes mDisplayString
; Gets 10 valid integers from user, stores ints in array, displays ints, their sum, and truncated average
INCLUDE Irvine32.inc
USER_NUMBERS = 10 ; constant - user should enter 10 numbers
;-----------------------------------------------------------------------------------------------
; Macro name: mGetString
;
; Prompts user to enter 10 signed decimal integers that must fit inside a 32-bit register
;
; Receives:
; promptUser = ask for number
; inputString = array address
; inputLength = array length
;
; Returns: string input by user and length of string input by user
;----------------------------------------------------------------------------------------------
mGetString MACRO promptUser, inputString, inputLength
push edx
push ecx
mov edx, promptUser
call WriteString
mov ecx, 15 ; I set the input string to max length of 15
mov edx, inputString
call ReadString
mov inputLength, eax
pop ecx
pop edx
ENDM
;----------------------------------------------------------------------------------------------------
; Macro name: mDisplayString
;
; Prints the string which is stored in a specified memory location
;
; Receives: address of string to display
;
; returns: None (but displays the output string to the console)
;-----------------------------------------------------------------------------------------------------
mDisplayString MACRO stringAddress
push edx
mov edx, stringAddress
call WriteString
pop edx
ENDM
.data
intro BYTE "Final 271 Project (OMG SO HAPPY!): Designing low-level I/O procedures, by <NAME>", 13, 10, 0
intro2 BYTE 13, 10, "Please input 10 signed decimal integers.", 13, 10, 0
intro3 BYTE "Each integer needs to be small enough to fit inside a 32-bit register.", 13, 10, 0
intro4 BYTE "After you have input 10 integers, a list of those integers, their sum, ", 13, 10, 0
intro5 BYTE "and their average value will be displayed.", 13, 10, 0
userPrompt BYTE "Please enter a signed integer: " ,0
userEntry BYTE 15 Dup(?) ; I think 13 would be fine but did 15 jsut in case
userError BYTE "DANGER!!! INVALID ENTRY! Please try again.", 13,10,0
userNums BYTE "You entered the following numbers: ", 13, 10, 0
comma BYTE ", ", 0
asciiString BYTE 15 Dup(?) ; although I don't think it matters because > 12 would be cut off
validNums SDWORD USER_NUMBERS Dup(?)
userNumSum BYTE 13, 10, "The sum of your numbers is: ", 0
userSum SDWORD ?
userNumAvg BYTE 13, 10, "The truncated average of your numbers is: ", 0
userAvg SDWORD ?
stringLength DWORD ?
validNum SDWORD ?
numberCount DWORD 0
negativeNum DWORD 0
doneWith271 BYTE "All projects for CS 271 are now complete! Thanks for taking part!", 13,10,0
.code
main PROC
push OFFSET intro
push OFFSET intro2
push OFFSET intro3
push OFFSET intro4
push OFFSET intro5
call introduction
mov edi, OFFSET validNums ; where we store valid user entries
mov ecx, USER_NUMBERS ; number of valid user entries we need
; user input loop must be in main (not paying attention to this meant I had to write this twice!)
getInput:
push USER_NUMBERS ; need 10 numbers
push numberCount ; how many numbers?
push stringLength ; length of each entry
push negativeNum ; to ensure negative numbers are printed as negative numbers
push OFFSET userPrompt ; prompt user to enter number
push OFFSET userEntry ; user entered string
push OFFSET userError ; try again
push OFFSET validNum ; actual number (not string)
push OFFSET asciiString ; ascii interpretation of string
call ReadVal
mov eax, validNum
stosd ; store string data
loop getInput ; loop that is IN MAIN!!!!!
call CrLf
mov ecx, USER_NUMBERS
mov esi, OFFSET validNums
mDisplayString OFFSET userNums
printNums:
push USER_NUMBERS ; user enters 10 numbers
push [esi]
push OFFSET asciiString ; ascii string to be printed
call WriteVal ; print ascii string currently pointed to
cmp ecx, 1 ; what is the counter at? (for commas)
jz getSum ; no more commas
mDisplayString OFFSET comma ; still need a comma
add esi, 4 ; go to the next ascii string to print
loop printNums ; keep printing!
getSum:
mov eax, 0
mov esi, OFFSET validNums ; valid numbers entered by user
mov ecx, USER_NUMBERS ; user entered 10 numbers
calculateSum:
add eax, [esi] ; add value to sum
add esi, 4 ; go to next value
loop calculateSum ; keep adding until all numbers iterated through
mov userSum, eax ; place sum value in userSum
mDisplayString OFFSET userNumSum ; print message of number sum
push USER_NUMBERS
push userSum
push OFFSET asciiString
call WriteVal ; print sum of user entered numbers
mov ebx, USER_NUMBERS ; 10 numbers entered so divide by this for average
mov eax, userSum ; sum of user numbers entered, divide by USER_NUMBERS to get average
cdq ; sign extend to ensure correct result obtained
idiv ebx ; divide by 10 to get average
mov userAvg, eax ; calculated truncated average
mDisplayString OFFSET userNumAvg ; print message of user numbers truncated average
push USER_NUMBERS
push userAvg ; truncated average of user numbers entered
push OFFSET asciiString ; ascii string to print (for user nums entered)
call WriteVal ; WRITE IT!
call CrLf ; for pretty
call CrLf
push OFFSET doneWith271 ; final 271 goodbye message!!!!!
call byeBye271 ; I know we still have the final . . . but PROJECTS ARE DONE!!!
call CrLf
Invoke ExitProcess,0 ; exit to operating system
main ENDP
; --introduction--
; Prints introduction and instructions using mDisplayString
; preconditions: intro and inst1-4 are strings that introduce the program and contain instructions
; postconditions: intro and instructions printed to screen
; receives: intro and instructions 1-4
; returns: intro and instructions printed to screen
introduction PROC
push ebp
mov ebp, esp
mDisplayString [ebp + 24] ; print intro
mDisplayString [ebp + 20] ; print instructions 1 - 4
mDisplayString [ebp + 16]
mDisplayString [ebp + 12]
mDisplayString [ebp + 8]
call CrLf
pop ebp
ret 20
introduction ENDP
; --ReadVal--
; Uses mGetString macro to get user input in the form of a string of digits.
; Converts string of ASCII digits to numbers, validating input as it goes.
; Stores each value in a memory variable, by reference.
; preconditions: userEntry, userPrompt, userError, and asciiString are all strings that have been created.
; numCount, negativeNum, and stringLength are variables that have been created.
; USER_NUMS has been created as a constant; validNums is an array that has been created.
; postconditions: none
; receives: USER_NUMS, stringLength, userEntry, userPrompt, validNums, numberCount, userError, negativeNum, and asciiString
; returns: array of numbers that have been validated
ReadVal PROC
push ebp
mov ebp, esp
pushad
promptUser:
mGetString [ebp + 24], [ebp + 20], [ebp + 32] ; MACRO call for prompt, enteredString, and stringLength
mov ecx, [ebp + 32] ; counter = stringLength
mov esi, [ebp + 20] ; source = entered string
mov edi, [ebp + 12] ; valid number
cld
checkIsValid:
lodsb
cmp ecx, 12 ; max length is 11 if there is a sign, so > 11 = invalid
jae notValid
mov ebx, [ebp + 32]
cmp ebx, ecx ; if stringLength is 11, is first char + or - ?
jne keepChecking
cmp al, 43 ; 43 = ASCII value for +
jz getNext
cmp al, 45 ; 45 = ASCII value for -
jz isNegative ; treat as negative number
jmp keepChecking
isNegative:
mov ebx, 1
mov [ebp + 28], ebx ; sets isNegative to 1
jmp getNext ; ready for next character
keepChecking:
cmp al, 57 ; 57 = ASCII value for 9
jg notValid ; if > 57, not valid
cmp al, 48 ; 48 = ASCII value for 0
jl notValid ; if < 0, not valid
sub al, 48 ; convert ASCII to number
movsx eax, al
push eax
mov ebx, 10
mov eax, [ebp + 36] ; counts numbers converted
imul ebx
pop ebx
jo notValid ; if overflow, then error
add eax, ebx
mov [ebp + 36], eax
jo notValid ; if overflow, then error
getNext:
loop checkIsValid ; keep checking
mov ebx, 1
cmp [ebp + 28], ebx ; is it negative?
jne isValid
neg eax ; if so, negate
isValid:
mov [edi], eax ; if valid, store number
jmp theEnd
notValid:
mDisplayString [ebp + 16] ; ERROR! ERROR!
mov ebx, 0
mov [ebp + 36], ebx ; integer conversion count reset for further checks
mov [ebp + 28], ebx ; isNegative reset for further checks
jmp promptUser
theEnd:
popad
pop ebp
ret 36
ReadVal ENDP
; --WriteVal--
; Converts numeric value into string of ASCII digits, then prints ASCII string using mDisplayString
; preconditions: USER_NUMS declared as constant, nums converted to ASCII, asciiString delcared as string
; postconditions: none
; receives: USER_NUMS, number to be converted, address of asciiString
; returns: asciiString to print (printed to display)
WriteVal PROC
push ebp
mov ebp, esp
pushad
mov ecx, 0 ; counter
mov edi, [ebp + 8] ; asciiString regardless of call
mov esi, [ebp + 12] ; either userSum or userNumAvg
mov eax, esi
cmp eax, 0
jge getASCII
push eax
mov al, 45 ; add '-' to the string for neg nums
stosb ; store string data
pop eax
neg eax ; makes positive because will be adding - if negative later
getASCII:
mov ebx, [ebp + 16] ; get ready to divide
cdq ; sign extend for correct answer
idiv ebx ; divide by USER_NUMS
add edx, 48 ; add ASCII value for 0 to get ASCII equivalent number (remainder + ASCII 0)
push edx ; remainder goes to stack
inc ecx ; increment counter
cmp eax, 0 ; are we done?
jz getReverse ; if yes, get ready to print
jmp getASCII ; if not, get next ASCII
getReverse:
pop eax
stosb ; store string data
loop getReverse ; keep reversing until full string complete
mov al, 0 ; 0 = null terminator, so string is done!
stosb ; store string data
mDisplayString [ebp + 8] ; asciiString finally ready for printing
popad
pop ebp
ret 12
WriteVal ENDP
; --byeBye271--
; Prints the final goodbye message of the final project of 271!!!!!
; preconditions: doneWith271 is a string that is totally ready for the end of this class
; postconditions: said goodbye to the class (at least the projects)
; receives: doneWith271 string
; returns: NONE (but says hasta la vista! via display!)
byeBye271 PROC
push ebp
mov ebp, esp
mDisplayString [ebp + 8] ;buh bye MASM
pop ebp
ret 4 ; did I mention I'm happy?
byeBye271 ENDP
END main
|
templates/asm/main.asm | 4llower/create-competitive-app | 2 | 161966 | <filename>templates/asm/main.asm
.model small
.stack 100h
.data
message db "Hello world!$"
.code
main:
mov ax, @data
mov ds, ax
mov ah, 09h
lea dx, message
int 21h
return:
mov ah, 4ch
int 21h
end main
|
src/Selective/Simulate.agda | Zalastax/thesis | 1 | 11321 | <reponame>Zalastax/thesis
module Selective.Simulate where
open import Selective.ActorMonad public
open import Selective.SimulationEnvironment
open import Selective.EnvironmentOperations
open import Prelude
open import Data.List.All.Properties using (++⁺)
open import Data.Nat.Properties using (≤-reflexive ; ≤-step)
open import Data.Product using (Σ ; _,_ ; _×_ ; Σ-syntax)
open Actor
open ValidActor
open Env
open FoundReference
open LiftedReferences
open UpdatedInbox
open ValidMessageList
open NamedInbox
open _comp↦_∈_
open NameSupply
open NameSupplyStream
data Trace (i : Size) : Set₂
record ∞Trace (i : Size) : Set₂ where
coinductive
constructor delay_
field force : {j : Size< i} → Trace j
data Trace (i : Size) where
TraceStop : (env : Env) → Done env → Trace i
_∷_ : (x : Env) (xs : ∞Trace i) → Trace i
reduce-unbound-return : {act : Actor} → (env : Env) → Focus act env →
ActorAtConstructor Return act →
ActorHasNoContinuation act →
Env
reduce-unbound-return env Focused AtReturn no-cont = block-focused env Focused (BlockedReturn AtReturn no-cont)
reduce-bound-return : {act : Actor} → (env : Env) → Focus act env →
ActorAtConstructor Return act →
ActorHasContinuation act →
Env
reduce-bound-return env@record {
acts = actor@record { computation = Return v ⟶ (f ∷ cont) } ∷ rest
; actors-valid = actor-valid ∷ rest-valid
} Focused AtReturn HasContinuation =
let
actor' : Actor
actor' = replace-actorM actor ((f v .force) ⟶ cont)
env' : Env
env' = replace-focused
env
Focused
actor'
(rewrap-valid-actor AreSame actor-valid)
in env'
reduce-bind : {act : Actor} → (env : Env) → Focus act env →
ActorAtConstructor Bind act →
Env
reduce-bind env@record { acts = actor@record { computation = (m ∞>>= f) ⟶ cont } ∷ rest ; actors-valid = actor-valid ∷ rest-valid } Focused AtBind =
let
actor' : Actor
actor' = replace-actorM actor ((m .force) ⟶ (f ∷ cont))
env' : Env
env' = replace-focused
env
Focused
actor'
(rewrap-valid-actor AreSame actor-valid)
in env'
reduce-spawn : {act : Actor} → (env : Env) → Focus act env →
ActorAtConstructor Spawn act →
Env
reduce-spawn env@record {
acts = actor@record { computation = Spawn {NewIS} {B} act ⟶ cont } ∷ rest
; actors-valid = actor-valid ∷ rest-valid
} Focused AtSpawn =
let
new-name : Name
new-name = env .name-supply .supply .name
new-store-entry : NamedInbox
new-store-entry = inbox# new-name [ NewIS ]
env' : Env
env' = add-top (act ⟶ []) env
valid' : ValidActor (env' .store) actor
valid' = valid-actor-suc (env .name-supply .supply) actor-valid
env'' : Env
env'' = top-actor-to-back env'
actor' : Actor
actor' = add-reference actor new-store-entry (Return _ ⟶ cont)
valid'' : ValidActor (env'' .store) actor'
valid'' = add-reference-valid RefAdded valid' [p: zero ][handles: ⊆-refl ]
env''' : Env
env''' = replace-focused env'' Focused actor' valid''
in env'''
reduce-send : {act : Actor} → (env : Env) → Focus act env →
ActorAtConstructor Send act →
Env
reduce-send env@record {
acts = actor@record { computation = Send {ToIS = ToIS} canSendTo (SendM tag fields) ⟶ cont } ∷ rest
; actors-valid = actor-valid ∷ rest-valid
} Focused AtSend =
let
to-reference : FoundReference (store env) ToIS
to-reference = lookup-reference-act actor-valid canSendTo
namedFields = name-fields-act (store env) actor fields actor-valid
actor' : Actor
actor' = replace-actorM actor (Return _ ⟶ cont)
withM : Env
withM = replace-focused
env
Focused
actor'
(rewrap-valid-actor AreSame actor-valid)
message = NamedM
(translate-message-pointer to-reference tag)
namedFields
message-is-valid : message-valid (env .store) message
message-is-valid = make-pointers-compatible
(env .store)
(actor .pre)
(actor .references)
(actor .pre-eq-refs)
fields
(actor-valid .references-have-pointer)
updater = add-message message message-is-valid
withUpdatedInbox : Env
withUpdatedInbox = update-inbox-env
withM
(underlying-pointer to-reference)
updater
in withUpdatedInbox
reduce-receive-without-message : {act : Actor} → (env : Env) → Focus act env →
ActorAtConstructor Receive act →
(p : has-inbox (env .store) act) →
inbox-for-actor (env .env-inboxes) act p [] →
Env
reduce-receive-without-message env Focused AtReceive p ifa = block-focused env Focused (BlockedReceive AtReceive p ifa)
reduce-receive-with-message : {act : Actor} → (env : Env) → Focus act env →
ActorAtConstructor Receive act →
(p : has-inbox (env .store) act) →
∀ inbox →
all-messages-valid (env .store) inbox →
InboxInState NonEmpty inbox →
inbox-for-actor (env .env-inboxes) act p inbox →
Env
reduce-receive-with-message env@record {
acts = actor@record { computation = (Receive ⟶ cont) } ∷ rest
; actors-valid = actor-valid ∷ rest-valid
} Focused AtReceive p (nm ∷ messages) (nmv ∷ vms) HasMessage ifa =
let
inboxesAfter = update-inbox
(env .store)
(env .env-inboxes)
(env .messages-valid)
(actor-valid .actor-has-inbox)
remove-message
actor' : Actor
actor' = add-references-rewrite
actor
(named-inboxes nm)
{unname-message nm}
(add-references++
nm
nmv
(pre actor))
(Return (unname-message nm) ⟶ cont)
actor-valid' : ValidActor (env .store) actor'
actor-valid' = record {
actor-has-inbox = actor-valid .actor-has-inbox
; references-have-pointer = valid++ nm nmv (actor-valid .references-have-pointer)
}
env' : Env
env' = let
updated = update-inbox (env .store) (env .env-inboxes) (env .messages-valid) (actor-valid .actor-has-inbox) remove-message
unblock-split = unblock-actors updated (env .blocked) (env .blocked-valid) (env .blocked-no-progress)
open UnblockedActors
in record
{ acts = actor' ∷ unblock-split .unblocked ++ rest
; blocked = unblock-split .still-blocked
; store = env .store
; env-inboxes = updated .updated-inboxes
; name-supply = env .name-supply
; actors-valid = actor-valid' ∷ ++⁺ (unblock-split .unblocked-valid) rest-valid
; blocked-valid = unblock-split .blocked-valid
; messages-valid = updated .inboxes-valid
; blocked-no-progress = unblock-split .blocked-no-prog
}
in env'
reduce-receive : {act : Actor} → (env : Env) → Focus act env →
ActorAtConstructor Receive act →
Env
reduce-receive env@record { acts = actor ∷ rest ; actors-valid = actor-valid ∷ _ } Focused AtReceive = choose-reduction (get-inbox env (actor-valid .actor-has-inbox))
where
open GetInbox
choose-reduction : (gi : GetInbox (env .store) (env .env-inboxes) (actor-valid .actor-has-inbox)) → Env
choose-reduction gi@record { messages = [] } =
reduce-receive-without-message env Focused AtReceive _ (gi .right-inbox)
choose-reduction gi@record { messages = _ ∷ _ } =
reduce-receive-with-message env Focused AtReceive _ (gi .messages) (gi .valid) HasMessage (gi .right-inbox)
reduce-self : {act : Actor} → (env : Env) → Focus act env →
ActorAtConstructor Self act →
Env
reduce-self env@record { acts = actor@record {
computation = Self ⟶ cont } ∷ _
; actors-valid = actor-valid ∷ _
} Focused AtSelf =
let
actor' : Actor
actor' = add-reference actor inbox# (actor .name) [ (actor .inbox-shape) ] ((Return _) ⟶ cont)
actor-valid' : ValidActor (env .store) actor'
actor-valid' = add-reference-valid RefAdded actor-valid [p: (actor-valid .actor-has-inbox) ][handles: ⊆-refl ]
env' : Env
env' = replace-focused
env
Focused
actor'
actor-valid'
in env'
reduce-selective-with-message : {act : Actor} → (env : Env) → Focus act env →
(aac : ActorAtConstructor Selective act) →
(point : has-inbox (env .store) act) →
∀ inbox →
all-messages-valid (env .store) inbox →
inbox-for-actor (env .env-inboxes) act point inbox →
{split : SplitList inbox} →
{p : (filter-named (selected-filter act aac)) (SplitList.el split) ≡ true} →
InboxInFilterState {filter = filter-named (selected-filter act aac)} inbox (Found split p) →
Env
reduce-selective-with-message env@record {
acts = actor@record { computation = SelectiveReceive filter ⟶ cont } ∷ rest
; actors-valid = actor-valid ∷ rest-valid
} Focused AtSelective point inb amv ifa (HasMessage split ok) =
let updated = update-inbox (env .store) (env .env-inboxes) (env .messages-valid) (actor-valid .actor-has-inbox) (remove-found-message filter)
unblock-split = unblock-actors updated (env .blocked) (env .blocked-valid) (env .blocked-no-progress)
open SplitList
received-nm = split .el
added-references = named-inboxes received-nm
received-message = unname-message received-nm
received-valid : message-valid (env .store) received-nm
received-valid = split-all-el inb amv split
adds-correct-references : map shape added-references ++ (actor .pre) ≡ add-references (actor .pre) received-message
adds-correct-references = add-references++ received-nm received-valid (actor .pre)
new-continuation = Return sm: received-message [ ok ] ⟶ cont
act' : Actor
act' = add-references-rewrite actor added-references {received-message} adds-correct-references new-continuation
act-valid' : ValidActor (env .store) act'
act-valid' = record {
actor-has-inbox = actor-valid .actor-has-inbox
; references-have-pointer = valid++ received-nm received-valid (actor-valid .references-have-pointer)
}
open UnblockedActors
in record
{ acts = act' ∷ unblock-split .unblocked ++ rest
; blocked = unblock-split .still-blocked
; store = env .store
; env-inboxes = updated-inboxes updated
; name-supply = env .name-supply
; actors-valid = act-valid' ∷ ++⁺ (unblock-split .unblocked-valid) rest-valid
; blocked-valid = unblock-split .blocked-valid
; messages-valid = inboxes-valid updated
; blocked-no-progress = unblock-split .blocked-no-prog
}
reduce-selective-without-message : {act : Actor} → (env : Env) → Focus act env →
(aac : ActorAtConstructor Selective act) →
(point : has-inbox (env .store) act) →
∀ inbox →
{ps : All (misses-filter (filter-named (selected-filter act aac))) inbox} →
inbox-for-actor (env .env-inboxes) act point inbox →
InboxInFilterState inbox (Nothing ps) →
Env
reduce-selective-without-message env Focused AtSelective point inbox ifa iifs =
block-focused env Focused (BlockedSelective AtSelective point inbox ifa iifs)
reduce-selective : {act : Actor} → (env : Env) → Focus act env →
ActorAtConstructor Selective act →
Env
reduce-selective env@record {
acts = actor@record { computation = SelectiveReceive filter ⟶ _ } ∷ _
; actors-valid = actor-valid ∷ _
} Focused AtSelective =
let inb = get-inbox env (actor-valid .actor-has-inbox)
in choose-reduction inb (find-split (inb .messages) (filter-named filter))
where
open GetInbox
choose-reduction : (gi : GetInbox (env .store) (env .env-inboxes) (actor-valid .actor-has-inbox)) → FoundInList (gi .messages) (filter-named filter) → Env
choose-reduction gi (Found split x) = reduce-selective-with-message env Focused AtSelective _ (gi .messages) (gi .valid) (gi .right-inbox) (HasMessage split x)
choose-reduction gi (Nothing ps) = reduce-selective-without-message env Focused AtSelective _ (gi .messages) (gi .right-inbox) (IsEmpty ps)
reduce-strengthen : {act : Actor} → (env : Env) → Focus act env →
ActorAtConstructor Strengthen act →
Env
reduce-strengthen env@record {
acts = actor@record { computation = Strengthen {ys} inc ⟶ cont } ∷ _
; actors-valid = actor-valid ∷ _
} Focused AtStrengthen =
let
lifted-references = lift-references inc (references actor) (pre-eq-refs actor)
actor' : Actor
actor' = lift-actor actor (lifted-references .contained) (lifted-references .contained-eq-inboxes) (Return _ ⟶ cont)
actor-valid' : ValidActor (env .store) actor'
actor-valid' = lift-valid-actor (CanBeLifted lifted-references) actor-valid
env' : Env
env' = replace-focused
env
Focused
actor'
actor-valid'
in env'
reduce : {act : Actor} → (env : Env) → Focus act env → Env
reduce env@record { acts = record { computation = (Return val ⟶ []) } ∷ _ } Focused =
reduce-unbound-return env Focused AtReturn (NoContinuation {v = val})
reduce env@record { acts = record { computation = (Return val ⟶ (_ ∷ _)) } ∷ _ } Focused =
reduce-bound-return env Focused AtReturn (HasContinuation {v = val})
reduce env@record { acts = record { computation = ((m ∞>>= f) ⟶ _)} ∷ _ } Focused =
reduce-bind env Focused AtBind
reduce env@record { acts = record { computation = (Spawn act ⟶ cont) } ∷ _ } Focused =
reduce-spawn env Focused AtSpawn
reduce env@record { acts = record { computation = (Send canSendTo msg ⟶ cont) } ∷ _ } Focused =
reduce-send env Focused AtSend
reduce env@record { acts = record { computation = (Receive ⟶ cont) } ∷ _ } Focused =
reduce-receive env Focused AtReceive
reduce env@record { acts = record { computation = (SelectiveReceive filter ⟶ cont) } ∷ _ } Focused =
reduce-selective env Focused AtSelective
reduce env@record { acts = record { computation = (Self ⟶ cont) } ∷ _ } Focused =
reduce-self env Focused AtSelf
reduce env@record { acts = record { computation = (Strengthen inc ⟶ cont) } ∷ _ } Focused =
reduce-strengthen env Focused AtStrengthen
simulate : Env → ∞Trace ∞
simulate env@record { acts = [] ; actors-valid = [] } = delay TraceStop env AllBlocked
simulate env@record { acts = _ ∷ _ ; actors-valid = _ ∷ _ } = keep-stepping (reduce env Focused)
where
open ∞Trace
keep-stepping : Env → ∞Trace ∞
keep-stepping env .force = env ∷ simulate env
|
Transynther/x86/_processed/NC/_st_sm_/i9-9900K_12_0xa0_notsx.log_1_971.asm | ljhsiun2/medusa | 9 | 174474 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r9
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0xe3b1, %rbx
nop
nop
add $29004, %rsi
movb $0x61, (%rbx)
nop
nop
nop
nop
add %rbx, %rbx
lea addresses_A_ht+0xf83a, %rsi
lea addresses_WC_ht+0x2a45, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
dec %r11
mov $0, %rcx
rep movsb
nop
nop
nop
nop
and %rcx, %rcx
lea addresses_A_ht+0xd461, %rsi
nop
nop
nop
nop
xor %r9, %r9
mov (%rsi), %di
nop
nop
nop
sub %rbx, %rbx
lea addresses_UC_ht+0x1a785, %rsi
lea addresses_normal_ht+0x17005, %rdi
nop
nop
nop
nop
cmp %rbx, %rbx
mov $59, %rcx
rep movsb
nop
nop
nop
nop
nop
cmp $3684, %r11
lea addresses_A_ht+0xd405, %rsi
lea addresses_UC_ht+0x17e05, %rdi
nop
nop
xor %r11, %r11
mov $10, %rcx
rep movsq
nop
nop
nop
add $61599, %rdx
lea addresses_WT_ht+0x9d55, %rsi
nop
nop
add $18162, %rdi
movw $0x6162, (%rsi)
nop
nop
add $29029, %r11
lea addresses_UC_ht+0x9425, %rbx
clflush (%rbx)
nop
sub %rsi, %rsi
mov (%rbx), %r9w
nop
nop
nop
nop
nop
cmp %rsi, %rsi
lea addresses_normal_ht+0xb91b, %rdi
cmp $34582, %r9
movb $0x61, (%rdi)
nop
nop
nop
nop
sub $50259, %r11
lea addresses_WT_ht+0x10d0d, %rsi
nop
nop
xor $50135, %rdi
mov (%rsi), %ebx
nop
nop
nop
nop
nop
dec %rdi
lea addresses_D_ht+0x12285, %rsi
lea addresses_A_ht+0xa005, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
dec %r11
mov $23, %rcx
rep movsq
nop
nop
nop
nop
nop
sub $24812, %r11
lea addresses_D_ht+0x10ce9, %rsi
nop
nop
xor %r11, %r11
movl $0x61626364, (%rsi)
nop
dec %r11
lea addresses_WC_ht+0x4205, %r11
nop
nop
add %rcx, %rcx
movb $0x61, (%r11)
add %rdi, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %rbx
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_A+0x13d05, %rsi
lea addresses_PSE+0x1beed, %rdi
nop
dec %rbx
mov $25, %rcx
rep movsq
nop
nop
inc %rcx
// Store
mov $0x2af0c80000000a05, %r14
nop
dec %r11
mov $0x5152535455565758, %rbx
movq %rbx, %xmm5
movntdq %xmm5, (%r14)
nop
nop
sub %rdi, %rdi
// Store
mov $0x2af0c80000000a05, %rbx
nop
nop
nop
nop
nop
xor $39958, %rdi
movb $0x51, (%rbx)
nop
nop
nop
xor $41520, %r14
// Store
lea addresses_A+0x1b7f3, %r14
nop
xor %rbx, %rbx
movb $0x51, (%r14)
nop
xor %rcx, %rcx
// Faulty Load
mov $0x2af0c80000000a05, %rsi
nop
cmp %r14, %r14
vmovups (%rsi), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $0, %xmm5, %r11
lea oracles, %r12
and $0xff, %r11
shlq $12, %r11
mov (%r12,%r11,1), %r11
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'AVXalign': True, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_PSE', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'size': 16, 'NT': True, 'same': True, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}}
{'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 4}}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 1}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 2}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 11}}
{'51': 1}
51
*/
|
typepaste.applescript | atisu/typepaste | 1 | 3900 | <filename>typepaste.applescript
do shell script "/bin/bash -s <<'EOF'
LOCATION=~/Projects/typepaste/
. ${LOCATION}/venv/bin/activate && ${LOCATION}/typepaste.py --batch-size 10
EOF" |
sorting-algorithms/main1.asm | informramiz/Assembly-Language-Programs | 0 | 11483 | <filename>sorting-algorithms/main1.asm
.MODEL SMALL
.STACK 100H
.DATA
STRING DB 80 DUP ( 0 )
BUBBLE_OPTION DB 0AH,0DH,'1. BUBBLE SORT $'
SELECTION_OPTION DB 0AH,0DH,'2. SELECTION SORT $'
INSERTION_OPTION DB 0AH,0DH,'3. INSERTION SORT $'
GNUM_OPTION DB 0AH,0DH, '4. GNOM SORT $'
MINIMUM_OPTION DB 0AH,0DH, '5. MINIMUM ELEMENT SORT $'
OPTION_INPUT DB 0AH,0DH,'ENTER OPTION NUMBER : $'
INVALID_OPTION DB 0AH,0DH,'INVALID OPTION ',0AH,0DH,'$'
ITERATION_MSG DB 0AH,0DH,'AFTER ONE ITERATION : $'
INPUT_MSG DB 0AH,0DH,'ENTER A STRING: $'
OUTPUT_MSG DB 0AH,0DH,'SORTED STRING IS: $'
INPUT_AGAIN DB 0AH,0DH,0AH,0DH,'DO YOU WANT TO CONTINUE ( 0/1 ) ? : $'
VALUE DW ?
.CODE
include minimumElement.asm
include bubble.asm
include insertion.asm
include selection.asm
include option1.asm
include swap.asm
include input.asm
include output.asm
include iteration.asm
INCLUDE GNUM.ASM
MAIN PROC
;making the DS to point to data segment
MOV AX,@DATA
MOV DS,AX
MOV ES,AX
CALL OPTION1
EXIT:
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN |
src/date.adb | GauBen/Arbre-Genealogique | 1 | 3353 | package body Date is
function D1_Inf_D2 (Date1 : T_Date; Date2 : T_Date) return Boolean is
begin
if Date1.Annee < Date2.Annee then
return True;
elsif Date1.Annee > Date2.Annee then
return False;
elsif Date1.Mois < Date2.Mois then
return True;
elsif Date1.Mois > Date2.Mois then
return False;
elsif Date1.Jour < Date2.Jour then
return True;
else
return False;
end if;
end D1_Inf_D2;
function D1_Egal_D2 (Date1 : T_Date; Date2 : T_Date) return Boolean is
begin
return Date1.Annee = Date2.Annee and Date1.Mois = Date2.Mois and
Date1.Jour = Date2.Jour;
end D1_Egal_D2;
-- Renvoie le nombre de jours d'un mois donné.
function Nombre_Jours (Mois : T_Mois; Annee : Integer) return Integer is
begin
case Mois is
when Janvier | Mars | Mai | Juillet | Aout | Octobre | Decembre =>
return 31;
when Fevrier =>
if Annee mod 400 = 0 then
return 29;
elsif Annee mod 100 = 0 then
return 28;
elsif Annee mod 4 = 0 then
return 29;
else
return 28;
end if;
when others =>
return 30;
end case;
end Nombre_Jours;
function Creer_Date
(Jour : Integer; Mois : Integer; Annee : Integer) return T_Date
is
Date : T_Date;
begin
if Mois < 1 or Mois > 12 or Jour < 1 or Jour > 31 then
raise Date_Incorrecte;
end if;
Date.Mois := T_Mois'Val (Mois - 1);
Date.Annee := Annee;
if Jour > Nombre_Jours (Date.Mois, Date.Annee) then
raise Date_Incorrecte;
end if;
Date.Jour := Jour;
return Date;
end Creer_Date;
end Date;
|
EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.asm | CEOALT1/RefindPlusUDK | 2,757 | 172912 | ;------------------------------------------------------------------------------
; IA32 assembly file for AP startup vector.
;
; Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
;------------------------------------------------------------------------------
.686p
.model flat
.code
include AsmInclude.inc
;-------------------------------------------------------------------------------------
FJMP32 MACRO Selector, Offset
DB 066h
DB 067h
DB 0EAh ; far jump
DD Offset ; 32-bit offset
DW Selector ; 16-bit selector
ENDM
;-------------------------------------------------------------------------------------
;RendezvousFunnelProc procedure follows. All APs execute their procedure. This
;procedure serializes all the AP processors through an Init sequence. It must be
;noted that APs arrive here very raw...ie: real mode, no stack.
;ALSO THIS PROCEDURE IS EXECUTED BY APs ONLY ON 16 BIT MODE. HENCE THIS PROC
;IS IN MACHINE CODE.
;-------------------------------------------------------------------------------------
;RendezvousFunnelProc (&WakeUpBuffer,MemAddress);
RendezvousFunnelProc PROC near C PUBLIC
RendezvousFunnelProcStart::
; At this point CS = 0x(vv00) and ip= 0x0.
db 8ch, 0c8h ; mov ax, cs
db 8eh, 0d8h ; mov ds, ax
db 8eh, 0c0h ; mov es, ax
db 8eh, 0d0h ; mov ss, ax
db 33h, 0c0h ; xor ax, ax
db 8eh, 0e0h ; mov fs, ax
db 8eh, 0e8h ; mov gs, ax
; Switch to flat mode.
db 0BEh
dw BufferStart ; mov si, BufferStart
db 66h, 8Bh, 0Ch ; mov ecx,dword ptr [si] ; ECX is keeping the start address of wakeup buffer
db 0FAh ; cli
db 0BEh
dw GdtrProfile ; mov si, GdtrProfile
db 66h ; db 66h
db 2Eh,0Fh, 01h, 14h ; lgdt fword ptr cs:[si]
db 0BEh
dw IdtrProfile ; mov si, IdtrProfile
db 66h ; db 66h
db 2Eh,0Fh, 01h, 1Ch ; lidt fword ptr cs:[si]
db 33h, 0C0h ; xor ax, ax
db 8Eh, 0D8h ; mov ds, ax
db 0Fh, 20h, 0C0h ; mov eax, cr0 ; Get control register 0
db 66h, 83h, 0C8h, 01h ; or eax, 000000001h ; Set PE bit (bit #0)
db 0Fh, 22h, 0C0h ; mov cr0, eax
FLAT32_JUMP::
FJMP32 010h,0h ; Far jmp using code segment descriptor
ProtectedModeStart:: ; protected mode entry point
mov ax, 8h
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax ; Flat mode setup.
;
; ProgramStack
;
mov ecx, 1bh ; Read IA32_APIC_BASE MSR
rdmsr
bt eax, 10 ; Check for x2apic mode
jnc LegacyApicMode
mov ecx, 802h ; Read APIC_ID
rdmsr
mov ebx, eax ; ebx == apicid
jmp GetCpuNumber
LegacyApicMode::
and eax, 0fffff000h
add eax, 20h
mov ebx, dword ptr [eax]
shr ebx, 24 ; ebx == apicid
GetCpuNumber::
xor ecx, ecx
mov edi, esi
add edi, ProcessorNumber
mov ecx, dword ptr [edi + 4 * ebx] ; ECX = CpuNumber
mov edi, esi
add edi, StackSize
mov eax, dword ptr [edi]
inc ecx
mul ecx ; EAX = StackSize * (CpuNumber + 1)
mov edi, esi
add edi, StackStart
mov ebx, dword ptr [edi]
add eax, ebx ; EAX = StackStart + StackSize * (CpuNumber + 1)
mov esp, eax
;
; Call C Function
;
mov edi, esi
add edi, RendezvousProc
mov ebx, dword ptr [edi]
test ebx, ebx
jz GoToSleep
call ebx ; Call C function
GoToSleep::
cli
hlt
jmp $-2
RendezvousFunnelProc ENDP
RendezvousFunnelProcEnd::
;-------------------------------------------------------------------------------------
; AsmGetAddressMap (&AddressMap);
;-------------------------------------------------------------------------------------
AsmGetAddressMap PROC near C PUBLIC
pushad
mov ebp,esp
mov ebx, dword ptr [ebp+24h]
mov dword ptr [ebx], RendezvousFunnelProcStart
mov dword ptr [ebx+4h], ProtectedModeStart - RendezvousFunnelProcStart
mov dword ptr [ebx+8h], FLAT32_JUMP - RendezvousFunnelProcStart
mov dword ptr [ebx+0ch], 0
mov dword ptr [ebx+10h], 0
mov dword ptr [ebx+14h], RendezvousFunnelProcEnd - RendezvousFunnelProcStart
popad
ret
AsmGetAddressMap ENDP
END
|
programs/oeis/014/A014217.asm | karttu/loda | 0 | 244357 | ; A014217: a(n) = floor(phi^n), where phi = (1+sqrt(5))/2 is the golden ratio.
; 1,1,2,4,6,11,17,29,46,76,122,199,321,521,842,1364,2206,3571,5777,9349,15126,24476,39602,64079,103681,167761,271442,439204,710646,1149851,1860497,3010349,4870846,7881196,12752042,20633239,33385281,54018521,87403802,141422324,228826126,370248451,599074577,969323029,1568397606,2537720636,4106118242,6643838879,10749957121,17393796001,28143753122,45537549124,73681302246,119218851371,192900153617,312119004989,505019158606,817138163596,1322157322202,2139295485799,3461452808001,5600748293801,9062201101802,14662949395604,23725150497406,38388099893011,62113250390417,100501350283429,162614600673846,263115950957276,425730551631122,688846502588399,1114577054219521,1803423556807921,2918000611027442,4721424167835364,7639424778862806
add $0,1
mov $3,4
lpb $0,1
sub $0,1
trn $2,4
trn $3,3
sub $5,$4
mov $4,$5
add $5,$2
add $2,$1
add $4,2
add $2,$4
add $5,$3
mov $1,$5
add $1,2
mov $5,3
lpe
sub $1,2
|
source/protocol/lsp-messages.ads | reznikmm/ada_lsp | 11 | 13946 | -- Copyright (c) 2017 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Containers.Hashed_Maps;
with Ada.Containers.Vectors;
with Ada.Streams;
with League.Strings.Hash;
with LSP.Generic_Optional;
with LSP.Types; use LSP.Types;
package LSP.Messages is
pragma Preelaborate;
pragma Style_Checks ("M125-bcht");
--```typescript
--interface Message {
-- jsonrpc: string;
--}
--```
type Message is abstract tagged record
jsonrpc: LSP_String;
end record;
--```typescript
--interface RequestMessage extends Message {
--
-- /**
-- * The request id.
-- */
-- id: number | string;
--
-- /**
-- * The method to be invoked.
-- */
-- method: string;
--
-- /**
-- * The method's params.
-- */
-- params?: any
--}
--```
type RequestMessage is new Message with record
id: LSP_Number_Or_String;
method: LSP_String;
-- params: LSP_Any;
end record;
--```typescript
--interface ResponseMessage extends Message {
-- /**
-- * The request id.
-- */
-- id: number | string | null;
--
-- /**
-- * The result of a request. This can be omitted in
-- * the case of an error.
-- */
-- result?: any;
--
-- /**
-- * The error object in case a request fails.
-- */
-- error?: ResponseError<any>;
--}
--
--interface ResponseError<D> {
-- /**
-- * A number indicating the error type that occurred.
-- */
-- code: number;
--
-- /**
-- * A string providing a short description of the error.
-- */
-- message: string;
--
-- /**
-- * A Primitive or Structured value that contains additional
-- * information about the error. Can be omitted.
-- */
-- data?: D;
--}
--
--export namespace ErrorCodes {
-- // Defined by JSON RPC
-- export const ParseError: number = -32700;
-- export const InvalidRequest: number = -32600;
-- export const MethodNotFound: number = -32601;
-- export const InvalidParams: number = -32602;
-- export const InternalError: number = -32603;
-- export const serverErrorStart: number = -32099;
-- export const serverErrorEnd: number = -32000;
-- export const ServerNotInitialized: number = -32002;
-- export const UnknownErrorCode: number = -32001;
--
-- // Defined by the protocol.
-- export const RequestCancelled: number = -32800;
--}
--```
type ErrorCodes is
(ParseError,
InvalidRequest,
MethodNotFound,
InvalidParams,
InternalError,
serverErrorStart,
serverErrorEnd,
ServerNotInitialized,
UnknownErrorCode,
RequestCancelled);
type ResponseError is record
code: ErrorCodes;
message: LSP_String;
data: LSP_Any;
end record;
not overriding procedure Read_ResponseError
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out ResponseError);
for ResponseError'Read use Read_ResponseError;
not overriding procedure Write_ResponseError
(S : access Ada.Streams.Root_Stream_Type'Class;
V : ResponseError);
for ResponseError'Write use Write_ResponseError;
package Optional_ResponseErrors is new LSP.Generic_Optional (ResponseError);
type Optional_ResponseError is new Optional_ResponseErrors.Optional_Type;
type ResponseMessage is new Message with record
id: LSP_Number_Or_String; -- or null?
-- result: LSP_Any;
error: Optional_ResponseError;
end record;
not overriding procedure Write_ResponseMessage
(S : access Ada.Streams.Root_Stream_Type'Class;
V : ResponseMessage);
for ResponseMessage'Write use Write_ResponseMessage;
--```typescript
--interface NotificationMessage extends Message {
-- /**
-- * The method to be invoked.
-- */
-- method: string;
--
-- /**
-- * The notification's params.
-- */
-- params?: any
--}
--```
type NotificationMessage is new Message with record
method: LSP_String;
-- params: LSP_Any;
end record;
--```typescript
--interface CancelParams {
-- /**
-- * The request id to cancel.
-- */
-- id: number | string;
--}
--```
type CancelParams is record
id: LSP_Number_Or_String;
end record;
--```typescript
--type DocumentUri = string;
--```
subtype DocumentUri is LSP.Types.LSP_String;
--```typescript
--export const EOL: string[] = ['\n', '\r\n', '\r'];
--```
-- This is intentionally empty. Nothing to declare for EOL
--```typescript
--interface Position {
-- /**
-- * Line position in a document (zero-based).
-- */
-- line: number;
--
-- /**
-- * Character offset on a line in a document (zero-based).
-- */
-- character: number;
--}
--```
type Position is record
line: Line_Number;
character: UTF_16_Index;
end record;
not overriding procedure Read_Position
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out Position);
for Position'Read use Read_Position;
not overriding procedure Write_Position
(S : access Ada.Streams.Root_Stream_Type'Class;
V : Position);
for Position'Write use Write_Position;
--```typescript
--interface Range {
-- /**
-- * The range's start position.
-- */
-- start: Position;
--
-- /**
-- * The range's end position.
-- */
-- end: Position;
--}
--```
type Span is record
first: Position;
last: Position; -- end: is reserved work
end record;
not overriding procedure Read_Span
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out Span);
for Span'Read use Read_Span;
not overriding procedure Write_Span
(S : access Ada.Streams.Root_Stream_Type'Class;
V : Span);
for Span'Write use Write_Span;
package Optional_Spans is new LSP.Generic_Optional (Span);
type Optional_Span is new Optional_Spans.Optional_Type;
--```typescript
--interface Location {
-- uri: DocumentUri;
-- range: Range;
--}
--```
type Location is record
uri: DocumentUri;
span: LSP.Messages.Span; -- range: is reserved word
end record;
not overriding procedure Write_Location
(S : access Ada.Streams.Root_Stream_Type'Class;
V : Location);
for Location'Write use Write_Location;
package Location_Vectors is new Ada.Containers.Vectors
(Positive, Location);
--+1
--```typescript
--namespace DiagnosticSeverity {
-- /**
-- * Reports an error.
-- */
-- export const Error = 1;
-- /**
-- * Reports a warning.
-- */
-- export const Warning = 2;
-- /**
-- * Reports an information.
-- */
-- export const Information = 3;
-- /**
-- * Reports a hint.
-- */
-- export const Hint = 4;
--}
--```
type DiagnosticSeverity is (Error, Warning, Information, Hint);
not overriding procedure Write_DiagnosticSeverity
(S : access Ada.Streams.Root_Stream_Type'Class;
V : DiagnosticSeverity);
for DiagnosticSeverity'Write use Write_DiagnosticSeverity;
package Optional_DiagnosticSeveritys is new LSP.Generic_Optional (DiagnosticSeverity);
type Optional_DiagnosticSeverity is new Optional_DiagnosticSeveritys.Optional_Type;
--```typescript
--interface Diagnostic {
-- /**
-- * The range at which the message applies.
-- */
-- range: Range;
--
-- /**
-- * The diagnostic's severity. Can be omitted. If omitted it is up to the
-- * client to interpret diagnostics as error, warning, info or hint.
-- */
-- severity?: number;
--
-- /**
-- * The diagnostic's code. Can be omitted.
-- */
-- code?: number | string;
--
-- /**
-- * A human-readable string describing the source of this
-- * diagnostic, e.g. 'typescript' or 'super lint'.
-- */
-- source?: string;
--
-- /**
-- * The diagnostic's message.
-- */
-- message: string;
--}
--```
type Diagnostic is record
span: LSP.Messages.Span;
severity: Optional_DiagnosticSeverity;
code: LSP_Number_Or_String;
source: Optional_String;
message: LSP_String;
end record;
not overriding procedure Read_Diagnostic
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out Diagnostic);
for Diagnostic'Read use Read_Diagnostic;
not overriding procedure Write_Diagnostic
(S : access Ada.Streams.Root_Stream_Type'Class;
V : Diagnostic);
for Diagnostic'Write use Write_Diagnostic;
package Diagnostic_Vectors is new Ada.Containers.Vectors
(Positive, Diagnostic);
type Diagnostic_Vector is new Diagnostic_Vectors.Vector with null record;
--```typescript
--interface Command {
-- /**
-- * Title of the command, like `save`.
-- */
-- title: string;
-- /**
-- * The identifier of the actual command handler.
-- */
-- command: string;
-- /**
-- * Arguments that the command handler should be
-- * invoked with.
-- */
-- arguments?: any[];
--}
--```
type Command is record
title: LSP_String;
command: LSP_String;
arguments: LSP_Any;
end record;
not overriding procedure Write_Command
(S : access Ada.Streams.Root_Stream_Type'Class;
V : Command);
for Command'Write use Write_Command;
package Command_Vectors is new Ada.Containers.Vectors
(Positive, Command);
type Command_Vector is new Command_Vectors.Vector with null record;
--```typescript
--interface TextEdit {
-- /**
-- * The range of the text document to be manipulated. To insert
-- * text into a document create a range where start === end.
-- */
-- range: Range;
--
-- /**
-- * The string to be inserted. For delete operations use an
-- * empty string.
-- */
-- newText: string;
--}
--```
type TextEdit is record
span: LSP.Messages.Span;
newText: LSP_String;
end record;
not overriding procedure Read_TextEdit
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out TextEdit);
for TextEdit'Read use Read_TextEdit;
not overriding procedure Write_TextEdit
(S : access Ada.Streams.Root_Stream_Type'Class;
V : TextEdit);
for TextEdit'Write use Write_TextEdit;
package Optional_TextEdits is new LSP.Generic_Optional (TextEdit);
type Optional_TextEdit is new Optional_TextEdits.Optional_Type;
package TextEdit_Vectors is new Ada.Containers.Vectors (Positive, TextEdit);
type TextEdit_Vector is new TextEdit_Vectors.Vector with null record;
not overriding procedure Read_TextEdit_Vector
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out TextEdit_Vector);
for TextEdit_Vector'Read use Read_TextEdit_Vector;
not overriding procedure Write_TextEdit_Vector
(S : access Ada.Streams.Root_Stream_Type'Class;
V : TextEdit_Vector);
for TextEdit_Vector'Write use Write_TextEdit_Vector;
--+N
--```typescript
--interface TextDocumentIdentifier {
-- /**
-- * The text document's URI.
-- */
-- uri: DocumentUri;
--}
--```
type TextDocumentIdentifier is tagged record
uri: DocumentUri;
end record;
not overriding procedure Read_TextDocumentIdentifier
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out TextDocumentIdentifier);
for TextDocumentIdentifier'Read use Read_TextDocumentIdentifier;
--+N+2
--```typescript
--interface VersionedTextDocumentIdentifier extends TextDocumentIdentifier {
-- /**
-- * The version number of this document.
-- */
-- version: number;
--}
--```
type VersionedTextDocumentIdentifier is new TextDocumentIdentifier with record
version: Version_Id;
end record;
not overriding procedure Read_VersionedTextDocumentIdentifier
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out VersionedTextDocumentIdentifier);
for VersionedTextDocumentIdentifier'Read use
Read_VersionedTextDocumentIdentifier;
not overriding procedure Write_VersionedTextDocumentIdentifier
(S : access Ada.Streams.Root_Stream_Type'Class;
V : VersionedTextDocumentIdentifier);
for VersionedTextDocumentIdentifier'Write use
Write_VersionedTextDocumentIdentifier;
--```typescript
--export interface TextDocumentEdit {
-- /**
-- * The text document to change.
-- */
-- textDocument: VersionedTextDocumentIdentifier;
--
-- /**
-- * The edits to be applied.
-- */
-- edits: TextEdit[];
--}
--```
type TextDocumentEdit is record
textDocument: VersionedTextDocumentIdentifier;
edits: TextEdit_Vector;
end record;
not overriding procedure Read_TextDocumentEdit
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out TextDocumentEdit);
for TextDocumentEdit'Read use Read_TextDocumentEdit;
not overriding procedure Write_TextDocumentEdit
(S : access Ada.Streams.Root_Stream_Type'Class;
V : TextDocumentEdit);
for TextDocumentEdit'Write use Write_TextDocumentEdit;
package TextDocumentEdit_Vectors is
new Ada.Containers.Vectors (Positive, TextDocumentEdit);
package TextDocumentEdit_Maps is new Ada.Containers.Hashed_Maps
(Key_Type => League.Strings.Universal_String,
Element_Type => TextEdit_Vector,
Hash => League.Strings.Hash,
Equivalent_Keys => League.Strings."=");
--```typescript
--export interface WorkspaceEdit {
-- /**
-- * Holds changes to existing resources.
-- */
-- changes?: { [uri: string]: TextEdit[]; };
--
-- /**
-- * An array of `TextDocumentEdit`s to express changes to n different text documents
-- * where each text document edit addresses a specific version of a text document.
-- * Whether a client supports versioned document edits is expressed via
-- * `WorkspaceClientCapabilities.workspaceEdit.documentChanges`.
-- */
-- documentChanges?: TextDocumentEdit[];
--}
--```
type WorkspaceEdit is record
changes: TextDocumentEdit_Maps.Map;
documentChanges: TextDocumentEdit_Vectors.Vector;
end record;
--```typescript
--interface TextDocumentItem {
-- /**
-- * The text document's URI.
-- */
-- uri: DocumentUri;
--
-- /**
-- * The text document's language identifier.
-- */
-- languageId: string;
--
-- /**
-- * The version number of this document (it will increase after each
-- * change, including undo/redo).
-- */
-- version: number;
--
-- /**
-- * The content of the opened text document.
-- */
-- text: string;
--}
--```
type TextDocumentItem is record
uri: DocumentUri;
languageId: LSP_String;
version: Version_Id;
text: LSP_String;
end record;
--```typescript
--interface TextDocumentPositionParams {
-- /**
-- * The text document.
-- */
-- textDocument: TextDocumentIdentifier;
--
-- /**
-- * The position inside the text document.
-- */
-- position: Position;
--}
--```
type TextDocumentPositionParams is tagged record
textDocument: TextDocumentIdentifier;
position: LSP.Messages.Position;
end record;
not overriding procedure Read_TextDocumentPositionParams
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out TextDocumentPositionParams);
for TextDocumentPositionParams'Read use Read_TextDocumentPositionParams;
--```typescript
--{ language: 'typescript', scheme: 'file' }
--{ language: 'json', pattern: '**/package.json' }
--```
-- This is just example of filter. Nothing to do
--```typescript
--export interface DocumentFilter {
-- /**
-- * A language id, like `typescript`.
-- */
-- language?: string;
--
-- /**
-- * A Uri [scheme](#Uri.scheme), like `file` or `untitled`.
-- */
-- scheme?: string;
--
-- /**
-- * A glob pattern, like `*.{ts,js}`.
-- */
-- pattern?: string;
--}
--```
type DocumentFilter is record
language: LSP.Types.Optional_String;
scheme: LSP.Types.Optional_String;
pattern: LSP.Types.Optional_String;
end record;
package DocumentFilter_Vectors is new Ada.Containers.Vectors
(Positive, DocumentFilter);
--```typescript
--export type DocumentSelector = DocumentFilter[];
--```
type DocumentSelector is new DocumentFilter_Vectors.Vector with null record;
type dynamicRegistration is new Optional_Boolean;
--+M
--```typescript
--/**
-- * Workspace specific client capabilities.
-- */
--export interface WorkspaceClientCapabilities {
-- /**
-- * The client supports applying batch edits to the workspace by supporting
-- * the request 'workspace/applyEdit'
-- */
-- applyEdit?: boolean;
--
-- /**
-- * Capabilities specific to `WorkspaceEdit`s
-- */
-- workspaceEdit?: {
-- /**
-- * The client supports versioned document changes in `WorkspaceEdit`s
-- */
-- documentChanges?: boolean;
-- };
--
-- /**
-- * Capabilities specific to the `workspace/didChangeConfiguration` notification.
-- */
-- didChangeConfiguration?: {
-- /**
-- * Did change configuration notification supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--
-- /**
-- * Capabilities specific to the `workspace/didChangeWatchedFiles` notification.
-- */
-- didChangeWatchedFiles?: {
-- /**
-- * Did change watched files notification supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--
-- /**
-- * Capabilities specific to the `workspace/symbol` request.
-- */
-- symbol?: {
-- /**
-- * Symbol request supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--
-- /**
-- * Capabilities specific to the `workspace/executeCommand` request.
-- */
-- executeCommand?: {
-- /**
-- * Execute command supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--}
--```
type WorkspaceClientCapabilities is record
applyEdit: Optional_Boolean;
workspaceEdit: Optional_Boolean;
didChangeConfiguration: dynamicRegistration;
didChangeWatchedFiles: dynamicRegistration;
symbol: dynamicRegistration;
executeCommand: dynamicRegistration;
end record;
--```typescript
--/**
-- * Text document specific client capabilities.
-- */
--export interface TextDocumentClientCapabilities {
--
-- synchronization?: {
-- /**
-- * Whether text document synchronization supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
--
-- /**
-- * The client supports sending will save notifications.
-- */
-- willSave?: boolean;
--
-- /**
-- * The client supports sending a will save request and
-- * waits for a response providing text edits which will
-- * be applied to the document before it is saved.
-- */
-- willSaveWaitUntil?: boolean;
--
-- /**
-- * The client supports did save notifications.
-- */
-- didSave?: boolean;
-- }
--
-- /**
-- * Capabilities specific to the `textDocument/completion`
-- */
-- completion?: {
-- /**
-- * Whether completion supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
--
-- /**
-- * The client supports the following `CompletionItem` specific
-- * capabilities.
-- */
-- completionItem?: {
-- /**
-- * Client supports snippets as insert text.
-- *
-- * A snippet can define tab stops and placeholders with `$1`, `$2`
-- * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
-- * the end of the snippet. Placeholders with equal identifiers are linked,
-- * that is typing in one will update others too.
-- */
-- snippetSupport?: boolean;
-- }
-- };
--
-- /**
-- * Capabilities specific to the `textDocument/hover`
-- */
-- hover?: {
-- /**
-- * Whether hover supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--
-- /**
-- * Capabilities specific to the `textDocument/signatureHelp`
-- */
-- signatureHelp?: {
-- /**
-- * Whether signature help supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--
-- /**
-- * Capabilities specific to the `textDocument/references`
-- */
-- references?: {
-- /**
-- * Whether references supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--
-- /**
-- * Capabilities specific to the `textDocument/documentHighlight`
-- */
-- documentHighlight?: {
-- /**
-- * Whether document highlight supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--
-- /**
-- * Capabilities specific to the `textDocument/documentSymbol`
-- */
-- documentSymbol?: {
-- /**
-- * Whether document symbol supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--
-- /**
-- * Capabilities specific to the `textDocument/formatting`
-- */
-- formatting?: {
-- /**
-- * Whether formatting supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--
-- /**
-- * Capabilities specific to the `textDocument/rangeFormatting`
-- */
-- rangeFormatting?: {
-- /**
-- * Whether range formatting supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--
-- /**
-- * Capabilities specific to the `textDocument/onTypeFormatting`
-- */
-- onTypeFormatting?: {
-- /**
-- * Whether on type formatting supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--
-- /**
-- * Capabilities specific to the `textDocument/definition`
-- */
-- definition?: {
-- /**
-- * Whether definition supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--
-- /**
-- * Capabilities specific to the `textDocument/codeAction`
-- */
-- codeAction?: {
-- /**
-- * Whether code action supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--
-- /**
-- * Capabilities specific to the `textDocument/codeLens`
-- */
-- codeLens?: {
-- /**
-- * Whether code lens supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--
-- /**
-- * Capabilities specific to the `textDocument/documentLink`
-- */
-- documentLink?: {
-- /**
-- * Whether document link supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--
-- /**
-- * Capabilities specific to the `textDocument/rename`
-- */
-- rename?: {
-- /**
-- * Whether rename supports dynamic registration.
-- */
-- dynamicRegistration?: boolean;
-- };
--}
--```
type synchronization is record
dynamicRegistration : Optional_Boolean;
willSave : Optional_Boolean;
willSaveWaitUntil : Optional_Boolean;
didSave : Optional_Boolean;
end record;
type completion is record
dynamicRegistration : Optional_Boolean;
snippetSupport : Optional_Boolean;
end record;
type TextDocumentClientCapabilities is record
synchronization: LSP.Messages.synchronization;
completion: LSP.Messages.completion;
hover: dynamicRegistration;
signatureHelp: dynamicRegistration;
references: dynamicRegistration;
documentHighlight: dynamicRegistration;
documentSymbol: dynamicRegistration;
formatting: dynamicRegistration;
rangeFormatting: dynamicRegistration;
onTypeFormatting: dynamicRegistration;
definition: dynamicRegistration;
codeAction: dynamicRegistration;
codeLens: dynamicRegistration;
documentLink: dynamicRegistration;
rename: dynamicRegistration;
end record;
--```typescript
--interface ClientCapabilities {
-- /**
-- * Workspace specific client capabilities.
-- */
-- workspace?: WorkspaceClientCapabilities;
--
-- /**
-- * Text document specific client capabilities.
-- */
-- textDocument?: TextDocumentClientCapabilities;
--
-- /**
-- * Experimental client capabilities.
-- */
-- experimental?: any;
--}
--```
type ClientCapabilities is record
workspace: WorkspaceClientCapabilities;
textDocument: TextDocumentClientCapabilities;
-- experimental?: any;
end record;
--```typescript
--interface InitializeParams {
-- /**
-- * The process Id of the parent process that started
-- * the server. Is null if the process has not been started by another process.
-- * If the parent process is not alive then the server should exit (see exit notification) its process.
-- */
-- processId: number | null;
--
-- /**
-- * The rootPath of the workspace. Is null
-- * if no folder is open.
-- *
-- * @deprecated in favour of rootUri.
-- */
-- rootPath?: string | null;
--
-- /**
-- * The rootUri of the workspace. Is null if no
-- * folder is open. If both `rootPath` and `rootUri` are set
-- * `rootUri` wins.
-- */
-- rootUri: DocumentUri | null;
--
-- /**
-- * User provided initialization options.
-- */
-- initializationOptions?: any;
--
-- /**
-- * The capabilities provided by the client (editor or tool)
-- */
-- capabilities: ClientCapabilities;
--
-- /**
-- * The initial trace setting. If omitted trace is disabled ('off').
-- */
-- trace?: 'off' | 'messages' | 'verbose';
--}
--```
type InitializeParams is record
processId: Optional_Number;
rootPath: LSP_String;
rootUri: DocumentUri; -- or null???
-- initializationOptions?: any;
capabilities: ClientCapabilities;
trace: Trace_Kinds;
end record;
--+K
--```typescript
--/**
-- * Defines how the host (editor) should sync document changes to the language server.
-- */
--export namespace TextDocumentSyncKind {
-- /**
-- * Documents should not be synced at all.
-- */
-- export const None = 0;
--
-- /**
-- * Documents are synced by always sending the full content
-- * of the document.
-- */
-- export const Full = 1;
--
-- /**
-- * Documents are synced by sending the full content on open.
-- * After that only incremental updates to the document are
-- * send.
-- */
-- export const Incremental = 2;
--}
--
--/**
-- * Completion options.
-- */
--export interface CompletionOptions {
-- /**
-- * The server provides support to resolve additional
-- * information for a completion item.
-- */
-- resolveProvider?: boolean;
--
-- /**
-- * The characters that trigger completion automatically.
-- */
-- triggerCharacters?: string[];
--}
--/**
-- * Signature help options.
-- */
--export interface SignatureHelpOptions {
-- /**
-- * The characters that trigger signature help
-- * automatically.
-- */
-- triggerCharacters?: string[];
--}
--
--/**
-- * Code Lens options.
-- */
--export interface CodeLensOptions {
-- /**
-- * Code lens has a resolve provider as well.
-- */
-- resolveProvider?: boolean;
--}
--
--/**
-- * Format document on type options
-- */
--export interface DocumentOnTypeFormattingOptions {
-- /**
-- * A character on which formatting should be triggered, like `}`.
-- */
-- firstTriggerCharacter: string;
--
-- /**
-- * More trigger characters.
-- */
-- moreTriggerCharacter?: string[];
--}
--
--/**
-- * Document link options
-- */
--export interface DocumentLinkOptions {
-- /**
-- * Document links have a resolve provider as well.
-- */
-- resolveProvider?: boolean;
--}
--
--/**
-- * Execute command options.
-- */
--export interface ExecuteCommandOptions {
-- /**
-- * The commands to be executed on the server
-- */
-- commands: string[]
--}
--
--/**
-- * Save options.
-- */
--export interface SaveOptions {
-- /**
-- * The client is supposed to include the content on save.
-- */
-- includeText?: boolean;
--}
--
--export interface TextDocumentSyncOptions {
-- /**
-- * Open and close notifications are sent to the server.
-- */
-- openClose?: boolean;
-- /**
-- * Change notificatins are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full
-- * and TextDocumentSyncKindIncremental.
-- */
-- change?: number;
-- /**
-- * Will save notifications are sent to the server.
-- */
-- willSave?: boolean;
-- /**
-- * Will save wait until requests are sent to the server.
-- */
-- willSaveWaitUntil?: boolean;
-- /**
-- * Save notifications are sent to the server.
-- */
-- save?: SaveOptions;
--}
--
--interface ServerCapabilities {
-- /**
-- * Defines how text documents are synced. Is either a detailed structure defining each notification or
-- * for backwards compatibility the TextDocumentSyncKind number.
-- */
-- textDocumentSync?: TextDocumentSyncOptions | number;
-- /**
-- * The server provides hover support.
-- */
-- hoverProvider?: boolean;
-- /**
-- * The server provides completion support.
-- */
-- completionProvider?: CompletionOptions;
-- /**
-- * The server provides signature help support.
-- */
-- signatureHelpProvider?: SignatureHelpOptions;
-- /**
-- * The server provides goto definition support.
-- */
-- definitionProvider?: boolean;
-- /**
-- * The server provides find references support.
-- */
-- referencesProvider?: boolean;
-- /**
-- * The server provides document highlight support.
-- */
-- documentHighlightProvider?: boolean;
-- /**
-- * The server provides document symbol support.
-- */
-- documentSymbolProvider?: boolean;
-- /**
-- * The server provides workspace symbol support.
-- */
-- workspaceSymbolProvider?: boolean;
-- /**
-- * The server provides code actions.
-- */
-- codeActionProvider?: boolean;
-- /**
-- * The server provides code lens.
-- */
-- codeLensProvider?: CodeLensOptions;
-- /**
-- * The server provides document formatting.
-- */
-- documentFormattingProvider?: boolean;
-- /**
-- * The server provides document range formatting.
-- */
-- documentRangeFormattingProvider?: boolean;
-- /**
-- * The server provides document formatting on typing.
-- */
-- documentOnTypeFormattingProvider?: DocumentOnTypeFormattingOptions;
-- /**
-- * The server provides rename support.
-- */
-- renameProvider?: boolean;
-- /**
-- * The server provides document link support.
-- */
-- documentLinkProvider?: DocumentLinkOptions;
-- /**
-- * The server provides execute command support.
-- */
-- executeCommandProvider?: ExecuteCommandOptions;
-- /**
-- * Experimental server capabilities.
-- */
-- experimental?: any;
--}
--```
type TextDocumentSyncKind is (None, Full, Incremental);
not overriding procedure Write_TextDocumentSyncKind
(S : access Ada.Streams.Root_Stream_Type'Class;
V : TextDocumentSyncKind);
for TextDocumentSyncKind'Write use Write_TextDocumentSyncKind;
package Optional_TextDocumentSyncKinds is new LSP.Generic_Optional (TextDocumentSyncKind);
type Optional_TextDocumentSyncKind is new Optional_TextDocumentSyncKinds.Optional_Type;
type TextDocumentSyncOptions is record
openClose: Optional_Boolean;
change: Optional_TextDocumentSyncKind;
willSave: Optional_Boolean;
willSaveWaitUntil: Optional_Boolean;
save: Optional_Boolean;
end record;
type Optional_TextDocumentSyncOptions
(Is_Set : Boolean := False;
Is_Number : Boolean := False) is
record
case Is_Set is
when True =>
case Is_Number is
when True =>
Value : TextDocumentSyncKind;
when False =>
Options : TextDocumentSyncOptions;
end case;
when False => null;
end case;
end record;
type CompletionOptions is record
resolveProvider: LSP.Types.Optional_Boolean;
triggerCharacters: LSP.Types.LSP_String_Vector;
end record;
not overriding procedure Write_CompletionOptions
(S : access Ada.Streams.Root_Stream_Type'Class;
V : CompletionOptions);
for CompletionOptions'Write use Write_CompletionOptions;
package Optional_CompletionOptionss is
new LSP.Generic_Optional (CompletionOptions);
type Optional_CompletionOptions is
new Optional_CompletionOptionss.Optional_Type;
type SignatureHelpOptions is record
triggerCharacters: LSP.Types.LSP_String_Vector;
end record;
not overriding procedure Write_SignatureHelpOptions
(S : access Ada.Streams.Root_Stream_Type'Class;
V : SignatureHelpOptions);
for SignatureHelpOptions'Write use Write_SignatureHelpOptions;
package Optional_SignatureHelpOptionss is
new LSP.Generic_Optional (SignatureHelpOptions);
type Optional_SignatureHelpOptions is
new Optional_SignatureHelpOptionss.Optional_Type;
type CodeLensOptions is record
resolveProvider: LSP.Types.Optional_Boolean;
end record;
not overriding procedure Write_CodeLensOptions
(S : access Ada.Streams.Root_Stream_Type'Class;
V : CodeLensOptions);
for CodeLensOptions'Write use Write_CodeLensOptions;
package Optional_CodeLensOptionss is
new LSP.Generic_Optional (CodeLensOptions);
type Optional_CodeLensOptions is
new Optional_CodeLensOptionss.Optional_Type;
type DocumentOnTypeFormattingOptions is record
firstTriggerCharacter: LSP.Types.LSP_String;
moreTriggerCharacter: LSP.Types.LSP_String_Vector;
end record;
not overriding procedure Write_DocumentOnTypeFormattingOptions
(S : access Ada.Streams.Root_Stream_Type'Class;
V : DocumentOnTypeFormattingOptions);
for DocumentOnTypeFormattingOptions'Write use Write_DocumentOnTypeFormattingOptions;
package Optional_DocumentOnTypeFormattingOptionss is
new LSP.Generic_Optional (DocumentOnTypeFormattingOptions);
type Optional_DocumentOnTypeFormattingOptions is
new Optional_DocumentOnTypeFormattingOptionss.Optional_Type;
type DocumentLinkOptions is record
resolveProvider: LSP.Types.Optional_Boolean;
end record;
type ExecuteCommandOptions is record
commands: LSP.Types.LSP_String_Vector;
end record;
type ServerCapabilities is record
textDocumentSync: Optional_TextDocumentSyncOptions;
hoverProvider: Optional_Boolean;
completionProvider: Optional_CompletionOptions;
signatureHelpProvider: Optional_SignatureHelpOptions;
definitionProvider: Optional_Boolean;
referencesProvider: Optional_Boolean;
documentHighlightProvider: Optional_Boolean;
documentSymbolProvider: Optional_Boolean;
workspaceSymbolProvider: Optional_Boolean;
codeActionProvider: Optional_Boolean;
codeLensProvider: Optional_CodeLensOptions;
documentFormattingProvider: Optional_Boolean;
documentRangeFormattingProvider: Optional_Boolean;
documentOnTypeFormattingProvider: Optional_DocumentOnTypeFormattingOptions;
renameProvider: Optional_Boolean;
documentLinkProvider: DocumentLinkOptions;
executeCommandProvider: ExecuteCommandOptions;
-- experimental?: any;
end record;
--```typescript
--interface InitializeResult {
-- /**
-- * The capabilities the language server provides.
-- */
-- capabilities: ServerCapabilities;
--}
--```
type InitializeResult is record
capabilities: ServerCapabilities;
end record;
type Initialize_Response is new ResponseMessage with record
result: InitializeResult;
end record;
--```typescript
--/**
-- * Known error codes for an `InitializeError`;
-- */
--export namespace InitializeError {
-- /**
-- * If the protocol version provided by the client can't be handled by the server.
-- * @deprecated This initialize error got replaced by client capabilities. There is
-- * no version handshake in version 3.0x
-- */
-- export const unknownProtocolVersion: number = 1;
--}
--```
unknownProtocolVersion: constant := 1;
--```typescript
--interface InitializeError {
-- /**
-- * Indicates whether the client execute the following retry logic:
-- * (1) show the message provided by the ResponseError to the user
-- * (2) user selects retry or cancel
-- * (3) if user selected retry the initialize method is sent again.
-- */
-- retry: boolean;
--}
--```
type InitializeError is record
retry: Boolean;
end record;
--+J
--```typescript
--export namespace MessageType {
-- /**
-- * An error message.
-- */
-- export const Error = 1;
-- /**
-- * A warning message.
-- */
-- export const Warning = 2;
-- /**
-- * An information message.
-- */
-- export const Info = 3;
-- /**
-- * A log message.
-- */
-- export const Log = 4;
--}
--```
type MessageType is (Error, Warning, Info, Log);
--```typescript
--interface ShowMessageParams {
-- /**
-- * The message type. See {@link MessageType}.
-- */
-- type: number;
--
-- /**
-- * The actual message.
-- */
-- message: string;
--}
--```
type ShowMessageParams is record
the_type: MessageType; -- type: is reserver word
message: LSP_String;
end record;
--```typescript
--interface ShowMessageRequestParams {
-- /**
-- * The message type. See {@link MessageType}
-- */
-- type: number;
--
-- /**
-- * The actual message
-- */
-- message: string;
--
-- /**
-- * The message action items to present.
-- */
-- actions?: MessageActionItem[];
--}
--```
type ShowMessageRequestParams is record
the_type: MessageType; -- type: is reserver word
message: LSP_String;
actions: MessageActionItem_Vector;
end record;
--```typescript
--interface MessageActionItem {
-- /**
-- * A short title like 'Retry', 'Open Log' etc.
-- */
-- title: string;
--}
--```
-- Lets use League.Strings.Universal_String for MessageActionItem
--```typescript
--interface LogMessageParams {
-- /**
-- * The message type. See {@link MessageType}
-- */
-- type: number;
--
-- /**
-- * The actual message
-- */
-- message: string;
--}
--```
type LogMessageParams is record
the_type: MessageType; -- type: is reserver word
message: LSP_String;
end record;
--```typescript
--export interface TextDocumentRegistrationOptions {
-- /**
-- * A document selector to identify the scope of the registration. If set to null
-- * the document selector provided on the client side will be used.
-- */
-- documentSelector: DocumentSelector | null;
--}
--```
type TextDocumentRegistrationOptions is tagged record
documentSelector: LSP.Messages.DocumentSelector;
end record;
--```typescript
--/**
-- * Descibe options to be used when registered for text document change events.
-- */
--export interface TextDocumentChangeRegistrationOptions extends TextDocumentRegistrationOptions {
-- /**
-- * How documents are synced to the server. See TextDocumentSyncKind.Full
-- * and TextDocumentSyncKindIncremental.
-- */
-- syncKind: number;
--}
--```
type TextDocumentChangeRegistrationOptions is
new TextDocumentRegistrationOptions with
record
syncKind: TextDocumentSyncKind;
end record;
--```typescript
--export interface TextDocumentSaveRegistrationOptions extends TextDocumentRegistrationOptions {
-- /**
-- * The client is supposed to include the content on save.
-- */
-- includeText?: boolean;
--}
--```
type TextDocumentSaveRegistrationOptions is
new TextDocumentRegistrationOptions with record
includeText: Optional_Boolean;
end record;
--```typescript
--export interface CompletionRegistrationOptions extends TextDocumentRegistrationOptions {
-- /**
-- * The characters that trigger completion automatically.
-- */
-- triggerCharacters?: string[];
--
-- /**
-- * The server provides support to resolve additional
-- * information for a completion item.
-- */
-- resolveProvider?: boolean;
--}
--```
type CompletionRegistrationOptions is new TextDocumentRegistrationOptions with record
triggerCharacters: LSP_String_Vector;
resolveProvider: Optional_Boolean;
end record;
--```typescript
--export interface SignatureHelpRegistrationOptions extends TextDocumentRegistrationOptions {
-- /**
-- * The characters that trigger signature help
-- * automatically.
-- */
-- triggerCharacters?: string[];
--}
--```
type SignatureHelpRegistrationOptions is new TextDocumentRegistrationOptions with record
triggerCharacters: LSP_String_Vector;
end record;
--```typescript
--export interface CodeLensRegistrationOptions extends TextDocumentRegistrationOptions {
-- /**
-- * Code lens has a resolve provider as well.
-- */
-- resolveProvider?: boolean;
--}
--```
type CodeLensRegistrationOptions is new TextDocumentRegistrationOptions with record
resolveProvider: Optional_Boolean;
end record;
--```typescript
--export interface DocumentLinkRegistrationOptions extends TextDocumentRegistrationOptions {
-- /**
-- * Document links have a resolve provider as well.
-- */
-- resolveProvider?: boolean;
--}
--```
type DocumentLinkRegistrationOptions is new TextDocumentRegistrationOptions with record
resolveProvider: Optional_Boolean;
end record;
--```typescript
--export interface DocumentOnTypeFormattingRegistrationOptions extends TextDocumentRegistrationOptions {
-- /**
-- * A character on which formatting should be triggered, like `}`.
-- */
-- firstTriggerCharacter: string;
-- /**
-- * More trigger characters.
-- */
-- moreTriggerCharacter?: string[]
--}
--```
type DocumentOnTypeFormattingRegistrationOptions is new TextDocumentRegistrationOptions with record
firstTriggerCharacter: LSP_String;
moreTriggerCharacter: LSP_String_Vector;
end record;
--```typescript
--/**
-- * Execute command registration options.
-- */
--export interface ExecuteCommandRegistrationOptions {
-- /**
-- * The commands to be executed on the server
-- */
-- commands: string[]
--}
--```
type ExecuteCommandRegistrationOptions is record
commands: LSP_String_Vector;
end record;
type Registration_Option (Kind : Registration_Option_Kinds := Absent) is record
case Kind is
when Absent =>
null;
when Text_Document_Registration_Option =>
Text_Document : TextDocumentRegistrationOptions;
when Text_Document_Change_Registration_Option =>
Text_Document_Change : TextDocumentChangeRegistrationOptions;
when Text_Document_Save_Registration_Option =>
Text_Document_Save : TextDocumentSaveRegistrationOptions;
when Completion_Registration_Option =>
Completion : CompletionRegistrationOptions;
when Signature_Help_Registration_Option =>
SignatureHelp : SignatureHelpRegistrationOptions;
when Code_Lens_Registration_Option =>
CodeLens : CodeLensRegistrationOptions;
when Document_Link_Registration_Option =>
DocumentLink : DocumentLinkRegistrationOptions;
when Document_On_Type_Formatting_Registration_Option =>
DocumentOnTypeFormatting : DocumentOnTypeFormattingRegistrationOptions;
when Execute_Command_Registration_Option =>
ExecuteCommand : ExecuteCommandRegistrationOptions;
end case;
end record;
--```typescript
--/**
-- * General parameters to register for a capability.
-- */
--export interface Registration {
-- /**
-- * The id used to register the request. The id can be used to deregister
-- * the request again.
-- */
-- id: string;
--
-- /**
-- * The method / capability to register for.
-- */
-- method: string;
--
-- /**
-- * Options necessary for the registration.
-- */
-- registerOptions?: any;
--}
--
--export interface RegistrationParams {
-- registrations: Registration[];
--}
--```
type Registration is record
id: LSP_String;
method: LSP_String;
registerOptions: Registration_Option;
end record;
type Registration_Array is array (Positive range <>) of Registration;
type RegistrationParams (Length : Natural) is record
registrations: Registration_Array (1 .. Length);
end record;
--```typescript
--/**
-- * General parameters to unregister a capability.
-- */
--export interface Unregistration {
-- /**
-- * The id used to unregister the request or notification. Usually an id
-- * provided during the register request.
-- */
-- id: string;
--
-- /**
-- * The method / capability to unregister for.
-- */
-- method: string;
--}
--
--export interface UnregistrationParams {
-- unregisterations: Unregistration[];
--}
--```
type Unregistration is record
id: LSP_String;
method: LSP_String;
end record;
package Unregistration_Vectors is new Ada.Containers.Vectors
(Positive, Unregistration);
type UnregistrationParams is
new Unregistration_Vectors.Vector with null record;
--```typescript
--interface DidChangeConfigurationParams {
-- /**
-- * The actual changed settings
-- */
-- settings: any;
--}
--```
type DidChangeConfigurationParams is record
settings: LSP.Types.LSP_Any;
end record;
--```typescript
--interface DidOpenTextDocumentParams {
-- /**
-- * The document that was opened.
-- */
-- textDocument: TextDocumentItem;
--}
--```
type DidOpenTextDocumentParams is record
textDocument: TextDocumentItem;
end record;
--```typescript
--interface DidChangeTextDocumentParams {
-- /**
-- * The document that did change. The version number points
-- * to the version after all provided content changes have
-- * been applied.
-- */
-- textDocument: VersionedTextDocumentIdentifier;
--
-- /**
-- * The actual content changes. The content changes descibe single state changes
-- * to the document. So if there are two content changes c1 and c2 for a document
-- * in state S10 then c1 move the document to S11 and c2 to S12.
-- */
-- contentChanges: TextDocumentContentChangeEvent[];
--}
--
--/**
-- * An event describing a change to a text document. If range and rangeLength are omitted
-- * the new text is considered to be the full content of the document.
-- */
--interface TextDocumentContentChangeEvent {
-- /**
-- * The range of the document that changed.
-- */
-- range?: Range;
--
-- /**
-- * The length of the range that got replaced.
-- */
-- rangeLength?: number;
--
-- /**
-- * The new text of the range/document.
-- */
-- text: string;
--}
--```
type TextDocumentContentChangeEvent is record
span: Optional_Span;
rangeLength: LSP.Types.Optional_Number;
text: LSP_String;
end record;
not overriding procedure Read_TextDocumentContentChangeEvent
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out TextDocumentContentChangeEvent);
for TextDocumentContentChangeEvent'Read use
Read_TextDocumentContentChangeEvent;
package TextDocumentContentChangeEvent_Vectors is new Ada.Containers.Vectors
(Positive, TextDocumentContentChangeEvent);
type TextDocumentContentChangeEvent_Vector is
new TextDocumentContentChangeEvent_Vectors.Vector with null record;
not overriding procedure Read_TextDocumentContentChangeEvent_Vector
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out TextDocumentContentChangeEvent_Vector);
for TextDocumentContentChangeEvent_Vector'Read use
Read_TextDocumentContentChangeEvent_Vector;
type DidChangeTextDocumentParams is record
textDocument: VersionedTextDocumentIdentifier;
contentChanges: TextDocumentContentChangeEvent_Vector;
end record;
--```typescript
--/**
-- * The parameters send in a will save text document notification.
-- */
--export interface WillSaveTextDocumentParams {
-- /**
-- * The document that will be saved.
-- */
-- textDocument: TextDocumentIdentifier;
--
-- /**
-- * The 'TextDocumentSaveReason'.
-- */
-- reason: number;
--}
--
--/**
-- * Represents reasons why a text document is saved.
-- */
--export namespace TextDocumentSaveReason {
--
-- /**
-- * Manually triggered, e.g. by the user pressing save, by starting debugging,
-- * or by an API call.
-- */
-- export const Manual = 1;
--
-- /**
-- * Automatic after a delay.
-- */
-- export const AfterDelay = 2;
--
-- /**
-- * When the editor lost focus.
-- */
-- export const FocusOut = 3;
--}
--```
type TextDocumentSaveReason is (Manual, AfterDelay, FocusOut);
type WillSaveTextDocumentParams is record
textDocument: TextDocumentIdentifier;
reason: TextDocumentSaveReason;
end record;
--```typescript
--interface DidSaveTextDocumentParams {
-- /**
-- * The document that was saved.
-- */
-- textDocument: TextDocumentIdentifier;
--
-- /**
-- * Optional the content when saved. Depends on the includeText value
-- * when the save notifcation was requested.
-- */
-- text?: string;
--}
--```
type DidSaveTextDocumentParams is record
textDocument: TextDocumentIdentifier;
text: Optional_String;
end record;
--```typescript
--interface DidCloseTextDocumentParams {
-- /**
-- * The document that was closed.
-- */
-- textDocument: TextDocumentIdentifier;
--}
--```
type DidCloseTextDocumentParams is record
textDocument: TextDocumentIdentifier;
end record;
--```typescript
--/**
-- * An event describing a file change.
-- */
--interface FileEvent {
-- /**
-- * The file's URI.
-- */
-- uri: DocumentUri;
-- /**
-- * The change type.
-- */
-- type: number;
--}
--
--/**
-- * The file event type.
-- */
--export namespace FileChangeType {
-- /**
-- * The file got created.
-- */
-- export const Created = 1;
-- /**
-- * The file got changed.
-- */
-- export const Changed = 2;
-- /**
-- * The file got deleted.
-- */
-- export const Deleted = 3;
--}
--```
type FileChangeType is (Created, Changed, Deleted);
type FileEvent is record
uri: DocumentUri;
the_type : FileChangeType; -- type: is reserver word
end record;
package FileEvent_Vectors is new Ada.Containers.Vectors (Positive, FileEvent);
--```typescript
--interface DidChangeWatchedFilesParams {
-- /**
-- * The actual file events.
-- */
-- changes: FileEvent[];
--}
--```
type DidChangeWatchedFilesParams is record
changes: FileEvent_Vectors.Vector;
end record;
--```typescript
--interface PublishDiagnosticsParams {
-- /**
-- * The URI for which diagnostic information is reported.
-- */
-- uri: DocumentUri;
--
-- /**
-- * An array of diagnostic information items.
-- */
-- diagnostics: Diagnostic[];
--}
--```
type PublishDiagnosticsParams is record
uri: DocumentUri;
diagnostics: Diagnostic_Vector;
end record;
--```typescript
--/**
-- * Represents a collection of [completion items](#CompletionItem) to be presented
-- * in the editor.
-- */
--interface CompletionList {
-- /**
-- * This list it not complete. Further typing should result in recomputing
-- * this list.
-- */
-- isIncomplete: boolean;
-- /**
-- * The completion items.
-- */
-- items: CompletionItem[];
--}
--
--/**
-- * Defines whether the insert text in a completion item should be interpreted as
-- * plain text or a snippet.
-- */
--namespace InsertTextFormat {
-- /**
-- * The primary text to be inserted is treated as a plain string.
-- */
-- export const PlainText = 1;
--
-- /**
-- * The primary text to be inserted is treated as a snippet.
-- *
-- * A snippet can define tab stops and placeholders with `$1`, `$2`
-- * and `${3:foo}`. `$0` defines the final tab stop, it defaults to
-- * the end of the snippet. Placeholders with equal identifiers are linked,
-- * that is typing in one will update others too.
-- *
-- * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md
-- */
-- export const Snippet = 2;
--}
--
--type InsertTextFormat = 1 | 2;
--
--interface CompletionItem {
-- /**
-- * The label of this completion item. By default
-- * also the text that is inserted when selecting
-- * this completion.
-- */
-- label: string;
-- /**
-- * The kind of this completion item. Based of the kind
-- * an icon is chosen by the editor.
-- */
-- kind?: number;
-- /**
-- * A human-readable string with additional information
-- * about this item, like type or symbol information.
-- */
-- detail?: string;
-- /**
-- * A human-readable string that represents a doc-comment.
-- */
-- documentation?: string;
-- /**
-- * A string that shoud be used when comparing this item
-- * with other items. When `falsy` the label is used.
-- */
-- sortText?: string;
-- /**
-- * A string that should be used when filtering a set of
-- * completion items. When `falsy` the label is used.
-- */
-- filterText?: string;
-- /**
-- * A string that should be inserted a document when selecting
-- * this completion. When `falsy` the label is used.
-- */
-- insertText?: string;
-- /**
-- * The format of the insert text. The format applies to both the `insertText` property
-- * and the `newText` property of a provided `textEdit`.
-- */
-- insertTextFormat?: InsertTextFormat;
-- /**
-- * An edit which is applied to a document when selecting this completion. When an edit is provided the value of
-- * `insertText` is ignored.
-- *
-- * *Note:* The range of the edit must be a single line range and it must contain the position at which completion
-- * has been requested.
-- */
-- textEdit?: TextEdit;
-- /**
-- * An optional array of additional text edits that are applied when
-- * selecting this completion. Edits must not overlap with the main edit
-- * nor with themselves.
-- */
-- additionalTextEdits?: TextEdit[];
-- /**
-- * An optional set of characters that when pressed while this completion is active will accept it first and
-- * then type that character. *Note* that all commit characters should have `length=1` and that superfluous
-- * characters will be ignored.
-- */
-- commitCharacters?: string[];
-- /**
-- * An optional command that is executed *after* inserting this completion. *Note* that
-- * additional modifications to the current document should be described with the
-- * additionalTextEdits-property.
-- */
-- command?: Command;
-- /**
-- * An data entry field that is preserved on a completion item between
-- * a completion and a completion resolve request.
-- */
-- data?: any
--}
--
--/**
-- * The kind of a completion entry.
-- */
--namespace CompletionItemKind {
-- export const Text = 1;
-- export const Method = 2;
-- export const Function = 3;
-- export const Constructor = 4;
-- export const Field = 5;
-- export const Variable = 6;
-- export const Class = 7;
-- export const Interface = 8;
-- export const Module = 9;
-- export const Property = 10;
-- export const Unit = 11;
-- export const Value = 12;
-- export const Enum = 13;
-- export const Keyword = 14;
-- export const Snippet = 15;
-- export const Color = 16;
-- export const File = 17;
-- export const Reference = 18;
--}
--```
type InsertTextFormat is (PlainText, Snippet);
not overriding procedure Write_InsertTextFormat
(S : access Ada.Streams.Root_Stream_Type'Class;
V : InsertTextFormat);
for InsertTextFormat'Write use Write_InsertTextFormat;
package Optional_InsertTextFormats is new LSP.Generic_Optional (InsertTextFormat);
type Optional_InsertTextFormat is new Optional_InsertTextFormats.Optional_Type;
type CompletionItemKind is (
Text,
Method,
A_Function,
Constructor,
Field,
Variable,
Class,
An_Interface,
Module,
Property,
Unit,
Value,
Enum,
Keyword,
Snippet,
Color,
File,
Reference);
not overriding procedure Write_CompletionItemKind
(S : access Ada.Streams.Root_Stream_Type'Class;
V : CompletionItemKind);
for CompletionItemKind'Write use Write_CompletionItemKind;
package Optional_CompletionItemKinds is new LSP.Generic_Optional (CompletionItemKind);
type Optional_CompletionItemKind is new Optional_CompletionItemKinds.Optional_Type;
type CompletionItem is record
label: LSP_String;
kind: Optional_CompletionItemKind;
detail: Optional_String;
documentation: Optional_String;
sortText: Optional_String;
filterText: Optional_String;
insertText: Optional_String;
insertTextFormat: Optional_InsertTextFormat;
textEdit: Optional_TextEdit;
additionalTextEdits: TextEdit_Vector;
commitCharacters: LSP_String_Vector;
command: LSP.Messages.Command; -- Optional ???
-- data?: any
end record;
not overriding procedure Write_CompletionItem
(S : access Ada.Streams.Root_Stream_Type'Class;
V : CompletionItem);
for CompletionItem'Write use Write_CompletionItem;
package CompletionItem_Vectors is new Ada.Containers.Vectors
(Positive, CompletionItem);
type CompletionList is record
isIncomplete: Boolean := False;
items: CompletionItem_Vectors.Vector;
end record;
type Completion_Response is new ResponseMessage with record
result: CompletionList;
end record;
--```typescript
--/**
-- * MarkedString can be used to render human readable text. It is either a markdown string
-- * or a code-block that provides a language and a code snippet. The language identifier
-- * is sematically equal to the optional language identifier in fenced code blocks in GitHub
-- * issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
-- *
-- * The pair of a language and a value is an equivalent to markdown:
-- * ```${language}
-- * ${value}
-- * ```
-- *
-- * Note that markdown strings will be sanitized - that means html will be escaped.
-- */
--type MarkedString = string | { language: string; value: string };
--```
type MarkedString (Is_String : Boolean := True) is record
value : LSP_String;
case Is_String is
when True =>
null;
when False =>
language : LSP_String;
end case;
end record;
not overriding procedure Write_MarkedString
(S : access Ada.Streams.Root_Stream_Type'Class;
V : MarkedString);
for MarkedString'Write use Write_MarkedString;
package MarkedString_Vectors is new Ada.Containers.Vectors
(Positive, MarkedString);
--```typescript
--/**
-- * The result of a hover request.
-- */
--interface Hover {
-- /**
-- * The hover's content
-- */
-- contents: MarkedString | MarkedString[];
--
-- /**
-- * An optional range is a range inside a text document
-- * that is used to visualize a hover, e.g. by changing the background color.
-- */
-- range?: Range;
--}
--```
type Hover is record
contents: MarkedString_Vectors.Vector;
Span: Optional_Span;
end record;
type Hover_Response is new ResponseMessage with record
result: Hover;
end record;
--```typescript
--/**
-- * Signature help represents the signature of something
-- * callable. There can be multiple signature but only one
-- * active and only one active parameter.
-- */
--interface SignatureHelp {
-- /**
-- * One or more signatures.
-- */
-- signatures: SignatureInformation[];
--
-- /**
-- * The active signature. If omitted or the value lies outside the
-- * range of `signatures` the value defaults to zero or is ignored if
-- * `signatures.length === 0`. Whenever possible implementors should
-- * make an active decision about the active signature and shouldn't
-- * rely on a default value.
-- * In future version of the protocol this property might become
-- * mandantory to better express this.
-- */
-- activeSignature?: number;
--
-- /**
-- * The active parameter of the active signature. If omitted or the value
-- * lies outside the range of `signatures[activeSignature].parameters`
-- * defaults to 0 if the active signature has parameters. If
-- * the active signature has no parameters it is ignored.
-- * In future version of the protocol this property might become
-- * mandantory to better express the active parameter if the
-- * active signature does have any.
-- */
-- activeParameter?: number;
--}
--
--/**
-- * Represents the signature of something callable. A signature
-- * can have a label, like a function-name, a doc-comment, and
-- * a set of parameters.
-- */
--interface SignatureInformation {
-- /**
-- * The label of this signature. Will be shown in
-- * the UI.
-- */
-- label: string;
--
-- /**
-- * The human-readable doc-comment of this signature. Will be shown
-- * in the UI but can be omitted.
-- */
-- documentation?: string;
--
-- /**
-- * The parameters of this signature.
-- */
-- parameters?: ParameterInformation[];
--}
--
--/**
-- * Represents a parameter of a callable-signature. A parameter can
-- * have a label and a doc-comment.
-- */
--interface ParameterInformation {
-- /**
-- * The label of this parameter. Will be shown in
-- * the UI.
-- */
-- label: string;
--
-- /**
-- * The human-readable doc-comment of this parameter. Will be shown
-- * in the UI but can be omitted.
-- */
-- documentation?: string;
--}
--```
type ParameterInformation is record
label: LSP_String;
documentation: Optional_String;
end record;
not overriding procedure Write_ParameterInformation
(S : access Ada.Streams.Root_Stream_Type'Class;
V : ParameterInformation);
for ParameterInformation'Write use Write_ParameterInformation;
package ParameterInformation_Vectors is new Ada.Containers.Vectors
(Positive, ParameterInformation);
type SignatureInformation is record
label: LSP_String;
documentation: Optional_String;
parameters: ParameterInformation_Vectors.Vector;
end record;
not overriding procedure Write_SignatureInformation
(S : access Ada.Streams.Root_Stream_Type'Class;
V : SignatureInformation);
for SignatureInformation'Write use Write_SignatureInformation;
package SignatureInformation_Vectors is new Ada.Containers.Vectors
(Positive, SignatureInformation);
type SignatureHelp is record
signatures: SignatureInformation_Vectors.Vector;
activeSignature: Optional_Number;
activeParameter: Optional_Number;
end record;
type SignatureHelp_Response is new ResponseMessage with record
result: SignatureHelp;
end record;
--```typescript
--interface ReferenceContext {
-- /**
-- * Include the declaration of the current symbol.
-- */
-- includeDeclaration: boolean;
--}
--```
type ReferenceContext is record
includeDeclaration: Boolean;
end record;
--```typescript
--interface ReferenceParams extends TextDocumentPositionParams {
-- context: ReferenceContext
--}
--```
type ReferenceParams is new TextDocumentPositionParams with record
context: ReferenceContext;
end record;
--```typescript
--/**
-- * A document highlight is a range inside a text document which deserves
-- * special attention. Usually a document highlight is visualized by changing
-- * the background color of its range.
-- *
-- */
--interface DocumentHighlight {
-- /**
-- * The range this highlight applies to.
-- */
-- range: Range;
--
-- /**
-- * The highlight kind, default is DocumentHighlightKind.Text.
-- */
-- kind?: number;
--}
--
--/**
-- * A document highlight kind.
-- */
--export namespace DocumentHighlightKind {
-- /**
-- * A textual occurrence.
-- */
-- export const Text = 1;
--
-- /**
-- * Read-access of a symbol, like reading a variable.
-- */
-- export const Read = 2;
--
-- /**
-- * Write-access of a symbol, like writing to a variable.
-- */
-- export const Write = 3;
--}
--```
type DocumentHighlightKind is (Unspecified, Text, Read, Write);
type DocumentHighlight is record
span: LSP.Messages.Span;
kind: DocumentHighlightKind;
end record;
not overriding procedure Write_DocumentHighlight
(S : access Ada.Streams.Root_Stream_Type'Class;
V : DocumentHighlight);
for DocumentHighlight'Write use Write_DocumentHighlight;
package DocumentHighlight_Vectors is new Ada.Containers.Vectors
(Positive, DocumentHighlight);
type Highlight_Response is new ResponseMessage with record
result: DocumentHighlight_Vectors.Vector;
end record;
--```typescript
--interface DocumentSymbolParams {
-- /**
-- * The text document.
-- */
-- textDocument: TextDocumentIdentifier;
--}
--```
type DocumentSymbolParams is record
textDocument: TextDocumentIdentifier;
end record;
--```typescript
--/**
-- * Represents information about programming constructs like variables, classes,
-- * interfaces etc.
-- */
--interface SymbolInformation {
-- /**
-- * The name of this symbol.
-- */
-- name: string;
--
-- /**
-- * The kind of this symbol.
-- */
-- kind: number;
--
-- /**
-- * The location of this symbol. The location's range is used by a tool
-- * to reveal the location in the editor. If the symbol is selected in the
-- * tool the range's start information is used to position the cursor. So
-- * the range usually spwans more then the actual symbol's name and does
-- * normally include thinks like visibility modifiers.
-- *
-- * The range doesn't have to denote a node range in the sense of a abstract
-- * syntax tree. It can therefore not be used to re-construct a hierarchy of
-- * the symbols.
-- */
-- location: Location;
--
-- /**
-- * The name of the symbol containing this symbol. This information is for
-- * user interface purposes (e.g. to render a qaulifier in the user interface
-- * if necessary). It can't be used to re-infer a hierarchy for the document
-- * symbols.
-- */
-- containerName?: string;
--}
--
--/**
-- * A symbol kind.
-- */
--export namespace SymbolKind {
-- export const File = 1;
-- export const Module = 2;
-- export const Namespace = 3;
-- export const Package = 4;
-- export const Class = 5;
-- export const Method = 6;
-- export const Property = 7;
-- export const Field = 8;
-- export const Constructor = 9;
-- export const Enum = 10;
-- export const Interface = 11;
-- export const Function = 12;
-- export const Variable = 13;
-- export const Constant = 14;
-- export const String = 15;
-- export const Number = 16;
-- export const Boolean = 17;
-- export const Array = 18;
--}
--```
type SymbolKind is
(File,
Module,
Namespace,
A_Package,
Class,
Method,
Property,
Field,
Constructor,
Enum,
An_Interface,
A_Function,
Variable,
A_Constant,
String,
Number,
A_Boolean,
An_Array);
type SymbolInformation is record
name: LSP_String;
kind: SymbolKind;
location: LSP.Messages.Location;
containerName: Optional_String;
end record;
not overriding procedure Write_SymbolInformation
(S : access Ada.Streams.Root_Stream_Type'Class;
V : SymbolInformation);
for SymbolInformation'Write use Write_SymbolInformation;
package SymbolInformation_Vectors is new Ada.Containers.Vectors
(Positive, SymbolInformation);
type SymbolInformation_Vector is
new SymbolInformation_Vectors.Vector with null record;
type Symbol_Response is new ResponseMessage with record
result: SymbolInformation_Vector;
end record;
--```typescript
--/**
-- * The parameters of a Workspace Symbol Request.
-- */
--interface WorkspaceSymbolParams {
-- /**
-- * A non-empty query string
-- */
-- query: string;
--}
--```
type WorkspaceSymbolParams is record
query: LSP_String;
end record;
--```typescript
--/**
-- * Params for the CodeActionRequest
-- */
--interface CodeActionParams {
-- /**
-- * The document in which the command was invoked.
-- */
-- textDocument: TextDocumentIdentifier;
--
-- /**
-- * The range for which the command was invoked.
-- */
-- range: Range;
--
-- /**
-- * Context carrying additional information.
-- */
-- context: CodeActionContext;
--}
--
--/**
-- * Contains additional diagnostic information about the context in which
-- * a code action is run.
-- */
--interface CodeActionContext {
-- /**
-- * An array of diagnostics.
-- */
-- diagnostics: Diagnostic[];
--}
--```
type CodeActionContext is record
diagnostics: Diagnostic_Vector;
end record;
type CodeActionParams is record
textDocument: TextDocumentIdentifier;
span: LSP.Messages.Span;
context: CodeActionContext;
end record;
type CodeAction_Response is new ResponseMessage with record
result: Command_Vector;
end record;
--```typescript
--interface CodeLensParams {
-- /**
-- * The document to request code lens for.
-- */
-- textDocument: TextDocumentIdentifier;
--}
--```
type CodeLensParams is record
textDocument: TextDocumentIdentifier;
end record;
--```typescript
--/**
-- * A code lens represents a command that should be shown along with
-- * source text, like the number of references, a way to run tests, etc.
-- *
-- * A code lens is _unresolved_ when no command is associated to it. For performance
-- * reasons the creation of a code lens and resolving should be done in two stages.
-- */
--interface CodeLens {
-- /**
-- * The range in which this code lens is valid. Should only span a single line.
-- */
-- range: Range;
--
-- /**
-- * The command this code lens represents.
-- */
-- command?: Command;
--
-- /**
-- * A data entry field that is preserved on a code lens item between
-- * a code lens and a code lens resolve request.
-- */
-- data?: any
--}
--```
type CodeLens is record
span: LSP.Messages.Span;
command: LSP.Messages.Command; -- Optional ???
-- data?: any
end record;
--```typescript
--interface DocumentLinkParams {
-- /**
-- * The document to provide document links for.
-- */
-- textDocument: TextDocumentIdentifier;
--}
--```
type DocumentLinkParams is record
textDocument: TextDocumentIdentifier;
end record;
--```typescript
--/**
-- * A document link is a range in a text document that links to an internal or external resource, like another
-- * text document or a web site.
-- */
--interface DocumentLink {
-- /**
-- * The range this link applies to.
-- */
-- range: Range;
-- /**
-- * The uri this link points to. If missing a resolve request is sent later.
-- */
-- target?: DocumentUri;
--}
--```
type DocumentLink is record
span: LSP.Messages.Span;
target: DocumentUri; -- Optional ???
end record;
--```typescript
--interface DocumentFormattingParams {
-- /**
-- * The document to format.
-- */
-- textDocument: TextDocumentIdentifier;
--
-- /**
-- * The format options.
-- */
-- options: FormattingOptions;
--}
--
--/**
-- * Value-object describing what options formatting should use.
-- */
--interface FormattingOptions {
-- /**
-- * Size of a tab in spaces.
-- */
-- tabSize: number;
--
-- /**
-- * Prefer spaces over tabs.
-- */
-- insertSpaces: boolean;
--
-- /**
-- * Signature for further properties.
-- */
-- [key: string]: boolean | number | string;
--}
--```
type FormattingOptions is record
tabSize: LSP_Number;
insertSpaces: Boolean;
-- [key: string]: boolean | number | string; ???
end record;
type DocumentFormattingParams is record
textDocument: TextDocumentIdentifier;
options: FormattingOptions;
end record;
--```typescript
--interface DocumentRangeFormattingParams {
-- /**
-- * The document to format.
-- */
-- textDocument: TextDocumentIdentifier;
--
-- /**
-- * The range to format
-- */
-- range: Range;
--
-- /**
-- * The format options
-- */
-- options: FormattingOptions;
--}
--```
type DocumentRangeFormattingParams is record
textDocument: TextDocumentIdentifier;
span: LSP.Messages.Span;
options: FormattingOptions;
end record;
--```typescript
--interface DocumentOnTypeFormattingParams {
-- /**
-- * The document to format.
-- */
-- textDocument: TextDocumentIdentifier;
--
-- /**
-- * The position at which this request was sent.
-- */
-- position: Position;
--
-- /**
-- * The character that has been typed.
-- */
-- ch: string;
--
-- /**
-- * The format options.
-- */
-- options: FormattingOptions;
--}
--```
type DocumentOnTypeFormattingParams is record
textDocument: TextDocumentIdentifier;
position: LSP.Messages.Position;
ch: LSP_String;
options: FormattingOptions;
end record;
--```typescript
--interface RenameParams {
-- /**
-- * The document to format.
-- */
-- textDocument: TextDocumentIdentifier;
--
-- /**
-- * The position at which this request was sent.
-- */
-- position: Position;
--
-- /**
-- * The new name of the symbol. If the given name is not valid the
-- * request must return a [ResponseError](#ResponseError) with an
-- * appropriate message set.
-- */
-- newName: string;
--}
--```
type RenameParams is record
textDocument: TextDocumentIdentifier;
position: LSP.Messages.Position;
newName: LSP_String;
end record;
--```typescript
--export interface ExecuteCommandParams {
--
-- /**
-- * The identifier of the actual command handler.
-- */
-- command: string;
-- /**
-- * Arguments that the command should be invoked with.
-- */
-- arguments?: any[];
--}
--```
type ExecuteCommandParams is record
command: LSP_String;
arguments: LSP_Any;
end record;
type ExecuteCommand_Response is new ResponseMessage with null record;
--```typescript
--export interface ApplyWorkspaceEditParams {
-- /**
-- * The edits to apply.
-- */
-- edit: WorkspaceEdit;
--}
--```
type ApplyWorkspaceEditParams is record
edit: WorkspaceEdit;
end record;
--```typescript
--export interface ApplyWorkspaceEditResponse {
-- /**
-- * Indicates whether the edit was applied or not.
-- */
-- applied: boolean;
--}
--```
type ApplyWorkspaceEditResponse is record
applied: Boolean;
end record;
type PublishDiagnostics_Notification is new NotificationMessage with record
params : PublishDiagnosticsParams;
end record;
type ApplyWorkspaceEdit_Request is new RequestMessage with record
params : ApplyWorkspaceEditParams;
end record;
type Location_Response is new ResponseMessage with record
result : Location_Vectors.Vector;
end record;
private
not overriding procedure Read_ClientCapabilities
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out ClientCapabilities);
not overriding procedure Read_CodeActionContext
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out CodeActionContext);
not overriding procedure Read_CodeActionParams
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out CodeActionParams);
not overriding procedure Read_completion
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out completion);
not overriding procedure Read_Diagnostic_Vector
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out Diagnostic_Vector);
not overriding procedure Read_DidChangeConfigurationParams
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out DidChangeConfigurationParams);
not overriding procedure Read_DidChangeTextDocumentParams
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out DidChangeTextDocumentParams);
not overriding procedure Read_DidCloseTextDocumentParams
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out DidCloseTextDocumentParams);
not overriding procedure Read_DidOpenTextDocumentParams
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out DidOpenTextDocumentParams);
not overriding procedure Read_DidSaveTextDocumentParams
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out DidSaveTextDocumentParams);
not overriding procedure Read_DocumentSymbolParams
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out DocumentSymbolParams);
not overriding procedure Read_dynamicRegistration
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out dynamicRegistration);
not overriding procedure Read_ExecuteCommandParams
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out ExecuteCommandParams);
not overriding procedure Read_InitializeParams
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out InitializeParams);
not overriding procedure Read_ReferenceContext
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out ReferenceContext);
not overriding procedure Read_ReferenceParams
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out ReferenceParams);
not overriding procedure Read_synchronization
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out synchronization);
not overriding procedure Read_TextDocumentClientCapabilities
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out TextDocumentClientCapabilities);
not overriding procedure Read_TextDocumentItem
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out TextDocumentItem);
not overriding procedure Read_WorkspaceClientCapabilities
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out WorkspaceClientCapabilities);
not overriding procedure Read_WorkspaceSymbolParams
(S : access Ada.Streams.Root_Stream_Type'Class;
V : out WorkspaceSymbolParams);
not overriding procedure Write_ApplyWorkspaceEdit_Request
(S : access Ada.Streams.Root_Stream_Type'Class;
V : ApplyWorkspaceEdit_Request);
not overriding procedure Write_ApplyWorkspaceEditParams
(S : access Ada.Streams.Root_Stream_Type'Class;
V : ApplyWorkspaceEditParams);
not overriding procedure Write_CodeAction_Response
(S : access Ada.Streams.Root_Stream_Type'Class;
V : CodeAction_Response);
not overriding procedure Write_Command_Vector
(S : access Ada.Streams.Root_Stream_Type'Class;
V : Command_Vector);
not overriding procedure Write_Completion_Response
(S : access Ada.Streams.Root_Stream_Type'Class;
V : Completion_Response);
not overriding procedure Write_CompletionList
(S : access Ada.Streams.Root_Stream_Type'Class;
V : CompletionList);
not overriding procedure Write_Diagnostic_Vector
(S : access Ada.Streams.Root_Stream_Type'Class;
V : Diagnostic_Vector);
not overriding procedure Write_DocumentLinkOptions
(S : access Ada.Streams.Root_Stream_Type'Class;
V : DocumentLinkOptions);
not overriding procedure Write_ExecuteCommand_Response
(S : access Ada.Streams.Root_Stream_Type'Class;
V : ExecuteCommand_Response);
not overriding procedure Write_ExecuteCommandOptions
(S : access Ada.Streams.Root_Stream_Type'Class;
V : ExecuteCommandOptions);
not overriding procedure Write_Highlight_Response
(S : access Ada.Streams.Root_Stream_Type'Class;
V : Highlight_Response);
not overriding procedure Write_Hover
(S : access Ada.Streams.Root_Stream_Type'Class;
V : Hover);
not overriding procedure Write_Hover_Response
(S : access Ada.Streams.Root_Stream_Type'Class;
V : Hover_Response);
not overriding procedure Write_Initialize_Response
(S : access Ada.Streams.Root_Stream_Type'Class;
V : Initialize_Response);
not overriding procedure Write_InitializeResult
(S : access Ada.Streams.Root_Stream_Type'Class;
V : InitializeResult);
not overriding procedure Write_Location_Response
(S : access Ada.Streams.Root_Stream_Type'Class;
V : Location_Response);
not overriding procedure Write_Optional_TextDocumentSyncOptions
(S : access Ada.Streams.Root_Stream_Type'Class;
V : Optional_TextDocumentSyncOptions);
not overriding procedure Write_PublishDiagnostics_Notification
(S : access Ada.Streams.Root_Stream_Type'Class;
V : PublishDiagnostics_Notification);
not overriding procedure Write_PublishDiagnosticsParams
(S : access Ada.Streams.Root_Stream_Type'Class;
V : PublishDiagnosticsParams);
not overriding procedure Write_ServerCapabilities
(S : access Ada.Streams.Root_Stream_Type'Class;
V : ServerCapabilities);
not overriding procedure Write_SignatureHelp
(S : access Ada.Streams.Root_Stream_Type'Class;
V : SignatureHelp);
not overriding procedure Write_SignatureHelp_Response
(S : access Ada.Streams.Root_Stream_Type'Class;
V : SignatureHelp_Response);
not overriding procedure Write_Symbol_Response
(S : access Ada.Streams.Root_Stream_Type'Class;
V : Symbol_Response);
not overriding procedure Write_SymbolInformation_Vector
(S : access Ada.Streams.Root_Stream_Type'Class;
V : SymbolInformation_Vector);
not overriding procedure Write_TextDocumentSyncOptions
(S : access Ada.Streams.Root_Stream_Type'Class;
V : TextDocumentSyncOptions);
not overriding procedure Write_WorkspaceEdit
(S : access Ada.Streams.Root_Stream_Type'Class;
V : WorkspaceEdit);
for ApplyWorkspaceEdit_Request'Write use Write_ApplyWorkspaceEdit_Request;
for ApplyWorkspaceEditParams'Write use Write_ApplyWorkspaceEditParams;
for CodeAction_Response'Write use Write_CodeAction_Response;
for Command_Vector'Write use Write_Command_Vector;
for Completion_Response'Write use Write_Completion_Response;
for CompletionList'Write use Write_CompletionList;
for Diagnostic_Vector'Write use Write_Diagnostic_Vector;
for DocumentLinkOptions'Write use Write_DocumentLinkOptions;
for ExecuteCommand_Response'Write use Write_ExecuteCommand_Response;
for ExecuteCommandOptions'Write use Write_ExecuteCommandOptions;
for Highlight_Response'Write use Write_Highlight_Response;
for Hover'Write use Write_Hover;
for Hover_Response'Write use Write_Hover_Response;
for Initialize_Response'Write use Write_Initialize_Response;
for InitializeResult'Write use Write_InitializeResult;
for Location_Response'Write use Write_Location_Response;
for Optional_TextDocumentSyncOptions'Write use Write_Optional_TextDocumentSyncOptions;
for PublishDiagnostics_Notification'Write use Write_PublishDiagnostics_Notification;
for PublishDiagnosticsParams'Write use Write_PublishDiagnosticsParams;
for ServerCapabilities'Write use Write_ServerCapabilities;
for SignatureHelp'Write use Write_SignatureHelp;
for SignatureHelp_Response'Write use Write_SignatureHelp_Response;
for Symbol_Response'Write use Write_Symbol_Response;
for SymbolInformation_Vector'Write use Write_SymbolInformation_Vector;
for TextDocumentItem'Read use Read_TextDocumentItem;
for TextDocumentSyncOptions'Write use Write_TextDocumentSyncOptions;
for WorkspaceEdit'Write use Write_WorkspaceEdit;
for ClientCapabilities'Read use Read_ClientCapabilities;
for CodeActionContext'Read use Read_CodeActionContext;
for CodeActionParams'Read use Read_CodeActionParams;
for completion'Read use Read_completion;
for Diagnostic_Vector'Read use Read_Diagnostic_Vector;
for DidChangeConfigurationParams'Read use Read_DidChangeConfigurationParams;
for DidChangeTextDocumentParams'Read use Read_DidChangeTextDocumentParams;
for DidCloseTextDocumentParams'Read use Read_DidCloseTextDocumentParams;
for DidOpenTextDocumentParams'Read use Read_DidOpenTextDocumentParams;
for DidSaveTextDocumentParams'Read use Read_DidSaveTextDocumentParams;
for DocumentSymbolParams'Read use Read_DocumentSymbolParams;
for dynamicRegistration'Read use Read_dynamicRegistration;
for ExecuteCommandParams'Read use Read_ExecuteCommandParams;
for InitializeParams'Read use Read_InitializeParams;
for ReferenceContext'Read use Read_ReferenceContext;
for ReferenceParams'Read use Read_ReferenceParams;
for synchronization'Read use Read_synchronization;
for TextDocumentClientCapabilities'Read use Read_TextDocumentClientCapabilities;
for WorkspaceClientCapabilities'Read use Read_WorkspaceClientCapabilities;
for WorkspaceSymbolParams'Read use Read_WorkspaceSymbolParams;
end LSP.Messages;
|
Altair101/asm/programsUntested/pTimerCounter.asm | tigerfarm/arduino | 2 | 242821 | <reponame>tigerfarm/arduino
; ------------------------------------------------
; Enter counter mode and display counter value for counter index in register A.
;
; ------------------------------------------------
ORG 0 ;
SENSE_SW EQU 255 ; Input port address: toggle sense switch byte, into register A.
;
; ------------------------------------------------
MVI A, ; Counter index file number.
OUT 25 ; Enter counter mode, and display counter value for counter index in register A.
; Flip the counter switch (AUX2 down) to exit counter mode and continue the program.
OUT 21 ; Increment counter value for counter index in register A.
OUT 25 ; Redisplay the counter value.
;
; ------------------------------------------------
Begin:
HLT ; Halt to wait for the Sense switches to be set.
IN SENSE_SW ; Get the Sense switches value into register A.
; 1 - first response to a ticket.
; 2 - 2nd or more, response to a ticket.
; ------------------------------------------------
OUT 25 ; Display Get the current value for the counter index, increment it and store it.
;
; ------------------------------------------------
JMP Begin
END
|
assiignment3.asm | Klaus073/Assembly-language | 0 | 8927 | ;q1
[org 0x0100]
jmp start
Array: dw 3, 9, 56, 43, 1, 2, 23
odd_counter: dw 0
even_counter: dw 0
Odd_Subroutine: ;; function for finding no. of odd number is array by Subroutine method
mov cx,2 ;divider
loop_odd:
xor ax,ax
xor dx,dx
mov ax ,[Array+bx]
div cx
cmp dx ,1
jne odd
add word[odd_counter],1
odd:
add bx,2
cmp bx,14
jne loop_odd
ret
Even_Subroutine: ;; function for finding no. of even number is array by Subroutine method
mov cx,2 ;divider
loop_even:
xor ax,ax
xor dx,dx
mov ax ,[Array+bx]
div cx
cmp dx ,1
je even
add word[even_counter],1
even:
add bx,2
cmp bx,14
jne loop_even
ret
;///////////////////////
;; Main Function
start:
mov ax,0
mov bx,0
mov dx,0
call Odd_Subroutine ;; Calling the odd function
mov ax,0
mov bx,0
mov dx,0
call Even_Subroutine ;; Calling the even function
mov ax, 0x4c00
int 0x21
;q2
[org 0x0100]
jmp start
Example: dw 47, 79, 31
sum_of_two_digit: dw 0
divider: dw 10
Subroutine_Function:
mov ax,0
mov bx,0
mov cx,0
mov dx,0
mov ax,[Example+bx] ;; static for 1st value of the array ;; we ll store first value sum to compare with other sums..
div word[divider] ;; it ll divide every coming value with 10
add dx,ax ;; it ll add the quotiont in label e.g 47-> 0+4=4
add word[sum_of_two_digit],dx ;; it ll add the remainder in the previous same label e.g 47-> 4+7=11
loop:
xor ax,ax
xor dx,dx
xor cx,cx
mov ax,word[Example+bx+2] ;; now ax ll get the 2nd value in the of array ,,
div word[divider] ;; divider
add dx,ax ;; e.g 47-> 0+4=4
mov cx,dx ;; it ll put the value of ax e.g 47 in the cx
cmp cx,[sum_of_two_digit] ;; here we ll compare the the sum of 1st value of array with summ 0f 2nd val of array
jng greater
mov si,word[Example+bx+2]
mov word[sum_of_two_digit],cx
greater:
mov si,word[Example+bx]
add bx,2
cmp bx,4 ;; chechks end loop condition
jne loop ;; loop if
mov ax, 0x4c00
int 0x21
start:
call Subroutine_Function ;; Calling the function
mov ax, 0x4c00
int 0x21
;q3
[org 0x0100]
jmp start
sum: dw 0
sum1: dw 0
add2:
mov bp,sp
mov cx,[bp+2]
add cx,ax
add cx,bx
pop word[bp+2]
ret
add1:
push bp
mov bp,sp
mov ax,[bp+4]
mov bx,[bp+6]
add word[sum],bx
add word[sum],ax
push word[sum]
call add2
pop bp
ret 4
start:
push 5
push 4
call add1
mov ax, 0x4c00
int 0x21
|
src/tests/shapematchingtests.ads | sebsgit/textproc | 0 | 11898 | <reponame>sebsgit/textproc
with AUnit; use AUnit;
with AUnit.Test_Cases; use AUnit.Test_Cases;
package ShapeMatchingTests is
type TestCase is new AUnit.Test_Cases.Test_Case with null record;
procedure Register_Tests(T: in out TestCase);
function Name(T: TestCase) return Message_String;
procedure testBasicShapes(T : in out Test_Cases.Test_Case'Class);
procedure testComplexImage(T: in out Test_Cases.Test_Case'Class);
end ShapeMatchingTests;
|
src/screen4.asm | mattemoore/nes_learning | 0 | 82662 | <gh_stars>0
screen4:
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$0e,$0f
.byte $10,$11,$12,$00,$14,$15,$16,$17,$00,$19,$1a,$1b,$1c,$1d,$1e,$1f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$2f
.byte $00,$31,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$3c,$3d,$3e,$3f
.byte $00,$00,$00,$00,$00,$00,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$5b,$5c,$5d,$5e,$5f
.byte $00,$00,$00,$00,$00,$00,$02,$02,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$7d,$7e,$7f
.byte $00,$00,$00,$00,$00,$00,$00,$02,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$9c,$9d,$9e,$9f
.byte $00,$00,$00,$00,$00,$00,$00,$02,$a8,$a9,$aa,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$b8,$b9,$ba,$bb,$bc,$bd,$be,$bf
.byte $00,$00,$00,$00,$00,$00,$00,$02,$c8,$c9,$ca,$00,$00,$00,$00,$00
.byte $00,$00,$00,$d3,$00,$00,$00,$00,$00,$d9,$da,$db,$dc,$dd,$de,$df
.byte $00,$00,$00,$00,$00,$00,$00,$02,$e8,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$f9,$fa,$fb,$fc,$fd,$fe,$ff
.byte $00,$00,$00,$00,$00,$00,$00,$02,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$15,$00,$00,$18,$19,$1a,$1b,$1c,$1d,$1e,$1f
.byte $00,$00,$00,$00,$00,$00,$00,$02,$00,$00,$00,$00,$00,$00,$00,$00
.byte $02,$00,$00,$00,$00,$00,$36,$37,$00,$39,$3a,$3b,$3c,$3d,$3e,$3f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$02,$00,$00,$00,$00,$00,$00,$00
.byte $00,$02,$00,$00,$00,$00,$56,$57,$00,$59,$5a,$5b,$00,$5d,$5e,$5f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$02,$00,$00,$00,$00,$00,$00,$00
.byte $00,$02,$00,$00,$00,$00,$00,$00,$00,$00,$7a,$7b,$00,$7d,$7e,$7f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$02,$00,$00,$00,$00,$00,$00,$00
.byte $00,$02,$00,$00,$00,$00,$00,$00,$00,$00,$9a,$9b,$00,$9d,$9e,$9f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$02,$02,$00,$00,$00,$00,$00,$00
.byte $00,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$bd,$be,$bf
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$00,$00,$00,$00,$00,$00
.byte $00,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$dd,$de,$df
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02,$02,$02,$00,$00,$00
.byte $00,$02,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$fd,$fe,$ff
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$02,$02,$02,$02
.byte $02,$02,$02,$02,$02,$02,$02,$00,$18,$00,$00,$00,$1c,$1d,$1e,$1f
.byte $00,$00,$00,$00,$00,$00,$26,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $30,$02,$32,$00,$00,$00,$02,$02,$02,$00,$00,$00,$3c,$3d,$3e,$3f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $50,$02,$00,$53,$00,$00,$00,$00,$00,$00,$00,$00,$5c,$5d,$5e,$5f
.byte $00,$00,$00,$00,$00,$65,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$02,$72,$73,$00,$00,$00,$00,$00,$00,$00,$7b,$7c,$7d,$7e,$7f
.byte $00,$00,$00,$00,$00,$00,$86,$00,$88,$00,$00,$00,$00,$00,$00,$00
.byte $00,$02,$02,$93,$00,$00,$00,$00,$98,$00,$00,$00,$9c,$9d,$9e,$9f
.byte $00,$00,$00,$00,$00,$a5,$a6,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$02,$02,$00,$b4,$00,$00,$00,$b8,$b9,$00,$00,$00,$bd,$be,$bf
.byte $00,$00,$00,$00,$00,$c5,$00,$00,$c8,$00,$00,$cb,$00,$00,$00,$00
.byte $00,$00,$02,$00,$00,$00,$00,$d7,$00,$00,$00,$00,$00,$dd,$de,$df
.byte $00,$00,$00,$00,$00,$00,$00,$e7,$00,$00,$ea,$eb,$00,$00,$00,$00
.byte $00,$00,$02,$00,$00,$00,$00,$f7,$00,$00,$00,$00,$00,$fd,$fe,$ff
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$02,$00,$14,$00,$00,$00,$00,$19,$1a,$1b,$00,$00,$1e,$1f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$2c,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$39,$3a,$00,$00,$00,$3e,$3f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$59,$5a,$5b,$00,$00,$5e,$5f
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$75,$76,$77,$78,$79,$7a,$7b,$00,$00,$7e,$7f
.byte $00,$00,$00,$00,$00,$85,$86,$87,$88,$00,$00,$8b,$00,$8d,$00,$8f
.byte $90,$91,$92,$00,$00,$95,$96,$97,$98,$99,$9a,$9b,$9c,$9d,$9e,$9f
.byte $00,$00,$00,$00,$a4,$a5,$a6,$a7,$a8,$a9,$aa,$ab,$ac,$ad,$ae,$af
.byte $b0,$b1,$b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9,$ba,$bb,$bc,$bd,$be,$bf
.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$c7,$f3,$fc,$f0,$ff,$ff,$03,$00,$cf
.byte $ff,$ff,$ff,$ff,$f3,$f0,$33,$c0,$ff,$ff,$ff,$3f,$ff,$ff,$ff,$cc
.byte $ff,$3f,$00,$0f,$3f,$cf,$ff,$d4,$cf,$3c,$00,$00,$cf,$cc,$ff,$ff
.byte $fc,$cf,$f3,$f0,$fc,$ff,$ff,$f3,$ff,$fb,$ff,$f3,$fc,$ff,$fe,$ff
|
src/jarsec.agda | jaywunder/jarsec-verified | 0 | 4834 | <filename>src/jarsec.agda<gh_stars>0
module jarsec where
open import Algebra
open import Data.Bool
open import Data.Char
-- open import Data.Empty
-- open import Data.Fin
open import Data.List
open import Data.Maybe hiding (map)
open import Data.Nat
open import Data.Nat.Base
open import Data.Nat.Show
-- open import Data.Integer
open import Data.Product hiding (map)
open import Data.Sum hiding (map)
open import Data.String hiding (length)
open import Function
-- open import Data.Sum
-- open import Data.Unit
-- open import Data.Vec
open import Category.Functor
open import Relation.Binary
open import Data.Char.Base
open import Agda.Builtin.Char
open import Relation.Binary.PropositionalEquality using (_≡_ ; refl)
record Parser (A : Set) : Set where
constructor mk-parser
field
parse : List Char → (List (A × (List Char)))
open Parser public
item : Parser Char
item = mk-parser λ where
[] → []
(c ∷ cs) → (c , cs) ∷ []
bind : ∀ { A B : Set } → Parser A → (A → Parser B) → Parser B
bind {A} p f = mk-parser $ λ cs →
let rs : List (A × List Char)
rs = parse p cs
in concatMap (λ x → parse (f (proj₁ x)) (proj₂ x)) rs
-- in concatMap (λ where (x , cs′) → parse (f x) cs′) rs
_>>=_ : ∀ { A B : Set } → Parser A → (A → Parser B) → Parser B
p >>= f = bind p f
_>>_ : ∀ { A B : Set } → Parser A → Parser B → Parser B
pA >> pB = pA >>= λ _ → pB
unit : ∀ { A : Set } → A → Parser A
unit a = mk-parser (λ str → ( a , str ) ∷ [])
unit* : ∀ { A : Set } → List A → Parser A
unit* xs = mk-parser (λ str → foldl (λ sum x → (x , str) ∷ sum) [] xs)
fmap : ∀ { A B : Set } → (A → B) → Parser A → Parser B
fmap f p = do
a ← p
unit (f a)
_<$>_ : ∀ { A B : Set } → (A → B) → Parser A → Parser B
f <$> p = fmap f p
_<*>_ : ∀ {A B : Set } → Parser A → Parser B → Parser ( A × B )
aP <*> bP = do
a ← aP
b ← bP
unit (a , b)
combine : { A : Set } → Parser A → Parser A → Parser A
combine p q = mk-parser (λ cs → (parse p cs) Data.List.++ (parse q cs))
failure : { A : Set } → Parser A
failure = mk-parser (λ cs → [])
option : { A : Set } → Parser A → Parser A → Parser A
option p q = mk-parser $ λ where
cs → case (parse p cs) of λ where
[] → parse q cs
result → result
{-# TERMINATING #-}
mutual
many* : { A : Set } → Parser A → Parser (List A)
many* v = option (many+ v) (unit [])
many+ : { A : Set } → Parser A → Parser (List A)
many+ v = fmap (λ { (a , list) → a ∷ list }) (v <*> (many* v))
satisfy : (Char -> Bool) -> Parser Char
satisfy f = do
c ← item
case (f c) of λ where
true → unit c
false → failure
oneOf : List Char → Parser Char
oneOf options = satisfy (flip elem options)
where
elem : Char → List Char → Bool
elem a [] = false
elem a (x ∷ xs) = case primCharEquality a x of λ where
true → true
false → elem a xs
module _ { A : Set } where
{-# TERMINATING #-}
chainl1 : Parser A → Parser (A → A → A) → Parser A
chainl1 p op = do
a ← p
rest a
where
rest : A → Parser A
rest a = option (do
f ← op
b ← p
rest (f a b)) (unit a)
chainl : { A : Set } → Parser A → Parser (A → A → A) → A → Parser A
chainl p op a = option (chainl1 p op) (unit a)
char : Char → Parser Char
char c = satisfy (primCharEquality c)
digit : Parser Char
digit = satisfy isDigit
-- TODO: Remove
∣_-_∣ : ℕ → ℕ → ℕ
∣ zero - y ∣ = y
∣ x - zero ∣ = x
∣ suc x - suc y ∣ = ∣ x - y ∣
natural : Parser ℕ
natural = natFromList <$> ((map primCharToNat) <$> (many+ digit))
where
natFromList : List ℕ → ℕ
natFromList [] = zero
natFromList (n ∷ ns) =
let len = length ns
in (∣ n - 48 ∣ + (10 * len)) + (natFromList ns)
string : String → Parser String
string str = primStringFromList <$> (string-chars (primStringToList str))
where
string-chars : List Char → Parser (List Char)
string-chars [] = unit []
string-chars (c ∷ cs) = do
char c
string-chars cs
unit (c ∷ cs)
spaces : Parser String
spaces = fmap primStringFromList (many* (oneOf (primStringToList " \n\r")))
token : { A : Set } → Parser A → Parser A
token p = do
a ← p
spaces
unit a
reserved : String → Parser String
reserved str = token (string str)
parens : { A : Set } → Parser A → Parser A
parens m = do
(reserved "(")
n ← m
(reserved ")")
unit n
--------------------------------------------------------------------------------
data Expr : Set where
Invalid : Expr
-- Var : Char → Expr
Lit : ℕ → Expr
Add : Expr → Expr → Expr
Mul : Expr → Expr → Expr
-- Add Sub : Expr → Expr → Expr
-- Mul Div : Expr → Expr → Expr
eval : Expr → ℕ
eval Invalid = 0
eval (Lit n) = n
eval (Add a b) = eval a + eval b
eval (Mul a b) = eval a * eval b
eval′ : Maybe Expr → ℕ
eval′ (just x) = eval x
eval′ nothing = 0
module _ where
{-# TERMINATING #-}
expr : Parser Expr
{-# TERMINATING #-}
term : Parser Expr
{-# TERMINATING #-}
factor : Parser Expr
infixOp : {A : Set} → String → (A → A → A) → Parser (A → A → A)
mulop : Parser (Expr → Expr → Expr)
addop : Parser (Expr → Expr → Expr)
number : Parser Expr
expr = chainl1 term addop
term = chainl1 factor mulop
factor = option number (parens expr)
infixOp x f = reserved x >> unit f
mulop = infixOp "*" Mul
addop = infixOp "+" Add
number = do
n ← natural
unit (Lit n)
runParser : { A : Set } → Parser A → String → Maybe A
runParser p str = case (parse p (primStringToList str)) of λ where
[] → nothing
(res ∷ xs) → just (proj₁ res)
run : String → Maybe Expr
run = runParser expr
do-everything : String → ℕ
do-everything str = eval′ $ run str
partial-parse : { A : Set } → Parser A → String → Maybe (List (A × List Char))
partial-parse p str with parse p (primStringToList str)
partial-parse p str | [] = nothing
partial-parse p str | xs = just xs
run-parser : { A : Set } → Parser A → List Char → Maybe (List (A × List Char))
run-parser p str = case (parse p str) of λ where
[] → nothing
xs → just xs
|
resource_alloy.als | triskadecaepyon/AlloySynthesis | 0 | 3019 | sig flexibleUnits {
consumes: set resources
}
fact one2one {
consumes.~consumes in iden
//Comment this out to allow for floating
//unused resources
//univ.consumes = resources
}
sig resources{//The modeled resource
}
sig staffStrength {
empowered: set flexibleUnits
}
sig staffCost {
requires: set resources
}
sig mbase{
strength: one staffStrength,
cost: one staffCost
}
fact connected {
all m: mbase, s: staffStrength | s in m.strength
all s: staffStrength, f: flexibleUnits |
f in s.empowered
all m: mbase, sc: staffCost | sc in m.cost
all sc: staffCost, r: resources | r in sc.requires
}
fact nosharedconsume {
all disj f1, f2: flexibleUnits |
f1.consumes != f2.consumes
}
pred currentMarket {
//consumes multiple resources
all f: flexibleUnits | #f.consumes =< 3
&& #f.consumes >= 1
//all f: flexibleUnits | #f.consumes = 1
}
pred show(b: mbase) {
currentMarket
#flexibleUnits = 5
//#resources < 10
}
run show for 9 but 1 mbase, exactly 10 resources
//run show for 9 but 1 mbase
|
install/lib/hardware/syquest.asm | minblock/msdos | 0 | 173039 | ;========================================================
COMMENT #
SYQUEST.ASM
Copyright (c) 1991 - Microsoft Corp.
All rights reserved.
Microsoft Confidential
=================================================
Function that checks for a Syquest removeable
hard disk device driver.
int far SyquestCheck ( void )
ARGUMENTS: NONE
RETURNS: int - TRUE if Syquest device
driver is installed
else FALSE.
================================================
johnhe - 08-20-90
END COMMENT #
; =======================================================
INCLUDE model.inc
; =======================================================
.DATA
SyquestStr db 'SYQ'
LEN_SYQUEST_STR EQU $-SyquestStr
.Code
; =======================================================
SyquestCheck PROC FAR USES SI DI DS ES
ASSUME ES:NOTHING
mov AH,52h
int 21h ; ES:BX --> first DBP
push BX ; Save offset
mov AH,30h
int 21h ; AL == Major version
pop DI ; Restore DPB offset to BX
add DI,17h ; DOS 2.x offset of NULL device is 17h
cmp AL,2 ; See if version is really 2.x
jle @f
add DI,0bh ; Offset for DOS > 2.x is 22h
@@:
mov AX,@DATA
mov DS,AX
mov SI,OFFSET SyquestStr
mov CX,LEN_SYQUEST_STR
cld
NameCmpLoop:
cmp DI,0ffffh ; See if ES:DX is xxxx:ffff
je NoSyquest
SaveSetup:
push CX ; Save name length
push DI ; Save ptr to current device
push SI ; Save ptr to Syquest string
add DI,0ah ; ES:DI --> Device name
repe cmpsb
pop SI
pop DI
pop CX
je IsSyquest
les DI,ES:[DI] ; Load ptr to next device.
jmp SHORT NameCmpLoop
NoSyquest:
xor AX,AX
jmp SHORT SyquestReturn
IsSyquest:
mov AX,1
SyquestReturn:
ret
SyquestCheck ENDP
; =======================================================
END
|
programs/oeis/114/A114480.asm | neoneye/loda | 22 | 167277 | ; A114480: Kekulé numbers for certain benzenoids.
; 4,50,650,8500,111250,1456250,19062500,249531250,3266406250,42757812500,559707031250,7326660156250,95907226562500,1255441894531250,16433947753906250,215123168945312500,2815998840332031250
mul $0,2
seq $0,153365 ; Number of zig-zag paths from top to bottom of a rectangle of width 9 with 2n rows whose color is that of the top right corner.
div $0,4
mul $0,2
|
programs/oeis/273/A273337.asm | jmorken/loda | 1 | 17735 | <filename>programs/oeis/273/A273337.asm<gh_stars>1-10
; A273337: First differences of number of active (ON,black) cells in n-th stage of growth of two-dimensional cellular automaton defined by "Rule 657", based on the 5-celled von Neumann neighborhood.
; 3,13,31,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152,160,168,176,184,192,200,208,216,224,232,240,248,256,264,272,280,288,296,304,312,320,328,336,344,352,360,368,376,384,392,400,408,416,424,432
mov $2,$0
mov $4,$0
mul $4,2
mov $0,$4
mov $3,4
mul $4,2
lpb $0
add $5,6
mov $0,$5
sub $0,1
mov $4,0
lpe
trn $4,4
mul $4,2
add $0,$4
add $0,6
sub $0,$3
add $1,1
add $1,$0
lpb $2
add $1,8
sub $2,1
lpe
|
libsrc/target/homelab/stdio/getk.asm | Frodevan/z88dk | 640 | 2933 | <filename>libsrc/target/homelab/stdio/getk.asm<gh_stars>100-1000
SECTION code_clib
PUBLIC getk
PUBLIC _getk
getk:
_getk:
call $85
ld l,a
ld h,0
ret
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_73.asm | ljhsiun2/medusa | 9 | 172114 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x14c75, %rsi
lea addresses_normal_ht+0x10db5, %rdi
nop
xor %r13, %r13
mov $70, %rcx
rep movsw
nop
nop
nop
sub $54257, %rcx
lea addresses_A_ht+0xfe2b, %rsi
lea addresses_D_ht+0x18ab5, %rdi
clflush (%rsi)
nop
nop
nop
xor $21667, %r14
mov $122, %rcx
rep movsq
nop
cmp $19168, %rdi
lea addresses_WT_ht+0x9e5f, %rdi
nop
nop
nop
nop
nop
cmp $32271, %r10
mov $0x6162636465666768, %rcx
movq %rcx, %xmm1
movups %xmm1, (%rdi)
nop
nop
nop
inc %rdi
lea addresses_WC_ht+0x11cc5, %rsi
lea addresses_A_ht+0x97b5, %rdi
cmp $22523, %rbx
mov $34, %rcx
rep movsl
nop
nop
nop
sub $35470, %rsi
lea addresses_WC_ht+0x145b5, %rdi
nop
nop
sub %r13, %r13
movw $0x6162, (%rdi)
add %rbx, %rbx
lea addresses_normal_ht+0xff35, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
xor %r14, %r14
mov $0x6162636465666768, %rcx
movq %rcx, %xmm3
vmovups %ymm3, (%rdi)
nop
nop
nop
and $38513, %rcx
lea addresses_A_ht+0x8db5, %r14
nop
nop
nop
add %rsi, %rsi
movb (%r14), %bl
nop
inc %rbx
lea addresses_UC_ht+0x9f7b, %r13
cmp $19542, %r10
mov (%r13), %r14w
nop
nop
nop
nop
dec %rbx
lea addresses_normal_ht+0xbbad, %rdi
nop
nop
xor %r13, %r13
movb (%rdi), %r10b
sub $16932, %r10
lea addresses_normal_ht+0x71b5, %rdi
dec %r10
movw $0x6162, (%rdi)
nop
nop
nop
nop
and %r10, %r10
lea addresses_A_ht+0xb5b5, %r13
nop
and %rbx, %rbx
mov $0x6162636465666768, %r14
movq %r14, %xmm2
vmovups %ymm2, (%r13)
nop
nop
nop
nop
nop
sub %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %r8
push %r9
// Faulty Load
lea addresses_UC+0x17db5, %r11
nop
nop
nop
nop
xor $58860, %r9
movb (%r11), %r10b
lea oracles, %r11
and $0xff, %r10
shlq $12, %r10
mov (%r11,%r10,1), %r10
pop %r9
pop %r8
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 5}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1, 'NT': True, 'same': False, 'congruent': 3}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2, 'NT': True, 'same': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 11}}
{'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
*/
|
tools/ayacc/src/lists.adb | svn2github/matreshka | 24 | 5759 | <reponame>svn2github/matreshka
with Unchecked_Deallocation;
package body Lists is
procedure Free is
new Unchecked_Deallocation (Element_Type, Element_Pointer);
--------------------------------------------------------------------------
procedure Attach (List1 : in out List;
List2 : in List) is
Endoflist1 : Element_Pointer;
--| Attach List2 to List1.
--| If List1 is null return List2
--| If List1 equals List2 then raise CircularList
--| Otherwise get the pointer to the last element of List1 and change
--| its Next field to be List2.
begin
if List1.Head = null then
List1 := List2;
elsif List1 = List2 then
raise Circularlist;
else
Endoflist1 := List1.Tail;
Endoflist1.Next := List2.Head;
List1.Tail := List2.Tail;
end if;
end Attach;
--------------------------------------------------------------------------
procedure Attach (L : in out List;
Element : in Itemtype) is
Old_Tail, New_Element : Element_Pointer;
--| Create a list containing Element and attach it to the end of L
begin
New_Element := new Element_Type'(Item => Element, Next => null);
if L.Head = null then
L.Head := New_Element;
L.Tail := New_Element;
else
Old_Tail := L.Tail;
Old_Tail.Next := New_Element;
L.Tail := New_Element;
end if;
end Attach;
--------------------------------------------------------------------------
function Attach (Element1 : in Itemtype;
Element2 : in Itemtype) return List is
Newlist : List;
--| Create a new list containing the information in Element1 and
--| attach Element2 to that list.
begin
Newlist.Head := new Element_Type'(Item => Element1, Next => null);
Newlist.Tail := NewList.Head;
Attach (Newlist, Element2);
return Newlist;
end Attach;
--------------------------------------------------------------------------
procedure Attach (Element : in Itemtype;
L : in out List) is
--| Create a new cell whose information is Element and whose Next
--| field is the list L. This prepends Element to the List L.
Old_Head, New_Head : Element_Pointer;
begin
if L.Head = null then
L.Head := new Element_Type'(Item => Element, Next => null);
L.Tail := L.Head;
else
Old_Head := L.Head;
New_Head := new Element_Type'(Item => Element, Next => Old_Head);
L.Head := New_Head;
end if;
end Attach;
--------------------------------------------------------------------------
function Attach (List1 : in List;
List2 : in List) return List is
--| Attach List2 to List1.
--| If List1 is null return List2
--| If List1 equals List2 then raise CircularList
--| Otherwise get the pointer to the last element of List1 and change
--| its Next field to be List2.
End_Of_List1 : Element_Pointer;
New_List : List;
begin
if List1.Head = null then
return List2;
elsif List1 = List2 then
raise Circularlist;
else
End_Of_List1 := List1.Tail;
End_Of_List1.Next := List2.Head;
New_List.Head := List1.Head;
New_List.Tail := List2.Tail;
return New_List;
end if;
end Attach;
-------------------------------------------------------------------------
function Attach (L : in List;
Element : in Itemtype) return List is
New_Element : Element_Pointer;
New_List : List;
End_Of_List : Element_Pointer;
--| Create a list called New_List and attach it to the end of L.
--| If L is null return New_List
--| Otherwise get the last element in L and make its Next field
--| New_List.
begin
New_Element := new Element_Type'(Item => Element, Next => null);
if L.Head = null then
New_List := (Head => New_Element, Tail => New_Element);
else
End_Of_List := L.Tail;
End_Of_List.Next := New_Element;
New_List := (Head => L.Head, Tail => New_Element);
end if;
return New_List;
end Attach;
--------------------------------------------------------------------------
function Attach (Element : in Itemtype;
L : in List) return List is
New_Element : Element_Pointer;
begin
if L.Head = null then
New_Element := new Element_Type'(Item => Element, Next => null);
return (Head => New_Element, Tail => New_Element);
else
New_Element := new Element_Type'(Item => Element, Next => L.Head);
return (Head => New_Element, Tail => L.Tail);
end if;
end Attach;
--------------------------------------------------------------------------
function Copy (L : in List) return List is
--| If L is null return null
--| Otherwise recursively copy the list by first copying the information
--| at the head of the list and then making the Next field point to
--| a copy of the tail of the list.
Current_Element : Element_Pointer := L.Head;
New_List : List := (Head => null, Tail => null);
begin
while Current_Element /= null loop
Attach (New_List, Current_Element.Item);
Current_Element := Current_Element.Next;
end loop;
return New_List;
end Copy;
--------------------------------------------------------------------------
--generic
-- with function Copy (I : in Itemtype) return Itemtype;
function Copydeep (L : in List) return List is
--| If L is null then return null.
--| Otherwise copy the first element of the list into the head of the
--| new list and copy the tail of the list recursively using CopyDeep.
Current_Element : Element_Pointer := L.Head;
New_List : List := (Head => null, Tail => null);
begin
while Current_Element /= null loop
Attach (New_List, Copy (Current_Element.Item));
Current_Element := Current_Element.next;
end loop;
return New_List;
end Copydeep;
--------------------------------------------------------------------------
function Create return List is
--| Return the empty list.
begin
return (Head => null, Tail => null);
end Create;
--------------------------------------------------------------------------
procedure Deletehead (L : in out List) is
New_Head : Element_Pointer;
--| Remove the element of the head of the list and return it to the heap.
--| If L is null EmptyList.
--| Otherwise save the Next field of the first element, remove the first
--| element and then assign to L the Next field of the first element.
begin
if L.Head = null then
raise Emptylist;
else
New_Head := L.Head.Next;
Free (L.Head);
L.Head := New_Head;
end if;
end Deletehead;
--------------------------------------------------------------------------
procedure Deleteitem (L : in out List;
Element : in Itemtype) is
--| Remove the first element in the list with the value Element.
--| If the first element of the list is equal to element then
--| remove it. Otherwise, recurse on the tail of the list.
Current_Element, Previous_Element : Element_Pointer;
begin
if L.Head = null then
raise Itemnotpresent;
elsif Equal (L.Head.Item, Element) then
Deletehead (L);
else
Current_Element := L.Head.Next;
Previous_Element := L.Head;
while Current_Element /= null and then
not Equal (Current_Element.Item, Element) loop
Previous_Element := Current_Element;
Current_Element := Current_Element.Next;
end loop;
if Current_Element = null then
raise Itemnotpresent;
else
if Current_Element = L.Tail then
L.Tail := Previous_Element;
end if;
Previous_Element.Next := Current_Element.Next;
Free (Current_Element);
end if;
end if;
end Deleteitem;
--------------------------------------------------------------------------
procedure Deleteitems (L : in out List;
Element : in Itemtype) is
Delete_List_Is_Empty : Boolean := True;
New_List_Is_Empty : Boolean := True;
Old_Tail : Element_Pointer;
Current_Element : Element_Pointer := L.Head;
New_List, Delete_List : List;
procedure Append (Element : in out Element_Pointer;
To_List : in out List) is
begin
if To_List.Head = null then
To_List.Head := Element;
To_List.Tail := Element;
else
Old_Tail := To_List.Tail;
To_List.Tail := Element;
Old_Tail.Next := To_List.Tail;
end if;
end Append;
begin
while Current_Element /= null loop
if Equal (Current_Element.Item, Element) then
Append (Element => Current_Element,
To_List => Delete_List);
Delete_List_Is_Empty := False;
else
Append (Element => Current_Element,
To_List => New_List);
New_List_Is_Empty := False;
end if;
Current_Element := Current_Element.Next;
end loop;
if Delete_List_Is_Empty then
raise Itemnotpresent;
else
Delete_List.Tail.Next := null;
Destroy (Delete_List);
end if;
if not New_List_Is_Empty then
New_List.Tail.Next := null;
end if;
L := New_List;
end Deleteitems;
--------------------------------------------------------------------------
procedure Destroy (L : in out List) is
Current_Element : Element_Pointer := L.Head;
Element_To_Delete : Element_Pointer;
--| Walk down the list removing all the elements and set the list to
--| the empty list.
begin
if L.Head /= null then
while Current_Element /= null loop
Element_To_Delete := Current_Element;
Current_Element := Current_Element.Next;
Free (Element_To_Delete);
end loop;
L := (Head => null, Tail => null);
end if;
end Destroy;
--------------------------------------------------------------------------
function Firstvalue (L : in List) return Itemtype is
--| Return the first value in the list.
begin
if L.Head = null then
raise Emptylist;
else
return L.Head.Item;
end if;
end Firstvalue;
--------------------------------------------------------------------------
function Isinlist (L : in List;
Element : in Itemtype) return Boolean is
Current_Element : Element_Pointer := L.Head;
--| Check if Element is in L. If it is return true otherwise return false.
begin
while Current_Element /= null and then
not Equal (Current_Element.Item, Element) loop
Current_Element := Current_Element.Next;
end loop;
return Current_Element /= null;
end Isinlist;
--------------------------------------------------------------------------
function Isempty (L : in List) return Boolean is
--| Is the list L empty.
begin
return L.Head = null;
end Isempty;
--------------------------------------------------------------------------
function Lastvalue (L : in List) return Itemtype is
--| Return the value of the last element of the list. Get the pointer
--| to the last element of L and then return its information.
begin
if L.Head = null then
raise Emptylist;
else
return L.Tail.Item;
end if;
end Lastvalue;
--------------------------------------------------------------------------
function Length (L : in List) return Integer is
--| Recursively compute the length of L. The length of a list is
--| 0 if it is null or 1 + the length of the tail.
Current_Element : Element_Pointer := L.Head;
List_Length : Natural := 0;
begin
while Current_Element /= null loop
List_Length := List_Length + 1;
Current_Element := Current_Element.Next;
end loop;
return List_Length;
end Length;
--------------------------------------------------------------------------
function Makelistiter (L : in List) return Listiter is
--| Start an iteration operation on the list L. Do a type conversion
--| from List to ListIter.
begin
return Listiter (L);
end Makelistiter;
--------------------------------------------------------------------------
function More (L : in Listiter) return Boolean is
--| This is a test to see whether an iteration is complete.
begin
return L.Head /= null;
end More;
--------------------------------------------------------------------------
procedure Next (Place : in out Listiter;
Info : out Itemtype) is
--| This procedure gets the information at the current place in the List
--| and moves the ListIter to the next postion in the list.
--| If we are at the end of a list then exception NoMore is raised.
Next_Element : Element_Pointer := Place.Head;
begin
if Next_Element = null then
raise Nomore;
else
Info := Next_Element.Item;
Place.Head := Next_Element.Next;
end if;
end Next;
--------------------------------------------------------------------------
procedure Replacehead (L : in out List;
Info : in Itemtype) is
--| This procedure replaces the information at the head of a list
--| with the given information. If the list is empty the exception
--| EmptyList is raised.
begin
if L.Head = null then
raise Emptylist;
else
L.Head.Item := Info;
end if;
end Replacehead;
--------------------------------------------------------------------------
procedure Replacetail (L : in out List;
Newtail : in List) is
List_Head_Item : Itemtype;
--| This destroys the tail of a list and replaces the tail with
--| NewTail. If L is empty EmptyList is raised.
begin
if L.Head = null then
raise Emptylist;
else
List_Head_Item := L.Head.Item;
Destroy (L);
L := Attach (List_Head_Item, Newtail);
end if;
end Replacetail;
--------------------------------------------------------------------------
function Tail (L : in List) return List is
--| This returns the list which is the tail of L. If L is null Empty
--| List is raised.
begin
if L.Head = null then
raise Emptylist;
else
return (Head => L.Head.Next, Tail => L.Tail);
end if;
end Tail;
--------------------------------------------------------------------------
function Equal (List1 : in List;
List2 : in List) return Boolean is
Placeinlist1 : Element_Pointer := List1.Head;
Placeinlist2 : Element_Pointer := List2.Head;
Contents1 : Itemtype;
Contents2 : Itemtype;
--| This function tests to see if two lists are equal. Two lists
--| are equal if for all the elements of List1 the corresponding
--| element of List2 has the same value. Thus if the 1st elements
--| are equal and the second elements are equal and so up to n.
--| Thus a necessary condition for two lists to be equal is that
--| they have the same number of elements.
--| This function walks over the two list and checks that the
--| corresponding elements are equal. As soon as we reach
--| the end of a list (PlaceInList = null) we fall out of the loop.
--| If both PlaceInList1 and PlaceInList2 are null after exiting the loop
--| then the lists are equal. If they both are not null the lists aren't
--| equal. Note that equality on elements is based on a user supplied
--| function Equal which is used to test for item equality.
begin
while (Placeinlist1 /= null) and then (Placeinlist2 /= null) loop
if not Equal (Placeinlist1.Item, Placeinlist2.Item) then
return False;
end if;
Placeinlist1 := Placeinlist1.Next;
Placeinlist2 := Placeinlist2.Next;
end loop;
return ((Placeinlist1 = null) and then (Placeinlist2 = null));
end Equal;
end Lists;
|
programs/oeis/057/A057361.asm | karttu/loda | 1 | 88005 | ; A057361: a(n) = floor(5*n/8).
; 0,0,1,1,2,3,3,4,5,5,6,6,7,8,8,9,10,10,11,11,12,13,13,14,15,15,16,16,17,18,18,19,20,20,21,21,22,23,23,24,25,25,26,26,27,28,28,29,30,30,31,31,32,33,33,34,35,35,36,36,37,38,38,39,40,40,41,41,42,43,43,44,45,45,46,46,47,48,48,49,50,50,51,51,52,53,53,54,55,55,56,56,57,58,58,59,60,60,61,61,62,63,63,64,65,65,66,66,67,68,68,69,70,70,71,71,72,73,73,74,75,75,76,76,77,78,78,79,80,80,81,81,82,83,83,84,85,85,86,86,87,88,88,89,90,90,91,91,92,93,93,94,95,95,96,96,97,98,98,99,100,100,101,101,102,103,103,104,105,105,106,106,107,108,108,109,110,110,111,111,112,113,113,114,115,115,116,116,117,118,118,119,120,120,121,121,122,123,123,124,125,125,126,126,127,128,128,129,130,130,131,131,132,133,133,134,135,135,136,136,137,138,138,139,140,140,141,141,142,143,143,144,145,145,146,146,147,148,148,149,150,150,151,151,152,153,153,154,155,155
mul $0,5
mov $1,$0
div $1,8
|
Transynther/x86/_processed/NONE/_ht_zr_un_/i7-7700_9_0x48.log_21829_2179.asm | ljhsiun2/medusa | 9 | 99892 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r14
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x11852, %rdi
nop
nop
nop
xor $50760, %r13
mov (%rdi), %r14d
nop
nop
nop
nop
add $35874, %rax
lea addresses_A_ht+0xc6b2, %rax
inc %r10
movw $0x6162, (%rax)
nop
nop
nop
nop
sub $25819, %r14
lea addresses_WC_ht+0x80b2, %rsi
lea addresses_UC_ht+0x48b2, %rdi
nop
nop
nop
nop
nop
cmp %r11, %r11
mov $23, %rcx
rep movsb
nop
xor $47895, %rsi
lea addresses_A_ht+0x1d72, %r10
add $51392, %rcx
mov $0x6162636465666768, %rax
movq %rax, (%r10)
nop
nop
nop
nop
nop
cmp %rcx, %rcx
lea addresses_WT_ht+0x1b902, %rsi
nop
nop
nop
sub $1661, %r11
movups (%rsi), %xmm4
vpextrq $1, %xmm4, %rcx
nop
nop
nop
sub $10163, %r10
lea addresses_normal_ht+0x133b2, %r10
nop
nop
sub $56052, %rdi
mov $0x6162636465666768, %rcx
movq %rcx, (%r10)
nop
nop
add %r11, %r11
lea addresses_A_ht+0xe472, %rsi
nop
nop
nop
nop
xor $14210, %rcx
movw $0x6162, (%rsi)
nop
add $28045, %rdi
lea addresses_WC_ht+0x118b2, %r13
nop
nop
nop
dec %rax
mov $0x6162636465666768, %r11
movq %r11, %xmm0
vmovups %ymm0, (%r13)
and %r11, %r11
lea addresses_WC_ht+0x170b2, %r10
nop
nop
nop
add %rdi, %rdi
vmovups (%r10), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $0, %xmm4, %rcx
nop
nop
nop
nop
nop
add %r13, %r13
lea addresses_WC_ht+0x4632, %r10
nop
nop
nop
add $40597, %rsi
vmovups (%r10), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %r11
nop
nop
nop
nop
cmp $49216, %r13
lea addresses_WC_ht+0x60b2, %rcx
nop
nop
nop
inc %r10
movl $0x61626364, (%rcx)
nop
nop
nop
add %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r15
push %r8
push %r9
// Faulty Load
lea addresses_A+0x150b2, %r11
nop
nop
nop
nop
nop
xor %r9, %r9
movups (%r11), %xmm0
vpextrq $1, %xmm0, %r8
lea oracles, %r9
and $0xff, %r8
shlq $12, %r8
mov (%r9,%r8,1), %r8
pop %r9
pop %r8
pop %r15
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 4, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 5, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 6, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 1, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 5, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 11, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 10, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 3, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 10, 'size': 4, 'same': False, 'NT': False}}
{'49': 20369, '48': 257, 'ff': 1, '00': 1202}
49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 48 00 49 00 00 00 49 00 00 49 49 00 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 48 49 49 49 00 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 00 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 48 49 49 49 00 48 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 00 00 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 48 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 00 49 00 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 48 48 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 48 49 48 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 48 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 00 49 49 49 49 49 00 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 48 48 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 00 48 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 48 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 00 49 49 49 49 00 49 49 00 49 49 49 49 49 49 49 49 00 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 48 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 00 49 48 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 00 49 49 49 49 49 49 49 49 49
*/
|
src/ui.asm | beckadamtheinventor/BOSshell5 | 2 | 80004 | <reponame>beckadamtheinventor/BOSshell5
input_number_routine:
call gfx_GetTextX
push hl
call gfx_GetTextY
ld l,a
push hl
.loop:
call gfx_SetTextXY
ld hl,3
push hl
ld hl,(ix+3)
push hl
call gfx_PrintUInt
pop hl
pop hl
call kb_Scan
ld hl,kb_Data+2
; Group 1
ld a,(hl)
inc hl
inc hl
; Group 2
ld a,(hl)
inc hl
inc hl
; Group 3
ld a,(hl)
inc hl
inc hl
; Group 4
ld a,(hl)
inc hl
inc hl
; Group 5
ld a,(hl)
inc hl
inc hl
; Group 6
ld a,(hl)
inc hl
inc hl
; Group 7
ld a,(hl)
inc hl
inc hl
pop hl
pop hl
ret
ui_credits_area_x:=0
ui_credits_area_y:=221
ui_credits_area_w:=20
ui_credits_area_h:=19
ui_folder_area_x:=0
ui_folder_area_y:=10
ui_folder_area_w:=80
ui_folder_area_h:=9
|
catalyst/src/main/antlr4/moonbox/catalyst/core/parser/udf/udfParser/UDF.g4 | Programmer-alliance/moonbox | 523 | 1885 | <filename>catalyst/src/main/antlr4/moonbox/catalyst/core/parser/udf/udfParser/UDF.g4
grammar UDF;
@members {
/**
* Verify whether current token is a valid decimal token (which contains dot).
* Returns true if the character that follows the token is not a digit or letter or underscore.
*
* For example:
* For char stream "2.3", "2." is not a valid decimal token, because it is followed by digit '3'.
* For char stream "2.3_", "2.3" is not a valid decimal token, because it is followed by '_'.
* For char stream "2.3W", "2.3" is not a valid decimal token, because it is followed by 'W'.
* For char stream "12.0D 34.E2+0.12 " 12.0D is a valid decimal token because it is folllowed
* by a space. 34.E2 is a valid decimal token because it is followed by symbol '+'
* which is not a digit or letter or underscore.
*/
public boolean isValidDecimal() {
int nextChar = _input.LA(1);
if (nextChar >= 'A' && nextChar <= 'Z' || nextChar >= '0' && nextChar <= '9' ||
nextChar == '_') {
return false;
} else {
return true;
}
}
}
tokens {
DELIMITER
}
udf
: sql=statement EOF
;
statement
: prefix FROM table=identifier (whereStatement)?
;
prefix
: SELECT (identifier | udfunction) (',' (identifier|udfunction))*
| SELECT (.)*?
;
whereStatement
: WHERE booleanExpression
;
udfunction
: arrayMap
| arrayFilter
| arrayExists
;
arrayMap
: ('array_map(' | 'ARRAY_MAP(') ((identifier|udfunction) ',' aAnde=arrowAndExpression) ')'
;
arrayFilter
: ('array_filter(' | 'ARRAY_FILTER(') ((identifier|udfunction) ',' aAnde=arrowAndExpression) ')'
;
arrayExists
: ('array_exists(' | 'ARRAY_EXISTS(') ((identifier|udfunction) ',' aAnde=arrowAndExpression) ')'
;
arrowAndExpression
: (arrowPrefix=variableAndArrow)? expression
;
variableAndArrow
: variable=IDENTIFIER ARROW
;
expression
: literal #litExpr
| booleanExpression #boolExpr
| mapExpression #mapExpr
;
literal
: NULL | DELIMITER
| number
| booleanValue
| STRING
;
mapExpression
: term (('+' | '-') term)*
;
term
: term1 (('%' term1))*
;
term1
: atom (('*' | '/') atom)*
;
atom
: IDENTIFIER
| numberAndString
| LPAREN mapExpression RPAREN
;
numberAndString
: number | STRING | NULL
;
ideantifierOrLiteral
: IDENTIFIER
| literal
;
booleanExpression
: termf ((AND | OR) termf)*
;
termf
: TRUE | FALSE
| IDENTIFIER BinaryComparator numberAndString
| IDENTIFIER BinaryComparator IDENTIFIER
| arrayExists
| LPAREN booleanExpression RPAREN
;
//booleanExpression
// : simpleBooleanExpression (AND simpleBooleanExpression)* (OR simpleBooleanExpression)*
// ;
//
//simpleBooleanExpression
// : booleanValue
// | IDENTIFIER BinaryComparator ideantifierOrLiteral
// ;
//
booleanValue
: TRUE | FALSE
;
identifier
: IDENTIFIER (. identifier)*
| quotedIdentifier
;
quotedIdentifier
: BACKQUOTED_IDENTIFIER
;
number
: MINUS? DECIMAL_VALUE
| MINUS? INTEGER_VALUE
| MINUS? BIGINT_LITERAL
| MINUS? SMALLINT_LITERAL
| MINUS? TINYINT_LITERAL
| MINUS? DOUBLE_LITERAL
| MINUS? BIGDECIMAL_LITERAL
;
AND: 'AND' | 'and' | '&&' | '&';
OR: 'OR'| 'or' | '||' | '|';
MINUS: '-';
TRUE: 'TRUE' | 'true';
FALSE: 'FALSE' | 'false';
NULL: 'NULL';
ARROW: '=>';
LPAREN: '(';
RPAREN: ')';
SELECT: 'SELECT'|'select';
FROM: 'from'|'FROM';
WHERE: 'where' | 'WHERE';
BinaryArithmeticOperator
: '+'
| '-'
| '*'
| '/'
| '%'
;
BinaryComparator
: '>'
| '>='
| '<'
| '<='
| '=='
| '!='
| '='
;
BACKQUOTED_IDENTIFIER
: '`' ( ~'`' | '``' )* '`'
;
STRING
: '\'' ( ~('\''|'\\') | ('\\' .) )* '\''
| '\"' ( ~('\"'|'\\') | ('\\' .) )* '\"'
;
BIGINT_LITERAL
: DIGIT+ 'L'
;
SMALLINT_LITERAL
: DIGIT+ 'S'
;
TINYINT_LITERAL
: DIGIT+ 'Y'
;
BYTELENGTH_LITERAL
: DIGIT+ ('B' | 'K' | 'M' | 'G')
;
DOUBLE_LITERAL
: DIGIT+ EXPONENT? 'D'
| DECIMAL_DIGITS EXPONENT? 'D' {isValidDecimal()}?
;
BIGDECIMAL_LITERAL
: DIGIT+ EXPONENT? 'BD'
| DECIMAL_DIGITS EXPONENT? 'BD' {isValidDecimal()}?
;
INTEGER_VALUE
: DIGIT+
;
DECIMAL_VALUE
: DIGIT+ EXPONENT
| DECIMAL_DIGITS EXPONENT? {isValidDecimal()}?
;
IDENTIFIER
: (LETTER | DIGIT | '_')+
;
// ==================================================================
fragment DECIMAL_DIGITS
: DIGIT+ '.' DIGIT*
| '.' DIGIT+
;
fragment EXPONENT
: 'E' [+-]? DIGIT+
;
fragment DIGIT
: [0-9]
;
fragment LETTER
: [A-Z]
| [a-z]
;
SIMPLE_COMMENT
: '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN)
;
BRACKETED_EMPTY_COMMENT
: '/**/' -> channel(HIDDEN)
;
BRACKETED_COMMENT
: '/*' ~[+] .*? '*/' -> channel(HIDDEN)
;
WS
: [ \r\n\t]+ -> channel(HIDDEN)
;
// Catch-all for anything we can't recognize.
// We use this to be able to ignore and recover all the text
// when splitting statements with DelimiterLexer
UNRECOGNIZED
: .
; |
src/main/antlr/BMoThParser.g4 | hhu-stups/bmoth | 6 | 5908 | parser grammar BMoThParser;
options { tokenVocab=BMoThLexer; }
@header {
package de.bmoth.antlr;
}
start
: parse_unit EOF # ParseUnit
;
parse_unit
: MACHINE IDENTIFIER (clauses+=machine_clause)* END # MachineParseUnit
;
machine_clause
: clauseName=(PROPERTIES|INVARIANT) pred=predicate # PredicateClause
| clauseName=(CONSTANTS|VARIABLES) identifier_list # DeclarationClause
| INITIALISATION substitution # InitialisationClause
| OPERATIONS ops+=single_operation (SEMICOLON ops+=single_operation)* # OperationsClause
| SETS set_definition (';' set_definition)* # SetsClause
| definition_clause # DefinitionClauseIndirection // used to reuse definition_clause for definition files
;
set_definition
: IDENTIFIER # DeferredSet
| IDENTIFIER EQUAL LEFT_BRACE identifier_list RIGHT_BRACE # EnumeratedSet
;
definition_clause
: DEFINITIONS defs+=single_definition (SEMICOLON defs+=single_definition)* SEMICOLON? # DefinitionClause
;
single_definition
: name=IDENTIFIER (LEFT_PAR identifier_list RIGHT_PAR)? DOUBLE_EQUAL definition_body # OrdinaryDefinition
| StringLiteral # DefinitionFile
;
definition_body
: IDENTIFIER (LEFT_PAR expression_list RIGHT_PAR)? # DefinitionAmbiguousCall
| expression # DefinitionExpression
| predicate # DefinitionPredicate
| substitution # DefinitionSubstitution
;
single_operation
: ( outputParams=identifier_list OUTPUT_PARAMS)? IDENTIFIER ( LEFT_PAR params=identifier_list RIGHT_PAR )? EQUAL substitution # Operation
;
quantified_variables_list
: identifier_list
| LEFT_PAR identifier_list RIGHT_PAR
;
identifier_list
: identifiers+=IDENTIFIER (',' identifiers+=IDENTIFIER)*
;
substitution
: BEGIN substitution END # BlockSubstitution
| SKIP_SUB # SkipSubstitution
| SELECT preds+=predicate THEN subs+=substitution
(WHEN preds+=predicate THEN subs+=substitution)*
(ELSE elseSub=substitution)? END # SelectSubstitution
| CASE expr=expression OF
EITHER either=expression_list THEN sub=substitution
(SUBSTITUTION_OR or_exprs+=expression_list THEN or_subs+=substitution)+
(ELSE else_sub=substitution)? END END # CaseSubstitution
| keyword=(PRE|ASSERT) predicate THEN substitution END # ConditionSubstitution
| ANY identifier_list WHERE predicate THEN substitution END # AnySubstitution
| identifier_list ':=' expression_list # AssignSubstitution
| substitution DOUBLE_VERTICAL_BAR substitution # ParallelSubstitution
| identifier_list DOUBLE_COLON expression # BecomesElementOfSubstitution
| identifier_list (ELEMENT_OF|COLON) LEFT_PAR predicate RIGHT_PAR # BecomesSuchThatSubstitution
| IF preds+=predicate THEN subs+=substitution
(ELSIF preds+=predicate THEN subs+=substitution)*
(ELSE elseSub=substitution)? END # IfSubstitution
| WHILE condition=predicate DO substitution INVARIANT invariant=predicate
VARIANT variant=expression END # WhileSubstitution
;
expression_list
: exprs+=expression (',' exprs+=expression)*
;
formula
: predicate EOF
| expression EOF
;
predicate
: LEFT_PAR predicate RIGHT_PAR # ParenthesesPredicate
| IDENTIFIER # PredicateIdentifier
| IDENTIFIER LEFT_PAR exprs+=expression (',' exprs+=expression)* RIGHT_PAR # PredicateDefinitionCall
| operator=(FOR_ANY|EXITS) quantified_variables_list
DOT LEFT_PAR predicate RIGHT_PAR # QuantifiedPredicate
| operator=(TRUE|FALSE) # PredicateOperator
| operator=NOT LEFT_PAR predicate RIGHT_PAR # PredicateOperator
| expression operator=(EQUAL|NOT_EQUAL|COLON|ELEMENT_OF|NOT_BELONGING
|INCLUSION|STRICT_INCLUSION|NON_INCLUSION|STRICT_NON_INCLUSION
|LESS_EQUAL|LESS|GREATER_EQUAL|GREATER) expression # PredicateOperatorWithExprArgs
| predicate operator=EQUIVALENCE predicate # PredicateOperator //p60
| predicate operator=(AND|OR) predicate # PredicateOperator //p40
| predicate operator=IMPLIES predicate # PredicateOperator //p30
;
expression
: Number # NumberExpression
| LEFT_PAR expression RIGHT_PAR # ParenthesesExpression
| BOOL_CAST LEFT_PAR predicate RIGHT_PAR # CastPredicateExpression
| IDENTIFIER # IdentifierExpression
| StringLiteral # StringExpression
| LEFT_BRACE RIGHT_BRACE # EmptySetExpression
| LEFT_BRACE expression_list RIGHT_BRACE # SetEnumerationExpression
| LEFT_BRACE identifier_list '|' predicate RIGHT_BRACE # SetComprehensionExpression
| LEFT_PAR exprs+=expression COMMA exprs+=expression
(COMMA exprs+=expression)* RIGHT_PAR # NestedCoupleAsTupleExpression
| '[' expression_list? ']' # SequenceEnumerationExpression
| '<''>' # EmptySequenceExpression
| operator=(NATURAL|NATURAL1|INTEGER|INT|NAT|NAT1
|MININT|MAXINT|BOOL|TRUE|FALSE) # ExpressionOperator
| exprs+=expression LEFT_PAR exprs+=expression
(',' exprs+=expression)* RIGHT_PAR # FunctionCallExpression
| operator=(DOM|RAN|CARD|CONC|FIRST|FRONT|ID|ISEQ|ISEQ1
|LAST|MAX|MIN|POW|REV|SEQ|SEQ1|TAIL
|GENERALIZED_UNION|GENERALIZED_INTER)
LEFT_PAR expression RIGHT_PAR # ExpressionOperator
| operator=(QUANTIFIED_UNION|QUANTIFIED_INTER|SIGMA|PI)
quantified_variables_list
DOT LEFT_PAR predicate VERTICAL_BAR expression RIGHT_PAR # QuantifiedExpression
// operators with precedences
| expression operator=TILDE # ExpressionOperator //p230
| operator=MINUS expression # ExpressionOperator //P210
| <assoc=right> expression operator=POWER_OF expression # ExpressionOperator //p200
| expression operator=(MULT|DIVIDE|MOD) expression # ExpressionOperator //p190
| expression operator=(PLUS|MINUS|SET_SUBTRACTION) expression # ExpressionOperator //p180
| expression operator=INTERVAL expression # ExpressionOperator //p170
| expression operator=(OVERWRITE_RELATION|DIRECT_PRODUCT|CONCAT
|DOMAIN_RESTRICTION|DOMAIN_SUBTRACTION|RANGE_RESTRICTION
|RANGE_SUBTRACTION|INSERT_FRONT|INSERT_TAIL|UNION|INTERSECTION
|RESTRICT_FRONT|RESTRICT_TAIL|MAPLET) expression # ExpressionOperator //p160
| expression operator=(SET_RELATION|PARTIAL_FUNCTION|TOTAL_FUNCTION
|TOTAL_INJECTION|PARTIAL_INJECTION|TOTAL_SURJECTION|PARTIAL_SURJECTION
|TOTAL_BIJECTION|PARTIAL_BIJECTION) expression # ExpressionOperator //p125
;
ltlStart
: ltlFormula EOF
;
ltlFormula
: LTL_LEFT_PAR ltlFormula LTL_RIGHT_PAR # LTLParentheses
| keyword=(LTL_TRUE|LTL_FALSE) # LTLKeyword
| operator=(LTL_GLOBALLY|LTL_FINALLY|LTL_NEXT|LTL_NOT) ltlFormula # LTLPrefixOperator
| LTL_B_START predicate B_END # LTLBPredicate
| ltlFormula operator=LTL_IMPLIES ltlFormula # LTLInfixOperator
| ltlFormula operator=(LTL_UNTIL|LTL_WEAK_UNTIL|LTL_RELEASE) ltlFormula # LTLInfixOperator
| ltlFormula operator=(LTL_AND|LTL_OR) ltlFormula # LTLInfixOperator
;
|
src/basic/readingDoubles.asm | FoxNeo/MyAssemblyProjects | 0 | 29298 | <gh_stars>0
.data
prompt: .asciiz "Enter the value of e: "
.text
# Display message of the user
li $v0, 4
la $a0, prompt
syscall
# Get the double from the user
li $v0, 7
syscall
# Display the user's input
li $v0, 3
add.d $f12, $f0, $f10
syscall |
programs/oeis/100/A100166.asm | jmorken/loda | 1 | 20175 | ; A100166: Structured deltoidal hexacontahedral numbers (vertex structure 9).
; 1,62,295,812,1725,3146,5187,7960,11577,16150,21791,28612,36725,46242,57275,69936,84337,100590,118807,139100,161581,186362,213555,243272,275625,310726,348687,389620,433637,480850,531371,585312,642785,703902,768775,837516,910237,987050,1068067,1153400,1243161,1337462,1436415,1540132,1648725,1762306,1880987,2004880,2134097,2268750,2408951,2554812,2706445,2863962,3027475,3197096,3372937,3555110,3743727,3938900,4140741,4349362,4564875,4787392,5017025,5253886,5498087,5749740,6008957,6275850,6550531,6833112,7123705,7422422,7729375,8044676,8368437,8700770,9041787,9391600,9750321,10118062,10494935,10881052,11276525,11681466,12095987,12520200,12954217,13398150,13852111,14316212,14790565,15275282,15770475,16276256,16792737,17320030,17858247,18407500,18967901,19539562,20122595,20717112,21323225,21941046,22570687,23212260,23865877,24531650,25209691,25900112,26603025,27318542,28046775,28787836,29541837,30308890,31089107,31882600,32689481,33509862,34343855,35191572,36053125,36928626,37818187,38721920,39639937,40572350,41519271,42480812,43457085,44448202,45454275,46475416,47511737,48563350,49630367,50712900,51811061,52924962,54054715,55200432,56362225,57540206,58734487,59945180,61172397,62416250,63676851,64954312,66248745,67560262,68888975,70234996,71598437,72979410,74378027,75794400,77228641,78680862,80151175,81639692,83146525,84671786,86215587,87778040,89359257,90959350,92578431,94216612,95874005,97550722,99246875,100962576,102697937,104453070,106228087,108023100,109838221,111673562,113529235,115405352,117302025,119219366,121157487,123116500,125096517,127097650,129120011,131163712,133228865,135315582,137423975,139554156,141706237,143880330,146076547,148295000,150535801,152799062,155084895,157393412,159724725,162078946,164456187,166856560,169280177,171727150,174197591,176691612,179209325,181750842,184316275,186905736,189519337,192157190,194819407,197506100,200217381,202953362,205714155,208499872,211310625,214146526,217007687,219894220,222806237,225743850,228707171,231696312,234711385,237752502,240819775,243913316,247033237,250179650,253352667,256552400,259778961,263032462,266313015,269620732,272955725,276318106,279707987,283125480,286570697,290043750
mov $5,$0
lpb $0
sub $0,1
add $1,$0
add $3,$0
add $3,4
add $1,$3
add $4,3
add $3,$4
lpe
add $0,1
add $1,$3
add $1,1
mul $1,2
sub $1,$0
mov $2,1
mov $6,$5
lpb $2
add $1,$6
sub $2,1
lpe
mov $8,$5
lpb $8
add $7,$6
sub $8,1
lpe
mov $2,21
mov $6,$7
lpb $2
add $1,$6
sub $2,1
lpe
mov $7,0
mov $8,$5
lpb $8
add $7,$6
sub $8,1
lpe
mov $2,17
mov $6,$7
lpb $2
add $1,$6
sub $2,1
lpe
|
oeis/290/A290662.asm | neoneye/loda-programs | 11 | 18188 | ; A290662: Decimal representation of the diagonal from the origin to the corner of the n-th stage of growth of the two-dimensional cellular automaton defined by "Rule 899", based on the 5-celled von Neumann neighborhood.
; 1,3,5,15,23,63,95,255,383,1023,1535,4095,6143,16383,24575,65535,98303,262143,393215,1048575,1572863,4194303,6291455,16777215,25165823,67108863,100663295,268435455,402653183,1073741823,1610612735,4294967295,6442450943,17179869183,25769803775,68719476735,103079215103,274877906943,412316860415,1099511627775,1649267441663,4398046511103,6597069766655,17592186044415,26388279066623,70368744177663,105553116266495,281474976710655,422212465065983,1125899906842623,1688849860263935,4503599627370495
mov $1,$0
mod $0,2
lpb $1
mul $0,2
add $0,3
sub $1,1
lpe
div $0,2
add $0,1
|
slides/ClosedTheory.agda | larrytheliquid/generic-elim | 11 | 5803 | {-# OPTIONS --type-in-type #-}
open import Data.Empty
open import Data.Unit
open import Data.Bool
open import Data.Product hiding ( curry ; uncurry )
open import Data.Nat
open import Data.String
open import Relation.Binary.PropositionalEquality using ( refl ; _≢_ ; _≡_ )
open import Function
module ClosedTheory where
noteq = _≢_
----------------------------------------------------------------------
data Desc (I : Set) : Set₁ where
End : (i : I) → Desc I
Rec : (i : I) (D : Desc I) → Desc I
Arg : (A : Set) (B : A → Desc I) → Desc I
ISet : Set → Set₁
ISet I = I → Set
El : {I : Set} (D : Desc I) → ISet I → ISet I
El (End j) X i = j ≡ i
El (Rec j D) X i = X j × El D X i
El (Arg A B) X i = Σ A (λ a → El (B a) X i)
----------------------------------------------------------------------
UncurriedEl : {I : Set} (D : Desc I) (X : ISet I) → Set
UncurriedEl D X = ∀{i} → El D X i → X i
CurriedEl : {I : Set} (D : Desc I) (X : ISet I) → Set
CurriedEl (End i) X = X i
CurriedEl (Rec i D) X = (x : X i) → CurriedEl D X
CurriedEl (Arg A B) X = (a : A) → CurriedEl (B a) X
CurriedEl' : {I : Set} (D : Desc I) (X : ISet I) (i : I) → Set
CurriedEl' (End j) X i = j ≡ i → X i
CurriedEl' (Rec j D) X i = (x : X j) → CurriedEl' D X i
CurriedEl' (Arg A B) X i = (a : A) → CurriedEl' (B a) X i
curryEl : {I : Set} (D : Desc I) (X : ISet I)
→ UncurriedEl D X → CurriedEl D X
curryEl (End i) X cn = cn refl
curryEl (Rec i D) X cn = λ x → curryEl D X (λ xs → cn (x , xs))
curryEl (Arg A B) X cn = λ a → curryEl (B a) X (λ xs → cn (a , xs))
uncurryEl : {I : Set} (D : Desc I) (X : ISet I)
→ CurriedEl D X → UncurriedEl D X
uncurryEl (End i) X cn refl = cn
uncurryEl (Rec i D) X cn (x , xs) = uncurryEl D X (cn x) xs
uncurryEl (Arg A B) X cn (a , xs) = uncurryEl (B a) X (cn a) xs
----------------------------------------------------------------------
data μ {I : Set} (D : Desc I) (i : I) : Set where
init : El D (μ D) i → μ D i
Inj : {I : Set} (D : Desc I) → Set
Inj D = CurriedEl D (μ D)
inj : {I : Set} (D : Desc I) → Inj D
inj D = curryEl D (μ D) init
----------------------------------------------------------------------
data VecT : Set where
nilT consT : VecT
VecC : (A : Set) → VecT → Desc ℕ
VecC A nilT = End zero
VecC A consT = Arg ℕ (λ n → Arg A λ _ → Rec n (End (suc n)))
VecD : (A : Set) → Desc ℕ
VecD A = Arg VecT (VecC A)
Vec : (A : Set) → ℕ → Set
Vec A = μ (VecD A)
InjConsT : Set → ℕ → Set
InjConsT A m = El (VecC A consT) (Vec A) m → Vec A m
InjConsT' : Set → ℕ → Set
InjConsT' A m = Σ ℕ (λ n → A × Vec A n × suc n ≡ m) → Vec A m
test-InjConsT : (A : Set) (n : ℕ) → InjConsT A n ≡ InjConsT' A n
test-InjConsT A n = refl
nil : (A : Set) → Vec A zero
nil A = init (nilT , refl)
cons : (A : Set) (n : ℕ) (x : A) (xs : Vec A n) → Vec A (suc n)
cons A n x xs = init (consT , n , x , xs , refl)
nil2 : (A : Set) → Vec A zero
nil2 A = inj (VecD A) nilT
cons2 : (A : Set) (n : ℕ) (x : A) (xs : Vec A n) → Vec A (suc n)
cons2 A = inj (VecD A) consT
bit : Vec Bool (suc zero)
bit = cons Bool zero true (nil Bool)
bit2 : Vec Bool (suc zero)
bit2 = init (consT , zero , true , init (nilT , refl) , refl)
----------------------------------------------------------------------
data TreeT : Set where
leaf₁T leaf₂T branchT : TreeT
TreeC : (A B : Set) → TreeT → Desc (ℕ × ℕ)
TreeC A B leaf₁T = Arg A λ _ → End (suc zero , zero)
TreeC A B leaf₂T = Arg B λ _ → End (zero , suc zero)
TreeC A B branchT = Arg ℕ λ m → Arg ℕ λ n
→ Arg ℕ λ x → Arg ℕ λ y
→ Rec (m , n) $ Rec (x , y)
$ End (m + x , n + y)
TreeD : (A B : Set) → Desc (ℕ × ℕ)
TreeD A B = Arg TreeT (TreeC A B)
Tree : (A B : Set) (m n : ℕ) → Set
Tree A B m n = μ (TreeD A B) (m , n)
leaf₁ : (A B : Set) → A → Tree A B (suc zero) zero
leaf₁ A B a = init (leaf₁T , a , refl)
leaf₁2 : (A B : Set) → A → Tree A B (suc zero) zero
leaf₁2 A B = inj (TreeD A B) leaf₁T
----------------------------------------------------------------------
|
src/Semantics/Substitution/Kits.agda | DimaSamoz/temporal-type-systems | 4 | 1903 | <filename>src/Semantics/Substitution/Kits.agda
-- Semantics of syntactic kits and explicit substitutions
module Semantics.Substitution.Kits where
open import Syntax.Types
open import Syntax.Context renaming (_,_ to _,,_)
open import Syntax.Terms
open import Syntax.Substitution.Kits
open import Semantics.Types
open import Semantics.Context
open import Semantics.Terms
open import CategoryTheory.Categories
open import CategoryTheory.Instances.Reactive renaming (top to Top)
open import CategoryTheory.Functor
open import CategoryTheory.Comonad
open import TemporalOps.Diamond
open import TemporalOps.Box
open import TemporalOps.Linear
open import Data.Sum
open import Data.Product
open import Relation.Binary.PropositionalEquality as ≡
using (_≡_ ; refl)
open Comonad W-□
private module F-□ = Functor F-□
-- Semantic interpretation of kits, grouping together
-- lemmas for the kit operations
record ⟦Kit⟧ {𝒮 : Schema} (k : Kit 𝒮) : Set where
open Kit k
field
-- Interpretation of the syntactic entity of the given scheme
⟦_⟧ : ∀{A Δ} -> 𝒮 Δ A -> ⟦ Δ ⟧ₓ ⇴ ⟦ A ⟧ⱼ
-- Variable conversion lemma
⟦𝓋⟧ : ∀ A Δ
-> ⟦ 𝓋 {Δ ,, A} top ⟧ ≈ π₂
-- Term conversion lemma
⟦𝓉⟧ : ∀{A Δ} (T : 𝒮 Δ A)
-> ⟦ 𝓉 T ⟧ₘ ≈ ⟦ T ⟧
-- Weakening map lemma
⟦𝓌⟧ : ∀ B {Δ A} (T : 𝒮 Δ A)
-> ⟦ 𝓌 {B} T ⟧ ≈ ⟦ T ⟧ ∘ π₁
-- Context stabilisation lemma
⟦𝒶⟧ : ∀{A Δ} (T : 𝒮 Δ (A always))
-> F-□.fmap ⟦ 𝒶 T ⟧ ∘ ⟦ Δ ˢ⟧□ ≈ δ.at ⟦ A ⟧ₜ ∘ ⟦ T ⟧
-- | Interpretation of substitutions and combinators
module ⟦K⟧ {𝒮} {k : Kit 𝒮} (⟦k⟧ : ⟦Kit⟧ k) where
open ⟦Kit⟧ ⟦k⟧
open Kit k
-- Denotation of substitutions as a map between contexts
⟦subst⟧ : ∀{Γ Δ} -> Subst 𝒮 Γ Δ -> ⟦ Δ ⟧ₓ ⇴ ⟦ Γ ⟧ₓ
⟦subst⟧ ● = !
⟦subst⟧ (σ ▸ T) = ⟨ ⟦subst⟧ σ , ⟦ T ⟧ ⟩
-- Simplified context stabilisation lemma for non-boxed stabilisation
⟦𝒶⟧′ : ∀{A Δ} (T : 𝒮 Δ (A always))
-> ⟦ 𝒶 T ⟧ ∘ ⟦ Δ ˢ⟧ ≈ ⟦ T ⟧
⟦𝒶⟧′ {A} {Δ} T {n} {⟦Δ⟧} rewrite ⟦ˢ⟧-factor Δ {n} {⟦Δ⟧}
= □-≡ n n (⟦𝒶⟧ T) n
-- Denotation of weakening
⟦⁺⟧ : ∀ A {Γ Δ} -> (σ : Subst 𝒮 Γ Δ)
-> ⟦subst⟧ (_⁺_ {A} σ k) ≈ ⟦subst⟧ σ ∘ π₁
⟦⁺⟧ A ● = refl
⟦⁺⟧ A (_▸_ {B} σ T) {n} {a} rewrite ⟦⁺⟧ A σ {n} {a}
| ⟦𝓌⟧ A T {n} {a} = refl
-- Denotation of lifting
⟦↑⟧ : ∀ A {Δ Γ} -> (σ : Subst 𝒮 Γ Δ)
-> ⟦subst⟧ (_↑_ {A} σ k) ≈ (⟦subst⟧ σ * id)
⟦↑⟧ A {Δ} ● {n} {a} rewrite ⟦𝓋⟧ A Δ {n} {a} = refl
⟦↑⟧ A {Δ} (σ ▸ T) {n} {a} rewrite ⟦⁺⟧ A σ {n} {a}
| ⟦𝓌⟧ A T {n} {a}
| ⟦𝓋⟧ A Δ {n} {a} = refl
-- Denotation of stabilisation (naturality condition for ⟦_ˢ⟧□)
⟦↓ˢ⟧ : ∀ {Γ Δ} -> (σ : Subst 𝒮 Γ Δ)
-> F-□.fmap (⟦subst⟧ (σ ↓ˢ k)) ∘ ⟦ Δ ˢ⟧□ ≈ ⟦ Γ ˢ⟧□ ∘ ⟦subst⟧ σ
⟦↓ˢ⟧ ● = refl
⟦↓ˢ⟧ (_▸_ {A now} σ T) {n} {a} rewrite ⟦↓ˢ⟧ σ {n} {a} = refl
⟦↓ˢ⟧ {Δ = Δ} (_▸_ {A always}{Γ} σ T) {n} {a} = ext lemma
where
lemma : ∀ l -> (F-□.fmap (⟦subst⟧ ((σ ▸ T) ↓ˢ k)) ∘ ⟦ Δ ˢ⟧□) n a l
≡ (⟦ Γ ,, A always ˢ⟧□ ∘ ⟦subst⟧ (σ ▸ T)) n a l
lemma l rewrite □-≡ n l (⟦↓ˢ⟧ σ {n} {a}) l
| □-≡ n l (⟦𝒶⟧ T {n} {a}) l = refl
-- Simplified denotation of stabilisation
⟦↓ˢ⟧′ : ∀ {Γ Δ} -> (σ : Subst 𝒮 Γ Δ)
-> ⟦subst⟧ (σ ↓ˢ k) ∘ ⟦ Δ ˢ⟧ ≈ ⟦ Γ ˢ⟧ ∘ ⟦subst⟧ σ
⟦↓ˢ⟧′ {Γ} {Δ} σ {n} {a} rewrite ⟦ˢ⟧-factor Δ {n} {a}
| □-≡ n n (⟦↓ˢ⟧ σ {n} {a}) n
| ⟦ˢ⟧-factor Γ {n} {(⟦subst⟧ σ n a)} = refl
-- Denotation of stabilisation idempotence
⟦ˢˢ⟧ : ∀ Γ -> F-□.fmap (⟦subst⟧ (Γ ˢˢₛ k)) ∘ ⟦ Γ ˢ ˢ⟧□ ∘ ⟦ Γ ˢ⟧ ≈ ⟦ Γ ˢ⟧□
⟦ˢˢ⟧ ∙ = refl
⟦ˢˢ⟧ (Γ ,, B now) = ⟦ˢˢ⟧ Γ
⟦ˢˢ⟧ (Γ ,, B always) {n} {⟦Γˢ⟧ , □⟦B⟧} = ext lemma
where
lemma : ∀ l → (F-□.fmap (⟦subst⟧ ((Γ ,, B always) ˢˢₛ k))
∘ ⟦ (Γ ,, B always) ˢ ˢ⟧□
∘ ⟦ Γ ,, B always ˢ⟧) n (⟦Γˢ⟧ , □⟦B⟧) l
≡ (⟦ Γ ˢ⟧□ n ⟦Γˢ⟧ l , □⟦B⟧)
lemma l rewrite ⟦𝓋⟧ (B always) (Γ ˢ ˢ) {l} {⟦ Γ ˢ ˢ⟧□ n (⟦ Γ ˢ⟧ n ⟦Γˢ⟧) l , □⟦B⟧}
| ⟦⁺⟧ (B always) (Γ ˢˢₛ k) {l} {(⟦ Γ ˢ ˢ⟧□ n (⟦ Γ ˢ⟧ n ⟦Γˢ⟧) l , □⟦B⟧)}
| □-≡ n l (⟦ˢˢ⟧ Γ {n} {⟦Γˢ⟧}) l = refl
-- Denotation of identity substitution
⟦idₛ⟧ : ∀ {Γ} -> ⟦subst⟧ (idₛ {Γ} k) ≈ id
⟦idₛ⟧ {∙} = refl
⟦idₛ⟧ {Γ ,, A} {n} {⟦Γ⟧ , ⟦A⟧}
rewrite ⟦⁺⟧ A {Γ} (idₛ k) {n} {⟦Γ⟧ , ⟦A⟧}
| ⟦idₛ⟧ {Γ} {n} {⟦Γ⟧}
| ⟦𝓋⟧ A Γ {n} {⟦Γ⟧ , ⟦A⟧} = refl
-- | Other lemmas
-- Substitution by the Γ ˢ ⊆ Γ subcontext substitution is the same as
-- stabilising the context
⟦subst⟧-Γˢ⊆Γ : ∀ Γ -> ⟦subst⟧ (Γˢ⊆Γ Γ ⊆ₛ k) ≈ ⟦ Γ ˢ⟧
⟦subst⟧-Γˢ⊆Γ ∙ = refl
⟦subst⟧-Γˢ⊆Γ (Γ ,, A now) {n} {⟦Γ⟧ , ⟦A⟧}
rewrite ⟦⁺⟧ (A now) (Γˢ⊆Γ Γ ⊆ₛ k) {n} {⟦Γ⟧ , ⟦A⟧} = ⟦subst⟧-Γˢ⊆Γ Γ
⟦subst⟧-Γˢ⊆Γ (Γ ,, A always) {n} {⟦Γ⟧ , ⟦A⟧}
rewrite ⟦↑⟧ (A always) (Γˢ⊆Γ Γ ⊆ₛ k) {n} {⟦Γ⟧ , ⟦A⟧}
| ⟦subst⟧-Γˢ⊆Γ Γ {n} {⟦Γ⟧} = refl
-- Interpretation of substitution and selection can be commuted
⟦subst⟧-handle : ∀{Δ Γ A B C} -> (σ : Subst 𝒮 Γ Δ)
-> {⟦C₁⟧ : ⟦ Γ ˢ ⟧ₓ ⊗ ⟦ A ⟧ₜ ⊗ ◇ ⟦ B ⟧ₜ ⇴ ◇ ⟦ C ⟧ₜ}
-> {⟦C₂⟧ : ⟦ Γ ˢ ⟧ₓ ⊗ ◇ ⟦ A ⟧ₜ ⊗ ⟦ B ⟧ₜ ⇴ ◇ ⟦ C ⟧ₜ}
-> {⟦C₃⟧ : ⟦ Γ ˢ ⟧ₓ ⊗ ⟦ A ⟧ₜ ⊗ ⟦ B ⟧ₜ ⇴ ◇ ⟦ C ⟧ₜ}
-> (handle
(⟦C₁⟧ ∘ (⟦subst⟧ (_↑_ {Event B now} (_↑_ {A now} (σ ↓ˢ k) k) k)))
(⟦C₂⟧ ∘ (⟦subst⟧ (_↑_ {B now} (_↑_ {Event A now} (σ ↓ˢ k) k) k)))
(⟦C₃⟧ ∘ (⟦subst⟧ (_↑_ {B now} (_↑_ {A now} (σ ↓ˢ k) k) k))))
≈ handle ⟦C₁⟧ ⟦C₂⟧ ⟦C₃⟧ ∘ (⟦subst⟧ (σ ↓ˢ k) * id)
⟦subst⟧-handle {A = A} {B} σ {n = n} {⟦Δ⟧ , inj₁ (inj₁ (⟦A⟧ , ⟦◇B⟧))}
rewrite ⟦↑⟧ (Event B now) (_↑_ {A now} (σ ↓ˢ k) k) {n} {(⟦Δ⟧ , ⟦A⟧) , ⟦◇B⟧}
| ⟦↑⟧ (A now) (σ ↓ˢ k) {n} {⟦Δ⟧ , ⟦A⟧} = refl
⟦subst⟧-handle {A = A} {B} σ {n = n} {⟦Δ⟧ , inj₁ (inj₂ (⟦B⟧ , ⟦◇A⟧))}
rewrite ⟦↑⟧ (B now) (_↑_ {Event A now} (σ ↓ˢ k) k) {n} {(⟦Δ⟧ , ⟦B⟧) , ⟦◇A⟧}
| ⟦↑⟧ (Event A now) (σ ↓ˢ k) {n} {⟦Δ⟧ , ⟦B⟧} = refl
⟦subst⟧-handle {A = A} {B} σ {n = n} {⟦Δ⟧ , inj₂ (⟦A⟧ , ⟦B⟧)}
rewrite ⟦↑⟧ (B now) (_↑_ {A now} (σ ↓ˢ k) k) {n} {(⟦Δ⟧ , ⟦A⟧) , ⟦B⟧}
| ⟦↑⟧ (A now) (σ ↓ˢ k) {n} {⟦Δ⟧ , ⟦A⟧} = refl
|
Codes/Chapter06/P08/P06-08.asm | ar-ekt/Dandamudi-Assembly-Solutions | 8 | 161608 | global _start
extern ExitProcess
%INCLUDE "lib.h"
%macro geti 0
fgets buffer, 15
a2i 15, buffer
%endmacro
%macro puti 1
i2a DWORD %1, buffer
puts buffer
%endmacro
section .data
MAX_ROW EQU 10
MAX_COL EQU 15
NEWLINE db 10, 0
TAB db 9, 0
MSG_ROW_INPUT db "Enter matrix number of rows: ", 0
MSG_COL_INPUT db "Enter matrix number of columns: ", 0
MSG_CELL_INPUT1 db "matrix[", 0
MSG_CELL_INPUT2 db "][", 0
MSG_CELL_INPUT3 db "] = ", 0
MSG_OUTPUT1 db "The maximum element is at (", 0
MSG_OUTPUT2 db ", ", 0
MSG_OUTPUT3 db ")", 10, 0
section .bss
buffer resb 100
matrix resd (MAX_COL*MAX_ROW)+1
section .code
_start:
call main
_end:
push DWORD 0
call ExitProcess
main:
enter 0, 0
pushad
push DWORD 0
push DWORD 0
push matrix
call matrixInput
pop ECX
pop EBX
push EBX
push ECX
push matrix
call mat_max
push ECX
push EBX
call print_result
end_main:
popad
leave
ret 0-0
matrixInput:
%define matrix DWORD [EBP+8]
%define numCol DWORD [EBP+12]
%define numRow DWORD [EBP+16]
enter 0, 0
pushad
matRowInput:
puts MSG_ROW_INPUT
geti
cmp EAX, MAX_ROW
jg matRowInput
cmp EAX, 1
jl matRowInput
mov numRow, EAX
matColInput:
puts MSG_COL_INPUT
geti
cmp EAX, MAX_COL
jg matColInput
cmp EAX, 1
jl matColInput
mov numCol, EAX
cellsInput:
mov ESI, matrix
mov ECX, 0-1
rowsInput:
inc ECX
cmp ECX, numRow
jge matrixInput_done
mov EDX, 0-1
columnsInput:
inc EDX
cmp EDX, numCol
jge rowsInput
puts MSG_CELL_INPUT1
puti ECX
puts MSG_CELL_INPUT2
puti EDX
puts MSG_CELL_INPUT3
geti
mov [ESI], EAX
add ESI, 4
jmp columnsInput
matrixInput_done:
popad
leave
ret 12-8
mat_max:
%define matrix DWORD [EBP+8]
%define numCol DWORD [EBP+12]
%define numRow DWORD [EBP+16]
%define maxVal DWORD [EBP-4]
%define maxX DWORD [EBP-8]
%define maxY DWORD [EBP-12]
enter 12, 0
pushad
mov maxVal, 0-2147483648
mov ESI, matrix
sub ESI, 4
mov EBX, 0-1
rowLoop:
inc EBX
cmp EBX, numRow
je mat_max_end
mov ECX, 0-1
colLoop:
inc ECX
cmp ECX, numCol
je rowLoop
add ESI, 4
mov EDX, maxVal
cmp [ESI], EDX
jng colLoop
is_bigger:
mov EDX, [ESI]
mov maxVal, EDX
mov maxX, EBX
mov maxY, ECX
jmp colLoop
mat_max_end:
popad
mov EBX, maxX
mov ECX, maxY
leave
ret 12-0
print_result:
%define maxX DWORD [EBP+8]
%define maxY DWORD [EBP+12]
enter 0, 0
puts MSG_OUTPUT1
puti maxX
puts MSG_OUTPUT2
puti maxY
puts MSG_OUTPUT3
print_result_end:
leave
ret 8-0
|
programs/oeis/100/A100575.asm | neoneye/loda | 22 | 247859 | ; A100575: Half the number of permutations of 0..n with exactly two maxima.
; 0,0,1,8,44,208,912,3840,15808,64256,259328,1042432,4180992,16748544,67047424,268304384,1073463296,4294377472,17178624000,68716855296,274872401920,1099500093440,4398022393856,17592135712768,70368639320064
mov $1,2
pow $1,$0
sub $2,$0
sub $2,1
add $2,$1
mul $1,$2
div $1,4
mov $0,$1
|
gdt.asm | FoxForge/Intel86-32bitOS-VGA-Driver | 0 | 170413 | ; Global Descriptor Table (GDT)
gdt_start:
; The first entry in the GDT is a mandatory 'null' descriptor
gdt_null:
dd 0
dd 0
; The code segment descriptor
;
; Base = 0, limit = FFFFF
; First flags byte:
; Bit 0 (Bit 40 in GDT): Access bit (Used with Virtual Memory). Because we are not using virtual memory yet we will set it to 0
; Bit 1 (Bit 41 in GDT): The readable/writable bit. Its set (for code selector), so we can read and execute data in the segment as code
; Bit 2 (Bit 42 in GDT): The conforming bit. For now, set to 0 to indicate that only code of the privilege set in bits 45 and 46 can execute.
; Bit 3 (Bit 43 in GDT): Set to 1 to indicate we have a code segment
; Bit 4 (Bit 44 in GDT): Represents this as a "system" or "code/data" descriptor. This is a code selector, so the bit is set to 1.
; Bits 5-6 (Bits 45-46 in GDT): The privilege level. We are in ring 0, so both bits are 0.
; Bit 7 (Bit 47 in GDT): Used to indicate the segment is in memory (Used with virtual memory). Set to zero for now, since we are not using virtual memory yet
;
; Second flags nibble: (Granularity)1 (32-bit default)1 (64-bit segment)0 (AVL)0 => 1100b
gdt_code:
dw 0FFFFh ; Limit (bits 0 - 15)
dw 0 ; Base (bits 0 - 15)
db 0 ; Base (bits 16 - 23)
db 10011010b ; First flags and type flags
db 11001111b ; Second flags and bits 16 - 19 of limit
db 0 ; Base (bits 24 - 31)
; The data segment descriptor
; Base = 0, limit = FFFFF
; First flags nibble: (Present)1 (Privilege)00 (Descriptor type)1 => 1001b
; Type flags nibble: (Code)0 (Expand down)0 (Writable)1 (Accessed)0 => 0010b
; Second flags nibble: (Granularity)1 (32-bit default)1 (64-bit segment)0 (AVL)0 => 1100b
gdt_data:
dw 0FFFFh ; Limit (bits 0 - 15)
dw 0 ; Base (bits 0 - 15)
db 0 ; Base (bits 16 - 23)
db 10010010b ; First flags and type flags
db 11001111b ; Second flags and bits 16 - 19 of limit
db 0 ; Base (bits 24 - 31)
gdt_end: ; This label lets us use the assembler to calculate the size of the GDT below,
; GDT Descriptor
gdt_descriptor:
dw gdt_end - gdt_start - 1 ; Size of the GDT. It is always one less than the true size.
dd gdt_start ; Start address of the GDT
; Useful offsets into the GDT
CODE_SEG equ gdt_code - gdt_start
DATA_SEG equ gdt_data - gdt_start
|
linear_algebra/cholesky_lu_tst_1.adb | jscparker/math_packages | 30 | 23418 | <reponame>jscparker/math_packages
-- Test LU decomposition on a real valued square matrix.
with Ada.Numerics.Generic_elementary_functions;
with Cholesky_LU;
with Text_IO; use Text_IO;
with Test_Matrices;
procedure cholesky_lu_tst_1 is
type Real is digits 15;
subtype Index is Integer range 0..191;
Starting_Index : constant Index := Index'First + 0;
Final_Index : Index := Index'Last - 0;
package Math is new Ada.Numerics.Generic_elementary_functions(Real);
use Math; --for sqrt
package lu is new Cholesky_LU (Real, Index, Matrix);
use lu;
package rio is new Float_IO(Real);
use rio;
package iio is new Integer_IO(Integer);
use iio;
package Make_Square_Matrix is new Test_Matrices (Real, Index, Matrix);
use Make_Square_Matrix;
type Matrix is array(Index, Index) of Real;
type Real_Extended is digits 15; -- or 18 on intel
Zero : constant Real := +0.0;
One : constant Real := +1.0;
Two : constant Real := +2.0;
Min_Allowed_Real : constant Real := Two**(Real'Machine_Emin / 4);
e_Sum : Real_Extended;
Sum : Real;
Diag_Inverse : Row_Vector := (others => Zero);
Zero_Vector : constant Row_Vector := (others => Zero);
A, A_LU, Err, L, U : Matrix := (others => (others => Zero));
Trace, Relative_Err : Real;
IO_Final_Index : Integer := 4;
-----------
-- Pause --
-----------
procedure Pause (s1,s2,s3,s4,s5,s6,s7,s8 : string := "") is
Continue : Character := ' ';
begin
New_Line;
if S1 /= "" then put_line (S1); end if;
if S2 /= "" then put_line (S2); end if;
if S3 /= "" then put_line (S3); end if;
if S4 /= "" then put_line (S4); end if;
if S5 /= "" then put_line (S5); end if;
if S6 /= "" then put_line (S6); end if;
if S7 /= "" then put_line (S7); end if;
if S8 /= "" then put_line (S8); end if;
new_line;
begin
put ("Enter a character to continue: ");
get_immediate (Continue);
new_line;
exception
when others => null;
end;
end pause;
-----------------------------------
-- Transpose_of_Left_Times_Right --
-----------------------------------
function Transpose_of_Left_Times_Right
(A, B : in Matrix;
Final_Row : in Index := Final_Index;
Final_Col : in Index := Final_Index;
Starting_Row : in Index := Starting_Index;
Starting_Col : in Index := Starting_Index)
return Matrix
is
Sum : Real := Zero;
Result : Matrix := (others => (others => Zero));
begin
for Row in Starting_Row .. Final_Row loop
for Col in Starting_Col .. Final_Col loop
Sum := Zero;
for k in Starting_Col .. Final_Col loop
Sum := Sum + A(k, Row) * B(k, Col);
end loop;
Result(Row, Col) := Sum;
end loop;
end loop;
return Result;
end Transpose_of_Left_Times_Right;
--------------------
-- Frobenius_Norm --
--------------------
function Frobenius_Norm
(A : in Matrix;
Final_Row : in Index := Final_Index;
Final_Col : in Index := Final_Index;
Starting_Row : in Index := Starting_Index;
Starting_Col : in Index := Starting_Index)
return Real
is
Max_A_Val : Real := Zero;
Sum, Scaling, tmp : Real := Zero;
begin
Max_A_Val := Zero;
for Row in Starting_Row .. Final_Row loop
for Col in Starting_Col .. Final_Col loop
if Max_A_Val < Abs A(Row, Col) then Max_A_Val := Abs A(Row, Col); end if;
end loop;
end loop;
Scaling := One / (Max_A_Val + Min_Allowed_Real);
Sum := Zero;
for Row in Starting_Row .. Final_Row loop
for Col in Starting_Col .. Final_Col loop
tmp := Scaling * A(Row, Col);
Sum := Sum + tmp * tmp;
end loop;
end loop;
return Sqrt (Sum) * Max_A_Val;
end Frobenius_Norm;
begin
put("Maximum matrix size is "&
Integer'Image(Zero_Vector'length-(Integer(Starting_Index)-Integer(Index'First))));
new_Line;
put("Input Size Of Matrix To Invert (enter an Integer)"); new_Line;
get(IO_Final_Index);
Final_Index := Starting_Index + Index (IO_Final_Index-1);
Pause(
"Test 1: Cholesky's LU Decomposition of matrix A = L*U. A positive definite",
"A is obtained from A = B'*B + eps*I, where B' = Transpose (B). If 15 digit",
"Reals are used, then expect error in calculation of A = L*U to be a few",
"parts per 10**15. In other words ||L*U - A|| / ||A|| should be a few",
"multiples of 10**(-15). Here |*| denotes the Frobenius Norm. Other matrix",
"norms give slightly different answers, so its an order of magnitude estimate."
);
new_line;
for Chosen_Matrix in Matrix_id loop
put("For matrix A = B'*B + eps*I, where B is ");
put(Matrix_id'Image(Chosen_Matrix)); Put(":");
new_line;
-- Get A:
Init_Matrix (A, Chosen_Matrix);
A := Transpose_of_Left_Times_Right (A, A);
-- A = A'A is now positive semi-definite. Shift all eigs +Epsilon, where
-- Epsilon = 2**(-Real'Machine_Mantissa / 2) * Upper_Bound_of_Largest_Eig:
Trace := Min_Allowed_Real;
for Col in Starting_Index .. Final_Index loop
Trace := Trace + A(Col, Col);
end loop;
for Col in Starting_Index .. Final_Index loop
A(Col, Col) := Two ** (-Real'Machine_Mantissa / 2) * Trace + A(Col, Col);
end loop;
-- Get A = L * U:
A_LU := A;
LU_decompose
(A => A_LU,
Diag_Inverse => Diag_Inverse,
Final_Index => Final_Index,
Starting_Index => Starting_Index);
-- L, U initialized to 0:
for Row in Starting_Index .. Index'Last loop
for Col in Row .. Index'Last loop
U(Row, Col) := A_LU(Row, Col);
end loop;
end loop;
for Col in Starting_Index .. Index'Last loop
for Row in Col .. Index'Last loop
L(Row, Col) := A_LU(Row, Col);
end loop;
end loop;
-- Multiply Original L and U as test. Get Max error:
for I in Starting_Index..Final_Index loop
for J in Starting_Index..Final_Index loop
e_Sum := +0.0;
for K in Starting_Index .. Final_Index loop
e_Sum := e_Sum + Real_Extended (L(I, K)) * Real_Extended (U(K, J));
end loop;
Sum:= Real(e_Sum);
-- Product(I,J) := Sum;
-- Calculate the error:
Err(i, j) := Sum - A(i, j);
end loop;
end loop;
Relative_Err := Frobenius_Norm (Err) / (Frobenius_Norm (A) + Min_Allowed_Real);
put(" Err in A - L*U is ~ ||A - L*U|| / ||A|| =");
put(Relative_Err);
new_line;
end loop; -- Matrix_id
end;
|
src/Ada/ewok-syscalls.ads | wookey-project/ewok-legacy | 0 | 10903 | <filename>src/Ada/ewok-syscalls.ads
--
-- Copyright 2018 The wookey project team <<EMAIL>>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <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 ada.unchecked_conversion;
package ewok.syscalls
with spark_mode => off
is
subtype t_syscall_ret is unsigned_32;
SYS_E_DONE : constant t_syscall_ret := 0; -- Syscall succesful
SYS_E_INVAL : constant t_syscall_ret := 1; -- Invalid input data
SYS_E_DENIED : constant t_syscall_ret := 2; -- Permission is denied
SYS_E_BUSY : constant t_syscall_ret := 3;
-- Target is busy OR not enough ressources OR ressource is already used
type t_svc_type is
(SVC_SYSCALL,
SVC_TASK_DONE,
SVC_ISR_DONE)
with size => 8;
function to_svc_type is new ada.unchecked_conversion
(unsigned_8, t_svc_type);
type t_syscall_type is
(SYS_YIELD,
SYS_INIT,
SYS_IPC,
SYS_CFG,
SYS_GETTICK,
SYS_RESET,
SYS_SLEEP,
SYS_LOCK,
SYS_GET_RANDOM,
SYS_LOG)
with size => 32;
type t_syscalls_init is
(INIT_DEVACCESS,
INIT_DMA,
INIT_DMA_SHM,
INIT_GETTASKID,
INIT_DONE);
type t_syscalls_ipc is
(IPC_RECV_SYNC,
IPC_SEND_SYNC,
IPC_RECV_ASYNC,
IPC_SEND_ASYNC);
type t_syscalls_cfg is
(CFG_GPIO_SET,
CFG_GPIO_GET,
CFG_GPIO_UNLOCK_EXTI,
CFG_DMA_RECONF,
CFG_DMA_RELOAD,
CFG_DMA_DISABLE,
CFG_DEV_MAP,
CFG_DEV_UNMAP,
CFG_DEV_RELEASE);
type t_syscalls_lock is
(LOCK_ENTER,
LOCK_EXIT);
type t_syscall_parameters is record
syscall_type : t_syscall_type;
args : aliased t_parameters;
end record
with pack;
end ewok.syscalls;
|
smsq/uq/werms.asm | olifink/smsqe | 0 | 86457 | <reponame>olifink/smsqe
; Error message routines QL compatible 1989 <NAME>
section uq
xdef uq_wersy
xdef uq_werms
xref uq_wtext
include 'dev8_keys_sys'
include 'dev8_keys_qdos_sms'
uq_wersy
move.l a0,-(sp)
sub.l a0,a0
bsr.s uq_werms
move.l (sp)+,a0
rts
uq_werms
tst.l d0 ; anything to do?
bge.s uwe_rts ; ... no
uwe.reg reg d0/a1
movem.l uwe.reg,-(sp)
move.l d0,a1
moveq #sms.mptr,d0
trap #do.sms2
bsr.s uq_wtext
movem.l (sp)+,uwe.reg
tst.l d0
uwe_rts
rts
end
|
Sast.Antlr/Grammars/CSharpLexer.g4 | wiseants/Sast | 0 | 5183 | // Eclipse Public License - v 1.0, http://www.eclipse.org/legal/epl-v10.html
// Copyright (c) 2013, <NAME> (<EMAIL>)
// Copyright (c) 2016-2017, <NAME> (<EMAIL>), Positive Technologies.
lexer grammar CSharpLexer;
channels { COMMENTS_CHANNEL, DIRECTIVE }
@lexer::members
{private int interpolatedStringLevel;
private System.Collections.Generic.Stack<bool> interpolatedVerbatiums = new System.Collections.Generic.Stack<bool>();
private System.Collections.Generic.Stack<int> curlyLevels = new System.Collections.Generic.Stack<int>();
private bool verbatium;
}
BYTE_ORDER_MARK: '\u00EF\u00BB\u00BF';
SINGLE_LINE_DOC_COMMENT: '///' InputCharacter* -> channel(COMMENTS_CHANNEL);
DELIMITED_DOC_COMMENT: '/**' .*? '*/' -> channel(COMMENTS_CHANNEL);
SINGLE_LINE_COMMENT: '//' InputCharacter* -> channel(COMMENTS_CHANNEL);
DELIMITED_COMMENT: '/*' .*? '*/' -> channel(COMMENTS_CHANNEL);
WHITESPACES: (Whitespace | NewLine)+ -> channel(HIDDEN);
SHARP: '#' -> mode(DIRECTIVE_MODE);
ABSTRACT: 'abstract';
ADD: 'add';
ALIAS: 'alias';
ARGLIST: '__arglist';
AS: 'as';
ASCENDING: 'ascending';
ASYNC: 'async';
AWAIT: 'await';
BASE: 'base';
BOOL: 'bool';
BREAK: 'break';
BY: 'by';
BYTE: 'byte';
CASE: 'case';
CATCH: 'catch';
CHAR: 'char';
CHECKED: 'checked';
CLASS: 'class';
CONST: 'const';
CONTINUE: 'continue';
DECIMAL: 'decimal';
DEFAULT: 'default';
DELEGATE: 'delegate';
DESCENDING: 'descending';
DO: 'do';
DOUBLE: 'double';
DYNAMIC: 'dynamic';
ELSE: 'else';
ENUM: 'enum';
EQUALS: 'equals';
EVENT: 'event';
EXPLICIT: 'explicit';
EXTERN: 'extern';
FALSE: 'false';
FINALLY: 'finally';
FIXED: 'fixed';
FLOAT: 'float';
FOR: 'for';
FOREACH: 'foreach';
FROM: 'from';
GET: 'get';
GOTO: 'goto';
GROUP: 'group';
IF: 'if';
IMPLICIT: 'implicit';
IN: 'in';
INT: 'int';
INTERFACE: 'interface';
INTERNAL: 'internal';
INTO: 'into';
IS: 'is';
JOIN: 'join';
LET: 'let';
LOCK: 'lock';
LONG: 'long';
NAMEOF: 'nameof';
NAMESPACE: 'namespace';
NEW: 'new';
NULL: 'null';
OBJECT: 'object';
ON: 'on';
OPERATOR: 'operator';
ORDERBY: 'orderby';
OUT: 'out';
OVERRIDE: 'override';
PARAMS: 'params';
PARTIAL: 'partial';
PRIVATE: 'private';
PROTECTED: 'protected';
PUBLIC: 'public';
READONLY: 'readonly';
REF: 'ref';
REMOVE: 'remove';
RETURN: 'return';
SBYTE: 'sbyte';
SEALED: 'sealed';
SELECT: 'select';
SET: 'set';
SHORT: 'short';
SIZEOF: 'sizeof';
STACKALLOC: 'stackalloc';
STATIC: 'static';
STRING: 'string';
STRUCT: 'struct';
SWITCH: 'switch';
THIS: 'this';
THROW: 'throw';
TRUE: 'true';
TRY: 'try';
TYPEOF: 'typeof';
UINT: 'uint';
ULONG: 'ulong';
UNCHECKED: 'unchecked';
UNMANAGED: 'unmanaged';
UNSAFE: 'unsafe';
USHORT: 'ushort';
USING: 'using';
VAR: 'var';
VIRTUAL: 'virtual';
VOID: 'void';
VOLATILE: 'volatile';
WHEN: 'when';
WHERE: 'where';
WHILE: 'while';
YIELD: 'yield';
//B.1.6 Identifiers
// must be defined after all keywords so the first branch (Available_identifier) does not match keywords
// https://msdn.microsoft.com/en-us/library/aa664670(v=vs.71).aspx
IDENTIFIER: '@'? IdentifierOrKeyword;
//B.1.8 Literals
// 0.Equals() would be parsed as an invalid real (1. branch) causing a lexer error
LITERAL_ACCESS: [0-9] ('_'* [0-9])* IntegerTypeSuffix? '.' '@'? IdentifierOrKeyword;
INTEGER_LITERAL: [0-9] ('_'* [0-9])* IntegerTypeSuffix?;
HEX_INTEGER_LITERAL: '0' [xX] ('_'* HexDigit)+ IntegerTypeSuffix?;
BIN_INTEGER_LITERAL: '0' [bB] ('_'* [01])+ IntegerTypeSuffix?;
REAL_LITERAL: ([0-9] ('_'* [0-9])*)? '.' [0-9] ('_'* [0-9])* ExponentPart? [FfDdMm]? | [0-9] ('_'* [0-9])* ([FfDdMm] | ExponentPart [FfDdMm]?);
CHARACTER_LITERAL: '\'' (~['\\\r\n\u0085\u2028\u2029] | CommonCharacter) '\'';
REGULAR_STRING: '"' (~["\\\r\n\u0085\u2028\u2029] | CommonCharacter)* '"';
VERBATIUM_STRING: '@"' (~'"' | '""')* '"';
INTERPOLATED_REGULAR_STRING_START: '$"'
{ interpolatedStringLevel++; interpolatedVerbatiums.Push(false); verbatium = false; } -> pushMode(INTERPOLATION_STRING);
INTERPOLATED_VERBATIUM_STRING_START: '$@"'
{ interpolatedStringLevel++; interpolatedVerbatiums.Push(true); verbatium = true; } -> pushMode(INTERPOLATION_STRING);
//B.1.9 Operators And Punctuators
OPEN_BRACE: '{'
{
if (interpolatedStringLevel > 0)
{
curlyLevels.Push(curlyLevels.Pop() + 1);
}};
CLOSE_BRACE: '}'
{
if (interpolatedStringLevel > 0)
{
curlyLevels.Push(curlyLevels.Pop() - 1);
if (curlyLevels.Peek() == 0)
{
curlyLevels.Pop();
Skip();
PopMode();
}
}
};
OPEN_BRACKET: '[';
CLOSE_BRACKET: ']';
OPEN_PARENS: '(';
CLOSE_PARENS: ')';
DOT: '.';
COMMA: ',';
COLON: ':'
{
if (interpolatedStringLevel > 0)
{
int ind = 1;
bool switchToFormatString = true;
while ((char)_input.La(ind) != '}')
{
if (_input.La(ind) == ':' || _input.La(ind) == ')')
{
switchToFormatString = false;
break;
}
ind++;
}
if (switchToFormatString)
{
Mode(INTERPOLATION_FORMAT);
}
}
};
SEMICOLON: ';';
PLUS: '+';
MINUS: '-';
STAR: '*';
DIV: '/';
PERCENT: '%';
AMP: '&';
BITWISE_OR: '|';
CARET: '^';
BANG: '!';
TILDE: '~';
ASSIGNMENT: '=';
LT: '<';
GT: '>';
INTERR: '?';
DOUBLE_COLON: '::';
OP_COALESCING: '??';
OP_INC: '++';
OP_DEC: '--';
OP_AND: '&&';
OP_OR: '||';
OP_PTR: '->';
OP_EQ: '==';
OP_NE: '!=';
OP_LE: '<=';
OP_GE: '>=';
OP_ADD_ASSIGNMENT: '+=';
OP_SUB_ASSIGNMENT: '-=';
OP_MULT_ASSIGNMENT: '*=';
OP_DIV_ASSIGNMENT: '/=';
OP_MOD_ASSIGNMENT: '%=';
OP_AND_ASSIGNMENT: '&=';
OP_OR_ASSIGNMENT: '|=';
OP_XOR_ASSIGNMENT: '^=';
OP_LEFT_SHIFT: '<<';
OP_LEFT_SHIFT_ASSIGNMENT: '<<=';
OP_COALESCING_ASSIGNMENT: '??=';
OP_RANGE: '..';
// https://msdn.microsoft.com/en-us/library/dn961160.aspx
mode INTERPOLATION_STRING;
DOUBLE_CURLY_INSIDE: '{{';
OPEN_BRACE_INSIDE: '{' { curlyLevels.Push(1); } -> skip, pushMode(DEFAULT_MODE);
REGULAR_CHAR_INSIDE: { !verbatium }? SimpleEscapeSequence;
VERBATIUM_DOUBLE_QUOTE_INSIDE: { verbatium }? '""';
DOUBLE_QUOTE_INSIDE: '"' { interpolatedStringLevel--; interpolatedVerbatiums.Pop();
verbatium = (interpolatedVerbatiums.Count > 0 ? interpolatedVerbatiums.Peek() : false); } -> popMode;
REGULAR_STRING_INSIDE: { !verbatium }? ~('{' | '\\' | '"')+;
VERBATIUM_INSIDE_STRING: { verbatium }? ~('{' | '"')+;
mode INTERPOLATION_FORMAT;
DOUBLE_CURLY_CLOSE_INSIDE: '}}' -> type(FORMAT_STRING);
CLOSE_BRACE_INSIDE: '}' { curlyLevels.Pop(); } -> skip, popMode;
FORMAT_STRING: ~'}'+;
mode DIRECTIVE_MODE;
DIRECTIVE_WHITESPACES: Whitespace+ -> channel(HIDDEN);
DIGITS: [0-9]+ -> channel(DIRECTIVE);
DIRECTIVE_TRUE: 'true' -> channel(DIRECTIVE), type(TRUE);
DIRECTIVE_FALSE: 'false' -> channel(DIRECTIVE), type(FALSE);
DEFINE: 'define' -> channel(DIRECTIVE);
UNDEF: 'undef' -> channel(DIRECTIVE);
DIRECTIVE_IF: 'if' -> channel(DIRECTIVE), type(IF);
ELIF: 'elif' -> channel(DIRECTIVE);
DIRECTIVE_ELSE: 'else' -> channel(DIRECTIVE), type(ELSE);
ENDIF: 'endif' -> channel(DIRECTIVE);
LINE: 'line' -> channel(DIRECTIVE);
ERROR: 'error' Whitespace+ -> channel(DIRECTIVE), mode(DIRECTIVE_TEXT);
WARNING: 'warning' Whitespace+ -> channel(DIRECTIVE), mode(DIRECTIVE_TEXT);
REGION: 'region' Whitespace* -> channel(DIRECTIVE), mode(DIRECTIVE_TEXT);
ENDREGION: 'endregion' Whitespace* -> channel(DIRECTIVE), mode(DIRECTIVE_TEXT);
PRAGMA: 'pragma' Whitespace+ -> channel(DIRECTIVE), mode(DIRECTIVE_TEXT);
NULLABLE: 'nullable' Whitespace+ -> channel(DIRECTIVE), mode(DIRECTIVE_TEXT);
DIRECTIVE_DEFAULT: 'default' -> channel(DIRECTIVE), type(DEFAULT);
DIRECTIVE_HIDDEN: 'hidden' -> channel(DIRECTIVE);
DIRECTIVE_OPEN_PARENS: '(' -> channel(DIRECTIVE), type(OPEN_PARENS);
DIRECTIVE_CLOSE_PARENS: ')' -> channel(DIRECTIVE), type(CLOSE_PARENS);
DIRECTIVE_BANG: '!' -> channel(DIRECTIVE), type(BANG);
DIRECTIVE_OP_EQ: '==' -> channel(DIRECTIVE), type(OP_EQ);
DIRECTIVE_OP_NE: '!=' -> channel(DIRECTIVE), type(OP_NE);
DIRECTIVE_OP_AND: '&&' -> channel(DIRECTIVE), type(OP_AND);
DIRECTIVE_OP_OR: '||' -> channel(DIRECTIVE), type(OP_OR);
DIRECTIVE_STRING: '"' ~('"' | [\r\n\u0085\u2028\u2029])* '"' -> channel(DIRECTIVE), type(STRING);
CONDITIONAL_SYMBOL: IdentifierOrKeyword -> channel(DIRECTIVE);
DIRECTIVE_SINGLE_LINE_COMMENT: '//' ~[\r\n\u0085\u2028\u2029]* -> channel(COMMENTS_CHANNEL), type(SINGLE_LINE_COMMENT);
DIRECTIVE_NEW_LINE: NewLine -> channel(DIRECTIVE), mode(DEFAULT_MODE);
mode DIRECTIVE_TEXT;
TEXT: ~[\r\n\u0085\u2028\u2029]+ -> channel(DIRECTIVE);
TEXT_NEW_LINE: NewLine -> channel(DIRECTIVE), type(DIRECTIVE_NEW_LINE), mode(DEFAULT_MODE);
// Fragments
fragment InputCharacter: ~[\r\n\u0085\u2028\u2029];
fragment NewLineCharacter
: '\u000D' //'<Carriage Return CHARACTER (U+000D)>'
| '\u000A' //'<Line Feed CHARACTER (U+000A)>'
| '\u0085' //'<Next Line CHARACTER (U+0085)>'
| '\u2028' //'<Line Separator CHARACTER (U+2028)>'
| '\u2029' //'<Paragraph Separator CHARACTER (U+2029)>'
;
fragment IntegerTypeSuffix: [lL]? [uU] | [uU]? [lL];
fragment ExponentPart: [eE] ('+' | '-')? [0-9] ('_'* [0-9])*;
fragment CommonCharacter
: SimpleEscapeSequence
| HexEscapeSequence
| UnicodeEscapeSequence
;
fragment SimpleEscapeSequence
: '\\\''
| '\\"'
| '\\\\'
| '\\0'
| '\\a'
| '\\b'
| '\\f'
| '\\n'
| '\\r'
| '\\t'
| '\\v'
;
fragment HexEscapeSequence
: '\\x' HexDigit
| '\\x' HexDigit HexDigit
| '\\x' HexDigit HexDigit HexDigit
| '\\x' HexDigit HexDigit HexDigit HexDigit
;
fragment NewLine
: '\r\n' | '\r' | '\n'
| '\u0085' // <Next Line CHARACTER (U+0085)>'
| '\u2028' //'<Line Separator CHARACTER (U+2028)>'
| '\u2029' //'<Paragraph Separator CHARACTER (U+2029)>'
;
fragment Whitespace
: UnicodeClassZS //'<Any Character With Unicode Class Zs>'
| '\u0009' //'<Horizontal Tab Character (U+0009)>'
| '\u000B' //'<Vertical Tab Character (U+000B)>'
| '\u000C' //'<Form Feed Character (U+000C)>'
;
fragment UnicodeClassZS
: '\u0020' // SPACE
| '\u00A0' // NO_BREAK SPACE
| '\u1680' // OGHAM SPACE MARK
| '\u180E' // MONGOLIAN VOWEL SEPARATOR
| '\u2000' // EN QUAD
| '\u2001' // EM QUAD
| '\u2002' // EN SPACE
| '\u2003' // EM SPACE
| '\u2004' // THREE_PER_EM SPACE
| '\u2005' // FOUR_PER_EM SPACE
| '\u2006' // SIX_PER_EM SPACE
| '\u2008' // PUNCTUATION SPACE
| '\u2009' // THIN SPACE
| '\u200A' // HAIR SPACE
| '\u202F' // NARROW NO_BREAK SPACE
| '\u3000' // IDEOGRAPHIC SPACE
| '\u205F' // MEDIUM MATHEMATICAL SPACE
;
fragment IdentifierOrKeyword
: IdentifierStartCharacter IdentifierPartCharacter*
;
fragment IdentifierStartCharacter
: LetterCharacter
| '_'
;
fragment IdentifierPartCharacter
: LetterCharacter
| DecimalDigitCharacter
| ConnectingCharacter
| CombiningCharacter
| FormattingCharacter
;
//'<A Unicode Character Of Classes Lu, Ll, Lt, Lm, Lo, Or Nl>'
// WARNING: ignores UnicodeEscapeSequence
fragment LetterCharacter
: UnicodeClassLU
| UnicodeClassLL
| UnicodeClassLT
| UnicodeClassLM
| UnicodeClassLO
| UnicodeClassNL
| UnicodeEscapeSequence
;
//'<A Unicode Character Of The Class Nd>'
// WARNING: ignores UnicodeEscapeSequence
fragment DecimalDigitCharacter
: UnicodeClassND
| UnicodeEscapeSequence
;
//'<A Unicode Character Of The Class Pc>'
// WARNING: ignores UnicodeEscapeSequence
fragment ConnectingCharacter
: UnicodeClassPC
| UnicodeEscapeSequence
;
//'<A Unicode Character Of Classes Mn Or Mc>'
// WARNING: ignores UnicodeEscapeSequence
fragment CombiningCharacter
: UnicodeClassMN
| UnicodeClassMC
| UnicodeEscapeSequence
;
//'<A Unicode Character Of The Class Cf>'
// WARNING: ignores UnicodeEscapeSequence
fragment FormattingCharacter
: UnicodeClassCF
| UnicodeEscapeSequence
;
//B.1.5 Unicode Character Escape Sequences
fragment UnicodeEscapeSequence
: '\\u' HexDigit HexDigit HexDigit HexDigit
| '\\U' HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit
;
fragment HexDigit : [0-9] | [A-F] | [a-f];
// Unicode character classes
fragment UnicodeClassLU
: '\u0041'..'\u005a'
| '\u00c0'..'\u00d6'
| '\u00d8'..'\u00de'
| '\u0100'..'\u0136'
| '\u0139'..'\u0147'
| '\u014a'..'\u0178'
| '\u0179'..'\u017d'
| '\u0181'..'\u0182'
| '\u0184'..'\u0186'
| '\u0187'..'\u0189'
| '\u018a'..'\u018b'
| '\u018e'..'\u0191'
| '\u0193'..'\u0194'
| '\u0196'..'\u0198'
| '\u019c'..'\u019d'
| '\u019f'..'\u01a0'
| '\u01a2'..'\u01a6'
| '\u01a7'..'\u01a9'
| '\u01ac'..'\u01ae'
| '\u01af'..'\u01b1'
| '\u01b2'..'\u01b3'
| '\u01b5'..'\u01b7'
| '\u01b8'..'\u01bc'
| '\u01c4'..'\u01cd'
| '\u01cf'..'\u01db'
| '\u01de'..'\u01ee'
| '\u01f1'..'\u01f4'
| '\u01f6'..'\u01f8'
| '\u01fa'..'\u0232'
| '\u023a'..'\u023b'
| '\u023d'..'\u023e'
| '\u0241'..'\u0243'
| '\u0244'..'\u0246'
| '\u0248'..'\u024e'
| '\u0370'..'\u0372'
| '\u0376'..'\u037f'
| '\u0386'..'\u0388'
| '\u0389'..'\u038a'
| '\u038c'..'\u038e'
| '\u038f'..'\u0391'
| '\u0392'..'\u03a1'
| '\u03a3'..'\u03ab'
| '\u03cf'..'\u03d2'
| '\u03d3'..'\u03d4'
| '\u03d8'..'\u03ee'
| '\u03f4'..'\u03f7'
| '\u03f9'..'\u03fa'
| '\u03fd'..'\u042f'
| '\u0460'..'\u0480'
| '\u048a'..'\u04c0'
| '\u04c1'..'\u04cd'
| '\u04d0'..'\u052e'
| '\u0531'..'\u0556'
| '\u10a0'..'\u10c5'
| '\u10c7'..'\u10cd'
| '\u1e00'..'\u1e94'
| '\u1e9e'..'\u1efe'
| '\u1f08'..'\u1f0f'
| '\u1f18'..'\u1f1d'
| '\u1f28'..'\u1f2f'
| '\u1f38'..'\u1f3f'
| '\u1f48'..'\u1f4d'
| '\u1f59'..'\u1f5f'
| '\u1f68'..'\u1f6f'
| '\u1fb8'..'\u1fbb'
| '\u1fc8'..'\u1fcb'
| '\u1fd8'..'\u1fdb'
| '\u1fe8'..'\u1fec'
| '\u1ff8'..'\u1ffb'
| '\u2102'..'\u2107'
| '\u210b'..'\u210d'
| '\u2110'..'\u2112'
| '\u2115'..'\u2119'
| '\u211a'..'\u211d'
| '\u2124'..'\u212a'
| '\u212b'..'\u212d'
| '\u2130'..'\u2133'
| '\u213e'..'\u213f'
| '\u2145'..'\u2183'
| '\u2c00'..'\u2c2e'
| '\u2c60'..'\u2c62'
| '\u2c63'..'\u2c64'
| '\u2c67'..'\u2c6d'
| '\u2c6e'..'\u2c70'
| '\u2c72'..'\u2c75'
| '\u2c7e'..'\u2c80'
| '\u2c82'..'\u2ce2'
| '\u2ceb'..'\u2ced'
| '\u2cf2'..'\ua640'
| '\ua642'..'\ua66c'
| '\ua680'..'\ua69a'
| '\ua722'..'\ua72e'
| '\ua732'..'\ua76e'
| '\ua779'..'\ua77d'
| '\ua77e'..'\ua786'
| '\ua78b'..'\ua78d'
| '\ua790'..'\ua792'
| '\ua796'..'\ua7aa'
| '\ua7ab'..'\ua7ad'
| '\ua7b0'..'\ua7b1'
| '\uff21'..'\uff3a'
;
fragment UnicodeClassLL
: '\u0061'..'\u007A'
| '\u00b5'..'\u00df'
| '\u00e0'..'\u00f6'
| '\u00f8'..'\u00ff'
| '\u0101'..'\u0137'
| '\u0138'..'\u0148'
| '\u0149'..'\u0177'
| '\u017a'..'\u017e'
| '\u017f'..'\u0180'
| '\u0183'..'\u0185'
| '\u0188'..'\u018c'
| '\u018d'..'\u0192'
| '\u0195'..'\u0199'
| '\u019a'..'\u019b'
| '\u019e'..'\u01a1'
| '\u01a3'..'\u01a5'
| '\u01a8'..'\u01aa'
| '\u01ab'..'\u01ad'
| '\u01b0'..'\u01b4'
| '\u01b6'..'\u01b9'
| '\u01ba'..'\u01bd'
| '\u01be'..'\u01bf'
| '\u01c6'..'\u01cc'
| '\u01ce'..'\u01dc'
| '\u01dd'..'\u01ef'
| '\u01f0'..'\u01f3'
| '\u01f5'..'\u01f9'
| '\u01fb'..'\u0233'
| '\u0234'..'\u0239'
| '\u023c'..'\u023f'
| '\u0240'..'\u0242'
| '\u0247'..'\u024f'
| '\u0250'..'\u0293'
| '\u0295'..'\u02af'
| '\u0371'..'\u0373'
| '\u0377'..'\u037b'
| '\u037c'..'\u037d'
| '\u0390'..'\u03ac'
| '\u03ad'..'\u03ce'
| '\u03d0'..'\u03d1'
| '\u03d5'..'\u03d7'
| '\u03d9'..'\u03ef'
| '\u03f0'..'\u03f3'
| '\u03f5'..'\u03fb'
| '\u03fc'..'\u0430'
| '\u0431'..'\u045f'
| '\u0461'..'\u0481'
| '\u048b'..'\u04bf'
| '\u04c2'..'\u04ce'
| '\u04cf'..'\u052f'
| '\u0561'..'\u0587'
| '\u1d00'..'\u1d2b'
| '\u1d6b'..'\u1d77'
| '\u1d79'..'\u1d9a'
| '\u1e01'..'\u1e95'
| '\u1e96'..'\u1e9d'
| '\u1e9f'..'\u1eff'
| '\u1f00'..'\u1f07'
| '\u1f10'..'\u1f15'
| '\u1f20'..'\u1f27'
| '\u1f30'..'\u1f37'
| '\u1f40'..'\u1f45'
| '\u1f50'..'\u1f57'
| '\u1f60'..'\u1f67'
| '\u1f70'..'\u1f7d'
| '\u1f80'..'\u1f87'
| '\u1f90'..'\u1f97'
| '\u1fa0'..'\u1fa7'
| '\u1fb0'..'\u1fb4'
| '\u1fb6'..'\u1fb7'
| '\u1fbe'..'\u1fc2'
| '\u1fc3'..'\u1fc4'
| '\u1fc6'..'\u1fc7'
| '\u1fd0'..'\u1fd3'
| '\u1fd6'..'\u1fd7'
| '\u1fe0'..'\u1fe7'
| '\u1ff2'..'\u1ff4'
| '\u1ff6'..'\u1ff7'
| '\u210a'..'\u210e'
| '\u210f'..'\u2113'
| '\u212f'..'\u2139'
| '\u213c'..'\u213d'
| '\u2146'..'\u2149'
| '\u214e'..'\u2184'
| '\u2c30'..'\u2c5e'
| '\u2c61'..'\u2c65'
| '\u2c66'..'\u2c6c'
| '\u2c71'..'\u2c73'
| '\u2c74'..'\u2c76'
| '\u2c77'..'\u2c7b'
| '\u2c81'..'\u2ce3'
| '\u2ce4'..'\u2cec'
| '\u2cee'..'\u2cf3'
| '\u2d00'..'\u2d25'
| '\u2d27'..'\u2d2d'
| '\ua641'..'\ua66d'
| '\ua681'..'\ua69b'
| '\ua723'..'\ua72f'
| '\ua730'..'\ua731'
| '\ua733'..'\ua771'
| '\ua772'..'\ua778'
| '\ua77a'..'\ua77c'
| '\ua77f'..'\ua787'
| '\ua78c'..'\ua78e'
| '\ua791'..'\ua793'
| '\ua794'..'\ua795'
| '\ua797'..'\ua7a9'
| '\ua7fa'..'\uab30'
| '\uab31'..'\uab5a'
| '\uab64'..'\uab65'
| '\ufb00'..'\ufb06'
| '\ufb13'..'\ufb17'
| '\uff41'..'\uff5a'
;
fragment UnicodeClassLT
: '\u01c5'..'\u01cb'
| '\u01f2'..'\u1f88'
| '\u1f89'..'\u1f8f'
| '\u1f98'..'\u1f9f'
| '\u1fa8'..'\u1faf'
| '\u1fbc'..'\u1fcc'
| '\u1ffc'..'\u1ffc'
;
fragment UnicodeClassLM
: '\u02b0'..'\u02c1'
| '\u02c6'..'\u02d1'
| '\u02e0'..'\u02e4'
| '\u02ec'..'\u02ee'
| '\u0374'..'\u037a'
| '\u0559'..'\u0640'
| '\u06e5'..'\u06e6'
| '\u07f4'..'\u07f5'
| '\u07fa'..'\u081a'
| '\u0824'..'\u0828'
| '\u0971'..'\u0e46'
| '\u0ec6'..'\u10fc'
| '\u17d7'..'\u1843'
| '\u1aa7'..'\u1c78'
| '\u1c79'..'\u1c7d'
| '\u1d2c'..'\u1d6a'
| '\u1d78'..'\u1d9b'
| '\u1d9c'..'\u1dbf'
| '\u2071'..'\u207f'
| '\u2090'..'\u209c'
| '\u2c7c'..'\u2c7d'
| '\u2d6f'..'\u2e2f'
| '\u3005'..'\u3031'
| '\u3032'..'\u3035'
| '\u303b'..'\u309d'
| '\u309e'..'\u30fc'
| '\u30fd'..'\u30fe'
| '\ua015'..'\ua4f8'
| '\ua4f9'..'\ua4fd'
| '\ua60c'..'\ua67f'
| '\ua69c'..'\ua69d'
| '\ua717'..'\ua71f'
| '\ua770'..'\ua788'
| '\ua7f8'..'\ua7f9'
| '\ua9cf'..'\ua9e6'
| '\uaa70'..'\uaadd'
| '\uaaf3'..'\uaaf4'
| '\uab5c'..'\uab5f'
| '\uff70'..'\uff9e'
| '\uff9f'..'\uff9f'
;
fragment UnicodeClassLO
: '\u00aa'..'\u00ba'
| '\u01bb'..'\u01c0'
| '\u01c1'..'\u01c3'
| '\u0294'..'\u05d0'
| '\u05d1'..'\u05ea'
| '\u05f0'..'\u05f2'
| '\u0620'..'\u063f'
| '\u0641'..'\u064a'
| '\u066e'..'\u066f'
| '\u0671'..'\u06d3'
| '\u06d5'..'\u06ee'
| '\u06ef'..'\u06fa'
| '\u06fb'..'\u06fc'
| '\u06ff'..'\u0710'
| '\u0712'..'\u072f'
| '\u074d'..'\u07a5'
| '\u07b1'..'\u07ca'
| '\u07cb'..'\u07ea'
| '\u0800'..'\u0815'
| '\u0840'..'\u0858'
| '\u08a0'..'\u08b2'
| '\u0904'..'\u0939'
| '\u093d'..'\u0950'
| '\u0958'..'\u0961'
| '\u0972'..'\u0980'
| '\u0985'..'\u098c'
| '\u098f'..'\u0990'
| '\u0993'..'\u09a8'
| '\u09aa'..'\u09b0'
| '\u09b2'..'\u09b6'
| '\u09b7'..'\u09b9'
| '\u09bd'..'\u09ce'
| '\u09dc'..'\u09dd'
| '\u09df'..'\u09e1'
| '\u09f0'..'\u09f1'
| '\u0a05'..'\u0a0a'
| '\u0a0f'..'\u0a10'
| '\u0a13'..'\u0a28'
| '\u0a2a'..'\u0a30'
| '\u0a32'..'\u0a33'
| '\u0a35'..'\u0a36'
| '\u0a38'..'\u0a39'
| '\u0a59'..'\u0a5c'
| '\u0a5e'..'\u0a72'
| '\u0a73'..'\u0a74'
| '\u0a85'..'\u0a8d'
| '\u0a8f'..'\u0a91'
| '\u0a93'..'\u0aa8'
| '\u0aaa'..'\u0ab0'
| '\u0ab2'..'\u0ab3'
| '\u0ab5'..'\u0ab9'
| '\u0abd'..'\u0ad0'
| '\u0ae0'..'\u0ae1'
| '\u0b05'..'\u0b0c'
| '\u0b0f'..'\u0b10'
| '\u0b13'..'\u0b28'
| '\u0b2a'..'\u0b30'
| '\u0b32'..'\u0b33'
| '\u0b35'..'\u0b39'
| '\u0b3d'..'\u0b5c'
| '\u0b5d'..'\u0b5f'
| '\u0b60'..'\u0b61'
| '\u0b71'..'\u0b83'
| '\u0b85'..'\u0b8a'
| '\u0b8e'..'\u0b90'
| '\u0b92'..'\u0b95'
| '\u0b99'..'\u0b9a'
| '\u0b9c'..'\u0b9e'
| '\u0b9f'..'\u0ba3'
| '\u0ba4'..'\u0ba8'
| '\u0ba9'..'\u0baa'
| '\u0bae'..'\u0bb9'
| '\u0bd0'..'\u0c05'
| '\u0c06'..'\u0c0c'
| '\u0c0e'..'\u0c10'
| '\u0c12'..'\u0c28'
| '\u0c2a'..'\u0c39'
| '\u0c3d'..'\u0c58'
| '\u0c59'..'\u0c60'
| '\u0c61'..'\u0c85'
| '\u0c86'..'\u0c8c'
| '\u0c8e'..'\u0c90'
| '\u0c92'..'\u0ca8'
| '\u0caa'..'\u0cb3'
| '\u0cb5'..'\u0cb9'
| '\u0cbd'..'\u0cde'
| '\u0ce0'..'\u0ce1'
| '\u0cf1'..'\u0cf2'
| '\u0d05'..'\u0d0c'
| '\u0d0e'..'\u0d10'
| '\u0d12'..'\u0d3a'
| '\u0d3d'..'\u0d4e'
| '\u0d60'..'\u0d61'
| '\u0d7a'..'\u0d7f'
| '\u0d85'..'\u0d96'
| '\u0d9a'..'\u0db1'
| '\u0db3'..'\u0dbb'
| '\u0dbd'..'\u0dc0'
| '\u0dc1'..'\u0dc6'
| '\u0e01'..'\u0e30'
| '\u0e32'..'\u0e33'
| '\u0e40'..'\u0e45'
| '\u0e81'..'\u0e82'
| '\u0e84'..'\u0e87'
| '\u0e88'..'\u0e8a'
| '\u0e8d'..'\u0e94'
| '\u0e95'..'\u0e97'
| '\u0e99'..'\u0e9f'
| '\u0ea1'..'\u0ea3'
| '\u0ea5'..'\u0ea7'
| '\u0eaa'..'\u0eab'
| '\u0ead'..'\u0eb0'
| '\u0eb2'..'\u0eb3'
| '\u0ebd'..'\u0ec0'
| '\u0ec1'..'\u0ec4'
| '\u0edc'..'\u0edf'
| '\u0f00'..'\u0f40'
| '\u0f41'..'\u0f47'
| '\u0f49'..'\u0f6c'
| '\u0f88'..'\u0f8c'
| '\u1000'..'\u102a'
| '\u103f'..'\u1050'
| '\u1051'..'\u1055'
| '\u105a'..'\u105d'
| '\u1061'..'\u1065'
| '\u1066'..'\u106e'
| '\u106f'..'\u1070'
| '\u1075'..'\u1081'
| '\u108e'..'\u10d0'
| '\u10d1'..'\u10fa'
| '\u10fd'..'\u1248'
| '\u124a'..'\u124d'
| '\u1250'..'\u1256'
| '\u1258'..'\u125a'
| '\u125b'..'\u125d'
| '\u1260'..'\u1288'
| '\u128a'..'\u128d'
| '\u1290'..'\u12b0'
| '\u12b2'..'\u12b5'
| '\u12b8'..'\u12be'
| '\u12c0'..'\u12c2'
| '\u12c3'..'\u12c5'
| '\u12c8'..'\u12d6'
| '\u12d8'..'\u1310'
| '\u1312'..'\u1315'
| '\u1318'..'\u135a'
| '\u1380'..'\u138f'
| '\u13a0'..'\u13f4'
| '\u1401'..'\u166c'
| '\u166f'..'\u167f'
| '\u1681'..'\u169a'
| '\u16a0'..'\u16ea'
| '\u16f1'..'\u16f8'
| '\u1700'..'\u170c'
| '\u170e'..'\u1711'
| '\u1720'..'\u1731'
| '\u1740'..'\u1751'
| '\u1760'..'\u176c'
| '\u176e'..'\u1770'
| '\u1780'..'\u17b3'
| '\u17dc'..'\u1820'
| '\u1821'..'\u1842'
| '\u1844'..'\u1877'
| '\u1880'..'\u18a8'
| '\u18aa'..'\u18b0'
| '\u18b1'..'\u18f5'
| '\u1900'..'\u191e'
| '\u1950'..'\u196d'
| '\u1970'..'\u1974'
| '\u1980'..'\u19ab'
| '\u19c1'..'\u19c7'
| '\u1a00'..'\u1a16'
| '\u1a20'..'\u1a54'
| '\u1b05'..'\u1b33'
| '\u1b45'..'\u1b4b'
| '\u1b83'..'\u1ba0'
| '\u1bae'..'\u1baf'
| '\u1bba'..'\u1be5'
| '\u1c00'..'\u1c23'
| '\u1c4d'..'\u1c4f'
| '\u1c5a'..'\u1c77'
| '\u1ce9'..'\u1cec'
| '\u1cee'..'\u1cf1'
| '\u1cf5'..'\u1cf6'
| '\u2135'..'\u2138'
| '\u2d30'..'\u2d67'
| '\u2d80'..'\u2d96'
| '\u2da0'..'\u2da6'
| '\u2da8'..'\u2dae'
| '\u2db0'..'\u2db6'
| '\u2db8'..'\u2dbe'
| '\u2dc0'..'\u2dc6'
| '\u2dc8'..'\u2dce'
| '\u2dd0'..'\u2dd6'
| '\u2dd8'..'\u2dde'
| '\u3006'..'\u303c'
| '\u3041'..'\u3096'
| '\u309f'..'\u30a1'
| '\u30a2'..'\u30fa'
| '\u30ff'..'\u3105'
| '\u3106'..'\u312d'
| '\u3131'..'\u318e'
| '\u31a0'..'\u31ba'
| '\u31f0'..'\u31ff'
| '\u3400'..'\u4db5'
| '\u4e00'..'\u9fcc'
| '\ua000'..'\ua014'
| '\ua016'..'\ua48c'
| '\ua4d0'..'\ua4f7'
| '\ua500'..'\ua60b'
| '\ua610'..'\ua61f'
| '\ua62a'..'\ua62b'
| '\ua66e'..'\ua6a0'
| '\ua6a1'..'\ua6e5'
| '\ua7f7'..'\ua7fb'
| '\ua7fc'..'\ua801'
| '\ua803'..'\ua805'
| '\ua807'..'\ua80a'
| '\ua80c'..'\ua822'
| '\ua840'..'\ua873'
| '\ua882'..'\ua8b3'
| '\ua8f2'..'\ua8f7'
| '\ua8fb'..'\ua90a'
| '\ua90b'..'\ua925'
| '\ua930'..'\ua946'
| '\ua960'..'\ua97c'
| '\ua984'..'\ua9b2'
| '\ua9e0'..'\ua9e4'
| '\ua9e7'..'\ua9ef'
| '\ua9fa'..'\ua9fe'
| '\uaa00'..'\uaa28'
| '\uaa40'..'\uaa42'
| '\uaa44'..'\uaa4b'
| '\uaa60'..'\uaa6f'
| '\uaa71'..'\uaa76'
| '\uaa7a'..'\uaa7e'
| '\uaa7f'..'\uaaaf'
| '\uaab1'..'\uaab5'
| '\uaab6'..'\uaab9'
| '\uaaba'..'\uaabd'
| '\uaac0'..'\uaac2'
| '\uaadb'..'\uaadc'
| '\uaae0'..'\uaaea'
| '\uaaf2'..'\uab01'
| '\uab02'..'\uab06'
| '\uab09'..'\uab0e'
| '\uab11'..'\uab16'
| '\uab20'..'\uab26'
| '\uab28'..'\uab2e'
| '\uabc0'..'\uabe2'
| '\uac00'..'\ud7a3'
| '\ud7b0'..'\ud7c6'
| '\ud7cb'..'\ud7fb'
| '\uf900'..'\ufa6d'
| '\ufa70'..'\ufad9'
| '\ufb1d'..'\ufb1f'
| '\ufb20'..'\ufb28'
| '\ufb2a'..'\ufb36'
| '\ufb38'..'\ufb3c'
| '\ufb3e'..'\ufb40'
| '\ufb41'..'\ufb43'
| '\ufb44'..'\ufb46'
| '\ufb47'..'\ufbb1'
| '\ufbd3'..'\ufd3d'
| '\ufd50'..'\ufd8f'
| '\ufd92'..'\ufdc7'
| '\ufdf0'..'\ufdfb'
| '\ufe70'..'\ufe74'
| '\ufe76'..'\ufefc'
| '\uff66'..'\uff6f'
| '\uff71'..'\uff9d'
| '\uffa0'..'\uffbe'
| '\uffc2'..'\uffc7'
| '\uffca'..'\uffcf'
| '\uffd2'..'\uffd7'
| '\uffda'..'\uffdc'
;
fragment UnicodeClassNL
: '\u16EE' // RUNIC ARLAUG SYMBOL
| '\u16EF' // RUNIC TVIMADUR SYMBOL
| '\u16F0' // RUNIC BELGTHOR SYMBOL
| '\u2160' // ROMAN NUMERAL ONE
| '\u2161' // ROMAN NUMERAL TWO
| '\u2162' // ROMAN NUMERAL THREE
| '\u2163' // ROMAN NUMERAL FOUR
| '\u2164' // ROMAN NUMERAL FIVE
| '\u2165' // ROMAN NUMERAL SIX
| '\u2166' // ROMAN NUMERAL SEVEN
| '\u2167' // ROMAN NUMERAL EIGHT
| '\u2168' // ROMAN NUMERAL NINE
| '\u2169' // ROMAN NUMERAL TEN
| '\u216A' // ROMAN NUMERAL ELEVEN
| '\u216B' // ROMAN NUMERAL TWELVE
| '\u216C' // ROMAN NUMERAL FIFTY
| '\u216D' // ROMAN NUMERAL ONE HUNDRED
| '\u216E' // ROMAN NUMERAL FIVE HUNDRED
| '\u216F' // ROMAN NUMERAL ONE THOUSAND
;
fragment UnicodeClassMN
: '\u0300' // COMBINING GRAVE ACCENT
| '\u0301' // COMBINING ACUTE ACCENT
| '\u0302' // COMBINING CIRCUMFLEX ACCENT
| '\u0303' // COMBINING TILDE
| '\u0304' // COMBINING MACRON
| '\u0305' // COMBINING OVERLINE
| '\u0306' // COMBINING BREVE
| '\u0307' // COMBINING DOT ABOVE
| '\u0308' // COMBINING DIAERESIS
| '\u0309' // COMBINING HOOK ABOVE
| '\u030A' // COMBINING RING ABOVE
| '\u030B' // COMBINING DOUBLE ACUTE ACCENT
| '\u030C' // COMBINING CARON
| '\u030D' // COMBINING VERTICAL LINE ABOVE
| '\u030E' // COMBINING DOUBLE VERTICAL LINE ABOVE
| '\u030F' // COMBINING DOUBLE GRAVE ACCENT
| '\u0310' // COMBINING CANDRABINDU
;
fragment UnicodeClassMC
: '\u0903' // DEVANAGARI SIGN VISARGA
| '\u093E' // DEVANAGARI VOWEL SIGN AA
| '\u093F' // DEVANAGARI VOWEL SIGN I
| '\u0940' // DEVANAGARI VOWEL SIGN II
| '\u0949' // DEVANAGARI VOWEL SIGN CANDRA O
| '\u094A' // DEVANAGARI VOWEL SIGN SHORT O
| '\u094B' // DEVANAGARI VOWEL SIGN O
| '\u094C' // DEVANAGARI VOWEL SIGN AU
;
fragment UnicodeClassCF
: '\u00AD' // SOFT HYPHEN
| '\u0600' // ARABIC NUMBER SIGN
| '\u0601' // ARABIC SIGN SANAH
| '\u0602' // ARABIC FOOTNOTE MARKER
| '\u0603' // ARABIC SIGN SAFHA
| '\u06DD' // ARABIC END OF AYAH
;
fragment UnicodeClassPC
: '\u005F' // LOW LINE
| '\u203F' // UNDERTIE
| '\u2040' // CHARACTER TIE
| '\u2054' // INVERTED UNDERTIE
| '\uFE33' // PRESENTATION FORM FOR VERTICAL LOW LINE
| '\uFE34' // PRESENTATION FORM FOR VERTICAL WAVY LOW LINE
| '\uFE4D' // DASHED LOW LINE
| '\uFE4E' // CENTRELINE LOW LINE
| '\uFE4F' // WAVY LOW LINE
| '\uFF3F' // FULLWIDTH LOW LINE
;
fragment UnicodeClassND
: '\u0030'..'\u0039'
| '\u0660'..'\u0669'
| '\u06f0'..'\u06f9'
| '\u07c0'..'\u07c9'
| '\u0966'..'\u096f'
| '\u09e6'..'\u09ef'
| '\u0a66'..'\u0a6f'
| '\u0ae6'..'\u0aef'
| '\u0b66'..'\u0b6f'
| '\u0be6'..'\u0bef'
| '\u0c66'..'\u0c6f'
| '\u0ce6'..'\u0cef'
| '\u0d66'..'\u0d6f'
| '\u0de6'..'\u0def'
| '\u0e50'..'\u0e59'
| '\u0ed0'..'\u0ed9'
| '\u0f20'..'\u0f29'
| '\u1040'..'\u1049'
| '\u1090'..'\u1099'
| '\u17e0'..'\u17e9'
| '\u1810'..'\u1819'
| '\u1946'..'\u194f'
| '\u19d0'..'\u19d9'
| '\u1a80'..'\u1a89'
| '\u1a90'..'\u1a99'
| '\u1b50'..'\u1b59'
| '\u1bb0'..'\u1bb9'
| '\u1c40'..'\u1c49'
| '\u1c50'..'\u1c59'
| '\ua620'..'\ua629'
| '\ua8d0'..'\ua8d9'
| '\ua900'..'\ua909'
| '\ua9d0'..'\ua9d9'
| '\ua9f0'..'\ua9f9'
| '\uaa50'..'\uaa59'
| '\uabf0'..'\uabf9'
| '\uff10'..'\uff19'
; |
orka/src/orka/interface/orka-futures-slots.ads | onox/orka | 52 | 7645 | <filename>orka/src/orka/interface/orka-futures-slots.ads
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2018 onox <<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.
generic
Count : Positive;
package Orka.Futures.Slots is
subtype Slot_Index is Positive range 1 .. Count;
subtype Future_Handle is Slot_Index;
subtype Location_Index is Slot_Index;
-----------------------------------------------------------------------------
type Handle_Array is array (Location_Index) of Future_Handle;
function Make_Handles return Handle_Array;
protected Manager is
procedure Acquire_Or_Fail (Slot : out Future_Access)
with Post => Slot.Current_Status = Waiting;
entry Acquire (Slot : out Future_Access)
with Post => Slot.Current_Status = Waiting;
procedure Release (Slot : not null Future_Access);
procedure Shutdown;
function Acquired_Slots return Natural;
function Stopping return Boolean;
private
Handles : Handle_Array := Make_Handles;
-- An array containing a contiguous number of handles pointing to
-- acquired Future_Object objects in the Future_Slots variable and
-- then followed by a contiguous number of handles pointing to
-- released Future_Object objects.
--
-- For example:
--
-- 1 3 4 | 2 5
-- ----- ---
-- acquired released
--
-- To acquire a slot, we simply move the '|' between the two arrays
-- to the right and return the Future_Object object to which the
-- new handle is pointing. In the example we return
-- Future_Slots (2)'Access.
--
-- To release a slot, we lookup the location (which is stored in the
-- Future_Object object itself) of its handle and then swap the
-- handle with the handle at the end of the array of acquired slots.
-- Finally, we move the '|' to the left.
--
-- For example, given the above array, releasing slot 1 results in:
--
-- 4 3 | 1 2 5
-- --- -----
-- acquired released
--
-- The two Future_Object objects of which their handles were
-- swapped (slots 1 and 4) are updated to point to the new location
-- containing their handle.
Acquired : Natural := 0;
-- Represents the '|' barrier between the acquired slots and
-- released slots
Should_Stop : Boolean := False;
end Manager;
private
protected type Future_Object is new Futures.Promise and Futures.Releasable_Future with
overriding
function Current_Status return Futures.Status;
overriding
procedure Set_Status (Value : Futures.Non_Failed_Status);
overriding
procedure Set_Failed (Reason : Ada.Exceptions.Exception_Occurrence);
overriding
entry Wait_Until_Done (Value : out Futures.Status);
function Handle_Location return Location_Index;
procedure Reset_And_Set_Location (Value : Location_Index);
procedure Set_Location (Value : Location_Index);
private
Status : Futures.Status := Futures.Waiting;
Location : Location_Index := 1;
Occurrence : Ada.Exceptions.Exception_Occurrence;
end Future_Object;
overriding
procedure Release (Object : Future_Object; Slot : not null Future_Access);
-- Ask the manager to release the slot
--
-- This procedure needs to be unsynchronized because Manager may call
-- synchronized subprograms of Future_Object (which would result in a
-- dead lock).
type Future_Array is array (Future_Handle) of aliased Future_Object;
function Make_Futures return Future_Array;
type Future_Object_Access is access all Future_Object;
end Orka.Futures.Slots;
|
source/league/ucd/matreshka-internals-unicode-ucd-core_001c.ads | svn2github/matreshka | 24 | 109 | <gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2015, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
pragma Restrictions (No_Elaboration_Code);
-- GNAT: enforce generation of preinitialized data section instead of
-- generation of elaboration code.
package Matreshka.Internals.Unicode.Ucd.Core_001C is
pragma Preelaborate;
Group_001C : aliased constant Core_Second_Stage
:= (16#00# .. 16#23# => -- 1C00 .. 1C23
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#24# .. 16#2B# => -- 1C24 .. 1C2B
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#2C# .. 16#33# => -- 1C2C .. 1C33
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#34# .. 16#35# => -- 1C34 .. 1C35
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#36# => -- 1C36
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Extender
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#37# => -- 1C37
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#3B# .. 16#3C# => -- 1C3B .. 1C3C
(Other_Punctuation, Neutral,
Other, Other, S_Term, Break_After,
(STerm
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#3D# .. 16#3F# => -- 1C3D .. 1C3F
(Other_Punctuation, Neutral,
Other, Other, Other, Break_After,
(Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#40# .. 16#49# => -- 1C40 .. 1C49
(Decimal_Number, Neutral,
Other, Numeric, Numeric, Numeric,
(Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#4D# .. 16#4F# => -- 1C4D .. 1C4F
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#50# .. 16#59# => -- 1C50 .. 1C59
(Decimal_Number, Neutral,
Other, Numeric, Numeric, Numeric,
(Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#5A# .. 16#77# => -- 1C5A .. 1C77
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#78# .. 16#7A# => -- 1C78 .. 1C7A
(Modifier_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Diacritic
| Alphabetic
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#7B# => -- 1C7B
(Modifier_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Diacritic
| Extender
| Alphabetic
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#7C# .. 16#7D# => -- 1C7C .. 1C7D
(Modifier_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Diacritic
| Alphabetic
| Case_Ignorable
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#7E# .. 16#7F# => -- 1C7E .. 1C7F
(Other_Punctuation, Neutral,
Other, Other, S_Term, Break_After,
(STerm
| Terminal_Punctuation
| Grapheme_Base => True,
others => False)),
16#C0# .. 16#C7# => -- 1CC0 .. 1CC7
(Other_Punctuation, Neutral,
Other, Other, Other, Alphabetic,
(Grapheme_Base => True,
others => False)),
16#D0# .. 16#D2# => -- 1CD0 .. 1CD2
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#D3# => -- 1CD3
(Other_Punctuation, Neutral,
Other, Other, Other, Alphabetic,
(Diacritic
| Grapheme_Base => True,
others => False)),
16#D4# .. 16#E0# => -- 1CD4 .. 1CE0
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#E1# => -- 1CE1
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Diacritic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#E2# .. 16#E8# => -- 1CE2 .. 1CE8
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#E9# .. 16#EC# => -- 1CE9 .. 1CEC
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#ED# => -- 1CED
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#EE# .. 16#F1# => -- 1CEE .. 1CF1
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#F2# .. 16#F3# => -- 1CF2 .. 1CF3
(Spacing_Mark, Neutral,
Spacing_Mark, Extend, Extend, Combining_Mark,
(Other_Alphabetic
| Alphabetic
| Grapheme_Base
| ID_Continue
| XID_Continue => True,
others => False)),
16#F4# => -- 1CF4
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
16#F5# .. 16#F6# => -- 1CF5 .. 1CF6
(Other_Letter, Neutral,
Other, A_Letter, O_Letter, Alphabetic,
(Alphabetic
| Grapheme_Base
| ID_Continue
| ID_Start
| XID_Continue
| XID_Start => True,
others => False)),
16#F8# .. 16#F9# => -- 1CF8 .. 1CF9
(Nonspacing_Mark, Neutral,
Extend, Extend, Extend, Combining_Mark,
(Diacritic
| Case_Ignorable
| Grapheme_Extend
| ID_Continue
| XID_Continue => True,
others => False)),
others =>
(Unassigned, Neutral,
Other, Other, Other, Unknown,
(others => False)));
end Matreshka.Internals.Unicode.Ucd.Core_001C;
|
Transynther/x86/_processed/NC/_zr_/i7-8650U_0xd2.log_21829_418.asm | ljhsiun2/medusa | 9 | 83304 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x17a6e, %rdx
nop
nop
nop
sub $46435, %r13
mov $0x6162636465666768, %r9
movq %r9, %xmm6
and $0xffffffffffffffc0, %rdx
vmovntdq %ymm6, (%rdx)
nop
nop
nop
nop
inc %r13
lea addresses_A_ht+0xcd96, %rsi
lea addresses_A_ht+0x14f16, %rdi
xor $37373, %r11
mov $86, %rcx
rep movsw
nop
nop
nop
nop
add $42139, %r11
lea addresses_normal_ht+0xe296, %rsi
lea addresses_WT_ht+0x77be, %rdi
nop
nop
nop
nop
dec %r14
mov $12, %rcx
rep movsw
nop
and %rsi, %rsi
lea addresses_D_ht+0x11e31, %r14
nop
nop
xor %rsi, %rsi
mov $0x6162636465666768, %rdx
movq %rdx, (%r14)
nop
nop
nop
nop
nop
xor %r14, %r14
lea addresses_WT_ht+0x10a96, %rsi
lea addresses_WT_ht+0x7096, %rdi
nop
nop
nop
nop
sub %rdx, %rdx
mov $84, %rcx
rep movsl
nop
nop
nop
cmp $64487, %r13
lea addresses_WT_ht+0x5876, %r13
nop
nop
nop
nop
nop
sub $62156, %rdx
mov $0x6162636465666768, %r9
movq %r9, %xmm2
vmovups %ymm2, (%r13)
nop
cmp $35176, %rdx
lea addresses_WC_ht+0xd1a3, %r9
nop
dec %rdi
mov (%r9), %dx
nop
nop
nop
nop
nop
sub $42785, %rcx
lea addresses_UC_ht+0x1871c, %r13
clflush (%r13)
sub $40841, %rdi
movl $0x61626364, (%r13)
nop
nop
nop
nop
and $54981, %rdx
lea addresses_WC_ht+0x1eef6, %rdi
and %r11, %r11
mov $0x6162636465666768, %rcx
movq %rcx, %xmm1
vmovups %ymm1, (%rdi)
nop
nop
nop
nop
and $15134, %r9
lea addresses_WT_ht+0x136d6, %rsi
clflush (%rsi)
nop
nop
nop
nop
nop
and %r11, %r11
vmovups (%rsi), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %rcx
nop
nop
nop
sub %r9, %r9
lea addresses_WC_ht+0x6a3e, %rsi
nop
nop
xor $63928, %rcx
movb (%rsi), %dl
and $32992, %r13
lea addresses_D_ht+0x1b896, %rsi
lea addresses_WC_ht+0x11296, %rdi
clflush (%rsi)
nop
nop
nop
xor %r13, %r13
mov $74, %rcx
rep movsq
xor $30361, %rdi
lea addresses_WT_ht+0x9916, %rsi
lea addresses_A_ht+0xfe16, %rdi
nop
nop
and %r9, %r9
mov $36, %rcx
rep movsw
nop
nop
nop
nop
nop
sub $45515, %r9
lea addresses_UC_ht+0x10296, %r11
clflush (%r11)
nop
nop
nop
nop
cmp $33777, %rsi
vmovups (%r11), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $1, %xmm3, %rdi
nop
nop
nop
nop
cmp %r13, %r13
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_normal+0xe3d6, %rcx
nop
nop
nop
add $30977, %rsi
movw $0x5152, (%rcx)
nop
nop
nop
nop
nop
xor $30128, %rdx
// Store
lea addresses_D+0x4e92, %r9
nop
nop
nop
nop
nop
add $21320, %r12
movw $0x5152, (%r9)
nop
nop
nop
nop
nop
inc %rdi
// Faulty Load
mov $0x4fb7d30000000a96, %rdx
nop
nop
nop
nop
nop
xor %rdi, %rdi
mov (%rdx), %r9w
lea oracles, %r11
and $0xff, %r9
shlq $12, %r9
mov (%r11,%r9,1), %r9
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
src/main/antlr4/be/uclouvain/gdbmiapi/MIOutput.g4 | chenoya/software-analysis-plasma-plugins | 0 | 2825 | grammar MIOutput;
output: out_of_band_record* result_record? out_of_band_record* '(gdb)' ' '? NL;
result_record: (Token_)? '^' result_class ( ',' result )* NL;
out_of_band_record: async_record | stream_record;
async_record: exec_async_output | status_async_output | notify_async_output;
exec_async_output: Token_? '*' async_output NL;
status_async_output: Token_? '+' async_output NL;
notify_async_output: Token_? '=' async_output NL;
async_output: async_class ( ',' result )*;
result_class: DONE | RUNNING | CONNECTED | ERROR | EXIT;
//Async_class: 'stopped'; //| others
async_class: String | result_class;
result: variable '=' value;
variable: String;
value: const_ | tuple | list;
const_: C_string;
tuple: '{}' | '{' result ( ',' result )* '}';
list: '[]' | '[' value ( ',' value )* ']' | '[' result ( ',' result )* ']';
stream_record: console_stream_output | target_stream_output | log_stream_output;
console_stream_output: '~' C_string NL;
target_stream_output: '@' C_string NL;
log_stream_output: '&' C_string NL;
DONE: 'done';
RUNNING: 'running';
CONNECTED: 'connected';
ERROR: 'error';
EXIT: 'exit';
NL: '\n' | '\r\n';
Token_: ('0' .. '9')+;
String: ('a' .. 'z' | '-')+;
C_string: '"' ( EscapeSeq | ~["\r\n\\] )* '"';
EscapeSeq: '\\' ('\'' |'"'| '?'| 'a' |'b' |'f'| 'n'| 'r'| 't'| 'v'| '\\');
|
in.asm | HmanA6399/PDP11-Assembler | 0 | 14955 | ; this code doesn’t do anything significant, it is just an example
MOV N, R0 ; R0 = 7 address 0
XOR R1, R1 ; R1 = 0 address 2
MOV #20, R3 ; R3 = 20 address 3
; memory is word addressable, so there isno
; problem in having odd addresses, why?
Label3: ; address 5
MOV -(R3), M ; M = 5 , R3= 19 address 5
DEC R0 ; R0 = 6 address 7
CMP #18, @R3 ; C=1,N=1 address 8
BHI Label1 ; Not taken address 10
MOV #18,@R3 ; M=18 address 11
Label1: ; address 13
DEC R0 ; R0=5 address 13
BEQ Label2 ; not taken address 14
INC R3 ; R3=20 address 15
Label2: ; address 16
BR Label3 ; address 16
HLT ; address 17
Define N 7 ; address 18
Define M 5 ; address 19 |
programs/oeis/289/A289945.asm | neoneye/loda | 22 | 5002 | ; A289945: a(n) = Sum_{k=1..n} k!^4.
; 1,17,1313,333089,207693089,268946253089,645510228813089,2643553803594573089,17342764866576345933089,173418555892594089945933089,2538940579958951120707545933089,52646414799433780559063261145933089
add $0,2
lpb $0
mov $2,$0
max $0,3
sub $0,1
pow $2,4
mul $1,$2
add $1,1
lpe
mul $1,16
add $1,1
mov $0,$1
|
release/src/router/gmp/source/mpn/x86/p6/mod_34lsub1.asm | zhoutao0712/rtn11pb1 | 184 | 103802 | dnl Intel P6 mpn_mod_34lsub1 -- remainder modulo 2^24-1.
dnl Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
dnl
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public License as
dnl published by the Free Software Foundation; either version 3 of the
dnl License, or (at your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C P6: 2.0 cycles/limb
C TODO
C Experiments with more unrolling indicate that 1.5 c/l is possible on P6-13
C with the current carry handling scheme.
C mp_limb_t mpn_mod_34lsub1 (mp_srcptr src, mp_size_t size)
C
C Groups of three limbs are handled, with carry bits from 0mod3 into 1mod3
C into 2mod3, but at that point going into a separate carries total so we
C don't keep the carry flag live across the loop control. Avoiding decl
C lets us get to 2.0 c/l, as compared to the generic x86 code at 3.66.
C
defframe(PARAM_SIZE, 8)
defframe(PARAM_SRC, 4)
dnl re-use parameter space
define(SAVE_EBX, `PARAM_SIZE')
define(SAVE_ESI, `PARAM_SRC')
TEXT
ALIGN(16)
PROLOGUE(mpn_mod_34lsub1)
deflit(`FRAME',0)
movl PARAM_SIZE, %ecx
movl PARAM_SRC, %edx
subl $2, %ecx C size-2
movl (%edx), %eax C src[0]
ja L(three_or_more)
jb L(one)
C size==2
movl 4(%edx), %ecx C src[1]
movl %eax, %edx C src[0]
shrl $24, %eax C src[0] high
andl $0xFFFFFF, %edx C src[0] low
addl %edx, %eax
movl %ecx, %edx C src[1]
shrl $16, %ecx C src[1] high
andl $0xFFFF, %edx
addl %ecx, %eax
shll $8, %edx C src[1] low
addl %edx, %eax
L(one):
ret
L(three_or_more):
C eax src[0], initial acc 0mod3
C ebx
C ecx size-2
C edx src
C esi
C edi
C ebp
movl %ebx, SAVE_EBX
movl 4(%edx), %ebx C src[1], initial 1mod3
subl $3, %ecx C size-5
movl %esi, SAVE_ESI
movl 8(%edx), %esi C src[2], initial 2mod3
pushl %edi FRAME_pushl()
movl $0, %edi C initial carries 0mod3
jng L(done) C if size < 6
L(top):
C eax acc 0mod3
C ebx acc 1mod3
C ecx counter, limbs
C edx src
C esi acc 2mod3
C edi carrys into 0mod3
C ebp
addl 12(%edx), %eax
adcl 16(%edx), %ebx
adcl 20(%edx), %esi
leal 12(%edx), %edx
adcl $0, %edi
subl $3, %ecx
jg L(top) C at least 3 more to process
L(done):
C ecx is -2, -1 or 0 representing 0, 1 or 2 more limbs respectively
cmpl $-1, %ecx
jl L(done_0) C if -2, meaning 0 more limbs
C 1 or 2 more limbs
movl $0, %ecx
je L(done_1) C if -1, meaning 1 more limb only
movl 16(%edx), %ecx
L(done_1):
addl 12(%edx), %eax C 0mod3
adcl %ecx, %ebx C 1mod3
adcl $0, %esi C 2mod3
adcl $0, %edi C carries 0mod3
L(done_0):
C eax acc 0mod3
C ebx acc 1mod3
C ecx
C edx
C esi acc 2mod3
C edi carries 0mod3
C ebp
movl %eax, %ecx C 0mod3
shrl $24, %eax C 0mod3 high initial total
andl $0xFFFFFF, %ecx C 0mod3 low
movl %edi, %edx C carries
shrl $24, %edi C carries high
addl %ecx, %eax C add 0mod3 low
andl $0xFFFFFF, %edx C carries 0mod3 low
movl %ebx, %ecx C 1mod3
shrl $16, %ebx C 1mod3 high
addl %edi, %eax C add carries high
addl %edx, %eax C add carries 0mod3 low
andl $0xFFFF, %ecx C 1mod3 low mask
addl %ebx, %eax C add 1mod3 high
movl SAVE_EBX, %ebx
shll $8, %ecx C 1mod3 low
movl %esi, %edx C 2mod3
popl %edi FRAME_popl()
shrl $8, %esi C 2mod3 high
andl $0xFF, %edx C 2mod3 low mask
addl %ecx, %eax C add 1mod3 low
shll $16, %edx C 2mod3 low
addl %esi, %eax C add 2mod3 high
movl SAVE_ESI, %esi
addl %edx, %eax C add 2mod3 low
ret
EPILOGUE()
|
Transynther/x86/_processed/NC/_st_zr_4k_/i7-7700_9_0xca.log_19052_1861.asm | ljhsiun2/medusa | 9 | 1872 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r15
push %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x8f43, %rdx
nop
nop
add $36054, %r9
mov $0x6162636465666768, %r13
movq %r13, %xmm5
movups %xmm5, (%rdx)
nop
and $21258, %r15
lea addresses_A_ht+0x7487, %r13
nop
nop
nop
nop
nop
sub $55077, %r8
mov (%r13), %r11w
nop
nop
nop
nop
nop
cmp $15981, %r11
lea addresses_WT_ht+0x18f43, %r9
nop
nop
nop
nop
sub $61033, %r15
mov (%r9), %r13w
nop
nop
nop
nop
cmp %rdx, %rdx
lea addresses_WT_ht+0x11c3, %r15
nop
nop
nop
nop
and %rdx, %rdx
movb (%r15), %r13b
nop
nop
add %r13, %r13
lea addresses_D_ht+0x5f43, %r11
nop
nop
xor $53857, %rdx
movups (%r11), %xmm4
vpextrq $1, %xmm4, %r8
nop
cmp %r9, %r9
lea addresses_A_ht+0x1aab3, %rsi
lea addresses_WC_ht+0x12743, %rdi
nop
nop
inc %r15
mov $61, %rcx
rep movsq
nop
nop
nop
nop
nop
dec %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %rax
push %rbp
push %rbx
push %rcx
push %rdx
// Store
lea addresses_D+0x10f43, %rbp
nop
nop
nop
nop
xor %rcx, %rcx
movb $0x51, (%rbp)
nop
nop
nop
nop
add %rbp, %rbp
// Store
mov $0x34d430000000b5b, %r13
nop
nop
dec %r14
mov $0x5152535455565758, %rbx
movq %rbx, %xmm1
movups %xmm1, (%r13)
nop
nop
nop
and $4717, %rcx
// Store
lea addresses_WC+0xff43, %rdx
cmp %rbp, %rbp
mov $0x5152535455565758, %r14
movq %r14, (%rdx)
nop
nop
nop
dec %rbx
// Store
lea addresses_PSE+0x18e63, %rax
nop
nop
and $12724, %rbp
movb $0x51, (%rax)
nop
nop
nop
nop
cmp %r14, %r14
// Store
lea addresses_A+0x10743, %rax
nop
cmp %rcx, %rcx
movl $0x51525354, (%rax)
add $6081, %rax
// Load
mov $0x63d9410000000303, %rbx
nop
and %rcx, %rcx
mov (%rbx), %dx
nop
nop
nop
nop
nop
xor $18952, %rbx
// Load
lea addresses_A+0xf343, %rcx
nop
nop
nop
nop
nop
sub %rax, %rax
vmovups (%rcx), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $1, %xmm6, %rbp
and $43693, %rdx
// Faulty Load
mov $0x58be120000000743, %rax
nop
nop
cmp $38886, %rbx
movb (%rax), %r14b
lea oracles, %rax
and $0xff, %r14
shlq $12, %r14
mov (%rax,%r14,1), %r14
pop %rdx
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_D'}}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_NC'}}
{'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WC'}}
{'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_PSE'}}
{'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A'}}
{'src': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'src': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 4, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}}
{'00': 428, '54': 18624}
54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 00 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 00 54 54
*/
|
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca_notsx.log_13_1541.asm | ljhsiun2/medusa | 9 | 102856 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x87a5, %r10
nop
nop
nop
nop
nop
xor %r12, %r12
mov $0x6162636465666768, %r9
movq %r9, (%r10)
nop
nop
nop
nop
cmp %rbp, %rbp
lea addresses_normal_ht+0x83fd, %rsi
lea addresses_WT_ht+0x1f0f, %rdi
clflush (%rdi)
nop
nop
nop
xor $19078, %r14
mov $91, %rcx
rep movsb
nop
nop
nop
inc %rsi
lea addresses_WT_ht+0x1aaed, %rcx
nop
nop
nop
cmp $22357, %r9
movb (%rcx), %r14b
dec %r10
lea addresses_normal_ht+0x157e9, %rbp
nop
add %r12, %r12
mov $0x6162636465666768, %rsi
movq %rsi, %xmm5
movups %xmm5, (%rbp)
nop
nop
nop
nop
nop
xor $29987, %rsi
lea addresses_D_ht+0x1de37, %rsi
lea addresses_WT_ht+0x3185, %rdi
clflush (%rsi)
clflush (%rdi)
nop
xor $48780, %r10
mov $12, %rcx
rep movsl
nop
nop
nop
and $55944, %rcx
lea addresses_D_ht+0x189d5, %rsi
lea addresses_D_ht+0x1287d, %rdi
add %r9, %r9
mov $95, %rcx
rep movsq
nop
nop
nop
inc %r10
lea addresses_WC_ht+0x8f5, %rsi
lea addresses_UC_ht+0x16a5, %rdi
nop
nop
nop
and $27671, %r14
mov $63, %rcx
rep movsl
nop
nop
nop
sub $4056, %rsi
lea addresses_normal_ht+0x10f0d, %r10
nop
add $60528, %rsi
movl $0x61626364, (%r10)
xor $22161, %rbp
lea addresses_WT_ht+0xfba5, %rcx
nop
nop
inc %rdi
movups (%rcx), %xmm7
vpextrq $0, %xmm7, %r9
nop
xor %r14, %r14
lea addresses_WC_ht+0x10cfd, %rbp
nop
nop
nop
nop
xor %r12, %r12
vmovups (%rbp), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %r10
nop
nop
inc %r12
lea addresses_normal_ht+0x156b5, %rsi
lea addresses_UC_ht+0x142a5, %rdi
clflush (%rdi)
nop
nop
nop
dec %r14
mov $22, %rcx
rep movsw
nop
cmp %r9, %r9
lea addresses_WC_ht+0xeea5, %rdi
nop
nop
nop
nop
nop
add %r14, %r14
mov $0x6162636465666768, %r12
movq %r12, %xmm5
movups %xmm5, (%rdi)
and %r10, %r10
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r8
push %rax
push %rcx
push %rdx
// Faulty Load
lea addresses_US+0x86a5, %rax
nop
nop
dec %rdx
mov (%rax), %ecx
lea oracles, %rdx
and $0xff, %rcx
shlq $12, %rcx
mov (%rdx,%rcx,1), %rcx
pop %rdx
pop %rcx
pop %rax
pop %r8
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_WC_ht'}, 'dst': {'same': True, 'congruent': 9, 'type': 'addresses_UC_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_normal_ht'}, 'dst': {'same': True, 'congruent': 8, 'type': 'addresses_UC_ht'}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11}}
{'00': 13}
00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
oeis/192/A192875.asm | neoneye/loda-programs | 11 | 173603 | <gh_stars>10-100
; A192875: Coefficient of x in the reduction by (x^2 -> x + 1) of the polynomial p(n,x) given in Comments.
; Submitted by <NAME>
; 0,1,3,11,37,119,391,1257,4087,13195,42757,138271,447615,1448249,4687071,15166963,49082501,158832391,513995543,1663319433,5382623015,17418520571,56367538373,182409150671,590288468367,1910213517529,6181580943951,20004015900707,64734355669957,209484774792695,677906972508007,2193753043793961,7099133978255575,22973280130658539,74343096176003461,240579312871948543,778531010452267551,2519379272385280121,8152882586591036223,26383282262704738003,85378094871803481605,276289318794377599591
mov $1,2
mov $3,-1
lpb $0
sub $0,1
add $1,$3
sub $4,$5
add $4,$2
mov $5,$4
mov $4,$2
mov $2,$3
add $4,$1
add $5,$4
mul $4,4
add $5,1
mov $3,$5
lpe
add $1,$3
mov $0,$1
div $0,2
|
programs/oeis/033/A033505.asm | neoneye/loda | 22 | 103718 | <filename>programs/oeis/033/A033505.asm
; A033505: Expansion of 1/(1 - 3*x - x^2 + x^3).
; 1,3,10,32,103,331,1064,3420,10993,35335,113578,365076,1173471,3771911,12124128,38970824,125264689,402640763,1294216154,4160024536,13371648999,42980755379,138153890600,444070778180,1427385469761,4588073296863,14747534582170,47403291573612,152369336006143,489763765009871,1574257339462144,5060166447390160,16264992916622753,52280887857796275,168047490042621418,540158365069037776,1736241697391938471,5580835967202231771,17938591233929596008,57660367971599081324,185338859181524608209,595738354282243309943,1914893554056655456714,6155080157270685071876,19784395671586467362399,63593373617973431702359,204409436368236077397600,657037287051095196532760,2111927923903548235293521,6788411622393503825015723,21820125504032964513807930,70136860210588849131145992,225442294513406008082230183,724643618246773908864028611,2329236289043138885543170024,7486910190862784557411308500,24065323243384718648913066913,77353643631973801618607339215,248639343948443338947323776058,799206352233919099811665600476,2568904757018226836763713238271,8257281279340156271155481539231,26541542242804776550418492255488,85313003250736259085647245067424,274223270715673397536204745918529,881441273154951675143842990567523,2833234086929792163882086472553674,9106920263228654769253897662310016,29272553603460804796499936468916199,94091346986681276994871620596504939,302439674300275981011860900596121000,972137816284048415233954385915951740
mul $0,2
mov $1,1
mov $3,1
lpb $0
sub $0,2
add $2,$1
add $2,$1
add $1,$2
mov $4,$3
mov $3,$2
mov $2,$4
lpe
mov $0,$1
|
models/tests/test34.als | transclosure/Amalgam | 4 | 1149 | module tests/test // Bugpost by <NAME> <<EMAIL>>
open util/relation as R
// Some primitive, unanalysed signatures:
// names, documents, resources
sig Name {}
sig XMLDoc {}
sig nonXML {}
// Any pipeline component has inputs and outputs.
abstract sig Component {
ins: Name -> lone XMLDoc,
outs: Name -> lone XMLDoc
}{
// The names of input and output ports are disjoint.
no dom[ins] & dom[outs]
// No document is simultaneously an input and an output
// for the same component.
no ran[ins] & ran[outs]
}
// Steps (atomic components) have no further internal
// structure, just inputs and outputs.
abstract sig Step extends Component {}
// Constructs (compound components), however, have
// nested components
abstract sig Construct extends Component {
components: set Component,
descendants: set Component
}{
descendants = ran[^@components]
descendants = ran[^@components]
}
sig Pipeline extends Construct {}
sig Identity extends Step {}
sig XSLT extends Step {}
sig Validate extends Step {}{
some document, schema : Name
| some X1, X2 : XMLDoc
| disj[document, schema]
// N.B. the Names are disjoint, not necessarily the documents
and ins = ( document -> X1 + schema -> X2 )
some result : Name
| some X : XMLDoc
| outs = ( result -> X )
}
sig XInclude extends Step {}{
some document : Name
| some X : XMLDoc
| ins = ( document -> X )
some result : Name
| some X : XMLDoc
| outs = ( result -> X )
}
sig Serialize extends Step {}
sig Parse extends Step {}
sig Load extends Step {}
sig Store extends Step {}
sig ExtensionStep extends Step {
type : Name
}
pred show (p: Pipeline) {
some p.ins
some p.outs
Component = p + p.^components
}
run show for 3 but 1 Pipeline expect 1
|
awa/plugins/awa-images/src/awa-images-services.ads | fuzzysloth/ada-awa | 0 | 15798 | -----------------------------------------------------------------------
-- awa-images-services -- Image service
-- Copyright (C) 2012, 2013, 2016 <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 Security.Permissions;
with ADO;
with AWA.Modules;
with EL.Expressions;
with AWA.Storages.Models;
-- == Storage Service ==
-- The <tt>Storage_Service</tt> provides the operations to access and use the persisent storage.
-- It controls the permissions that grant access to the service for users.
--
-- Other modules can be notified of storage changes by registering a listener
-- on the storage module.
package AWA.Images.Services is
package ACL_Create_Storage is new Security.Permissions.Definition ("storage-create");
package ACL_Delete_Storage is new Security.Permissions.Definition ("storage-delete");
package ACL_Create_Folder is new Security.Permissions.Definition ("folder-create");
PARAM_THUMBNAIL_COMMAND : constant String := "thumbnail_command";
-- ------------------------------
-- Image Service
-- ------------------------------
-- The <b>Image_Service</b> works closely with the storage service. It extracts the
-- information of an image, creates the image thumbnail.
type Image_Service is new AWA.Modules.Module_Manager with private;
type Image_Service_Access is access all Image_Service'Class;
-- Initializes the image service.
overriding
procedure Initialize (Service : in out Image_Service;
Module : in AWA.Modules.Module'Class);
procedure Create_Thumbnail (Service : in Image_Service;
Source : in String;
Into : in String;
Width : in out Natural;
Height : in out Natural);
-- Build a thumbnail for the image identified by the Id.
procedure Build_Thumbnail (Service : in Image_Service;
Id : in ADO.Identifier);
-- Save the data object contained in the <b>Data</b> part element into the
-- target storage represented by <b>Into</b>.
procedure Create_Image (Service : in Image_Service;
File : in AWA.Storages.Models.Storage_Ref'Class);
-- Deletes the storage instance.
procedure Delete_Image (Service : in Image_Service;
File : in AWA.Storages.Models.Storage_Ref'Class);
-- Scale the image dimension.
procedure Scale (Width : in Natural;
Height : in Natural;
To_Width : in out Natural;
To_Height : in out Natural);
-- Get the dimension represented by the string. The string has one of the following
-- formats:
-- original -> Width, Height := Natural'Last
-- default -> Width, Height := 0
-- <width>x -> Width := <width>, Height := 0
-- x<height> -> Width := 0, Height := <height>
-- <width>x<height> -> Width := <width>, Height := <height>
procedure Get_Sizes (Dimension : in String;
Width : out Natural;
Height : out Natural);
private
type Image_Service is new AWA.Modules.Module_Manager with record
Thumbnail_Command : EL.Expressions.Expression;
end record;
end AWA.Images.Services;
|
programs/oeis/099/A099975.asm | ckrause/cm | 22 | 104879 | ; A099975: Bisection of A014137.
; 2,9,65,626,6918,82500,1033412,13402697,178405157,2423307047,33453694487,467995871777,6619846420553,94520750408709,1360510918810437,19720133460129650,287590328749420958,4216819865806452984,62127422576288648840,919286657093271150630,13655332291007661393470,203553241407997457013410,3043971215078242223355170,45653073683802462499830980,686533217105588966032431452,10349580545376066004887022064,156376618946931126205583285456,2367750953583703468645672670852,35921160738203428870440552047828,545954616154902718634582314227020,8311933539335878411808435940482252,126747521841153485025455279433135689
mul $0,2
lpb $0
mov $2,$0
seq $2,228403 ; The number of boundary twigs for complete binary twigs. A twig is a vertex with one edge on the boundary and only one other descendant.
add $3,$2
pow $2,0
sub $0,$2
lpe
mov $0,$3
div $0,2
add $0,2
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/g-hesorg.ads | djamal2727/Main-Bearing-Analytical-Model | 0 | 16373 | <filename>Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/g-hesorg.ads
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . H E A P _ S O R T _ G --
-- --
-- S p e c --
-- --
-- Copyright (C) 1995-2020, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Heapsort generic package using formal procedures
-- This package provides a generic heapsort routine that can be used with
-- different types of data.
-- See also GNAT.Heap_Sort, a version that works with subprogram access
-- parameters, allowing code sharing. The generic version is slightly more
-- efficient but does not allow code sharing and has an interface that is
-- more awkward to use.
-- There is also GNAT.Heap_Sort_A, which is now considered obsolete, but
-- was an older version working with subprogram parameters. This version
-- is retained for backwards compatibility with old versions of GNAT.
-- This heapsort algorithm uses approximately N*log(N) compares in the
-- worst case and is in place with no additional storage required. See
-- the body for exact details of the algorithm used.
generic
-- The data to be sorted is assumed to be indexed by integer values from
-- 1 to N, where N is the number of items to be sorted. In addition, the
-- index value zero is used for a temporary location used during the sort.
with procedure Move (From : Natural; To : Natural);
-- A procedure that moves the data item with index value From to the data
-- item with index value To (the old value in To being lost). An index
-- value of zero is used for moves from and to a single temporary location.
-- For best efficiency, this routine should be marked as inlined.
with function Lt (Op1, Op2 : Natural) return Boolean;
-- A function that compares two items and returns True if the item with
-- index Op1 is less than the item with Index Op2, and False if the Op1
-- item is greater than the Op2 item. If the two items are equal, then
-- it does not matter whether True or False is returned (it is slightly
-- more efficient to return False). For best efficiency, this routine
-- should be marked as inlined.
-- Note on use of temporary location
-- There are two ways of providing for the index value zero to represent
-- a temporary value. Either an extra location can be allocated at the
-- start of the array, or alternatively the Move and Lt subprograms can
-- test for the case of zero and treat it specially. In any case it is
-- desirable to specify the two subprograms as inlined and the tests for
-- zero will in this case be resolved at instantiation time.
package GNAT.Heap_Sort_G is
pragma Pure;
procedure Sort (N : Natural);
-- This procedures sorts items in the range from 1 to N into ascending
-- order making calls to Lt to do required comparisons, and Move to move
-- items around. Note that, as described above, both Move and Lt use a
-- single temporary location with index value zero. This sort is not
-- stable, i.e. the order of equal elements in the input is not preserved.
end GNAT.Heap_Sort_G;
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1290.asm | ljhsiun2/medusa | 9 | 92747 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r13
push %r8
// Faulty Load
lea addresses_RW+0x1873f, %r10
nop
nop
nop
nop
xor $8360, %r13
mov (%r10), %r11d
lea oracles, %r12
and $0xff, %r11
shlq $12, %r11
mov (%r12,%r11,1), %r11
pop %r8
pop %r13
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_RW', 'same': True, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_RW', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
test/Fail/Issue3124.agda | alhassy/agda | 1 | 13387 | <gh_stars>1-10
-- Andreas, 2018-06-10, issue #3124
-- Wrong context for error IrrelevantDatatype in the coverage checker.
data Squash (A : Set) : Prop where
squash : A → Squash A
test : ∀{A} → Squash (Squash A → A)
test = squash λ{ (squash y) → y }
-- WAS: de Bruijn index in error message
-- Expected error:
-- Cannot split on argument of irrelevant datatype (Squash .A)
-- when checking the definition of .extendedlambda0
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_945.asm | ljhsiun2/medusa | 9 | 173234 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x15e91, %r12
nop
add $46880, %rax
mov (%r12), %edx
nop
nop
nop
xor %r14, %r14
lea addresses_WT_ht+0x8201, %rsi
lea addresses_normal_ht+0x116a1, %rdi
nop
nop
nop
nop
nop
and %r10, %r10
mov $100, %rcx
rep movsq
nop
nop
nop
nop
inc %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %r9
push %rax
push %rbx
push %rdx
// Store
lea addresses_UC+0x6601, %r12
nop
cmp $63182, %rbx
mov $0x5152535455565758, %r10
movq %r10, %xmm6
vmovups %ymm6, (%r12)
nop
nop
nop
nop
nop
sub $57735, %rbx
// Faulty Load
lea addresses_PSE+0x11c01, %r10
nop
nop
nop
cmp %r14, %r14
mov (%r10), %r12d
lea oracles, %rbx
and $0xff, %r12
shlq $12, %r12
mov (%rbx,%r12,1), %r12
pop %rdx
pop %rbx
pop %rax
pop %r9
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 1, 'type': 'addresses_PSE', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC', 'congruent': 7}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_PSE', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC_ht', 'congruent': 4}}
{'dst': {'same': False, 'congruent': 1, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_346.asm | ljhsiun2/medusa | 9 | 168543 | <filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_346.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x41be, %rdx
nop
nop
nop
cmp %rax, %rax
vmovups (%rdx), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $1, %xmm0, %rsi
nop
nop
nop
nop
nop
xor $50356, %rcx
lea addresses_normal_ht+0x5e36, %rbp
nop
and $16668, %rcx
mov (%rbp), %bx
nop
nop
nop
sub $57749, %rax
lea addresses_A_ht+0x1e1e, %rsi
lea addresses_WC_ht+0xa47e, %rdi
nop
nop
nop
and %r12, %r12
mov $23, %rcx
rep movsw
and %rax, %rax
lea addresses_D_ht+0x54fe, %rcx
sub $7534, %rdx
mov (%rcx), %bp
xor $59210, %rbx
lea addresses_D_ht+0x15e7e, %rdx
nop
xor $61271, %rax
mov $0x6162636465666768, %rsi
movq %rsi, (%rdx)
nop
nop
nop
cmp $41090, %rax
lea addresses_D_ht+0x1757e, %rcx
nop
nop
nop
cmp %rsi, %rsi
mov (%rcx), %edx
nop
and $61355, %r12
lea addresses_D_ht+0x1746, %rbp
nop
cmp $47992, %r12
movl $0x61626364, (%rbp)
inc %rbx
lea addresses_normal_ht+0x18d7e, %rbp
nop
nop
nop
nop
nop
cmp %rax, %rax
movb (%rbp), %cl
nop
nop
nop
nop
nop
sub %rbp, %rbp
lea addresses_normal_ht+0x923f, %rax
nop
nop
add $37815, %rbp
mov (%rax), %rbx
nop
inc %rdx
lea addresses_UC_ht+0xc17e, %rax
nop
nop
nop
add $11423, %r12
mov (%rax), %cx
sub $61299, %rdi
lea addresses_UC_ht+0x567e, %rsi
nop
nop
nop
nop
add %rbp, %rbp
movb (%rsi), %cl
nop
nop
nop
dec %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r8
push %r9
push %rbp
push %rbx
push %rcx
// Store
mov $0xd98d80000000d1a, %r13
nop
nop
nop
nop
nop
and %r10, %r10
movw $0x5152, (%r13)
nop
nop
xor $28830, %rbx
// Store
lea addresses_WT+0xf7e, %rbp
nop
nop
inc %rcx
mov $0x5152535455565758, %r13
movq %r13, %xmm5
movups %xmm5, (%rbp)
nop
nop
add $4354, %r10
// Faulty Load
lea addresses_PSE+0xad7e, %rbx
nop
nop
nop
nop
sub %r8, %r8
vmovups (%rbx), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $1, %xmm2, %rcx
lea oracles, %rbx
and $0xff, %rcx
shlq $12, %rcx
mov (%rbx,%rcx,1), %rcx
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r8
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_NC', 'AVXalign': False, 'size': 2}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_WT', 'AVXalign': False, 'size': 16}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_D_ht', 'AVXalign': True, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8}}
{'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4}}
{'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xca_notsx.log_21829_1193.asm | ljhsiun2/medusa | 9 | 245033 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x15956, %r9
nop
nop
nop
nop
xor $14234, %r12
movb $0x61, (%r9)
nop
nop
nop
nop
and $26734, %r14
lea addresses_WT_ht+0x1dd02, %rdx
add %rdi, %rdi
movups (%rdx), %xmm5
vpextrq $1, %xmm5, %rax
nop
nop
add %rdx, %rdx
lea addresses_normal_ht+0x166b2, %rax
nop
inc %r11
movw $0x6162, (%rax)
nop
nop
nop
nop
dec %r11
lea addresses_D_ht+0x158a2, %rsi
lea addresses_normal_ht+0x1ac2a, %rdi
nop
nop
nop
nop
nop
cmp %r12, %r12
mov $103, %rcx
rep movsb
xor %rdi, %rdi
lea addresses_A_ht+0x1a32a, %r12
nop
nop
nop
nop
nop
xor $42958, %rdi
mov (%r12), %ecx
nop
nop
nop
nop
nop
sub $39250, %rsi
lea addresses_normal_ht+0xadb8, %rsi
nop
nop
nop
nop
xor %r12, %r12
mov $0x6162636465666768, %rdx
movq %rdx, %xmm2
vmovups %ymm2, (%rsi)
nop
nop
nop
dec %rdx
lea addresses_normal_ht+0x10baa, %rsi
lea addresses_UC_ht+0xf72a, %rdi
nop
nop
nop
nop
nop
sub %rax, %rax
mov $126, %rcx
rep movsq
xor %rsi, %rsi
lea addresses_D_ht+0xb2a, %rsi
nop
nop
nop
nop
and %rdi, %rdi
mov (%rsi), %edx
nop
nop
nop
nop
nop
xor $52719, %rsi
lea addresses_UC_ht+0x962a, %rdx
nop
nop
nop
dec %r9
mov $0x6162636465666768, %rcx
movq %rcx, %xmm2
movups %xmm2, (%rdx)
nop
nop
nop
dec %rsi
lea addresses_normal_ht+0x11a9a, %rax
nop
nop
nop
nop
add %rcx, %rcx
and $0xffffffffffffffc0, %rax
vmovntdqa (%rax), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $1, %xmm7, %r12
dec %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %rax
push %rbx
push %rcx
push %rdx
// Store
lea addresses_A+0x1f2a, %rax
nop
nop
mfence
movw $0x5152, (%rax)
nop
nop
sub %r13, %r13
// Load
lea addresses_normal+0xff2a, %r12
nop
nop
nop
nop
cmp %rcx, %rcx
movb (%r12), %bl
nop
cmp $4449, %r13
// Faulty Load
lea addresses_A+0x1f2a, %r12
sub %rbx, %rbx
mov (%r12), %cx
lea oracles, %r12
and $0xff, %rcx
shlq $12, %rcx
mov (%r12,%rcx,1), %rcx
pop %rdx
pop %rcx
pop %rbx
pop %rax
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 4}}
{'52': 21829}
52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52
*/
|
programs/oeis/061/A061087.asm | jmorken/loda | 1 | 240464 | ; A061087: a(n) = A061086(n) / n.
; 11,14,109,116,1025,1036,1049,1064,1081,10100,10121,10144,10169,10196,10225,10256,10289,10324,10361,10400,10441,100484,100529,100576,100625,100676,100729,100784,100841,100900,100961,101024,101089,101156,101225,101296,101369,101444,101521,101600,101681,101764,101849,101936,102025,102116,1002209,1002304,1002401,1002500,1002601,1002704,1002809,1002916,1003025,1003136,1003249,1003364,1003481,1003600,1003721,1003844,1003969,1004096,1004225,1004356,1004489,1004624,1004761,1004900,1005041,1005184,1005329,1005476,1005625,1005776,1005929,1006084,1006241,1006400,1006561,1006724,1006889,1007056,1007225,1007396,1007569,1007744,1007921,1008100,1008281,1008464,1008649,1008836,1009025,1009216,1009409,1009604,1009801,10010000,10010201,10010404,10010609,10010816,10011025,10011236,10011449,10011664,10011881,10012100,10012321,10012544,10012769,10012996,10013225,10013456,10013689,10013924,10014161,10014400,10014641,10014884,10015129,10015376,10015625,10015876,10016129,10016384,10016641,10016900,10017161,10017424,10017689,10017956,10018225,10018496,10018769,10019044,10019321,10019600,10019881,10020164,10020449,10020736,10021025,10021316,10021609,10021904,10022201,10022500,10022801,10023104,10023409,10023716,10024025,10024336,10024649,10024964,10025281,10025600,10025921,10026244,10026569,10026896,10027225,10027556,10027889,10028224,10028561,10028900,10029241,10029584,10029929,10030276,10030625,10030976,10031329,10031684,10032041,10032400,10032761,10033124,10033489,10033856,10034225,10034596,10034969,10035344,10035721,10036100,10036481,10036864,10037249,10037636,10038025,10038416,10038809,10039204,10039601,10040000,10040401,10040804,10041209,10041616,10042025,10042436,10042849,10043264,10043681,10044100,10044521,10044944,10045369,10045796,10046225,100046656,100047089,100047524,100047961,100048400,100048841,100049284,100049729,100050176,100050625,100051076,100051529,100051984,100052441,100052900,100053361,100053824,100054289,100054756,100055225,100055696,100056169,100056644,100057121,100057600,100058081,100058564,100059049,100059536,100060025,100060516,100061009,100061504,100062001,100062500
mov $4,$0
mov $5,$0
add $5,1
mov $9,$0
lpb $5
mov $0,$9
sub $5,1
sub $0,$5
mov $8,$0
mov $11,2
lpb $11
mov $0,$8
sub $11,1
add $0,$11
pow $0,3
mov $6,2
lpb $0
div $0,10
mul $6,10
lpe
mov $1,$6
mov $10,$11
lpb $10
mov $2,$1
sub $10,1
lpe
lpe
lpb $8
sub $2,$1
mov $8,0
lpe
mov $1,$2
div $1,20
mul $1,10
add $1,1
add $7,$1
lpe
mov $1,$7
add $1,$4
mov $3,$4
mul $3,$4
add $1,$3
|
test_1.asm | shavtvalishvili/Assembly-Emulator | 0 | 161180 | SP = SP - 2
M[SP] =.2 40
RV =.2 M[SP]
SP = SP + 2
RET |
programs/oeis/047/A047599.asm | karttu/loda | 0 | 25 | ; A047599: Numbers that are congruent to {0, 3, 4, 5} mod 8.
; 0,3,4,5,8,11,12,13,16,19,20,21,24,27,28,29,32,35,36,37,40,43,44,45,48,51,52,53,56,59,60,61,64,67,68,69,72,75,76,77,80,83,84,85,88,91,92,93,96,99,100,101,104,107,108,109,112,115,116,117,120,123,124
add $0,7
mov $1,$0
div $1,4
mul $1,2
mov $2,$0
lpb $2,1
mov $3,$0
add $3,2
mov $0,$3
sub $2,4
lpe
add $1,$0
sub $1,13
|
src/ada-libc/src/libc-stdint.ads | mstewartgallus/linted | 0 | 1507 | <filename>src/ada-libc/src/libc-stdint.ads<gh_stars>0
-- Copyright 2015 <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 Interfaces.C; use Interfaces.C;
package Libc.Stdint is
pragma Pure;
subtype int8_t is signed_char; -- /usr/include/stdint.h:36
subtype int16_t is short; -- /usr/include/stdint.h:37
subtype int32_t is int; -- /usr/include/stdint.h:38
subtype int64_t is long; -- /usr/include/stdint.h:40
subtype uint8_t is unsigned_char; -- /usr/include/stdint.h:48
subtype uint16_t is unsigned_short; -- /usr/include/stdint.h:49
subtype uint32_t is unsigned; -- /usr/include/stdint.h:51
subtype uint64_t is unsigned_long; -- /usr/include/stdint.h:55
subtype int_least8_t is signed_char; -- /usr/include/stdint.h:65
subtype int_least16_t is short; -- /usr/include/stdint.h:66
subtype int_least32_t is int; -- /usr/include/stdint.h:67
subtype int_least64_t is long; -- /usr/include/stdint.h:69
subtype uint_least8_t is unsigned_char; -- /usr/include/stdint.h:76
subtype uint_least16_t is unsigned_short; -- /usr/include/stdint.h:77
subtype uint_least32_t is unsigned; -- /usr/include/stdint.h:78
subtype uint_least64_t is unsigned_long; -- /usr/include/stdint.h:80
subtype int_fast8_t is signed_char; -- /usr/include/stdint.h:90
subtype int_fast16_t is long; -- /usr/include/stdint.h:92
subtype int_fast32_t is long; -- /usr/include/stdint.h:93
subtype int_fast64_t is long; -- /usr/include/stdint.h:94
subtype uint_fast8_t is unsigned_char; -- /usr/include/stdint.h:103
subtype uint_fast16_t is unsigned_long; -- /usr/include/stdint.h:105
subtype uint_fast32_t is unsigned_long; -- /usr/include/stdint.h:106
subtype uint_fast64_t is unsigned_long; -- /usr/include/stdint.h:107
subtype intptr_t is long; -- /usr/include/stdint.h:119
subtype uintptr_t is unsigned_long; -- /usr/include/stdint.h:122
subtype intmax_t is long; -- /usr/include/stdint.h:134
subtype uintmax_t is unsigned_long; -- /usr/include/stdint.h:135
INT8_MIN : constant := int8_t'First;
INT16_MIN : constant := int16_t'First;
INT32_MIN : constant := int32_t'First;
INT64_MIN : constant := int64_t'First;
INT8_MAX : constant := int8_t'Last;
INT16_MAX : constant := int16_t'Last;
INT32_MAX : constant := int32_t'Last;
INT64_MAX : constant := int64_t'Last;
UINT8_MAX : constant := uint8_t'Last;
UINT16_MAX : constant := uint16_t'Last;
UINT32_MAX : constant := uint32_t'Last;
UINT64_MAX : constant := uint64_t'Last;
INT_LEAST8_MIN : constant := int_least8_t'First;
INT_LEAST16_MIN : constant := int_least16_t'First;
INT_LEAST32_MIN : constant := int_least32_t'First;
INT_LEAST64_MIN : constant := int_least64_t'First;
INT_LEAST8_MAX : constant := int_least8_t'Last;
INT_LEAST16_MAX : constant := int_least16_t'Last;
INT_LEAST32_MAX : constant := int_least32_t'Last;
INT_LEAST64_MAX : constant := int_least64_t'Last;
UINT_LEAST8_MAX : constant := uint_least8_t'Last;
UINT_LEAST16_MAX : constant := uint_least16_t'Last;
UINT_LEAST32_MAX : constant := uint_least32_t'Last;
UINT_LEAST64_MAX : constant := uint_least64_t'Last;
INT_FAST8_MIN : constant := int_fast8_t'First;
INT_FAST16_MIN : constant := int_fast16_t'First;
INT_FAST32_MIN : constant := int_fast32_t'First;
INT_FAST64_MIN : constant := int_fast64_t'First;
INT_FAST8_MAX : constant := int_fast8_t'Last;
INT_FAST16_MAX : constant := int_fast16_t'Last;
INT_FAST32_MAX : constant := int_fast32_t'Last;
INT_FAST64_MAX : constant := int_fast64_t'Last;
UINT_FAST8_MAX : constant := uint_fast8_t'Last;
UINT_FAST16_MAX : constant := uint_fast16_t'Last;
UINT_FAST32_MAX : constant := uint_fast32_t'Last;
UINT_FAST64_MAX : constant := uint_fast64_t'Last;
INTPTR_MIN : constant := intptr_t'First;
INTPTR_MAX : constant := intptr_t'Last;
UINTPTR_MAX : constant := uintptr_t'Last;
INTMAX_MIN : constant := intmax_t'First;
INTMAX_MAX : constant := intmax_t'Last;
UINTMAX_MAX : constant := uintmax_t'Last;
PTRDIFF_MIN : constant := ptrdiff_t'First;
PTRDIFF_MAX : constant := ptrdiff_t'Last;
SIG_ATOMIC_MIN : constant := -2147483647 - 1;
SIG_ATOMIC_MAX : constant := 2147483647;
SIZE_MAX : constant := size_t'Last;
-- unsupported macro: WCHAR_MIN __WCHAR_MIN
-- unsupported macro: WCHAR_MAX __WCHAR_MAX
WINT_MIN : constant := 0;
WINT_MAX : constant := 4294967295;
end Libc.Stdint;
|
maps/TinTower9F.asm | Dev727/ancientplatinum | 28 | 177888 | object_const_def ; object_event constants
const TINTOWER9F_POKE_BALL
TinTower9F_MapScripts:
db 0 ; scene scripts
db 0 ; callbacks
TinTower9FHPUp:
itemball HP_UP
TinTower9FUnusedHoOhText:
; unused
text "HO-OH: Shaoooh!"
done
TinTower9FUnusedLugiaText:
; unused
text "LUGIA: Gyaaan!"
done
TinTower9F_MapEvents:
db 0, 0 ; filler
db 7 ; warp events
warp_event 12, 3, TIN_TOWER_8F, 2
warp_event 2, 5, TIN_TOWER_8F, 3
warp_event 12, 7, TIN_TOWER_8F, 4
warp_event 7, 9, TIN_TOWER_ROOF, 1
warp_event 16, 7, TIN_TOWER_7F, 5
warp_event 6, 13, TIN_TOWER_8F, 5
warp_event 8, 13, TIN_TOWER_8F, 6
db 0 ; coord events
db 0 ; bg events
db 1 ; object events
object_event 9, 1, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, TinTower9FHPUp, EVENT_TIN_TOWER_9F_HP_UP
|
src/simple-loop.asm | brgmnn/uob-cpu-simulator | 0 | 245244 | # this is a comment
mov r0,#10
mov r1,#1
loop1:
sub r0,r0,#1
add r2,r2,r1
br r0,$loop1
halt
|
programs/oeis/331/A331429.asm | jmorken/loda | 1 | 15461 | <filename>programs/oeis/331/A331429.asm
; A331429: Expansion of x^2*(10-5*x+x^2)/((1-x)^4*(1-x^2)).
; 0,0,10,35,91,189,351,594,946,1430,2080,2925,4005,5355,7021,9044,11476,14364,17766,21735,26335,31625,37675,44550,52326,61074,70876,81809,93961,107415,122265,138600,156520,176120,197506,220779,246051,273429,303031,334970,369370,406350,446040,488565,534061,582659,634501
mov $15,$0
mov $17,$0
lpb $17
clr $0,15
mov $0,$15
sub $17,1
sub $0,$17
mov $12,$0
mov $14,$0
lpb $14
clr $0,12
mov $0,$12
sub $14,1
sub $0,$14
mov $9,$0
mov $11,$0
lpb $11
mov $0,$9
sub $11,1
sub $0,$11
mov $4,$0
add $4,$0
mov $8,1
add $8,$0
sub $8,1
lpb $0
add $0,1
mod $0,2
add $8,$4
mov $3,$8
add $3,2
mov $1,$3
sub $3,5
mov $4,$1
mov $8,6
lpe
mov $1,$3
trn $1,1
add $10,$1
lpe
add $13,$10
lpe
add $16,$13
lpe
mov $1,$16
|
libsrc/_DEVELOPMENT/stdio/c/sdcc_iy/vfscanf_unlocked.asm | meesokim/z88dk | 0 | 12406 | <filename>libsrc/_DEVELOPMENT/stdio/c/sdcc_iy/vfscanf_unlocked.asm
; int vfscanf_unlocked(FILE *stream, const char *format, void *arg)
SECTION code_stdio
PUBLIC _vfscanf_unlocked
EXTERN asm_vfscanf_unlocked
_vfscanf_unlocked:
pop af
pop ix
pop de
pop bc
push bc
push de
push hl
push af
jp asm_vfscanf_unlocked
|
llvm-gcc-4.2-2.9/gcc/testsuite/ada/acats/tests/c3/c38202a.ada | vidkidz/crossbridge | 1 | 29323 | <reponame>vidkidz/crossbridge
-- C38202A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT TASKING ATTRIBUTES ARE DECLARED AND RETURN CORRECT
-- VALUES FOR OBJECTS HAVING AN ACCESS TYPE WHOSE DESIGNATED
-- TYPE IS A TASK TYPE.
-- CHECK THE ACCESS TYPE RESULTS OF FUNCTION CALLS.
-- AH 9/12/86
-- EDS 7/14/98 AVOID OPTIMIZATION
WITH REPORT; USE REPORT;
PROCEDURE C38202A IS
BEGIN
TEST ("C38202A", "OBJECTS HAVING ACCESS TYPES WITH DESIGNATED " &
"TASK TYPE CAN BE PREFIX OF TASKING ATTRIBUTES");
-- CHECK TWO CASES: (1) TASK IS CALLABLE, NOT TERMINATED.
-- (2) TASK IS NOT CALLABLE, TERMINATED.
DECLARE
TASK TYPE TSK IS
ENTRY GO_ON;
END TSK;
TASK DRIVER IS
ENTRY TSK_DONE;
END DRIVER;
TYPE P_TYPE IS ACCESS TSK;
P : P_TYPE;
TASK BODY TSK IS
I : INTEGER RANGE 0 .. 2;
BEGIN
ACCEPT GO_ON;
I := IDENT_INT(5); -- CONSTRAINT_ERROR RAISED.
FAILED ("CONSTAINT_ERROR NOT RAISED IN TASK " &
" TSK - 1A " & INTEGER'IMAGE(I));
EXCEPTION
WHEN CONSTRAINT_ERROR =>
DRIVER.TSK_DONE;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED IN TASK " &
"TSK - 1A ");
DRIVER.TSK_DONE;
END TSK;
TASK BODY DRIVER IS
COUNTER : INTEGER := 1;
BEGIN
P := NEW TSK;
IF NOT P'CALLABLE THEN
FAILED ("TASKING ATTRIBUTE RETURNS INCORRECT " &
"VALUE - 1B");
END IF;
IF P'TERMINATED THEN
FAILED ("TASKING ATTRIBUTE RETURNS INCORRECT " &
"VALUE - 1C");
END IF;
P.GO_ON;
ACCEPT TSK_DONE;
WHILE (NOT P'TERMINATED AND COUNTER <= 3) LOOP
DELAY 10.0;
COUNTER := COUNTER + 1;
END LOOP;
IF COUNTER > 3 THEN
FAILED ("TASK TSK NOT TERMINATED IN SUFFICIENT " &
"TIME - 1D");
END IF;
IF P'CALLABLE THEN
FAILED ("TASKING ATTRIBUTE RETURNS INCORRECT " &
"VALUE - 1E");
END IF;
IF NOT P'TERMINATED THEN
FAILED ("TASKING ATTRIBUTE RETURNS INCORRECT " &
"VALUE - 1F");
END IF;
END DRIVER;
BEGIN
NULL;
END; -- BLOCK
-- CHECK ACCESS TYPE RESULT RETURNED FROM FUNCTION.
-- CHECK TWO CASES: (1) TASK IS CALLABLE, NOT TERMINATED.
-- (2) TASK IS NOT CALLABLE, TERMINATED.
DECLARE
TASK TYPE TSK IS
ENTRY GO_ON;
END TSK;
TASK DRIVER IS
ENTRY TSK_DONE;
END DRIVER;
TYPE P_TYPE IS ACCESS TSK;
P : P_TYPE;
TSK_CREATED : BOOLEAN := FALSE;
FUNCTION F1 RETURN P_TYPE IS
BEGIN
RETURN P;
END F1;
TASK BODY TSK IS
I : INTEGER RANGE 0 .. 2;
BEGIN
ACCEPT GO_ON;
I := IDENT_INT(5); -- CONSTRAINT_ERROR RAISED.
FAILED ("CONSTRAINT_ERROR NOT RAISED IN TASK " &
"TSK - 2A " & INTEGER'IMAGE(I));
EXCEPTION
WHEN CONSTRAINT_ERROR =>
DRIVER.TSK_DONE;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED IN TASK " &
"TSK - 2A ");
DRIVER.TSK_DONE;
END TSK;
TASK BODY DRIVER IS
COUNTER : INTEGER := 1;
BEGIN
P := NEW TSK; -- ACTIVATE P.ALL (F1.ALL).
IF NOT F1'CALLABLE THEN
FAILED ("TASKING ATTRIBUTE RETURNS INCORRECT " &
"VALUE WHEN PREFIX IS VALUE FROM " &
"FUNCTION CALL - 2B");
END IF;
IF F1'TERMINATED THEN
FAILED ("TASKING ATTRIBUTE RETURNS INCORRECT " &
"VALUE WHEN PREFIX IS VALUE FROM " &
"FUNCTION CALL - 2C");
END IF;
F1.ALL.GO_ON;
ACCEPT TSK_DONE;
WHILE (NOT F1'TERMINATED AND COUNTER <= 3) LOOP
DELAY 10.0;
COUNTER := COUNTER + 1;
END LOOP;
IF COUNTER > 3 THEN
FAILED ("TASK TSK NOT TERMINATED IN SUFFICIENT " &
"TIME - 2D");
END IF;
IF F1'CALLABLE THEN
FAILED ("TASKING ATTRIBUTE RETURNS INCORRECT " &
"VALUE WHEN PREFIX IS VALUE FROM " &
"FUNCTION CALL - 2E");
END IF;
IF NOT F1'TERMINATED THEN
FAILED ("TASKING ATTRIBUTE RETURNS INCORRECT " &
"VALUE WHEN PREFIX IS VALUE FROM " &
"FUNCTION CALL - 2F");
END IF;
END DRIVER;
BEGIN
NULL;
END; -- BLOCK
RESULT;
END C38202A;
|
src/main/antlr/AttributesParser.g4 | vlsergey/tex2html | 0 | 2163 | parser grammar AttributesParser ;
@header {
package com.github.vlsergey.tex2html.grammar;
}
options {
tokenVocab = AttributesLexer ;
}
attributes
: (attribute (COMMA attribute )* )? ;
attribute : name EQUALS value ;
name : ALPHA ;
value : textWidth | textWidthRelative ;
number
: NUMERIC | ( NUMERIC DOT NUMERIC ) | ( DOT NUMERIC ) | ( NUMERIC DOT )
;
textWidth : TEXTWIDTH ;
textWidthRelative : number TEXTWIDTH ;
|
programs/oeis/193/A193512.asm | neoneye/loda | 22 | 97321 | ; A193512: a(n) = Sum of odd divisors of Omega(n), a(1) = 0.
; 0,1,1,1,1,1,1,4,1,1,1,4,1,1,1,1,1,4,1,4,1,1,1,1,1,1,4,4,1,4,1,6,1,1,1,1,1,1,1,1,1,4,1,4,4,1,1,6,1,4,1,4,1,1,1,1,1,1,1,1,1,1,4,4,1,4,1,4,1,4,1,6,1,1,4,4,1,4,1,6,1,1,1,1,1,1,1,1,1,1,1,4,1,1,1,4,1,4,4,1
seq $0,1222 ; Number of prime divisors of n counted with multiplicity (also called bigomega(n) or Omega(n)).
seq $0,4011 ; Theta series of D_4 lattice; Fourier coefficients of Eisenstein series E_{gamma,2}.
div $0,24
|
oeis/010/A010525.asm | neoneye/loda-programs | 11 | 161217 | <gh_stars>10-100
; A010525: Decimal expansion of square root of 73.
; 8,5,4,4,0,0,3,7,4,5,3,1,7,5,3,1,1,6,7,8,7,1,6,4,8,3,2,6,2,3,9,7,0,6,4,3,4,5,9,4,4,5,5,3,2,9,5,3,3,2,8,2,2,4,1,9,0,8,6,5,1,2,5,3,7,7,1,6,4,8,8,1,9,3,2,7,2,9,8,3,8,1,0,8,0,9,7,2,0,3,0,1,0,7,0,0,9,4,2,9
mov $1,1
mov $2,1
mov $3,$0
add $3,8
mov $4,$0
add $4,3
mul $4,2
mov $7,10
pow $7,$4
mov $9,10
lpb $3
mov $4,$2
pow $4,2
mul $4,73
mov $5,$1
pow $5,2
add $4,$5
mov $6,$1
mov $1,$4
mul $6,$2
mul $6,2
mov $2,$6
mov $8,$4
div $8,$7
max $8,2
div $1,$8
div $2,$8
sub $3,1
lpe
mov $3,$9
pow $3,$0
div $2,$3
div $1,$2
mod $1,$9
mov $0,$1
|
examples/src/zhelper.ads | sonneveld/adazmq | 0 | 25503 | with ZMQ;
package ZHelper is
function Rand_Of (First : Integer; Last : Integer) return Integer;
function Rand_Of (First : Float; Last : Float) return Float;
-- Provide random number from First .. Last
procedure Dump (S : ZMQ.Socket_Type'Class);
-- Receives all message parts from socket, prints neatly
function Set_Id (S : ZMQ.Socket_Type'Class) return String;
procedure Set_Id (S : ZMQ.Socket_Type'Class);
-- Set simple random printable identity on socket
end ZHelper;
|
tools-src/gnu/gcc/gcc/ada/prj-env.adb | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 27735 | <gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P R J . E N V --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 2001 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, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with GNAT.OS_Lib; use GNAT.OS_Lib;
with Namet; use Namet;
with Opt;
with Osint; use Osint;
with Output; use Output;
with Prj.Com; use Prj.Com;
with Prj.Util;
with Snames; use Snames;
with Stringt; use Stringt;
with Table;
package body Prj.Env is
type Naming_Id is new Nat;
No_Naming : constant Naming_Id := 0;
Ada_Path_Buffer : String_Access := new String (1 .. 1_000);
-- A buffer where values for ADA_INCLUDE_PATH
-- and ADA_OBJECTS_PATH are stored.
Ada_Path_Length : Natural := 0;
-- Index of the last valid character in Ada_Path_Buffer.
package Namings is new Table.Table (
Table_Component_Type => Naming_Data,
Table_Index_Type => Naming_Id,
Table_Low_Bound => 1,
Table_Initial => 5,
Table_Increment => 100,
Table_Name => "Prj.Env.Namings");
Default_Naming : constant Naming_Id := Namings.First;
Global_Configuration_Pragmas : Name_Id;
Local_Configuration_Pragmas : Name_Id;
-----------------------
-- Local Subprograms --
-----------------------
function Body_Path_Name_Of (Unit : Unit_Id) return String;
-- Returns the path name of the body of a unit.
-- Compute it first, if necessary.
function Spec_Path_Name_Of (Unit : Unit_Id) return String;
-- Returns the path name of the spec of a unit.
-- Compute it first, if necessary.
procedure Add_To_Path (Path : String);
-- Add Path to global variable Ada_Path_Buffer
-- Increment Ada_Path_Length
----------------------
-- Ada_Include_Path --
----------------------
function Ada_Include_Path (Project : Project_Id) return String_Access is
procedure Add (Project : Project_Id);
-- Add all the source directories of a project to the path,
-- only if this project has not been visited.
-- Call itself recursively for projects being modified,
-- and imported projects.
-- Add the project to the list Seen if this is the first time
-- we call Add for this project.
---------
-- Add --
---------
procedure Add (Project : Project_Id) is
begin
-- If Seen is empty, then the project cannot have been
-- visited.
if not Projects.Table (Project).Seen then
Projects.Table (Project).Seen := True;
declare
Data : Project_Data := Projects.Table (Project);
List : Project_List := Data.Imported_Projects;
Current : String_List_Id := Data.Source_Dirs;
Source_Dir : String_Element;
begin
-- Add to path all source directories of this project
while Current /= Nil_String loop
if Ada_Path_Length > 0 then
Add_To_Path (Path => (1 => Path_Separator));
end if;
Source_Dir := String_Elements.Table (Current);
String_To_Name_Buffer (Source_Dir.Value);
declare
New_Path : constant String :=
Name_Buffer (1 .. Name_Len);
begin
Add_To_Path (New_Path);
end;
Current := Source_Dir.Next;
end loop;
-- Call Add to the project being modified, if any
if Data.Modifies /= No_Project then
Add (Data.Modifies);
end if;
-- Call Add for each imported project, if any
while List /= Empty_Project_List loop
Add (Project_Lists.Table (List).Project);
List := Project_Lists.Table (List).Next;
end loop;
end;
end if;
end Add;
-- Start of processing for Ada_Include_Path
begin
-- If it is the first time we call this function for
-- this project, compute the source path
if Projects.Table (Project).Include_Path = null then
Ada_Path_Length := 0;
for Index in 1 .. Projects.Last loop
Projects.Table (Index).Seen := False;
end loop;
Add (Project);
Projects.Table (Project).Include_Path :=
new String'(Ada_Path_Buffer (1 .. Ada_Path_Length));
end if;
return Projects.Table (Project).Include_Path;
end Ada_Include_Path;
----------------------
-- Ada_Objects_Path --
----------------------
function Ada_Objects_Path
(Project : Project_Id;
Including_Libraries : Boolean := True)
return String_Access is
procedure Add (Project : Project_Id);
-- Add all the object directory of a project to the path,
-- only if this project has not been visited.
-- Call itself recursively for projects being modified,
-- and imported projects.
-- Add the project to the list Seen if this is the first time
-- we call Add for this project.
---------
-- Add --
---------
procedure Add (Project : Project_Id) is
begin
-- If this project has not been seen yet
if not Projects.Table (Project).Seen then
Projects.Table (Project).Seen := True;
declare
Data : Project_Data := Projects.Table (Project);
List : Project_List := Data.Imported_Projects;
begin
-- Add to path the object directory of this project
-- except if we don't include library project and
-- this is a library project.
if (Data.Library and then Including_Libraries)
or else
(Data.Object_Directory /= No_Name
and then
(not Including_Libraries or else not Data.Library))
then
if Ada_Path_Length > 0 then
Add_To_Path (Path => (1 => Path_Separator));
end if;
-- For a library project, att the library directory
if Data.Library then
declare
New_Path : constant String :=
Get_Name_String (Data.Library_Dir);
begin
Add_To_Path (New_Path);
end;
else
-- For a non library project, add the object directory
declare
New_Path : constant String :=
Get_Name_String (Data.Object_Directory);
begin
Add_To_Path (New_Path);
end;
end if;
end if;
-- Call Add to the project being modified, if any
if Data.Modifies /= No_Project then
Add (Data.Modifies);
end if;
-- Call Add for each imported project, if any
while List /= Empty_Project_List loop
Add (Project_Lists.Table (List).Project);
List := Project_Lists.Table (List).Next;
end loop;
end;
end if;
end Add;
-- Start of processing for Ada_Objects_Path
begin
-- If it is the first time we call this function for
-- this project, compute the objects path
if Projects.Table (Project).Objects_Path = null then
Ada_Path_Length := 0;
for Index in 1 .. Projects.Last loop
Projects.Table (Index).Seen := False;
end loop;
Add (Project);
Projects.Table (Project).Objects_Path :=
new String'(Ada_Path_Buffer (1 .. Ada_Path_Length));
end if;
return Projects.Table (Project).Objects_Path;
end Ada_Objects_Path;
-----------------
-- Add_To_Path --
-----------------
procedure Add_To_Path (Path : String) is
begin
-- If Ada_Path_Buffer is too small, double it
if Ada_Path_Length + Path'Length > Ada_Path_Buffer'Last then
declare
New_Ada_Path_Buffer : constant String_Access :=
new String
(1 .. Ada_Path_Buffer'Last +
Ada_Path_Buffer'Last);
begin
New_Ada_Path_Buffer (1 .. Ada_Path_Length) :=
Ada_Path_Buffer (1 .. Ada_Path_Length);
Ada_Path_Buffer := New_Ada_Path_Buffer;
end;
end if;
Ada_Path_Buffer
(Ada_Path_Length + 1 .. Ada_Path_Length + Path'Length) := Path;
Ada_Path_Length := Ada_Path_Length + Path'Length;
end Add_To_Path;
-----------------------
-- Body_Path_Name_Of --
-----------------------
function Body_Path_Name_Of (Unit : Unit_Id) return String is
Data : Unit_Data := Units.Table (Unit);
begin
-- If we don't know the path name of the body of this unit,
-- we compute it, and we store it.
if Data.File_Names (Body_Part).Path = No_Name then
declare
Current_Source : String_List_Id :=
Projects.Table (Data.File_Names (Body_Part).Project).Sources;
Path : GNAT.OS_Lib.String_Access;
begin
-- By default, put the file name
Data.File_Names (Body_Part).Path :=
Data.File_Names (Body_Part).Name;
-- For each source directory
while Current_Source /= Nil_String loop
String_To_Name_Buffer
(String_Elements.Table (Current_Source).Value);
Path :=
Locate_Regular_File
(Namet.Get_Name_String
(Data.File_Names (Body_Part).Name),
Name_Buffer (1 .. Name_Len));
-- If the file is in this directory,
-- then we store the path, and we are done.
if Path /= null then
Name_Len := Path'Length;
Name_Buffer (1 .. Name_Len) := Path.all;
Data.File_Names (Body_Part).Path := Name_Enter;
exit;
else
Current_Source :=
String_Elements.Table (Current_Source).Next;
end if;
end loop;
Units.Table (Unit) := Data;
end;
end if;
-- Returned the value stored
return Namet.Get_Name_String (Data.File_Names (Body_Part).Path);
end Body_Path_Name_Of;
--------------------------------
-- Create_Config_Pragmas_File --
--------------------------------
procedure Create_Config_Pragmas_File
(For_Project : Project_Id;
Main_Project : Project_Id)
is
File_Name : Temp_File_Name;
File : File_Descriptor := Invalid_FD;
The_Packages : Package_Id;
Gnatmake : Prj.Package_Id;
Compiler : Prj.Package_Id;
Current_Unit : Unit_Id := Units.First;
First_Project : Project_List := Empty_Project_List;
Current_Project : Project_List;
Current_Naming : Naming_Id;
Global_Attribute : Variable_Value := Nil_Variable_Value;
Local_Attribute : Variable_Value := Nil_Variable_Value;
Global_Attribute_Present : Boolean := False;
Local_Attribute_Present : Boolean := False;
procedure Check (Project : Project_Id);
procedure Check_Temp_File;
-- Check that a temporary file has been opened.
-- If not, create one, and put its name in the project data,
-- with the indication that it is a temporary file.
procedure Copy_File (Name : String_Id);
-- Copy a configuration pragmas file into the temp file.
procedure Put
(Unit_Name : Name_Id;
File_Name : Name_Id;
Unit_Kind : Spec_Or_Body);
-- Put an SFN pragma in the temporary file.
procedure Put (File : File_Descriptor; S : String);
procedure Put_Line (File : File_Descriptor; S : String);
-----------
-- Check --
-----------
procedure Check (Project : Project_Id) is
Data : constant Project_Data := Projects.Table (Project);
begin
if Current_Verbosity = High then
Write_Str ("Checking project file """);
Write_Str (Namet.Get_Name_String (Data.Name));
Write_Str (""".");
Write_Eol;
end if;
-- Is this project in the list of the visited project?
Current_Project := First_Project;
while Current_Project /= Empty_Project_List
and then Project_Lists.Table (Current_Project).Project /= Project
loop
Current_Project := Project_Lists.Table (Current_Project).Next;
end loop;
-- If it is not, put it in the list, and visit it
if Current_Project = Empty_Project_List then
Project_Lists.Increment_Last;
Project_Lists.Table (Project_Lists.Last) :=
(Project => Project, Next => First_Project);
First_Project := Project_Lists.Last;
-- Is the naming scheme of this project one that we know?
Current_Naming := Default_Naming;
while Current_Naming <= Namings.Last and then
not Same_Naming_Scheme
(Left => Namings.Table (Current_Naming),
Right => Data.Naming) loop
Current_Naming := Current_Naming + 1;
end loop;
-- If we don't know it, add it
if Current_Naming > Namings.Last then
Namings.Increment_Last;
Namings.Table (Namings.Last) := Data.Naming;
-- We need a temporary file to be created
Check_Temp_File;
-- Put the SFN pragmas for the naming scheme
-- Spec
Put_Line
(File, "pragma Source_File_Name");
Put_Line
(File, " (Spec_File_Name => ""*" &
Namet.Get_Name_String (Data.Naming.Current_Spec_Suffix) &
""",");
Put_Line
(File, " Casing => " &
Image (Data.Naming.Casing) & ",");
Put_Line
(File, " Dot_Replacement => """ &
Namet.Get_Name_String (Data.Naming.Dot_Replacement) &
""");");
-- and body
Put_Line
(File, "pragma Source_File_Name");
Put_Line
(File, " (Body_File_Name => ""*" &
Namet.Get_Name_String (Data.Naming.Current_Impl_Suffix) &
""",");
Put_Line
(File, " Casing => " &
Image (Data.Naming.Casing) & ",");
Put_Line
(File, " Dot_Replacement => """ &
Namet.Get_Name_String (Data.Naming.Dot_Replacement) &
""");");
-- and maybe separate
if
Data.Naming.Current_Impl_Suffix /= Data.Naming.Separate_Suffix
then
Put_Line
(File, "pragma Source_File_Name");
Put_Line
(File, " (Subunit_File_Name => ""*" &
Namet.Get_Name_String (Data.Naming.Separate_Suffix) &
""",");
Put_Line
(File, " Casing => " &
Image (Data.Naming.Casing) &
",");
Put_Line
(File, " Dot_Replacement => """ &
Namet.Get_Name_String (Data.Naming.Dot_Replacement) &
""");");
end if;
end if;
if Data.Modifies /= No_Project then
Check (Data.Modifies);
end if;
declare
Current : Project_List := Data.Imported_Projects;
begin
while Current /= Empty_Project_List loop
Check (Project_Lists.Table (Current).Project);
Current := Project_Lists.Table (Current).Next;
end loop;
end;
end if;
end Check;
---------------------
-- Check_Temp_File --
---------------------
procedure Check_Temp_File is
begin
if File = Invalid_FD then
GNAT.OS_Lib.Create_Temp_File (File, Name => File_Name);
if File = Invalid_FD then
Osint.Fail
("unable to create temporary configuration pragmas file");
elsif Opt.Verbose_Mode then
Write_Str ("Creating temp file """);
Write_Str (File_Name);
Write_Line ("""");
end if;
end if;
end Check_Temp_File;
---------------
-- Copy_File --
---------------
procedure Copy_File (Name : in String_Id) is
Input : File_Descriptor;
Buffer : String (1 .. 1_000);
Input_Length : Integer;
Output_Length : Integer;
begin
Check_Temp_File;
String_To_Name_Buffer (Name);
if Opt.Verbose_Mode then
Write_Str ("Copying config pragmas file """);
Write_Str (Name_Buffer (1 .. Name_Len));
Write_Line (""" into temp file");
end if;
declare
Name : constant String :=
Name_Buffer (1 .. Name_Len) & ASCII.NUL;
begin
Input := Open_Read (Name'Address, Binary);
end;
if Input = Invalid_FD then
Osint.Fail
("cannot open configuration pragmas file " &
Name_Buffer (1 .. Name_Len));
end if;
loop
Input_Length := Read (Input, Buffer'Address, Buffer'Length);
Output_Length := Write (File, Buffer'Address, Input_Length);
if Output_Length /= Input_Length then
Osint.Fail ("disk full");
end if;
exit when Input_Length < Buffer'Length;
end loop;
Close (Input);
end Copy_File;
---------
-- Put --
---------
procedure Put
(Unit_Name : Name_Id;
File_Name : Name_Id;
Unit_Kind : Spec_Or_Body)
is
begin
-- A temporary file needs to be open
Check_Temp_File;
-- Put the pragma SFN for the unit kind (spec or body)
Put (File, "pragma Source_File_Name (");
Put (File, Namet.Get_Name_String (Unit_Name));
if Unit_Kind = Specification then
Put (File, ", Spec_File_Name => """);
else
Put (File, ", Body_File_Name => """);
end if;
Put (File, Namet.Get_Name_String (File_Name));
Put_Line (File, """);");
end Put;
procedure Put (File : File_Descriptor; S : String) is
Last : Natural;
begin
Last := Write (File, S (S'First)'Address, S'Length);
if Last /= S'Length then
Osint.Fail ("Disk full");
end if;
if Current_Verbosity = High then
Write_Str (S);
end if;
end Put;
--------------
-- Put_Line --
--------------
procedure Put_Line (File : File_Descriptor; S : String) is
S0 : String (1 .. S'Length + 1);
Last : Natural;
begin
-- Add an ASCII.LF to the string. As this gnat.adc
-- is supposed to be used only by the compiler, we don't
-- care about the characters for the end of line.
-- The truth is we could have put a space, but it is
-- more convenient to be able to read gnat.adc during
-- development. And the development was done under UNIX.
-- Hence the ASCII.LF.
S0 (1 .. S'Length) := S;
S0 (S0'Last) := ASCII.LF;
Last := Write (File, S0'Address, S0'Length);
if Last /= S'Length + 1 then
Osint.Fail ("Disk full");
end if;
if Current_Verbosity = High then
Write_Line (S);
end if;
end Put_Line;
-- Start of processing for Create_Config_Pragmas_File
begin
if not Projects.Table (For_Project).Config_Checked then
-- Remove any memory of processed naming schemes, if any
Namings.Set_Last (Default_Naming);
-- Check the naming schemes
Check (For_Project);
-- Visit all the units and process those that need an SFN pragma
while Current_Unit <= Units.Last loop
declare
Unit : constant Unit_Data :=
Units.Table (Current_Unit);
begin
if Unit.File_Names (Specification).Needs_Pragma then
Put (Unit.Name,
Unit.File_Names (Specification).Name,
Specification);
end if;
if Unit.File_Names (Body_Part).Needs_Pragma then
Put (Unit.Name,
Unit.File_Names (Body_Part).Name,
Body_Part);
end if;
Current_Unit := Current_Unit + 1;
end;
end loop;
The_Packages := Projects.Table (Main_Project).Decl.Packages;
Gnatmake :=
Prj.Util.Value_Of
(Name => Name_Builder,
In_Packages => The_Packages);
if Gnatmake /= No_Package then
Global_Attribute := Prj.Util.Value_Of
(Variable_Name => Global_Configuration_Pragmas,
In_Variables => Packages.Table (Gnatmake).Decl.Attributes);
Global_Attribute_Present :=
Global_Attribute /= Nil_Variable_Value
and then String_Length (Global_Attribute.Value) > 0;
end if;
The_Packages := Projects.Table (For_Project).Decl.Packages;
Compiler :=
Prj.Util.Value_Of
(Name => Name_Compiler,
In_Packages => The_Packages);
if Compiler /= No_Package then
Local_Attribute := Prj.Util.Value_Of
(Variable_Name => Local_Configuration_Pragmas,
In_Variables => Packages.Table (Compiler).Decl.Attributes);
Local_Attribute_Present :=
Local_Attribute /= Nil_Variable_Value
and then String_Length (Local_Attribute.Value) > 0;
end if;
if Global_Attribute_Present then
if File /= Invalid_FD
or else Local_Attribute_Present
then
Copy_File (Global_Attribute.Value);
else
String_To_Name_Buffer (Global_Attribute.Value);
Projects.Table (For_Project).Config_File_Name := Name_Find;
end if;
end if;
if Local_Attribute_Present then
if File /= Invalid_FD then
Copy_File (Local_Attribute.Value);
else
String_To_Name_Buffer (Local_Attribute.Value);
Projects.Table (For_Project).Config_File_Name := Name_Find;
end if;
end if;
if File /= Invalid_FD then
GNAT.OS_Lib.Close (File);
if Opt.Verbose_Mode then
Write_Str ("Closing configuration file """);
Write_Str (File_Name);
Write_Line ("""");
end if;
Name_Len := File_Name'Length;
Name_Buffer (1 .. Name_Len) := File_Name;
Projects.Table (For_Project).Config_File_Name := Name_Find;
Projects.Table (For_Project).Config_File_Temp := True;
end if;
Projects.Table (For_Project).Config_Checked := True;
end if;
end Create_Config_Pragmas_File;
-------------------------
-- Create_Mapping_File --
-------------------------
procedure Create_Mapping_File (Name : in out Temp_File_Name) is
File : File_Descriptor := Invalid_FD;
The_Unit_Data : Unit_Data;
Data : File_Name_Data;
procedure Put (S : String);
-- Put a line in the mapping file
procedure Put_Data (Spec : Boolean);
-- Put the mapping of the spec or body contained in Data in the file
-- (3 lines).
---------
-- Put --
---------
procedure Put (S : String) is
Last : Natural;
begin
Last := Write (File, S'Address, S'Length);
if Last /= S'Length then
Osint.Fail ("Disk full");
end if;
end Put;
--------------
-- Put_Data --
--------------
procedure Put_Data (Spec : Boolean) is
begin
Put (Get_Name_String (The_Unit_Data.Name));
if Spec then
Put ("%s");
else
Put ("%b");
end if;
Put (S => (1 => ASCII.LF));
Put (Get_Name_String (Data.Name));
Put (S => (1 => ASCII.LF));
Put (Get_Name_String (Data.Path));
Put (S => (1 => ASCII.LF));
end Put_Data;
-- Start of processing for Create_Mapping_File
begin
GNAT.OS_Lib.Create_Temp_File (File, Name => Name);
if File = Invalid_FD then
Osint.Fail
("unable to create temporary mapping file");
elsif Opt.Verbose_Mode then
Write_Str ("Creating temp mapping file """);
Write_Str (Name);
Write_Line ("""");
end if;
-- For all units in table Units
for Unit in 1 .. Units.Last loop
The_Unit_Data := Units.Table (Unit);
-- If the unit has a valid name
if The_Unit_Data.Name /= No_Name then
Data := The_Unit_Data.File_Names (Specification);
-- If there is a spec, put it mapping in the file
if Data.Name /= No_Name then
Put_Data (Spec => True);
end if;
Data := The_Unit_Data.File_Names (Body_Part);
-- If there is a body (or subunit) put its mapping in the file
if Data.Name /= No_Name then
Put_Data (Spec => False);
end if;
end if;
end loop;
GNAT.OS_Lib.Close (File);
end Create_Mapping_File;
------------------------------------
-- File_Name_Of_Library_Unit_Body --
------------------------------------
function File_Name_Of_Library_Unit_Body
(Name : String;
Project : Project_Id)
return String
is
Data : constant Project_Data := Projects.Table (Project);
Original_Name : String := Name;
Extended_Spec_Name : String :=
Name & Namet.Get_Name_String
(Data.Naming.Current_Spec_Suffix);
Extended_Body_Name : String :=
Name & Namet.Get_Name_String
(Data.Naming.Current_Impl_Suffix);
Unit : Unit_Data;
The_Original_Name : Name_Id;
The_Spec_Name : Name_Id;
The_Body_Name : Name_Id;
begin
Canonical_Case_File_Name (Original_Name);
Name_Len := Original_Name'Length;
Name_Buffer (1 .. Name_Len) := Original_Name;
The_Original_Name := Name_Find;
Canonical_Case_File_Name (Extended_Spec_Name);
Name_Len := Extended_Spec_Name'Length;
Name_Buffer (1 .. Name_Len) := Extended_Spec_Name;
The_Spec_Name := Name_Find;
Canonical_Case_File_Name (Extended_Body_Name);
Name_Len := Extended_Body_Name'Length;
Name_Buffer (1 .. Name_Len) := Extended_Body_Name;
The_Body_Name := Name_Find;
if Current_Verbosity = High then
Write_Str ("Looking for file name of """);
Write_Str (Name);
Write_Char ('"');
Write_Eol;
Write_Str (" Extended Spec Name = """);
Write_Str (Extended_Spec_Name);
Write_Char ('"');
Write_Eol;
Write_Str (" Extended Body Name = """);
Write_Str (Extended_Body_Name);
Write_Char ('"');
Write_Eol;
end if;
-- For every unit
for Current in reverse Units.First .. Units.Last loop
Unit := Units.Table (Current);
-- Case of unit of the same project
if Unit.File_Names (Body_Part).Project = Project then
declare
Current_Name : constant Name_Id :=
Unit.File_Names (Body_Part).Name;
begin
-- Case of a body present
if Current_Name /= No_Name then
if Current_Verbosity = High then
Write_Str (" Comparing with """);
Write_Str (Get_Name_String (Current_Name));
Write_Char ('"');
Write_Eol;
end if;
-- If it has the name of the original name,
-- return the original name
if Unit.Name = The_Original_Name
or else Current_Name = The_Original_Name
then
if Current_Verbosity = High then
Write_Line (" OK");
end if;
return Get_Name_String (Current_Name);
-- If it has the name of the extended body name,
-- return the extended body name
elsif Current_Name = The_Body_Name then
if Current_Verbosity = High then
Write_Line (" OK");
end if;
return Extended_Body_Name;
else
if Current_Verbosity = High then
Write_Line (" not good");
end if;
end if;
end if;
end;
end if;
-- Case of a unit of the same project
if Units.Table (Current).File_Names (Specification).Project =
Project
then
declare
Current_Name : constant Name_Id :=
Unit.File_Names (Specification).Name;
begin
-- Case of spec present
if Current_Name /= No_Name then
if Current_Verbosity = High then
Write_Str (" Comparing with """);
Write_Str (Get_Name_String (Current_Name));
Write_Char ('"');
Write_Eol;
end if;
-- If name same as the original name, return original name
if Unit.Name = The_Original_Name
or else Current_Name = The_Original_Name
then
if Current_Verbosity = High then
Write_Line (" OK");
end if;
return Get_Name_String (Current_Name);
-- If it has the same name as the extended spec name,
-- return the extended spec name.
elsif Current_Name = The_Spec_Name then
if Current_Verbosity = High then
Write_Line (" OK");
end if;
return Extended_Spec_Name;
else
if Current_Verbosity = High then
Write_Line (" not good");
end if;
end if;
end if;
end;
end if;
end loop;
-- We don't know this file name, return an empty string
return "";
end File_Name_Of_Library_Unit_Body;
-------------------------
-- For_All_Object_Dirs --
-------------------------
procedure For_All_Object_Dirs (Project : Project_Id) is
Seen : Project_List := Empty_Project_List;
procedure Add (Project : Project_Id);
-- Process a project. Remember the processes visited to avoid
-- processing a project twice. Recursively process an eventual
-- modified project, and all imported projects.
---------
-- Add --
---------
procedure Add (Project : Project_Id) is
Data : constant Project_Data := Projects.Table (Project);
List : Project_List := Data.Imported_Projects;
begin
-- If the list of visited project is empty, then
-- for sure we never visited this project.
if Seen = Empty_Project_List then
Project_Lists.Increment_Last;
Seen := Project_Lists.Last;
Project_Lists.Table (Seen) :=
(Project => Project, Next => Empty_Project_List);
else
-- Check if the project is in the list
declare
Current : Project_List := Seen;
begin
loop
-- If it is, then there is nothing else to do
if Project_Lists.Table (Current).Project = Project then
return;
end if;
exit when Project_Lists.Table (Current).Next =
Empty_Project_List;
Current := Project_Lists.Table (Current).Next;
end loop;
-- This project has never been visited, add it
-- to the list.
Project_Lists.Increment_Last;
Project_Lists.Table (Current).Next := Project_Lists.Last;
Project_Lists.Table (Project_Lists.Last) :=
(Project => Project, Next => Empty_Project_List);
end;
end if;
-- If there is an object directory, call Action
-- with its name
if Data.Object_Directory /= No_Name then
Get_Name_String (Data.Object_Directory);
Action (Name_Buffer (1 .. Name_Len));
end if;
-- If we are extending a project, visit it
if Data.Modifies /= No_Project then
Add (Data.Modifies);
end if;
-- And visit all imported projects
while List /= Empty_Project_List loop
Add (Project_Lists.Table (List).Project);
List := Project_Lists.Table (List).Next;
end loop;
end Add;
-- Start of processing for For_All_Object_Dirs
begin
-- Visit this project, and its imported projects,
-- recursively
Add (Project);
end For_All_Object_Dirs;
-------------------------
-- For_All_Source_Dirs --
-------------------------
procedure For_All_Source_Dirs (Project : Project_Id) is
Seen : Project_List := Empty_Project_List;
procedure Add (Project : Project_Id);
-- Process a project. Remember the processes visited to avoid
-- processing a project twice. Recursively process an eventual
-- modified project, and all imported projects.
---------
-- Add --
---------
procedure Add (Project : Project_Id) is
Data : constant Project_Data := Projects.Table (Project);
List : Project_List := Data.Imported_Projects;
begin
-- If the list of visited project is empty, then
-- for sure we never visited this project.
if Seen = Empty_Project_List then
Project_Lists.Increment_Last;
Seen := Project_Lists.Last;
Project_Lists.Table (Seen) :=
(Project => Project, Next => Empty_Project_List);
else
-- Check if the project is in the list
declare
Current : Project_List := Seen;
begin
loop
-- If it is, then there is nothing else to do
if Project_Lists.Table (Current).Project = Project then
return;
end if;
exit when Project_Lists.Table (Current).Next =
Empty_Project_List;
Current := Project_Lists.Table (Current).Next;
end loop;
-- This project has never been visited, add it
-- to the list.
Project_Lists.Increment_Last;
Project_Lists.Table (Current).Next := Project_Lists.Last;
Project_Lists.Table (Project_Lists.Last) :=
(Project => Project, Next => Empty_Project_List);
end;
end if;
declare
Current : String_List_Id := Data.Source_Dirs;
The_String : String_Element;
begin
-- Call action with the name of every source directorie
while Current /= Nil_String loop
The_String := String_Elements.Table (Current);
String_To_Name_Buffer (The_String.Value);
Action (Name_Buffer (1 .. Name_Len));
Current := The_String.Next;
end loop;
end;
-- If we are extending a project, visit it
if Data.Modifies /= No_Project then
Add (Data.Modifies);
end if;
-- And visit all imported projects
while List /= Empty_Project_List loop
Add (Project_Lists.Table (List).Project);
List := Project_Lists.Table (List).Next;
end loop;
end Add;
-- Start of processing for For_All_Source_Dirs
begin
-- Visit this project, and its imported projects recursively
Add (Project);
end For_All_Source_Dirs;
-------------------
-- Get_Reference --
-------------------
procedure Get_Reference
(Source_File_Name : String;
Project : out Project_Id;
Path : out Name_Id)
is
begin
if Current_Verbosity > Default then
Write_Str ("Getting Reference_Of (""");
Write_Str (Source_File_Name);
Write_Str (""") ... ");
end if;
declare
Original_Name : String := Source_File_Name;
Unit : Unit_Data;
begin
Canonical_Case_File_Name (Original_Name);
for Id in Units.First .. Units.Last loop
Unit := Units.Table (Id);
if (Unit.File_Names (Specification).Name /= No_Name
and then
Namet.Get_Name_String
(Unit.File_Names (Specification).Name) = Original_Name)
or else (Unit.File_Names (Specification).Path /= No_Name
and then
Namet.Get_Name_String
(Unit.File_Names (Specification).Path) =
Original_Name)
then
Project := Unit.File_Names (Specification).Project;
Path := Unit.File_Names (Specification).Path;
if Current_Verbosity > Default then
Write_Str ("Done: Specification.");
Write_Eol;
end if;
return;
elsif (Unit.File_Names (Body_Part).Name /= No_Name
and then
Namet.Get_Name_String
(Unit.File_Names (Body_Part).Name) = Original_Name)
or else (Unit.File_Names (Body_Part).Path /= No_Name
and then Namet.Get_Name_String
(Unit.File_Names (Body_Part).Path) =
Original_Name)
then
Project := Unit.File_Names (Body_Part).Project;
Path := Unit.File_Names (Body_Part).Path;
if Current_Verbosity > Default then
Write_Str ("Done: Body.");
Write_Eol;
end if;
return;
end if;
end loop;
end;
Project := No_Project;
Path := No_Name;
if Current_Verbosity > Default then
Write_Str ("Cannot be found.");
Write_Eol;
end if;
end Get_Reference;
----------------
-- Initialize --
----------------
procedure Initialize is
Global : constant String := "global_configuration_pragmas";
Local : constant String := "local_configuration_pragmas";
begin
-- Put the standard GNAT naming scheme in the Namings table
Namings.Increment_Last;
Namings.Table (Namings.Last) := Standard_Naming_Data;
Name_Len := Global'Length;
Name_Buffer (1 .. Name_Len) := Global;
Global_Configuration_Pragmas := Name_Find;
Name_Len := Local'Length;
Name_Buffer (1 .. Name_Len) := Local;
Local_Configuration_Pragmas := Name_Find;
end Initialize;
------------------------------------
-- Path_Name_Of_Library_Unit_Body --
------------------------------------
function Path_Name_Of_Library_Unit_Body
(Name : String;
Project : Project_Id)
return String
is
Data : constant Project_Data := Projects.Table (Project);
Original_Name : String := Name;
Extended_Spec_Name : String :=
Name & Namet.Get_Name_String
(Data.Naming.Current_Spec_Suffix);
Extended_Body_Name : String :=
Name & Namet.Get_Name_String
(Data.Naming.Current_Impl_Suffix);
First : Unit_Id := Units.First;
Current : Unit_Id;
Unit : Unit_Data;
begin
Canonical_Case_File_Name (Original_Name);
Canonical_Case_File_Name (Extended_Spec_Name);
Canonical_Case_File_Name (Extended_Spec_Name);
if Current_Verbosity = High then
Write_Str ("Looking for path name of """);
Write_Str (Name);
Write_Char ('"');
Write_Eol;
Write_Str (" Extended Spec Name = """);
Write_Str (Extended_Spec_Name);
Write_Char ('"');
Write_Eol;
Write_Str (" Extended Body Name = """);
Write_Str (Extended_Body_Name);
Write_Char ('"');
Write_Eol;
end if;
while First <= Units.Last
and then Units.Table (First).File_Names (Body_Part).Project /= Project
loop
First := First + 1;
end loop;
Current := First;
while Current <= Units.Last loop
Unit := Units.Table (Current);
if Unit.File_Names (Body_Part).Project = Project
and then Unit.File_Names (Body_Part).Name /= No_Name
then
declare
Current_Name : constant String :=
Namet.Get_Name_String (Unit.File_Names (Body_Part).Name);
begin
if Current_Verbosity = High then
Write_Str (" Comparing with """);
Write_Str (Current_Name);
Write_Char ('"');
Write_Eol;
end if;
if Current_Name = Original_Name then
if Current_Verbosity = High then
Write_Line (" OK");
end if;
return Body_Path_Name_Of (Current);
elsif Current_Name = Extended_Body_Name then
if Current_Verbosity = High then
Write_Line (" OK");
end if;
return Body_Path_Name_Of (Current);
else
if Current_Verbosity = High then
Write_Line (" not good");
end if;
end if;
end;
elsif Unit.File_Names (Specification).Name /= No_Name then
declare
Current_Name : constant String :=
Namet.Get_Name_String
(Unit.File_Names (Specification).Name);
begin
if Current_Verbosity = High then
Write_Str (" Comparing with """);
Write_Str (Current_Name);
Write_Char ('"');
Write_Eol;
end if;
if Current_Name = Original_Name then
if Current_Verbosity = High then
Write_Line (" OK");
end if;
return Spec_Path_Name_Of (Current);
elsif Current_Name = Extended_Spec_Name then
if Current_Verbosity = High then
Write_Line (" OK");
end if;
return Spec_Path_Name_Of (Current);
else
if Current_Verbosity = High then
Write_Line (" not good");
end if;
end if;
end;
end if;
Current := Current + 1;
end loop;
return "";
end Path_Name_Of_Library_Unit_Body;
-------------------
-- Print_Sources --
-------------------
procedure Print_Sources is
Unit : Unit_Data;
begin
Write_Line ("List of Sources:");
for Id in Units.First .. Units.Last loop
Unit := Units.Table (Id);
Write_Str (" ");
Write_Line (Namet.Get_Name_String (Unit.Name));
if Unit.File_Names (Specification).Name /= No_Name then
if Unit.File_Names (Specification).Project = No_Project then
Write_Line (" No project");
else
Write_Str (" Project: ");
Get_Name_String
(Projects.Table
(Unit.File_Names (Specification).Project).Path_Name);
Write_Line (Name_Buffer (1 .. Name_Len));
end if;
Write_Str (" spec: ");
Write_Line
(Namet.Get_Name_String
(Unit.File_Names (Specification).Name));
end if;
if Unit.File_Names (Body_Part).Name /= No_Name then
if Unit.File_Names (Body_Part).Project = No_Project then
Write_Line (" No project");
else
Write_Str (" Project: ");
Get_Name_String
(Projects.Table
(Unit.File_Names (Body_Part).Project).Path_Name);
Write_Line (Name_Buffer (1 .. Name_Len));
end if;
Write_Str (" body: ");
Write_Line
(Namet.Get_Name_String
(Unit.File_Names (Body_Part).Name));
end if;
end loop;
Write_Line ("end of List of Sources.");
end Print_Sources;
-----------------------
-- Spec_Path_Name_Of --
-----------------------
function Spec_Path_Name_Of (Unit : Unit_Id) return String is
Data : Unit_Data := Units.Table (Unit);
begin
if Data.File_Names (Specification).Path = No_Name then
declare
Current_Source : String_List_Id :=
Projects.Table (Data.File_Names (Specification).Project).Sources;
Path : GNAT.OS_Lib.String_Access;
begin
Data.File_Names (Specification).Path :=
Data.File_Names (Specification).Name;
while Current_Source /= Nil_String loop
String_To_Name_Buffer
(String_Elements.Table (Current_Source).Value);
Path := Locate_Regular_File
(Namet.Get_Name_String
(Data.File_Names (Specification).Name),
Name_Buffer (1 .. Name_Len));
if Path /= null then
Name_Len := Path'Length;
Name_Buffer (1 .. Name_Len) := Path.all;
Data.File_Names (Specification).Path := Name_Enter;
exit;
else
Current_Source :=
String_Elements.Table (Current_Source).Next;
end if;
end loop;
Units.Table (Unit) := Data;
end;
end if;
return Namet.Get_Name_String (Data.File_Names (Specification).Path);
end Spec_Path_Name_Of;
end Prj.Env;
|
src/curve25519_mult.adb | joffreyhuguet/curve25519-spark2014 | 4 | 22059 | <gh_stars>1-10
with Multiply_Proof; use Multiply_Proof;
package body Curve25519_Mult with
SPARK_Mode
is
--------------
-- Multiply --
--------------
function Multiply (X, Y : Integer_255) return Product_Integer is
Product : Product_Integer := (others => 0);
begin
for J in Index_Type loop
for K in Index_Type loop
Product (J + K) :=
Product (J + K)
+ X (J) * Y (K) * (if J mod 2 = 1 and then K mod 2 = 1 then 2 else 1);
Partial_Product_Def (X, Y, J, K);
-- Reminding definition of Partial_Product
pragma Loop_Invariant ((for all L in 0 .. J - 1 =>
Product (L) = Product'Loop_Entry (L))
and then
(for all L in J + K + 1 .. 18 =>
Product (L) = Product'Loop_Entry (L)));
-- To signify at which indexes content has not been changed
pragma Loop_Invariant (for all L in J .. J + K =>
Product (L) = Partial_Product (X, Y, J, L - J));
-- Increasingly proving the value of Product (L)
end loop;
pragma Loop_Invariant (for all L in J + 10 .. 18 =>
Product (L) = Product'Loop_Entry (L));
-- To signify at which indexes content has not been changed
pragma Loop_Invariant (for all L in Product_Index_Type =>
Product (L) in
(-2) * Long_Long_Integer (J + 1) * (2**27 - 1)**2
..
2 * Long_Long_Integer (J + 1) * (2**27 - 1)**2);
-- To prove overflow checks
pragma Loop_Invariant (for all L in 0 .. J + 9 =>
Product (L) = Array_Step_J (X, Y, J) (L));
-- Product is partially equal to Array_Step_J (X, Y, J);
end loop;
Prove_Multiply (X, Y, Product);
return Product;
end Multiply;
end Curve25519_Mult;
|
include/gid/gid-decoding_bmp.adb | docandrew/troodon | 5 | 24963 | with GID.Buffering; use GID.Buffering;
package body GID.Decoding_BMP is
procedure Load (image: in out Image_descriptor) is
b01, b, br, bg, bb: U8:= 0;
x, x_max, y: Natural;
--
function Times_257(x: Primary_color_range) return Primary_color_range is
pragma Inline(Times_257);
begin
return 16 * (16 * x) + x; -- this is 257 * x, = 16#0101# * x
-- Numbers 8-bit -> no OA warning at instanciation. Returns x if type Primary_color_range is mod 2**8.
end Times_257;
full_opaque: constant Primary_color_range:= Primary_color_range'Last;
--
procedure Pixel_with_palette is
pragma Inline(Pixel_with_palette);
begin
case Primary_color_range'Modulus is
when 256 =>
Put_Pixel(
Primary_color_range(image.palette(Integer(b)).red),
Primary_color_range(image.palette(Integer(b)).green),
Primary_color_range(image.palette(Integer(b)).blue),
full_opaque
);
when 65_536 =>
Put_Pixel(
Times_257(Primary_color_range(image.palette(Integer(b)).red)),
Times_257(Primary_color_range(image.palette(Integer(b)).green)),
Times_257(Primary_color_range(image.palette(Integer(b)).blue)),
-- Times_257 makes max intensity FF go to FFFF
full_opaque
);
when others =>
raise invalid_primary_color_range with "BMP: color range not supported";
end case;
end Pixel_with_palette;
--
pair: Boolean;
bit: Natural range 0..7;
--
line_bits: constant Float:= Float(image.width * Positive_32 (image.bits_per_pixel));
padded_line_size: constant Positive:= 4 * Integer(Float'Ceiling(line_bits / 32.0));
unpadded_line_size: constant Positive:= Integer(Float'Ceiling(line_bits / 8.0));
-- (in bytes)
begin
Attach_Stream(image.buffer, image.stream);
y:= 0;
while y <= Integer (image.height) - 1 loop
x:= 0;
x_max:= Integer (image.width) - 1;
case image.bits_per_pixel is
when 1 => -- B/W
bit:= 0;
Set_X_Y(x,y);
while x <= x_max loop
if bit=0 then
Get_Byte(image.buffer, b01);
end if;
b:= (b01 and 16#80#) / 16#80#;
Pixel_with_palette;
b01:= b01 * 2; -- cannot overflow.
if bit=7 then
bit:= 0;
else
bit:= bit + 1;
end if;
x:= x + 1;
end loop;
when 4 => -- 16 colour image
pair:= True;
Set_X_Y(x,y);
while x <= x_max loop
if pair then
Get_Byte(image.buffer, b01);
b:= (b01 and 16#F0#) / 16#10#;
else
b:= (b01 and 16#0F#);
end if;
pair:= not pair;
Pixel_with_palette;
x:= x + 1;
end loop;
when 8 => -- 256 colour image
Set_X_Y(x,y);
while x <= x_max loop
Get_Byte(image.buffer, b);
Pixel_with_palette;
x:= x + 1;
end loop;
when 24 => -- RGB, 256 colour per primary colour
Set_X_Y(x,y);
while x <= x_max loop
Get_Byte(image.buffer, bb);
Get_Byte(image.buffer, bg);
Get_Byte(image.buffer, br);
case Primary_color_range'Modulus is
when 256 =>
Put_Pixel(
Primary_color_range(br),
Primary_color_range(bg),
Primary_color_range(bb),
full_opaque
);
when 65_536 =>
Put_Pixel(
Times_257(Primary_color_range(br)),
Times_257(Primary_color_range(bg)),
Times_257(Primary_color_range(bb)),
-- Times_257 makes max intensity FF go to FFFF
full_opaque
);
when others =>
raise invalid_primary_color_range with "BMP: color range not supported";
end case;
x:= x + 1;
end loop;
when others =>
null;
end case;
for i in unpadded_line_size + 1 .. padded_line_size loop
Get_Byte(image.buffer, b);
end loop;
y:= y + 1;
Feedback((y*100) / Integer (image.height));
end loop;
end Load;
end GID.Decoding_BMP;
|
bad.asm | despinoza1/sic-assembler | 0 | 175578 | .
. Assembly file with many errors
.
BAD START
FIRST LDDX ZERO INITIALIZE REGISTERS
LDA ZERO
1LOOP ADD TABLE,X ADD THE ELEMENTS
TIX COUNT ARE WE DONE?
l337@ JLT LOOP IF NOT, LOOP
TOOLONG STA TOTAL STORE THE TOTAL
RSUB AND RETURN
TABLE RESW 20000 FOR THE ARRAY
COUNT RESW 1 NUMBER OF ELEMENTS
ZERO WORD 0 CONSTANT
ZERO BYTE
TOTAL RESW 1 PLACE FOR TOTAL
. END FIRST
|
Cubical/Algebra/AbGroup/Instances/DiffInt.agda | FernandoLarrain/cubical | 301 | 17189 | <reponame>FernandoLarrain/cubical<gh_stars>100-1000
-- It is recommended to use Cubical.Algebra.CommRing.Instances.Int
-- instead of this file.
{-# OPTIONS --safe #-}
module Cubical.Algebra.AbGroup.Instances.DiffInt where
open import Cubical.Foundations.Prelude
open import Cubical.HITs.SetQuotients
open import Cubical.Algebra.AbGroup.Base
open import Cubical.Data.Int.MoreInts.DiffInt
renaming (
_+_ to _+ℤ_
)
DiffℤasAbGroup : AbGroup ℓ-zero
DiffℤasAbGroup = makeAbGroup {G = ℤ}
[ (0 , 0) ]
_+ℤ_
-ℤ_
ℤ-isSet
+ℤ-assoc
(λ x → zero-identityʳ 0 x)
(λ x → -ℤ-invʳ x)
+ℤ-comm
|
libsrc/stdio/conio/vpeek_screendollar.asm | Frodevan/z88dk | 640 | 161355 | <reponame>Frodevan/z88dk
SECTION code_clib
PUBLIC vpeek_screendollar
EXTERN screendollar
EXTERN screendollar_with_count
EXTERN generic_console_font32
EXTERN generic_console_udg32
; Match character in buffer on stack to the font
;
; Entry on stack: address of buffer, 8 bytes of buffer
vpeek_screendollar:
IF __CPU_GBZ80__
INCLUDE "target/gb/def/gb_globals.def"
ld hl,generic_console_font32
ld a,(hl+)
ld h,(hl)
ld l,a
; Gameboy fonts are in GBDK format. We're making the bold assumption that if
; we're assembled for GBZ80 then we are on the gameboy
ld a,(hl+) ;Font type
inc hl ;Skips to the start of encoding table if present
and 3
ld de,128
cp FONT_128ENCODING
jr z,add_offset
ld de,0
cp FONT_NOENCODING
jr z,add_offset
ld d,1
add_offset:
add hl,de ;Now points to the font set
pop de ;The buffer on the stack
ld b,128 ;Gameboy fonts are 128 bytes (with graphics 0-31)
call screendollar_with_count
ELSE
ld hl,(generic_console_font32)
pop de ;the buffer on the stack
call screendollar
ENDIF
jr nc,gotit
IF __CPU_GBZ80__
ld hl,generic_console_udg32
ld a,(hl+)
ld h,(hl)
ld l,a
ELSE
ld hl,(generic_console_udg32)
ENDIF
ld b,128
call screendollar_with_count
jr c,gotit
add 128
gotit:
IF __CPU_GBZ80__ | __CPU_INTEL__
push af
pop bc
ELSE
ex af,af ; Save those flags
ENDIF
IF __CPU_GBZ80__
add sp,8
ELSE
ld hl,8 ; Dump our temporary buffer
add hl,sp
ld sp,hl
ENDIF
IF __CPU_GBZ80__ | __CPU_INTEL__
push bc
pop af
ELSE
ex af,af ; Flags and parameter back
ENDIF
ret
|
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0_notsx.log_21829_1745.asm | ljhsiun2/medusa | 9 | 241768 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0xb215, %r11
nop
nop
nop
nop
nop
and $19044, %rdx
movw $0x6162, (%r11)
nop
nop
nop
nop
sub $30205, %r8
lea addresses_D_ht+0xa2ad, %rsi
lea addresses_WT_ht+0x1dd1d, %rdi
nop
nop
nop
sub %r9, %r9
mov $2, %rcx
rep movsl
nop
nop
xor $2417, %r9
lea addresses_D_ht+0x18715, %r9
add %rdi, %rdi
mov (%r9), %cx
nop
nop
nop
nop
nop
lfence
lea addresses_WT_ht+0xa789, %rsi
lea addresses_D_ht+0xcccd, %rdi
nop
nop
nop
nop
inc %r8
mov $88, %rcx
rep movsl
nop
nop
nop
nop
nop
and $23234, %rdi
lea addresses_UC_ht+0x13db5, %rsi
nop
nop
xor %rdi, %rdi
vmovups (%rsi), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $1, %xmm7, %rcx
and $31384, %rsi
lea addresses_normal_ht+0x43d4, %rsi
lea addresses_D_ht+0xffad, %rdi
nop
nop
nop
nop
add %rdx, %rdx
mov $40, %rcx
rep movsl
nop
nop
nop
nop
nop
dec %rsi
lea addresses_A_ht+0x19615, %r12
inc %rcx
mov $0x6162636465666768, %r8
movq %r8, %xmm1
movups %xmm1, (%r12)
nop
nop
cmp %rdx, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r8
push %rax
push %rbx
push %rdx
push %rsi
// Load
lea addresses_normal+0x68f5, %rdx
nop
nop
nop
cmp %r12, %r12
movb (%rdx), %bl
and $46338, %rdx
// Store
lea addresses_RW+0x10155, %r8
nop
add $61450, %r14
movl $0x51525354, (%r8)
nop
nop
inc %rdx
// Faulty Load
lea addresses_A+0xde15, %rdx
nop
nop
nop
nop
add %rax, %rax
movb (%rdx), %bl
lea oracles, %r8
and $0xff, %rbx
shlq $12, %rbx
mov (%r8,%rbx,1), %rbx
pop %rsi
pop %rdx
pop %rbx
pop %rax
pop %r8
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 6}}
[Faulty Load]
{'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 7}}
{'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 4}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 11}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
test/succeed/IndexOnBuiltin.agda | asr/agda-kanso | 1 | 6343 | <filename>test/succeed/IndexOnBuiltin.agda
module IndexOnBuiltin where
data Nat : Set where
zero : Nat
suc : Nat -> Nat
{-# BUILTIN NATURAL Nat #-}
{-# BUILTIN ZERO zero #-}
{-# BUILTIN SUC suc #-}
data Fin : Nat -> Set where
fz : {n : Nat} -> Fin (suc n)
fs : {n : Nat} -> Fin n -> Fin (suc n)
f : Fin 2 -> Fin 1
f fz = fz
f (fs i) = i
|
programs/oeis/004/A004524.asm | neoneye/loda | 22 | 171060 | <filename>programs/oeis/004/A004524.asm
; A004524: Three even followed by one odd.
; 0,0,0,1,2,2,2,3,4,4,4,5,6,6,6,7,8,8,8,9,10,10,10,11,12,12,12,13,14,14,14,15,16,16,16,17,18,18,18,19,20,20,20,21,22,22,22,23,24,24,24,25,26,26,26,27,28,28,28,29,30,30,30,31,32,32,32,33,34,34,34,35,36,36,36,37,38,38,38,39,40,40,40,41,42,42,42,43,44,44,44,45,46,46,46,47,48,48,48,49
mul $0,5
div $0,4
mul $0,4
div $0,10
|
Task/Compound-data-type/Ada/compound-data-type-3.ada | LaudateCorpus1/RosettaCodeData | 1 | 24211 | <filename>Task/Compound-data-type/Ada/compound-data-type-3.ada
type Person (Gender : Gender_Type) is record
Name : Name_String;
Age : Natural;
Weight : Float;
Case Gender is
when Male =>
Beard_Length : Float;
when Female =>
null;
end case;
end record;
|
programs/oeis/188/A188148.asm | karttu/loda | 0 | 26676 | <filename>programs/oeis/188/A188148.asm
; A188148: Number of 3-step self-avoiding walks on an n X n square summed over all starting positions.
; 0,8,44,104,188,296,428,584,764,968,1196,1448,1724,2024,2348,2696,3068,3464,3884,4328,4796,5288,5804,6344,6908,7496,8108,8744,9404,10088,10796,11528,12284,13064,13868,14696,15548,16424,17324,18248,19196,20168,21164,22184,23228,24296,25388,26504,27644,28808
pow $0,2
mul $0,12
trn $0,4
mov $1,$0
|
src/main/resources/SQLiteLexer.g4 | subhagho/qengine | 0 | 421 | /*
* The MIT License (MIT)
*
* Copyright (c) 2020 by <NAME>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Project : sqlite-parser; an ANTLR4 grammar for SQLite https://github.com/bkiers/sqlite-parser
* Developed by : <NAME>, <EMAIL>
*/
lexer grammar SQLiteLexer;
SCOL: ';';
DOT: '.';
OPEN_PAR: '(';
CLOSE_PAR: ')';
COMMA: ',';
ASSIGN: '=';
STAR: '*';
PLUS: '+';
MINUS: '-';
TILDE: '~';
PIPE2: '||';
DIV: '/';
MOD: '%';
LT2: '<<';
GT2: '>>';
AMP: '&';
PIPE: '|';
LT: '<';
LT_EQ: '<=';
GT: '>';
GT_EQ: '>=';
EQ: '==';
NOT_EQ1: '!=';
NOT_EQ2: '<>';
// http://www.sqlite.org/lang_keywords.html
ABORT: A B O R T;
ACTION: A C T I O N;
ADD: A D D;
AFTER: A F T E R;
ALL: A L L;
ALTER: A L T E R;
ANALYZE: A N A L Y Z E;
AND: A N D;
AS: A S;
ASC: A S C;
ATTACH: A T T A C H;
AUTOINCREMENT: A U T O I N C R E M E N T;
BEFORE: B E F O R E;
BEGIN: B E G I N;
BETWEEN: B E T W E E N;
BY: B Y;
CASCADE: C A S C A D E;
CASE: C A S E;
CAST: C A S T;
CHECK: C H E C K;
COLLATE: C O L L A T E;
COLUMN: C O L U M N;
COMMIT: C O M M I T;
CONFLICT: C O N F L I C T;
CONSTRAINT: C O N S T R A I N T;
CREATE: C R E A T E;
CROSS: C R O S S;
CURRENT_DATE: C U R R E N T '_' D A T E;
CURRENT_TIME: C U R R E N T '_' T I M E;
CURRENT_TIMESTAMP: C U R R E N T '_' T I M E S T A M P;
DATABASE: D A T A B A S E;
DEFAULT: D E F A U L T;
DEFERRABLE: D E F E R R A B L E;
DEFERRED: D E F E R R E D;
DELETE: D E L E T E;
DESC: D E S C;
DETACH: D E T A C H;
DISTINCT: D I S T I N C T;
DROP: D R O P;
EACH: E A C H;
ELSE: E L S E;
END: E N D;
ESCAPE: E S C A P E;
EXCEPT: E X C E P T;
EXCLUSIVE: E X C L U S I V E;
EXISTS: E X I S T S;
EXPLAIN: E X P L A I N;
FAIL: F A I L;
FOR: F O R;
FOREIGN: F O R E I G N;
FROM: F R O M;
FULL: F U L L;
GLOB: G L O B;
GROUP: G R O U P;
HAVING: H A V I N G;
IF: I F;
IGNORE: I G N O R E;
IMMEDIATE: I M M E D I A T E;
IN: I N;
INDEX: I N D E X;
INDEXED: I N D E X E D;
INITIALLY: I N I T I A L L Y;
INNER: I N N E R;
INSERT: I N S E R T;
INSTEAD: I N S T E A D;
INTERSECT: I N T E R S E C T;
INTO: I N T O;
IS: I S;
ISNULL: I S N U L L;
JOIN: J O I N;
KEY: K E Y;
LEFT: L E F T;
LIKE: L I K E;
LIMIT: L I M I T;
MATCH: M A T C H;
NATURAL: N A T U R A L;
NO: N O;
NOT: N O T;
NOTNULL: N O T N U L L;
NULL_: N U L L;
OF: O F;
OFFSET: O F F S E T;
ON: O N;
OR: O R;
ORDER: O R D E R;
OUTER: O U T E R;
PLAN: P L A N;
PRAGMA: P R A G M A;
PRIMARY: P R I M A R Y;
QUERY: Q U E R Y;
RAISE: R A I S E;
RECURSIVE: R E C U R S I V E;
REFERENCES: R E F E R E N C E S;
REGEXP: R E G E X P;
REINDEX: R E I N D E X;
RELEASE: R E L E A S E;
RENAME: R E N A M E;
REPLACE: R E P L A C E;
RESTRICT: R E S T R I C T;
RIGHT: R I G H T;
ROLLBACK: R O L L B A C K;
ROW: R O W;
ROWS: R O W S;
SAVEPOINT: S A V E P O I N T;
SELECT: S E L E C T;
SET: S E T;
TABLE: T A B L E;
TEMP: T E M P;
TEMPORARY: T E M P O R A R Y;
THEN: T H E N;
TO: T O;
TRANSACTION: T R A N S A C T I O N;
TRIGGER: T R I G G E R;
UNION: U N I O N;
UNIQUE: U N I Q U E;
UPDATE: U P D A T E;
USING: U S I N G;
VACUUM: V A C U U M;
VALUES: V A L U E S;
VIEW: V I E W;
VIRTUAL: V I R T U A L;
WHEN: W H E N;
WHERE: W H E R E;
WITH: W I T H;
WITHOUT: W I T H O U T;
FIRST_VALUE: F I R S T '_' V A L U E;
OVER: O V E R;
PARTITION: P A R T I T I O N;
RANGE: R A N G E;
PRECEDING: P R E C E D I N G;
UNBOUNDED: U N B O U N D E D;
CURRENT: C U R R E N T;
FOLLOWING: F O L L O W I N G;
CUME_DIST: C U M E '_' D I S T;
DENSE_RANK: D E N S E '_' R A N K;
LAG: L A G;
LAST_VALUE: L A S T '_' V A L U E;
LEAD: L E A D;
NTH_VALUE: N T H '_' V A L U E;
NTILE: N T I L E;
PERCENT_RANK: P E R C E N T '_' R A N K;
RANK: R A N K;
ROW_NUMBER: R O W '_' N U M B E R;
GENERATED: G E N E R A T E D;
ALWAYS: A L W A Y S;
STORED: S T O R E D;
TRUE_: T R U E;
FALSE_: F A L S E;
WINDOW: W I N D O W;
NULLS: N U L L S;
FIRST: F I R S T;
LAST: L A S T;
FILTER: F I L T E R;
GROUPS: G R O U P S;
EXCLUDE: E X C L U D E;
TIES: T I E S;
OTHERS: O T H E R S;
DO: D O;
NOTHING: N O T H I N G;
IDENTIFIER:
'"' (~'"' | '""')* '"'
| '`' (~'`' | '``')* '`'
| '[' ~']'* ']'
| [a-zA-Z_] [a-zA-Z_0-9]*; // TODO check: needs more chars in set
NUMERIC_LITERAL:
((DIGIT+ ('.' DIGIT*)?) | ('.' DIGIT+)) (E [-+]? DIGIT+)?
| '0x' HEX_DIGIT+;
BIND_PARAMETER: '?' DIGIT* | [:@$] IDENTIFIER;
STRING_LITERAL: '\'' ( ~'\'' | '\'\'')* '\'';
BLOB_LITERAL: X STRING_LITERAL;
SINGLE_LINE_COMMENT:
'--' ~[\r\n]* (('\r'? '\n') | EOF) -> channel(HIDDEN);
MULTILINE_COMMENT: '/*' .*? ( '*/' | EOF) -> channel(HIDDEN);
SPACES: [ \u000B\t\r\n] -> channel(HIDDEN);
UNEXPECTED_CHAR: .;
fragment HEX_DIGIT: [0-9a-fA-F];
fragment DIGIT: [0-9];
fragment A: [aA];
fragment B: [bB];
fragment C: [cC];
fragment D: [dD];
fragment E: [eE];
fragment F: [fF];
fragment G: [gG];
fragment H: [hH];
fragment I: [iI];
fragment J: [jJ];
fragment K: [kK];
fragment L: [lL];
fragment M: [mM];
fragment N: [nN];
fragment O: [oO];
fragment P: [pP];
fragment Q: [qQ];
fragment R: [rR];
fragment S: [sS];
fragment T: [tT];
fragment U: [uU];
fragment V: [vV];
fragment W: [wW];
fragment X: [xX];
fragment Y: [yY];
fragment Z: [zZ];
|
Library/SpecUI/CommonUI/CWin/cwinMenu.asm | steakknife/pcgeos | 504 | 15144 | <reponame>steakknife/pcgeos
COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1988 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: CommonUI/CWin (common code for several specific ui's)
FILE: cwinMenu.asm
ROUTINES:
Name Description
---- -----------
GLB OLMenuWinClass Open Look/CUA/Motif window class
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 2/89 Initial version
Doug 6/89 Moved to winMenu.asm from openMenuWin.asm
Eric 7/89 Motif extensions, more documentation
Joon 9/92 PM extensions
DESCRIPTION:
$Id: cwinMenu.asm,v 1.2 98/05/04 07:35:25 joon Exp $
------------------------------------------------------------------------------@
;
; For documentation of the OLMenuWinClass see:
; /staff/pcgeos/Spec/olMenuWinClass.doc
;
CommonUIClassStructures segment resource
OLMenuWinClass mask CLASSF_DISCARD_ON_SAVE or \
mask CLASSF_NEVER_SAVED
MenuWinScrollerClass mask CLASSF_DISCARD_ON_SAVE or \
mask CLASSF_NEVER_SAVED
CommonUIClassStructures ends
;---------------------------------------------------
MenuBuild segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinInitialize -- MSG_META_INITIALIZE for OLMenuWinClass
DESCRIPTION: Initialize an OLMenuWin object for the GenInteraction.
PASS: *ds:si - instance data
es - segment of OlMenuClass
ax - MSG_META_INITIALIZE
cx, dx, bp - ?
RETURN: ax, cx, dx, bp - ?
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 2/89 Initial version
------------------------------------------------------------------------------@
OLMenuWinInitialize method dynamic OLMenuWinClass, MSG_META_INITIALIZE
;Do superclass initialization
mov di, offset OLMenuWinClass
CallSuper MSG_META_INITIALIZE
;Setup our geometry preferences before calling superclass which will
;process hints
;set menu attributes (SAVE BYTES here)
call MenuBuild_DerefVisSpec_DI
ORNF ds:[di].OLWI_fixedAttr, mask OWFA_IS_MENU
OLS < mov ds:[di].OLWI_attrs, mask OWA_SHADOW or mask OWA_FOCUSABLE >
CUAS < ORNF ds:[di].OLWI_attrs, mask OWA_THICK_LINE_BORDER \
or mask OWA_KIDS_INSIDE_BORDER or mask OWA_FOCUSABLE \
or mask OWA_CLOSABLE >
if _MENUS_PINNABLE ;------------------------------------------------------
;CUA/MOTIF: only allow pinnable menus if not in strict-compatibility mde
CUAS < call FlowGetUIButtonFlags ;get args from geosec.ini file >
CUAS < test al, mask UIBF_SPECIFIC_UI_COMPATIBLE >
CUAS < jnz noLawsuit >
OLS < ORNF ds:[di].OLWI_attrs, mask OWA_PINNABLE or mask OWA_HEADER >
CUAS < ORNF ds:[di].OLWI_attrs, mask OWA_PINNABLE >
noLawsuit:
;
; If keyboard-only, or UI concept of Pinnable menus isn't allowed,
; turn off pinnable menus altogether.
;
call OpenCheckIfKeyboardOnly ; carry set if so
jc notPinnable
push es, cx
segmov es, dgroup, cx
test es:[olWindowOptions], mask UIWO_PINNABLE_MENUS
pop es, cx
jnz afterNotPinnable
notPinnable:
andnf ds:[di].OLWI_attrs, not mask OWA_PINNABLE ; clear flag
afterNotPinnable:
endif ;------------------------------------------------------
;now set menu type
OLS < mov ds:[di].OLWI_type, OLWT_MENU >
CUAS < mov ds:[di].OLWI_type, MOWT_MENU ;set window type = MENU >
if _SUB_MENUS ;--------------------------------------------------------------
mov cx, ds:[di].OLCI_buildFlags
and cx, mask OLBF_REPLY
cmp cx, OLBR_SUB_MENU shl offset OLBF_REPLY
jnz winPosSize
OLS < mov ds:[di].OLWI_type, OLWT_SUBMENU >
CUAS < mov ds:[di].OLWI_type, MOWT_SUBMENU >
endif ;--------------------------------------------------------------
winPosSize:
;do geometry handling
call OLMenuWinScanGeometryHints
;Process hints from GenInteraction object. We want to know if the
;CUA/Motif - specific hint HINT_SYSTEM_MENU was specified.
;setup es:di to be ptr to
;Hint handler table
segmov es, cs, di
mov di, offset cs:OLMenuWinHintHandlers
mov ax, length (cs:OLMenuWinHintHandlers)
call ObjVarScanData
ret
OLMenuWinInitialize endp
;Hint handler table
OLMenuWinHintHandlers VarDataHandler \
<HINT_INFREQUENTLY_USED, offset HintNotPinnable>,
<HINT_SYS_MENU, offset OLMenuWinHintIsSystemMenu>,
<HINT_IS_EXPRESS_MENU,offset OLMenuWinHintIsExpressMenu>,
<HINT_CUSTOM_SYS_MENU, offset OLMenuWinHintCustomSysMenu>,
<HINT_INTERACTION_INFREQUENT_USAGE,offset OLMenuWinHintInfrequentUsage>
HintNotPinnable proc far
class OLMenuWinClass
call MenuBuild_DerefVisSpec_DI
OLS < ANDNF ds:[di].OLWI_attrs, not (mask OWA_PINNABLE or mask OWA_HEADER)>
CUAS < ANDNF ds:[di].OLWI_attrs, not mask OWA_PINNABLE >
ret
HintNotPinnable endp
OLMenuWinHintCustomSysMenu proc far
class OLMenuWinClass
call MenuBuild_DerefVisSpec_DI
ORNF ds:[di].OLMWI_specState, mask OMWSS_CUSTOM_SYS_MENU
ret
OLMenuWinHintCustomSysMenu endp
OLMenuWinHintInfrequentUsage proc far
class OLMenuWinClass
call MenuBuild_DerefVisSpec_DI
ORNF ds:[di].OLMWI_specState, mask OMWSS_INFREQUENT_USAGE
ret
OLMenuWinHintInfrequentUsage endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinScanGeometryHints --
MSG_SPEC_SCAN_GEOMETRY_HINTS for OLMenuWinClass
DESCRIPTION: Scans geometry hints.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_SPEC_SCAN_GEOMETRY_HINTS
RETURN: nothing
ax, cx, dx, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 2/ 5/92 Initial Version
------------------------------------------------------------------------------@
OLMenuWinScanGeometryHints method static OLMenuWinClass, \
MSG_SPEC_SCAN_GEOMETRY_HINTS
uses bx, di, es ; To comply w/static call requirements
.enter ; that bx, si, di, & es are preserved.
; NOTE that es is NOT segment of class
mov di, segment OLMenuWinClass
mov es, di
;handle superclass geometry stuff first
mov di, offset OLMenuWinClass
CallSuper MSG_SPEC_SCAN_GEOMETRY_HINTS
;Setup our geometry preferences before calling superclass which will
;process hints
;Make all buttons the width of the smallest
call MenuBuild_DerefVisSpec_DI
;override OLWinClass positioning/sizing behavior
;(We set the PERSIST flags so that if this menu is pinned, and then
;closed, PrepForReOpen does not set anything invalid.)
mov ds:[di].OLWI_winPosSizeFlags, \
mask WPSF_PERSIST \
or (WCT_KEEP_VISIBLE shl offset WPSF_CONSTRAIN_TYPE) \
or (WPT_AS_REQUIRED shl offset WPSF_POSITION_TYPE) \
or (WST_AS_DESIRED shl offset WPSF_SIZE_TYPE)
;process positioning and sizing hints - might not allow this
clr cx ;pass flag: no icon for this window
call OpenWinProcessHints
.leave
ret
OLMenuWinScanGeometryHints endm
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinHintIsSystemMenu
DESCRIPTION: Hint handler for HINT_SYS_MENU. Internal hint to indicate
that this generic interaction group was actually created by
the specific UI, & should be turned into the CUA system
menu.
CALLED BY: INTERNAL
PASS:
*ds:si - window object
ds:bx - ptr to hint structure
ax - hint = (ds:bx).HE_type
RETURN:
ds - new segment of object block
OK TO DESTROY in hint handler:
ax, bx, si, di, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric Initial version
Doug 10/89 Added header
Eric 6/90 Added OLMenuWinHintIsExpressMenu.
------------------------------------------------------------------------------@
OLMenuWinHintIsExpressMenu proc far
FALL_THRU OLMenuWinHintIsSystemMenu ;for now, no diff.
OLMenuWinHintIsExpressMenu endp
OLMenuWinHintIsSystemMenu proc far
class OLMenuWinClass
;set the OMWA_IS_SYSTEM_MENU attribute bit for this menu window
call MenuBuild_DerefVisSpec_DI
;SAVE BYTES: may not be necessary
ORNF ds:[di].OLWI_fixedAttr, mask OWFA_IS_MENU
OLS < mov ds:[di].OLWI_type, OLWT_SYSTEM_MENU >
CUAS < mov ds:[di].OLWI_type, MOWT_SYSTEM_MENU >
;set window type = SYSTEM_MENU
ret
OLMenuWinHintIsSystemMenu endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinUpdateSpecBuild -- MSG_SPEC_BUILD_BRANCH
DESCRIPTION: We intercept UPDATE_SPEC_BUILD here so that menus which are
pinnable can add a PIN button. (CUA style only).
PASS:
*ds:si - instance data
es - segment of OLMenuWinClass
ax - MSG_SPEC_BUILD_BRANCH
cx - ?
dx - ?
bp - SpecBuildFlags (SBF_WIN_GROUP, etc)
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 12/89 Initial version
------------------------------------------------------------------------------@
OLMenuWinUpdateSpecBuild method dynamic OLMenuWinClass,
MSG_SPEC_BUILD_BRANCH
if ALLOW_ACTIVATION_OF_DISABLED_MENUS
;
; Make sure this is set. System menus are always enabled regardless
; of their parent's status. (Changed to always enable menus of
; any kind. -cbh 12/10/92)
;
;OLS < cmp ds:[di].OLWI_type, OLWT_SYSTEM_MENU >
;CUAS < cmp ds:[di].OLWI_type, MOWT_SYSTEM_MENU >
; jne 10$
or bp, mask SBF_VIS_PARENT_FULLY_ENABLED
;10$:
endif
if _MENUS_PINNABLE ;------------------------------------------------------
if _CUA_STYLE ;------------------------------------------------------
mov di, ds:[di].OLCI_buildFlags
and di, mask OLBF_TARGET
cmp di, OLBT_IS_POPUP_LIST shl offset OLBF_TARGET
je callSuper ;popup list, cannot pin (for now)
;first test if this MSG_SPEC_BUILD_BRANCH has been recursively
;descending the visible tree. If not, it means we are opening this menu
test bp, mask SBF_WIN_GROUP ;at top of tree?
jz callSuper ;skip if not...
push bp
call OLMenuWinEnsurePinTrigger
pop bp
endif ;--------------------------------------------------------------
endif ;--------------------------------------------------------------
callSuper:
mov ax, MSG_SPEC_BUILD_BRANCH
push bp
mov di, offset OLMenuWinClass
call ObjCallSuperNoLock
pop bp
alreadyBuilt:
;get our orientation correct. We'll be horizontal if our button
;desires it.
call MenuBuild_DerefVisSpec_DI
or ds:[di].VCI_geoAttrs, mask VCGA_ORIENT_CHILDREN_VERTICALLY
mov ax, ds:[di].OLCI_buildFlags
and ax, mask OLBF_TARGET
cmp ax, OLBT_IS_POPUP_LIST shl offset OLBF_TARGET
jne 20$ ;not popup list, leave vertical
push si
mov si, ds:[di].OLPWI_button
tst si
clc ;assume no button, choose vertical
jz 15$ ;no button, skip this, after popping si
mov ax, MSG_OL_MENU_BUTTON_INIT_POPUP_ORIENTATION
call ObjCallInstanceNoLock ;returns carry set if horizontal
15$:
pop si
jnc 20$ ;button wants us vertical, branch
call MenuBuild_DerefVisSpec_DI
and ds:[di].VCI_geoAttrs, not mask VCGA_ORIENT_CHILDREN_VERTICALLY
20$:
;if File menu, ensure File:Exit exists and has moniker
test bp, mask SBF_WIN_GROUP
jz noFileExitYet
call EnsureFileExit
noFileExitYet:
;update separators in this menu
mov ax, MSG_SPEC_UPDATE_MENU_SEPARATORS
GOTO ObjCallInstanceNoLock
OLMenuWinUpdateSpecBuild endp
MenuBuild_DerefVisSpec_DI proc near
mov di, ds:[si]
add di, ds:[di].Vis_offset
ret
MenuBuild_DerefVisSpec_DI endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckForCustomSystemMenu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks to see if the application has provided a custom
system menu. If yes, we use it as the system menu.
The standard system menu becomes a submenu of the app
provided sys menu.
CALLED BY: OLMenuWinUpdateSpecBuild
PASS: *ds:si - Instance data
bp - SpecBuildFlags
RETURN: carry set if we called our superclass to do SPEC_BUILD_BRANCH
DESTROYED: ax, bx, cx, dx, di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JS 8/24/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MenuBuild_DerefGen_DI proc near
mov di, ds:[si]
add di, ds:[di].Gen_offset
ret
MenuBuild_DerefGen_DI endp
if not (_DISABLE_APP_EXIT_UI)
MenuBuild_ObjMessageCallFixupDS proc near
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
ret
MenuBuild_ObjMessageCallFixupDS endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinVisAddChild
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Intercept MSG_VIS_ADD_CHILD to place the standard system
menu at the correct position in the app provided sys menu
CALLED BY: MSG_VIS_ADD_CHILD
PASS: *ds:si = OLMenuWinClass object
ds:di = OLMenuWinClass instance data
ds:bx = OLMenuWinClass object (same as *ds:si)
es = segment of OLMenuWinClass
ax = message #
RETURN: cx, dx = unchanged
DESTROYED: ax, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JS 8/30/92 Initial version
brianc 10/8/92 force Exit to end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLMenuWinVisAddChild method dynamic OLMenuWinClass, MSG_VIS_ADD_CHILD
uses bp
.enter
mov di, offset OLMenuWinClass
call ObjCallSuperNoLock
;
; after adding whatever it was we added, make sure the Exit trigger
; is last
; *ds:si = OLMenuWin
; ^lcx:dx = child added
;
call MenuBuild_DerefVisSpec_DI
test ds:[di].OLMWI_specState, mask OMWSS_EXIT_CREATED
jz noExit
mov ax, ATTR_OL_MENU_WIN_EXIT_TRIGGER
call ObjVarFindData ; carry set if found
jnc noExit
push cx, dx ; save child for exit
mov cx, ({optr} ds:[bx]).handle ; ^lcx:dx = exit trigger if any
mov dx, ({optr} ds:[bx]).chunk
mov ax, MSG_VIS_MOVE_CHILD
mov bp, CCO_LAST ; move to end, not dirty
call ObjCallInstanceNoLock
pop cx, dx ; restore child for return
noExit:
.leave
ret
OLMenuWinVisAddChild endm
if _MENUS_PINNABLE ;------------------------------------------------------
if _CUA_STYLE ;------------------------------------------------------
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinEnsurePinTrigger
DESCRIPTION: Create a pushpin trigger, if one is needed & doesn't yet
exist.
CALLED BY: INTERNAL
OLMenuWinUpdateSpecBuild
PASS: *ds:si - OLMenuWin objec
RETURN: nothing
DESTROYED: ax, bx, cx, dx, bp, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 5/92 Added header
------------------------------------------------------------------------------@
OLMenuWinEnsurePinTrigger proc far
class OLMenuWinClass
.enter
;see if we already have a PinTrigger object for this menu
call MenuBuild_DerefVisSpec_DI
test ds:[di].OLWI_attrs, mask OWA_PINNABLE
jz done ;skip if not pinnable...
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jnz done ;skip if already pinned...
tst ds:[di].OLPWI_pinTrigger ;See if already created
jnz done ;skip to end if so...
;create a group to hold pin trigger
push es, si
mov cx, ds:[LMBH_handle]
mov dx, si ; add to ourselves
mov di, segment GenInteractionClass
mov es, di
mov di, offset GenInteractionClass
mov ax, -1 ; init USABLE, one-way up link
mov bx, 0 ; no hints
mov bp, 0 ; ignore dirty
call OpenCreateChildObject ; ^lcx:dx = new object
pop es, si
call MenuBuild_DerefVisSpec_DI
mov ds:[di].OLPWI_pinTrigger, dx ; save chunk handle, so we
; can find it later.
push dx ; save again for short term use
push si ; save OLMenuWin chunk
EC < cmp cx, ds:[LMBH_handle] >
EC < ERROR_NE OL_ERROR >
mov si, dx ; *ds:si = pin group
mov bp, mask SBF_IN_UPDATE_WIN_GROUP or mask SBF_TREE_BUILD or \
mask SBF_VIS_PARENT_FULLY_ENABLED or VUM_NOW
mov ax, MSG_SPEC_BUILD_BRANCH
call ObjCallInstanceNoLock
;create a GenTrigger object, and place at the top of this menu
; *ds:si = pin group (parent for pin trigger)
mov cx, ds:[LMBH_handle]
pop dx ; ^lcx:dx = *ds:dx = OLMenuWin
; (destination of message)
push dx ; save OLMenuWin chunk again
mov ax, MSG_OL_POPUP_TOGGLE_PUSHPIN ; action message
mov di, handle PinMoniker ; VisualMoniker to use
mov bp, offset PinMoniker
mov bx, ATTR_GEN_TRIGGER_IMMEDIATE_ACTION ; hint to add
clc ; full gen linkage
; (we use this when we destroy
; the pin group/trigger)
call OpenCreateChildTrigger ; ^lcx:dx = new trigger
;now since we had virtually no control over where this object
;was placed in the visible tree, move it to be the first child now.
pop si ; *ds:si = OLMenuWin
mov cx, ds:[LMBH_handle] ; ^lcx:dx = pin group
pop dx
mov bp, CCO_FIRST ;make it the first child
mov ax, MSG_VIS_MOVE_CHILD
call ObjCallInstanceNoLock
done:
.leave
ret
OLMenuWinEnsurePinTrigger endp
endif ;--------------------------------------------------------------
endif ;--------------------------------------------------------------
COMMENT @----------------------------------------------------------------------
FUNCTION: EnsureFileExit
DESCRIPTION: If this is GenInteraction is marked with
ATTR_GEN_INTERACTION_GROUP_TYPE {GIGT_FILE_MENU},
make sure we have an Exit item.
CALLED BY: INTERNAL
OLMenuWinUpdateSpecBuild
PASS:
*ds:si - OLDialogWin object
RETURN:
nothing
DESTROYED:
ax, bx, cx, dx, di, bp
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 5/13/92 Initial version
VL 7/11/95 Comment out this proc if
_DISABLE_APP_EXIT_UI if true.
------------------------------------------------------------------------------@
EnsureFileExit proc near
; Don't want a File Exit if _DISABLE_APP_EXIT_UI is true.
if not (_DISABLE_APP_EXIT_UI) ;-----------------------------------------------
uses si
.enter
call MenuBuild_DerefVisSpec_DI
test ds:[di].OLMWI_specState, mask OMWSS_FILE_MENU
LONG jz done
;
; do not create Exit trigger if we are running in UILM_TRANSPARENT
; mode and we are not a Desk Accessory
; Changed to allow .ini-file override via UILO_CLOSABLE_APPS flag
; (9/9/93 -atw)
call UserGetLaunchModel ; ax = UILaunchModel
cmp ax, UILM_TRANSPARENT
jne addExit ; not UILM_TRANSPARENT, add
call UserGetLaunchOptions
test ax, mask UILO_CLOSABLE_APPS ;In transparent mode, but
jnz addExit ; override flag present, so add
; exit trigger.
mov ax, MSG_GEN_APPLICATION_GET_LAUNCH_FLAGS
call GenCallApplication ; al = AppLaunchFlags
test al, mask ALF_DESK_ACCESSORY
LONG jz done ; not DA, no Exit item
addExit:
;
; this is file menu and we want to add Exit trigger
;
mov ax, ATTR_OL_MENU_WIN_EXIT_TRIGGER
call ObjVarFindData ; carry set if found
mov cx, ({optr} ds:[bx]).handle ; ^lcx:dx = exit trigger if any
mov dx, ({optr} ds:[bx]).chunk
jc haveTrigger
push es
mov cx, ds:[LMBH_handle] ; add to this object
mov dx, si
mov di, segment GenTriggerClass
mov es, di
mov di, offset GenTriggerClass
mov al, -1 ; init USABLE
mov ah, -1 ; one-way upward generic link
clr bx
mov bp, CCO_LAST ; (not dirty)
call OpenCreateChildObject ; ^lcx:dx = new trigger
pop es
push si, cx, dx ; save OLMenuWin
mov si, dx ; *ds:si = new trigger
mov ax, ATTR_GEN_TRIGGER_INTERACTION_COMMAND or \
mask VDF_SAVE_TO_STATE
mov cx, size InteractionCommand
call ObjVarAddData ; ds:dx = pointer to extra data
mov {InteractionCommand} ds:[bx], IC_EXIT
mov ax, si ; *ds:ax = exit trigger
mov bx, mask OCF_DIRTY shl 8
call ObjSetFlags ; undo dirtying by ObjVarAddData
clr bp ; basic build
call VisSendSpecBuild ; build it
pop si, cx, dx ; *ds:si = OLMenuWin
call SaveExitTriggerInfo ; preserves cx, dx
call MenuBuild_DerefVisSpec_DI
ornf ds:[di].OLMWI_specState, mask OMWSS_EXIT_CREATED
haveTrigger:
;
; ^lcx:dx = exit trigger
;
mov bx, cx
mov si, dx
mov ax, MSG_GEN_GET_VIS_MONIKER
call MenuBuild_ObjMessageCallFixupDS ; ax = moniker (if any)
tst ax
LONG jnz done ; have moniker already
if _MOTIF or _ISUI
mov dx, -1 ; get appname from app
mov bp, (VMS_TEXT shl offset VMSF_STYLE) or mask VMSF_COPY_CHUNK
mov cx, ds:[LMBH_handle] ; copy into menu block
mov ax, MSG_GEN_FIND_MONIKER
call MenuBuild_ObjMessageCallFixupDS ; ^lcx:dx = moniker (call trig.)
LONG jcxz exitDone ; not found leave plain "Exit" moniker
mov di, dx
mov di, ds:[di] ; ds:di = app name moniker
test ds:[di].VM_type, mask VMT_GSTRING
jnz monikerDone ; carry clear
push si, es, bx
mov bx, handle StandardMonikers
call ObjLockObjBlock
mov es, ax
mov di, offset FileExitMoniker
mov di, es:[di]
mov bl, es:[di].VM_data.VMT_mnemonicOffset
add di, offset VM_data.VMT_text
push bx
push di
LocalStrLength includeNull ; cx = length w/null (for separator)
pop di
mov ax, dx
mov bx, offset VM_data.VMT_text
DBCS < shl cx, 1 >
call LMemInsertAt ; insert space in app name chunk for Exit
DBCS < shr cx, 1 >
pop bx ; bl = mnemonic offset
mov si, di
mov di, dx
mov di, ds:[di]
mov ds:[di].VM_width, 0 ; recompute size
mov ds:[di].VM_data.VMT_mnemonicOffset, bl
add di, offset VM_data.VMT_text
segxchg ds, es ; ds:si = "Exit" es:di = app name
LocalCopyString ; insert "Exit" before app name
segmov ds, es ; ds:di = app name
mov {TCHAR}ds:[di-(size TCHAR)], C_SPACE ; separator
mov bx, handle StandardMonikers
call MemUnlock ; unlock moniker resource
pop si, es, bx
mov cx, ds:[LMBH_handle]
mov bp, VUM_MANUAL
push dx
mov ax, MSG_GEN_REPLACE_VIS_MONIKER_OPTR
call MenuBuild_ObjMessageCallFixupDS
pop dx
stc ; moniker already set
monikerDone:
pushf
mov ax, dx
call LMemFree
popf
jc short afterExit
exitDone:
endif
mov cx, handle StandardMonikers
mov dx, offset FileExitMoniker
setMoniker::
mov bp, VUM_MANUAL
mov ax, MSG_GEN_REPLACE_VIS_MONIKER_OPTR
call MenuBuild_ObjMessageCallFixupDS
afterExit::
;
; do keyboard shortcut
;
mov ax, MSG_GEN_GET_KBD_ACCELERATOR
call MenuBuild_ObjMessageCallFixupDS
tst cx
jnz done ; something set already
if DBCS_PCGEOS
mov cx, KeyboardShortcut <0, 0, 0, 0, C_SYS_F3 and mask KS_CHAR>
else
mov cx, KeyboardShortcut <0, 0, 0, 0, 0xf, VC_F3>
endif
mov dl, VUM_MANUAL
mov ax, MSG_GEN_SET_KBD_ACCELERATOR
call MenuBuild_ObjMessageCallFixupDS
done:
.leave
endif ;not (_DISABLE_APP_EXIT_UI) -------------------------------------------
ret
EnsureFileExit endp
;
; pass:
; *ds:si = OLMenuWin
; ^lcx:dx = exit trigger
; return:
; nothing
; destroy:
; ax, bx
;
SaveExitTriggerInfo proc near
mov ax, ATTR_OL_MENU_WIN_EXIT_TRIGGER ; don't save to state
push cx
mov cx, size optr
call ObjVarAddData ; ds:bx = extra data
pop cx ; restore handle (returned)
mov ({optr} ds:[bx]).handle, cx
mov ({optr} ds:[bx]).chunk, dx
done:
ret
SaveExitTriggerInfo endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinSpecBuild -- MSG_SPEC_BUILD
DESCRIPTION: Ensure moniker if ATTR_GEN_INTERACTION_GROUP_TYPE set.
PASS:
*ds:si - instance data
es - segment of OLMenuWinClass
ax - MSG_SPEC_BUILD
cx - ?
dx - ?
bp - SpecBuildFlags (SBF_WIN_GROUP, etc)
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
Moniker must be set before calling superclass as the moniker is needed
at that time. Don't care whether SBF_WIN_GROUP or not, we need to do
this the first time through.
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 5/12/92 Initial version
------------------------------------------------------------------------------@
OLMenuWinSpecBuild method OLMenuWinClass, MSG_SPEC_BUILD
if ALLOW_ACTIVATION_OF_DISABLED_MENUS
;
; Enable menus of any kind. -cbh 12/10/92 (Actually, only those in
; a menu bar. -cbh 12/17/92)
;
mov di, ds:[di].OLCI_buildFlags
test di, mask OLBF_AVOID_MENU_BAR
jz notInMenuBar
and di, mask OLBF_TARGET
cmp di, OLBT_IS_POPUP_LIST shl offset OLBF_TARGET
jne notInMenuBar
or bp, mask SBF_VIS_PARENT_FULLY_ENABLED
notInMenuBar:
endif
;
; ensure moniker if ATTR_GEN_INTERACTION_GROUP_TYPE set
;
push ax, bp
mov ax, ATTR_GEN_INTERACTION_GROUP_TYPE
call ObjVarFindData ; ds:bx = data, if found
LONG jnc done ; not found, done
EC < VarDataSizePtr ds, bx, ax >
EC < cmp ax, size GenInteractionGroupType >
EC < ERROR_NE OL_ERROR_BAD_GEN_INTERACTION_GROUP_TYPE >
mov bl, ds:[bx] ; bl = GenInteractionGroupType
EC < cmp bl, GenInteractionGroupType >
EC < ERROR_AE OL_ERROR_BAD_GEN_INTERACTION_GROUP_TYPE >
;
; if GIGT_FILE_MENU, set flag so we know this fact later
;
cmp bl, GIGT_FILE_MENU
jne notFileMenu
call MenuBuild_DerefVisSpec_DI
ornf ds:[di].OLMWI_specState, mask OMWSS_FILE_MENU
; set this so OLPopupWinClass
; can know this
ornf ds:[di].OLPWI_flags, mask OLPWF_FILE_MENU
;
; let GenPrimary know about us
;
push es, bx, si ; save "File" menu chunk
call GenSwapLockParent ; *ds:si = parent
; bx = "File" menu block
mov di, segment GenPrimaryClass
mov es, di
mov di, offset GenPrimaryClass
call ObjIsObjectInClass ; carry set if so
call ObjSwapUnlock ; *ds - this block
; (preserves flags)
pop es, bx, si ; restore "File" menu chunk
jnc notFileMenu ; not under GenPrimary, ignore
; as "File" menu
mov cx, ds:[LMBH_handle] ; ^lcx:dx = "File" menu
mov dx, si
mov ax, MSG_OL_BASE_WIN_NOTIFY_OF_FILE_MENU
call GenCallParent ; let GenPrimary know of us
notFileMenu:
;
; check if moniker exists
; *ds:si = OLMenuWin
;
call MenuBuild_DerefGen_DI ; ds:di = gen instance
tst ds:[di].GI_visMoniker ; have vis moniker?
jnz done ; yes, leave alone
;
; add moniker based on GenInteractionGroupType
; bl = GenInteractionGroupType
;
clr bh
shl bx, 1 ; convert to word table offset
mov dx, cs:[groupTypeMonikerTable][bx] ; dx = moniker
mov cx, handle StandardMonikers ; ^lcx:dx = moniker
mov bp, VUM_MANUAL
mov ax, MSG_GEN_REPLACE_VIS_MONIKER_OPTR
call ObjCallInstanceNoLock
;
; let superclass finish up
;
done:
pop ax, bp
mov di, offset OLMenuWinClass
GOTO ObjCallSuperNoLock
OLMenuWinSpecBuild endm
groupTypeMonikerTable label word
word offset GroupTypeFileMoniker ; GIGT_FILE_MENU
word offset GroupTypeEditMoniker ; GIGT_EDIT_MENU
word offset GroupTypeViewMoniker ; GIGT_VIEW_MENU
word offset GroupTypeOptionsMoniker ; GIGT_OPTIONS_MENU
word offset GroupTypeWindowMoniker ; GIGT_WINDOW_MENU
word offset GroupTypeHelpMoniker ; GIGT_HELP_MENU
word offset GroupTypePrintMoniker ; GIGT_PRINT_GROUP
GROUP_TYPE_MONIKER_TABLE_SIZE equ $-groupTypeMonikerTable
.assert (((GIGT_PRINT_GROUP+1)*2) eq GROUP_TYPE_MONIKER_TABLE_SIZE)
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinNotifyOfInteractionCommand --
MSG_OL_WIN_NOTIFY_OF_INTERACTION_COMMAND for OLMenuWinClass
DESCRIPTION: Respond to MSG_OL_WIN_NOTIFY_OF_INTERACTION_COMMAND.
PASS: *ds:si = instance data for object
ds:di = specific instance (OLMenuWin)
dx:bp = NotifyOfInteractionCommandStruct
RETURN: nothing
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 4/90 initial version
------------------------------------------------------------------------------@
OLMenuWinNotifyOfInteractionCommand method dynamic OLMenuWinClass,
MSG_OL_WIN_NOTIFY_OF_INTERACTION_COMMAND
;
; notification of MSG_GEN_TRIGGER_INTERACTION_COMMAND
;
mov es, dx ; es:bp = NOICS_
cmp es:[bp].NOICS_ic, IC_EXIT
jne done ; if non-EXIT IC trigger in
; menu, ignore it
; did we create one?
test ds:[di].OLMWI_specState, mask OMWSS_EXIT_CREATED
jnz done ; yes, don't save again
mov cx, es:[bp].NOICS_optr.handle
mov dx, es:[bp].NOICS_optr.chunk
call SaveExitTriggerInfo
done:
ret
OLMenuWinNotifyOfInteractionCommand endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinECCheckCascadeData
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: EC only code which checks consistency of the IS_CASCADING
bit and ATTR_OL_MENU_WIN_CASCADED_MENU vardata.
CALLED BY: Cascade menu code
PASS: *ds:si = object ptr
RETURN: nothing
DESTROYED: nothing, even flags are maintained.
SIDE EFFECTS: Dies if inconsistent.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 4/27/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _CASCADING_MENUS and ERROR_CHECK
OLMenuWinECCheckCascadeData proc far
uses ax,bx,cx,dx,di,ds,es
.enter
pushf
mov ax, ATTR_OL_MENU_WIN_CASCADED_MENU
call ObjVarFindData ; if data, ds:bx = ptr
mov dl, TRUE ; found var data?
jc lookAtBit
mov dl, FALSE ; no.. didn't find it
lookAtBit:
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].OLMWI_moreSpecState, mask OMWMSS_IS_CASCADING
mov dh, TRUE ; bit set?
jnz doTests
mov dh, FALSE ; no, bit clear
doTests:
; dl = is there var data? TRUE/FALSE
; dh = is the CASCADING bit set? TRUE/FALSE
cmp dl, dh
ERROR_NE OL_ERROR ; INCONSISTENT dl & dh
tst dl
jz done
; check var data's contents -- should be valid optr
push si
mov si, ds:[bx].offset
mov bx, ds:[bx].handle
call ECCheckLMemOD
pop si
done:
popf
.leave
ret
OLMenuWinECCheckCascadeData endp
endif ;_CASCADING_MENUS and ERROR_CHECK
MenuBuild ends
WinClasses segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinGupQuery -- MSG_SPEC_GUP_QUERY for OLMenuWinClass
DESCRIPTION: Respond to a query traveling up the generic composite tree -
see OLMapGroup (in CSpec/cspecInteraction.asm) for info.
PASS: *ds:si - instance data
es - segment of OLMenuWinClass
ax - MSG_SPEC_GUP_QUERY
cx - Query type (GenQueryType or SpecGenQueryType)
dx -?
bp - OLBuildFlags
RETURN: carry - set if query acknowledged, clear if not
bp - OLBuildFlags
cx:dx - vis parent
DESTROYED: ?
PSEUDO CODE/STRATEGY:
see OLMapGroup for details
if (query = SGQT_BUILD_INFO) {
respond:
TOP_MENU = 0
SUB_MENU = 1
visParent = this object
} else {
send query to superclass (will send to generic parent)
}
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 7/89 Adapted from Tony's new handler.
------------------------------------------------------------------------------@
OLMenuWinGupQuery method dynamic OLMenuWinClass, MSG_SPEC_GUP_QUERY
cmp cx, SGQT_BUILD_INFO ;can we answer this query?
jne noAnswer ;skip if so...
EC < test bp, mask OLBF_REPLY >
EC < ERROR_NZ OL_BUILD_FLAGS_MULTIPLE_REPLIES >
or bp, OLBR_SUB_MENU shl offset OLBF_REPLY
;
; We'll return ourselves, but if an OLCtrl was the generic parent
; of the querying object, it will set itself as the visual parent
; rather than this object. -cbh 5/11/92
;
call WinClasses_Mov_CXDX_Self
stc ;return query acknowledged
ret
noAnswer:
FALL_THRU WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far
OLMenuWinGupQuery endp
WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far proc far
call WinClasses_ObjCallSuperNoLock_OLMenuWinClass
ret
WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far endp
WinClasses ends
;-------------------------------
MenuSepQuery segment resource
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinUpdateMenuSeparators --
MSG_SPEC_UPDATE_MENU_SEPARATORS handler
DESCRIPTION: This method is sent when an object in the menu decides that
a separator in the menu might need to change. We start a
wandering query, which updates the appropriate items
in the menu.
PASS: *ds:si = instance data for object
RETURN: nothing
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 3/90 initial version
------------------------------------------------------------------------------@
OLMenuWinUpdateMenuSeparators method dynamic OLMenuWinClass, \
MSG_SPEC_UPDATE_MENU_SEPARATORS
clr ch ;pass flags: initiate query
mov ax, MSG_SPEC_MENU_SEP_QUERY
GOTO ObjCallInstanceNoLock
OLMenuWinUpdateMenuSeparators endm
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinSpecMenuSepQuery -- MSG_SPEC_MENU_SEP_QUERY handler
DESCRIPTION: This method travels the visible tree within a menu,
to determine which OLMenuItemGroups need top and bottom
separators to be drawn.
PASS: *ds:si = instance data for object
ch = MenuSepFlags
RETURN: ch = MenuSepFlags (updated)
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 3/90 initial version
------------------------------------------------------------------------------@
OLMenuWinSpecMenuSepQuery method dynamic OLMenuWinClass, \
MSG_SPEC_MENU_SEP_QUERY
;see if we are initiating this query, or if it has travelled the
;entire visible tree in the menu already.
test ch, mask MSF_FROM_CHILD
jnz fromChild ;skip if reached end of visible tree...
GOTO VisCallFirstChild
fromChild:
;this method has travelled the entire visible tree in the menu,
;and was sent by the last child to this root node. Begin the
;process of un-recursing.
ANDNF ch, not (mask MSF_SEP or mask MSF_USABLE or mask MSF_FROM_CHILD)
;indicate no need for separator yet
stc
ret
OLMenuWinSpecMenuSepQuery endm
MenuSepQuery ends
;-------------------------------
WinClasses segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinActivate -- MSG_OL_POPUP_ACTIVATE for OLMenuWinClass
DESCRIPTION: Open this menu, allowing it to be active
PASS: *ds:si - instance data
es - segment of OlMenuClass
ax - MSG_ACTIVATE_MENU
cx, dx - location to make active (field coordinates)
bp - ?
RETURN: ax, cx, dx, bp - ?
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 2/89 Initial version
------------------------------------------------------------------------------@
OLMenuWinActivate method dynamic OLMenuWinClass, MSG_OL_POPUP_ACTIVATE
mov bp, VUM_MANUAL ;assume menu is not visible
if _MENUS_PINNABLE ;------------------------------------------------------
;if menu is pinned, un-pin it
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jz afterPinned ;skip if not pinned (not visible)...
;first save menu's current position so that it can be restored when
;the menu button is released. Start by stuffing the desired location
;of the menu into our "OLWI_prevWinBounds" variable, so the Swap
;routine stuffs them into the visible bounds.
push cx, dx
call WinClasses_DerefVisSpec_DI
clr ds:[di].OLWI_prevWinBounds.R_left
clr ds:[di].OLWI_prevWinBounds.R_top
mov ds:[di].OLWI_prevWinBounds.R_right, -1
mov ds:[di].OLWI_prevWinBounds.R_bottom, -1
ORNF ds:[di].OLMWI_specState, mask OMWSS_WAS_PINNED
;indicate was pinned, so want to
;restore to old location when closes
push ds:[di].OLWI_attrs
call OpenWinSwapState ;swap attributes, position and size
;flags, and visible bounds
;restore attributes trashed during swap
call WinClasses_DerefVisSpec_DI
pop ds:[di].OLWI_attrs
OLS < ANDNF ds:[di].OLWI_attrs, not (mask OWA_PINNABLE or mask OWA_HEADER) >
CUAS < ANDNF ds:[di].OLWI_attrs, not (mask OWA_PINNABLE) >
;set temporarily not pinnable
;make menu unpinned, but DO NOT CLOSE IT!
clr bp ;pass FALSE flag
mov ax, MSG_OL_POPUP_TOGGLE_PUSHPIN
call WinClasses_ObjCallSuperNoLock_OLMenuWinClass
;borders and header attributes have been updated, and children
;marked as invalid if necessary. Now resize window to desired size
;again, and update it.
mov cx, mask RSA_CHOOSE_OWN_SIZE ;set win group to desired size
mov dx, mask RSA_CHOOSE_OWN_SIZE ;(just changes bounds)
call VisSetSize
mov cl, mask VOF_GEOMETRY_INVALID ;set geometry invalid here
call WinClasses_VisMarkInvalid_MANUAL
pop cx, dx
mov bp, VUM_NOW ;force an update below
endif ;------------------------------------------------------
afterPinned:
;enforce positioning behavior: keep menu visible, and place below
;our menu button. (bp = VisUpdateMode)
;Preserve WPSF_SHRINK_DESIRED_SIZE_TO_FIT_IN_PARENT flag when setting
;this stuff up. -cbh 1/18/93
call WinClasses_DerefVisSpec_DI
and ds:[di].OLWI_winPosSizeFlags, \
mask WPSF_SHRINK_DESIRED_SIZE_TO_FIT_IN_PARENT
or ds:[di].OLWI_winPosSizeFlags, \
mask WPSF_PERSIST \
or (WCT_KEEP_VISIBLE shl offset WPSF_CONSTRAIN_TYPE) \
or (WPT_AS_REQUIRED shl offset WPSF_POSITION_TYPE) \
or (WST_AS_DESIRED shl offset WPSF_SIZE_TYPE)
;make popup lists redo their geometry, if necessary, to stay onscreen
;(No, let's do this for all menus. We can't have menus trailing off
; the screen!)
; push cx
; mov cx, ds:[di].OLCI_buildFlags
; and cx, mask OLBF_TARGET
; cmp cx, OLBT_IS_POPUP_LIST shl offset OLBF_TARGET
; jne 10$ ;not popup list, branch
or ds:[di].OLWI_winPosSizeFlags, \
mask WPSF_SHRINK_DESIRED_SIZE_TO_FIT_IN_PARENT
;10$:
; pop cx
;not yet in stay-up mode
ANDNF ds:[di].OLMWI_specState, not (mask OMWSS_IN_STAY_UP_MODE)
;Position menu based on cx, dx passed
push bp
call VisSetPosition
pop dx ;set dl = VisUpdateMode
; Mark window as invalid, from move
mov cl, mask VOF_WINDOW_INVALID ;set this flag
call WinClasses_VisMarkInvalid
;Send method to do vis update, bring to top.
mov ax, MSG_GEN_INTERACTION_INITIATE
call WinClasses_ObjCallSuperNoLock_OLMenuWinClass
;start SelectMyControlsOnly mechanism for menu window.
;(See documentation for OLWinClass)
mov ax, MSG_OL_WIN_STARTUP_GRAB
call WinClasses_ObjCallInstanceNoLock
;if this is a popup-menu (no menu button), then grab the Gadget
;exclusive from the parent window, so that we know to close
;if the parent closes unexpectedly.
call WinClasses_DerefVisSpec_DI
tst ds:[di].OLPWI_button ;do we have a menu button?
jnz done ;skip if so...
call OLMenuWinGrabRemoteGadgetExcl
done:
ret
OLMenuWinActivate endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinInitiate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Startup a menu window in stay-up-mode.
CALLED BY: MSG_GEN_INTERACTION_INITIATE
PASS: *ds:si = OLMenuWinClass object
ds:di = OLMenuWinClass instance data
ds:bx = OLMenuWinClass object (same as *ds:si)
es = segment of OLMenuWinClass
ax = message #
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JS 9/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLMenuWinInitiate method dynamic OLMenuWinClass,
MSG_GEN_INTERACTION_INITIATE
;not yet in stay-up mode
ANDNF ds:[di].OLMWI_specState, not (mask OMWSS_IN_STAY_UP_MODE)
;Send method to do vis update, bring to top.
mov ax, MSG_GEN_INTERACTION_INITIATE
call WinClasses_ObjCallSuperNoLock_OLMenuWinClass
;start SelectMyControlsOnly mechanism for menu window.
;(See documentation for OLWinClass)
mov ax, MSG_OL_WIN_STARTUP_GRAB
call WinClasses_ObjCallInstanceNoLock
;enter stay-up mode
mov ax, MSG_MO_MW_ENTER_STAY_UP_MODE
mov cx, TRUE ; grab gadget exclusive
GOTO ObjCallInstanceNoLock
OLMenuWinInitiate endm
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinInteractionCommand
DESCRIPTION: If IC_DISMISS, dismiss the menu. If IC_EXIT, exit the app.
PASS:
*ds:si - instance data
es - segment of OLMenuWinClass
ax - MSG_GEN_GUP_INTERACTION_COMMAND
cx - InteractionCommand
RETURN:
carry - set (query answered)
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 8/89 Initial version
------------------------------------------------------------------------------@
OLMenuWinInteractionCommand method dynamic OLMenuWinClass,
MSG_GEN_GUP_INTERACTION_COMMAND
;
; handle only IC_DISMISS and IC_EXIT
;
cmp cx, IC_DISMISS
je dismiss
cmp cx, IC_EXIT
je exit
; else, let superclass handle
mov di, offset OLMenuWinClass
GOTO ObjCallSuperNoLock ; need tail recurse here
dismiss:
;first: see if this menu is transitioning from pinned & opened from
;menu button to just pinned. If so, abort - there is already
;a MSG_OL_POPUP_TOGGLE_PUSHPIN in progress; we arrived here
;because the toggle operation restores the focus to an object which
;grabs the gadget exclusive from the menu button, and so the menu button
;is asking the menu to close. Just ignore it.
test ds:[di].OLMWI_specState, mask OMWSS_RE_PINNING
jnz done ;skip to abort...
notRePinning:
ForceRef notRePinning
;If this menu is pinned, toggle its pushpin status.
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jz notPinned ;skip if not pinned...
isPinnedSoToggle:
ForceRef isPinnedSoToggle
;menu is pinned: toggle the pinned status: this will
;send a MSG_GEN_GUP_INTERACTION_COMMAND {IC_DISMISS} to the menu.
mov bp, TRUE ;pass flag: dismiss menu
mov ax, MSG_OL_POPUP_TOGGLE_PUSHPIN
call WinClasses_ObjCallInstanceNoLock
jmp short done
notPinned: ;if this menu was pinned before it was opened under the menu button,
;then restore it to that state now. (Keeps the focus)
test ds:[di].OLMWI_specState, mask OMWSS_WAS_PINNED
jz notPinnedWasNotPinned ;skip if was not pinned...
;notPinnedButWasPinned:
;HACK: the toggle pushpin code is going to release the FOCUS exclusive
;from this window, and so the base window may restore the FOCUS
;to an object on the base window which will take the gadget exclusive,
;such as a GenTrigger. The menu button which opens this menu will
;lose the gadget exclusive, and tell this menu to close. To prevent the
;menu from closing, set OMWSS_RE_PINNING)
ANDNF ds:[di].OLMWI_specState, not (mask OMWSS_WAS_PINNED)
ORNF ds:[di].OLMWI_specState, mask OMWSS_RE_PINNING
call OpenWinSwapState ;restore old attrs, position flags,
;and position
mov ax, MSG_OL_POPUP_TOGGLE_PUSHPIN
call WinClasses_ObjCallInstanceNoLock
call WinClasses_DerefVisSpec_DI
ANDNF ds:[di].OLMWI_specState, not (mask OMWSS_RE_PINNING)
;
;DO NOT call superclass- OLPopupWinClass will close this window!
;
jmp short done
exit:
;
; exit associated application
;
mov ax, MSG_META_QUIT
call GenCallApplication
jmp short done
notPinnedWasNotPinned:
;menu is NOT pinned, and WAS NOT pinned.
mov di, 500
call ThreadBorrowStackSpace
push di
;Call superclass so that window is CLOSED (set not REALIZABLE)
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_DISMISS
call WinClasses_ObjCallSuperNoLock_OLMenuWinClass
;tell our menu button to make sure that it is reset visually
mov ax, MSG_OL_MENU_BUTTON_NOTIFY_MENU_DISMISSED
call OLPopupWinSendToButton
pop di
call ThreadReturnStackSpace
done:
stc ; gup query handled
ret
OLMenuWinInteractionCommand endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinPrePassiveButton -- MSG_META_PRE_PASSIVE_BUTTON
DESCRIPTION: Handler for mouse button being pressed while we have a
passive mouse grab. This grab is set up when the menu
window is told by the menu button that it is in stay-up mode.
First we tell the base window that we are leaving
stay-up mode, and reset our own state bits, so that the
SelectMyControlsOnly mechanism in the base window and here
will take the menu down.
PASS: *ds:si - instance data
es - segment of OLMenuWinClass
ax - method
cx, dx - ptr position
bp - [ UIFunctionsActive | buttonInfo ]
(for menu window - indicates if pointer is inside menu)
RETURN: ax, cx, dx, bp - ?
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 8/89 Initial version
Joon 9/92 Added check for scrollable popup list
------------------------------------------------------------------------------@
OLMenuWinPrePassiveButton method dynamic OLMenuWinClass, \
MSG_META_PRE_PASSIVE_BUTTON
;if we were in stay-up mode, send MSG_MO_MW_LEAVE_STAY_UP_MODE
;to self, so will send to menu button and base window.
test ds:[di].OLMWI_specState, mask OMWSS_IN_STAY_UP_MODE
jz done ;skip if not...
ifdef ALLOW_SCROLLABLE_POPUP_LISTS
;if this is a popup list and the ptr is in bounds, then just return
;processed. Mouse interactions needs to be handled by the items in
;the popup list.
mov di, ds:[di].OLCI_buildFlags
and di, mask OLBF_TARGET
cmp di, OLBT_IS_POPUP_LIST shl offset OLBF_TARGET
jne notPopupList
call VisTestPointInBounds
jc returnProcessed
notPopupList:
endif
; don't leave stay up mode if press is not UIFA_IN and
; VisTestPointInBounds is true
test bp, (mask UIFA_IN) shl 8
jnz continue
call VisTestPointInBounds
jc returnProcessed
continue:
;we are in stay-up mode. Send method to self so will be sent
;to BaseWindow and MenuButton. MenuButton will return cx = TRUE/FALSE
;telling us if we should keep menu up.
;Pass: cx, dx = mouse position (in window coords)
; bp = [ UIFunctionsActive | buttonInfo ]
test bp, mask BI_PRESS ;any button pressed?
jz done ;skip if not...
if BUBBLE_HELP
test bp, (mask UIFA_IN) shl 8
jz leaveStayUpMode
; button press inside menu
mov ax, bp
andnf ax, mask BI_BUTTON ;is it BUTTON_2?
cmp ax, BUTTON_2 shl offset BI_BUTTON
je done ;skip if so...
leaveStayUpMode:
endif ; BUBBLE_HELP
mov ax, cx
mov bx, dx
call VisQueryWindow ; get window we're on
EC < push bx >
EC < mov bx, di >
EC < call ECCheckWindowHandle ; ensure good window >
EC < pop bx >
call WinTransform ; get screen coords
mov cx, ax ; cx, dx = ptr position in screen coords
mov dx, bx
push bp ;save UIFA_IN flags from Flow
;pass bp...
mov ax, MSG_MO_MW_LEAVE_STAY_UP_MODE
call WinClasses_ObjCallInstanceNoLock ;send to self
;returns cx = TRUE if mouse
;over menu button AND is correct
;mouse button for this specific
;UI. (Will restart base window
;grab if over mouse button)
pop bp
;If mouse is pressed outside of menu window AND menu button
;bounds, kill menu immediately.
test bp, (mask UIFA_IN) shl 8 ;is mouse ptr in menu window?
jnz returnProcessed ;skip if so...
;notInBounds: ;Mouse pointer is not over menu window.
tst cx ;over menu button?
jnz returnProcessed ;skip if so...
;kill menu immediately (if not pinned)! Send method to self.
;Cascading menus cannot have the pre-passive grab forcing the
;closure of the menus. The bad case is where two or more menus are
;open, and the user clicks on a menu that is not the "top" menu (the
;one that has the pre-passive grab). This will get called first,
;bringing down the "top" menu, which will cause the other menus to
;go down since the "top" menu will send a SUBMENU_REQUESTS_CLOSE
;message up the gen tree. But this is not desired since the user
;may have clicked on another menu button. The other mechanisms,
;post-passive grab and gadget exclusive, will do the work.
; --JimG 4/29/94
if not _CASCADING_MENUS
push bp ;save UIFunctionsActive etc
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_INTERACTION_COMPLETE
call WinClasses_ObjCallInstanceNoLock ;send to self
pop bp
endif ;not _CASCADING_MENUS
; Replay button, just in case the pre-passive list has changed as a
; result of the above
mov ax, mask MRF_REPLAY
ret
returnProcessed: ;return with ax = MRF_*** flag
mov ax, mask MRF_PROCESSED
ret
done: ;send event to superclass (OLWinClass) so that its
;mechanisms operate properly.
GOTO WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far
OLMenuWinPrePassiveButton endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinPostPassiveButton -- MSG_META_POST_PASSIVE_BUTTON
DESCRIPTION: See OLWinClass for complete description of how this
fits into the SelectMyConrolsOnly mechanism. We have
subclassed this method here so that a menu can decide
whether to kill itself when leaving stay-up mode.
IMPORTANT: we are concerned with the button PRESS here,
not the release. We want the press because we may want the
menu to close the instant we leave stay-up mode.
PASS: *ds:si - instance data
es - segment of OLMenuWinClass
ax - method
cx, dx - ptr position
bp - [ UIFunctionsActive | buttonInfo ]
RETURN: ax, cx, dx, bp - ?
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 8/89 Initial version
------------------------------------------------------------------------------@
OLMenuWinPostPassiveButton method dynamic OLMenuWinClass, \
MSG_META_POST_PASSIVE_BUTTON
push ax, bp ;save method and flags
;for superclass call
;are any buttons pressed?
test bp, mask BI_PRESS ;any button pressed?
jnz callSuper ;skip if so...
;are any buttons pressed?
test bp, mask BI_B3_DOWN or mask BI_B2_DOWN or \
mask BI_B1_DOWN or mask BI_B0_DOWN
jnz callSuper ;skip if so...
;all buttons released: if not in stay-up-mode or pinned, close menu now.
test ds:[di].OLMWI_specState, mask OMWSS_IN_STAY_UP_MODE
jnz callSuper ;skip if so...
;If using cascading menus, call OLMenuWinCloseOrCascade which will
;take care of checking if this menu is currently cascading.
if _CASCADING_MENUS
call OLMenuWinCloseOrCascade ;destroys:ax,bx,cx,dx,bp,di
else ;_CASCADING_MENUS is FALSE
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_INTERACTION_COMPLETE
call WinClasses_ObjCallInstanceNoLock ;send to self
endif ;_CASCADING_MENUS
callSuper:
pop ax, bp ;get method and flags
;call superclass to handle remainder of work (EndGrab, etc)
GOTO WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far
OLMenuWinPostPassiveButton endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinEnterStayUpMode
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
METHOD: MSG_MO_MW_ENTER_STAY_UP_MODE
DESCRIPTION: This is sent by the MOMenuButton object when it realizes
that we are entering stay-up mode. This procedure sets some
state flags in this object.
PASS: *ds:si - instance data
es - segment of OLMenuWinClass
ax - method
cx = TRUE to force release of current GADGET EXCL owner,
so that higher-level menus close.
RETURN: ds:*si, es = same
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
eric 8/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLMenuWinEnterStayUpMode method dynamic OLMenuWinClass,
MSG_MO_MW_ENTER_STAY_UP_MODE
EC < cmp cx, TRUE >
EC < je 1$ >
EC < cmp cx, FALSE >
EC < ERROR_NE OL_ERROR >
EC <1$: >
;is ENTER_STAY_UP_MODE: set our state info, and start a pre-passive
;mouse grab so that we can exit stay-up mode when the button is
;next pressed.
ORNF ds:[di].OLMWI_specState, mask OMWSS_IN_STAY_UP_MODE
;inform our parent window that it has a menu in stay-up mode.
;(If this is a menu or sub-menu, inform GenPrimary/GenDisplay/
;GenSummons, etc. If is a sys-menu for a pinned menu, inform
;the menu.) This will cause OpenWinEndGrab to NOT force the release
;of the gadget exclusive as the mouse button is released.
push cx
mov ax, MSG_VIS_VUP_QUERY
mov cx, SVQT_HAS_MENU_IN_STAY_UP_MODE
call OLMenuWinCallButtonOrGenParent
pop cx
;if we want to force the release of high-level menus, send a VUP
;query through our menu button, so that 1) this menu gets the GADGET
;exclusive directly from the parent window (GenPrimary), and
;2) so that as the high-level menus close, our menu button does not
;force this menu to close.
tst cx
jz 10$
call OLMenuWinGrabRemoteGadgetExcl
10$: ;tell the Flow Object that we want to be notified of ANY button press,
;even if not on menu.
call VisAddButtonPrePassive
if _KBD_NAVIGATION and _MENU_NAVIGATION ;------------------------------
;CUA/Motif: set focus to first object in menu (is currently 0:0).
mov ax, MSG_GEN_NAVIGATE_TO_NEXT_FIELD
call WinClasses_ObjCallInstanceNoLock
endif ;--------------------------------------------------------------
ret
OLMenuWinEnterStayUpMode endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinLeaveStayUpMode
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
METHOD: MSG_MO_MW_LEAVE_STAY_UP_MODE
DESCRIPTION: This method is sent by this object to itself when
a pre-passive button event is received, indicating that
we should exit stay-up mode.
PASS: *ds:si - instance data
es - segment of OLMenuWinClass
ax - method
cx, dx - mouse position in screen coordinates
bp - [ UIFunctionsActive | buttonInfo ]
(for menu window - indicates if pointer is inside menu)
RETURN: ds:*si, es = same
cx = TRUE if mouse over menu button
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
eric 8/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLMenuWinLeaveStayUpMode method dynamic OLMenuWinClass,
MSG_MO_MW_LEAVE_STAY_UP_MODE
EC < call VisCheckVisAssumption ;make sure ds:*si ok >
;FIRST: make sure that we are in stay-up-mode, so that we don't
;mess up the state of the parent window (GenPrimary) by telling it
;that we are leaving stay-up-mode when we aren't.
;Do we ever have a case where the OMWSS_IN_STAY_UP_MODE has been reset already,
;so that we don't release our VisRemoveButtonPrePassive before the window
;goes away??? Seems to happen 1/100 times that menu navigation is used.
;
;Should not be a problem, as VisRemoveButtonPrePasive is called from VisClose,
;just to make sure that it is gene -- Doug
;
test ds:[di].OLMWI_specState, mask OMWSS_IN_STAY_UP_MODE
jz done ;skip if not in stay-up mode...
;reset state bit, remove passive grab, ;and send
;MSG_MO_MB_LEAVE_STAY_UP_MODE to OLMenuButton, so it knows to set
;closing = TRUE
ANDNF ds:[di].OLMWI_specState, not (mask OMWSS_IN_STAY_UP_MODE)
call VisRemoveButtonPrePassive
;inform our parent window that it has no menu in stay-up mode.
;(If this is a menu or sub-menu, inform GenPrimary/GenDisplay/
;GenSummons, etc. If is a sys-menu for a pinned menu, inform
;the menu.)
push cx, dx, bp
mov ax, MSG_VIS_VUP_QUERY
mov cx, SVQT_NO_MENU_IN_STAY_UP_MODE
call OLMenuWinCallButtonOrGenParent
pop cx, dx, bp
;First: send method to menu button which opens this menu,
;so it will reset its state bit
;Pass: bp - [ UIFunctionsActive | buttonInfo ]
; (for menu window - indicates if pointer is inside menu)
tst ds:[di].OLPWI_button ;make sure we have a button
jnz sendToButton ;if yes, send to button
clr cx ;else return cx = FALSE
ret
sendToButton:
mov ax, MSG_MO_MB_LEAVE_STAY_UP_MODE
call OLPopupWinSendToButton
done:
ret
OLMenuWinLeaveStayUpMode endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinCascadeMode
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Enables/disables cascade mode.
Will cause submenu's to be killed if disabling cascade mode
or cascading with a different submenu optr.
Will automatically start the grab for this window if the
result of this call closes a menu.
CALLED BY: MSG_MO_MW_CASCADE_MODE
PASS: *ds:si = OLMenuWinClass object
ds:di = OLMenuWinClass instance data
ds:bx = OLMenuWinClass object (same as *ds:si)
es = segment of OLMenuWinClass
ax = message #
cl = OLMenuWinCascadeModeOptions
OMWCMO_CASCADE
True=Enable/False=Disable cascade mode.
OMWCMO_START_GRAB
If TRUE, will take the grabs and take the gadget
exclusive after setting the cascade mode.
if OMWCMO_CASCADE = TRUE
^ldx:bp = optr to submenu
else
dx, bp are ignored
RETURN: Nothing
DESTROYED: ax, cx
SIDE EFFECTS:
If cascade mode is enabled, the menu will NOT be closed when a
lost gadget exclusive is received, nor when the passive grab wants
to close it. It will, however, still be closed by a
MSG_MO_MW_GUP_SUBMENU_REQUESTS_CLOSE message if the ignore bit
is not set.
PSEUDO CODE/STRATEGY:
None
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 4/21/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _CASCADING_MENUS
OLMenuWinCascadeMode method dynamic OLMenuWinClass,
MSG_MO_MW_CASCADE_MODE
.enter
push cx ; save for last (cl)
; set cascading information based upon argument
; ensure original cascade data is correct before changing (EC)
EC < call OLMenuWinECCheckCascadeData >
mov ch, ds:[di].OLMWI_moreSpecState ; save original state
clr ax ; use ah to keep cascade bit
; Here we put the new cascade bit into ah, later into ch.
; This value is or'ed back into instance data after the "done"
; label. This is done this way because some routines called below
; depend upon the moreSpecState's CASCADE bit to be consistent with
; the vardata which hasn't been changed yet.
test cl, mask OMWCMO_CASCADE
jz handleVarData
ornf ah, mask OMWMSS_IS_CASCADING
handleVarData:
; check to see if the cascading bit changed
xor ch, ah
test ch, mask OMWMSS_IS_CASCADING ; test if bit changed
push cx ; case "changed" info (ch)
mov ch, ah ; new state is now in ch
mov ax, ATTR_OL_MENU_WIN_CASCADED_MENU
jnz updateVarData ; bit changed - fix var data
; cascade bit hasn't change. Check to see if the bit is true.
test cl, mask OMWCMO_CASCADE
jz done ; not cascading, we're done
; We are cascading. Make sure that the handle passed is the same as
; the handle stored.
call ObjVarFindData ; ds:bx = ptr to data
EC < ERROR_NC OL_ERROR ; SHOULD HAVE VAR DATA >
; compare handle already in var data with ^ldx:bp (handle passed in)
cmp ds:[bx].handle, dx ; ^ldx:bp = handle passed in
jne changeVarData ; nope, need to change vardata
cmp ds:[bx].offset, bp
je done ; handle is the same, we're done
changeVarData:
; handle not the same. we need to force the close of the submenu
; tree starting with the old handle, and then update the stored handle.
; Close "old" submenus below this menu
push ax, cx, dx, bp, bx
mov cx, TRUE
call OLMenuWinSendCloseRequestToLastMenu ; destroy:ax,bx,cx,dx,bp
pop ax, cx, dx, bp, bx
; change var data to reflect the new submenu. Then we're done.
call ObjVarFindData ; may have moved
movdw ds:[bx], dxbp
jmp short done
updateVarData:
; the bit has changed.. adjust the var data accordingly
test cl, mask OMWCMO_CASCADE
jz deleteVarData
; add var data
push cx
mov cx, size optr ; size of data
call ObjVarAddData ; ds:bx = ptr to data
movdw ds:[bx], dxbp ; ^ldx:bp = handle passed in
pop cx
jmp short done
deleteVarData:
; Close all submenus below current menu
push ax, cx
mov cx, TRUE
call OLMenuWinSendCloseRequestToLastMenu
pop ax, cx
; Delete the var data
call ObjVarDeleteData
EC < ERROR_C OL_ERROR ; nothing deleted? should have var data!>
done:
; ONLY the cascade bit should be set in ch.
EC < test ch, not (mask OMWMSS_IS_CASCADING) >
EC < ERROR_NZ OL_ERROR ;ch got trashed >
mov di, ds:[si]
add di, ds:[di].Vis_offset
; store new cascade bit
andnf ds:[di].OLMWI_moreSpecState, not mask OMWMSS_IS_CASCADING
ornf ds:[di].OLMWI_moreSpecState, ch
; check to make sure that we didn't screw up the data consistency
EC < call OLMenuWinECCheckCascadeData >
; Decide to start up grabs and/or enter stay up mode.
pop cx ; "change" info (ch)
pop ax ; get passed flags (al)
; If we are cascading, then don't do any of this.. we don't want to
; take the gadget exclusive away from someone else...
test al, mask OMWCMO_CASCADE ; cascading?
jnz dontGrab ; yes.. done
; ch = the OLMWI_moreSpecState cascading information that has changed.
; We know that we aren't currently cascading. So, IF we were
; cascading (i.e. we closed submenus) OR we were told to start the
; grab, then ask the window to startup grab.
mov cl, al
test cx, (mask OMWMSS_IS_CASCADING shl 8) or mask OMWCMO_START_GRAB
jz dontGrab ; nope.. done
push ax ; preserve passed flags
mov ax, MSG_OL_WIN_STARTUP_GRAB
call ObjCallInstanceNoLock
pop ax
; Were we told to start grab? If so, then we also enter stay up
; mode. Otherwise, we just bail.
test al, mask OMWCMO_START_GRAB
jz dontGrab ; skip stay up mode...
mov cx, TRUE ; grab gadget exclusive
mov ax, MSG_MO_MW_ENTER_STAY_UP_MODE
call ObjCallInstanceNoLock
dontGrab:
.leave
ret
OLMenuWinCascadeMode endm
endif ;_CASCADING_MENUS
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinMoveResizeWin -- MSG_VIS_MOVE_RESIZE_WIN for OLWinClass
DESCRIPTION: Intercepts the method which does final positioning & resizing
of a window, in order to allow pinned menu to be moved
off-screen.
PASS: *ds:si - instance data
es - segment of OLMenuWinClass
ax - MSG_VIS_MOVE_RESIZE_WIN
RETURN: nothing
DESTROYED: ?
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 1/90 Initial version
------------------------------------------------------------------------------@
OLMenuWinMoveResizeWin method dynamic OLMenuWinClass, MSG_VIS_MOVE_RESIZE_WIN
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jz callSuper ;skip if not...
;relax positioning behavior somewhat - allow menu to be
;partially obscured.
ANDNF ds:[di].OLWI_winPosSizeFlags, not (mask WPSF_CONSTRAIN_TYPE)
ORNF ds:[di].OLWI_winPosSizeFlags, \
WCT_KEEP_PARTIALLY_VISIBLE shl offset WPSF_CONSTRAIN_TYPE
callSuper:
;finally, call superclass to do move/resize
call WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far
;and update scrollers if needed
call ImGetButtonState ; non-zero if pressed
call OLMenuWinUpdateUpDownScrollers
ret
OLMenuWinMoveResizeWin endp
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinVisClose -- MSG_VIS_CLOSE for OLMenuWinClass
DESCRIPTION: We intercept this method here so that we can release
any remote gadget exclusives that we might have.
PASS: *ds:si - instance data
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 6/90 initial version
------------------------------------------------------------------------------@
OLMenuWinVisClose method dynamic OLMenuWinClass, MSG_VIS_CLOSE
;send query to generic parent (do not send to self, in the hope
;of deciding whether to send to button or genparent, because self
;will handle as if a child had called!)
push ax, cx, dx, bp
call OLMenuWinReleaseRemoteGadgetExcl
pop ax, cx, dx, bp
;call superclass (OLPopupWinClass) for default handling
call WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far
; Update up/down scrollers as needed
mov al, 0
call OLMenuWinUpdateUpDownScrollers
ret
OLMenuWinVisClose endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinEnsureNoMenusInStayUpMode
DESCRIPTION: This method is sent from the Flow object to all objects
which have active or passive mouse grabs.
PASS: *ds:si - instance data
es - segment of OLWinClass
cx:dx - EnsureNoMenusInStayUpModeParams, of null if no buffer
passed
RETURN: ax = 0 (due to byte-saving measure in FlowObject)
DESTROYED:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 6/90 Initial version
------------------------------------------------------------------------------@
OLMenuWinEnsureNoMenusInStayUpMode method dynamic OLMenuWinClass, \
MSG_META_ENSURE_NO_MENUS_IN_STAY_UP_MODE
;if PINNED = TRUE, it means that we are entering pinned mode.
;Do not close menu if so.
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jnz done
;Otherwise, if the menu is in stay-up-mode, force it to close now.
test ds:[di].OLMWI_specState, mask OMWSS_IN_STAY_UP_MODE
jz done ;exit if not stay up mode
tst cx
jnz incDismissCount
push cx, dx, bp
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_DISMISS
call WinClasses_ObjCallInstanceNoLock
pop cx, dx, bp
jmp short sendToKids
incDismissCount:
tst cx ;no buffer, branch
jz sendToKids
EC < push ds, si >
EC < movdw dssi, cxdx >
EC < call ECCheckBounds >
EC < pop ds, si >
mov es, cx
mov bx, dx
inc es:[bx].ENMISUMP_menuCount ;increment menu count
sendToKids:
;
; Now, to close any of our submenus, send to our children
;
mov ax, MSG_META_ENSURE_NO_MENUS_IN_STAY_UP_MODE
call GenSendToChildren
done:
clr ax ;Return "MouseFlags" null
ret
OLMenuWinEnsureNoMenusInStayUpMode endm
WinClasses ends
KbdNavigation segment resource
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinFupKbdChar - MSG_META_FUP_KBD_CHAR handler
for OLMenuWinClass
DESCRIPTION: This method is sent by child which 1) is the focused object
and 2) has received a MSG_META_FUP_KBD_CHAR
which is does not care about. Since we also don't care
about the character, we forward this method up to the
parent in the focus hierarchy.
PASS: *ds:si = instance data for object
cx = character value
dl = CharFlags
dh = ShiftState (ModBits)
bp low = ToggleState
bp high = scan code
RETURN: carry set if handled
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 2/90 initial version
------------------------------------------------------------------------------@
if _KBD_NAVIGATION ;------------------------------------------------------
OLMenuWinFupKbdChar method dynamic OLMenuWinClass, MSG_META_FUP_KBD_CHAR
push ax ;save method
test dl, mask CF_FIRST_PRESS or mask CF_REPEAT_PRESS
LONG jz callSuper ;skip if not press event...
;ADDED 10/23/90 by Eric to prevent pinned menus from interpreting keyboard
;navigation keys which would try to close the menu.
;if this menu is pinned (the user must have pinned it using
;keyboard navigation, for the focus to be inside the menu),
;then ignore key at this class level.
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jnz checkControlMenuNavigationThenInternalKeys ;skip if is pinned...
;if this menu has a menu button (i.e. is not a popup menu), then
;first check for the keys which cause us to send methods to the button.
tst ds:[di].OLPWI_button ;is there a menu button?
jz checkInternalKeys ;skip if not...
;we will check these keys using two tables: one for menus, one
;for sub-menus.
mov bx, ds:[di].OLCI_buildFlags
ANDNF bx, mask OLBF_REPLY
cmp bx, OLBR_SUB_MENU shl offset OLBF_REPLY
push es ;set es:di = table of shortcuts
segmov es, cs
mov di, offset cs:OLMenuWinKbdBindings
jne 10$ ;skip if is menu...
;is a sub-menu
mov di, offset cs:OLMenuWinKbdBindings2
10$:
call ConvertKeyToMethod
pop es
jnc checkInternalKeys ;skip if none found...
cmp ax, MSG_META_DUMMY ;left-arrow in sub-menu?
je closeSubMenuToParentMenu ;skip if so...
sendToButton:
ForceRef sendToButton
;
; Code put in here to do nothing with left and right arrows for express
; menus, so we won't have complicated deaths in express submenus.
; There's probably a cleaner solution than this. -cbh 11/ 4/92
;
if EVENT_MENU
push ax
mov ax, HINT_EVENT_MENU
call ObjVarFindData
pop ax
jc 19$
endif
push ax
mov ax, HINT_EXPRESS_MENU
call ObjVarFindData
pop ax
jnc 20$
19$::
SBCS < mov cx, (CS_CONTROL shl 8) or VC_ESCAPE ;make an escape key >
DBCS < mov cx, C_SYS_ESCAPE ;make an escape key >
mov ax, MSG_META_FUP_KBD_CHAR
20$:
call OLMenuWinFocusAndCallButton ;trashes si
popExit:
pop ax
stc ;say handled
ret
closeSubMenuToParentMenu:
call OLMenuWinKbdCloseSubMenuToParentMenu ;trashes si
pop ax
stc ;say handled
ret
;ADDED 10/23/90 by Eric to allow usage of the System Menu Button in a
;pinned menu.
checkControlMenuNavigationThenInternalKeys:
;pass ds:di = instance data
call HandleMenuNavigation ;do menu navigation, if needed
jnc checkInternalKeys ;skip if not handled...
pop ax
ret
checkInternalKeys:
;now check for keys which we can handle by navigating within
;this menu.
push es ;set es:di = table of shortcuts
segmov es, cs
mov di, offset cs:OLMenuWinKbdBindings3
call ConvertKeyToMethod
pop es
jnc callSuper ;skip if none found...
sendToSelf::
push ds ;save KBD char in idata so that when
mov bp, segment idata
segmov ds, bp ;new child item (possibly a genlist)
mov ds:[lastKbdCharCX], cx ;gains focus, it knows whether to start
pop ds ;at top or bottom item in list.
mov cx, IC_INTERACTION_COMPLETE ;in case we send
;MSG_GEN_GUP_INTERACTION_COMMAND
call ObjCallInstanceNoLock
push ds ;reset our saved KBD char to "none"
mov bp, segment idata ;so that if a genlist gains the focus
segmov ds, bp
clr ds:[lastKbdCharCX] ;because the menu regains focus,
pop ds ;it starts at the top item in the list
handled::
pop ax
stc ;say handled
ret
callSuper:
;we don't care about this keyboard event. Call our superclass
;so it will be forwarded up the focus hierarchy.
pop ax ;get method
mov di, offset OLMenuWinClass
GOTO ObjCallSuperNoLock
OLMenuWinFupKbdChar endm
;Keyboard shortcut bindings for OLMenuWinClass (do not separate tables)
;*** KEYS FOR MENU, WHICH WILL SEND METHODS TO THE MENU BUTTON ***
OLMenuWinKbdBindings label word
word length OLMWShortcutList
;P C S C
;h A t h S h
;y l r f e a
;s t l t t r
if DBCS_PCGEOS
OLMWShortcutList KeyboardShortcut \
<0, 0, 0, 0, C_SYS_LEFT and mask KS_CHAR>, ;previous menu
<0, 0, 0, 0, C_SYS_RIGHT and mask KS_CHAR>, ;next menu
<0, 0, 0, 0, C_SYS_ESCAPE and mask KS_CHAR> ;close menu, go up
else
OLMWShortcutList KeyboardShortcut \
<0, 0, 0, 0, 0xf, VC_LEFT>, ;NAVIGATE TO PREVIOUS (MENU)
<0, 0, 0, 0, 0xf, VC_RIGHT>, ;NAVIGATE TO NEXT (MENU)
<0, 0, 0, 0, 0xf, VC_ESCAPE> ;CLOSE MENU (will continue up tree)
endif
;insert additional shortcuts here.
;OLMWMethodList label word
word MSG_SPEC_NAVIGATE_TO_PREVIOUS_FIELD
word MSG_SPEC_NAVIGATE_TO_NEXT_FIELD
;use SPEC instead of GEN method since
;we are sending to non-generic objects.
word MSG_META_FUP_KBD_CHAR ;will send cx, dx, bp up to menu button
;disguised as MSG_META_FUP_KBD_CHAR.
;Button will close this menu and those
;above it.
;*** KEYS FOR SUB-MENU, WHICH WILL SEND METHODS TO THE MENU BUTTON ***
OLMenuWinKbdBindings2 label word
word length OLMWShortcutList2
;P C S C
;h A t h S h
;y l r f e a
;s t l t t r
if DBCS_PCGEOS
OLMWShortcutList2 KeyboardShortcut \
<0, 0, 0, 0, C_SYS_LEFT and mask KS_CHAR>, ;close sub-menu
<0, 0, 0, 0, C_SYS_RIGHT and mask KS_CHAR>, ;close, go to next
<0, 0, 0, 0, C_SYS_ESCAPE and mask KS_CHAR> ;close menu, go up
else
OLMWShortcutList2 KeyboardShortcut \
<0, 0, 0, 0, 0xf, VC_LEFT>, ;CLOSE THIS SUB-MENU (ONLY)
<0, 0, 0, 0, 0xf, VC_RIGHT>, ;CLOSE THIS SUB-MENU AND THE PARENT
;MENU, OPEN THE NEXT TOP-LEVEL MENU.
<0, 0, 0, 0, 0xf, VC_ESCAPE> ;CLOSE MENU (will continue up tree)
endif
;insert additional shortcuts here.
;OLMWMethodList2 label word
word MSG_META_DUMMY ;we will handle this specially: see
;OLMenuWinKbdCloseSubMenuToParentMenu
word MSG_OL_MENU_BUTTON_SEND_RIGHT_ARROW_TO_PARENT_MENU
;send method to menu button, so it will
;send a MSG_META_FUP_KBD_CHAR to the
;menu it is in, simulating the RIGHT
;arrow being pressed. Will close parent
;menu, and open next top-level menu.
word MSG_META_FUP_KBD_CHAR ;will send cx, dx, bp up to menu button
;disguised as MSG_META_FUP_KBD_CHAR.
;Button will close this menu and those
;above it.
;*** KEYS FOR MENU, WHICH ARE SENT TO THIS MENU ***
OLMenuWinKbdBindings3 label word
word length OLMWShortcutList3
;P C S C
;h A t h S h
;y l r f e a
;s t l t t r
if DBCS_PCGEOS
OLMWShortcutList3 KeyboardShortcut \
<0, 0, 0, 0, C_SYS_UP and mask KS_CHAR>, ;previous menu item
<0, 0, 0, 0, C_SYS_DOWN and mask KS_CHAR>, ;next menu item
<0, 0, 0, 0, C_SYS_ESCAPE and mask KS_CHAR> ;close popup
else
OLMWShortcutList3 KeyboardShortcut \
<0, 0, 0, 0, 0xf, VC_UP>, ;NAVIGATE TO PREVIOUS menu item
<0, 0, 0, 0, 0xf, VC_DOWN>, ;NAVIGATE TO NEXT menu item
<0, 0, 0, 0, 0xf, VC_ESCAPE> ;CLOSE THIS POPUP MENU (has no button)
endif
;insert additional shortcuts here.
;OLMWMethodList3 label word
word MSG_GEN_NAVIGATE_TO_PREVIOUS_FIELD
word MSG_GEN_NAVIGATE_TO_NEXT_FIELD
word MSG_GEN_GUP_INTERACTION_COMMAND
;ODIE: adding items here requires change in code above
endif ;----------------------------------------------------------------------
COMMENT @----------------------------------------------------------------------
ROUTINE: OLMenuWinFocusAndCallButton
SYNOPSIS: Places the FOCUS exclusive on the menu button, and then
forwards the passed method on to it.
IMPORTANT: this is not called for popup menus, since they
DO NOT have a menu button!
CALLED BY: OLMenuWinFupKbdChar
PASS: *ds:si -- handle
ax -- navigation method to call button's parent with
RETURN: nothing
DESTROYED: ax, cx, dx, bp, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 5/ 2/90 Initial version
Eric 6/90 update, more doc.
------------------------------------------------------------------------------@
OLMenuWinFocusAndCallButton proc near
class OLMenuWinClass
;set *ds:si = OLMenuButtonClass object, and send some methods to it.
call KN_DerefVisSpec_DI
mov si, ds:[di].OLPWI_button ;set *ds:si = menu button
EC < tst si >
EC < ERROR_Z OL_ERROR ;we MUST have a button >
EC < call VisCheckVisAssumption ;make sure everything's OK >
;
; skip giving focus to menu button if kbd-char (ESCAPE)
;
cmp ax, MSG_META_FUP_KBD_CHAR
je afterFocus
;first move the focus inside the Primary to the menu button.
;(must indicate that is MENU_RELATED!)
push ax, cx, dx, bp
mov bp, mask MAEF_OD_IS_MENU_RELATED or \
mask MAEF_GRAB or mask MAEF_FOCUS or mask MAEF_NOT_HERE
mov cx, ds:[LMBH_handle]
mov dx, si
mov ax, MSG_META_MUP_ALTER_FTVMC_EXCL
call ObjCallInstanceNoLock
pop ax, cx, dx, bp ;restore method args
afterFocus:
;Do whatever navigation is called for at the menu bar level.
;(send to menu button, not its parent, since we might be sending
;MSG_META_FUP_KBD_CHAR.)
push ax
call ObjCallInstanceNoLock ;navigate / handle ESCAPE
pop ax
cmp ax, MSG_OL_MENU_BUTTON_SEND_RIGHT_ARROW_TO_PARENT_MENU
je exit ;skip if not navigating...
cmp ax, MSG_META_FUP_KBD_CHAR ;if not navigating,
je exit ;skip to end...
;else, was navigating: Find out which object in the window
;was navigated to, and send a method which will only activate
;menu buttons. Standard OLButtonClass objects will ignore.
mov ax, MSG_VIS_VUP_QUERY_FOCUS_EXCL
call VisCallParent ;returns focus in cx:dx
mov bx, cx ;set up focus in ^lbx:si
mov si, dx
mov ax, MSG_OL_MENU_BUTTON_KBD_ACTIVATE
mov di, mask MF_FIXUP_DS
call ObjMessage
exit:
ret
OLMenuWinFocusAndCallButton endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinSendCloseRequestToParentMenu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Looks up the generic tree to find an object of class
OLMenuWinClass. The search is continued until an
object that is not a subclass of GenInteractionClass is
found. If it finds the menu window, the message
MSG_MO_MW_CASCADE_MODE(OMWCMO_START_GRAB) is called.
The menu window object's vis part MUST already be built.
CALLED BY: OLMenuWinKbdCloseSubMenuToParentMenu
PASS: *ds:si = menu object
RETURN: *ds:si = current menu object. (ds is fixed up).
DESTROYED: ax, bx, cx, dx, bp, di
SIDE EFFECTS:
WARNING: This routine MAY resize LMem and/or object blocks, moving
them on the heap and invalidating stored segment pointers
and current register or stored offsets to them.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 8/6/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _CASCADING_MENUS
OLMenuWinSendCloseRequestToParentMenu proc near
uses si, es
.enter
mov bx, ds:[LMBH_handle]
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov si, ds:[di].OLPWI_button ; ^lbx:si = menu button
tst si
jz done
searchLoop:
mov ax, MSG_VIS_FIND_PARENT
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
jcxz done
movdw bxsi, cxdx ; ^lbx:si = parent
call ObjSwapLock
segmov es, <segment GenInteractionClass>, di
mov di, offset GenInteractionClass
call ObjIsObjectInClass
jnc unlock ; break out of loop
segmov es, <segment OLMenuWinClass>, di
mov di, offset OLMenuWinClass
call ObjIsObjectInClass
cmc
jc unlock ; continue up tree
mov cl, mask OMWCMO_START_GRAB
mov ax, MSG_MO_MW_CASCADE_MODE
call ObjCallInstanceNoLock
clc
unlock:
call ObjSwapUnlock
jc searchLoop ; continue if carry set
done:
.leave
ret
OLMenuWinSendCloseRequestToParentMenu endp
endif ;_CASCADING_MENUS
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinKbdCloseSubMenuToParentMenu
DESCRIPTION: This procedure is used when the left-arrow key is pressed
inside the menu. If this menu is not pinned, we close this
menu, and place the focus on our menu button,
inside the parent menu.
CALLED BY: OLMenuWinFupKbdChar
PASS: *ds:si = instance data for object
RETURN: nothing
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 6/90 initial version
------------------------------------------------------------------------------@
OLMenuWinKbdCloseSubMenuToParentMenu proc far
class OLMenuWinClass
call KN_DerefVisSpec_DI
test ds:[di].OLWI_specState, mask OLWSS_PINNED
LONG jnz done
if ERROR_CHECK
;Do NOT test for WAS_PINNED case.
; fail case: pin a sub-menu, then try to navigate to it by going through
; the parent menu. Once the sub-menu is visible, press left-arrow to
; get back to parent.
;
; test ds:[di].OLMWI_specState, mask OMWSS_WAS_PINNED
; ERROR_NZ OL_ERROR
;make sure this menu is a sub-menu
mov bx, ds:[di].OLCI_buildFlags ;will be used below
ANDNF bx, mask OLBF_REPLY ;see if we are sub-menu or menu
cmp bx, OLBR_SUB_MENU shl offset OLBF_REPLY
ERROR_NE OL_ERROR
endif
;set *ds:si = OLMenuButtonClass object, and send some methods to it.
push si ;save *ds:si = submenu
mov si, ds:[di].OLPWI_button ;set *ds:si = menu button
push si ;save menu button
call KN_DerefVisSpec_DI ;set ds:di = menu button
;make sure that we have a valid menu button, and that it thinks
;this menu is opened
EC < tst si >
EC < ERROR_Z OL_ERROR ;we MUST have a button >
EC < call VisCheckVisAssumption ;make sure everything's OK >
EC < test ds:[di].OLMBI_specState, mask OLMBSS_POPUP_OPEN >
EC < ERROR_Z OL_ERROR >
;reset OLButton and OLMenuButton state flags for this menu button
.warn -private
ANDNF ds:[di].OLMBI_specState, not (mask OLMBSS_POPUP_OPEN)
.warn @private
;hack: force the button to reset itself visually (without redrawing),
;so that when it gains the focus, it can save this state again.
;pass ds:di = instance data
call OLButtonRestoreBorderedAndDepressedStatus
;now make sure that the parent menu that this menu button is inside
;gets the focus window exclusive from the GenPrimary.
mov ax, MSG_META_GRAB_FOCUS_EXCL
call CallOLWin
pop si ;restore *ds:si = menu button
;dismiss this menu. It has already lost the focus. This will
;cause the menu button to redraw properly.
pop di ;set *ds:si = submenu
xchg si, di ;set *ds:di = menu button, *ds:si=menu
push si
push di
if _CASCADING_MENUS
;
; close last menu only
;
call OLMenuWinSendCloseRequestToParentMenu
else
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_DISMISS
call ObjCallInstanceNoLock
endif
pop si ;set *ds:si = menu button
;now move the focus inside the parent menu to the menu button.
;(DO NOT pass IS_MENU_RELATED flag!) This will cause the menu button
;to draw properly. (*ds:si = menu button)
call MetaGrabFocusExclLow
afterGrab:
pop si ;restore *ds:si = menu
done:
ret
OLMenuWinKbdCloseSubMenuToParentMenu endp
KbdNavigation ends
WinClasses segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinBringToTop
DESCRIPTION: Intercepts default handler to check to see if this is an
app modal window. If it is, & it is coming to the top of
the screen, then it should be made THE modal window within
the application.
PASS:
*ds:si - instance data
es - segment of MetaClass
ax - MSG_GEN_BRING_TO_TOP
cx, dx, bp - ?
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 3/90 Initial version
------------------------------------------------------------------------------@
;IMPORTANT: this method handler must match OpenWinBringToTop in functionality,
;except for FOCUS handling.
OLMenuWinBringToTop method dynamic OLMenuWinClass, MSG_GEN_BRING_TO_TOP
;if this window is not opened then abort: the user or application
;caused the window to close before this method arrived via the queue.
call VisQueryWindow
tst di
jz setGenState ; Skip if window not opened...
;Raise window to top of window group
clr ax
clr dx ; Leave LayerID unchanged
call WinChangePriority
call MenuWinScrollerEnsureOnTop
;if this menu is pinned, DO NOT grab the FOCUS exclusive.
;During MSG_META_START_BUTTON, we will determine if a menu item is
;being pressed on, and will decide whether to grab the focus.
;Note: no need to grab the target exclusive.
call WinClasses_DerefVisSpec_DI
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jnz setGenState ;skip if is pinned...
call OpenCheckIfMenusTakeFocus
jnc setGenState
;
; Let's try grabbing the mouse. The problem is that when this menu
; comes up, the menu button that created it gets a MSG_META_PTR out
; of its bounds, which causes it to release the mouse, and realizing
; that it did have the mouse beforehand, causes it to give the focus
; back to its parent window. So submenus never get the focus.
; -cbh 6/22/92 (Removed -- causes problems when clicking and
; releasing on the left-edge of submenu menu buttons -- the submenu
; goes away without doing anyway when you click on it. -cbh 10/13/92)
;
; call VisGrabMouse
mov ax, MSG_META_GRAB_FOCUS_EXCL
call WinClasses_ObjCallInstanceNoLock
;Make it the focus window, if posible
setGenState:
; Raise the active list entry to
; the top, to reflect new/desired
; position in window hierarchy.
; (If no active list entry, window
; isn't up & nothing will be done)
mov cx, ds:[LMBH_handle]
mov dx, si
mov ax, MSG_GEN_APPLICATION_BRING_WINDOW_TO_TOP
call GenCallApplication
ret
OLMenuWinBringToTop endm
MenuWinScrollerEnsureOnTop proc near
uses bx, si, di
.enter
mov ax, TEMP_OL_MENU_WIN_SCROLLERS
call ObjVarFindData
jnc done
push ds:[bx].MWSS_downScroller
mov si, ds:[bx].MWSS_upScroller
call ensureScrollerOnTop
pop si
call ensureScrollerOnTop
done:
.leave
ret
ensureScrollerOnTop label near
tst si
jz ensureDone
mov di, ds:[si]
mov di, ds:[di].MWSI_window
tst di
jz ensureDone
clr ax, dx ; just bring to top of layer
call WinChangePriority
ensureDone:
retn
MenuWinScrollerEnsureOnTop endp
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinGrabGadgetExcl
DESCRIPTION: This routine ensures that the gadget exclusive mechanism
is set up to that it will close this menu if the parent
window (GenPrimary) suddenly goes away. Note that this routine
works according to whether the mouse or keyboard was used
to place the menu in stay-up-mode:
MOUSE: we send a VUP query through our menu button, so that
it will eventually reach the GenPrimary. We grab the gadget
exclusive directly from the primary, forcing any higher-level
or same-level menus to close.
KBD: we do absolutely nothing. Since this menu was placed
in stay-up mode via the keyboard, the user must have of
activated our menu button. Therefore that button has the
gadget exclusive, and will close this menu if the button
loses the gadget.
PASS: *ds:si = instance data for object
RETURN: nothing
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 3/90 initial version
------------------------------------------------------------------------------@
OLMenuWinGrabRemoteGadgetExcl proc far ; uses GOTO
;send query to button or generic parent (do not send to self, in the
;hope of deciding whether to send to button or genparent, because self
;will handle as if a child had called!) If this query passes through
;our menu button, it will reset a state flag and then be sent up the
;tree as a standard SVQT_REMOTE_GRAB_GADGET_EXCL query.
mov cx, SVQT_NOTIFY_MENU_BUTTON_AND_REMOTE_GRAB_GADGET_EXCL
mov ax, MSG_VIS_VUP_QUERY
mov bp, ds:[LMBH_handle] ;pass ^lbp:dx = this object
mov dx, si
GOTO OLMenuWinCallButtonOrGenParent
OLMenuWinGrabRemoteGadgetExcl endp
OLMenuWinReleaseRemoteGadgetExcl proc far ; uses GOTO
mov cx, SVQT_REMOTE_RELEASE_GADGET_EXCL
mov ax, MSG_VIS_VUP_QUERY
mov bp, ds:[LMBH_handle] ;pass ^lbp:dx = this object
mov dx, si
GOTO OLMenuWinCallButtonOrGenParent
OLMenuWinReleaseRemoteGadgetExcl endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinVupQuery -- MSG_VIS_VUP_QUERY for OLMenuWinClass
DESCRIPTION: Respond to MSG_VIS_VUP_QUERY.
PASS: *ds:si = instance data for object
ds:di = specific instance (OLMenuWin)
cx = SpecVisQueryType (see cConstant.def)
RETURN: carry set if answered query
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 4/90 initial version
------------------------------------------------------------------------------@
OLMenuWinVupQuery method dynamic OLMenuWinClass, MSG_VIS_VUP_QUERY
cmp cx, SVQT_HAS_MENU_IN_STAY_UP_MODE
je callSuperIfPinned
cmp cx, SVQT_NO_MENU_IN_STAY_UP_MODE
je callSuperIfPinned ;Both changed from callSuperIfPinned
; so this function actually does
; what it's supposed to in non-pinned
; menus. -cbh 12/30/93
;Changed back to callSuperIfPinned
; to fix problem with submenus not
; staying up if parent menu is not in
; stay up mode. - Joon (7/28/94)
cmp cx, SVQT_REMOTE_GRAB_GADGET_EXCL
je callSuperIfPinned ;skip if cannot handle query...
cmp cx, SVQT_REMOTE_RELEASE_GADGET_EXCL
je callSuperIfPinned
callSuper:
GOTO WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far
callSuperIfPinned:
;if this is a pinned menu (or will revert back to being a pinned
;menu shortly), behave as a base window: call superclass,
;so that OLWinClass handles this query as if this window was
;a GenPrimary. Otherwise (is normal menu), send query up tree.
FALL_THRU OLMenuWinCallSuperIfPinned
OLMenuWinVupQuery endm
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinCallSuperIfPinned
DESCRIPTION: If this menu is pinned (or will shortly revert back to being
pinned), then behave as a base window: call superclass,
so that OLWinClass handles this query as if this window was
a GenPrimary.
CALLED BY: OLMenuWinVupQuery, OLMenuWinVupGrabFocusWinExcl
PASS: *ds:si = instance data for object
es = segment of OLMenuWinClass
ax = method to send
cx, dx, bp = data to send with method
RETURN: nothing
DESTROYED: ?
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 6/90 initial version
------------------------------------------------------------------------------@
OLMenuWinCallSuperIfPinned proc far
class OLMenuWinClass
call WinClasses_DerefVisSpec_DI
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jnz callSuper ;skip if pinned (cy=0)...
test ds:[di].OLMWI_specState, mask OMWSS_WAS_PINNED
jnz callSuper ;skip if pinned (cy=0)...
;this menu is not pinned: is an intermediate menu inbetween the
;requesting submenu, and the base window. Forward up the tree:
;if has a menu button, send VUP_QUERY from that button. Otherwise,
;send to generic parent and pray!
GOTO OLMenuWinCallButtonOrGenParent
callSuper:
GOTO WinClasses_ObjCallSuperNoLock_OLMenuWinClass_Far
OLMenuWinCallSuperIfPinned endp
OLMenuWinCallButtonOrGenParent proc far ;called via GOTO
class OLMenuWinClass
;this menu is not pinned: is an intermediate menu inbetween the
;requesting submenu, and the base window. Forward up the tree:
;if has a menu button, send VUP_QUERY from that button. Otherwise,
;send to generic parent and pray!
call WinClasses_DerefVisSpec_DI
.warn -private
tst ds:[di].OLPWI_button ;do we have a menu button?
.warn @private
jz callGenParent ;skip if not...
call OLPopupWinSendToButton ; (is movable, so no GOTO)
ret
callGenParent:
GOTO GenCallParent
OLMenuWinCallButtonOrGenParent endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinAlterFTVMCExcl
DESCRIPTION: We intercept this method here so that if a sub-menu requests
the focus window exclusive from an un-pinned menu,
we forward the request on up to the parent window (GenPrimary
or GenDisplay).
PASS: *ds:si - instance data
ax - MSG_VIS_VUP_ALTER_FTVMC_Excl
^lcx:dx - OD of object
bp - MetaAlterFTVMCExclFlags for object
RETURN:
DESTROYED: bx, si, di, ds, es
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 6/90 initial version
Doug 10/91 merged VUP_GRAB & VUP_RELEASE handlers here
------------------------------------------------------------------------------@
OLMenuWinAlterFTVMCExcl method dynamic OLMenuWinClass, \
MSG_META_MUP_ALTER_FTVMC_EXCL
test bp, mask MAEF_NOT_HERE ; if asking for exclusive ourself,
jnz callSuper ; let superclass do right thing
; If a child object, however, decide what to do with request
;
test bp, mask MAEF_FOCUS ; If not focus,
jz callSuper ; send request to superclass
; Otherwise, figure out if we should redirect request
;
test bp, mask MAEF_GRAB
jz release
;grab:
; First, see if sub-menu requesting grab. If not, just pass on
; request to superclass for normal handling
;
test bp, mask MAEF_OD_IS_WINDOW
jz callSuper
test bp, mask MAEF_OD_IS_MENU_RELATED
jz callSuper
;if this is a pinned menu (or will revert back to being a pinned
;menu shortly), behave as a base window: call superclass,
;so that OLWinClass handles this query as if this window was
;a GenPrimary. Otherwise (is normal menu), send query up tree.
GOTO OLMenuWinCallSuperIfPinned
release:
;Typically, we could just call OLMenuWinCallSuperIfPinned, and
;it would decide whether this menu should handle this VUP, or if it
;should forward it up to the Primary. But we have a situation where
;as this pinned menu is CLOSING, its system menu closes, and releases
;the focus window exclusive from this pinned menu. The problem is that
;since this menu is closing, the PINNED flag has been reset,
;and so we would forward this VUP to the Primary, when in fact we
;should handle it here, since this menu was recently pinned.
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jnz callSuper ;skip if pinned (cy=0)...
test ds:[di].OLMWI_specState, mask OMWSS_WAS_PINNED
jnz callSuper ;skip if pinned (cy=0)...
;If not pinned, might have been recently pinned, or object releasing
;is not a sub-menu which grabbed the focus from the primary, so
;check to see if object actually does have grab here before sending
;on to primary.
cmp cx, ds:[di].OLWI_focusExcl.FTVMC_OD.handle
jne 10$
cmp dx, ds:[di].OLWI_focusExcl.FTVMC_OD.chunk
je callSuper ;skip to release exclusive from THIS
;windowed object...
;(no need to check the OLWI_prevFocusExcl, since menu ODs are not
;stored there: just gadgets, and they don't send RELEASE_FOCUS_EXCL)
10$: ;this menu is not pinned: is an intermediate menu inbetween the
;requesting submenu, and the base window. Forward up the tree:
;if has a menu button, send VUP_QUERY from that button. Otherwise,
;send to generic parent and pray!
GOTO OLMenuWinCallButtonOrGenParent
callSuper:
;
; fix problem of opening and pinning a submenu from a pinned menu
; resulting in the focus being returned to the pinned menu instead
; of the previous focus in the Primary -- if after release the focus
; for the becoming-pinned sub-menu, we are focus-less, then release
; the focus from ourselves. We will still have a focus if you open
; the submenu, then close it via kbd navigation. - brianc 1/22/93
;
push bp
call WinClasses_ObjCallSuperNoLock_OLMenuWinClass
pop bp
test bp, mask MAEF_GRAB or mask MAEF_NOT_HERE
jnz done ; not submenu release
test bp, mask MAEF_FOCUS
jz done ; not focus
call WinClasses_DerefVisSpec_DI
tst ds:[di].OLWI_focusExcl.FTVMC_OD.handle
jnz done ; have focus
; Should we do this test also - brianc 1/22/93
; Yes. 2/24/94 cbh (
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jz done ; wasn't pinned
; )
call MetaReleaseFocusExclLow
;
; Give focus to next best window (will usually turn out to be the
; current target window)
;
mov ax, MSG_META_ENSURE_ACTIVE_FT
call GenCallApplication
done:
ret
OLMenuWinAlterFTVMCExcl endm
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinRecalcSize --
MSG_VIS_RECALC_SIZE for OLMenuWinClass
DESCRIPTION: Recalc's size.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_VIS_RECALC_SIZE
cx, dx - size suggestions
RETURN: cx, dx - size to use
ax, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 5/ 1/92 Initial Version
------------------------------------------------------------------------------@
OLMenuWinRecalcSize method dynamic OLMenuWinClass, MSG_VIS_RECALC_SIZE
call MenuWinPassMarginInfo
call OpenRecalcCtrlSize
ret
OLMenuWinRecalcSize endm
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinVisPositionBranch --
MSG_VIS_POSITION_BRANCH for OLMenuWinClass
DESCRIPTION: Positions the object.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_VIS_POSITION_BRANCH
cx, dx - position
RETURN: nothing
ax, cx, dx, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 5/ 1/92 Initial Version
------------------------------------------------------------------------------@
OLMenuWinVisPositionBranch method dynamic OLMenuWinClass, \
MSG_VIS_POSITION_BRANCH
call MenuWinPassMarginInfo
call VisCompPosition
ret
OLMenuWinVisPositionBranch endm
COMMENT @----------------------------------------------------------------------
ROUTINE: MenuWinPassMarginInfo
SYNOPSIS: Passes margin info for OpenRecalcCtrlSize.
CALLED BY: OLMenuWinRecalcSize, OLMenuWinPositionBranch
PASS: *ds:si -- MenuWin bar
RETURN: bp -- VisCompMarginSpacingInfo
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 5/ 1/92 Initial version
------------------------------------------------------------------------------@
MenuWinPassMarginInfo proc near uses cx, dx
.enter
call OLMenuWinGetSpacing ;first, get spacing
push cx, dx ;save spacing
call OpenWinGetMargins ;margins in ax/bp/cx/dx
pop di, bx
call OpenPassMarginInfo
exit:
.leave
ret
MenuWinPassMarginInfo endp
WinClasses ends
;-------------------------------
WinMethods segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinGetSpacing --
MSG_VIS_COMP_GET_CHILD_SPACING for OLMenuWinClass
DESCRIPTION: Handles spacing for the OLMenuWinClass. Makes very small
spacing between the non-outlined buttons in unpinned menus.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_VIS_COMP_GET_CHILD_SPACING
RETURN: cx - spacing between children
dx - spacing between lines of wrapped children
DESTROYED: bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 9/18/89 Initial version
------------------------------------------------------------------------------@
OLMenuWinGetSpacing method OLMenuWinClass, MSG_VIS_COMP_GET_CHILD_SPACING
;
; Do normal window stuff.
;
mov cx, MENU_SPACING ;no spacing between menu items
mov dx, cx
if _MENUS_PINNABLE ;------------------------------------------------------
if _OL_STYLE ;START of OPEN_LOOK specific code -----------------------------
mov di, ds:[si] ;point to instance
add di, ds:[di].Vis_offset ;ds:[di] -- SpecInstance
test ds:[di].OLWI_specState, mask OLWSS_PINNED ;if pinned, exit
jnz OLMWGS_exit
mov cx, 1 ;else very minimal spacing
endif
endif
ret
OLMenuWinGetSpacing endp
WinMethods ends
;-------------------------------
KbdNavigation segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinFindKbdAccelerator --
MSG_GEN_FIND_KBD_ACCELERATOR for OLMenuWinClass
DESCRIPTION: Looks for keyboard accelerator. The only reason this is
subclassed is to set the gadget exclusive when we activate
the menu button.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_GEN_FIND_KBD_ACCELERATOR
same as MSG_META_KBD_CHAR:
cl - Character (Chars or VChar)
ch - CharacterSet (CS_BSW or CS_CONTROL)
dl - CharFlags
dh - ShiftState (left from conversion)
bp low - ToggleState
bp high - scan code
RETURN: carry set if accelerator found and dealt with
DESTROYED: bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 5/ 4/90 Initial version
------------------------------------------------------------------------------@
OLMenuWinFindKbdAccelerator method OLMenuWinClass, \
MSG_GEN_FIND_KBD_ACCELERATOR
call GenCheckKbdAccelerator ;see if we have a match
jnc exit ;nope, exit
call KN_DerefVisSpec_DI
mov si, ds:[di].OLPWI_button ;application releasing the
tst si ;no button, exit
jz exit
mov bx, ds:[LMBH_handle]
mov ax, MSG_OL_BUTTON_KBD_ACTIVATE
mov di, mask MF_FORCE_QUEUE
call ObjMessage
stc
exit:
ret
OLMenuWinFindKbdAccelerator endm
KbdNavigation ends
WinMethods segment resource
COMMENT @----------------------------------------------------------------------
FUNCTION: OLMenuWinLostGadgetExcl
DESCRIPTION: This method is sent when some other object in the parent window
(GenPrimary or pinned parent menu) grabs the gadget exclusive.
NOTE: if we get this method, it means that we HAVE the
gadget exclusive; so therefore this menu is in stay-up-mode,
or is a popup menu which is being held open.
If the menu button which opens this menu is grabbing the
gadget exclusive, we ignore this loss, because we know
this button is going to open this menu shortly.
PASS: *ds:si = instance data for object
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 5/90 initial version
------------------------------------------------------------------------------@
OLMenuWinLostGadgetExcl method dynamic OLMenuWinClass, MSG_VIS_LOST_GADGET_EXCL
mov di, ds:[di].OLPWI_button
tst di ;do we have a menu button?
jz genDismissInteraction ;skip if not (is popup menu)...
;this is a standard menu: if menu button is going to open menu,
;DO NOT close menu now! (*ds:di = OLMenuButtonClass object)
.warn -private
mov di, ds:[di] ;set ds:di = Spec instance data for
add di, ds:[di].Vis_offset ;the OLMenuButtonClass object
test ds:[di].OLBI_specState, mask OLBSS_HAS_MOUSE_GRAB
.warn @private
jz genDismissInteraction ;skip if button not pressed...
;ignore this LOST_GADGET event, since the button will shortly
;open this menu again.
ret
genDismissInteraction:
;if this menu is not PINNED, will send MSG_GEN_GUP_INTERACTION_COMMAND
;with IC_DISMISS to self.
;If using cascading menus, call OLMenuWinCloseOrCascade which will
;take care of checking if this menu is currently cascading.
if _CASCADING_MENUS
call OLMenuWinCloseOrCascade ;destroys:ax,bx,cx,dx,bp,di
else ;_CASCADING_MENUS is FALSE
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_INTERACTION_COMPLETE
call ObjCallInstanceNoLock
endif ;_CASCADING_MENUS
ret
OLMenuWinLostGadgetExcl endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuMarkForCloseOneLevel
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: used to close last menu in cascading set
CALLED BY: MSG_OL_MENU_MARK_FOR_CLOSE_ONE_LEVEL
PASS: *ds:si = OLMenuWinClass object
ds:di = OLMenuWinClass instance data
ds:bx = OLMenuWinClass object (same as *ds:si)
es = segment of OLMenuWinClass
ax = message #
RETURN:
DESTROYED:
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 6/21/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinGupSubmenuRequestsClose
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks the OMWMSS_IGNORE_SUBMENU_CLOSE_REQUEST flag.
If the flag is true, then the flag is cleared, and the
method returns. If the flag is false, then this menu
is closed, and the message is sent to the Gen parent
if the parent's vis part is an OLMenuWinClass.
CALLED BY: MSG_MO_MW_GUP_SUBMENU_REQUESTS_CLOSE
PASS: *ds:si = OLMenuWinClass object
ds:di = OLMenuWinClass instance data
ds:bx = OLMenuWinClass object (same as *ds:si)
es = segment of OLMenuWinClass
ax = message #
RETURN: Nothing
DESTROYED: ax
SIDE EFFECTS: None.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 4/21/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _CASCADING_MENUS
OLMenuWinGupSubmenuRequestsClose method dynamic OLMenuWinClass,
MSG_MO_MW_GUP_SUBMENU_REQUESTS_CLOSE
; check this before saving the passed args since it would be a waste
; of time if the jump was followed.
test ds:[di].OLMWI_moreSpecState, \
mask OMWMSS_IGNORE_SUBMENU_CLOSE_REQUEST
jnz done
push cx, dx, bp ; save args
; ensure cascade data is consistent
EC < call OLMenuWinECCheckCascadeData >
; since this menu is going down, disable the cascading bit.
test ds:[di].OLMWI_moreSpecState, mask OMWMSS_IS_CASCADING
jz notCascading
andnf ds:[di].OLMWI_moreSpecState, not (mask OMWMSS_IS_CASCADING)
; Delete the cascaded var data
mov ax, ATTR_OL_MENU_WIN_CASCADED_MENU
call ObjVarDeleteData
EC < ERROR_C OL_ERROR ; no var data-inconsistent >
notCascading:
; prevent this message from being resent by lost_gadget_excl handler.
ornf ds:[di].OLMWI_moreSpecState, mask OMWMSS_DONT_SEND_REQUEST
; close this menu
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_INTERACTION_COMPLETE
call ObjCallInstanceNoLock
call OLMenuWinSendCloseRequest ; Destroys ax, bx, cx, dx, bp
mov di, ds:[si]
add di, ds:[di].Vis_offset
donePop::
pop cx, dx, bp ; restore args
; ONLY JUMP HERE FROM BEFORE PUSHING THE ARGS
done:
; the ignore is only valid for one request at a time. also,
; allow this request to be sent again.
andnf ds:[di].OLMWI_moreSpecState, \
not (mask OMWMSS_IGNORE_SUBMENU_CLOSE_REQUEST or \
mask OMWMSS_DONT_SEND_REQUEST)
ret
OLMenuWinGupSubmenuRequestsClose endm
endif ;_CASCADING_MENUS
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinCloseOrCascade
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Closes the current menu and sends the submenu close request
message to the parent if the current menu is not cascading.
CALLED BY: OLMenuWinLostGadgetExcl, OLMenuWinPostPassiveButton
PASS: *ds:si = menu object
RETURN: None.
DESTROYED: ax, bx, cx, dx, bp, di
SIDE EFFECTS:
WARNING: This routine MAY resize LMem and/or object blocks, moving
them on the heap and invalidating stored segment pointers
and current register or stored offsets to them.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 4/21/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _CASCADING_MENUS
OLMenuWinCloseOrCascade proc far
class OLMenuWinClass
.enter
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].OLMWI_moreSpecState, mask OMWMSS_IS_CASCADING
jnz done ; menu is cascading..
; don't close
; be sure to always clear this flag if the menu is going down
andnf ds:[di].OLMWI_moreSpecState, \
not mask OMWMSS_IGNORE_SUBMENU_CLOSE_REQUEST
; prevent close request from being resent by lost_gadget_excl handler.
mov bl, ds:[di].OLMWI_moreSpecState ; store original state for later
ornf ds:[di].OLMWI_moreSpecState, mask OMWMSS_DONT_SEND_REQUEST
; close this menu
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_INTERACTION_COMPLETE
call ObjCallInstanceNoLock
; okay, send the request. restore the flag first.
mov di, ds:[si]
add di, ds:[di].Vis_offset
andnf ds:[di].OLMWI_moreSpecState, not mask OMWMSS_DONT_SEND_REQUEST
; told not to send request.. skip to end.
test bl, mask OMWMSS_DONT_SEND_REQUEST
jnz done
; send close request to menu parents, if they exists.
call OLMenuWinSendCloseRequest ; destroys: ax,bx,cx,dx,bp
done:
.leave
ret
OLMenuWinCloseOrCascade endp
endif ;_CASCADING_MENUS
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinSendCloseRequest
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Looks up the generic tree to find an object of class
OLMenuWinClass. The search is continued until an
object that is not a subclass of GenInteractionClass is
found. If it finds the menu window, the message
MSG_MO_MW_GUP_SUBMENU_REQUESTS_CLOSE is sent.
The menu window object's vis part MUST already be built.
CALLED BY: OLMenuWinCloseOrCascade and OLMenuWinGupSubmenuRequestClose
PASS: *ds:si = menu object
RETURN: *ds:si = current menu object. (ds is fixed up).
DESTROYED: ax, bx, cx, dx, bp, di
SIDE EFFECTS:
WARNING: This routine MAY resize LMem and/or object blocks, moving
them on the heap and invalidating stored segment pointers
and current register or stored offsets to them.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 4/21/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _CASCADING_MENUS
OLMenuWinSendCloseRequest proc near
uses si, es
.enter
mov bx, ds:[LMBH_handle]
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov si, ds:[di].OLPWI_button ; ^lbx:si = menu button
tst si
jz done
searchLoop:
mov ax, MSG_VIS_FIND_PARENT
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
jcxz done
movdw bxsi, cxdx ; ^lbx:si = parent
call ObjSwapLock
segmov es, <segment GenInteractionClass>, di
mov di, offset GenInteractionClass
call ObjIsObjectInClass
jnc unlock ; break out of loop
segmov es, <segment OLMenuWinClass>, di
mov di, offset OLMenuWinClass
call ObjIsObjectInClass
cmc
jc unlock ; continue up tree
mov ax, MSG_MO_MW_GUP_SUBMENU_REQUESTS_CLOSE
call ObjCallInstanceNoLock ; Destroys: ax
clc
unlock:
call ObjSwapUnlock
jc searchLoop ; continue if carry set
done:
.leave
ret
OLMenuWinSendCloseRequest endp
endif ;_CASCADING_MENUS
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinSendCloseRequestToLastMenu
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sends a MSG_MO_MW_GUP_SUBMENU_REQUESTS_CLOSE to the last
menu of the currently cascaded menus. May close all menus
in the this chain of menus or may close only the menus BELOW
the current menu depending upon the value of cx.
CALLED BY:
PASS: *ds:si = current menu object
cx = Preserve current menu and those above it
TRUE: Only close menus BELOW the current menu
FALSE: Close all menus in this chain
RETURN: *ds:si = current menu object. (ds is fixed up).
DESTROYED: ax, bx, cx, dx, bp, di
SIDE EFFECTS:
WARNING: This routine MAY resize LMem and/or object blocks, moving
them on the heap and invalidating stored segment pointers
and current register or stored offsets to them.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 4/27/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _CASCADING_MENUS
OLMenuWinSendCloseRequestToLastMenu proc far
.enter
; Set ignore bit to preserve the current menu based upon cx.
mov di, ds:[si]
add di, ds:[di].Vis_offset
; Assume we close all menus.
andnf ds:[di].OLMWI_moreSpecState, \
not (mask OMWMSS_IGNORE_SUBMENU_CLOSE_REQUEST)
jcxz beginLoop
; Nope, preserve current menu.
ornf ds:[di].OLMWI_moreSpecState, \
mask OMWMSS_IGNORE_SUBMENU_CLOSE_REQUEST
beginLoop:
; Add extra lock to original object to make loop work correctly.
mov bx, ds:[LMBH_handle] ; ^lbx = orig obj handle
push bx, si ; SAVE original object OPTR
call ObjLockObjBlock ; ax = segment
EC < mov dx, ds >
EC < cmp ax, dx >
EC < ERROR_NE OL_ERROR ; SHOULD BE EQUAL! >
tryAgain:
; *ds:si = current menu, locked
; ensure cascade data consistency
EC < call OLMenuWinECCheckCascadeData >
; Ensure the object's vis part is built!
EC < call VisCheckVisAssumption >
; Check if the object is of class OLMenuWinClass
EC < mov cx, segment OLMenuWinClass >
EC < mov dx, offset OLMenuWinClass >
EC < mov ax, MSG_META_IS_OBJECT_IN_CLASS >
EC < call ObjCallInstanceNoLock ; Destroys: ax, cx, dx, bp>
EC < ERROR_NC OL_ERROR ; NOT OLMenuWinClass !! >
; Is this the last child?
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].OLMWI_moreSpecState, mask OMWMSS_IS_CASCADING
jz sendMessage ; Yes -- send message
; No -- find next child in cascade.
mov ax, ATTR_OL_MENU_WIN_CASCADED_MENU
call ObjVarFindData ; if data, ds:bx = ptr
; (ds still ptr to our block)
EC < ERROR_NC OL_ERROR ; no var data - that's bad >
; Get optr from vardata of next child.
mov si, ds:[bx].offset
mov bx, ds:[bx].handle ; ^lbx:si = next child menu
call ObjLockObjBlock ; *ax:si = next child, locked
mov bx, ds:[LMBH_handle] ; ^lbx = parent menu handle
call MemUnlock ; unlock parent menu
mov ds, ax ; *ds:si = next child, locked
; Continue looking for child
jmp tryAgain
sendMessage:
; *ds:si = correct object to send message to, locked.
mov ax, MSG_MO_MW_GUP_SUBMENU_REQUESTS_CLOSE
call ObjCallInstanceNoLock
; unlock last block
mov bx, ds:[LMBH_handle]
call MemUnlock
pop bx, si ; ^lbx:si = original obj optr
call MemDerefDS ; fixup ds.. *ds:si = orig obj
.leave
ret
OLMenuWinSendCloseRequestToLastMenu endp
endif ;_CASCADING_MENUS
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinCloseAllMenusInCascade
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: All the menus in the cascade that the destination menu
belongs to will be closed. Basically just calls
OLMenuWinSendCloseRquestToLastMenu.
CALLED BY: MSG_MO_MW_CLOSE_ALL_MENUS_IN_CASCADE
PASS: *ds:si = OLMenuWinClass object
ds:di = OLMenuWinClass instance data
ds:bx = OLMenuWinClass object (same as *ds:si)
es = segment of OLMenuWinClass
ax = message #
RETURN: None
DESTROYED: ax, cx, bp
SIDE EFFECTS:
May close all menus in cascade!
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 6/10/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _CASCADING_MENUS
OLMenuWinCloseAllMenusInCascade method dynamic OLMenuWinClass,
MSG_MO_MW_CLOSE_ALL_MENUS_IN_CASCADE
uses dx
.enter
; send close request to last menu. do not preserve the current menu.
clr cx
call OLMenuWinSendCloseRequestToLastMenu
.leave
ret
OLMenuWinCloseAllMenusInCascade endm
endif ;_CASCADING_MENUS
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinVisOpen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sets up some flags used for cascading menus, calls superclass.
CALLED BY: MSG_VIS_OPEN
PASS: *ds:si = OLMenuWinClass object
ds:di = OLMenuWinClass instance data
ds:bx = OLMenuWinClass object (same as *ds:si)
es = segment of OLMenuWinClass
ax = message #
bp = 0 if top window, else window for obejct to open on
RETURN: Nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 4/21/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLMenuWinVisOpen method dynamic OLMenuWinClass,
MSG_VIS_OPEN
.enter
if _CASCADING_MENUS
; ensure cascade data is consistent
EC < call OLMenuWinECCheckCascadeData >
; clear cascade var data, if any remaining.
test ds:[di].OLMWI_moreSpecState, mask OMWMSS_IS_CASCADING
jz notCascading
; Delete the cascaded var data
push ax
mov ax, ATTR_OL_MENU_WIN_CASCADED_MENU
call ObjVarDeleteData
EC < ERROR_C OL_ERROR ; no var data-inconsistent >
pop ax
notCascading:
; Clears all cascade state bits
clr ds:[di].OLMWI_moreSpecState
endif ;_CASCADING_MENUS
; Call superclass
mov di, offset OLMenuWinClass
call ObjCallSuperNoLock
; Update up/down scrollers as needed
mov al, 0
call OLMenuWinUpdateUpDownScrollers
.leave
ret
OLMenuWinVisOpen endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLMenuWinUpdateUpDownScrollers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Update up/down scrollers for menu window
CALLED BY: OLMenuWinVisOpen, OLMenuWinVisClose, OLMenuWinMoveResizeWin
PASS: *ds:si = OLMenuWinClass object
al = non-zero to delay closing until END_SELECT
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
joon 3/02/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MENU_WIN_SCROLL_DELTA equ 23
OLMenuWinUpdateUpDownScrollers proc far
delayClose local word push ax ; only al used
scrollers local word push 0 ; assume no scrollers needed
upScroller local lptr push 0 ; assume no up scroller exists
downScroller local lptr push 0 ; assume no dn scroller exists
parent local Rectangle
parentWin local hptr
menu local Rectangle
menuWin local hptr
uses ax,bx,cx,dx,si,di,bp,es
.enter
; not needed for pinned menus
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].OLWI_specState, mask OLWSS_PINNED
LONG jnz done
; first figure out what needs to be updated
call VisQueryParentWin ; di = window handle
tst di
jz checkUpdate
call WinGetWinScreenBounds
mov ss:[parent].R_top, bx
mov ss:[parent].R_bottom, dx
mov ss:[parentWin], di
if TOOL_AREA_IS_TASK_BAR
call OLWinGetToolAreaSize ; dx = height
push ds
segmov ds, dgroup
tst ds:[taskBarAutoHide]
jnz doneTaskBar
tst ds:[taskBarPosition]
jg atBottom
add ss:[parent].R_top, dx
jmp short doneTaskBar
atBottom:
sub ss:[parent].R_bottom, dx
doneTaskBar:
pop ds
endif
call VisQueryWindow ; di = window handle
tst di
jz checkUpdate
call WinGetWinScreenBounds
add ax, 2
sub cx, 2
mov ss:[menu].R_left, ax
mov ss:[menu].R_top, bx
mov ss:[menu].R_right, cx
mov ss:[menu].R_bottom, dx
mov ss:[menuWin], di
cmp bx, ss:[parent].R_top
jge checkDown
mov ss:[scrollers].high, TRUE ; need up scroller
checkDown:
cmp dx, ss:[parent].R_bottom
jle checkUpdate
mov ss:[scrollers].low, TRUE ; need down scroller
; now update the scrollers
checkUpdate:
tst ss:[scrollers]
jnz update
mov ax, TEMP_OL_MENU_WIN_SCROLLERS ; if no hint and no scrollers
call ObjVarFindData ; are needed, then we're done
jnc done
update:
call EnsureMenuWinUpDownScrollers
handleUpScroller:
mov si, ss:[upScroller]
tst ss:[scrollers].high
call openClose
mov si, ss:[downScroller]
tst ss:[scrollers].low
call openClose
done:
.leave
ret
openClose:
jz close
call OpenMenuWinScrollerWindow
retn
close:
call CloseMenuWinScrollerWindow
retn
OLMenuWinUpdateUpDownScrollers endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EnsureMenuWinUpDownScrollers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Ensure up/down scroller objects exist
CALLED BY: OLMenuWinUpdateUpDownScrollers
PASS: *ds:si = OLMenuWinClass object
OLMenuWinUpdateUpDownScrollers stack frame
RETURN: nothing
DESTROYED: ax,bx,cx,dx,di,es
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Joon 3/2/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
EnsureMenuWinUpDownScrollers proc near
.enter inherit OLMenuWinUpdateUpDownScrollers
mov ax, TEMP_OL_MENU_WIN_SCROLLERS
call ObjVarFindData
jnc createScrollers
mov ax, ds:[bx].MWSS_upScroller
mov ss:[upScroller], ax
mov ax, ds:[bx].MWSS_downScroller
mov ss:[downScroller], ax
jmp done
createScrollers:
mov ax, MENU_WIN_SCROLL_DELTA
mov dx, offset menuWinScrollerUpBitmap
call createScroller
mov ss:[upScroller], ax
mov ax, -MENU_WIN_SCROLL_DELTA
mov dx, offset menuWinScrollerDownBitmap
call createScroller
mov ss:[downScroller], ax
mov ax, TEMP_OL_MENU_WIN_SCROLLERS
mov cx, size MenuWinScrollerStruct
call ObjVarAddData
mov ax, ss:[upScroller]
mov ds:[bx].MWSS_upScroller, ax
mov ax, ss:[downScroller]
mov ds:[bx].MWSS_downScroller, ax
done:
.leave
ret
createScroller:
push si
segmov es, <segment MenuWinScrollerClass>
mov di, offset MenuWinScrollerClass
mov bx, ds:[LMBH_handle]
call GenInstantiateIgnoreDirty
mov di, ds:[si]
mov ds:[di].MWSI_delta, ax
mov ds:[di].MWSI_bitmap, dx
mov ax, si
pop si
mov ds:[di].MWSI_menu, si
retn
EnsureMenuWinUpDownScrollers endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OpenMenuWinScrollerWindow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Open menu window up/down scroller
CALLED BY: OLMenuWinUpdateUpDownScrollers
PASS: *ds:si = MenuWinScrollerClass object
OLMenuWinUpdateUpDownScrollers stack frame
RETURN: nothing
DESTROYED: ax,bx,cx,dx,di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Joon 3/3/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OpenMenuWinScrollerWindow proc near
.enter inherit OLMenuWinUpdateUpDownScrollers
EC < push es, di >
EC < segmov es, <segment MenuWinScrollerClass> >
EC < mov di, offset MenuWinScrollerClass >
EC < call ObjIsObjectInClass >
EC < ERROR_NC OL_ERROR ; not a MenuWinScroller >
EC < pop es, di >
mov di, ds:[si]
tst ds:[di].MWSI_window
jnz done
if (0)
push si, bp
mov bx, si
mov di, ss:[menuWin]
mov si, WIT_LAYER_ID
call WinGetInfo
mov si, bx
push ax ; layer ID to use
call GeodeGetProcessHandle ; Get owner for window
push bx ; owner to use
push ss:[parentWin] ; parent window handle
push 0 ; window region segment
push 0 ; window region offset
mov bx, ss:[parent].R_top
mov dx, bx
add dx, MENU_WIN_SCROLL_DELTA
mov di, ds:[si]
tst ds:[di].MWSI_delta
jg gotBounds
mov dx, ss:[parent].R_bottom
mov bx, dx
sub bx, MENU_WIN_SCROLL_DELTA
gotBounds:
push dx ; window bottom
push ss:[menu].R_right ; window right
push bx ; window top
push ss:[menu].R_left ; window left
mov di, ss:[menuWin] ; ^hdi = menu Window
mov bp, si ; *ds:bp = expose OD
mov si, WIT_PRIORITY
call WinGetInfo ; al = WinPriorityData
clr ah ; ax = WinPassFlags
push ax ; save WinPassFlags
mov si, WIT_COLOR
call WinGetInfo ; ax,bx = color
pop si ; si = WinPassFlags
mov di, ds:[LMBH_handle] ; ^ldi:bp = expose OD
movdw cxdx, dibp ; ^lcx:dx = mouse OD
call WinOpen
pop si, bp
else
mov ax, ss:[parent].R_top
mov cx, ax
add cx, MENU_WIN_SCROLL_DELTA
tst ds:[di].MWSI_delta
jg createWindow
mov cx, ss:[parent].R_bottom
mov ax, cx
sub ax, MENU_WIN_SCROLL_DELTA
createWindow:
push si, bp
call GeodeGetProcessHandle ; Get owner for window
push bx ; layer ID to use
push bx ; owner to use
push ss:[parentWin] ; parent window handle
push 0 ; window region segment
push 0 ; window region offset
push cx ; window bottom
mov ss:[menu].R_bottom, cx ; store for later
push ss:[menu].R_right ; window right
push ax ; window top
mov ss:[menu].R_top, ax ; store for later
push ss:[menu].R_left ; window left
mov di, ss:[menuWin] ; ^hdi = menu Window
mov bp, si ; *ds:bp = expose OD
mov si, WIT_PRIORITY
call WinGetInfo ; al = WinPriorityData
clr ah ; ax = WinPassFlags
push ax ; save WinPassFlags
mov si, WIT_COLOR
call WinGetInfo ; ax,bx = color
pop si ; si = WinPassFlags
mov di, ds:[LMBH_handle] ; ^ldi:bp = expose OD
movdw cxdx, dibp ; ^lcx:dx = mouse OD
call WinOpen
pop si, bp
endif
mov di, ds:[si]
mov ds:[di].MWSI_window, bx
mov ax, ss:[menu].R_top
mov ds:[di].MWSI_top, ax
mov ax, ss:[menu].R_bottom
mov ds:[di].MWSI_bottom, ax
done:
.leave
ret
OpenMenuWinScrollerWindow endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CloseMenuWinScrollerWindow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Close menu window up/down scroller
CALLED BY: INTERNAL
PASS: *ds:si = MenuWinScrollerClass
RETURN: nothing
DESTROYED: ax,di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Joon 3/3/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CloseMenuWinScrollerWindow proc near
.enter inherit OLMenuWinUpdateUpDownScrollers
EC < push es, di >
EC < segmov es, <segment MenuWinScrollerClass> >
EC < mov di, offset MenuWinScrollerClass >
EC < call ObjIsObjectInClass >
EC < ERROR_NC OL_ERROR ; not a MenuWinScroller >
EC < pop es, di >
tst ss:[delayClose].low
jnz done
clr ax
mov di, ds:[si]
xchg ax, ds:[di].MWSI_window
tst ax
jz done
mov di, ax
call WinClose ; close the MenuWinScroller window
done:
.leave
ret
CloseMenuWinScrollerWindow endp
WinMethods ends
LessUsedGeometry segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinUpdateGeometry --
MSG_VIS_UPDATE_GEOMETRY for OLMenuWinClass
DESCRIPTION: Updates geometry.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_VIS_UPDATE_GEOMETRY
RETURN: nothing
ax, cx, dx, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 4/21/92 Initial Version
------------------------------------------------------------------------------@
OLMenuWinUpdateGeometry method dynamic OLMenuWinClass, MSG_VIS_UPDATE_GEOMETRY
push ax, es
test ds:[di].VI_optFlags, mask VOF_GEO_UPDATE_PATH or \
mask VOF_GEOMETRY_INVALID
jz callSuper
call OLMenuCalcCenters
jnc callSuper ;nothing to do, branch
test bp, mask SGMCF_NEED_TO_RESET_GEO ;any item have valid geometry?
jz callSuper ;no, no need to reset stuff.
mov dl, VUM_MANUAL
mov ax, MSG_VIS_RESET_TO_INITIAL_SIZE
call ObjCallInstanceNoLock
callSuper:
pop ax, es
mov di, offset OLMenuWinClass
CallSuper MSG_VIS_UPDATE_GEOMETRY
ret
OLMenuWinUpdateGeometry endm
COMMENT @----------------------------------------------------------------------
ROUTINE: OLMenuCalcCenters
SYNOPSIS: Calculates left and right portions of a menu.
CALLED BY: OLMenuWinUpdateGeometry, OLMenuWinResetSizeToStayOnscreen
PASS: *ds:si -- menu
RETURN: carry set if values changed
bp -- SpecGetMenuCenterFlags
DESTROYED: cx, dx, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 2/ 4/93 Initial version
------------------------------------------------------------------------------@
OLMenuCalcCenters proc near
;
; Before we do geometry, we'll go through all the child menu items and
; determinate who is the biggest one. (We'll make two passes if the
; first pass yields an object allowing wrapping, so that all the
; children can clear their optimization bits and set expand-width-to-fit
; bits correctly. -cbh 1/18/93)
;
; If this is a pinned menu, we need the items to expand to fit whatever
; minimum width might be needed for the menu, so we'll set the ALLOWING_
; WRAPPING flag now, which effectively turns off geometry optizations.
; -cbh 2/12/93
;
clr bp
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].OLWI_specState, mask OLWSS_PINNED
jz 5$
or bp, mask SGMCF_ALLOWING_WRAPPING
5$:
call GetMenuCenter
test bp, mask SGMCF_ALLOWING_WRAPPING
jz 10$
call GetMenuCenter
10$:
cmp cx, ds:[di].OLMWI_monikerSpace
jne sizesChanged
cmp dx, ds:[di].OLMWI_accelSpace
clc ;assume sizes not changing
je exit ;nope, exit
sizesChanged:
;
; If the menu item sizes changed, we'll store the new values and
; reset the geometry of all the objects in the window, so the menus
; will get their sizes recalculated. (We could also do this via
; VGA_ALWAYS_RECALC_SIZE in the buttons, but this will be more efficient
; for most situations.)
;
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov ds:[di].OLMWI_monikerSpace, cx
mov ds:[di].OLMWI_accelSpace, dx
stc
exit:
ret
OLMenuCalcCenters endp
GetMenuCenter proc near
clr cx ;moniker space
mov dx, cx ;accelerator space
mov ax, MSG_SPEC_GET_MENU_CENTER
call ObjCallInstanceNoLock
ret
GetMenuCenter endp
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinConvertDesiredSizeHint --
MSG_SPEC_CONVERT_DESIRED_SIZE_HINT for OLMenuWinClass
DESCRIPTION: Converts desired size for this object.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_SPEC_CONVERT_DESIRED_SIZE_HINT
cx - SpecSizeSpec: width
dx - SpecSizeSpec: height
bp - number of childre
RETURN: cx, dx - converted size
ax, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 5/20/92 Initial Version
------------------------------------------------------------------------------@
OLMenuWinConvertDesiredSizeHint method dynamic OLMenuWinClass, \
MSG_SPEC_CONVERT_DESIRED_SIZE_HINT
;
; Hack to get the buttons of popup lists to get correct desired size
; calculations (it derives its hint from this object).
; (Changed 11/11/92 cbh to do the conversion at the button.)
;
mov bx, ds:[di].OLCI_buildFlags
and bx, mask OLBF_TARGET
cmp bx, OLBT_IS_POPUP_LIST shl offset OLBF_TARGET
je isPopupList
callSuper:
mov di, offset OLMenuWinClass
GOTO ObjCallSuperNoLock ;do normal OLCtrl stuff
isPopupList:
mov di, ds:[di].OLPWI_button
tst di
jz callSuper ;no button, call superclass
; (why, I don't know.)
mov si, di
call ObjCallInstanceNoLock ;send to the button
if not SELECTION_BOX
tst cx ;no width hint, exit
jz exit
add cx, OL_DOWN_MARK_WIDTH + OL_MARK_SPACING
endif
exit:: ;add width of arrow plus margin
ret
OLMenuWinConvertDesiredSizeHint endm
COMMENT @----------------------------------------------------------------------
METHOD: OLMenuWinResetSizeToStayOnscreen --
MSG_SPEC_RESET_SIZE_TO_STAY_ONSCREEN for OLMenuWinClass
DESCRIPTION: Resets size to keep itself onscreen.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_SPEC_RESET_SIZE_TO_STAY_ONSCREEN
dl - VisUpdateMode
RETURN: nothing
ax, cx, dx, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 2/ 4/93 Initial Version
------------------------------------------------------------------------------@
OLMenuWinResetSizeToStayOnscreen method dynamic OLMenuWinClass, \
MSG_SPEC_RESET_SIZE_TO_STAY_ONSCREEN
;
; Wrap the puppy if it doesn't fit, and hope for the best. -2/ 5/93
; (Not working yet. -cbh 2/ 6/93)
;
; or ds:[di].VCI_geoAttrs, mask VCGA_ALLOW_CHILDREN_TO_WRAP
mov di, offset OLMenuWinClass
call ObjCallSuperNoLock
call OLMenuCalcCenters ;this needs to be redone now,
; mainly so that the ONE_PASS
; OPTIMIZATION flag is cleared.
ret
OLMenuWinResetSizeToStayOnscreen endm
LessUsedGeometry ends
WinMethods segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MenuWinScrollerStartSelect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle start select on scroller
CALLED BY: MSG_META_START_SELECT
PASS: *ds:si = MenuWinScrollerClass object
ds:di = MenuWinScrollerClass instance data
ds:bx = MenuWinScrollerClass object (same as *ds:si)
es = segment of MenuWinScrollerClass
ax = message #
cx = X position of mouse
dx = X position of mouse
bp low = ButtonInfo (In input.def)
bp high = UIFunctionsActive (In Objects/uiInputC.def)
RETURN: ax = MouseReturnFlags (In Objects/uiInputC.def)
DESTROYED: bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
joon 3/03/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MenuWinScrollerStartSelect method dynamic MenuWinScrollerClass,
MSG_META_START_SELECT
MenuWinScrollerScroll label far
push si
call MenuWinScrollerScrollOnly
call ImGetButtonState
call OLMenuWinUpdateUpDownScrollers
pop si
call MenuWinScrollerStartTimer
mov ax, mask MRF_PROCESSED
ret
MenuWinScrollerStartSelect endm
;
; returns: C set if actually scrolled
;
MenuWinScrollerScrollOnly proc near
mov di, ds:[si]
mov bp, ds:[di].MWSI_delta
mov si, ds:[di].MWSI_menu
;
; check if already at top or bottom
;
call VisQueryParentWin ; di = window handle
tst di
jz update
call WinGetWinScreenBounds
if TOOL_AREA_IS_TASK_BAR
; bx = top, dx = bottom
mov ax, dx ; ax = bottom
call OLWinGetToolAreaSize ; cx = width, dx = height
push ds
segmov ds, dgroup
tst ds:[taskBarAutoHide]
jnz doneTaskBar
tst ds:[taskBarPosition]
jg atBottom
add bx, dx
jmp short doneTaskBar
atBottom:
sub ax, dx
doneTaskBar:
pop ds
push bx, ax ; save top, bottom
else
push bx, dx ; save top, bottom
endif
call VisQueryWindow ; di = window handle
tst di
jz update
call WinGetWinScreenBounds
pop ax, cx ; ax = scrn top, cx = scrn bot
tst bp
jns scrollDown
cmp dx, cx
jle update
jmp short moveIt
scrollDown:
cmp bx, ax
jge update
moveIt:
call VisGetBounds
mov cx, ax
mov dx, bx
add dx, bp
call VisSetPosition
mov ax, MSG_VIS_MOVE_RESIZE_WIN
mov di, offset OLWinClass
call ObjCallSuperNoLock
stc
jmp short exit
update:
clc
exit:
ret
MenuWinScrollerScrollOnly endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MenuWinScrollerEndSelect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle end select on scroller
CALLED BY: MSG_META_END_SELECT
PASS: *ds:si = MenuWinScrollerClass object
ds:di = MenuWinScrollerClass instance data
ds:bx = MenuWinScrollerClass object (same as *ds:si)
es = segment of MenuWinScrollerClass
ax = message #
cx = X position of mouse
dx = X position of mouse
bp low = ButtonInfo (In input.def)
bp high = UIFunctionsActive (In Objects/uiInputC.def)
RETURN: ax = MouseReturnFlags (In Objects/uiInputC.def)
DESTROYED: bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
joon 3/03/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MenuWinScrollerEndSelect method dynamic MenuWinScrollerClass,
MSG_META_END_SELECT, MSG_META_END_OTHER
call MenuWinScrollerStopTimer
;
; update pending close
;
mov di, ds:[si]
mov si, ds:[di].MWSI_menu
mov al, 0
call OLMenuWinUpdateUpDownScrollers
mov ax, mask MRF_PROCESSED
ret
MenuWinScrollerEndSelect endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MenuWinScrollerRawUnivEnter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Mouse pointer entered scroller window
CALLED BY: MSG_META_RAW_UNIV_ENTER
PASS: *ds:si = MenuWinScrollerClass object
ds:di = MenuWinScrollerClass instance data
ds:bx = MenuWinScrollerClass object (same as *ds:si)
es = segment of MenuWinScrollerClass
ax = message #
^lcx:dx = InputObj of window method refers to
^hbp = Window that method refers to
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
joon 3/03/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MenuWinScrollerRawUnivEnter method dynamic MenuWinScrollerClass,
MSG_META_RAW_UNIV_ENTER
mov di, offset MenuWinScrollerClass
call ObjCallSuperNoLock
call ImGetButtonState
test al, mask BI_B0_DOWN
jz done
MenuWinScrollerStartTimer label far
push ds
segmov ds, <segment idata>
mov cx, ds:[olGadgetRepeatDelay]
pop ds
mov al, TIMER_EVENT_ONE_SHOT
mov bx, ds:[LMBH_handle]
mov dx, MSG_MENU_WIN_SCROLLER_TIMER_EXPIRED
call TimerStart
mov di, ds:[si]
mov ds:[di].MWSI_timerID, ax
mov ds:[di].MWSI_timerHandle, bx
done:
ret
MenuWinScrollerRawUnivEnter endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MenuWinScrollerRawUnivLeave
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Mouse pointer left scroller window
CALLED BY: MSG_META_RAW_UNIV_LEAVE
PASS: *ds:si = MenuWinScrollerClass object
ds:di = MenuWinScrollerClass instance data
ds:bx = MenuWinScrollerClass object (same as *ds:si)
es = segment of MenuWinScrollerClass
ax = message #
^lcx:dx = InputObj of window method refers to
^hbp = Window that method refers to
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
joon 3/03/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MenuWinScrollerRawUnivLeave method dynamic MenuWinScrollerClass,
MSG_META_RAW_UNIV_LEAVE
mov di, offset MenuWinScrollerClass
call ObjCallSuperNoLock
MenuWinScrollerStopTimer label far
clr ax, bx
mov di, ds:[si]
xchg ax, ds:[di].MWSI_timerID
xchg bx, ds:[di].MWSI_timerHandle
tst bx
jz done
call TimerStop
done:
;
; update pending close
;
mov di, ds:[si]
push si
mov si, ds:[di].MWSI_menu
mov al, 0
call OLMenuWinUpdateUpDownScrollers
pop si
ret
MenuWinScrollerRawUnivLeave endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MenuWinScrollerTimerExpired
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle timer expired
CALLED BY: MSG_MENU_WIN_SCROLLER_TIMER_EXPIRED
PASS: *ds:si = MenuWinScrollerClass object
ds:di = MenuWinScrollerClass instance data
ds:bx = MenuWinScrollerClass object (same as *ds:si)
es = segment of MenuWinScrollerClass
ax = message #
RETURN:
DESTROYED:
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
joon 3/03/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MenuWinScrollerTimerExpired method dynamic MenuWinScrollerClass,
MSG_MENU_WIN_SCROLLER_TIMER_EXPIRED
clr ax, bx
xchg ax, ds:[di].MWSI_timerID
xchg bx, ds:[di].MWSI_timerHandle
cmp ax, bp
jne done
tst bx
jz done
call ImGetButtonState
test al, mask BI_B0_DOWN
jz done
call MenuWinScrollerScroll
call MenuWinScrollerStartTimer
done:
ret
MenuWinScrollerTimerExpired endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MenuWinScrollerExposed
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Draw
CALLED BY: MSG_META_EXPOSED
PASS: *ds:si = MenuWinScrollerClass object
ds:di = MenuWinScrollerClass instance data
ds:bx = MenuWinScrollerClass object (same as *ds:si)
es = segment of MenuWinScrollerClass
ax = message #
^hcx = Window
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
joon 3/03/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MenuWinScrollerExposed method dynamic MenuWinScrollerClass,
MSG_META_EXPOSED
mov di, cx
call GrCreateState
call GrBeginUpdate
call GrGetWinBounds
sub cx, ax
sub cx, 7
shr cx, 1
mov ax, cx
sub dx, bx
sub dx, 4
shr dx, 1
mov bx, dx
mov si, ds:[si]
mov si, ds:[si].MWSI_bitmap
segmov ds, cs
clr dx
call GrFillBitmap
call GrEndUpdate
call GrDestroyState
ret
MenuWinScrollerExposed endm
menuWinScrollerUpBitmap Bitmap <7, 4, 0, BMF_MONO>
db 00010000b
db 00111000b
db 01111100b
db 11111110b
menuWinScrollerDownBitmap Bitmap <7, 4, 0, BMF_MONO>
db 11111110b
db 01111100b
db 00111000b
db 00010000b
;
; ensure keyboard navigation item remains on-screen
;
OLMenuWinNavigate method dynamic OLMenuWinClass, MSG_SPEC_NAVIGATE_TO_NEXT_FIELD, MSG_SPEC_NAVIGATE_TO_PREVIOUS_FIELD, MSG_OL_MENU_WIN_UPDATE_SCROLLABLE_MENU
cmp ax, MSG_OL_MENU_WIN_UPDATE_SCROLLABLE_MENU
je checkAgain
mov di, offset OLMenuWinClass
call ObjCallSuperNoLock
checkAgain:
mov ax, TEMP_OL_MENU_WIN_SCROLLERS
call ObjVarFindData
jnc done ; no scrollers
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov ax, ds:[di].OLWI_focusExcl.FTVMC_OD.handle
tst ax
jz done ; no focus
mov si, ds:[di].VCI_window
tst si
jz done ; no menu window
push bx ; save vardata
push si ; save window
mov bx, ax
mov si, ds:[di].OLWI_focusExcl.FTVMC_OD.chunk
mov ax, MSG_VIS_GET_BOUNDS
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; bp = top, dx = bottom
pop di ; di = window
mov bx, bp
call WinTransform
push ax, bx
movdw axbx, cxdx
call WinTransform
movdw cxdx, axbx ; dx = bottom (scr)
pop bx, ax ; ax = top (scr)
pop bx ; ds:bx = vardata
mov si, ds:[bx].MWSS_upScroller
mov di, ds:[si]
tst ds:[di].MWSI_window
jz doneUp
cmp ax, ds:[di].MWSI_bottom
jge doneUp
scrollMenu:
push si ; save scroller
call MenuWinScrollerScrollOnly ; *ds:si = menu win
pushf ; save scroll result
clr al ; update immediately
call OLMenuWinUpdateUpDownScrollers
popf ; C set if scrolled
pop si ; *ds:si = scroller
jnc done ; no scroll, done
mov di, ds:[si]
mov si, ds:[di].MWSI_menu
jmp checkAgain
doneUp:
mov si, ds:[bx].MWSS_downScroller
mov di, ds:[si]
tst ds:[di].MWSI_window
jz done
cmp dx, ds:[di].MWSI_top
jg scrollMenu
done:
ret
OLMenuWinNavigate endm
WinMethods ends
|
data/pokemon/dex_entries/drowzee.asm | AtmaBuster/pokeplat-gen2 | 6 | 162469 | db "HYPNOSIS@" ; species name
db "When it twitches"
next "its nose, it can"
next "tell where someone"
page "is sleeping and"
next "what that person"
next "is dreaming about.@"
|
src/stack.adb | laurentzh/CHIP-8 | 4 | 13343 | package body Stack is
procedure Push_Stack(Stack : in out Stack_Record; Element : Address) is
begin
Stack.Arr(Stack.Size) := Element;
Stack.Size := Stack.Size + 1;
end Push_Stack;
function Pop_Stack(Stack : in out Stack_Record) return Address is
begin
Stack.Size := Stack.Size - 1;
return Stack.Arr(Stack.Size);
end Pop_Stack;
function Peek_Stack(Stack : Stack_Record) return Address is
begin
return Stack.Arr(Stack.Size - 1);
end Peek_Stack;
function Init_Stack return Stack_Record is
Stack : Stack_Record;
begin
Stack.Size := 0;
return Stack;
end;
end Stack;
|
test/Succeed/Issue1719/Pushouts.agda | KDr2/agda | 0 | 1930 | {-# OPTIONS --cubical-compatible --rewriting #-}
module Issue1719.Pushouts where
open import Issue1719.Common
open import Issue1719.Spans
postulate
Pushout : (d : Span) → Set
left : {d : Span} → (Span.A d) → Pushout d
right : {d : Span} → (Span.B d) → Pushout d
glue : {d : Span} → (c : Span.C d) → left (Span.f d c) == right (Span.g d c) :> Pushout d
module _ {d : Span} {l} {P : Pushout d → Set l}
(left* : (a : Span.A d) → P (left a))
(right* : (b : Span.B d) → P (right b))
(glue* : (c : Span.C d) → left* (Span.f d c) == right* (Span.g d c) [ P ↓ glue c ]) where
postulate
Pushout-elim : (x : Pushout d) → P x
Pushout-left-β : (a : Span.A d) → Pushout-elim (left a) ↦ left* a
{-# REWRITE Pushout-left-β #-}
Pushout-right-β : (b : Span.B d) → Pushout-elim (right b) ↦ right* b
{-# REWRITE Pushout-right-β #-}
Pushout-glue-β : (c : Span.C d) → ap Pushout-elim (glue c) ↦ glue* c
{-# REWRITE Pushout-glue-β #-}
|
Library/Spline/Spline/splineAttrs.asm | steakknife/pcgeos | 504 | 174061 | <reponame>steakknife/pcgeos
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: splineAttrs.asm
AUTHOR: <NAME>
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/22/92 Initial version.
DESCRIPTION:
$Id: splineAttrs.asm,v 1.1 97/04/07 11:09:27 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineAttrCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineApplyAttributesToGState
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION:
PASS: *ds:si = VisSplineClass object
ds:di = VisSplineClass instance data
es = Segment of VisSplineClass.
RETURN:
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/27/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineApplyAttributesToGState method dynamic VisSplineClass,
MSG_SPLINE_APPLY_ATTRIBUTES_TO_GSTATE
uses ax,cx,dx,bp
.enter
push bp
call SplineMethodCommonReadOnly
pop di
; set normal draw mode
mov al, MM_COPY
call GrSetMixMode
mov si, es:[bp].VSI_lineAttr
mov si, ds:[si]
call GrSetLineAttr
mov si, es:[bp].VSI_areaAttr
mov si, ds:[si]
call GrSetAreaAttr
call SplineEndmCommon
.leave
ret
SplineApplyAttributesToGState endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineSetDefaultLineAttrs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Initialize the line attributes data structure with the
default attributes.
PASS: *ds:si = VisSplineClass object
ds:di = VisSplineClass instance data
es = Segment of VisSplineClass.
RETURN:
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/22/92 Initial version.
SH 5/05/94 XIP'ed
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DefaultSplineLineAttrs LineAttr <CF_INDEX,
<C_BLACK,0,0>,
SDM_100,
CMT_DITHER shl offset CMM_MAP_TYPE,
LE_BUTTCAP,
LJ_BEVELED,
LS_SOLID,
<0,1>>
SplineSetDefaultLineAttrs method dynamic VisSplineClass,
MSG_SPLINE_SET_DEFAULT_LINE_ATTRS
uses ax,cx,dx
.enter
FXIP< push bx, si >
FXIP< mov bx, cs >
FXIP< mov si, offset DefaultSplineLineAttrs >
FXIP< mov cx, size LineAttr >
FXIP< call SysCopyToStackBXSI >
FXIP< mov cx, bx >
FXIP< mov dx, si >
FXIP< pop bx, si
NOFXIP< mov cx, cs >
NOFXIP< mov dx, offset DefaultSplineLineAttrs >
mov ax, MSG_SPLINE_SET_LINE_ATTRS
call ObjCallInstanceNoLock
FXIP< call SysRemoveFromStack >
.leave
ret
SplineSetDefaultLineAttrs endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineSetDefaultAreaAttrs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION:
PASS: *ds:si = VisSplineClass object
ds:di = VisSplineClass instance data
es = Segment of VisSplineClass.
RETURN:
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/22/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DefaultSplineAreaAttrs AreaAttr <CF_INDEX,
<C_BLACK,0,0>,
SDM_100,
CMT_DITHER shl offset CMM_MAP_TYPE>
SplineSetDefaultAreaAttrs method dynamic VisSplineClass,
MSG_SPLINE_SET_DEFAULT_AREA_ATTRS
uses ax,cx,dx
.enter
FXIP< push bx, si >
FXIP< mov bx, cs >
FXIP< mov si, offset DefaultSplineAreaAttrs >
FXIP< mov cx, size AreaAttr >
FXIP< call SysCopyToStackBXSI >
FXIP< mov cx, bx >
FXIP< mov dx, si >
FXIP< pop bx, si
NOFXIP< mov cx, cs >
NOFXIP< mov dx, offset DefaultSplineAreaAttrs >
mov ax, MSG_SPLINE_SET_AREA_ATTRS
call ObjCallInstanceNoLock
FXIP< call SysRemoveFromStack >
.leave
ret
SplineSetDefaultAreaAttrs endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineSetLineAttrs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION:
PASS: *ds:si = VisSplineClass object
ds:di = VisSplineClass instance data
es = Segment of VisSplineClass.
cx:dx = fptr to a LineAttr structure
(must be fptr for XIP'ed geodes)
RETURN:
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/22/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineSetLineAttrs method dynamic VisSplineClass,
MSG_SPLINE_SET_LINE_ATTRS
uses ax,cx,dx,bp
.enter
if FULL_EXECUTE_IN_PLACE
;
; Validate that cx:dx is not pointing to a movable code segment
;
EC< push bx, si >
EC< movdw bxsi, cxdx >
EC< call ECAssertValidFarPointerXIP >
EC< pop bx, si >
endif
test ds:[di].VSI_state, mask SS_HAS_ATTR_CHUNKS
jz done
call SplineMethodCommon
mov di, es:[bp].VSI_lineAttr
mov di, ds:[di]
push ds, es
segmov es, ds
mov ds, cx
mov si, dx
mov cx, size LineAttr
rep movsb
pop ds, es
call SplineEndmCommon
done:
.leave
ret
SplineSetLineAttrs endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineSetAreaAttrs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION:
PASS: *ds:si = VisSplineClass object
ds:di = VisSplineClass instance data
es = Segment of VisSplineClass.
cx:dx = fptr to a AreaAttr structure
(must be fptr for XIP'ed geodes)
RETURN:
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/22/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineSetAreaAttrs method dynamic VisSplineClass,
MSG_SPLINE_SET_AREA_ATTRS
uses ax,cx,dx,bp
.enter
if FULL_EXECUTE_IN_PLACE
;
; Validate that cx:dx is not pointing to a movable code segment
;
EC< push bx, si >
EC< movdw bxsi, cxdx >
EC< call ECAssertValidFarPointerXIP >
EC< pop bx, si >
endif
test ds:[di].VSI_state, mask SS_HAS_ATTR_CHUNKS
jz done
call SplineMethodCommon
mov di, es:[bp].VSI_areaAttr
mov di, ds:[di]
push ds, es
segmov es, ds
mov ds, cx
mov si, dx
mov cx, size AreaAttr
rep movsb
pop ds, es
call SplineEndmCommon
done:
.leave
ret
SplineSetAreaAttrs endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
METHOD: SplineSetLineWidth, MSG_SPLINE_SET_LINE_WIDTH
DESCRIPTION: Set the line width for all subsequent draws
PASS: *ds:si - VisSpline object
ds:di - VisSPline instance data
dx.cx - line width (WWFixed)
RETURN: nothing
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 4/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineSetLineWidth method dynamic VisSplineClass,
MSG_SPLINE_SET_LINE_WIDTH
uses ax, cx, dx, bp
.enter
call SplineMethodCommon
mov ax, UT_LINE_ATTR
call SplineInitUndo
mov di, es:[bp].VSI_lineAttr
mov di, ds:[di]
movdw bxax, dxcx ; bxax is NEW width
xchg cx, ds:[di].LA_width.WWF_frac
xchg dx, ds:[di].LA_width.WWF_int
cmpdw bxax, dxcx ; compare NEW, OLD
; If NEW > OLD, recalc vis bounds BEFORE invalidating,
; otherwise vice versa.
jg recalcThenInval
call SplineInvalidate
call SplineRecalcVisBounds
jmp done
recalcThenInval:
call SplineRecalcVisBounds
call SplineInvalidate
done:
call SplineEndmCommon
.leave
ret
SplineSetLineWidth endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineGetLineWidth
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Get the line width from my instance data
PASS: *ds:si = VisSplineClass object
ds:di = VisSplineClass instance data
es = Segment of VisSplineClass.
ax = Method.
RETURN: dx.cx - line width (WWFixed)
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 10/15/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineGetLineWidth method dynamic VisSplineClass,
MSG_SPLINE_GET_LINE_WIDTH
mov bx, offset VSI_lineAttr
mov cx, offset LA_width
mov dx, size LA_width
GOTO SplineGetAttrCommon
SplineGetLineWidth endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineGetLineAttrs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION:
PASS: *ds:si = VisSplineClass object
ds:di = VisSplineClass instance data
es = Segment of VisSplineClass.
RETURN:
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/22/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineGetLineAttrs method dynamic VisSplineClass,
MSG_SPLINE_GET_LINE_ATTRS
uses ax,cx,dx,bp
.enter
call SplineMethodCommonReadOnly
mov si, es:[bp].VSI_lineAttr
mov si, ds:[si]
push es
mov es, cx
mov di, dx
mov cx, size LineAttr
rep movsb
pop es
call SplineEndmCommon
.leave
ret
SplineGetLineAttrs endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineGetAreaAttrs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION:
PASS: *ds:si = VisSplineClass object
ds:di = VisSplineClass instance data
es = Segment of VisSplineClass.
RETURN:
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/22/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineGetAreaAttrs method dynamic VisSplineClass,
MSG_SPLINE_GET_AREA_ATTRS
uses ax,cx,dx,bp
.enter
call SplineMethodCommonReadOnly
mov si, es:[bp].VSI_areaAttr
mov si, ds:[si]
push es
mov es, cx
mov di, dx
mov cx, size AreaAttr
rep movsb
pop es
call SplineEndmCommon
.leave
ret
SplineGetAreaAttrs endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineSetLineStyle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Set the line style
PASS: *ds:si = VisSplineClass instance data.
ds:di = *ds:si
ds:bx = instance data of superclass
es = Segment of VisSplineClass class record
ax = Method number.
cl = Line Style
RETURN: nothing
DESTROYED: Nada.
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 6/17/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineSetLineStyle method dynamic VisSplineClass, \
MSG_SPLINE_SET_LINE_STYLE
uses ax, cx, dx, bp
.enter
push cx, dx
mov ax, UT_LINE_ATTR
mov bx, offset VSI_lineAttr
mov cx, size LA_style
mov dx, offset LA_style
call SplineSetAttrCommon
.leave
ret
SplineSetLineStyle endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineSetLineMask
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Set the line mask
PASS: *ds:si = VisSplineClass object
ds:di = VisSplineClass instance data
es = Segment of VisSplineClass.
RETURN:
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/22/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineSetLineMask method dynamic VisSplineClass,
MSG_SPLINE_SET_LINE_MASK
uses ax,cx,dx,bp
.enter
push cx, dx
mov ax, UT_LINE_ATTR
mov bx, offset VSI_lineAttr
mov cx, size LA_mask
mov dx, offset LA_mask
call SplineSetAttrCommon
.leave
ret
SplineSetLineMask endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineGetLineMask
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION:
PASS: *ds:si = VisSplineClass object
ds:di = VisSplineClass instance data
es = Segment of VisSplineClass.
RETURN:
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/22/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineGetLineMask method dynamic VisSplineClass,
MSG_SPLINE_GET_LINE_MASK
mov bx, offset VSI_lineAttr
mov cx, offset LA_mask
mov dx, size LA_mask
GOTO SplineGetAttrCommon
SplineGetLineMask endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineGetLineStyle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Return the spline's current line style
PASS: *ds:si = VisSplineClass object
ds:di = VisSplineClass instance data
es = Segment of VisSplineClass.
ax = Method.
RETURN: cl = line style
DESTROYED: dx
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 10/15/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineGetLineStyle method dynamic VisSplineClass,
MSG_SPLINE_GET_LINE_STYLE
mov bx, offset VSI_lineAttr
mov cx, offset LA_style
mov dx, size LA_style
GOTO SplineGetAttrCommon
SplineGetLineStyle endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineSetLineColor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Set the line color of the spline object
PASS: *ds:si = VisSplineClass instance data.
ds:di = *ds:si
ds:bx = instance data of superclass
es = Segment of VisSplineClass class record
ax = Method number.
cx, dx = color values (see GrSetLineColor for
description).
RETURN: nothing
DESTROYED: Nada.
REGISTER/STACK USAGE:
Standard dynamic register file.
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 6/17/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineSetLineColor method dynamic VisSplineClass,
MSG_SPLINE_SET_LINE_COLOR
uses ax, cx, dx, bp
.enter
push cx, dx
mov ax, UT_LINE_ATTR
mov bx, offset VSI_lineAttr
mov cx, size LA_color
mov dx, offset LA_color
call SplineSetAttrCommon
.leave
ret
SplineSetLineColor endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineGetLineColor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: returns the line color
PASS: *ds:si = VisSpline`Class object
ds:di = VisSpline`Class instance data
es = Segment of VisSpline`Class.
ax = Method.
RETURN:
DESTROYED:
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 10/15/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineGetLineColor method dynamic VisSplineClass,
MSG_SPLINE_GET_LINE_COLOR
mov bx, offset VSI_lineAttr
mov cx, offset LA_color
mov dx, size LA_color
GOTO SplineGetAttrCommon
SplineGetLineColor endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineSetAreaColor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Set the area color
PASS: *ds:si = VisSplineClass instance data.
ds:di = *ds:si
ds:bx = instance data of superclass
es = Segment of VisSplineClass class record
ax = Method number.
ch = ColorFlag
cl, dh, dl - color values
(see GrSetAreaColor for more info).
RETURN: nothing
DESTROYED: Nada.
REGISTER/STACK USAGE:
Standard dynamic register file.
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: ???
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 6/17/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineSetAreaColor method dynamic VisSplineClass, \
MSG_SPLINE_SET_AREA_COLOR
uses bp
.enter
push cx, dx
mov ax, UT_AREA_ATTR
mov bx, offset VSI_areaAttr
mov cx, size AA_color
mov dx, offset AA_color
call SplineSetAttrCommon
.leave
ret
SplineSetAreaColor endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineGetAreaColor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Return the spline's area color
PASS: *ds:si = VisSplineClass object
ds:di = VisSplineClass instance data
es = Segment of VisSplineClass.
ax = Method.
RETURN: cx = area color
DESTROYED: dx
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 10/15/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineGetAreaColor method dynamic VisSplineClass,
MSG_SPLINE_GET_AREA_COLOR
mov bx, offset VSI_areaAttr
mov cx, offset AA_color
mov dx, size AA_color
GOTO SplineGetAttrCommon
SplineGetAreaColor endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineSetAreaMask
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Set the mask for the area-fill routine.
PASS: *ds:si = VisSplineClass instance data.
ds:di = *ds:si
ds:bx = instance data of superclass
es = Segment of VisSplineClass class record
ax = Method number.
cl - area fill mask
RETURN: nothing
DESTROYED: Nada.
REGISTER/STACK USAGE:
Standard dynamic register file.
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 6/17/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineSetAreaMask method dynamic VisSplineClass,
MSG_SPLINE_SET_AREA_MASK
uses ax, bp
.enter
push cx, dx
mov ax, UT_AREA_ATTR
mov bx, offset VSI_areaAttr
mov cx, size AA_mask
mov dx, offset AA_mask
call SplineSetAttrCommon
.leave
ret
SplineSetAreaMask endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineSetAttrCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY: SplineSetLineWidth, etc, etc, etc,.
PASS: ax - UndoType (UT_LINE_ATTR or UT_AREA_ATTR)
bx - offset in instance data to chunk handle of
attribute chunk
cx - size of attribute data (1, 2 or 4 bytes)
dx - offset into attribute chunk to attribute field
ON STACK:
dataCX ; words of data to store
dataDX
RETURN: nothing
DESTROYED: ax,bx,cx,dx,si,di,bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 11/ 7/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineSetAttrCommon proc near \
dataDX:word,
dataCX:word ; (pushed first)
class VisSplineClass
.enter
test ds:[di].VSI_state, mask SS_HAS_ATTR_CHUNKS
jz realExit
; save stack frame and offset into instance data
push bp, bx
call SplineMethodCommon
pop di, bx ; stack frame, offset
call SplineInitUndo ; undo type in AL
EC < call ECSplineAttrChunks >
xchg di, bp ; di <= instance data,
; bp <= stack frame
mov bx, es:[bx][di] ; attr chunk handle
EC < tst bx >
EC < ERROR_Z SPLINE_HAS_NO_ATTR_CHUNKS >
mov bx, ds:[bx] ; deref attr chunk
EC < xchg bx, si >
EC < call ECCheckLMemChunk >
EC < xchg bx, si >
push es, di ; instance ptr
segmov es, ds, di
mov di, bx
add di, dx ; es:di - offset into attr chunk
mov ax, dataCX
stosb
dec cx
jz done
mov al, ah
stosb
dec cx
jz done
mov ax, dataDX
stosb
dec cx
jz done
mov al, ah
stosb
done:
pop es, bp ; es:bp - instance ptr
call SplineInvalidate
call SplineEndmCommon
realExit:
.leave
ret @ArgSize
SplineSetAttrCommon endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineGetAreaMask
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Return the spline's area mask
PASS: *ds:si = VisSplineClass object
ds:di = VisSplineClass instance data
es = Segment of VisSplineClass.
ax = Method.
RETURN: cx = area mask
DESTROYED: dx
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 10/15/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineGetAreaMask method dynamic VisSplineClass,
MSG_SPLINE_GET_AREA_MASK
mov bx, offset VSI_areaAttr
mov cx, offset AA_mask
mov dx, size AA_mask
GOTO SplineGetAttrCommon
SplineGetAreaMask endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SplineGetAttrCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Retrieve the attribute
CALLED BY: SplineGet...
PASS: bx - offset into VSI data wherein the pointer to the
attribute resides
cx - offset into the attribute chunk for the desired
attribute.
dx - size of the attribute: 1-4 bytes
RETURN: (depending on DX passed)
cl, cx, or DX:CX as the RETURN value (if dword, DX is
the HIGH word)
DESTROYED: bx, di
dx (if not returned)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 10/15/91 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SplineGetAttrCommon proc far
uses bp
class VisSplineClass
.enter
test ds:[di].VSI_state, mask SS_HAS_ATTR_CHUNKS
jz noChunks
call SplineMethodCommonReadOnly
mov di, bx ; offset to lptr in
; instance data.
mov di, es:[bp][di]
mov di, ds:[di]
add di, cx ; now, ds:di points to the desired
; attribute.
cmp dx, 1
je movByte
; Move a dword even if only one word is needed (it's faster than
; checking!)
movdw dxcx, ds:[di]
done:
call SplineEndmCommon
realExit:
.leave
ret
movByte:
mov cl, {byte} ds:[di]
jmp done
noChunks:
clrdw cxdx
jmp realExit
SplineGetAttrCommon endp
SplineAttrCode ends
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_5538_1291.asm | ljhsiun2/medusa | 9 | 166591 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r15
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x11299, %r15
nop
nop
nop
nop
nop
sub $34418, %rax
movb (%r15), %r13b
nop
nop
nop
and %rdx, %rdx
lea addresses_WC_ht+0x11957, %rsi
lea addresses_normal_ht+0x485d, %rdi
nop
dec %rbx
mov $104, %rcx
rep movsb
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_A_ht+0x2456, %rdi
nop
nop
nop
and $36289, %rax
movb $0x61, (%rdi)
add $37473, %rsi
lea addresses_WT_ht+0x18edd, %rsi
nop
sub $14173, %r13
movb (%rsi), %cl
nop
nop
cmp $21975, %rdx
lea addresses_UC_ht+0x18a5f, %rdi
nop
nop
nop
nop
nop
xor $12114, %rax
mov $0x6162636465666768, %rsi
movq %rsi, %xmm0
and $0xffffffffffffffc0, %rdi
movaps %xmm0, (%rdi)
nop
sub $43051, %rdi
lea addresses_UC_ht+0x13ffd, %rsi
lea addresses_WC_ht+0x7a6c, %rdi
nop
cmp %rbx, %rbx
mov $50, %rcx
rep movsq
nop
nop
nop
and %rdi, %rdi
lea addresses_WC_ht+0x1109f, %rsi
lea addresses_WC_ht+0x1a93d, %rdi
add $26255, %rbx
mov $93, %rcx
rep movsl
nop
nop
nop
nop
and %r15, %r15
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r15
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r8
push %rbx
push %rcx
push %rdx
// Store
lea addresses_RW+0xebba, %r8
clflush (%r8)
nop
nop
nop
nop
nop
cmp $32464, %r13
movl $0x51525354, (%r8)
nop
sub $35556, %r11
// Store
lea addresses_WT+0x18b1d, %rbx
nop
dec %r8
mov $0x5152535455565758, %rcx
movq %rcx, %xmm0
vmovups %ymm0, (%rbx)
nop
nop
nop
nop
nop
add $54653, %rbx
// Faulty Load
lea addresses_WT+0x1e4dd, %rdx
nop
nop
nop
nop
dec %rcx
vmovups (%rdx), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %rbx
lea oracles, %r8
and $0xff, %rbx
shlq $12, %rbx
mov (%r8,%rbx,1), %rbx
pop %rdx
pop %rcx
pop %rbx
pop %r8
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_RW', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT', 'congruent': 3}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WT_ht', 'congruent': 2}}
{'dst': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_A_ht', 'congruent': 0}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WT_ht', 'congruent': 4}}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 16, 'type': 'addresses_UC_ht', 'congruent': 1}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}}
{'dst': {'same': False, 'congruent': 5, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_WC_ht'}}
{'39': 5538}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
firmware/coreboot/src/mainboard/lenovo/t530/gma-mainboard.ads | fabiojna02/OpenCellular | 1 | 28142 | <gh_stars>1-10
with HW.GFX.GMA;
with HW.GFX.GMA.Display_Probing;
use HW.GFX.GMA;
use HW.GFX.GMA.Display_Probing;
private package GMA.Mainboard is
ports : constant Port_List :=
(DP1,
DP2,
DP3,
HDMI1,
HDMI2,
HDMI3,
Analog,
Internal,
others => Disabled);
end GMA.Mainboard;
|
grammar/pep_trace.g4 | quepas/pep2csv | 1 | 1087 | <reponame>quepas/pep2csv
grammar pep_trace;
NEWLINE : '\r'?'\n';
fragment DIGIT : [0-9];
fragment LETTER : [a-zA-Z];
fragment COLON : ':';
INT : '-'? DIGIT+;
EVENT : LETTER (LETTER | '_' | '=' | COLON | DIGIT)*;
TRACE_PROPERTY : COLON (LETTER | DIGIT | '_')+;
// Grammar rules
pep: trace (NEWLINE trace)* NEWLINE? EOF;
trace
: '@trace_start' trace_properties NEWLINE
'@perf_events:' events_list NEWLINE
trace_values NEWLINE
'@trace_end';
trace_properties: TRACE_PROPERTY (TRACE_PROPERTY)*;
events_list: EVENT (',' EVENT)*;
trace_values: row_values (NEWLINE row_values)*;
row_values: INT (',' INT)*;
|
MapCSS.g4 | mercatormaps/go-mapcss | 0 | 5619 | grammar MapCSS;
fragment COMMENT: ('/*' .*? '*/') | ('//' .*? '\n');
WS: (' ' | '\t' | '\n' | '\r' | '\f' | COMMENT) -> skip;
LBRACE: '{';
RBRACE: '}';
COLON: ':';
SEMICOLON: ';';
HYPHEN: '-';
fragment EBACKSLASH: '\\\\';
fragment UNICODE: '\u0080'..'\uFFFE';
fragment EDQUOTE: '\\"';
fragment ESQUOTE: '\\\'';
DQUOTED_STRING: '"' (' ' | '!' | '#'..'[' | ']'..'~' | '°' | UNICODE | EDQUOTE | EBACKSLASH)* '"';
SQUOTED_STRING: '\'' (' '..'&' | '('..'[' | ']'..'~' | '°' | UNICODE | ESQUOTE | EBACKSLASH)* '\'';
DIGIT: [0-9];
// Colors
fragment HEX_CHAR: [0-9a-fA-F];
fragment HEX_3_DIGITS: '#' HEX_CHAR HEX_CHAR HEX_CHAR;
fragment HEX_4_DIGITS: '#' HEX_CHAR HEX_CHAR HEX_CHAR HEX_CHAR;
fragment HEX_6_DIGITS: '#' HEX_CHAR HEX_CHAR HEX_CHAR HEX_CHAR HEX_CHAR HEX_CHAR;
fragment HEX_8_DIGITS: '#' HEX_CHAR HEX_CHAR HEX_CHAR HEX_CHAR HEX_CHAR HEX_CHAR HEX_CHAR HEX_CHAR;
HEX: (HEX_3_DIGITS | HEX_4_DIGITS | HEX_6_DIGITS | HEX_8_DIGITS);
// Numbers
int_
: '-'? DIGIT+
;
uint_
: DIGIT+
;
float_
: '-'? DIGIT+ | DIGIT* '.' DIGIT+;
// Properties
IDENTIFIER: [A-Za-z]+ [A-Za-z0-9\-]*;
// Structure
stylesheet
: entry* EOF
;
entry
: canvas_rule
| rule_
;
// Selectors
rule_
: selector (',' selector)+ decl_block
;
selector
: typ=IDENTIFIER zoom? (attribute)+
;
zoom
: zoom_range
| min_zoom
| exact_zoom
;
zoom_range
: '|z' min=uint_ HYPHEN max=uint_
;
min_zoom
: '|z' min=uint_ '-'
;
exact_zoom
: '|z' min=uint_
;
attribute
: '[' neg='!'? name=IDENTIFIER ']'
;
decl_block
: LBRACE RBRACE
;
// Canvas rule
canvas_rule
: 'canvas' canvas_decl_block
;
canvas_decl_block
: LBRACE (canvas_decl)+ RBRACE
;
canvas_decl
: antialiasing_decl
| fill_opacity_decl
| fill_color_decl
;
// Properties
antialiasing_decl
: 'antialiasing' COLON v=('full' | 'text' | 'none') SEMICOLON
;
fill_opacity_decl
: 'fill-opacity' COLON v=float_ SEMICOLON
;
fill_color_decl
: 'fill-color' COLON color SEMICOLON
;
color
: HEX
| rgb_color
| rgba_color
;
rgb_color
: 'rgb(' r=uint_ ',' g=uint_ ',' b=uint_ ')'
;
rgba_color
: 'rgba(' r=uint_ ',' g=uint_ ',' b=uint_ ',' a=float_ ')'
;
|
archs/exec_OCaml.als | mpardalos/memalloy | 20 | 5082 | <gh_stars>10-100
module exec_OCaml[E]
open exec[E]
sig Exec_OCaml extends Exec {
A : set E, // atomic events
}{
// initial writes are non-atomic
A in EV - IW
// RMWs and fences are atomic
(F + (R & W)) in A
}
one sig rm_A extends PTag {}
fun A[e:PTag->E, X:Exec_OCaml] : set E { X.A - e[rm_EV] - e[rm_A] }
|
orka_simd/src/x86/gnat/orka-simd-avx-doubles-arithmetic.ads | onox/orka | 52 | 7192 | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2016 onox <<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 Orka.SIMD.AVX.Doubles.Arithmetic is
pragma Pure;
function "*" (Left, Right : m256d) return m256d
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_mulpd256";
function "*" (Left, Right : m256d_Array) return m256d_Array
with Inline;
-- Multiplies the left matrix with the right matrix. Matrix multiplication
-- is associative, but not commutative.
function "*" (Left : m256d_Array; Right : m256d) return m256d
with Inline;
-- Multiplies the left matrix with the right vector. Matrix multiplication
-- is associative, but not commutative.
function "/" (Left, Right : m256d) return m256d
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_divpd256";
function Divide_Or_Zero (Left, Right : m256d) return m256d
with Inline;
function "+" (Left, Right : m256d) return m256d
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_addpd256";
function "-" (Left, Right : m256d) return m256d
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_subpd256";
function "-" (Elements : m256d) return m256d is
((0.0, 0.0, 0.0, 0.0) - Elements)
with Inline;
function "abs" (Elements : m256d) return m256d
with Inline;
function Sum (Elements : m256d) return Float_64
with Inline;
function Add_Subtract (Left, Right : m256d) return m256d
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_addsubpd256";
-- Subtract and add 64-bit doubles from Left and Right
function Horizontal_Add (Left, Right : m256d) return m256d
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_haddpd256";
-- Compute the sums of adjacent 64-bit doubles in Left and Right.
-- The two sums (four elements gives two pairs) of elements
-- from Left are stored in the two doubles in the first and third
-- position, sums from Right in the second and fourth.
function Horizontal_Subtract (Left, Right : m256d) return m256d
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_hsubpd256";
-- Compute the differences of adjacent 64-bit doubles in Left and Right.
-- The two differences (four elements gives two pairs) of elements
-- from Left are stored in the two doubles in the first and third
-- position, differences from Right in the second and fourth.
end Orka.SIMD.AVX.Doubles.Arithmetic;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.