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 |
|---|---|---|---|---|
Games/banchorce/source/maingame.asm | CiaranGruber/Ti-84-Calculator | 1 | 246498 | <gh_stars>1-10
;---------------------------------------------------------------;
; ;
; Banchor ;
; Main Game Loop ;
; ;
;---------------------------------------------------------------;
checkAreaName:
ld a,(area) ; A = New area number
ld hl,areaNum ; HL => Last area number
ld b,(hl) ; B = Last area number
ld (hl),a ; Save new area number
or a ; Check if it's 0
jr z,mainLoop ; If so, no area name
cp b ; Check to see if still in same area
jr z,mainLoop
DRAW_AREA_NAME()
mainLoop:
ld hl,frame
inc (hl)
ld hl,mainLoop
ld (__pauseJump),hl
ld hl,hurt
ld a,(hl)
or a
jr z,$+3
dec (hl)
call animateMap
call keyScan ; do a key scan
ld a,(y)
add a,3
and %11111000
add a,a
ld b,a
ld a,(x)
add a,3
srl a
srl a
srl a
add a,b
ld (playerOffset),a ; Save offset in map of player
ld a,(attacking)
or a
jr z,checkPlayerMovement
inc a
jr nz,afterPlayerMovement ; Can't move if attacking!
checkPlayerMovement:
ld a,(kbdG7)
push af
bit kbitUp,a
call nz,playerUp
pop af
push af
bit kbitDown,a
call nz,playerDown
pop af
push af
bit kbitLeft,a
call nz,playerLeft
pop af
push af
bit kbitRight,a
call nz,playerRight
pop af
or a
jr z,afterPlayerMovement
ld hl,walkCnt
inc (hl)
afterPlayerMovement:
ld a,(kbdG2)
bit kbitAlpha,a
jr z,afterCheckPeopleChests
call checkPeople ; Check to see if there's a person to talk to
call checkChests ; Check to see if there's a chest to open
afterCheckPeopleChests:
ld a,(kbdG6)
bit kbitClear,a
jp nz,saveGame
ld a,(kbdG1)
bit kbitMode,a
jp nz,pauseGame
#ifdef GOLD_GIVE
bit kbitDel,a
call nz,goldGive
#endif
bit kbit2nd,a
ld hl,afterAttacking
jp nz,tryAttacking
xor a
ld (attacking),a
afterAttacking:
ld a,(attacking)
or a
jr z,afterCheckStones
inc a
jr z,afterCheckStones
cp INI_ATTACK+1
jr nz,afterCheckStones ; can only break stones during first frame of attack
ld a,(ringOfMight) ; Check if player has Ring Of Might
or a
jr z,afterCheckStones ; If not, can't crush anything
ld bc,6 ; BC = 6 tiles to check
ld hl,replaceStoneRockTiles+6
ld a,(ringOfThunder) ; Check if player has Ring Of Thunder
or a
jr z,checkStones ; If not, only check stone tiles
ld bc,12 ; Otherwise, 12 tiles to check (6 stone, 6 rock)
ld hl,replaceStoneRockTiles
checkStones:
push hl
push bc ; Save for later usage
ld a,(playerDir)
add a,a
ld de,0 \ ld e,a
ld hl,swordCoords
add hl,de
ld bc,(y)
call _setBCUTo0
ld a,b
add a,(hl)
ld b,a
ld a,c
inc hl
add a,(hl)
ld c,a
ld (__stoneCoords),bc
ld l,a
ld a,b
call getTile
ex de,hl
ld hl,stoneRockTiles
pop bc ; BC = Number of tiles to check, depending on which Ring player has
cpir
pop hl
jr nz,afterCheckStones
add hl,bc
ld a,(hl)
ld (de),a
ld b,a
__stoneCoords = $+1
ld hl,$000000
srl h
srl h
srl h
srl l
srl l
srl l
ld a,l
add a,a
add a,a
add a,a
add a,a
add a,h
ld c,a
ld a,b
afterCheckStones:
; check warps
ld a,(numWarps)
or a
jr z,afterCheckWarps
ld b,a
ld hl,warps
ld a,(playerOffset)
ld de,4
checkWarps:
cp (hl) ; Compare playerOffset to warp offset
jp z,warpToMap
add hl,de
djnz checkWarps
afterCheckWarps:
ld a,(frame) ; Get frame counter
__enemySpawn = $+1
and $0F ; Only try this on every 16th frame (every 8th frame on Hard/Hell difficulties)
call z,makeEnemy ; Try making an enemy
call moveBullets ; Move enemy bullets
call moveEnemies ; Move enemies
call updateAnims ; Update animations
call checkSwordEnemyCollisions ; Check sword/enemy collisions
call checkPlayerEnemyCollisions ; Check player/enemy collisions
call checkPlayerBulletCollisions ; Check player/bullet collisions
call checkPlayerOrbCollisions ; check player/health orb collisions
call drawMap ; draw the map
call drawOrbs ; draw health orbs
call drawEnemies ; Draw enemies
call drawBullets ; Draw enemy bullets
call drawAnims ; Draw animations
call drawPlayer ; Draw player
__redrawHud = $+1
ld a,2
or a
call nz,drawHud ; draw the HUD, but only if there is a need (to reduce chance of frame lag)
__drawAreaName = $+1
ld a,$00
or a
call nz,drawAreaName ; draw the area name if we recently entered a new area
call vramFlip ; flip vbuf to lcd
ld a,(hearts)
or a
jp nz,mainLoop ; Can only keep playing if still alive!
jp playerDead
;------------------------------------------------
; pauseGame - not sure what this does?
; input: none
; output: none
;------------------------------------------------
pauseGame:
call vramCopy
ld de,80*256+50
ld bc,60*256+60
ld a,COLOUR_REDGREY
call drawWindow
ld de,136
ld c,106
ld hl,strPaused
call drawString
call vramFlip
pauseLoop:
call waitKey
cp GK_2ND
jr z,pauseDone
cp GK_ENTER
jr nz,pauseGame
pauseDone:
__pauseJump = $+1
jp mainLoop
.end
|
labs/code/play/src/S.g4 | parrt/cs652 | 110 | 1891 | <gh_stars>100-1000
grammar S;
code: stat+ ;
stat: 'return' expr ';'
| ID '=' expr ';'
;
expr: expr '*' expr
| expr '+' expr
| INT
| ID
;
INT : [0-9]+ ;
ID : [a-zA-Z]+ ;
WS : [ \r\n]+ -> skip ; |
tier-1/xcb/source/thin/xcb-xcb_render_create_radial_gradient_request_t.ads | charlie5/cBound | 2 | 23814 | -- This file is generated by SWIG. Please do not modify by hand.
--
with Interfaces;
with xcb.xcb_render_pointfix_t;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_render_create_radial_gradient_request_t is
-- Item
--
type Item is record
major_opcode : aliased Interfaces.Unsigned_8;
minor_opcode : aliased Interfaces.Unsigned_8;
length : aliased Interfaces.Unsigned_16;
picture : aliased xcb.xcb_render_picture_t;
inner : aliased xcb.xcb_render_pointfix_t.Item;
outer : aliased xcb.xcb_render_pointfix_t.Item;
inner_radius : aliased xcb.xcb_render_fixed_t;
outer_radius : aliased xcb.xcb_render_fixed_t;
num_stops : aliased Interfaces.Unsigned_32;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_render_create_radial_gradient_request_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_render_create_radial_gradient_request_t.Item,
Element_Array =>
xcb.xcb_render_create_radial_gradient_request_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C
.size_t range <>) of aliased xcb
.xcb_render_create_radial_gradient_request_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_render_create_radial_gradient_request_t.Pointer,
Element_Array =>
xcb.xcb_render_create_radial_gradient_request_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_render_create_radial_gradient_request_t;
|
programs/oeis/098/A098971.asm | jmorken/loda | 1 | 92151 | ; A098971: a(0)=1; for n > 0, a(n)=a(floor(n/2))+2*a(floor(n/4)).
; 1,3,5,5,11,11,11,11,21,21,21,21,21,21,21,21,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,171,171,171,171,171
mov $1,4
lpb $0
div $0,2
mul $1,2
lpe
div $1,6
mul $1,2
add $1,1
|
programs/oeis/010/A010691.asm | karttu/loda | 1 | 178047 | <filename>programs/oeis/010/A010691.asm<gh_stars>1-10
; A010691: Period 2: repeat (1,10).
; 1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10
mod $0,2
mov $1,10
pow $1,$0
|
test/Succeed/IndexInference.agda | redfish64/autonomic-agda | 3 | 3358 | <filename>test/Succeed/IndexInference.agda
{-# OPTIONS -v tc.conv.irr:50 #-}
-- {-# OPTIONS -v tc.lhs.unify:50 #-}
module IndexInference where
data Nat : Set where
zero : Nat
suc : Nat -> Nat
data Vec (A : Set) : Nat -> Set where
[] : Vec A zero
_::_ : {n : Nat} -> A -> Vec A n -> Vec A (suc n)
infixr 40 _::_
-- The length of the vector can be inferred from the pattern.
foo : Vec Nat _ -> Nat
foo (a :: b :: c :: []) = c
-- Andreas, 2012-09-13 an example with irrelevant components in index
pred : Nat → Nat
pred (zero ) = zero
pred (suc n) = n
data ⊥ : Set where
record ⊤ : Set where
NonZero : Nat → Set
NonZero zero = ⊥
NonZero (suc n) = ⊤
data Fin (n : Nat) : Set where
zero : .(NonZero n) → Fin n
suc : .(NonZero n) → Fin (pred n) → Fin n
data SubVec (A : Set)(n : Nat) : Fin n → Set where
[] : .{p : NonZero n} → SubVec A n (zero p)
_::_ : .{p : NonZero n}{k : Fin (pred n)} → A → SubVec A (pred n) k → SubVec A n (suc p k)
-- The length of the vector can be inferred from the pattern.
bar : {A : Set} → SubVec A (suc (suc (suc zero))) _ → A
bar (a :: []) = a
|
programs/oeis/231/A231680.asm | karttu/loda | 0 | 162704 | <reponame>karttu/loda
; A231680: a(n) = Sum_{i=0..n} digsum_8(i), where digsum_8(i) = A053829(i).
; 0,1,3,6,10,15,21,28,29,31,34,38,43,49,56,64,66,69,73,78,84,91,99,108,111,115,120,126,133,141,150,160,164,169,175,182,190,199,209,220,225,231,238,246,255,265,276,288,294,301,309,318,328,339,351,364,371,379,388,398,409,421,434,448,449,451,454,458,463,469,476,484,486,489,493,498,504,511,519,528
mov $7,$0
mov $9,$0
lpb $9,1
clr $0,7
mov $0,$7
sub $9,1
sub $0,$9
lpb $0,1
mov $3,$0
div $0,8
mov $6,$3
mod $6,8
add $4,$6
lpe
add $8,$4
lpe
mov $1,$8
|
Transynther/x86/_processed/NONE/_zr_/i3-7100_9_0x84_notsx.log_122_135.asm | ljhsiun2/medusa | 9 | 105510 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r14
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0xe414, %r14
nop
nop
nop
nop
inc %r12
movw $0x6162, (%r14)
nop
nop
nop
xor $15417, %r13
lea addresses_A_ht+0xb83c, %rsi
lea addresses_WC_ht+0x158a8, %rdi
nop
nop
nop
nop
nop
add $12499, %rbx
mov $74, %rcx
rep movsq
cmp %rsi, %rsi
lea addresses_D_ht+0x3714, %rsi
lea addresses_WC_ht+0x19204, %rdi
nop
sub $27837, %r13
mov $24, %rcx
rep movsb
add $24938, %r14
lea addresses_WC_ht+0xded4, %r12
nop
nop
nop
and %rsi, %rsi
mov (%r12), %r13
nop
dec %r12
lea addresses_WT_ht+0x1ef3c, %rbx
nop
nop
nop
nop
xor %rcx, %rcx
vmovups (%rbx), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $1, %xmm3, %r13
add $12029, %rsi
lea addresses_WC_ht+0x2114, %rsi
lea addresses_normal_ht+0xe814, %rdi
nop
nop
nop
nop
add $29236, %rdx
mov $22, %rcx
rep movsb
xor $56703, %rcx
lea addresses_A_ht+0x190bc, %r14
nop
nop
nop
nop
cmp %rcx, %rcx
movw $0x6162, (%r14)
nop
nop
nop
nop
nop
dec %rdx
lea addresses_UC_ht+0xf824, %rsi
lea addresses_UC_ht+0x17d14, %rdi
clflush (%rsi)
nop
nop
nop
and $18837, %r13
mov $77, %rcx
rep movsq
nop
nop
nop
xor $30941, %rdi
lea addresses_UC_ht+0x197d4, %rsi
lea addresses_A_ht+0x9914, %rdi
nop
nop
nop
sub %r12, %r12
mov $84, %rcx
rep movsb
nop
cmp $60242, %rbx
lea addresses_normal_ht+0x2294, %r14
nop
nop
nop
nop
dec %rsi
movups (%r14), %xmm4
vpextrq $0, %xmm4, %rdi
nop
nop
nop
add $34956, %r13
lea addresses_A_ht+0xb4d4, %rdi
nop
nop
nop
inc %r12
movb $0x61, (%rdi)
nop
nop
nop
nop
inc %rdx
lea addresses_WC_ht+0x14c54, %r14
nop
nop
nop
nop
cmp %rdx, %rdx
movw $0x6162, (%r14)
nop
nop
nop
nop
nop
sub $38935, %rcx
lea addresses_D_ht+0x7c50, %rsi
lea addresses_WC_ht+0x1db14, %rdi
nop
and $47687, %r13
mov $37, %rcx
rep movsq
nop
cmp $63146, %rdx
lea addresses_WC_ht+0x6a14, %rsi
nop
nop
nop
nop
nop
sub $11658, %rdi
mov (%rsi), %r13
nop
and $15982, %rcx
lea addresses_WC_ht+0x1a514, %rsi
lea addresses_D_ht+0x7494, %rdi
nop
nop
nop
nop
nop
and $52028, %rbx
mov $17, %rcx
rep movsq
nop
nop
nop
add %rbx, %rbx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r15
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_UC+0x6494, %rax
nop
nop
nop
sub $13929, %rcx
movw $0x5152, (%rax)
nop
nop
nop
sub %r15, %r15
// Store
lea addresses_D+0x14254, %r15
cmp $4056, %rbx
movb $0x51, (%r15)
nop
nop
nop
nop
nop
cmp $11990, %r15
// REPMOV
lea addresses_US+0x14914, %rsi
lea addresses_UC+0x1dc14, %rdi
nop
nop
nop
dec %r13
mov $81, %rcx
rep movsw
cmp $55433, %rcx
// Store
lea addresses_WC+0x1514c, %rax
nop
nop
add %rcx, %rcx
movw $0x5152, (%rax)
dec %rbx
// Faulty Load
lea addresses_A+0x1d514, %r11
nop
nop
nop
nop
dec %rbx
movb (%r11), %r15b
lea oracles, %rax
and $0xff, %r15
shlq $12, %r15
mov (%rax,%r15,1), %r15
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r15
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_D', 'same': False, 'size': 1, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_US', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_UC', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 4, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'same': True, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'00': 122}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
4-high/gel/source/platform/sdl/gel-window-setup.ads | charlie5/lace | 20 | 8033 | <gh_stars>10-100
with
gel.Window.sdl;
package gel.Window.setup
renames gel.Window.sdl;
|
lapl.g4 | Lartu/LAPL | 4 | 6253 | grammar lapl;
// +-----------------------------------------+ //
// | Lexer Rules | //
// +-----------------------------------------+ //
MULTICOMMENT : '/*' .*? '*/' -> skip ;
MULTICOMMENTB : '#*' .*? '*#' -> skip ;
/*MULTICOMMENTALL : '/*' .*? EOF -> skip ;
MULTICOMMENTALLB: '/*' .*? EOF -> skip ;*/
COMMENT : '#' .*? '\n' -> skip ;
COMMENTB : '//' .*? '\n' -> skip ;
WHITESPACE : (' ' | '\t' | '\n' |'\r') -> skip;
EQ_OP : '==';
NEQ_OP : '!=';
LT_OP : '<';
GT_OP : '>';
LE_OP : '<=';
GE_OP : '>=';
PLUS_OP : '+';
MINUS_OP : '-';
POW_OP : '**';
TIMES_OP : '*';
DIV_OP : '/';
MOD_OP : '%';
ASSIGN_OP : '=';
CONCAT_OP : '&';
LPAR : '(';
RPAR : ')' ;
SEMICOLON : ';' ;
COLON : ':' ;
BLOCK_OPEN : '{' ;
BLOCK_CLOSE : '}' ;
INDEX_ACCESS_O : '[' ;
INDEX_ACCESS_C : ']' ;
VARIABLE : '$' [a-zA-Z_] [a-zA-Z0-9_]* ;
COMMA : ',' ;
// <Reserved words>
REF_OP : 'ref';
FLOOR_OP : 'floor';
CEIL_OP : 'ceil';
NOT_OP : 'not';
OR_OP : 'or';
AND_OP : 'and';
STR_OP : 'str';
NUM_OP : 'num';
BOOLOP : 'bool';
WHILE : 'while' ;
CONTINUE : 'continue' ;
BREAK : 'break' ;
IF : 'if' ;
ELSE : 'else' ;
DISPLAY : 'display' ;
EXIT : 'exit' ;
TRUE : 'true' ;
FALSE : 'false' ;
RETURN : 'return' ;
FUNCTION : 'fun' | 'def' ;
ARRAY : 'array' ;
MAP : 'map' ;
LINEFEED : 'lf' ;
CRLF : 'crlf' ;
TYPE : 'type' ;
VAR : 'var';
BIF_LEN : 'len';
RANDOM : 'random';
ACCEPT : 'accept';
BIF_ISNUM : 'isNumeric';
BIF_REPLACE : 'replace';
// </Reserved words>
IDENTIFIER : [a-zA-Z_] [a-zA-Z0-9_]* ;
NUMBER : [0-9]+ ('.' [0-9]+)? ;
QUOTE : '\'';
DQUOTE : '"';
CHAR : ~['] | ESCAPEDCHAR ;
DCHAR : ~["] | ESCAPEDCHAR ;
ESCAPEDCHAR : '\\' . ;
STRING : (QUOTE CHAR* QUOTE) | (DQUOTE DCHAR* DQUOTE);
// +------------------------------------------+ //
// | Parser Rules | //
// +------------------------------------------+ //
lapl_source
: statement* EOF
;
statement
: block
| line_statement
| empty_line
;
empty_line
: SEMICOLON
;
block
: BLOCK_OPEN statement* BLOCK_CLOSE
| while_block
| if_block
| function_declaration
;
line_statement
:
( assignment
| function_call
| continue_statement
| break_statement
| exit_statement
| display_statement
| value
| return_statement
) SEMICOLON
;
string
: STRING
| STR_OP number_expression
| LINEFEED
| CRLF
;
number
: PLUS_OP* MINUS_OP* NUMBER
| NUM_OP string_expression
| TYPE value
;
number_expression
: number
| builtin_number_function
| function_call
| VARIABLE
| CEIL_OP number_expression
| FLOOR_OP number_expression
| number_expression POW_OP number_expression
| number_expression MOD_OP number_expression
| number_expression DIV_OP number_expression
| number_expression TIMES_OP number_expression
| number_expression MINUS_OP number_expression
| number_expression PLUS_OP number_expression
| LPAR number_expression RPAR
; //Precedence goes from bottom (higher) to top (lower)
string_expression
: string
| builtin_string_function
| function_call
| VARIABLE
| string_expression INDEX_ACCESS_O number_expression INDEX_ACCESS_C
| string_expression INDEX_ACCESS_O number_expression COMMA number_expression INDEX_ACCESS_C
| string_expression CONCAT_OP string_expression
| LPAR string_expression RPAR
;
builtin_number_function
: BIF_LEN LPAR string_expression RPAR
| RANDOM LPAR RPAR
;
builtin_string_function
: ACCEPT LPAR RPAR
| BIF_REPLACE LPAR string_expression COMMA string_expression COMMA string_expression RPAR
;
builtin_boolean_function
: BIF_ISNUM LPAR string_expression RPAR
;
/*array //TODO check
: ARRAY
| VARIABLE INDEX_ACCESS_O value INDEX_ACCESS_C
| function_call INDEX_ACCESS_O value INDEX_ACCESS_C
;
map //TODO check
: MAP
| VARIABLE BLOCK_OPEN value BLOCK_CLOSE
| function_call BLOCK_OPEN value BLOCK_CLOSE
;
array_expression
: array
| VARIABLE
| function_call
;
map_expression
: map
| VARIABLE
| function_call
;*/
value
: VARIABLE
| function_call
| string_expression
| number_expression
| boolean_expr
//| array_expression
//| map_expression
;
argument
: value
//| REF_OP VARIABLE
;
assignment
: VARIABLE ASSIGN_OP value
| VAR VARIABLE ASSIGN_OP value
| VAR VARIABLE
//| VARIABLE INDEX_ACCESS_O value INDEX_ACCESS_C ASSIGN_OP value
;
function_call
: IDENTIFIER LPAR argument (COMMA argument)* RPAR
;
while_block
: WHILE boolean_expr statement
;
boolean_value
: TRUE
| FALSE
;
boolean_expr
: boolean_value
| builtin_boolean_function
| function_call
| VARIABLE
| NOT_OP boolean_expr
| string_expression EQ_OP string_expression
| string_expression NEQ_OP string_expression
| string_expression LT_OP string_expression
| string_expression GT_OP string_expression
| string_expression LE_OP string_expression
| string_expression GE_OP string_expression
| number_expression EQ_OP number_expression
| number_expression NEQ_OP number_expression
| number_expression LT_OP number_expression
| number_expression GT_OP number_expression
| number_expression LE_OP number_expression
| number_expression GE_OP number_expression
| boolean_expr EQ_OP boolean_expr
| boolean_expr NEQ_OP boolean_expr
| boolean_expr OR_OP boolean_expr
| boolean_expr AND_OP boolean_expr
| LPAR boolean_expr RPAR
;
if_block
: IF boolean_expr statement else_block?
;
else_block
: ELSE statement
;
continue_statement
: CONTINUE
;
break_statement
: BREAK
;
return_statement
: RETURN
;
exit_statement
: EXIT
| EXIT number_expression
;
function_declaration
: FUNCTION IDENTIFIER LPAR (VARIABLE (COMMA VARIABLE)*)? RPAR statement
;
display_statement
: DISPLAY display_values
;
display_values
: value+
;
/*
FEATURES TO BE ADDED (in no particular order):
BOOLEAN EXPRESSIONS WITH VARIABLES OR FUNCTIONS ON BOTH SIDES
arrays
maps
pass by reference for maps and arrays
copy maps and arrays
include
SCRIPTDIR
try - except
try without except
sleep
execute
file saving, loading and appending (and reading line by line)
trigonometric functions
split
features to be *maybe* added:
ternary operator
for each
for
namespaces
fork
mutex
semaphores
already added:
== and != for booleans
string length
random number
isNumeric(string)
accept()
What happens if num "aslkdj" is executed?
utf8 support
replace
Negative values in string slices
String slices to infinity
real return statement
functions to be added to the stdlib:
string uppercase
string lowercase
*/ |
alloy4fun_models/trashltl/models/11/axGqH2DkExeNKs27B.als | Kaixi26/org.alloytools.alloy | 0 | 2323 | <gh_stars>0
open main
pred idaxGqH2DkExeNKs27B_prop12 {
always all f:File | eventually f in Trash
}
pred __repair { idaxGqH2DkExeNKs27B_prop12 }
check __repair { idaxGqH2DkExeNKs27B_prop12 <=> prop12o } |
Driver/Socket/PPP/pppMain.asm | steakknife/pcgeos | 504 | 26137 | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Geoworks 1995 -- All Rights Reserved
GEOWORKS CONFIDENTIAL
PROJECT: Socket
MODULE: PPP Driver
FILE: pppMain.asm
AUTHOR: <NAME>, Apr 19, 1995
ROUTINES:
Name Description
---- -----------
Socket driver function handlers:
--------------------------------
PPPStrategy
PPPDoNothing
PPPInit
PPPExit
PPPSuspend
PPPRegister
PPPUnregister
PPPAllocConnection
PPPLinkConnectRequest
PPPStopLinkConnect
PPPDisconnectRequest
PPPSendDatagram
PPPResetRequest
PPPGetInfo
PPPResolveAddr
PPPMediumActivated
PADCallTerminated ; Penelope PAD
Method handlers for PPPProcessClass:
------------------------------------
PPPDetach
PPPTimeout
PPPOpenLink
PPPCloseLink
PPPSendFrame
PPPHandleDataNotification
PPPHandlePadStreamStatus ; Penelope PAD
PPPPClientDataProto ; Penelope PAD
PPPPClientConnectProto ; Penelope PAD
PPPPClientErrorProto ; Penelope PAD
Misc:
-----
ECCheckClientInfo
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 4/19/95 Initial revision
DESCRIPTION:
$Id: pppMain.asm,v 1.34 98/08/12 17:24:12 jwu Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
;---------------------------------------------------------------------------
; Dgroup
;---------------------------------------------------------------------------
ResidentCode segment resource
DriverTable SocketDriverInfoStruct <
<PPPStrategy,
0,
DRIVER_TYPE_SOCKET>,
0,
(mask SDPO_MAX_PKT or mask SDPO_UNIT),
PPP_MIN_DGRAM_HDR
>
ForceRef DriverTable
ResidentCode ends
idata segment
;
; First word in segment of process class must be a handle or
; kernel code will die when calling superclass. Process class
; created in drivers must manually put the handle in dgroup.
;
myHandle hptr handle 0
port SerialPortNum PPP_DEFAULT_PORT
baud SerialBaud PPP_DEFAULT_BAUD
if _RESPONDER
;
; Data structure for logging outgoing calls with Contact Log.
;
pppLogEntry LogEntry <
0, ; LE_number
LECI_INVALID_CONTACT_ID, ; LE_contactID
LET_DATA, ; LE_type
LED_SENT, ; LE_direction
0, ; LE_duration
<0>, ; LE_datetime
0> ; LE_flags
endif ; _RESPONDER
idata ends
ForceRef myHandle
udata segment
pppThread hptr.HandleThread
timerHandle hptr
hugeLMem hptr
inputBuffer hptr
regSem hptr ; semaphore for registering clients
taskSem hptr ; mutex for PPP actions that need to
; be synchronized
clientInfo PppClientInfo
flowCtrl SerialFlowControl
serialStrategy fptr
if not _PENELOPE
serialDr hptr
modemStrategy fptr
modemDr hptr ; only loaded when needed
baudRate word ; the baud rate from modem
endif
mediumType MediumType ; for Clavin notifications
spaceToken word ; token from GeodeRequestSpace
if _RESPONDER
vpClientToken VpClientToken ; token assigned by VP library
vpCallID byte
callEnded BooleanByte
endif
if _PENELOPE
padOptr optr ; PAD's optr to send messages
padLibrary hptr ; PAD's library handle
padResponse AtTranslationType_e ; latest response from PAD
padStatus word ; initially 0x0040 (CD set).
padSignalDone byte ; -1 TRUE, 0 FALSE for
; PPPGetPADResponse
padAbnormalDisconnect byte ; -1 if PAD disconnects us
; abnormally, else 0
padStreamDr hptr
padStreamStrategy fptr
padUpStream word ; StreamToken to read data
padDnStream word ; StreamToken to write data
endif
udata ends
idata segment
;; The data will be used by internet dial-up application.
bytesSent dword 0
bytesReceived dword 0
idRegistered byte 0
idata ends
PPPClassStructures segment resource
PPPProcessClass
PPPUIClass
PPPAddressControlClass
PPPSpecialTextClass
PPPClassStructures ends
;---------------------------------------------------------------------------
; Strategy Routine
;---------------------------------------------------------------------------
ResidentCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPStrategy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Entry point for all PPP driver calls.
CALLED BY: EXTERNAL (PPP client)
PASS: di = SocketFunction
see specific socket function for other arguments
RETURN: carry set if some error occurred
see specific socket function for return values
DESTROYED: nothing
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 4/19/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPStrategy proc far
uses di
.enter
EC < call ECCheckClientInfo >
cmp di, SOCKET_DR_FIRST_SPEC_FUNC
jge dialup
shl di ; index (4-byte) fptrs
cmp di, size driverProcTable
jae badCall
pushdw cs:driverProcTable[di]
call PROCCALLFIXEDORMOVABLE_PASCAL
exit:
.leave
ret
dialup:
;check if the function is one of our special functions defined for the
;internet dialup application
sub di, SOCKET_DR_FIRST_SPEC_FUNC
shl di
cmp di, size PPPIDFuncTable
jae badCall
pushdw cs:PPPIDFuncTable[di]
call PROCCALLFIXEDORMOVABLE_PASCAL
jmp exit
badCall:
mov ax, SDE_UNSUPPORTED_FUNCTION
stc
jmp exit
PPPStrategy endp
driverProcTable fptr.far \
PPPInit,
PPPExit,
PPPSuspend,
PPPDoNothing, ; DR_UNSUSPEND
PPPRegister,
PPPUnregister,
PPPAllocConnection,
PPPLinkConnectRequest,
PPPDoNothing, ; DR_SOCKET_DATA_CONNECT_REQUEST
PPPStopLinkConnect,
PPPDisconnectRequest,
PPPDoNothing, ; DR_SOCKET_SEND_DATA
PPPDoNothing, ; DR_SOCKET_STOP_SEND_DATA
PPPSendDatagram,
PPPResetRequest,
PPPDoNothing, ; DR_SOCKET_ATTACH
PPPDoNothing, ; DR_SOCKET_REJECT
PPPGetInfo,
PPPDoNothing, ; DR_SOCKET_SET_OPTION
PPPDoNothing, ; DR_SOCKET_GET_OPTION
PPPResolveAddr,
PPPDoNothing, ; DR_SOCKET_STOP_RESOLVE
PPPDoNothing, ; DR_SOCKET_CLOSE_MEDIUM
PPPDoNothing, ; DR_SOCKET_MEDIUM_CONNECT_REQUEST
PPPMediumActivated,
PPPDoNothing, ; DR_SOCKET_SET_MEDIUM_OPTION
PPPDoNothing ; DR_SOCKET_RESOLVE_LINK_LEVEL_ADDRESS
PPPIDFuncTable fptr.far \
PPPIDGetBaudRate,
PPPIDGetBytesSent,
PPPIDGetBytesReceived,
PPPIDRegister,
PPPIDUnregister,
PPPIDForceDisconnect
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPDoNothing
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Just clear the carry.
CALLED BY: PPPStrategy
RETURN: carry clear
DESTROYED: nothing
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/16/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPDoNothing proc far
clc
ret
PPPDoNothing endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECCheckClientInfo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Validate clientInfo structure.
CALLED BY: PPPStrategy
PASS: nothing
RETURN: only if clientInfo is valid
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 7/25/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if ERROR_CHECK
ECCheckClientInfo proc far
uses bx, ds
.enter
mov bx, handle dgroup
call MemDerefDS
tst ds:[clientInfo].PCI_unit
ERROR_NE PPP_CORRUPT_CLIENT_INFO
mov bl, ds:[clientInfo].PCI_linkState
Assert etype, bl, PppLinkState
mov bx, ds:[clientInfo].PCI_mutex
tst bx
je checkError
test bl, 00001111b ; just check 16 byte boundary
ERROR_NE PPP_CORRUPT_CLIENT_INFO
checkError:
mov bx, ds:[clientInfo].PCI_error
tst bx
je exit
Assert etype, bl, SocketDrError
clr bl
Assert etype, bx, SpecSocketDrError
exit:
.leave
ret
ECCheckClientInfo endp
endif ; ERROR_CHECK
ResidentCode ends
InitCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPInit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Initialize the PPP driver.
CALLED BY: PPPStrategy
PASS: nothing
RETURN: carry clear if driver successfully initialized
DESTROYED: ax, cx, dx, bp, di, si, ds, es (allowed)
PSEUDO CODE/STRATEGY:
Load appropriate serial driver and get strategy routine
Allocate input buffer block
Allocate a HugeLMem
Allocate registration semaphore
call PPPSetup to initialize the protocols
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/16/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPInit proc far
uses bx
.enter
;
; Get some elbow room. (Use UI for the app.) Bail if
; request is denied.
;
mov bx, handle dgroup
call MemDerefDS
mov ax, SGIT_UI_PROCESS
call SysGetInfo ; ax = UI handle
mov cx, PPP_SPACE_NEEDED
mov_tr bx, ax
call GeodeRequestSpace ; bx = reservation token
jc exit
mov ds:[spaceToken], bx
;
; Load appropriate serial driver and get serial strategy routine.
;
; For Penelope, PAD loads the serial driver and returns to us a
; stream handle. So serial driver is not always loaded.
;
if _PENELOPE
;
; For PENELOPE, medium is GMID_CELL_MODEM and Unit is 0. Port
; is used as the Unit in many routines in PPP.
;
mov ds:[port], 0 ; unit = 0 (for Medium
; and Unit).
else
call PPPLoadSerialDriver
jc error
;
; Read port and baud settings.
;
call PPPGetPortSettings
endif
;
; Allocate block for input buffer and make sure we own it.
;
mov ax, PPP_INPUT_BUFFER_SIZE
mov cx, ALLOC_DYNAMIC or mask HF_SHARABLE
mov bx, handle 0
call MemAllocSetOwner
jc error
mov ds:[inputBuffer], bx
;
; Create huge lmem for allocating buffers.
;
clr ax
mov bx, MIN_OPTIMAL_BLOCK_SIZE
mov cx, MAX_OPTIMAL_BLOCK_SIZE
call HugeLMemCreate
jc error
mov ds:[hugeLMem], bx
;
; Allocate the semaphore for synchronizing client registration
; and link open/closes. Make sure we own both!
;
mov bx, 1
call ThreadAllocSem
mov ds:[regSem], bx
mov ax, handle 0
call HandleModifyOwner ; destroys AX
mov bx, 1
call ThreadAllocSem
mov ds:[taskSem], bx
mov ax, handle 0
call HandleModifyOwner
;
; Initialize PPP protocols. DS already points to dgroup for
; the C routine.
;
call PPPSetup
clc
jmp exit
error:
call PPPExit
stc
exit:
.leave
ret
PPPInit endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPExit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Shutdown the PPP driver.
CALLED BY: PPPStrategy
PPPInit
PASS: nothing
RETURN: nothing
DESTROYED: ax, bx, cx, dx, si, di, ds, es (allowed)
PSEUDO CODE/STRATEGY:
Shutdown PPP protocol.
Close any open devices.
Free input buffer
Free HugeLmem
Free registration semaphore
Return requested space.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/16/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPExit proc far
;
; Only cleanup if not doing a dirty shutdown.
;
mov bx, handle dgroup
call MemDerefDS
mov al, ds:[clientInfo].PCI_status
and ax, mask CS_REGISTERED
EC < WARNING_NZ PPP_DIRTY_SHUTDOWN >
push ax
call PPPShutdown
if _PENELOPE
;
; Unregister from PAD and unload PAD. PAD is responsible for
; loading and unloading serial driver.
;
call PPPUnloadPAD
else
;
; Unload serial driver, if loaded. If not, then we didn't get
; any further so just return the borrowed space.
;
clr bx
xchg bx, ds:[serialDr]
tst bx
je returnSpace
call GeodeFreeDriver
endif
;
; Free input buffer. If not allocated, then hugelmem and
; reg semaphore never got created.
;
clr bx
xchg bx, ds:[inputBuffer]
tst bx
je returnSpace
call MemFree
;
; Free huge lmem and registration semaphore. If huge lmem was
; not allocated, then we didn't allocate a semaphore.
;
clr bx
xchg bx, ds:[hugeLMem]
tst bx
je returnSpace
call HugeLMemDestroy
clr bx
xchg bx, ds:[regSem]
call ThreadFreeSem
clr bx
xchg bx, ds:[taskSem]
call ThreadFreeSem
returnSpace:
;
; Return borrowed space. Do this last!
;
clr bx
xchg bx, ds:[spaceToken]
tst bx
jz exit
call GeodeReturnSpace
exit:
ret
PPPExit endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPSuspend
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Allow suspension if no connections are open.
CALLED BY: PPPStrategy
PASS: cx:dx = buffer to place reason for for refusal, if refused
RETURN: carry set if suspension refused
cx:dx = buffer filled with null terminated reason
(DRIVER_SUSPEND_ERROR_BUFFER_SIZE bytes long)
carry clear if suspension approved
DESTROYED: ax, di (allowed)
PSEUDO CODE/STRATEGY:
Find out if a connection is not closed
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/16/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPSuspend proc far
uses bx, si, ds, es
.enter
EC < Assert buffer, cxdx, DRIVER_SUSPEND_ERROR_BUFFER_SIZE >
;
; Allow suspension if PPP link is closed.
;
mov bx, handle dgroup
call MemDerefES
cmp es:[clientInfo].PCI_linkState, PLS_CLOSED
je exit ; carry clear
;
; Refuse suspension. Give reason.
;
mov bx, handle Strings
call MemLock
mov ds, ax
mov si, offset refuseSuspendString
mov si, ds:[si]
EC < push cx >
EC < movdw esdi, dssi >
EC < call LocalStringSize ; cx = size w/o null >
EC < cmp cx, DRIVER_SUSPEND_ERROR_BUFFER_SIZE >
EC < ERROR_AE PPP_REFUSE_SUSPEND_STRING_TOO_LONG >
EC < pop cx >
movdw esdi, cxdx
LocalCopyString
call MemUnlock
stc
exit:
.leave
ret
PPPSuspend endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPRegister
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Register a client to use PPP.
CALLED BY: PPPStrategy
PASS: bx = domain handle of the driver
ds:si = domain name (null terminated) (ignored)
dx:bp = client entry point for SCO functions (virtual fptr)
cl = SocketDriverType (ignored)
RETURN: carry set if error
ax = SocketDrError (SDE_ALREADY_REGISTERED,
SDE_MEDIUM_BUSY)
else
bx = client handle
cl = min header size required
DESTROYED: ax, bx if not returned (di allowed)
PSEUDO CODE/STRATEGY:
Grab the reg sem
if client is already registered
if client is same client
return error with SDE_ALREADY_REGISTERED
else
return error with SDE_MEDIUM_BUSY
else
store registration info
allocate mutex for client
spawn thread
start timer
return registration info
release reg sem
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/16/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPRegister proc far
uses ds
.enter
EC < push bx, si >
EC < movdw bxsi, dxbp >
EC < call ECAssertValidFarPointerXIP >
EC < pop bx, si >
;
; Get in line for registration.
;
mov di, bx ; di = domain handle
mov bx, handle dgroup
call MemDerefDS
mov bx, ds:[regSem]
call ThreadPSem
;
; Only allow registration if not already registered.
;
test ds:[clientInfo].PCI_status, mask CS_REGISTERED
jne busy
;
; Store registration info. Allocate mutex, spawn thread and
; start timer.
;
BitSet ds:[clientInfo].PCI_status, CS_REGISTERED
mov ds:[clientInfo].PCI_domain, di
movdw ds:[clientInfo].PCI_clientEntry, dxbp
clr bx ; blocking sem
call ThreadAllocSem ; bx = semaphore
mov ax, handle 0
call HandleModifyOwner
mov ds:[clientInfo].PCI_mutex, bx
call PPPCreateThread ; di = error, if any
jc error
mov cl, PPP_MIN_HDR_SIZE
clc
jmp done
busy:
;
; If client is already registered, determine if client is
; the same or different. PPP driver can only be registered
; once. (For now because it only supports one interface.)
;
mov di, SDE_MEDIUM_BUSY
cmpdw dxbp, ds:[clientInfo].PCI_clientEntry
jne error
mov di, SDE_ALREADY_REGISTERED
error:
stc
done:
mov bx, ds:[regSem]
call ThreadVSem ; trashes AX
mov_tr ax, di ; return any error
mov bx, offset clientInfo ; return client handle
.leave
ret
PPPRegister endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPUnregister
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Unregister the client.
CALLED BY: PPPStrategy
PASS: bx = client handle
RETURN: carry clear if unregisterd
bx = domain handle
DESTROYED: bx if unregister refused
di (allowed)
PSEUDO CODE/STRATEGY:
get in line before doing anything
Refuse unregistration if link state is not closed.
Else
reset client info
free mutex
destroy thread
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/16/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPUnregister proc far
uses ax, si, ds
.enter
EC < cmp bx, offset clientInfo >
EC < ERROR_NE PPP_INVALID_CLIENT_HANDLE >
;
; Get in line.
;
mov_tr si, bx
mov bx, handle dgroup
call MemDerefDS ; ds:si = client info
mov bx, ds:[regSem]
call ThreadPSem
;
; Is client even registered?
;
test ds:[si].PCI_status, mask CS_REGISTERED
je error
cmp ds:[si].PCI_linkState, PLS_CLOSED
EC < WARNING_NE PPP_CLIENT_UNREGISTERING_BEFORE_LINK_CLOSED >
jne error
;
; Reset client information. Free the mutex, stop the timer
; and destroy the thread.
;
BitClr ds:[si].PCI_status, CS_REGISTERED
clr bx
movdw ds:[si].PCI_clientEntry, bxbx
mov ds:[si].PCI_linkState, bl
mov ds:[si].PCI_timer, bx
mov ds:[si].PCI_error, bx
xchg bx, ds:[si].PCI_mutex
call ThreadFreeSem
call PPPDestroyThread
;
; Return domain handle.
;
clr di ; clears carry
xchg di, ds:[si].PCI_domain ; carry still clear
jmp exit
error:
stc
exit:
mov bx, ds:[regSem]
call ThreadVSem ; preserves flags
mov bx, di ; return domain handle
.leave
ret
PPPUnregister endp
InitCode ends
ConnectCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPAllocConnection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Assign a connection handle to client for use with
DR_SOCKET_LINK_CONNECT_REQUEST.
CALLED BY: PPPStrategy
PASS: bx = client handle
RETURN: carry set if error
ax = SocketDrError (SDE_MEDIUM_BUSY)
else carry clear
ax = connection handle
DESTROYED: di (allowed)
PSEUDO CODE/STRATEGY:
grab taskSem
if status shows a blocked client, a passive
connect is occurring, so return SDE_MEDIUM_BUSY
if closed, set state to OPEN
release taskSem
return connection handle
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 7/18/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPAllocConnection proc far
uses bx, es
.enter
EC < cmp bx, offset clientInfo >
EC < ERROR_NE PPP_INVALID_CLIENT_HANDLE >
;
; Get in line.
;
mov bx, handle dgroup
call MemDerefES
mov bx, es:[taskSem]
call ThreadPSem ; destroys AX
;
; if the internet dialup not registered,
; we need to launch internet dialup application and block here
; until the IDialup tells us to go
; we want to check the domain name, but it's ignored...
;
movdw es:[bytesSent], 0
movdw es:[bytesReceived], 0
tst es:[idRegistered]
jnz cont
call PPPLaunchIDial
cont:
;
; May be blocked if a passive connection is being opened.
;
mov di, SDE_MEDIUM_BUSY
test es:[clientInfo].PCI_status, mask CS_BLOCKED
stc
jnz done
;
; If CLOSED, set state to OPENING and clear error.
; Otherwise, connection is already open or will about to
; be so just return connection handle.
;
cmp es:[clientInfo].PCI_linkState, PLS_CLOSED
jne retHandle
mov es:[clientInfo].PCI_linkState, PLS_OPENING
mov es:[clientInfo].PCI_error, SDE_NO_ERROR
EC < test es:[clientInfo].PCI_status, mask CS_REGISTERED >
EC < ERROR_Z PPP_INTERNAL_ERROR >
EC < tst es:[clientInfo].PCI_accpnt >
EC < ERROR_NZ PPP_INTERNAL_ERROR >
EC < tst es:[clientInfo].PCI_timer >
EC < ERROR_NZ PPP_INTERNAL_ERROR >
;
; send notification
;
push bp
mov bp, PPP_STATUS_OPENING
call PPPSendNotice
pop bp
retHandle:
mov di, PPP_CONNECTION_HANDLE
clc
done:
;
; Release access and return result.
;
call ThreadVSem ; preserves flags
mov_tr ax, di ; ax = SDE or handle
.leave
ret
PPPAllocConnection endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPLinkConnectRequest
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Open up the PPP link.
CALLED BY: PPPStrategy
PASS: cx = timeout value (in ticks)
bx = connection handle
ds:si = non-null terminated string for addr to connect to
ax = addr string size
RETURN: carry set if connect failed immediately
ax = SocketDrError with SpecSocketDrError
(SDE_LINK_OPEN_FAILED,
SDE_CONNECTION_TIMEOUT,
SDE_CONNECTION_RESET,
SDE_CONNECTION_RESET_BY_PEER,
SDE_CONNECTION_EXISTS,
SDE_INSUFFICIENT_MEMORY
possibly with
SSDE_INVALID_ACCPNT
SSDE_CANCEL
SSDE_NO_USERNAME
SSDE_DEVICE_ERROR
SSDE_DEVICE_NOT_FOUND
SSDE_DEVICE_BUSY
SSDE_CALL_FAILED
SSDE_DEVICE_TIMEOUT
SSDE_DIAL_ERROR
SSDE_LINE_BUSY
SSDE_NO_DIALTONE
SSDE_NO_ANSWER
SSDE_NO_CARRIER
SSDE_BLACKLISTED
SSDE_DELAYED
SSDE_AUTH_FAILED
SSDE_AUTH_REFUSED
SSDE_NEG_FAILED
SSDE_LQM_FAILURE)
otherwise, carry clear
DESTROYED: di (allowed)
PSEUDO CODE/STRATEGY:
grab taskSem
if blocked, {
release taskSem
return busy (passive opening in progress)
}
if PLS_OPENING {
convert timeout to intervals and store
queue MSG_PPP_OPEN_LINK
}
release taskSem
return connection handle
Client handle is offset to client info.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/16/95 Initial version
jwu 7/18/96 Non-blocking version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPLinkConnectRequest proc far
uses bx, cx, dx, bp, si, es, ds
.enter
EC < cmp bx, PPP_CONNECTION_HANDLE >
EC < ERROR_NE PPP_INVALID_CONNECTION_HANDLE >
EC < push bx >
EC < mov bx, ds >
EC < call ECAssertValidFarPointerXIP >
EC < pop bx >
;
; Get in line.
;
mov_tr dx, ax ; dx = addr string size
mov bx, handle dgroup
call MemDerefES
mov bx, es:[taskSem]
call ThreadPSem ; destroys AX
;
; if the internet dialup not registered,
; we need to launch internet dialup application and block here
; until the IDialup tells us to go
; we want to check the domain name, but it's ignored...
;
movdw es:[bytesSent], 0
movdw es:[bytesReceived], 0
tst es:[idRegistered]
jnz cont
call PPPLaunchIDial
cont:
;
; May be blocked if a passive connection is being opened.
;
mov ax, (SSDE_DEVICE_BUSY or SDE_LINK_OPEN_FAILED)
test es:[clientInfo].PCI_status, mask CS_BLOCKED
jnz errorDone
;
; If link is already opened, return SDE_ALREADY_EXISTS
; so client won't keep waiting for a notification.
;
mov ax, SDE_CONNECTION_EXISTS
cmp es:[clientInfo].PCI_linkState, PLS_OPEN
je errorDone
;
; If beyond OPENING state, return success. Link is in process
; of opening so notification will be sent. If state is less
; than opening, connection is in process of closing so return
; connection exists.
;
CheckHack < PLS_CLOSING lt PLS_OPENING >
CheckHack < PLS_OPENING lt PLS_LOGIN >
CheckHack < PLS_LOGIN lt PLS_NEGOTIATING>
CheckHack < PLS_NEGOTIATING lt PLS_OPEN >
cmp es:[clientInfo].PCI_linkState, PLS_OPENING
ja done ; carry clear from cmp
jb errorDone ; ax = SDE_CONN_EXISTS
;
; Store timeout, converting from ticks to intervals and
; rounding up. Then queue a msg for the driver's thread
; to open the link.
;
push dx ; addr size
mov_tr ax, cx
clr dx ; dx:ax = timeout
mov cx, PPP_TIMEOUT_INTERVAL
div cx ; ax = quotient
; dx = remainder
tst dx
jz storeTime
inc ax
storeTime:
mov es:[clientInfo].PCI_timer, ax
pop cx ; cx = addr size
;
; Copy address to stack in case caller has it on their stack
; and intends to free it as soon as this routine returns.
;
mov bx, es:[pppThread]
mov di, mask MF_FORCE_QUEUE
jcxz sendMsg ; no address to copy
push es
mov dx, cx ; dx = addr size
sub sp, cx
segmov es, ss, di
mov di, sp
rep movsb
mov bp, sp ; ss:bp = address
mov cx, dx ; cx = addr size
mov di, mask MF_FORCE_QUEUE or mask MF_STACK
sendMsg:
mov ax, MSG_PPP_OPEN_LINK
call ObjMessage
jcxz wellDone
add sp, cx
pop es ; es = dgroup
wellDone:
clc
jmp done
errorDone:
stc
done:
;
; Release access and return result.
;
xchg cx, ax ; cx = result
mov bx, es:[taskSem]
call ThreadVSem ; preserves flags
xchg ax, cx ; ax = error, if any
.leave
ret
PPPLinkConnectRequest endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPStopLinkConnect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Interrupt a DR_SOCKET_LINK_CONNECT_REQUEST.
CALLED BY: PPPStrategy
PASS: bx = connection handle
RETURN: carry clear
DESTROYED: di (allowed)
PSEUDO CODE/STRATEGY:
grab taskSem
if state is CLOSED or CLOSING, do nothing
set state to PLS_CLOSING
store SDE_INTERRUPTED as error
if state is OPENING, do nothing
(Other code will check for cancellation and
stop the physical connection process)
else if state is LOGIN,
Notify Term to stop login process
else if state is NEGOTIATING or OPENED
queue driver MSG_PPP_CLOSE_LINK
release taskSem
NOTES:
Difference between this and PPPDisconnectRequest is that
the latter blocks until link is already closed. Also,
PPPDisconnectRequest expects the link to be either opened
or closed, but will not interrupt a partially opened link.
CANNOT queue driver MSG_PPP_MANUAL_LOGIN_COMPLETE here.
Must wait for Term to respond via the callback before
continuing because Term may still be working with the
serial port.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 7/18/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPStopLinkConnect proc far
uses ax, bx, es
.enter
EC < cmp bx, PPP_CONNECTION_HANDLE >
EC < ERROR_NE PPP_INVALID_CONNECTION_HANDLE >
;
; Gain access.
;
mov bx, handle dgroup
call MemDerefES
mov bx, es:[taskSem]
call ThreadPSem ; destroys AX
;
; If link is not opening or open, do nothing.
;
CheckHack < (PLS_CLOSED+1) eq PLS_CLOSING >
mov al, es:[clientInfo].PCI_linkState
cmp al, PLS_CLOSING
jbe done
;
; Set state and error BEFORE queuing messages for driver.
;
mov es:[clientInfo].PCI_linkState, PLS_CLOSING
mov es:[clientInfo].PCI_error, SDE_INTERRUPTED
;
; send notification
;
push bp
mov bp, PPP_STATUS_CLOSING
call PPPSendNotice
pop bp
;
; If manual login in progress, notify Term to stop it.
; Else, close link if beyond login process.
;
CheckHack <PLS_LOGIN_INIT lt PLS_OPENING>
CheckHack <PLS_OPENING lt PLS_LOGIN>
CheckHack <PLS_LOGIN lt PLS_NEGOTIATING>
CheckHack <PLS_NEGOTIATING lt PLS_OPEN>
cmp al, PLS_LOGIN_INIT
jb done
cmp al, PLS_LOGIN
ja closeLink
test es:[clientInfo].PCI_status, mask CS_MANUAL_LOGIN
jz done
call PPPStopManualLogin
jmp done
closeLink:
mov ax, MSG_PPP_CLOSE_LINK
mov bx, es:[pppThread]
mov di, mask MF_FORCE_QUEUE
call ObjMessage
done:
;
; Release access and return success.
;
mov bx, es:[taskSem]
call ThreadVSem
clc
.leave
ret
PPPStopLinkConnect endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPDisconnectRequest
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Close the PPP link.
CALLED BY: PPPStrategy
PASS: bx = connection handle
ax = SocketCloseType (ignored)
RETURN: carry set if not connected
ax = SDE_NO_ERROR
DESTROYED: di (allowed)
PSEUDO CODE/STRATEGY:
if link is already closed, return carry set
else
set CS_BLOCKED in client status
queue message for driver thread to close link
block on mutex
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/16/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPDisconnectRequest proc far
uses bx, es
.enter
EC < cmp bx, PPP_CONNECTION_HANDLE >
EC < ERROR_NE PPP_INVALID_CONNECTION_HANDLE >
;
; Get in line.
;
mov bx, handle dgroup
call MemDerefES
mov bx, es:[taskSem]
call ThreadPSem ; destroys AX
EC < test es:[clientInfo].PCI_status, mask CS_BLOCKED >
EC < ERROR_NE PPP_TOO_MANY_TASKS >
;
; If link closed, return carry. Take advantage of PLS_CLOSED
; being less than PLS_OPEN in doing the cmp to set carry.
; Don't forget to release task sem before returning.
;
CheckHack <PLS_CLOSED lt PLS_OPEN>
cmp es:[clientInfo].PCI_linkState, PLS_OPEN
je closeIt
EC < pushf >
EC < cmp es:[clientInfo].PCI_linkState, PLS_CLOSED >
EC < ERROR_NE PPP_INTERNAL_ERROR ; use stop to interrupt >
EC < popf >
call ThreadVSem ; preserves flags
jmp exit ; carry set by cmp
closeIt:
;
; Remember that we are blocked.
;
BitSet es:[clientInfo].PCI_status, CS_BLOCKED
mov es:[clientInfo].PCI_linkState, PLS_CLOSING
call ThreadVSem ; release task sem
;
; send notification
;
push bp
mov bp, PPP_STATUS_CLOSING
call PPPSendNotice
pop bp
;
; Have driver's thread do the close and wait for task to
; complete.
;
mov bx, es:[pppThread]
mov ax, MSG_PPP_CLOSE_LINK
mov di, mask MF_FORCE_QUEUE
call ObjMessage
mov bx, es:[clientInfo].PCI_mutex
call ThreadPSem
clc
exit:
mov ax, SDE_NO_ERROR
.leave
ret
PPPDisconnectRequest endp
ConnectCode ends
PPPCODE segment public 'CODE'
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPSendDatagram
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send a packet enclosed in a PPP frame.
CALLED BY: PPPStrategy
PASS: dx:bp = optr of buffer
cx = size of data in buffer
bx = client handle
ax = size of address (ignored)
ds:si = non-null term. string for address (ignored)
RETURN: carry clear
DESTROYED: ax, di (allowed)
PSEUDO CODE/STRATEGY:
Pass buffer to driver thread to do the send.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/16/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPSendDatagram proc far
uses bx, es
.enter
EC < Assert optr, dxbp >
EC < cmp bx, offset clientInfo >
EC < ERROR_NE PPP_INVALID_CLIENT_HANDLE >
mov bx, handle dgroup
call MemDerefES
mov bx, es:[pppThread]
mov ax, MSG_PPP_SEND_FRAME
mov di, mask MF_FORCE_QUEUE
call ObjMessage
;
; increase the count - bytesSent
;
push bx
movdw axbx, es:[bytesSent]
add bx, cx
jnc done
inc ax
done:
movdw es:[bytesSent], axbx
pop bx
clc
.leave
ret
PPPSendDatagram endp
PPPCODE ends
ConnectCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPResetRequest
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Reset the PPP link.
CALLED BY: PPPStrategy
PASS: ax = connection handle
RETURN: nothing
DESTROYED: di (allowed)
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/16/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPResetRequest proc far
uses ax, bx
.enter
mov_tr bx, ax ; bx = connection handle
call PPPDisconnectRequest
.leave
ret
PPPResetRequest endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPGetInfo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get info from the driver.
CALLED BY: PPPStrategy
PASS: ax = SocketGetInfoType
if SGIT_LOCAL_ADDR
ds:bx = buffer for address
dx = size of buffer
RETURN: carry clear if info is available and
SGIT_MTU
ax = maximum packet size
SGIT_LOCAL_ADDR
ds:bx = buffer filled with address if big enough
ax = address size
SGIT_MEDIUM_AND_UNIT
cxdx = MediumType
bp = GeoworksMediumID
bl = MediumUnitType
SGIT_ADDR_CTRL
cx:dx = pointer to class
else, carry set
DESTROYED: ax if not used for return value
di (preserved by PPPStrategy)
PSEUDO CODE/ STRATEGY:
use jump table and SocketGetInfoType to jump to
a label in routine for processing.
Be careful not to destroy any registers which aren't used
as return values for that info type.
Return carry set if info is not available
NOTE:
MUST NOT grab taskSem because PPPLINKOPENED holds the
taskSem during notifications. TCP will call this routine
with the PPP thread to get info about the link.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/17/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPGetInfo proc far
uses di, es
.enter
EC < Assert etype ax, SocketGetInfoType >
push bx
mov bx, handle dgroup
call MemDerefES
pop bx
cmp ax, size infoTable
LONG jae noInfo
mov_tr di, ax
jmp cs:infoTable[di]
medAndUnit:
;
; Medium and unit. Query for info.
; XXX: Assumes MUT_INT if not GMID_CELL_MODEM!
;
if _PENELOPE
;
; PPPP connects to PAD and PAD does not have a named medium.
; We assign PAD's medium to be as follows.
;
mov cx, MANUFACTURER_ID_GEOWORKS
mov dx, GMID_CELL_MODEM ; cxdx = MediumType
clr bp ; bp = nothing
mov bl, MUT_NONE
jmp done
else
clr cx
mov bx, es:[port]
mov di, DR_SERIAL_GET_MEDIUM
call es:[serialStrategy] ; dxax = MediumType
EC < cmp dx, ManufacturerID >
EC < WARNING_A SERIAL_DRIVER_RETURNED_INVALID_MANUFACTURER_ID>
movdw cxdx, dxax
mov bp, bx ; bp = port
mov bl, MUT_INT
cmp dx, GMID_CELL_MODEM
LONG jne done
mov bl, MUT_NONE
jmp done
endif
addrCtrl:
;
; Address control. Return class for controller. Increment
; ref count of driver.
;
push bx
mov bx, handle 0
call GeodeAddReference
pop bx
mov cx, vseg PPPAddressControlClass
mov dx, offset PPPAddressControlClass
jmp done
address:
;
; Local address. Return local IP address used for link
; if negotiated. If none negotiated yet, then the info
; is not avaiable at this moment. Make sure buffer is
; big enough.
;
EC < Assert buffer dsbx, dx >
mov ax, IP_ADDR_SIZE
cmp ax, dx
ja exit ; carry already clear
push bx, cx, si, ds ; destroyed by C
segmov ds, es, ax ; ds = dgroup for C
call GetLocalIPAddr ; dxax = IP addr
pop bx, cx, si, ds
tstdw dxax
je noInfo ; none yet
;
; Convert address to network form before copying to buffer.
;
xchg dh, dl
xchg ah, al
movdw ds:[bx], axdx
mov ax, IP_ADDR_SIZE
jmp done
mtu:
;
; Ask LCP to return the negotiated MTU (aka MRU).
;
push bx, cx, dx, si, ds ; destroyed by C
segmov ds, es, ax ; ds = dgroup for C
call GetInterfaceMTU ; ax = mtu
pop bx, cx, dx, si, ds
done:
clc
jmp exit
noInfo:
stc
exit:
.leave
ret
infoTable nptr \
offset noInfo, ; SGIT_MEDIA_LIST
offset medAndUnit, ; SGIT_MEDIUM_AND_UNIT
offset addrCtrl, ; SGIT_ADDR_CTRL
offset noInfo, ; SGIT_ADDR_SIZE
offset address, ; SGIT_LOCAL_ADDRESS
offset noInfo, ; SGIT_REMOTE_ADDRESS
offset mtu, ; SGIT_MTU
offset noInfo, ; SGIT_PREF_CTRL
offset noInfo ; SGIT_MEDIUM_CONNECTION
PPPGetInfo endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPResolveAddr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Resolve a link level address for PPP.
CALLED BY: PPPStrategy
PASS: ds:si = addr to resolve
cx = size of addr (including word for linkSize)
dx:bp = buffer for resolved address
ax = buffer size
RETURN: carry clear
dx:bp = buffer filled with address if buffer is big enough
cx = size of resolved address
DESTROYED: di (allowed)
PSEUDO CODE/STRATEGY:
If buffer is big enough, copy the link address to the
buffer. PPP doesn't need the address resolved.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/17/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPResolveAddr proc far
EC < Assert buffer dxbp, ax >
EC < push bx, si >
EC < mov bx, ds >
EC < call ECAssertValidFarPointerXIP >
EC < movdw bxsi, dxbp >
EC < call ECAssertValidFarPointerXIP >
EC < pop bx, si >
;
; If buffer is big enough, copy link address to buffer.
;
cmp ax, cx
jb exit
push cx, si, es
movdw esdi, dxbp
rep movsb
pop cx, si, es
exit:
clc
ret
PPPResolveAddr endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPMediumActivated
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Called by lurker after it loads PPP driver or by application
detecting an incoming call.
CALLED BY: PPPStrategy
PASS: dx:bx = MediumUnitType
(port is passively opened by lurker if port used)
if RESPONDER:
cl = call ID
RETURN: carry set if error
DESTROYED: di (allowed)
PSEUDO CODE/STRATEGY:
If link isn't closed, return error
If cell modem, store medium type
else if port differs from expected port, return error
If PPP has no client,
allocate mutex
Allocate a thread for PPP driver
pretend we are registered (if we're not already)
Remember client is passive
Set PPP in passive mode
set client timer
have driver's thread open link and block
until open has completed
if successful,
if no client
get the IP client
if failed, free mutex, destroy thread
and clear register bit
else return carry clear
else just tell client link is opened and
return carry clear
if failed
if had no client
free mutex, destroy thread and
clear registered bit
return carry
NOTES:
Must P taskSem first, then regSem to avoid possible
deadlock situations. PPPLINKCLOSED also grabs both
semaphores in this order.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/17/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPMediumActivated proc far
uses ax, bx, cx, dx, si, ds, es
noClient local word
.enter
EC < push bx, si >
EC < movdw bxsi, dxbx >
EC < call ECAssertValidFarPointerXIP >
EC < pop bx, si >
;
; If link isn't closed, return error.
;
clr noClient
mov_tr di, bx ; dx:di = MediumAndUnit
mov bx, handle dgroup
call MemDerefDS ; set DS dgroup for C
mov bx, ds:[taskSem]
call ThreadPSem ; gain access
mov bx, ds:[regSem]
call ThreadPSem
cmp ds:[clientInfo].PCI_linkState, PLS_CLOSED
LONG jne errorVSem
if _RESPONDER
;
; Store call ID.
;
mov ds:[vpCallID], cl
endif
;
; Store medium type and continue if cell modem. Else verify the
; port is the same as the one PPP should be using.
;
mov es, dx ; es:di = MediumAndUnit
movdw dxcx, es:[di].MU_medium
movdw ds:[mediumType], dxcx
cmp cx, GMID_CELL_MODEM
je okayToProceed
mov cx, es:[di].MU_unit
cmp ds:[port], cx
LONG jne errorVSem
okayToProceed:
;
; The mutex and PPP driver thread aren't created until PPP
; has a client so do it now if PPP doesn't have a client already.
;
test ds:[clientInfo].PCI_status, mask CS_REGISTERED
jnz openLink ; have client
call PPPCreateThread
LONG jc errorVSem
clr bx
call ThreadAllocSem
mov ax, handle 0
call HandleModifyOwner
mov ds:[clientInfo].PCI_mutex, bx
mov noClient, bx ; bx is non-zero
openLink:
;
; Set registered bit so we don't have to worry about a client
; trying to register while we're doing this and remember PPP
; is in the passive mode. Might as well set the blocked flag
; now since we're mucking with the status.
;
ornf ds:[clientInfo].PCI_status, mask CS_REGISTERED \
or mask CS_PASSIVE or mask CS_BLOCKED
;
; send notification
;
push bp
mov bp, PPP_STATUS_OPENING
call PPPSendNotice
pop bp
mov ds:[clientInfo].PCI_linkState, PLS_OPENING
mov ds:[clientInfo].PCI_timer, PPP_DEFAULT_OPEN_TIMEOUT
call PPPPassiveMode
mov bx, ds:[regSem]
call ThreadVSem
mov bx, ds:[taskSem]
call ThreadVSem ; release access
;
; Have driver's thread open the link and wait until completed.
;
clr cx ; no address
mov bx, ds:[pppThread]
mov ax, MSG_PPP_OPEN_LINK
mov di, mask MF_FORCE_QUEUE
call ObjMessage
mov bx, ds:[clientInfo].PCI_mutex
call ThreadPSem
;
; Process result of opening the link.
;
mov bx, ds:[taskSem]
call ThreadPSem ; gain access
mov bx, ds:[regSem]
call ThreadPSem
BitClr ds:[clientInfo].PCI_status, CS_PASSIVE
cmp ds:[clientInfo].PCI_linkState, PLS_OPEN
je releaseAccess ; carry clear
;
; If no client, clear registered bit, free mutex, and destroy
; thread.
;
tst noClient
jz errorVSem
BitClr ds:[clientInfo].PCI_status, CS_REGISTERED
clr bx
xchg bx, ds:[clientInfo].PCI_mutex
call ThreadFreeSem
call PPPDestroyThread
errorVSem:
stc
if _RESPONDER
mov ds:[vpCallID], 0
endif
releaseAccess:
mov bx, ds:[regSem]
call ThreadVSem ; preserves flags
mov bx, ds:[taskSem]
call ThreadVSem ; preserves flags
exit::
.leave
ret
PPPMediumActivated endp
if _PENELOPE
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PADCallTerminated
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: PAD has terminated PPP's call. We call PPPCallTerminated.
CALLED BY: PPPHandlePadStreamStatus,
PPPPClientDataProto,
PPPPClientErrorProto
PASS: ds - dgroup
RETURN: Nothing
DESTROYED: Nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kkee 7/ 7/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PADCallTerminated proc near
uses ax, bx, cx
.enter
;
; Log the fact that the call was dropped as the error to return
; to the client.
;
mov bx, ds:[taskSem]
call ThreadPSem ; gain access
mov ds:[clientInfo].PCI_error, SSDE_NO_CARRIER or \
SDE_LINK_OPEN_FAILED
call ThreadVSem ; release access
;
; Reset stream so we don't call streamStrategy as
; stream might be invalid, causing PPP to crash.
;
clr ds:[padUpStream]
clr ds:[padDnStream]
movdw ds:[padStreamStrategy], 0
clr ds:[padStreamDr]
;
; Terminate protocol.
;
clr ax
push ax
call PPPCallTerminated
done:
.leave
ret
PADCallTerminated endp
endif
ConnectCode ends
InitCode segment resource
;---------------------------------------------------------------------------
; Method Handlers for PPPProcessClass
;---------------------------------------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPDetach
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Intercepted to decide if detach is allowed.
CALLED BY: MSG_META_DETACH
PASS: *ds:si = PPPProcessClass object
es = segment of PPPProcessClass
cx = caller's ID
dx:bp = caller's OD
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
If PPP has a client, then do not handle this because
client will unregister us and then we can detach.
Else, call superclass.
NOTE: Caller MUST have P-ed regSem.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/17/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPDetach method dynamic PPPProcessClass,
MSG_META_DETACH
push ds
mov bx, handle dgroup
call MemDerefDS
test ds:[clientInfo].PCI_status, mask CS_REGISTERED
pop ds
jne exit
push cx, dx, si, es ; preserve around C call
call PPPReset
pop cx, dx, si, es
mov ax, MSG_META_DETACH
mov di, offset PPPProcessClass
call ObjCallSuperNoLock
exit:
ret
PPPDetach endm
InitCode ends
COMMONCODE segment public 'CODE'
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPTimeout
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Process interval timer expiring.
CALLED BY: MSG_PPP_TIMEOUT
PASS: nothing
RETURN: nothing
DESTROYED: ax, cx, dx, bp
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/17/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPTimeout method dynamic PPPProcessClass,
MSG_PPP_TIMEOUT
;
; Don't bother processing if the timer has been stopped since
; this event was queued.
;
mov bx, handle dgroup
call MemDerefDS ; setup dgroup for C
tst ds:[timerHandle]
jz exit
;
; Process client timer first. If client timer expires,
; LCP will stop all protocol timers and wake client.
;
tst ds:[clientInfo].PCI_timer
je doProto
dec ds:[clientInfo].PCI_timer
jnz doProto
call lcp_client_timeout
jmp exit
doProto:
;
; Process PPP protocol timers. DS already set to dgroup.
;
call PPPHandleTimeout
exit:
ret
PPPTimeout endm
COMMONCODE ends
ConnectCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPOpenLink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Open up the PPP link.
CALLED BY: PPPLinkConnectRequest and PPPMediumActivated
via MSG_PPP_OPEN_LINK
PASS: cx = addr size
ss:bp = non-null terminated address
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
Check for interrupt throughout to catch a cancel and
stop link connection as soon as possible. Once LCP
has started, checking for interrupts is no longer
necessary.
gain access
Reset PPP protocol variables
Get access point info
if successful,
Open device to specified address
if failed
clear timer, set error, wake up client
else if not passive:
Tell LCP the lower layer is up
Signal LCP with the open event
release access
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/17/95 Initial version
jwu 7/19/96 Check for interrupts and do manual login
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPOpenLink method dynamic PPPProcessClass,
MSG_PPP_OPEN_LINK
;
; Clear former PPP protocol settings. Must do this before access
; point info is set or we will erase the new settings.
;
mov bx, handle dgroup
call MemDerefDS ; setup dgroup for C
push cx
call PPPReset ; destroys all but bp
pop cx
;
; If have address, get info from access point.
;
mov bx, ds:[taskSem]
call ThreadPSem
cmp ds:[clientInfo].PCI_linkState, PLS_CLOSING
jbe interrupted
jcxz openDevice
EC < test ds:[clientInfo].PCI_status, mask CS_PASSIVE>
EC < ERROR_NE PPP_INTERNAL_ERROR ; must be active mode! >
mov dx, ss ; dx:bp = address
call PPPSetAccessInfo ; ax = error
jnc openDevice
;
; send notification
;
push bp
mov bp, PPP_STATUS_ACCPNT
call PPPSendNotice
pop bp
jmp error
openDevice:
;
; If manual login, initialize login app before continuing.
;
test ds:[clientInfo].PCI_status, mask CS_MANUAL_LOGIN
jz noLogin
mov ds:[clientInfo].PCI_linkState, PLS_LOGIN_INIT
call PPPInitManualLogin ; ax = SSDE
jc error
mov bx, ds:[taskSem]
call ThreadVSem ; release access
jmp exit
noLogin:
;
; send notification
; XXX - This use to send PPP_STATUS_DIALING notification
; but it was done WAY too early. It is now sent from
; PPPModemOpen once the initialization of the modem
; has been successful; directly BEFORE dialing.
; --JimG 8/23/99
;
call PPPDeviceOpen ; ax = error
jc error
BitSet ds:[clientInfo].PCI_status, CS_DEVICE_OPENED
;
; Begin PPP negotiation phase, releasing access first.
;
mov ds:[clientInfo].PCI_linkState, PLS_NEGOTIATING
;
; send notification
;
push bp
mov bp, PPP_STATUS_CONNECTING
call PPPSendNotice
pop bp
mov bx, ds:[taskSem]
call ThreadVSem ; release access
call PPPBeginNegotiations
jmp exit
error:
;
; Store error, reset client timer, accpnt, status and state.
;
tst al
jnz storeIt
mov al, SDE_LINK_OPEN_FAILED
storeIt:
mov ds:[clientInfo].PCI_error, ax
interrupted:
mov_tr dx, ax ; dx = SocketDrError
;
; Unlock access point if used.
;
mov ax, ds:[clientInfo].PCI_accpnt
tst ax
jz resetStuff
call PPPCleanupAccessInfo
call AccessPointUnlock
clr ax
mov ds:[clientInfo].PCI_accpnt, ax
resetStuff:
mov ds:[clientInfo].PCI_timer, ax
mov ds:[clientInfo].PCI_linkState, PLS_CLOSED
mov cl, ds:[clientInfo].PCI_status
BitClr ds:[clientInfo].PCI_status, CS_BLOCKED
mov bx, ds:[taskSem]
call ThreadVSem ; release access
;
; send notification
;
push bp
mov bp, PPP_STATUS_CLOSED
call PPPSendNotice
pop bp
;
; Wake client if blocked, else notify client.
;
test cl, mask CS_BLOCKED
jz notify
mov bx, ds:[clientInfo].PCI_mutex
call ThreadVSem ; wake client
jmp exit
notify:
mov di, SCO_CONNECT_FAILED
call PPPNotifyLinkClosed
exit:
ret
PPPOpenLink endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPCloseLink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Close the PPP link in an orderly manner. (No fair just
closing the physical connection. Must terminate link
with consent of peer.)
CALLED BY: MSG_PPP_CLOSE_LINK
PASS: nothing
RETURN: nothing
DESTROYED: ax, cx, dx, bp
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/17/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPCloseLink method dynamic PPPProcessClass,
MSG_PPP_CLOSE_LINK
mov bx, handle dgroup
call MemDerefDS ; setup dgroup for C
clr ax
push ax ; pass unit of 0
call lcp_close
;
; send notification
; XXX - This use to send PPP_STATUS_CLOSED notification
; but it was done WAY too early. It is also sent from
; PPPLINKCLOSED, which is more appropriate, once the
; closing has completed. This makes the UI more
; accurate.
; --JimG 8/23/99
;
ret
PPPCloseLink endm
ConnectCode ends
PPPCODE segment public 'CODE'
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPSendFrame
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send the buffer's data enclosed in a PPP frame.
CALLED BY: MSG_PPP_SEND_FRAME
PASS: dx:bp = optr of buffer
cx = size of data in buffer
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
Set up dgroup in DS for C code
Lock down buffer and store optr of buffer in the header
so C code can simply deal with a fptr.
Pass locked buffer to ppp_ip_output
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/17/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPSendFrame method dynamic PPPProcessClass,
MSG_PPP_SEND_FRAME
mov bx, dx
call HugeLMemLock
mov es, ax
mov di, es:[bp] ; es:di = PppPacketHeader
movdw es:[di].PPH_optr, dxbp
EC < cmp cx, es:[di].PPH_common.PH_dataSize >
EC < ERROR_NE PPP_BAD_DATA_SIZE >
EC < cmp es:[di].PPH_common.PH_dataOffset, PPP_MIN_HDR_SIZE>
EC < ERROR_B PPP_BAD_DATA_OFFSET >
mov bx, handle dgroup
call MemDerefDS ; setup dgroup for C
push ds:[clientInfo].PCI_unit ; pass unit
pushdw esdi ; pass packet
call ppp_ip_output
ret
PPPSendFrame endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPHandleDataNotification
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Data notification handler for incoming data.
CALLED BY: MSG_PPP_HANDLE_DATA_NOTIFICATION
PASS: nothing
RETURN: nothing
DESTROYED: ax, cx, dx, bp
PSEUDO CODE/STRATEGY:
Lock input buffer
Read all of the data or no further notifications will
arrive for remaining data. If too much to fit in buffer,
read again after processing some of the data.
Data is read to the input buffer.
Pass input buffer to PPPProcessInput for processing.
Safe to reset buffer when full because data is processed
each time through the loop.
If read a full buffer size, try to read again just to make
sure we get all the data.
Unlock input buffer
REVISION HISTORY:
Name Date Description
---- ---- -----------
jwu 5/17/95 Initial version
jwu 7/19/96 Manual login version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPHandleDataNotification method dynamic PPPProcessClass,
MSG_PPP_HANDLE_DATA_NOTIFICATION
;
; Make sure device is still open. This message may have been
; in queue before device was closed.
;
mov bx, handle dgroup
call MemDerefES
test es:[clientInfo].PCI_status, mask CS_DEVICE_OPENED
je exit
;
; If in manual login phase, don't touch the input. It belongs
; to Term.
;
mov bx, es:[taskSem]
call ThreadPSem
cmp es:[clientInfo].PCI_linkState, PLS_LOGIN
call ThreadVSem
je exit
mov bx, es:[inputBuffer]
call MemLock
mov ds, ax
clr si ; ds:si = place for data
readLoop:
;
; Read as much as will fit in the buffer.
;
if _PENELOPE
mov bx, es:[padUpStream]
else
mov bx, es:[port]
endif
mov cx, PPP_INPUT_BUFFER_SIZE
mov ax, STREAM_NOBLOCK
mov di, DR_STREAM_READ
if _PENELOPE
tstdw es:[padStreamStrategy]
jnz streamValid
clr cx
jmp done
streamValid:
call es:[padStreamStrategy] ; cx = # bytes read
else
call es:[serialStrategy] ; cx = # bytes read
endif
jcxz done
;
; Process input data. Then try to read more if we read an
; entire buffer, in case there is more data that couldn't fit
; in the earlier read.
;
push cx, si, es, ds ; may be destroyed by C
pushdw dssi ; pass pointer to input
push cx ; pass size of input
segmov ds, es, cx ; ds = dgroup for C
call PPPProcessInput
pop cx, si, es, ds
cmp cx, PPP_INPUT_BUFFER_SIZE
je readLoop
done:
mov bx, es:[inputBuffer]
call MemUnlock
exit:
ret
PPPHandleDataNotification endm
PPPCODE ends
if _PENELOPE
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPHandlePadStreamStatus
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle error generated by PAD (via RLP) to upStream.
CALLED BY: MSG_PPP_HANDLE_PAD_STREAM_STATUS
PASS: *ds:si = PPPProcessClass object
ds:di = PPPProcessClass instance data
ds:bx = PPPProcessClass object (same as *ds:si)
es = segment of PPPProcessClass
ax = message #
RETURN: Nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
Initially CarrierDetect bit (0x0040) is 1.
In PPP-PAD connected mode, if the CarrierDetect
bit toggles from 0 to 1, then disconnect with ATH.
REVISION HISTORY:
Name Date Description
---- ---- -----------
kkee 6/30/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPHandlePadStreamStatus method dynamic PPPProcessClass,
MSG_PPP_HANDLE_PAD_STREAM_STATUS
.enter
mov bx, handle dgroup
call MemDerefDS
mov bx, ds:[padUpStream]
mov ax, STREAM_READ
mov di, DR_STREAM_GET_ERROR
tstdw ds:[padStreamStrategy]
jz exit
call ds:[padStreamStrategy] ; ax = error token
;
; Deal with the error code in ax. If connected to PAD and
; carrier detect bit toggles from 0 to 1, then disconnect.
;
cmp ds:[padResponse], PAD_AT_CONNECT
jne exit
and ds:[padStatus], 0x0040
jnz keepAlive
and ax, 0x0040
jnz shutDown
keepAlive:
mov ds:[padStatus], ax ; for future toggle check
jmp exit
shutDown:
;
; Carrier detect has toggled from 0 to 1 while connected.
;
call PADCallTerminated
exit:
.leave
ret
PPPHandlePadStreamStatus endm
endif ; if _PENELOPE
if _PENELOPE
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPPClientDataProto
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Called by PAD to send data responses to PPP. This message
is sent by PAD and serviced by PPPGetPADResponse.
CALLED BY: MSG_CLIENT_DATA_PROTO
PASS: *ds:si = PPPProcessClass object
ds:di = PPPProcessClass instance data
ds:bx = PPPProcessClass object (same as *ds:si)
es = segment of PPPProcessClass
ax = message #
cx = atTranslationType_e
dx = dataBlock, null-terminated string. NULL if no data.
RETURN: Nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
All state changes between PPP and PAD *must* happen here.
REVISION HISTORY:
Name Date Description
---- ---- -----------
kkee 11/19/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPPClientDataProto method dynamic PPPProcessClass,
MSG_CLIENT_DATA_PROTO
.enter
tst dx
jz nodata
mov bx, dx
call MemFree ; no use for data.
nodata:
mov bx, handle dgroup
call MemDerefDS
;
; Save PAD response code and signal done. padSignalDone is
; used by PPPGetPADGetResponse.
;
mov ds:[padResponse], cx
mov ds:[padSignalDone], -1 ; TRUE
;
; The only good return codes we should be looking for are
; PAD_AT_OK, PAD_AT_CONNECT, and PAD_AT_RING. Anything else
; is error and we should shut down.
;
cmp cx, PAD_AT_RING
jbe exit
mov ds:[padAbnormalDisconnect], -1
;
; Set link state closed and report error to client.
;
call PADCallTerminated
exit:
.leave
ret
PPPPClientDataProto endm
endif ; if _PENELOPE
if _PENELOPE
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPPClientConnectProto
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Called by PAD to send established data-link to PPP. This
message is sent by PAD and serviced by PPPGetPADResponse.
CALLED BY: MSG_CLIENT_CONNECT_PROTO
PASS: *ds:si = PPPProcessClass object
ds:di = PPPProcessClass instance data
ds:bx = PPPProcessClass object (same as *ds:si)
es = segment of PPPProcessClass
ax = message #
cx = GeodeHandle, stream handle from GeodeUseDriver
dx = StreamToken for upStream
bp = StreamToken for dnStream
RETURN: Nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
Save the strategy routines of PAD's stream driver.
Save upStream and dnStream. dnStream has been initialized
by PAD.
Initialize upStream.
REVISION HISTORY:
Name Date Description
---- ---- -----------
kkee 11/19/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPPClientConnectProto method dynamic PPPProcessClass,
MSG_CLIENT_CONNECT_PROTO
.enter
EC < push bx >
EC < mov bx, cx >
EC < call ECCheckGeodeHandle >
EC < pop bx >
mov bx, handle dgroup
call MemDerefES
;
; We must not connect unless we are in PLS_OPENING state.
; In fact, we should not get this message at all if our state
; is not PLS_OPENING.
;
cmp es:[clientInfo].PCI_linkState, PLS_OPENING
EC < ERROR_NE PPP_PAD_CONNECTING_WHILE_NOT_OPENING >
jne exit
mov es:[padStreamDr], cx
mov bx, cx
call GeodeInfoDriver
movdw es:[padStreamStrategy], ds:[si].DIS_strategy, ax
mov es:[padUpStream], dx
mov es:[padDnStream], bp
;
; Setup data notification with upStream.
; dnStream has been initialized by PAD.
;
mov ax, StreamNotifyType <1, SNE_DATA, SNM_MESSAGE>
mov bx, es:[padUpStream]
mov cx, es:[pppThread]
mov bp, MSG_PPP_HANDLE_DATA_NOTIFICATION
mov di, DR_STREAM_SET_NOTIFY
call es:[padStreamStrategy]
;
; Setup error notification with upStream. Upstream errors are
; generated by RLP (Radio Link Protocol).
;
mov ax, StreamNotifyType <1, SNE_ERROR, SNM_MESSAGE>
mov bx, es:[padUpStream]
mov cx, es:[pppThread]
mov bp, MSG_PPP_HANDLE_PAD_STREAM_STATUS
mov di, DR_STREAM_SET_NOTIFY
call es:[padStreamStrategy]
exit:
.leave
ret
PPPPClientConnectProto endm
endif ; if _PENELOPE
if _PENELOPE
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPPClientErrorProto
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Called by PAD to send error codes to PPP. This message is
sent by PAD and serviced by PPPGetPADResponse.
CALLED BY: MSG_CLIENT_ERROR_PROTO
PASS: *ds:si = PPPProcessClass object
ds:di = PPPProcessClass instance data
ds:bx = PPPProcessClass object (same as *ds:si)
es = segment of PPPProcessClass
ax = message #
cx:dx = one of ERR_PAD_... error codes.
RETURN: dgroup::padSignalDone = 0 if no error.
else
dgroup::padSignalDone = -1 if error
dgroup::padResponse = atTranslationType_e
(PAD_AT_OK,
PAD_AT_ERROR)
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
PAD is shutting us down. We must unregister from PAD.
REVISION HISTORY:
Name Date Description
---- ---- -----------
kkee 11/19/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPPClientErrorProto method dynamic PPPProcessClass,
MSG_CLIENT_ERROR_PROTO
.enter
mov bx, handle dgroup
call MemDerefDS
tst dx ; as cx is always 0.
jz exit ; no error
;
; Convert error code in cx:dx to ds:[padResponse].
;
mov ds:[padSignalDone], -1 ; a final state
mov ds:[padResponse], PAD_AT_ERROR
mov ds:[padAbnormalDisconnect], -1
;
; Set link state closed and report error to client.
;
call PADCallTerminated
exit:
.leave
ret
PPPPClientErrorProto endm
endif ; if _PENELOPE
if _PENELOPE
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPPClientModeProto
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Does nothing as this message is never sent to PPP by
PAD as PAD only send it to System Bus Handler (sbh).
CALLED BY: MSG_CLIENT_MODE_PROTO
PASS: *ds:si = PPPProcessClass object
ds:di = PPPProcessClass instance data
ds:bx = PPPProcessClass object (same as *ds:si)
es = segment of PPPProcessClass
ax = message #
cx = sbgMsg, System Bus Handler message.
RETURN: Nothing
DESTROYED: Nothing
SIDE EFFECTS: Nothing
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
kkee 3/ 5/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPPClientModeProto method dynamic PPPProcessClass,
MSG_CLIENT_MODE_PROTO
ret
PPPPClientModeProto endm
endif ; if _PENELOPE
IDialupCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPIDGetBaudRate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY: PPPStrategy
PASS: nothing
RETURN: ax = baud rate
DESTROYED:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
mzhu 11/30/98 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPIDGetBaudRate proc far
uses es, ds, di, bx
.enter
mov bx, handle dgroup
call MemDerefES
mov ax, es:[baudRate]
clr dx
.leave
ret
PPPIDGetBaudRate endp
IDialupCode ends
COMMONCODE segment public 'CODE'
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPIDGetBytesSent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY: PPPStrategy
PASS:
RETURN: dxax = bytes sent
DESTROYED:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
mzhu 11/30/98 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPIDGetBytesSent proc far
uses es, bx, cx, ds
.enter
mov bx, handle dgroup
call MemDerefES
movdw dxax, es:[bytesSent]
.leave
ret
PPPIDGetBytesSent endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPIDGetBytesReceived
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY: PPPStrategy
PASS: nothing
RETURN: dxax = bytes received
DESTROYED:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
mzhu 11/30/98 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPIDGetBytesReceived proc far
uses es, bx, cx, ds
.enter
mov bx, handle dgroup
call MemDerefES
movdw dxax, es:[bytesReceived]
.leave
ret
PPPIDGetBytesReceived endp
COMMONCODE ends
IDialupCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPIDRegister
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY: PPPStrategy
PASS: nothing
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
mzhu 11/30/98 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPIDRegister proc far
uses es, bx
.enter
mov bx, handle dgroup
call MemDerefES
mov es:[idRegistered], -1
.leave
ret
PPPIDRegister endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPIDUnregister
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY: PPPStrategy
PASS: nothing
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
mzhu 11/30/98 initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPIDUnregister proc far
uses es, bx, ax
.enter
mov bx, handle dgroup
call MemDerefES
mov bx, es:[taskSem]
call ThreadPSem ; destroys AX
mov es:[idRegistered], 0
call ThreadVSem
.leave
ret
PPPIDUnregister endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPIDForceDisconnect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Force a disconnect. The most useful reason for this
function's existence is to abort a dial in progress.
CALLED BY: PPPStrategy
PASS: nothing
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
Calling PPPCallTerminated doesn't always cause PPP to
close (particularly if no connection is established).
Seems to work once it is established, though.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 9/08/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPIDForceDisconnect proc far
uses ax,bx,cx,dx,si,di,bp,ds
.enter
mov bx, handle dgroup
call MemDerefDS
cmp ds:[clientInfo].PCI_linkState, PLS_CLOSING
jbe done
cmp ds:[clientInfo].PCI_linkState, PLS_OPENING ;dialing
je slamModem
terminateCall:
clr ax
push ax
call PPPCallTerminated
done:
.leave
ret
slamModem:
; Tell the modem driver to abort the dial. If it could not be
; done because the connection has already been made, then
; revert to having PPP terminate the call.
;
tst ds:[modemStrategy].handle
jz done
mov di, DR_MODEM_ABORT_DIAL
call ds:[modemStrategy]
jc terminateCall
jmp done
PPPIDForceDisconnect endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPLaunchIDial
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Launch internet dialup application.
CALLED BY: PPPOpenDevice
PASS: nothing
RETURN: carry set if error
DESTROYED: ax, cx
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
mzhu 12/04/98 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPLaunchIDial proc far
uses dx, si, es, ss, bx, cx, dx, di, ds
if DBCS_PCGEOS
idTokenString local 5 dup (TCHAR) ; 4 token chars plus null
endif
idToken local GeodeToken
.enter
push bp
; check if it's already launched
; "test xxx, 0" always gives you zero, so it will never jump to done, which
; is not what you want. --- AY
;;; test ds:[idcbfunc], 0
mov bx, handle dgroup
call MemDerefDS
; tstdw ds:[idcbfunc]
; jnz exit
; get the geode token from ini file
segmov es, ss, bx ; es:di = buffer
mov bx, handle Strings
call MemLock
mov ds, ax
mov_tr cx, ax
mov dx, ds:[idialTokenKey] ; cx:dx = key string
assume ds:Strings
mov si, ds:[pppCategory]
assume ds:nothing
if DBCS_PCGEOS
lea di, idTokenString ; es:di = token chars
else
lea di, idToken ; es:di = GeodeToken
endif
push bp
if DBCS_PCGEOS
mov bp, InitFileReadFlags \
<IFCC_INTACT, 0, 0, size idTokenString>
else
mov bp, InitFileReadFlags \
<IFCC_INTACT, 0, 0, size GeodeToken>
endif
call InitFileReadString ; carry set if none
pop bp
if DBCS_PCGEOS
lea di, idToken
mov ax, {TCHAR}idTokenString[0*(size TCHAR)]
mov es:[di].GT_chars[0], al
mov ax, {TCHAR}idTokenString[1*(size TCHAR)]
mov es:[di].GT_chars[1], al
mov ax, {TCHAR}idTokenString[2*(size TCHAR)]
mov es:[di].GT_chars[2], al
mov ax, {TCHAR}idTokenString[3*(size TCHAR)]
mov es:[di].GT_chars[3], al
endif
mov idToken.GT_manufID, MANUFACTURER_ID_GEOWORKS
jc done
; create a default launch block
mov dx, MSG_GEN_PROCESS_OPEN_APPLICATION
call IACPCreateDefaultLaunchBlock ; ^hdx = AppLaunchBlock
mov bx, dx
call MemLock
mov ds, ax
clr si
mov bx, 0
call ThreadAllocSem
mov ds:[si].ALB_extraData, bx ; send the semaphore to IDial
push bx
mov bx, dx
call MemUnlock
; launch the application
mov ax, mask IACPCF_FIRST_ONLY or \
(IACPSM_USER_INTERACTIBLE shl offset IACPCF_SERVER_MODE)
call IACPConnect ; bp = IACPConnection
; ax, bx, cx destroyed
pop bx
jc done ; something wrong
; block here till IDial release the semaphore
call ThreadPSem
call ThreadFreeSem
clr cx
call IACPShutdown
done:
mov bx, handle Strings
call MemUnlock
exit:
pop bp
.leave
ret
PPPLaunchIDial endp
IDialupCode ends
ConnectCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PPPSendNotice
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send a notification
CALLED BY:
PASS: bp - PPPStatus
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS: destroys any segment pointing to block
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
mzhu 12/7/98 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PPPSendNotice proc near
uses ax, bx, cx, dx, di, si, ds
.enter
mov bx, handle dgroup
call MemDerefDS
;;
; add error message to bp
;
or bp, ds:[clientInfo].PCI_error
;
; record an event
;
mov ax, MSG_META_NOTIFY
mov cx, MANUFACTURER_ID_GEOWORKS
mov dx, GWNT_PPP_STATUS_NOTIFICATION
mov di, mask MF_RECORD
clr bx
clr si
call ObjMessage ; di = event handle
;
; dispatch the event
;
mov cx, di
clr dx
mov bx, MANUFACTURER_ID_GEOWORKS
mov ax, GCNSLT_PPP_STATUS_NOTIFICATIONS
mov bp, mask GCNLSF_FORCE_QUEUE or mask GCNLSF_SET_STATUS
call GCNListSend
.leave
ret
PPPSendNotice endp
ConnectCode ends
|
mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/swap32.asm | gb-archive/really-old-stuff | 10 | 166246 | <reponame>gb-archive/really-old-stuff<filename>mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/swap32.asm
; Exchanges current DE HL with the
; ones in the stack
__SWAP32:
pop bc ; Return address
exx
pop hl ; exx'
pop de
exx
push de ; exx
push hl
exx ; exx '
push de
push hl
exx ; exx
pop hl
pop de
push bc
ret
|
src/API/protypo-api-callback_utilities.ads | fintatarta/protypo | 0 | 7689 | <gh_stars>0
with Protypo.Api.Engine_Values.Engine_Value_Vectors;
use Protypo.Api.Engine_Values;
package Protypo.Api.Callback_Utilities is
type Class_Array is array (Positive range <>) of Engine_Value_Class;
function Match_Signature (Parameters : Engine_Value_Vectors.Vector;
Signature : Class_Array)
return Boolean;
function Is_A (Parameters : Engine_Value_Vectors.Vector;
Index : Positive;
Class : Engine_Value_Class)
return Boolean;
function Get (Parameters : Engine_Value_Vectors.Vector;
Index : Positive)
return Engine_Value;
function Get_Parameter (Parameters : Engine_Value_Vectors.Vector;
Index : Positive)
return String
with
Pre => Is_A (Parameters => Parameters,
Index => Index,
Class => Text);
end Protypo.Api.Callback_Utilities;
|
RobSharper.Ros.MessageEssentials/RosType.g4 | jr-robotics/RobSharper.Ros.MessageEssentials | 2 | 1417 | grammar RosType;
/* ------------------------------------------------------------------ */
/* PARSER RULES */
/* ------------------------------------------------------------------ */
type_input
: type EOF
| array_type EOF
;
type
: built_in_type
| ros_type
| ros_package_type
;
built_in_type
: INT8
| UINT8
| INT16
| UINT16
| INT32
| UINT32
| INT64
| UINT64
| BYTE
| CHAR
| FLOAT32
| FLOAT64
| TIME
| DURATION
| STRING
| BOOL
;
ros_type
: IDENTIFIER
;
ros_package_type
: IDENTIFIER SLASH IDENTIFIER
;
array_type
: variable_array_type
| fixed_array_type
;
variable_array_type
: type OPEN_BRACKET CLOSE_BRACKET
;
fixed_array_type
: type OPEN_BRACKET INTEGER_LITERAL CLOSE_BRACKET
;
/* ------------------------------------------------------------------ */
/* LEXER RULES */
/* ------------------------------------------------------------------ */
BOOL: 'bool';
INT8: 'int8';
UINT8: 'uint8';
BYTE: 'byte';
CHAR: 'char';
INT16: 'int16';
UINT16: 'uint16';
INT32: 'int32';
UINT32: 'uint32';
INT64: 'int64';
UINT64: 'uint64';
FLOAT32: 'float32';
FLOAT64: 'float64';
STRING: 'string';
TIME: 'time';
DURATION: 'duration';
SLASH: '/';
OPEN_BRACKET: OpenBracket;
CLOSE_BRACKET: CloseBracket;
INTEGER_LITERAL: [0-9]+;
IDENTIFIER: (Lowercase | Uppercase) (Lowercase | Uppercase | Digit | '_')*;
fragment OpenBracket: '[';
fragment CloseBracket: ']';
fragment Lowercase: [a-z];
fragment Uppercase: [A-Z];
fragment Digit: [0-9]; |
programs/oeis/119/A119690.asm | neoneye/loda | 22 | 79 | ; A119690: n! mod n*(n+1)/2.
; 0,2,0,4,0,6,0,0,0,10,0,12,0,0,0,16,0,18,0,0,0,22,0,0,0,0,0,28,0,30,0,0,0,0,0,36,0,0,0,40,0,42,0,0,0,46,0,0,0,0,0,52,0,0,0,0,0,58,0,60,0,0,0,0,0,66,0,0,0,70,0,72,0,0,0,0,0,78,0,0,0,82,0,0,0,0,0,88,0,0,0,0,0,0
lpb $0
add $0,1
mov $1,$0
seq $0,66247 ; Characteristic function of composite numbers: 1 if n is composite else 0.
mul $0,$1
lpe
mov $0,$1
|
programs/oeis/202/A202964.asm | jmorken/loda | 1 | 176236 | ; A202964: Number of arrays of 4 integers in -n..n with sum zero and adjacent elements differing in absolute value.
; 4,28,108,268,544,972,1576,2392,3456,4792,6436,8424,10780,13540,16740,20404,24568,29268,34528,40384,46872,54016,61852,70416,79732,89836,100764,112540,125200,138780,153304,168808,185328,202888,221524,241272
mov $2,$0
cal $0,153976 ; a(n) = n^3 + (n+2)^3.
mul $0,2
div $0,12
mul $0,4
mov $1,$0
mov $3,$2
mul $3,2
add $1,$3
mov $4,$2
mul $4,$2
mov $3,$4
mul $3,6
add $1,$3
mul $4,$2
mov $3,$4
mul $3,4
add $1,$3
|
Formalization/PredicateLogic/Syntax.agda | Lolirofle/stuff-in-agda | 6 | 11634 | <reponame>Lolirofle/stuff-in-agda
open import Formalization.PredicateLogic.Signature
module Formalization.PredicateLogic.Syntax (𝔏 : Signature) where
open Signature(𝔏)
open import Data.ListSized
import Lvl
open import Functional using (_∘_ ; _∘₂_ ; swap)
open import Numeral.Finite
open import Numeral.Natural
open import Sets.PredicateSet using (PredSet)
open import Type
private variable ℓ : Lvl.Level
private variable args vars : ℕ
data Term (vars : ℕ) : Type{ℓₒ} where
var : 𝕟(vars) → Term(vars) -- Variables
func : Obj(args) → List(Term(vars))(args) → Term(vars) -- Constants/functions
-- Formulas.
-- Inductive definition of the grammatical elements of the language of predicate logic.
data Formula : ℕ → Type{ℓₚ Lvl.⊔ ℓₒ} where
_$_ : Prop(args) → List(Term(vars))(args) → Formula(vars) -- Relations
⊤ : Formula(vars) -- Tautology (Top / True)
⊥ : Formula(vars) -- Contradiction (Bottom / False)
_∧_ : Formula(vars) → Formula(vars) → Formula(vars) -- Conjunction (And)
_∨_ : Formula(vars) → Formula(vars) → Formula(vars) -- Disjunction (Or)
_⟶_ : Formula(vars) → Formula(vars) → Formula(vars) -- Implication
Ɐ : Formula(𝐒(vars)) → Formula(vars)
∃ : Formula(𝐒(vars)) → Formula(vars)
-- A sentence is a formula with no variables occurring.
Sentence = Formula(𝟎)
infix 1011 _$_
infixr 1005 _∧_
infixr 1004 _∨_
infixr 1000 _⟶_
-- Negation
¬_ : Formula(vars) → Formula(vars)
¬_ = _⟶ ⊥
-- Double negation
¬¬_ : Formula(vars) → Formula(vars)
¬¬_ = (¬_) ∘ (¬_)
-- Reverse implication
_⟵_ : Formula(vars) → Formula(vars) → Formula(vars)
_⟵_ = swap(_⟶_)
-- Equivalence
_⟷_ : Formula(vars) → Formula(vars) → Formula(vars)
p ⟷ q = (p ⟵ q) ∧ (p ⟶ q)
-- (Nor)
_⊽_ : Formula(vars) → Formula(vars) → Formula(vars)
_⊽_ = (¬_) ∘₂ (_∨_)
-- (Nand)
_⊼_ : Formula(vars) → Formula(vars) → Formula(vars)
_⊼_ = (¬_) ∘₂ (_∧_)
-- (Exclusive or / Xor)
_⊻_ : Formula(vars) → Formula(vars) → Formula(vars)
_⊻_ = (¬_) ∘₂ (_⟷_)
infix 1010 ¬_ ¬¬_
infixl 1000 _⟵_ _⟷_
Ɐ₊ : Formula(vars) → Sentence
Ɐ₊{𝟎} φ = φ
Ɐ₊{𝐒 v} φ = Ɐ₊{v} (Ɐ φ)
∃₊ : Formula(vars) → Sentence
∃₊{𝟎} φ = φ
∃₊{𝐒 v} φ = ∃₊{v} (∃ φ)
|
Library/Config/Pref/prefTocList.asm | steakknife/pcgeos | 504 | 80426 | <gh_stars>100-1000
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: prefTocList.asm
AUTHOR: <NAME>
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 10/28/92 Initial version.
DESCRIPTION:
$Id: prefTocList.asm,v 1.2 98/04/05 12:58:52 gene Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListBuildArray
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Build the array of files for this TOC list
PASS: *ds:si = PrefTocListClass object
ds:di = PrefTocListClass instance data
es = dgroup
RETURN: nothing
DESTROYED: ax
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 10/28/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListBuildArray method dynamic PrefTocListClass,
MSG_PREF_DYNAMIC_LIST_BUILD_ARRAY
uses cx, dx, bp
.enter
mov ax, MSG_GEN_APPLICATION_MARK_BUSY
call GenCallApplication
call FilePushDir
;
; Set our current path. If we're unable to set it, then just
; read from the toc file without updating.
;
mov ax, ATTR_GEN_PATH_DATA
mov dx, TEMP_GEN_PATH_SAVED_DISK_HANDLE
call GenPathSetCurrentPathFromObjectPath
pushf
DerefPref ds, si, bx
popf
;
; Fetch the flags to pass to TocUpdateCategory. If the carry
; is set, then we were unable to CD to the directory
; containing the files, so pass that information to
; TocUpdateCategory.
;
mov ax, ds:[bx].PTLI_flags
jnc gotFlags
ornf ax, mask TUCF_DIRECTORY_NOT_FOUND
gotFlags:
sub sp, size TocUpdateCategoryParams
mov bp, sp
mov ss:[bp].TUCP_flags, ax
movtok ss:[bp].TUCP_tokenChars, \
ds:[bx].PTLI_tocInfo.TCS_tokenChars, ax
lea di, ds:[bx].PTLI_tocInfo
segmov es, ds
call TocUpdateCategory
add sp, size TocUpdateCategoryParams
;
; Find the category, and cache the array pointers in our
; instance data.
;
call TocFindCategory
EC < ERROR_C CATEGORY_NOT_FOUND >
;
; Fetch the count from the item array
;
call PrefTocListGetItemArray ; di - VM handle of array
call TocGetFileHandle ; bx- VM file handle
call HugeArrayGetCount ; ax - count
;
; Add the number of extra entries.
;
call PrefTocListGetNumExtraEntries
add cx, ax
;
; Save the selection, for those cases where there's a default
; value specified in the .ui file (usually 0 or 1,
; corresponding to an "extra entry")
;
push cx
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
call ObjCallInstanceNoLock
pop cx
pushf ; carry set if none selected
push ax ; ax - selection
mov ax, MSG_GEN_DYNAMIC_LIST_INITIALIZE
call ObjCallInstanceNoLock
pop cx
popf
jc afterSet
mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION
clr dx
call ObjCallInstanceNoLock
afterSet:
call FilePopDir
mov ax, MSG_GEN_APPLICATION_MARK_NOT_BUSY
call GenCallApplication
.leave
ret
PrefTocListBuildArray endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListQueryItemMoniker
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Retrieve the moniker for an entry in the dynamic list
CALLED BY: MSG_GEN_DYNAMIC_LIST_QUERY_ITEM_MONIKER
PASS: *ds:si = PrefDeviceList object
ds:di = PrefDeviceListInstance
bp = entry number whose moniker is requested.
RETURN: nothing
DESTROYED: ax, bx, cx, dx, si, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 5/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListQueryItemMoniker method dynamic PrefTocListClass,
MSG_GEN_DYNAMIC_LIST_QUERY_ITEM_MONIKER
SBCS <locals local NAME_ARRAY_MAX_NAME_SIZE dup (char) >
DBCS <locals local NAME_ARRAY_MAX_NAME_SIZE dup (wchar) >
mov ax, bp ; element #
.enter
push bp
mov cx, ss
lea dx, locals
mov bp, NAME_ARRAY_MAX_NAME_SIZE
call PrefTocListGetItemName
mov bp, ax
mov ax, MSG_GEN_DYNAMIC_LIST_REPLACE_ITEM_TEXT
call ObjCallInstanceNoLock
pop bp
.leave
ret
PrefTocListQueryItemMoniker endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListGetItemPtr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get ds:di pointing to the specified element data.
Caller MUST call HugeArrayUnlock when done
CALLED BY: PrefTocListGetItemName
PASS: ax - device #
*ds:si - PrefTocList
RETURN: IF FOUND:
carry clear
ds:di - TocDeviceStruct
cx - size of data (ie, stringLength (in bytes) + size
TocDeviceStruct (in bytes))
caller MUST call HugeArrayUnlock when done
ELSE:
carry set
di - destroyed
nothing to unlock
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
Caller must unlock the HugeArray element, but only if it was
locked (carry clear)
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/ 9/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListGetItemPtr proc near
uses ax,bx,dx,si
EC < call ECCheckPrefTocListDSSI >
.enter
call PrefTocListGetItemArray ; di - SortedNameArray
call TocGetFileHandle
clr dx
call HugeArrayLock
tst ax
jz notFound
mov di, si
mov cx, dx
done:
.leave
ret
notFound:
stc
jmp done
PrefTocListGetItemPtr endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListGetItemArray
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return the SortedNameArray handle for this list.
CALLED BY: PrefTocListGetItemPtr
PASS: *ds:si - PrefTocList
RETURN: di - VM handle of SortedNameArray
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/ 7/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListGetItemArray proc near
class PrefTocListClass
uses bx
.enter
EC < call ECCheckPrefTocListDSSI >
DerefPref ds, si, di
lea bx, ds:[di].PTLI_tocInfo.TCS_files
test ds:[di].PTLI_flags, mask TUCF_EXTENDED_DEVICE_DRIVERS
jz gotPtr
lea bx, ds:[di].PTLI_tocInfo.TCS_devices
gotPtr:
mov di, ds:[bx]
.leave
ret
PrefTocListGetItemArray endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListGetDriverArray
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return the array of drivers
CALLED BY: PrefTocListGetSelectedDriverName
PASS: *ds:si - PrefTocList
RETURN: ax:di - dbptr to NameArray of TocFileStruct
structures.
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/ 7/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListGetDriverArray proc near
class PrefTocListClass
.enter
EC < call ECCheckPrefTocListDSSI >
DerefPref ds, si, di
movdw axdi, ds:[di].PTLI_tocInfo.TCS_files
.leave
ret
PrefTocListGetDriverArray endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListSaveOptions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: If this is an extended device driver, then save the
"driver = " key
PASS: *ds:si = PrefTocListClass object
ds:di = PrefTocListClass instance data
es = Segment of PrefTocListClass.
ss:bp = GenOptionsParams
RETURN: nothing
DESTROYED: cx,dx
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/ 6/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListSaveOptions method dynamic PrefTocListClass,
MSG_GEN_SAVE_OPTIONS
uses ax
passedBP local word push bp
spuiDOSName local DosDotFileName
tocBuffer local TOC_ELEMENT_BUFFER_SIZE dup (TCHAR)
.enter
;
; use DOS name?
;
mov ax, ATTR_PREF_TOC_LIST_STORE_DOS_NAME
call ObjVarFindData
LONG jc storeDOSName
;
; If this object is not a device list, then no need to do
; anything special.
;
mov di, ds:[si]
add di, ds:[di].PrefTocList_offset
test ds:[di].PTLI_flags, mask TUCF_EXTENDED_DEVICE_DRIVERS
jz done
;
; Write info word, if specified
;
mov ax, ATTR_PREF_TOC_LIST_INFO_KEY
call ObjVarFindData
jnc afterInfo
mov ax, MSG_PREF_TOC_LIST_GET_SELECTED_ITEM_INFO
call ObjCallInstanceNoLock
jc afterInfo
;
; Now, deref the vardata again in case it moved and write out
; the info.
;
push ax
mov ax, ATTR_PREF_TOC_LIST_INFO_KEY
call ObjVarFindData
pop ax
push bp
mov dx, bx
mov cx, ds ;cx:dx <- key
push ds, si
segmov ds, ss
mov bp, ss:passedBP
lea si, ss:[bp].GOP_category ;ds:si <- category
push bp
mov_tr bp, ax
call InitFileWriteInteger
pop bp
pop ds, si
pop bp
afterInfo:
;
; Get the name of the selected driver. If bp=0, then no driver
; is selected.
;
push bp
mov cx, ss
lea dx, ss:tocBuffer ;cx:dx <- buffer
mov bp, TOC_ELEMENT_BUFFER_SIZE
mov ax, MSG_PREF_TOC_LIST_GET_SELECTED_DRIVER_NAME
call ObjCallInstanceNoLock
tst bp ;any name returned?
pop bp
jz afterWrite ;branch if not
push ds, es, si
segmov ds, ss
mov bx, ss:passedBP
lea si, ss:[bx].GOP_category
mov es, cx
mov di, dx ; string to write
mov cx, cs
mov dx, offset driverKey
CheckHack <segment driverKey eq @CurSeg>
call InitFileWriteString
pop ds, es, si
afterWrite:
done:
.leave
mov di, offset PrefTocListClass
GOTO ObjCallSuperNoLock
;
; store the DOS name instead
;
storeDOSName:
;
; get the DOS name
;
mov cx, ss
lea dx, ss:spuiDOSName
mov ax, MSG_PREF_TOC_LIST_GET_DOS_NAME
call ObjCallInstanceNoLock
;
; write it out to the .INI file
;
push bp, es, ds
segmov es, ss
lea di, ss:spuiDOSName ;es:di <- string
mov bp, ss:passedBP ;ss:bp <- params
segmov ds, ss, cx
lea si, ss:[bp].GOP_category ;ds:si <- category
lea dx, ss:[bp].GOP_key ;cx:dx <- key
call InitFileWriteString
pop bp, es, ds
.leave
ret
PrefTocListSaveOptions endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListLoadOptions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Load the DOS name if this has ATTR_PREF_TOC_LIST_STORE_DOS_NAME
PASS: *ds:si = PrefTocListClass object
ds:di = PrefTocListClass instance data
es = Segment of PrefTocListClass.
ss:bp = GenOptionsParams
RETURN: nothing
DESTROYED: cx,dx
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
gene 2/29/00 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListLoadOptions method dynamic PrefTocListClass,
MSG_GEN_LOAD_OPTIONS
passedBP local word
spuiName local FileLongName
spuiDOSName local FileLongName ;just in case
;
; check for normal case
;
push ax
mov ax, ATTR_PREF_TOC_LIST_STORE_DOS_NAME
call ObjVarFindData
pop ax
jnc callSuper
mov_tr ax, bp
.enter
mov ss:passedBP, ax
;
; read the DOS name from the INI file
;
push ds, si, bp
segmov es, ss
lea di, ss:spuiDOSName
mov bp, ss:passedBP
segmov ds, ss, cx
lea si, ss:[bp].GOP_category ;ds:si <- category
lea dx, ss:[bp].GOP_key ;cx:dx <- key
mov bp, InitFileReadFlags <0, 0, 0, (size FileLongName)>
call InitFileReadString
pop ds, si, bp
jc afterSetSelection ;branch if none
;
; go to the correct directory
;
call FilePushDir
mov ax, ATTR_GEN_PATH_DATA
mov dx, TEMP_GEN_PATH_SAVED_DISK_HANDLE
call GenPathSetCurrentPathFromObjectPath
;
; get its longname
;
push ds
segmov ds, ss
lea dx, ss:spuiDOSName
mov ax, FEA_NAME
mov cx, (size FileLongName)
lea di, ss:spuiName
call FileGetPathExtAttributes
pop ds
call FilePopDir
;
; set the list selection
;
push bp
mov cx, ss
lea dx, ss:spuiName
clr bp ;bp <- exact match
mov ax, MSG_PREF_DYNAMIC_LIST_FIND_ITEM
call ObjCallInstanceNoLock ;ax <- item #
pop bp
jc afterSetSelection
mov_tr cx, ax ;cx <- item #
mov ax, MSG_PREF_ITEM_GROUP_SET_ORIGINAL_SELECTION
call ObjCallInstanceNoLock
afterSetSelection:
.leave
ret
callSuper:
mov di, offset PrefTocListClass
GOTO ObjCallSuperNoLock
PrefTocListLoadOptions endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListGetSelectedItemInfo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Return the info field of the selected device
PASS: *ds:si = PrefTocListClass object
ds:di = PrefTocListClass instance data
es = Segment of PrefTocListClass.
RETURN: if found:
carry clear
ax - device info
else
carry set
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/ 9/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListGetSelectedItemInfo method dynamic PrefTocListClass,
MSG_PREF_TOC_LIST_GET_SELECTED_ITEM_INFO
uses cx,dx,bp
.enter
call GetSelection
cmp ax, GIGS_NONE
stc
je done
call PrefTocListCheckExtraEntry
jc extraEntry ; ax <- extra entry info, or
; item #
call PrefTocListGetItemPtr
mov ax, 0 ; don't trash carry
jc done
mov ax, ds:[di].TDS_info
call HugeArrayUnlock
done:
.leave
ret
extraEntry:
mov ax, ds:[di].PTEE_info
clc
jmp done
PrefTocListGetSelectedItemInfo endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetSelection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the selection without trashing the #!%$#&*
registers.
CALLED BY: PrefTocListGetSelectedDeviceInfo,
PrefTocListGetSelectedDriverName
PASS: *ds:si - PrefTocList
RETURN: ax - selection
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/12/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetSelection proc near
uses cx,dx,bp
.enter
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
call ObjCallInstanceNoLock
.leave
ret
GetSelection endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListGetSelectedDriverName
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Fill in the buffer with the name of the driver of the
selected device.
PASS: *ds:si = PrefTocListClass object
ds:di = PrefTocListClass instance data
es = Segment of PrefTocListClass.
cx:dx = buffer to fill in
bp = length of buffer (# chars)
RETURN: bp = length of string copied (0 if none) (# chars)
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/ 9/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListGetSelectedDriverName method dynamic PrefTocListClass,
MSG_PREF_TOC_LIST_GET_SELECTED_DRIVER_NAME
uses ax,cx,dx
.enter
if ERROR_CHECK
test ds:[di].PTLI_flags, mask TUCF_EXTENDED_DEVICE_DRIVERS
ERROR_Z NOT_A_DEVICE_LIST
endif
call GetSelection ; ax <- selection
cmp ax, GIGS_NONE
je notFound
mov es, cx ; buffer segment
call PrefTocListCheckExtraEntry
jc extraEntry
push ds, si ; *ds:si - PrefTocList
call PrefTocListGetItemPtr
jc notFoundAndPop
mov bx, ds:[di].TDS_driver
call HugeArrayUnlock ; unlock it
pop ds, si
call PrefTocListGetDriverArray ; ax:di - driver array
call TocDBLock
mov_tr ax, bx
call ChunkArrayElementToPtr ; ds:di - ptr, cx-size
EC < ERROR_C ELEMENT_NUMBER_OUT_OF_BOUNDS >
add di, offset NAE_data + offset TFS_name
sub cx, offset NAE_data + offset TFS_name
call CopyStringDSDIToESDX
call TocDBUnlock
done:
.leave
ret
notFoundAndPop:
pop ds, si
notFound:
clr bp
jmp done
extraEntry:
mov di, ds:[di].PTEE_driver
mov di, ds:[di]
ChunkSizePtr ds, di, cx
call CopyStringDSDIToESDX
jmp done
PrefTocListGetSelectedDriverName endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CopyStringDSDIToESDX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy the string at DS:DI to CX:DX
CALLED BY: PrefTocListGetItemName,
PrefTocListGetSelectedDriverName
PASS: ds:di - source
es:dx - dest
cx - size of source (# bytes)
bp - length of dest (# chars)
RETURN: bp - # chars copied. 0 if source bigger than dest
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/ 9/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CopyStringDSDIToESDX proc near
uses ax,ds,es,si,di,cx
.enter
mov si, di
DBCS < shl bp, 1 ; # chars -> # bytes >
if ERROR_CHECK
; Copious error-checking
push ds, si
call ECCheckBounds
segmov ds, es
mov si, dx
call ECCheckBounds
lea si, ds:[si][bp][-1]
call ECCheckBounds
pop ds, si
endif
mov di, dx
cmp cx, bp
jg tooBig
mov bp, cx ; string length
shr cx
rep movsw
jnc afterByte
movsb
afterByte:
SBCS < mov {byte} es:[di], 0 ; null terminate>
DBCS < mov {word} es:[di], 0 ; null terminate>
done:
.leave
ret
tooBig:
clr bp
jmp done
CopyStringDSDIToESDX endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListGetItemMoniker
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION:
PASS: *ds:si = PrefTocListClass object
ds:di = PrefTocListClass instance data
es = dgroup
ss:bp = GetItemMonikerParams
RETURN: buffer filled in
bp - length of string (zero if buffer too short) (# chars)
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 9/23/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListGetItemMoniker method dynamic PrefTocListClass,
MSG_PREF_ITEM_GROUP_GET_ITEM_MONIKER
uses cx,dx
.enter
movdw cxdx, ss:[bp].GIMP_buffer
mov ax, ss:[bp].GIMP_identifier
mov bp, ss:[bp].GIMP_bufferSize
call PrefTocListGetItemName
.leave
ret
PrefTocListGetItemMoniker endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListGetItemName
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return the name of an item
CALLED BY: PrefTocListGetItemMoniker
PASS: cx:dx - buffer to fill in
bp - length of buffer (# chars)
ax - device number
*ds:si - PrefTocList
RETURN: bp - length of item name (w/o NULL) (# chars)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/10/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListGetItemName proc near
class PrefTocListClass
uses ax,bx,cx,ds,di,ds,si,es
.enter
EC < call ECCheckPrefTocListDSSI >
mov es, cx ; es:dx - dest
call PrefTocListCheckExtraEntry
jc extraEntry
;
; Get a pointer into the TOC file. We'll either be pointing
; to a TocFileStruct or a TocDeviceStruct, and we need to know
; which, so that we can point to the string portion.
;
DerefPref ds, si, bx
mov bx, ds:[bx].PTLI_flags
call PrefTocListGetItemPtr ; cx - size of info
jc notFound
test bx, mask TUCF_EXTENDED_DEVICE_DRIVERS
jnz device
add di, offset TFS_name
sub cx, offset TFS_name
jmp copyString
device:
add di, offset TDS_name
sub cx, offset TDS_name
copyString:
call CopyStringDSDIToESDX ; characters copied =>
; BP (w/o NULL)
call HugeArrayUnlock
done:
.leave
ret
extraEntry:
mov di, ds:[di].PTEE_item
mov di, ds:[di]
ChunkSizePtr ds, di, cx
call CopyStringDSDIToESDX
jmp done
;
; The item isn't in the array for some reason. Just return a
; null string.
;
notFound:
mov di, dx
DBCS < mov {byte} es:[di], 0 >
SBCS < mov {word} es:[di], 0 >
clr bp
jmp done
PrefTocListGetItemName endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListFindItem
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Return the element # of the passed item
PASS: *ds:si = PrefTocListClass object
ds:di = PrefTocListClass instance data
es = dgroup
cx:dx - string to find
bp - nonzero to ignore case
RETURN: carry clear if found:
ax - item number
carry set if not found:
ax - item number after where device would be
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 10/18/92 Initial version.
gene 3/26/98 Changed to use ObjVarScanData()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ScanExtraEntries proc near
segmov es, cs, ax
mov ax, length tocListExtraFindHandlers
call ObjVarScanData
ret
ScanExtraEntries endp
CheckHack <segment tocListExtraFindHandlers eq segment tocListExtraCheckHandlers>
CheckHack <segment tocListExtraFindHandlers eq segment tocListExtraCountHandlers>
CheckHack <length tocListExtraFindHandlers eq length tocListExtraCheckHandlers>
CheckHack <length tocListExtraFindHandlers eq length tocListExtraCountHandlers>
tocListExtraFindHandlers VarDataHandler \
<ATTR_PREF_TOC_LIST_EXTRA_ENTRY_1, offset ListExtraFindHandler>,
<ATTR_PREF_TOC_LIST_EXTRA_ENTRY_2, offset ListExtraFindHandler>
ListExtraFindHandler proc far
uses es
.enter
;
; See if we've already found the string (there's no way
; to abort the ObjVarScanData() call early)
;
tst bp ;found string?
jz done ;branch if so
;
; See if the passed string matches the extra entry
;
mov es, bp ;es:dx <- string
call CompareStringESDXWithExtraEntry
je foundString
inc cx ;cx <- adjust count
done:
.leave
ret
foundString:
clr bp ;bp <- indicate found
jmp done
ListExtraFindHandler endp
PrefTocListFindItem method dynamic PrefTocListClass,
MSG_PREF_DYNAMIC_LIST_FIND_ITEM
uses dx,bp
.enter
;
; 3/26/98: changed to use ObjVarScanData() so that more than
; two EXTRA_ENTRY devices can be specified.
;
push cx ;save string segment
push bp
mov bp, cx
clr cx ; item number (start by assuming zero)
mov di, offset tocListExtraFindHandlers
call ScanExtraEntries
;
; See if we found the string in vardata
;
tst bp ;found string?
pop bp
pop es ;es <- string segment
jz done ;branch if so
;
; String not found in vardata
;
push cx ; number of extra entries
call PrefTocListGetItemArray ; di - array
mov si, dx
segmov ds, es
clr bx, cx ; assume no flags -- don't copy name
tst bp
jz gotFlags
mov bl, mask SNAFF_IGNORE_CASE
gotFlags:
call TocSortedNameArrayFind ; bx - element in array
pop cx
add cx, ax
done:
mov_tr ax, cx ; ax <- item number
.leave
ret
PrefTocListFindItem endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CompareStringESDXWithExtraEntry
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Compare the string at es:dx with the item in the extra
entry at ds:bx. Sets the Z flag if equal
CALLED BY: PrefTocListFindItem
PASS: es:dx - string
ds:bx - PrefTocExtraEntry to compare against
RETURN: nothing
DESTROYED: bx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 7/ 1/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CompareStringESDXWithExtraEntry proc near
uses si,cx,di
.enter
mov si, ds:[bx].PTEE_item
mov si, ds:[si] ; ds:si - extra entry string
EC < call ECCheckLMemChunk >
mov di, dx ; es:di - one string
clr cx
call LocalCmpStrings
.leave
ret
CompareStringESDXWithExtraEntry endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListCheckExtraEntry
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: See if the passed item # requires that we use the
extra entry fields
CALLED BY: PrefTocListGetSelectedDriverName,
PrefTocListGetSelectedDeviceInfo,
PrefTocListGetItemName
PASS: *ds:si - PrefDeviceList
ax - item #
RETURN: If Extra Entry:
ax - entry number
ds:di - points to extra entry name
carry set
Else
ax - subtracted by # of extra entries
carry clear
di - unchanged
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 7/ 1/92 Initial version.
gene 3/26/98 Changed to use ObjVarScanData()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
tocListExtraCheckHandlers VarDataHandler \
<ATTR_PREF_TOC_LIST_EXTRA_ENTRY_1, offset ListExtraCheckHandler>,
<ATTR_PREF_TOC_LIST_EXTRA_ENTRY_2, offset ListExtraCheckHandler>
ListExtraCheckHandler proc far
jcxz foundEntry ;branch if at entry
afterEntry:
dec cx ;cx <- adjust count
ret
foundEntry:
mov dx, bx ;ds:dx <- ptr to data
jmp afterEntry
ListExtraCheckHandler endp
PrefTocListCheckExtraEntry proc near
uses bx
class PrefTocListClass
.enter
EC < call ECCheckPrefTocListDSSI >
cmp ax, GIGS_NONE
je done
call PrefTocListGetNumExtraEntries
cmp ax, cx
jl useExtraEntry
sub ax, cx ; clears carry
done:
.leave
ret
useExtraEntry:
push es, ax, dx
mov cx, ax ;cx <- item #
mov di, offset tocListExtraCheckHandlers
call ScanExtraEntries
mov di, dx ; ds:di - pointer to PrefTocExtraEntry
pop es, ax, dx
stc
jmp done
PrefTocListCheckExtraEntry endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListGetNumExtraEntries
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine the number of extras from the instance data
CALLED BY: PrefTocListBuildArray, PrefTocListCheckExtraEntry
PASS: *ds:si - sorted list
RETURN: cx - # extra entries
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This is a potentially slow operation -- we could instead cache
this value if we wanted...
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 7/ 1/92 Initial version.
gene 3/26/98 Changed to use ObjVarScanData()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
tocListExtraCountHandlers VarDataHandler \
<ATTR_PREF_TOC_LIST_EXTRA_ENTRY_1, offset ListExtraCountHandler>,
<ATTR_PREF_TOC_LIST_EXTRA_ENTRY_2, offset ListExtraCountHandler>
ListExtraCountHandler proc far
inc cx ;cx <- adjust count
ret
ListExtraCountHandler endp
PrefTocListGetNumExtraEntries proc near
uses ax,di,bx,es
class PrefTocListClass
.enter
EC < call ECCheckPrefTocListDSSI >
clr cx ; item number (start by assuming zero)
mov di, offset tocListExtraCountHandlers
call ScanExtraEntries
.leave
ret
PrefTocListGetNumExtraEntries endp
if ERROR_CHECK
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECCheckPrefTocListDSSI
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: ensure *ds:si - is a pref device list
CALLED BY: PrefTocListClass procedures
PASS: *ds:si - pref device list
RETURN: nothing
DESTROYED: nothing - flags preserved
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/12/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ECCheckPrefTocListDSSI proc near
uses es, di
.enter
pushf
segmov es, <segment PrefTocListClass>, di
mov di, offset PrefTocListClass
call ObjIsObjectInClass
ERROR_NC DS_SI_WRONG_CLASS
popf
.leave
ret
ECCheckPrefTocListDSSI endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListSendStatusMessage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Cope with any associated container object when something new
gets selected
CALLED BY: MSG_GEN_ITEM_GROUP_SEND_STATUS_MSG
PASS: *ds:si = PrefTocList object
cx = non-zero if GIGSF_MODIFIED bit should be set in
status message
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 12/ 7/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListSendStatusMessage method dynamic PrefTocListClass,
MSG_GEN_ITEM_GROUP_SEND_STATUS_MSG
uses cx, ax
.enter
mov ax, ATTR_PREF_TOC_LIST_CONTAINER
call ObjVarFindData
jnc done
movdw cxdx, ({optr}ds:[bx])
call PrefTocListSendSelectionToContainer
done:
.leave
mov di, offset PrefTocListClass
GOTO ObjCallSuperNoLock
PrefTocListSendStatusMessage endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListSendSelectionToContainer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send the name of the vm file/library associated with the
current selection to the passed container object. If there
is no associated vm file/library, the container is set
not-usable
CALLED BY: (INTERNAL) PrefTocListSendSelectionToContainer
PASS: *ds:si = PrefTocList object
^lcx:dx = PrefContainer object
RETURN: nothing
DESTROYED: ax, bx, cx, dx, di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 12/ 7/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListSendSelectionToContainer proc near
class PrefTocListClass
container local optr push cx, dx
driverName local FileLongName
matchAttrs local 2 dup (FileExtAttrDesc)
uses es, si
.enter
mov di, ds:[si]
add di, ds:[di].PrefTocList_offset
;
; Fetch the name of the selected file, based on what type of data
; we're displaying (for a non-driver list, we can just use the item's
; moniker, as that's the file name, while a driver list displays the
; device name, so we need to ask for the driver name instead)
;
mov cx, ss
lea dx, ss:[driverName] ; cx:dx <- buffer
push bp
mov bp, length driverName ; bp <- buffer size
mov ax, MSG_PREF_TOC_LIST_GET_SELECTED_DRIVER_NAME
test ds:[di].PTLI_flags, mask TUCF_EXTENDED_DEVICE_DRIVERS
jnz haveMessage
mov ax, MSG_PREF_ITEM_GROUP_GET_SELECTED_ITEM_TEXT
haveMessage:
call ObjCallInstanceNoLock
tst bp ; buffer big enough?
pop bp
LONG jz noSpecialPrefs ; nope
;
; Strip off any leading "EC " from the driverName, as prefs
; are the same for either one.
;
SBCS < cmp {word}ss:[driverName], 'E' or ('C' shl 8) >
DBCS < cmp {word}ss:[driverName], 'E' >
DBCS < jne findFile >
DBCS < cmp {word}ss:[driverName][2], 'C' >
jne findFile
SBCS < cmp ss:[driverName][2], ' ' >
DBCS < cmp {word}ss:[driverName][4], ' ' >
jne findFile
;
; Shuffle the name down over top of the "EC "
;
push ds, si
SBCS < lea si, ss:[driverName][3] >
DBCS < lea si, ss:[driverName][6] >
segmov ds, ss, cx
mov es, cx
lea di, ss:[driverName]
mov cx, length driverName - 3
LocalCopyNString
pop ds, si
findFile:
if DBCS_PCGEOS
;
; for DBCS, convert to SBCS as FEA_NOTICE is SBCS
; (in-place DBCS-to-SBCS works)
;
push ds, si
segmov ds, ss, cx
mov es, cx
lea si, ss:[driverName]
lea di, ss:[driverName]
mov ax, '.' ; default char
mov bx, CODE_PAGE_US ; should give SBCS
clr cx, dx ; null-term, default FS driver
call LocalGeosToDos
pop ds, si
LONG jc noSpecialPrefs ; couldn't convert
endif
;
; Look for a file whose FEA_NOTICE attribute matches the
; longname of the selected driver.
;
call FilePushDir
mov ax, ATTR_GEN_PATH_DATA
mov dx, TEMP_GEN_PATH_SAVED_DISK_HANDLE
call GenPathSetCurrentPathFromObjectPath
mov ss:[matchAttrs][0*FileExtAttrDesc].FEAD_attr, FEA_NOTICE
mov ss:[matchAttrs][0*FileExtAttrDesc].FEAD_value.segment, ss
lea ax, ss:[driverName]
mov ss:[matchAttrs][0*FileExtAttrDesc].FEAD_value.offset, ax
mov ss:[matchAttrs][0*FileExtAttrDesc].FEAD_size, size driverName
mov ss:[matchAttrs][1*FileExtAttrDesc].FEAD_attr, FEA_END_OF_LIST
push bp
lea ax, ss:[matchAttrs]
sub sp, size FileEnumParams
mov bp, sp
mov ss:[bp].FEP_searchFlags, mask FESF_GEOS_NON_EXECS or \
mask FESF_GEOS_EXECS
mov ss:[bp].FEP_returnAttrs.segment, 0
mov ss:[bp].FEP_returnAttrs.offset, FESRT_NAME
mov ss:[bp].FEP_returnSize, size FileLongName
movdw ss:[bp].FEP_matchAttrs, ssax
mov ss:[bp].FEP_bufSize, 1
mov ss:[bp].FEP_skipCount, 0
call FileEnum
pop bp
call FilePopDir
jc noSpecialPrefs
jcxz noSpecialPrefs
;
; Build the full path of the file in question.
;
push bp
pushdw ss:[container]
call PrefTocListBuildPath
popdw axsi
;
; Tell the container about it.
;
push bx
mov_tr bx, ax
mov ax, MSG_GEN_PATH_SET
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
jc freeFullPath
;
; Since that was successful, set the container usable.
;
mov ax, MSG_GEN_SET_USABLE
mov dl, VUM_NOW
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
clc
freeFullPath:
;
; Free the full-path block.
;
lahf
pop bx
call MemFree
sahf
pop bp
jc noSpecialPrefs ; => path set was bad, so make
; sure container isn't usable.
done:
.leave
ret
noSpecialPrefs:
movdw bxsi, ss:[container]
mov ax, MSG_GEN_SET_NOT_USABLE
mov dl, VUM_NOW
mov di, mask MF_CALL or mask MF_FIXUP_DS
push bp
call ObjMessage
pop bp
jmp done
PrefTocListSendSelectionToContainer endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListBuildPath
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Build the full path of the found file to give to the
container
CALLED BY: (INTERNAL) PrefTocListSendSelectionToContainer
PASS: *ds:si = PrefTocList
^hbx = FileLongName of found file
RETURN: cx:dx = full path
bx = handle of same
bp = disk handle
DESTROYED: ax, es, di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 12/ 6/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListBuildPath proc near
class PrefTocListClass
.enter
;
; Get the list's current path into a block o' memory.
;
push bx ; save block holding filename
clr di
mov es, di ; es <- 0 => allocate block, please
mov ax, ATTR_GEN_PATH_DATA
mov dx, TEMP_GEN_PATH_SAVED_DISK_HANDLE
call GenPathGetObjectPath
push cx ; save disk handle
;
; Enlarge returned block to hold the filename, plus a path separator.
;
mov_tr bx, ax
mov ax, MGIT_SIZE
call MemGetInfo ; ax <- # bytes
SBCS < add ax, size FileLongName + 1 >
DBCS < add ax, size FileLongName + 2 >
mov ch, mask HAF_LOCK
call MemReAlloc
;
; Find the end of the path.
;
mov es, ax
clr ax, di
mov cx, -1
LocalFindChar
LocalPrevChar esdi ; point to the char before
LocalPrevChar esdi ; the null term
LocalLoadChar ax, '\\'
SBCS < scasb ; is it a backslash? >
DBCS < scasw ; is it a backslash? >
je copyName ; yes -- no need of another
LocalPutChar esdi, ax ; no -- replace the null byte
copyName:
;
; Copy the filename onto the end.
;
pop bp ; bp <- disk handle
mov_tr ax, bx ; preserve full path handle
pop bx ; bx <- filename
push ds, si, ax
call MemLock
mov ds, ax
clr si
mov cx, length FileLongName
LocalCopyNString
;
; Free that block.
;
call MemFree
;
; Set up for return.
;
pop ds, si, bx ; bx <- path handle
mov cx, es ; cx:dx <- path
clr dx
.leave
ret
PrefTocListBuildPath endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListGetSelectedItemPath
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Fetch the full path of the selected item.
CALLED BY: MSG_PREF_TOC_LIST_GET_SELECTED_ITEM_PATH
PASS: *ds:si = PrefTocList object
ds:di = PrefTocListInstance
RETURN: cx:dx = full path
ax = locked handle of same
bp = disk handle
DESTROYED: bx, si, di
SIDE EFFECTS: none
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 12/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListGetSelectedItemPath method dynamic PrefTocListClass,
MSG_PREF_TOC_LIST_GET_SELECTED_ITEM_PATH
.enter
;
; Get the current selection into a block on the heap for use by
; PrefTocListBuildPath
;
mov ax, size FileLongName
mov cx, ALLOC_DYNAMIC_NO_ERR_LOCK
call MemAlloc
mov cx, ax
clr dx
mov bp, length FileLongName
mov ax, MSG_PREF_TOC_LIST_GET_SELECTED_DRIVER_NAME
test ds:[di].PTLI_flags, mask TUCF_EXTENDED_DEVICE_DRIVERS
jnz haveMessage
mov ax, MSG_PREF_ITEM_GROUP_GET_SELECTED_ITEM_TEXT
haveMessage:
call ObjCallInstanceNoLock
call MemUnlock
;
; Now use common routine to create our return value.
;
call PrefTocListBuildPath
mov_tr ax, bx ; return handle in ax
.leave
ret
PrefTocListGetSelectedItemPath endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListCheckDeviceAvailable
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Load the driver for the selected device and see if it thinks
the selected device is present.
CALLED BY: MSG_PREF_TOC_LIST_CHECK_DEVICE_AVAILABLE
PASS: *ds:si = PrefTocList object
RETURN: carry set if device available:
if driver is video driver, ax = DisplayType
carry clear if device not available
ax = 0 if device not present
= GeodeLoadError + 1 if couldn't load driver
DESTROYED: cx, dx
SIDE EFFECTS: none
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 4/ 9/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListCheckDeviceAvailable method dynamic PrefTocListClass,
MSG_PREF_TOC_LIST_CHECK_DEVICE_AVAILABLE
DBCS <deviceName local NAME_ARRAY_MAX_NAME_SIZE dup (wchar)>
SBCS <deviceName local NAME_ARRAY_MAX_NAME_SIZE dup (char)>
DBCS <driverName local NAME_ARRAY_MAX_NAME_SIZE dup (wchar)>
SBCS <driverName local NAME_ARRAY_MAX_NAME_SIZE dup (char)>
.enter
;
; Call ourselves to fetch the device and driver names.
;
push bp
mov cx, ss
lea dx, deviceName
mov bp, length deviceName
mov ax, MSG_PREF_ITEM_GROUP_GET_SELECTED_ITEM_TEXT
call ObjCallInstanceNoLock
pop bp
push bp
mov cx, ss
lea dx, driverName
mov bp, length driverName
mov ax, MSG_PREF_TOC_LIST_GET_SELECTED_DRIVER_NAME
call ObjCallInstanceNoLock ; will upchuck
; if list not
; for devices
pop bp
;
; Push to the directory that contains our drivers.
;
call FilePushDir
mov ax, ATTR_GEN_PATH_DATA
mov dx, TEMP_GEN_PATH_SAVED_DISK_HANDLE
call GenPathSetCurrentPathFromObjectPath
;
; Attempt to load the device driver.
;
segmov ds, ss
lea si, ss:[driverName]
clr ax, bx ; XXX: no protocol numbers
call GeodeUseDriver
call FilePopDir
jc cantLoad
;
; Driver loaded ok, so now call its DRE_TEST_DEVICE vector to see
; if the desired device is actually present.
;
push bx ; driver handle
call GeodeInfoDriver ; ds:si <- DriverInfoStruct
;
; if video driver, return the display type...
;
clr cx
cmp ds:[si].DIS_driverType, DRIVER_TYPE_VIDEO
jne testDevice
mov cl, ds:[si].VDI_displayType
testDevice:
mov bx, si ; ds:bx <- DriverInfoStruct
mov dx, ss
lea si, deviceName ; dx:si <- device name
mov di, DRE_TEST_DEVICE
callIt::
call ds:[bx].DIS_strategy
;
; Free up the driver now its dread work is accomplished.
;
pop bx ; driver handle
mov ds, dx
push ax
call GeodeFreeDriver
pop ax
;
; See if the device is actually there.
;
xchg ax, cx ; ax <- DisplayType, cx <- res.
cmp cx, DP_PRESENT
je ok
cmp cx, DP_CANT_TELL
je ok
;
; Signal device's absence, returning carry clear (eventually).
;
clr ax
error:
stc
ok:
cmc ; want carry set if ok and clear if not...
.leave
ret
cantLoad:
;
; Couldn't load the video driver. If it's not because the thing's
; already resident (error code is something other than
; GLE_NOT_MULTI_LAUNCHABLE), return immediately.
;
inc ax ; so it's non-zero
jmp error
PrefTocListCheckDeviceAvailable endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListSetTokenChars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Set the token chars for this TOC list.
PASS: *ds:si - PrefTocListClass object
ds:di - PrefTocListClass instance data
es - dgroup
RETURN: nothing
DESTROYED: ax,cx,dx,bp
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 4/26/93 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListSetTokenChars method dynamic PrefTocListClass,
MSG_PREF_TOC_LIST_SET_TOKEN_CHARS
;
; Store the token chars
;
push ds, si, di
lea di, ds:[di].PTLI_tocInfo.TCS_tokenChars
segmov es, ds
segmov ds, ss
mov si, bp
mov cx, size TokenChars/2
rep movsw
pop ds, si, di
;
; Mark the object dirty (necessary?)
;
call ObjMarkDirty
;
; Rescan stuff
;
mov ax, MSG_PREF_DYNAMIC_LIST_BUILD_ARRAY
GOTO ObjCallInstanceNoLock
PrefTocListSetTokenChars endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTocListGetDosName
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Get the DOS name for the selected driver
PASS: *ds:si - PrefTocListClass object
ds:di - PrefTocListClass instance data
es - dgroup
cx:dx - buffer (at least DosDotFileName in size)
RETURN: cx:dx - filled in (NULL for no selection)
DESTROYED: ax
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
gene 2/29/00 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTocListGetDosName method dynamic PrefTocListClass,
MSG_PREF_TOC_LIST_GET_DOS_NAME
uses ax, cx, dx, es
bufPtr local fptr.TCHAR push cx, dx
longName local FileLongName
.enter
;
; go to the correct directory
;
call FilePushDir
mov ax, ATTR_GEN_PATH_DATA
mov dx, TEMP_GEN_PATH_SAVED_DISK_HANDLE
call GenPathSetCurrentPathFromObjectPath
;
; get the longname from the list
;
push bp
mov cx, ss
lea dx, ss:longName
mov bp, FILE_LONGNAME_LENGTH
mov ax, MSG_PREF_ITEM_GROUP_GET_SELECTED_ITEM_TEXT
call ObjCallInstanceNoLock
pop bp
;
; get the DOS name from the longname
;
segmov ds, ss, cx
lea dx, ss:longName ;ds:dx <- filename
les di, ss:bufPtr ;es:di <- buffer
mov cx, (size DosDotFileName) ;cx <- buffer size
mov ax, FEA_DOS_NAME
call FileGetPathExtAttributes
jnc done ;branch if no error
mov {TCHAR}es:[di], 0 ;store NULL if error
done:
;
; return to the old directory
;
call FilePopDir
.leave
ret
PrefTocListGetDosName endm
|
programs/oeis/145/A145910.asm | neoneye/loda | 22 | 245855 | <reponame>neoneye/loda
; A145910: a(n) = (1 + 3*n)*(4 + 3*n)/2.
; 2,14,35,65,104,152,209,275,350,434,527,629,740,860,989,1127,1274,1430,1595,1769,1952,2144,2345,2555,2774,3002,3239,3485,3740,4004,4277,4559,4850,5150,5459,5777,6104,6440,6785,7139,7502,7874
mul $0,3
add $0,3
bin $0,2
sub $0,1
|
iod/con2/pc16/palsprite.asm | olifink/smsqe | 0 | 172014 | ; QPC 16 bit sprite (mode 32) palette
;
; 2002-12-15 Added additional mode palettes (JG)
;
section driver
;
xdef pt_palsprite
xdef pt_pal16sprite
xdef pt_pal4sprite
xdef pt_pal2sprite
;
pt_palsprite
dc.w $0000,$0420,$0001,$0421,$0900,$0D20,$0901,$0D21
dc.w $0048,$0468,$0049,$0469,$0948,$0D68,$0949,$0D69
dc.w $4002,$4422,$4003,$4423,$4902,$4D22,$4903,$4D23
dc.w $404A,$446A,$404B,$446B,$494A,$4D6A,$494B,$4D6B
dc.w $1200,$1620,$1201,$1621,$1B00,$1F20,$1B01,$1F21
dc.w $1248,$1668,$1249,$1669,$1B48,$1F68,$1B49,$1F69
dc.w $5202,$5622,$5203,$5623,$5B02,$5F22,$5B03,$5F23
dc.w $524A,$566A,$524B,$566B,$5B4A,$5F6A,$5B4B,$5F6B
dc.w $0090,$04B0,$0091,$04B1,$0990,$0DB0,$0991,$0DB1
dc.w $00D8,$04F8,$00D9,$04F9,$09D8,$0DF8,$09D9,$0DF9
dc.w $4092,$44B2,$4093,$44B3,$4992,$4DB2,$4993,$4DB3
dc.w $40DA,$44FA,$40DB,$44FB,$49DA,$4DFA,$49DB,$4DFB
dc.w $1290,$16B0,$1291,$16B1,$1B90,$1FB0,$1B91,$1FB1
dc.w $12D8,$16F8,$12D9,$16F9,$1BD8,$1FF8,$1BD9,$1FF9
dc.w $5292,$56B2,$5293,$56B3,$5B92,$5FB2,$5B93,$5FB3
dc.w $52DA,$56FA,$52DB,$56FB,$5BDA,$5FFA,$5BDB,$5FFB
dc.w $8004,$8424,$8005,$8425,$8904,$8D24,$8905,$8D25
dc.w $804C,$846C,$804D,$846D,$894C,$8D6C,$894D,$8D6D
dc.w $C006,$C426,$C007,$C427,$C906,$CD26,$C907,$CD27
dc.w $C04E,$C46E,$C04F,$C46F,$C94E,$CD6E,$C94F,$CD6F
dc.w $9204,$9624,$9205,$9625,$9B04,$9F24,$9B05,$9F25
dc.w $924C,$966C,$924D,$966D,$9B4C,$9F6C,$9B4D,$9F6D
dc.w $D206,$D626,$D207,$D627,$DB06,$DF26,$DB07,$DF27
dc.w $D24E,$D66E,$D24F,$D66F,$DB4E,$DF6E,$DB4F,$DF6F
dc.w $8094,$84B4,$8095,$84B5,$8994,$8DB4,$8995,$8DB5
dc.w $80DC,$84FC,$80DD,$84FD,$89DC,$8DFC,$89DD,$8DFD
dc.w $C096,$C4B6,$C097,$C4B7,$C996,$CDB6,$C997,$CDB7
dc.w $C0DE,$C4FE,$C0DF,$C4FF,$C9DE,$CDFE,$C9DF,$CDFF
dc.w $9294,$96B4,$9295,$96B5,$9B94,$9FB4,$9B95,$9FB5
dc.w $92DC,$96FC,$92DD,$96FD,$9BDC,$9FFC,$9BDD,$9FFD
dc.w $D296,$D6B6,$D297,$D6B7,$DB96,$DFB6,$DB97,$DFB7
dc.w $D2DE,$D6FE,$D2DF,$D6FF,$DBDE,$DFFE,$DBDF,$DFFF
;
; mapping irgb into native colours
pt_pal16sprite
dc.w $0000,$1000,$0004,$1004,$0080,$1080,$0084,$1084
dc.w $0842,$1F00,$E007,$FF07,$00F8,$1FF8,$E0FF,$FFFF
; mapping gr into native colours
pt_pal4sprite
dc.w $0000,$00F8,$E007,$FFFF
; mapping w into native colours
pt_pal2sprite
dc.w $0000,$FFFF
end
|
src/main/antlr4/org/n1qlite/N1ql.g4 | christoferwhite/n1qlite | 1 | 1453 | // Naming this grammar as 'N1ql'
grammar N1ql;
// Parser Rules
// High level Phrase recognition
dropPrimaryIndex: 'DROP' 'PRIMARY' 'INDEX' 'ON' namedKeyspaceRef indexUsing?;
lookupJoinPredicate: 'ON' 'PRIMARY'? 'KEYS' expr;
namedBucketRef: (poolName ':')? bucketName;
viewIndexStmt: (createViewIndex|dropViewIndex);
rankFunctions: ('RANK'|'DENSE_RANK'|'PERCENT_RANK'|'CUME_DIST');
pathFor: 'FOR' (variable 'IN' path (',' variable 'IN' path)*) ('WHEN' cond) 'END';
nullsTreatment: ('RESPECT'|'IGNORE') 'NULLS';
nthvalFrom: 'FROM' ('FIRST'|'LAST');
rangeXform: ('ARRAY'|'FIRST'|'OBJECT' nameExpr ':') expr 'FOR' ((var ('WITHIN'|('IN' (var ',' expr 'IN'))))|(nameVar ':' var ('IN'|'WITHIN'))) expr ('WHEN' cond)? 'END';
// Clauses
fromClause: 'FROM' fromTerm;
groupByClause: (lettingClause|('GROUP' 'BY' (expr (',' expr)*) lettingClause? havingClause?));
havingClause: 'HAVING' cond;
joinClause: joinType? 'JOIN' fromKeyspace ('AS'? alias)? joinPredicate;
joinPredicate: (lookupJoinPredicate|indexJoinPredicate);
joinType: ('INNER'|('LEFT' 'OUTER'?));
keyClause: 'PRIMARY'? 'KEY' expr; // This ones diagram is bugged i think
keysClause: 'KEYS' expr;
letClause: 'LET' (alias '=' expr (',' alias '=' expr)*);
lettingClause: 'LETTING' (alias '=' expr (',' alias '=' expr)*);
limitClause: 'LIMIT' expr;
nestClause: joinType? 'NEST' fromKeyspace ('AS'? alias)? joinPredicate;
offsetClause: 'OFFSET' expr;
onKeysClause: 'ON' 'PRIMARY'? 'KEYS' expr;
orderByClause: 'ORDER' 'BY' (orderingTerm (',' orderingTerm));
orderingTerm: expr ('ASC'|'DESC')? ('NULLS' ('FIRST'|'LAST'))?;
returningClause: 'RETURNING' ((resultExpr (',' resultExpr)*)|(('RAW'|'ELEMENT'|'VALUE') expr));
selectClause: 'SELECT' ('ALL'|'DISTINCT')? ((resultExpr(',' resultExpr)*)|(('RAW'|'ELEMENT'|'VALUE') expr ('AS'? alias)?));
setClause: 'SET' (path '=' expr updateFor? (',' path '=' expr updateFor?)*);
setOp: ('UNION'|'INTERSECT'|'EXCEPT');
unsetClause: 'UNSET' ( path updateFor? (',' path updateFor?)*);
useClause: (useKeysClause|useIndexClause);
useIndexClause: 'USE' 'INDEX' '(' (indexRef ('.' indexRef)*) ')';
useKeysClause: 'USE' 'PRIMARY'? 'KEYS' expr;
valueClause: ('VALUE'|'VALUES') expr;
valuesClause: 'VALUES' ('(' expr ',' expr ')' ('VALUES'? ',' '(' expr ',' expr ')')*);
whereClause: 'WHERE' cond;
// Expressions
// Expression parsing
mexpr: (expr|rcvexpr|first); // might be left recursion error
lexpr: (mexpr|prepare|cursor);
rcvexpr: '<-' mexpr; // might be left recursion error
// Basic Expressions
expr: literal
|identifier
// |nestedExpr
|caseExpr
|logicalTerm
|comparisonTerm
|arithmeticTerm
|concatenationTerm
|windowFunction
|functionCall
|subqueryExpr
|collectionExpr
|constructionExpr
|'(' expr ')';
// CASE Expreressions
caseExpr: (simpleCaseExpr|searchedCaseExpr);
fullCase: 'CASE'('WHEN' mcond 'THEN' block)* ('ELSE' block)? 'END';
searchedCase: 'CASE' mexpr ('WHEN' mexpr 'THEN' block)* ('ELSE' block)? 'END';
searchedCaseExpr: 'CASE' ('WHEN' cond 'THEN' expr)* ('ELSE' expr)? ;
simpleCaseExpr: 'CASE' expr ('WHEN' expr 'THEN' expr)* ('ELSE' expr)? 'END';
// COLLECTION Expreressions
collectionCond: ('ANY'|'SOME'|'EVERY') (variable ('IN'|'WITHIN') expr) (variable ('IN'|'WITHIN') expr)* ('SATISFIES' cond) 'END';
// collectionExpr: (existsExpr|inExpr|withinExpr|rangeCond|rangeXform);
collectionExpr: (existsExpr|inExpr| /*withinExpr| */ rangeXform);
// MISC Expressions
mapExpr: 'MAP' (variable (',' variable)*) 'IN' (expr (',' expr)*) ('TO' expr)? ('WHEN' cond)? 'END';
nameExpr: expr;
inExpr: expr 'NOT'? 'IN' expr;
arrayExpr: 'ARRAY' expr 'FOR' (variable('IN'|'WITHIN') expr) (',' variable('IN'|'WITHIN'))? ('WHEN' cond)? 'END';
fieldExpr: (identifier|(escapedIdentifier ('|')?)) '.' expr;
firstExpr: 'FIRST' expr 'FOR'
(variable ('IN'|'WITHIN') expr)
(',' variable ('IN'|'WITHIN') expr)?
('WHEN' cond)? 'END';
constructionExpr: (object|array);
// collectionExpr: (existsExpr|inExpr|withinExpr|rangeCond|rangeXform);
existsExpr: 'EXISTS' expr;
elementExpr: expr '[' expr ']';
existentialExpr: 'EXISTS' '(' select ')';
// existsExpr: 'EXISTS' expr;
// nestedExpr: (fieldExpr|elementExpr|sliceExpr);
reduceExpr: 'REDUCE' (variable (',' variable)*) 'IN' (expr (',' expr)*) 'TO' expr ('WHEN' cond)? 'END';
resultExpr: (((path '.')? '*')|(expr('AS'? alias)?));
sliceExpr: expr '[' expr ':' expr? ']';
subqueryExpr: '(' select ')';
// withinExpr: expr 'NOT'? 'WITHIN' expr;
// Functions
keyspaceRef: (namespace ';')? keyspace ('AS'? alias)?;
namedKeyspaceRef: (namespace ':')? keyspace;
namespace: identifier;
keyspace: identifier;
// Higher Level Functions
aggregateFunctions: ('ARRAY_AGG'|'AVG'|'COUNT'|'COUNTIN'|'MAX'|'MEAN'|'MEDIAN'|'MIN'|'SUM'|'STDDEV_SAMP'|'STDDEV_POP'|'VARIENCE'|'VAR_SAMP'|'VAR_POP');
aggregateQualifier: ('ALL'|'DISTINCT');
// Window Functions
// Control Functions
ctrl: (if|case|loop|break|continue|pass|return|deliver); // defer was in here, but there was no parser diagrams
if: mcond 'THEN' block ('ELSEIF' mcond 'THEN' block)* ('ELSE' block)? 'END';
case: (fullCase|searchedCase);
// case: (fullCase|searchedCase);
concatenationTerm: expr '||' expr;
collectionPredicate: ('ANY'|'ALL') cond 'OVER' expr ('AS'? alias)? (('OVER' subpath ('AS' alias)?)+)?;
collectionXform: (arrayExpr|firstExpr);
loop: label? (while|for);
break: 'BREAK' labelName?;
continue: 'CONTINUE' labelName?;
comprehension: '[' expr 'OVER' expr ('AS'? alias)? ('IF' expr)? (('OVER' subpath ('AS' alias)? ('IF' expr)?)+)? ']';
pass: 'PASS';
return: 'RETURN' (lexpr (',' lexpr));
deliver: 'DELIVER' ('WHEN' commop 'THEN' block)* ('ELSE' block)? 'END';
// defer: ; /////////////////////////////////// this is not in the database
ddlStmt: indexStmt;
dmlStmt: (insert|upsert|delete|update|merge);
for: (forIter|forMap);
forIter: 'FOR' var 'IN' (mexpr|cursor) 'DO' block 'END';
forMap: 'FOR' keyVar ',' valVar 'IN' mexpr 'DO' block 'END';
delete: 'DELETE' 'FROM' keyspaceRef useClause? whereClause? limitClause? returningClause?;
execute: 'EXECUTE' mexpr ('USING' mexpr (',' mexpr)*)?;
first: 'FIRST' cursor;
cursor: (query|execute);
dataset: path ('AS'? alias)? (('OVER' subpath ('AS'? alias)?)+)?;
start: 'START' 'TRANSACTION';
while: 'WHILE' mcond 'DO' block 'END';
query: (select|dmlStmt);
subquery: select;
label: labelName ':';
labelName: identifier;
function: functionName '(' ('DISTINCT'? (((path '.')? '*')|(expr (',' expr))))?;
functionName: identifier;
functionCall: functionName '(' ('*'|((expr (',' expr)*)|'DISTINCT'))?;
fullpath: (poolName ':')? path;
commop: (sendop|rcvop);
sendop: var '<-' mexpr;
rcvop: var (',' var)? (':='|'::=') rcvexpr;
rollback: 'ROLLBACK' 'WORK'?;
truncate: 'TRUNCATE' keyspaceRef;
unset: 'UNSET' mexpr '.' subpath;
update: 'UPDATE' keyspaceRef useClause? setClause? unsetClause? whereClause? limitClause? returningClause?;
updateFor: ('FOR' (nameVar ':')? var ('IN'|'WITHIN') path (',' (nameVar ':')? var ('IN'|'WITHIN') path)*)* ('WHEN' cond)? 'END';
upsert: 'UPSERT' 'INTO' keyspaceRef (insertValues|insertSelect) returningClause?;
using: 'USING' ('VIEW'|'GSI');
prepare: 'PREPARE' (query|mexpr) ('USING' (var (',' var)*))?;
partition: 'PARTION' 'BY' expr;
pair: nameExpr ':' expr;
// N1ql parsing commands
assign: (var(',' var)*) ':=' (lexpr(',' lexpr)*);
init: (var (',' var)*) '::=' (lexpr (',' lexpr)*);
decl: 'DECLARE' (var(',' var)*) (':=' (lexpr (',' lexpr)*))?;
// Basic Parses
// PATH
path: identifier ('[' expr ']')* ('.' path)?; // This loop ('[' expr ']')* is questionable because there is no seperators like commas and stuff
subpath: identifier ('[' int ']')? ('.' subpath);
// Logic Syntax
logicalTerm: ((cond ('AND'|'OR'))|'NOT') cond;
// Conditions
cond: expr;
mcond: mexpr;
//Begin
begin: 'BEGIN' block 'END';
// Block
block: terminatedStmt;
terminatedStmt: stmt (';'|newline);
transactionStmt: (start|commit|rollback);
//stmt: (begin|ded|init|assign|unset|sendop|ctrl|lexpr);
stmt: (begin|init|assign|unset|sendop|ctrl|lexpr);
// From
fromKeyspace: (namespace ':')? keyspace;
fromPath: (namespace ':')? path;
fromSelectCore: fromClause letClause? whereClause? groupByClause? selectClause;
fromSelect: fromClause letClause? whereClause? groupByClause? selectClause;
// fromTerm: ((fromKeyspace ('AS'? alias)? useClause?)|('(' select ')' 'AS'? alias)|(expr ('AS' alias)?)|(fromTerm (joinClause|nestClause|unnestClause)));
fromTerm: ((fromKeyspace ('AS'? alias)? useClause?)|('(' select ')' 'AS'? alias)|(expr ('AS' alias)?)|(fromTerm (joinClause|nestClause)));
// Select
select: (selectTerm ('ALL'? setOp selectTerm)*) orderByClause? limitClause? offsetClause?;
subselect: (selectFrom|fromSelect);
selectCore: (selectFromCore|fromSelectCore);
selectFor: select 'FOR' ('UPDATE'|'SHARE') ('OF' (keyspaceRef (',' keyspaceRef)*))?;
selectFromCore: selectClause fromClause? letClause? whereClause? groupByClause?;
selectFrom: selectClause fromClause? letClause? whereClause? groupByClause?; // BAD PARSING, replace all the selectfromcore with selectFrom
selectTerm: (subselect|'(' select ')');
// Insert
insert: 'INSERT' 'INTO' keyspaceRef (insertValues|insertSelect) returningClause?;
insertSelect: '(' 'PRIMARY' 'KEY' expr (',' 'VALUE' expr)? ')' select;
insertValues: ('(' 'PRIMARY'? 'KEY' ',' 'VALUE' ')')? valuesClause;
// Window
windowClause: windowPartitionClause? (windowOrderClause (windowFrameClause (windowFrameExclusion)?)?)?;
// windowFrameClause: ('ROWS'|'RANGE'|'GROUPS') (('UNBOUNDED' 'PRECEDING')|('CURRENT' 'ROW')|(valexpr 'FOLLOWING')|('BETWEEN'(('UNBOUNDED' 'PRECEDING')|('CURRENT' 'ROW')|(valexpr 'FOLLOWING')|('BETWEEN' (('UNBOUNDED' 'PRECEDING')|('CURRENT' 'ROW')|(valexpr ('PRECEDING'|'FOLLOWING'))) 'AND' (('UNBOUNDED' 'FOLLOWING')|('CURRENT' 'ROW')|(valexpr ('PRECEDING'|'FOLLOWING')))))));
windowFrameClause: ('ROWS'|'RANGE'|'GROUPS') (('UNBOUNDED' 'PRECEDING')|('CURRENT' 'ROW')|('BETWEEN'(('UNBOUNDED' 'PRECEDING')|('CURRENT' 'ROW')|('BETWEEN' (('UNBOUNDED' 'PRECEDING')|('CURRENT' 'ROW')) 'AND' (('UNBOUNDED' 'FOLLOWING')|('CURRENT' 'ROW'))))));
windowFrameExclusion: 'EXECUTE' ('CURRENT' 'ROW'|'GROUP'|'TIES'|'NO' 'OTHERS');
windowFunctionArguments:(aggregateQualifier? expr (',' expr (',' expr)?)?)?;
windowFunctionOptions: nthvalFrom? nullsTreatment?;
windowFunctionType: (aggregateFunctions|rankFunctions|'ROW_NUMBER'|'RATIO_TO_REPORT'|'NTILE'|'LAG'|'LEAD'|'FIRST_VALUE'|'LAST_VALUE'|'NTH_VALUE');
windowFunction: windowFunctionType '(' windowFunctionArguments ')' windowFunctionOptions? 'OVER' '(' windowClause ')';
windowOrderClause: 'ORDER' 'BY' (orderingTerm(',' orderingTerm)*);
windowOrderTerm: ('ASC'|'DESC')? ('NULLS' ('FIRST'|'LAST'))?;
windowPartitionClause: 'PARTION' 'BY' (expr (',' expr));
// Bucket
bucketName: identifier;
bucketRef: (poolName ':')? bucketName ('AS'? alias)?;
bucketSpec: (poolName ':')? bucketName;
bucketStmt: alterBucket;
alterBucket: 'ALTER' 'BUCKET' (poolName ':')? bucketName 'RENAME' subpath 'TO' identifier;
// Index
alterIndex: 'ALTER' 'INDEX' namedBucketRef '.' indexName 'RENAME' 'TO' indexName;
buildIndexes: 'BUILD' 'INDEXES' 'ON' namedKeyspaceRef '(' indexName (',' indexName) ')' indexUsing?;
createIndex: 'CREATE' 'INDEX' indexName 'ON' namedKeyspaceRef '(' expr (',' expr)* ')' whereClause? indexUsing? indexWith?;
createPrimaryIndex: 'CREATE' 'PRIMARY' 'INDEX' indexName? 'ON' namedKeyspaceRef indexUsing? indexWith?;
createViewIndex: 'CREATE' 'VIEW' 'INDEX' identifier 'ON' (poolName ':')? bucketName '(' subpath (',' subpath)* ')';
dropIndex: 'DROP' 'INDEX' namedKeyspaceRef '.' indexName indexUsing?;
dropViewIndex: 'DROP' 'VIEW' 'INDEX' (poolName ':')? bucketName '.' identifier;
indexJoinPredicate: 'ON' 'PRIMARY'? 'KEY' expr 'FOR' alias;
// Merge
merge: 'MERGE' 'INTO' keyspaceRef 'USING' mergeSource 'ON' keyClause mergeActions limitClause? returningClause?;
mergeActions: mergeUpdate? mergeDelete? mergeInsert?;
mergeDelete: 'WHEN' 'MATCHED' 'THEN' 'DELETE' whereClause?;
mergeInsert: 'WHEN' 'NOT' 'MATCHED' 'THEN' 'INSERT' expr whereClause?;
mergeUpdate: 'WHEN' 'MATCHED' 'THEN' 'UPDATE' setClause? unsetClause? whereClause?;
mergeSource: ((fromKeyspace ('AS'? alias)? useClause?)|('(' select ')' 'AS'? alias)|(expr ('AS'? alias)?));
indexName: identifier;
// indexRef: indexRef indexUsing?;
indexRef: indexUsing indexRef?;
indexStmt: (createPrimaryIndex|createIndex|dropPrimaryIndex|dropIndex|buildIndexes);
indexUsing: 'USING' ('VIEW'|'GSI');
indexWith: 'WITH' expr;
// POOL
poolName: identifier;
// Comments
commit: 'COMMIT' 'WORK'?;
blockComment: '/*' (text newline)* '*/';
lineComment: '--' (text newline);
// Datatypes
// Comparison Term
comparisonTerm: expr (('IS' 'NOT'? ('NULL'|'MISSING'|'KNOWN'|'VALUED'))|(('='|'=='|'!='|'<>'|'>'|'>='|'<'|'<='|('NOT'? ('BETWEEN' expr 'AND'|'LIKE'))) expr));
// Alias
alias: identifier;
// ID
identifier: (escapedIdentifier|UnescapedIdentifier);
escapedIdentifier: '\'' chars '\'';
UnescapedIdentifier: [a-zA-Z_] ([$_a-zA-Z0-9])*;
// Variables
var: identifier;
variable: identifier;
nameVar: identifier;
valVar: var;
keyVar: var;
// Arrays
array: '[' elements? ']';
elements: (expr|expr ',' elements);
// Objects
object: '{' members? '}';
members: (pair|pair ',' members);
// Literals
literal: (string|number|'TRUE'|'FALSE'|'NULL'|'MISSING');
literalValue: (string|number|object|array|'TRUE'|'FALSE'|'NULL');
// Text
string: '"' chars? '"';
char: (UnicodeCharacter|('\\' ('\\'|'/'|'b'|'f'|'n'|'r'|'t'|('u' HexDigit HexDigit HexDigit HexDigit))));
chars: (char|char chars?);
UnicodeCharacter: [\u0080-\ufffe];
text: chars; ///////////// This is my guess at what it is as 'text' was not in the github database
newline: ('\r\n'|'\n'|'\r');
// Math
arithmeticTerm: ('-'|(expr ('+'|'-'|'*'|'/'|'%'))) expr;
number: int frac? exp?;
int: '-'? uint;
uint: (Digit|(NonZeroDigit digits));
Digit: [0-9];
digits: Digit digits?;
NonZeroDigit: [1-9];
HexDigit: ([0-9]|[a-f]|[A-F]);
frac: '.' digits;
exp: e digits;
e: ('e'|'E') ('-'|'+');
// Whitespace
WS: [ \r\n\t]+ -> skip;
|
prototyping/Luau/RuntimeError.agda | Tr4shh/Roblox-Luau | 0 | 9335 | module Luau.RuntimeError where
open import Agda.Builtin.Equality using (_≡_)
open import Luau.Heap using (Heap; _[_])
open import FFI.Data.Maybe using (just; nothing)
open import FFI.Data.String using (String)
open import Luau.Syntax using (Block; Expr; nil; var; addr; block_is_end; _$_; local_←_; return; done; _∙_; number; binexp)
open import Luau.RuntimeType using (RuntimeType; valueType)
open import Luau.Value using (val)
open import Properties.Equality using (_≢_)
data RuntimeErrorᴮ {a} (H : Heap a) : Block a → Set
data RuntimeErrorᴱ {a} (H : Heap a) : Expr a → Set
data RuntimeErrorᴱ H where
TypeMismatch : ∀ t v → (t ≢ valueType v) → RuntimeErrorᴱ H (val v)
UnboundVariable : ∀ x → RuntimeErrorᴱ H (var x)
SEGV : ∀ a → (H [ a ] ≡ nothing) → RuntimeErrorᴱ H (addr a)
app₁ : ∀ {M N} → RuntimeErrorᴱ H M → RuntimeErrorᴱ H (M $ N)
app₂ : ∀ {M N} → RuntimeErrorᴱ H N → RuntimeErrorᴱ H (M $ N)
block : ∀ b {B} → RuntimeErrorᴮ H B → RuntimeErrorᴱ H (block b is B end)
bin₁ : ∀ {M N op} → RuntimeErrorᴱ H M → RuntimeErrorᴱ H (binexp M op N)
bin₂ : ∀ {M N op} → RuntimeErrorᴱ H N → RuntimeErrorᴱ H (binexp M op N)
data RuntimeErrorᴮ H where
local : ∀ x {M B} → RuntimeErrorᴱ H M → RuntimeErrorᴮ H (local x ← M ∙ B)
return : ∀ {M B} → RuntimeErrorᴱ H M → RuntimeErrorᴮ H (return M ∙ B)
|
test/Succeed/Issue468.agda | shlevy/agda | 1,989 | 2982 | <gh_stars>1000+
module Issue468 where
data Unit : Set where
nothing : Unit
data Maybe (A : Set) : Set where
nothing : Maybe A
just : A → Maybe A
data P : (R : Set) → Maybe R → Set₁ where
p : (R : Set) (x : R) → P R (just x)
works : P Unit (just _)
works = p _ nothing
fails : Unit → P Unit (just _)
fails x = p _ nothing
|
programs/oeis/268/A268460.asm | karttu/loda | 0 | 164788 | ; A268460: Number of length-6 0..n arrays with no adjacent pair x,x+1 followed at any distance by x+1,x.
; 22,456,3146,13204,41526,108032,245626,504876,959414,1712056,2901642,4710596,7373206,11184624,16510586,23797852,33585366,46516136,63349834,84976116,112428662,146899936,189756666,242556044,307062646,385266072,479399306,591957796,725719254,883764176,1069497082,1286668476,1539397526,1832195464,2169989706,2558148692,3002507446,3509393856,4085655674,4738688236,5476462902,6307556216,7241179786,8287210884,9456223766,10759521712,12209169786,13818028316,15599787094,17569000296,19741122122,22132543156,24760627446,27643750304,30801336826,34253901132,38023086326,42131705176,46603781514,51464592356,56740710742,62460049296,68651904506,75347001724,82577540886,90377242952,98781397066,107826908436,117552346934,127997996416,139205904762,151219934636,164085814966,177851193144,192565687946,208280943172,225050682006,242930762096,261979231354,282256384476,303824820182,326749499176,351097802826,376939592564,404347270006,433395837792,464162961146,496729030156,531177222774,567593568536,606067013002,646689482916,689555952086,734764507984,782416419066,832616202812,885471694486,941094116616,999598149194,1061102000596,1125727479222,1193600065856,1264848986746,1339607287404,1418011907126,1500203754232,1586327782026,1676533065476,1770972878614,1869804772656,1973190654842,2081296867996,2194294270806,2312358318824,2435669146186,2564411648052,2698775563766,2838955560736,2985151319034,3137567616716,3296414415862,3461906949336,3634265808266,3813717030244,4000492188246,4194828480272,4396968819706,4607161926396,4825662418454,5052730904776,5288634078282,5533644809876,5788042243126,6052111889664,6326145725306,6610442286892,6905306769846,7211051126456,7527994164874,7856461648836,8196786398102,8549308389616,8914374859386,9292340405084,9683567089366,10088424543912,10507290074186,10940548764916,11388593586294,11851825500896,12330653571322,12825495068556,13336775581046,13864929124504,14410398252426,14973634167332,15555096832726,16155255085776,16774586750714,17413578752956,18072727233942,18752537666696,19453524972106,20176213635924,20921137826486,21688841513152,22479878585466,23294812973036,24134218766134,24998680337016,25888792461962,26805160444036,27748400236566,28719138567344,29718013063546,30745672377372,31802776312406,32889995950696,34008013780554,35157523825076,36339231771382,37553855100576,38802123218426,40084777586764,41402571855606,42756271995992,44146656433546,45574516182756,47040654981974,48545889429136,50091049118202,51676976776316,53304528401686,54974573402184,56687994734666,58445689045012,60248566808886,62097552473216,63993584598394,65937616001196,67930613898422,69973560051256,72067450910346,74213297761604,76412126872726,78664979640432,80972912738426,83336998266076,85758323897814,88237993033256
mov $1,22
mov $2,92
mov $5,$0
mov $6,$0
lpb $2,1
add $1,$6
sub $2,1
lpe
mov $3,$5
lpb $3,1
sub $3,1
add $4,$6
lpe
mov $2,147
mov $6,$4
lpb $2,1
add $1,$6
sub $2,1
lpe
mov $3,$5
mov $4,0
lpb $3,1
sub $3,1
add $4,$6
lpe
mov $2,126
mov $6,$4
lpb $2,1
add $1,$6
sub $2,1
lpe
mov $3,$5
mov $4,0
lpb $3,1
sub $3,1
add $4,$6
lpe
mov $2,56
mov $6,$4
lpb $2,1
add $1,$6
sub $2,1
lpe
mov $3,$5
mov $4,0
lpb $3,1
sub $3,1
add $4,$6
lpe
mov $2,12
mov $6,$4
lpb $2,1
add $1,$6
sub $2,1
lpe
mov $3,$5
mov $4,0
lpb $3,1
sub $3,1
add $4,$6
lpe
mov $2,1
mov $6,$4
lpb $2,1
add $1,$6
sub $2,1
lpe
|
libpal/intel_64bit_systemv_nasm/read_ss.asm | mars-research/pal | 26 | 95837 | <reponame>mars-research/pal<filename>libpal/intel_64bit_systemv_nasm/read_ss.asm
bits 64
default rel
section .text
global pal_execute_read_ss
pal_execute_read_ss :
xor rax, rax
mov ax, ss
ret
|
lib/sse/aes128_ecb_by4_sse.asm | edtubbs/intel-ipsec-mb | 0 | 14877 | ;;
;; Copyright (c) 2019-2021, Intel Corporation
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;;
;; * Redistributions of source code must retain the above copyright notice,
;; this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of Intel Corporation nor the names of its contributors
;; may be used to endorse or promote products derived from this software
;; without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;
; routine to do AES ECB encrypt/decrypt on 16n bytes doing AES by 4
; XMM registers are clobbered. Saving/restoring must be done at a higher level
; void aes_ecb_x_y_sse(void *in,
; UINT128 keys[],
; void *out,
; UINT64 len_bytes);
;
; x = direction (enc/dec)
; y = key size (128/192/256)
; arg 1: IN: pointer to input (cipher text)
; arg 2: KEYS: pointer to keys
; arg 3: OUT: pointer to output (plain text)
; arg 4: LEN: length in bytes (multiple of 16)
;
%include "include/os.asm"
%include "include/clear_regs.asm"
%ifndef AES_ECB_ENC_256
%ifndef AES_ECB_ENC_192
%ifndef AES_ECB_ENC_128
%define AES_ECB_ENC_128 aes_ecb_enc_128_sse
%define AES_ECB_DEC_128 aes_ecb_dec_128_sse
%endif
%endif
%endif
%ifdef LINUX
%define IN rdi
%define KEYS rsi
%define OUT rdx
%define LEN rcx
%else
%define IN rcx
%define KEYS rdx
%define OUT r8
%define LEN r9
%endif
%define IDX rax
%define TMP IDX
%define XDATA0 xmm0
%define XDATA1 xmm1
%define XDATA2 xmm2
%define XDATA3 xmm3
%define XKEY0 xmm4
%define XKEY2 xmm5
%define XKEY4 xmm6
%define XKEY6 xmm7
%define XKEY10 xmm8
%define XKEY_A xmm14
%define XKEY_B xmm15
section .text
%macro AES_ECB 2
%define %%NROUNDS %1 ; [in] Number of AES rounds, numerical value
%define %%DIR %2 ; [in] Direction (encrypt/decrypt)
%ifidn %%DIR, ENC
%define AES aesenc
%define AES_LAST aesenclast
%else ; DIR = DEC
%define AES aesdec
%define AES_LAST aesdeclast
%endif
mov TMP, LEN
and TMP, 3*16
jz %%initial_4
cmp TMP, 2*16
jb %%initial_1
ja %%initial_3
%%initial_2:
; load plain/cipher text
movdqu XDATA0, [IN + 0*16]
movdqu XDATA1, [IN + 1*16]
movdqa XKEY0, [KEYS + 0*16]
pxor XDATA0, XKEY0 ; 0. ARK
pxor XDATA1, XKEY0
movdqa XKEY2, [KEYS + 2*16]
AES XDATA0, [KEYS + 1*16] ; 1. ENC
AES XDATA1, [KEYS + 1*16]
mov IDX, 2*16
AES XDATA0, XKEY2 ; 2. ENC
AES XDATA1, XKEY2
movdqa XKEY4, [KEYS + 4*16]
AES XDATA0, [KEYS + 3*16] ; 3. ENC
AES XDATA1, [KEYS + 3*16]
AES XDATA0, XKEY4 ; 4. ENC
AES XDATA1, XKEY4
movdqa XKEY6, [KEYS + 6*16]
AES XDATA0, [KEYS + 5*16] ; 5. ENC
AES XDATA1, [KEYS + 5*16]
AES XDATA0, XKEY6 ; 6. ENC
AES XDATA1, XKEY6
movdqa XKEY_B, [KEYS + 8*16]
AES XDATA0, [KEYS + 7*16] ; 7. ENC
AES XDATA1, [KEYS + 7*16]
AES XDATA0, XKEY_B ; 8. ENC
AES XDATA1, XKEY_B
movdqa XKEY10, [KEYS + 10*16]
AES XDATA0, [KEYS + 9*16] ; 9. ENC
AES XDATA1, [KEYS + 9*16]
%if %%NROUNDS >= 12
AES XDATA0, XKEY10 ; 10. ENC
AES XDATA1, XKEY10
AES XDATA0, [KEYS + 11*16] ; 11. ENC
AES XDATA1, [KEYS + 11*16]
%endif
%if %%NROUNDS == 14
AES XDATA0, [KEYS + 12*16] ; 12. ENC
AES XDATA1, [KEYS + 12*16]
AES XDATA0, [KEYS + 13*16] ; 13. ENC
AES XDATA1, [KEYS + 13*16]
%endif
%if %%NROUNDS == 10
AES_LAST XDATA0, XKEY10 ; 10. ENC
AES_LAST XDATA1, XKEY10
%elif %%NROUNDS == 12
AES_LAST XDATA0, [KEYS + 12*16] ; 12. ENC
AES_LAST XDATA1, [KEYS + 12*16]
%else
AES_LAST XDATA0, [KEYS + 14*16] ; 14. ENC
AES_LAST XDATA1, [KEYS + 14*16]
%endif
movdqu [OUT + 0*16], XDATA0
movdqu [OUT + 1*16], XDATA1
cmp LEN, 2*16
je %%done
jmp %%main_loop
align 16
%%initial_1:
; load plain/cipher text
movdqu XDATA0, [IN + 0*16]
movdqa XKEY0, [KEYS + 0*16]
pxor XDATA0, XKEY0 ; 0. ARK
movdqa XKEY2, [KEYS + 2*16]
AES XDATA0, [KEYS + 1*16] ; 1. ENC
mov IDX, 1*16
AES XDATA0, XKEY2 ; 2. ENC
movdqa XKEY4, [KEYS + 4*16]
AES XDATA0, [KEYS + 3*16] ; 3. ENC
AES XDATA0, XKEY4 ; 4. ENC
movdqa XKEY6, [KEYS + 6*16]
AES XDATA0, [KEYS + 5*16] ; 5. ENC
AES XDATA0, XKEY6 ; 6. ENC
movdqa XKEY_B, [KEYS + 8*16]
AES XDATA0, [KEYS + 7*16] ; 7. ENC
AES XDATA0, XKEY_B ; 8. ENC
movdqa XKEY10, [KEYS + 10*16]
AES XDATA0, [KEYS + 9*16] ; 9. ENC
%if %%NROUNDS >= 12
AES XDATA0, XKEY10 ; 10. ENC
AES XDATA0, [KEYS + 11*16] ; 11. ENC
%endif
%if %%NROUNDS == 14
AES XDATA0, [KEYS + 12*16] ; 12. ENC
AES XDATA0, [KEYS + 13*16] ; 13. ENC
%endif
%if %%NROUNDS == 10
AES_LAST XDATA0, XKEY10 ; 10. ENC
%elif %%NROUNDS == 12
AES_LAST XDATA0, [KEYS + 12*16] ; 12. ENC
%else
AES_LAST XDATA0, [KEYS + 14*16] ; 14. ENC
%endif
movdqu [OUT + 0*16], XDATA0
cmp LEN, 1*16
je %%done
jmp %%main_loop
%%initial_3:
; load plain/cipher text
movdqu XDATA0, [IN + 0*16]
movdqu XDATA1, [IN + 1*16]
movdqu XDATA2, [IN + 2*16]
movdqa XKEY0, [KEYS + 0*16]
movdqa XKEY_A, [KEYS + 1*16]
pxor XDATA0, XKEY0 ; 0. ARK
pxor XDATA1, XKEY0
pxor XDATA2, XKEY0
movdqa XKEY2, [KEYS + 2*16]
AES XDATA0, XKEY_A ; 1. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
movdqa XKEY_A, [KEYS + 3*16]
mov IDX, 3*16
AES XDATA0, XKEY2 ; 2. ENC
AES XDATA1, XKEY2
AES XDATA2, XKEY2
movdqa XKEY4, [KEYS + 4*16]
AES XDATA0, XKEY_A ; 3. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
movdqa XKEY_A, [KEYS + 5*16]
AES XDATA0, XKEY4 ; 4. ENC
AES XDATA1, XKEY4
AES XDATA2, XKEY4
movdqa XKEY6, [KEYS + 6*16]
AES XDATA0, XKEY_A ; 5. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
movdqa XKEY_A, [KEYS + 7*16]
AES XDATA0, XKEY6 ; 6. ENC
AES XDATA1, XKEY6
AES XDATA2, XKEY6
movdqa XKEY_B, [KEYS + 8*16]
AES XDATA0, XKEY_A ; 7. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
movdqa XKEY_A, [KEYS + 9*16]
AES XDATA0, XKEY_B ; 8. ENC
AES XDATA1, XKEY_B
AES XDATA2, XKEY_B
movdqa XKEY_B, [KEYS + 10*16]
AES XDATA0, XKEY_A ; 9. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
%if %%NROUNDS >= 12
movdqa XKEY_A, [KEYS + 11*16]
AES XDATA0, XKEY_B ; 10. ENC
AES XDATA1, XKEY_B
AES XDATA2, XKEY_B
movdqa XKEY_B, [KEYS + 12*16]
AES XDATA0, XKEY_A ; 11. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
%endif
%if %%NROUNDS == 14
movdqa XKEY_A, [KEYS + 13*16]
AES XDATA0, XKEY_B ; 12. ENC
AES XDATA1, XKEY_B
AES XDATA2, XKEY_B
movdqa XKEY_B, [KEYS + 14*16]
AES XDATA0, XKEY_A ; 13. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
%endif
AES_LAST XDATA0, XKEY_B ; 10/12/14. ENC (depending on key size)
AES_LAST XDATA1, XKEY_B
AES_LAST XDATA2, XKEY_B
movdqu [OUT + 0*16], XDATA0
movdqu [OUT + 1*16], XDATA1
movdqu [OUT + 2*16], XDATA2
cmp LEN, 3*16
je %%done
jmp %%main_loop
align 16
%%initial_4:
; load plain/cipher text
movdqu XDATA0, [IN + 0*16]
movdqu XDATA1, [IN + 1*16]
movdqu XDATA2, [IN + 2*16]
movdqu XDATA3, [IN + 3*16]
movdqa XKEY0, [KEYS + 0*16]
movdqa XKEY_A, [KEYS + 1*16]
pxor XDATA0, XKEY0 ; 0. ARK
pxor XDATA1, XKEY0
pxor XDATA2, XKEY0
pxor XDATA3, XKEY0
movdqa XKEY2, [KEYS + 2*16]
AES XDATA0, XKEY_A ; 1. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
AES XDATA3, XKEY_A
movdqa XKEY_A, [KEYS + 3*16]
mov IDX, 4*16
AES XDATA0, XKEY2 ; 2. ENC
AES XDATA1, XKEY2
AES XDATA2, XKEY2
AES XDATA3, XKEY2
movdqa XKEY4, [KEYS + 4*16]
AES XDATA0, XKEY_A ; 3. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
AES XDATA3, XKEY_A
movdqa XKEY_A, [KEYS + 5*16]
AES XDATA0, XKEY4 ; 4. ENC
AES XDATA1, XKEY4
AES XDATA2, XKEY4
AES XDATA3, XKEY4
movdqa XKEY6, [KEYS + 6*16]
AES XDATA0, XKEY_A ; 5. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
AES XDATA3, XKEY_A
movdqa XKEY_A, [KEYS + 7*16]
AES XDATA0, XKEY6 ; 6. ENC
AES XDATA1, XKEY6
AES XDATA2, XKEY6
AES XDATA3, XKEY6
movdqa XKEY_B, [KEYS + 8*16]
AES XDATA0, XKEY_A ; 7. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
AES XDATA3, XKEY_A
movdqa XKEY_A, [KEYS + 9*16]
AES XDATA0, XKEY_B ; 8. ENC
AES XDATA1, XKEY_B
AES XDATA2, XKEY_B
AES XDATA3, XKEY_B
movdqa XKEY_B, [KEYS + 10*16]
AES XDATA0, XKEY_A ; 9. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
AES XDATA3, XKEY_A
%if %%NROUNDS >= 12
movdqa XKEY_A, [KEYS + 11*16]
AES XDATA0, XKEY_B ; 10. ENC
AES XDATA1, XKEY_B
AES XDATA2, XKEY_B
AES XDATA3, XKEY_B
movdqa XKEY_B, [KEYS + 12*16]
AES XDATA0, XKEY_A ; 11. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
AES XDATA3, XKEY_A
%endif
%if %%NROUNDS == 14
movdqa XKEY_A, [KEYS + 13*16]
AES XDATA0, XKEY_B ; 12. ENC
AES XDATA1, XKEY_B
AES XDATA2, XKEY_B
AES XDATA3, XKEY_B
movdqa XKEY_B, [KEYS + 14*16]
AES XDATA0, XKEY_A ; 13. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
AES XDATA3, XKEY_A
%endif
AES_LAST XDATA0, XKEY_B ; 10/12/14. ENC (depending on key size)
AES_LAST XDATA1, XKEY_B
AES_LAST XDATA2, XKEY_B
AES_LAST XDATA3, XKEY_B
movdqu [OUT + 0*16], XDATA0
movdqu [OUT + 1*16], XDATA1
movdqu [OUT + 2*16], XDATA2
movdqu [OUT + 3*16], XDATA3
cmp LEN, 4*16
jz %%done
jmp %%main_loop
align 16
%%main_loop:
; load plain/cipher text
movdqu XDATA0, [IN + IDX + 0*16]
movdqu XDATA1, [IN + IDX + 1*16]
movdqu XDATA2, [IN + IDX + 2*16]
movdqu XDATA3, [IN + IDX + 3*16]
movdqa XKEY_A, [KEYS + 1*16]
pxor XDATA0, XKEY0 ; 0. ARK
pxor XDATA1, XKEY0
pxor XDATA2, XKEY0
pxor XDATA3, XKEY0
add IDX, 4*16
AES XDATA0, XKEY_A ; 1. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
AES XDATA3, XKEY_A
movdqa XKEY_A, [KEYS + 3*16]
AES XDATA0, XKEY2 ; 2. ENC
AES XDATA1, XKEY2
AES XDATA2, XKEY2
AES XDATA3, XKEY2
AES XDATA0, XKEY_A ; 3. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
AES XDATA3, XKEY_A
movdqa XKEY_A, [KEYS + 5*16]
AES XDATA0, XKEY4 ; 4. ENC
AES XDATA1, XKEY4
AES XDATA2, XKEY4
AES XDATA3, XKEY4
AES XDATA0, XKEY_A ; 5. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
AES XDATA3, XKEY_A
movdqa XKEY_A, [KEYS + 7*16]
AES XDATA0, XKEY6 ; 6. ENC
AES XDATA1, XKEY6
AES XDATA2, XKEY6
AES XDATA3, XKEY6
movdqa XKEY_B, [KEYS + 8*16]
AES XDATA0, XKEY_A ; 7. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
AES XDATA3, XKEY_A
movdqa XKEY_A, [KEYS + 9*16]
AES XDATA0, XKEY_B ; 8. ENC
AES XDATA1, XKEY_B
AES XDATA2, XKEY_B
AES XDATA3, XKEY_B
movdqa XKEY_B, [KEYS + 10*16]
AES XDATA0, XKEY_A ; 9. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
AES XDATA3, XKEY_A
%if %%NROUNDS >= 12
movdqa XKEY_A, [KEYS + 11*16]
AES XDATA0, XKEY_B ; 10. ENC
AES XDATA1, XKEY_B
AES XDATA2, XKEY_B
AES XDATA3, XKEY_B
movdqa XKEY_B, [KEYS + 12*16]
AES XDATA0, XKEY_A ; 11. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
AES XDATA3, XKEY_A
%endif
%if %%NROUNDS == 14
movdqa XKEY_A, [KEYS + 13*16]
AES XDATA0, XKEY_B ; 12. ENC
AES XDATA1, XKEY_B
AES XDATA2, XKEY_B
AES XDATA3, XKEY_B
movdqa XKEY_B, [KEYS + 14*16]
AES XDATA0, XKEY_A ; 13. ENC
AES XDATA1, XKEY_A
AES XDATA2, XKEY_A
AES XDATA3, XKEY_A
%endif
AES_LAST XDATA0, XKEY_B ; 10/12/14. ENC (depending on key size)
AES_LAST XDATA1, XKEY_B
AES_LAST XDATA2, XKEY_B
AES_LAST XDATA3, XKEY_B
movdqu [OUT + IDX + 0*16 - 4*16], XDATA0
movdqu [OUT + IDX + 1*16 - 4*16], XDATA1
movdqu [OUT + IDX + 2*16 - 4*16], XDATA2
movdqu [OUT + IDX + 3*16 - 4*16], XDATA3
cmp IDX, LEN
jne %%main_loop
%%done:
%ifdef SAFE_DATA
clear_all_xmms_sse_asm
%endif ;; SAFE_DATA
ret
%endmacro
;;
;; AES-ECB 128 functions
;;
%ifdef AES_ECB_ENC_128
align 16
MKGLOBAL(AES_ECB_ENC_128,function,internal)
AES_ECB_ENC_128:
AES_ECB 10, ENC
align 16
MKGLOBAL(AES_ECB_DEC_128,function,internal)
AES_ECB_DEC_128:
AES_ECB 10, DEC
%endif
;;
;; AES-ECB 192 functions
;;
%ifdef AES_ECB_ENC_192
align 16
MKGLOBAL(AES_ECB_ENC_192,function,internal)
AES_ECB_ENC_192:
AES_ECB 12, ENC
align 16
MKGLOBAL(AES_ECB_DEC_192,function,internal)
AES_ECB_DEC_192:
AES_ECB 12, DEC
%endif
;;
;; AES-ECB 256 functions
;;
%ifdef AES_ECB_ENC_256
align 16
MKGLOBAL(AES_ECB_ENC_256,function,internal)
AES_ECB_ENC_256:
AES_ECB 14, ENC
align 16
MKGLOBAL(AES_ECB_DEC_256,function,internal)
AES_ECB_DEC_256:
AES_ECB 14, DEC
%endif
%ifdef LINUX
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
|
src/libs/strings/strlen.asm | QFSW/2048x86_64 | 6 | 9866 | <reponame>QFSW/2048x86_64<filename>src/libs/strings/strlen.asm
PUBLIC strlen
.code
; gets the length of a string
; RCX = str
strlen PROC
MOV RAX, -1 ; length ctr
sloop:
INC RAX
MOV DL, [RCX + RAX]
CMP DL, 0
JNE sloop
RET
strlen ENDP
END |
sh.asm | asacela/xv6_cs153_Fall2020 | 0 | 93843 |
_sh: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
return 0;
}
int
main(void)
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 53 push %ebx
e: 51 push %ecx
f: 83 ec 10 sub $0x10,%esp
static char buf[100];
int fd;
int status;
// Ensure that three file descriptors are open.
while((fd = open("console", O_RDWR)) >= 0){
12: eb 0d jmp 21 <main+0x21>
14: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(fd >= 3){
18: 83 f8 02 cmp $0x2,%eax
1b: 0f 8f b0 00 00 00 jg d1 <main+0xd1>
static char buf[100];
int fd;
int status;
// Ensure that three file descriptors are open.
while((fd = open("console", O_RDWR)) >= 0){
21: 83 ec 08 sub $0x8,%esp
24: 6a 02 push $0x2
26: 68 61 12 00 00 push $0x1261
2b: e8 62 0d 00 00 call d92 <open>
30: 83 c4 10 add $0x10,%esp
33: 85 c0 test %eax,%eax
35: 79 e1 jns 18 <main+0x18>
printf(2, "cannot cd %s\n", buf+3);
continue;
}
if(fork1() == 0)
runcmd(parsecmd(buf));
wait(&status);
37: 8d 5d f4 lea -0xc(%ebp),%ebx
3a: eb 26 jmp 62 <main+0x62>
3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int
fork1(void)
{
int pid;
pid = fork();
40: e8 05 0d 00 00 call d4a <fork>
if(pid == -1)
45: 83 f8 ff cmp $0xffffffff,%eax
48: 0f 84 9e 00 00 00 je ec <main+0xec>
buf[strlen(buf)-1] = 0; // chop \n
if(chdir(buf+3) < 0)
printf(2, "cannot cd %s\n", buf+3);
continue;
}
if(fork1() == 0)
4e: 85 c0 test %eax,%eax
50: 0f 84 a3 00 00 00 je f9 <main+0xf9>
runcmd(parsecmd(buf));
wait(&status);
56: 83 ec 0c sub $0xc,%esp
59: 53 push %ebx
5a: e8 fb 0c 00 00 call d5a <wait>
5f: 83 c4 10 add $0x10,%esp
break;
}
}
// Read and run input commands.
while(getcmd(buf, sizeof(buf)) >= 0){
62: 83 ec 08 sub $0x8,%esp
65: 6a 64 push $0x64
67: 68 80 18 00 00 push $0x1880
6c: e8 9f 00 00 00 call 110 <getcmd>
71: 83 c4 10 add $0x10,%esp
74: 85 c0 test %eax,%eax
76: 78 6a js e2 <main+0xe2>
if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){
78: 80 3d 80 18 00 00 63 cmpb $0x63,0x1880
7f: 75 bf jne 40 <main+0x40>
81: 80 3d 81 18 00 00 64 cmpb $0x64,0x1881
88: 75 b6 jne 40 <main+0x40>
8a: 80 3d 82 18 00 00 20 cmpb $0x20,0x1882
91: 75 ad jne 40 <main+0x40>
// Chdir must be called by the parent, not the child.
buf[strlen(buf)-1] = 0; // chop \n
93: 83 ec 0c sub $0xc,%esp
96: 68 80 18 00 00 push $0x1880
9b: e8 f0 0a 00 00 call b90 <strlen>
if(chdir(buf+3) < 0)
a0: c7 04 24 83 18 00 00 movl $0x1883,(%esp)
// Read and run input commands.
while(getcmd(buf, sizeof(buf)) >= 0){
if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){
// Chdir must be called by the parent, not the child.
buf[strlen(buf)-1] = 0; // chop \n
a7: c6 80 7f 18 00 00 00 movb $0x0,0x187f(%eax)
if(chdir(buf+3) < 0)
ae: e8 0f 0d 00 00 call dc2 <chdir>
b3: 83 c4 10 add $0x10,%esp
b6: 85 c0 test %eax,%eax
b8: 79 a8 jns 62 <main+0x62>
printf(2, "cannot cd %s\n", buf+3);
ba: 50 push %eax
bb: 68 83 18 00 00 push $0x1883
c0: 68 69 12 00 00 push $0x1269
c5: 6a 02 push $0x2
c7: e8 d4 0d 00 00 call ea0 <printf>
cc: 83 c4 10 add $0x10,%esp
cf: eb 91 jmp 62 <main+0x62>
int status;
// Ensure that three file descriptors are open.
while((fd = open("console", O_RDWR)) >= 0){
if(fd >= 3){
close(fd);
d1: 83 ec 0c sub $0xc,%esp
d4: 50 push %eax
d5: e8 a0 0c 00 00 call d7a <close>
break;
da: 83 c4 10 add $0x10,%esp
dd: e9 55 ff ff ff jmp 37 <main+0x37>
}
if(fork1() == 0)
runcmd(parsecmd(buf));
wait(&status);
}
exit(PASS_STATUS);
e2: 83 ec 0c sub $0xc,%esp
e5: 6a 01 push $0x1
e7: e8 66 0c 00 00 call d52 <exit>
{
int pid;
pid = fork();
if(pid == -1)
panic("fork");
ec: 83 ec 0c sub $0xc,%esp
ef: 68 ea 11 00 00 push $0x11ea
f4: e8 67 00 00 00 call 160 <panic>
if(chdir(buf+3) < 0)
printf(2, "cannot cd %s\n", buf+3);
continue;
}
if(fork1() == 0)
runcmd(parsecmd(buf));
f9: 83 ec 0c sub $0xc,%esp
fc: 68 80 18 00 00 push $0x1880
101: e8 9a 09 00 00 call aa0 <parsecmd>
106: 89 04 24 mov %eax,(%esp)
109: e8 82 00 00 00 call 190 <runcmd>
10e: 66 90 xchg %ax,%ax
00000110 <getcmd>:
exit(PASS_STATUS);
}
int
getcmd(char *buf, int nbuf)
{
110: 55 push %ebp
111: 89 e5 mov %esp,%ebp
113: 56 push %esi
114: 53 push %ebx
115: 8b 75 0c mov 0xc(%ebp),%esi
118: 8b 5d 08 mov 0x8(%ebp),%ebx
printf(2, "$ ");
11b: 83 ec 08 sub $0x8,%esp
11e: 68 c0 11 00 00 push $0x11c0
123: 6a 02 push $0x2
125: e8 76 0d 00 00 call ea0 <printf>
memset(buf, 0, nbuf);
12a: 83 c4 0c add $0xc,%esp
12d: 56 push %esi
12e: 6a 00 push $0x0
130: 53 push %ebx
131: e8 8a 0a 00 00 call bc0 <memset>
gets(buf, nbuf);
136: 58 pop %eax
137: 5a pop %edx
138: 56 push %esi
139: 53 push %ebx
13a: e8 e1 0a 00 00 call c20 <gets>
13f: 83 c4 10 add $0x10,%esp
142: 31 c0 xor %eax,%eax
144: 80 3b 00 cmpb $0x0,(%ebx)
147: 0f 94 c0 sete %al
if(buf[0] == 0) // EOF
return -1;
return 0;
}
14a: 8d 65 f8 lea -0x8(%ebp),%esp
14d: f7 d8 neg %eax
14f: 5b pop %ebx
150: 5e pop %esi
151: 5d pop %ebp
152: c3 ret
153: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
159: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000160 <panic>:
exit(PASS_STATUS);
}
void
panic(char *s)
{
160: 55 push %ebp
161: 89 e5 mov %esp,%ebp
163: 83 ec 0c sub $0xc,%esp
printf(2, "%s\n", s);
166: ff 75 08 pushl 0x8(%ebp)
169: 68 5d 12 00 00 push $0x125d
16e: 6a 02 push $0x2
170: e8 2b 0d 00 00 call ea0 <printf>
exit(PASS_STATUS);
175: c7 04 24 01 00 00 00 movl $0x1,(%esp)
17c: e8 d1 0b 00 00 call d52 <exit>
181: eb 0d jmp 190 <runcmd>
183: 90 nop
184: 90 nop
185: 90 nop
186: 90 nop
187: 90 nop
188: 90 nop
189: 90 nop
18a: 90 nop
18b: 90 nop
18c: 90 nop
18d: 90 nop
18e: 90 nop
18f: 90 nop
00000190 <runcmd>:
struct cmd *parsecmd(char*);
// Execute cmd. Never returns.
void
runcmd(struct cmd *cmd)
{
190: 55 push %ebp
191: 89 e5 mov %esp,%ebp
193: 53 push %ebx
194: 83 ec 14 sub $0x14,%esp
197: 8b 5d 08 mov 0x8(%ebp),%ebx
struct listcmd *lcmd;
struct pipecmd *pcmd;
struct redircmd *rcmd;
int status;
if(cmd == 0)
19a: 85 db test %ebx,%ebx
19c: 74 7f je 21d <runcmd+0x8d>
exit(PASS_STATUS);
switch(cmd->type){
19e: 83 3b 05 cmpl $0x5,(%ebx)
1a1: 0f 87 0b 01 00 00 ja 2b2 <runcmd+0x122>
1a7: 8b 03 mov (%ebx),%eax
1a9: ff 24 85 78 12 00 00 jmp *0x1278(,%eax,4)
runcmd(lcmd->right);
break;
case PIPE:
pcmd = (struct pipecmd*)cmd;
if(pipe(p) < 0)
1b0: 8d 45 f0 lea -0x10(%ebp),%eax
1b3: 83 ec 0c sub $0xc,%esp
1b6: 50 push %eax
1b7: e8 a6 0b 00 00 call d62 <pipe>
1bc: 83 c4 10 add $0x10,%esp
1bf: 85 c0 test %eax,%eax
1c1: 0f 88 21 01 00 00 js 2e8 <runcmd+0x158>
int
fork1(void)
{
int pid;
pid = fork();
1c7: e8 7e 0b 00 00 call d4a <fork>
if(pid == -1)
1cc: 83 f8 ff cmp $0xffffffff,%eax
1cf: 0f 84 ea 00 00 00 je 2bf <runcmd+0x12f>
case PIPE:
pcmd = (struct pipecmd*)cmd;
if(pipe(p) < 0)
panic("pipe");
if(fork1() == 0){
1d5: 85 c0 test %eax,%eax
1d7: 0f 84 18 01 00 00 je 2f5 <runcmd+0x165>
int
fork1(void)
{
int pid;
pid = fork();
1dd: e8 68 0b 00 00 call d4a <fork>
if(pid == -1)
1e2: 83 f8 ff cmp $0xffffffff,%eax
1e5: 0f 84 d4 00 00 00 je 2bf <runcmd+0x12f>
dup(p[1]);
close(p[0]);
close(p[1]);
runcmd(pcmd->left);
}
if(fork1() == 0){
1eb: 85 c0 test %eax,%eax
1ed: 0f 84 30 01 00 00 je 323 <runcmd+0x193>
dup(p[0]);
close(p[0]);
close(p[1]);
runcmd(pcmd->right);
}
close(p[0]);
1f3: 83 ec 0c sub $0xc,%esp
1f6: ff 75 f0 pushl -0x10(%ebp)
close(p[1]);
wait(&status);
1f9: 8d 5d ec lea -0x14(%ebp),%ebx
dup(p[0]);
close(p[0]);
close(p[1]);
runcmd(pcmd->right);
}
close(p[0]);
1fc: e8 79 0b 00 00 call d7a <close>
close(p[1]);
201: 58 pop %eax
202: ff 75 f4 pushl -0xc(%ebp)
205: e8 70 0b 00 00 call d7a <close>
wait(&status);
20a: 89 1c 24 mov %ebx,(%esp)
20d: e8 48 0b 00 00 call d5a <wait>
wait(&status);
212: 89 1c 24 mov %ebx,(%esp)
215: e8 40 0b 00 00 call d5a <wait>
break;
21a: 83 c4 10 add $0x10,%esp
struct pipecmd *pcmd;
struct redircmd *rcmd;
int status;
if(cmd == 0)
exit(PASS_STATUS);
21d: 83 ec 0c sub $0xc,%esp
220: 6a 01 push $0x1
222: e8 2b 0b 00 00 call d52 <exit>
int
fork1(void)
{
int pid;
pid = fork();
227: e8 1e 0b 00 00 call d4a <fork>
if(pid == -1)
22c: 83 f8 ff cmp $0xffffffff,%eax
22f: 0f 84 8a 00 00 00 je 2bf <runcmd+0x12f>
wait(&status);
break;
case BACK:
bcmd = (struct backcmd*)cmd;
if(fork1() == 0)
235: 85 c0 test %eax,%eax
237: 75 e4 jne 21d <runcmd+0x8d>
239: eb 49 jmp 284 <runcmd+0xf4>
default:
panic("runcmd");
case EXEC:
ecmd = (struct execcmd*)cmd;
if(ecmd->argv[0] == 0)
23b: 8b 43 04 mov 0x4(%ebx),%eax
23e: 85 c0 test %eax,%eax
240: 74 db je 21d <runcmd+0x8d>
exit(PASS_STATUS);
exec(ecmd->argv[0], ecmd->argv);
242: 8d 53 04 lea 0x4(%ebx),%edx
245: 51 push %ecx
246: 51 push %ecx
247: 52 push %edx
248: 50 push %eax
249: e8 3c 0b 00 00 call d8a <exec>
printf(2, "exec %s failed\n", ecmd->argv[0]);
24e: 83 c4 0c add $0xc,%esp
251: ff 73 04 pushl 0x4(%ebx)
254: 68 ca 11 00 00 push $0x11ca
259: 6a 02 push $0x2
25b: e8 40 0c 00 00 call ea0 <printf>
break;
260: 83 c4 10 add $0x10,%esp
263: eb b8 jmp 21d <runcmd+0x8d>
case REDIR:
rcmd = (struct redircmd*)cmd;
close(rcmd->fd);
265: 83 ec 0c sub $0xc,%esp
268: ff 73 14 pushl 0x14(%ebx)
26b: e8 0a 0b 00 00 call d7a <close>
if(open(rcmd->file, rcmd->mode) < 0){
270: 58 pop %eax
271: 5a pop %edx
272: ff 73 10 pushl 0x10(%ebx)
275: ff 73 08 pushl 0x8(%ebx)
278: e8 15 0b 00 00 call d92 <open>
27d: 83 c4 10 add $0x10,%esp
280: 85 c0 test %eax,%eax
282: 78 48 js 2cc <runcmd+0x13c>
break;
case BACK:
bcmd = (struct backcmd*)cmd;
if(fork1() == 0)
runcmd(bcmd->cmd);
284: 83 ec 0c sub $0xc,%esp
287: ff 73 04 pushl 0x4(%ebx)
28a: e8 01 ff ff ff call 190 <runcmd>
int
fork1(void)
{
int pid;
pid = fork();
28f: e8 b6 0a 00 00 call d4a <fork>
if(pid == -1)
294: 83 f8 ff cmp $0xffffffff,%eax
297: 74 26 je 2bf <runcmd+0x12f>
runcmd(rcmd->cmd);
break;
case LIST:
lcmd = (struct listcmd*)cmd;
if(fork1() == 0)
299: 85 c0 test %eax,%eax
29b: 74 e7 je 284 <runcmd+0xf4>
runcmd(lcmd->left);
wait(&status);
29d: 8d 45 ec lea -0x14(%ebp),%eax
2a0: 83 ec 0c sub $0xc,%esp
2a3: 50 push %eax
2a4: e8 b1 0a 00 00 call d5a <wait>
runcmd(lcmd->right);
2a9: 5a pop %edx
2aa: ff 73 08 pushl 0x8(%ebx)
2ad: e8 de fe ff ff call 190 <runcmd>
if(cmd == 0)
exit(PASS_STATUS);
switch(cmd->type){
default:
panic("runcmd");
2b2: 83 ec 0c sub $0xc,%esp
2b5: 68 c3 11 00 00 push $0x11c3
2ba: e8 a1 fe ff ff call 160 <panic>
{
int pid;
pid = fork();
if(pid == -1)
panic("fork");
2bf: 83 ec 0c sub $0xc,%esp
2c2: 68 ea 11 00 00 push $0x11ea
2c7: e8 94 fe ff ff call 160 <panic>
case REDIR:
rcmd = (struct redircmd*)cmd;
close(rcmd->fd);
if(open(rcmd->file, rcmd->mode) < 0){
printf(2, "open %s failed\n", rcmd->file);
2cc: 51 push %ecx
2cd: ff 73 08 pushl 0x8(%ebx)
2d0: 68 da 11 00 00 push $0x11da
2d5: 6a 02 push $0x2
2d7: e8 c4 0b 00 00 call ea0 <printf>
exit(FAIL_STATUS);
2dc: c7 04 24 00 00 00 00 movl $0x0,(%esp)
2e3: e8 6a 0a 00 00 call d52 <exit>
break;
case PIPE:
pcmd = (struct pipecmd*)cmd;
if(pipe(p) < 0)
panic("pipe");
2e8: 83 ec 0c sub $0xc,%esp
2eb: 68 ef 11 00 00 push $0x11ef
2f0: e8 6b fe ff ff call 160 <panic>
if(fork1() == 0){
close(1);
2f5: 83 ec 0c sub $0xc,%esp
2f8: 6a 01 push $0x1
2fa: e8 7b 0a 00 00 call d7a <close>
dup(p[1]);
2ff: 58 pop %eax
300: ff 75 f4 pushl -0xc(%ebp)
303: e8 c2 0a 00 00 call dca <dup>
close(p[0]);
308: 58 pop %eax
309: ff 75 f0 pushl -0x10(%ebp)
30c: e8 69 0a 00 00 call d7a <close>
close(p[1]);
311: 58 pop %eax
312: ff 75 f4 pushl -0xc(%ebp)
315: e8 60 0a 00 00 call d7a <close>
runcmd(pcmd->left);
31a: 58 pop %eax
31b: ff 73 04 pushl 0x4(%ebx)
31e: e8 6d fe ff ff call 190 <runcmd>
}
if(fork1() == 0){
close(0);
323: 83 ec 0c sub $0xc,%esp
326: 6a 00 push $0x0
328: e8 4d 0a 00 00 call d7a <close>
dup(p[0]);
32d: 5a pop %edx
32e: ff 75 f0 pushl -0x10(%ebp)
331: e8 94 0a 00 00 call dca <dup>
close(p[0]);
336: 59 pop %ecx
337: ff 75 f0 pushl -0x10(%ebp)
33a: e8 3b 0a 00 00 call d7a <close>
close(p[1]);
33f: 58 pop %eax
340: ff 75 f4 pushl -0xc(%ebp)
343: e8 32 0a 00 00 call d7a <close>
runcmd(pcmd->right);
348: 58 pop %eax
349: ff 73 08 pushl 0x8(%ebx)
34c: e8 3f fe ff ff call 190 <runcmd>
351: eb 0d jmp 360 <fork1>
353: 90 nop
354: 90 nop
355: 90 nop
356: 90 nop
357: 90 nop
358: 90 nop
359: 90 nop
35a: 90 nop
35b: 90 nop
35c: 90 nop
35d: 90 nop
35e: 90 nop
35f: 90 nop
00000360 <fork1>:
exit(PASS_STATUS);
}
int
fork1(void)
{
360: 55 push %ebp
361: 89 e5 mov %esp,%ebp
363: 83 ec 08 sub $0x8,%esp
int pid;
pid = fork();
366: e8 df 09 00 00 call d4a <fork>
if(pid == -1)
36b: 83 f8 ff cmp $0xffffffff,%eax
36e: 74 02 je 372 <fork1+0x12>
panic("fork");
return pid;
}
370: c9 leave
371: c3 ret
{
int pid;
pid = fork();
if(pid == -1)
panic("fork");
372: 83 ec 0c sub $0xc,%esp
375: 68 ea 11 00 00 push $0x11ea
37a: e8 e1 fd ff ff call 160 <panic>
37f: 90 nop
00000380 <execcmd>:
//PAGEBREAK!
// Constructors
struct cmd*
execcmd(void)
{
380: 55 push %ebp
381: 89 e5 mov %esp,%ebp
383: 53 push %ebx
384: 83 ec 10 sub $0x10,%esp
struct execcmd *cmd;
cmd = malloc(sizeof(*cmd));
387: 6a 54 push $0x54
389: e8 42 0d 00 00 call 10d0 <malloc>
memset(cmd, 0, sizeof(*cmd));
38e: 83 c4 0c add $0xc,%esp
struct cmd*
execcmd(void)
{
struct execcmd *cmd;
cmd = malloc(sizeof(*cmd));
391: 89 c3 mov %eax,%ebx
memset(cmd, 0, sizeof(*cmd));
393: 6a 54 push $0x54
395: 6a 00 push $0x0
397: 50 push %eax
398: e8 23 08 00 00 call bc0 <memset>
cmd->type = EXEC;
39d: c7 03 01 00 00 00 movl $0x1,(%ebx)
return (struct cmd*)cmd;
}
3a3: 89 d8 mov %ebx,%eax
3a5: 8b 5d fc mov -0x4(%ebp),%ebx
3a8: c9 leave
3a9: c3 ret
3aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
000003b0 <redircmd>:
struct cmd*
redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd)
{
3b0: 55 push %ebp
3b1: 89 e5 mov %esp,%ebp
3b3: 53 push %ebx
3b4: 83 ec 10 sub $0x10,%esp
struct redircmd *cmd;
cmd = malloc(sizeof(*cmd));
3b7: 6a 18 push $0x18
3b9: e8 12 0d 00 00 call 10d0 <malloc>
memset(cmd, 0, sizeof(*cmd));
3be: 83 c4 0c add $0xc,%esp
struct cmd*
redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd)
{
struct redircmd *cmd;
cmd = malloc(sizeof(*cmd));
3c1: 89 c3 mov %eax,%ebx
memset(cmd, 0, sizeof(*cmd));
3c3: 6a 18 push $0x18
3c5: 6a 00 push $0x0
3c7: 50 push %eax
3c8: e8 f3 07 00 00 call bc0 <memset>
cmd->type = REDIR;
cmd->cmd = subcmd;
3cd: 8b 45 08 mov 0x8(%ebp),%eax
{
struct redircmd *cmd;
cmd = malloc(sizeof(*cmd));
memset(cmd, 0, sizeof(*cmd));
cmd->type = REDIR;
3d0: c7 03 02 00 00 00 movl $0x2,(%ebx)
cmd->cmd = subcmd;
3d6: 89 43 04 mov %eax,0x4(%ebx)
cmd->file = file;
3d9: 8b 45 0c mov 0xc(%ebp),%eax
3dc: 89 43 08 mov %eax,0x8(%ebx)
cmd->efile = efile;
3df: 8b 45 10 mov 0x10(%ebp),%eax
3e2: 89 43 0c mov %eax,0xc(%ebx)
cmd->mode = mode;
3e5: 8b 45 14 mov 0x14(%ebp),%eax
3e8: 89 43 10 mov %eax,0x10(%ebx)
cmd->fd = fd;
3eb: 8b 45 18 mov 0x18(%ebp),%eax
3ee: 89 43 14 mov %eax,0x14(%ebx)
return (struct cmd*)cmd;
}
3f1: 89 d8 mov %ebx,%eax
3f3: 8b 5d fc mov -0x4(%ebp),%ebx
3f6: c9 leave
3f7: c3 ret
3f8: 90 nop
3f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000400 <pipecmd>:
struct cmd*
pipecmd(struct cmd *left, struct cmd *right)
{
400: 55 push %ebp
401: 89 e5 mov %esp,%ebp
403: 53 push %ebx
404: 83 ec 10 sub $0x10,%esp
struct pipecmd *cmd;
cmd = malloc(sizeof(*cmd));
407: 6a 0c push $0xc
409: e8 c2 0c 00 00 call 10d0 <malloc>
memset(cmd, 0, sizeof(*cmd));
40e: 83 c4 0c add $0xc,%esp
struct cmd*
pipecmd(struct cmd *left, struct cmd *right)
{
struct pipecmd *cmd;
cmd = malloc(sizeof(*cmd));
411: 89 c3 mov %eax,%ebx
memset(cmd, 0, sizeof(*cmd));
413: 6a 0c push $0xc
415: 6a 00 push $0x0
417: 50 push %eax
418: e8 a3 07 00 00 call bc0 <memset>
cmd->type = PIPE;
cmd->left = left;
41d: 8b 45 08 mov 0x8(%ebp),%eax
{
struct pipecmd *cmd;
cmd = malloc(sizeof(*cmd));
memset(cmd, 0, sizeof(*cmd));
cmd->type = PIPE;
420: c7 03 03 00 00 00 movl $0x3,(%ebx)
cmd->left = left;
426: 89 43 04 mov %eax,0x4(%ebx)
cmd->right = right;
429: 8b 45 0c mov 0xc(%ebp),%eax
42c: 89 43 08 mov %eax,0x8(%ebx)
return (struct cmd*)cmd;
}
42f: 89 d8 mov %ebx,%eax
431: 8b 5d fc mov -0x4(%ebp),%ebx
434: c9 leave
435: c3 ret
436: 8d 76 00 lea 0x0(%esi),%esi
439: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000440 <listcmd>:
struct cmd*
listcmd(struct cmd *left, struct cmd *right)
{
440: 55 push %ebp
441: 89 e5 mov %esp,%ebp
443: 53 push %ebx
444: 83 ec 10 sub $0x10,%esp
struct listcmd *cmd;
cmd = malloc(sizeof(*cmd));
447: 6a 0c push $0xc
449: e8 82 0c 00 00 call 10d0 <malloc>
memset(cmd, 0, sizeof(*cmd));
44e: 83 c4 0c add $0xc,%esp
struct cmd*
listcmd(struct cmd *left, struct cmd *right)
{
struct listcmd *cmd;
cmd = malloc(sizeof(*cmd));
451: 89 c3 mov %eax,%ebx
memset(cmd, 0, sizeof(*cmd));
453: 6a 0c push $0xc
455: 6a 00 push $0x0
457: 50 push %eax
458: e8 63 07 00 00 call bc0 <memset>
cmd->type = LIST;
cmd->left = left;
45d: 8b 45 08 mov 0x8(%ebp),%eax
{
struct listcmd *cmd;
cmd = malloc(sizeof(*cmd));
memset(cmd, 0, sizeof(*cmd));
cmd->type = LIST;
460: c7 03 04 00 00 00 movl $0x4,(%ebx)
cmd->left = left;
466: 89 43 04 mov %eax,0x4(%ebx)
cmd->right = right;
469: 8b 45 0c mov 0xc(%ebp),%eax
46c: 89 43 08 mov %eax,0x8(%ebx)
return (struct cmd*)cmd;
}
46f: 89 d8 mov %ebx,%eax
471: 8b 5d fc mov -0x4(%ebp),%ebx
474: c9 leave
475: c3 ret
476: 8d 76 00 lea 0x0(%esi),%esi
479: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000480 <backcmd>:
struct cmd*
backcmd(struct cmd *subcmd)
{
480: 55 push %ebp
481: 89 e5 mov %esp,%ebp
483: 53 push %ebx
484: 83 ec 10 sub $0x10,%esp
struct backcmd *cmd;
cmd = malloc(sizeof(*cmd));
487: 6a 08 push $0x8
489: e8 42 0c 00 00 call 10d0 <malloc>
memset(cmd, 0, sizeof(*cmd));
48e: 83 c4 0c add $0xc,%esp
struct cmd*
backcmd(struct cmd *subcmd)
{
struct backcmd *cmd;
cmd = malloc(sizeof(*cmd));
491: 89 c3 mov %eax,%ebx
memset(cmd, 0, sizeof(*cmd));
493: 6a 08 push $0x8
495: 6a 00 push $0x0
497: 50 push %eax
498: e8 23 07 00 00 call bc0 <memset>
cmd->type = BACK;
cmd->cmd = subcmd;
49d: 8b 45 08 mov 0x8(%ebp),%eax
{
struct backcmd *cmd;
cmd = malloc(sizeof(*cmd));
memset(cmd, 0, sizeof(*cmd));
cmd->type = BACK;
4a0: c7 03 05 00 00 00 movl $0x5,(%ebx)
cmd->cmd = subcmd;
4a6: 89 43 04 mov %eax,0x4(%ebx)
return (struct cmd*)cmd;
}
4a9: 89 d8 mov %ebx,%eax
4ab: 8b 5d fc mov -0x4(%ebp),%ebx
4ae: c9 leave
4af: c3 ret
000004b0 <gettoken>:
char whitespace[] = " \t\r\n\v";
char symbols[] = "<|>&;()";
int
gettoken(char **ps, char *es, char **q, char **eq)
{
4b0: 55 push %ebp
4b1: 89 e5 mov %esp,%ebp
4b3: 57 push %edi
4b4: 56 push %esi
4b5: 53 push %ebx
4b6: 83 ec 0c sub $0xc,%esp
char *s;
int ret;
s = *ps;
4b9: 8b 45 08 mov 0x8(%ebp),%eax
char whitespace[] = " \t\r\n\v";
char symbols[] = "<|>&;()";
int
gettoken(char **ps, char *es, char **q, char **eq)
{
4bc: 8b 5d 0c mov 0xc(%ebp),%ebx
4bf: 8b 75 10 mov 0x10(%ebp),%esi
char *s;
int ret;
s = *ps;
4c2: 8b 38 mov (%eax),%edi
while(s < es && strchr(whitespace, *s))
4c4: 39 df cmp %ebx,%edi
4c6: 72 13 jb 4db <gettoken+0x2b>
4c8: eb 29 jmp 4f3 <gettoken+0x43>
4ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
s++;
4d0: 83 c7 01 add $0x1,%edi
{
char *s;
int ret;
s = *ps;
while(s < es && strchr(whitespace, *s))
4d3: 39 fb cmp %edi,%ebx
4d5: 0f 84 ed 00 00 00 je 5c8 <gettoken+0x118>
4db: 0f be 07 movsbl (%edi),%eax
4de: 83 ec 08 sub $0x8,%esp
4e1: 50 push %eax
4e2: 68 6c 18 00 00 push $0x186c
4e7: e8 f4 06 00 00 call be0 <strchr>
4ec: 83 c4 10 add $0x10,%esp
4ef: 85 c0 test %eax,%eax
4f1: 75 dd jne 4d0 <gettoken+0x20>
s++;
if(q)
4f3: 85 f6 test %esi,%esi
4f5: 74 02 je 4f9 <gettoken+0x49>
*q = s;
4f7: 89 3e mov %edi,(%esi)
ret = *s;
4f9: 0f be 37 movsbl (%edi),%esi
4fc: 89 f1 mov %esi,%ecx
4fe: 89 f0 mov %esi,%eax
switch(*s){
500: 80 f9 29 cmp $0x29,%cl
503: 7f 5b jg 560 <gettoken+0xb0>
505: 80 f9 28 cmp $0x28,%cl
508: 7d 61 jge 56b <gettoken+0xbb>
50a: 84 c9 test %cl,%cl
50c: 0f 85 de 00 00 00 jne 5f0 <gettoken+0x140>
ret = 'a';
while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s))
s++;
break;
}
if(eq)
512: 8b 55 14 mov 0x14(%ebp),%edx
515: 85 d2 test %edx,%edx
517: 74 05 je 51e <gettoken+0x6e>
*eq = s;
519: 8b 45 14 mov 0x14(%ebp),%eax
51c: 89 38 mov %edi,(%eax)
while(s < es && strchr(whitespace, *s))
51e: 39 fb cmp %edi,%ebx
520: 77 0d ja 52f <gettoken+0x7f>
522: eb 23 jmp 547 <gettoken+0x97>
524: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
s++;
528: 83 c7 01 add $0x1,%edi
break;
}
if(eq)
*eq = s;
while(s < es && strchr(whitespace, *s))
52b: 39 fb cmp %edi,%ebx
52d: 74 18 je 547 <gettoken+0x97>
52f: 0f be 07 movsbl (%edi),%eax
532: 83 ec 08 sub $0x8,%esp
535: 50 push %eax
536: 68 6c 18 00 00 push $0x186c
53b: e8 a0 06 00 00 call be0 <strchr>
540: 83 c4 10 add $0x10,%esp
543: 85 c0 test %eax,%eax
545: 75 e1 jne 528 <gettoken+0x78>
s++;
*ps = s;
547: 8b 45 08 mov 0x8(%ebp),%eax
54a: 89 38 mov %edi,(%eax)
return ret;
}
54c: 8d 65 f4 lea -0xc(%ebp),%esp
54f: 89 f0 mov %esi,%eax
551: 5b pop %ebx
552: 5e pop %esi
553: 5f pop %edi
554: 5d pop %ebp
555: c3 ret
556: 8d 76 00 lea 0x0(%esi),%esi
559: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
while(s < es && strchr(whitespace, *s))
s++;
if(q)
*q = s;
ret = *s;
switch(*s){
560: 80 f9 3e cmp $0x3e,%cl
563: 75 0b jne 570 <gettoken+0xc0>
case '<':
s++;
break;
case '>':
s++;
if(*s == '>'){
565: 80 7f 01 3e cmpb $0x3e,0x1(%edi)
569: 74 75 je 5e0 <gettoken+0x130>
case '&':
case '<':
s++;
break;
case '>':
s++;
56b: 83 c7 01 add $0x1,%edi
56e: eb a2 jmp 512 <gettoken+0x62>
while(s < es && strchr(whitespace, *s))
s++;
if(q)
*q = s;
ret = *s;
switch(*s){
570: 7f 5e jg 5d0 <gettoken+0x120>
572: 83 e9 3b sub $0x3b,%ecx
575: 80 f9 01 cmp $0x1,%cl
578: 76 f1 jbe 56b <gettoken+0xbb>
s++;
}
break;
default:
ret = 'a';
while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s))
57a: 39 fb cmp %edi,%ebx
57c: 77 24 ja 5a2 <gettoken+0xf2>
57e: eb 7c jmp 5fc <gettoken+0x14c>
580: 0f be 07 movsbl (%edi),%eax
583: 83 ec 08 sub $0x8,%esp
586: 50 push %eax
587: 68 64 18 00 00 push $0x1864
58c: e8 4f 06 00 00 call be0 <strchr>
591: 83 c4 10 add $0x10,%esp
594: 85 c0 test %eax,%eax
596: 75 1f jne 5b7 <gettoken+0x107>
s++;
598: 83 c7 01 add $0x1,%edi
s++;
}
break;
default:
ret = 'a';
while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s))
59b: 39 fb cmp %edi,%ebx
59d: 74 5b je 5fa <gettoken+0x14a>
59f: 0f be 07 movsbl (%edi),%eax
5a2: 83 ec 08 sub $0x8,%esp
5a5: 50 push %eax
5a6: 68 6c 18 00 00 push $0x186c
5ab: e8 30 06 00 00 call be0 <strchr>
5b0: 83 c4 10 add $0x10,%esp
5b3: 85 c0 test %eax,%eax
5b5: 74 c9 je 580 <gettoken+0xd0>
ret = '+';
s++;
}
break;
default:
ret = 'a';
5b7: be 61 00 00 00 mov $0x61,%esi
5bc: e9 51 ff ff ff jmp 512 <gettoken+0x62>
5c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
5c8: 89 df mov %ebx,%edi
5ca: e9 24 ff ff ff jmp 4f3 <gettoken+0x43>
5cf: 90 nop
while(s < es && strchr(whitespace, *s))
s++;
if(q)
*q = s;
ret = *s;
switch(*s){
5d0: 80 f9 7c cmp $0x7c,%cl
5d3: 74 96 je 56b <gettoken+0xbb>
5d5: eb a3 jmp 57a <gettoken+0xca>
5d7: 89 f6 mov %esi,%esi
5d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
break;
case '>':
s++;
if(*s == '>'){
ret = '+';
s++;
5e0: 83 c7 02 add $0x2,%edi
s++;
break;
case '>':
s++;
if(*s == '>'){
ret = '+';
5e3: be 2b 00 00 00 mov $0x2b,%esi
5e8: e9 25 ff ff ff jmp 512 <gettoken+0x62>
5ed: 8d 76 00 lea 0x0(%esi),%esi
while(s < es && strchr(whitespace, *s))
s++;
if(q)
*q = s;
ret = *s;
switch(*s){
5f0: 80 f9 26 cmp $0x26,%cl
5f3: 75 85 jne 57a <gettoken+0xca>
5f5: e9 71 ff ff ff jmp 56b <gettoken+0xbb>
5fa: 89 df mov %ebx,%edi
ret = 'a';
while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s))
s++;
break;
}
if(eq)
5fc: 8b 45 14 mov 0x14(%ebp),%eax
5ff: be 61 00 00 00 mov $0x61,%esi
604: 85 c0 test %eax,%eax
606: 0f 85 0d ff ff ff jne 519 <gettoken+0x69>
60c: e9 36 ff ff ff jmp 547 <gettoken+0x97>
611: eb 0d jmp 620 <peek>
613: 90 nop
614: 90 nop
615: 90 nop
616: 90 nop
617: 90 nop
618: 90 nop
619: 90 nop
61a: 90 nop
61b: 90 nop
61c: 90 nop
61d: 90 nop
61e: 90 nop
61f: 90 nop
00000620 <peek>:
return ret;
}
int
peek(char **ps, char *es, char *toks)
{
620: 55 push %ebp
621: 89 e5 mov %esp,%ebp
623: 57 push %edi
624: 56 push %esi
625: 53 push %ebx
626: 83 ec 0c sub $0xc,%esp
629: 8b 7d 08 mov 0x8(%ebp),%edi
62c: 8b 75 0c mov 0xc(%ebp),%esi
char *s;
s = *ps;
62f: 8b 1f mov (%edi),%ebx
while(s < es && strchr(whitespace, *s))
631: 39 f3 cmp %esi,%ebx
633: 72 12 jb 647 <peek+0x27>
635: eb 28 jmp 65f <peek+0x3f>
637: 89 f6 mov %esi,%esi
639: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
s++;
640: 83 c3 01 add $0x1,%ebx
peek(char **ps, char *es, char *toks)
{
char *s;
s = *ps;
while(s < es && strchr(whitespace, *s))
643: 39 de cmp %ebx,%esi
645: 74 18 je 65f <peek+0x3f>
647: 0f be 03 movsbl (%ebx),%eax
64a: 83 ec 08 sub $0x8,%esp
64d: 50 push %eax
64e: 68 6c 18 00 00 push $0x186c
653: e8 88 05 00 00 call be0 <strchr>
658: 83 c4 10 add $0x10,%esp
65b: 85 c0 test %eax,%eax
65d: 75 e1 jne 640 <peek+0x20>
s++;
*ps = s;
65f: 89 1f mov %ebx,(%edi)
return *s && strchr(toks, *s);
661: 0f be 13 movsbl (%ebx),%edx
664: 31 c0 xor %eax,%eax
666: 84 d2 test %dl,%dl
668: 74 17 je 681 <peek+0x61>
66a: 83 ec 08 sub $0x8,%esp
66d: 52 push %edx
66e: ff 75 10 pushl 0x10(%ebp)
671: e8 6a 05 00 00 call be0 <strchr>
676: 83 c4 10 add $0x10,%esp
679: 85 c0 test %eax,%eax
67b: 0f 95 c0 setne %al
67e: 0f b6 c0 movzbl %al,%eax
}
681: 8d 65 f4 lea -0xc(%ebp),%esp
684: 5b pop %ebx
685: 5e pop %esi
686: 5f pop %edi
687: 5d pop %ebp
688: c3 ret
689: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000690 <parseredirs>:
return cmd;
}
struct cmd*
parseredirs(struct cmd *cmd, char **ps, char *es)
{
690: 55 push %ebp
691: 89 e5 mov %esp,%ebp
693: 57 push %edi
694: 56 push %esi
695: 53 push %ebx
696: 83 ec 1c sub $0x1c,%esp
699: 8b 75 0c mov 0xc(%ebp),%esi
69c: 8b 5d 10 mov 0x10(%ebp),%ebx
69f: 90 nop
int tok;
char *q, *eq;
while(peek(ps, es, "<>")){
6a0: 83 ec 04 sub $0x4,%esp
6a3: 68 11 12 00 00 push $0x1211
6a8: 53 push %ebx
6a9: 56 push %esi
6aa: e8 71 ff ff ff call 620 <peek>
6af: 83 c4 10 add $0x10,%esp
6b2: 85 c0 test %eax,%eax
6b4: 74 6a je 720 <parseredirs+0x90>
tok = gettoken(ps, es, 0, 0);
6b6: 6a 00 push $0x0
6b8: 6a 00 push $0x0
6ba: 53 push %ebx
6bb: 56 push %esi
6bc: e8 ef fd ff ff call 4b0 <gettoken>
6c1: 89 c7 mov %eax,%edi
if(gettoken(ps, es, &q, &eq) != 'a')
6c3: 8d 45 e4 lea -0x1c(%ebp),%eax
6c6: 50 push %eax
6c7: 8d 45 e0 lea -0x20(%ebp),%eax
6ca: 50 push %eax
6cb: 53 push %ebx
6cc: 56 push %esi
6cd: e8 de fd ff ff call 4b0 <gettoken>
6d2: 83 c4 20 add $0x20,%esp
6d5: 83 f8 61 cmp $0x61,%eax
6d8: 75 51 jne 72b <parseredirs+0x9b>
panic("missing file for redirection");
switch(tok){
6da: 83 ff 3c cmp $0x3c,%edi
6dd: 74 31 je 710 <parseredirs+0x80>
6df: 83 ff 3e cmp $0x3e,%edi
6e2: 74 05 je 6e9 <parseredirs+0x59>
6e4: 83 ff 2b cmp $0x2b,%edi
6e7: 75 b7 jne 6a0 <parseredirs+0x10>
break;
case '>':
cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1);
break;
case '+': // >>
cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1);
6e9: 83 ec 0c sub $0xc,%esp
6ec: 6a 01 push $0x1
6ee: 68 01 02 00 00 push $0x201
6f3: ff 75 e4 pushl -0x1c(%ebp)
6f6: ff 75 e0 pushl -0x20(%ebp)
6f9: ff 75 08 pushl 0x8(%ebp)
6fc: e8 af fc ff ff call 3b0 <redircmd>
break;
701: 83 c4 20 add $0x20,%esp
break;
case '>':
cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1);
break;
case '+': // >>
cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1);
704: 89 45 08 mov %eax,0x8(%ebp)
break;
707: eb 97 jmp 6a0 <parseredirs+0x10>
709: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
tok = gettoken(ps, es, 0, 0);
if(gettoken(ps, es, &q, &eq) != 'a')
panic("missing file for redirection");
switch(tok){
case '<':
cmd = redircmd(cmd, q, eq, O_RDONLY, 0);
710: 83 ec 0c sub $0xc,%esp
713: 6a 00 push $0x0
715: 6a 00 push $0x0
717: eb da jmp 6f3 <parseredirs+0x63>
719: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1);
break;
}
}
return cmd;
}
720: 8b 45 08 mov 0x8(%ebp),%eax
723: 8d 65 f4 lea -0xc(%ebp),%esp
726: 5b pop %ebx
727: 5e pop %esi
728: 5f pop %edi
729: 5d pop %ebp
72a: c3 ret
char *q, *eq;
while(peek(ps, es, "<>")){
tok = gettoken(ps, es, 0, 0);
if(gettoken(ps, es, &q, &eq) != 'a')
panic("missing file for redirection");
72b: 83 ec 0c sub $0xc,%esp
72e: 68 f4 11 00 00 push $0x11f4
733: e8 28 fa ff ff call 160 <panic>
738: 90 nop
739: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000740 <parseexec>:
return cmd;
}
struct cmd*
parseexec(char **ps, char *es)
{
740: 55 push %ebp
741: 89 e5 mov %esp,%ebp
743: 57 push %edi
744: 56 push %esi
745: 53 push %ebx
746: 83 ec 30 sub $0x30,%esp
749: 8b 75 08 mov 0x8(%ebp),%esi
74c: 8b 7d 0c mov 0xc(%ebp),%edi
char *q, *eq;
int tok, argc;
struct execcmd *cmd;
struct cmd *ret;
if(peek(ps, es, "("))
74f: 68 14 12 00 00 push $0x1214
754: 57 push %edi
755: 56 push %esi
756: e8 c5 fe ff ff call 620 <peek>
75b: 83 c4 10 add $0x10,%esp
75e: 85 c0 test %eax,%eax
760: 0f 85 9a 00 00 00 jne 800 <parseexec+0xc0>
return parseblock(ps, es);
ret = execcmd();
766: e8 15 fc ff ff call 380 <execcmd>
cmd = (struct execcmd*)ret;
argc = 0;
ret = parseredirs(ret, ps, es);
76b: 83 ec 04 sub $0x4,%esp
struct cmd *ret;
if(peek(ps, es, "("))
return parseblock(ps, es);
ret = execcmd();
76e: 89 c3 mov %eax,%ebx
770: 89 45 cc mov %eax,-0x34(%ebp)
cmd = (struct execcmd*)ret;
argc = 0;
ret = parseredirs(ret, ps, es);
773: 57 push %edi
774: 56 push %esi
775: 8d 5b 04 lea 0x4(%ebx),%ebx
778: 50 push %eax
779: e8 12 ff ff ff call 690 <parseredirs>
77e: 83 c4 10 add $0x10,%esp
781: 89 45 d0 mov %eax,-0x30(%ebp)
return parseblock(ps, es);
ret = execcmd();
cmd = (struct execcmd*)ret;
argc = 0;
784: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp)
78b: eb 16 jmp 7a3 <parseexec+0x63>
78d: 8d 76 00 lea 0x0(%esi),%esi
cmd->argv[argc] = q;
cmd->eargv[argc] = eq;
argc++;
if(argc >= MAXARGS)
panic("too many args");
ret = parseredirs(ret, ps, es);
790: 83 ec 04 sub $0x4,%esp
793: 57 push %edi
794: 56 push %esi
795: ff 75 d0 pushl -0x30(%ebp)
798: e8 f3 fe ff ff call 690 <parseredirs>
79d: 83 c4 10 add $0x10,%esp
7a0: 89 45 d0 mov %eax,-0x30(%ebp)
ret = execcmd();
cmd = (struct execcmd*)ret;
argc = 0;
ret = parseredirs(ret, ps, es);
while(!peek(ps, es, "|)&;")){
7a3: 83 ec 04 sub $0x4,%esp
7a6: 68 2b 12 00 00 push $0x122b
7ab: 57 push %edi
7ac: 56 push %esi
7ad: e8 6e fe ff ff call 620 <peek>
7b2: 83 c4 10 add $0x10,%esp
7b5: 85 c0 test %eax,%eax
7b7: 75 5f jne 818 <parseexec+0xd8>
if((tok=gettoken(ps, es, &q, &eq)) == 0)
7b9: 8d 45 e4 lea -0x1c(%ebp),%eax
7bc: 50 push %eax
7bd: 8d 45 e0 lea -0x20(%ebp),%eax
7c0: 50 push %eax
7c1: 57 push %edi
7c2: 56 push %esi
7c3: e8 e8 fc ff ff call 4b0 <gettoken>
7c8: 83 c4 10 add $0x10,%esp
7cb: 85 c0 test %eax,%eax
7cd: 74 49 je 818 <parseexec+0xd8>
break;
if(tok != 'a')
7cf: 83 f8 61 cmp $0x61,%eax
7d2: 75 66 jne 83a <parseexec+0xfa>
panic("syntax");
cmd->argv[argc] = q;
7d4: 8b 45 e0 mov -0x20(%ebp),%eax
cmd->eargv[argc] = eq;
argc++;
7d7: 83 45 d4 01 addl $0x1,-0x2c(%ebp)
7db: 83 c3 04 add $0x4,%ebx
while(!peek(ps, es, "|)&;")){
if((tok=gettoken(ps, es, &q, &eq)) == 0)
break;
if(tok != 'a')
panic("syntax");
cmd->argv[argc] = q;
7de: 89 43 fc mov %eax,-0x4(%ebx)
cmd->eargv[argc] = eq;
7e1: 8b 45 e4 mov -0x1c(%ebp),%eax
7e4: 89 43 24 mov %eax,0x24(%ebx)
argc++;
7e7: 8b 45 d4 mov -0x2c(%ebp),%eax
if(argc >= MAXARGS)
7ea: 83 f8 0a cmp $0xa,%eax
7ed: 75 a1 jne 790 <parseexec+0x50>
panic("too many args");
7ef: 83 ec 0c sub $0xc,%esp
7f2: 68 1d 12 00 00 push $0x121d
7f7: e8 64 f9 ff ff call 160 <panic>
7fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int tok, argc;
struct execcmd *cmd;
struct cmd *ret;
if(peek(ps, es, "("))
return parseblock(ps, es);
800: 83 ec 08 sub $0x8,%esp
803: 57 push %edi
804: 56 push %esi
805: e8 56 01 00 00 call 960 <parseblock>
80a: 83 c4 10 add $0x10,%esp
ret = parseredirs(ret, ps, es);
}
cmd->argv[argc] = 0;
cmd->eargv[argc] = 0;
return ret;
}
80d: 8d 65 f4 lea -0xc(%ebp),%esp
810: 5b pop %ebx
811: 5e pop %esi
812: 5f pop %edi
813: 5d pop %ebp
814: c3 ret
815: 8d 76 00 lea 0x0(%esi),%esi
818: 8b 45 cc mov -0x34(%ebp),%eax
81b: 8b 55 d4 mov -0x2c(%ebp),%edx
81e: 8d 04 90 lea (%eax,%edx,4),%eax
argc++;
if(argc >= MAXARGS)
panic("too many args");
ret = parseredirs(ret, ps, es);
}
cmd->argv[argc] = 0;
821: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
cmd->eargv[argc] = 0;
828: c7 40 2c 00 00 00 00 movl $0x0,0x2c(%eax)
82f: 8b 45 d0 mov -0x30(%ebp),%eax
return ret;
}
832: 8d 65 f4 lea -0xc(%ebp),%esp
835: 5b pop %ebx
836: 5e pop %esi
837: 5f pop %edi
838: 5d pop %ebp
839: c3 ret
ret = parseredirs(ret, ps, es);
while(!peek(ps, es, "|)&;")){
if((tok=gettoken(ps, es, &q, &eq)) == 0)
break;
if(tok != 'a')
panic("syntax");
83a: 83 ec 0c sub $0xc,%esp
83d: 68 16 12 00 00 push $0x1216
842: e8 19 f9 ff ff call 160 <panic>
847: 89 f6 mov %esi,%esi
849: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000850 <parsepipe>:
return cmd;
}
struct cmd*
parsepipe(char **ps, char *es)
{
850: 55 push %ebp
851: 89 e5 mov %esp,%ebp
853: 57 push %edi
854: 56 push %esi
855: 53 push %ebx
856: 83 ec 14 sub $0x14,%esp
859: 8b 5d 08 mov 0x8(%ebp),%ebx
85c: 8b 75 0c mov 0xc(%ebp),%esi
struct cmd *cmd;
cmd = parseexec(ps, es);
85f: 56 push %esi
860: 53 push %ebx
861: e8 da fe ff ff call 740 <parseexec>
if(peek(ps, es, "|")){
866: 83 c4 0c add $0xc,%esp
struct cmd*
parsepipe(char **ps, char *es)
{
struct cmd *cmd;
cmd = parseexec(ps, es);
869: 89 c7 mov %eax,%edi
if(peek(ps, es, "|")){
86b: 68 30 12 00 00 push $0x1230
870: 56 push %esi
871: 53 push %ebx
872: e8 a9 fd ff ff call 620 <peek>
877: 83 c4 10 add $0x10,%esp
87a: 85 c0 test %eax,%eax
87c: 75 12 jne 890 <parsepipe+0x40>
gettoken(ps, es, 0, 0);
cmd = pipecmd(cmd, parsepipe(ps, es));
}
return cmd;
}
87e: 8d 65 f4 lea -0xc(%ebp),%esp
881: 89 f8 mov %edi,%eax
883: 5b pop %ebx
884: 5e pop %esi
885: 5f pop %edi
886: 5d pop %ebp
887: c3 ret
888: 90 nop
889: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
{
struct cmd *cmd;
cmd = parseexec(ps, es);
if(peek(ps, es, "|")){
gettoken(ps, es, 0, 0);
890: 6a 00 push $0x0
892: 6a 00 push $0x0
894: 56 push %esi
895: 53 push %ebx
896: e8 15 fc ff ff call 4b0 <gettoken>
cmd = pipecmd(cmd, parsepipe(ps, es));
89b: 58 pop %eax
89c: 5a pop %edx
89d: 56 push %esi
89e: 53 push %ebx
89f: e8 ac ff ff ff call 850 <parsepipe>
8a4: 89 7d 08 mov %edi,0x8(%ebp)
8a7: 89 45 0c mov %eax,0xc(%ebp)
8aa: 83 c4 10 add $0x10,%esp
}
return cmd;
}
8ad: 8d 65 f4 lea -0xc(%ebp),%esp
8b0: 5b pop %ebx
8b1: 5e pop %esi
8b2: 5f pop %edi
8b3: 5d pop %ebp
struct cmd *cmd;
cmd = parseexec(ps, es);
if(peek(ps, es, "|")){
gettoken(ps, es, 0, 0);
cmd = pipecmd(cmd, parsepipe(ps, es));
8b4: e9 47 fb ff ff jmp 400 <pipecmd>
8b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000008c0 <parseline>:
return cmd;
}
struct cmd*
parseline(char **ps, char *es)
{
8c0: 55 push %ebp
8c1: 89 e5 mov %esp,%ebp
8c3: 57 push %edi
8c4: 56 push %esi
8c5: 53 push %ebx
8c6: 83 ec 14 sub $0x14,%esp
8c9: 8b 5d 08 mov 0x8(%ebp),%ebx
8cc: 8b 75 0c mov 0xc(%ebp),%esi
struct cmd *cmd;
cmd = parsepipe(ps, es);
8cf: 56 push %esi
8d0: 53 push %ebx
8d1: e8 7a ff ff ff call 850 <parsepipe>
while(peek(ps, es, "&")){
8d6: 83 c4 10 add $0x10,%esp
struct cmd*
parseline(char **ps, char *es)
{
struct cmd *cmd;
cmd = parsepipe(ps, es);
8d9: 89 c7 mov %eax,%edi
while(peek(ps, es, "&")){
8db: eb 1b jmp 8f8 <parseline+0x38>
8dd: 8d 76 00 lea 0x0(%esi),%esi
gettoken(ps, es, 0, 0);
8e0: 6a 00 push $0x0
8e2: 6a 00 push $0x0
8e4: 56 push %esi
8e5: 53 push %ebx
8e6: e8 c5 fb ff ff call 4b0 <gettoken>
cmd = backcmd(cmd);
8eb: 89 3c 24 mov %edi,(%esp)
8ee: e8 8d fb ff ff call 480 <backcmd>
8f3: 83 c4 10 add $0x10,%esp
8f6: 89 c7 mov %eax,%edi
parseline(char **ps, char *es)
{
struct cmd *cmd;
cmd = parsepipe(ps, es);
while(peek(ps, es, "&")){
8f8: 83 ec 04 sub $0x4,%esp
8fb: 68 32 12 00 00 push $0x1232
900: 56 push %esi
901: 53 push %ebx
902: e8 19 fd ff ff call 620 <peek>
907: 83 c4 10 add $0x10,%esp
90a: 85 c0 test %eax,%eax
90c: 75 d2 jne 8e0 <parseline+0x20>
gettoken(ps, es, 0, 0);
cmd = backcmd(cmd);
}
if(peek(ps, es, ";")){
90e: 83 ec 04 sub $0x4,%esp
911: 68 2e 12 00 00 push $0x122e
916: 56 push %esi
917: 53 push %ebx
918: e8 03 fd ff ff call 620 <peek>
91d: 83 c4 10 add $0x10,%esp
920: 85 c0 test %eax,%eax
922: 75 0c jne 930 <parseline+0x70>
gettoken(ps, es, 0, 0);
cmd = listcmd(cmd, parseline(ps, es));
}
return cmd;
}
924: 8d 65 f4 lea -0xc(%ebp),%esp
927: 89 f8 mov %edi,%eax
929: 5b pop %ebx
92a: 5e pop %esi
92b: 5f pop %edi
92c: 5d pop %ebp
92d: c3 ret
92e: 66 90 xchg %ax,%ax
while(peek(ps, es, "&")){
gettoken(ps, es, 0, 0);
cmd = backcmd(cmd);
}
if(peek(ps, es, ";")){
gettoken(ps, es, 0, 0);
930: 6a 00 push $0x0
932: 6a 00 push $0x0
934: 56 push %esi
935: 53 push %ebx
936: e8 75 fb ff ff call 4b0 <gettoken>
cmd = listcmd(cmd, parseline(ps, es));
93b: 58 pop %eax
93c: 5a pop %edx
93d: 56 push %esi
93e: 53 push %ebx
93f: e8 7c ff ff ff call 8c0 <parseline>
944: 89 7d 08 mov %edi,0x8(%ebp)
947: 89 45 0c mov %eax,0xc(%ebp)
94a: 83 c4 10 add $0x10,%esp
}
return cmd;
}
94d: 8d 65 f4 lea -0xc(%ebp),%esp
950: 5b pop %ebx
951: 5e pop %esi
952: 5f pop %edi
953: 5d pop %ebp
gettoken(ps, es, 0, 0);
cmd = backcmd(cmd);
}
if(peek(ps, es, ";")){
gettoken(ps, es, 0, 0);
cmd = listcmd(cmd, parseline(ps, es));
954: e9 e7 fa ff ff jmp 440 <listcmd>
959: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000960 <parseblock>:
return cmd;
}
struct cmd*
parseblock(char **ps, char *es)
{
960: 55 push %ebp
961: 89 e5 mov %esp,%ebp
963: 57 push %edi
964: 56 push %esi
965: 53 push %ebx
966: 83 ec 10 sub $0x10,%esp
969: 8b 5d 08 mov 0x8(%ebp),%ebx
96c: 8b 75 0c mov 0xc(%ebp),%esi
struct cmd *cmd;
if(!peek(ps, es, "("))
96f: 68 14 12 00 00 push $0x1214
974: 56 push %esi
975: 53 push %ebx
976: e8 a5 fc ff ff call 620 <peek>
97b: 83 c4 10 add $0x10,%esp
97e: 85 c0 test %eax,%eax
980: 74 4a je 9cc <parseblock+0x6c>
panic("parseblock");
gettoken(ps, es, 0, 0);
982: 6a 00 push $0x0
984: 6a 00 push $0x0
986: 56 push %esi
987: 53 push %ebx
988: e8 23 fb ff ff call 4b0 <gettoken>
cmd = parseline(ps, es);
98d: 58 pop %eax
98e: 5a pop %edx
98f: 56 push %esi
990: 53 push %ebx
991: e8 2a ff ff ff call 8c0 <parseline>
if(!peek(ps, es, ")"))
996: 83 c4 0c add $0xc,%esp
struct cmd *cmd;
if(!peek(ps, es, "("))
panic("parseblock");
gettoken(ps, es, 0, 0);
cmd = parseline(ps, es);
999: 89 c7 mov %eax,%edi
if(!peek(ps, es, ")"))
99b: 68 50 12 00 00 push $0x1250
9a0: 56 push %esi
9a1: 53 push %ebx
9a2: e8 79 fc ff ff call 620 <peek>
9a7: 83 c4 10 add $0x10,%esp
9aa: 85 c0 test %eax,%eax
9ac: 74 2b je 9d9 <parseblock+0x79>
panic("syntax - missing )");
gettoken(ps, es, 0, 0);
9ae: 6a 00 push $0x0
9b0: 6a 00 push $0x0
9b2: 56 push %esi
9b3: 53 push %ebx
9b4: e8 f7 fa ff ff call 4b0 <gettoken>
cmd = parseredirs(cmd, ps, es);
9b9: 83 c4 0c add $0xc,%esp
9bc: 56 push %esi
9bd: 53 push %ebx
9be: 57 push %edi
9bf: e8 cc fc ff ff call 690 <parseredirs>
return cmd;
}
9c4: 8d 65 f4 lea -0xc(%ebp),%esp
9c7: 5b pop %ebx
9c8: 5e pop %esi
9c9: 5f pop %edi
9ca: 5d pop %ebp
9cb: c3 ret
parseblock(char **ps, char *es)
{
struct cmd *cmd;
if(!peek(ps, es, "("))
panic("parseblock");
9cc: 83 ec 0c sub $0xc,%esp
9cf: 68 34 12 00 00 push $0x1234
9d4: e8 87 f7 ff ff call 160 <panic>
gettoken(ps, es, 0, 0);
cmd = parseline(ps, es);
if(!peek(ps, es, ")"))
panic("syntax - missing )");
9d9: 83 ec 0c sub $0xc,%esp
9dc: 68 3f 12 00 00 push $0x123f
9e1: e8 7a f7 ff ff call 160 <panic>
9e6: 8d 76 00 lea 0x0(%esi),%esi
9e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000009f0 <nulterminate>:
}
// NUL-terminate all the counted strings.
struct cmd*
nulterminate(struct cmd *cmd)
{
9f0: 55 push %ebp
9f1: 89 e5 mov %esp,%ebp
9f3: 53 push %ebx
9f4: 83 ec 04 sub $0x4,%esp
9f7: 8b 5d 08 mov 0x8(%ebp),%ebx
struct execcmd *ecmd;
struct listcmd *lcmd;
struct pipecmd *pcmd;
struct redircmd *rcmd;
if(cmd == 0)
9fa: 85 db test %ebx,%ebx
9fc: 0f 84 96 00 00 00 je a98 <nulterminate+0xa8>
return 0;
switch(cmd->type){
a02: 83 3b 05 cmpl $0x5,(%ebx)
a05: 77 48 ja a4f <nulterminate+0x5f>
a07: 8b 03 mov (%ebx),%eax
a09: ff 24 85 90 12 00 00 jmp *0x1290(,%eax,4)
nulterminate(pcmd->right);
break;
case LIST:
lcmd = (struct listcmd*)cmd;
nulterminate(lcmd->left);
a10: 83 ec 0c sub $0xc,%esp
a13: ff 73 04 pushl 0x4(%ebx)
a16: e8 d5 ff ff ff call 9f0 <nulterminate>
nulterminate(lcmd->right);
a1b: 58 pop %eax
a1c: ff 73 08 pushl 0x8(%ebx)
a1f: e8 cc ff ff ff call 9f0 <nulterminate>
break;
a24: 83 c4 10 add $0x10,%esp
a27: 89 d8 mov %ebx,%eax
bcmd = (struct backcmd*)cmd;
nulterminate(bcmd->cmd);
break;
}
return cmd;
}
a29: 8b 5d fc mov -0x4(%ebp),%ebx
a2c: c9 leave
a2d: c3 ret
a2e: 66 90 xchg %ax,%ax
return 0;
switch(cmd->type){
case EXEC:
ecmd = (struct execcmd*)cmd;
for(i=0; ecmd->argv[i]; i++)
a30: 8b 4b 04 mov 0x4(%ebx),%ecx
a33: 8d 43 2c lea 0x2c(%ebx),%eax
a36: 85 c9 test %ecx,%ecx
a38: 74 15 je a4f <nulterminate+0x5f>
a3a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
*ecmd->eargv[i] = 0;
a40: 8b 10 mov (%eax),%edx
a42: 83 c0 04 add $0x4,%eax
a45: c6 02 00 movb $0x0,(%edx)
return 0;
switch(cmd->type){
case EXEC:
ecmd = (struct execcmd*)cmd;
for(i=0; ecmd->argv[i]; i++)
a48: 8b 50 d8 mov -0x28(%eax),%edx
a4b: 85 d2 test %edx,%edx
a4d: 75 f1 jne a40 <nulterminate+0x50>
struct redircmd *rcmd;
if(cmd == 0)
return 0;
switch(cmd->type){
a4f: 89 d8 mov %ebx,%eax
bcmd = (struct backcmd*)cmd;
nulterminate(bcmd->cmd);
break;
}
return cmd;
}
a51: 8b 5d fc mov -0x4(%ebp),%ebx
a54: c9 leave
a55: c3 ret
a56: 8d 76 00 lea 0x0(%esi),%esi
a59: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
nulterminate(lcmd->right);
break;
case BACK:
bcmd = (struct backcmd*)cmd;
nulterminate(bcmd->cmd);
a60: 83 ec 0c sub $0xc,%esp
a63: ff 73 04 pushl 0x4(%ebx)
a66: e8 85 ff ff ff call 9f0 <nulterminate>
break;
a6b: 89 d8 mov %ebx,%eax
a6d: 83 c4 10 add $0x10,%esp
}
return cmd;
}
a70: 8b 5d fc mov -0x4(%ebp),%ebx
a73: c9 leave
a74: c3 ret
a75: 8d 76 00 lea 0x0(%esi),%esi
*ecmd->eargv[i] = 0;
break;
case REDIR:
rcmd = (struct redircmd*)cmd;
nulterminate(rcmd->cmd);
a78: 83 ec 0c sub $0xc,%esp
a7b: ff 73 04 pushl 0x4(%ebx)
a7e: e8 6d ff ff ff call 9f0 <nulterminate>
*rcmd->efile = 0;
a83: 8b 43 0c mov 0xc(%ebx),%eax
break;
a86: 83 c4 10 add $0x10,%esp
break;
case REDIR:
rcmd = (struct redircmd*)cmd;
nulterminate(rcmd->cmd);
*rcmd->efile = 0;
a89: c6 00 00 movb $0x0,(%eax)
break;
a8c: 89 d8 mov %ebx,%eax
bcmd = (struct backcmd*)cmd;
nulterminate(bcmd->cmd);
break;
}
return cmd;
}
a8e: 8b 5d fc mov -0x4(%ebp),%ebx
a91: c9 leave
a92: c3 ret
a93: 90 nop
a94: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
struct listcmd *lcmd;
struct pipecmd *pcmd;
struct redircmd *rcmd;
if(cmd == 0)
return 0;
a98: 31 c0 xor %eax,%eax
a9a: eb 8d jmp a29 <nulterminate+0x39>
a9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000aa0 <parsecmd>:
struct cmd *parseexec(char**, char*);
struct cmd *nulterminate(struct cmd*);
struct cmd*
parsecmd(char *s)
{
aa0: 55 push %ebp
aa1: 89 e5 mov %esp,%ebp
aa3: 56 push %esi
aa4: 53 push %ebx
char *es;
struct cmd *cmd;
es = s + strlen(s);
aa5: 8b 5d 08 mov 0x8(%ebp),%ebx
aa8: 83 ec 0c sub $0xc,%esp
aab: 53 push %ebx
aac: e8 df 00 00 00 call b90 <strlen>
cmd = parseline(&s, es);
ab1: 59 pop %ecx
parsecmd(char *s)
{
char *es;
struct cmd *cmd;
es = s + strlen(s);
ab2: 01 c3 add %eax,%ebx
cmd = parseline(&s, es);
ab4: 8d 45 08 lea 0x8(%ebp),%eax
ab7: 5e pop %esi
ab8: 53 push %ebx
ab9: 50 push %eax
aba: e8 01 fe ff ff call 8c0 <parseline>
abf: 89 c6 mov %eax,%esi
peek(&s, es, "");
ac1: 8d 45 08 lea 0x8(%ebp),%eax
ac4: 83 c4 0c add $0xc,%esp
ac7: 68 d9 11 00 00 push $0x11d9
acc: 53 push %ebx
acd: 50 push %eax
ace: e8 4d fb ff ff call 620 <peek>
if(s != es){
ad3: 8b 45 08 mov 0x8(%ebp),%eax
ad6: 83 c4 10 add $0x10,%esp
ad9: 39 c3 cmp %eax,%ebx
adb: 75 12 jne aef <parsecmd+0x4f>
printf(2, "leftovers: %s\n", s);
panic("syntax");
}
nulterminate(cmd);
add: 83 ec 0c sub $0xc,%esp
ae0: 56 push %esi
ae1: e8 0a ff ff ff call 9f0 <nulterminate>
return cmd;
}
ae6: 8d 65 f8 lea -0x8(%ebp),%esp
ae9: 89 f0 mov %esi,%eax
aeb: 5b pop %ebx
aec: 5e pop %esi
aed: 5d pop %ebp
aee: c3 ret
es = s + strlen(s);
cmd = parseline(&s, es);
peek(&s, es, "");
if(s != es){
printf(2, "leftovers: %s\n", s);
aef: 52 push %edx
af0: 50 push %eax
af1: 68 52 12 00 00 push $0x1252
af6: 6a 02 push $0x2
af8: e8 a3 03 00 00 call ea0 <printf>
panic("syntax");
afd: c7 04 24 16 12 00 00 movl $0x1216,(%esp)
b04: e8 57 f6 ff ff call 160 <panic>
b09: 66 90 xchg %ax,%ax
b0b: 66 90 xchg %ax,%ax
b0d: 66 90 xchg %ax,%ax
b0f: 90 nop
00000b10 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
b10: 55 push %ebp
b11: 89 e5 mov %esp,%ebp
b13: 53 push %ebx
b14: 8b 45 08 mov 0x8(%ebp),%eax
b17: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
b1a: 89 c2 mov %eax,%edx
b1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
b20: 83 c1 01 add $0x1,%ecx
b23: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
b27: 83 c2 01 add $0x1,%edx
b2a: 84 db test %bl,%bl
b2c: 88 5a ff mov %bl,-0x1(%edx)
b2f: 75 ef jne b20 <strcpy+0x10>
;
return os;
}
b31: 5b pop %ebx
b32: 5d pop %ebp
b33: c3 ret
b34: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
b3a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000b40 <strcmp>:
int
strcmp(const char *p, const char *q)
{
b40: 55 push %ebp
b41: 89 e5 mov %esp,%ebp
b43: 56 push %esi
b44: 53 push %ebx
b45: 8b 55 08 mov 0x8(%ebp),%edx
b48: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
b4b: 0f b6 02 movzbl (%edx),%eax
b4e: 0f b6 19 movzbl (%ecx),%ebx
b51: 84 c0 test %al,%al
b53: 75 1e jne b73 <strcmp+0x33>
b55: eb 29 jmp b80 <strcmp+0x40>
b57: 89 f6 mov %esi,%esi
b59: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
b60: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
b63: 0f b6 02 movzbl (%edx),%eax
p++, q++;
b66: 8d 71 01 lea 0x1(%ecx),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
b69: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
b6d: 84 c0 test %al,%al
b6f: 74 0f je b80 <strcmp+0x40>
b71: 89 f1 mov %esi,%ecx
b73: 38 d8 cmp %bl,%al
b75: 74 e9 je b60 <strcmp+0x20>
p++, q++;
return (uchar)*p - (uchar)*q;
b77: 29 d8 sub %ebx,%eax
}
b79: 5b pop %ebx
b7a: 5e pop %esi
b7b: 5d pop %ebp
b7c: c3 ret
b7d: 8d 76 00 lea 0x0(%esi),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
b80: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
b82: 29 d8 sub %ebx,%eax
}
b84: 5b pop %ebx
b85: 5e pop %esi
b86: 5d pop %ebp
b87: c3 ret
b88: 90 nop
b89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000b90 <strlen>:
uint
strlen(const char *s)
{
b90: 55 push %ebp
b91: 89 e5 mov %esp,%ebp
b93: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
b96: 80 39 00 cmpb $0x0,(%ecx)
b99: 74 12 je bad <strlen+0x1d>
b9b: 31 d2 xor %edx,%edx
b9d: 8d 76 00 lea 0x0(%esi),%esi
ba0: 83 c2 01 add $0x1,%edx
ba3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
ba7: 89 d0 mov %edx,%eax
ba9: 75 f5 jne ba0 <strlen+0x10>
;
return n;
}
bab: 5d pop %ebp
bac: c3 ret
uint
strlen(const char *s)
{
int n;
for(n = 0; s[n]; n++)
bad: 31 c0 xor %eax,%eax
;
return n;
}
baf: 5d pop %ebp
bb0: c3 ret
bb1: eb 0d jmp bc0 <memset>
bb3: 90 nop
bb4: 90 nop
bb5: 90 nop
bb6: 90 nop
bb7: 90 nop
bb8: 90 nop
bb9: 90 nop
bba: 90 nop
bbb: 90 nop
bbc: 90 nop
bbd: 90 nop
bbe: 90 nop
bbf: 90 nop
00000bc0 <memset>:
void*
memset(void *dst, int c, uint n)
{
bc0: 55 push %ebp
bc1: 89 e5 mov %esp,%ebp
bc3: 57 push %edi
bc4: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
bc7: 8b 4d 10 mov 0x10(%ebp),%ecx
bca: 8b 45 0c mov 0xc(%ebp),%eax
bcd: 89 d7 mov %edx,%edi
bcf: fc cld
bd0: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
bd2: 89 d0 mov %edx,%eax
bd4: 5f pop %edi
bd5: 5d pop %ebp
bd6: c3 ret
bd7: 89 f6 mov %esi,%esi
bd9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000be0 <strchr>:
char*
strchr(const char *s, char c)
{
be0: 55 push %ebp
be1: 89 e5 mov %esp,%ebp
be3: 53 push %ebx
be4: 8b 45 08 mov 0x8(%ebp),%eax
be7: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
bea: 0f b6 10 movzbl (%eax),%edx
bed: 84 d2 test %dl,%dl
bef: 74 1d je c0e <strchr+0x2e>
if(*s == c)
bf1: 38 d3 cmp %dl,%bl
bf3: 89 d9 mov %ebx,%ecx
bf5: 75 0d jne c04 <strchr+0x24>
bf7: eb 17 jmp c10 <strchr+0x30>
bf9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
c00: 38 ca cmp %cl,%dl
c02: 74 0c je c10 <strchr+0x30>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
c04: 83 c0 01 add $0x1,%eax
c07: 0f b6 10 movzbl (%eax),%edx
c0a: 84 d2 test %dl,%dl
c0c: 75 f2 jne c00 <strchr+0x20>
if(*s == c)
return (char*)s;
return 0;
c0e: 31 c0 xor %eax,%eax
}
c10: 5b pop %ebx
c11: 5d pop %ebp
c12: c3 ret
c13: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
c19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000c20 <gets>:
char*
gets(char *buf, int max)
{
c20: 55 push %ebp
c21: 89 e5 mov %esp,%ebp
c23: 57 push %edi
c24: 56 push %esi
c25: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
c26: 31 f6 xor %esi,%esi
cc = read(0, &c, 1);
c28: 8d 7d e7 lea -0x19(%ebp),%edi
return 0;
}
char*
gets(char *buf, int max)
{
c2b: 83 ec 1c sub $0x1c,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
c2e: eb 29 jmp c59 <gets+0x39>
cc = read(0, &c, 1);
c30: 83 ec 04 sub $0x4,%esp
c33: 6a 01 push $0x1
c35: 57 push %edi
c36: 6a 00 push $0x0
c38: e8 2d 01 00 00 call d6a <read>
if(cc < 1)
c3d: 83 c4 10 add $0x10,%esp
c40: 85 c0 test %eax,%eax
c42: 7e 1d jle c61 <gets+0x41>
break;
buf[i++] = c;
c44: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
c48: 8b 55 08 mov 0x8(%ebp),%edx
c4b: 89 de mov %ebx,%esi
if(c == '\n' || c == '\r')
c4d: 3c 0a cmp $0xa,%al
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
c4f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
c53: 74 1b je c70 <gets+0x50>
c55: 3c 0d cmp $0xd,%al
c57: 74 17 je c70 <gets+0x50>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
c59: 8d 5e 01 lea 0x1(%esi),%ebx
c5c: 3b 5d 0c cmp 0xc(%ebp),%ebx
c5f: 7c cf jl c30 <gets+0x10>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
c61: 8b 45 08 mov 0x8(%ebp),%eax
c64: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
c68: 8d 65 f4 lea -0xc(%ebp),%esp
c6b: 5b pop %ebx
c6c: 5e pop %esi
c6d: 5f pop %edi
c6e: 5d pop %ebp
c6f: c3 ret
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
c70: 8b 45 08 mov 0x8(%ebp),%eax
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
c73: 89 de mov %ebx,%esi
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
c75: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
c79: 8d 65 f4 lea -0xc(%ebp),%esp
c7c: 5b pop %ebx
c7d: 5e pop %esi
c7e: 5f pop %edi
c7f: 5d pop %ebp
c80: c3 ret
c81: eb 0d jmp c90 <stat>
c83: 90 nop
c84: 90 nop
c85: 90 nop
c86: 90 nop
c87: 90 nop
c88: 90 nop
c89: 90 nop
c8a: 90 nop
c8b: 90 nop
c8c: 90 nop
c8d: 90 nop
c8e: 90 nop
c8f: 90 nop
00000c90 <stat>:
int
stat(const char *n, struct stat *st)
{
c90: 55 push %ebp
c91: 89 e5 mov %esp,%ebp
c93: 56 push %esi
c94: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
c95: 83 ec 08 sub $0x8,%esp
c98: 6a 00 push $0x0
c9a: ff 75 08 pushl 0x8(%ebp)
c9d: e8 f0 00 00 00 call d92 <open>
if(fd < 0)
ca2: 83 c4 10 add $0x10,%esp
ca5: 85 c0 test %eax,%eax
ca7: 78 27 js cd0 <stat+0x40>
return -1;
r = fstat(fd, st);
ca9: 83 ec 08 sub $0x8,%esp
cac: ff 75 0c pushl 0xc(%ebp)
caf: 89 c3 mov %eax,%ebx
cb1: 50 push %eax
cb2: e8 f3 00 00 00 call daa <fstat>
cb7: 89 c6 mov %eax,%esi
close(fd);
cb9: 89 1c 24 mov %ebx,(%esp)
cbc: e8 b9 00 00 00 call d7a <close>
return r;
cc1: 83 c4 10 add $0x10,%esp
cc4: 89 f0 mov %esi,%eax
}
cc6: 8d 65 f8 lea -0x8(%ebp),%esp
cc9: 5b pop %ebx
cca: 5e pop %esi
ccb: 5d pop %ebp
ccc: c3 ret
ccd: 8d 76 00 lea 0x0(%esi),%esi
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
cd0: b8 ff ff ff ff mov $0xffffffff,%eax
cd5: eb ef jmp cc6 <stat+0x36>
cd7: 89 f6 mov %esi,%esi
cd9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000ce0 <atoi>:
return r;
}
int
atoi(const char *s)
{
ce0: 55 push %ebp
ce1: 89 e5 mov %esp,%ebp
ce3: 53 push %ebx
ce4: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
ce7: 0f be 11 movsbl (%ecx),%edx
cea: 8d 42 d0 lea -0x30(%edx),%eax
ced: 3c 09 cmp $0x9,%al
cef: b8 00 00 00 00 mov $0x0,%eax
cf4: 77 1f ja d15 <atoi+0x35>
cf6: 8d 76 00 lea 0x0(%esi),%esi
cf9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
d00: 8d 04 80 lea (%eax,%eax,4),%eax
d03: 83 c1 01 add $0x1,%ecx
d06: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
d0a: 0f be 11 movsbl (%ecx),%edx
d0d: 8d 5a d0 lea -0x30(%edx),%ebx
d10: 80 fb 09 cmp $0x9,%bl
d13: 76 eb jbe d00 <atoi+0x20>
n = n*10 + *s++ - '0';
return n;
}
d15: 5b pop %ebx
d16: 5d pop %ebp
d17: c3 ret
d18: 90 nop
d19: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000d20 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
d20: 55 push %ebp
d21: 89 e5 mov %esp,%ebp
d23: 56 push %esi
d24: 53 push %ebx
d25: 8b 5d 10 mov 0x10(%ebp),%ebx
d28: 8b 45 08 mov 0x8(%ebp),%eax
d2b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
d2e: 85 db test %ebx,%ebx
d30: 7e 14 jle d46 <memmove+0x26>
d32: 31 d2 xor %edx,%edx
d34: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
d38: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
d3c: 88 0c 10 mov %cl,(%eax,%edx,1)
d3f: 83 c2 01 add $0x1,%edx
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
d42: 39 da cmp %ebx,%edx
d44: 75 f2 jne d38 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
d46: 5b pop %ebx
d47: 5e pop %esi
d48: 5d pop %ebp
d49: c3 ret
00000d4a <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
d4a: b8 01 00 00 00 mov $0x1,%eax
d4f: cd 40 int $0x40
d51: c3 ret
00000d52 <exit>:
SYSCALL(exit)
d52: b8 02 00 00 00 mov $0x2,%eax
d57: cd 40 int $0x40
d59: c3 ret
00000d5a <wait>:
SYSCALL(wait)
d5a: b8 03 00 00 00 mov $0x3,%eax
d5f: cd 40 int $0x40
d61: c3 ret
00000d62 <pipe>:
SYSCALL(pipe)
d62: b8 04 00 00 00 mov $0x4,%eax
d67: cd 40 int $0x40
d69: c3 ret
00000d6a <read>:
SYSCALL(read)
d6a: b8 05 00 00 00 mov $0x5,%eax
d6f: cd 40 int $0x40
d71: c3 ret
00000d72 <write>:
SYSCALL(write)
d72: b8 10 00 00 00 mov $0x10,%eax
d77: cd 40 int $0x40
d79: c3 ret
00000d7a <close>:
SYSCALL(close)
d7a: b8 15 00 00 00 mov $0x15,%eax
d7f: cd 40 int $0x40
d81: c3 ret
00000d82 <kill>:
SYSCALL(kill)
d82: b8 06 00 00 00 mov $0x6,%eax
d87: cd 40 int $0x40
d89: c3 ret
00000d8a <exec>:
SYSCALL(exec)
d8a: b8 07 00 00 00 mov $0x7,%eax
d8f: cd 40 int $0x40
d91: c3 ret
00000d92 <open>:
SYSCALL(open)
d92: b8 0f 00 00 00 mov $0xf,%eax
d97: cd 40 int $0x40
d99: c3 ret
00000d9a <mknod>:
SYSCALL(mknod)
d9a: b8 11 00 00 00 mov $0x11,%eax
d9f: cd 40 int $0x40
da1: c3 ret
00000da2 <unlink>:
SYSCALL(unlink)
da2: b8 12 00 00 00 mov $0x12,%eax
da7: cd 40 int $0x40
da9: c3 ret
00000daa <fstat>:
SYSCALL(fstat)
daa: b8 08 00 00 00 mov $0x8,%eax
daf: cd 40 int $0x40
db1: c3 ret
00000db2 <link>:
SYSCALL(link)
db2: b8 13 00 00 00 mov $0x13,%eax
db7: cd 40 int $0x40
db9: c3 ret
00000dba <mkdir>:
SYSCALL(mkdir)
dba: b8 14 00 00 00 mov $0x14,%eax
dbf: cd 40 int $0x40
dc1: c3 ret
00000dc2 <chdir>:
SYSCALL(chdir)
dc2: b8 09 00 00 00 mov $0x9,%eax
dc7: cd 40 int $0x40
dc9: c3 ret
00000dca <dup>:
SYSCALL(dup)
dca: b8 0a 00 00 00 mov $0xa,%eax
dcf: cd 40 int $0x40
dd1: c3 ret
00000dd2 <getpid>:
SYSCALL(getpid)
dd2: b8 0b 00 00 00 mov $0xb,%eax
dd7: cd 40 int $0x40
dd9: c3 ret
00000dda <sbrk>:
SYSCALL(sbrk)
dda: b8 0c 00 00 00 mov $0xc,%eax
ddf: cd 40 int $0x40
de1: c3 ret
00000de2 <sleep>:
SYSCALL(sleep)
de2: b8 0d 00 00 00 mov $0xd,%eax
de7: cd 40 int $0x40
de9: c3 ret
00000dea <uptime>:
SYSCALL(uptime)
dea: b8 0e 00 00 00 mov $0xe,%eax
def: cd 40 int $0x40
df1: c3 ret
df2: 66 90 xchg %ax,%ax
df4: 66 90 xchg %ax,%ax
df6: 66 90 xchg %ax,%ax
df8: 66 90 xchg %ax,%ax
dfa: 66 90 xchg %ax,%ax
dfc: 66 90 xchg %ax,%ax
dfe: 66 90 xchg %ax,%ax
00000e00 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
e00: 55 push %ebp
e01: 89 e5 mov %esp,%ebp
e03: 57 push %edi
e04: 56 push %esi
e05: 53 push %ebx
e06: 89 c6 mov %eax,%esi
e08: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
e0b: 8b 5d 08 mov 0x8(%ebp),%ebx
e0e: 85 db test %ebx,%ebx
e10: 74 7e je e90 <printint+0x90>
e12: 89 d0 mov %edx,%eax
e14: c1 e8 1f shr $0x1f,%eax
e17: 84 c0 test %al,%al
e19: 74 75 je e90 <printint+0x90>
neg = 1;
x = -xx;
e1b: 89 d0 mov %edx,%eax
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
e1d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
x = -xx;
e24: f7 d8 neg %eax
e26: 89 75 c0 mov %esi,-0x40(%ebp)
} else {
x = xx;
}
i = 0;
e29: 31 ff xor %edi,%edi
e2b: 8d 5d d7 lea -0x29(%ebp),%ebx
e2e: 89 ce mov %ecx,%esi
e30: eb 08 jmp e3a <printint+0x3a>
e32: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
e38: 89 cf mov %ecx,%edi
e3a: 31 d2 xor %edx,%edx
e3c: 8d 4f 01 lea 0x1(%edi),%ecx
e3f: f7 f6 div %esi
e41: 0f b6 92 b0 12 00 00 movzbl 0x12b0(%edx),%edx
}while((x /= base) != 0);
e48: 85 c0 test %eax,%eax
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
e4a: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
e4d: 75 e9 jne e38 <printint+0x38>
if(neg)
e4f: 8b 45 c4 mov -0x3c(%ebp),%eax
e52: 8b 75 c0 mov -0x40(%ebp),%esi
e55: 85 c0 test %eax,%eax
e57: 74 08 je e61 <printint+0x61>
buf[i++] = '-';
e59: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1)
e5e: 8d 4f 02 lea 0x2(%edi),%ecx
e61: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi
e65: 8d 76 00 lea 0x0(%esi),%esi
e68: 0f b6 07 movzbl (%edi),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
e6b: 83 ec 04 sub $0x4,%esp
e6e: 83 ef 01 sub $0x1,%edi
e71: 6a 01 push $0x1
e73: 53 push %ebx
e74: 56 push %esi
e75: 88 45 d7 mov %al,-0x29(%ebp)
e78: e8 f5 fe ff ff call d72 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
e7d: 83 c4 10 add $0x10,%esp
e80: 39 df cmp %ebx,%edi
e82: 75 e4 jne e68 <printint+0x68>
putc(fd, buf[i]);
}
e84: 8d 65 f4 lea -0xc(%ebp),%esp
e87: 5b pop %ebx
e88: 5e pop %esi
e89: 5f pop %edi
e8a: 5d pop %ebp
e8b: c3 ret
e8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
} else {
x = xx;
e90: 89 d0 mov %edx,%eax
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
e92: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
e99: eb 8b jmp e26 <printint+0x26>
e9b: 90 nop
e9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000ea0 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
ea0: 55 push %ebp
ea1: 89 e5 mov %esp,%ebp
ea3: 57 push %edi
ea4: 56 push %esi
ea5: 53 push %ebx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
ea6: 8d 45 10 lea 0x10(%ebp),%eax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
ea9: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
eac: 8b 75 0c mov 0xc(%ebp),%esi
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
eaf: 8b 7d 08 mov 0x8(%ebp),%edi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
eb2: 89 45 d0 mov %eax,-0x30(%ebp)
eb5: 0f b6 1e movzbl (%esi),%ebx
eb8: 83 c6 01 add $0x1,%esi
ebb: 84 db test %bl,%bl
ebd: 0f 84 b0 00 00 00 je f73 <printf+0xd3>
ec3: 31 d2 xor %edx,%edx
ec5: eb 39 jmp f00 <printf+0x60>
ec7: 89 f6 mov %esi,%esi
ec9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
ed0: 83 f8 25 cmp $0x25,%eax
ed3: 89 55 d4 mov %edx,-0x2c(%ebp)
state = '%';
ed6: ba 25 00 00 00 mov $0x25,%edx
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
edb: 74 18 je ef5 <printf+0x55>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
edd: 8d 45 e2 lea -0x1e(%ebp),%eax
ee0: 83 ec 04 sub $0x4,%esp
ee3: 88 5d e2 mov %bl,-0x1e(%ebp)
ee6: 6a 01 push $0x1
ee8: 50 push %eax
ee9: 57 push %edi
eea: e8 83 fe ff ff call d72 <write>
eef: 8b 55 d4 mov -0x2c(%ebp),%edx
ef2: 83 c4 10 add $0x10,%esp
ef5: 83 c6 01 add $0x1,%esi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
ef8: 0f b6 5e ff movzbl -0x1(%esi),%ebx
efc: 84 db test %bl,%bl
efe: 74 73 je f73 <printf+0xd3>
c = fmt[i] & 0xff;
if(state == 0){
f00: 85 d2 test %edx,%edx
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
f02: 0f be cb movsbl %bl,%ecx
f05: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
f08: 74 c6 je ed0 <printf+0x30>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
f0a: 83 fa 25 cmp $0x25,%edx
f0d: 75 e6 jne ef5 <printf+0x55>
if(c == 'd'){
f0f: 83 f8 64 cmp $0x64,%eax
f12: 0f 84 f8 00 00 00 je 1010 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
f18: 81 e1 f7 00 00 00 and $0xf7,%ecx
f1e: 83 f9 70 cmp $0x70,%ecx
f21: 74 5d je f80 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
f23: 83 f8 73 cmp $0x73,%eax
f26: 0f 84 84 00 00 00 je fb0 <printf+0x110>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
f2c: 83 f8 63 cmp $0x63,%eax
f2f: 0f 84 ea 00 00 00 je 101f <printf+0x17f>
putc(fd, *ap);
ap++;
} else if(c == '%'){
f35: 83 f8 25 cmp $0x25,%eax
f38: 0f 84 c2 00 00 00 je 1000 <printf+0x160>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
f3e: 8d 45 e7 lea -0x19(%ebp),%eax
f41: 83 ec 04 sub $0x4,%esp
f44: c6 45 e7 25 movb $0x25,-0x19(%ebp)
f48: 6a 01 push $0x1
f4a: 50 push %eax
f4b: 57 push %edi
f4c: e8 21 fe ff ff call d72 <write>
f51: 83 c4 0c add $0xc,%esp
f54: 8d 45 e6 lea -0x1a(%ebp),%eax
f57: 88 5d e6 mov %bl,-0x1a(%ebp)
f5a: 6a 01 push $0x1
f5c: 50 push %eax
f5d: 57 push %edi
f5e: 83 c6 01 add $0x1,%esi
f61: e8 0c fe ff ff call d72 <write>
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
f66: 0f b6 5e ff movzbl -0x1(%esi),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
f6a: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
f6d: 31 d2 xor %edx,%edx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
f6f: 84 db test %bl,%bl
f71: 75 8d jne f00 <printf+0x60>
putc(fd, c);
}
state = 0;
}
}
}
f73: 8d 65 f4 lea -0xc(%ebp),%esp
f76: 5b pop %ebx
f77: 5e pop %esi
f78: 5f pop %edi
f79: 5d pop %ebp
f7a: c3 ret
f7b: 90 nop
f7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
f80: 83 ec 0c sub $0xc,%esp
f83: b9 10 00 00 00 mov $0x10,%ecx
f88: 6a 00 push $0x0
f8a: 8b 5d d0 mov -0x30(%ebp),%ebx
f8d: 89 f8 mov %edi,%eax
f8f: 8b 13 mov (%ebx),%edx
f91: e8 6a fe ff ff call e00 <printint>
ap++;
f96: 89 d8 mov %ebx,%eax
f98: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
f9b: 31 d2 xor %edx,%edx
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
f9d: 83 c0 04 add $0x4,%eax
fa0: 89 45 d0 mov %eax,-0x30(%ebp)
fa3: e9 4d ff ff ff jmp ef5 <printf+0x55>
fa8: 90 nop
fa9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else if(c == 's'){
s = (char*)*ap;
fb0: 8b 45 d0 mov -0x30(%ebp),%eax
fb3: 8b 18 mov (%eax),%ebx
ap++;
fb5: 83 c0 04 add $0x4,%eax
fb8: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
s = "(null)";
fbb: b8 a8 12 00 00 mov $0x12a8,%eax
fc0: 85 db test %ebx,%ebx
fc2: 0f 44 d8 cmove %eax,%ebx
while(*s != 0){
fc5: 0f b6 03 movzbl (%ebx),%eax
fc8: 84 c0 test %al,%al
fca: 74 23 je fef <printf+0x14f>
fcc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
fd0: 88 45 e3 mov %al,-0x1d(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
fd3: 8d 45 e3 lea -0x1d(%ebp),%eax
fd6: 83 ec 04 sub $0x4,%esp
fd9: 6a 01 push $0x1
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
fdb: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
fde: 50 push %eax
fdf: 57 push %edi
fe0: e8 8d fd ff ff call d72 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
fe5: 0f b6 03 movzbl (%ebx),%eax
fe8: 83 c4 10 add $0x10,%esp
feb: 84 c0 test %al,%al
fed: 75 e1 jne fd0 <printf+0x130>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
fef: 31 d2 xor %edx,%edx
ff1: e9 ff fe ff ff jmp ef5 <printf+0x55>
ff6: 8d 76 00 lea 0x0(%esi),%esi
ff9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
1000: 83 ec 04 sub $0x4,%esp
1003: 88 5d e5 mov %bl,-0x1b(%ebp)
1006: 8d 45 e5 lea -0x1b(%ebp),%eax
1009: 6a 01 push $0x1
100b: e9 4c ff ff ff jmp f5c <printf+0xbc>
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
1010: 83 ec 0c sub $0xc,%esp
1013: b9 0a 00 00 00 mov $0xa,%ecx
1018: 6a 01 push $0x1
101a: e9 6b ff ff ff jmp f8a <printf+0xea>
101f: 8b 5d d0 mov -0x30(%ebp),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
1022: 83 ec 04 sub $0x4,%esp
1025: 8b 03 mov (%ebx),%eax
1027: 6a 01 push $0x1
1029: 88 45 e4 mov %al,-0x1c(%ebp)
102c: 8d 45 e4 lea -0x1c(%ebp),%eax
102f: 50 push %eax
1030: 57 push %edi
1031: e8 3c fd ff ff call d72 <write>
1036: e9 5b ff ff ff jmp f96 <printf+0xf6>
103b: 66 90 xchg %ax,%ax
103d: 66 90 xchg %ax,%ax
103f: 90 nop
00001040 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
1040: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
1041: a1 e4 18 00 00 mov 0x18e4,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
1046: 89 e5 mov %esp,%ebp
1048: 57 push %edi
1049: 56 push %esi
104a: 53 push %ebx
104b: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
104e: 8b 10 mov (%eax),%edx
void
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
1050: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
1053: 39 c8 cmp %ecx,%eax
1055: 73 19 jae 1070 <free+0x30>
1057: 89 f6 mov %esi,%esi
1059: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
1060: 39 d1 cmp %edx,%ecx
1062: 72 1c jb 1080 <free+0x40>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
1064: 39 d0 cmp %edx,%eax
1066: 73 18 jae 1080 <free+0x40>
static Header base;
static Header *freep;
void
free(void *ap)
{
1068: 89 d0 mov %edx,%eax
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
106a: 39 c8 cmp %ecx,%eax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
106c: 8b 10 mov (%eax),%edx
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
106e: 72 f0 jb 1060 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
1070: 39 d0 cmp %edx,%eax
1072: 72 f4 jb 1068 <free+0x28>
1074: 39 d1 cmp %edx,%ecx
1076: 73 f0 jae 1068 <free+0x28>
1078: 90 nop
1079: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
break;
if(bp + bp->s.size == p->s.ptr){
1080: 8b 73 fc mov -0x4(%ebx),%esi
1083: 8d 3c f1 lea (%ecx,%esi,8),%edi
1086: 39 d7 cmp %edx,%edi
1088: 74 19 je 10a3 <free+0x63>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
108a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
108d: 8b 50 04 mov 0x4(%eax),%edx
1090: 8d 34 d0 lea (%eax,%edx,8),%esi
1093: 39 f1 cmp %esi,%ecx
1095: 74 23 je 10ba <free+0x7a>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
1097: 89 08 mov %ecx,(%eax)
freep = p;
1099: a3 e4 18 00 00 mov %eax,0x18e4
}
109e: 5b pop %ebx
109f: 5e pop %esi
10a0: 5f pop %edi
10a1: 5d pop %ebp
10a2: c3 ret
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
10a3: 03 72 04 add 0x4(%edx),%esi
10a6: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
10a9: 8b 10 mov (%eax),%edx
10ab: 8b 12 mov (%edx),%edx
10ad: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
10b0: 8b 50 04 mov 0x4(%eax),%edx
10b3: 8d 34 d0 lea (%eax,%edx,8),%esi
10b6: 39 f1 cmp %esi,%ecx
10b8: 75 dd jne 1097 <free+0x57>
p->s.size += bp->s.size;
10ba: 03 53 fc add -0x4(%ebx),%edx
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
freep = p;
10bd: a3 e4 18 00 00 mov %eax,0x18e4
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
p->s.size += bp->s.size;
10c2: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
10c5: 8b 53 f8 mov -0x8(%ebx),%edx
10c8: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
}
10ca: 5b pop %ebx
10cb: 5e pop %esi
10cc: 5f pop %edi
10cd: 5d pop %ebp
10ce: c3 ret
10cf: 90 nop
000010d0 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
10d0: 55 push %ebp
10d1: 89 e5 mov %esp,%ebp
10d3: 57 push %edi
10d4: 56 push %esi
10d5: 53 push %ebx
10d6: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
10d9: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
10dc: 8b 15 e4 18 00 00 mov 0x18e4,%edx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
10e2: 8d 78 07 lea 0x7(%eax),%edi
10e5: c1 ef 03 shr $0x3,%edi
10e8: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
10eb: 85 d2 test %edx,%edx
10ed: 0f 84 a3 00 00 00 je 1196 <malloc+0xc6>
10f3: 8b 02 mov (%edx),%eax
10f5: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
10f8: 39 cf cmp %ecx,%edi
10fa: 76 74 jbe 1170 <malloc+0xa0>
10fc: 81 ff 00 10 00 00 cmp $0x1000,%edi
1102: be 00 10 00 00 mov $0x1000,%esi
1107: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx
110e: 0f 43 f7 cmovae %edi,%esi
1111: ba 00 80 00 00 mov $0x8000,%edx
1116: 81 ff ff 0f 00 00 cmp $0xfff,%edi
111c: 0f 46 da cmovbe %edx,%ebx
111f: eb 10 jmp 1131 <malloc+0x61>
1121: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
1128: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
112a: 8b 48 04 mov 0x4(%eax),%ecx
112d: 39 cf cmp %ecx,%edi
112f: 76 3f jbe 1170 <malloc+0xa0>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
1131: 39 05 e4 18 00 00 cmp %eax,0x18e4
1137: 89 c2 mov %eax,%edx
1139: 75 ed jne 1128 <malloc+0x58>
char *p;
Header *hp;
if(nu < 4096)
nu = 4096;
p = sbrk(nu * sizeof(Header));
113b: 83 ec 0c sub $0xc,%esp
113e: 53 push %ebx
113f: e8 96 fc ff ff call dda <sbrk>
if(p == (char*)-1)
1144: 83 c4 10 add $0x10,%esp
1147: 83 f8 ff cmp $0xffffffff,%eax
114a: 74 1c je 1168 <malloc+0x98>
return 0;
hp = (Header*)p;
hp->s.size = nu;
114c: 89 70 04 mov %esi,0x4(%eax)
free((void*)(hp + 1));
114f: 83 ec 0c sub $0xc,%esp
1152: 83 c0 08 add $0x8,%eax
1155: 50 push %eax
1156: e8 e5 fe ff ff call 1040 <free>
return freep;
115b: 8b 15 e4 18 00 00 mov 0x18e4,%edx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
1161: 83 c4 10 add $0x10,%esp
1164: 85 d2 test %edx,%edx
1166: 75 c0 jne 1128 <malloc+0x58>
return 0;
1168: 31 c0 xor %eax,%eax
116a: eb 1c jmp 1188 <malloc+0xb8>
116c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
1170: 39 cf cmp %ecx,%edi
1172: 74 1c je 1190 <malloc+0xc0>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
1174: 29 f9 sub %edi,%ecx
1176: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
1179: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
117c: 89 78 04 mov %edi,0x4(%eax)
}
freep = prevp;
117f: 89 15 e4 18 00 00 mov %edx,0x18e4
return (void*)(p + 1);
1185: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
1188: 8d 65 f4 lea -0xc(%ebp),%esp
118b: 5b pop %ebx
118c: 5e pop %esi
118d: 5f pop %edi
118e: 5d pop %ebp
118f: c3 ret
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
prevp->s.ptr = p->s.ptr;
1190: 8b 08 mov (%eax),%ecx
1192: 89 0a mov %ecx,(%edx)
1194: eb e9 jmp 117f <malloc+0xaf>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
1196: c7 05 e4 18 00 00 e8 movl $0x18e8,0x18e4
119d: 18 00 00
11a0: c7 05 e8 18 00 00 e8 movl $0x18e8,0x18e8
11a7: 18 00 00
base.s.size = 0;
11aa: b8 e8 18 00 00 mov $0x18e8,%eax
11af: c7 05 ec 18 00 00 00 movl $0x0,0x18ec
11b6: 00 00 00
11b9: e9 3e ff ff ff jmp 10fc <malloc+0x2c>
|
alloy4fun_models/trashltl/models/11/zbuxyN4EbK5CTkYCa.als | Kaixi26/org.alloytools.alloy | 0 | 231 | open main
pred idzbuxyN4EbK5CTkYCa_prop12 {
eventually (all f:File | f in Trash and (f not in Trash) releases (f in Trash))
}
pred __repair { idzbuxyN4EbK5CTkYCa_prop12 }
check __repair { idzbuxyN4EbK5CTkYCa_prop12 <=> prop12o } |
programs/oeis/021/A021319.asm | karttu/loda | 1 | 99485 | ; A021319: Decimal expansion of 1/315.
; 0,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3,1,7,4,6,0,3
sub $0,1
cal $0,20806 ; Decimal expansion of 1/7.
mov $1,$0
sub $1,1
|
oeis/017/A017786.asm | neoneye/loda-programs | 11 | 96088 | <filename>oeis/017/A017786.asm
; A017786: Binomial coefficients C(70,n).
; 1,70,2415,54740,916895,12103014,131115985,1198774720,9440350920,65033528560,396704524216,2163842859360,10638894058520,47465835030320,193253756909160,721480692460864,2480089880334220,7877932561061640,23196134763125940,63484158299081520,161884603662657876,385439532530137800,858478958817125100,1791608261879217600,3508566179513467800,6455761770304780752,11173433833219812840,18208558839321176480,27963143931814663880,40498346384007444240,55347740058143507128,71416438784701299520,87038784768854708790
mov $1,70
bin $1,$0
mov $0,$1
|
lib/crt/classic/crt_section_standard.asm | geoffmcl/z88dk | 0 | 20246 | ; Classic Memory map and section setup
;
; This layout suits all the classic machines. Memory placement is
; affected by:
;
; CRT_MODEL: RAM/ROM configuration
; CRT_ORG_CODE: Where code starts executing from
; CRT_ORG_BSS: Where uninitialised global variables are placed
; CRT_ORG_GRAPHICS: Where graphics routines + variables are stored (certain ports only)
;
; Contains the generic variables + features
;
; crt_model = 0 ; everything in RAM
; crt_model = 1 ; ROM model, data section copied
; crt_model = 2 ; ROM model, data section compressed
SECTION CODE
SECTION code_crt_init
SECTION code_crt_init_exit
SECTION code_crt_exit
SECTION code_crt_exit_exit
SECTION code_driver
SECTION rodata_driver ;Keep it in low memoey
SECTION code_compiler
SECTION code_clib
SECTION code_crt0_sccz80
SECTION code_l
SECTION code_l_sdcc
SECTION code_l_sccz80
SECTION code_compress_zx7
SECTION code_compress_aplib
SECTION code_ctype
SECTION code_esxdos
SECTION code_fp
SECTION code_fp_math48
SECTION code_fp_math32
SECTION code_fp_math16
SECTION code_fp_mbf32
SECTION code_fp_mbf64
SECTION code_math
SECTION code_error
SECTION code_stdlib
SECTION code_string
SECTION code_adt_b_array
SECTION code_adt_b_vector
SECTION code_adt_ba_priority_queue
SECTION code_adt_ba_stack
SECTION code_adt_bv_priority_queue
SECTION code_adt_bv_stack
SECTION code_adt_p_forward_list
SECTION code_adt_p_forward_list_alt
SECTION code_adt_p_list
SECTION code_adt_p_queue
SECTION code_adt_p_stack
SECTION code_adt_w_array
SECTION code_adt_w_vector
SECTION code_adt_wa_priority_queue
SECTION code_adt_wa_stack
SECTION code_adt_wv_priority_queue
SECTION code_adt_wv_stack
SECTION code_alloc_balloc
SECTION code_alloc_obstack
SECTION code_arch
SECTION code_font
SECTION code_font_fzx
SECTION code_psg
SECTION code_sound_ay
SECTION code_z80
IF !__crt_org_graphics
SECTION code_graphics
ENDIF
SECTION code_user
SECTION rodata_fp
SECTION rodata_fp_math16
SECTION rodata_fp_math32
SECTION rodata_fp_mbf32
SECTION rodata_fp_mbf64
SECTION rodata_arch
SECTION rodata_compiler
SECTION rodata_clib
SECTION rodata_psg
SECTION rodata_sound_ay
IF !__crt_org_graphics
SECTION rodata_graphics
ENDIF
SECTION rodata_user
SECTION rodata_font
SECTION rodata_font_fzx
SECTION rodata_font_4x8
SECTION rodata_font_8x8
SECTION ROMABLE_END
IF !__crt_model
SECTION DATA
SECTION smc_clib
SECTION smc_user
SECTION data_clib
SECTION data_stdlib
SECTION data_psg
SECTION data_sound_ay
IF !__crt_org_graphics
SECTION data_graphics
ENDIF
SECTION data_crt
SECTION data_arch
SECTION data_compiler
SECTION data_user
SECTION data_alloc_balloc
SECTION DATA_END
ENDIF
SECTION BSS
IF __crt_org_bss
org __crt_org_bss
defb 0 ; control name of bss binary
ENDIF
SECTION bss_fp
SECTION bss_fp_math32
SECTION bss_fp_mbf32
SECTION bss_fp_mbf64
SECTION bss_compress_aplib
SECTION bss_error
SECTION bss_crt
SECTION bss_fardata
IF __crt_org_bss_fardata_start
org __crt_org_bss_fardata_start
ENDIF
SECTION bss_compiler
IF __crt_org_bss_compiler_start
org __crt_org_bss_compiler_start
ENDIF
SECTION bss_driver
SECTION bss_arch
SECTION bss_clib
SECTION bss_string
SECTION bss_alloc_balloc
IF !__crt_org_graphics
SECTION bss_graphics
ENDIF
SECTION bss_psg
SECTION bss_sound_ay
SECTION bss_user
IF __crt_model > 0
SECTION DATA
org -1
defb 0 ; control name of data binary
SECTION smc_clib
SECTION smc_fp
SECTION smc_user
SECTION data_clib
SECTION data_crt
SECTION data_arch
SECTION data_stdlib
SECTION data_psg
SECTION data_sound_ay
IF !__crt_org_graphics
SECTION data_graphics
ENDIF
SECTION data_compiler
SECTION data_user
SECTION data_alloc_balloc
SECTION DATA_END
ENDIF
SECTION BSS_END
IF __crt_org_graphics
SECTION HIMEM
org __crt_org_graphics
SECTION code_graphics
SECTION code_himem
SECTION rodata_graphics
SECTION rodata_himem
SECTION data_himem
SECTION data_graphics
SECTION bss_graphics
SECTION bss_himem
SECTION HIMEM_END
ENDIF
IF CRT_APPEND_MMAP
INCLUDE "./mmap.inc"
ENDIF
|
programs/oeis/095/A095265.asm | karttu/loda | 0 | 85130 | ; A095265: A sequence generated from a 4th degree Pascal's Triangle polynomial.
; 1,22,103,284,605,1106,1827,2808,4089,5710,7711,10132,13013,16394,20315,24816,29937,35718,42199,49420,57421,66242,75923,86504,98025,110526,124047,138628,154309,171130,189131,208352,228833,250614,273735,298236
mov $1,$0
add $1,1
add $0,$1
lpb $0,1
sub $0,1
add $3,$2
add $1,$3
add $2,5
lpe
|
firmware/kernal/mmu.asm | QuorumComp/hc800 | 2 | 177546 | INCLUDE "lowlevel/hc800.i"
INCLUDE "mmu.i"
; ---------------------------------------------------------------------------
; -- Set default kernal MMU configurations
; --
SECTION "MmuInitialize",CODE
MmuInitialize:
pusha
ld de,.mmuDataLoad
ld f,.mmuDataLoadEnd-.mmuDataLoad
ld t,MMU_CFG_LOAD
jal internalMmuSetConfigCode
ld de,.mmuDataKernal
ld f,.mmuDataKernalEnd-.mmuDataKernal
ld t,MMU_CFG_CLIENT
jal internalMmuSetConfigCode
ld t,MMU_CFG_SPARE
jal internalMmuSetConfigCode
ld t,MMU_CFG_KERNAL
jal internalMmuSetConfigCode
ld t,MMU_CFG_KERNAL
jal MmuActivateConfig
ld b,IO_MMU_BASE
ld c,IO_MMU_CHARGEN
ld t,$08
lio (bc),t ; chargen
popa
j (hl)
.mmuDataKernal: DB MMU_CFG_HARVARD ; config bits
DB $01,$81,$82,$83 ; code banks
DB $80,$81,BANK_PALETTE,BANK_ATTRIBUTE ; data banks
DB $01,$80 ; system code/data
.mmuDataKernalEnd:
.mmuDataLoad: DB MMU_CFG_HARVARD|MMU_CFG_DATA_48K ; config bits
DB $01,$81,$82,$83 ; code banks
DB $80,$00,$00,$00 ; data banks
DB $01,$80 ; system code/data
.mmuDataLoadEnd:
; ---------------------------------------------------------------------------
; -- Activate MMU configuration
; --
SECTION "MmuActivateConfig",CODE
MmuActivateConfig:
pusha
ld b,IO_MMU_BASE
ld c,IO_MMU_ACTIVE_INDEX
lio (bc),t
popa
j (hl)
; ---------------------------------------------------------------------------
; -- Load MMU configuration
; --
; -- Inputs:
; -- t - MMU configuration index
; -- de - configuration, 9 bytes of data (config, 4x code, 4x data)
; --
SECTION "MmuSetConfigCode",CODE
MmuSetConfigCode:
pusha
ld f,MMU_CONFIG_SIZE
j internalMmuSetConfigCode\.enter
; ---------------------------------------------------------------------------
; -- Load MMU configuration
; --
; -- Inputs:
; -- f - length of config data
; -- t - MMU configuration index
; -- de - configuration
; --
internalMmuSetConfigCode:
pusha
.enter
ld b,IO_MMU_BASE
ld c,IO_MMU_UPDATE_INDEX
lio (bc),t
ld c,IO_MMU_CONFIGURATION
.loop lco t,(de)
add de,1
lio (bc),t
add c,1
dj f,.loop
popa
j (hl)
; ---------------------------------------------------------------------------
; -- Load MMU configuration
; --
; -- Inputs:
; -- t - MMU configuration index
; -- de - configuration, 9 bytes of data (config, 4x code, 4x data)
; --
SECTION "MmuSetConfigData",CODE
MmuSetConfigData:
pusha
ld f,MMU_CONFIG_SIZE
j internalMmuSetConfigData\.enter
; ---------------------------------------------------------------------------
; -- Load MMU configuration
; --
; -- Inputs:
; -- f - length of config data
; -- t - MMU configuration index
; -- de - configuration
; --
internalMmuSetConfigData:
pusha
.enter
ld b,IO_MMU_BASE
ld c,IO_MMU_UPDATE_INDEX
lio (bc),t
ld c,IO_MMU_CONFIGURATION
.loop ld t,(de)
add de,1
lio (bc),t
add c,1
dj f,.loop
popa
j (hl)
|
src/main/kotlin/io/kixi/kd/KDLexer.g4 | dleuck/Ki.Kotlin.KD | 2 | 6839 | lexer grammar KDLexer;
/**
* KD Lexer
*
* @author <NAME>
*/
channels {
WHITESPACE,
COMMENTS
}
NULL: 'null' | 'nil';
TRUE: 'true' | 'on';
FALSE: 'false' | 'off';
// Note: This requires a "protocol:/" at the beginning, which excludes URLs such as jar:file:/home/duke/duke.jar!
// The trainling':/' is necessary to disabiguate protocol: and namespace:
URL: [a-zA-Z][a-zA-Z0-9.+\-]* ':' '/' [a-zA-Z0-9.+\-_~:/?#[\]@!$&'()*;,%=]+;
// Numbers --- ---
// SECTION: literals
fragment DecDigit: '0'..'9';
fragment DecDigitNoZero: '1'..'9';
fragment DecDigitOrSeparator: DecDigit | '_';
fragment DecDigits
: DecDigit DecDigitOrSeparator* DecDigit
| DecDigit
;
fragment DoubleExponent: [eE] [+-]? DecDigits;
fragment NonZeroNumberPart
: (DecDigitNoZero DecDigitOrSeparator* DecDigit | DecDigit)
;
fragment NumberPart
: (DecDigit DecDigitOrSeparator* DecDigit | DecDigit)
;
fragment ASCIIAlpha: [a-zA-Z];
FloatLiteral
: '-'? NumberPart? '.' NumberPart DoubleExponent? [fF]
| '-'? NumberPart DoubleExponent? [fF]
;
DoubleLiteral
: '-'? NumberPart? '.' NumberPart DoubleExponent? [dD]?
| '-'? NumberPart DoubleExponent [dD]?
| '-'? NumberPart [dD]
;
DecimalLiteral
: '-'? NumberPart? '.' NumberPart DoubleExponent? ('bd' | 'BD')
| '-'? NumberPart DoubleExponent? ('bd' | 'BD')
;
IntegerLiteral
: '-'? NumberPart
;
fragment HexDigit: [0-9a-fA-F];
fragment HexDigitOrSeparator: HexDigit | '_';
HexLiteral
: '-'?
(
'0' [xX] HexDigit HexDigitOrSeparator* HexDigit
|
'0' [xX] HexDigit
)
;
fragment BinDigit: [01];
fragment BinDigitOrSeparator: BinDigit | '_';
BinLiteral:
'-'?
(
'0' [bB] BinDigit BinDigitOrSeparator* BinDigit
|
'0' [bB] BinDigit
)
;
LongLiteral
: (IntegerLiteral | HexLiteral | BinLiteral) 'L'
;
fragment Number: IntegerLiteral | DoubleLiteral;
// Version --- ---
Version: (NumberPart '-' VersionQualifierAndNum) |
(NumberPart '.' NumberPart '-' VersionQualifierAndNum) |
(NumberPart '.' NumberPart '.' NumberPart ('-' VersionQualifierAndNum)?);
fragment VersionQualifierAndNum: VersionQualifier ('-'? NumberPart)?;
// String --- ---
SimpleString: '"' (Esc | ~["\r\n\\])* '"';
RawString: '@"' (~["\r\n])* '"';
BlockStringStart: '"""' -> pushMode(blockString);
BlockRawStringStart: '@"""' -> pushMode(blockRawString);
BlockRawAltStringStart: '`' -> pushMode(blockRawAltString);
fragment UniCharacterLiteral
: '\\' 'u' HexDigit HexDigit HexDigit HexDigit
;
fragment EscapedIdentifier
: '\\' ('t' | 'b' | 'r' | 'n' | '\'' | '"' | '\\' )
;
fragment Esc
: UniCharacterLiteral
| EscapedIdentifier
;
fragment Unicode // TODO - Add six HEX version
: 'u' HexDigit HexDigit HexDigit HexDigit
;
fragment SafeCodePoint
: ~ ["\\\u0000-\u001F]
;
fragment CharSafeCodePoint
: ~ ['\\\u0000-\u001F]
;
// TODO: This doesn't capture some emoji correctly
CharLiteral: '\'' (Esc | CharSafeCodePoint) '\'';
// End String --- ---
// Date, Time and Duration
fragment DAYS: 'day' | 'days';
fragment HOURS: 'h';
fragment MINUTES: 'min';
fragment SECONDS: 's';
fragment MILLIS: 'ms';
fragment NANOS: 'ns';
// Duration: CompoundDuration | DayDuration | HourDuration | MinuteDuration | SecondDuration | MillisecondDuration
// | NanosecondDuration;
// If days are included the label "day" is required. All others unit specifications are
// optional. We can't use the unit durations for other segments because the labels are
// optional.
//
// TODO: We should handle this in the Parser
CompoundDuration: '-'? (DayDuration ':')? DecDigits HOURS? ':' DecDigits MINUTES? ':'
DecDigits ('.' NumberPart DoubleExponent?)? SECONDS?;
DayDuration: Number DAYS;
HourDuration: Number HOURS;
MinuteDuration: Number MINUTES;
SecondDuration: Number SECONDS;
MillisecondDuration: IntegerLiteral MILLIS;
NanosecondDuration: IntegerLiteral NANOS;
// See reference: https://github.com/kixi-io/Ki.Docs/wiki/Ki-Data-(KD)#ZonedDateTime
Date: '-'? (DecDigits '/' DecDigit DecDigit? '/' DecDigit DecDigit?) |
// ISO 8601 exhttps://en.wikipedia.org/wiki/ISO_8601#Times
(DecDigits '-' DecDigit DecDigit? '-' DecDigit DecDigit?);
Time: (AT | 'T') DecDigits':' DecDigits (':' DecDigits ('.' NumberPart DoubleExponent?)?)? TimeZone?;
// TODO - Break this into separate parser rules
// TODO - Fix lexer issue where negative offset is treated as a negative number
fragment TimeZone:
// positive offset
('+' DecDigit DecDigit? (':' DecDigit DecDigit)?) |
('-'(
// negative offset
( DecDigit DecDigit? (':' DecDigit DecDigit)?) |
// UTC (Z)
('UTC' | 'GMT' | 'Z') |
// KiTZ
( ASCIIAlpha ASCIIAlpha '/' ASCIIAlpha+ )
)
) |
// needed for ISO 8601
'Z'
;
// Quantity ////
// Assumed to be an Int or a Decimal unless Double, Float or Long is specified
IntegerQuantityLiteral
: '-'? NumberPart UnitID (':' [Li])?
;
DecimalQuantityLiteral
: '-'? NumberPart UnitID ':' [dDfF]
| '-'? NumberPart? '.' NumberPart DoubleExponent? UnitID (':' [dDfFL])?
| '-'? NumberPart DoubleExponent UnitID (':' [dDfFL])?
;
// Range Operators
InclusiveRangeOp: '..';
ExclusiveRangeOp: '<..<';
ExclusiveLeftOp: '<..';
ExclusiveRightOp: '..<';
// Punctuation
DOT: '.';
COLON: ':';
SEMICOLON: ';';
EQUALS: '=';
OPEN: '{';
CLOSE: '}';
LPAREN: '(';
RPAREN: ')';
LSQUARE: '[';
RSQUARE: ']';
COMMA: ',';
SLASH: '/';
DASH: '-';
AT: '@';
PLUS: '+';
UNDERSCORE: '_';
// Encodings --- ---
BLOB_START: '.blob(' -> pushMode(blob);
// Identifiers --- ---
// Any unicode letter, emoji, $ or _
fragment IDStart: [$_\p{Alpha}\p{General_Category=Other_Letter}\p{Emoji_Presentation}]; // [$_\p{Alpha}\p{General_Category=Other_Letter}\p{Emoji}\p{Join_Control}\p{Variation_Selector}];
// Any unicode letter, digit, emoji, ., $ or _
fragment IDChar: [$_\p{Alnum}\p{General_Category=Other_Letter}\p{Emoji}\p{Join_Control}\p{Variation_Selector}];
// ('.' ID)? allows for dot separated paths that don't interfer with ranges
ID: IDStart IDChar* ('.' ID)?;
fragment VersionQualifier: [\p{Alpha}]+;
fragment UnitID: (ID | 'ℓ' | 'mℓ' | '°') ('²' | '³')?;
// COMMENTS --- ---
BlockComment: '/*' ( BlockComment | . )*? '*/' -> channel(HIDDEN); //-> skip; //-> channel(COMMENTS);
LineComment: ('#' | '//') ~[\u000A\u000D]* -> channel(HIDDEN); //-> skip; //-> channel(COMMENTS);
// WHITE_SPACE --- ---
WS: ([ \t\r] | '\\' '\n')+ -> channel(HIDDEN); //-> skip;
NL: ('\n' | ';')+;
// These are implemented using modes so that a single blob or block string is made up of several tokens (at least one
// per line of code). This helps the syntax highlighter on IntelliJ IDEA as tokens that are too big, when you introduce
// an error, are split into many tokens and, when you remove the error, the IDE doesn't do enough backtracking for the
// lexer to be able to recognize a big chunk of text again. So, splitting it in multiple tokens helps.
mode blob;
// Complies with "The Base64 Alphabet" as specified in Table 1 of RFC 4648
BLOB_DATA: [ \t\r\n]* [A-Za-z0-9+=/]* [ \t\r\n]*;
BLOB_END: ')' -> popMode;
BLOB_ERROR: .;
mode blockString;
BlockStringChunk: [\t\r\n]+ BlockStringChar* | [\t\r\n]* BlockStringChar+;
BlockStringEnd: '"""' -> popMode;
BlockStringError: [\\]? .;
fragment BlockStringChar: '""' ~'"' | '"' ~'"' | Esc | SafeCodePoint;
mode blockRawString;
BlockRawStringChunk: [\t\r\n]+ BlockRawStringChar* | [\t\r\n]* BlockRawStringChar+;
BlockRawStringEnd: '"""' -> popMode;
BlockRawStringError: .;
fragment BlockRawStringChar: [\\] | BlockStringChar;
mode blockRawAltString;
BlockRawAltStringChunk: [\t\r\n]+ (~'`')* | [\t\r\n]* (~'`')+;
BlockRawAltStringEnd: '`' -> popMode; |
src/tcl-commands.adb | thindil/tashy2 | 2 | 27807 | <gh_stars>1-10
-- Copyright (c) 2020-2021 <NAME> <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package body Tcl.Commands with
SPARK_Mode => Off
is
function Tcl_Create_Command
(Command_Name: String; Proc: Tcl_Cmd_Proc;
Interpreter: Tcl_Interpreter := Get_Interpreter;
Delete_Proc: Tcl_Cmd_Delete_Proc := Null_Tcl_Cmd_Delete_Proc)
return Tcl_Command is
function Tcl_Create_Command_C
(Interp: Tcl_Interpreter; Cmd_Name: chars_ptr; Ada_Proc: Tcl_Cmd_Proc;
Client_Data: System.Address; Delete_Proc_Ada: Tcl_Cmd_Delete_Proc)
return Tcl_Command with
Import,
Convention => C,
External_Name => "Tcl_CreateCommand";
begin
return Tcl_Create_Command_C
(Interp => Interpreter, Cmd_Name => New_String(Str => Command_Name),
Ada_Proc => Proc, Client_Data => Null_Address,
Delete_Proc_Ada => Delete_Proc);
end Tcl_Create_Command;
function Get_Argument
(Arguments_Pointer: not null Argv_Pointer.Pointer; Index: Natural)
return String is
begin
return
Value
(Item =>
Argv_Pointer.Value(Ref => Arguments_Pointer)(size_t(Index)));
end Get_Argument;
end Tcl.Commands;
|
Transynther/x86/_processed/NC/_zr_/i7-8650U_0xd2.log_16822_869.asm | ljhsiun2/medusa | 9 | 17391 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x2979, %r9
nop
and $30852, %r13
movb (%r9), %r12b
nop
inc %rbx
lea addresses_WC_ht+0x102f9, %rsi
lea addresses_WT_ht+0x1e479, %rdi
nop
nop
nop
nop
inc %r8
mov $35, %rcx
rep movsb
nop
nop
mfence
lea addresses_normal_ht+0x14359, %r9
and $11483, %rdi
movl $0x61626364, (%r9)
nop
nop
xor %r8, %r8
lea addresses_A_ht+0x1a379, %rsi
lea addresses_WT_ht+0x1a441, %rdi
nop
dec %rbx
mov $55, %rcx
rep movsq
nop
nop
nop
nop
sub %r8, %r8
lea addresses_UC_ht+0x1f89, %rsi
lea addresses_WC_ht+0xb479, %rdi
nop
nop
nop
nop
add %r12, %r12
mov $118, %rcx
rep movsq
cmp %rbx, %rbx
lea addresses_WT_ht+0x8679, %rsi
inc %r9
vmovups (%rsi), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $0, %xmm4, %r13
nop
nop
and $1139, %r8
lea addresses_normal_ht+0xff79, %rsi
nop
nop
nop
nop
nop
sub %r12, %r12
mov (%rsi), %edi
nop
nop
nop
cmp %r13, %r13
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %r15
push %r8
push %rbx
push %rsi
// Store
lea addresses_normal+0x13439, %r12
nop
nop
nop
nop
add %r15, %r15
movl $0x51525354, (%r12)
nop
nop
nop
nop
sub %r10, %r10
// Faulty Load
mov $0x50f8010000000079, %r15
nop
nop
nop
nop
inc %rbx
mov (%r15), %r12
lea oracles, %rsi
and $0xff, %r12
shlq $12, %r12
mov (%rsi,%r12,1), %r12
pop %rsi
pop %rbx
pop %r8
pop %r15
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 6, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'00': 16822}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
2ndSemester/Operating Systems/Lab5/Lab5.asm | xairaven/kpi_labs | 0 | 105505 | <reponame>xairaven/kpi_labs
title Lab5.asm ; Title of program
.model SMALL ; Model of memory for exe file
.stack 100h ; Reserving memory for stack
code segment
assume CS:code, DS:data ; Linking label code with CS and label data with DS
begin: MOV AX, data ; Moving data to DS
MOV DS, AX
MOV AH, 09h ; Displaying string "Before"
LEA DX, BEFORE
INT 21h
MOV AH, 40h ; Function code
MOV BX, 01h ; Descriptor (01 for display, 00 for files)
MOV CX, 0Eh ; Displaying 14 symbols (TEXT length, 0Eh in hex)
LEA DX, TEXT
INT 21h
MOV AH, 09h ; Carriage return, line feed (or LINE BREAK)
LEA DX, CR_LF
INT 21h
MOV AH, 09h
LEA DX, CR_LF
INT 21h
MOV AL, SYMBOL ; Moving "*" to AL
MOV CX, 4 ; Loop with 4 iterations
MOV BX, 3 ; Index 3, because we need exchange 9001 in TEXT to "*"
L1: ; Loop start
MOV TEXT[BX], AL ; Moving "*" to TEXT symbol with index BX (3, 4, 5, 6)
INC BX ; Incrementing BX (3, 4, 5, 6)
LOOP L1 ; Jumping to start of the loop
MOV CX, 2 ; Second loop with 2 iterations
MOV BX, 9 ; Index 9, because we need exchange 12 in TEXT to "*"
L2: ; Second loop start
MOV TEXT[BX], AL ; Moving "*" to TEXT symbol with index BX (9, 10)
INC BX ; Incrementing BX (9, 10)
LOOP L2 ; Jumping to start of the loop
MOV TEXT[12], AL ; Changing 12th symbol in TEXT by the traditional way
MOV TEXT[13], AL ; Changing 13th symbol in TEXT by the traditional way
MOV AH, 09h ; Displaying string "After"
LEA DX, AFTER
INT 21h
MOV AH, 40h ; Function code
MOV BX, 01h ; Descriptor (01 for display, 00 for files)
MOV CX, 0Eh ; Displaying 14 symbols (TEXT length, 0Eh in hex)
LEA DX, TEXT
INT 21h
MOV AH, 09h ; Carriage return, line feed (or LINE BREAK)
LEA DX, CR_LF
INT 21h
MOV AH, 4Ch ; Exit function
MOV Al, 0 ; Code 0
INT 21h
code ends
data segment
L_BREAK EQU 0dh, 0ah, '$' ; L_BREAK - constant of CR_LF
CR_LF DB 0dh, 0ah, '$'
BEFORE DB "Before:", L_BREAK
AFTER DB "After:", L_BREAK
TEXT DB "ISO9001GR12H45", L_BREAK
SYMBOL DB "*"
data ends
end begin |
a-chzla1.ads | ytomino/gnat4drake | 0 | 6463 | <filename>a-chzla1.ads
pragma License (Unrestricted);
with Ada.Wide_Wide_Characters.Latin_1;
package Ada.Characters.Wide_Wide_Latin_1
renames Ada.Wide_Wide_Characters.Latin_1;
|
sound/sfxasm/4C.asm | NatsumiFox/Sonic-3-93-Nov-03 | 7 | 165073 | <reponame>NatsumiFox/Sonic-3-93-Nov-03
4C_Header:
sHeaderInit ; Z80 offset is $C460
sHeaderPatch 4C_Patches
sHeaderTick $01
sHeaderCh $01
sHeaderSFX $80, $05, 4C_FM5, $05, $00
4C_Patches:
; Patch $00
; $3C
; $00, $01, $01, $00, $1F, $12, $1A, $1F
; $10, $00, $1F, $00, $09, $13, $0A, $12
; $FF, $0F, $FF, $0F, $00, $80, $00, $80
spAlgorithm $04
spFeedback $07
spDetune $00, $00, $00, $00
spMultiple $00, $01, $01, $00
spRateScale $00, $00, $00, $00
spAttackRt $1F, $1A, $12, $1F
spAmpMod $00, $00, $00, $00
spSustainRt $10, $1F, $00, $00
spSustainLv $0F, $0F, $00, $00
spDecayRt $09, $0A, $13, $12
spReleaseRt $0F, $0F, $0F, $0F
spTotalLv $00, $00, $00, $00
; 4C_FM5 at $C3F6 ($6A before start of file) can not be converted, because the data does not exist.
|
newitems/general/hooks.asm | fcard/z3randomizer | 0 | 1288 | org $0089E2 ; Bank00.asm:1344 - LDA.b #$80 : STA $2115
JSL ExtraNMIUpdate
NOP
|
src/ascon128v11.ads | jhumphry/Ascon_SPARK | 1 | 15146 | <gh_stars>1-10
-- Ascon128v11
-- an instantiation of the Ascon-128 (v 1.1) variant of the Ascon Authenticated
-- Encryption Algorithm created by <NAME>, <NAME>,
-- <NAME> and <NAME>.
-- Copyright (c) 2016-2018, <NAME> - see LICENSE file for details
pragma SPARK_Mode(On);
with Ascon;
package Ascon128v11 is new Ascon(a_rounds => 12,
b_rounds => 6,
b_round_constants_offset => 0,
rate => 64);
|
src/Categories/Category/Construction/Core.agda | Trebor-Huang/agda-categories | 279 | 10300 | <filename>src/Categories/Category/Construction/Core.agda
{-# OPTIONS --without-K --safe #-}
open import Categories.Category
-- The core of a category.
-- See https://ncatlab.org/nlab/show/core
module Categories.Category.Construction.Core {o ℓ e} (𝒞 : Category o ℓ e) where
open import Level using (_⊔_)
open import Function using (flip)
open import Categories.Category.Groupoid using (Groupoid; IsGroupoid)
open import Categories.Morphism 𝒞 as Morphism
open import Categories.Morphism.IsoEquiv 𝒞 as IsoEquiv
open Category 𝒞
open _≃_
Core : Category o (ℓ ⊔ e) e
Core = record
{ Obj = Obj
; _⇒_ = _≅_
; _≈_ = _≃_
; id = ≅.refl
; _∘_ = flip ≅.trans
; assoc = ⌞ assoc ⌟
; sym-assoc = ⌞ sym-assoc ⌟
; identityˡ = ⌞ identityˡ ⌟
; identityʳ = ⌞ identityʳ ⌟
; identity² = ⌞ identity² ⌟
; equiv = ≃-isEquivalence
; ∘-resp-≈ = λ where ⌞ eq₁ ⌟ ⌞ eq₂ ⌟ → ⌞ ∘-resp-≈ eq₁ eq₂ ⌟
}
Core-isGroupoid : IsGroupoid Core
Core-isGroupoid = record
{ _⁻¹ = ≅.sym
; iso = λ {_ _ f} → record { isoˡ = ⌞ isoˡ f ⌟ ; isoʳ = ⌞ isoʳ f ⌟ }
}
where open _≅_
CoreGroupoid : Groupoid o (ℓ ⊔ e) e
CoreGroupoid = record { category = Core; isGroupoid = Core-isGroupoid }
module CoreGroupoid = Groupoid CoreGroupoid
-- Useful shorthands for reasoning about isomorphisms and morphisms of
-- 𝒞 in the same module.
module Shorthands where
module Commutationᵢ where
open Commutation Core public using () renaming ([_⇒_]⟨_≈_⟩ to [_≅_]⟨_≈_⟩)
infixl 2 connectᵢ
connectᵢ : ∀ {A C : Obj} (B : Obj) → A ≅ B → B ≅ C → A ≅ C
connectᵢ B f g = ≅.trans f g
syntax connectᵢ B f g = f ≅⟨ B ⟩ g
open _≅_ public
open _≃_ public
open Morphism public using (module _≅_)
open IsoEquiv public using (⌞_⌟) renaming (module _≃_ to _≈ᵢ_)
open CoreGroupoid public using (_⁻¹) renaming
( _⇒_ to _≅_
; _≈_ to _≈ᵢ_
; id to idᵢ
; _∘_ to _∘ᵢ_
; iso to ⁻¹-iso
; module Equiv to Equivᵢ
; module HomReasoning to HomReasoningᵢ
; module iso to ⁻¹-iso
)
|
unordnung_auch_assembler/asm/attiny13/IR-sensitive/tinyProg.asm | no-go/Blink_atmega328p | 0 | 17595 | <reponame>no-go/Blink_atmega328p
.include "myTiny13.h"
.equ TASTER,3
.equ LEDB,1
;irq Vector
.org 0x0000
rjmp RESET
nop
rjmp PCINT0
.org 0x0010
RESET:
sbi DDRB,LEDB ; output
cbi DDRB,TASTER ; input
ldi A,0b00100000 ; IRQ react on PCINT
out GIMSK,A
sbi PCMSK,TASTER ; set PCINT on TASTER IRQ
sei
mainLoop:
rjmp mainLoop
.org 0x0030
PCINT0:
sbic PINB,TASTER ; IF tester clear
rjmp bitSet
cbi PORTB,LEDB ; then clear LED
reti
bitSet:
sbi PORTB,LEDB ; ELSE set bit
reti
|
WDE.PacketViewer/Filtering/Antlr/Syntax.g4 | T1ti/WoWDatabaseEditor | 0 | 2086 | grammar Syntax;
options {
language=CSharp;
}
@parser::namespace { WDE.PacketViewer.Filtering.Antlr }
@lexer::namespace { WDE.PacketViewer.Filtering.Antlr }
expr
: '(' expr ')' # EParen
| expr ('in' | 'IN') expr # EIn
| ID '.' ID # EFieldValue
| ID '(' (expr (',' expr)*)? ')' #EFuncAppl
| 'true' # ETrue
| 'false' # EFalse
| INT # EInt
| STRING #EStr
| '!' expr # ENegate
| expr '*' expr # EMulOp
| expr '/' expr # EDivOp
| expr '+' expr # EPlusOp
| expr '<' expr # ELessThan
| expr '<=' expr # ELessEquals
| expr '>' expr # EGreaterThan
| expr '>=' expr # EGreaterEquals
| expr '==' expr # EEquals
| expr '!=' expr # ENotEquals
| <assoc=right> expr ('&&' | 'and' | 'AND' ) expr # EAnd
| <assoc=right> expr ('||' | 'or' | 'OR' ) expr # EOr
;
fragment Letter : Capital | Small ;
fragment Capital : [A-Z\u00C0-\u00D6\u00D8-\u00DE] ;
fragment Small : [a-z\u00DF-\u00F6\u00F8-\u00FF] ;
fragment Digit : [0-9] ;
INT : Digit+ ;
STRING : '\'' .*? '\'' | '"' .*? '"';
fragment ID_First : Letter | '_';
ID : ID_First (ID_First | Digit)* ;
WS : (' ' | '\r' | '\t' | '\n')+ -> skip; |
programs/oeis/152/A152179.asm | neoneye/loda | 22 | 243070 | ; A152179: (n^2-2=A008865) mod 9. Period 9:repeat 8,2,7,5,5,7,2,8,7.
; 8,2,7,5,5,7,2,8,7,8,2,7,5,5,7,2,8,7,8,2,7,5,5,7,2,8,7,8,2,7,5,5,7,2,8,7,8,2,7,5,5,7,2,8,7,8,2,7,5,5,7,2,8,7
add $0,3
mov $2,$0
add $0,5
mul $0,$2
mod $0,9
add $0,2
|
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_1968.asm | ljhsiun2/medusa | 9 | 7954 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r15
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x17236, %rdx
cmp %rcx, %rcx
mov $0x6162636465666768, %rsi
movq %rsi, (%rdx)
nop
nop
dec %rdx
lea addresses_WC_ht+0xff3a, %rdi
nop
inc %r9
mov $0x6162636465666768, %rsi
movq %rsi, %xmm4
movups %xmm4, (%rdi)
nop
cmp %rsi, %rsi
lea addresses_normal_ht+0x3d36, %r15
nop
nop
nop
nop
sub $22301, %r13
mov (%r15), %rcx
nop
nop
nop
nop
nop
cmp %r9, %r9
lea addresses_normal_ht+0x1236, %r13
inc %rcx
mov $0x6162636465666768, %rdx
movq %rdx, %xmm3
movups %xmm3, (%r13)
dec %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_UC+0x1ceb6, %rsi
lea addresses_D+0x11a36, %rdi
nop
nop
nop
nop
nop
and %r10, %r10
mov $99, %rcx
rep movsb
nop
nop
nop
nop
and $8097, %rbp
// REPMOV
lea addresses_UC+0x17c36, %rsi
lea addresses_D+0x139e6, %rdi
nop
nop
nop
nop
nop
cmp %r12, %r12
mov $65, %rcx
rep movsb
nop
sub %rdi, %rdi
// Faulty Load
lea addresses_WT+0x2a36, %r10
nop
nop
add %r8, %r8
mov (%r10), %esi
lea oracles, %rcx
and $0xff, %rsi
shlq $12, %rsi
mov (%rcx,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WT', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_D', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
[Faulty Load]
{'src': {'type': 'addresses_WT', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 16, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
programs/oeis/086/A086303.asm | jmorken/loda | 1 | 24240 | ; A086303: Numbers n such that n+15 is prime.
; 2,4,8,14,16,22,26,28,32,38,44,46,52,56,58,64,68,74,82,86,88,92,94,98,112,116,122,124,134,136,142,148,152,158,164,166,176,178,182,184,196,208,212,214,218,224,226,236,242,248,254,256,262,266,268,278,292,296
add $0,6
cal $0,40 ; The prime numbers.
mov $1,$0
div $1,2
sub $1,7
mul $1,2
|
test/fail/StronglyRigidOccurrence.agda | dagit/agda | 1 | 8006 | <gh_stars>1-10
{-# OPTIONS --allow-unsolved-metas #-}
-- The option is supplied to force a real error to pass the regression test.
module StronglyRigidOccurrence where
data Nat : Set where
zero : Nat
suc : Nat -> Nat
data _≡_ {A : Set}(a : A) : A -> Set where
refl : a ≡ a
test : let X : Nat; X = _ in X ≡ suc X
test = refl
-- this gives an error in the occurs checker
|
oeis/244/A244755.asm | neoneye/loda-programs | 11 | 87427 | <reponame>neoneye/loda-programs
; A244755: a(n) = Sum_{k=0..n} C(n,k) * (1 + 3^k)^(n-k).
; Submitted by <NAME>
; 1,3,13,87,985,19563,697573,44195007,4985202865,987432857043,344306650353853,209169206074748967,222262777197258910345,409907753371580011362363,1317924525238880964004945813,7341603216747343890845790989967,71176841502529490992224798115792225,1194667970680888413525528371901563682723,34865797804284362538865418662612649277222253,1761008192451168682038287825213504779701222460407,154569917131087734622357204971262962359736238634530105,23476112125956100496499255877977753568993857456920007104523
mov $4,$0
lpb $0
sub $0,1
add $2,1
pow $2,$1
add $2,1
mov $3,$4
bin $3,$1
add $1,1
mul $3,$2
mov $2,3
pow $2,$0
add $5,$3
lpe
mov $0,$5
add $0,1
|
libsrc/_DEVELOPMENT/math/float/math16/lm16/c/sccz80/ldexp_callee.asm | witchcraft2001/z88dk | 640 | 91992 |
SECTION code_fp_math16
PUBLIC ldexpf16_callee
EXTERN cm16_sccz80_ldexp_callee
defc ldexpf16_callee = cm16_sccz80_ldexp_callee
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _ldexpf16_callee
EXTERN cm16_sdcc_ldexp_callee
defc _ldexpf16_callee = cm16_sdcc_ldexp_callee
ENDIF
|
oeis/042/A042911.asm | neoneye/loda-programs | 11 | 169236 | <gh_stars>10-100
; A042911: Denominators of continued fraction convergents to sqrt(987).
; Submitted by <NAME>(w3)
; 1,2,5,12,749,1510,3769,9048,564745,1138538,2841821,6822180,425816981,858456142,2142729265,5143914672,321065438929,647274792530,1615615023989,3878504840508,242082915135485,488044335111478,1218171585358441,2924387505828360,182530196946716761,367984781399261882,918499759745240525,2204984300889742932,137627526414909302309,277460037130708347550,692547600676325997409,1662555238483360342368,103770972386644667224225,209204500011772694790818,522179972410190056805861,1253564444832152808402540
add $0,1
mov $3,1
lpb $0
sub $0,1
add $3,$2
add $2,$3
mov $3,$1
mov $1,$2
dif $2,3
mod $2,$1
mul $2,180
add $3,$2
mov $2,$1
lpe
mov $0,$1
|
programs/oeis/011/A011895.asm | karttu/loda | 1 | 162527 | ; A011895: a(n) = floor(n*(n-1)*(n-2)/13).
; 0,0,0,0,1,4,9,16,25,38,55,76,101,132,168,210,258,313,376,447,526,613,710,817,934,1061,1200,1350,1512,1686,1873,2074,2289,2518,2761,3020,3295,3586,3893,4218,4560,4920,5298,5695,6112,6549,7006,7483,7982,8503,9046,9611,10200,10812,11448,12108,12793,13504,14241,15004,15793,16610,17455,18328,19229,20160,21120,22110,23130,24181,25264,26379,27526,28705,29918,31165,32446,33761,35112,36498,37920,39378,40873,42406,43977,45586,47233,48920,50647,52414,54221,56070,57960,59892,61866,63883,65944,68049,70198,72391,74630,76915,79246,81623,84048,86520,89040,91608,94225,96892,99609,102376,105193,108062,110983,113956,116981,120060,123192,126378,129618,132913,136264,139671,143134,146653,150230,153865,157558,161309,165120,168990,172920,176910,180961,185074,189249,193486,197785,202148,206575,211066,215621,220242,224928,229680,234498,239383,244336,249357,254446,259603,264830,270127,275494,280931,286440,292020,297672,303396,309193,315064,321009,327028,333121,339290,345535,351856,358253,364728,371280,377910,384618,391405,398272,405219,412246,419353,426542,433813,441166,448601,456120,463722,471408,479178,487033,494974,503001,511114,519313,527600,535975,544438,552989,561630,570360,579180,588090,597091,606184,615369,624646,634015,643478,653035,662686,672431,682272,692208,702240,712368,722593,732916,743337,753856,764473,775190,786007,796924,807941,819060,830280,841602,853026,864553,876184,887919,899758,911701,923750,935905,948166,960533,973008,985590,998280,1011078,1023985,1037002,1050129,1063366,1076713,1090172,1103743,1117426,1131221,1145130,1159152,1173288
bin $0,3
mul $0,36
div $0,78
mov $1,$0
|
oeis/141/A141752.asm | neoneye/loda-programs | 11 | 9154 | ; A141752: a(n) = Sum_{k=0..n} ( Fibonacci(2*k-1) + (n-k)*Fibonacci(2*k) ).
; 1,2,5,14,39,106,283,748,1967,5160,13521,35412,92725,242774,635609,1664066,4356603,11405758,29860687,78176320,204668291,535828572,1402817445,3672623784,9615053929,25172538026,65902560173,172535142518
mov $2,1
lpb $0
sub $0,1
add $1,$2
add $3,$2
add $3,1
add $2,$3
lpe
add $1,1
mov $0,$1
|
oeis/313/A313747.asm | neoneye/loda-programs | 11 | 27232 | ; A313747: Coordination sequence Gal.6.200.3 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,10,15,20,26,31,36,42,47,52,57,62,67,72,77,82,88,93,98,104,109,114,119,124,129,134,139,144,150,155,160,166,171,176,181,186,191,196,201,206,212,217,222,228,233,238,243,248,253
mov $1,$0
seq $1,313720 ; Coordination sequence Gal.6.153.4 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 $2,$0
mul $0,6
sub $0,1
mod $0,$1
add $0,1
mul $2,4
add $0,$2
|
src/Internals/protypo-parsing.ads | fintatarta/protypo | 0 | 17237 | <filename>src/Internals/protypo-parsing.ads
with Protypo.Scanning;
with Protypo.Code_Trees;
private
package Protypo.Parsing is
function Parse_Statement_Sequence (Input : in out Scanning.Token_List)
return Code_Trees.Parsed_Code;
function Parse_Expression (Input: in out Scanning.Token_List)
return Code_Trees.Parsed_Code;
end Protypo.Parsing;
|
Agda/Ag09.agda | Brethland/LEARNING-STUFF | 2 | 626 | <filename>Agda/Ag09.agda
module Ag09 where
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_; refl; cong; cong-app)
open Eq.≡-Reasoning
open import Data.Nat using (ℕ; zero; suc; _+_)
open import Data.Nat.Properties using (+-comm)
_∘_ : ∀ {A B C : Set} → (B → C) → (A → B) → (A → C)
(g ∘ f) x = g (f x)
infix 0 _≃_
record _≃_ (A B : Set) : Set where
field
to : A → B
from : B → A
from∘to : ∀ (x : A) → from (to x) ≡ x
to∘from : ∀ (y : B) → to (from y) ≡ y
open _≃_
infix 0 _≲_
record _≲_ (A B : Set) : Set where
field
to : A → B
from : B → A
from∘to : ∀ (x : A) → from (to x) ≡ x
open _≲_
-- exercises
≃-implies-≲ : ∀ {A B : Set}
→ A ≃ B
-----
→ A ≲ B
≃-implies-≲ A≃B =
record
{ to = to A≃B
; from = from A≃B
; from∘to = from∘to A≃B
}
record _⇔_ (A B : Set) : Set where
field
to : A → B
from : B → A
open _⇔_
⇔-refl : ∀ {A : Set} → A ⇔ A
⇔-refl =
record
{ to = λ{x → x}
; from = λ{y → y}
}
⇔-sym : ∀ {A B : Set} → A ⇔ B → B ⇔ A
⇔-sym A⇔B =
record
{ to = from A⇔B
; from = to A⇔B
}
⇔-trans : ∀ {A B C : Set} → A ⇔ B → B ⇔ C → A ⇔ C
⇔-trans A⇔B B⇔C =
record
{ to = to B⇔C ∘ to A⇔B
; from = from A⇔B ∘ from B⇔C
}
≃-refl : ∀ {A : Set}
-----
→ A ≃ A
≃-refl =
record
{ to = λ{x → x}
; from = λ{y → y}
; from∘to = λ{x → refl}
; to∘from = λ{y → refl}
}
≃-sym : ∀ {A B : Set}
→ A ≃ B
-----
→ B ≃ A
≃-sym A≃B =
record
{ to = from A≃B
; from = to A≃B
; from∘to = to∘from A≃B
; to∘from = from∘to A≃B
}
≃-trans : ∀ {A B C : Set}
→ A ≃ B
→ B ≃ C
-----
→ A ≃ C
≃-trans A≃B B≃C =
record
{ to = to B≃C ∘ to A≃B
; from = from A≃B ∘ from B≃C
; from∘to = λ{x →
begin
(from A≃B ∘ from B≃C) ((to B≃C ∘ to A≃B) x)
≡⟨⟩
from A≃B (from B≃C (to B≃C (to A≃B x)))
≡⟨ cong (from A≃B) (from∘to B≃C (to A≃B x)) ⟩
from A≃B (to A≃B x)
≡⟨ from∘to A≃B x ⟩
x
∎}
; to∘from = λ{y →
begin
(to B≃C ∘ to A≃B) ((from A≃B ∘ from B≃C) y)
≡⟨⟩
to B≃C (to A≃B (from A≃B (from B≃C y)))
≡⟨ cong (to B≃C) (to∘from A≃B (from B≃C y)) ⟩
to B≃C (from B≃C y)
≡⟨ to∘from B≃C y ⟩
y
∎}
}
module ≃-Reasoning where
infix 1 ≃-begin_
infixr 2 _≃⟨_⟩_
infix 3 _≃-∎
≃-begin_ : ∀ {A B : Set}
→ A ≃ B
-----
→ A ≃ B
≃-begin A≃B = A≃B
_≃⟨_⟩_ : ∀ (A : Set) {B C : Set}
→ A ≃ B
→ B ≃ C
-----
→ A ≃ C
A ≃⟨ A≃B ⟩ B≃C = ≃-trans A≃B B≃C
_≃-∎ : ∀ (A : Set)
-----
→ A ≃ A
A ≃-∎ = ≃-refl
open ≃-Reasoning
postulate
extensionality : ∀ {A B : Set} {f g : A → B}
→ (∀ (x : A) → f x ≡ g x)
-----------------------
→ f ≡ g
|
Vba.Language/Vba.Grammars/Preprocessor.g4 | rossknudsen/Vba.Language | 20 | 3739 | <gh_stars>10-100
grammar Preprocessor;
import Common;
// Parser Rules
headerLine
: classHeaderLine
| moduleAttribute
;
classHeaderLine
: WS* Version WS+ FloatLiteral WS+ Class WS*
| WS* Begin WS*
| WS* MultiUse WS* EQ WS* IntegerLiteral WS* COMMENT?
| WS* End WS*
;
moduleAttribute
: Attribute WS+ VbName WS* EQ WS* ModuleName WS*
| Attribute WS+ optionalAttributes WS* EQ WS* boolLiteral WS*
;
optionalAttributes
: VbExposed
| VbGlobalNamespace
| VbCreatable
| VbPredeclaredId
| VbCustomizable
;
preprocessorStatement
: constantDeclaration
| ifStatement
| elseIfStatement
| elseStatement
| endIfStatement
;
constantDeclaration
: WS* '#' Const WS+ ID WS* EQ WS* expression WS*
;
ifStatement
: WS* '#' If WS+ expression WS+ Then WS*
;
elseIfStatement
: WS* '#' ElseIf WS+ expression WS+ Then WS*
;
elseStatement
: WS* '#' Else WS*
;
endIfStatement
: WS* '#' End WS+ If WS*
;
//Lexer Rules
ModuleName : '"' [A-Za-z] [A-Za-z0-9_]* '"';
// Module Header Keywords
Attribute : 'Attribute';
VbName : 'VB_Name';
VbExposed : 'VB_Exposed';
VbGlobalNamespace : 'VB_GlobalNameSpace';
VbCreatable : 'VB_Creatable';
VbPredeclaredId : 'VB_PredeclaredId';
VbCustomizable : 'VB_Customizable';
// Keywords
Begin : 'BEGIN';
Class : 'CLASS';
MultiUse : 'MultiUse';
Version : 'VERSION';
|
libsrc/osca/get_dir_name.asm | andydansby/z88dk-mk2 | 1 | 87662 | ;
; Old School Computer Architecture - interfacing FLOS
; <NAME>, 2012
;
; Get name of current directory
;
; $Id: get_dir_name.asm,v 1.2 2012/03/08 07:16:46 stefano Exp $
;
INCLUDE "flos.def"
XLIB get_dir_name
get_dir_name:
jp kjt_get_dir_name
|
Definition/Conversion/Lift.agda | CoqHott/logrel-mltt | 2 | 570 | <reponame>CoqHott/logrel-mltt<filename>Definition/Conversion/Lift.agda
{-# OPTIONS --safe #-}
module Definition.Conversion.Lift where
open import Definition.Untyped
open import Definition.Untyped.Properties
open import Definition.Typed
open import Definition.Typed.Weakening
open import Definition.Typed.Properties
open import Definition.Typed.EqRelInstance
open import Definition.Conversion
open import Definition.Conversion.Whnf
open import Definition.Conversion.Soundness
open import Definition.Conversion.Reduction
open import Definition.Conversion.Weakening
open import Definition.LogicalRelation
open import Definition.LogicalRelation.Properties
open import Definition.LogicalRelation.Fundamental.Reducibility
open import Definition.Typed.Consequences.Syntactic
open import Definition.Typed.Consequences.Reduction
open import Definition.Typed.Consequences.Equality
open import Tools.Product
import Tools.PropositionalEquality as PE
-- Lifting of algorithmic equality of types from WHNF to generic types.
liftConv : ∀ {A B rA Γ}
→ Γ ⊢ A [conv↓] B ^ rA
→ Γ ⊢ A [conv↑] B ^ rA
liftConv A<>B =
let ⊢A , ⊢B = syntacticEq (soundnessConv↓ A<>B)
whnfA , whnfB = whnfConv↓ A<>B
in [↑] _ _ (id ⊢A) (id ⊢B) whnfA whnfB A<>B
-- Lifting of algorithmic equality of terms from WHNF to generic terms.
liftConvTerm : ∀ {t u A Γ l}
→ Γ ⊢ t [conv↓] u ∷ A ^ l
→ Γ ⊢ t [conv↑] u ∷ A ^ l
liftConvTerm t<>u =
let ⊢A , ⊢t , ⊢u = syntacticEqTerm (soundnessConv↓Term t<>u)
whnfA , whnfT , whnfU = whnfConv↓Term t<>u
in [↑]ₜ _ _ _ (id ⊢A) (id ⊢t) (id ⊢u) whnfA whnfT whnfU t<>u
mutual
-- Helper function for lifting from neutrals to generic terms in WHNF.
lift~toConv↓!′ : ∀ {t u A A′ Γ l lA }
→ Γ ⊩⟨ l ⟩ A′ ^ [ ! , lA ]
→ Γ ⊢ A′ ⇒* A ^ [ ! , lA ]
→ Γ ⊢ t ~ u ↓! A ^ lA
→ Γ ⊢ t [conv↓] u ∷ A ^ lA
lift~toConv↓!′ (Uᵣ′ _ l r l' l< PE.refl d) D ([~] A D₁ whnfB k~l)
rewrite U≡A-whnf (trans (sym (subset* (red d))) (subset* D)) whnfB =
ne ([~] A D₁ Uₙ k~l)
lift~toConv↓!′ (ℕᵣ D) D₁ ([~] A D₂ whnfB k~l)
rewrite PE.sym (whrDet* (red D , ℕₙ) (D₁ , whnfB)) =
ℕ-ins ([~] A D₂ ℕₙ k~l)
lift~toConv↓!′ (ne′ K D neK K≡K) D₁ ([~] A D₂ whnfB k~l)
rewrite PE.sym (whrDet* (red D , ne neK) (D₁ , whnfB)) =
let _ , ⊢t , ⊢u = syntacticEqTerm (soundness~↑! k~l)
A≡K = subset* D₂
in ne-ins (conv ⊢t A≡K) (conv ⊢u A≡K) neK ([~] A D₂ (ne neK) k~l)
lift~toConv↓!′ (Πᵣ′ rF lF lG l< l<' F G D ⊢F ⊢G A≡A [F] [G] G-ext) D₁ ([~] A D₂ whnfB k~l) with PE.sym (whrDet* (red D , Πₙ) (D₁ , whnfB))
lift~toConv↓!′ (Πᵣ′ ! lF lG l< l<' F G D ⊢F ⊢G A≡A [F] [G] G-ext) D₁ ([~] A D₂ whnfB k~l) | PE.refl =
let ⊢ΠFG , ⊢t , ⊢u = syntacticEqTerm (soundness~↓! ([~] A D₂ Πₙ k~l))
neT , neU = ne~↑! k~l
⊢Γ = wf ⊢F
var0 = neuTerm ([F] (step id) (⊢Γ ∙ ⊢F)) (var 0) (var (⊢Γ ∙ ⊢F) here)
(genRefl (var (⊢Γ ∙ ⊢F) here))
0≡0 = lift~toConv↑′ ([F] (step id) (⊢Γ ∙ ⊢F)) (var-refl′ (var (⊢Γ ∙ ⊢F) here))
k∘0≡l∘0 = lift~toConv↑′ ([G] (step id) (⊢Γ ∙ ⊢F) var0)
(~↑! (app-cong (wk~↓! (step id) (⊢Γ ∙ ⊢F) ([~] A D₂ Πₙ k~l)) 0≡0))
in η-eq l< l<' ⊢F ⊢t ⊢u (ne neT) (ne neU)
(PE.subst (λ x → _ ⊢ _ [conv↑] _ ∷ x ^ _)
(wkSingleSubstId _)
k∘0≡l∘0)
lift~toConv↓!′ (Πᵣ′ % lF lG l< l<' F G D ⊢F ⊢G A≡A [F] [G] G-ext) D₁ ([~] A D₂ whnfB k~l) | PE.refl =
let ⊢ΠFG , ⊢t , ⊢u = syntacticEqTerm (soundness~↓! ([~] A D₂ Πₙ k~l))
neT , neU = ne~↑! k~l
⊢Γ = wf ⊢F
var0 = neuTerm ([F] (step id) (⊢Γ ∙ ⊢F)) (var 0) (var (⊢Γ ∙ ⊢F) here)
(genRefl (var (⊢Γ ∙ ⊢F) here))
k∘0≡l∘0 = lift~toConv↑′ ([G] (step id) (⊢Γ ∙ ⊢F) var0)
(~↑! (app-cong (wk~↓! (step id) (⊢Γ ∙ ⊢F) ([~] A D₂ Πₙ k~l)) (%~↑ (var (⊢Γ ∙ ⊢F) here) (var (⊢Γ ∙ ⊢F) here))))
in η-eq l< l<' ⊢F ⊢t ⊢u (ne neT) (ne neU)
(PE.subst (λ x → _ ⊢ _ [conv↑] _ ∷ x ^ _)
(wkSingleSubstId _)
k∘0≡l∘0)
lift~toConv↓!′ (emb emb< [A]) D t~u = lift~toConv↓!′ [A] D t~u
lift~toConv↓!′ (emb ∞< [A]) D t~u = lift~toConv↓!′ [A] D t~u
-- Helper function for lifting from neutrals to generic terms.
lift~toConv↑!′ : ∀ {t u A Γ l lA}
→ Γ ⊩⟨ l ⟩ A ^ [ ! , lA ]
→ Γ ⊢ t ~ u ↑! A ^ lA
→ Γ ⊢ t [conv↑] u ∷ A ^ lA
lift~toConv↑!′ [A] t~u =
let B , whnfB , D = whNorm′ [A]
t~u↓ = [~] _ (red D) whnfB t~u
neT , neU = ne~↑! t~u
_ , ⊢t , ⊢u = syntacticEqTerm (soundness~↓! t~u↓)
in [↑]ₜ _ _ _ (red D) (id ⊢t) (id ⊢u) whnfB
(ne neT) (ne neU) (lift~toConv↓!′ [A] (red D) t~u↓)
lift~toConv↑′ : ∀ {t u A Γ l lA}
→ Γ ⊩⟨ l ⟩ A ^ [ ! , lA ]
→ Γ ⊢ t ~ u ↑ A ^ [ ! , lA ]
→ Γ ⊢ t [conv↑] u ∷ A ^ lA
lift~toConv↑′ [A] (~↑! x) = lift~toConv↑!′ [A] x
-- Lifting of algorithmic equality of terms from neutrals to generic terms in WHNF.
lift~toConv↓! : ∀ {t u A Γ lA}
→ Γ ⊢ t ~ u ↓! A ^ lA
→ Γ ⊢ t [conv↓] u ∷ A ^ lA
lift~toConv↓! ([~] A D whnfB k~l) =
lift~toConv↓!′ (reducible (proj₁ (syntacticRed D))) D ([~] A D whnfB k~l)
lift~toConv↓ : ∀ {t u A Γ lA}
→ Γ ⊢ t ~ u ↓! A ^ lA
→ Γ ⊢ t [conv↓] u ∷ A ^ lA
lift~toConv↓ x = lift~toConv↓! x
-- Lifting of algorithmic equality of terms from neutrals to generic terms.
lift~toConv↑! : ∀ {t u A Γ lA}
→ Γ ⊢ t ~ u ↑! A ^ lA
→ Γ ⊢ t [conv↑] u ∷ A ^ lA
lift~toConv↑! t~u =
lift~toConv↑!′ (reducible (proj₁ (syntacticEqTerm (soundness~↑! t~u)))) t~u
lift~toConv↑ : ∀ {t u A Γ lA}
→ Γ ⊢ t ~ u ↑ A ^ [ ! , lA ]
→ Γ ⊢ t [conv↑] u ∷ A ^ lA
lift~toConv↑ (~↑! t~u) = lift~toConv↑! t~u
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2_notsx.log_165_1762.asm | ljhsiun2/medusa | 9 | 162088 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x1a3ad, %rsi
nop
nop
nop
nop
nop
add %r9, %r9
movb $0x61, (%rsi)
dec %rbx
lea addresses_UC_ht+0x19705, %r13
nop
nop
nop
nop
sub %rbx, %rbx
movups (%r13), %xmm5
vpextrq $0, %xmm5, %r12
and $52648, %r12
lea addresses_normal_ht+0x1b7a5, %rsi
lea addresses_WC_ht+0x17fa5, %rdi
nop
nop
nop
nop
add %r9, %r9
mov $45, %rcx
rep movsl
nop
nop
nop
nop
nop
cmp $24448, %rsi
lea addresses_normal_ht+0x170ad, %r12
nop
and $64987, %rsi
mov (%r12), %r11d
cmp %rsi, %rsi
lea addresses_normal_ht+0x752d, %rsi
nop
nop
and $35021, %r12
mov $0x6162636465666768, %r9
movq %r9, %xmm3
movups %xmm3, (%rsi)
sub $57881, %r9
lea addresses_A_ht+0x193ad, %rsi
lea addresses_UC_ht+0x1022d, %rdi
cmp %r9, %r9
mov $42, %rcx
rep movsb
nop
nop
nop
nop
inc %r11
lea addresses_WT_ht+0x1600d, %r9
nop
nop
nop
nop
sub %rbx, %rbx
mov (%r9), %cx
nop
nop
nop
inc %rcx
lea addresses_UC_ht+0x13ad, %r12
nop
nop
nop
nop
sub $2260, %r9
and $0xffffffffffffffc0, %r12
movntdqa (%r12), %xmm6
vpextrq $0, %xmm6, %rbx
nop
nop
xor $63179, %r9
lea addresses_WC_ht+0x6c08, %r13
nop
nop
nop
nop
nop
inc %r9
vmovups (%r13), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %rcx
nop
and %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r15
push %rbp
push %rbx
push %rcx
push %rdx
// Load
lea addresses_normal+0x19e8b, %r13
nop
nop
nop
nop
and $8095, %rbx
mov (%r13), %bp
// Exception!!!
nop
nop
nop
nop
nop
mov (0), %r14
nop
nop
nop
nop
xor %rbp, %rbp
// Load
lea addresses_A+0x19d0d, %r14
nop
nop
nop
nop
nop
dec %rbx
vmovups (%r14), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $0, %xmm5, %r13
nop
nop
nop
nop
and $44745, %rbx
// Store
lea addresses_US+0x1106d, %rbx
nop
nop
cmp $1083, %rcx
mov $0x5152535455565758, %rbp
movq %rbp, (%rbx)
nop
nop
nop
nop
cmp $44016, %rbx
// Store
lea addresses_RW+0x33ed, %r14
nop
nop
nop
nop
nop
inc %rcx
mov $0x5152535455565758, %rbx
movq %rbx, %xmm4
vmovups %ymm4, (%r14)
sub %r13, %r13
// Faulty Load
lea addresses_normal+0x3bad, %rcx
nop
nop
nop
nop
cmp %r15, %r15
movntdqa (%rcx), %xmm7
vpextrq $0, %xmm7, %r14
lea oracles, %rbx
and $0xff, %r14
shlq $12, %r14
mov (%rbx,%r14,1), %r14
pop %rdx
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 11, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'00': 165}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
programs/oeis/037/A037461.asm | neoneye/loda | 22 | 163383 | <gh_stars>10-100
; A037461: a(n)=Sum{d(i)*7^i: i=0,1,...,m}, where Sum{d(i)*4^i: i=0,1,...,m} is the base 4 representation of n.
; 1,2,3,7,8,9,10,14,15,16,17,21,22,23,24,49,50,51,52,56,57,58,59,63,64,65,66,70,71,72,73,98,99,100,101,105,106,107,108,112,113,114,115,119,120,121,122,147,148,149,150,154,155,156,157,161,162,163,164,168,169,170,171,343,344,345,346,350,351,352,353,357,358,359,360,364,365,366,367,392,393,394,395,399,400,401,402,406,407,408,409,413,414,415,416,441,442,443,444,448
mov $4,$0
add $4,1
mov $6,$0
lpb $4
mov $0,$6
mov $3,0
sub $4,1
sub $0,$4
mov $2,70
mov $5,1
add $5,$0
add $3,$5
lpb $3
mul $2,7
dif $3,4
lpe
mov $5,$2
div $5,420
mul $5,3
add $5,1
add $1,$5
lpe
mov $0,$1
|
theorems/cw/cohomology/FirstCohomologyGroup.agda | mikeshulman/HoTT-Agda | 0 | 15882 | {-# OPTIONS --without-K --rewriting #-}
open import HoTT
open import cohomology.Theory
open import cohomology.PtdMapSequence
open import groups.ExactSequence
open import groups.Exactness
open import groups.HomSequence
open import groups.KernelImageUniqueFactorization
open import cw.CW
module cw.cohomology.FirstCohomologyGroup {i} (OT : OrdinaryTheory i)
(⊙skel : ⊙Skeleton {i} 2) (ac : ⊙has-cells-with-choice 0 ⊙skel i) where
open OrdinaryTheory OT
open import cw.cohomology.TipAndAugment OT (⊙cw-take (lteSR lteS) ⊙skel)
open import cw.cohomology.WedgeOfCells OT
open import cw.cohomology.TipCoboundary OT (⊙cw-init ⊙skel)
open import cw.cohomology.HigherCoboundary OT ⊙skel
open import cw.cohomology.HigherCoboundaryGrid OT ⊙skel ac
open import cw.cohomology.GridPtdMap (⊙cw-incl-last (⊙cw-init ⊙skel)) (⊙cw-incl-last ⊙skel)
open import cw.cohomology.TipGrid OT (⊙cw-init ⊙skel) (⊙init-has-cells-with-choice ⊙skel ac)
open import cw.cohomology.TopGrid OT 1 (⊙cw-incl-last (⊙cw-init ⊙skel)) (⊙cw-incl-last ⊙skel)
open import cohomology.LongExactSequence cohomology-theory
private
0≤2 : 0 ≤ 2
0≤2 = lteSR lteS
ac₀ = ⊙take-has-cells-with-choice 0≤2 ⊙skel ac
{-
H
Coker ≃ C(X₁)<------C(X₂) = C(X)
^ ^
| |
| |
C(X₁/X₀)<---C(X₂/X₀) ≃ Ker
WoC G
WoC := Wedges of Cells
-}
private
G : Group i
G = C 1 (⊙Cofiber (⊙cw-incl-tail 0≤2 ⊙skel))
G-iso-Ker : G ≃ᴳ Ker.grp cw-co∂-last
G-iso-Ker = Ker-cw-co∂-last
H : Group i
H = C 1 ⊙⟦ ⊙cw-init ⊙skel ⟧
Coker-iso-H : CokerCo∂Head.grp ≃ᴳ H
Coker-iso-H = Coker-cw-co∂-head
G-to-C-cw : G →ᴳ C 1 ⊙⟦ ⊙skel ⟧
G-to-C-cw = C-fmap 1 (⊙cfcod' (⊙cw-incl-tail 0≤2 ⊙skel))
abstract
G-to-C-cw-is-surj : is-surjᴳ G-to-C-cw
G-to-C-cw-is-surj = Exact.K-trivial-implies-φ-is-surj
(exact-seq-index 2 $ C-cofiber-exact-seq 0 (⊙cw-incl-tail 0≤2 ⊙skel))
(CX₀-≠-is-trivial (pos-≠ (ℕ-S≠O 0)) ac₀)
C-cw-to-H : C 1 ⊙⟦ ⊙skel ⟧ →ᴳ H
C-cw-to-H = C-fmap 1 (⊙cw-incl-last ⊙skel)
abstract
C-cw-to-H-is-inj : is-injᴳ C-cw-to-H
C-cw-to-H-is-inj = Exact.G-trivial-implies-ψ-is-inj
(exact-seq-index 2 $ C-cofiber-exact-seq 0 (⊙cw-incl-last ⊙skel))
(CXₙ/Xₙ₋₁-<-is-trivial ⊙skel ltS ac)
C-WoC : Group i
C-WoC = C 1 (⊙Cofiber (⊙cw-incl-last (⊙cw-init ⊙skel)))
G-to-C-WoC : G →ᴳ C-WoC
G-to-C-WoC = C-fmap 1 Y/X-to-Z/X
C-WoC-to-H : C-WoC →ᴳ H
C-WoC-to-H = C-fmap 1 (⊙cfcod' (⊙cw-incl-last (⊙cw-init ⊙skel)))
open import groups.KernelImage cw-co∂-last cw-co∂-head CX₁/X₀-is-abelian
C-cw-iso-ker/im : C 1 ⊙⟦ ⊙skel ⟧ ≃ᴳ Ker/Im
C-cw-iso-ker/im = H-iso-Ker/Im
cw-co∂-last cw-co∂-head CX₁/X₀-is-abelian
φ₁ φ₁-is-surj φ₂ φ₂-is-inj lemma-comm
where
φ₁ = G-to-C-cw ∘ᴳ GroupIso.g-hom G-iso-Ker
abstract
φ₁-is-surj : is-surjᴳ φ₁
φ₁-is-surj = ∘-is-surj G-to-C-cw-is-surj (equiv-is-surj (GroupIso.g-is-equiv G-iso-Ker))
φ₂ = GroupIso.g-hom Coker-iso-H ∘ᴳ C-cw-to-H
abstract
φ₂-is-inj : is-injᴳ φ₂
φ₂-is-inj = ∘-is-inj (equiv-is-inj (GroupIso.g-is-equiv Coker-iso-H)) C-cw-to-H-is-inj
abstract
lemma-comm : ∀ g →
GroupIso.g Coker-iso-H (GroupHom.f (C-cw-to-H ∘ᴳ G-to-C-cw) (GroupIso.g G-iso-Ker g))
== q[ fst g ]
lemma-comm g =
GroupIso.g Coker-iso-H (GroupHom.f C-cw-to-H (GroupHom.f G-to-C-cw (GroupIso.g G-iso-Ker g)))
=⟨ ap (GroupIso.g Coker-iso-H) (! (C-top-grid-commutes □$ᴳ GroupIso.g G-iso-Ker g)) ⟩
GroupIso.g Coker-iso-H (GroupHom.f C-WoC-to-H (GroupHom.f G-to-C-WoC (GroupIso.g G-iso-Ker g)))
=⟨ ap (GroupIso.g Coker-iso-H ∘ GroupHom.f C-WoC-to-H ∘ fst) (GroupIso.f-g G-iso-Ker g) ⟩
GroupIso.g Coker-iso-H (GroupHom.f C-WoC-to-H (fst g))
=⟨ GroupIso.g-f Coker-iso-H q[ fst g ] ⟩
q[ fst g ]
=∎
|
libsrc/target/mz/stdio/generic_console.asm | Frodevan/z88dk | 640 | 94587 | <reponame>Frodevan/z88dk<filename>libsrc/target/mz/stdio/generic_console.asm
;
; Sharp colours
;
; 0 = black
; 1 = blue
; 2 = red
; 3 = purple
; 4 = green
; 5 = light blue
; 6 = yellow
; 7 = white
SECTION code_clib
PUBLIC generic_console_cls
PUBLIC generic_console_vpeek
PUBLIC generic_console_scrollup
PUBLIC generic_console_printc
PUBLIC generic_console_ioctl
PUBLIC generic_console_set_ink
PUBLIC generic_console_set_paper
PUBLIC generic_console_set_attribute
EXTERN sharpmz_from_ascii
EXTERN sharpmz_to_ascii
EXTERN CONSOLE_COLUMNS
EXTERN CONSOLE_ROWS
defc DISPLAY = 0xd000
defc COLOUR_MAP = 0xd800
INCLUDE "ioctl.def"
PUBLIC CLIB_GENCON_CAPS
defc CLIB_GENCON_CAPS = CAP_GENCON_FG_COLOUR | CAP_GENCON_BG_COLOUR
generic_console_ioctl:
scf
ret
; For the Sharp we use inverse to switch to the alternate character set
generic_console_set_attribute:
ld b,(hl) ;flags 2 - we want bit 7
ld a,(__sharpmz_attr)
rla ;dump existing extend flag
rr b ;get new flag
rra
ld (__sharpmz_attr),a
ret
generic_console_set_ink:
and 7
rla
rla
rla
rla
ld e,a
ld a,(__sharpmz_attr)
and @10000111
or e
ld (__sharpmz_attr),a
ret
generic_console_set_paper:
and 7
ld e,a
ld a,(__sharpmz_attr)
and @11110000
or e
ld (__sharpmz_attr),a
ret
generic_console_cls:
ld hl, DISPLAY
ld de, DISPLAY +1
ld bc, +(CONSOLE_COLUMNS * CONSOLE_ROWS) - 1
ld (hl),0
ldir
ld hl, COLOUR_MAP
ld de, COLOUR_MAP+1
ld bc, +(CONSOLE_COLUMNS * CONSOLE_ROWS) - 1
ld a,(__sharpmz_attr)
ld (hl),a
ldir
ret
; c = x
; b = y
; a = character to print
; e = raw
generic_console_printc:
rr e
call nc,sharpmz_from_ascii ;exits with a = character
call xypos
ld (hl),a
ld a,h
add 8
ld h,a
ld a,(__sharpmz_attr)
ld (hl),a
ret
;Entry: c = x,
; b = y
;Exit: nc = success
; a = character,
; c = failure
generic_console_vpeek:
push de
call xypos
ld a,(hl)
pop de
rr e
call nc, sharpmz_to_ascii
and a
ret
xypos:
ld hl,DISPLAY - CONSOLE_COLUMNS
ld de,CONSOLE_COLUMNS
inc b
generic_console_printc_1:
add hl,de
djnz generic_console_printc_1
generic_console_printc_3:
add hl,bc ;hl now points to address in display
ret
generic_console_scrollup:
push de
push bc
ld hl, DISPLAY + CONSOLE_COLUMNS
ld de, DISPLAY
ld bc,+ ((CONSOLE_COLUMNS) * (CONSOLE_ROWS-1))
ldir
ex de,hl
ld b,CONSOLE_COLUMNS
generic_console_scrollup_3:
ld (hl),0
inc hl
djnz generic_console_scrollup_3
ld hl, COLOUR_MAP + CONSOLE_COLUMNS
ld de, COLOUR_MAP
ld bc,+ ((CONSOLE_COLUMNS) * (CONSOLE_ROWS-1))
ldir
ex de,hl
ld b,CONSOLE_COLUMNS
ld a,(__sharpmz_attr)
generic_console_scrollup_4:
ld (hl),a
inc hl
djnz generic_console_scrollup_4
pop bc
pop de
ret
SECTION data_clib
.__sharpmz_attr defb $70 ; White on Black
|
08/tests/test3/test3.asm | Savioor/nand2tetris2022-public | 0 | 178145 | <filename>08/tests/test3/test3.asm
//init SP
@256
D = A
@SP
M = D
//init LCL
@256
D = A
@LCL
M = D
//init ARG
@256
D = A
@ARG
M = D
// call Sys.init 0
// get ip
@RET_ADDR0
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@5
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Sys.init
0; JMP
(RET_ADDR0)
// function Array.new 0
(f_Array.new)
// write 0 for every local var
@LCL
A = M
@0
D = A
@SP
M = M + D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// gt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE02
D; JLE
@YGT02
D; JGT
(YLE02)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH2 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE2 // IF Y < 0 AND X > 0
D; JGT
@NOTTRUE2
0;JMP
(YGT02)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH2 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE2 // IF Y > 0 AND X < 0
D; JGT
@NOTTRUE2
0; JMP
//D HOLDS X
(BOTH2)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE2
D; JGT
@NOTTRUE2
0;JMP
(NOTTRUE2)
@SP
A = M -1
M = 0
@ENDTRUE2
0; JMP
(TRUE2)
@SP
A = M - 1
M = -1
(ENDTRUE2)
// not
@SP
A = M - 1
M = ! M
@SP
AM = M - 1
D = M
@Array.new$IF_TRUE0
D; JNE
@Array.new$IF_FALSE0
0; JMP
(Array.new$IF_TRUE0)
// push constant 2
@2
D = A
@SP
M = M + 1
A = M - 1
M = D
// call Sys.error 1
// get ip
@RET_ADDR2
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@6
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Sys.error
0; JMP
(RET_ADDR2)
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Array.new$IF_FALSE0)
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// call Memory.alloc 1
// get ip
@RET_ADDR3
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@6
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Memory.alloc
0; JMP
(RET_ADDR3)
// return
@LCL // frame = LCL
D = M
@R13 // R13 is frame
M = D
@5
A = D - A
D = M
@R14
M = D // sets retAddr to frame - 5
@SP
AM = M - 1
D = M
@ARG
A = M // *ARG = pop
M = D
@ARG
D = M
@SP
M = D + 1
@R13
M = M - 1
@R13
A = M
D = M
@THAT
M = D
@R13
M = M - 1
@R13
A = M
D = M
@THIS
M = D
@R13
M = M - 1
@R13
A = M
D = M
@ARG
M = D
@R13
M = M - 1
@R13
A = M
D = M
@LCL
M = D
@R14
A = M
0; JMP
// function Array.dispose 0
(f_Array.dispose)
// write 0 for every local var
@LCL
A = M
@0
D = A
@SP
M = M + D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop pointer 0
@0
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push pointer 0
@0
D = A
@3
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// call Memory.deAlloc 1
// get ip
@RET_ADDR4
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@6
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Memory.deAlloc
0; JMP
(RET_ADDR4)
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// return
@LCL // frame = LCL
D = M
@R13 // R13 is frame
M = D
@5
A = D - A
D = M
@R14
M = D // sets retAddr to frame - 5
@SP
AM = M - 1
D = M
@ARG
A = M // *ARG = pop
M = D
@ARG
D = M
@SP
M = D + 1
@R13
M = M - 1
@R13
A = M
D = M
@THAT
M = D
@R13
M = M - 1
@R13
A = M
D = M
@THIS
M = D
@R13
M = M - 1
@R13
A = M
D = M
@ARG
M = D
@R13
M = M - 1
@R13
A = M
D = M
@LCL
M = D
@R14
A = M
0; JMP
// function Main.main 12
(f_Main.main)
// write 0 for every local var
@LCL
A = M
M = 0
A = A + 1
M = 0
A = A + 1
M = 0
A = A + 1
M = 0
A = A + 1
M = 0
A = A + 1
M = 0
A = A + 1
M = 0
A = A + 1
M = 0
A = A + 1
M = 0
A = A + 1
M = 0
A = A + 1
M = 0
A = A + 1
M = 0
A = A + 1
@12
D = A
@SP
M = M + D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// pop local 0
@0
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 2
@2
D = A
@SP
M = M + 1
A = M - 1
M = D
// pop local 1
@1
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 3
@3
D = A
@SP
M = M + 1
A = M - 1
M = D
// pop local 2
@2
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 4
@4
D = A
@SP
M = M + 1
A = M - 1
M = D
// pop local 3
@3
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 5
@5
D = A
@SP
M = M + 1
A = M - 1
M = D
// pop local 4
@4
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 6
@6
D = A
@SP
M = M + 1
A = M - 1
M = D
// pop local 5
@5
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push local 2
@2
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push local 3
@3
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push local 4
@4
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push local 5
@5
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop local 6
@6
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// call Math.multiply 2
// get ip
@RET_ADDR5
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@7
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Math.multiply
0; JMP
(RET_ADDR5)
// push local 2
@2
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 3
@3
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// call Math.multiply 2
// get ip
@RET_ADDR6
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@7
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Math.multiply
0; JMP
(RET_ADDR6)
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push local 4
@4
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 5
@5
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// call Math.multiply 2
// get ip
@RET_ADDR7
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@7
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Math.multiply
0; JMP
(RET_ADDR7)
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop local 7
@7
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push local 5
@5
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// call Math.divide 2
// get ip
@RET_ADDR8
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@7
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Math.divide
0; JMP
(RET_ADDR8)
// push local 4
@4
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// call Math.divide 2
// get ip
@RET_ADDR9
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@7
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Math.divide
0; JMP
(RET_ADDR9)
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// call Math.divide 2
// get ip
@RET_ADDR10
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@7
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Math.divide
0; JMP
(RET_ADDR10)
// pop local 8
@8
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 5000
@5000
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 6
@6
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// call Memory.poke 2
// get ip
@RET_ADDR11
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@7
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Memory.poke
0; JMP
(RET_ADDR11)
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 5001
@5001
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 7
@7
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// call Memory.poke 2
// get ip
@RET_ADDR12
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@7
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Memory.poke
0; JMP
(RET_ADDR12)
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 5002
@5002
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 8
@8
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// call Memory.poke 2
// get ip
@RET_ADDR13
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@7
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Memory.poke
0; JMP
(RET_ADDR13)
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// return
@LCL // frame = LCL
D = M
@R13 // R13 is frame
M = D
@5
A = D - A
D = M
@R14
M = D // sets retAddr to frame - 5
@SP
AM = M - 1
D = M
@ARG
A = M // *ARG = pop
M = D
@ARG
D = M
@SP
M = D + 1
@R13
M = M - 1
@R13
A = M
D = M
@THAT
M = D
@R13
M = M - 1
@R13
A = M
D = M
@THIS
M = D
@R13
M = M - 1
@R13
A = M
D = M
@ARG
M = D
@R13
M = M - 1
@R13
A = M
D = M
@LCL
M = D
@R14
A = M
0; JMP
// function Math.init 1
(f_Math.init)
// write 0 for every local var
@LCL
A = M
M = 0
A = A + 1
@1
D = A
@SP
M = M + D
// push constant 16
@16
D = A
@SP
M = M + 1
A = M - 1
M = D
// call Array.new 1
// get ip
@RET_ADDR14
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@6
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Array.new
0; JMP
(RET_ADDR14)
// pop static 1
@Math.1
D = A
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 16
@16
D = A
@SP
M = M + 1
A = M - 1
M = D
// call Array.new 1
// get ip
@RET_ADDR15
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@6
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Array.new
0; JMP
(RET_ADDR15)
// pop static 0
@Math.0
D = A
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// push static 0
@Math.0
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push temp 0
@0
D = A
@5
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop that 0
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Math.init$WHILE_EXP0)
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 15
@15
D = A
@SP
M = M + 1
A = M - 1
M = D
// lt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE017
D; JLE
@YGT017
D; JGT
(YLE017)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH17 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE17 // IF Y < 0 AND X > 0
D; JLT
@NOTTRUE17
0;JMP
(YGT017)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH17 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE17 // IF Y > 0 AND X < 0
D; JLT
@NOTTRUE17
0; JMP
//D HOLDS X
(BOTH17)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE17
D; JLT
@NOTTRUE17
0;JMP
(NOTTRUE17)
@SP
A = M -1
M = 0
@ENDTRUE17
0; JMP
(TRUE17)
@SP
A = M - 1
M = -1
(ENDTRUE17)
// not
@SP
A = M - 1
M = ! M
@SP
AM = M - 1
D = M
@Math.init$WHILE_END0
D; JNE
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop local 0
@0
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push static 0
@Math.0
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// sub
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D - M
A = A - 1
M = D
@SP
M = M - 1
// push static 0
@Math.0
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// sub
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D - M
A = A - 1
M = D
@SP
M = M - 1
// push static 0
@Math.0
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push temp 0
@0
D = A
@5
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop that 0
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
@Math.init$WHILE_EXP0
0; JMP
(Math.init$WHILE_END0)
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// return
@LCL // frame = LCL
D = M
@R13 // R13 is frame
M = D
@5
A = D - A
D = M
@R14
M = D // sets retAddr to frame - 5
@SP
AM = M - 1
D = M
@ARG
A = M // *ARG = pop
M = D
@ARG
D = M
@SP
M = D + 1
@R13
M = M - 1
@R13
A = M
D = M
@THAT
M = D
@R13
M = M - 1
@R13
A = M
D = M
@THIS
M = D
@R13
M = M - 1
@R13
A = M
D = M
@ARG
M = D
@R13
M = M - 1
@R13
A = M
D = M
@LCL
M = D
@R14
A = M
0; JMP
// function Math.abs 0
(f_Math.abs)
// write 0 for every local var
@LCL
A = M
@0
D = A
@SP
M = M + D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// lt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE018
D; JLE
@YGT018
D; JGT
(YLE018)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH18 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE18 // IF Y < 0 AND X > 0
D; JLT
@NOTTRUE18
0;JMP
(YGT018)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH18 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE18 // IF Y > 0 AND X < 0
D; JLT
@NOTTRUE18
0; JMP
//D HOLDS X
(BOTH18)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE18
D; JLT
@NOTTRUE18
0;JMP
(NOTTRUE18)
@SP
A = M -1
M = 0
@ENDTRUE18
0; JMP
(TRUE18)
@SP
A = M - 1
M = -1
(ENDTRUE18)
@SP
AM = M - 1
D = M
@Math.abs$IF_TRUE0
D; JNE
@Math.abs$IF_FALSE0
0; JMP
(Math.abs$IF_TRUE0)
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// neg
@SP
A = M - 1
M = - M
// pop argument 0
@0
D = A
@ARG
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Math.abs$IF_FALSE0)
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// return
@LCL // frame = LCL
D = M
@R13 // R13 is frame
M = D
@5
A = D - A
D = M
@R14
M = D // sets retAddr to frame - 5
@SP
AM = M - 1
D = M
@ARG
A = M // *ARG = pop
M = D
@ARG
D = M
@SP
M = D + 1
@R13
M = M - 1
@R13
A = M
D = M
@THAT
M = D
@R13
M = M - 1
@R13
A = M
D = M
@THIS
M = D
@R13
M = M - 1
@R13
A = M
D = M
@ARG
M = D
@R13
M = M - 1
@R13
A = M
D = M
@LCL
M = D
@R14
A = M
0; JMP
// function Math.multiply 5
(f_Math.multiply)
// write 0 for every local var
@LCL
A = M
M = 0
A = A + 1
M = 0
A = A + 1
M = 0
A = A + 1
M = 0
A = A + 1
M = 0
A = A + 1
@5
D = A
@SP
M = M + D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// lt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE019
D; JLE
@YGT019
D; JGT
(YLE019)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH19 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE19 // IF Y < 0 AND X > 0
D; JLT
@NOTTRUE19
0;JMP
(YGT019)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH19 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE19 // IF Y > 0 AND X < 0
D; JLT
@NOTTRUE19
0; JMP
//D HOLDS X
(BOTH19)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE19
D; JLT
@NOTTRUE19
0;JMP
(NOTTRUE19)
@SP
A = M -1
M = 0
@ENDTRUE19
0; JMP
(TRUE19)
@SP
A = M - 1
M = -1
(ENDTRUE19)
// push argument 1
@1
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// gt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE020
D; JLE
@YGT020
D; JGT
(YLE020)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH20 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE20 // IF Y < 0 AND X > 0
D; JGT
@NOTTRUE20
0;JMP
(YGT020)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH20 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE20 // IF Y > 0 AND X < 0
D; JGT
@NOTTRUE20
0; JMP
//D HOLDS X
(BOTH20)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE20
D; JGT
@NOTTRUE20
0;JMP
(NOTTRUE20)
@SP
A = M -1
M = 0
@ENDTRUE20
0; JMP
(TRUE20)
@SP
A = M - 1
M = -1
(ENDTRUE20)
// and
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D & M
A = A - 1
M = D
@SP
M = M - 1
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// gt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE021
D; JLE
@YGT021
D; JGT
(YLE021)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH21 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE21 // IF Y < 0 AND X > 0
D; JGT
@NOTTRUE21
0;JMP
(YGT021)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH21 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE21 // IF Y > 0 AND X < 0
D; JGT
@NOTTRUE21
0; JMP
//D HOLDS X
(BOTH21)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE21
D; JGT
@NOTTRUE21
0;JMP
(NOTTRUE21)
@SP
A = M -1
M = 0
@ENDTRUE21
0; JMP
(TRUE21)
@SP
A = M - 1
M = -1
(ENDTRUE21)
// push argument 1
@1
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// lt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE022
D; JLE
@YGT022
D; JGT
(YLE022)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH22 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE22 // IF Y < 0 AND X > 0
D; JLT
@NOTTRUE22
0;JMP
(YGT022)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH22 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE22 // IF Y > 0 AND X < 0
D; JLT
@NOTTRUE22
0; JMP
//D HOLDS X
(BOTH22)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE22
D; JLT
@NOTTRUE22
0;JMP
(NOTTRUE22)
@SP
A = M -1
M = 0
@ENDTRUE22
0; JMP
(TRUE22)
@SP
A = M - 1
M = -1
(ENDTRUE22)
// and
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D & M
A = A - 1
M = D
@SP
M = M - 1
// or
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D | M
A = A - 1
M = D
@SP
M = M - 1
// pop local 4
@4
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// call Math.abs 1
// get ip
@RET_ADDR22
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@6
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Math.abs
0; JMP
(RET_ADDR22)
// pop argument 0
@0
D = A
@ARG
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push argument 1
@1
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// call Math.abs 1
// get ip
@RET_ADDR23
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@6
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Math.abs
0; JMP
(RET_ADDR23)
// pop argument 1
@1
D = A
@ARG
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push argument 1
@1
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// lt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE025
D; JLE
@YGT025
D; JGT
(YLE025)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH25 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE25 // IF Y < 0 AND X > 0
D; JLT
@NOTTRUE25
0;JMP
(YGT025)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH25 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE25 // IF Y > 0 AND X < 0
D; JLT
@NOTTRUE25
0; JMP
//D HOLDS X
(BOTH25)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE25
D; JLT
@NOTTRUE25
0;JMP
(NOTTRUE25)
@SP
A = M -1
M = 0
@ENDTRUE25
0; JMP
(TRUE25)
@SP
A = M - 1
M = -1
(ENDTRUE25)
@SP
AM = M - 1
D = M
@Math.multiply$IF_TRUE0
D; JNE
@Math.multiply$IF_FALSE0
0; JMP
(Math.multiply$IF_TRUE0)
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop local 1
@1
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push argument 1
@1
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop argument 0
@0
D = A
@ARG
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop argument 1
@1
D = A
@ARG
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Math.multiply$IF_FALSE0)
(Math.multiply$WHILE_EXP0)
// push local 2
@2
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push argument 1
@1
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// lt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE026
D; JLE
@YGT026
D; JGT
(YLE026)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH26 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE26 // IF Y < 0 AND X > 0
D; JLT
@NOTTRUE26
0;JMP
(YGT026)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH26 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE26 // IF Y > 0 AND X < 0
D; JLT
@NOTTRUE26
0; JMP
//D HOLDS X
(BOTH26)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE26
D; JLT
@NOTTRUE26
0;JMP
(NOTTRUE26)
@SP
A = M -1
M = 0
@ENDTRUE26
0; JMP
(TRUE26)
@SP
A = M - 1
M = -1
(ENDTRUE26)
// not
@SP
A = M - 1
M = ! M
@SP
AM = M - 1
D = M
@Math.multiply$WHILE_END0
D; JNE
// push local 3
@3
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push static 0
@Math.0
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push argument 1
@1
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// and
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D & M
A = A - 1
M = D
@SP
M = M - 1
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// gt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE027
D; JLE
@YGT027
D; JGT
(YLE027)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH27 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE27 // IF Y < 0 AND X > 0
D; JGT
@NOTTRUE27
0;JMP
(YGT027)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH27 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE27 // IF Y > 0 AND X < 0
D; JGT
@NOTTRUE27
0; JMP
//D HOLDS X
(BOTH27)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE27
D; JGT
@NOTTRUE27
0;JMP
(NOTTRUE27)
@SP
A = M -1
M = 0
@ENDTRUE27
0; JMP
(TRUE27)
@SP
A = M - 1
M = -1
(ENDTRUE27)
@SP
AM = M - 1
D = M
@Math.multiply$IF_TRUE1
D; JNE
@Math.multiply$IF_FALSE1
0; JMP
(Math.multiply$IF_TRUE1)
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop local 0
@0
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push local 2
@2
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 3
@3
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push static 0
@Math.0
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop local 2
@2
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Math.multiply$IF_FALSE1)
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop argument 0
@0
D = A
@ARG
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push local 3
@3
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop local 3
@3
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
@Math.multiply$WHILE_EXP0
0; JMP
(Math.multiply$WHILE_END0)
// push local 4
@4
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
@SP
AM = M - 1
D = M
@Math.multiply$IF_TRUE2
D; JNE
@Math.multiply$IF_FALSE2
0; JMP
(Math.multiply$IF_TRUE2)
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// neg
@SP
A = M - 1
M = - M
// pop local 0
@0
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Math.multiply$IF_FALSE2)
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// return
@LCL // frame = LCL
D = M
@R13 // R13 is frame
M = D
@5
A = D - A
D = M
@R14
M = D // sets retAddr to frame - 5
@SP
AM = M - 1
D = M
@ARG
A = M // *ARG = pop
M = D
@ARG
D = M
@SP
M = D + 1
@R13
M = M - 1
@R13
A = M
D = M
@THAT
M = D
@R13
M = M - 1
@R13
A = M
D = M
@THIS
M = D
@R13
M = M - 1
@R13
A = M
D = M
@ARG
M = D
@R13
M = M - 1
@R13
A = M
D = M
@LCL
M = D
@R14
A = M
0; JMP
// function Math.divide 4
(f_Math.divide)
// write 0 for every local var
@LCL
A = M
M = 0
A = A + 1
M = 0
A = A + 1
M = 0
A = A + 1
M = 0
A = A + 1
@4
D = A
@SP
M = M + D
// push argument 1
@1
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// eq
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE028
D; JLE
@YGT028
D; JGT
(YLE028)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH28 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE28 // IF Y < 0 AND X > 0
D; JEQ
@NOTTRUE28
0;JMP
(YGT028)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH28 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE28 // IF Y > 0 AND X < 0
D; JEQ
@NOTTRUE28
0; JMP
//D HOLDS X
(BOTH28)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE28
D; JEQ
@NOTTRUE28
0;JMP
(NOTTRUE28)
@SP
A = M -1
M = 0
@ENDTRUE28
0; JMP
(TRUE28)
@SP
A = M - 1
M = -1
(ENDTRUE28)
@SP
AM = M - 1
D = M
@Math.divide$IF_TRUE0
D; JNE
@Math.divide$IF_FALSE0
0; JMP
(Math.divide$IF_TRUE0)
// push constant 3
@3
D = A
@SP
M = M + 1
A = M - 1
M = D
// call Sys.error 1
// get ip
@RET_ADDR28
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@6
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Sys.error
0; JMP
(RET_ADDR28)
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Math.divide$IF_FALSE0)
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// lt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE030
D; JLE
@YGT030
D; JGT
(YLE030)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH30 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE30 // IF Y < 0 AND X > 0
D; JLT
@NOTTRUE30
0;JMP
(YGT030)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH30 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE30 // IF Y > 0 AND X < 0
D; JLT
@NOTTRUE30
0; JMP
//D HOLDS X
(BOTH30)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE30
D; JLT
@NOTTRUE30
0;JMP
(NOTTRUE30)
@SP
A = M -1
M = 0
@ENDTRUE30
0; JMP
(TRUE30)
@SP
A = M - 1
M = -1
(ENDTRUE30)
// push argument 1
@1
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// gt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE031
D; JLE
@YGT031
D; JGT
(YLE031)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH31 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE31 // IF Y < 0 AND X > 0
D; JGT
@NOTTRUE31
0;JMP
(YGT031)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH31 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE31 // IF Y > 0 AND X < 0
D; JGT
@NOTTRUE31
0; JMP
//D HOLDS X
(BOTH31)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE31
D; JGT
@NOTTRUE31
0;JMP
(NOTTRUE31)
@SP
A = M -1
M = 0
@ENDTRUE31
0; JMP
(TRUE31)
@SP
A = M - 1
M = -1
(ENDTRUE31)
// and
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D & M
A = A - 1
M = D
@SP
M = M - 1
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// gt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE032
D; JLE
@YGT032
D; JGT
(YLE032)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH32 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE32 // IF Y < 0 AND X > 0
D; JGT
@NOTTRUE32
0;JMP
(YGT032)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH32 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE32 // IF Y > 0 AND X < 0
D; JGT
@NOTTRUE32
0; JMP
//D HOLDS X
(BOTH32)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE32
D; JGT
@NOTTRUE32
0;JMP
(NOTTRUE32)
@SP
A = M -1
M = 0
@ENDTRUE32
0; JMP
(TRUE32)
@SP
A = M - 1
M = -1
(ENDTRUE32)
// push argument 1
@1
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// lt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE033
D; JLE
@YGT033
D; JGT
(YLE033)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH33 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE33 // IF Y < 0 AND X > 0
D; JLT
@NOTTRUE33
0;JMP
(YGT033)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH33 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE33 // IF Y > 0 AND X < 0
D; JLT
@NOTTRUE33
0; JMP
//D HOLDS X
(BOTH33)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE33
D; JLT
@NOTTRUE33
0;JMP
(NOTTRUE33)
@SP
A = M -1
M = 0
@ENDTRUE33
0; JMP
(TRUE33)
@SP
A = M - 1
M = -1
(ENDTRUE33)
// and
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D & M
A = A - 1
M = D
@SP
M = M - 1
// or
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D | M
A = A - 1
M = D
@SP
M = M - 1
// pop local 2
@2
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// push static 1
@Math.1
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push argument 1
@1
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// call Math.abs 1
// get ip
@RET_ADDR33
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@6
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Math.abs
0; JMP
(RET_ADDR33)
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push temp 0
@0
D = A
@5
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop that 0
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// call Math.abs 1
// get ip
@RET_ADDR34
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@6
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Math.abs
0; JMP
(RET_ADDR34)
// pop argument 0
@0
D = A
@ARG
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Math.divide$WHILE_EXP0)
// push local 3
@3
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// not
@SP
A = M - 1
M = ! M
// not
@SP
A = M - 1
M = ! M
@SP
AM = M - 1
D = M
@Math.divide$WHILE_END0
D; JNE
// push constant 32767
@32767
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push static 1
@Math.1
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// sub
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D - M
A = A - 1
M = D
@SP
M = M - 1
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push static 1
@Math.1
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// lt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE036
D; JLE
@YGT036
D; JGT
(YLE036)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH36 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE36 // IF Y < 0 AND X > 0
D; JLT
@NOTTRUE36
0;JMP
(YGT036)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH36 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE36 // IF Y > 0 AND X < 0
D; JLT
@NOTTRUE36
0; JMP
//D HOLDS X
(BOTH36)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE36
D; JLT
@NOTTRUE36
0;JMP
(NOTTRUE36)
@SP
A = M -1
M = 0
@ENDTRUE36
0; JMP
(TRUE36)
@SP
A = M - 1
M = -1
(ENDTRUE36)
// pop local 3
@3
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push local 3
@3
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// not
@SP
A = M - 1
M = ! M
@SP
AM = M - 1
D = M
@Math.divide$IF_TRUE1
D; JNE
@Math.divide$IF_FALSE1
0; JMP
(Math.divide$IF_TRUE1)
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push static 1
@Math.1
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push static 1
@Math.1
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push static 1
@Math.1
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push temp 0
@0
D = A
@5
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop that 0
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push static 1
@Math.1
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// gt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE037
D; JLE
@YGT037
D; JGT
(YLE037)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH37 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE37 // IF Y < 0 AND X > 0
D; JGT
@NOTTRUE37
0;JMP
(YGT037)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH37 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE37 // IF Y > 0 AND X < 0
D; JGT
@NOTTRUE37
0; JMP
//D HOLDS X
(BOTH37)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE37
D; JGT
@NOTTRUE37
0;JMP
(NOTTRUE37)
@SP
A = M -1
M = 0
@ENDTRUE37
0; JMP
(TRUE37)
@SP
A = M - 1
M = -1
(ENDTRUE37)
// pop local 3
@3
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push local 3
@3
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// not
@SP
A = M - 1
M = ! M
@SP
AM = M - 1
D = M
@Math.divide$IF_TRUE2
D; JNE
@Math.divide$IF_FALSE2
0; JMP
(Math.divide$IF_TRUE2)
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop local 0
@0
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Math.divide$IF_FALSE2)
(Math.divide$IF_FALSE1)
@Math.divide$WHILE_EXP0
0; JMP
(Math.divide$WHILE_END0)
(Math.divide$WHILE_EXP1)
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// neg
@SP
A = M - 1
M = - M
// gt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE038
D; JLE
@YGT038
D; JGT
(YLE038)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH38 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE38 // IF Y < 0 AND X > 0
D; JGT
@NOTTRUE38
0;JMP
(YGT038)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH38 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE38 // IF Y > 0 AND X < 0
D; JGT
@NOTTRUE38
0; JMP
//D HOLDS X
(BOTH38)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE38
D; JGT
@NOTTRUE38
0;JMP
(NOTTRUE38)
@SP
A = M -1
M = 0
@ENDTRUE38
0; JMP
(TRUE38)
@SP
A = M - 1
M = -1
(ENDTRUE38)
// not
@SP
A = M - 1
M = ! M
@SP
AM = M - 1
D = M
@Math.divide$WHILE_END1
D; JNE
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push static 1
@Math.1
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// gt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE039
D; JLE
@YGT039
D; JGT
(YLE039)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH39 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE39 // IF Y < 0 AND X > 0
D; JGT
@NOTTRUE39
0;JMP
(YGT039)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH39 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE39 // IF Y > 0 AND X < 0
D; JGT
@NOTTRUE39
0; JMP
//D HOLDS X
(BOTH39)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE39
D; JGT
@NOTTRUE39
0;JMP
(NOTTRUE39)
@SP
A = M -1
M = 0
@ENDTRUE39
0; JMP
(TRUE39)
@SP
A = M - 1
M = -1
(ENDTRUE39)
// not
@SP
A = M - 1
M = ! M
@SP
AM = M - 1
D = M
@Math.divide$IF_TRUE3
D; JNE
@Math.divide$IF_FALSE3
0; JMP
(Math.divide$IF_TRUE3)
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push static 0
@Math.0
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop local 1
@1
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push static 1
@Math.1
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// sub
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D - M
A = A - 1
M = D
@SP
M = M - 1
// pop argument 0
@0
D = A
@ARG
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Math.divide$IF_FALSE3)
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// sub
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D - M
A = A - 1
M = D
@SP
M = M - 1
// pop local 0
@0
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
@Math.divide$WHILE_EXP1
0; JMP
(Math.divide$WHILE_END1)
// push local 2
@2
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
@SP
AM = M - 1
D = M
@Math.divide$IF_TRUE4
D; JNE
@Math.divide$IF_FALSE4
0; JMP
(Math.divide$IF_TRUE4)
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// neg
@SP
A = M - 1
M = - M
// pop local 1
@1
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Math.divide$IF_FALSE4)
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// return
@LCL // frame = LCL
D = M
@R13 // R13 is frame
M = D
@5
A = D - A
D = M
@R14
M = D // sets retAddr to frame - 5
@SP
AM = M - 1
D = M
@ARG
A = M // *ARG = pop
M = D
@ARG
D = M
@SP
M = D + 1
@R13
M = M - 1
@R13
A = M
D = M
@THAT
M = D
@R13
M = M - 1
@R13
A = M
D = M
@THIS
M = D
@R13
M = M - 1
@R13
A = M
D = M
@ARG
M = D
@R13
M = M - 1
@R13
A = M
D = M
@LCL
M = D
@R14
A = M
0; JMP
// function Math.sqrt 2
(f_Math.sqrt)
// write 0 for every local var
@LCL
A = M
M = 0
A = A + 1
M = 0
A = A + 1
@2
D = A
@SP
M = M + D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// lt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE040
D; JLE
@YGT040
D; JGT
(YLE040)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH40 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE40 // IF Y < 0 AND X > 0
D; JLT
@NOTTRUE40
0;JMP
(YGT040)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH40 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE40 // IF Y > 0 AND X < 0
D; JLT
@NOTTRUE40
0; JMP
//D HOLDS X
(BOTH40)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE40
D; JLT
@NOTTRUE40
0;JMP
(NOTTRUE40)
@SP
A = M -1
M = 0
@ENDTRUE40
0; JMP
(TRUE40)
@SP
A = M - 1
M = -1
(ENDTRUE40)
@SP
AM = M - 1
D = M
@Math.sqrt$IF_TRUE0
D; JNE
@Math.sqrt$IF_FALSE0
0; JMP
(Math.sqrt$IF_TRUE0)
// push constant 4
@4
D = A
@SP
M = M + 1
A = M - 1
M = D
// call Sys.error 1
// get ip
@RET_ADDR40
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@6
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Sys.error
0; JMP
(RET_ADDR40)
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Math.sqrt$IF_FALSE0)
// push constant 7
@7
D = A
@SP
M = M + 1
A = M - 1
M = D
// pop local 0
@0
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Math.sqrt$WHILE_EXP0)
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// neg
@SP
A = M - 1
M = - M
// gt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE042
D; JLE
@YGT042
D; JGT
(YLE042)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH42 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE42 // IF Y < 0 AND X > 0
D; JGT
@NOTTRUE42
0;JMP
(YGT042)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH42 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE42 // IF Y > 0 AND X < 0
D; JGT
@NOTTRUE42
0; JMP
//D HOLDS X
(BOTH42)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE42
D; JGT
@NOTTRUE42
0;JMP
(NOTTRUE42)
@SP
A = M -1
M = 0
@ENDTRUE42
0; JMP
(TRUE42)
@SP
A = M - 1
M = -1
(ENDTRUE42)
// not
@SP
A = M - 1
M = ! M
@SP
AM = M - 1
D = M
@Math.sqrt$WHILE_END0
D; JNE
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push static 0
@Math.0
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push static 0
@Math.0
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// call Math.multiply 2
// get ip
@RET_ADDR42
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@7
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Math.multiply
0; JMP
(RET_ADDR42)
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// gt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE044
D; JLE
@YGT044
D; JGT
(YLE044)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH44 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE44 // IF Y < 0 AND X > 0
D; JGT
@NOTTRUE44
0;JMP
(YGT044)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH44 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE44 // IF Y > 0 AND X < 0
D; JGT
@NOTTRUE44
0; JMP
//D HOLDS X
(BOTH44)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE44
D; JGT
@NOTTRUE44
0;JMP
(NOTTRUE44)
@SP
A = M -1
M = 0
@ENDTRUE44
0; JMP
(TRUE44)
@SP
A = M - 1
M = -1
(ENDTRUE44)
// not
@SP
A = M - 1
M = ! M
@SP
AM = M - 1
D = M
@Math.sqrt$IF_TRUE1
D; JNE
@Math.sqrt$IF_FALSE1
0; JMP
(Math.sqrt$IF_TRUE1)
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push static 0
@Math.0
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop local 1
@1
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Math.sqrt$IF_FALSE1)
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// sub
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D - M
A = A - 1
M = D
@SP
M = M - 1
// pop local 0
@0
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
@Math.sqrt$WHILE_EXP0
0; JMP
(Math.sqrt$WHILE_END0)
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// return
@LCL // frame = LCL
D = M
@R13 // R13 is frame
M = D
@5
A = D - A
D = M
@R14
M = D // sets retAddr to frame - 5
@SP
AM = M - 1
D = M
@ARG
A = M // *ARG = pop
M = D
@ARG
D = M
@SP
M = D + 1
@R13
M = M - 1
@R13
A = M
D = M
@THAT
M = D
@R13
M = M - 1
@R13
A = M
D = M
@THIS
M = D
@R13
M = M - 1
@R13
A = M
D = M
@ARG
M = D
@R13
M = M - 1
@R13
A = M
D = M
@LCL
M = D
@R14
A = M
0; JMP
// function Math.max 0
(f_Math.max)
// write 0 for every local var
@LCL
A = M
@0
D = A
@SP
M = M + D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push argument 1
@1
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// gt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE045
D; JLE
@YGT045
D; JGT
(YLE045)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH45 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE45 // IF Y < 0 AND X > 0
D; JGT
@NOTTRUE45
0;JMP
(YGT045)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH45 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE45 // IF Y > 0 AND X < 0
D; JGT
@NOTTRUE45
0; JMP
//D HOLDS X
(BOTH45)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE45
D; JGT
@NOTTRUE45
0;JMP
(NOTTRUE45)
@SP
A = M -1
M = 0
@ENDTRUE45
0; JMP
(TRUE45)
@SP
A = M - 1
M = -1
(ENDTRUE45)
@SP
AM = M - 1
D = M
@Math.max$IF_TRUE0
D; JNE
@Math.max$IF_FALSE0
0; JMP
(Math.max$IF_TRUE0)
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop argument 1
@1
D = A
@ARG
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Math.max$IF_FALSE0)
// push argument 1
@1
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// return
@LCL // frame = LCL
D = M
@R13 // R13 is frame
M = D
@5
A = D - A
D = M
@R14
M = D // sets retAddr to frame - 5
@SP
AM = M - 1
D = M
@ARG
A = M // *ARG = pop
M = D
@ARG
D = M
@SP
M = D + 1
@R13
M = M - 1
@R13
A = M
D = M
@THAT
M = D
@R13
M = M - 1
@R13
A = M
D = M
@THIS
M = D
@R13
M = M - 1
@R13
A = M
D = M
@ARG
M = D
@R13
M = M - 1
@R13
A = M
D = M
@LCL
M = D
@R14
A = M
0; JMP
// function Math.min 0
(f_Math.min)
// write 0 for every local var
@LCL
A = M
@0
D = A
@SP
M = M + D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push argument 1
@1
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// lt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE046
D; JLE
@YGT046
D; JGT
(YLE046)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH46 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE46 // IF Y < 0 AND X > 0
D; JLT
@NOTTRUE46
0;JMP
(YGT046)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH46 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE46 // IF Y > 0 AND X < 0
D; JLT
@NOTTRUE46
0; JMP
//D HOLDS X
(BOTH46)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE46
D; JLT
@NOTTRUE46
0;JMP
(NOTTRUE46)
@SP
A = M -1
M = 0
@ENDTRUE46
0; JMP
(TRUE46)
@SP
A = M - 1
M = -1
(ENDTRUE46)
@SP
AM = M - 1
D = M
@Math.min$IF_TRUE0
D; JNE
@Math.min$IF_FALSE0
0; JMP
(Math.min$IF_TRUE0)
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop argument 1
@1
D = A
@ARG
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Math.min$IF_FALSE0)
// push argument 1
@1
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// return
@LCL // frame = LCL
D = M
@R13 // R13 is frame
M = D
@5
A = D - A
D = M
@R14
M = D // sets retAddr to frame - 5
@SP
AM = M - 1
D = M
@ARG
A = M // *ARG = pop
M = D
@ARG
D = M
@SP
M = D + 1
@R13
M = M - 1
@R13
A = M
D = M
@THAT
M = D
@R13
M = M - 1
@R13
A = M
D = M
@THIS
M = D
@R13
M = M - 1
@R13
A = M
D = M
@ARG
M = D
@R13
M = M - 1
@R13
A = M
D = M
@LCL
M = D
@R14
A = M
0; JMP
// function Memory.init 0
(f_Memory.init)
// write 0 for every local var
@LCL
A = M
@0
D = A
@SP
M = M + D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// pop static 0
@Memory.0
D = A
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 2048
@2048
D = A
@SP
M = M + 1
A = M - 1
M = D
// push static 0
@Memory.0
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push constant 14334
@14334
D = A
@SP
M = M + 1
A = M - 1
M = D
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push temp 0
@0
D = A
@5
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop that 0
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 2049
@2049
D = A
@SP
M = M + 1
A = M - 1
M = D
// push static 0
@Memory.0
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push constant 2050
@2050
D = A
@SP
M = M + 1
A = M - 1
M = D
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push temp 0
@0
D = A
@5
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop that 0
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// return
@LCL // frame = LCL
D = M
@R13 // R13 is frame
M = D
@5
A = D - A
D = M
@R14
M = D // sets retAddr to frame - 5
@SP
AM = M - 1
D = M
@ARG
A = M // *ARG = pop
M = D
@ARG
D = M
@SP
M = D + 1
@R13
M = M - 1
@R13
A = M
D = M
@THAT
M = D
@R13
M = M - 1
@R13
A = M
D = M
@THIS
M = D
@R13
M = M - 1
@R13
A = M
D = M
@ARG
M = D
@R13
M = M - 1
@R13
A = M
D = M
@LCL
M = D
@R14
A = M
0; JMP
// function Memory.peek 0
(f_Memory.peek)
// write 0 for every local var
@LCL
A = M
@0
D = A
@SP
M = M + D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push static 0
@Memory.0
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// return
@LCL // frame = LCL
D = M
@R13 // R13 is frame
M = D
@5
A = D - A
D = M
@R14
M = D // sets retAddr to frame - 5
@SP
AM = M - 1
D = M
@ARG
A = M // *ARG = pop
M = D
@ARG
D = M
@SP
M = D + 1
@R13
M = M - 1
@R13
A = M
D = M
@THAT
M = D
@R13
M = M - 1
@R13
A = M
D = M
@THIS
M = D
@R13
M = M - 1
@R13
A = M
D = M
@ARG
M = D
@R13
M = M - 1
@R13
A = M
D = M
@LCL
M = D
@R14
A = M
0; JMP
// function Memory.poke 0
(f_Memory.poke)
// write 0 for every local var
@LCL
A = M
@0
D = A
@SP
M = M + D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push static 0
@Memory.0
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push argument 1
@1
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push temp 0
@0
D = A
@5
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop that 0
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// return
@LCL // frame = LCL
D = M
@R13 // R13 is frame
M = D
@5
A = D - A
D = M
@R14
M = D // sets retAddr to frame - 5
@SP
AM = M - 1
D = M
@ARG
A = M // *ARG = pop
M = D
@ARG
D = M
@SP
M = D + 1
@R13
M = M - 1
@R13
A = M
D = M
@THAT
M = D
@R13
M = M - 1
@R13
A = M
D = M
@THIS
M = D
@R13
M = M - 1
@R13
A = M
D = M
@ARG
M = D
@R13
M = M - 1
@R13
A = M
D = M
@LCL
M = D
@R14
A = M
0; JMP
// function Memory.alloc 2
(f_Memory.alloc)
// write 0 for every local var
@LCL
A = M
M = 0
A = A + 1
M = 0
A = A + 1
@2
D = A
@SP
M = M + D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// lt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE047
D; JLE
@YGT047
D; JGT
(YLE047)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH47 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE47 // IF Y < 0 AND X > 0
D; JLT
@NOTTRUE47
0;JMP
(YGT047)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH47 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE47 // IF Y > 0 AND X < 0
D; JLT
@NOTTRUE47
0; JMP
//D HOLDS X
(BOTH47)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE47
D; JLT
@NOTTRUE47
0;JMP
(NOTTRUE47)
@SP
A = M -1
M = 0
@ENDTRUE47
0; JMP
(TRUE47)
@SP
A = M - 1
M = -1
(ENDTRUE47)
@SP
AM = M - 1
D = M
@Memory.alloc$IF_TRUE0
D; JNE
@Memory.alloc$IF_FALSE0
0; JMP
(Memory.alloc$IF_TRUE0)
// push constant 5
@5
D = A
@SP
M = M + 1
A = M - 1
M = D
// call Sys.error 1
// get ip
@RET_ADDR47
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@6
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Sys.error
0; JMP
(RET_ADDR47)
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Memory.alloc$IF_FALSE0)
// push constant 2048
@2048
D = A
@SP
M = M + 1
A = M - 1
M = D
// pop local 1
@1
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Memory.alloc$WHILE_EXP0)
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// lt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE049
D; JLE
@YGT049
D; JGT
(YLE049)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH49 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE49 // IF Y < 0 AND X > 0
D; JLT
@NOTTRUE49
0;JMP
(YGT049)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH49 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE49 // IF Y > 0 AND X < 0
D; JLT
@NOTTRUE49
0; JMP
//D HOLDS X
(BOTH49)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE49
D; JLT
@NOTTRUE49
0;JMP
(NOTTRUE49)
@SP
A = M -1
M = 0
@ENDTRUE49
0; JMP
(TRUE49)
@SP
A = M - 1
M = -1
(ENDTRUE49)
// not
@SP
A = M - 1
M = ! M
@SP
AM = M - 1
D = M
@Memory.alloc$WHILE_END0
D; JNE
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop local 1
@1
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
@Memory.alloc$WHILE_EXP0
0; JMP
(Memory.alloc$WHILE_END0)
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push constant 16379
@16379
D = A
@SP
M = M + 1
A = M - 1
M = D
// gt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE050
D; JLE
@YGT050
D; JGT
(YLE050)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH50 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE50 // IF Y < 0 AND X > 0
D; JGT
@NOTTRUE50
0;JMP
(YGT050)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH50 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE50 // IF Y > 0 AND X < 0
D; JGT
@NOTTRUE50
0; JMP
//D HOLDS X
(BOTH50)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE50
D; JGT
@NOTTRUE50
0;JMP
(NOTTRUE50)
@SP
A = M -1
M = 0
@ENDTRUE50
0; JMP
(TRUE50)
@SP
A = M - 1
M = -1
(ENDTRUE50)
@SP
AM = M - 1
D = M
@Memory.alloc$IF_TRUE1
D; JNE
@Memory.alloc$IF_FALSE1
0; JMP
(Memory.alloc$IF_TRUE1)
// push constant 6
@6
D = A
@SP
M = M + 1
A = M - 1
M = D
// call Sys.error 1
// get ip
@RET_ADDR50
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@6
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Sys.error
0; JMP
(RET_ADDR50)
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Memory.alloc$IF_FALSE1)
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 2
@2
D = A
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// gt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE052
D; JLE
@YGT052
D; JGT
(YLE052)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH52 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE52 // IF Y < 0 AND X > 0
D; JGT
@NOTTRUE52
0;JMP
(YGT052)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH52 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE52 // IF Y > 0 AND X < 0
D; JGT
@NOTTRUE52
0; JMP
//D HOLDS X
(BOTH52)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE52
D; JGT
@NOTTRUE52
0;JMP
(NOTTRUE52)
@SP
A = M -1
M = 0
@ENDTRUE52
0; JMP
(TRUE52)
@SP
A = M - 1
M = -1
(ENDTRUE52)
@SP
AM = M - 1
D = M
@Memory.alloc$IF_TRUE2
D; JNE
@Memory.alloc$IF_FALSE2
0; JMP
(Memory.alloc$IF_TRUE2)
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 2
@2
D = A
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// sub
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D - M
A = A - 1
M = D
@SP
M = M - 1
// push constant 2
@2
D = A
@SP
M = M + 1
A = M - 1
M = D
// sub
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D - M
A = A - 1
M = D
@SP
M = M - 1
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push temp 0
@0
D = A
@5
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop that 0
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 2
@2
D = A
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// eq
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE053
D; JLE
@YGT053
D; JGT
(YLE053)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH53 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE53 // IF Y < 0 AND X > 0
D; JEQ
@NOTTRUE53
0;JMP
(YGT053)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH53 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE53 // IF Y > 0 AND X < 0
D; JEQ
@NOTTRUE53
0; JMP
//D HOLDS X
(BOTH53)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE53
D; JEQ
@NOTTRUE53
0;JMP
(NOTTRUE53)
@SP
A = M -1
M = 0
@ENDTRUE53
0; JMP
(TRUE53)
@SP
A = M - 1
M = -1
(ENDTRUE53)
@SP
AM = M - 1
D = M
@Memory.alloc$IF_TRUE3
D; JNE
@Memory.alloc$IF_FALSE3
0; JMP
(Memory.alloc$IF_TRUE3)
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 3
@3
D = A
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push constant 4
@4
D = A
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push temp 0
@0
D = A
@5
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop that 0
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
@Memory.alloc$IF_END3
0; JMP
(Memory.alloc$IF_FALSE3)
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 3
@3
D = A
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push temp 0
@0
D = A
@5
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop that 0
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Memory.alloc$IF_END3)
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push constant 2
@2
D = A
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push temp 0
@0
D = A
@5
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop that 0
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Memory.alloc$IF_FALSE2)
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push temp 0
@0
D = A
@5
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop that 0
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 2
@2
D = A
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// return
@LCL // frame = LCL
D = M
@R13 // R13 is frame
M = D
@5
A = D - A
D = M
@R14
M = D // sets retAddr to frame - 5
@SP
AM = M - 1
D = M
@ARG
A = M // *ARG = pop
M = D
@ARG
D = M
@SP
M = D + 1
@R13
M = M - 1
@R13
A = M
D = M
@THAT
M = D
@R13
M = M - 1
@R13
A = M
D = M
@THIS
M = D
@R13
M = M - 1
@R13
A = M
D = M
@ARG
M = D
@R13
M = M - 1
@R13
A = M
D = M
@LCL
M = D
@R14
A = M
0; JMP
// function Memory.deAlloc 2
(f_Memory.deAlloc)
// write 0 for every local var
@LCL
A = M
M = 0
A = A + 1
M = 0
A = A + 1
@2
D = A
@SP
M = M + D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 2
@2
D = A
@SP
M = M + 1
A = M - 1
M = D
// sub
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D - M
A = A - 1
M = D
@SP
M = M - 1
// pop local 0
@0
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop local 1
@1
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// eq
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE054
D; JLE
@YGT054
D; JGT
(YLE054)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH54 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE54 // IF Y < 0 AND X > 0
D; JEQ
@NOTTRUE54
0;JMP
(YGT054)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH54 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE54 // IF Y > 0 AND X < 0
D; JEQ
@NOTTRUE54
0; JMP
//D HOLDS X
(BOTH54)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE54
D; JEQ
@NOTTRUE54
0;JMP
(NOTTRUE54)
@SP
A = M -1
M = 0
@ENDTRUE54
0; JMP
(TRUE54)
@SP
A = M - 1
M = -1
(ENDTRUE54)
@SP
AM = M - 1
D = M
@Memory.deAlloc$IF_TRUE0
D; JNE
@Memory.deAlloc$IF_FALSE0
0; JMP
(Memory.deAlloc$IF_TRUE0)
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// sub
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D - M
A = A - 1
M = D
@SP
M = M - 1
// push constant 2
@2
D = A
@SP
M = M + 1
A = M - 1
M = D
// sub
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D - M
A = A - 1
M = D
@SP
M = M - 1
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push temp 0
@0
D = A
@5
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop that 0
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
@Memory.deAlloc$IF_END0
0; JMP
(Memory.deAlloc$IF_FALSE0)
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// sub
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D - M
A = A - 1
M = D
@SP
M = M - 1
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push temp 0
@0
D = A
@5
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop that 0
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 2
@2
D = A
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// eq
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE055
D; JLE
@YGT055
D; JGT
(YLE055)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH55 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE55 // IF Y < 0 AND X > 0
D; JEQ
@NOTTRUE55
0;JMP
(YGT055)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH55 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE55 // IF Y > 0 AND X < 0
D; JEQ
@NOTTRUE55
0; JMP
//D HOLDS X
(BOTH55)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE55
D; JEQ
@NOTTRUE55
0;JMP
(NOTTRUE55)
@SP
A = M -1
M = 0
@ENDTRUE55
0; JMP
(TRUE55)
@SP
A = M - 1
M = -1
(ENDTRUE55)
@SP
AM = M - 1
D = M
@Memory.deAlloc$IF_TRUE1
D; JNE
@Memory.deAlloc$IF_FALSE1
0; JMP
(Memory.deAlloc$IF_TRUE1)
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 2
@2
D = A
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push temp 0
@0
D = A
@5
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop that 0
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
@Memory.deAlloc$IF_END1
0; JMP
(Memory.deAlloc$IF_FALSE1)
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// push local 1
@1
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// add
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D + M
A = A - 1
M = D
@SP
M = M - 1
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push that 0
@0
D = A
@THAT
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// pop pointer 1
@1
D = A
@3
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// push temp 0
@0
D = A
@5
A = A + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// pop that 0
@0
D = A
@THAT
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Memory.deAlloc$IF_END1)
(Memory.deAlloc$IF_END0)
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// return
@LCL // frame = LCL
D = M
@R13 // R13 is frame
M = D
@5
A = D - A
D = M
@R14
M = D // sets retAddr to frame - 5
@SP
AM = M - 1
D = M
@ARG
A = M // *ARG = pop
M = D
@ARG
D = M
@SP
M = D + 1
@R13
M = M - 1
@R13
A = M
D = M
@THAT
M = D
@R13
M = M - 1
@R13
A = M
D = M
@THIS
M = D
@R13
M = M - 1
@R13
A = M
D = M
@ARG
M = D
@R13
M = M - 1
@R13
A = M
D = M
@LCL
M = D
@R14
A = M
0; JMP
// function Sys.init 0
(f_Sys.init)
// write 0 for every local var
@LCL
A = M
@0
D = A
@SP
M = M + D
// call Memory.init 0
// get ip
@RET_ADDR55
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@5
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Memory.init
0; JMP
(RET_ADDR55)
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// call Math.init 0
// get ip
@RET_ADDR56
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@5
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Math.init
0; JMP
(RET_ADDR56)
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
// call Main.main 0
// get ip
@RET_ADDR57
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@5
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Main.main
0; JMP
(RET_ADDR57)
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Sys.init$WHILE_EXP0)
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// not
@SP
A = M - 1
M = ! M
// not
@SP
A = M - 1
M = ! M
@SP
AM = M - 1
D = M
@Sys.init$WHILE_END0
D; JNE
@Sys.init$WHILE_EXP0
0; JMP
(Sys.init$WHILE_END0)
// function Sys.halt 0
(f_Sys.halt)
// write 0 for every local var
@LCL
A = M
@0
D = A
@SP
M = M + D
(Sys.halt$WHILE_EXP0)
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// not
@SP
A = M - 1
M = ! M
// not
@SP
A = M - 1
M = ! M
@SP
AM = M - 1
D = M
@Sys.halt$WHILE_END0
D; JNE
@Sys.halt$WHILE_EXP0
0; JMP
(Sys.halt$WHILE_END0)
// function Sys.wait 1
(f_Sys.wait)
// write 0 for every local var
@LCL
A = M
M = 0
A = A + 1
@1
D = A
@SP
M = M + D
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// lt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE059
D; JLE
@YGT059
D; JGT
(YLE059)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH59 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE59 // IF Y < 0 AND X > 0
D; JLT
@NOTTRUE59
0;JMP
(YGT059)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH59 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE59 // IF Y > 0 AND X < 0
D; JLT
@NOTTRUE59
0; JMP
//D HOLDS X
(BOTH59)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE59
D; JLT
@NOTTRUE59
0;JMP
(NOTTRUE59)
@SP
A = M -1
M = 0
@ENDTRUE59
0; JMP
(TRUE59)
@SP
A = M - 1
M = -1
(ENDTRUE59)
@SP
AM = M - 1
D = M
@Sys.wait$IF_TRUE0
D; JNE
@Sys.wait$IF_FALSE0
0; JMP
(Sys.wait$IF_TRUE0)
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// call Sys.error 1
// get ip
@RET_ADDR59
D = A
// push data in this order: RET LCL ARG THIS THAT
@SP
M = M + 1
A = M - 1
M = D
@LCL
D = M
@SP
M = M + 1
A = M - 1
M = D
@ARG
D = M
@SP
M = M + 1
A = M - 1
M = D
@THIS
D = M
@SP
M = M + 1
A = M - 1
M = D
@THAT
D = M
@SP
M = M + 1
A = M - 1
M = D
// set vals
@SP
D = M
@6
D = D - A
@ARG
M = D
@SP
D = M
@LCL
M = D
@f_Sys.error
0; JMP
(RET_ADDR59)
// pop temp 0
@0
D = A
@5
D = A + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Sys.wait$IF_FALSE0)
(Sys.wait$WHILE_EXP0)
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// gt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE061
D; JLE
@YGT061
D; JGT
(YLE061)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH61 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE61 // IF Y < 0 AND X > 0
D; JGT
@NOTTRUE61
0;JMP
(YGT061)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH61 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE61 // IF Y > 0 AND X < 0
D; JGT
@NOTTRUE61
0; JMP
//D HOLDS X
(BOTH61)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE61
D; JGT
@NOTTRUE61
0;JMP
(NOTTRUE61)
@SP
A = M -1
M = 0
@ENDTRUE61
0; JMP
(TRUE61)
@SP
A = M - 1
M = -1
(ENDTRUE61)
// not
@SP
A = M - 1
M = ! M
@SP
AM = M - 1
D = M
@Sys.wait$WHILE_END0
D; JNE
// push constant 50
@50
D = A
@SP
M = M + 1
A = M - 1
M = D
// pop local 0
@0
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
(Sys.wait$WHILE_EXP1)
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// gt
@SP
AM = M - 1
D = M // D HOLDS Y
@YLE062
D; JLE
@YGT062
D; JGT
(YLE062)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH62 // IF BOTH OF THEM ARE LESS OR EQUAL TO 0
D; JLE
@TRUE62 // IF Y < 0 AND X > 0
D; JGT
@NOTTRUE62
0;JMP
(YGT062)
@SP
A = M - 1
D = M // D HOLDS X
@BOTH62 // IF BOTH OF THEM ARE BIGGER THEN 0
D; JGE
@TRUE62 // IF Y > 0 AND X < 0
D; JGT
@NOTTRUE62
0; JMP
//D HOLDS X
(BOTH62)
@SP
A = M
A = M // A HOLDS Y
D = D - A
@TRUE62
D; JGT
@NOTTRUE62
0;JMP
(NOTTRUE62)
@SP
A = M -1
M = 0
@ENDTRUE62
0; JMP
(TRUE62)
@SP
A = M - 1
M = -1
(ENDTRUE62)
// not
@SP
A = M - 1
M = ! M
@SP
AM = M - 1
D = M
@Sys.wait$WHILE_END1
D; JNE
// push local 0
@0
D = A
@LCL
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// sub
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D - M
A = A - 1
M = D
@SP
M = M - 1
// pop local 0
@0
D = A
@LCL
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
@Sys.wait$WHILE_EXP1
0; JMP
(Sys.wait$WHILE_END1)
// push argument 0
@0
D = A
@ARG
A = M + D
D = M
@SP
M = M + 1
A = M - 1
M = D
// push constant 1
@1
D = A
@SP
M = M + 1
A = M - 1
M = D
// sub
@SP
A = M - 1
A = A - 1
D = M
A = A + 1
D = D - M
A = A - 1
M = D
@SP
M = M - 1
// pop argument 0
@0
D = A
@ARG
D = M + D
@R13
M = D
@SP
M = M - 1
A = M
D = M
@R13
A = M
M = D
@Sys.wait$WHILE_EXP0
0; JMP
(Sys.wait$WHILE_END0)
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// return
@LCL // frame = LCL
D = M
@R13 // R13 is frame
M = D
@5
A = D - A
D = M
@R14
M = D // sets retAddr to frame - 5
@SP
AM = M - 1
D = M
@ARG
A = M // *ARG = pop
M = D
@ARG
D = M
@SP
M = D + 1
@R13
M = M - 1
@R13
A = M
D = M
@THAT
M = D
@R13
M = M - 1
@R13
A = M
D = M
@THIS
M = D
@R13
M = M - 1
@R13
A = M
D = M
@ARG
M = D
@R13
M = M - 1
@R13
A = M
D = M
@LCL
M = D
@R14
A = M
0; JMP
// function Sys.error 0
(f_Sys.error)
// write 0 for every local var
@LCL
A = M
@0
D = A
@SP
M = M + D
(Sys.error$WHILE_EXP0)
// push constant 0
@0
D = A
@SP
M = M + 1
A = M - 1
M = D
// not
@SP
A = M - 1
M = ! M
// not
@SP
A = M - 1
M = ! M
@SP
AM = M - 1
D = M
@Sys.error$WHILE_END0
D; JNE
@Sys.error$WHILE_EXP0
0; JMP
(Sys.error$WHILE_END0)
|
agda/book/Programming_Language_Foundations_in_Agda/x08-747Quantifiers-completed.agda | haroldcarr/learn-haskell-coq-ml-etc | 36 | 11259 | <gh_stars>10-100
module 747Quantifiers where
-- Library
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_; refl)
open import Data.Nat using (ℕ; zero; suc; _+_; _*_; _≤_; z≤n; s≤s) -- added ≤
open import Relation.Nullary using (¬_)
open import Data.Product using (_×_; proj₁; proj₂) renaming (_,_ to ⟨_,_⟩) -- added proj₂
open import Data.Sum using (_⊎_; inj₁; inj₂ ) -- added inj₁, inj₂
open import Function using (_∘_) -- added
-- Copied from 747Isomorphism.
postulate
extensionality : ∀ {A B : Set} {f g : A → B}
→ (∀ (x : A) → f x ≡ g x)
-----------------------
→ f ≡ g
infix 0 _≃_
record _≃_ (A B : Set) : Set where
constructor mk-≃
field
to : A → B
from : B → A
from∘to : ∀ (x : A) → from (to x) ≡ x
to∘from : ∀ (y : B) → to (from y) ≡ y
open _≃_
record _⇔_ (A B : Set) : Set where
field
to : A → B
from : B → A
open _⇔_
-- Logical forall is, not surpringly, ∀.
-- Forall elimination is also function application.
∀-elim : ∀ {A : Set} {B : A → Set}
→ (L : ∀ (x : A) → B x)
→ (M : A)
-----------------
→ B M
∀-elim L M = L M
-- In fact, A → B is nicer syntax for ∀ (_ : A) → B.
-- 747/PLFA exercise: ForAllDistProd (1 point)
-- Show that ∀ distributes over ×.
-- (The special case of → distributes over × was shown in the Connectives chapter.)
∀-distrib-× : ∀ {A : Set} {B C : A → Set} →
(∀ (x : A) → B x × C x) ≃ (∀ (x : A) → B x) × (∀ (x : A) → C x)
∀-distrib-× = {!!}
-- 747/PLFA exercise: SumForAllImpForAllSum (1 point)
-- Show that a disjunction of foralls implies a forall of disjunctions.
⊎∀-implies-∀⊎ : ∀ {A : Set} {B C : A → Set} →
(∀ (x : A) → B x) ⊎ (∀ (x : A) → C x) → ∀ (x : A) → B x ⊎ C x
⊎∀-implies-∀⊎ ∀B⊎∀C = {!!}
-- Existential quantification can be defined as a pair:
-- a witness and a proof that the witness satisfies the property.
data Σ (A : Set) (B : A → Set) : Set where
⟨_,_⟩ : (x : A) → B x → Σ A B
-- Some convenient syntax.
Σ-syntax = Σ
infix 2 Σ-syntax
syntax Σ-syntax A (λ x → B) = Σ[ x ∈ A ] B
-- Unfortunately, we can use the RHS syntax in code,
-- but the LHS will show up in displays of goal and context.
-- This is equivalent to defining a dependent record type.
record Σ′ (A : Set) (B : A → Set) : Set where
field
proj₁′ : A
proj₂′ : B proj₁′
-- By convention, the library uses ∃ when the domain of the bound variable is implicit.
∃ : ∀ {A : Set} (B : A → Set) → Set
∃ {A} B = Σ A B
-- More special syntax.
∃-syntax = ∃
syntax ∃-syntax (λ x → B) = ∃[ x ] B
-- Above we saw two ways of constructing an existential.
-- We eliminate an existential with a function that consumes the
-- witness and proof and reaches a conclusion C.
∃-elim : ∀ {A : Set} {B : A → Set} {C : Set}
→ (∀ x → B x → C)
→ ∃[ x ] B x
---------------
→ C
∃-elim f ⟨ x , y ⟩ = f x y
-- This is a generalization of currying (from Connectives).
-- currying : ∀ {A B C : Set} → (A → B → C) ≃ (A × B → C)
∀∃-currying : ∀ {A : Set} {B : A → Set} {C : Set}
→ (∀ x → B x → C) ≃ (∃[ x ] B x → C)
_≃_.to ∀∃-currying f ⟨ x , x₁ ⟩ = f x x₁
_≃_.from ∀∃-currying e x x₁ = e ⟨ x , x₁ ⟩
_≃_.from∘to ∀∃-currying f = refl
_≃_.to∘from ∀∃-currying e = extensionality λ { ⟨ x , x₁ ⟩ → refl}
-- 747/PLFA exercise: ExistsDistSum (2 points)
-- Show that existentials distribute over disjunction.
∃-distrib-⊎ : ∀ {A : Set} {B C : A → Set} →
∃[ x ] (B x ⊎ C x) ≃ (∃[ x ] B x) ⊎ (∃[ x ] C x)
∃-distrib-⊎ = {!!}
-- 747/PLFA exercise: ExistsProdImpProdExists (1 point)
-- Show that existentials distribute over ×.
∃×-implies-×∃ : ∀ {A : Set} {B C : A → Set} →
∃[ x ] (B x × C x) → (∃[ x ] B x) × (∃[ x ] C x)
∃×-implies-×∃ = {!!}
-- An existential example: revisiting even/odd.
-- Recall the mutually-recursive definitions of even and odd.
data even : ℕ → Set
data odd : ℕ → Set
data even where
even-zero : even zero
even-suc : ∀ {n : ℕ}
→ odd n
------------
→ even (suc n)
data odd where
odd-suc : ∀ {n : ℕ}
→ even n
-----------
→ odd (suc n)
-- An number is even iff it is double some other number.
-- A number is odd iff is one plus double some other number.
-- Proofs below.
even-∃ : ∀ {n : ℕ} → even n → ∃[ m ] ( m * 2 ≡ n)
odd-∃ : ∀ {n : ℕ} → odd n → ∃[ m ] (1 + m * 2 ≡ n)
even-∃ even-zero = ⟨ zero , refl ⟩
even-∃ (even-suc x) with odd-∃ x
even-∃ (even-suc x) | ⟨ x₁ , refl ⟩ = ⟨ suc x₁ , refl ⟩
odd-∃ (odd-suc x) with even-∃ x
odd-∃ (odd-suc x) | ⟨ x₁ , refl ⟩ = ⟨ x₁ , refl ⟩
∃-even : ∀ {n : ℕ} → ∃[ m ] ( m * 2 ≡ n) → even n
∃-odd : ∀ {n : ℕ} → ∃[ m ] (1 + m * 2 ≡ n) → odd n
∃-even ⟨ zero , refl ⟩ = even-zero
∃-even ⟨ suc x , refl ⟩ = even-suc (∃-odd ⟨ x , refl ⟩)
∃-odd ⟨ x , refl ⟩ = odd-suc (∃-even ⟨ x , refl ⟩)
-- PLFA exercise: what if we write the arithmetic more "naturally"?
-- (Proof gets harder but is still doable).
-- 747/PLFA exercise: AltLE (3 points)
-- An alternate definition of y ≤ z.
-- (Optional exercise: Is this an isomorphism?)
∃-≤ : ∀ {y z : ℕ} → ( (y ≤ z) ⇔ ( ∃[ x ] (y + x ≡ z) ) )
∃-≤ = {!!}
-- The negation of an existential is isomorphic to a universal of a negation.
¬∃≃∀¬ : ∀ {A : Set} {B : A → Set}
→ (¬ ∃[ x ] B x) ≃ ∀ x → ¬ B x
¬∃≃∀¬ = {!!}
-- 747/PLFA exercise: ExistsNegImpNegForAll (1 point)
-- Existence of negation implies negation of universal.
∃¬-implies-¬∀ : ∀ {A : Set} {B : A → Set}
→ ∃[ x ] (¬ B x)
--------------
→ ¬ (∀ x → B x)
∃¬-implies-¬∀ ∃¬B = {!!}
-- The converse cannot be proved in intuitionistic logic.
-- PLFA exercise: isomorphism between naturals and existence of canonical binary.
-- This is essentially what we did at the end of 747Isomorphism.
|
oeis/202/A202831.asm | neoneye/loda-programs | 11 | 175789 | <filename>oeis/202/A202831.asm
; A202831: E.g.f.: exp(4*x/(1-5*x)) / sqrt(1-25*x^2).
; Submitted by <NAME>
; 1,4,81,1444,44521,1397124,58354321,2574344644,136043683281,7657406908804,489836445798001,33351743794661604,2504378700538997881,199445618093659242244,17189578072429077875121,1564487078400498014277124,152146464623361858013314721,15558346062620657685256259844,1684599833799100070091777534481,191042753445545122432737149191204,22784746732802907191249453531765001,2836106946041483807932580294022979204,369312192357628629314127241068790969681,50034169431923144997097287598242324799044
seq $0,202832 ; E.g.f: exp(2*x + 5*x^2/2).
pow $0,2
|
rustnes-dev/test_roms/test_apu_m/test_11.asm | w1n5t0n99/rustnes | 2 | 91 | ; TEST 01
; 2012 (c) JrezCorp Team
;
; ASM6502
;
.list
.inesprg 1 ; 1 PRG
.ineschr 1 ; 1 CHR
.inesmir 0 ; V-mirroring
.inesmap 0 ; 0-map (NMAP)
; MEMORY MAP
;
; 0x0000 - 0x04FF - arrays (0x0000-0x00FF - zero page, 0x0100-0x01FF - stack, 0x0200-0x02FF - sprite memmory)
; 0x0500 - 0x07FF - variables
; 0x0800 - 0x1FFF - mirrors of 0x0000 - 0x07FF
; 0x2000 - 0x2007 - PPU registers
; 0x2008 - 0x3FFF - mirrors of 0x2000 - 0x2007
; 0x4000 - 0x401F - 2A03 (APU) registers
; 0x4020 - 0x5FFF - mapper registers (not used)
; 0x6000 - 0x7FFF - SRAM
; 0x8000 - 0xFFFF - PRG ROM
; VARIABLES AND ARRAYS
stack = $0100 ; (size = 256)
sprite_mem = $0200 ; (size = 256)
nmi_hit = $0500 ; (size = 1)
first_run = $0501 ; (size = 1)
last_res = $0502 ; (size = 1)
.bank 0
.org $8000
; PRG ROM
main:
; PPU is turned off
; setup palette
lda #$3f
sta $2006
lda #0
sta $2006
lda #13
sta $2007
lda #32
sta $2007
lda #14
sta $2007
lda #14
sta $2007
; clear attributes
lda #$23
sta $2006
lda #$c0
sta $2006
ldx #64
lda #0
main_loop0:
sta $2007
dex
bne main_loop0
lda #$21
sta $2006
lda #$2a
sta $2006
; TEST
lda #0
sta first_run
sta last_res
jmp test
.org $8100
test:
lda #$40
sta $4017
lda #0
sta $4017
ldx #$39
ldy #$18
loop:
dex
bne loop
dey
bne loop
nop
nop
lda $4015
bne wait_1
wait_1:
lda #$40
sta $4017
lda #0
sta $4002
sta $4003
lda #1
sta $4015
lda #0
sta $4003
lda #$80
ldx #7
clear_lc_loop:
sta $4017
dex
bne clear_lc_loop
stx $4017
ldx #$38
ldy #$18
clear_loop:
dex
bne clear_loop
dey
bne clear_loop
nop
nop
nop
nop
sta $4017
nop
ldx #$ff
lda $4015
and #1
ldy first_run
bne test_check
sta last_res
lda #1
sta first_run
jmp test
test_check:
eor last_res
beq fail_loop
pass_loop:
inx
lda test_success, x
sta $2007
bne pass_loop
beq test_end
fail_loop:
inx
lda test_error, x
sta $2007
bne fail_loop
test_end:
jsr vwait
lda #%00001010
sta $2001
clv
eloop:
bvc eloop
; clear scroll
clear_scroll:
lda #0
sta $2006
sta $2006
rts
; wait for vblank starts
vwait_start:
bit $2002
vwait_start_loop0:
bit $2002
bpl vwait_start_loop0
rts
; wait for vblank ends and clear scroll
vwait_end:
jsr vwait_end_wc
jmp clear_scroll
; wait for vblank ends
vwait_end_wc:
lda $2002
bmi vwait_end_wc
rts
; wait for a vblank
vwait:
jsr vwait_wc
jmp clear_scroll
; wait for a vblank (scroll not cleared)
vwait_wc:
jsr vwait_start
jmp vwait_end_wc
; entry point
start:
; turn off PPU
lda #0
sta $2000
sta $2001
; disable interrupts
sei
; reset stack pointer
ldx $ff
txs
; wait for two vblanks
jsr vwait_wc
jsr vwait_wc
; goto main
jmp main
; non-maskable interrupt
nmi:
; save state
php
pha
lda #1
sta nmi_hit
pla
plp
rti
; ignore any irq
irq:
rti
; DATA
test_error:
.db "TEST FAILED",0
test_success:
.db "TEST PASSED",0
; POINTERS
.bank 1
.org $FFFA
.dw nmi, start, irq
; CHR ROM
.bank 2
.org $0000
.incbin "rom.chr"
|
05_exec/win32/exec32.asm | jacwil/nasm-on-windows | 13 | 10200 | [BITS 32]
GLOBAL _main
EXTERN _CloseHandle@4
EXTERN _CreateProcessA@40
EXTERN _ExitProcess@4
EXTERN _GetCommandLineA@0
EXTERN _GetLastError@0
EXTERN _GetStdHandle@4
EXTERN _WaitForSingleObject@8
EXTERN _WriteFile@20
SECTION .data
sUsage db 'USAGE: exec mycmd [cmdarg]...',10,'Executes the program specified and waits for the spawned process to exit.',10
lUsage equ $-sUsage
sError db 'CreateProcess failed.',10
lError equ $-sError
startinfo:
dd 044h
times 16 dd 0
procinfo:
hproc dd 0
hthread dd 0
times 2 dd 0
SECTION .bss
stdout resd 1
SECTION .text
_main:
push -0Bh ;STD_OUTPUT_HANDLE
call _GetStdHandle@4
mov [stdout], eax
call _GetCommandLineA@0
mov esi, eax
mov edi, eax
call strlen_v3
mov edi, esi
call finddblsp
cmp edi, 0
jz .usage
push procinfo
push startinfo
push 0
push 0
push 0
push 0
push 0
push 0
push edi
push 0
call _CreateProcessA@40
cmp eax, 0
jz .error
mov ebx, [hproc]
mov edx, [hthread]
push -1
push ebx
call _WaitForSingleObject@8
push ebx
call _CloseHandle@4
push edx
call _CloseHandle@4
push 0
call _ExitProcess@4
xor eax, eax
ret
.error:
call _GetLastError@0
mov ebx, eax
mov eax, [stdout]
push 0
push 0
push lError
push sError
push eax
call _WriteFile@20
push ebx
call _ExitProcess@4
mov eax, ebx
ret
.usage:
mov eax, [stdout]
push 0
push 0
push lUsage
push sUsage
push eax
call _WriteFile@20
push 2
call _ExitProcess@4
mov eax, 2
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; finddblsp ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Description: ;
; Finds the first occurance of 2 spaces (ASCII ;
; code 020h) in a row. Function stops searching ;
; after looking at ECX bytes. Very inefficient. ;
; ;
; Usage and Effects: ;
; EAX: DESTROYED upon return. ;
; ECX: Length of string to search. Length of ;
; substring upon return. ;
; EDI: Pointer to the input string on function ;
; call. Points to the character immediately ;
; following the double space upon return if ;
; found. 0 upon return if not found. ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
finddblsp:
cmp ecx, 1
jle .notfound
cmp word [edi], 02020h
jz .found
dec ecx
inc edi
jmp finddblsp
.notfound:
xor edi, edi
ret
.found:
inc edi
inc edi
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; strlen_v3 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Description: ;
; Works like the C library function it's named ;
; after. Finds the length of a NULL terminated ;
; string. Version 3 (v3): This function is the ;
; same as v2 but makes use of the processor's ;
; REP prefix. ;
; ;
; DANGER: This function doesn't place a limit on ;
; the size of the string. If the string is not ;
; NULL terminated, this function will continue ;
; reading bytes of memory until an exception is ;
; thrown. ;
; ;
; Usage and Effects: ;
; EAX: 0 upon return. ;
; ECX: Length of string upon return. ;
; EDI: Pointer to the input string on function ;
; call. Points to input string's NULL ;
; terminator upon return. ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
strlen_v3:
xor eax, eax
mov ecx, -1
cld
repne scasb
inc ecx
inc ecx
dec edi
neg ecx
ret
|
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_2527.asm | ljhsiun2/medusa | 9 | 94779 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r14
push %r15
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x15e88, %r15
nop
nop
nop
nop
cmp %r14, %r14
mov $0x6162636465666768, %r10
movq %r10, %xmm5
movups %xmm5, (%r15)
nop
dec %r12
lea addresses_D_ht+0x1d878, %r14
nop
nop
nop
nop
dec %r10
movb $0x61, (%r14)
cmp $56347, %r15
lea addresses_WC_ht+0xa938, %rcx
nop
sub $16615, %rdi
vmovups (%rcx), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $0, %xmm1, %r10
nop
nop
xor %rdi, %rdi
lea addresses_D_ht+0x11fb8, %rsi
lea addresses_UC_ht+0xb238, %rdi
nop
lfence
mov $10, %rcx
rep movsq
nop
nop
nop
dec %rsi
lea addresses_UC_ht+0x7138, %r14
add %r15, %r15
and $0xffffffffffffffc0, %r14
movntdqa (%r14), %xmm4
vpextrq $1, %xmm4, %rsi
nop
dec %r14
lea addresses_D_ht+0x14038, %rsi
lea addresses_A_ht+0x15138, %rdi
nop
nop
nop
nop
and %r10, %r10
mov $12, %rcx
rep movsq
nop
nop
add $56669, %rdi
lea addresses_UC_ht+0xc338, %r14
nop
nop
nop
nop
cmp $15065, %r12
movb (%r14), %r13b
nop
nop
xor $775, %r14
lea addresses_normal_ht+0x124dc, %rcx
nop
nop
nop
and %r15, %r15
movups (%rcx), %xmm4
vpextrq $1, %xmm4, %r14
nop
nop
nop
nop
dec %r15
lea addresses_A_ht+0x1b99c, %rdi
nop
nop
nop
and $53586, %r14
movb (%rdi), %r12b
nop
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_UC_ht+0x1d938, %rsi
nop
nop
cmp $44700, %rdi
mov (%rsi), %r10w
nop
nop
nop
nop
and %r14, %r14
lea addresses_D_ht+0x2138, %r15
clflush (%r15)
and %rdi, %rdi
mov $0x6162636465666768, %r13
movq %r13, %xmm5
movups %xmm5, (%r15)
xor $54875, %rsi
lea addresses_D_ht+0xfc28, %rsi
clflush (%rsi)
nop
nop
nop
nop
nop
cmp $59293, %rcx
vmovups (%rsi), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %r10
nop
nop
xor $61982, %r14
lea addresses_WT_ht+0xbdc8, %rsi
lea addresses_WT_ht+0x1c938, %rdi
nop
nop
nop
nop
nop
sub %r14, %r14
mov $72, %rcx
rep movsq
nop
nop
nop
nop
nop
inc %r14
pop %rsi
pop %rdi
pop %rcx
pop %r15
pop %r14
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r15
push %r9
push %rax
push %rbp
push %rbx
push %rdx
// Store
mov $0x7c252d0000000d48, %r9
xor %rax, %rax
movw $0x5152, (%r9)
nop
nop
xor %r15, %r15
// Store
lea addresses_WC+0x9d38, %r10
nop
nop
xor %rdx, %rdx
mov $0x5152535455565758, %rax
movq %rax, (%r10)
nop
nop
nop
dec %r15
// Faulty Load
lea addresses_UC+0xb938, %rax
nop
nop
nop
cmp $46247, %rbp
movb (%rax), %r9b
lea oracles, %rdx
and $0xff, %r9
shlq $12, %r9
mov (%rdx,%r9,1), %r9
pop %rdx
pop %rbx
pop %rbp
pop %rax
pop %r9
pop %r15
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 6, 'size': 8, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 3, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 11, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 11, 'size': 16, 'same': False, 'NT': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 9, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 2, 'size': 1, 'same': True, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': True, 'congruent': 11, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 16, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 3, 'size': 32, 'same': True, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': True}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
src/apsepp-test_node_class-private_test_reporter.adb | thierr26/ada-apsepp | 0 | 16260 | <filename>src/apsepp-test_node_class-private_test_reporter.adb
-- Copyright (C) 2019 <NAME> <<EMAIL>>
-- MIT license. Please refer to the LICENSE file.
package body Apsepp.Test_Node_Class.Private_Test_Reporter is
----------------------------------------------------------------------------
procedure Run_Instance_Process_Primitive is
begin
Shared_Instance.Instance.Process;
end Run_Instance_Process_Primitive;
----------------------------------------------------------------------------
function Test_Reporter return Test_Reporter_Access
is (Test_Reporter_Access (Shared_Instance_Fallback_Switch.Instance_FS));
----------------------------------------------------------------------------
end Apsepp.Test_Node_Class.Private_Test_Reporter;
|
tools-src/gnu/gcc/gcc/ada/i-os2lib.ads | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 28354 | <reponame>enfoTek/tomato.linksys.e2000.nvram-mod
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- I N T E R F A C E S . O S 2 L I B --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1993-1997 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 (and children) provide interface definitions to the standard
-- OS/2 Library. They are merely a translation of the various <bse*.h> files.
-- It is intended that higher level interfaces (with better names, and
-- stronger typing!) be built on top of this one for Ada (i.e. clean)
-- programming.
-- We have chosen to keep names, types, etc. as close as possible to the
-- C definition to provide easier reference to the documentation. The main
-- exception is when a formal and its type (in C) differed only by the case
-- of letters (like in HMUX hmux). In this case, we have prepended "F_" to
-- the formal (i.e. F_hmux : HMUX).
with Interfaces.C;
with Interfaces.C.Strings;
with System;
package Interfaces.OS2Lib is
pragma Preelaborate (OS2Lib);
package IC renames Interfaces.C;
package ICS renames Interfaces.C.Strings;
-------------------
-- General Types --
-------------------
type APIRET is new IC.unsigned_long;
type APIRET16 is new IC.unsigned_short;
subtype APIRET32 is APIRET;
subtype PSZ is ICS.chars_ptr;
subtype PCHAR is ICS.chars_ptr;
subtype PVOID is System.Address;
type PPVOID is access all PVOID;
type BOOL32 is new IC.unsigned_long;
False32 : constant BOOL32 := 0;
True32 : constant BOOL32 := 1;
type UCHAR is new IC.unsigned_char;
type USHORT is new IC.unsigned_short;
type ULONG is new IC.unsigned_long;
type PULONG is access all ULONG;
-- Coprocessor stack register element.
type FPREG is record
losig : ULONG; -- Low 32-bits of the mantissa
hisig : ULONG; -- High 32-bits of the mantissa
signexp : USHORT; -- Sign and exponent
end record;
pragma Convention (C, FPREG);
type AULONG is array (IC.size_t range <>) of ULONG;
type AFPREG is array (IC.size_t range <>) of FPREG;
type LHANDLE is new IC.unsigned_long;
NULLHANDLE : constant := 0;
---------------------
-- Time Management --
---------------------
function DosSleep (How_long : ULONG) return APIRET;
pragma Import (C, DosSleep, "DosSleep");
type DATETIME is record
hours : UCHAR;
minutes : UCHAR;
seconds : UCHAR;
hundredths : UCHAR;
day : UCHAR;
month : UCHAR;
year : USHORT;
timezone : IC.short;
weekday : UCHAR;
end record;
type PDATETIME is access all DATETIME;
function DosGetDateTime (pdt : PDATETIME) return APIRET;
pragma Import (C, DosGetDateTime, "DosGetDateTime");
function DosSetDateTime (pdt : PDATETIME) return APIRET;
pragma Import (C, DosSetDateTime, "DosSetDateTime");
----------------------------
-- Miscelleneous Features --
----------------------------
-- Features which do not fit any child
function DosBeep (Freq : ULONG; Dur : ULONG) return APIRET;
pragma Import (C, DosBeep, "DosBeep");
procedure Must_Not_Fail (Return_Code : OS2Lib.APIRET);
pragma Inline (Must_Not_Fail);
-- Many OS/2 functions return APIRET and are not supposed to fail. In C
-- style, these would be called as procedures, disregarding the returned
-- value. This procedure can be used to achieve the same effect with a
-- call of the form: Must_Not_Fail (Some_OS2_Function (...));
procedure Sem_Must_Not_Fail (Return_Code : OS2Lib.APIRET);
pragma Inline (Sem_Must_Not_Fail);
-- Similar to Must_Not_Fail, but used in the case of DosPostEventSem,
-- where the "error" code ERROR_ALREADY_POSTED is not really an error.
end Interfaces.OS2Lib;
|
programs/oeis/014/A014447.asm | karttu/loda | 0 | 102141 | <filename>programs/oeis/014/A014447.asm
; A014447: Odd Lucas numbers.
; 1,3,7,11,29,47,123,199,521,843,2207,3571,9349,15127,39603,64079,167761,271443,710647,1149851,3010349,4870847,12752043,20633239,54018521,87403803,228826127,370248451,969323029,1568397607,4106118243
mul $0,3
mov $1,1
mov $2,1
mov $4,-3
lpb $0,1
sub $0,2
add $1,$2
mov $3,2
sub $3,$2
mov $5,$3
sub $5,$1
sub $1,$4
mov $4,$5
lpe
mul $1,2
div $1,8
mul $1,2
add $1,1
|
gcc-gcc-7_3_0-release/gcc/ada/a-strfix.ads | best08618/asylo | 7 | 28343 | <filename>gcc-gcc-7_3_0-release/gcc/ada/a-strfix.ads
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . S T R I N G S . F I X E D --
-- --
-- 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. --
-- --
------------------------------------------------------------------------------
with Ada.Strings.Maps;
package Ada.Strings.Fixed is
pragma Preelaborate;
--------------------------------------------------------------
-- Copy Procedure for Strings of Possibly Different Lengths --
--------------------------------------------------------------
procedure Move
(Source : String;
Target : out String;
Drop : Truncation := Error;
Justify : Alignment := Left;
Pad : Character := Space);
------------------------
-- Search Subprograms --
------------------------
function Index
(Source : String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
function Index
(Source : String;
Pattern : String;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural;
function Index
(Source : String;
Set : Maps.Character_Set;
Test : Membership := Inside;
Going : Direction := Forward) return Natural;
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
pragma Ada_05 (Index);
function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Direction := Forward;
Mapping : Maps.Character_Mapping_Function) return Natural;
pragma Ada_05 (Index);
function Index
(Source : String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership := Inside;
Going : Direction := Forward) return Natural;
pragma Ada_05 (Index);
function Index_Non_Blank
(Source : String;
Going : Direction := Forward) return Natural;
function Index_Non_Blank
(Source : String;
From : Positive;
Going : Direction := Forward) return Natural;
pragma Ada_05 (Index_Non_Blank);
function Count
(Source : String;
Pattern : String;
Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
function Count
(Source : String;
Pattern : String;
Mapping : Maps.Character_Mapping_Function) return Natural;
function Count
(Source : String;
Set : Maps.Character_Set) return Natural;
procedure Find_Token
(Source : String;
Set : Maps.Character_Set;
From : Positive;
Test : Membership;
First : out Positive;
Last : out Natural);
pragma Ada_2012 (Find_Token);
procedure Find_Token
(Source : String;
Set : Maps.Character_Set;
Test : Membership;
First : out Positive;
Last : out Natural);
------------------------------------
-- String Translation Subprograms --
------------------------------------
function Translate
(Source : String;
Mapping : Maps.Character_Mapping) return String;
procedure Translate
(Source : in out String;
Mapping : Maps.Character_Mapping);
function Translate
(Source : String;
Mapping : Maps.Character_Mapping_Function) return String;
procedure Translate
(Source : in out String;
Mapping : Maps.Character_Mapping_Function);
---------------------------------------
-- String Transformation Subprograms --
---------------------------------------
function Replace_Slice
(Source : String;
Low : Positive;
High : Natural;
By : String) return String;
procedure Replace_Slice
(Source : in out String;
Low : Positive;
High : Natural;
By : String;
Drop : Truncation := Error;
Justify : Alignment := Left;
Pad : Character := Space);
function Insert
(Source : String;
Before : Positive;
New_Item : String) return String;
procedure Insert
(Source : in out String;
Before : Positive;
New_Item : String;
Drop : Truncation := Error);
function Overwrite
(Source : String;
Position : Positive;
New_Item : String) return String;
procedure Overwrite
(Source : in out String;
Position : Positive;
New_Item : String;
Drop : Truncation := Right);
function Delete
(Source : String;
From : Positive;
Through : Natural) return String;
procedure Delete
(Source : in out String;
From : Positive;
Through : Natural;
Justify : Alignment := Left;
Pad : Character := Space);
---------------------------------
-- String Selector Subprograms --
---------------------------------
function Trim
(Source : String;
Side : Trim_End) return String;
procedure Trim
(Source : in out String;
Side : Trim_End;
Justify : Alignment := Left;
Pad : Character := Space);
function Trim
(Source : String;
Left : Maps.Character_Set;
Right : Maps.Character_Set) return String;
procedure Trim
(Source : in out String;
Left : Maps.Character_Set;
Right : Maps.Character_Set;
Justify : Alignment := Strings.Left;
Pad : Character := Space);
function Head
(Source : String;
Count : Natural;
Pad : Character := Space) return String;
procedure Head
(Source : in out String;
Count : Natural;
Justify : Alignment := Left;
Pad : Character := Space);
function Tail
(Source : String;
Count : Natural;
Pad : Character := Space) return String;
procedure Tail
(Source : in out String;
Count : Natural;
Justify : Alignment := Left;
Pad : Character := Space);
----------------------------------
-- String Constructor Functions --
----------------------------------
function "*"
(Left : Natural;
Right : Character) return String;
function "*"
(Left : Natural;
Right : String) return String;
end Ada.Strings.Fixed;
|
SOAS/Metatheory/Syntax.agda | JoeyEremondi/agda-soas | 0 | 12466 | <filename>SOAS/Metatheory/Syntax.agda
-- Syntax of a second-order language
module SOAS.Metatheory.Syntax {T : Set} where
open import SOAS.Families.Core {T}
open import SOAS.Families.Build
open import SOAS.Common
open import SOAS.Context
open import Categories.Object.Initial
open import SOAS.Construction.Structure
open import SOAS.ContextMaps.Inductive
open import SOAS.Coalgebraic.Strength
open import SOAS.Abstract.ExpStrength
open import SOAS.Metatheory.MetaAlgebra
-- Data characterising a second-order syntax:
-- * a signature endofunctor ⅀
-- * coalgebraic and exponential strength
-- * initial (⅀,𝔛)-meta-algebra for each 𝔛
-- + an inductive metavariable constructor for convenience
record Syntax : Set₁ where
field
⅀F : Functor 𝔽amiliesₛ 𝔽amiliesₛ
⅀:CS : CompatStrengths ⅀F
𝕋:Init : (𝔛 : Familyₛ) → Initial (𝕄etaAlgebras ⅀F 𝔛)
mvarᵢ : {𝔛 : Familyₛ}{τ : T}{Π Γ : Ctx} (open Initial (𝕋:Init 𝔛))
→ 𝔛 τ Π → Sub (𝐶 ⊥) Π Γ → 𝐶 ⊥ τ Γ
module _ {𝔛 : Familyₛ} where
open Initial (𝕋:Init 𝔛)
private
variable
α α₁ α₂ α₃ α₄ α₅ α₆ α₇ α₈ α₉ : T
Γ Π Π₁ Π₂ Π₃ Π₄ Π₅ Π₆ Π₇ Π₈ Π₉ : Ctx
𝔐 : MCtx
Tm : MCtx → Familyₛ
Tm 𝔐 = 𝐶 (Initial.⊥ (𝕋:Init ∥ 𝔐 ∥))
-- Shorthands for metavariables associated with a metavariable environment
infix 100 𝔞⟨_ 𝔟⟨_ 𝔠⟨_ 𝔡⟨_ 𝔢⟨_
infix 100 ◌ᵃ⟨_ ◌ᵇ⟨_ ◌ᶜ⟨_ ◌ᵈ⟨_ ◌ᵉ⟨_
𝔞⟨_ : Sub (Tm (⁅ Π ⊩ₙ α ⁆ 𝔐)) Π Γ → Tm (⁅ Π ⊩ₙ α ⁆ 𝔐) α Γ
𝔞⟨ ε = mvarᵢ ↓ ε
𝔟⟨_ : Sub (Tm (⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐)) Π Γ
→ Tm (⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐) α Γ
𝔟⟨ ε = mvarᵢ (↑ ↓) ε
𝔠⟨_ : Sub (Tm (⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐)) Π Γ
→ Tm (⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐) α Γ
𝔠⟨ ε = mvarᵢ (↑ ↑ ↓) ε
𝔡⟨_ : Sub (Tm (⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐)) Π Γ
→ Tm (⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐) α Γ
𝔡⟨ ε = mvarᵢ (↑ ↑ ↑ ↓) ε
𝔢⟨_ : Sub (Tm (⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐)) Π Γ
→ Tm (⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐) α Γ
𝔢⟨ ε = mvarᵢ (↑ ↑ ↑ ↑ ↓) ε
𝔣⟨_ : Sub (Tm (⁅ Π₅ ⊩ₙ α₅ ⁆ ⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐)) Π Γ
→ Tm (⁅ Π₅ ⊩ₙ α₅ ⁆ ⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐) α Γ
𝔣⟨ ε = mvarᵢ (↑ ↑ ↑ ↑ ↑ ↓) ε
𝔤⟨_ : Sub (Tm (⁅ Π₆ ⊩ₙ α₆ ⁆ ⁅ Π₅ ⊩ₙ α₅ ⁆ ⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐)) Π Γ
→ Tm (⁅ Π₆ ⊩ₙ α₆ ⁆ ⁅ Π₅ ⊩ₙ α₅ ⁆ ⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐) α Γ
𝔤⟨ ε = mvarᵢ (↑ ↑ ↑ ↑ ↑ ↑ ↓) ε
𝔥⟨_ : Sub (Tm (⁅ Π₇ ⊩ₙ α₇ ⁆ ⁅ Π₆ ⊩ₙ α₆ ⁆ ⁅ Π₅ ⊩ₙ α₅ ⁆ ⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐)) Π Γ
→ Tm (⁅ Π₇ ⊩ₙ α₇ ⁆ ⁅ Π₆ ⊩ₙ α₆ ⁆ ⁅ Π₅ ⊩ₙ α₅ ⁆ ⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐) α Γ
𝔥⟨ ε = mvarᵢ (↑ ↑ ↑ ↑ ↑ ↑ ↑ ↓) ε
𝔦⟨_ : Sub (Tm (⁅ Π₈ ⊩ₙ α₈ ⁆ ⁅ Π₇ ⊩ₙ α₇ ⁆ ⁅ Π₆ ⊩ₙ α₆ ⁆ ⁅ Π₅ ⊩ₙ α₅ ⁆ ⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐)) Π Γ
→ Tm (⁅ Π₈ ⊩ₙ α₈ ⁆ ⁅ Π₇ ⊩ₙ α₇ ⁆ ⁅ Π₆ ⊩ₙ α₆ ⁆ ⁅ Π₅ ⊩ₙ α₅ ⁆ ⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐) α Γ
𝔦⟨ ε = mvarᵢ (↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↓) ε
𝔧⟨_ : Sub (Tm (⁅ Π₉ ⊩ₙ α₉ ⁆ ⁅ Π₈ ⊩ₙ α₈ ⁆ ⁅ Π₇ ⊩ₙ α₇ ⁆ ⁅ Π₆ ⊩ₙ α₆ ⁆ ⁅ Π₅ ⊩ₙ α₅ ⁆ ⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐)) Π Γ
→ Tm (⁅ Π₉ ⊩ₙ α₉ ⁆ ⁅ Π₈ ⊩ₙ α₈ ⁆ ⁅ Π₇ ⊩ₙ α₇ ⁆ ⁅ Π₆ ⊩ₙ α₆ ⁆ ⁅ Π₅ ⊩ₙ α₅ ⁆ ⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ Π ⊩ₙ α ⁆ 𝔐) α Γ
𝔧⟨ ε = mvarᵢ (↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↓) ε
-- Shorthands for metavariables with an empty metavariable environment
𝔞 : Tm (⁅ α ⁆ 𝔐) α Γ
𝔞 = 𝔞⟨ •
𝔟 : Tm (⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ α ⁆ 𝔐) α Γ
𝔟 = 𝔟⟨ •
𝔠 : Tm (⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ α ⁆ 𝔐) α Γ
𝔠 = 𝔠⟨ •
𝔡 : Tm (⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ α ⁆ 𝔐) α Γ
𝔡 = 𝔡⟨ •
𝔢 : Tm (⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ α ⁆ 𝔐) α Γ
𝔢 = 𝔢⟨ •
𝔣 : Tm (⁅ Π₅ ⊩ₙ α₅ ⁆ ⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ α ⁆ 𝔐) α Γ
𝔣 = 𝔣⟨ •
𝔤 : Tm (⁅ Π₆ ⊩ₙ α₆ ⁆ ⁅ Π₅ ⊩ₙ α₅ ⁆ ⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ α ⁆ 𝔐) α Γ
𝔤 = 𝔤⟨ •
𝔥 : Tm (⁅ Π₇ ⊩ₙ α₇ ⁆ ⁅ Π₆ ⊩ₙ α₆ ⁆ ⁅ Π₅ ⊩ₙ α₅ ⁆ ⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ α ⁆ 𝔐) α Γ
𝔥 = 𝔥⟨ •
𝔦 : Tm (⁅ Π₈ ⊩ₙ α₈ ⁆ ⁅ Π₇ ⊩ₙ α₇ ⁆ ⁅ Π₆ ⊩ₙ α₆ ⁆ ⁅ Π₅ ⊩ₙ α₅ ⁆ ⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ α ⁆ 𝔐) α Γ
𝔦 = 𝔦⟨ •
𝔧 : Tm (⁅ Π₉ ⊩ₙ α₉ ⁆ ⁅ Π₈ ⊩ₙ α₈ ⁆ ⁅ Π₇ ⊩ₙ α₇ ⁆ ⁅ Π₆ ⊩ₙ α₆ ⁆ ⁅ Π₅ ⊩ₙ α₅ ⁆ ⁅ Π₄ ⊩ₙ α₄ ⁆ ⁅ Π₃ ⊩ₙ α₃ ⁆ ⁅ Π₂ ⊩ₙ α₂ ⁆ ⁅ Π₁ ⊩ₙ α₁ ⁆ ⁅ α ⁆ 𝔐) α Γ
𝔧 = 𝔧⟨ •
-- Synonyms for holes
◌ᵃ = 𝔞 ; ◌ᵇ = 𝔟 ; ◌ᶜ = 𝔠 ; ◌ᵈ = 𝔡 ; ◌ᵉ = 𝔢
◌ᵃ⟨_ = 𝔞⟨_ ; ◌ᵇ⟨_ = 𝔟⟨_ ; ◌ᶜ⟨_ = 𝔠⟨_ ; ◌ᵈ⟨_ = 𝔡⟨_ ; ◌ᵉ⟨_ = 𝔢⟨_
|
Working Disassembly/General/Sprites/Sonic/Map - Sonic Snowboarding.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 5 | 3530 | <filename>Working Disassembly/General/Sprites/Sonic/Map - Sonic Snowboarding.asm<gh_stars>1-10
Map_347E30: dc.w Frame_347E4A-Map_347E30
dc.w Frame_347E4C-Map_347E30
dc.w Frame_347E66-Map_347E30
dc.w Frame_347E80-Map_347E30
dc.w Frame_347E9A-Map_347E30
dc.w Frame_347EB4-Map_347E30
dc.w Frame_347ECE-Map_347E30
dc.w Frame_347EE2-Map_347E30
dc.w Frame_347EFC-Map_347E30
dc.w Frame_347F16-Map_347E30
dc.w Frame_347F30-Map_347E30
dc.w Frame_347F4A-Map_347E30
dc.w Frame_347F6A-Map_347E30
Frame_347E4A: dc.w 0
Frame_347E4C: dc.w 4
dc.b $FC, $F, 0, 0,$FF,$FA
dc.b $EC, 7, 0,$10,$FF,$EA
dc.b $EC, 9, 0,$18,$FF,$FA
dc.b $DC, 9, 0,$1E,$FF,$F2
Frame_347E66: dc.w 4
dc.b $EE, 8, 0, 0,$FF,$F0
dc.b $F6, $D, 0, 3,$FF,$F0
dc.b 6, 8, 0, $B,$FF,$F8
dc.b $E, 6, 0, $E,$FF,$F8
Frame_347E80: dc.w 4
dc.b $E9, $A, 0, 0,$FF,$F1
dc.b $F9, 4, 0, 9, 0, 9
dc.b 1, $D, 0, $B,$FF,$F1
dc.b $11, 9, 0,$13,$FF,$E9
Frame_347E9A: dc.w 4
dc.b $EA, $F, 0, 0,$FF,$F3
dc.b $A, 8, 0,$10,$FF,$F3
dc.b $12, $C, 0,$13,$FF,$EB
dc.b $1A, 8, 0,$17,$FF,$EB
Frame_347EB4: dc.w 4
dc.b $EA, 8, 0, 0,$FF,$F5
dc.b $F2, $E, 0, 3,$FF,$ED
dc.b $A, 8, 0, $F,$FF,$F5
dc.b $12, $D, 0,$12,$FF,$F5
Frame_347ECE: dc.w 3
dc.b $EF, $F, 0, 0,$FF,$EC
dc.b $F, $C, 0,$10,$FF,$E4
dc.b $F, 8, 0,$14, 0, 4
Frame_347EE2: dc.w 4
dc.b $EF, $F, 0, 0,$FF,$EC
dc.b $F, $C, 0,$10,$FF,$E4
dc.b $F, 8, 0,$14, 0, 4
dc.b 7, 0, 0,$17, 0,$14
Frame_347EFC: dc.w 4
dc.b $EF, $F, 0, 0,$FF,$EC
dc.b 7, 4, 0,$10, 0, $C
dc.b $F, $C, 0,$12,$FF,$E4
dc.b $F, 0, 0,$16, 0, 4
Frame_347F16: dc.w 4
dc.b $F1, $E, 0, 0,$FF,$E5
dc.b $F1, 6, 0, $C, 0, 5
dc.b 9, $C, 0,$12,$FF,$ED
dc.b $11, $A, 0,$16,$FF,$ED
Frame_347F30: dc.w 4
dc.b $EB, $F, 0, 0,$FF,$F6
dc.b $F3, $A, 0,$10,$FF,$DE
dc.b $B, $C, 0,$19,$FF,$EE
dc.b $13, 9, 0,$1D,$FF,$F6
Frame_347F4A: dc.w 5
dc.b $EE, $F, 0, 0,$FF,$EC
dc.b $FE, 0, 0,$10, 0, $C
dc.b $E, $C, 0,$11,$FF,$E4
dc.b $E, 0, 0,$15, 0, 4
dc.b $16, $C, 0,$16,$FF,$FC
Frame_347F6A: dc.w 5
dc.b $EA, 8, 0, 0,$FF,$EE
dc.b $F2, $E, 0, 3,$FF,$EE
dc.b $A, $C, 0, $F,$FF,$E6
dc.b $12, $C, 0,$13,$FF,$EE
dc.b $1A, $C, 0,$17,$FF,$FE
|
examples/asm/standard.asm | Nibble-Knowledge/label-replacer | 0 | 171521 | <gh_stars>0
INF BASE_ADDR
LOD N_[2]
|
src/parser/evaql/evaql_lexer.g4 | YT0828/eva | 0 | 1214 | <reponame>YT0828/eva<gh_stars>0
lexer grammar evaql_lexer;
channels { EVAQLCOMMENT, ERRORCHANNEL }
// SKIP
SPACE: [ \t\r\n]+ -> channel(HIDDEN);
SPEC_EVAQL_COMMENT: '/*!' .+? '*/' -> channel(EVAQLCOMMENT);
COMMENT_INPUT: '/*' .*? '*/' -> channel(HIDDEN);
LINE_COMMENT: (
('-- ' | '#') ~[\r\n]* ('\r'? '\n' | EOF)
| '--' ('\r'? '\n' | EOF)
) -> channel(HIDDEN);
// Keywords
// Common Keywords
ALL: 'ALL';
ALTER: 'ALTER';
AND: 'AND';
ANY: 'ANY';
ANYDIM: 'ANYDIM';
AS: 'AS';
ASC: 'ASC';
BLOB: 'BLOB';
BY: 'BY';
COLUMN: 'COLUMN';
CREATE: 'CREATE';
DATA: 'DATA';
DATABASE: 'DATABASE';
DEFAULT: 'DEFAULT';
DELETE: 'DELETE';
DESC: 'DESC';
DESCRIBE: 'DESCRIBE';
DISTINCT: 'DISTINCT';
DROP: 'DROP';
EXIT: 'EXIT';
EXISTS: 'EXISTS';
EXPLAIN: 'EXPLAIN';
FALSE: 'FALSE';
FROM: 'FROM';
GROUP: 'GROUP';
HAVING: 'HAVING';
IF: 'IF';
IN: 'IN';
INFILE: 'INFILE';
INDIR: 'INDIR';
INTO: 'INTO';
INDEX: 'INDEX';
INSERT: 'INSERT';
IS: 'IS';
JOIN: 'JOIN';
KEY: 'KEY';
LIKE: 'LIKE';
LIMIT: 'LIMIT';
LOAD: 'LOAD';
NO: 'NO';
NOT: 'NOT';
NULL_LITERAL: 'NULL';
OFFSET: 'OFFSET';
ON: 'ON';
OR: 'OR';
ORDER: 'ORDER';
PATH: 'PATH';
PRIMARY: 'PRIMARY';
REFERENCES: 'REFERENCES';
RENAME: 'RENAME';
SAMPLE: 'SAMPLE';
SELECT: 'SELECT';
SET: 'SET';
SHUTDOWN: 'SHUTDOWN';
SOME: 'SOME';
TABLE: 'TABLE';
TO: 'TO';
TRUE: 'TRUE';
TRUNCATE: 'TRUNCATE';
UNION: 'UNION';
UNIQUE: 'UNIQUE';
UNKNOWN: 'UNKNOWN';
UNLOCK: 'UNLOCK';
UNSIGNED: 'UNSIGNED';
UPDATE: 'UPDATE';
UPLOAD: 'UPLOAD';
USING: 'USING';
VALUES: 'VALUES';
WHERE: 'WHERE';
XOR: 'XOR';
// EVAQL keywords
ERROR_BOUNDS: 'ERROR_WITHIN';
CONFIDENCE_LEVEL: 'AT_CONFIDENCE';
// Index types
BTREE: 'BTREE';
HASH: 'HASH';
// Computer vision tasks
OBJECT_DETECTION: 'OBJECT_DETECTION';
ACTION_CLASSICATION: 'ACTION_CLASSICATION';
// DATA TYPE Keywords
BOOLEAN: 'BOOLEAN';
INTEGER: 'INTEGER';
FLOAT: 'FLOAT';
TEXT: 'TEXT';
NDARRAY: 'NDARRAY';
INT8: 'INT8';
UINT8: 'UINT8';
INT16: 'INT16';
INT32: 'INT32';
INT64: 'INT64';
UNICODE: 'UNICODE';
BOOL: 'BOOL';
FLOAT32: 'FLOAT32';
FLOAT64: 'FLOAT64';
DECIMAL: 'DECIMAL';
STR: 'STR';
DATETIME: 'DATETIME';
ANYTYPE: 'ANYTYPE';
// Group function Keywords
AVG: 'AVG';
COUNT: 'COUNT';
MAX: 'MAX';
MIN: 'MIN';
STD: 'STD';
SUM: 'SUM';
FCOUNT: 'FCOUNT';
// Keywords, but can be ID
// Common Keywords, but can be ID
AUTO_INCREMENT: 'AUTO_INCREMENT';
COLUMNS: 'COLUMNS';
HELP: 'HELP';
TEMPTABLE: 'TEMPTABLE';
VALUE: 'VALUE';
// UDF
UDF: 'UDF';
INPUT: 'INPUT';
OUTPUT: 'OUTPUT';
TYPE: 'TYPE';
IMPL: 'IMPL';
// Common function names
ABS: 'ABS';
// Operators
// Operators. Assigns
VAR_ASSIGN: ':=';
PLUS_ASSIGN: '+=';
MINUS_ASSIGN: '-=';
MULT_ASSIGN: '*=';
DIV_ASSIGN: '/=';
MOD_ASSIGN: '%=';
AND_ASSIGN: '&=';
XOR_ASSIGN: '^=';
OR_ASSIGN: '|=';
// Operators. Arithmetics
STAR: '*';
DIVIDE: '/';
MODULE: '%';
PLUS: '+';
MINUSMINUS: '--';
MINUS: '-';
DIV: 'DIV';
MOD: 'MOD';
// Operators. Comparation
EQUAL_SYMBOL: '=';
GREATER_SYMBOL: '>';
LESS_SYMBOL: '<';
EXCLAMATION_SYMBOL: '!';
// Operators. Bit
BIT_NOT_OP: '~';
BIT_OR_OP: '|';
BIT_AND_OP: '&';
BIT_XOR_OP: '^';
// Constructors symbols
DOT: '.';
LR_BRACKET: '(';
RR_BRACKET: ')';
LR_SQ_BRACKET: '[';
RR_SQ_BRACKET: ']';
COMMA: ',';
SEMI: ';';
AT_SIGN: '@';
ZERO_DECIMAL: '0';
ONE_DECIMAL: '1';
TWO_DECIMAL: '2';
SINGLE_QUOTE_SYMB: '\'';
DOUBLE_QUOTE_SYMB: '"';
REVERSE_QUOTE_SYMB: '`';
COLON_SYMB: ':';
// Literal Primitives
STRING_LITERAL: DQUOTA_STRING | SQUOTA_STRING;
DECIMAL_LITERAL: DEC_DIGIT+;
REAL_LITERAL: (DEC_DIGIT+)? '.' DEC_DIGIT+
| DEC_DIGIT+ '.' EXPONENT_NUM_PART
| (DEC_DIGIT+)? '.' (DEC_DIGIT+ EXPONENT_NUM_PART)
| DEC_DIGIT+ EXPONENT_NUM_PART;
NULL_SPEC_LITERAL: '\\' 'N';
// Hack for dotID
// Prevent recognize string: .123somelatin AS ((.123), FLOAT_LITERAL), ((somelatin), ID)
// it must recoginze: .123somelatin AS ((.), DOT), (123somelatin, ID)
DOT_ID: '.' ID_LITERAL;
// Identifiers
ID: ID_LITERAL;
// DOUBLE_QUOTE_ID: '"' ~'"'+ '"';
REVERSE_QUOTE_ID: '`' ~'`'+ '`';
STRING_USER_NAME: (
SQUOTA_STRING | DQUOTA_STRING
| BQUOTA_STRING | ID_LITERAL
) '@'
(
SQUOTA_STRING | DQUOTA_STRING
| BQUOTA_STRING | ID_LITERAL
);
LOCAL_ID: '@'
(
[A-Z0-9._$]+
| SQUOTA_STRING
| DQUOTA_STRING
| BQUOTA_STRING
);
GLOBAL_ID: '@' '@'
(
[A-Z0-9._$]+
| BQUOTA_STRING
);
// Fragments for Literal primitives
fragment EXPONENT_NUM_PART: 'E' '-'? DEC_DIGIT+;
fragment ID_LITERAL: [A-Za-z_$0-9]*?[A-Za-z_$]+?[A-Za-z_$0-9]*;
fragment DQUOTA_STRING: '"' ( '\\'. | '""' | ~('"'| '\\') )* '"';
fragment SQUOTA_STRING: '\'' ('\\'. | '\'\'' | ~('\'' | '\\'))* '\'';
fragment BQUOTA_STRING: '`' ( '\\'. | '``' | ~('`'|'\\'))* '`';
fragment DEC_DIGIT: [0-9];
fragment BIT_STRING_L: 'B' '\'' [01]+ '\'';
// Last tokens must generate Errors
ERROR_RECONGNIGION: . -> channel(ERRORCHANNEL);
|
arch/ARM/Nordic/drivers/nrf52/nrf-adc.adb | rocher/Ada_Drivers_Library | 192 | 9559 | ------------------------------------------------------------------------------
-- --
-- Copyright © AdaCore and other contributors, 2017-2020 --
-- See https://github.com/AdaCore/Ada_Drivers_Library/graphs/contributors --
-- for more information --
-- --
-- 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_SVD.SAADC; use NRF_SVD.SAADC;
with nRF.Tasks; use nRF.Tasks;
with System.Storage_Elements;
package body nRF.ADC is
procedure Set_Resolution (Res : Bits_Resolution);
procedure Set_Reference (Ref : Reference_Selection);
procedure Wait_For_Result;
--------------------
-- Set_Resolution --
--------------------
procedure Set_Resolution (Res : Bits_Resolution) is
begin
SAADC_Periph.RESOLUTION.VAL :=
(case Res is
when Res_8bit => Val_8BIT,
when Res_10bit => Val_10BIT,
when Res_12bit => Val_12BIT);
end Set_Resolution;
-------------------
-- Set_Reference --
-------------------
procedure Set_Reference (Ref : Reference_Selection) is
begin
case Ref is
when Internal_0V6 =>
SAADC_Periph.CH (0).CONFIG.REFSEL := Internal;
when VDD_One_Forth =>
SAADC_Periph.CH (0).CONFIG.REFSEL := Vdd1_4;
end case;
end Set_Reference;
--------------------------
-- Start_Pin_Conversion --
--------------------------
function Do_Pin_Conversion
(Pin : Analog_Pin;
Input : Pin_Input_Selection;
Ref : Reference_Selection;
Res : Bits_Resolution) return UInt16
is
Result : UInt16 with Volatile;
begin
Set_Resolution (Res);
Set_Reference (Ref);
SAADC_Periph.RESULT.PTR := UInt32 (System.Storage_Elements.To_Integer (Result'Address));
SAADC_Periph.RESULT.MAXCNT.MAXCNT := 1;
case Input is
when Pin_Quadruple =>
SAADC_Periph.CH (0).CONFIG.GAIN := Gain4;
when Pin_Double =>
SAADC_Periph.CH (0).CONFIG.GAIN := Gain2;
when Pin_Full =>
SAADC_Periph.CH (0).CONFIG.GAIN := Gain1;
when Pin_Half =>
SAADC_Periph.CH (0).CONFIG.GAIN := Gain1_2;
when Pin_One_Third =>
SAADC_Periph.CH (0).CONFIG.GAIN := Gain1_3;
when Pin_One_Forth =>
SAADC_Periph.CH (0).CONFIG.GAIN := Gain1_4;
when Pin_One_Fifth =>
SAADC_Periph.CH (0).CONFIG.GAIN := Gain1_5;
when Pin_One_Sixth =>
SAADC_Periph.CH (0).CONFIG.GAIN := Gain1_6;
end case;
case Pin is
when 0 =>
SAADC_Periph.CH (0).PSELP.PSELP := Analoginput0;
when 1 =>
SAADC_Periph.CH (0).PSELP.PSELP := Analoginput1;
when 2 =>
SAADC_Periph.CH (0).PSELP.PSELP := Analoginput2;
when 3 =>
SAADC_Periph.CH (0).PSELP.PSELP := Analoginput3;
when 4 =>
SAADC_Periph.CH (0).PSELP.PSELP := Analoginput4;
when 5 =>
SAADC_Periph.CH (0).PSELP.PSELP := Analoginput5;
when 6 =>
SAADC_Periph.CH (0).PSELP.PSELP := Analoginput6;
when 7 =>
SAADC_Periph.CH (0).PSELP.PSELP := Analoginput7;
end case;
SAADC_Periph.ENABLE.ENABLE := Enabled;
Trigger (ADC_START);
Wait_For_Result;
return Result;
end Do_Pin_Conversion;
--------------------------
-- Start_VDD_Conversion --
--------------------------
function Do_VDD_Conversion
(Input : VDD_Input_Selection;
Ref : Reference_Selection;
Res : Bits_Resolution) return UInt16
is
Result : UInt16 with Volatile;
begin
Set_Resolution (Res);
Set_Reference (Ref);
SAADC_Periph.CH (0).PSELP.PSELP := Vdd;
SAADC_Periph.RESULT.PTR := UInt32 (System.Storage_Elements.To_Integer (Result'Address));
SAADC_Periph.RESULT.MAXCNT.MAXCNT := 1;
case Input is
when VDD_One_Fifth =>
SAADC_Periph.CH (0).CONFIG.GAIN := Gain1_5;
when VDD_One_Sixth =>
SAADC_Periph.CH (0).CONFIG.GAIN := Gain1_6;
end case;
SAADC_Periph.ENABLE.ENABLE := Enabled;
Trigger (ADC_START);
Wait_For_Result;
return Result;
end Do_VDD_Conversion;
----------
-- Busy --
----------
function Busy return Boolean
is (SAADC_Periph.STATUS.STATUS = Busy);
---------------------
-- Wait_For_Result --
---------------------
procedure Wait_For_Result is
begin
while Busy loop
null;
end loop;
SAADC_Periph.ENABLE.ENABLE := Enabled;
end Wait_For_Result;
end nRF.ADC;
|
programs/oeis/034/A034850.asm | neoneye/loda | 22 | 11808 | ; A034850: Triangular array formed by taking every other term of Pascal's triangle.
; 1,1,2,1,3,1,6,1,5,10,1,6,20,6,1,21,35,7,1,28,70,28,1,9,84,126,36,1,10,120,252,120,10,1,55,330,462,165,11,1,66,495,924,495,66,1,13,286,1287,1716,715,78,1,14,364,2002,3432,2002,364,14,1,105,1365,5005,6435,3003,455,15,1,120,1820,8008,12870,8008,1820,120,1,17,680,6188,19448,24310,12376,2380,136,1,18,816,8568,31824,48620,31824,8568,816,18,1,171,3876,27132,75582
mul $0,2
seq $0,7318 ; Pascal's triangle read by rows: C(n,k) = binomial(n,k) = n!/(k!*(n-k)!), 0 <= k <= n.
|
examples/userdata_example.adb | jhumphry/aLua | 0 | 2923 | -- Userdata_Example
-- A example of using the Ada values in Lua via UserData values
-- Copyright (c) 2015, <NAME> - see LICENSE for terms
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Long_Float_Text_IO; use Ada.Long_Float_Text_IO;
with Lua; use Lua;
with Lua.Util; use Lua.Util;
with Example_Userdata;
use Example_Userdata;
procedure Userdata_Example is
L : Lua_State;
Result : Boolean;
Counter : Integer;
Discard :Thread_Status;
Parent_Object : aliased Parent := (Flag => True);
Child_Object : aliased Child := (Counter => 3, Flag => False);
begin
Put_Line("Using Ada values as userdata in Lua");
Put("Lua version: ");
Put(Item => L.Version, Aft => 0, Exp => 0);
New_Line;New_Line;
Put_Line("There are three Ada types, Grandparent(abstract)->Parent->Child");
Put_Line("Grandparent and descendants have a flag that can be toggled");
Put_Line("Child has a counter that can be incremented");
Put_Line("There are only two userdata types in Lua, Grandparent and Child.");
New_Line;
-- Register the "toggle" and "increment" operations in the metatables.
Register_Operations(L);
Put_Line("Pushing an 'Parent' value (Flag => True) to the stack as a Grandparent'Class userdata.");
Grandparent_Userdata.Push_Class(L, Parent_Object'Unchecked_Access);
Put_Line("Saving a copy of the userdata in global variable 'parent_foo'");
L.PushValue(-1);
L.SetGlobal("parent_foo");
Print_Stack(L);
Put_Line("Retrieving the value of 'Flag' from the value at the top of the stack.");
Result := Grandparent_Userdata.ToUserdata(L, -1).Flag;
Put_Line((if Result then "parent_foo.Flag is now true"
else "parent_foo.Flag is now false"));
New_Line;
Put_Line("Pushing an 'Child' value (Counter => 3, Flag => False) to the stack as a Child userdata.");
Child_Userdata.Push(L, Child_Object'Unchecked_Access);
Print_Stack(L);
Put_Line("Saving the userdata at the top of the stack in global variable 'child_bar'");
L.SetGlobal("child_bar");
New_Line;
Put_Line("Clearing the stack");
L.SetTop(0);
New_Line;
Put_Line("Calling 'parent_foo:toggle()' in Lua");
Discard := L.LoadString_By_Copy("parent_foo:toggle()");
L.Call(nargs => 0, nresults => 0);
New_Line;
Put_Line("Calling 'child_bar:toggle()' in Lua");
Discard := L.LoadString_By_Copy("child_bar:toggle()");
L.Call(nargs => 0, nresults => 0);
New_Line;
Put_Line("Calling 'child_bar:increment()' in Lua");
Discard := L.LoadString_By_Copy("child_bar:increment()");
L.Call(nargs => 0, nresults => 0);
New_Line;
New_Line;
Put_Line("Retrieving the value of 'Flag' from parent_foo and child_bar, " &
"treating them as Grandparent values.");
L.GetGlobal("parent_foo");
Result := Grandparent_Userdata.ToUserdata(L, -1).Flag;
Put_Line((if Result then "parent_foo.Flag is now true"
else "parent_foo.Flag is now false"));
L.SetTop(0);
L.GetGlobal("child_bar");
Result := Grandparent_Userdata.ToUserdata(L, -1).Flag;
Put_Line((if Result then "child_bar.Flag is now true"
else "child_bar.Flag is now false"));
Put_Line("Retrieving the value of 'Counter' from child_bar, " &
"treating it as a Child value.");
Counter := Child_Userdata.ToUserdata(L, -1).Counter;
Put_Line("child_bar.Counter = " & Integer'Image(Counter));
New_Line;
end Userdata_Example;
|
Assembly/OS/INPUT.asm | p-rivero/CESC16 | 2 | 246339 | <filename>Assembly/OS/INPUT.asm
; ========================
; Keyboard Input library
; ========================
#bank program
INPUT:
; Constants:
.ACK = 0x06
.RDY = 0x07
.BACKSPACE = 0x08
.TAB = 0x09
.ENTER = 0x0A
.PAGEUP = 0x0B
.PAGEDOWN = 0x0C
.HOME = 0x0D
.INSERT = 0x0E
; F1-F12 mapped to 0x0F-0x1A
.ESC = 0x1B
.LEFT = 0x1C
.RIGHT = 0x1D
.DOWN = 0x1E
.UP = 0x1F
.DEL = 0x7F
; Attach an interrupt handler (jump address) to a keypress
; WARNING: Those syscalls make use of the stack, and so they should be called in the correct order
; as if they were push/pop instructions.
.AttachInterrupt:
swap a0, [HANDLERS.KEYPRESS] ; Attach new interrupt and retrieve old one
swap a0, [sp] ; Simultaneously pop return address and push old interrupt handler
jmp a0 ; Jump to return address
.DetachInterrupt:
pop a0 ; Pop return address
pop a1 ; Pop old interrupt handler
mov [HANDLERS.KEYPRESS], a1 ; Attach old interrupt handler
jmp a0 ; Jump to return address
; INTERRUPT HANDLER: it gets called when a key is pressed
.Key_Handler:
cmp a0, INPUT.ESC
je ..keyboard_int ; Keyboard interrupt
movf t0, [HANDLERS.KEYPRESS] ; Load the address of the user interrupt handler
jnz t0 ; If it's not zero, jump to the user handler
ret ; If it's zero, don't do anything
..keyboard_int:
mov [TMR_ACTIVE], zero ; Disable timer
jmp STARTUP.Reset ; Reset computer (placeholder)
|
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca.log_21829_895.asm | ljhsiun2/medusa | 9 | 27665 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r15
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x1b4b9, %r15
nop
add %rdi, %rdi
movw $0x6162, (%r15)
nop
nop
nop
nop
cmp %r8, %r8
lea addresses_A_ht+0xd789, %r8
nop
nop
nop
add $3523, %rsi
mov (%r8), %r10
sub %r15, %r15
lea addresses_normal_ht+0x18b89, %rsi
lea addresses_D_ht+0x165cd, %rdi
nop
xor %rax, %rax
mov $3, %rcx
rep movsw
and $39144, %rax
lea addresses_WT_ht+0x46dd, %rcx
sub $37636, %rsi
mov $0x6162636465666768, %rdi
movq %rdi, %xmm5
movups %xmm5, (%rcx)
nop
add %r15, %r15
lea addresses_WT_ht+0x8d89, %rsi
lea addresses_normal_ht+0x7149, %rdi
nop
nop
sub %r10, %r10
mov $27, %rcx
rep movsb
nop
sub $31590, %r15
lea addresses_UC_ht+0x15389, %r8
sub $45051, %rdi
mov (%r8), %cx
nop
and %rdi, %rdi
lea addresses_WT_ht+0x7119, %r10
nop
cmp %r13, %r13
movb (%r10), %al
nop
nop
and $60888, %rdi
lea addresses_A_ht+0xb2bd, %rsi
lea addresses_WT_ht+0x17d89, %rdi
clflush (%rsi)
add $10438, %r10
mov $119, %rcx
rep movsb
nop
nop
nop
nop
add %rsi, %rsi
lea addresses_WC_ht+0x16b89, %r13
nop
nop
nop
nop
nop
add $27496, %r10
movw $0x6162, (%r13)
cmp %rax, %rax
lea addresses_UC_ht+0x1e3e9, %rsi
nop
nop
nop
nop
nop
add $57031, %rdi
mov $0x6162636465666768, %rcx
movq %rcx, %xmm4
vmovups %ymm4, (%rsi)
nop
xor $27162, %rax
lea addresses_normal_ht+0x8a89, %rsi
lea addresses_normal_ht+0x11049, %rdi
nop
nop
nop
nop
nop
and %rax, %rax
mov $68, %rcx
rep movsq
nop
nop
nop
nop
xor %r8, %r8
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r15
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r15
push %r8
push %r9
push %rdi
push %rdx
push %rsi
// Store
lea addresses_UC+0x16489, %r15
nop
nop
sub %rsi, %rsi
mov $0x5152535455565758, %rdx
movq %rdx, %xmm5
vmovups %ymm5, (%r15)
nop
nop
nop
nop
nop
dec %r8
// Store
mov $0xd09, %rdi
nop
nop
nop
sub %r12, %r12
mov $0x5152535455565758, %r9
movq %r9, %xmm3
vmovups %ymm3, (%rdi)
nop
nop
nop
nop
nop
dec %r8
// Faulty Load
mov $0x3c271f0000000789, %r15
nop
nop
nop
nop
and %r12, %r12
mov (%r15), %r9w
lea oracles, %rdi
and $0xff, %r9
shlq $12, %r9
mov (%rdi,%r9,1), %r9
pop %rsi
pop %rdx
pop %rdi
pop %r9
pop %r8
pop %r15
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_P', 'same': False, 'AVXalign': False, 'congruent': 7}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_NC', 'same': True, 'AVXalign': True, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': True, 'congruent': 3}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 10}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 6}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': True, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 6}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
home/math.asm | opiter09/ASM-Machina | 1 | 170469 | ; function to do multiplication
; all values are big endian
; INPUT
; FF96-FF98 = multiplicand
; FF99 = multiplier
; OUTPUT
; FF95-FF98 = product
Multiply::
push hl
push bc
callfar _Multiply
pop bc
pop hl
ret
; function to do division
; all values are big endian
; INPUT
; FF95-FF98 = dividend
; FF99 = divisor
; b = number of bytes in the dividend (starting from FF95)
; OUTPUT
; FF95-FF98 = quotient
; FF99 = remainder
Divide::
push hl
push de
push bc
homecall _Divide
pop bc
pop de
pop hl
ret
|
smart-rule/src/main/antlr4/org/smartdata/rule/parser/SmartRule.g4 | ZVampirEM77/SSM | 2 | 6055 | <reponame>ZVampirEM77/SSM
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
grammar SmartRule;
ssmrule
: object ':' (trigger '|')? conditions '|' cmdlet #ruleLine
| Linecomment+ #commentLine
;
// just one cmdlet
// TODO: Fix this item
object
: OBJECTTYPE #objTypeOnly
| OBJECTTYPE WITH objfilter #objTypeWith
;
trigger
: AT timepointexpr #triTimePoint
| EVERY timeintvalexpr duringexpr? #triCycle
| ON fileEvent duringexpr? #triFileEvent
;
duringexpr : FROM timepointexpr (TO timepointexpr)? ;
objfilter
: boolvalue
;
conditions
: boolvalue
;
boolvalue
: compareexpr #bvCompareexpr
| NOT boolvalue #bvNot
| boolvalue (AND | OR) boolvalue #bvAndOR
| id #bvId
| '(' boolvalue ')' #bvCurve
;
compareexpr
: numricexpr oPCMP numricexpr #cmpIdLong
| stringexpr ('==' | '!=') stringexpr #cmpIdString
| stringexpr MATCHES stringexpr #cmpIdStringMatches
| timeintvalexpr oPCMP timeintvalexpr #cmpTimeintvalTimeintval
| timepointexpr oPCMP timepointexpr #cmpTimepointTimePoint
;
timeintvalexpr
: '(' timeintvalexpr ')' #tieCurves
| TIMEINTVALCONST #tieConst
| timepointexpr '-' timepointexpr #tieTpExpr
| timeintvalexpr ('-' | '+') timeintvalexpr #tieTiExpr
| id #tieTiIdExpr
;
timepointexpr
: '(' timepointexpr ')' #tpeCurves
| NOW #tpeNow
| TIMEPOINTCONST #tpeTimeConst
| timepointexpr ('+' | '-') timeintvalexpr #tpeTimeExpr
| id #tpeTimeId
;
commonexpr
: boolvalue
| timeintvalexpr
| timepointexpr
| numricexpr
| LONG
| STRING
| id
| '(' commonexpr ')'
;
numricexpr
: numricexpr op=('*' | '/' | '%') numricexpr #numricexprMul
| numricexpr op=('+' | '-') numricexpr #numricexprAdd
| id #numricexprId
| LONG #numricexprLong
| '(' numricexpr ')' #numricexprCurve
;
stringexpr
: '(' stringexpr ')' #strCurve
| STRING #strOrdString
| TIMEPOINTCONST #strTimePointStr
| id #strID
| stringexpr '+' stringexpr #strPlus
;
cmdlet
: .*
;
id
: ID #idAtt
| OBJECTTYPE '.' ID #idObjAtt
| ID '(' constexpr (',' constexpr)* ')' #idAttPara
| OBJECTTYPE '.' ID '(' constexpr (',' constexpr)* ')' #idObjAttPara
;
oPCMP
: '=='
| '>'
| '<'
| '>='
| '<='
| '!='
;
opr
: '*'
| '/'
| '+'
| '-'
| '%'
;
fileEvent
: FILECREATE
| FILECLOSE
| FILEAPPEND
| FILERENAME
| FILEMETADATA
| FILEUNLINK
| FILETRUNCATE
;
constexpr
: LONG #constLong
| STRING #constString
| TIMEINTVALCONST #constTimeInverval
| TIMEPOINTCONST #constTimePoint
;
OBJECTTYPE
: FILE
| DIRECTORY
| STORAGE
| CACHE
;
AT : 'at' ;
AND : 'and' ;
EVERY : 'every' ;
FROM : 'from' ;
ON : 'on' ;
OR : 'or' ;
NOW : 'now' ;
NOT : 'not' ;
TO : 'to' ;
WITH : 'with' ;
MATCHES : 'matches' ;
fragment FILE : 'file' ;
fragment DIRECTORY : 'directory' ;
fragment STORAGE : 'storage' ;
fragment CACHE : 'cache' ;
FILECREATE: 'FileCreate' ;
FILECLOSE: 'FileClose' ;
FILEAPPEND: 'FileAppend' ;
FILERENAME: 'FileRename' ;
FILEMETADATA: 'FileMetadate' ;
FILEUNLINK: 'FileUnlink' ;
FILETRUNCATE: 'FileTruncate' ;
TIMEINTVALCONST
: ([1-9] [0-9]* ('ms' | 's' | 'm' | 'h' | 'd' | 'sec' | 'min' | 'hour' | 'day'))+ ;
TIMEPOINTCONST
: '"' [1-9][0-9][0-9][0-9] '-' [0-9][0-9] '-' [0-9][0-9] ' '+ [0-9][0-9] ':' [0-9][0-9] ':' [0-9][0-9] '"'
;
ID : [a-zA-Z_] [a-zA-Z0-9_]* ;
Linecomment : '#' .*? '\r'? '\n' -> skip ;
WS : [ \t\r\n]+ -> skip ;
STRING
: '"' (ESCAPE | ~["\\])* '"';
fragment ESCAPE : '\\' (["\\/bfnrt] | UNICODE) ;
fragment UNICODE : 'u' HEX HEX HEX HEX ;
fragment HEX : [0-9a-fA-F] ;
LONG
: '0'
| [1-9] [0-9]*
| ('0' | [1-9] [0-9]*) ('P' | 'p' | 'T' | 't' | 'G' | 'g' | 'M' | 'm' | 'K' | 'k') ('B' | 'b')
;
NEWLINE : '\r'? '\n' ; |
src/Typed/LTLCRef.agda | laMudri/linear.agda | 34 | 14955 | module Typed.LTLCRef where
open import Data.List.Relation.Ternary.Interleaving.Propositional
open import Relation.Unary hiding (_∈_)
open import Relation.Unary.PredicateTransformer using (Pt)
open import Function
open import Category.Monad
open import Relation.Ternary.Separation
open import Relation.Ternary.Separation.Allstar
open import Relation.Ternary.Separation.Morphisms
open import Relation.Ternary.Separation.Monad
open import Relation.Ternary.Separation.Monad.Reader
open import Prelude
data Ty : Set where
unit : Ty
ref : Ty → Ty
prod : Ty → Ty → Ty
_⊸_ : (a b : Ty) → Ty
Ctx = List Ty
CtxT = List Ty → List Ty
open import Relation.Ternary.Separation.Construct.List Ty
open import Relation.Ternary.Separation.Construct.Market
open import Relation.Ternary.Separation.Construct.Product
infixr 20 _◂_
_◂_ : Ty → CtxT → CtxT
(x ◂ f) Γ = x ∷ f Γ
variable a b c : Ty
variable ℓv : Level
variable τ : Set ℓv
variable Γ Γ₁ Γ₂ Γ₃ : List τ
data Exp : Ty → Ctx → Set where
-- base type
tt : ε[ Exp unit ]
letunit : ∀[ Exp unit ✴ Exp a ⇒ Exp a ]
-- linear λ calculus
var : ∀[ Just a ⇒ Exp a ]
lam : ∀[ (a ◂ id ⊢ Exp b) ⇒ Exp (a ⊸ b) ]
ap : ∀[ Exp (a ⊸ b) ✴ Exp a ⇒ Exp b ]
-- products
pair : ∀[ Exp a ✴ Exp b ⇒ Exp (prod a b) ]
letpair : ∀[ Exp (prod a b) ✴ (λ Γ → a ∷ b ∷ Γ) ⊢ Exp c ⇒ Exp c ]
-- state
ref : ε[ Exp a ⇒ Exp (ref a) ]
swaps : ∀[ Exp (ref a) ✴ Exp b ⇒ Exp (prod a (ref b)) ]
del : ε[ Exp (ref unit) ⇒ Exp unit ]
-- store types
ST = List Ty
-- values
data Val : Ty → Pred ST 0ℓ where
tt : ε[ Val unit ]
clos : Exp b (a ∷ Γ) → ∀[ Allstar Val Γ ⇒ Val (a ⊸ b) ]
ref : ∀[ Just a ⇒ Val (ref a) ]
pair : ∀[ Val a ✴ Val b ⇒ Val (prod a b) ]
{- The 'give-it-to-me-straight' semantics -}
Store : ST → ST → Set
Store = Allstar Val
-- {- First attempt -- evaluation without a frame, seems simple enough... -}
-- eval₁ : ∀ {Ψ Γ} → Exp a Γ → Allstar Val Γ Φ₁ → Store Ψ Φ₂ → Φ₁ ⊎ Φ₂ ≣ Ψ →
-- ∃ λ Ψ' → ∃₂ λ Φ₃ Φ₄ → Store Ψ' Φ₃ × Val a Φ₄ × Φ₃ ⊎ Φ₄ ≣ Ψ'
-- eval₁ (num x) nil μ σ = -, -, -, μ , num x , ⊎-comm σ
-- eval₁ (lam e) env μ σ = -, -, -, μ , (clos e env) , ⊎-comm σ
-- eval₁ (ap (f ×⟨ σ ⟩ e)) env μ σ₂ =
-- let
-- env₁ ×⟨ σ₃ ⟩ env₂ = repartition σ env
-- _ , τ₁ , τ₂ = ⊎-assoc (⊎-comm σ₃) σ₂
-- {- Oops, store contains more stuff than used; i.e. we have a frame -}
-- in case eval₁ f env₁ μ {!τ₂!} of λ where
-- (_ , _ , _ , μ' , clos e env₃ , σ₄) → {!!}
-- eval₁ (var x) = {!!}
-- eval₁ (ref e) = {!!}
-- eval₁ (deref e) = {!!}
-- eval₁ (asgn x) = {!!}
-- {- First attempt -- evaluation *with* a frame. Are you sure want this? -}
-- eval₂ : ∀ {Ψ Γ Φf} → Exp a Γ → Allstar Val Γ Φ₁ → Store Ψ Φ₂ → Φ₁ ⊎ Φ₂ ≣ Φ → Φ ⊎ Φf ≣ Ψ →
-- ∃₂ λ Φ' Ψ' → ∃₂ λ Φ₃ Φ₄ → Store Ψ' Φ₃ × Val a Φ₄ × Φ₃ ⊎ Φ₄ ≣ Φ' × Φ' ⊎ Φf ≣ Ψ'
-- eval₂ (num x) nil μ σ₁ σ₂ =
-- case ⊎-id⁻ˡ σ₁ of λ where refl → -, -, -, -, μ , num x , ⊎-idʳ , σ₂
-- eval₂ (lam x) env μ σ₁ σ₂ = {!!}
-- eval₂ (pair (e₁ ×⟨ σ ⟩ e₂)) env μ σ₁ σ₂ =
-- let
-- env₁ ×⟨ σ₃ ⟩ env₂ = repartition σ env
-- _ , τ₁ , τ₂ = ⊎-assoc (⊎-comm σ₃) σ₁ -- separation between sub-env and store
-- _ , τ₃ , τ₄ = ⊎-assoc (⊎-comm τ₁) σ₂ -- compute the frame
-- in case eval₂ e₁ env₁ μ τ₂ τ₃ of λ where
-- (_ , _ , _ , _ , μ' , v₁ , σ₄ , σ₅) →
-- let v = eval₂ e₂ env₂ μ' {!τ₁!} {!!} in {!!}
-- eval₂ (var x) env μ σ₁ σ₂ = {!!}
-- eval₂ (ref e) env μ σ₁ σ₂ = {!!}
-- eval₂ (deref e) env μ σ₁ σ₂ = {!!}
-- eval₂ (asgn x) env μ σ₁ σ₂ = {!!}
-- eval₂ (ap (f ×⟨ σ ⟩ e)) env μ σ₁ σ₂ = {!!}
{- The monadic semantics -}
module _ {i : Size} where
open import Relation.Ternary.Separation.Monad.Delay public
open import Relation.Ternary.Separation.Monad.State
open import Relation.Ternary.Separation.Monad.State.Heap Val
open HeapOps (Delay i) {{ monad = delay-monad }}
using (state-monad; newref; read; write; Cells)
public
open ReaderTransformer id-morph Val (StateT (Delay i) Cells)
{{ monad = state-monad }}
renaming (Reader to M'; reader-monad to monad)
public
open Monads.Monad monad public
open Monads using (_&_; str; typed-str) public
M : Size → (Γ₁ Γ₂ : Ctx) → Pt ST 0ℓ
M i = M' {i}
mutual
eval⊸ : ∀ {i Γ} → Exp (a ⊸ b) Γ → ∀[ Val a ⇒ M i Γ ε (Val b) ]
eval⊸ e v = do
clos e env ×⟨ σ₂ ⟩ v ← ►eval e & v
empty ← append (cons (v ×⟨ ⊎-comm σ₂ ⟩ env))
►eval e
eval : ∀ {i Γ} → Exp a Γ → ε[ M i Γ ε (Val a) ]
eval tt = do
return tt
eval (letunit (e₁ ×⟨ Γ≺ ⟩ e₂)) = do
tt ← frame Γ≺ (►eval e₁)
►eval e₂
eval (var refl) = do
lookup
eval (lam e) = do
env ← ask
return (clos e env)
eval (pair (e₁ ×⟨ Γ≺ ⟩ e₂)) = do
v₁ ← frame Γ≺ (►eval e₁)
v₂✴v₁ ← ►eval e₂ & v₁
return (pair (✴-swap v₂✴v₁))
eval (letpair (e₁ ×⟨ Γ≺ ⟩ e₂)) = do
pair (v₁ ×⟨ σ ⟩ v₂) ← frame Γ≺ (►eval e₁)
empty ← prepend (cons (v₁ ×⟨ σ ⟩ (singleton v₂)))
►eval e₂
eval (ap (f ×⟨ Γ≺ ⟩ e)) = do
v ← frame (⊎-comm Γ≺) (►eval e)
eval⊸ f v
eval (ref e) = do
v ← ►eval e
r ← liftM (newref v)
return (ref r)
eval (swaps (e₁ ×⟨ Γ≺ ⟩ e₂)) = do
ref ra ← frame Γ≺ (►eval e₁)
vb ×⟨ σ₁ ⟩ ra ← ►eval e₂ & ra
rb ×⟨ σ₂ ⟩ va ← liftM (write (ra ×⟨ ⊎-comm σ₁ ⟩ vb))
return (pair (va ×⟨ (⊎-comm σ₂) ⟩ (ref rb)))
eval (del e) = do
ref r ← ►eval e
liftM (read r)
►eval : ∀ {i Γ} → Exp a Γ → ε[ M i Γ ε (Val a) ]
app (app (►eval e) env σ) μ σ' = later (λ where .force → app (app (eval e) env σ) μ σ')
|
third_party/codecs/xvidcore/src/bitstream/x86_asm/cbp_mmx.asm | Narflex/sagetv | 292 | 610 | ;/****************************************************************************
; *
; * XVID MPEG-4 VIDEO CODEC
; * - MMX CBP computation -
; *
; * Copyright (C) 2005 <NAME> <<EMAIL>>
; * 2001-2003 <NAME> <<EMAIL>>
; * 2002-2003 <NAME> <<EMAIL>>
; *
; * This program 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 2 of the License, or
; * (at your option) any later version.
; *
; * This program is distributed in the hope that it will be useful,
; * but WITHOUT ANY WARRANTY ; without even the implied warranty of
; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; * GNU General Public License for more details.
; *
; * You should have received a copy of the GNU General Public License
; * along with this program ; if not, write to the Free Software
; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
; *
; * $Id: cbp_mmx.asm,v 1.19 2009-09-16 17:07:58 Isibaar Exp $
; *
; ***************************************************************************/
;=============================================================================
; Macros
;=============================================================================
%include "nasm.inc"
;=============================================================================
; Local data
;=============================================================================
DATA
ALIGN SECTION_ALIGN
mult_mask:
db 0x10,0x20,0x04,0x08,0x01,0x02,0x00,0x00
ignore_dc:
dw 0, -1, -1, -1
;=============================================================================
; Code
;=============================================================================
TEXT
cglobal calc_cbp_mmx
;-----------------------------------------------------------------------------
; uint32_t calc_cbp_mmx(const int16_t coeff[6][64]);
;-----------------------------------------------------------------------------
%macro MAKE_LOAD 2
por mm0, [%2-128*1+%1*8]
por mm1, [%2+128*0+%1*8]
por mm2, [%2+128*1+%1*8]
por mm3, [%2+128*2+%1*8]
por mm4, [%2+128*3+%1*8]
por mm5, [%2+128*4+%1*8]
%endmacro
ALIGN SECTION_ALIGN
calc_cbp_mmx:
mov _EAX, prm1 ; coeff
movq mm7, [ignore_dc]
pxor mm6, mm6 ; used only for comparing
movq mm0, [_EAX+128*0]
movq mm1, [_EAX+128*1]
movq mm2, [_EAX+128*2]
movq mm3, [_EAX+128*3]
movq mm4, [_EAX+128*4]
movq mm5, [_EAX+128*5]
add _EAX, 8+128
pand mm0, mm7
pand mm1, mm7
pand mm2, mm7
pand mm3, mm7
pand mm4, mm7
pand mm5, mm7
MAKE_LOAD 0, _EAX
MAKE_LOAD 1, _EAX
MAKE_LOAD 2, _EAX
MAKE_LOAD 3, _EAX
MAKE_LOAD 4, _EAX
MAKE_LOAD 5, _EAX
MAKE_LOAD 6, _EAX
MAKE_LOAD 7, _EAX
MAKE_LOAD 8, _EAX
MAKE_LOAD 9, _EAX
MAKE_LOAD 10, _EAX
MAKE_LOAD 11, _EAX
MAKE_LOAD 12, _EAX
MAKE_LOAD 13, _EAX
MAKE_LOAD 14, _EAX
movq mm7, [mult_mask]
packssdw mm0, mm1
packssdw mm2, mm3
packssdw mm4, mm5
packssdw mm0, mm2
packssdw mm4, mm6
pcmpeqw mm0, mm6
pcmpeqw mm4, mm6
pcmpeqw mm0, mm6
pcmpeqw mm4, mm6
psrlw mm0, 15
psrlw mm4, 15
packuswb mm0, mm4
pmaddwd mm0, mm7
movq mm1, mm0
psrlq mm1, 32
paddusb mm0, mm1
movd eax, mm0
shr _EAX, 8
and _EAX, 0x3F
ret
ENDFUNC
NON_EXEC_STACK
|
src/main/antlr4/org/verdictdb/parser/VerdictSQLLexer.g4 | zhengant/verdictdb | 0 | 4576 |
lexer grammar VerdictSQLLexer;
// Verdict Keywords
SIZE: S I Z E;
COLUMNS: C O L U M N S;
SHOW: S H O W;
UNIFORM: U N I F O R M;
FASTCONVERGE: F A S T C O N V E R G E;
SCRAMBLE: S C R A M B L E;
SCRAMBLES: S C R A M B L E S;
GET: G E T;
// Basic keywords (from https://msdn.microsoft.com/en-us/library/ms189822.aspx)
ADD: A D D;
ALL: A L L;
ALTER: A L T E R;
AND: A N D;
ANY: A N Y;
AS: A S;
ASC: A S C;
ASCII: A S C I I;
AUTHORIZATION: A U T H O R I Z A T I O N;
BACKUP: B A C K U P;
BEGIN: B E G I N;
BETWEEN: B E T W E E N;
BLOCKSIZE: B L O C K S I Z E;
BREAK: B R E A K;
BROWSE: B R O W S E;
BULK: B U L K;
BY: B Y;
CASCADE: C A S C A D E;
CASE: C A S E;
CHANGETABLE: C H A N G E T A B L E;
CHANGES: C H A N G E S;
CHECK: C H E C K;
CHECKPOINT: C H E C K P O I N T;
CLOSE: C L O S E;
CLUSTERED: C L U S T E R E D;
COALESCE: C O A L E S C E;
COLLATE: C O L L A T E;
COLUMN: C O L U M N;
COMMIT: C O M M I T;
COMPUTE: C O M P U T E;
CONSTRAINT: C O N S T R A I N T;
CONTAINS: C O N T A I N S;
CONTAINSTABLE: C O N T A I N S T A B L E;
CONTINUE: C O N T I N U E;
CONV: C O N V;
CONVERT: C O N V E R T;
CREATE: C R E A T E;
CROSS: C R O S S;
CURRENT: C U R R E N T;
CURRENT_DATE: C U R R E N T '_' D A T E;
CURRENT_TIME: C U R R E N T '_' T I M E;
CURRENT_TIMESTAMP: C U R R E N T '_' T I M E S T A M P;
CURRENT_USER: C U R R E N T '_' U S E R;
CURSOR: C U R S O R;
DATABASE: D A T A B A S E;
DATABASES: D A T A B A S E S;
DBCC: D B C C;
DEALLOCATE: D E A L L O C A T E;
DECLARE: D E C L A R E;
DELETE: D E L E T E;
DENY: D E N Y;
DESC: D E S C;
DESCRIBE: D E S C R I B E;
DISK: D I S K;
DISTINCT: D I S T I N C T;
DISTRIBUTED: D I S T R I B U T E D;
DOUBLE: D O U B L E;
DROP: D R O P;
DUMP: D U M P;
ELSE: E L S E;
END: E N D;
ERRLVL: E R R L V L;
ESCAPE: E S C A P E;
EXCEPT: E X C E P T;
EXEC: E X E C;
EXECUTE: E X E C U T E;
EXISTS: E X I S T S;
EXIT: E X I T;
EXTERNAL: E X T E R N A L;
FALSE: F A L S E;
FETCH: F E T C H;
FILE: F I L E;
FILLFACTOR: F I L L F A C T O R;
FOR: F O R;
FORCESEEK: F O R C E S E E K;
FOREIGN: F O R E I G N;
FREETEXT: F R E E T E X T;
FREETEXTTABLE: F R E E T E X T T A B L E;
FROM: F R O M;
FULL: F U L L;
FUNCTION: F U N C T I O N;
GOTO: G O T O;
GRANT: G R A N T;
GROUP: G R O U P;
HASH: H A S H;
HAVING: H A V I N G;
IDENTITY: I D E N T I T Y;
IDENTITYCOL: I D E N T I T Y C O L;
IDENTITY_INSERT: I D E N T I T Y '_' I N S E R T;
IF: I F;
IN: I N;
INDEX: I N D E X;
INNER: I N N E R;
INSERT: I N S E R T;
INT4LARGER: I N T '4' L A R G E R;
INTERSECT: I N T E R S E C T;
INTO: I N T O;
IS: I S;
JOIN: J O I N;
KEY: K E Y;
KILL: K I L L;
LEFT: L E F T;
LIKE: L I K E;
LIMIT: L I M I T;
LINENO: L I N E N O;
LOAD: L O A D;
MERGE: M E R G E;
MID: M I D;
NATIONAL: N A T I O N A L;
NOCHECK: N O C H E C K;
NONCLUSTERED: N O N C L U S T E R E D;
NOT: N O T;
NULL: N U L L;
NULLIF: N U L L I F;
NULLS: N U L L S;
OF: O F;
OFF: O F F;
OFFSETS: O F F S E T S;
ON: O N;
OPEN: O P E N;
OPENDATASOURCE: O P E N D A T A S O U R C E;
OPENQUERY: O P E N Q U E R Y;
OPENROWSET: O P E N R O W S E T;
OPENXML: O P E N X M L;
OPTION: O P T I O N;
OR: O R;
ORDER: O R D E R;
OUTER: O U T E R;
OVER: O V E R;
PERCENT: P E R C E N T;
PIVOT: P I V O T;
PLAN: P L A N;
PRECISION: P R E C I S I O N;
PRIMARY: P R I M A R Y;
PRINT: P R I N T;
PROC: P R O C;
PROCEDURE: P R O C E D U R E;
RAISERROR: R A I S E R R O R;
RAWTOHEX: R A W T O H E X;
READ: R E A D;
READTEXT: R E A D T E X T;
RECONFIGURE: R E C O N F I G U R E;
REFERENCES: R E F E R E N C E S;
REPLICATION: R E P L I C A T I O N;
RESTORE: R E S T O R E;
RESTRICT: R E S T R I C T;
RETURN: R E T U R N;
REVERT: R E V E R T;
REVOKE: R E V O K E;
RIGHT: R I G H T;
RLIKE: R L I K E;
ROLLBACK: R O L L B A C K;
ROWCOUNT: R O W C O U N T;
ROWGUIDCOL: R O W G U I D C O L;
RPAD: R P A D;
RULE: R U L E;
SAVE: S A V E;
SCHEMA: S C H E M A;
SCHEMAS: S C H E M A S;
SECURITYAUDIT: S E C U R I T Y A U D I T;
SELECT: S E L E C T;
SEMANTICKEYPHRASETABLE: S E M A N T I C K E Y P H R A S E T A B L E;
SEMANTICSIMILARITYDETAILSTABLE: S E M A N T I C S I M I L A R I T Y D E T A I L S T A B L E;
SEMANTICSIMILARITYTABLE: S E M A N T I C S I M I L A R I T Y T A B L E;
SEMI: S E M I;
SESSION_USER: S E S S I O N '_' U S E R;
SET: S E T;
SETUSER: S E T U S E R;
SHUTDOWN: S H U T D O W N;
SOME: S O M E;
SUBSTR: S U B S T R;
SUBSTRING: S U B S T R I N G;
STATISTICS: S T A T I S T I C S;
SYSTEM_USER: S Y S T E M '_' U S E R;
TABLE: T A B L E;
TABLES: T A B L E S;
TABLESAMPLE: T A B L E S A M P L E;
TEXTSIZE: T E X T S I Z E;
THEN: T H E N;
TO: T O;
TOP: T O P;
TRAN: T R A N;
TRANSACTION: T R A N S A C T I O N;
TRIGGER: T R I G G E R;
TRUE: T R U E;
TRUNCATE: T R U N C A T E;
TRY_CONVERT: T R Y '_' C O N V E R T;
TSEQUAL: T S E Q U A L;
UNION: U N I O N;
UNIQUE: U N I Q U E;
UNPIVOT: U N P I V O T;
UPDATE: U P D A T E;
UPDATETEXT: U P D A T E T E X T;
USE: U S E;
USER: U S E R;
VALUES: V A L U E S;
VARYING: V A R Y I N G;
VIEW: V I E W;
WAITFOR: W A I T F O R;
WHEN: W H E N;
WHERE: W H E R E;
WHILE: W H I L E;
WITH: W I T H;
WITHIN: W I T H I N;
WITHOUT: W I T H O U T;
WRITETEXT: W R I T E T E X T;
ZONE: Z O N E;
// Additional keywords (they can be id).
ABBREV: A B B R E V;
ABSOLUTE: A B S O L U T E;
ABS: A B S;
ACOS: A C O S;
ADDDATE: A D D D A T E;
ADDTIME: A D D T I M E;
AES_DECRYPT: A E S '_' D E C R Y P T;
AES_ENCRYPT: A E S '_' E N C R Y P T;
AGE: A G E;
APPLY: A P P L Y;
AREA: A R E A;
ARRAY_AGG: A R R A Y '_' A G G;
ARRAY_APPEND: A R R A Y '_' A P P E N D;
ARRAY_CAT: A R R A Y '_' C A T;
ARRAY_DIMS: A R R A Y '_' D I M S;
ARRAY_LENGTH: A R R A Y '_' L E N G T H S;
ARRAY_LOWER: A R R A Y '_' L O W E R;
ARRAY_NDIMS: A R R A Y '_' N D I M S;
ARRAY_POSITION: A R R A Y '_' P O S I T I O N;
ARRAY_POSITIONS: A R R A Y '_' P O S I T I O N S;
ARRAY_PREPEND: A R R A Y '_' P R E P E N D;
ARRAY_REMOVE: A R R A Y '_' R E M O V E;
ARRAY_REPLACE: A R R A Y '_' R E P L A C E;
ARRAY_TO_JSON: A R R A Y '_' T O '_' J S O N;
ARRAY_TO_STRING: A R R A Y '_' T O '_' S T R I N G;
ARRAY_TO_TSVECTOR: A R R A Y '_' T O '_' T S V E C T O R;
ARRAY_UPPER: A R R A Y '_' U P P E R;
ASIN: A S I N;
ATAN: A T A N;
ATAN2: A T A N '2';
AUTO: A U T O;
AVG: A V G;
BASE64: B A S E '64';
BIGINT: B I G I N T;
BIN: B I N;
BINARY_CHECKSUM: B I N A R Y '_' C H E C K S U M;
BIT: B I T;
BIT_LENGTH: B I T '_' L E N G T H;
BOOL_AND: B O O L '_' A N D;
BOOL_OR: B O O L '_' O R;
BOX: B O X;
BOUND_BOX: B O U N D '_' B O X;
BROADCAST: B R O A D C A S T;
BTRIM: B T R I M;
BROUND: B R O U N D;
CALLER: C A L L E R;
CARDINALITY: C A R D I N A L I T Y;
CAST: C A S T;
CATCH: C A T C H;
CBRT: C B R T;
CEIL: C E I L;
CEILING: C E I L I N G;
CENTER: C E N T E R;
CHAR: C H A R;
CHAR_LENGTH: C H A R '_' L E N G T H;
CHARACTER_LENGTH: C H A R A C T E R '_' L E N G T H;
CHECKSUM: C H E C K S U M;
CHECKSUM_AGG: C H E C K S U M '_' A G G;
CHR: C H R;
CIRCLE: C I R C L E;
CLOCK_TIMESTAMP: C L O C K '_' T I M E S T A M P;
COMMITTED: C O M M I T T E D;
CONCAT: C O N C A T;
CONCAT_WS: C O N C A T '_' W S;
CONFIG: C O N F I G;
CONVERT_FROM: C O N V E R T '_' F R O M;
CONVERT_TO: C O N V E R T '_' T O;
COOKIE: C O O K I E;
COS: C O S;
CORR: C O R R;
COVAR_POP: C O V A R '_' P O P;
COVAR_SAMP: C O V A R '_' S A M P;
COT: C O T;
COUNT: C O U N T;
COUNT_BIG: C O U N T '_' B I G;
CRC32: C R C '32';
CURDATE: C U R D A T E;
CURRVAL: C U R R V A L;
CURTIME: C U R T I M E;
DATE: D A T E;
DATEADD: D A T E A D D;
DATE_ADD: D A T E '_' A D D;
DATE_FORMAT: D A T E '_' F O R M A T;
DATE_PART: D A T E '_' P A R T;
DATE_SUB: D A T E '_' S U B;
DATE_TRUNC: D A T E '_' T R U N C;
DATEDIFF: D A T E D I F F;
DATENAME: D A T E N A M E;
DATEPART: D A T E P A R T;
DATETIME: D A T E T I M E;
DATETIME2: D A T E T I M E '2';
DATETIMEOFFSET: D A T E T I M E O F F S E T;
DAY: D A Y;
DAYNAME: D A Y N A M E;
DAYOFMONTH: D A Y O F M O N T H;
DAYOFWEEK: D A Y O F W E E K;
DAYOFYEAR: D A Y O F Y E A R;
DAYS: D A Y S;
DECODE: D E C O D E;
DEGREES: D E G R E E S;
DELAY: D E L A Y;
DELETED: D E L E T E D;
DENSE_RANK: D E N S E '_' R A N K;
DIAMETER: D I A M E T E R;
DISABLE: D I S A B L E;
DIV: D I V;
DYNAMIC: D Y N A M I C;
NATURAL_CONSTANT: E;
ENCODE: E N C O D E;
ENCRYPTION: E N C R Y P T I O N;
ENUM_FIRST: E N U M '_' F I R S T;
ENUM_LAST: E N U M '_' L A S T;
ENUM_RANGE: E N U M '_' R A N G E;
ESCAPED_BY: E S C A P E D ' ' B Y;
EXACT: E X A C T;
EXP: E X P;
EXPLODE: E X P L O D E;
EXTRACT: E X T R A C T;
EVERY: E V E R Y;
FACTORIAL: F A C T O R I A L;
FAMILY: F A M I L Y;
FAST: F A S T;
FAST_FORWARD: F A S T '_' F O R W A R D;
FIELD: F I E L D;
FIELDS_SEPARATED_BY: F I E L D S ' ' S E P A R A T E D ' ' B Y;
FIND_IN_SET: F I N D '_' I N '_' S E T;
FIRST: F I R S T;
FLOOR: F L O O R;
FOLLOWING: F O L L O W I N G;
FORMAT: F O R M A T;
FORMAT_NUMBER: F O R M A T '_' N U M B E R;
FORWARD_ONLY: F O R W A R D '_' O N L Y;
FNV_HASH: F N V '_' H A S H;
FROM_DAYS: F R O M '_' D A Y S;
FROM_UNIXTIME: F R O M '_' U N I X T I M E;
FULLSCAN: F U L L S C A N;
GEOGRAPHY: G E O G R A P H Y;
GEOMETRY: G E O M E T R Y;
GET_BIT: G E T '_' B I T;
GET_BYTE: G E T '_' B Y T E;
GET_CURRENT_TS_CONFIG: G E T '_' C U R R E N T '_' T S '_' C O N F I G;
GET_JSON_OBJECT: G E T '_' J S O N '_' O B J E C T;
GLOBAL: G L O B A L;
GO: G O;
GREATEST: G R E A T E S T;
GROUPING: G R O U P I N G;
GROUPING_ID: G R O U P I N G '_' I D;
HEIGHT: H E I G H T;
HEX: H E X;
HIERARCHYID: H I E R A R C H Y I D;
HOST: H O S T;
HOSTMASK: H O S T M A S K;
HOUR: H O U R;
IFNULL: I F N U L L;
IMAGE: I M A G E;
INT: I N T;
INITCAP: I N I T C A P;
INSENSITIVE: I N S E N S I T I V E;
INSERTED: I N S E R T E D;
INSTR: I N S T R;
INTERVAL: I N T E R V A L;
IN_FILE: I N '_' F I L E;
INET_SAME_FAMILY: I N E T '_' S A M E '_' F A M I L Y;
INET_MERGE: I N E T '_' M E R G E;
ISCLOSED: I S C L O S E D;
ISEMPTY: I S E M P T Y;
ISFINITE: I S F I N I T E;
ISNULL: I S N U L L;
ISOLATION: I S O L A T I O N;
ISOPEN: I S O P E N;
JSON_AGG: J S O N '_' A G G;
JSON_ARRAY_LENGTH: J S O N '_' A R R A Y '_' L E N G T H;
JSON_ARRAY_ELEMENTS: J S O N '_' A R R A Y '_' E L E M E N T S;
JSON_ARRAY_ELEMENTS_TEXT: J S O N '_' A R R A Y '_' E L E M E N T S '_' T E X T;
JSON_BUILD_ARRAY: J S O N '_' B U I L D '_' A R R A Y;
JSON_BUILD_OBJECT: J S O N '_' B U I L D '_' O B J E C T;
JSON_EACH: J S O N '_' E A C H;
JSON_EACH_TEXT: J S O N '_' E A C H '_' T E X T;
JSON_EXTRACT_PATH: J S O N '_' E X T R A C T '_' P A T H;
JSON_EXTRACT_PATH_TEXT: J S O N '_' E X T R A C T '_' P A T H '_' T E X T;
JSON_OBJECT: J S O N '_' O B J E C T;
JSON_OBJECT_KEYS: J S O N '_' O B J E C T '_' K E Y S;
JSON_OBJECT_AGG: J S O N '_' O B J E C T '_' A G G;
JSON_POPULATE_RECORD: J S O N '_' P O P U L A T E '_' R E C O R D;
JSON_POPULATE_RECORDSET: J S O N '_' P O P U L A T E '_' R E C O R D S E T;
JSON_STRIP_NULLS: J S O N '_' S T R I P '_' N U L L S;
JSON_TO_RECORD: J S O N '_' T O '_' R E C O R D;
JSON_TO_RECORDSET: J S O N '_' T O '_' R E C O R D S E T;
JSON_TYPEOF: J S O N '_' T Y P E O F;
JSONB_AGG: J S O N B '_' A G G;
JSONB_OBJECT_AGG: J S O N B '_' O B J E C T '_' A G G;
JSONB_SET: J S O N B '_' S E T;
JSONB_INSERT: J S O N B '_' I N S E R T;
JSONB_PRETTY: J S O N B '_' P R E T T Y;
JUSTIFY_DAYS: J U S T I F Y '_' D A Y S;
JUSTIFY_HOURS: J U S T I F Y '_' H O U R S;
JUSTIFY_INTERVALS: J U S T I F Y '_' I N T E R V A L;
KEEPFIXED: K E E P F I X E D;
KEYSET: K E Y S E T;
LAST: L A S T;
LASTVAL: L A S T V A L;
LAST_DAY: L A S T '_' D A Y;
LAST_INSERT_ID: L A S T '_' I N S E R T '_' I D;
LATERAL: L A T E R A L;
LCASE: L C A S E;
LEAST: L E A S T;
LENGTH: L E N G T H;
LEVEL: L E V E L;
LINE: L I N E;
LN: L N;
LOCAL: L O C A L;
LOCALTIME: L O C A L T I M E;
LOCALTIMESTAMP: L O C A L T I M E S T A M P;
LOCATE: L O C A T E;
LOCATION: L O C A T I O N;
LOCK_ESCALATION: L O C K '_' E S C A L A T I O N;
LOG: L O G;
LOG2: L O G '2';
LOG10: L O G '10';
LOGIN: L O G I N;
LOOP: L O O P;
LOWER: L O W E R;
LOWER_INC: L O W E R '_' I N C;
LOWER_INF: L O W E R '_' I N F;
LPAD: L P A D;
LTRIM: L T R I M;
LSEG: L S E G;
MACADDR8_SET7BIT: M A C A D D R '8' '_' S E T '7' B I T;
MAKEDATE: M A K E D A T E;
MAKETIME: M A K E T I M E;
MAKE_DATE: M A K E '_' D A T E;
MAKE_TIME: M A K E '_' T I M E;
MAKE_TIMESTAMP: M A K E '_' T I M E S T A M P;
MAKE_TIMESTAMPTZ: M A K E '_' T I M E S T A M P T Z;
MARK: M A R K;
MASKLEN: M A S K L E N;
MAX: M A X;
MD5: M D '5';
METHOD: M E T H O D;
MICROSECOND: M I C R O S E C O N D;
MIN: M I N;
MIN_ACTIVE_ROWVERSION: M I N '_' A C T I V E '_' R O W V E R S I O N;
MINUTE: M I N U T E;
MOD: M O D;
MODIFY: M O D I F Y;
MONEY: M O N E Y;
MONTH: M O N T H;
MONTHNAME: M O N T H N A M E;
MONTHS: M O N T H S;
NEGATIVE: N E G A T I V E;
NEXT: N E X T;
NETMASK: N E T M A S K;
NETWORK: N E T W O R K;
NAME: N A M E;
NCHAR: N C H A R;
NDV: N D V;
NEXTVAL: N E X T V A L;
NOCOUNT: N O C O U N T;
NOEXPAND: N O E X P A N D;
NORECOMPUTE: N O R E C O M P U T E;
NOW: N O W;
NPOINTS: N P O I N T S;
NTEXT: N T E X T;
NTILE: N T I L E;
NUMBER: N U M B E R;
NUMNODE: N U M N O D E;
NUMERIC: N U M E R I C;
NVARCHAR: N V A R C H A R;
NVL: N V L;
OCTET_LENGTH: O C T E T '_' L E N G T H;
OFFSET: O F F S E T;
ONLY: O N L Y;
OPTIMISTIC: O P T I M I S T I C;
OPTIMIZE: O P T I M I Z E;
OUT: O U T;
OUTPUT: O U T P U T;
OVERLAY: O V E R L A Y;
OWNER: O W N E R;
PARTITION: P A R T I T I O N;
PATH: P A T H;
PCLOSE: P C L O S E;
PERCENTILE: P E R C E N T I L E;
PERIOD_ADD: P E R I O D '_' A D D;
PERIOD_DIFF: P E R I O D '_' D I F F;
PG_CLIENT_ENCODING: P G '_' C L I E N T '_' E N C O D I N G;
PLAINTO_TSQUERY: P L A I N T O '_' T S Q U E R Y;
PHRASETO_TSQUERY: P H R A S E T O '_' T S Q U E R Y;
PI: P I;
PLACING: P L A C I N G;
PMOD: P M O D;
POINT: P O I N T;
POLYGON: P O L Y G O N;
POPEN: P O P E N;
POSITION: P O S I T I O N;
POSITIVE: P O S I T I V E;
POW: P O W;
POWER: P O W E R;
PRECEDING: P R E C E D I N G;
PRIOR: P R I O R;
QUARTER: Q U A R T E R;
QUERYTREE: Q U E R Y T R E E;
QUOTED_BY: Q U O T E D ' ' B Y;
QUOTE_IDENT: Q U O T E '_' I D E N T;
QUOTE_LITERAL: Q U O T E '_' L I T E R A L;
QUOTE_NULLABLE: Q U O T E '_' N U L L A B L E;
RADIANS: R A D I A N S;
RADIUS: R A D I U S;
RAND: R A N D;
RANDOM: R A N D O M;
RANGE: R A N G E;
RANGE_MERGE: R A N G E '_' M E R G E;
RANK: R A N K;
READONLY: R E A D O N L Y;
READ_ONLY: R E A D '_' O N L Y;
RECOMMENDED: R E C O M M E N D E D;
RECOMPILE: R E C O M P I L E;
REFRESH: R E F R E S H;
REGR_AVGX: R E G R '_' A V G X;
REGR_AVGY: R E G R '_' A V G Y;
REGR_COUNT: R E G R '_' C O U N T;
REGR_INTERCEPT: R E G R '_' I N T E R C E P T;
REGR_R2: R E G R '_' R '2';
REGR_SLOPE: R E G R '_' S L O P E;
REGR_SXX: R E G R '_' S X X;
REGR_SXY: R E G R '_' S X Y;
REGR_SYY: R E G R '_' S Y Y;
RELATIVE: R E L A T I V E;
REGEXP_MATCHES: R E G E X P '_' M A T C H E S;
REGEXP_REPLACE: R E G E X P '_' R E P L A C E;
REGEXP_SPLIT_TO_ARRAY: R E G E X P '_' S P L I T '_' T O '_' A R R A Y;
REGEXP_SPLIT_TO_TABLE: R E G E X P '_' S P L I T '_' T O '_' T A B L E;
REMOTE: R E M O T E;
REPEAT: R E P E A T;
REPEATABLE: R E P E A T A B L E;
REPLACE: R E P L A C E;
REVERSE: R E V E R S E;
ROLLUP: R O L L U P;
ROOT: R O O T;
ROUND: R O U N D;
ROW: R O W;
ROW_TO_JSON: R O W '_' T O '_' J S O N;
ROWGUID: R O W G U I D;
ROWS: R O W S;
ROW_NUMBER: R O W '_' N U M B E R;
RTRIM: R T R I M;
SAMPLE: S A M P L E;
SCALE: S C A L E;
SCHEMABINDING: S C H E M A B I N D I N G;
SCROLL: S C R O L L;
SCROLL_LOCKS: S C R O L L '_' L O C K S;
SECOND: S E C O N D;
SEC_TO_TIME: S E C '_' T O '_' T I M E;
SELF: S E L F;
SERIALIZABLE: S E R I A L I Z A B L E;
SETSEED: S E T S E E D;
SETWEIGHT: S E T W E I G H T;
SETVAL: S E T V A L;
SET_BIT: S E T '_' B I T;
SET_BYTE: S E T '_' B Y T E;
SET_MASKLEN: S E T '_' M A S K L E N;
SHA1: S H A '1';
SHA2: S H A '2';
SHIFTLEFT: S H I F T L E F T;
SHIFTRIGHT: S H I F T R I G H T;
SHIFTRIGHTUNSIGNED: S H I F T R I G H T U N S I G N E D;
SIGN: S I G N;
SIN: S I N;
SMALLDATETIME: S M A L L D A T E T I M E;
SMALLINT: S M A L L I N T;
SMALLMONEY: S M A L L M O N E Y;
SNAPSHOT: S N A P S H O T;
SPACE_FUNCTION: S P A C E;
SPATIAL_WINDOW_MAX_CELLS: S P A T I A L '_' W I N D O W '_' M A X '_' C E L L S;
SPLIT: S P L I T;
SPLIT_PART: S P L I T '_' P A R T;
SQL_VARIANT: S Q L '_' V A R I A N T;
STATEMENT_TIMESTAMP: S T A T E M E N T '_' T I M E S T A M P;
STATIC: S T A T I C;
STATS_STREAM: S T A T S '_' S T R E A M;
STDEV: S T D E V;
STDDEV: S T D D E V;
STDEVP: S T D E V P;
STDDEV_SAMP: S T D D E V '_' S A M P;
STORED_AS_PARQUET: S T O R E D ' ' A S ' ' P A R Q U E T;
STRCMP: S T R C M P;
STRING_AGG: S T R I N G '_' A G G;
STRING_TO_ARRAY: S T R I N G '_' T O '_' A R R A Y;
STRPOS: S T R P O S;
STR_TO_DATE: S T R '_' T O '_' D A T E;
SUBDATE: S U B D A T E;
SUBSTRING_INDEX: S U B S T R I N G '_' I N D E X;
SUM: S U M;
SQRT: S Q R T;
STDDEV_POP: S T D D E V '_' P O P;
STRIP: S T R I P;
STRTOL: S T R T O L;
SYSDATE: S Y S D A T E;
TAN: T A N;
TEXT: T E X T;
THROW: T H R O W;
TIES: T I E S;
TIME: T I M E;
TIMEDIFF: T I M E D I F F;
TIMEOFDAY: T I M E O F D A Y;
TIMESTAMP: T I M E S T A M P;
TIME_FORMAT: T I M E '_' F O R M A T E;
TIME_TO_SEC: T I M E '_' T O '_' S E C;
TINYINT: T I N Y I N T;
TO_ASCII: T O '_' A S C I I;
TO_CHAR: T O '_' C H A R;
TO_DATE: T O '_' D A T E;
TO_DAYS: T O '_' D A Y S;
TO_HEX: T O '_' H E X;
TO_JSON: T O '_' J S O N;
TO_JSONB: T O '_' J S O N B;
TO_NUMBER: T O '_' N U M B E R;
TO_TIMESTAMP: T O '_' T I M E S T A M P;
TO_TSQUERY: T O '_' T S Q U E R Y;
TO_TSVECTOR: T O '_' T S V E C T O R;
TRANSACTION_TIMESTAMP: T R A N S A N C A T I O N '_' T I M E S T A M P;
TRANSLATE: T R A N S L A T E;
TRIM: T R I M;
TRUNC: T R U N C;
TRY: T R Y;
TS_DELETE: T S '_' D E L E T E;
TS_FILTER: T S '_' F I L T E R;
TS_HEADLINE: T S '_' H E A D L I N E;
TS_RANK: T S '_' R A N K;
TS_RANK_CD: T S '_' R A N K '_' C D;
TS_REWRITE: T S '_' R E W R I T E;
TSQUERY_PHRASE: T S Q U E R Y '_' P H R A S E;
TSVECTOR_TO_ARRAY: T S V E C T O R '_' T O '_' A R R A Y;
TSVECTOR_UPDATE_TRIGGER: T S V E C T O R '_' U P D A T E '_' T R I G G E R;
TSVECTOR_UPDATE_TRIGGER_COLUMN: T S V E C T O R '_' U P D A T E '_' T R I G G E R '_' C O L U M N;
TYPE: T Y P E;
TYPE_WARNING: T Y P E '_' W A R N I N G;
UCASE: U C A S E;
UNBOUNDED: U N B O U N D E D;
UNCOMMITTED: U N C O M M I T T E D;
UNHEX: U N H E X;
UNIQUEIDENTIFIER: U N I Q U E I D E N T I F I E R;
UNIVERSE: U N I V E R S E;
UNIX_TIMESTAMP: U N I X '_' T I M E S T A M P;
UNKNOWN: U N K N O W N;
UNNEST: U N N E S T;
UPPER: U P P E R;
UPPER_INC: U P P E R '_' I N C;
UPPER_INF: U P P E R '_' I N F;
USING: U S I N G;
VAR: V A R;
VARBINARY: V A R B I N A R Y;
VARCHAR: V A R C H A R;
VARIANCE: V A R I A N C E;
VAR_POP: V A R '_' P O P;
VAR_SAMP: V A R '_' S A M P;
VARP: V A R P;
VERSION: V E R S I O N;
VIEW_METADATA: V I E W '_' M E T A D A T A;
WEEKOFYEAR: W E E K O F Y E A R;
WEEK: W E E K;
WEEKDAY: W E E K D A Y;
WIDTH: W I D T H;
WIDTH_BUCKET: W I D T H '_' B U C K E T;
WORK: W O R K;
XML: X M L;
XMLAGG: X M L A G G;
XMLCOMMENT: X M L C O M M E N T;
XMLCONCAT: X M L C O N C A T;
XMLELEMENT: X M L E L E M E N T;
XMLFOREST: X M L F O R E S T;
XMLNAMESPACES: X M L N A M E S P A C E S;
XMLPI: X M L P I;
XMLROOT: X M L R O O T;
XML_ISWELL_FORMAT: X M L '_' I S '_' W E L L '_' F O R M A T;
XPATH: X P A T H;
XPATH_EXISTS: X P A T H '_' E X I S T S;
YEAR: Y E A R;
YEARS: Y E A R S;
YEARWEEK: Y E A R W E E K;
DOLLAR_ACTION: '$' A C T I O N;
SPACE: [ \t\r\n]+ -> channel(1);
COMMENT: '/*' .*? '*/' -> channel(HIDDEN);
LINE_COMMENT: '--' ~[\r\n]* -> channel(HIDDEN);
// TODO: ID can be not only Latin.
DOUBLE_QUOTE_ID: '"' ~'"'+ '"';
BACKTICK_ID: '`' ~'`'+ '`';
SQUARE_BRACKET_ID: '[' ~']'+ ']';
LOCAL_ID: '@' [a-zA-Z_$@#0-9]+;
DECIMAL: DEC_DIGIT+;
ID: [a-zA-Z_#][a-zA-Z_#$@0-9]*;
STRING: N? '\'' (~'\'' | '\'\'')* '\'';
BINARY: '0' X HEX_DIGIT*;
FLOAT: DEC_DOT_DEC;
REAL: DEC_DOT_DEC (E [+-]? DEC_DIGIT+)?;
EQUAL: '=';
GREATER: '>';
LESS: '<';
EXCLAMATION: '!';
PLUS_ASSIGN: '+=';
MINUS_ASSIGN: '-=';
MULT_ASSIGN: '*=';
DIV_ASSIGN: '/=';
MOD_ASSIGN: '%=';
AND_ASSIGN: '&=';
XOR_ASSIGN: '^=';
OR_ASSIGN: '|=';
DOT: '.';
UNDERLINE: '_';
AT: '@';
SHARP: '#';
DOLLAR: '$';
LR_BRACKET: '(';
RR_BRACKET: ')';
COMMA: ',';
SEMICOLON: ';';
COLON: ':';
STAR: '*';
DIVIDE: '/';
MODULE: '%';
PLUS: '+';
MINUS: '-';
BIT_NOT: '~';
BIT_OR: '|';
BIT_AND: '&';
BIT_XOR: '^';
BIT_CONCAT: '||';
BIT_LSHIFT: '<<';
BIT_RSHIFT: '>>';
fragment LETTER: [a-zA-Z_];
fragment DEC_DOT_DEC: (DEC_DIGIT+ '.' DEC_DIGIT+ | DEC_DIGIT+ '.' | '.' DEC_DIGIT+);
fragment HEX_DIGIT: [0-9A-Fa-f];
fragment DEC_DIGIT: [0-9];
fragment A: [aA];
fragment B: [bB];
fragment C: [cC];
fragment D: [dD];
fragment E: [eE];
fragment F: [fF];
fragment G: [gG];
fragment H: [hH];
fragment I: [iI];
fragment J: [jJ];
fragment K: [kK];
fragment L: [lL];
fragment M: [mM];
fragment N: [nN];
fragment O: [oO];
fragment P: [pP];
fragment Q: [qQ];
fragment R: [rR];
fragment S: [sS];
fragment T: [tT];
fragment U: [uU];
fragment V: [vV];
fragment W: [wW];
fragment X: [xX];
fragment Y: [yY];
fragment Z: [zZ];
|
source/amf/ocl/amf-internals-tables-ocl_metamodel.adb | svn2github/matreshka | 24 | 7883 | <filename>source/amf/ocl/amf-internals-tables-ocl_metamodel.adb
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012-2013, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
package body AMF.Internals.Tables.OCL_Metamodel is
----------------
-- MM_OCL_OCL --
----------------
function MM_OCL_OCL return AMF.Internals.CMOF_Element is
begin
return Base + 133;
end MM_OCL_OCL;
----------------------------
-- MC_OCL_Collection_Kind --
----------------------------
function MC_OCL_Collection_Kind return AMF.Internals.CMOF_Element is
begin
return Base + 135;
end MC_OCL_Collection_Kind;
---------------------
-- MC_OCL_Any_Type --
---------------------
function MC_OCL_Any_Type return AMF.Internals.CMOF_Element is
begin
return Base + 1;
end MC_OCL_Any_Type;
---------------------------------------
-- MC_OCL_Association_Class_Call_Exp --
---------------------------------------
function MC_OCL_Association_Class_Call_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 2;
end MC_OCL_Association_Class_Call_Exp;
---------------------
-- MC_OCL_Bag_Type --
---------------------
function MC_OCL_Bag_Type return AMF.Internals.CMOF_Element is
begin
return Base + 3;
end MC_OCL_Bag_Type;
--------------------------------
-- MC_OCL_Boolean_Literal_Exp --
--------------------------------
function MC_OCL_Boolean_Literal_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 4;
end MC_OCL_Boolean_Literal_Exp;
---------------------
-- MC_OCL_Call_Exp --
---------------------
function MC_OCL_Call_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 5;
end MC_OCL_Call_Exp;
----------------------------
-- MC_OCL_Collection_Item --
----------------------------
function MC_OCL_Collection_Item return AMF.Internals.CMOF_Element is
begin
return Base + 6;
end MC_OCL_Collection_Item;
-----------------------------------
-- MC_OCL_Collection_Literal_Exp --
-----------------------------------
function MC_OCL_Collection_Literal_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 7;
end MC_OCL_Collection_Literal_Exp;
------------------------------------
-- MC_OCL_Collection_Literal_Part --
------------------------------------
function MC_OCL_Collection_Literal_Part return AMF.Internals.CMOF_Element is
begin
return Base + 8;
end MC_OCL_Collection_Literal_Part;
-----------------------------
-- MC_OCL_Collection_Range --
-----------------------------
function MC_OCL_Collection_Range return AMF.Internals.CMOF_Element is
begin
return Base + 9;
end MC_OCL_Collection_Range;
----------------------------
-- MC_OCL_Collection_Type --
----------------------------
function MC_OCL_Collection_Type return AMF.Internals.CMOF_Element is
begin
return Base + 10;
end MC_OCL_Collection_Type;
-----------------------------
-- MC_OCL_Enum_Literal_Exp --
-----------------------------
function MC_OCL_Enum_Literal_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 11;
end MC_OCL_Enum_Literal_Exp;
------------------------------
-- MC_OCL_Expression_In_Ocl --
------------------------------
function MC_OCL_Expression_In_Ocl return AMF.Internals.CMOF_Element is
begin
return Base + 12;
end MC_OCL_Expression_In_Ocl;
-----------------------------
-- MC_OCL_Feature_Call_Exp --
-----------------------------
function MC_OCL_Feature_Call_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 13;
end MC_OCL_Feature_Call_Exp;
-------------------
-- MC_OCL_If_Exp --
-------------------
function MC_OCL_If_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 14;
end MC_OCL_If_Exp;
--------------------------------
-- MC_OCL_Integer_Literal_Exp --
--------------------------------
function MC_OCL_Integer_Literal_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 15;
end MC_OCL_Integer_Literal_Exp;
--------------------------------
-- MC_OCL_Invalid_Literal_Exp --
--------------------------------
function MC_OCL_Invalid_Literal_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 16;
end MC_OCL_Invalid_Literal_Exp;
-------------------------
-- MC_OCL_Invalid_Type --
-------------------------
function MC_OCL_Invalid_Type return AMF.Internals.CMOF_Element is
begin
return Base + 17;
end MC_OCL_Invalid_Type;
------------------------
-- MC_OCL_Iterate_Exp --
------------------------
function MC_OCL_Iterate_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 18;
end MC_OCL_Iterate_Exp;
-------------------------
-- MC_OCL_Iterator_Exp --
-------------------------
function MC_OCL_Iterator_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 19;
end MC_OCL_Iterator_Exp;
--------------------
-- MC_OCL_Let_Exp --
--------------------
function MC_OCL_Let_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 20;
end MC_OCL_Let_Exp;
------------------------
-- MC_OCL_Literal_Exp --
------------------------
function MC_OCL_Literal_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 21;
end MC_OCL_Literal_Exp;
---------------------
-- MC_OCL_Loop_Exp --
---------------------
function MC_OCL_Loop_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 22;
end MC_OCL_Loop_Exp;
------------------------
-- MC_OCL_Message_Exp --
------------------------
function MC_OCL_Message_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 23;
end MC_OCL_Message_Exp;
-------------------------
-- MC_OCL_Message_Type --
-------------------------
function MC_OCL_Message_Type return AMF.Internals.CMOF_Element is
begin
return Base + 24;
end MC_OCL_Message_Type;
--------------------------------
-- MC_OCL_Navigation_Call_Exp --
--------------------------------
function MC_OCL_Navigation_Call_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 25;
end MC_OCL_Navigation_Call_Exp;
-----------------------------
-- MC_OCL_Null_Literal_Exp --
-----------------------------
function MC_OCL_Null_Literal_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 26;
end MC_OCL_Null_Literal_Exp;
--------------------------------
-- MC_OCL_Numeric_Literal_Exp --
--------------------------------
function MC_OCL_Numeric_Literal_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 27;
end MC_OCL_Numeric_Literal_Exp;
---------------------------
-- MC_OCL_Ocl_Expression --
---------------------------
function MC_OCL_Ocl_Expression return AMF.Internals.CMOF_Element is
begin
return Base + 28;
end MC_OCL_Ocl_Expression;
-------------------------------
-- MC_OCL_Operation_Call_Exp --
-------------------------------
function MC_OCL_Operation_Call_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 29;
end MC_OCL_Operation_Call_Exp;
-----------------------------
-- MC_OCL_Ordered_Set_Type --
-----------------------------
function MC_OCL_Ordered_Set_Type return AMF.Internals.CMOF_Element is
begin
return Base + 30;
end MC_OCL_Ordered_Set_Type;
----------------------------------
-- MC_OCL_Primitive_Literal_Exp --
----------------------------------
function MC_OCL_Primitive_Literal_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 31;
end MC_OCL_Primitive_Literal_Exp;
------------------------------
-- MC_OCL_Property_Call_Exp --
------------------------------
function MC_OCL_Property_Call_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 32;
end MC_OCL_Property_Call_Exp;
-----------------------------
-- MC_OCL_Real_Literal_Exp --
-----------------------------
function MC_OCL_Real_Literal_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 33;
end MC_OCL_Real_Literal_Exp;
--------------------------
-- MC_OCL_Sequence_Type --
--------------------------
function MC_OCL_Sequence_Type return AMF.Internals.CMOF_Element is
begin
return Base + 34;
end MC_OCL_Sequence_Type;
---------------------
-- MC_OCL_Set_Type --
---------------------
function MC_OCL_Set_Type return AMF.Internals.CMOF_Element is
begin
return Base + 35;
end MC_OCL_Set_Type;
----------------------
-- MC_OCL_State_Exp --
----------------------
function MC_OCL_State_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 36;
end MC_OCL_State_Exp;
-------------------------------
-- MC_OCL_String_Literal_Exp --
-------------------------------
function MC_OCL_String_Literal_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 37;
end MC_OCL_String_Literal_Exp;
------------------------------------
-- MC_OCL_Template_Parameter_Type --
------------------------------------
function MC_OCL_Template_Parameter_Type return AMF.Internals.CMOF_Element is
begin
return Base + 38;
end MC_OCL_Template_Parameter_Type;
------------------------------
-- MC_OCL_Tuple_Literal_Exp --
------------------------------
function MC_OCL_Tuple_Literal_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 39;
end MC_OCL_Tuple_Literal_Exp;
-------------------------------
-- MC_OCL_Tuple_Literal_Part --
-------------------------------
function MC_OCL_Tuple_Literal_Part return AMF.Internals.CMOF_Element is
begin
return Base + 40;
end MC_OCL_Tuple_Literal_Part;
-----------------------
-- MC_OCL_Tuple_Type --
-----------------------
function MC_OCL_Tuple_Type return AMF.Internals.CMOF_Element is
begin
return Base + 41;
end MC_OCL_Tuple_Type;
---------------------
-- MC_OCL_Type_Exp --
---------------------
function MC_OCL_Type_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 42;
end MC_OCL_Type_Exp;
------------------------------------------
-- MC_OCL_Unlimited_Natural_Literal_Exp --
------------------------------------------
function MC_OCL_Unlimited_Natural_Literal_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 43;
end MC_OCL_Unlimited_Natural_Literal_Exp;
----------------------------------
-- MC_OCL_Unspecified_Value_Exp --
----------------------------------
function MC_OCL_Unspecified_Value_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 44;
end MC_OCL_Unspecified_Value_Exp;
---------------------
-- MC_OCL_Variable --
---------------------
function MC_OCL_Variable return AMF.Internals.CMOF_Element is
begin
return Base + 45;
end MC_OCL_Variable;
-------------------------
-- MC_OCL_Variable_Exp --
-------------------------
function MC_OCL_Variable_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 46;
end MC_OCL_Variable_Exp;
----------------------
-- MC_OCL_Void_Type --
----------------------
function MC_OCL_Void_Type return AMF.Internals.CMOF_Element is
begin
return Base + 47;
end MC_OCL_Void_Type;
----------------------------------------------------------------------------------
-- MP_OCL_Association_Class_Call_Exp_Referred_Association_Class_A_Referring_Exp --
----------------------------------------------------------------------------------
function MP_OCL_Association_Class_Call_Exp_Referred_Association_Class_A_Referring_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 55;
end MP_OCL_Association_Class_Call_Exp_Referred_Association_Class_A_Referring_Exp;
-----------------------------------------------
-- MP_OCL_Boolean_Literal_Exp_Boolean_Symbol --
-----------------------------------------------
function MP_OCL_Boolean_Literal_Exp_Boolean_Symbol return AMF.Internals.CMOF_Element is
begin
return Base + 56;
end MP_OCL_Boolean_Literal_Exp_Boolean_Symbol;
----------------------------------------------
-- MP_OCL_Call_Exp_Source_A_Applied_Element --
----------------------------------------------
function MP_OCL_Call_Exp_Source_A_Applied_Element return AMF.Internals.CMOF_Element is
begin
return Base + 57;
end MP_OCL_Call_Exp_Source_A_Applied_Element;
-----------------------------------------
-- MP_OCL_Collection_Item_Item_A_Item1 --
-----------------------------------------
function MP_OCL_Collection_Item_Item_A_Item1 return AMF.Internals.CMOF_Element is
begin
return Base + 58;
end MP_OCL_Collection_Item_Item_A_Item1;
----------------------------------------
-- MP_OCL_Collection_Literal_Exp_Kind --
----------------------------------------
function MP_OCL_Collection_Literal_Exp_Kind return AMF.Internals.CMOF_Element is
begin
return Base + 59;
end MP_OCL_Collection_Literal_Exp_Kind;
-----------------------------------------------
-- MP_OCL_Collection_Literal_Exp_Part_A_Exp1 --
-----------------------------------------------
function MP_OCL_Collection_Literal_Exp_Part_A_Exp1 return AMF.Internals.CMOF_Element is
begin
return Base + 48;
end MP_OCL_Collection_Literal_Exp_Part_A_Exp1;
-------------------------------------------------
-- MP_OCL_Collection_Range_First_A_First_Owner --
-------------------------------------------------
function MP_OCL_Collection_Range_First_A_First_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 60;
end MP_OCL_Collection_Range_First_A_First_Owner;
-----------------------------------------------
-- MP_OCL_Collection_Range_Last_A_Last_Owner --
-----------------------------------------------
function MP_OCL_Collection_Range_Last_A_Last_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 61;
end MP_OCL_Collection_Range_Last_A_Last_Owner;
-------------------------------------------------
-- MP_OCL_Collection_Type_Element_Type_A_Type1 --
-------------------------------------------------
function MP_OCL_Collection_Type_Element_Type_A_Type1 return AMF.Internals.CMOF_Element is
begin
return Base + 62;
end MP_OCL_Collection_Type_Element_Type_A_Type1;
-----------------------------------------------------------------
-- MP_OCL_Enum_Literal_Exp_Referred_Enum_Literal_A_Literal_Exp --
-----------------------------------------------------------------
function MP_OCL_Enum_Literal_Exp_Referred_Enum_Literal_A_Literal_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 63;
end MP_OCL_Enum_Literal_Exp_Referred_Enum_Literal_A_Literal_Exp;
---------------------------------------------------------------
-- MP_OCL_Expression_In_Ocl_Body_Expression_A_Top_Expression --
---------------------------------------------------------------
function MP_OCL_Expression_In_Ocl_Body_Expression_A_Top_Expression return AMF.Internals.CMOF_Element is
begin
return Base + 64;
end MP_OCL_Expression_In_Ocl_Body_Expression_A_Top_Expression;
------------------------------------------------------------
-- MP_OCL_Expression_In_Ocl_Context_Variable_A_Self_Owner --
------------------------------------------------------------
function MP_OCL_Expression_In_Ocl_Context_Variable_A_Self_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 65;
end MP_OCL_Expression_In_Ocl_Context_Variable_A_Self_Owner;
-----------------------------------------------------------------
-- MP_OCL_Expression_In_Ocl_Generated_Type_A_Owning_Classifier --
-----------------------------------------------------------------
function MP_OCL_Expression_In_Ocl_Generated_Type_A_Owning_Classifier return AMF.Internals.CMOF_Element is
begin
return Base + 66;
end MP_OCL_Expression_In_Ocl_Generated_Type_A_Owning_Classifier;
-------------------------------------------------------------
-- MP_OCL_Expression_In_Ocl_Parameter_Variable_A_Var_Owner --
-------------------------------------------------------------
function MP_OCL_Expression_In_Ocl_Parameter_Variable_A_Var_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 49;
end MP_OCL_Expression_In_Ocl_Parameter_Variable_A_Var_Owner;
-------------------------------------------------------------
-- MP_OCL_Expression_In_Ocl_Result_Variable_A_Result_Owner --
-------------------------------------------------------------
function MP_OCL_Expression_In_Ocl_Result_Variable_A_Result_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 67;
end MP_OCL_Expression_In_Ocl_Result_Variable_A_Result_Owner;
----------------------------------------
-- MP_OCL_If_Exp_Condition_A_If_Owner --
----------------------------------------
function MP_OCL_If_Exp_Condition_A_If_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 68;
end MP_OCL_If_Exp_Condition_A_If_Owner;
------------------------------------------------
-- MP_OCL_If_Exp_Else_Expression_A_Else_Owner --
------------------------------------------------
function MP_OCL_If_Exp_Else_Expression_A_Else_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 69;
end MP_OCL_If_Exp_Else_Expression_A_Else_Owner;
------------------------------------------------
-- MP_OCL_If_Exp_Then_Expression_A_Then_Owner --
------------------------------------------------
function MP_OCL_If_Exp_Then_Expression_A_Then_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 70;
end MP_OCL_If_Exp_Then_Expression_A_Then_Owner;
-----------------------------------------------
-- MP_OCL_Integer_Literal_Exp_Integer_Symbol --
-----------------------------------------------
function MP_OCL_Integer_Literal_Exp_Integer_Symbol return AMF.Internals.CMOF_Element is
begin
return Base + 71;
end MP_OCL_Integer_Literal_Exp_Integer_Symbol;
------------------------------------------
-- MP_OCL_Iterate_Exp_Result_A_Base_Exp --
------------------------------------------
function MP_OCL_Iterate_Exp_Result_A_Base_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 72;
end MP_OCL_Iterate_Exp_Result_A_Base_Exp;
------------------------------
-- MP_OCL_Let_Exp_In_A_Exp4 --
------------------------------
function MP_OCL_Let_Exp_In_A_Exp4 return AMF.Internals.CMOF_Element is
begin
return Base + 73;
end MP_OCL_Let_Exp_In_A_Exp4;
------------------------------------
-- MP_OCL_Let_Exp_Variable_A_Exp5 --
------------------------------------
function MP_OCL_Let_Exp_Variable_A_Exp5 return AMF.Internals.CMOF_Element is
begin
return Base + 74;
end MP_OCL_Let_Exp_Variable_A_Exp5;
--------------------------------------------
-- MP_OCL_Loop_Exp_Body_A_Loop_Body_Owner --
--------------------------------------------
function MP_OCL_Loop_Exp_Body_A_Loop_Body_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 75;
end MP_OCL_Loop_Exp_Body_A_Loop_Body_Owner;
-----------------------------------------
-- MP_OCL_Loop_Exp_Iterator_A_Loop_Exp --
-----------------------------------------
function MP_OCL_Loop_Exp_Iterator_A_Loop_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 50;
end MP_OCL_Loop_Exp_Iterator_A_Loop_Exp;
----------------------------------------
-- MP_OCL_Message_Exp_Argument_A_Exp2 --
----------------------------------------
function MP_OCL_Message_Exp_Argument_A_Exp2 return AMF.Internals.CMOF_Element is
begin
return Base + 51;
end MP_OCL_Message_Exp_Argument_A_Exp2;
------------------------------------------------
-- MP_OCL_Message_Exp_Called_Operation_A_Exp6 --
------------------------------------------------
function MP_OCL_Message_Exp_Called_Operation_A_Exp6 return AMF.Internals.CMOF_Element is
begin
return Base + 76;
end MP_OCL_Message_Exp_Called_Operation_A_Exp6;
-------------------------------------------
-- MP_OCL_Message_Exp_Sent_Signal_A_Exp7 --
-------------------------------------------
function MP_OCL_Message_Exp_Sent_Signal_A_Exp7 return AMF.Internals.CMOF_Element is
begin
return Base + 77;
end MP_OCL_Message_Exp_Sent_Signal_A_Exp7;
--------------------------------------
-- MP_OCL_Message_Exp_Target_A_Exp8 --
--------------------------------------
function MP_OCL_Message_Exp_Target_A_Exp8 return AMF.Internals.CMOF_Element is
begin
return Base + 78;
end MP_OCL_Message_Exp_Target_A_Exp8;
----------------------------------------------------
-- MP_OCL_Message_Type_Referred_Operation_A_Type2 --
----------------------------------------------------
function MP_OCL_Message_Type_Referred_Operation_A_Type2 return AMF.Internals.CMOF_Element is
begin
return Base + 79;
end MP_OCL_Message_Type_Referred_Operation_A_Type2;
-------------------------------------------------
-- MP_OCL_Message_Type_Referred_Signal_A_Type3 --
-------------------------------------------------
function MP_OCL_Message_Type_Referred_Signal_A_Type3 return AMF.Internals.CMOF_Element is
begin
return Base + 80;
end MP_OCL_Message_Type_Referred_Signal_A_Type3;
---------------------------------------------------------
-- MP_OCL_Navigation_Call_Exp_Navigation_Source_A_Exp9 --
---------------------------------------------------------
function MP_OCL_Navigation_Call_Exp_Navigation_Source_A_Exp9 return AMF.Internals.CMOF_Element is
begin
return Base + 81;
end MP_OCL_Navigation_Call_Exp_Navigation_Source_A_Exp9;
-------------------------------------------------------
-- MP_OCL_Navigation_Call_Exp_Qualifier_A_Parent_Nav --
-------------------------------------------------------
function MP_OCL_Navigation_Call_Exp_Qualifier_A_Parent_Nav return AMF.Internals.CMOF_Element is
begin
return Base + 52;
end MP_OCL_Navigation_Call_Exp_Qualifier_A_Parent_Nav;
------------------------------------------------------
-- MP_OCL_Operation_Call_Exp_Argument_A_Parent_Call --
------------------------------------------------------
function MP_OCL_Operation_Call_Exp_Argument_A_Parent_Call return AMF.Internals.CMOF_Element is
begin
return Base + 53;
end MP_OCL_Operation_Call_Exp_Argument_A_Parent_Call;
-----------------------------------------------------------------
-- MP_OCL_Operation_Call_Exp_Referred_Operation_A_Refering_Exp --
-----------------------------------------------------------------
function MP_OCL_Operation_Call_Exp_Referred_Operation_A_Refering_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 82;
end MP_OCL_Operation_Call_Exp_Referred_Operation_A_Refering_Exp;
---------------------------------------------------------------
-- MP_OCL_Property_Call_Exp_Referred_Property_A_Refering_Exp --
---------------------------------------------------------------
function MP_OCL_Property_Call_Exp_Referred_Property_A_Refering_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 83;
end MP_OCL_Property_Call_Exp_Referred_Property_A_Refering_Exp;
-----------------------------------------
-- MP_OCL_Real_Literal_Exp_Real_Symbol --
-----------------------------------------
function MP_OCL_Real_Literal_Exp_Real_Symbol return AMF.Internals.CMOF_Element is
begin
return Base + 84;
end MP_OCL_Real_Literal_Exp_Real_Symbol;
--------------------------------------------
-- MP_OCL_State_Exp_Referred_State_A_Exp9 --
--------------------------------------------
function MP_OCL_State_Exp_Referred_State_A_Exp9 return AMF.Internals.CMOF_Element is
begin
return Base + 85;
end MP_OCL_State_Exp_Referred_State_A_Exp9;
---------------------------------------------
-- MP_OCL_String_Literal_Exp_String_Symbol --
---------------------------------------------
function MP_OCL_String_Literal_Exp_String_Symbol return AMF.Internals.CMOF_Element is
begin
return Base + 86;
end MP_OCL_String_Literal_Exp_String_Symbol;
--------------------------------------------------
-- MP_OCL_Template_Parameter_Type_Specification --
--------------------------------------------------
function MP_OCL_Template_Parameter_Type_Specification return AMF.Internals.CMOF_Element is
begin
return Base + 87;
end MP_OCL_Template_Parameter_Type_Specification;
------------------------------------------
-- MP_OCL_Tuple_Literal_Exp_Part_A_Exp3 --
------------------------------------------
function MP_OCL_Tuple_Literal_Exp_Part_A_Exp3 return AMF.Internals.CMOF_Element is
begin
return Base + 54;
end MP_OCL_Tuple_Literal_Exp_Part_A_Exp3;
-------------------------------------------------
-- MP_OCL_Tuple_Literal_Part_Attribute_A_Part2 --
-------------------------------------------------
function MP_OCL_Tuple_Literal_Part_Attribute_A_Part2 return AMF.Internals.CMOF_Element is
begin
return Base + 88;
end MP_OCL_Tuple_Literal_Part_Attribute_A_Part2;
-------------------------------------------
-- MP_OCL_Type_Exp_Referred_Type_A_Exp11 --
-------------------------------------------
function MP_OCL_Type_Exp_Referred_Type_A_Exp11 return AMF.Internals.CMOF_Element is
begin
return Base + 89;
end MP_OCL_Type_Exp_Referred_Type_A_Exp11;
-------------------------------------------------------------------
-- MP_OCL_Unlimited_Natural_Literal_Exp_Unlimited_Natural_Symbol --
-------------------------------------------------------------------
function MP_OCL_Unlimited_Natural_Literal_Exp_Unlimited_Natural_Symbol return AMF.Internals.CMOF_Element is
begin
return Base + 90;
end MP_OCL_Unlimited_Natural_Literal_Exp_Unlimited_Natural_Symbol;
-----------------------------------------------------------
-- MP_OCL_Variable_Init_Expression_A_Initialized_Element --
-----------------------------------------------------------
function MP_OCL_Variable_Init_Expression_A_Initialized_Element return AMF.Internals.CMOF_Element is
begin
return Base + 91;
end MP_OCL_Variable_Init_Expression_A_Initialized_Element;
------------------------------------------------------
-- MP_OCL_Variable_Represented_Parameter_A_Variable --
------------------------------------------------------
function MP_OCL_Variable_Represented_Parameter_A_Variable return AMF.Internals.CMOF_Element is
begin
return Base + 92;
end MP_OCL_Variable_Represented_Parameter_A_Variable;
----------------------------------------------------------
-- MP_OCL_Variable_Exp_Referred_Variable_A_Refering_Exp --
----------------------------------------------------------
function MP_OCL_Variable_Exp_Referred_Variable_A_Refering_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 93;
end MP_OCL_Variable_Exp_Referred_Variable_A_Refering_Exp;
-------------------------------------------------
-- MP_OCL_A_First_Owner_Collection_Range_First --
-------------------------------------------------
function MP_OCL_A_First_Owner_Collection_Range_First return AMF.Internals.CMOF_Element is
begin
return Base + 159;
end MP_OCL_A_First_Owner_Collection_Range_First;
--------------------------------------------
-- MP_OCL_A_Exp9_State_Exp_Referred_State --
--------------------------------------------
function MP_OCL_A_Exp9_State_Exp_Referred_State return AMF.Internals.CMOF_Element is
begin
return Base + 175;
end MP_OCL_A_Exp9_State_Exp_Referred_State;
-----------------------------------------------
-- MP_OCL_A_Last_Owner_Collection_Range_Last --
-----------------------------------------------
function MP_OCL_A_Last_Owner_Collection_Range_Last return AMF.Internals.CMOF_Element is
begin
return Base + 160;
end MP_OCL_A_Last_Owner_Collection_Range_Last;
---------------------------------------------------------------
-- MP_OCL_A_Refering_Exp_Property_Call_Exp_Referred_Property --
---------------------------------------------------------------
function MP_OCL_A_Refering_Exp_Property_Call_Exp_Referred_Property return AMF.Internals.CMOF_Element is
begin
return Base + 149;
end MP_OCL_A_Refering_Exp_Property_Call_Exp_Referred_Property;
-------------------------------------------------
-- MP_OCL_A_Type1_Collection_Type_Element_Type --
-------------------------------------------------
function MP_OCL_A_Type1_Collection_Type_Element_Type return AMF.Internals.CMOF_Element is
begin
return Base + 176;
end MP_OCL_A_Type1_Collection_Type_Element_Type;
------------------------------------------
-- MP_OCL_A_Exp3_Tuple_Literal_Exp_Part --
------------------------------------------
function MP_OCL_A_Exp3_Tuple_Literal_Exp_Part return AMF.Internals.CMOF_Element is
begin
return Base + 161;
end MP_OCL_A_Exp3_Tuple_Literal_Exp_Part;
----------------------------------------------------------
-- MP_OCL_A_Refering_Exp_Variable_Exp_Referred_Variable --
----------------------------------------------------------
function MP_OCL_A_Refering_Exp_Variable_Exp_Referred_Variable return AMF.Internals.CMOF_Element is
begin
return Base + 150;
end MP_OCL_A_Refering_Exp_Variable_Exp_Referred_Variable;
-------------------------------------------
-- MP_OCL_A_Exp11_Type_Exp_Referred_Type --
-------------------------------------------
function MP_OCL_A_Exp11_Type_Exp_Referred_Type return AMF.Internals.CMOF_Element is
begin
return Base + 151;
end MP_OCL_A_Exp11_Type_Exp_Referred_Type;
----------------------------------------------
-- MP_OCL_A_Applied_Element_Call_Exp_Source --
----------------------------------------------
function MP_OCL_A_Applied_Element_Call_Exp_Source return AMF.Internals.CMOF_Element is
begin
return Base + 134;
end MP_OCL_A_Applied_Element_Call_Exp_Source;
---------------------------------------------------------------
-- MP_OCL_A_Top_Expression_Expression_In_Ocl_Body_Expression --
---------------------------------------------------------------
function MP_OCL_A_Top_Expression_Expression_In_Ocl_Body_Expression return AMF.Internals.CMOF_Element is
begin
return Base + 162;
end MP_OCL_A_Top_Expression_Expression_In_Ocl_Body_Expression;
--------------------------------------------
-- MP_OCL_A_Loop_Body_Owner_Loop_Exp_Body --
--------------------------------------------
function MP_OCL_A_Loop_Body_Owner_Loop_Exp_Body return AMF.Internals.CMOF_Element is
begin
return Base + 152;
end MP_OCL_A_Loop_Body_Owner_Loop_Exp_Body;
------------------------------------------------------------
-- MP_OCL_A_Self_Owner_Expression_In_Ocl_Context_Variable --
------------------------------------------------------------
function MP_OCL_A_Self_Owner_Expression_In_Ocl_Context_Variable return AMF.Internals.CMOF_Element is
begin
return Base + 163;
end MP_OCL_A_Self_Owner_Expression_In_Ocl_Context_Variable;
-----------------------------------------
-- MP_OCL_A_Loop_Exp_Loop_Exp_Iterator --
-----------------------------------------
function MP_OCL_A_Loop_Exp_Loop_Exp_Iterator return AMF.Internals.CMOF_Element is
begin
return Base + 153;
end MP_OCL_A_Loop_Exp_Loop_Exp_Iterator;
-------------------------------------------------
-- MP_OCL_A_Type3_Message_Type_Referred_Signal --
-------------------------------------------------
function MP_OCL_A_Type3_Message_Type_Referred_Signal return AMF.Internals.CMOF_Element is
begin
return Base + 177;
end MP_OCL_A_Type3_Message_Type_Referred_Signal;
-------------------------------------------------------------
-- MP_OCL_A_Result_Owner_Expression_In_Ocl_Result_Variable --
-------------------------------------------------------------
function MP_OCL_A_Result_Owner_Expression_In_Ocl_Result_Variable return AMF.Internals.CMOF_Element is
begin
return Base + 164;
end MP_OCL_A_Result_Owner_Expression_In_Ocl_Result_Variable;
----------------------------------------------------
-- MP_OCL_A_Type2_Message_Type_Referred_Operation --
----------------------------------------------------
function MP_OCL_A_Type2_Message_Type_Referred_Operation return AMF.Internals.CMOF_Element is
begin
return Base + 178;
end MP_OCL_A_Type2_Message_Type_Referred_Operation;
-------------------------------------------------------------
-- MP_OCL_A_Var_Owner_Expression_In_Ocl_Parameter_Variable --
-------------------------------------------------------------
function MP_OCL_A_Var_Owner_Expression_In_Ocl_Parameter_Variable return AMF.Internals.CMOF_Element is
begin
return Base + 165;
end MP_OCL_A_Var_Owner_Expression_In_Ocl_Parameter_Variable;
-----------------------------------------------------------------
-- MP_OCL_A_Owning_Classifier_Expression_In_Ocl_Generated_Type --
-----------------------------------------------------------------
function MP_OCL_A_Owning_Classifier_Expression_In_Ocl_Generated_Type return AMF.Internals.CMOF_Element is
begin
return Base + 166;
end MP_OCL_A_Owning_Classifier_Expression_In_Ocl_Generated_Type;
-----------------------------------------------------------------
-- MP_OCL_A_Literal_Exp_Enum_Literal_Exp_Referred_Enum_Literal --
-----------------------------------------------------------------
function MP_OCL_A_Literal_Exp_Enum_Literal_Exp_Referred_Enum_Literal return AMF.Internals.CMOF_Element is
begin
return Base + 141;
end MP_OCL_A_Literal_Exp_Enum_Literal_Exp_Referred_Enum_Literal;
-------------------------------------------------
-- MP_OCL_A_Part2_Tuple_Literal_Part_Attribute --
-------------------------------------------------
function MP_OCL_A_Part2_Tuple_Literal_Part_Attribute return AMF.Internals.CMOF_Element is
begin
return Base + 167;
end MP_OCL_A_Part2_Tuple_Literal_Part_Attribute;
-------------------------------------------------------
-- MP_OCL_A_Parent_Nav_Navigation_Call_Exp_Qualifier --
-------------------------------------------------------
function MP_OCL_A_Parent_Nav_Navigation_Call_Exp_Qualifier return AMF.Internals.CMOF_Element is
begin
return Base + 168;
end MP_OCL_A_Parent_Nav_Navigation_Call_Exp_Qualifier;
------------------------------------------------------
-- MP_OCL_A_Parent_Call_Operation_Call_Exp_Argument --
------------------------------------------------------
function MP_OCL_A_Parent_Call_Operation_Call_Exp_Argument return AMF.Internals.CMOF_Element is
begin
return Base + 154;
end MP_OCL_A_Parent_Call_Operation_Call_Exp_Argument;
---------------------------------------------------------
-- MP_OCL_A_Exp9_Navigation_Call_Exp_Navigation_Source --
---------------------------------------------------------
function MP_OCL_A_Exp9_Navigation_Call_Exp_Navigation_Source return AMF.Internals.CMOF_Element is
begin
return Base + 169;
end MP_OCL_A_Exp9_Navigation_Call_Exp_Navigation_Source;
-----------------------------------------------------------------
-- MP_OCL_A_Refering_Exp_Operation_Call_Exp_Referred_Operation --
-----------------------------------------------------------------
function MP_OCL_A_Refering_Exp_Operation_Call_Exp_Referred_Operation return AMF.Internals.CMOF_Element is
begin
return Base + 155;
end MP_OCL_A_Refering_Exp_Operation_Call_Exp_Referred_Operation;
----------------------------------------
-- MP_OCL_A_If_Owner_If_Exp_Condition --
----------------------------------------
function MP_OCL_A_If_Owner_If_Exp_Condition return AMF.Internals.CMOF_Element is
begin
return Base + 142;
end MP_OCL_A_If_Owner_If_Exp_Condition;
------------------------------------------------
-- MP_OCL_A_Then_Owner_If_Exp_Then_Expression --
------------------------------------------------
function MP_OCL_A_Then_Owner_If_Exp_Then_Expression return AMF.Internals.CMOF_Element is
begin
return Base + 143;
end MP_OCL_A_Then_Owner_If_Exp_Then_Expression;
----------------------------------------------------------------------------------
-- MP_OCL_A_Referring_Exp_Association_Class_Call_Exp_Referred_Association_Class --
----------------------------------------------------------------------------------
function MP_OCL_A_Referring_Exp_Association_Class_Call_Exp_Referred_Association_Class return AMF.Internals.CMOF_Element is
begin
return Base + 170;
end MP_OCL_A_Referring_Exp_Association_Class_Call_Exp_Referred_Association_Class;
------------------------------------------------
-- MP_OCL_A_Else_Owner_If_Exp_Else_Expression --
------------------------------------------------
function MP_OCL_A_Else_Owner_If_Exp_Else_Expression return AMF.Internals.CMOF_Element is
begin
return Base + 144;
end MP_OCL_A_Else_Owner_If_Exp_Else_Expression;
------------------------------------------
-- MP_OCL_A_Base_Exp_Iterate_Exp_Result --
------------------------------------------
function MP_OCL_A_Base_Exp_Iterate_Exp_Result return AMF.Internals.CMOF_Element is
begin
return Base + 156;
end MP_OCL_A_Base_Exp_Iterate_Exp_Result;
------------------------------
-- MP_OCL_A_Exp4_Let_Exp_In --
------------------------------
function MP_OCL_A_Exp4_Let_Exp_In return AMF.Internals.CMOF_Element is
begin
return Base + 145;
end MP_OCL_A_Exp4_Let_Exp_In;
--------------------------------------
-- MP_OCL_A_Exp8_Message_Exp_Target --
--------------------------------------
function MP_OCL_A_Exp8_Message_Exp_Target return AMF.Internals.CMOF_Element is
begin
return Base + 171;
end MP_OCL_A_Exp8_Message_Exp_Target;
-----------------------------------------------
-- MP_OCL_A_Exp1_Collection_Literal_Exp_Part --
-----------------------------------------------
function MP_OCL_A_Exp1_Collection_Literal_Exp_Part return AMF.Internals.CMOF_Element is
begin
return Base + 157;
end MP_OCL_A_Exp1_Collection_Literal_Exp_Part;
----------------------------------------
-- MP_OCL_A_Exp2_Message_Exp_Argument --
----------------------------------------
function MP_OCL_A_Exp2_Message_Exp_Argument return AMF.Internals.CMOF_Element is
begin
return Base + 172;
end MP_OCL_A_Exp2_Message_Exp_Argument;
------------------------------------
-- MP_OCL_A_Exp5_Let_Exp_Variable --
------------------------------------
function MP_OCL_A_Exp5_Let_Exp_Variable return AMF.Internals.CMOF_Element is
begin
return Base + 146;
end MP_OCL_A_Exp5_Let_Exp_Variable;
------------------------------------------------
-- MP_OCL_A_Exp6_Message_Exp_Called_Operation --
------------------------------------------------
function MP_OCL_A_Exp6_Message_Exp_Called_Operation return AMF.Internals.CMOF_Element is
begin
return Base + 173;
end MP_OCL_A_Exp6_Message_Exp_Called_Operation;
-----------------------------------------
-- MP_OCL_A_Item1_Collection_Item_Item --
-----------------------------------------
function MP_OCL_A_Item1_Collection_Item_Item return AMF.Internals.CMOF_Element is
begin
return Base + 158;
end MP_OCL_A_Item1_Collection_Item_Item;
-----------------------------------------------------------
-- MP_OCL_A_Initialized_Element_Variable_Init_Expression --
-----------------------------------------------------------
function MP_OCL_A_Initialized_Element_Variable_Init_Expression return AMF.Internals.CMOF_Element is
begin
return Base + 147;
end MP_OCL_A_Initialized_Element_Variable_Init_Expression;
-------------------------------------------
-- MP_OCL_A_Exp7_Message_Exp_Sent_Signal --
-------------------------------------------
function MP_OCL_A_Exp7_Message_Exp_Sent_Signal return AMF.Internals.CMOF_Element is
begin
return Base + 174;
end MP_OCL_A_Exp7_Message_Exp_Sent_Signal;
------------------------------------------------------
-- MP_OCL_A_Variable_Variable_Represented_Parameter --
------------------------------------------------------
function MP_OCL_A_Variable_Variable_Represented_Parameter return AMF.Internals.CMOF_Element is
begin
return Base + 148;
end MP_OCL_A_Variable_Variable_Represented_Parameter;
-----------------------------------------------
-- MA_OCL_Collection_Range_First_First_Owner --
-----------------------------------------------
function MA_OCL_Collection_Range_First_First_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 94;
end MA_OCL_Collection_Range_First_First_Owner;
------------------------------------------
-- MA_OCL_State_Exp_Referred_State_Exp9 --
------------------------------------------
function MA_OCL_State_Exp_Referred_State_Exp9 return AMF.Internals.CMOF_Element is
begin
return Base + 95;
end MA_OCL_State_Exp_Referred_State_Exp9;
---------------------------------------------
-- MA_OCL_Collection_Range_Last_Last_Owner --
---------------------------------------------
function MA_OCL_Collection_Range_Last_Last_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 96;
end MA_OCL_Collection_Range_Last_Last_Owner;
-------------------------------------------------------------
-- MA_OCL_Property_Call_Exp_Referred_Property_Refering_Exp --
-------------------------------------------------------------
function MA_OCL_Property_Call_Exp_Referred_Property_Refering_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 97;
end MA_OCL_Property_Call_Exp_Referred_Property_Refering_Exp;
-----------------------------------------------
-- MA_OCL_Collection_Type_Element_Type_Type1 --
-----------------------------------------------
function MA_OCL_Collection_Type_Element_Type_Type1 return AMF.Internals.CMOF_Element is
begin
return Base + 98;
end MA_OCL_Collection_Type_Element_Type_Type1;
----------------------------------------
-- MA_OCL_Tuple_Literal_Exp_Part_Exp3 --
----------------------------------------
function MA_OCL_Tuple_Literal_Exp_Part_Exp3 return AMF.Internals.CMOF_Element is
begin
return Base + 99;
end MA_OCL_Tuple_Literal_Exp_Part_Exp3;
--------------------------------------------------------
-- MA_OCL_Variable_Exp_Referred_Variable_Refering_Exp --
--------------------------------------------------------
function MA_OCL_Variable_Exp_Referred_Variable_Refering_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 100;
end MA_OCL_Variable_Exp_Referred_Variable_Refering_Exp;
-----------------------------------------
-- MA_OCL_Type_Exp_Referred_Type_Exp11 --
-----------------------------------------
function MA_OCL_Type_Exp_Referred_Type_Exp11 return AMF.Internals.CMOF_Element is
begin
return Base + 101;
end MA_OCL_Type_Exp_Referred_Type_Exp11;
--------------------------------------------
-- MA_OCL_Call_Exp_Source_Applied_Element --
--------------------------------------------
function MA_OCL_Call_Exp_Source_Applied_Element return AMF.Internals.CMOF_Element is
begin
return Base + 102;
end MA_OCL_Call_Exp_Source_Applied_Element;
-------------------------------------------------------------
-- MA_OCL_Expression_In_Ocl_Body_Expression_Top_Expression --
-------------------------------------------------------------
function MA_OCL_Expression_In_Ocl_Body_Expression_Top_Expression return AMF.Internals.CMOF_Element is
begin
return Base + 103;
end MA_OCL_Expression_In_Ocl_Body_Expression_Top_Expression;
------------------------------------------
-- MA_OCL_Loop_Exp_Body_Loop_Body_Owner --
------------------------------------------
function MA_OCL_Loop_Exp_Body_Loop_Body_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 104;
end MA_OCL_Loop_Exp_Body_Loop_Body_Owner;
----------------------------------------------------------
-- MA_OCL_Expression_In_Ocl_Context_Variable_Self_Owner --
----------------------------------------------------------
function MA_OCL_Expression_In_Ocl_Context_Variable_Self_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 105;
end MA_OCL_Expression_In_Ocl_Context_Variable_Self_Owner;
---------------------------------------
-- MA_OCL_Loop_Exp_Iterator_Loop_Exp --
---------------------------------------
function MA_OCL_Loop_Exp_Iterator_Loop_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 106;
end MA_OCL_Loop_Exp_Iterator_Loop_Exp;
-----------------------------------------------
-- MA_OCL_Message_Type_Referred_Signal_Type3 --
-----------------------------------------------
function MA_OCL_Message_Type_Referred_Signal_Type3 return AMF.Internals.CMOF_Element is
begin
return Base + 107;
end MA_OCL_Message_Type_Referred_Signal_Type3;
-----------------------------------------------------------
-- MA_OCL_Expression_In_Ocl_Result_Variable_Result_Owner --
-----------------------------------------------------------
function MA_OCL_Expression_In_Ocl_Result_Variable_Result_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 108;
end MA_OCL_Expression_In_Ocl_Result_Variable_Result_Owner;
--------------------------------------------------
-- MA_OCL_Message_Type_Referred_Operation_Type2 --
--------------------------------------------------
function MA_OCL_Message_Type_Referred_Operation_Type2 return AMF.Internals.CMOF_Element is
begin
return Base + 109;
end MA_OCL_Message_Type_Referred_Operation_Type2;
-----------------------------------------------------------
-- MA_OCL_Expression_In_Ocl_Parameter_Variable_Var_Owner --
-----------------------------------------------------------
function MA_OCL_Expression_In_Ocl_Parameter_Variable_Var_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 110;
end MA_OCL_Expression_In_Ocl_Parameter_Variable_Var_Owner;
---------------------------------------------------------------
-- MA_OCL_Expression_In_Ocl_Generated_Type_Owning_Classifier --
---------------------------------------------------------------
function MA_OCL_Expression_In_Ocl_Generated_Type_Owning_Classifier return AMF.Internals.CMOF_Element is
begin
return Base + 111;
end MA_OCL_Expression_In_Ocl_Generated_Type_Owning_Classifier;
---------------------------------------------------------------
-- MA_OCL_Enum_Literal_Exp_Referred_Enum_Literal_Literal_Exp --
---------------------------------------------------------------
function MA_OCL_Enum_Literal_Exp_Referred_Enum_Literal_Literal_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 112;
end MA_OCL_Enum_Literal_Exp_Referred_Enum_Literal_Literal_Exp;
-----------------------------------------------
-- MA_OCL_Tuple_Literal_Part_Attribute_Part2 --
-----------------------------------------------
function MA_OCL_Tuple_Literal_Part_Attribute_Part2 return AMF.Internals.CMOF_Element is
begin
return Base + 113;
end MA_OCL_Tuple_Literal_Part_Attribute_Part2;
-----------------------------------------------------
-- MA_OCL_Navigation_Call_Exp_Qualifier_Parent_Nav --
-----------------------------------------------------
function MA_OCL_Navigation_Call_Exp_Qualifier_Parent_Nav return AMF.Internals.CMOF_Element is
begin
return Base + 114;
end MA_OCL_Navigation_Call_Exp_Qualifier_Parent_Nav;
----------------------------------------------------
-- MA_OCL_Operation_Call_Exp_Argument_Parent_Call --
----------------------------------------------------
function MA_OCL_Operation_Call_Exp_Argument_Parent_Call return AMF.Internals.CMOF_Element is
begin
return Base + 115;
end MA_OCL_Operation_Call_Exp_Argument_Parent_Call;
-------------------------------------------------------
-- MA_OCL_Navigation_Call_Exp_Navigation_Source_Exp9 --
-------------------------------------------------------
function MA_OCL_Navigation_Call_Exp_Navigation_Source_Exp9 return AMF.Internals.CMOF_Element is
begin
return Base + 116;
end MA_OCL_Navigation_Call_Exp_Navigation_Source_Exp9;
---------------------------------------------------------------
-- MA_OCL_Operation_Call_Exp_Referred_Operation_Refering_Exp --
---------------------------------------------------------------
function MA_OCL_Operation_Call_Exp_Referred_Operation_Refering_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 117;
end MA_OCL_Operation_Call_Exp_Referred_Operation_Refering_Exp;
--------------------------------------
-- MA_OCL_If_Exp_Condition_If_Owner --
--------------------------------------
function MA_OCL_If_Exp_Condition_If_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 118;
end MA_OCL_If_Exp_Condition_If_Owner;
----------------------------------------------
-- MA_OCL_If_Exp_Then_Expression_Then_Owner --
----------------------------------------------
function MA_OCL_If_Exp_Then_Expression_Then_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 119;
end MA_OCL_If_Exp_Then_Expression_Then_Owner;
--------------------------------------------------------------------------------
-- MA_OCL_Association_Class_Call_Exp_Referred_Association_Class_Referring_Exp --
--------------------------------------------------------------------------------
function MA_OCL_Association_Class_Call_Exp_Referred_Association_Class_Referring_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 120;
end MA_OCL_Association_Class_Call_Exp_Referred_Association_Class_Referring_Exp;
----------------------------------------------
-- MA_OCL_If_Exp_Else_Expression_Else_Owner --
----------------------------------------------
function MA_OCL_If_Exp_Else_Expression_Else_Owner return AMF.Internals.CMOF_Element is
begin
return Base + 121;
end MA_OCL_If_Exp_Else_Expression_Else_Owner;
----------------------------------------
-- MA_OCL_Iterate_Exp_Result_Base_Exp --
----------------------------------------
function MA_OCL_Iterate_Exp_Result_Base_Exp return AMF.Internals.CMOF_Element is
begin
return Base + 122;
end MA_OCL_Iterate_Exp_Result_Base_Exp;
----------------------------
-- MA_OCL_Let_Exp_In_Exp4 --
----------------------------
function MA_OCL_Let_Exp_In_Exp4 return AMF.Internals.CMOF_Element is
begin
return Base + 123;
end MA_OCL_Let_Exp_In_Exp4;
------------------------------------
-- MA_OCL_Message_Exp_Target_Exp8 --
------------------------------------
function MA_OCL_Message_Exp_Target_Exp8 return AMF.Internals.CMOF_Element is
begin
return Base + 124;
end MA_OCL_Message_Exp_Target_Exp8;
---------------------------------------------
-- MA_OCL_Collection_Literal_Exp_Part_Exp1 --
---------------------------------------------
function MA_OCL_Collection_Literal_Exp_Part_Exp1 return AMF.Internals.CMOF_Element is
begin
return Base + 125;
end MA_OCL_Collection_Literal_Exp_Part_Exp1;
--------------------------------------
-- MA_OCL_Message_Exp_Argument_Exp2 --
--------------------------------------
function MA_OCL_Message_Exp_Argument_Exp2 return AMF.Internals.CMOF_Element is
begin
return Base + 126;
end MA_OCL_Message_Exp_Argument_Exp2;
----------------------------------
-- MA_OCL_Let_Exp_Variable_Exp5 --
----------------------------------
function MA_OCL_Let_Exp_Variable_Exp5 return AMF.Internals.CMOF_Element is
begin
return Base + 127;
end MA_OCL_Let_Exp_Variable_Exp5;
----------------------------------------------
-- MA_OCL_Message_Exp_Called_Operation_Exp6 --
----------------------------------------------
function MA_OCL_Message_Exp_Called_Operation_Exp6 return AMF.Internals.CMOF_Element is
begin
return Base + 128;
end MA_OCL_Message_Exp_Called_Operation_Exp6;
---------------------------------------
-- MA_OCL_Collection_Item_Item_Item1 --
---------------------------------------
function MA_OCL_Collection_Item_Item_Item1 return AMF.Internals.CMOF_Element is
begin
return Base + 129;
end MA_OCL_Collection_Item_Item_Item1;
---------------------------------------------------------
-- MA_OCL_Variable_Init_Expression_Initialized_Element --
---------------------------------------------------------
function MA_OCL_Variable_Init_Expression_Initialized_Element return AMF.Internals.CMOF_Element is
begin
return Base + 130;
end MA_OCL_Variable_Init_Expression_Initialized_Element;
-----------------------------------------
-- MA_OCL_Message_Exp_Sent_Signal_Exp7 --
-----------------------------------------
function MA_OCL_Message_Exp_Sent_Signal_Exp7 return AMF.Internals.CMOF_Element is
begin
return Base + 131;
end MA_OCL_Message_Exp_Sent_Signal_Exp7;
----------------------------------------------------
-- MA_OCL_Variable_Represented_Parameter_Variable --
----------------------------------------------------
function MA_OCL_Variable_Represented_Parameter_Variable return AMF.Internals.CMOF_Element is
begin
return Base + 132;
end MA_OCL_Variable_Represented_Parameter_Variable;
------------
-- MB_OCL --
------------
function MB_OCL return AMF.Internals.AMF_Element is
begin
return Base;
end MB_OCL;
------------
-- MB_OCL --
------------
function ML_OCL return AMF.Internals.AMF_Element is
begin
return Base + 178;
end ML_OCL;
end AMF.Internals.Tables.OCL_Metamodel;
|
src/COM/OPTEST.asm | Erukaron/TONY | 0 | 20178 | <reponame>Erukaron/TONY<filename>src/COM/OPTEST.asm
mov al, 0x55
mov ah, 0xaa
mov ax, 0xaa00
mov bl, 0xaa
mov bh, 0x55
mov bx, 0x00aa
mov cl, [0x55aa]
mov ch, [0xaa55]
mov cx, [si]
mov dx, ax
mov dh, ah
mov dl, al |
Simulation/connection.ads | edgarsmdn/Aspen_Plus_Python | 0 | 10301 | <reponame>edgarsmdn/Aspen_Plus_Python<gh_stars>0
<AdbFile>
<GuidDictionary count="121">
<Guid value="e1bdaa8f-05fd-43bb-903e-d87749440aa9" int="0"/>
<Guid value="fb058446-e81c-4e84-a1c6-57d0a3202bbe" int="1"/>
<Guid value="149049bb-db00-453c-9f0a-ce5f829dfa6a" int="2"/>
<Guid value="6139ab55-36b8-4f11-b965-be9af1398548" int="3"/>
<Guid value="1240b6a7-26b8-49c3-b71b-c4177c4dfa93" int="4"/>
<Guid value="6a0510df-f74e-458c-b813-3a5b26c0cc98" int="5"/>
<Guid value="36a46377-00ac-46db-9177-77eb99e36024" int="6"/>
<Guid value="7d969648-46e7-40f1-bb48-4e4e8170ed50" int="7"/>
<Guid value="5564ad08-a311-48a4-849b-888477a0abdc" int="8"/>
<Guid value="e46b55ab-2cdf-4ff3-8a9d-f32c385b7477" int="9"/>
<Guid value="b5177582-732b-4ccf-a68d-71bdc76bc010" int="10"/>
<Guid value="523c24d6-2679-48b2-90c0-9f4d804e4a50" int="11"/>
<Guid value="7aa50a59-73c1-47b9-a27b-72f11886a478" int="12"/>
<Guid value="0139c15d-3ec6-44a5-b2d8-19670af93704" int="13"/>
<Guid value="d9f77d68-a1a6-41e6-bb0a-4aac78acaeb3" int="14"/>
<Guid value="ca70c9ba-15d4-4fbb-afdb-df3f59f1a59b" int="15"/>
<Guid value="96c0ded1-6432-40aa-9658-1a8f04b73e5a" int="16"/>
<Guid value="cf6dafa7-e227-4be5-b732-bc58327b3ef1" int="17"/>
<Guid value="767491b8-0eea-4f62-9772-c4d62d302d89" int="18"/>
<Guid value="e1f77723-20af-481b-b715-a247fa28347c" int="19"/>
<Guid value="bab39d78-d6e6-4c3e-a0d0-475d93d74206" int="20"/>
<Guid value="4e5b2616-eca4-4750-bcae-16144ab4aa9d" int="21"/>
<Guid value="0c1b0347-8cdf-4384-9334-b8d0afed0470" int="22"/>
<Guid value="b0233e04-f5b3-4cc1-bd10-6242264f3279" int="23"/>
<Guid value="3c6b7fbb-4809-4430-a433-c62bf69deb91" int="24"/>
<Guid value="fe6faa69-79c7-4d71-a695-300a4171a239" int="25"/>
<Guid value="17d557ee-0e3b-4f65-89cf-8988433f57bb" int="26"/>
<Guid value="74fd7dac-6707-4cc1-80de-36fadfa7800b" int="27"/>
<Guid value="c8ce8a72-9c5e-4fee-8fd2-9b32c6654f87" int="28"/>
<Guid value="217df349-385b-40aa-9980-7fa1ec316e4d" int="29"/>
<Guid value="0a436056-91cb-47bf-829f-58dcadfb76a4" int="30"/>
<Guid value="213b1a73-699e-4a7f-9bcb-7e7ea676b28b" int="31"/>
<Guid value="5d203439-3442-4604-a2c1-339025bdb230" int="32"/>
<Guid value="34bf561f-ccea-48c9-b039-e0798797098d" int="33"/>
<Guid value="2f95107c-cfad-4668-a555-abdf2f0aaa02" int="34"/>
<Guid value="d9d5caf1-a5ab-400b-81c4-33dfb2d9633d" int="35"/>
<Guid value="53dc327f-6ee6-4caa-abb2-d325670d3951" int="36"/>
<Guid value="2f2b54f5-0fe0-47a7-a90a-70da617a58da" int="37"/>
<Guid value="3bfc4754-a448-47d1-82bf-a9a246075901" int="38"/>
<Guid value="39cf37ab-c038-45c3-b95e-480b422901b7" int="39"/>
<Guid value="399248a9-d286-4878-8317-089635e8b44d" int="40"/>
<Guid value="8a966293-3e8a-4ce6-a947-995dae50b7bd" int="41"/>
<Guid value="e3197534-fa65-46f1-9569-bf68586809be" int="42"/>
<Guid value="a3a1b82b-79c9-489d-bb1e-070fcf89444a" int="43"/>
<Guid value="47acee2d-56cc-4773-b7e2-ee20225eec53" int="44"/>
<Guid value="4e87a2bd-421b-4b63-8ed8-79e387678252" int="45"/>
<Guid value="80803248-6b52-4a49-9328-788e4e58db34" int="46"/>
<Guid value="b6fec974-2f6f-4339-bfcd-45d1d91b3c26" int="47"/>
<Guid value="2348d9d1-decf-4beb-b6cf-571f5f38f08c" int="48"/>
<Guid value="2a6bf3bc-c8a1-42b2-b1cb-b8deca24df04" int="49"/>
<Guid value="5afcce95-57b9-450c-81ac-9ed152bb5232" int="50"/>
<Guid value="e4cbe853-9062-4bb1-ac6f-d226cf5c9897" int="51"/>
<Guid value="24a65d64-3fde-4edc-a8cd-09b43e27401d" int="52"/>
<Guid value="15593bd7-3af5-4a7f-8731-19f17e296b22" int="53"/>
<Guid value="ebe609c5-c41b-4f79-88a6-ed3c0abfb958" int="54"/>
<Guid value="ba430646-cca5-47e0-b6f0-7051e3417088" int="55"/>
<Guid value="87a9b2c2-c453-42de-8d4d-7d38660bf9bd" int="56"/>
<Guid value="1c0f4d8c-db7e-46c7-9d97-d748af00d34b" int="57"/>
<Guid value="b56b510f-d77c-473c-8b6a-983df185ef5d" int="58"/>
<Guid value="a52e13da-789f-4675-8619-bf83c3085b61" int="59"/>
<Guid value="d21adcbc-fdbe-488e-8695-1696bcdf9d96" int="60"/>
<Guid value="114dae4a-0e1e-4745-b868-326e39ba8245" int="61"/>
<Guid value="3bb34d03-117c-4081-9bb4-bf6781e63d54" int="62"/>
<Guid value="ad556ff8-d41d-4030-82f7-97f654cd25aa" int="63"/>
<Guid value="73fa2a41-c074-46bb-87f2-31d32bd8a231" int="64"/>
<Guid value="c690f9dd-0a30-4ae6-8055-34c0fc58c300" int="65"/>
<Guid value="f127c0f6-d60f-45f8-9a6e-28a51482b944" int="66"/>
<Guid value="37e01851-1620-4fb6-885f-f4a401bb2a63" int="67"/>
<Guid value="36adff82-c12d-4b22-9ac5-1e4bc786ed91" int="68"/>
<Guid value="aac6dd64-f01f-4ebf-b4c8-57c4b850a9be" int="69"/>
<Guid value="4ed0cdbb-bb83-4e2d-a59d-5adf243aef69" int="70"/>
<Guid value="d4198184-cf6e-41e8-b963-e3b5b1352ebb" int="71"/>
<Guid value="78ff734a-b78e-45c4-8616-2f82e26db057" int="72"/>
<Guid value="613a616b-e114-476a-a337-ca2f3db02fa0" int="73"/>
<Guid value="038976a1-9c97-4d62-b034-5cddf6d0c3d9" int="74"/>
<Guid value="9e1eb42e-4da8-4e40-8ccc-22e7a49ab434" int="75"/>
<Guid value="d3d425b1-27cc-48e5-b0c1-c17bd6c4ec08" int="76"/>
<Guid value="5729a872-3fa6-47ad-b309-341a16bcaa62" int="77"/>
<Guid value="038b16f2-e3ac-4dbb-92eb-ca9000184a22" int="78"/>
<Guid value="f47d9357-2c29-4fff-ad60-e9a0e39a2fe2" int="79"/>
<Guid value="c3ecab21-3cac-45c0-9709-8ad2313b8457" int="80"/>
<Guid value="190e49ac-da04-4937-a031-36d72d2747d2" int="81"/>
<Guid value="a5ba7c30-38d8-4568-b222-7b634e30f119" int="82"/>
<Guid value="d00bf64a-073b-4032-a75c-87b9edc41bab" int="83"/>
<Guid value="8907541b-63a8-4307-97b9-fc23bb4f7ce3" int="84"/>
<Guid value="9b616bc1-a38c-42ba-84f0-d41aa3fe3c0d" int="85"/>
<Guid value="7589f4a9-7d03-4306-98fd-48c927006d97" int="86"/>
<Guid value="b2befa81-d55f-470b-9549-0a93d5a8dfba" int="87"/>
<Guid value="8151f41d-739f-4a81-b8a7-90b9df5df93a" int="88"/>
<Guid value="f92f607c-0874-4f5b-90ee-f165edb8e2ab" int="89"/>
<Guid value="643f1978-21c9-4529-a95c-3f8e52072309" int="90"/>
<Guid value="3fc900c7-d0f0-4f28-9799-a033461dbab2" int="91"/>
<Guid value="b65ad35e-bc15-4f1e-ba4a-0cee40c516bd" int="92"/>
<Guid value="a5ff5f3a-f605-4bce-b9aa-20c7585b200d" int="93"/>
<Guid value="cbe6d848-93e7-4490-9ed4-6e52fbc1b049" int="94"/>
<Guid value="04384086-a1b7-4d1a-a185-1afa035459a3" int="95"/>
<Guid value="7e7d5fd8-b283-4b8f-98af-113fcd1d8e71" int="96"/>
<Guid value="2194afbf-4c01-424a-a598-2d6b41502805" int="97"/>
<Guid value="9f67acf5-ecce-4045-84f0-467fa3de01be" int="98"/>
<Guid value="565a9ba8-597c-4394-9361-89564924fe3e" int="99"/>
<Guid value="9f0bd91f-1b59-4473-9f30-cccf63f6787f" int="100"/>
<Guid value="c464ad1e-98d4-4f1d-b563-4f9832104b7c" int="101"/>
<Guid value="0e9262d9-2ea9-45ce-b21c-bfd4aba42cf0" int="102"/>
<Guid value="8e4f9fb5-1f4a-4a9c-bc51-e561eddf40b7" int="103"/>
<Guid value="28595021-483a-460d-bef7-03ab147c6414" int="104"/>
<Guid value="d115f21f-e29c-405c-83f1-d05fd3dfc13e" int="105"/>
<Guid value="c43ac5fa-0d0d-4795-84ae-47e122458aeb" int="106"/>
<Guid value="d0835727-9d32-4cd3-9e69-21bff34aea49" int="107"/>
<Guid value="8b9185ba-7f5e-47fe-83b2-6d74ce612691" int="108"/>
<Guid value="86c17b98-cc01-4041-8d19-f70ebc0ba843" int="109"/>
<Guid value="e773b742-2e93-4702-ad45-928f7a84c155" int="110"/>
<Guid value="9434c195-c627-46b5-bbf4-d47a8a733ce4" int="111"/>
<Guid value="1147f2c6-4c68-475d-8904-d6ff18e0e150" int="112"/>
<Guid value="206faf60-f74c-484d-b762-c906f4a44b7f" int="113"/>
<Guid value="4013184f-56a0-4814-b528-32bd7e6b378a" int="114"/>
<Guid value="ced8fabc-e7e0-4826-b6a4-22a3b27f091a" int="115"/>
<Guid value="9f0c959e-1756-432b-b90b-f254e111098c" int="116"/>
<Guid value="2465d752-efdc-412a-a8ef-ec4ec7c29326" int="117"/>
<Guid value="572c7c2f-69d1-4014-8168-39c7745f8b7e" int="118"/>
<Guid value="a1025aec-4590-4163-891f-d8c433a74643" int="119"/>
<Guid value="3aa58576-347d-47ce-bcdf-660a94fa8efc" int="120"/>
</GuidDictionary>
<Records>
<Record typeGuid="1" guid="0"><Value guid="2">21</Value></Record>
<Record typeGuid="22" guid="21"><Array guid="26"><Element><Key>COL-EXT</Key><Val>30</Val></Element><Element><Key>MXSOLV</Key><Val>116</Val></Element></Array><Array guid="27"><Element><Key>FEED</Key><Val>53</Val></Element><Element><Key>C7</Key><Val>110</Val></Element><Element><Key>RICH-SOL</Key><Val>112</Val></Element><Element><Key>SOLVENT</Key><Val>114</Val></Element><Element><Key>MAKE-UP</Key><Val>118</Val></Element></Array></Record>
<Record typeGuid="31" guid="30"><Value guid="32">false</Value><Value guid="39">true</Value><Value guid="40">true</Value><Value guid="41">false</Value><Value guid="42">false</Value><Value guid="43">false</Value><Value guid="45">COL-EXT</Value><Value guid="47">21</Value><Array guid="50"><Element><Val>105</Val></Element><Element><Val>115</Val></Element></Array><Array guid="51"><Element><Val>111</Val></Element><Element><Val>113</Val></Element></Array></Record>
<Record typeGuid="54" guid="53"><Value guid="55">FEED</Value><Value guid="56">1</Value><Value guid="57">21</Value><Value guid="59">105</Value><Value guid="95">0</Value></Record>
<Record typeGuid="106" guid="105"><Value guid="107">F(IN)</Value><Value guid="108">30</Value><Value guid="109">53</Value></Record>
<Record typeGuid="54" guid="110"><Value guid="55">C7</Value><Value guid="56">1</Value><Value guid="57">21</Value><Value guid="58">111</Value><Value guid="95">0</Value></Record>
<Record typeGuid="106" guid="111"><Value guid="107">VD(OUT)</Value><Value guid="108">30</Value><Value guid="109">110</Value></Record>
<Record typeGuid="54" guid="112"><Value guid="55">RICH-SOL</Value><Value guid="56">1</Value><Value guid="57">21</Value><Value guid="58">113</Value><Value guid="95">0</Value></Record>
<Record typeGuid="106" guid="113"><Value guid="107">B(OUT)</Value><Value guid="108">30</Value><Value guid="109">112</Value></Record>
<Record typeGuid="54" guid="114"><Value guid="55">SOLVENT</Value><Value guid="56">1</Value><Value guid="57">21</Value><Value guid="58">120</Value><Value guid="59">115</Value><Value guid="95">0</Value></Record>
<Record typeGuid="106" guid="115"><Value guid="107">F(IN)</Value><Value guid="108">30</Value><Value guid="109">114</Value></Record>
<Record typeGuid="117" guid="116"><Value guid="39">true</Value><Value guid="40">true</Value><Value guid="41">false</Value><Value guid="42">false</Value><Value guid="43">false</Value><Value guid="45">MXSOLV</Value><Value guid="47">21</Value><Array guid="50"><Element><Val>119</Val></Element></Array><Array guid="51"><Element><Val>120</Val></Element></Array></Record>
<Record typeGuid="54" guid="118"><Value guid="55">MAKE-UP</Value><Value guid="56">1</Value><Value guid="57">21</Value><Value guid="59">119</Value><Value guid="95">0</Value></Record>
<Record typeGuid="106" guid="119"><Value guid="107">F(IN)</Value><Value guid="108">116</Value><Value guid="109">118</Value></Record>
<Record typeGuid="106" guid="120"><Value guid="107">P(OUT)</Value><Value guid="108">116</Value><Value guid="109">114</Value></Record>
</Records></AdbFile> |
libsrc/graphics/point_callee.asm | jpoikela/z88dk | 38 | 167436 | <filename>libsrc/graphics/point_callee.asm
;
; Z88 Graphics Functions - Small C+ stubs
;
; Written around the Interlogic Standard Library
;
; Stubs Written by <NAME> - 30/9/98
;
;
; $Id: point_callee.asm $
;
; CALLER LINKAGE FOR FUNCTION POINTERS
; ----- void point(int x, int y)
;Result is true/false
SECTION code_graphics
PUBLIC point_callee
PUBLIC _point_callee
PUBLIC ASMDISP_POINT_CALLEE
EXTERN swapgfxbk
EXTERN swapgfxbk1
EXTERN pointxy
.point_callee
._point_callee
pop af ; ret addr
pop hl ; y
pop de
ld h,e ; x
push af ; ret addr
.asmentry
push ix
call swapgfxbk
call pointxy
push af
call swapgfxbk1
pop af
pop ix
ld hl,1
ret nz ;pixel set
dec hl
ret
DEFC ASMDISP_POINT_CALLEE = asmentry - point_callee
|
gcc-gcc-7_3_0-release/gcc/ada/g-io.adb | best08618/asylo | 7 | 4028 | <gh_stars>1-10
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . I O --
-- --
-- B o d y --
-- --
-- Copyright (C) 1995-2010, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body GNAT.IO is
Current_Out : File_Type := Stdout;
pragma Atomic (Current_Out);
-- Current output file (modified by Set_Output)
---------
-- Get --
---------
procedure Get (X : out Integer) is
function Get_Int return Integer;
pragma Import (C, Get_Int, "get_int");
begin
X := Get_Int;
end Get;
procedure Get (C : out Character) is
function Get_Char return Character;
pragma Import (C, Get_Char, "get_char");
begin
C := Get_Char;
end Get;
--------------
-- Get_Line --
--------------
procedure Get_Line (Item : out String; Last : out Natural) is
C : Character;
begin
for Nstore in Item'Range loop
Get (C);
if C = ASCII.LF then
Last := Nstore - 1;
return;
else
Item (Nstore) := C;
end if;
end loop;
Last := Item'Last;
end Get_Line;
--------------
-- New_Line --
--------------
procedure New_Line (File : File_Type; Spacing : Positive := 1) is
begin
for J in 1 .. Spacing loop
Put (File, ASCII.LF);
end loop;
end New_Line;
procedure New_Line (Spacing : Positive := 1) is
begin
New_Line (Current_Out, Spacing);
end New_Line;
---------
-- Put --
---------
procedure Put (X : Integer) is
begin
Put (Current_Out, X);
end Put;
procedure Put (File : File_Type; X : Integer) is
procedure Put_Int (X : Integer);
pragma Import (C, Put_Int, "put_int");
procedure Put_Int_Stderr (X : Integer);
pragma Import (C, Put_Int_Stderr, "put_int_stderr");
begin
case File is
when Stdout => Put_Int (X);
when Stderr => Put_Int_Stderr (X);
end case;
end Put;
procedure Put (C : Character) is
begin
Put (Current_Out, C);
end Put;
procedure Put (File : File_Type; C : Character) is
procedure Put_Char (C : Character);
pragma Import (C, Put_Char, "put_char");
procedure Put_Char_Stderr (C : Character);
pragma Import (C, Put_Char_Stderr, "put_char_stderr");
begin
case File is
when Stdout => Put_Char (C);
when Stderr => Put_Char_Stderr (C);
end case;
end Put;
procedure Put (S : String) is
begin
Put (Current_Out, S);
end Put;
procedure Put (File : File_Type; S : String) is
begin
for J in S'Range loop
Put (File, S (J));
end loop;
end Put;
--------------
-- Put_Line --
--------------
procedure Put_Line (S : String) is
begin
Put_Line (Current_Out, S);
end Put_Line;
procedure Put_Line (File : File_Type; S : String) is
begin
Put (File, S);
New_Line (File);
end Put_Line;
----------------
-- Set_Output --
----------------
procedure Set_Output (File : File_Type) is
begin
Current_Out := File;
end Set_Output;
---------------------
-- Standard_Output --
---------------------
function Standard_Output return File_Type is
begin
return Stdout;
end Standard_Output;
--------------------
-- Standard_Error --
--------------------
function Standard_Error return File_Type is
begin
return Stderr;
end Standard_Error;
end GNAT.IO;
|
src/Internals/protypo-scanning.ads | fintatarta/protypo | 0 | 29232 | with Readable_Sequences.Generic_Sequences;
with Protypo.Tokens;
with Protypo.Api.Interpreters;
private package Protypo.Scanning is
type Token_Array is array (Positive range<>) of Tokens.Token;
package Token_Sequences is
new Readable_Sequences.Generic_Sequences (Element_Type => Tokens.Token,
Element_Array => Token_Array);
subtype Token_List is Token_Sequences.Sequence;
function Tokenize (Template : Protypo.Api.Interpreters.Template_Type;
Base_Dir : String) return Token_List;
procedure Dump (Item : Token_List);
-- Print to stdout the content of Item. Useful for debugging
Scanning_Error : exception;
Consume_With_Escape_Procedure_Name : constant ID := "@@";
Consume_Procedure_Name : constant ID := "@";
end Protypo.Scanning;
|
programs/oeis/281/A281381.asm | neoneye/loda | 22 | 170194 | ; A281381: a(n) = n*(n + 1)*(4*n + 5)/2.
; 0,9,39,102,210,375,609,924,1332,1845,2475,3234,4134,5187,6405,7800,9384,11169,13167,15390,17850,20559,23529,26772,30300,34125,38259,42714,47502,52635,58125,63984,70224,76857,83895,91350,99234,107559,116337,125580,135300,145509,156219,167442,179190,191475,204309,217704,231672,246225,261375,277134,293514,310527,328185,346500,365484,385149,405507,426570,448350,470859,494109,518112,542880,568425,594759,621894,649842,678615,708225,738684,770004,802197,835275,869250,904134,939939,976677,1014360,1053000,1092609,1133199,1174782,1217370,1260975,1305609,1351284,1398012,1445805,1494675,1544634,1595694,1647867,1701165,1755600,1811184,1867929,1925847,1984950
mov $1,$0
mul $1,4
add $1,5
bin $1,2
mul $0,$1
div $0,12
mul $0,3
|
data/test-files/Prelude.agda | carlostome/martin | 0 | 4735 | <filename>data/test-files/Prelude.agda
module Prelude where
data Nat : Set where
zero : Nat
suc : Nat -> Nat
{-# BUILTIN NATURAL Nat #-}
data _==_ {A : Set} (x : A) : A → Set where
refl : x == x
data Vec (A : Set) : Nat -> Set where
nil : Vec A 0
cons : forall {n} -> A -> Vec A n -> Vec A (suc n)
data List (A : Set) : Set where
nil : List A
cons : A -> List A -> List A
data Empty : Set where
data Not (A : Set) : Set where
is-absurd : (A -> Empty) -> Not A
data Dec (A : Set) : Set where
yes : A -> Dec A
no : Not A -> Dec A
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1783.asm | ljhsiun2/medusa | 9 | 161834 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x2321, %rsi
lea addresses_A_ht+0x184e1, %rdi
xor $16697, %r12
mov $98, %rcx
rep movsl
nop
nop
nop
nop
xor $17121, %r8
lea addresses_WC_ht+0x1c221, %rsi
lea addresses_normal_ht+0xfe49, %rdi
nop
xor %rdx, %rdx
mov $112, %rcx
rep movsq
cmp %r8, %r8
lea addresses_UC_ht+0x179e1, %r12
dec %r13
and $0xffffffffffffffc0, %r12
movntdqa (%r12), %xmm6
vpextrq $1, %xmm6, %rdi
nop
nop
nop
nop
lfence
lea addresses_A_ht+0xef21, %rsi
nop
nop
nop
dec %rcx
mov (%rsi), %r13d
nop
inc %rdi
lea addresses_A_ht+0x1d8e1, %rdi
nop
and %r12, %r12
movb (%rdi), %r8b
nop
cmp %rdi, %rdi
lea addresses_WC_ht+0x40e1, %rdx
nop
nop
nop
nop
nop
and $59292, %r13
mov $0x6162636465666768, %r8
movq %r8, (%rdx)
nop
and %rdi, %rdi
lea addresses_UC_ht+0x16216, %rdx
nop
nop
nop
nop
sub $7584, %r12
mov (%rdx), %r8d
nop
nop
nop
nop
and %r13, %r13
lea addresses_D_ht+0x8b79, %rdi
nop
nop
nop
xor $2971, %r8
movups (%rdi), %xmm0
vpextrq $1, %xmm0, %rsi
nop
nop
nop
nop
nop
dec %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %rax
push %rdx
push %rsi
// Faulty Load
lea addresses_PSE+0x78e1, %r12
sub %r14, %r14
movups (%r12), %xmm0
vpextrq $0, %xmm0, %rax
lea oracles, %r12
and $0xff, %rax
shlq $12, %rax
mov (%r12,%rax,1), %rax
pop %rsi
pop %rdx
pop %rax
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_PSE', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_WC_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': True, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': True, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'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
*/
|
oeis/215/A215552.asm | neoneye/loda-programs | 11 | 82857 | <reponame>neoneye/loda-programs<filename>oeis/215/A215552.asm
; A215552: a(n) = binomial(8*n,n)*(6*n+1)/(7*n+1).
; Submitted by <NAME>
; 1,7,104,1748,31000,566618,10559208,199448964,3804949176,73143988775,1414591812920,27492340515912,536480138597624,10504551860174120,206284010045343000,4061109502392133464,80126310234711780600,1583953257985260802200,31365436013686385802048,622045772573835386374500,12353439503439194274874760,245635026109439823900515340,4889673632867356412311836240,97434675013155225146393620940,1943361919964193820524073863000,38794243593914885057531285680308,775041900933903271124303914760736
mov $2,8
mul $2,$0
mov $1,$2
bin $1,$0
sub $0,1
bin $2,$0
sub $1,$2
mov $0,$1
|
programs/oeis/152/A152833.asm | jmorken/loda | 1 | 10644 | <reponame>jmorken/loda
; A152833: a(0) = -3; a(n) = n-a(n-1).
; -3,4,-2,5,-1,6,0,7,1,8,2,9,3,10,4,11,5,12,6,13,7,14,8,15,9,16,10,17,11,18,12,19,13,20,14,21,15,22,16,23,17,24,18,25,19,26,20,27,21,28,22,29,23,30,24,31,25,32,26,33,27,34,28,35,29,36,30,37,31,38,32,39,33,40,34
mov $3,$0
mod $0,2
mov $1,$3
sub $1,6
mov $2,$0
mov $4,$3
lpb $2
lpb $4
mov $3,1
sub $4,$4
lpe
add $1,5
mul $3,2
add $3,$2
mov $4,1
lpb $3
add $1,1
sub $3,$4
lpe
add $1,5
sub $2,1
lpe
div $1,2
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.