max_stars_repo_path stringlengths 4 261 | max_stars_repo_name stringlengths 6 106 | max_stars_count int64 0 38.8k | id stringlengths 1 6 | text stringlengths 7 1.05M |
|---|---|---|---|---|
oeis/022/A022232.asm | neoneye/loda-programs | 0 | 84003 | ; A022232: Gaussian binomial coefficients [ n,3 ] for q = 7.
; Submitted by <NAME>(w4)
; 1,400,140050,48177200,16531644851,5670690600800,1945063360640100,667157540444234400,228835075951868449701,78490432990886231801200,26922218610904350161500150,9234320988196680367732171600,3167372099179629291002826414551,1086408630029793075132746383601600,372638160100766855958152870082720200,127814888914589875321839862142055988800,43840506897705642578072550710977421539401,15037293865913099856070277315953016506002000,5157791796008196408769883348056084762404300250
add $0,2
lpb $0
sub $0,1
add $2,2
mul $2,7
add $3,$1
gcd $1,2
add $1,$2
mul $1,$2
div $3,$2
lpe
mul $1,$3
mov $0,$1
div $0,25536
|
test/Fail/Issue690.agda | cruhland/agda | 1,989 | 2189 | {-# OPTIONS --type-in-type #-}
-- {-# OPTIONS -v tc.pos:10 -v tc.polarity:10 #-}
-- Andreas, 2012-09-06, message on Agda list "Forget Hurken's paradox..."
module Issue690 where
infix 4 _≡_
data _≡_ {A : Set} (x : A) : A → Set where
refl : x ≡ x
data ⊥ : Set where
data D : Set where
abs : ∀ {E : Set} → D ≡ E → (E → ⊥) → D
lam : (D → ⊥) → D
lam f = abs refl f
app : D → D → ⊥
app (abs refl f) d = f d
omega : D
omega = lam (λ x → app x x)
Omega : ⊥
Omega = app omega omega
|
test/Fail/UselessAbstractField.agda | pthariensflame/agda | 3 | 4935 | -- Andreas, 2016-07-17
record R : Set₁ where
abstract
field T : Set
-- Expected error:
--
-- Using abstract here has no effect. Abstract applies only
-- definitions like data definitions, record type definitions and
-- function clauses.
|
Graphics/3GXlib/ClearImage.asm | jaredwhitney/os3 | 5 | 29982 | <reponame>jaredwhitney/os3
L3gx.clearImage : ; L3gxImage image, int color
methodTraceEnter
pop dword [clearImage.retval]
pop dword [clearImage.color]
pop dword [clearImage.image]
pusha
mov ebx, [clearImage.image]
mov eax, [ebx+L3gxImage_data]
mov edx, [ebx+L3gxImage_w]
imul edx, [ebx+L3gxImage_h]
shl edx, 2 ; 4 bytes per pixel
mov ecx, [clearImage.color]
mov [clearImage.kcol+0x0], ecx
mov [clearImage.kcol+0x4], ecx
mov [clearImage.kcol+0x8], ecx
mov [clearImage.kcol+0xC], ecx
movdqu xmm0, [clearImage.kcol]
push eax
push ecx
mov eax, edx
xor edx, edx
mov ecx, 0x100
idiv ecx
mov ebx, eax
pop ecx
pop eax
clearImage_loop :
movdqu [eax], xmm0
movdqu [eax+0x10], xmm0
movdqu [eax+0x20], xmm0
movdqu [eax+0x30], xmm0
movdqu [eax+0x40], xmm0
movdqu [eax+0x50], xmm0
movdqu [eax+0x60], xmm0
movdqu [eax+0x70], xmm0
movdqu [eax+0x80], xmm0
movdqu [eax+0x90], xmm0
movdqu [eax+0xA0], xmm0
movdqu [eax+0xB0], xmm0
movdqu [eax+0xC0], xmm0
movdqu [eax+0xD0], xmm0
movdqu [eax+0xE0], xmm0
movdqu [eax+0xF0], xmm0
add eax, 0x100
dec ebx
cmp ebx, 0
jg clearImage_loop
clearImage_loop2 :
cmp edx, 0
jle clearImage_ret
mov [eax], ecx
add eax, 4
sub edx, 4
jmp clearImage_loop2
clearImage_ret :
popa
push dword [clearImage.retval]
methodTraceLeave
ret
clearImage.retval :
dd 0x0
clearImage.image :
dd 0x0
clearImage.color :
dd 0x0
clearImage.kcol :
dq 0x0, 0x0 |
MakeOsMyself/day01/hello_os.asm | tomoyuki-nakabayashi/MyPlayGround | 0 | 19128 | <gh_stars>0
; hello-os
; TAB=4
DB 0xeb, 0x4e, 0x90
DB "HELLOIPL" ; ブートセレクタの名前を自由にかいていよい (8Byte)
DW 512 ; 1セクタの大きさ (512にしなければならない)
DB 1 ; クラスタの大きさ (1セクタにしなければならない)
DW 1 ; FATがどこから始まるか (普通は1セクタ目からにする)
DB 2 ; FATの個数 (2にしなければならない)
DW 224 ; ルートディレクトリ領域の大きさ (普通は224エントリにする)
DW 2880 ; このドライブの大きさ (2880セクタにしなければならない)
DB 0xf0 ; メディアタイプ (0xf0にしなければならない)
DW 9 ; FAT領域の長さ (9セクタにしなければならない)
DW 18 ; 1トラックにいくつのセクタがあるか (18にしなければならない)
DW 2 ; ヘッドの数 (2にしなければならない)
DD 0 ; パーティションを使っていないのでここは必ず0
DD 2880 ; このドライブの大きさをもう一度書く
DB 0, 0, 0x29 ; よくわからないけどこの値にしておくといいらしい
DD 0xffffffff ; たぶんボリュームシリアル番号
DB "HELLO-OS " ; ディスクの名前 (11Byte)
DB "FAT12 " ; フォーマットの名前 (8Byte)
RESB 18 ; とりあえず18バイト開けておく`
; Program Main Body
DB 0xb8, 0x00, 0x00, 0x8e, 0xd0, 0xbc, 0x00, 0x7c
DB 0x8e, 0xd8, 0x8e, 0xc0, 0xbe, 0x74, 0x7c, 0x8a
DB 0x04, 0x83, 0xc6, 0x01, 0x3c, 0x00, 0x74, 0x09
db 0xb4, 0x0e, 0xbb, 0x0f, 0x00, 0xcd, 0x10, 0xeb
db 0xee, 0xf4, 0xeb, 0xfd
; Message
db 0x0a, 0x0a
db "hello, world"
db 0x0a
db 0
resb 0x1fe-($-$$)
db 0x55, 0xaa
; ブート以外の記述
db 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00
resb 4600
db 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00
resb 1469432
|
Library/Text/Text/textMethodSet.asm | steakknife/pcgeos | 504 | 81224 | <gh_stars>100-1000
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: textMethodSet.asm
AUTHOR: <NAME>, Nov 21, 1991
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
John 11/21/91 Initial revision
DESCRIPTION:
Method(s) for setting text in the text object.
$Id: textMethodSet.asm,v 1.1 97/04/07 11:18:20 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TextSetReplace segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextReplaceNew
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replace a range of the text object with some text supplied
by the caller.
CALLED BY: via MSG_VIS_TEXT_REPLACE_ALL
ReplaceSelectionWithSomething
AppendWithSomething
VisTextDeleteAll
VisTextDeleteSelection
PASS: *ds:si = Instance ptr
ss:bp = VisTextReplaceParameters
RETURN: carry - set if replace aborted
DESTROYED: everything (it's a method handler)
PSEUDO CODE/STRATEGY:
Quit any selection that might be taking place
Check for that the replace operation is legal
Remove the selection hilite
Replace the text
If the selection is a cursor
Position the cursor
Else
Hilite the selection
Endif
Force the selection to be visible
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/21/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextReplaceNew method VisTextClass, MSG_VIS_TEXT_REPLACE_TEXT
uses bx
.enter
if ERROR_CHECK
;
; If the text reference is a pointer, validate that the text is not
; in a movable code segment
;
FXIP< tstdw ss:[bp].VTRP_insCount >
FXIP< jz notPointer >
FXIP< cmp ss:[bp].VTRP_textReference.TR_type, TRT_POINTER >
FXIP< jne notPointer >
FXIP< push bx, si >
FXIP< movdw bxsi, ss:[bp].VTRP_textReference.TR_ref.TRU_pointer >
FXIP< call ECAssertValidFarPointerXIP >
FXIP< pop bx, si >
FXIP< notPointer: >
endif
;
; Convert the range into something meaningful.
;
clr bx ; No context
call TA_GetTextRange ; Convert range
call TS_GetReplaceSize ; Convert number of characters
; if there is nothing to do then bail
movdw dxax, ss:[bp].VTRP_range.VTR_end
subdw dxax, ss:[bp].VTRP_range.VTR_start
or ax, dx
or ax, ss:[bp].VTRP_insCount.low
or ax, ss:[bp].VTRP_insCount.high
jz exitNoError
if _CHAR_LIMIT
call CheckForTooManyChars
jc exit
endif
;
; Make sure that the user isn't trying to nuke a section break.
;
; We check for the VTRF_FILTER flag here because if the flag is
; set (editing), we don't allow the user to nuke a section break.
;
; If the flag is clear (eg: delete-section initiated by application)
; then we do allow nuking of a section break character.
;
test ss:[bp].VTRP_flags, mask VTRF_FILTER
jz doReplace
call TR_CheckCrossSectionChange ; Illegal to nuke section-break
jnc doReplace
mov ax, MSG_VIS_TEXT_CROSS_SECTION_REPLACE_ABORTED
call Text_ObjCallInstanceNoLock
jmp exitError ; Branch if nuking a break
doReplace:
;
; Do the replacement if we can.
;
call ReplaceWithoutCrossSectionCheck
jc exitError
;
; Notify the output if context is desired.
;
test ss:[bp].VTRP_flags, mask VTRF_DO_NOT_SEND_CONTEXT_UPDATE
jnz exitNoError
call T_CheckIfContextUpdateDesired
jz exitNoError
movdw dxax, ss:[bp].VTRP_range.VTR_start
call SendPositionContext
exitNoError:
clc ; Signal: no error
exit:
;
; Carry set on error.
;
.leave
ret
exitError:
stc
jmp exit
VisTextReplaceNew endm
if _CHAR_LIMIT
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckForTooManyChars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Assert that the insert will not push the total number of
chars over the character limit.
CALLED BY: VTFInsert
PASS: *ds:si - text object
ss:bp - VisTextReplaceParameters
RETURN: carry clear if replace can proceed
carry set if not, and warning displayed
DESTROYED: ax,bx,cx,dx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cassie 4/22/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CheckForTooManyChars proc near
class VisTextClass
.enter
;
; Don't bother checking small text objects.
;
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].VTI_storageFlags, mask VTSF_LARGE
jz noLimit
;
; First, see if this is a deletion. If so, let it proceed.
;
tstdw ss:[bp].VTRP_insCount
jz noLimit
;
; Then get the char limit, if any.
;
call GetCharLimit ; cx <- char count limit
jcxz noLimit
;
; Now calculate size of the text if replace happened, and check
; if it would exceed the limit.
;
push cx
call TS_GetTextSize ; dx.ax <- # chars
movdw cxbx, ss:[bp].VTRP_range.VTR_end
subdw cxbx, ss:[bp].VTRP_range.VTR_start
subdw dxax, cxbx ;# chars - # replaced
pop cx
add ax, ss:[bp].VTRP_insCount.low ;new # chars + # insert
adc dx, ss:[bp].VTRP_insCount.high
jnz noWayJose
cmp ax, cx
ja noWayJose
noLimit:
clc
ret
noWayJose:
mov cx, handle CharLimitWarningString
mov dx, offset CharLimitWarningString
call TT_DoWarningDialog
stc
.leave
ret
CheckForTooManyChars endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetCharLimit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the maximum number of characters
CALLED BY:
PASS: nothing
RETURN: cx - max # chars, or 0 for no limit
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cassie 4/22/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetCharLimit proc near
uses ax, es
.enter
segmov es, dgroup, ax
mov cx, es:charLimit
cmp cx, -1
je initialize
done:
.leave
ret
initialize:
call TR_GetTextLimits ; cx <- char limit
jmp done
GetCharLimit endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReplaceWithoutCrossSectionCheck
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replace a range of text, without checking to see if the
replacement crosses a section break.
CALLED BY: VisTextReplaceNew
PASS: *ds:si = Instance
Override file set
ss:bp = VisTextReplaceParameters w/ range set
RETURN: carry set if we couldn't do the replacement
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 5/26/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReplaceWithoutCrossSectionCheck proc near
class VisTextClass
uses ax, bx, cx, dx, di, bp, es
.enter
call TextGStateCreate
call TS_CheckLegalChange ; Check for legal replace
cmc
LONG jc quit
EC < call TS_ECCheckParams >
;
; Do any necessary filtering
;
test ss:[bp].VTRP_flags, mask VTRF_FILTER
jz noFilter
call FilterReplacement
LONG jc quit
noFilter:
; Setup the undo items for this app.
;
call Text_DerefVis_DI
test ds:[di].VTI_features, mask VTF_ALLOW_UNDO
jz noNewUndoChain
test ss:[bp].VTRP_flags, mask VTRF_UNDO
jnz noNewUndoChain
call GenProcessUndoCheckIfIgnoring ;Don't create any undo chains
tst ax ; if actions are being
jnz noNewUndoChain ; ignored.
; If there is no current undo item, or if we are not doing typing,
; create a new chain.
mov ax, offset ReplacementString
tstdw ss:[bp].VTRP_insCount
jnz 10$
mov ax, offset DeleteString
10$:
test ss:[bp].VTRP_flags, mask VTRF_KEYBOARD_INPUT
jz createNewChain
; We are typing - see if we have a current typing undo action - if so,
; we don't want to start a new chain.
call TU_DerefUndo
mov ax, ds:[bx].VTCUI_vmChain.handle
tst ax
jnz noNewUndoChain
mov ax, offset TypingString
createNewChain:
call TU_CreateEmptyChain ;Actions will get inserted in chain
; later
noNewUndoChain:
;
; If we have an output then see if we have any text
;
call TS_GetTextSize ; dx.ax = size
mov bx, ax
or bx, dx
push bx ; Save "have text" flag
push ss:[bp].VTRP_flags
call EditUnHilite ; Remove selection hilite
call TA_UpdateRunsForReplacement ; Update the runs
;
; carry set if runs changed
; zero set if a paragraph attribute was nuked
;
pushf
;
; If we are transitioning from having a selection to not having
; a selection then we must update
;
call TSL_SelectIsCursor ;carry set if cursor
jc noRangeSelected
popf
stc
pushf
noRangeSelected:
;
; Save the current cursor-region
;
call Text_DerefVis_DI
popf
push ds:[di].VTI_cursorRegion
pushf ; Save "change" flag
;
; Update the selection based on the replacement parameters
;
call AdjustSelectionForReplacement
;
; Update any suspend range that might be hanging around...
;
call AdjustSuspendForReplacement
;
; Zero flag set if a paragraph attribute was nuked
;
call TextReplace
;
; Call SendCharAttrParaAttrChange if needed
;
popf
push dx
jc forceChange
; If we are inseting text and the cursor is now at the beginning of
; a paragraph then force an update because moving from "not start
; of paragraph" to "start of paragraph" (such as inserting a CR) can
; require an update
tstdw ss:[bp].VTRP_insCount
jz noChange
call TS_GetTextSize ; dx.ax = size
movdw cxbx, dxax
call TSL_SelectGetSelectionStart ; dxax = cursor
cmpdw cxbx, dxax
jz noChange
call TSL_IsParagraphStart
jnc noChange
forceChange:
mov ax, VIS_TEXT_STANDARD_NOTIFICATION_FLAGS
call TA_SendNotification
jmp afterNotify
noChange:
call Text_DerefVis_DI
test ds:[di].VTI_state, mask VTS_EDITABLE
jz afterNotify ; no notif if not editable
mov ax, mask VTNF_CURSOR_POSITION ; else, just send cursor pos
call TA_SendNotification
afterNotify:
pop dx
;
; Update the cursor/selection.
; dx = New cursor position
; = -1 if cursor position can't be known.
;
call TSL_SelectIsCursor ; Check for a cursor
jnc hiliteSelection
cmp dx, -1 ; Check for unknown position
je hiliteSelection
;
; The cursors final resting place is known. Put it there.
;
call Text_DerefVis_DI ; ds:di <- instance ptr
mov bx, dx ; Pass position in bx
add bx, ds:[di].VTI_leftOffset ; Adjust for scrolled object
call TSL_CursorPositionX ; Position the cursor
jmp afterHilite
hiliteSelection:
call EditHilite ; Hilite the selection
afterHilite:
;
; Update the goal-position
;
call Text_DerefVis_DI ; ds:di <- instance ptr
mov ax, ds:[di].VTI_cursorPos.P_x ; ax <- cursor position
add ax, ds:[di].VTI_leftOffset ; Adjust for scrolled object
mov ds:[di].VTI_goalPosition, ax ; Make cursor position into
; goal position.
;
; Set the minimum selection and the current selection mode.
;
call TSL_SelectGetSelectionStart ; dx.ax <- start
movdw ds:[di].VTI_selectMinStart, dxax
movdw ds:[di].VTI_selectMinEnd, dxax
and ds:[di].VTI_intSelFlags, not mask VTISF_SELECTION_TYPE
pop ax ; ax <- old cursor region
call TSL_UpdateCursorRegion ; Update the cursor region
;
; Display the cursor/selection on screen.
;
clr bp ; We are not dragging
call TSL_SelectGetSelectionStart ; dx.ax <- position to show
call TextCallShowSelection ; Force selection on visible
;
; if the replace was due to a user action then mark the object as
; user modified, otherwise mark the object as not user modified
;
pop cx ;CX <- flags
test cx, mask VTRF_USER_MODIFICATION
jnz modified
call TextMarkNotUserModified
jmp common
modified:
call TextMarkUserModified
common:
pop cx ; Restore "have text" flag
;
; Send EMPTY_STATUS_CHANGED if needed
;
call TS_GetTextSize
or ax, dx ; ax = "have text now" flag
jnz haveTextNow
jcxz noEmptyChange
jmp emptyChange
haveTextNow:
tst cx
jnz noEmptyChange
emptyChange:
mov_tr bp, ax ; bp = "have text now" flag
mov ax, MSG_META_TEXT_EMPTY_STATUS_CHANGED
call Text_ObjCallInstanceNoLock_save_cxdxbp
noEmptyChange:
clc ; Signal: replace succeeded
quit:
pushf ; Save "error" flag
call TextGStateDestroy
popf ; Restore "error" flag
.leave
ret
ReplaceWithoutCrossSectionCheck endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AdjustSelectionForReplacement
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Adjust the selection after a replace operation.
CALLED BY: VisTextReplace, VisTextReplaceWithTransferItem
PASS: ds:*si = instance ptr
ss:bp = VisTextReplaceParameters
RETURN: nothing
DESTROYED: nothing, flags preserved
PSEUDO CODE/STRATEGY:
There are a few kinds of replacements:
1) Paste
2) Quick move/copy
3) Normal (editing, etc)
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 4/ 6/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AdjustSelectionForReplacement proc far
class VisTextClass
uses bx, di
.enter
pushf
call Text_DerefVis_DI ; ds:di <- instance ptr.
ExtractField byte, ds:[di].VTI_intFlags, VTIF_ADJUST_TYPE, bl
clr bh
shl bx, 1 ; Use bx as index into table
call cs:adjustSelectionForReplacementHandlers[bx]
popf
.leave
ret
AdjustSelectionForReplacement endp
adjustSelectionForReplacementHandlers word \
offset cs:AdjustSelectionNormal, ; AT_NORMAL
offset cs:AdjustSelectionPaste, ; AT_PASTE
offset cs:AdjustSelectionQuick ; AT_QUICK
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AdjustSelectionNormal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Adjust a selection in a normal fashion.
CALLED BY: AdjustSelectionForReplacement via adjustSelectionHandlers
PASS: ds:di = Instance ptr
ss:bp = VisTextReplaceParameters
RETURN: Selection updated
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
if changePos > selectStart
no change
else if changePos == selectStart
selectStart = changePos+insCount
else if (changePos + delCount) > selectStart
selectStart += insCount-delCount
endif
if changePos > selectEnd
no change
else if (changePos == selectEnd
selectEnd = changePos+insCount
else if (changePos + delCount) > selectEnd
selectEnd += insCount-delCount
endif
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/21/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AdjustSelectionNormal proc near
uses ax, bx, cx, dx
.enter
;
; Get the selection start and update it.
;
call TSL_SelectGetSelection ; dx.ax <- select start
; cx.bx <- select end
call AdjustOffsetNormal ; dx.ax <- adjusted start
xchgdw dxax, cxbx ; dx.ax <- select end
; cx.bx <- adjusted start
call AdjustOffsetNormal ; dx.ax <- adjusted end
xchgdw dxax, cxbx ; dx.ax <- adjusted start
; cx.bx <- adjusted end
call TSL_SelectSetSelectionWithoutNukingUndo
.leave
ret
AdjustSelectionNormal endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AdjustOffsetNormal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Adjust an offset in a "normal" fashion.
CALLED BY: AdjustSelectionNormal
PASS: dx.ax = Offset to adjust
ss:bp = VisTextReplaceParameters
RETURN: dx.ax = Adjusted offset
DESTROYED: nothign
PSEUDO CODE/STRATEGY:
Here are the cases:
1) offset before changed area
X +--del--+
Do nothing
2) offset after changed area
+--del--+ X
offset = offset - (changeEnd - changeStart) + insCount
3) offset in changed area
+--del--X--+
offset = changePos + insCount
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/21/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AdjustOffsetNormal proc near
.enter
cmpdw dxax, ss:[bp].VTRP_range.VTR_start
jb quit ; Branch if offset before change
;
; The offset to adjust is after the change position.
;
cmpdw dxax, ss:[bp].VTRP_range.VTR_end
ja adjustAfterRange
;
; Offset is in the range.
;
movdw dxax, ss:[bp].VTRP_range.VTR_start
adddw dxax, ss:[bp].VTRP_insCount
quit:
.leave
ret
adjustAfterRange:
subdw dxax, ss:[bp].VTRP_range.VTR_end
adddw dxax, ss:[bp].VTRP_range.VTR_start
adddw dxax, ss:[bp].VTRP_insCount
jmp quit
AdjustOffsetNormal endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AdjustSelectionPaste
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Adjust a selection after a paste
CALLED BY: AdjustSelectionForReplacement via adjustSelectionHandlers
PASS: ds:di = Instance ptr
ss:bp = VisTextReplaceParameters
RETURN: Selection updated
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
After a paste the selection becomes a cursor after the paste position.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/21/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AdjustSelectionPaste proc near
uses ax, bx, cx, dx
.enter
movdw dxax, ss:[bp].VTRP_range.VTR_start
adddw dxax, ss:[bp].VTRP_insCount ; dx.ax <- after change pos
;
; Save the position in selectStart/End
;
movdw cxbx, dxax ; cx.bx <- same position
call TSL_SelectSetSelectionWithoutNukingUndo
.leave
ret
AdjustSelectionPaste endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AdjustSelectionQuick
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Adjust a selection after a quick move or copy.
CALLED BY: AdjustSelectionForReplacement via adjustSelectionHandlers
PASS: ds:di = Instance ptr
ss:bp = VisTextReplaceParameters
RETURN: Selection updated
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
After a quick-move/copy we select the range.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 11/21/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AdjustSelectionQuick proc near
uses ax, bx, cx, dx
.enter
; dx.ax <- change position
; cx.bx <- after change pos
movdw dxax, ss:[bp].VTRP_range.VTR_start
movdw cxbx, ss:[bp].VTRP_range.VTR_end
adddw cxbx, ss:[bp].VTRP_insCount
call TSL_SelectSetSelectionWithoutNukingUndo
.leave
ret
AdjustSelectionQuick endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AdjustSuspendForReplacement
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Adjust the start/end suspend offsets after a replacement.
CALLED BY: VisTextReplaceNew
PASS: *ds:si = Instance
ss:bp = VisTextReplaceParameters
zero flag set if a paragraph attribute was nuked
RETURN: Suspend offsets updated
DESTROYED: nothing, flags preserved
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 5/11/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AdjustSuspendForReplacement proc near
class VisTextClass
uses ax, bx, cx, dx
.enter
pushf
mov ax, ATTR_VIS_TEXT_SUSPEND_DATA ; ax <- data to find
call ObjVarFindData ; ds:bx <- VisTextSuspendData
LONG jnc quit ; Branch if no such data
mov ds:[bx].VTSD_needsRecalc, BB_TRUE
;-----------------------------------------------------------------------------
; Update Start
;-----------------------------------------------------------------------------
;
; We update the start becomes the minimum of the old start and
; the change position... Unless of course the end is zero, in which
; case we haven't actually made any change yet, and we therefore
; set the start to whatever the range is currently.
;
tstdw ds:[bx].VTSD_recalcRange.VTR_end
jz setStart
movdw dxax, ds:[bx].VTSD_recalcRange.VTR_start
cmpdw dxax, ss:[bp].VTRP_range.VTR_start
jbe gotStart
setStart:
movdw dxax, ss:[bp].VTRP_range.VTR_start
gotStart:
movdw ds:[bx].VTSD_recalcRange.VTR_start, dxax
;-----------------------------------------------------------------------------
; Update End
;-----------------------------------------------------------------------------
;
; The problem here is that the VTSD_range really isn't like a cursor.
; It really doesn't accurately reflect the area that needs changing.
; If this is the first call here, the end of the range is zero.
; Adjusting this position is the wrong thing to do.
;
; Imagine the case where the change is made to text at offset 10 by
; inserting 5 characters. No adjustment will be done for an offset
; of zero (it falls before the position of the change) so the end
; of the range will be set to zero. Clearly we really want the end
; of the range to be set to 15 sinc that is the last affected character
; offset.
;
; How do we do this? We do it by setting the end of the range to the
; maximum of the current end and the position of the change.
;
movdw dxax, ss:[bp].VTRP_range.VTR_start
; was-> cmpdw ds:[bx].VTSD_range.VTR_end, dxax
cmpdw ds:[bx].VTSD_recalcRange.VTR_end, dxax
jae gotTempEnd
; was-> movdw ds:[bx].VTSD_range.VTR_end, dxax
movdw ds:[bx].VTSD_recalcRange.VTR_end, dxax
gotTempEnd:
; make sure that the end is in range
call TS_GetTextSize ;dxax = size
adddw dxax, ss:[bp].VTRP_range.VTR_start
subdw dxax, ss:[bp].VTRP_range.VTR_end
adddw dxax, ss:[bp].VTRP_insCount
cmpdw dxax, ds:[bx].VTSD_recalcRange.VTR_start
jae afterStartCheck
movdw ds:[bx].VTSD_recalcRange.VTR_start, dxax
afterStartCheck:
cmpdw dxax, ds:[bx].VTSD_recalcRange.VTR_end
jae afterEndCheck
movdw ds:[bx].VTSD_recalcRange.VTR_end, dxax
afterEndCheck:
;
; Not so fast... If the change nuked a paragraph attribute, we need
; to compute past the end of the change. This "end" can be gotten
; by scanning from the current end to the end of the next paragraph.
;
popf ; Zero set if para-attr nuked
pushf
jnz gotEndIGuess ; Branch if not nuked
;
; A paragraph attribute was nuked... find the new "end"
;
movdw dxax, ds:[bx].VTSD_recalcRange.VTR_end
call TSL_FindParagraphEnd ; dx.ax <- end of paragraph
movdw ds:[bx].VTSD_recalcRange.VTR_end, dxax
gotEndIGuess:
;
; We update the end as though it were part of the selection
;
movdw dxax, ds:[bx].VTSD_recalcRange.VTR_end
call AdjustOffsetNormal ; Update the end
;
; We add one special case to this... an end offset of zero is taken
; as an indicator that nothing actually changed. For this reason
; we never allow the end offset to be zero.
;
tstdw dxax
jnz gotEnd
inc ax
gotEnd:
movdw ds:[bx].VTSD_recalcRange.VTR_end, dxax
quit:
popf
.leave
ret
AdjustSuspendForReplacement endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TextMarkUserModified
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Mark the object user modified and send a MSG_META_TEXT_USER_MODIFIED
if needed
CALLED BY: Utility
PASS: *ds:si = Text instance
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
tony 11/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TextMarkUserModified proc far uses ax, di
class VisTextClass
.enter
call Text_DerefVis_DI
test ds:[di].VTI_state, mask VTS_USER_MODIFIED
jnz alreadyModified
;
; We made the object dirty for the first time, send out a method
;
ornf ds:[di].VTI_state, mask VTS_USER_MODIFIED
mov di, 1000
call ThreadBorrowStackSpace
mov ax, MSG_META_TEXT_USER_MODIFIED
call Text_ObjCallInstanceNoLock_save_cxdxbp
call ThreadReturnStackSpace
alreadyModified:
.leave
ret
TextMarkUserModified endp
;---
if ERROR_CHECK
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckStringForImbeddedNull
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Make sure that there are no nulls in the string we are
appending.
CALLED BY: GLOBAL
PASS: dx:bp - ptr to string
cx - # bytes
RETURN: nada
DESTROYED: nada
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 8/13/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CheckStringForImbeddedNull proc far uses ax, cx, es, di
jcxz exit ;Exit if null-terminated
.enter
movdw esdi, dxbp
SBCS < clr al >
DBCS < clr ax >
SBCS < repne scasb >
DBCS < repne scasw >
EC < ERROR_Z TEXT_STRING_CONTAINS_NULL >
.leave
exit:
ret
CheckStringForImbeddedNull endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextReplaceAllPtr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replace all the text in an object with text referenced by
a pointer.
CALLED BY: via MSG_VIS_TEXT_REPLACE_ALL_PTR
PASS: *ds:si = Instance ptr
dx:bp = Text pointer
cx = Size, 0 if null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/ 7/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextReplaceAllPtr method dynamic VisTextClass,
MSG_VIS_TEXT_REPLACE_ALL_PTR
if ERROR_CHECK
;
; Validate that the text is not in a movable code segment
;
FXIP< push bx, si >
FXIP< mov bx, dx >
FXIP< mov si, bp >
FXIP< call ECAssertValidFarPointerXIP >
FXIP< pop bx, si >
endif
EC < call CheckStringForImbeddedNull >
; optimize here -- if the text is the same then do nothing
test ds:[di].VTI_storageFlags, mask VTSF_LARGE
jnz noOptimize
push cx, si, es
mov si, ds:[di].VTI_text
mov si, ds:[si] ;ds:si = existing text
ChunkSizePtr ds, si, cx ;cx = size
DBCS < shr cx, 1 >
movdw esdi, dxbp
SBCS < repe cmpsb >
DBCS < repe cmpsw >
pop cx, si, es
jz noChange
noOptimize:
xchg dx, bp ; Offset first, then segment
mov ax, TRT_POINTER
GOTO ReplaceAllWithSomething
noChange:
FALL_THRU TextMarkNotUserModified
VisTextReplaceAllPtr endm
TextMarkNotUserModified proc far uses ax, di
class VisTextClass
.enter
call Text_DerefVis_DI
test ds:[di].VTI_state, mask VTS_USER_MODIFIED
jz alreadyNotModified
;
; We made the object dirty for the first time, send out a method
;
andnf ds:[di].VTI_state, not mask VTS_USER_MODIFIED
mov ax, MSG_META_TEXT_NOT_USER_MODIFIED
call Text_ObjCallInstanceNoLock_save_cxdxbp
alreadyNotModified:
.leave
ret
TextMarkNotUserModified endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextReplaceAllOptr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replace all the text in an object with text referenced by
an optr.
CALLED BY: via MSG_VIS_TEXT_REPLACE_ALL_OPTR
PASS: *ds:si = Instance ptr
dx = Block handle
bp = Chunk handle
cx = Size, 0 if null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/ 7/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextReplaceAllOptr method dynamic VisTextClass,
MSG_VIS_TEXT_REPLACE_ALL_OPTR
xchg dx, bp ; Chunk first, then block
mov ax, TRT_OPTR
GOTO ReplaceAllWithSomething
VisTextReplaceAllOptr endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextReplaceAllBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replace all the text in an object with text referenced by
a handle.
CALLED BY: via MSG_VIS_TEXT_REPLACE_ALL_BLOCK
PASS: *ds:si = Instance ptr
dx = Block handle
cx = Size, 0 if null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/ 7/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextReplaceAllBlock method dynamic VisTextClass,
MSG_VIS_TEXT_REPLACE_ALL_BLOCK
mov ax, TRT_BLOCK
GOTO ReplaceAllWithSomething
VisTextReplaceAllBlock endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextReplaceAllVMBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replace all the text in an object with text referenced by
a vm-block.
CALLED BY: via MSG_VIS_TEXT_REPLACE_ALL_VM_BLOCK
PASS: *ds:si = Instance ptr
dx = VM-Block handle
cx = Size, 0 if null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/ 7/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextReplaceAllVMBlock method dynamic VisTextClass,
MSG_VIS_TEXT_REPLACE_ALL_VM_BLOCK
mov ax, TRT_VM_BLOCK
GOTO ReplaceAllWithSomething
VisTextReplaceAllVMBlock endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextReplaceAllDBItem
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replace all the text in an object with text referenced by
a db-item. The text is assumed to be null terminated
CALLED BY: via MSG_VIS_TEXT_REPLACE_ALL_VM_BLOCK
PASS: *ds:si = Instance ptr
dx = File handle
bp = Group
cx = Item
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/ 7/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextReplaceAllDBItem method dynamic VisTextClass,
MSG_VIS_TEXT_REPLACE_ALL_DB_ITEM
mov di, cx ; di <- 3rd word of data
clr cx ; Null terminated
xchg bp, di ; Item first, then group
mov ax, TRT_DB_ITEM
GOTO ReplaceAllWithSomething
VisTextReplaceAllDBItem endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextReplaceAllHugeArray
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replace all the text in an object with text referenced by
a huge-array.
CALLED BY: via MSG_VIS_TEXT_REPLACE_ALL_VM_BLOCK
PASS: *ds:si = Instance ptr
dx = File handle
bp = Array handle
cx = Size, 0 if null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/ 7/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextReplaceAllHugeArray method dynamic VisTextClass,
MSG_VIS_TEXT_REPLACE_ALL_HUGE_ARRAY
mov ax, TRT_HUGE_ARRAY
FALL_THRU ReplaceAllWithSomething
VisTextReplaceAllHugeArray endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReplaceAllWithSomething
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replace all the text in an object with something.
CALLED BY: VisTextReplaceAll*
PASS: *ds:si = Instance ptr
ax = TextReferenceType
dx,bp,di= Parameters
cx = Size, 0 for null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/ 7/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReplaceAllWithSomething proc far
mov bx, bp ; bx <- parameter passed in bp
sub sp, size VisTextReplaceParameters
mov bp, sp ; ss:bp <- frame
clrdw ss:[bp].VTRP_range.VTR_start
movdw ss:[bp].VTRP_range.VTR_end, TEXT_ADDRESS_PAST_END
mov ss:[bp].VTRP_insCount.high, 0
mov ss:[bp].VTRP_insCount.low, cx
mov ss:[bp].VTRP_flags, 0
;
; If the passed size is zero then we want to compute the length
;
tst cx ; Check for zero sized
jnz gotSize
mov ss:[bp].VTRP_insCount.high, INSERT_COMPUTE_TEXT_LENGTH
gotSize:
;
; Fill in the frame...
;
mov ss:[bp].VTRP_textReference.TR_type, ax
mov {word} ss:[bp].VTRP_textReference.TR_ref, dx
mov {word} ss:[bp].VTRP_textReference.TR_ref[2], bx
mov {word} ss:[bp].VTRP_textReference.TR_ref[4], di
;
; Do the replace
;
call VisTextReplaceNew
add sp, size VisTextReplaceParameters
ret
ReplaceAllWithSomething endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextReplaceSelectionPtr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replace the selection with text referenced by a pointer.
CALLED BY: via MSG_VIS_TEXT_REPLACE_SELECTION_PTR
PASS: *ds:si = Instance ptr
dx:bp = Text pointer
cx = Size, 0 if null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextReplaceSelectionPtr method VisTextClass,
MSG_VIS_TEXT_REPLACE_SELECTION_PTR
if ERROR_CHECK
;
; Validate that the text is not in a movable code segment
;
FXIP< push bx, si >
FXIP< mov bx, dx >
FXIP< mov si, bp >
FXIP< call ECAssertValidFarPointerXIP >
FXIP< pop bx, si >
endif
EC < call CheckStringForImbeddedNull >
xchg dx, bp ; Offset first, then segment
mov ax, TRT_POINTER
GOTO ReplaceSelectionWithSomething
VisTextReplaceSelectionPtr endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextReplaceSelectionOptr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replace the selection in an object with text referenced by
an optr.
CALLED BY: via MSG_VIS_TEXT_REPLACE_SELECTION_OPTR
PASS: *ds:si = Instance ptr
dx = Block handle
bp = Chunk handle
cx = Size, 0 if null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextReplaceSelectionOptr method dynamic VisTextClass,
MSG_VIS_TEXT_REPLACE_SELECTION_OPTR
xchg dx, bp ; Block first, then chunk
mov ax, TRT_OPTR
GOTO ReplaceSelectionWithSomething
VisTextReplaceSelectionOptr endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextReplaceSelectionBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replace the selection in an object with text referenced by
a handle.
CALLED BY: via MSG_VIS_TEXT_REPLACE_SELECTION_BLOCK
PASS: *ds:si = Instance ptr
dx = Block handle
cx = Size, 0 if null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextReplaceSelectionBlock method dynamic VisTextClass,
MSG_VIS_TEXT_REPLACE_SELECTION_BLOCK
mov ax, TRT_BLOCK
GOTO ReplaceSelectionWithSomething
VisTextReplaceSelectionBlock endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextReplaceSelectionVMBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replace the selection in an object with text referenced by
a vm-block.
CALLED BY: via MSG_VIS_TEXT_REPLACE_SELECTION_VM_BLOCK
PASS: *ds:si = Instance ptr
dx = VM-Block handle
cx = Size, 0 if null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextReplaceSelectionVMBlock method dynamic VisTextClass,
MSG_VIS_TEXT_REPLACE_SELECTION_VM_BLOCK
mov ax, TRT_VM_BLOCK
GOTO ReplaceSelectionWithSomething
VisTextReplaceSelectionVMBlock endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextReplaceSelectionDBItem
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replace the selection in an object with text referenced by
a db-item. The text is assumed to be null terminated
CALLED BY: via MSG_VIS_TEXT_REPLACE_SELECTION_DB_ITEM
PASS: *ds:si = Instance ptr
dx = File handle
bp = Group
cx = Item
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextReplaceSelectionDBItem method dynamic VisTextClass,
MSG_VIS_TEXT_REPLACE_SELECTION_DB_ITEM
mov di, cx ; di <- 3rd word of data
clr cx ; Null terminated
xchg bp, di ; Item first, then group
mov ax, TRT_DB_ITEM
GOTO ReplaceSelectionWithSomething
VisTextReplaceSelectionDBItem endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextReplaceSelectionHugeArray
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replace the selection in an object with text referenced by
a huge-array.
CALLED BY: via MSG_VIS_TEXT_REPLACE_SELECTION_HUGE_ARRAY
PASS: *ds:si = Instance ptr
dx = File handle
bp = Array handle
cx = Size, 0 if null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextReplaceSelectionHugeArray method dynamic VisTextClass,
MSG_VIS_TEXT_REPLACE_SELECTION_HUGE_ARRAY
mov ax, TRT_HUGE_ARRAY
FALL_THRU ReplaceSelectionWithSomething
VisTextReplaceSelectionHugeArray endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReplaceSelectionWithSomething
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replace the selection with some text.
CALLED BY: VisTextReplaceSelection*
PASS: *ds:si = Instance ptr
ax = TextReferenceType
dx,bp,di= Values to pass in the stack frame
cx = Size, 0 for null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReplaceSelectionWithSomething proc far
mov bx, bp ; bx <- parameter passed in bp
sub sp, size VisTextReplaceParameters
mov bp, sp ; ss:bp <- frame
mov ss:[bp].VTRP_range.VTR_start.high, VIS_TEXT_RANGE_SELECTION
mov ss:[bp].VTRP_insCount.high, 0
mov ss:[bp].VTRP_insCount.low, cx
mov ss:[bp].VTRP_flags, 0
;
; If the passed size is zero then we want to compute the length
;
tst cx ; Check for zero sized
jnz gotSize
mov ss:[bp].VTRP_insCount.high, INSERT_COMPUTE_TEXT_LENGTH
gotSize:
;
; Fill in the frame...
;
mov ss:[bp].VTRP_textReference.TR_type, ax
mov {word} ss:[bp].VTRP_textReference.TR_ref, dx
mov {word} ss:[bp].VTRP_textReference.TR_ref[2], bx
mov {word} ss:[bp].VTRP_textReference.TR_ref[4], di
;
; Do the replace
;
call VisTextReplaceNew
add sp, size VisTextReplaceParameters
ret
ReplaceSelectionWithSomething endp
TextSetReplace ends
TextInstance segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextAppendPtr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Append with text referenced by a pointer.
CALLED BY: via MSG_VIS_TEXT_APPEND_PTR
PASS: *ds:si = Instance ptr
dx:bp = Text pointer
cx = Size, 0 if null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextAppendPtr method dynamic VisTextClass, MSG_VIS_TEXT_APPEND_PTR
if ERROR_CHECK
;
; Validate that the text is not in a movable code segment
;
FXIP< push bx, si >
FXIP< mov bx, dx >
FXIP< mov si, bp >
FXIP< call ECAssertValidFarPointerXIP >
FXIP< pop bx, si >
endif
EC < call CheckStringForImbeddedNull >
xchg dx, bp ; Offset first, then segment
mov ax, TRT_POINTER
GOTO AppendWithSomething
VisTextAppendPtr endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextAppendOptr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Append to an object with text referenced by an optr.
CALLED BY: via MSG_VIS_TEXT_APPEND_OPTR
PASS: *ds:si = Instance ptr
dx = Block handle
bp = Chunk handle
cx = Size, 0 if null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextAppendOptr method dynamic VisTextClass,
MSG_VIS_TEXT_APPEND_OPTR
xchg dx, bp ; Block first, then chunk
mov ax, TRT_OPTR
GOTO AppendWithSomething
VisTextAppendOptr endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextAppendBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Append to an object with text referenced by a handle.
CALLED BY: via MSG_VIS_TEXT_APPEND_BLOCK
PASS: *ds:si = Instance ptr
dx = Block handle
cx = Size, 0 if null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextAppendBlock method dynamic VisTextClass, MSG_VIS_TEXT_APPEND_BLOCK
mov ax, TRT_BLOCK
GOTO AppendWithSomething
VisTextAppendBlock endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextAppendVMBlock
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Append to an object with text referenced by a vm-block.
CALLED BY: via MSG_VIS_TEXT_APPEND_VM_BLOCK
PASS: *ds:si = Instance ptr
dx = VM-Block handle
cx = Size, 0 if null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextAppendVMBlock method dynamic VisTextClass,
MSG_VIS_TEXT_APPEND_VM_BLOCK
mov ax, TRT_VM_BLOCK
GOTO AppendWithSomething
VisTextAppendVMBlock endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextAppendDBItem
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Append to an object with text referenced by a db-item.
The text is assumed to be null terminated
CALLED BY: via MSG_VIS_TEXT_APPEND_DB_ITEM
PASS: *ds:si = Instance ptr
dx = File handle
bp = Group
cx = Item
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextAppendDBItem method dynamic VisTextClass,
MSG_VIS_TEXT_APPEND_DB_ITEM
mov di, cx ; di <- 3rd word of data
clr cx ; Null terminated
xchg bp, di ; Item first, then group
mov ax, TRT_DB_ITEM
GOTO AppendWithSomething
VisTextAppendDBItem endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextAppendHugeArray
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Append to an object with text referenced by a huge-array.
CALLED BY: via MSG_VIS_TEXT_APPEND_HUGE_ARRAY
PASS: *ds:si = Instance ptr
dx = File handle
bp = Array handle
cx = Size, 0 if null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextAppendHugeArray method dynamic VisTextClass,
MSG_VIS_TEXT_APPEND_HUGE_ARRAY
mov ax, TRT_HUGE_ARRAY
FALL_THRU AppendWithSomething
VisTextAppendHugeArray endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AppendWithSomething
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Append with some text.
CALLED BY: VisTextAppend*
PASS: *ds:si = Instance ptr
ax = TextReferenceType
dx,bp,di= Values to pass in the stack frame
cx = Size, 0 for null terminated
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AppendWithSomething proc far
mov bx, bp ; bx <- parameter passed in bp
sub sp, size VisTextReplaceParameters
mov bp, sp ; ss:bp <- frame
movdw ss:[bp].VTRP_range.VTR_start, TEXT_ADDRESS_PAST_END
movdw ss:[bp].VTRP_range.VTR_end, TEXT_ADDRESS_PAST_END
mov ss:[bp].VTRP_insCount.high, 0
mov ss:[bp].VTRP_insCount.low, cx
mov ss:[bp].VTRP_flags, 0
;
; If the passed size is zero then we want to compute the length
;
tst cx ; Check for zero sized
jnz gotSize
mov ss:[bp].VTRP_insCount.high, INSERT_COMPUTE_TEXT_LENGTH
gotSize:
;
; Fill in the frame...
;
mov ss:[bp].VTRP_textReference.TR_type, ax
mov {word} ss:[bp].VTRP_textReference.TR_ref, dx
mov {word} ss:[bp].VTRP_textReference.TR_ref[2], bx
mov {word} ss:[bp].VTRP_textReference.TR_ref[4], di
;
; Do the replace
;
call VisTextReplaceNew
add sp, size VisTextReplaceParameters
ret
AppendWithSomething endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextDeleteRangeOfChars
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Deletes a range of characters from the text object
CALLED BY: GLOBAL
PASS: ss:bp - VisTextRange of chars to delete
RETURN: nada
DESTROYED: nada
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 10/26/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextDeleteRangeOfChars method VisTextClass,
MSG_META_DELETE_RANGE_OF_CHARS
movdw dxax, ss:[bp].VTR_start
movdw cxbx, ss:[bp].VTR_end
sub sp, size VisTextReplaceParameters
mov bp, sp ; ss:bp <- frame ptr
movdw ss:[bp].VTRP_range.VTR_start, dxax
movdw ss:[bp].VTRP_range.VTR_end, cxbx
clrdw ss:[bp].VTRP_insCount
mov ss:[bp].VTRP_flags, mask VTRF_FILTER or \
mask VTRF_USER_MODIFICATION
call VisTextReplaceNew
add sp, size VisTextReplaceParameters
ret
VisTextDeleteRangeOfChars endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextDeleteAll
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Delete all the text in an object.
CALLED BY: via MSG_VIS_TEXT_DELETE_ALL
PASS: *ds:si = Instance ptr
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextDeleteAll method dynamic VisTextClass,
MSG_VIS_TEXT_DELETE_ALL
sub sp, size VisTextReplaceParameters
mov bp, sp ; ss:bp <- frame ptr
clr ax
clrdw ss:[bp].VTRP_range.VTR_start, ax
movdw ss:[bp].VTRP_range.VTR_end, TEXT_ADDRESS_PAST_END
clrdw ss:[bp].VTRP_insCount, ax
mov ss:[bp].VTRP_flags, ax
call VisTextReplaceNew
add sp, size VisTextReplaceParameters
ret
VisTextDeleteAll endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextDelete
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Deletes the current selection
CALLED BY: GLOBAL
PASS: nada
RETURN: nada
DESTROYED: nada
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 11/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextDelete method VisTextClass, MSG_META_DELETE
mov ax, mask VTRF_USER_MODIFICATION or mask VTRF_FILTER
GOTO DeleteSelectionCommon
VisTextDelete endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VisTextDeleteSelection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Delete the selection in an object.
CALLED BY: via MSG_VIS_TEXT_DELETE_SELECTION
PASS: *ds:si = Instance ptr
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 2/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VisTextDeleteSelection method dynamic VisTextClass,
MSG_VIS_TEXT_DELETE_SELECTION
clr ax
FALL_THRU DeleteSelectionCommon
VisTextDeleteSelection endm
DeleteSelectionCommon proc far
if DBCS_PCGEOS
EC < mov di, 1000 >
EC < call ThreadBorrowStackSpace >
EC < push di >
endif
sub sp, size VisTextReplaceParameters
mov bp, sp ; ss:bp <- frame ptr
mov ss:[bp].VTRP_range.VTR_start.high, VIS_TEXT_RANGE_SELECTION
clrdw ss:[bp].VTRP_insCount
mov ss:[bp].VTRP_flags, ax
call VisTextReplaceNew
add sp, size VisTextReplaceParameters
if DBCS_PCGEOS
EC < pop di >
EC < call ThreadReturnStackSpace >
endif
ret
DeleteSelectionCommon endp
TextInstance ends
|
3-mid/impact/source/3d/dynamics/joints/impact-d3-constraint_solver.ads | charlie5/lace | 20 | 25433 | <gh_stars>10-100
with impact.d3.Object,
impact.d3.Manifold,
impact.d3.Joint,
impact.d3.contact_solver_Info,
impact.d3.Dispatcher;
package impact.d3.constraint_Solver
--
-- impact.d3.constraint_Solver provides solver interface.
--
is
type Item is abstract tagged private;
type View is access all Item'Class;
procedure destruct (Self : in out Item) is null;
procedure prepareSolve (Self : in out Item; numBodies : in Integer;
numManifolds : in Integer)
is null;
function solveGroup (Self : access Item; bodies : access impact.d3.Object.Vector;
manifold : access impact.d3.Manifold.Vector;
constraints : access impact.d3.Joint.Vector;
info : in impact.d3.contact_solver_Info.Item'Class;
dispatcher : in impact.d3.Dispatcher.item'Class) return math.Real
is abstract;
--
-- Solve a group of constraints.
procedure allSolved (Self : in out Item; info : in impact.d3.contact_solver_Info.Item'Class)
is null;
procedure reset (Self : in out Item)
is abstract;
--
-- Clear internal cached data and reset random seed.
private
type Item is abstract tagged null record;
end impact.d3.constraint_Solver;
|
Irvine/Examples/ch04/64 bit/SumArray_64.asm | alieonsido/ASM_TESTING | 0 | 168353 | <reponame>alieonsido/ASM_TESTING
; Summing an Array (SumArray_64.asm)
; This program sums an array of words.
; The LOOP instruction requires the /LARGEADDRESSAWARE linker switch to equal NO.
ExitProcess proto
.data
intarray QWORD 1000000000000h,2000000000000h
QWORD 3000000000000h,4000000000000h
.code
main proc
mov rdi,OFFSET intarray ; 1: RDI = address of intarray
mov rcx,LENGTHOF intarray ; 2: initialize loop counter
mov rax,0 ; 3: sum = 0
L1: ; 4: mark beginning of loop
add rax,[rdi] ; 5: add an integer
add rdi,TYPE intarray ; 6: point to next element
loop L1 ; 7: repeat until RCX = 0
mov ecx,0 ; ExitProcess return value
call ExitProcess
main endp
end |
mc-sema/validator/x86_64/tests/AND32mr.asm | randolphwong/mcsema | 2 | 13339 | <reponame>randolphwong/mcsema
BITS 64
;TEST_FILE_META_BEGIN
;TEST_TYPE=TEST_F
;TEST_IGNOREFLAGS=FLAG_AF
;TEST_FILE_META_END
; AND32mr
;TEST_BEGIN_RECORDING
lea rax, [rsp-0x4]
mov DWORD [rax], 0x55555
mov ebx, 0x77777
and DWORD [rax], ebx
mov eax, 0x0
;TEST_END_RECORDING
|
oeis/157/A157863.asm | neoneye/loda-programs | 11 | 163325 | <gh_stars>10-100
; A157863: a(n) = 103680000*n^2 + 28800*n + 1.
; 103708801,414777601,933206401,1658995201,2592144001,3732652801,5080521601,6635750401,8398339201,10368288001,12545596801,14930265601,17522294401,20321683201,23328432001,26542540801,29964009601,33592838401,37429027201,41472576001,45723484801,50181753601,54847382401,59720371201,64800720001,70088428801,75583497601,81285926401,87195715201,93312864001,99637372801,106169241601,112908470401,119855059201,127009008001,134370316801,141938985601,149715014401,157698403201,165889152001,174287260801
seq $0,157862 ; a(n) = 1728000*n + 240.
pow $0,2
sub $0,2986813497600
div $0,28800
add $0,103708801
|
notes/papers/implicit/examples/Dangerous-Agda1.agda | shlevy/agda | 1,989 | 5081 |
data N : Set = zero | suc (n:N)
data B : Set = true | false
data False : Set =
data True : Set = tt
F : B -> Set
F true = N
F false = B
G : (x:B) -> F x -> Set
G false _ = N
G true zero = B
G true (suc n) = N
(==) : B -> B -> Set
true == true = True
false == false = True
_ == _ = False
data Equal (x,y:B) : Set where
equal : x == y -> Equal x y
refl : (x:B) -> Equal x x
refl true = equal tt
refl false = equal tt
postulate
f : (x:B) -> (y : F x) -> G x y -> N -- Equal x true -> N
h : N
h = f _ false zero --(refl true)
|
libsrc/_DEVELOPMENT/adt/bv_stack/c/sccz80/bv_stack_destroy.asm | teknoplop/z88dk | 8 | 169828 | <gh_stars>1-10
; void bv_stack_destroy(bv_stack_t *s)
SECTION code_clib
SECTION code_adt_bv_stack
PUBLIC bv_stack_destroy
EXTERN asm_bv_stack_destroy
defc bv_stack_destroy = asm_bv_stack_destroy
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1786.asm | ljhsiun2/medusa | 9 | 20403 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0xc04a, %rsi
lea addresses_A_ht+0x173ca, %rdi
nop
nop
nop
nop
nop
cmp $24131, %r12
mov $61, %rcx
rep movsq
cmp %r15, %r15
pop %rsi
pop %rdi
pop %rcx
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %rax
push %rbp
push %rcx
push %rdx
// Store
lea addresses_US+0x3fca, %rdx
clflush (%rdx)
nop
nop
nop
nop
nop
xor $4326, %rbp
movb $0x51, (%rdx)
nop
nop
nop
add %r10, %r10
// Load
lea addresses_A+0xf7ca, %r10
dec %rax
mov (%r10), %bp
inc %rdx
// Store
mov $0x7ca, %r12
nop
nop
nop
sub $36990, %rcx
movb $0x51, (%r12)
nop
nop
xor $44647, %rdx
// Store
lea addresses_A+0xeca, %rax
clflush (%rax)
nop
nop
nop
nop
add $13415, %r10
movl $0x51525354, (%rax)
nop
cmp $7119, %rax
// Faulty Load
lea addresses_RW+0x3ca, %r14
xor %rbp, %rbp
mov (%r14), %edx
lea oracles, %r14
and $0xff, %rdx
shlq $12, %rdx
mov (%r14,%rdx,1), %rdx
pop %rdx
pop %rcx
pop %rbp
pop %rax
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_RW', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 10}}
{'src': {'type': 'addresses_A', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 7}}
[Faulty Load]
{'src': {'type': 'addresses_RW', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
Chapter2/#1.agda | CodaFi/HoTT-Exercises | 0 | 15880 | {-# OPTIONS --without-K #-}
module #1 where
open import Relation.Binary.PropositionalEquality
{-
Exercise 2.1. Show that the three obvious proofs of Lemma 2.1.2 are pairwise equal.
-}
ind₌ : ∀{a b}{A : Set a} → (C : (x y : A) → (x ≡ y) → Set b) → ((x : A) → C x x refl) → {x y : A} → (p : x ≡ y) → C x y p
ind₌ C c {x}{y} p rewrite p = c y
composite : ∀ {i} {A : Set i}{x y z : A} → (x ≡ y) → (y ≡ z) → (x ≡ z)
composite {i} {A} {_}{_}{z} p = ind₌ D d p where
D : (x y : A) → (p : x ≡ y) → Set i
D x y _ = y ≡ z → x ≡ z
d : (x₁ : A) → D x₁ x₁ refl
d _ = λ x → x
composite' : ∀ {i} {A : Set i}{x y z : A} → (x ≡ y) → (y ≡ z) → (x ≡ z)
composite' {i} {A} {_}{_}{z} = ind₌ D d where
D : (x y : A) → (p : x ≡ y) → Set i
D x y _ = y ≡ z → x ≡ z
d : (x : A) → D x x refl
d x = ind₌ E e where
E : (x z : A) → (q : x ≡ z) → Set i
E x z _ = x ≡ z
e : (x : A) → E x x refl
e x = refl
composite'' : ∀ {i} {A : Set i}{x y z : A} → (x ≡ y) → (y ≡ z) → (x ≡ z)
composite'' refl refl = refl
composite=composite' : ∀ {i} {A : Set i}{x y z : A} → (p : x ≡ y)(q : y ≡ z) → composite p q ≡ composite' p q
composite=composite' refl refl = refl
composite=composite'' : ∀ {i} {A : Set i}{x y z : A} → (p : x ≡ y)(q : y ≡ z) → composite p q ≡ composite'' p q
composite=composite'' refl refl = refl
composite'=composite'' : ∀ {i} {A : Set i}{x y z : A} → (p : x ≡ y)(q : y ≡ z) → composite' p q ≡ composite'' p q
composite'=composite'' refl refl = refl
|
sensibility.agda | hazelgrove/agda-popl17 | 14 | 12740 | <filename>sensibility.agda
open import Nat
open import Prelude
open import core
open import judgemental-erase
open import moveerase
module sensibility where
mutual
-- if an action transforms a ê in a synthetic posistion to another ê,
-- they have the same type up erasure of the cursor
actsense-synth : {Γ : ·ctx} {e e' : ê} {e◆ e'◆ : ė} {t t' : τ̇} {α : action} →
erase-e e e◆ →
erase-e e' e'◆ →
Γ ⊢ e => t ~ α ~> e' => t' →
Γ ⊢ e◆ => t →
Γ ⊢ e'◆ => t'
-- in the movement case, we defer to the movement erasure theorem
actsense-synth er er' (SAMove x) wt with erasee-det (moveerasee' er x) er'
... | refl = wt
-- in all the nonzipper cases, the cursor must be at the top for the
-- action rule to apply, so we just build the new derivation
-- directly. no recursion is needed; these are effectively base cases.
actsense-synth _ EETop SADel _ = SEHole
actsense-synth EETop (EEAscR ETTop) SAConAsc wt = SAsc (ASubsume wt TCRefl)
actsense-synth _ EETop (SAConVar p) _ = SVar p
actsense-synth EETop (EEAscR (ETArrL ETTop)) (SAConLam x) SEHole = SAsc (ALam x MAArr (ASubsume SEHole TCRefl))
actsense-synth EETop (EEApR EETop) (SAConApArr x) wt = SAp wt x (ASubsume SEHole TCHole1)
actsense-synth EETop (EEApR EETop) (SAConApOtw x) wt = SAp (SNEHole wt) MAHole (ASubsume SEHole TCRefl)
actsense-synth _ EETop SAConNumlit _ = SNum
actsense-synth EETop (EEPlusR EETop) (SAConPlus1 TCRefl) wt = SPlus (ASubsume wt TCRefl) (ASubsume SEHole TCHole1)
actsense-synth EETop (EEPlusR EETop) (SAConPlus1 TCHole2) wt = SPlus (ASubsume wt TCHole1) (ASubsume SEHole TCHole1)
actsense-synth EETop (EEPlusR EETop) (SAConPlus2 _) wt = SPlus (ASubsume (SNEHole wt) TCHole1) (ASubsume SEHole TCHole1)
actsense-synth EETop (EENEHole EETop) SAConNEHole wt = SNEHole wt
actsense-synth _ EETop (SAFinish x) _ = x
--- zipper cases. in each, we recur on the smaller action derivation
--- following the zipper structure, then reassemble the result
actsense-synth (EEAscL er) (EEAscL er') (SAZipAsc1 x) (SAsc x₁)
with actsense-ana er er' x x₁
... | ih = SAsc ih
actsense-synth (EEAscR x₁) (EEAscR x) (SAZipAsc2 x₂ x₃ x₄ x₅) (SAsc x₆)
with eraset-det x x₃
... | refl = SAsc x₅
actsense-synth er (EEApL er') (SAZipApArr x x₁ x₂ act x₃) wt
with actsense-synth x₁ er' act x₂
... | ih = SAp ih x x₃
actsense-synth (EEApR er) (EEApR er') (SAZipApAna x x₁ x₂) (SAp wt x₃ x₄)
with synthunicity x₁ wt
... | refl with matcharrunicity x x₃
... | refl with actsense-ana er er' x₂ x₄
... | ih = SAp wt x ih
actsense-synth (EEPlusL er) (EEPlusL er') (SAZipPlus1 x) (SPlus x₁ x₂)
with actsense-ana er er' x x₁
... | ih = SPlus ih x₂
actsense-synth (EEPlusR er) (EEPlusR er') (SAZipPlus2 x) (SPlus x₁ x₂)
with actsense-ana er er' x x₂
... | ih = SPlus x₁ ih
actsense-synth er (EENEHole er') (SAZipHole x x₁ act) wt
with actsense-synth x er' act x₁
... | ih = SNEHole ih
-- if an action transforms an ê in an analytic posistion to another ê,
-- they have the same type up erasure of the cursor.
actsense-ana : {Γ : ·ctx} {e e' : ê} {e◆ e'◆ : ė} {t : τ̇} {α : action} →
erase-e e e◆ →
erase-e e' e'◆ →
Γ ⊢ e ~ α ~> e' ⇐ t →
Γ ⊢ e◆ <= t →
Γ ⊢ e'◆ <= t
-- in the subsumption case, punt to the other theorem
actsense-ana er1 er2 (AASubsume x x₁ x₂ x₃) _ = ASubsume (actsense-synth x er2 x₂ x₁) x₃
-- for movement, appeal to the movement-erasure theorem
actsense-ana er1 er2 (AAMove x) wt with erasee-det (moveerasee' er1 x) er2
... | refl = wt
-- in the nonzipper cases, we again know where the hole must be, so we
-- force it and then build the relevant derivation directly.
actsense-ana EETop EETop AADel wt = ASubsume SEHole TCHole1
actsense-ana EETop (EEAscR ETTop) AAConAsc wt = ASubsume (SAsc wt) TCRefl
actsense-ana EETop (EENEHole EETop) (AAConVar x₁ p) wt = ASubsume (SNEHole (SVar p)) TCHole1
actsense-ana EETop (EELam EETop) (AAConLam1 x₁ x₂) wt = ALam x₁ x₂ (ASubsume SEHole TCHole1)
actsense-ana EETop (EENEHole EETop) (AAConNumlit x) wt = ASubsume (SNEHole SNum) TCHole1
actsense-ana EETop EETop (AAFinish x) wt = x
actsense-ana EETop (EENEHole (EEAscR (ETArrL ETTop))) (AAConLam2 x _) (ASubsume SEHole q) =
ASubsume (SNEHole (SAsc (ALam x MAArr (ASubsume SEHole TCRefl)))) q
-- all subsumptions in the right derivation are bogus, because there's no
-- rule for lambdas synthetically
actsense-ana (EELam _) (EELam _) (AAZipLam _ _ _) (ASubsume () _)
-- that leaves only the zipper cases for lambda, where we force the
-- forms and then recurr into the body of the lambda being checked.
actsense-ana (EELam er1) (EELam er2) (AAZipLam x₁ x₂ act) (ALam x₄ x₅ wt)
with matcharrunicity x₂ x₅
... | refl with actsense-ana er1 er2 act wt
... | ih = ALam x₄ x₅ ih
|
source/gmp-z.adb | ytomino/gmp-ada | 4 | 14843 | with System.Storage_Elements;
with C.stdint;
with C.string;
package body GMP.Z is
use type System.Storage_Elements.Storage_Element;
use type System.Storage_Elements.Storage_Offset;
use type C.signed_int;
use type C.size_t;
use type C.gmp.mp_size_t;
procedure memcpy (dst, src : System.Address; n : C.size_t)
with Import, Convention => Intrinsic, External_Name => "__builtin_memcpy";
-- implementation
function To_MP_Integer (X : Long_Long_Integer) return MP_Integer is
begin
return Result : MP_Integer do
mpz_set_Long_Long_Integer (Controlled.Reference (Result), X);
end return;
end To_MP_Integer;
function Image (Value : MP_Integer; Base : Number_Base := 10) return String is
Raw_Value : constant not null access constant C.gmp.mpz_struct :=
Controlled.Constant_Reference (Value);
Buffer_Size : constant C.size_t :=
C.gmp.mpz_sizeinbase (Raw_Value, C.signed_int (Base)) + 2;
Buffer : aliased C.char_array (0 .. Buffer_Size);
Dummy : C.char_ptr;
begin
Dummy :=
C.gmp.mpz_get_str (
Buffer (Buffer'First)'Access,
C.signed_int (Base),
Raw_Value);
declare
Length : constant Natural :=
Natural (C.string.strlen (Buffer (Buffer'First)'Access));
Result : String (1 .. Length);
for Result'Address use Buffer'Address;
begin
return Result;
end;
end Image;
function Value (Image : String; Base : Number_Base := 10) return MP_Integer is
Image_Length : constant C.size_t := Image'Length;
C_Image : C.char_array (0 .. Image_Length); -- NUL
begin
memcpy (C_Image'Address, Image'Address, Image_Length);
C_Image (Image_Length) := C.char'Val (0);
return Result : MP_Integer do
if C.gmp.mpz_set_str (
Controlled.Reference (Result),
C_Image (C_Image'First)'Access,
C.signed_int (Base)) < 0
then
raise Constraint_Error;
end if;
end return;
end Value;
function "=" (Left, Right : MP_Integer) return Boolean is
begin
return C.gmp.mpz_cmp (
Controlled.Constant_Reference (Left),
Controlled.Constant_Reference (Right)) = 0;
end "=";
function "<" (Left, Right : MP_Integer) return Boolean is
begin
return C.gmp.mpz_cmp (
Controlled.Constant_Reference (Left),
Controlled.Constant_Reference (Right)) < 0;
end "<";
function ">" (Left, Right : MP_Integer) return Boolean is
begin
return C.gmp.mpz_cmp (
Controlled.Constant_Reference (Left),
Controlled.Constant_Reference (Right)) > 0;
end ">";
function "<=" (Left, Right : MP_Integer) return Boolean is
begin
return C.gmp.mpz_cmp (
Controlled.Constant_Reference (Left),
Controlled.Constant_Reference (Right)) <= 0;
end "<=";
function ">=" (Left, Right : MP_Integer) return Boolean is
begin
return C.gmp.mpz_cmp (
Controlled.Constant_Reference (Left),
Controlled.Constant_Reference (Right)) >= 0;
end ">=";
function "+" (Right : MP_Integer) return MP_Integer is
begin
return Right;
end "+";
function "-" (Right : MP_Integer) return MP_Integer is
begin
return Result : MP_Integer do
C.gmp.mpz_neg (
Controlled.Reference (Result),
Controlled.Constant_Reference (Right));
end return;
end "-";
function "+" (Left, Right : MP_Integer) return MP_Integer is
begin
return Result : MP_Integer do
C.gmp.mpz_add (
Controlled.Reference (Result),
Controlled.Constant_Reference (Left),
Controlled.Constant_Reference (Right));
end return;
end "+";
function "-" (Left, Right : MP_Integer) return MP_Integer is
begin
return Result : MP_Integer do
C.gmp.mpz_sub (
Controlled.Reference (Result),
Controlled.Constant_Reference (Left),
Controlled.Constant_Reference (Right));
end return;
end "-";
function "*" (Left, Right : MP_Integer) return MP_Integer is
begin
return Result : MP_Integer do
C.gmp.mpz_mul (
Controlled.Reference (Result),
Controlled.Constant_Reference (Left),
Controlled.Constant_Reference (Right));
end return;
end "*";
function "/" (Left, Right : MP_Integer) return MP_Integer is
begin
return Result : MP_Integer do
C.gmp.mpz_div (
Controlled.Reference (Result),
Controlled.Constant_Reference (Left),
Controlled.Constant_Reference (Right));
end return;
end "/";
function "**" (Left : MP_Integer; Right : Natural) return MP_Integer is
begin
return Result : MP_Integer do
C.gmp.mpz_pow_ui (
Controlled.Reference (Result),
Controlled.Constant_Reference (Left),
C.unsigned_long'Mod (Right));
end return;
end "**";
function Copy_Sign (Value, Sign : MP_Integer) return MP_Integer is
begin
if (C.gmp.qmpz_cmp_si (Controlled.Constant_Reference (Value), 0) < 0) =
(C.gmp.qmpz_cmp_si (Controlled.Constant_Reference (Sign), 0) < 0)
then
return Value;
else
return -Value;
end if;
end Copy_Sign;
function Copy_Sign (Value : MP_Integer; Sign : Integer) return MP_Integer is
begin
if (C.gmp.qmpz_cmp_si (Controlled.Constant_Reference (Value), 0) < 0) =
(Sign < 0)
then
return Value;
else
return -Value;
end if;
end Copy_Sign;
function Copy_Sign (Value : Integer; Sign : MP_Integer) return Integer is
begin
if (Value < 0) =
(C.gmp.qmpz_cmp_si (Controlled.Constant_Reference (Sign), 0) < 0)
then
return Value;
else
return -Value;
end if;
end Copy_Sign;
package body Controlled is
function View_Reference (Item : in out MP_Integer)
return not null access C.gmp.mpz_struct;
pragma Inline (View_Reference);
function View_Reference (Item : in out MP_Integer)
return not null access C.gmp.mpz_struct is
begin
return Item.Raw (0)'Unchecked_Access;
end View_Reference;
-- implementation
function Reference (Item : in out Z.MP_Integer)
return not null access C.gmp.mpz_struct is
begin
return View_Reference (MP_Integer (Item)); -- view conversion
end Reference;
function Constant_Reference (Item : Z.MP_Integer)
return not null access constant C.gmp.mpz_struct is
begin
return MP_Integer (Item).Raw (0)'Unchecked_Access;
end Constant_Reference;
overriding procedure Initialize (Object : in out MP_Integer) is
begin
C.gmp.mpz_init (Object.Raw (0)'Access);
end Initialize;
overriding procedure Adjust (Object : in out MP_Integer) is
Source : constant C.gmp.mpz_t := Object.Raw;
begin
C.gmp.mpz_init_set (Object.Raw (0)'Access, Source (0)'Access);
end Adjust;
overriding procedure Finalize (Object : in out MP_Integer) is
begin
C.gmp.mpz_clear (Object.Raw (0)'Access);
end Finalize;
end Controlled;
procedure Read (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : out MP_Integer) is
begin
Read (Stream, Controlled.Reference (Item));
end Read;
procedure Write (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : in MP_Integer) is
begin
Write (Stream, Controlled.Constant_Reference (Item));
end Write;
-- streaming
function bswap32 (x : C.stdint.int32_t) return C.stdint.int32_t
with Import, Convention => Intrinsic, External_Name => "__builtin_bswap32";
function Convert_BE (X : C.stdint.int32_t) return C.stdint.int32_t is
begin
case System.Default_Bit_Order is
when System.High_Order_First =>
return X;
when System.Low_Order_First =>
return bswap32 (X);
end case;
end Convert_BE;
-- Read, equivalent to mpz_in_raw
procedure Read (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : not null access C.gmp.mpz_struct)
is
csize : System.Storage_Elements.Storage_Offset;
begin
declare
csize_bytes : C.stdint.int32_t; -- 4 bytes for size
begin
C.stdint.int32_t'Read (Stream, csize_bytes);
csize :=
System.Storage_Elements.Storage_Offset ( -- sign extending
Convert_BE (csize_bytes));
end;
if csize /= 0 then
declare
abs_csize : constant System.Storage_Elements.Storage_Offset := abs csize;
cp : aliased System.Storage_Elements.Storage_Array (0 .. abs_csize - 1);
begin
System.Storage_Elements.Storage_Array'Read (Stream, cp);
C.gmp.mpz_import (
Item,
C.size_t (abs_csize), -- word count
1, -- big endian in array
1, -- word size
1, -- big endian in word
0, -- no padding
C.void_const_ptr (cp'Address));
end;
if csize < 0 then
C.gmp.mpz_neg (Item, Item);
end if;
else
C.gmp.mpz_set_ui (Item, 0);
end if;
end Read;
-- Write, equivalent to mpz_out_raw
procedure Write (
Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : not null access constant C.gmp.mpz_struct)
is
xsize : constant C.gmp.mp_size_t := C.gmp.mp_size_t (Item.mp_size);
begin
if xsize /= 0 then
declare
abs_xsize : constant C.gmp.mp_size_t := abs xsize;
tsize : constant System.Storage_Elements.Storage_Offset :=
(System.Storage_Elements.Storage_Offset (abs_xsize) * C.gmp.GMP_NUMB_BITS + 7)
/ 8;
tp : aliased System.Storage_Elements.Storage_Array (0 .. tsize - 1);
bp : System.Storage_Elements.Storage_Offset := 0;
bytes : aliased C.size_t;
Dummy : C.void_ptr;
begin
Dummy :=
C.gmp.mpz_export (
C.void_ptr (tp'Address),
bytes'Access,
1, -- big endian in array
1, -- word size
1, -- big endian in word
0, -- no padding
Item);
-- strip high zero bytes (without fetching from bp)
declare
zeros : System.Storage_Elements.Storage_Offset := 0;
begin
while tp (zeros) = 0 loop
zeros := zeros + 1;
end loop;
bp := bp + zeros;
bytes := bytes - C.size_t (zeros);
end;
declare
-- total bytes to be written
ssize : constant System.Storage_Elements.Storage_Offset :=
System.Storage_Elements.Storage_Offset (bytes);
begin
declare
bytes_Signed : C.stdint.int32_t := C.stdint.int32_t (bytes);
begin
if xsize < 0 then
-- twos complement negative for the size value
bytes_Signed := -bytes_Signed;
end if;
C.stdint.int32_t'Write (Stream, Convert_BE (bytes_Signed));
end;
System.Storage_Elements.Storage_Array'Write (
Stream,
tp (bp .. bp + ssize - 1));
end;
end;
else
C.stdint.int32_t'Write (Stream, 0);
end if;
end Write;
end GMP.Z;
|
test/testdata_vm/002 add_imm_too_large2.asm | onlyafly/oakblue | 0 | 176666 | <filename>test/testdata_vm/002 add_imm_too_large2.asm
ADD R0 R0 #-17
ADD R0 R0 #15
ADD R0 R0 #2
HALT |
NonReflectiveZ.agda | z-murray/AnalysisAgda | 0 | 4041 | <reponame>z-murray/AnalysisAgda<gh_stars>0
{-# OPTIONS --without-K --safe #-}
open import Agda.Builtin.Bool
open import Data.Maybe.Base using (just; nothing)
open import Relation.Binary.PropositionalEquality
open import Relation.Nullary
open import Data.Integer.Base
open import Data.Integer.Properties using (+-*-commutativeRing)
open import Tactic.RingSolver.Core.AlmostCommutativeRing using (fromCommutativeRing)
open import Tactic.RingSolver.NonReflective (fromCommutativeRing +-*-commutativeRing λ { +0 -> just refl; _ -> nothing}) public
|
Transynther/x86/_processed/AVXALIGN/_st_/i7-8650U_0xd2.log_6278_20.asm | ljhsiun2/medusa | 9 | 98589 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r15
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0xf8fc, %r12
nop
nop
nop
cmp $33243, %rsi
mov $0x6162636465666768, %rbx
movq %rbx, (%r12)
nop
nop
nop
dec %rbx
lea addresses_WC_ht+0x1add4, %rcx
sub %r15, %r15
mov $0x6162636465666768, %r14
movq %r14, %xmm3
movups %xmm3, (%rcx)
cmp $17967, %r15
lea addresses_WC_ht+0x3984, %rsi
lea addresses_A_ht+0x142b5, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
nop
nop
and %r14, %r14
mov $27, %rcx
rep movsb
nop
nop
nop
nop
and $12871, %rcx
lea addresses_D_ht+0x23d4, %rbx
nop
nop
inc %r12
movups (%rbx), %xmm6
vpextrq $0, %xmm6, %r15
nop
nop
nop
inc %r15
lea addresses_A_ht+0x106b0, %rsi
nop
nop
nop
nop
cmp $45110, %rbx
mov $0x6162636465666768, %r15
movq %r15, (%rsi)
nop
add %rcx, %rcx
lea addresses_A_ht+0xcd14, %r12
nop
nop
nop
nop
nop
xor %rdi, %rdi
mov (%r12), %esi
nop
nop
add %rbx, %rbx
lea addresses_A_ht+0xc3d4, %r15
clflush (%r15)
nop
nop
nop
nop
xor %rdi, %rdi
movups (%r15), %xmm1
vpextrq $0, %xmm1, %rcx
nop
add $53543, %rcx
lea addresses_WC_ht+0x1d434, %r12
nop
nop
nop
nop
and %rbx, %rbx
movb $0x61, (%r12)
nop
nop
nop
nop
nop
cmp $25238, %r14
lea addresses_WT_ht+0xeba0, %r14
inc %r12
vmovups (%r14), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %rdi
nop
nop
nop
nop
dec %rbx
lea addresses_D_ht+0xd9d4, %r15
nop
sub %r12, %r12
movl $0x61626364, (%r15)
nop
nop
nop
add %rbx, %rbx
lea addresses_WT_ht+0x39fc, %rsi
nop
nop
nop
cmp $22310, %r14
vmovups (%rsi), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $0, %xmm1, %r12
nop
inc %r14
lea addresses_UC_ht+0x238a, %rsi
lea addresses_WT_ht+0x146d4, %rdi
nop
nop
nop
nop
and %rax, %rax
mov $53, %rcx
rep movsl
nop
nop
dec %rax
lea addresses_WC_ht+0x159d4, %rsi
lea addresses_WC_ht+0x17d4, %rdi
nop
nop
nop
nop
cmp $6798, %r15
mov $46, %rcx
rep movsw
nop
add $56470, %rax
lea addresses_WT_ht+0x12a43, %r15
add %rax, %rax
mov $0x6162636465666768, %r12
movq %r12, (%r15)
nop
add $47900, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r15
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r15
push %rax
push %rbx
// Faulty Load
lea addresses_PSE+0x175d4, %r11
nop
nop
xor $3398, %r12
movb (%r11), %r15b
lea oracles, %rax
and $0xff, %r15
shlq $12, %r15
mov (%rax,%r15,1), %r15
pop %rbx
pop %rax
pop %r15
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'33': 6278}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1974.asm | ljhsiun2/medusa | 9 | 1270 | <filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1974.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r15
push %rbp
push %rdi
push %rdx
lea addresses_normal_ht+0x1a9ce, %r13
nop
nop
nop
nop
nop
cmp %rdi, %rdi
and $0xffffffffffffffc0, %r13
vmovaps (%r13), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %rbp
nop
nop
nop
nop
and $30883, %r15
lea addresses_A_ht+0x5fdd, %rdx
nop
nop
nop
nop
sub $28605, %rbp
mov (%rdx), %r11
nop
and $20074, %rdx
lea addresses_WT_ht+0x15ce, %r11
clflush (%r11)
nop
nop
nop
nop
sub $6887, %rdi
mov $0x6162636465666768, %r15
movq %r15, %xmm7
movups %xmm7, (%r11)
nop
nop
nop
nop
nop
add %rdi, %rdi
pop %rdx
pop %rdi
pop %rbp
pop %r15
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r8
push %rax
push %rbp
push %rcx
// Store
lea addresses_A+0x18fce, %r11
nop
nop
nop
nop
nop
cmp %rcx, %rcx
mov $0x5152535455565758, %rbp
movq %rbp, (%r11)
and %r8, %r8
// Store
lea addresses_WC+0xbae0, %r12
nop
nop
nop
nop
and %rax, %rax
mov $0x5152535455565758, %rcx
movq %rcx, %xmm5
vmovups %ymm5, (%r12)
nop
nop
nop
nop
dec %rax
// Faulty Load
lea addresses_D+0x9fce, %rbp
nop
nop
nop
nop
nop
xor $17711, %r10
mov (%rbp), %rcx
lea oracles, %r11
and $0xff, %rcx
shlq $12, %rcx
mov (%r11,%rcx,1), %rcx
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_A', 'size': 8, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_WC', 'size': 32, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
src/statements/adabase-statement-base-mysql.ads | jrmarino/AdaBase | 30 | 16212 | -- This file is covered by the Internet Software Consortium (ISC) License
-- Reference: ../../License.txt
with AdaBase.Connection.Base.MySQL;
with AdaBase.Bindings.MySQL;
with Ada.Containers.Vectors;
package AdaBase.Statement.Base.MySQL is
package ACM renames AdaBase.Connection.Base.MySQL;
package ABM renames AdaBase.Bindings.MySQL;
package AC renames Ada.Containers;
type MySQL_statement (type_of_statement : Stmt_Type;
log_handler : ALF.LogFacility_access;
mysql_conn : ACM.MySQL_Connection_Access;
initial_sql : SQL_Access;
con_error_mode : Error_Modes;
con_case_mode : Case_Modes;
con_max_blob : BLOB_Maximum;
con_buffered : Boolean)
is new Base_Statement and AIS.iStatement with private;
type MySQL_statement_access is access all MySQL_statement;
overriding
function column_count (Stmt : MySQL_statement) return Natural;
overriding
function last_insert_id (Stmt : MySQL_statement) return Trax_ID;
overriding
function last_sql_state (Stmt : MySQL_statement) return SQL_State;
overriding
function last_driver_code (Stmt : MySQL_statement) return Driver_Codes;
overriding
function last_driver_message (Stmt : MySQL_statement) return String;
overriding
procedure discard_rest (Stmt : out MySQL_statement);
overriding
function execute (Stmt : out MySQL_statement) return Boolean;
overriding
function execute (Stmt : out MySQL_statement; parameters : String;
delimiter : Character := '|') return Boolean;
overriding
function rows_returned (Stmt : MySQL_statement) return Affected_Rows;
overriding
function column_name (Stmt : MySQL_statement; index : Positive)
return String;
overriding
function column_table (Stmt : MySQL_statement; index : Positive)
return String;
overriding
function column_native_type (Stmt : MySQL_statement; index : Positive)
return field_types;
overriding
function fetch_next (Stmt : out MySQL_statement) return ARS.Datarow;
overriding
function fetch_all (Stmt : out MySQL_statement) return ARS.Datarow_Set;
overriding
function fetch_bound (Stmt : out MySQL_statement) return Boolean;
overriding
procedure fetch_next_set (Stmt : out MySQL_statement;
data_present : out Boolean;
data_fetched : out Boolean);
private
type mysql_canvas;
procedure initialize (Object : in out MySQL_statement);
procedure Adjust (Object : in out MySQL_statement);
procedure finalize (Object : in out MySQL_statement);
procedure internal_post_prep_stmt (Stmt : out MySQL_statement);
procedure internal_direct_post_exec (Stmt : out MySQL_statement;
newset : Boolean := False);
procedure process_direct_result (Stmt : out MySQL_statement);
procedure scan_column_information (Stmt : out MySQL_statement);
procedure clear_column_information (Stmt : out MySQL_statement);
procedure construct_bind_slot (Stmt : MySQL_statement;
struct : out ABM.MYSQL_BIND;
canvas : out mysql_canvas;
marker : Positive);
function internal_fetch_bound (Stmt : out MySQL_statement) return Boolean;
function internal_fetch_row (Stmt : out MySQL_statement)
return ARS.Datarow;
function internal_ps_fetch_row (Stmt : out MySQL_statement)
return ARS.Datarow;
function internal_ps_fetch_bound (Stmt : out MySQL_statement)
return Boolean;
function convert_to_bitstring (nv : String; width : Natural) return String;
function num_set_items (nv : String) return Natural;
function bincopy (data : ABM.ICS.char_array_access;
datalen, max_size : Natural)
return String;
function bincopy (data : ABM.ICS.char_array_access;
datalen, max_size : Natural;
hard_limit : Natural := 0)
return AR.Chain;
procedure log_problem
(statement : MySQL_statement;
category : Log_Category;
message : String;
pull_codes : Boolean := False;
break : Boolean := False);
type column_info is record
table : CT.Text;
field_name : CT.Text;
field_type : field_types;
field_size : Natural;
null_possible : Boolean;
mysql_type : ABM.enum_field_types;
end record;
type fetch_status is (pending, progressing, completed);
package VColumns is new AC.Vectors (Index_Type => Positive,
Element_Type => column_info);
-- mysql_canvas is used by prepared statement execution
-- The Ada types are converted to C types and stored in this record which
-- MySQL finds through pointers.
type mysql_canvas is record
length : aliased ABM.IC.unsigned_long := 0;
is_null : aliased ABM.my_bool := 0;
error : aliased ABM.my_bool := 0;
buffer_uint8 : ABM.IC.unsigned_char := 0;
buffer_uint16 : ABM.IC.unsigned_short := 0;
buffer_uint32 : ABM.IC.unsigned := 0;
buffer_uint64 : ABM.IC.unsigned_long := 0;
buffer_int8 : ABM.IC.signed_char := 0;
buffer_int16 : ABM.IC.short := 0;
buffer_int32 : ABM.IC.int := 0;
buffer_int64 : ABM.IC.long := 0;
buffer_float : ABM.IC.C_float := 0.0;
buffer_double : ABM.IC.double := 0.0;
buffer_binary : ABM.ICS.char_array_access := null;
buffer_time : ABM.MYSQL_TIME;
end record;
type mysql_canvases is array (Positive range <>) of aliased mysql_canvas;
type mysql_canvases_Access is access all mysql_canvases;
procedure free_canvas is new Ada.Unchecked_Deallocation
(mysql_canvases, mysql_canvases_Access);
procedure free_binary is new Ada.Unchecked_Deallocation
(ABM.IC.char_array, ABM.ICS.char_array_access);
procedure reclaim_canvas (Stmt : out MySQL_statement);
type MySQL_statement (type_of_statement : Stmt_Type;
log_handler : ALF.LogFacility_access;
mysql_conn : ACM.MySQL_Connection_Access;
initial_sql : SQL_Access;
con_error_mode : Error_Modes;
con_case_mode : Case_Modes;
con_max_blob : BLOB_Maximum;
con_buffered : Boolean)
is new Base_Statement and AIS.iStatement with
record
delivery : fetch_status := completed;
result_handle : ABM.MYSQL_RES_Access := null;
stmt_handle : ABM.MYSQL_STMT_Access := null;
bind_canvas : mysql_canvases_Access := null;
assign_counter : Natural := 0;
num_columns : Natural := 0;
size_of_rowset : Trax_ID := 0;
column_info : VColumns.Vector;
sql_final : SQL_Access;
end record;
end AdaBase.Statement.Base.MySQL;
|
src/main/antlr/com/thore/L2SMT/L2SMT.g4 | diasalvatore/l2smt | 0 | 3245 | <reponame>diasalvatore/l2smt
grammar L2SMT;
@header {
package com.thore.L2SMT;
import com.thore.language.*;
import java.util.*;
import java.util.regex.*;
import org.apache.commons.lang3.math.*;
}
@parser::members {
private List<String> currentLabel;
private String currentLabelId;
private int currentLabelCounter = 0;
private Map<String, Type> tempType = new HashMap<>();
private List<SystemState> sss = new ArrayList<>();
private SystemState ss = new SystemState();
public List<SystemState> getSystemStates() {
return sss;
}
private void newState() {
sss.add(ss);
ss = ss.clone();
}
private void addLabel(String label) {
String l = label.substring(1,label.length()-1).replace(" ", "");
currentLabel.add(l);
if (currentLabelId.equals("") || l.startsWith("#")) currentLabelId = "id"+l.replace("#","").replaceAll("-","");
}
private void resetLabel() {
currentLabel = new LinkedList<>();
currentLabelCounter = 0;
currentLabelId = "";
}
private Type getType(String pool, String name) {
return Type.Bool; // ToDo
}
private Type cType(Type t1, Type t2, String error) {
if (t1 != t2) {
System.err.println("["+currentLabel+"]\nERROR: " + error);
System.exit(-1);
}
return t1;
}
private void addExpr(String expr) {
if (expr != null && !expr.isEmpty())
ss.addExpr((currentLabelCounter == 0 ? "\n; ["+currentLabel+"]\n":"")+"(assert (! "+expr+" :named "+currentLabelId+"_"+(currentLabelCounter++)+"))");
}
private String addQuantifierType(String var, Type t) {
if (t == Type.AttrDS || t == Type.AttrE || t == Type.DS || t == Type.Role) {
tempType.put(var, t);
// System.out.println("var:"+var);
// System.out.println(tempType.entrySet());
return "("+var+" Atom) ";
} else {
return "("+var+" "+t+") ";
}
}
/**
* Return domain assertions about quantified variables
*/
private String getQuantifierTypes() {
String ret = "";
if (tempType.size() > 1) ret = "(and ";
for (Map.Entry<String, Type> entry : tempType.entrySet()) {
ret += "(= (is"+entry.getValue() + " " + entry.getKey()+") true) ";
}
if (tempType.size() > 1) ret += ")";
tempType = new HashMap<>();
return ret;
}
private void updateFunction(String name, List<String> nple) {
for (String s : nple) {
if (tempType.containsKey(s)) { // excluding quantified variables
return;
}
}
ss.updateFunction(name, nple);
}
private void updateAtom(String name, Type type) {
if (!tempType.containsKey(name)) { // excluding quantified variables
ss.updateAtom(name, type);
}
}
/**
* Translates L operators in SMT operators
*/
private String transOp(String op) {
String trans = op;
switch (op) {
case "&&": trans = "and"; break;
case "||": trans = "or"; break;
case "!": trans = "not"; break;
case "==": trans = "="; break;
}
return trans;
}
/**
* Translate values using valueOf or not
*/
private String valueOfOrNot(String s) {
if (NumberUtils.isNumber(s) || s.equals("true") || s.equals("false") ) { // ToDo: consider other cases than numbers
return s;
} else {
return " (valueOf " + s + " ) ";
}
}
}
// ------------------------------- GRAMMAR -------------------------------
program returns [String s]:
{ ss = new SystemState(); }
(
{resetLabel();}
(STEP_DELIMITER { newState(); })?
(l=LABEL { addLabel($l.text); })+
((p=pred { addExpr($p.s); })? EOP)+
)+
{ newState(); }
;
pred returns [String s, Type t]:
op=('FORALL'|'EXISTS') { $s = "("+($op.text.equals("FORALL") ? "forall" : "exists")+" ("; }
v=ID ':' ty=TYPE { $s += addQuantifierType($v.text, Type.valueOf($ty.text)); }
(',' v=ID ':' ty=TYPE { $s += addQuantifierType($v.text, Type.valueOf($ty.text)); })*
'{' p=pred '}' {
// $t = cType($p.t, Type.Bool, $op.text + " predicate should be Bool");
$t = Type.Bool;
if ($op.text.equals("FORALL")) {
$s += ") (=> "+getQuantifierTypes()+" "+$p.s+"))";
} else {
$s += ") (and "+getQuantifierTypes()+" "+$p.s+"))";
}
}
| p1=pred op=(AND|OR) p2=pred {
//cType($p1.t, Type.Bool, $op.text + " operands should be Bool");
$t = cType($p2.t, Type.Bool, $op.text + " operands should be Bool");
$s = "("+transOp($op.text)+" "+$p1.s+" "+$p2.s+")";
}
| p1=pred op=('<'|'<='|'>='|'>'|'=='|'!=') p2=pred {
// todo
//cType($p1.t, Type.Int, $op.text + " operands should be Int");
//$t = cType($p2.t, Type.Int, $op.text + " operands should be Int");
$t = Type.Bool;
// $s = "("+transOp($op.text)+" (valueOf "+$p1.s+") (valueOf "+$p2.s+"))";
if ($op.text.equals("!=")) {
$s = "(not (= "+valueOfOrNot($p1.s)+ " " +valueOfOrNot($p2.s)+"))";
} else {
$s = "("+transOp($op.text)+" "+valueOfOrNot($p1.s)+ " " +valueOfOrNot($p2.s)+")";
}
}
| p1=pred op=('+'|'-') p2=pred {
// todo
cType($p1.t, Type.Int, $op.text + " operands should be Int");
$t = cType($p2.t, Type.Int, $op.text + " operands should be Int");
$s = "("+transOp($op.text)+valueOfOrNot($p1.s)+ " " +valueOfOrNot($p2.s)+")";
}
| p1=pred op=('*'|'/') p2=pred {
cType($p1.t, Type.Int, $op.text + " operands should be Int");
$t = cType($p2.t, Type.Int, $op.text + " operands should be Int");
$s = "("+transOp($op.text)+valueOfOrNot($p1.s)+ " " +valueOfOrNot($p2.s)+")";
//$s = "("+$op.text+" (valueOf "+$p1.s+") (valueOf "+$p2.s+"))";
}
| p1=pred IMPLIES p2=pred {
cType($p1.t, Type.Bool, "=> LHS should be Bool");
$t = cType($p2.t, Type.Bool, "=> RHS should be Bool");
$s = "(=> "+$p1.s+" "+$p2.s+")";
}
| NOT p=pred {
$t = cType($p.t, Type.Bool, "! arg should be Bool");
$s = "(not "+$p.s+")";
}
| f=function {
$t = $f.t;
$s = $f.s;
}
| te=term {
$t = $te.t;
$s = $te.s;
}
| '(' p=pred ')' {
$t = $p.t;
$s = $p.s;
}
;
term returns [String s, Type t]:
BOOL {
$t = Type.Bool;
// $s = $BOOL.text;
$s = ss.addStringPool($BOOL.text);
}
| INT {
$t = Type.Int;
$s = $INT.text;
}
| REAL {
$t = Type.Real;
$s = $REAL.text;
}
| STRING {
$t = Type.String;
$s = ss.addStringPool($STRING.text);
}
| ATTRE {
$t = getType("AttrE", $ATTRE.text);
$s = $ATTRE.text;
updateAtom($ATTRE.text, null);
}
| ATTRDS {
$t = getType("AttrDS", $ATTRDS.text);
$s = $ATTRDS.text;
updateAtom($ATTRDS.text, null);
}
| ROLE {
$t = Type.Role;
$s = $ROLE.text;
updateAtom($ROLE.text, null);
}
| DS {
$t = Type.DS;
$s = $DS.text;
updateAtom($DS.text, null);
}
| ID {
$t = null;
$s = $ID.text;
updateAtom($ID.text, null);
}
| '^'ID {
$t = null;
$s = "["+$ID.text+"]";
updateAtom($ID.text, null);
}
;
function returns [String s, Type t]:
'IsBool(' t1=term ')' {
$t = Type.Bool;
$s = "(= (isBool "+$t1.s+") true)";
updateAtom($t1.s, Type.Bool);
}
| 'IsInt(' t1=term ')' {
$t = Type.Bool;
$s = "(= (isInt "+$t1.s+") true)";
updateAtom($t1.s, Type.Int);
}
| 'IsReal(' t1=term ')' {
$t = Type.Bool;
$s = "(= (isReal "+$t1.s+") true)";
updateAtom($t1.s, Type.Real);
}
| 'IsString(' t1=term ')' {
$t = Type.Bool;
$s = "(= (isString "+$t1.s+") true)";
updateAtom($t1.s, Type.String);
}
| 'IsRole(' t1=term ')' {
$t = Type.Bool;
$s = "(= (isRole "+$t1.s+") true)";
updateAtom($t1.s, Type.Role);
}
| 'IsDS(' t1=term ')' {
$t = Type.Bool;
$s = "(= (isDS "+$t1.s+") true)";
updateAtom($t1.s, Type.DS);
}
| 'IsAttrE(' t1=term ')' {
$t = Type.Bool;
$s = "(= (isAttrE "+$t1.s+") true)";
//updateAtom($t1.text, Type.AttrE);
updateFunction("isAttrE", Arrays.asList(new String[] { $t1.text }));
}
| 'IsAttrDS(' t1=term ')' {
$t = Type.Bool;
$s = "(= (isAttrDS "+$t1.s+") true)";
//updateAtom($t1.text, Type.AttrDS);
updateFunction("isAttrDS", Arrays.asList(new String[] { $t1.text }));
}
| 'NameOf(' t1=term ',' str=STRING ')' {
$t = Type.Bool;
$s = "(= (nameOf "+$t1.text+") "+ss.addStringPool($str.text)+")";
}
| 'HasAttr(' t1=term ',' t2=term ')' {
$t = Type.Bool;
$s = "(= (hasAttr "+$t1.text+" "+$t2.text+") true)";
updateAtom($t1.text, Type.DS);
updateAtom($t2.text, Type.AttrDS); //Arrays.asList(new String[]{"one", "two", "three"});
updateFunction("hasAttr", Arrays.asList(new String[] { $t1.text, $t2.text }));
}
| 'HasRole(' t1=term ',' t2=term ')' {
$t = Type.Bool;
$s = "(= (hasRole "+$t1.text+" "+$t2.text+") true)";
updateAtom($t1.text, Type.DS);
updateAtom($t2.text, Type.Role);
updateFunction("hasRole", Arrays.asList(new String[] { $t1.text, $t2.text }));
}
| 'Provides(' t1=term ',' t2=term ')' {
$t = Type.Bool;
$s = "(= (provides "+$t1.text+" "+$t2.text+") true)";
updateAtom($t1.text, Type.DS);
updateAtom($t2.text, Type.Role);
updateFunction("provides", Arrays.asList(new String[] { $t1.text, $t2.text }));
}
| 'Consumes(' t1=term ',' t2=term ')' {
$t = Type.Bool;
$s = "(= (consumes "+$t1.text+" "+$t2.text+") true)";
updateAtom($t1.text, Type.DS);
updateAtom($t2.text, Type.Role);
updateFunction("consumes", Arrays.asList(new String[] { $t1.text, $t2.text }));
}
| 'Bond(' t1=term ',' t2=term ',' t3=term ')' {
$t = Type.Bool;
//$s = "(= (bond "+$t1.text+" "+$t2.text+" "+$t3.text+") true)";
$s = "(and (= (pre "+$t1.text+" "+$t2.text+" "+$t3.text+") true) (= (pre "+$t2.text+" "+$t1.text+" "+$t3.text+") true))";
updateAtom($t1.text, Type.DS);
updateAtom($t2.text, Type.DS);
updateAtom($t3.text, Type.Role);
updateFunction("bond", Arrays.asList(new String[] { $t1.text, $t2.text, $t3.text }));
updateFunction("uses", Arrays.asList(new String[] { $t1.text, $t2.text }));
}
| 'Uses(' t1=term ',' t2=term ')' {
$t = Type.Bool;
$s = "(= (uses "+$t1.text+" "+$t2.text+") true)";
updateAtom($t1.text, Type.DS);
updateAtom($t2.text, Type.DS);
// updateFunction("uses", Arrays.asList(new String[] { $t1.text, $t2.text }));
}
| 'Precondition(' t1=term ',' r1=term ',' p1=pred ')' {
$t = Type.Bool;
if (tempType.size() > 0) {
$s = "(pre "+$t1.text+" "+$r1.text+" "+$p1.s+")";
} else {
$s = "";
ss.updateCondition("pre", $t1.text, $r1.text, $p1.s);
}
}
| 'Postcondition(' t1=term ',' r1=term ',' p1=pred ')' {
$t = Type.Bool;
$s = "";
ss.updateCondition("post", $t1.text, $r1.text, $p1.s);
}
;
// *** LEXER ***
TYPE: 'Bool' | 'Int' | 'Real' | 'String' | 'AttrE' | 'AttrDS' | 'Role' | 'DS';
// operators
AND: '&&' | 'and';
OR: '||' | 'or';
NOT: '!' | 'not';
IMPLIES: '=>' | 'implies';
STEP_DELIMITER: '---STEP---';
// litterals
BOOL: 'True' | 'False'| 'true' | 'false';
INT: '-'? DIGIT+;
REAL: INT+ '.' INT+;
STRING: ('\'' ALLCHAR* '\'')|('"' ALLCHAR* '"');
ATTRE: 'AE.' ID;
ATTRDS: 'AD.' ID '.' ID;
ROLE: 'R.' ID;
DS: 'DS.' ID;
LABEL: '[' ('?'|'#')? ALLCHAR+ ']';
ID: '$'?[a-z] [a-zA-Z0-9]*;
fragment
ALLCHAR: [a-zA-Z0-9\- ];
DIGIT: [0-9]+ ;
WS: [ \n\r\t]+ -> skip ; // skip spaces, tabs, newlines, \r (Windows)
COMMENT: ('#'|'//') ~( '\r' | '\n' )* -> skip;
EOP: [;]+; |
src/main/antlr/JsonPath.g4 | amazinglzy/NRA4JsonStore | 0 | 6825 | grammar JsonPath;
jsonBasicPathExpr: jsonAbsolutePathExpr | jsonRelativePathExpr ;
jsonAbsolutePathExpr: '$' jsonSteps ;
jsonRelativePathExpr: '@' jsonSteps ;
jsonSteps: jsonStep * ;
jsonStep: (jsonObjectStep | jsonArrayStep | jsonDescendentStep ) jsonFilterExpr ?;
jsonFilterExpr: FILTER_BEGIN jsonCond FILTER_END ;
jsonCond: jsonRelativePathExpr # JsonCondExists
| jsonCond LOGIC_AND jsonCond # JsonCondAnd
;
jsonObjectStep: '.' (jsonObjectWildcardStep | jsonObjectFieldNameStep);
jsonObjectWildcardStep: WILDCARD ;
jsonObjectFieldNameStep: jsonFieldName ;
jsonDescendentStep: '..' jsonFieldName ;
jsonFieldName: IDENTIFIER ;
jsonArrayStep: ARRAY_BEGIN (jsonArrayWildcardStep | jsonArraySelectionsStep) ARRAY_END ;
jsonArrayWildcardStep: WILDCARD;
jsonArraySelectionsStep: jsonArraySlice ;
jsonArraySlice: NATRUAL_INTEGER ':' NATRUAL_INTEGER ;
JSON_STRING: '"' (~["\\])* '"';
NATRUAL_INTEGER: '0' | POSITIVEDIGIT DIGIT*;
IDENTIFIER: LETTER (LETTER | DIGIT)*;
FILTER_BEGIN: '[?(';
FILTER_END: ')]';
ARRAY_BEGIN: '[';
ARRAY_END: ']';
WILDCARD: '*';
LOGIC_AND: '&&';
DIGIT: [0-9];
POSITIVEDIGIT: [1-9];
LETTER: [A-Z] | [a-z] | [_];
WS: [ \t\r\n]+ -> skip; |
Numeral/Integer.agda | Lolirofle/stuff-in-agda | 6 | 4451 | module Numeral.Integer where
import Lvl
open import Numeral.Natural as ℕ using (ℕ)
import Numeral.Natural.Oper as ℕ
open import Syntax.Number
open import Type
-- Integers
data ℤ : Type{Lvl.𝟎} where
+ₙ_ : ℕ → ℤ -- Positive integers including zero from the naturals (0,1,..).
−𝐒ₙ_ : ℕ → ℤ -- Negative integers from the naturals (..,−2,−1).
{-# BUILTIN INTEGER ℤ #-}
{-# BUILTIN INTEGERPOS +ₙ_ #-}
{-# BUILTIN INTEGERNEGSUC −𝐒ₙ_ #-}
------------------------------------------
-- Constructors and deconstructors
-- Constructing negative number from ℕ
−ₙ_ : ℕ → ℤ
−ₙ (ℕ.𝟎) = +ₙ ℕ.𝟎
−ₙ (ℕ.𝐒(x)) = −𝐒ₙ(x)
-- Intuitive constructor patterns
pattern 𝟎 = +ₙ(ℕ.𝟎) -- Zero (0).
pattern +𝐒ₙ_ n = +ₙ(ℕ.𝐒(n)) -- Positive integers from the naturals (1,2,..).
pattern 𝟏 = +ₙ(ℕ.𝟏) -- One (1).
pattern −𝟏 = −𝐒ₙ(ℕ.𝟎) -- Negative one (−1).
{-# DISPLAY ℤ.+ₙ_ ℕ.𝟎 = 𝟎 #-}
{-# DISPLAY ℤ.+ₙ_ ℕ.𝟏 = 𝟏 #-}
{-# DISPLAY ℤ.−𝐒ₙ_ ℕ.𝟎 = −𝟏 #-}
{-# DISPLAY ℤ.+ₙ_(ℕ.𝐒(n)) = +𝐒ₙ_ n #-}
-- Absolute value
absₙ : ℤ → ℕ
absₙ(+ₙ x) = x
absₙ(−𝐒ₙ(x)) = ℕ.𝐒(x)
-- Syntax
instance
ℤ-InfiniteNegativeNumeral : InfiniteNegativeNumeral(ℤ)
ℤ-InfiniteNegativeNumeral = InfiniteNegativeNumeral.intro(−ₙ_)
instance
ℤ-InfiniteNumeral : InfiniteNumeral(ℤ)
ℤ-InfiniteNumeral = InfiniteNumeral.intro(+ₙ_)
|
Retreet.g4 | purdue-cap/Retreet | 2 | 6932 | grammar Retreet;
prog
: (function)+
| (relation)+
;
relation
: 'unfused' ':' INT '->' 'fused' ':' INT
;
id
: IDENTIFIER
;
function
: main
| func
;
main
: 'main' '(' id ')''{' stmt+ '}'
;
func
: id '(' param_list ')' '{' stmt+ '}'
;
param_list
: id // loc variable
| id param_tail // loc & int variables
;
param_tail
: ',' id param_tail // int variable
| // empty
;
stmt
: block_withid
| if_stmt
| '[' block_withid ':' block_withid ']' // parallel
;
block_withid
: block '//' INT
//| if_stmt_withid '//' INT
;
block
: call
| assgn_list
| single_if_stmt
;
call
: id '(' arg_list ')' ';'
;
arg_list
: lexpr arg_list_tail
;
arg_list_tail
: ',' aexpr arg_list_tail
| // empty
;
assgn_list
: assgn+
;
assgn
: field '=' aexpr ';'
| id '=' aexpr ';'
| 'return' ';'
;
single_if_stmt
: 'if' '(' bexpr ')' '{' assgn_list '}'
;
if_stmt
:if_part else_part;
if_part
: 'if' '(' bexpr ')' '{' stmt+ '}'
;
else_part
: 'else' '{' stmt+ '}'
| // empty
;
lexpr
: id
| lexpr '.' dir
;
dir
: 'left'
| 'right'
| 'next'
;
aexpr
: INT
| id
| field
| aexpr aop aexpr
;
aop
: '+'
| '-'
;
field
: lexpr '.' id
;
bexpr
: lit bexpr_suffix
;
bexpr_suffix
: '&&' lit bexpr_suffix
| '||' lit bexpr_suffix
| // empty
;
lit
: '!' basic_cond
| basic_cond
;
basic_cond
: aexpr compop aexpr
| lexpr eqop 'nil'
| 'true'
| 'false'
;
compop
: '>'
| '<'
| '>='
| '<='
| eqop
;
eqop
: '=='
| '!='
;
WHITESPACE
: ( ' ' | '\t' | '\r' | '\n' )+ -> skip
;
KEYWORD
: 'main'
| 'if'
| 'else'
| 'nil'
| 'return'
| 'left'
| 'right'
| 'next'
| 'true'
| 'false'
;
IDENTIFIER
: [a-zA-Z]+
;
INT
: [0-9]+
;
|
eurasia/codegen/pds/pds_mte_state_copy.asm | shaqfu786/GFX_Linux_DDK | 3 | 90348 | /******************************************************************************
* Name : pds_mte_state_copy.asm
*
* Copyright : 2006-2008 by Imagination Technologies Limited.
* : All rights reserved. No part of this software, either
* : material or conceptual may be copied or distributed,
* : transmitted, transcribed, stored in a retrieval system or
* : translated into any human or computer language in any form
* : by any means, electronic, mechanical, manual or otherwise,
* : or disclosed to third parties without the express written
* : permission of Imagination Technologies Limited,
* : Home Park Estate, Kings Langley, Hertfordshire,
* : WD4 8LZ, U.K.
*
* Platform : ANSI
*
* $Log: pds_mte_state_copy.asm $
*****************************************************************************/
#include "sgxdefs.h"
#if !defined(FIX_HW_BRN_25339) && !defined(FIX_HW_BRN_27330)
/**********************************************************
PDS data
***********************************************************/
data dword DMA0;
data dword DMA1;
data dword DMA2;
data dword DMA3;
data dword USE0;
data dword USE1;
data dword USE2;
/**********************************************************
PDS instructions
***********************************************************/
/* check DMA0, skip it if null... */
tstz p0, DMA0
p0 bra USE_ISSUE
/* ... else write to DMA interface */
movs doutd, DMA0, DMA1
/* check DMA2, skip it if null... */
tstz p0, DMA2
p0 bra USE_ISSUE
/* ... else write to DMA interface */
movs doutd, DMA2, DMA3
/* run MTE update program on USE */
USE_ISSUE:
movs doutu, USE0, USE1, USE2
/* end of program */
halt
#else /* !defined(FIX_HW_BRN_25339) && !defined(FIX_HW_BRN_27330) */
/**********************************************************
PDS data
***********************************************************/
data dword DMA0;
data dword DMA1;
data dword DMA2;
data dword DMA3;
data dword USE0;
data dword USE1;
data dword USE2;
temp dword temp_USE2 = ds1[48]
/**********************************************************
PDS instructions
***********************************************************/
/* write to DMA interface */
movs doutd, DMA0, DMA1
/* check DMA2, skip it if null... */
tstz p0, DMA2
p0 bra USE_ISSUE
/* ... else write to DMA interface */
movs doutd, DMA2, DMA3
/* run MTE update program on USE */
USE_ISSUE:
mov32 temp_USE2, USE2
movs doutu, USE0, USE1, temp_USE2
/* end of program */
halt
#endif /* !defined(FIX_HW_BRN_25339) && !defined(FIX_HW_BRN_27330) */
|
data/mapHeaders/PokemonTower4F.asm | AmateurPanda92/pokemon-rby-dx | 9 | 90660 | PokemonTower4F_h:
db CEMETERY ; tileset
db POKEMON_TOWER_4F_HEIGHT, POKEMON_TOWER_4F_WIDTH ; dimensions (y, x)
dw PokemonTower4F_Blocks ; blocks
dw PokemonTower4F_TextPointers ; texts
dw PokemonTower4F_Script ; scripts
db 0 ; connections
dw PokemonTower4F_Object ; objects
|
utils/disk-tools/split/starter.asm | vbmacher/qsOS | 1 | 12509 | ;
; STARTER.ASM
;
; (c) Copyright 2002, <NAME>.
;
;
;
.model compact
.stack 16384
.386p
.code
extrn _main: near
.startup
call _main
xor ax,ax
.exit
end
|
ada-out-string-param/main.adb | dksmiffs/gnatmake-examples | 0 | 19426 | <reponame>dksmiffs/gnatmake-examples<filename>ada-out-string-param/main.adb<gh_stars>0
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Unbounded;
procedure Main is
package SU renames Ada.Strings.Unbounded;
procedure I_Return_String(Sun : out SU.Unbounded_String) is
begin
Sun := SU.To_Unbounded_String("Hellew, I am an Ada string.");
end I_Return_String;
SUnb : SU.Unbounded_String;
begin
I_Return_String(SUnb);
Put_Line("Output string is here ==>" & SU.To_String(SUnb) & "<==");
end Main;
|
programs/oeis/021/A021069.asm | neoneye/loda | 22 | 245585 | <gh_stars>10-100
; A021069: Decimal expansion of 1/65.
; 0,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3,8,4,6,1,5,3
mov $1,10
pow $1,$0
mul $1,9
add $1,10
div $1,9
mul $1,9
div $1,13
mul $1,10
sub $1,1
div $1,45
mod $1,10
mov $0,$1
|
src/main/antlr/me/wollemat/sake/v2/parser/Sake.g4 | wollemat/sake | 2 | 2346 | <filename>src/main/antlr/me/wollemat/sake/v2/parser/Sake.g4<gh_stars>1-10
grammar Sake;
@header { package me.wollemat.sake.v2.parser; }
start : function+ EOF
;
function : FUN ID OPEN CLOSE ARROW expr # NoParamFunction
| FUN ID OPEN ID (COMMA ID)* CLOSE ARROW expr # ParamFunction
;
// ORDER is important for precedence!
expr : OPEN expr CLOSE # GroupingExpression
| expr SQUAREOPEN expr SQUARECLOSE # ArrayExpression
| SUB expr # NegationExpression
| NOT expr # NotExpression
| expr MULT expr # MultiplicationExpression
| expr DIV expr # DivisionExpression
| expr REM expr # RemainderExpression
| expr PLUS expr # AdditionExpression
| expr SUB expr # SubtractionExpression
| expr GE expr # GreaterEqualsExpression
| expr GT expr # GreaterThanExpression
| expr LE expr # LessEqualsExpression
| expr LT expr # LessThanExpression
| expr EQ expr # EqualsExpression
| expr NEQ expr # NotEqualsExpression
| expr AND expr # AndExpression
| expr OR expr # OrExpression
| expr APPEND expr # AppendExpression
| expr CONCAT expr # ConcatExpression
| expr OPEN CLOSE # NoArgumentApplicationExpression
| expr OPEN expr (COMMA expr)* CLOSE # ArgumentApplicationExpression
| LAMBDA OPEN CLOSE ARROW expr # NoParamLambdaExpression
| LAMBDA OPEN ID (COMMA ID)* CLOSE ARROW expr # ParamLambdaExpression
| PRINT OPEN expr CLOSE # PrintExpression
| FAIL OPEN expr CLOSE # FailExpression
| IF OPEN expr CLOSE expr (ELIF OPEN expr CLOSE expr)* ELSE expr # IfExpression
| ID # VariableExpression
| STRING # StringExpression
| FLOAT # FloatExpression
| INTEGER # IntegerExpression
| TRUE # TrueExpression
| FALSE # FalseExpression
| NIL # NilExpression
| NULL # NullExpression
;
// Lexer fragments (NOT RULES!)
fragment DIGIT : [0-9];
fragment LOWERCASE : [a-z];
fragment UPPERCASE : [A-Z];
// Reserved keywords
FUN : 'fun';
LAMBDA : 'lambda';
ARROW : '->';
IF : 'if';
ELIF : 'elif';
ELSE : 'else';
TRUE : 'true';
FALSE : 'false';
NIL : 'nil';
NULL : 'null';
AND : 'and';
OR : 'or';
NOT : 'not';
PRINT : 'print';
FAIL : 'fail';
// Special characters
QUOTE : '\'';
DOT : '.';
COMMA : ',';
OPEN : '(';
CLOSE : ')';
SQUAREOPEN : '[';
SQUARECLOSE : ']';
// Reserved operators
APPEND : '::';
CONCAT : ':::';
PLUS : '+';
SUB : '-';
MULT : '*';
DIV : '/';
REM : '%';
GE : '>=';
GT : '>';
LE : '<=';
LT : '<';
EQ : '==';
NEQ : '!=';
// Literal rules
STRING : QUOTE (~'\''|'\\\'')* QUOTE;
FLOAT : DIGIT+ DOT DIGIT+;
INTEGER : DIGIT+;
// Identifier rule
ID : LOWERCASE+;
// Ignored characters
WHITESPACE : (' '|'\t')+ -> skip;
NEWLINE : ('\r'?'\n'|'\r')+ -> skip;
|
other.7z/SFC.7z/SFC/ソースデータ/MarioKart/Missile.asm | prismotizm/gigaleak | 0 | 16259 | Name: Missile.asm
Type: file
Size: 4086
Last-Modified: '1992-07-01T15:00:00Z'
SHA-1: D86D4BC3036302A3E9BBAF6CB246DDCC08222DC6
Description: null
|
libsrc/_DEVELOPMENT/l/z80/ascii/l_eat_hdigits.asm | jpoikela/z88dk | 640 | 80504 |
SECTION code_clib
SECTION code_l
PUBLIC l_eat_hdigits
EXTERN asm_isxdigit
l_eat_hdigits:
; advance buffer pointer past decimal digits
;
; enter : hl = char *
;
; exit : hl = char * (points past digits)
; a = non-matching char
;
; uses : af, hl
ld a,(hl)
call asm_isxdigit
ret c
inc hl
jr l_eat_hdigits
|
programs/oeis/333/A333813.asm | jmorken/loda | 1 | 14810 | ; A333813: a(n) = 2^(1 + floor(n*log_2(3))) - (3^n + 1).
; 0,0,6,4,46,12,294,1908,1630,13084,6486,84996,517134,502828,3605638,2428308,24062142,5077564,149450422,985222180,808182894,6719515980,2978678758,43295774644,267326277406,252223018332,1856180682774,1170495537220
mul $0,2
cal $0,117855 ; Number of nonzero palindromes of length n (in base 3).
cal $0,35327 ; Write n in binary, interchange 0's and 1's, convert back to decimal.
mov $1,$0
div $1,4
mul $1,2
|
src/httpd-main.adb | aheijde/httpd | 1 | 13323 | with Ada.Text_IO;
with Ada.Strings.Fixed;
with AWS.Config.Set;
with AWS.Server;
with HTTPd.Callbacks;
procedure HTTPd.Main is
Web_Server : AWS.Server.HTTP;
Web_Config : AWS.Config.Object;
begin
-- Show header
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line(" HH HH TTTTTTT TTTTTTT PPPPPP dd ");
Ada.Text_IO.Put_Line(" HH HH TTT TTT P PP dd ");
Ada.Text_IO.Put_Line(" HHHHHHH TTT TTT PPPPPP dddddd ");
Ada.Text_IO.Put_Line(" HH HH TTT TTT PP dd dd ");
Ada.Text_IO.Put_Line(" HH HH TTT TTT PP dddddd ");
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line("Simple static Web Server made in Ada 2012");
Ada.Text_IO.Put_Line(">> v1.0 [25/April/2020]");
Ada.Text_IO.Put_Line(">> Made by: <NAME>");
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line("Stop server by pressing Q");
Ada.Text_IO.New_Line;
-- Setup
AWS.Config.Set.Server_Host (Web_Config, Host);
AWS.Config.Set.Server_Port (Web_Config, Port);
-- Start the server
AWS.Server.Start (Web_Server, Callbacks.Default'Access, Web_Config);
-- Connection to web server
Ada.Text_IO.Put_Line("Connect to http://" & Host & ":" & Ada.Strings.Fixed.Trim(Port'Img, Ada.Strings.Left) & "/");
-- Wait for the Q key to exit
AWS.Server.Wait (AWS.Server.Q_Key_Pressed);
-- Stop the server
AWS.Server.Shutdown (Web_Server);
end HTTPd.Main;
|
src/entropy-none/siphash-entropy.adb | jhumphry/SPARK_SipHash | 5 | 12879 | <reponame>jhumphry/SPARK_SipHash<gh_stars>1-10
-- SipHash.Entropy
-- A child package that attempts to set the key from an entropy source on the
-- system.
-- This implementation is for systems where no entropy is available.
-- Copyright (c) 2015, <NAME> - see LICENSE file for details
package body SipHash.Entropy
with SPARK_Mode => Off
is
function System_Entropy_Source return Boolean is
(False);
procedure Set_Key_From_System_Entropy is
begin
raise Entropy_Unavailable
with "System entropy not available on this system";
end Set_Key_From_System_Entropy;
procedure Set_Key_From_System_Entropy (Success : out Boolean) is
begin
Success := False;
end Set_Key_From_System_Entropy;
end SipHash.Entropy;
|
programs/oeis/000/A000292.asm | karttu/loda | 1 | 84302 | <reponame>karttu/loda<gh_stars>1-10
; A000292: Tetrahedral (or triangular pyramidal) numbers: a(n) = C(n+2,3) = n*(n+1)*(n+2)/6.
; 0,1,4,10,20,35,56,84,120,165,220,286,364,455,560,680,816,969,1140,1330,1540,1771,2024,2300,2600,2925,3276,3654,4060,4495,4960,5456,5984,6545,7140,7770,8436,9139,9880,10660,11480,12341,13244,14190,15180,16215,17296,18424,19600,20825,22100,23426,24804,26235,27720,29260,30856,32509,34220,35990,37820,39711,41664,43680,45760,47905,50116,52394,54740,57155,59640,62196,64824,67525,70300,73150,76076,79079,82160,85320,88560,91881,95284,98770,102340,105995,109736,113564,117480,121485,125580,129766,134044,138415,142880,147440,152096,156849,161700,166650,171700,176851,182104,187460,192920,198485,204156,209934,215820,221815,227920,234136,240464,246905,253460,260130,266916,273819,280840,287980,295240,302621,310124,317750,325500,333375,341376,349504,357760,366145,374660,383306,392084,400995,410040,419220,428536,437989,447580,457310,467180,477191,487344,497640,508080,518665,529396,540274,551300,562475,573800,585276,596904,608685,620620,632710,644956,657359,669920,682640,695520,708561,721764,735130,748660,762355,776216,790244,804440,818805,833340,848046,862924,877975,893200,908600,924176,939929,955860,971970,988260,1004731,1021384,1038220,1055240,1072445,1089836,1107414,1125180,1143135,1161280,1179616,1198144,1216865,1235780,1254890,1274196,1293699,1313400,1333300,1353400,1373701,1394204,1414910,1435820,1456935,1478256,1499784,1521520,1543465,1565620,1587986,1610564,1633355,1656360,1679580,1703016,1726669,1750540,1774630,1798940,1823471,1848224,1873200,1898400,1923825,1949476,1975354,2001460,2027795,2054360,2081156,2108184,2135445,2162940,2190670,2218636,2246839,2275280,2303960,2332880,2362041,2391444,2421090,2450980,2481115,2511496,2542124,2573000,2604125
add $0,2
bin $0,3
mov $1,$0
|
programs/oeis/314/A314754.asm | karttu/loda | 0 | 172990 | <gh_stars>0
; A314754: Coordination sequence Gal.5.82.2 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,5,9,13,19,23,27,33,37,41,46,51,55,59,65,69,73,79,83,87,92,97,101,105,111,115,119,125,129,133,138,143,147,151,157,161,165,171,175,179,184,189,193,197,203,207,211,217,221,225
mov $2,$0
mov $4,$0
lpb $0,1
mov $0,3
mul $0,$2
mov $2,$0
add $0,1
mov $6,$2
add $2,3
add $3,$6
add $6,$2
div $2,$6
add $2,$3
mod $2,10
add $2,3
sub $2,$0
sub $0,$2
div $0,10
lpe
mov $1,$0
add $1,1
mov $5,$4
mul $5,4
add $1,$5
|
oeis/097/A097896.asm | neoneye/loda-programs | 11 | 15395 | <reponame>neoneye/loda-programs
; A097896: Number of compositions of n with either all parts odd or all parts even.
; Submitted by <NAME>
; 1,2,2,5,5,12,13,29,34,71,89,176,233,441,610,1115,1597,2840,4181,7277,10946,18735,28657,48416,75025,125489,196418,326003,514229,848424,1346269,2211077,3524578,5768423,9227465,15061424,24157817,39350313
lpb $0
sub $0,1
sub $2,$1
add $1,$3
mul $4,2
sub $4,$5
add $4,1
add $4,$2
mov $5,$4
mov $4,$2
mov $2,$3
add $4,$1
add $5,$4
mov $3,$5
lpe
sub $4,$1
add $5,$4
mov $0,$5
add $0,1
|
list_combo/src/lists-dynamic.ads | gerr135/ada_gems | 6 | 28628 | --
-- This implementation encapsulates Ada.Containers.Vectors.Vector as a record entry.
-- This is a common way to compose enveloping type, requiring glue code to implement all
-- declared methods. SImple to understand, but only explicitly declared methods are available.
--
-- Copyright (C) 2018 <NAME> <<EMAIL>>
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
with Ada.Containers.Vectors;
generic
type Element_Type is new Element_Interface with private;
package Lists.dynamic is
type List is new List_Interface with private;
overriding
function List_Constant_Reference (Container : aliased in List; Position : Cursor) return Constant_Reference_Type;
overriding
function List_Constant_Reference (Container : aliased in List; Index : Index_Type) return Constant_Reference_Type;
overriding
function List_Reference (Container : aliased in out List; Position : Cursor) return Reference_Type;
overriding
function List_Reference (Container : aliased in out List; Index : Index_Type) return Reference_Type;
overriding
function Iterate (Container : in List) return Iterator_Interface'Class;
-- new methods from ACV.Vector pool; should really be part of interface, here is only a demo of tying all together..
function To_Vector (Length : Index_Type) return List;
private
package ACV is new Ada.Containers.Vectors(Index_Type, Element_Type);
type List is new List_Interface with record
vec : ACV.Vector;
end record;
function Has_Element (L : List; Position : Index_Base) return Boolean;
-- here we also need to implement Reversible_Iterator interface
type Iterator is new Iterator_Interface with record
Container : List_Access;
Index : Index_Type'Base;
end record;
overriding
function First (Object : Iterator) return Cursor;
overriding
function Last (Object : Iterator) return Cursor;
overriding
function Next (Object : Iterator; Position : Cursor) return Cursor;
overriding
function Previous (Object : Iterator; Position : Cursor) return Cursor;
end Lists.dynamic;
|
font/text_ui.asm | speccytools/spectranet-index-module | 0 | 13047 | <gh_stars>0
EXTERN asm_zx_cxy2saddr
EXTERN asm_zx_cxy2aaddr
include "../include/spectranet.inc"
include "../include/defs.inc"
include "../include/stdmodules.inc"
include "../include/fcntl.inc"
include "../include/zxrom.inc"
include "../include/sysvars.inc"
include "../include/zxsysvars.inc"
include "../src/memory.inc"
org 0x1000
; stack: string to write
; stack: amount to write
; registers used:
; ixl - number of characters left to write
; hl - current screen address
; de - current characted data address
; bc - current string address
text_ui_write:
pop iy ; ret
ld de, hl ; store string address into de for a bit
ld ix, 0xFF ; -1
count_loop:
ld a, (hl)
inc hl
inc ixl
and a
jr nz, count_loop ; string length is in ixl
pop hl ; yx
push hl ; preserve yx for asm_zx_cxy2aaddr
call asm_zx_cxy2aaddr ; get color data addr
ld c, ixl ; get chars amount into ixl
inc c ; divide it in half
rr c ; with round top
ld a, (TEXT_COLOR)
_text_ui_write_color_loop: ; fill up color info
ld (hl), a
inc hl
dec c
jr nz, _text_ui_write_color_loop
pop hl ; restore hl to yx
call asm_zx_cxy2saddr ; hl now holds a screen address
ld bc, de ; pop string address into bc
push iy ; ret
_text_ui_write_loop:
; even
include "text_ui_routine_loop_header.inc"
include "text_ui_routine_even.inc"
inc h
include "text_ui_routine_even.inc"
inc h
include "text_ui_routine_even.inc"
inc h
include "text_ui_routine_even.inc"
inc h
include "text_ui_routine_even.inc"
inc h
include "text_ui_routine_even.inc"
inc h
include "text_ui_routine_even.inc"
inc h
include "text_ui_routine_even.inc"
ld a, h ; restore (h)l from 7 increments
sub 7
ld h, a
inc bc ; onto next character
dec ixl ; do we have more to print?
ret z ; we're done
; odd
include "text_ui_routine_loop_header.inc"
include "text_ui_routine_odd.inc"
inc h
include "text_ui_routine_odd.inc"
inc h
include "text_ui_routine_odd.inc"
inc h
include "text_ui_routine_odd.inc"
inc h
include "text_ui_routine_odd.inc"
inc h
include "text_ui_routine_odd.inc"
inc h
include "text_ui_routine_odd.inc"
inc h
include "text_ui_routine_odd.inc"
inc hl ; onto next screen address position
ld a, h ; restore (h)l from 7 increments
sub 7
ld h, a
inc bc ; onto next character
dec ixl ; do we have more to print?
ret z ; we're done
jp _text_ui_write_loop
font:
binary "font_4x8_80columns.bin"
|
test/Fail/Erasure-Lambda-Wrong-Attribute.agda | cruhland/agda | 1,989 | 1321 | -- Andreas, 2018-10-16, wrong quantity in lambda-abstraction
applyErased : {@0 A B : Set} → (@0 A → B) → @0 A → B
applyErased f x = f x
test : {A : Set} → A → A
test x = applyErased (λ (@ω y) → y) x
-- Expected error:
--
-- Wrong quantity annotation in lambda abstraction.
--
-- Current error (because @ω as default quantity is ignored):
--
-- Variable y is declared erased, so it cannot be used here
-- when checking that the expression y has type _B_7
|
programs/oeis/030/A030495.asm | karttu/loda | 0 | 93734 | ; A030495: a(n) = (n+1)!+ n.
; 1,3,8,27,124,725,5046,40327,362888,3628809,39916810,479001611,6227020812,87178291213,1307674368014,20922789888015,355687428096016,6402373705728017
mov $1,$0
add $1,1
fac $1
add $1,$0
|
sfx_engine/TABs-Play.asm | GSoftwareDevelopment/sfx-tracker | 9 | 25003 | ; TAB - PLAY NOTE
sty _regTemp ; store current TAB offset
; get SFX settings
cmp #FN_NOTE_FREQ ; check type of note (Note numer or Frequency Divider Set)
; Carry flag determine SFX_PLAY_NOTE mode
and #%00111111 ; extract SFX Index from Order
tay ; transfer SFX Index to Y register
lda TABParam ; get note_index
jsr SFX_PLAY_NOTE
ldy _regTemp ; restore current TAB offset
jmp next_player_tick
|
programs/oeis/134/A134024.asm | neoneye/loda | 22 | 100609 | <gh_stars>10-100
; A134024: Number of positive trits in balanced ternary representation of n.
; 0,1,1,1,2,1,1,2,1,1,2,2,2,3,1,1,2,1,1,2,2,2,3,1,1,2,1,1,2,2,2,3,2,2,3,2,2,3,3,3,4,1,1,2,1,1,2,2,2,3,1,1,2,1,1,2,2,2,3,2,2,3,2,2,3,3,3,4,1,1,2,1,1,2,2,2,3,1,1,2,1,1,2,2,2,3,2,2,3,2,2,3,3,3,4,2,2,3,2,2
lpb $0
add $0,1
mov $2,$0
div $0,3
seq $2,21115 ; Decimal expansion of 1/111.
mov $3,$2
min $3,1
add $1,$3
lpe
mov $0,$1
|
prole_art/wobble.asm | FolkertVanVerseveld/c64 | 1 | 172416 | <filename>prole_art/wobble.asm
// Assembler: KickAssembler v4.19
BasicUpstart2(main)
#import "../pseudo.lib"
// https://dustlayer.com/vic-ii/2013/4/25/vic-ii-for-beginners-beyond-the-screen-rasters-cycle
//
// 50 is net iets voor het begin van 25 rijenscherm
.var irq_line_top = (312 - 284) / 2
.var irq_line_screen_start = 49
//.var irq_line_top = $20
.var irq_line_bottom = 284 + 5
.var vic = $0000
.var screen = vic + $0400
// intro idea:
// split lines with text introducing prole art?
// scroller idea:
// parallax scrolling with three areas, where dutch and sweden flag will reside
// while some stuff is scrolling (probably petscii, maybe bitmap?)
// dutch flag:
// red for raster sky?
// white for horizon?
// blue with water stuff (inc. boat?)
// swedish flag
// twister like effect?
// or methos and anton names with sprites/petscii with flag colors
.var music = LoadSid("/home/methos/Music/HVSC69/MUSICIANS/0-9/20CC/van_Santen_Edwin/Blackmail_Tune_1.sid")
main:
//lda #0
//sta $0400
lda #0
jsr music.init
// inline: setup irq
sei
mov #$35 : $01
mov16 #irq_top : $fffe
mov #$1b : $d011
mov #irq_line_top : $d012
mov #$81 : $d01a
mov #$7f : $dc0d
mov #$7f : $dd0d
lda $dc0d
lda $dd0d
mov #$ff : $d019
cli
jmp *
irq_top:
irq // 21, 21
lda #6 // 4, 25
sta $d020 // 4, 29
!fptr:
ldx scroll_top_size // 4, 33
!l:
jsr delay2 // 14, 14
jsr delay2 // 14, 28
jsr delay2 // 14, 42
jsr delay2 // 14, 56
jmp !next+
!next:
dex // 2, 61
bne !l-
lda #14
sta $d020
ldx scroll_top_size
cpx #$24
beq !no_inc+
inx
stx scroll_top_size
qri2 #irq_line_bottom : #irq_bottom
!no_inc:
lda #$4c
sta !fptr-
lda #<!done+
sta !fptr- + 1
lda #>!done+
sta !fptr- + 2
jmp !irq_change_once+
!done:
qri #irq_line_screen_start : #irq_screen_top
scroll_top_size:
.byte 1
irq_screen_top:
irq
!irq_change_once:
jsr delay
jsr delay
bit $ea
lda #6
sta $d020
ldx wobble_size
ldy wobble_pos
!l:
lda wobble_tbl, y
sta $d016
jsr delay2
jsr delay2
jsr delay2
nop
iny
tya
and #$1f
tay
dex
bne !l-
ldx wobble_size
cpx #$d7
beq !no_inc+
inx
stx wobble_size
inc wobble_pos
lda #$c8
sta $d016
lda #14
sta $d020
qri2 #irq_line_bottom : #irq_bottom
!no_inc:
inc wobble_pos
qri2 #irq_line_bottom : #irq_bottom2
irq_bottom:
irq
jsr music.play
qri2 #irq_line_top : #irq_top
irq_bottom2:
irq
jsr music.play
jsr erase_bottom
qri2 #irq_line_screen_start : #irq_screen_top
delay2:
nop
delay:
rts
erase_bottom:
// check counter
ldx fill_size
cpx #13
beq !done+
inc fill_size
// TODO add sqrfade logic
// TODO add top row
// fill top row
lda #$e0
ldx #39
!row_put:
sta screen, x
dex
bpl !row_put-
// increment pointer
clc
lda !row_put- + 1
adc #40
sta !row_put- + 1
bcc !no_inc+
inc !row_put- + 2
!no_inc:
// fill bottom row
lda #$e0
ldx #39
!row_put:
sta screen + 24 * 40, x
dex
bpl !row_put-
// decrement pointer
sec
lda !row_put- + 1
sbc #40
sta !row_put- + 1
bcs !no_dec+
dec !row_put- + 2
!no_dec:
!done:
rts
wobble_size:
.byte 2
wobble_pos:
.byte 0
fill_size:
.byte 0
.align $10
wobble_tbl:
.fill $20, round($c8 + 3 + 3 * sin(toRadians(i * 360 / $20)))
.byte $c8, $c9, $ca, $cb, $cc, $cd, $ce, $cf
.byte $cf, $ce, $cd, $cc, $cb, $ca, $c9, $c8
// MUSIC
* = music.location "music"
.fill music.size, music.getData(i)
.print "music_init = $" + toHexString(music.init)
.print "music_play = $" + toHexString(music.play)
|
alloy4fun_models/trashltl/models/14/sPg8udPdwF3z3pTzg.als | Kaixi26/org.alloytools.alloy | 0 | 605 | open main
pred idsPg8udPdwF3z3pTzg_prop15 {
eventually (all f:File | f in Trash)
}
pred __repair { idsPg8udPdwF3z3pTzg_prop15 }
check __repair { idsPg8udPdwF3z3pTzg_prop15 <=> prop15o } |
lib/sprites.asm | cppchriscpp/waddles-the-duck | 0 | 8940 | <reponame>cppchriscpp/waddles-the-duck<gh_stars>0
; Definitions for all sprites used by our app, and some useful constants.
SPRITE_TYPE_COLLECTIBLE = 0
SPRITE_TYPE_JUMPABLE_ENEMY = 1
SPRITE_TYPE_INVULN_ENEMY = 2
SPRITE_TYPE_DIMENSIONER = 3
SPRITE_TYPE_FIREBALL = 4
SPRITE_TYPE_SHARK = 5
SPRITE_TYPE_PROFESSOR = 6
SPRITE_TYPE_TELEPORT = 7
SPRITE_TYPE_TELEPORT_2 = 8
SPRITE_TYPE_GRABBER = 9
SPRITE_SIZE_DEFAULT = 0
SPRITE_SIZE_TINY = 1
SPRITE_SIZE_2X1 = 2
SPRITE_SIZE_3X1 = 3
SPRITE_SIZE_4X1 = 4
SPRITE_SIZE_TINY_NORMAL_ALIGNMENT = 5
SPRITE_SIZE_TELEPORTER = 6
SPRITE_ANIMATION_NONE = 0
SPRITE_ANIMATION_NORMAL = 1
SPRITE_ANIMATION_BINARY = 2 ; first tile, second tile, first tile, second tile...
SPRITE_ANIMATION_LR = 3 ; 1 for left, 1 for right
SPRITE_ANIMATION_FAST = 4
SPRITE_ANIMATION_DYING = $a0 ; NOTE: This must not match any dimensions or things will fall apart. This is %10100000
SPRITE_TYPE_COIN = 0
SPRITE_TYPE_TURTLE = 1
SPRITE_TYPE_GATOR = 2
SPRITE_TYPE_SNAKE = 3
SPRITE_TYPE_PLATFORM = 4
PALETTE_0 = %00000000
PALETTE_1 = %00000001
PALETTE_2 = %00000010
PALETTE_3 = %00000011
COLLECTIBLE_SPRITE_ID = 0
sprite_definitions:
; Type, width, height, size, animation, first tile id, palette, speed.
.byte SPRITE_TYPE_COLLECTIBLE, 8, 8, SPRITE_SIZE_TINY, SPRITE_ANIMATION_NONE, $2, PALETTE_0, 0 ; 0. Coin
.byte SPRITE_TYPE_JUMPABLE_ENEMY, 16, 8, SPRITE_SIZE_2X1, SPRITE_ANIMATION_NORMAL, $20, PALETTE_1, 1 ; 1. Turtle
.byte SPRITE_TYPE_JUMPABLE_ENEMY, 16, 8, SPRITE_SIZE_2X1, SPRITE_ANIMATION_NORMAL, $24, PALETTE_1, 1 ; 2. Gator
.byte SPRITE_TYPE_JUMPABLE_ENEMY, 24, 8, SPRITE_SIZE_3X1, SPRITE_ANIMATION_NORMAL, $28, PALETTE_1, 2 ; 3. Snake
.byte SPRITE_TYPE_INVULN_ENEMY, 16, 14, SPRITE_SIZE_DEFAULT, SPRITE_ANIMATION_NORMAL, $40, PALETTE_1, 1 ; 4. Militarized turtle
.byte SPRITE_TYPE_PLATFORM, 32, 8, SPRITE_SIZE_4X1, SPRITE_ANIMATION_NORMAL, $03, PALETTE_1, 0 ; Falling platform.
.byte SPRITE_TYPE_FIREBALL, 10, 11, SPRITE_SIZE_DEFAULT, SPRITE_ANIMATION_FAST, $44, PALETTE_1, 64 ; fireball (extra data/speed = how high the ball goes)
.byte SPRITE_TYPE_SHARK, 16, 8, SPRITE_SIZE_2X1, SPRITE_ANIMATION_LR, $68, PALETTE_1, 0 ; Blank sprites to keep dimension stuff on one line.
; Dimension Swappers
.byte SPRITE_TYPE_DIMENSIONER, 32, 16, SPRITE_SIZE_TINY_NORMAL_ALIGNMENT, DIMENSION_PLAIN, $0, PALETTE_0, DIMENSION_BARREN
.byte SPRITE_TYPE_DIMENSIONER, 32, 16, SPRITE_SIZE_TINY_NORMAL_ALIGNMENT, DIMENSION_PLAIN, $0, PALETTE_0, DIMENSION_ICE_AGE
.byte SPRITE_TYPE_DIMENSIONER, 32, 16, SPRITE_SIZE_TINY_NORMAL_ALIGNMENT, DIMENSION_BARREN, $0, PALETTE_0, DIMENSION_ICE_AGE
.byte SPRITE_TYPE_DIMENSIONER, 32, 16, SPRITE_SIZE_TINY_NORMAL_ALIGNMENT, DIMENSION_AGGRESSIVE, $0, PALETTE_0, DIMENSION_PLAIN
.byte SPRITE_TYPE_DIMENSIONER, 32, 16, SPRITE_SIZE_TINY_NORMAL_ALIGNMENT, DIMENSION_AGGRESSIVE, $0, PALETTE_0, DIMENSION_ICE_AGE
.byte SPRITE_TYPE_DIMENSIONER, 32, 16, SPRITE_SIZE_TINY_NORMAL_ALIGNMENT, DIMENSION_BARREN, $0, PALETTE_0, DIMENSION_AGGRESSIVE
.byte SPRITE_TYPE_DIMENSIONER, 32, 16, SPRITE_SIZE_TINY_NORMAL_ALIGNMENT, DIMENSION_AGGRESSIVE, $0, PALETTE_0, DIMENSION_END_OF_DAYS
.byte SPRITE_TYPE_DIMENSIONER, 32, 16, SPRITE_SIZE_TINY_NORMAL_ALIGNMENT, DIMENSION_PLAIN, $0, PALETTE_0, DIMENSION_END_OF_DAYS
.byte SPRITE_TYPE_PROFESSOR, 32, 32, SPRITE_SIZE_DEFAULT, SPRITE_ANIMATION_NONE, $07, PALETTE_0, 0
.byte SPRITE_TYPE_PROFESSOR, 16, 32, SPRITE_SIZE_DEFAULT, SPRITE_ANIMATION_NONE, $09, PALETTE_0, 0
.byte SPRITE_TYPE_TELEPORT, 24, 8, SPRITE_SIZE_TELEPORTER, SPRITE_ANIMATION_BINARY, $48, PALETTE_2, 0
.byte SPRITE_TYPE_TELEPORT_2, 24, 8, SPRITE_SIZE_TELEPORTER, SPRITE_ANIMATION_BINARY, $48, PALETTE_2, 0 ; Intentional duplicate... based on id, first one only shows in normal dim, second only in dark.
.byte SPRITE_TYPE_GRABBER, 16, 16, SPRITE_SIZE_DEFAULT, SPRITE_ANIMATION_NORMAL, $80, PALETTE_1, 3 |
src/timers/TurboRTimer.asm | sharksym/vgmplay-sharksym | 6 | 162298 | <reponame>sharksym/vgmplay-sharksym
;
; Turbo R high res timer
;
; 4000 Hz resolution
;
; There is a slight deviation of +1 second every 5 minutes (+0.35%).
;
TurboRTimer_SAMPLES: equ 11 ; every 64 timer cycles = 11 samples
TurboRTimer: MACRO
super: Timer TurboRTimer_Start, TurboRTimer_Stop, TurboRTimer_Reset, Update
lastTimer:
db 0
; ix = this
Update: PROC
ld b,(ix + TurboRTimer.lastTimer)
Wait:
TurboRTimer_GetTimerValue_M
cp b
jr z,Wait
ld (ix + TurboRTimer.lastTimer),a
sub b
ld l,a
ld h,0
ld c,l
ld b,h
add hl,hl ; x11 (TurboRTimer_SAMPLES)
add hl,hl
add hl,hl
add hl,bc
add hl,bc
add hl,bc
ex de,hl
jr super.Callback
ENDP
ENDM
; hl = callback
; ix = this
TurboRTimer_Construct: equ Timer_Construct
; jp Timer_Construct
; ix = this
TurboRTimer_Destruct: equ Timer_Destruct
; jp Timer_Destruct
; ix = this
TurboRTimer_Start: equ TurboRTimer_Reset
; jp TurboRTimer_Reset
; ix = this
TurboRTimer_Stop: equ System_Return
; ret
; ix = this
TurboRTimer_Reset:
TurboRTimer_GetTimerValue_M
ld (ix + TurboRTimer.lastTimer),a
ret
; ix = this
; a <- 3995 Hz timer value
TurboRTimer_GetTimerValue_M: MACRO
in a,(0E7H)
ld h,a
in a,(0E6H)
ld l,a
in a,(0E7H)
cp h
jr z,NoLapse
add a,a
add a,a
jr Continue
NoLapse:
add hl,hl
add hl,hl
ld a,h
Continue:
ENDM
; f <- c: found
TurboRTimer_Detect: equ Utils_IsTurboR
; jp Utils_IsTurboR
|
tools-src/gnu/gcc/gcc/ada/7sosinte.adb | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 4523 | <filename>tools-src/gnu/gcc/gcc/ada/7sosinte.adb
------------------------------------------------------------------------------
-- --
-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . O S _ I N T E R F A C E --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1997-2001 Florida State University --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNARL; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. It is --
-- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
-- State University (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
-- This is a FSU Threads version of this package
pragma Polling (Off);
-- Turn off polling, we do not want ATC polling to take place during
-- tasking operations. It causes infinite loops and other problems.
with Interfaces.C;
package body System.OS_Interface is
use Interfaces.C;
-----------------
-- To_Duration --
-----------------
function To_Duration (TS : timespec) return Duration is
begin
return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9;
end To_Duration;
function To_Duration (TV : struct_timeval) return Duration is
begin
return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6;
end To_Duration;
-----------------
-- To_Timespec --
-----------------
function To_Timespec (D : Duration) return timespec is
S : time_t;
F : Duration;
begin
S := time_t (Long_Long_Integer (D));
F := D - Duration (S);
-- If F has negative value due to a round-up, adjust for positive F
-- value.
if F < 0.0 then
S := S - 1;
F := F + 1.0;
end if;
return timespec' (tv_sec => S,
tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec;
----------------
-- To_Timeval --
----------------
function To_Timeval (D : Duration) return struct_timeval is
S : long;
F : Duration;
begin
S := long (Long_Long_Integer (D));
F := D - Duration (S);
-- If F has negative value due to a round-up, adjust for positive F
-- value.
if F < 0.0 then
S := S - 1;
F := F + 1.0;
end if;
return struct_timeval' (tv_sec => S,
tv_usec => long (Long_Long_Integer (F * 10#1#E6)));
end To_Timeval;
-------------
-- sigwait --
-------------
-- FSU_THREADS has a nonstandard sigwait
function sigwait
(set : access sigset_t;
sig : access Signal) return int
is
Result : int;
function sigwait_base (set : access sigset_t) return int;
pragma Import (C, sigwait_base, "sigwait");
begin
Result := sigwait_base (set);
if Result = -1 then
sig.all := 0;
return errno;
end if;
sig.all := Signal (Result);
return 0;
end sigwait;
------------------------
-- pthread_mutex_lock --
------------------------
-- FSU_THREADS has nonstandard pthread_mutex_lock and unlock.
-- It sets errno but the standard Posix requires it to be returned.
function pthread_mutex_lock (mutex : access pthread_mutex_t) return int is
function pthread_mutex_lock_base
(mutex : access pthread_mutex_t) return int;
pragma Import (C, pthread_mutex_lock_base, "pthread_mutex_lock");
Result : int;
begin
Result := pthread_mutex_lock_base (mutex);
if Result /= 0 then
return errno;
end if;
return 0;
end pthread_mutex_lock;
--------------------------
-- pthread_mutex_unlock --
--------------------------
function pthread_mutex_unlock
(mutex : access pthread_mutex_t) return int
is
function pthread_mutex_unlock_base
(mutex : access pthread_mutex_t) return int;
pragma Import (C, pthread_mutex_unlock_base, "pthread_mutex_unlock");
Result : int;
begin
Result := pthread_mutex_unlock_base (mutex);
if Result /= 0 then
return errno;
end if;
return 0;
end pthread_mutex_unlock;
-----------------------
-- pthread_cond_wait --
-----------------------
-- FSU_THREADS has a nonstandard pthread_cond_wait.
-- The FSU_THREADS version returns EINTR when interrupted.
function pthread_cond_wait
(cond : access pthread_cond_t;
mutex : access pthread_mutex_t) return int
is
function pthread_cond_wait_base
(cond : access pthread_cond_t;
mutex : access pthread_mutex_t) return int;
pragma Import (C, pthread_cond_wait_base, "pthread_cond_wait");
Result : int;
begin
Result := pthread_cond_wait_base (cond, mutex);
if Result = EINTR then
return 0;
else
return Result;
end if;
end pthread_cond_wait;
----------------------------
-- pthread_cond_timedwait --
----------------------------
-- FSU_THREADS has a nonstandard pthread_cond_timedwait. The
-- FSU_THREADS version returns -1 and set errno to EAGAIN for timeout.
function pthread_cond_timedwait
(cond : access pthread_cond_t;
mutex : access pthread_mutex_t;
abstime : access timespec) return int
is
function pthread_cond_timedwait_base
(cond : access pthread_cond_t;
mutex : access pthread_mutex_t;
abstime : access timespec) return int;
pragma Import (C, pthread_cond_timedwait_base, "pthread_cond_timedwait");
Result : int;
begin
Result := pthread_cond_timedwait_base (cond, mutex, abstime);
if Result = -1 then
if errno = EAGAIN then
return ETIMEDOUT;
else
return EINVAL;
end if;
end if;
return 0;
end pthread_cond_timedwait;
---------------------------
-- pthread_setschedparam --
---------------------------
-- FSU_THREADS does not have pthread_setschedparam
-- This routine returns a non-negative value upon failure
-- but the error code can not be set conforming the POSIX standard.
function pthread_setschedparam
(thread : pthread_t;
policy : int;
param : access struct_sched_param) return int
is
function pthread_setschedattr
(thread : pthread_t;
attr : pthread_attr_t) return int;
pragma Import (C, pthread_setschedattr, "pthread_setschedattr");
attr : aliased pthread_attr_t;
Result : int;
begin
Result := pthread_attr_init (attr'Access);
if Result /= 0 then
return Result;
end if;
attr.sched := policy;
-- Short-cut around pthread_attr_setprio
attr.prio := param.sched_priority;
Result := pthread_setschedattr (thread, attr);
if Result /= 0 then
return Result;
end if;
Result := pthread_attr_destroy (attr'Access);
if Result /= 0 then
return Result;
else
return 0;
end if;
end pthread_setschedparam;
-------------------------
-- pthread_getspecific --
-------------------------
-- FSU_THREADS has a nonstandard pthread_getspecific
function pthread_getspecific (key : pthread_key_t) return System.Address is
function pthread_getspecific_base
(key : pthread_key_t;
value : access System.Address) return int;
pragma Import (C, pthread_getspecific_base, "pthread_getspecific");
Tmp : aliased System.Address;
Result : int;
begin
Result := pthread_getspecific_base (key, Tmp'Access);
if Result /= 0 then
return System.Null_Address;
end if;
return Tmp;
end pthread_getspecific;
---------------------------------
-- pthread_attr_setdetachstate --
---------------------------------
function pthread_attr_setdetachstate
(attr : access pthread_attr_t;
detachstate : int) return int
is
function pthread_attr_setdetachstate_base
(attr : access pthread_attr_t;
detachstate : access int) return int;
pragma Import
(C, pthread_attr_setdetachstate_base, "pthread_attr_setdetachstate");
Tmp : aliased int := detachstate;
begin
return pthread_attr_setdetachstate_base (attr, Tmp'Access);
end pthread_attr_setdetachstate;
-----------------
-- sched_yield --
-----------------
-- FSU_THREADS does not have sched_yield;
function sched_yield return int is
procedure sched_yield_base (arg : System.Address);
pragma Import (C, sched_yield_base, "pthread_yield");
begin
sched_yield_base (System.Null_Address);
return 0;
end sched_yield;
----------------
-- Stack_Base --
----------------
function Get_Stack_Base (thread : pthread_t) return Address is
begin
return thread.stack_base;
end Get_Stack_Base;
end System.OS_Interface;
|
programs/oeis/021/A021263.asm | karttu/loda | 1 | 172297 | <gh_stars>1-10
; A021263: Decimal expansion of 1/259.
; 0,0,3,8,6,1,0,0,3,8,6,1,0,0,3,8,6,1,0,0,3,8,6,1,0,0,3,8,6,1,0,0,3,8,6,1,0,0,3,8,6,1,0,0,3,8,6,1,0,0,3,8,6,1,0,0,3,8,6,1,0,0,3,8,6,1,0,0,3,8,6,1,0,0,3,8,6,1,0,0,3,8,6,1,0,0,3,8,6,1,0,0,3,8,6,1,0,0,3
cal $0,21067 ; Decimal expansion of 1/63.
add $1,$0
pow $1,2
div $1,8
|
check file creator.applescript | AlexanderGalen/applescripts | 3 | 4511 | tell application "Finder"
--set myFile to "Macintosh HD:Users:maggie:Desktop:vector-test.eps" as alias
set myFile to "Macintosh HD:Users:maggie:Desktop:raster-test.eps" as alias
open for access myFile
set FileContents to read myFile
close access myFile
end tell
if FileContents contains "%%Creator: Adobe Illustrator" then
return "Vector"
else if FileContents contains "%%Creator: Adobe Photoshop" then
return "Raster"
else
return "neither"
end if |
programs/oeis/314/A314894.asm | neoneye/loda | 22 | 1460 | ; A314894: Coordination sequence Gal.6.194.3 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,5,9,14,19,24,28,33,38,43,47,52,57,61,66,71,76,80,85,90,95,99,104,109,113,118,123,128,132,137,142,147,151,156,161,165,170,175,180,184,189,194,199,203,208,213,217,222,227,232
mov $2,$0
add $2,$0
add $2,6
mov $3,$2
mov $4,$0
add $0,$2
sub $3,6
lpb $0
sub $0,1
trn $0,10
mov $1,7
add $3,3
trn $3,4
lpe
add $1,$3
add $1,3
lpb $4
add $1,3
sub $4,1
lpe
sub $1,9
mov $0,$1
|
programs/oeis/033/A033132.asm | neoneye/loda | 22 | 162720 | <reponame>neoneye/loda
; A033132: Base-5 digits are, in order, the first n terms of the periodic sequence with initial period 1,1,0.
; 1,6,30,151,756,3780,18901,94506,472530,2362651,11813256,59066280,295331401,1476657006,7383285030,36916425151,184582125756,922910628780,4614553143901,23072765719506,115363828597530,576819142987651
add $0,2
mov $3,2
mov $4,1
lpb $0
sub $0,1
mul $4,5
add $4,2
mov $5,5
lpe
mov $1,$4
sub $5,$3
mov $2,$5
mul $2,2
add $2,25
div $1,$2
mov $0,$1
|
oeis/109/A109338.asm | neoneye/loda-programs | 11 | 162604 | ; A109338: Triangle read by rows: T(n,k) = number of inequivalent binary sequences of length n and weight k, where two sequences are said to be equivalent if they have the same set of phrases in their Ziv-Lempel encodings (the phrases can appear in a different order in the two sequences).
; Submitted by <NAME>(s3)
; 1,1,1,1,1,1,1,2,2,1,1,2,2,2,1,1,2,4,4,2,1
seq $0,7318 ; Pascal's triangle read by rows: C(n,k) = binomial(n,k) = n!/(k!*(n-k)!), 0 <= k <= n.
mov $1,2
lpb $0
trn $0,$1
mul $1,2
lpe
mov $0,$1
div $0,4
|
boot/screen.asm | DriesCode/bootloaders | 6 | 178947 | section .text
clear_screen:
pusha
mov ah, 06h
mov al, 0x0
mov bh, 0x0
xor cx, cx
mov dh, 25
mov dl, 80
int 10h
popa
ret
print_str:
pusha
mov ah, 0Ah
xor bx, bx
mov cx, 1
.print_ch:
mov al, [si]
cmp al, 0
je .end
cmp al, 13
je .nwln
int 10h
call .move_cursor
inc si
jmp .print_ch
.end:
popa
ret
.move_cursor:
pusha
mov ah, 03h
xor bx, bx
int 10h
mov ah, 02h
xor bx, bx
inc dl
int 10h
popa
ret
.nwln:
pusha
mov ah, 03h
xor bx, bx
int 10h
mov ah, 02h
xor bx, bx
inc dh
mov dl, 0x0
int 10h
popa
inc si
jmp .print_ch
print_hex:
pusha ; save the register values to the stack for later
mov cx,4 ; Start the counter: we want to print 4 characters
; 4 bits per char, so we're printing a total of 16 bits
char_loop:
dec cx ; Decrement the counter
mov ax,dx ; copy bx into ax so we can mask it for the last chars
shr dx,4 ; shift bx 4 bits to the right
and ax,0xf ; mask ah to get the last 4 bits
mov bx, HEX_OUT ; set bx to the memory address of our string
add bx, 2 ; skip the '0x'
add bx, cx ; add the current counter to the address
cmp ax,0xa ; Check to see if it's a letter or number
jl set_letter ; If it's a number, go straight to setting the value
add al, 0x27 ; If it's a letter, add 0x27, and plus 0x30 down below
; ASCII letters start 0x61 for "a" characters after
; decimal numbers. We need to cover that distance.
jl set_letter
set_letter:
add al, 0x30 ; For and ASCII number, add 0x30
mov byte [bx],al ; Add the value of the byte to the char at bx
cmp cx,0 ; check the counter, compare with 0
je print_hex_done ; if the counter is 0, finish
jmp char_loop ; otherwise, loop again
print_hex_done:
mov bx, HEX_OUT ; print the string pointed to by bx
call print_string
popa ; pop the initial register values back from the stack
ret ; return the function
print_string: ; Push registers onto the stack
pusha
string_loop:
mov al, [bx] ; Set al to the value at bx
cmp al, 0 ; Compare the value in al to 0 (check for null terminator)
jne print_char ; If it's not null, print the character at al
; Otherwise the string is done, and the function is ending
popa ; Pop all the registers back onto the stack
ret ; return execution to where we were
print_char:
mov ah, 0x0e ; Linefeed printing
int 0x10 ; Print character
add bx, 1 ; Shift bx to the next character
jmp string_loop ; go back to the beginning of our loop
section .data
HEX_OUT: db '0x0000', 0
|
programs/oeis/134/A134986.asm | karttu/loda | 0 | 241900 | <gh_stars>0
; A134986: a(n) = smallest integer m not equal to n such that n = (floor(n^2/m) + m)/2.
; 2,3,2,3,4,5,5,6,7,8,9,10,10,11,12,13,14,15,16,17,17,18,19,20,21,22,23,24,25,26,26,27,28,29,30,31,32,33,34,35,36,37,37,38,39,40,41,42,43,44,45,46,47,48,49,50,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187
lpb $0,1
add $1,$0
sub $0,1
trn $0,2
add $0,4
sub $1,1
add $2,2
trn $0,$2
add $1,1
sub $1,$0
trn $0,1
lpe
trn $1,1
add $1,$0
add $1,2
|
src/lambda_dll.asm | amalchuk/lambda_core | 0 | 100414 | <filename>src/lambda_dll.asm
; Copyright 2020-2021 <NAME>. All rights reserved.
; This project is licensed under the terms of the MIT License.
format PE DLL
entry DllMain
include 'win32a.inc'
; +--------------------------------------------+
; | MACRO DEFINITIONS SECTION |
; +--------------------------------------------+
macro double number {
local ..value, ..high, ..low
virtual at 0
..value dq number
load ..high dword from 4
load ..low dword from 0
end virtual
push ..high
push ..low
}
; +--------------------------------------------+
; | CODE SECTION |
; +--------------------------------------------+
allocate:
cmp dword [.address], 0
jz .initialize
@@:
push ecx
push 0
push dword [.address]
call [HeapAlloc]
ret
.initialize:
call [GetProcessHeap]
test eax, eax
jz .error
mov dword [.address], eax
jmp @b
.error:
ret
.address:
dd 0
splicing:
push ebx edi ebp
pushfd
cld
mov ebx, ecx
mov ecx, ebx
add ecx, 5h
call allocate
test eax, eax
jz .finish
push edi
mov ecx, ebx
mov edi, eax
rep movsb
sub esi, ebx
pop edi
mov byte [eax + ebx], 0E9h
mov edx, esi
sub edx, eax
sub edx, 5h
mov dword [eax + ebx + 1], edx
push eax
mov ebp, esi
and ebp, 0FFFFF000h
push .protection
push PAGE_EXECUTE_READWRITE
push 1000h
push ebp
call [VirtualProtect]
mov byte [esi], 0E9h
mov edx, edi
sub edx, esi
sub edx, 5h
mov dword [esi + 1], edx
cmp ebx, 5h
jle .cleanup
mov ecx, ebx
sub ecx, 5h
mov edi, esi
add edi, 5h
mov al, 90h
rep stosb
.cleanup:
push .protection
push dword [.protection]
push 1000h
push ebp
call [VirtualProtect]
pop eax
.finish:
popfd
pop ebp edi ebx
ret
.protection:
dd ?
proc DetourFunction uses esi edi ecx, procedure, gateway, length
mov ecx, dword [length]
add ecx, 5h
mov edi, dword [gateway]
mov esi, dword [procedure]
call splicing
ret
endp
proc hacked_glBegin mode
cmp [mode], GL_TRIANGLES
je .enable_wallhack
cmp [mode], GL_TRIANGLE_STRIP
je .enable_wallhack
cmp [mode], GL_TRIANGLE_FAN
je .enable_wallhack
cmp [mode], GL_QUADS
je .disable_wallhack
cmp [mode], GL_QUAD_STRIP
je .disable_wallhack
cmp [mode], GL_POLYGON
je .disable_wallhack
@@:
xor eax, eax
jmp @f
.enable_wallhack:
cmp [found_an_entity], 1
je @b
mov [found_an_entity], 1
double 0.5
double 0.0
call [glDepthRange]
jmp @b
.disable_wallhack:
cmp [found_an_entity], 0
je @b
mov [found_an_entity], 0
double 1.0
double 0.0
call [glDepthRange]
jmp @b
@@:
push [mode]
call [original_glBegin]
ret
endp
proc hacked_glVertex3f x, y, z
push 1.0
push 1.0
push 1.0
call [glColor3f]
@@:
push [z]
push [y]
push [x]
call [original_glVertex3f]
ret
endp
main:
stdcall DetourFunction, [glBegin], hacked_glBegin, 6h
mov [original_glBegin], eax
stdcall DetourFunction, [glVertex3f], hacked_glVertex3f, 6h
mov [original_glVertex3f], eax
proc DllMain hinstDLL, fdwReason, lpvReserved
cmp [fdwReason], DLL_PROCESS_ATTACH
jne @f
invoke DisableThreadLibraryCalls, [hinstDLL]
test eax, eax
jz @f
invoke CreateThread, 0, 0, main, 0, 0, 0
test eax, eax
jz @f
invoke CloseHandle, eax
@@:
mov eax, TRUE
ret
endp
; +--------------------------------------------+
; | OPTIONS SECTION |
; +--------------------------------------------+
; Global variables:
found_an_entity dd 0
; Original OpenGL functions:
original_glBegin dd ?
original_glVertex3f dd ?
; Primitives:
GL_TRIANGLES = 4h
GL_TRIANGLE_STRIP = 5h
GL_TRIANGLE_FAN = 6h
GL_QUADS = 7h
GL_QUAD_STRIP = 8h
GL_POLYGON = 9h
; +--------------------------------------------+
; | IMPORT SECTION |
; +--------------------------------------------+
data import
dd 0, 0, 0, RVA kernel_name, RVA kernel_table
dd 0, 0, 0, RVA opengl_name, RVA opengl_table
dd 0, 0, 0, 0, 0
kernel_name db 'kernel32.dll', 0
opengl_name db 'opengl32.dll', 0
kernel_table:
CloseHandle dd RVA _CloseHandle
CreateThread dd RVA _CreateThread
DisableThreadLibraryCalls dd RVA _DisableThreadLibraryCalls
GetProcessHeap dd RVA _GetProcessHeap
HeapAlloc dd RVA _HeapAlloc
VirtualProtect dd RVA _VirtualProtect
dd 0
opengl_table:
glBegin dd RVA _glBegin
glColor3f dd RVA _glColor3f
glDepthRange dd RVA _glDepthRange
glVertex3f dd RVA _glVertex3f
dd 0
; kernel32.dll =>
_CloseHandle dw 0
db 'CloseHandle', 0
_CreateThread dw 0
db 'CreateThread', 0
_DisableThreadLibraryCalls dw 0
db 'DisableThreadLibraryCalls', 0
_GetProcessHeap dw 0
db 'GetProcessHeap', 0
_HeapAlloc dw 0
db 'HeapAlloc', 0
_VirtualProtect dw 0
db 'VirtualProtect', 0
; opengl32.dll =>
_glBegin dw 0
db 'glBegin', 0
_glColor3f dw 0
db 'glColor3f', 0
_glDepthRange dw 0
db 'glDepthRange', 0
_glVertex3f dw 0
db 'glVertex3f', 0
end data
; +--------------------------------------------+
; | FIXUPS SECTION |
; +--------------------------------------------+
section '.reloc' fixups data readable discardable
|
unix/inet-internal-os_constants.adb | annexi-strayline/ASAP-INET | 0 | 17187 | ------------------------------------------------------------------------------
-- --
-- Internet Protocol Suite Package --
-- --
-- ------------------------------------------------------------------------ --
-- --
-- Copyright (C) 2020, ANNEXI-STRAYLINE Trans-Human Ltd. --
-- All rights reserved. --
-- --
-- Original Contributors: --
-- * <NAME> (ANNEXI-STRAYLINE) --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- --
-- * Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
package body INET.Internal.OS_Constants is
function To_Timespec (T: Duration) return timespec is
Nanosecond_Factor : constant := 1_000_000_000;
Whole_Seconds_Rounded: constant Natural := Natural (T);
-- The ARM explicitly states that a type conversion from a real type to
-- an integer type causes a mathematical rounding, rather than a
-- truncation.
Whole_Seconds: Duration := Duration (Whole_Seconds_Rounded);
begin
-- Whole_Seconds is rounded. But we want the actual seconds component,
-- so we check if it rounded up here.
if Whole_Seconds > T then
Whole_Seconds := Whole_Seconds - 1.0;
end if;
return ts: timespec do
ts.tv_sec := time_t (Whole_Seconds);
ts.tv_nsec := long ((T - Whole_Seconds) * Nanosecond_Factor);
end return;
end To_Timespec;
end INET.Internal.OS_Constants;
|
programs/oeis/173/A173855.asm | neoneye/loda | 22 | 4931 | ; A173855: a(n) = A173039(n+4) - A173039(n+1).
; 8,4,24,40,12,56,72,20,88,104,28,120,136,36,152,168,44,184,200,52,216,232,60,248,264,68,280,296,76,312,328,84,344,360,92,376,392,100,408,424,108,440,456,116,472,488,124,504,520,132,536,552,140,568,584,148,600,616,156,632,648,164,664,680,172,696,712,180,728,744,188,760,776,196,792,808,204,824,840,212,856,872,220,888,904,228,920,936,236,952,968,244,984,1000,252,1016,1032,260,1048,1064
mul $0,2
mov $1,$0
seq $1,122918 ; Expansion of (1+x)^2/(1+x+x^2)^2.
add $0,$1
mul $0,4
add $0,4
|
sound/sfxasm/9C.asm | NatsumiFox/Sonic-3-93-Nov-03 | 7 | 99786 | 9C_Header:
sHeaderInit ; Z80 offset is $D258
sHeaderPatch 9C_Patches
sHeaderTick $01
sHeaderCh $01
sHeaderSFX $80, $05, 9C_FM5, $00, $05
9C_FM5:
sPatFM $00
ssModZ80 $01, $01, $C1, $8E
dc.b nC0, $04, $04, $04, $04
sStop
9C_Patches:
; Patch $00
; $F9
; $22, $30, $20, $30, $10, $09, $1F, $1F
; $00, $18, $09, $02, $0C, $1F, $10, $05
; $0F, $2F, $4F, $2F, $11, $07, $04, $80
spAlgorithm $01
spFeedback $07
spDetune $02, $02, $03, $03
spMultiple $02, $00, $00, $00
spRateScale $00, $00, $00, $00
spAttackRt $10, $1F, $09, $1F
spAmpMod $00, $00, $00, $00
spSustainRt $00, $09, $18, $02
spSustainLv $00, $04, $02, $02
spDecayRt $0C, $10, $1F, $05
spReleaseRt $0F, $0F, $0F, $0F
spTotalLv $11, $04, $07, $00
|
programs/oeis/329/A329193.asm | karttu/loda | 0 | 20942 | ; A329193: a(n) = floor(log_2(n^3)) = floor(3 log_2(n))
; 0,3,4,6,6,7,8,9,9,9,10,10,11,11,11,12,12,12,12,12,13,13,13,13,13,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,18,18
add $0,1
pow $0,3
log $0,2
mov $1,$0
|
Asn1/parser/src/grammar/CoolParser.g4 | abhinavg97/Compilers-2 | 0 | 2919 | <gh_stars>0
parser grammar CoolParser;
options {
tokenVocab = CoolLexer;
}
@header{
import cool.AST;
import java.util.List;
}
@members{
String filename;
public void setFilename(String f){
filename = f;
}
/*
DO NOT EDIT THE FILE ABOVE THIS LINE
Add member functions, variables below.
*/
}
/*
Add Grammar rules and appropriate actions for building AST below.
*/
// Grammar for Cool , taken from cool manual and the actions are added appropriately to build an AST.
program returns [AST.program value] :
cl=class_list EOF
{
$value = new AST.program($cl.value, $cl.value.get(0).lineNo);
}
;
class_list returns [ArrayList<AST.class_> value]
/* [class]+ */
@init
{
$value = new ArrayList<AST.class_>();
}
:
(c = class_ SEMICOLON {$value.add($c.value);})+
;
class_ returns [AST.class_ value] :
/* class TYPE [inherits TYPE] {[[feature]]*} */
cls=CLASS type=TYPEID INHERITS parent_type=TYPEID LBRACE fl=feature_list RBRACE
{
$value = new AST.class_($type.getText(), filename, $parent_type.getText(), $fl.value, $cls.getLine());
}
| cls=CLASS type=TYPEID LBRACE fl=feature_list RBRACE
{
/* using Object as the parent_type.getText() value to conform with the class_ method in AST.java */
$value = new AST.class_($type.getText(), filename, "Object", $fl.value, $cls.getLine());
}
;
feature_list returns [ArrayList <AST.feature> value]
/* [feature;]* */
@init
{
$value = new ArrayList<AST.feature>();
}
:
(c=feature SEMICOLON {$value.add($c.value);})*
;
feature returns [AST.feature value]:
/* method|attribute */
// we are not using the feature method as defined in AST.java file as it consists of attribute or method and those methods are used instead to return the appropriate value
function=method
{
$value=$function.value;
}
| attribute=attr
{
$value=$attribute.value;
}
;
attr returns [AST.attr value]:
/* ID: TYPE [<- expr] */
id=OBJECTID COLON type=TYPEID ASSIGN expr=expression
{
$value = new AST.attr($id.getText(), $type.getText(), $expr.value, $id.getLine());
}
|
id=OBJECTID COLON type=TYPEID
{
// creating a dummy expression from the no_expr method of AST.java to conform with the attr method of AST.java
$value = new AST.attr($id.getText(), $type.getText(), new AST.no_expr($id.getLine()), $id.getLine());
}
;
method returns [AST.method value]:
/* ID([formal [,formal]*]) : TYPE {expr} */
id=OBJECTID LPAREN fl=formal_list RPAREN COLON type=TYPEID LBRACE expr=expression RBRACE
{
$value = new AST.method($id.getText(), $fl.value, $type.getText(), $expr.value, $id.getLine());
}
|
id=OBJECTID LPAREN RPAREN COLON type=TYPEID LBRACE expr=expression RBRACE
{
// creating a dummy form,al list to be passed to conform with the method method() given in AST.java file
$value = new AST.method($id.getText(), new ArrayList<AST.formal>(), $type.getText(), $expr.value, $id.getLine());
}
;
formal_list returns [ArrayList<AST.formal> value]
/* formal [,formal]* */
@init
{
$value = new ArrayList<AST.formal>();
}
:
c = formal {$value.add($c.value);}
(COMMA y = formal {$value.add($y.value);})*
;
formal returns [AST.formal value]:
/* ID : TYPE */
id=OBJECTID COLON type=TYPEID
{
$value = new AST.formal($id.getText(), $type.getText(), $id.getLine()) ;
}
;
expression_list returns [ArrayList<AST.expression> value]
/* [expr [[, expr]]* ] */
@init
{
$value = new ArrayList<AST.expression>();
}
:
(expr=expression {$value.add($expr.value);} (COMMA expr=expression {$value.add($expr.value);})* )?
;
expr_list returns [ArrayList<AST.expression> value]
@init
{
$value = new ArrayList<AST.expression>();
}
:
(expr = expression SEMICOLON {$value.add($expr.value);})+
;
branch_list returns [ArrayList<AST.branch> value]
/* [branch ;]+ */
@init
{
$value = new ArrayList<AST.branch>();
}
:
(br = branch SEMICOLON {$value.add($br.value);})+
;
branch returns [AST.branch value] :
/* ID : TYPE => expr */
id=OBJECTID COLON type=TYPEID DARROW expr=expression
{
$value = new AST.branch($id.getText(), $type.getText(), $expr.value, $id.getLine());
}
;
let_list returns [ArrayList<AST.attr> value]
/* attr [, attr]* */
@init
{
$value = new ArrayList<AST.attr>();
}
:
c = attr { $value.add($c.value); }
(COMMA y = attr {$value.add($y.value);})*
;
expression returns [AST.expression value]:
// expr[@TYPE].ID([expr [[, expr]]* ])
expr=expression DOT id=OBJECTID LPAREN exp_list=expression_list RPAREN
{
$value = new AST.dispatch($expr.value, $id.getText(), $exp_list.value, $id.getLine());
}
| expr=expression ATSYM type=TYPEID DOT id=OBJECTID LPAREN exp_list=expression_list RPAREN
{
$value = new AST.static_dispatch($expr.value, $type.getText(), $id.getText(), $exp_list.value, $id.getLine());
}
/*ID ( [expr [[, expr]]* ]) */
| id=OBJECTID LPAREN exp_list=expression_list RPAREN
{ // we are using object method as a dummy expression to conform with the method of dispatch in AST.java file
$value = new AST.dispatch(new AST.object("self" , $id.getLine()) , $id.getText() , $exp_list.value , $id.getLine());
}
/* ~ expr */
| st=TILDE expr=expression
{
$value = new AST.comp($expr.value, $st.getLine());
}
/* isvoid expr */
| st=ISVOID expr=expression
{
$value = new AST.isvoid($expr.value, $st.getLine());
}
/* expr * expr */
| exp1=expression STAR exp2=expression
{
$value = new AST.mul($exp1.value, $exp2.value, $exp1.value.lineNo);
}
/* expr / expr */
| exp1=expression SLASH exp2=expression
{
$value = new AST.divide($exp1.value, $exp2.value, $exp1.value.lineNo);
}
/* expr + expr */
| exp1=expression PLUS exp2=expression
{
$value = new AST.plus($exp1.value, $exp2.value, $exp1.value.lineNo);
}
/* expr - expr */
| exp1=expression MINUS exp2=expression
{
$value = new AST.sub($exp1.value, $exp2.value, $exp1.value.lineNo);
}
/* expr < expr */
| exp1=expression LT exp2=expression
{
$value = new AST.lt($exp1.value, $exp2.value, $exp1.value.lineNo);
}
/* expr <= expr */
| exp1=expression LE exp2=expression
{
$value = new AST.leq($exp1.value, $exp2.value, $exp1.value.lineNo);
}
/* expr = expr */
| exp1=expression EQUALS exp2=expression
{
$value = new AST.eq($exp1.value, $exp2.value, $exp1.value.lineNo);
}
/* not expr */
| st=NOT expr=expression
{
$value = new AST.neg($expr.value, $st.getLine());
}
/* ID <- expr */
|id=OBJECTID ASSIGN expr=expression
{
$value = new AST.assign($id.getText(), $expr.value, $id.getLine());
}
/* if expr then expr else expr fi*/
| st=IF predicate=expression THEN ifbody=expression ELSE elsebody=expression FI
{
$value = new AST.cond($predicate.value, $ifbody.value, $elsebody.value, $st.getLine());
}
/* while expr loop expr pool */
| st=WHILE predicate=expression LOOP body=expression POOL
{
$value = new AST.loop($predicate.value, $body.value, $st.getLine());
}
// { [[expr]]* } //
| st=LBRACE el=expr_list RBRACE
{
// block method as defined in AST.java file
$value = new AST.block($el.value, $st.getLine());
}
// let ID:TYPE [[, ID : TYPE [<- expr]]]* in expr //
| st=LET ll=let_list IN expr=expression
{
$value = $expr.value;
AST.attr current_atr;
int i = $ll.value.size() - 1;
while(i>=0)
{
current_atr = $ll.value.get(i);
$value = new AST.let(current_atr.name, current_atr.typeid,current_atr.value, $value, $st.getLine());
i--;
}
}
// case expr of [[ID : TYPE => expr;]]+ esac //
| st=CASE predicate=expression OF bl=branch_list ESAC
{
$value = new AST.typcase($predicate.value, $bl.value, $st.getLine());
}
/* new TYPE */
| st=NEW type=TYPEID
{
$value = new AST.new_($type.getText(), $st.getLine());
}
/* (expr) */
| LPAREN expr=expression RPAREN
{
$value = $expr.value;
}
/* ID */
| id=OBJECTID
{
$value = new AST.object($id.getText(), $id.getLine());
}
/* integer */
| var=INT_CONST
{ // java method Integer.parseInt is used here to convert string to int conforming to the function defined in AST.java file
$value = new AST.int_const(Integer.parseInt($var.getText()), $var.getLine());
}
/* string */
| var=STR_CONST
{
$value = new AST.string_const($var.getText(), $var.getLine());
}
/* true / false */
| var=BOOL_CONST
{
$value = new AST.bool_const($var.getText().charAt(0)=='t', $var.getLine());
}
; |
data/pokemon/base_stats/breloom.asm | AtmaBuster/pokeplat-gen2 | 6 | 174649 | <filename>data/pokemon/base_stats/breloom.asm<gh_stars>1-10
db 0 ; species ID placeholder
db 60, 130, 80, 70, 60, 60
; hp atk def spd sat sdf
db GRASS, FIGHTING ; type
db 90 ; catch rate
db 165 ; base exp
db NO_ITEM, BERRY ; items
db GENDER_F12_5 ; gender ratio
db 15 ; step cycles to hatch
INCBIN "gfx/pokemon/breloom/front.dimensions"
db GROWTH_FLUCTUATING ; growth rate
dn EGG_FAIRY, EGG_PLANT ; egg groups
db 70 ; happiness
; tm/hm learnset
tmhm FOCUS_PUNCH, TOXIC, BULK_UP, BULLET_SEED, HIDDEN_POWER, SUNNY_DAY, HYPER_BEAM, PROTECT, GIGA_DRAIN, SAFEGUARD, FRUSTRATION, SOLARBEAM, IRON_TAIL, RETURN, BRICK_BREAK, DOUBLE_TEAM, SLUDGE_BOMB, ROCK_TOMB, FACADE, SECRET_POWER, REST, ATTRACT, SNATCH, FOCUS_BLAST, ENERGY_BALL, FLING, ENDURE, DRAIN_PUNCH, GIGA_IMPACT, FLASH, STONE_EDGE, SWORDS_DANCE, CAPTIVATE, ROCK_SLIDE, SLEEP_TALK, NATURAL_GIFT, GRASS_KNOT, SWAGGER, SUBSTITUTE, CUT, STRENGTH, ROCK_SMASH, FURY_CUTTER, HELPING_HAND, MUD_SLAP, SEED_BOMB, SNORE, SUPERPOWER, SYNTHESIS, THUNDERPUNCH, VACUUM_WAVE
; end
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca_notsx.log_21829_129.asm | ljhsiun2/medusa | 9 | 242134 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %rcx
push %rdx
push %rsi
// Faulty Load
lea addresses_D+0x31b8, %rdx
nop
nop
nop
nop
nop
cmp $18579, %rcx
mov (%rdx), %si
lea oracles, %r13
and $0xff, %rsi
shlq $12, %rsi
mov (%r13,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rcx
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D', 'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 0}}
<gen_prepare_buffer>
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
externals/mpir-3.0.0/mpn/sparc32/v9/udiv.asm | JaminChan/eos_win | 12 | 95422 | <filename>externals/mpir-3.0.0/mpn/sparc32/v9/udiv.asm
dnl SPARC v9 32-bit mpn_udiv_qrnnd - division support for longlong.h.
dnl Copyright 2002, 2003 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 2.1 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library; see the file COPYING.LIB. If not, write
dnl to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
dnl Boston, MA 02110-1301, USA.
include(`../config.m4')
C INPUT PARAMETERS
C rem_ptr o0
C n1 o1
C n0 o2
C d o3
ASM_START()
PROLOGUE(mpn_udiv_qrnnd)
sllx %o1, 32, %g1 C shift upper dividend limb
srl %o2, 0, %g2 C zero extend lower dividend limb
srl %o3, 0, %g3 C zero extend divisor
or %g2, %g1, %g1 C assemble 64-bit dividend
udivx %g1, %g3, %g1
mulx %g1, %g3, %g4
sub %g2, %g4, %g2
st %g2, [%o0] C store remainder
retl
mov %g1, %o0 C return quotient
EPILOGUE(mpn_udiv_qrnnd)
|
scripts/CaptureOne/Geotag from GPS.applescript | bezineb5/gps-toolchain | 0 | 1281 | <filename>scripts/CaptureOne/Geotag from GPS.applescript
set backupPath to ""
set parentImageFile to ""
-- Retrieve the current image selected in Capture One
tell application "Capture One 12"
repeat with variantItem in (get selected variants)
set parentImageFile to (get path of (get parent image of variantItem))
if (parentImageFile is not equal to "") then exit repeat
end repeat
end tell
if (parentImageFile is equal to "") then
display dialog "No path found. Did you select an image?"
return
end if
-- Get the path to the image
set parentImagePath to (parentFolderOf for parentImageFile)
-- Call the python script
set commandLine to "eval `/usr/libexec/path_helper -s`; python3 -m autogps"
if (parentImageFile is not equal to "") then
set commandLine to (commandLine & " --backup \"" & backupPath & "\"")
end if
set commandLine to (commandLine & " \"" & parentImagePath & "\"")
do shell script commandLine
-- Notify the user
display notification "Images successfully geotagged"
-- From: https://stackoverflow.com/questions/30823900/getting-directory-of-input-file-applescript
to parentFolderOf for pxPath
-- Assumes no superfluous slashes
set {tids, text item delimiters, i} to {text item delimiters, "/", ((pxPath ends with "/") as integer) + 1}
set {parFol, text item delimiters} to {text 1 thru text item -(i + 1) of pxPath, tids}
return parFol
end parentFolderOf
|
win32/VC10/Win32/libxml2_Release/xmlreader.asm | txwizard/libxml2_x64_and_ARM | 0 | 10574 | <reponame>txwizard/libxml2_x64_and_ARM<filename>win32/VC10/Win32/libxml2_Release/xmlreader.asm
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27027.1
TITLE C:\Users\DAG\Documents\_Clients\CodeProject Authors Group\Windows on ARM\libxml2\libxml2-2.9.9\xmlreader.c
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB MSVCRT
INCLUDELIB OLDNAMES
_DATA SEGMENT
COMM _xmlMalloc:DWORD
COMM _xmlMallocAtomic:DWORD
COMM _xmlRealloc:DWORD
COMM _xmlFree:DWORD
COMM _xmlMemStrdup:DWORD
COMM _xmlIsBaseCharGroup:BYTE:010H
COMM _xmlIsCharGroup:BYTE:010H
COMM _xmlIsCombiningGroup:BYTE:010H
COMM _xmlIsDigitGroup:BYTE:010H
COMM _xmlIsExtenderGroup:BYTE:010H
COMM _xmlIsIdeographicGroup:BYTE:010H
COMM _xmlIsPubidChar_tab:BYTE:0100H
COMM _xmlParserMaxDepth:DWORD
COMM _forbiddenExp:DWORD
COMM _emptyExp:DWORD
_DATA ENDS
msvcjmc SEGMENT
__188180DA_corecrt_math@h DB 01H
__2CC6E67D_corecrt_stdio_config@h DB 01H
__05476D76_corecrt_wstdio@h DB 01H
__A452D4A0_stdio@h DB 01H
__4384A2D9_corecrt_memcpy_s@h DB 01H
__4E51A221_corecrt_wstring@h DB 01H
__2140C079_string@h DB 01H
__7B7A869E_ctype@h DB 01H
__BC13D883_xmlreader@c DB 01H
msvcjmc ENDS
PUBLIC ___local_stdio_printf_options
PUBLIC _printf
PUBLIC _xmlNewTextReader
PUBLIC _xmlNewTextReaderFilename
PUBLIC _xmlFreeTextReader
PUBLIC _xmlTextReaderSetup
PUBLIC _xmlTextReaderRead
PUBLIC _xmlTextReaderReadInnerXml
PUBLIC _xmlTextReaderReadOuterXml
PUBLIC _xmlTextReaderReadString
PUBLIC _xmlTextReaderReadAttributeValue
PUBLIC _xmlTextReaderAttributeCount
PUBLIC _xmlTextReaderDepth
PUBLIC _xmlTextReaderHasAttributes
PUBLIC _xmlTextReaderHasValue
PUBLIC _xmlTextReaderIsDefault
PUBLIC _xmlTextReaderIsEmptyElement
PUBLIC _xmlTextReaderNodeType
PUBLIC _xmlTextReaderQuoteChar
PUBLIC _xmlTextReaderReadState
PUBLIC _xmlTextReaderIsNamespaceDecl
PUBLIC _xmlTextReaderConstBaseUri
PUBLIC _xmlTextReaderConstLocalName
PUBLIC _xmlTextReaderConstName
PUBLIC _xmlTextReaderConstNamespaceUri
PUBLIC _xmlTextReaderConstPrefix
PUBLIC _xmlTextReaderConstXmlLang
PUBLIC _xmlTextReaderConstString
PUBLIC _xmlTextReaderConstValue
PUBLIC _xmlTextReaderBaseUri
PUBLIC _xmlTextReaderLocalName
PUBLIC _xmlTextReaderName
PUBLIC _xmlTextReaderNamespaceUri
PUBLIC _xmlTextReaderPrefix
PUBLIC _xmlTextReaderXmlLang
PUBLIC _xmlTextReaderValue
PUBLIC _xmlTextReaderClose
PUBLIC _xmlTextReaderGetAttributeNo
PUBLIC _xmlTextReaderGetAttribute
PUBLIC _xmlTextReaderGetAttributeNs
PUBLIC _xmlTextReaderGetRemainder
PUBLIC _xmlTextReaderLookupNamespace
PUBLIC _xmlTextReaderMoveToAttributeNo
PUBLIC _xmlTextReaderMoveToAttribute
PUBLIC _xmlTextReaderMoveToAttributeNs
PUBLIC _xmlTextReaderMoveToFirstAttribute
PUBLIC _xmlTextReaderMoveToNextAttribute
PUBLIC _xmlTextReaderMoveToElement
PUBLIC _xmlTextReaderNormalization
PUBLIC _xmlTextReaderConstEncoding
PUBLIC _xmlTextReaderSetParserProp
PUBLIC _xmlTextReaderGetParserProp
PUBLIC _xmlTextReaderCurrentNode
PUBLIC _xmlTextReaderGetParserLineNumber
PUBLIC _xmlTextReaderGetParserColumnNumber
PUBLIC _xmlTextReaderPreserve
PUBLIC _xmlTextReaderPreservePattern
PUBLIC _xmlTextReaderCurrentDoc
PUBLIC _xmlTextReaderExpand
PUBLIC _xmlTextReaderNext
PUBLIC _xmlTextReaderNextSibling
PUBLIC _xmlTextReaderIsValid
PUBLIC _xmlTextReaderRelaxNGValidate
PUBLIC _xmlTextReaderRelaxNGValidateCtxt
PUBLIC _xmlTextReaderRelaxNGSetSchema
PUBLIC _xmlTextReaderSchemaValidate
PUBLIC _xmlTextReaderSchemaValidateCtxt
PUBLIC _xmlTextReaderSetSchema
PUBLIC _xmlTextReaderConstXmlVersion
PUBLIC _xmlTextReaderStandalone
PUBLIC _xmlTextReaderByteConsumed
PUBLIC _xmlReaderWalker
PUBLIC _xmlReaderForDoc
PUBLIC _xmlReaderForFile
PUBLIC _xmlReaderForMemory
PUBLIC _xmlReaderForFd
PUBLIC _xmlReaderForIO
PUBLIC _xmlReaderNewWalker
PUBLIC _xmlReaderNewDoc
PUBLIC _xmlReaderNewFile
PUBLIC _xmlReaderNewMemory
PUBLIC _xmlReaderNewFd
PUBLIC _xmlReaderNewIO
PUBLIC _xmlTextReaderLocatorLineNumber
PUBLIC _xmlTextReaderLocatorBaseURI
PUBLIC _xmlTextReaderSetErrorHandler
PUBLIC _xmlTextReaderSetStructuredErrorHandler
PUBLIC _xmlTextReaderGetErrorHandler
PUBLIC __JustMyCode_Default
PUBLIC ??_C@_0BE@MPMNBMMA@xmlMalloc?5failed?5?$CB?6@ ; `string'
PUBLIC ??_C@_0BF@DCPGEBNC@xmlRealloc?5failed?5?$CB?6@ ; `string'
PUBLIC ??_C@_01JLIPDDHJ@?3@ ; `string'
PUBLIC ??_C@_0BB@DOFEEJAH@Expand?5failed?5?$CB?6@ ; `string'
PUBLIC ??_C@_00CNPNBAHC@@ ; `string'
PUBLIC ??_C@_0CA@MIIEHMNN@http?3?1?1www?4w3?4org?12003?1XInclude@ ; `string'
PUBLIC ??_C@_0CA@JAOIMFBM@http?3?1?1www?4w3?4org?12001?1XInclude@ ; `string'
PUBLIC ??_C@_0GL@PIJMIJNC@c?3?2users?2dag?2documents?2_clients@ ; `string'
PUBLIC ??_C@_0BO@MDEMDPPE@Unimplemented?5block?5at?5?$CFs?3?$CFd?6@ ; `string'
PUBLIC ??_C@_0CC@HCDAIILG@xmlNewTextReader?5?3?5malloc?5faile@ ; `string'
PUBLIC ??_C@_05PPEFOGKI@xmlns@ ; `string'
PUBLIC ??_C@_0BO@GBJIDPIB@http?3?1?1www?4w3?4org?12000?1xmlns?1@ ; `string'
PUBLIC ??_C@_05NOBOONOA@?$CDtext@ ; `string'
PUBLIC ??_C@_0P@LIENAFBO@?$CDcdata?9section@ ; `string'
PUBLIC ??_C@_08FBDKDMPC@?$CDcomment@ ; `string'
PUBLIC ??_C@_09DFKKGJPK@?$CDdocument@ ; `string'
PUBLIC ??_C@_0BD@FMMPJIKP@?$CDdocument?9fragment@ ; `string'
PUBLIC ??_C@_0CE@MNBJMFAB@xmlTextReaderSetup?5?3?5malloc?5fai@ ; `string'
PUBLIC ??_C@_02DKCKIIND@?$CFs@ ; `string'
PUBLIC ??_C@_0BE@KJPJIHAO@vsnprintf?5failed?5?$CB?6@ ; `string'
PUBLIC ??_C@_07FHOHOHLG@include@ ; `string'
EXTRN _xmlStrdup:PROC
EXTRN _xmlStrEqual:PROC
EXTRN _xmlStrlen:PROC
EXTRN _xmlStrcat:PROC
EXTRN __imp____acrt_iob_func:PROC
EXTRN __imp____stdio_common_vfprintf:PROC
EXTRN __imp____stdio_common_vsprintf:PROC
EXTRN _xmlBufContent:PROC
EXTRN _xmlBufUse:PROC
EXTRN _xmlBufShrink:PROC
EXTRN _xmlDictCreate:PROC
EXTRN _xmlDictFree:PROC
EXTRN _xmlDictLookup:PROC
EXTRN _xmlDictQLookup:PROC
EXTRN _xmlDictOwns:PROC
EXTRN _xmlSplitQName2:PROC
EXTRN _xmlBufferCreate:PROC
EXTRN _xmlBufferFree:PROC
EXTRN _xmlBufferCat:PROC
EXTRN _xmlFreeDtd:PROC
EXTRN _xmlFreeNs:PROC
EXTRN _xmlFreeNsList:PROC
EXTRN _xmlFreeDoc:PROC
EXTRN _xmlCopyDtd:PROC
EXTRN _xmlNewDocText:PROC
EXTRN _xmlDocCopyNode:PROC
EXTRN _xmlGetLineNo:PROC
EXTRN _xmlIsBlankNode:PROC
EXTRN _xmlUnlinkNode:PROC
EXTRN _xmlFreeNode:PROC
EXTRN _xmlSearchNs:PROC
EXTRN _xmlGetNoNsProp:PROC
EXTRN _xmlGetNsProp:PROC
EXTRN _xmlNodeListGetString:PROC
EXTRN _xmlBufGetNodeContent:PROC
EXTRN _xmlNodeGetLang:PROC
EXTRN _xmlNodeGetSpacePreserve:PROC
EXTRN _xmlNodeGetBase:PROC
EXTRN _xmlNodeDump:PROC
EXTRN _xmlHashFree:PROC
EXTRN _xmlHashLookup:PROC
EXTRN _xmlParserError:PROC
EXTRN _xmlParserWarning:PROC
EXTRN _xmlParserValidityError:PROC
EXTRN _xmlParserValidityWarning:PROC
EXTRN _xmlIsID:PROC
EXTRN _xmlFreeRefTable:PROC
EXTRN _xmlValidatePushElement:PROC
EXTRN _xmlValidatePushCData:PROC
EXTRN _xmlValidatePopElement:PROC
EXTRN _xmlFindCharEncodingHandler:PROC
EXTRN _xmlAllocParserInputBuffer:PROC
EXTRN _xmlParserInputBufferCreateFilename:PROC
EXTRN _xmlParserInputBufferCreateFd:PROC
EXTRN _xmlParserInputBufferCreateStatic:PROC
EXTRN _xmlParserInputBufferCreateIO:PROC
EXTRN _xmlParserInputBufferRead:PROC
EXTRN _xmlFreeParserInputBuffer:PROC
EXTRN _xmlParserGetDirectory:PROC
EXTRN _xmlStopParser:PROC
EXTRN _xmlFreeParserCtxt:PROC
EXTRN _xmlCreatePushParserCtxt:PROC
EXTRN _xmlParseChunk:PROC
EXTRN _xmlByteConsumed:PROC
EXTRN _xmlCtxtReset:PROC
EXTRN _xmlCtxtUseOptions:PROC
EXTRN _xmlSAXVersion:PROC
EXTRN ___xmlGenericError:PROC
EXTRN ___xmlGenericErrorContext:PROC
EXTRN ___xmlDeregisterNodeDefaultValue:PROC
EXTRN _xmlRelaxNGNewParserCtxt:PROC
EXTRN _xmlRelaxNGFreeParserCtxt:PROC
EXTRN _xmlRelaxNGSetParserErrors:PROC
EXTRN _xmlRelaxNGParse:PROC
EXTRN _xmlRelaxNGFree:PROC
EXTRN _xmlRelaxNGSetValidErrors:PROC
EXTRN _xmlRelaxNGSetValidStructuredErrors:PROC
EXTRN _xmlRelaxNGNewValidCtxt:PROC
EXTRN _xmlRelaxNGFreeValidCtxt:PROC
EXTRN _xmlRelaxNGValidatePushElement:PROC
EXTRN _xmlRelaxNGValidatePushCData:PROC
EXTRN _xmlRelaxNGValidatePopElement:PROC
EXTRN _xmlRelaxNGValidateFullElement:PROC
EXTRN _xmlSchemaNewParserCtxt:PROC
EXTRN _xmlSchemaFreeParserCtxt:PROC
EXTRN _xmlSchemaSetParserErrors:PROC
EXTRN _xmlSchemaIsValid:PROC
EXTRN _xmlSchemaParse:PROC
EXTRN _xmlSchemaFree:PROC
EXTRN _xmlSchemaSetValidErrors:PROC
EXTRN _xmlSchemaSetValidStructuredErrors:PROC
EXTRN _xmlSchemaNewValidCtxt:PROC
EXTRN _xmlSchemaFreeValidCtxt:PROC
EXTRN _xmlSchemaSAXPlug:PROC
EXTRN _xmlSchemaSAXUnplug:PROC
EXTRN _xmlSchemaValidateSetLocator:PROC
EXTRN _xmlSwitchToEncoding:PROC
EXTRN _xmlNewInputStream:PROC
EXTRN _inputPush:PROC
EXTRN _xmlCanonicPath:PROC
EXTRN _xmlXIncludeNewContext:PROC
EXTRN _xmlXIncludeSetFlags:PROC
EXTRN _xmlXIncludeFreeContext:PROC
EXTRN _xmlXIncludeProcessNode:PROC
EXTRN _xmlFreePattern:PROC
EXTRN _xmlPatterncompile:PROC
EXTRN _xmlPatternMatch:PROC
EXTRN _xmlBufCreateSize:PROC
EXTRN _xmlBufSetAllocationScheme:PROC
EXTRN _xmlBufGetAllocationScheme:PROC
EXTRN _xmlBufFree:PROC
EXTRN _xmlBufEmpty:PROC
EXTRN _xmlBufResetInput:PROC
EXTRN @__CheckForDebuggerJustMyCode@4:PROC
EXTRN _memset:PROC
EXTRN ___xmlRegisterCallbacks:DWORD
_DATA SEGMENT
COMM ?_OptionsStorage@?1??__local_stdio_printf_options@@9@9:QWORD ; `__local_stdio_printf_options'::`2'::_OptionsStorage
_DATA ENDS
; COMDAT ??_C@_07FHOHOHLG@include@
CONST SEGMENT
??_C@_07FHOHOHLG@include@ DB 'include', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BE@KJPJIHAO@vsnprintf?5failed?5?$CB?6@
CONST SEGMENT
??_C@_0BE@KJPJIHAO@vsnprintf?5failed?5?$CB?6@ DB 'vsnprintf failed !', 0aH
DB 00H ; `string'
CONST ENDS
; COMDAT ??_C@_02DKCKIIND@?$CFs@
CONST SEGMENT
??_C@_02DKCKIIND@?$CFs@ DB '%s', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0CE@MNBJMFAB@xmlTextReaderSetup?5?3?5malloc?5fai@
CONST SEGMENT
??_C@_0CE@MNBJMFAB@xmlTextReaderSetup?5?3?5malloc?5fai@ DB 'xmlTextReader'
DB 'Setup : malloc failed', 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BD@FMMPJIKP@?$CDdocument?9fragment@
CONST SEGMENT
??_C@_0BD@FMMPJIKP@?$CDdocument?9fragment@ DB '#document-fragment', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_09DFKKGJPK@?$CDdocument@
CONST SEGMENT
??_C@_09DFKKGJPK@?$CDdocument@ DB '#document', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_08FBDKDMPC@?$CDcomment@
CONST SEGMENT
??_C@_08FBDKDMPC@?$CDcomment@ DB '#comment', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0P@LIENAFBO@?$CDcdata?9section@
CONST SEGMENT
??_C@_0P@LIENAFBO@?$CDcdata?9section@ DB '#cdata-section', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_05NOBOONOA@?$CDtext@
CONST SEGMENT
??_C@_05NOBOONOA@?$CDtext@ DB '#text', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BO@GBJIDPIB@http?3?1?1www?4w3?4org?12000?1xmlns?1@
CONST SEGMENT
??_C@_0BO@GBJIDPIB@http?3?1?1www?4w3?4org?12000?1xmlns?1@ DB 'http://www.'
DB 'w3.org/2000/xmlns/', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_05PPEFOGKI@xmlns@
CONST SEGMENT
??_C@_05PPEFOGKI@xmlns@ DB 'xmlns', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0CC@HCDAIILG@xmlNewTextReader?5?3?5malloc?5faile@
CONST SEGMENT
??_C@_0CC@HCDAIILG@xmlNewTextReader?5?3?5malloc?5faile@ DB 'xmlNewTextRea'
DB 'der : malloc failed', 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BO@MDEMDPPE@Unimplemented?5block?5at?5?$CFs?3?$CFd?6@
CONST SEGMENT
??_C@_0BO@MDEMDPPE@Unimplemented?5block?5at?5?$CFs?3?$CFd?6@ DB 'Unimplem'
DB 'ented block at %s:%d', 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0GL@PIJMIJNC@c?3?2users?2dag?2documents?2_clients@
CONST SEGMENT
??_C@_0GL@PIJMIJNC@c?3?2users?2dag?2documents?2_clients@ DB 'c:\users\dag'
DB '\documents\_clients\codeproject authors group\windows on arm\'
DB 'libxml2\libxml2-2.9.9\xmlreader.c', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0CA@JAOIMFBM@http?3?1?1www?4w3?4org?12001?1XInclude@
CONST SEGMENT
??_C@_0CA@JAOIMFBM@http?3?1?1www?4w3?4org?12001?1XInclude@ DB 'http://www'
DB '.w3.org/2001/XInclude', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0CA@MIIEHMNN@http?3?1?1www?4w3?4org?12003?1XInclude@
CONST SEGMENT
??_C@_0CA@MIIEHMNN@http?3?1?1www?4w3?4org?12003?1XInclude@ DB 'http://www'
DB '.w3.org/2003/XInclude', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_00CNPNBAHC@@
CONST SEGMENT
??_C@_00CNPNBAHC@@ DB 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BB@DOFEEJAH@Expand?5failed?5?$CB?6@
CONST SEGMENT
??_C@_0BB@DOFEEJAH@Expand?5failed?5?$CB?6@ DB 'Expand failed !', 0aH, 00H ; `string'
CONST ENDS
; COMDAT ??_C@_01JLIPDDHJ@?3@
CONST SEGMENT
??_C@_01JLIPDDHJ@?3@ DB ':', 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BF@DCPGEBNC@xmlRealloc?5failed?5?$CB?6@
CONST SEGMENT
??_C@_0BF@DCPGEBNC@xmlRealloc?5failed?5?$CB?6@ DB 'xmlRealloc failed !', 0aH
DB 00H ; `string'
CONST ENDS
; COMDAT ??_C@_0BE@MPMNBMMA@xmlMalloc?5failed?5?$CB?6@
CONST SEGMENT
??_C@_0BE@MPMNBMMA@xmlMalloc?5failed?5?$CB?6@ DB 'xmlMalloc failed !', 0aH
DB 00H ; `string'
CONST ENDS
; Function compile flags: /Odt
; COMDAT __JustMyCode_Default
_TEXT SEGMENT
__JustMyCode_Default PROC ; COMDAT
push ebp
mov ebp, esp
pop ebp
ret 0
__JustMyCode_Default ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderWarning
_TEXT SEGMENT
_ctxt$ = 8 ; size = 4
_msg$ = 12 ; size = 4
_xmlTextReaderWarning PROC ; COMDAT
; 4878 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
lea eax, DWORD PTR _msg$[ebp+4]
push eax
push DWORD PTR _msg$[ebp]
call _xmlTextReaderBuildMessage
mov esi, eax
add esp, 8
; 4843 : if (str != NULL) {
test esi, esi
je SHORT $LN4@xmlTextRea
; 4841 : xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx->_private;
mov eax, DWORD PTR _ctxt$[ebp]
mov ecx, DWORD PTR [eax+272]
; 4844 : if (reader->errorFunc)
mov edx, DWORD PTR [ecx+108]
test edx, edx
je SHORT $LN5@xmlTextRea
; 4845 : reader->errorFunc(reader->errorFuncArg, str, severity,
push eax
push 3
push esi
push DWORD PTR [ecx+112]
call edx
add esp, 16 ; 00000010H
$LN5@xmlTextRea:
; 4846 : (xmlTextReaderLocatorPtr) ctx);
; 4847 : xmlFree(str);
push esi
call DWORD PTR _xmlFree
add esp, 4
$LN4@xmlTextRea:
pop esi
; 4879 : va_list ap;
; 4880 :
; 4881 : va_start(ap, msg);
; 4882 : xmlTextReaderGenericError(ctxt,
; 4883 : XML_PARSER_SEVERITY_WARNING,
; 4884 : xmlTextReaderBuildMessage(msg, ap));
; 4885 : va_end(ap);
; 4886 : }
pop ebp
ret 0
_xmlTextReaderWarning ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderError
_TEXT SEGMENT
_ctxt$ = 8 ; size = 4
_msg$ = 12 ; size = 4
_xmlTextReaderError PROC ; COMDAT
; 4865 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
lea eax, DWORD PTR _msg$[ebp+4]
push eax
push DWORD PTR _msg$[ebp]
call _xmlTextReaderBuildMessage
mov esi, eax
add esp, 8
; 4843 : if (str != NULL) {
test esi, esi
je SHORT $LN4@xmlTextRea
; 4841 : xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx->_private;
mov eax, DWORD PTR _ctxt$[ebp]
mov ecx, DWORD PTR [eax+272]
; 4844 : if (reader->errorFunc)
mov edx, DWORD PTR [ecx+108]
test edx, edx
je SHORT $LN5@xmlTextRea
; 4845 : reader->errorFunc(reader->errorFuncArg, str, severity,
push eax
push 4
push esi
push DWORD PTR [ecx+112]
call edx
add esp, 16 ; 00000010H
$LN5@xmlTextRea:
; 4846 : (xmlTextReaderLocatorPtr) ctx);
; 4847 : xmlFree(str);
push esi
call DWORD PTR _xmlFree
add esp, 4
$LN4@xmlTextRea:
pop esi
; 4866 : va_list ap;
; 4867 :
; 4868 : va_start(ap, msg);
; 4869 : xmlTextReaderGenericError(ctxt,
; 4870 : XML_PARSER_SEVERITY_ERROR,
; 4871 : xmlTextReaderBuildMessage(msg, ap));
; 4872 : va_end(ap);
; 4873 :
; 4874 : }
pop ebp
ret 0
_xmlTextReaderError ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderGenericError
_TEXT SEGMENT
_ctxt$ = 8 ; size = 4
_severity$ = 12 ; size = 4
_str$ = 16 ; size = 4
_xmlTextReaderGenericError PROC ; COMDAT
; 4838 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _str$[ebp]
test esi, esi
je SHORT $LN2@xmlTextRea
; 4839 : xmlParserCtxtPtr ctx = (xmlParserCtxtPtr) ctxt;
; 4840 :
; 4841 : xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx->_private;
mov eax, DWORD PTR _ctxt$[ebp]
mov ecx, DWORD PTR [eax+272]
; 4842 :
; 4843 : if (str != NULL) {
; 4844 : if (reader->errorFunc)
mov edx, DWORD PTR [ecx+108]
test edx, edx
je SHORT $LN3@xmlTextRea
; 4845 : reader->errorFunc(reader->errorFuncArg, str, severity,
push eax
push DWORD PTR _severity$[ebp]
push esi
push DWORD PTR [ecx+112]
call edx
add esp, 16 ; 00000010H
$LN3@xmlTextRea:
; 4846 : (xmlTextReaderLocatorPtr) ctx);
; 4847 : xmlFree(str);
push esi
call DWORD PTR _xmlFree
add esp, 4
$LN2@xmlTextRea:
pop esi
; 4848 : }
; 4849 : }
pop ebp
ret 0
_xmlTextReaderGenericError ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderSchemaValidateInternal
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xsd$ = 12 ; size = 4
_ctxt$ = 16 ; size = 4
_options$ = 20 ; size = 4
_xmlTextReaderSchemaValidateInternal PROC ; COMDAT
; 4457 : {
push ebp
mov ebp, esp
push ebx
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
je SHORT $LN6@xmlTextRea
; 4458 : if (reader == NULL)
; 4459 : return(-1);
; 4460 :
; 4461 : if ((xsd != NULL) && (ctxt != NULL))
mov ebx, DWORD PTR _xsd$[ebp]
mov edi, DWORD PTR _ctxt$[ebp]
test ebx, ebx
je SHORT $LN24@xmlTextRea
test edi, edi
je SHORT $LN5@xmlTextRea
$LN6@xmlTextRea:
pop edi
; 4555 : return(0);
; 4556 : }
pop esi
or eax, -1
pop ebx
pop ebp
ret 0
$LN24@xmlTextRea:
; 4462 : return(-1);
; 4463 :
; 4464 : if (((xsd != NULL) || (ctxt != NULL)) &&
test edi, edi
je SHORT $LN25@xmlTextRea
$LN5@xmlTextRea:
cmp DWORD PTR [esi], 0
jne SHORT $LN6@xmlTextRea
cmp DWORD PTR [esi+20], 0
je SHORT $LN6@xmlTextRea
$LN25@xmlTextRea:
; 4465 : ((reader->mode != XML_TEXTREADER_MODE_INITIAL) ||
; 4466 : (reader->ctxt == NULL)))
; 4467 : return(-1);
; 4468 :
; 4469 : /* Cleanup previous validation stuff. */
; 4470 : if (reader->xsdPlug != NULL) {
mov eax, DWORD PTR [esi+152]
test eax, eax
je SHORT $LN7@xmlTextRea
; 4471 : xmlSchemaSAXUnplug(reader->xsdPlug);
push eax
call _xmlSchemaSAXUnplug
add esp, 4
; 4472 : reader->xsdPlug = NULL;
mov DWORD PTR [esi+152], 0
$LN7@xmlTextRea:
; 4473 : }
; 4474 : if (reader->xsdValidCtxt != NULL) {
mov eax, DWORD PTR [esi+140]
test eax, eax
je SHORT $LN8@xmlTextRea
; 4475 : if (! reader->xsdPreserveCtxt)
cmp DWORD PTR [esi+144], 0
jne SHORT $LN9@xmlTextRea
; 4476 : xmlSchemaFreeValidCtxt(reader->xsdValidCtxt);
push eax
call _xmlSchemaFreeValidCtxt
add esp, 4
$LN9@xmlTextRea:
; 4477 : reader->xsdValidCtxt = NULL;
mov DWORD PTR [esi+140], 0
$LN8@xmlTextRea:
; 4478 : }
; 4479 : reader->xsdPreserveCtxt = 0;
; 4480 : if (reader->xsdSchemas != NULL) {
mov eax, DWORD PTR [esi+136]
mov DWORD PTR [esi+144], 0
test eax, eax
je SHORT $LN10@xmlTextRea
; 4481 : xmlSchemaFree(reader->xsdSchemas);
push eax
call _xmlSchemaFree
add esp, 4
; 4482 : reader->xsdSchemas = NULL;
mov DWORD PTR [esi+136], 0
$LN10@xmlTextRea:
; 4483 : }
; 4484 :
; 4485 : if ((xsd == NULL) && (ctxt == NULL)) {
test ebx, ebx
jne SHORT $LN23@xmlTextRea
test edi, edi
je $LN26@xmlTextRea
; 4518 : return(-1);
; 4519 : }
; 4520 : } else {
; 4521 : /* Use the given validation context. */
; 4522 : reader->xsdValidCtxt = ctxt;
; 4523 : reader->xsdPreserveCtxt = 1;
; 4524 : reader->xsdPlug = xmlSchemaSAXPlug(reader->xsdValidCtxt,
mov ecx, DWORD PTR [esi+20]
mov DWORD PTR [esi+140], edi
mov DWORD PTR [esi+144], 1
lea eax, DWORD PTR [ecx+4]
push eax
push ecx
push edi
call _xmlSchemaSAXPlug
add esp, 12 ; 0000000cH
mov DWORD PTR [esi+152], eax
; 4525 : &(reader->ctxt->sax),
; 4526 : &(reader->ctxt->userData));
; 4527 : if (reader->xsdPlug == NULL) {
test eax, eax
jne $LN18@xmlTextRea
; 4528 : reader->xsdValidCtxt = NULL;
pop edi
mov DWORD PTR [esi+140], eax
; 4529 : reader->xsdPreserveCtxt = 0;
mov DWORD PTR [esi+144], eax
; 4555 : return(0);
; 4556 : }
or eax, -1
pop esi
pop ebx
pop ebp
ret 0
$LN23@xmlTextRea:
; 4486 : /* We just want to deactivate the validation, so get out. */
; 4487 : return(0);
; 4488 : }
; 4489 :
; 4490 : if (xsd != NULL) {
; 4491 : xmlSchemaParserCtxtPtr pctxt;
; 4492 : /* Parse the schema and create validation environment. */
; 4493 : pctxt = xmlSchemaNewParserCtxt(xsd);
push ebx
call _xmlSchemaNewParserCtxt
add esp, 4
mov edi, eax
; 4494 : if (reader->errorFunc != NULL) {
cmp DWORD PTR [esi+108], 0
je SHORT $LN14@xmlTextRea
; 4495 : xmlSchemaSetParserErrors(pctxt,
push esi
push OFFSET _xmlTextReaderValidityWarningRelay
push OFFSET _xmlTextReaderValidityErrorRelay
push edi
call _xmlSchemaSetParserErrors
add esp, 16 ; 00000010H
$LN14@xmlTextRea:
; 4496 : xmlTextReaderValidityErrorRelay,
; 4497 : xmlTextReaderValidityWarningRelay,
; 4498 : reader);
; 4499 : }
; 4500 : reader->xsdSchemas = xmlSchemaParse(pctxt);
push edi
call _xmlSchemaParse
; 4501 : xmlSchemaFreeParserCtxt(pctxt);
push edi
mov DWORD PTR [esi+136], eax
call _xmlSchemaFreeParserCtxt
; 4502 : if (reader->xsdSchemas == NULL)
mov eax, DWORD PTR [esi+136]
add esp, 8
test eax, eax
je $LN6@xmlTextRea
; 4503 : return(-1);
; 4504 : reader->xsdValidCtxt = xmlSchemaNewValidCtxt(reader->xsdSchemas);
push eax
call _xmlSchemaNewValidCtxt
mov edx, eax
add esp, 4
mov DWORD PTR [esi+140], edx
; 4505 : if (reader->xsdValidCtxt == NULL) {
test edx, edx
jne SHORT $LN16@xmlTextRea
; 4506 : xmlSchemaFree(reader->xsdSchemas);
push DWORD PTR [esi+136]
call _xmlSchemaFree
add esp, 4
; 4507 : reader->xsdSchemas = NULL;
mov DWORD PTR [esi+136], 0
; 4555 : return(0);
; 4556 : }
or eax, -1
pop edi
pop esi
pop ebx
pop ebp
ret 0
$LN16@xmlTextRea:
; 4508 : return(-1);
; 4509 : }
; 4510 : reader->xsdPlug = xmlSchemaSAXPlug(reader->xsdValidCtxt,
mov ecx, DWORD PTR [esi+20]
lea eax, DWORD PTR [ecx+4]
push eax
push ecx
push edx
call _xmlSchemaSAXPlug
add esp, 12 ; 0000000cH
mov DWORD PTR [esi+152], eax
; 4511 : &(reader->ctxt->sax),
; 4512 : &(reader->ctxt->userData));
; 4513 : if (reader->xsdPlug == NULL) {
test eax, eax
jne SHORT $LN18@xmlTextRea
; 4514 : xmlSchemaFree(reader->xsdSchemas);
push DWORD PTR [esi+136]
call _xmlSchemaFree
; 4515 : reader->xsdSchemas = NULL;
; 4516 : xmlSchemaFreeValidCtxt(reader->xsdValidCtxt);
push DWORD PTR [esi+140]
mov DWORD PTR [esi+136], 0
call _xmlSchemaFreeValidCtxt
add esp, 8
; 4517 : reader->xsdValidCtxt = NULL;
mov DWORD PTR [esi+140], 0
; 4555 : return(0);
; 4556 : }
or eax, -1
pop edi
pop esi
pop ebx
pop ebp
ret 0
$LN18@xmlTextRea:
; 4530 : return(-1);
; 4531 : }
; 4532 : }
; 4533 : xmlSchemaValidateSetLocator(reader->xsdValidCtxt,
push esi
push OFFSET _xmlTextReaderLocator
push DWORD PTR [esi+140]
call _xmlSchemaValidateSetLocator
add esp, 12 ; 0000000cH
; 4534 : xmlTextReaderLocator,
; 4535 : (void *) reader);
; 4536 : /*
; 4537 : * Redirect the validation context's error channels to use
; 4538 : * the reader channels.
; 4539 : * TODO: In case the user provides the validation context we
; 4540 : * could make this redirection optional.
; 4541 : */
; 4542 : if (reader->errorFunc != NULL) {
cmp DWORD PTR [esi+108], 0
je SHORT $LN19@xmlTextRea
; 4543 : xmlSchemaSetValidErrors(reader->xsdValidCtxt,
push esi
push OFFSET _xmlTextReaderValidityWarningRelay
push OFFSET _xmlTextReaderValidityErrorRelay
push DWORD PTR [esi+140]
call _xmlSchemaSetValidErrors
add esp, 16 ; 00000010H
$LN19@xmlTextRea:
; 4544 : xmlTextReaderValidityErrorRelay,
; 4545 : xmlTextReaderValidityWarningRelay,
; 4546 : reader);
; 4547 : }
; 4548 : if (reader->sErrorFunc != NULL) {
cmp DWORD PTR [esi+192], 0
je SHORT $LN20@xmlTextRea
; 4549 : xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt,
push esi
push OFFSET _xmlTextReaderValidityStructuredRelay
push DWORD PTR [esi+140]
call _xmlSchemaSetValidStructuredErrors
add esp, 12 ; 0000000cH
$LN20@xmlTextRea:
; 4550 : xmlTextReaderValidityStructuredRelay,
; 4551 : reader);
; 4552 : }
; 4553 : reader->xsdValidErrors = 0;
mov DWORD PTR [esi+148], 0
; 4554 : reader->validate = XML_TEXTREADER_VALIDATE_XSD;
mov DWORD PTR [esi+8], 4
$LN26@xmlTextRea:
; 4555 : return(0);
; 4556 : }
pop edi
pop esi
xor eax, eax
pop ebx
pop ebp
ret 0
_xmlTextReaderSchemaValidateInternal ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderRelaxNGValidateInternal
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_rng$ = 12 ; size = 4
_ctxt$ = 16 ; size = 4
_options$ = 20 ; size = 4
_xmlTextReaderRelaxNGValidateInternal PROC ; COMDAT
; 4354 : {
push ebp
mov ebp, esp
push ebx
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
je SHORT $LN6@xmlTextRea
; 4355 : if (reader == NULL)
; 4356 : return(-1);
; 4357 :
; 4358 : if ((rng != NULL) && (ctxt != NULL))
mov ebx, DWORD PTR _rng$[ebp]
mov edi, DWORD PTR _ctxt$[ebp]
test ebx, ebx
je SHORT $LN21@xmlTextRea
test edi, edi
je SHORT $LN5@xmlTextRea
$LN6@xmlTextRea:
pop edi
; 4435 : return(0);
; 4436 : }
pop esi
or eax, -1
pop ebx
pop ebp
ret 0
$LN21@xmlTextRea:
; 4359 : return (-1);
; 4360 :
; 4361 : if (((rng != NULL) || (ctxt != NULL)) &&
test edi, edi
je SHORT $LN4@xmlTextRea
$LN5@xmlTextRea:
cmp DWORD PTR [esi], 0
jne SHORT $LN6@xmlTextRea
cmp DWORD PTR [esi+20], 0
je SHORT $LN6@xmlTextRea
$LN4@xmlTextRea:
; 4362 : ((reader->mode != XML_TEXTREADER_MODE_INITIAL) ||
; 4363 : (reader->ctxt == NULL)))
; 4364 : return(-1);
; 4365 :
; 4366 : /* Cleanup previous validation stuff. */
; 4367 : if (reader->rngValidCtxt != NULL) {
mov eax, DWORD PTR [esi+120]
test eax, eax
je SHORT $LN7@xmlTextRea
; 4368 : if ( !reader->rngPreserveCtxt)
cmp DWORD PTR [esi+124], 0
jne SHORT $LN8@xmlTextRea
; 4369 : xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt);
push eax
call _xmlRelaxNGFreeValidCtxt
add esp, 4
$LN8@xmlTextRea:
; 4370 : reader->rngValidCtxt = NULL;
mov DWORD PTR [esi+120], 0
$LN7@xmlTextRea:
; 4371 : }
; 4372 : reader->rngPreserveCtxt = 0;
; 4373 : if (reader->rngSchemas != NULL) {
mov eax, DWORD PTR [esi+116]
mov DWORD PTR [esi+124], 0
test eax, eax
je SHORT $LN9@xmlTextRea
; 4374 : xmlRelaxNGFree(reader->rngSchemas);
push eax
call _xmlRelaxNGFree
add esp, 4
; 4375 : reader->rngSchemas = NULL;
mov DWORD PTR [esi+116], 0
$LN9@xmlTextRea:
; 4376 : }
; 4377 :
; 4378 : if ((rng == NULL) && (ctxt == NULL)) {
test ebx, ebx
jne SHORT $LN20@xmlTextRea
test edi, edi
je SHORT $LN22@xmlTextRea
; 4408 : return(-1);
; 4409 : }
; 4410 : } else {
; 4411 : /* Use the given validation context. */
; 4412 : reader->rngValidCtxt = ctxt;
mov DWORD PTR [esi+120], edi
; 4413 : reader->rngPreserveCtxt = 1;
mov DWORD PTR [esi+124], 1
$LN16@xmlTextRea:
; 4414 : }
; 4415 : /*
; 4416 : * Redirect the validation context's error channels to use
; 4417 : * the reader channels.
; 4418 : * TODO: In case the user provides the validation context we
; 4419 : * could make this redirection optional.
; 4420 : */
; 4421 : if (reader->errorFunc != NULL) {
cmp DWORD PTR [esi+108], 0
je SHORT $LN17@xmlTextRea
; 4422 : xmlRelaxNGSetValidErrors(reader->rngValidCtxt,
push esi
push OFFSET _xmlTextReaderValidityWarningRelay
push OFFSET _xmlTextReaderValidityErrorRelay
push edi
call _xmlRelaxNGSetValidErrors
add esp, 16 ; 00000010H
$LN17@xmlTextRea:
; 4423 : xmlTextReaderValidityErrorRelay,
; 4424 : xmlTextReaderValidityWarningRelay,
; 4425 : reader);
; 4426 : }
; 4427 : if (reader->sErrorFunc != NULL) {
cmp DWORD PTR [esi+192], 0
je SHORT $LN18@xmlTextRea
; 4428 : xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt,
push esi
push OFFSET _xmlTextReaderValidityStructuredRelay
push DWORD PTR [esi+120]
call _xmlRelaxNGSetValidStructuredErrors
add esp, 12 ; 0000000cH
$LN18@xmlTextRea:
; 4429 : xmlTextReaderValidityStructuredRelay,
; 4430 : reader);
; 4431 : }
; 4432 : reader->rngValidErrors = 0;
mov DWORD PTR [esi+128], 0
; 4433 : reader->rngFullNode = NULL;
mov DWORD PTR [esi+132], 0
; 4434 : reader->validate = XML_TEXTREADER_VALIDATE_RNG;
mov DWORD PTR [esi+8], 2
$LN22@xmlTextRea:
; 4435 : return(0);
; 4436 : }
pop edi
pop esi
xor eax, eax
pop ebx
pop ebp
ret 0
$LN20@xmlTextRea:
; 4379 : /* We just want to deactivate the validation, so get out. */
; 4380 : return(0);
; 4381 : }
; 4382 :
; 4383 :
; 4384 : if (rng != NULL) {
; 4385 : xmlRelaxNGParserCtxtPtr pctxt;
; 4386 : /* Parse the schema and create validation environment. */
; 4387 :
; 4388 : pctxt = xmlRelaxNGNewParserCtxt(rng);
push ebx
call _xmlRelaxNGNewParserCtxt
add esp, 4
mov edi, eax
; 4389 : if (reader->errorFunc != NULL) {
cmp DWORD PTR [esi+108], 0
je SHORT $LN13@xmlTextRea
; 4390 : xmlRelaxNGSetParserErrors(pctxt,
push esi
push OFFSET _xmlTextReaderValidityWarningRelay
push OFFSET _xmlTextReaderValidityErrorRelay
push edi
call _xmlRelaxNGSetParserErrors
add esp, 16 ; 00000010H
$LN13@xmlTextRea:
; 4391 : xmlTextReaderValidityErrorRelay,
; 4392 : xmlTextReaderValidityWarningRelay,
; 4393 : reader);
; 4394 : }
; 4395 : if (reader->sErrorFunc != NULL) {
cmp DWORD PTR [esi+192], 0
je SHORT $LN14@xmlTextRea
; 4396 : xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt,
push esi
push OFFSET _xmlTextReaderValidityStructuredRelay
push DWORD PTR [esi+120]
call _xmlRelaxNGSetValidStructuredErrors
add esp, 12 ; 0000000cH
$LN14@xmlTextRea:
; 4397 : xmlTextReaderValidityStructuredRelay,
; 4398 : reader);
; 4399 : }
; 4400 : reader->rngSchemas = xmlRelaxNGParse(pctxt);
push edi
call _xmlRelaxNGParse
; 4401 : xmlRelaxNGFreeParserCtxt(pctxt);
push edi
mov DWORD PTR [esi+116], eax
call _xmlRelaxNGFreeParserCtxt
; 4402 : if (reader->rngSchemas == NULL)
mov eax, DWORD PTR [esi+116]
add esp, 8
test eax, eax
je $LN6@xmlTextRea
; 4403 : return(-1);
; 4404 : reader->rngValidCtxt = xmlRelaxNGNewValidCtxt(reader->rngSchemas);
push eax
call _xmlRelaxNGNewValidCtxt
mov edi, eax
add esp, 4
mov DWORD PTR [esi+120], edi
; 4405 : if (reader->rngValidCtxt == NULL) {
test edi, edi
jne $LN16@xmlTextRea
; 4406 : xmlRelaxNGFree(reader->rngSchemas);
push DWORD PTR [esi+116]
call _xmlRelaxNGFree
add esp, 4
; 4407 : reader->rngSchemas = NULL;
mov DWORD PTR [esi+116], edi
; 4435 : return(0);
; 4436 : }
or eax, -1
pop edi
pop esi
pop ebx
pop ebp
ret 0
_xmlTextReaderRelaxNGValidateInternal ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderLocator
_TEXT SEGMENT
_ctx$ = 8 ; size = 4
_file$ = 12 ; size = 4
_line$ = 16 ; size = 4
_xmlTextReaderLocator PROC ; COMDAT
; 4206 : xmlTextReaderLocator(void *ctx, const char **file, unsigned long *line) {
push ebp
mov ebp, esp
push ebx
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ebx, DWORD PTR _ctx$[ebp]
test ebx, ebx
je SHORT $LN3@xmlTextRea
; 4207 : xmlTextReaderPtr reader;
; 4208 :
; 4209 : if ((ctx == NULL) || ((file == NULL) && (line == NULL)))
mov edi, DWORD PTR _file$[ebp]
mov esi, DWORD PTR _line$[ebp]
test edi, edi
jne SHORT $LN17@xmlTextRea
test esi, esi
jne SHORT $LN18@xmlTextRea
$LN3@xmlTextRea:
pop edi
; 4244 : }
; 4245 : return(-1);
; 4246 : }
pop esi
or eax, -1
pop ebx
pop ebp
ret 0
$LN17@xmlTextRea:
; 4210 : return(-1);
; 4211 :
; 4212 : if (file != NULL)
; 4213 : *file = NULL;
mov DWORD PTR [edi], 0
; 4214 : if (line != NULL)
test esi, esi
je SHORT $LN5@xmlTextRea
$LN18@xmlTextRea:
; 4215 : *line = 0;
mov DWORD PTR [esi], 0
$LN5@xmlTextRea:
; 4216 :
; 4217 : reader = (xmlTextReaderPtr) ctx;
; 4218 : if ((reader->ctxt != NULL) && (reader->ctxt->input != NULL)) {
mov eax, DWORD PTR [ebx+20]
test eax, eax
je SHORT $LN6@xmlTextRea
mov eax, DWORD PTR [eax+36]
test eax, eax
je SHORT $LN6@xmlTextRea
; 4219 : if (file != NULL)
test edi, edi
je SHORT $LN7@xmlTextRea
; 4220 : *file = reader->ctxt->input->filename;
mov eax, DWORD PTR [eax+4]
mov DWORD PTR [edi], eax
$LN7@xmlTextRea:
; 4221 : if (line != NULL)
test esi, esi
je SHORT $LN8@xmlTextRea
; 4222 : *line = reader->ctxt->input->line;
mov eax, DWORD PTR [ebx+20]
mov eax, DWORD PTR [eax+36]
mov eax, DWORD PTR [eax+28]
mov DWORD PTR [esi], eax
$LN8@xmlTextRea:
; 4244 : }
; 4245 : return(-1);
; 4246 : }
pop edi
pop esi
xor eax, eax
pop ebx
pop ebp
ret 0
$LN6@xmlTextRea:
; 4223 : return(0);
; 4224 : }
; 4225 : if (reader->node != NULL) {
mov eax, DWORD PTR [ebx+64]
test eax, eax
je SHORT $LN3@xmlTextRea
; 4226 : long res;
; 4227 : int ret = 0;
xor ecx, ecx
; 4228 :
; 4229 : if (line != NULL) {
test esi, esi
je SHORT $LN12@xmlTextRea
; 4230 : res = xmlGetLineNo(reader->node);
push eax
call _xmlGetLineNo
add esp, 4
; 4231 : if (res > 0)
test eax, eax
jle SHORT $LN11@xmlTextRea
; 4232 : *line = (unsigned long) res;
mov DWORD PTR [esi], eax
xor ecx, ecx
jmp SHORT $LN12@xmlTextRea
$LN11@xmlTextRea:
; 4233 : else
; 4234 : ret = -1;
or ecx, -1
$LN12@xmlTextRea:
; 4235 : }
; 4236 : if (file != NULL) {
test edi, edi
je SHORT $LN15@xmlTextRea
; 4237 : xmlDocPtr doc = reader->node->doc;
mov eax, DWORD PTR [ebx+64]
mov eax, DWORD PTR [eax+32]
; 4238 : if ((doc != NULL) && (doc->URL != NULL))
test eax, eax
je SHORT $LN14@xmlTextRea
mov eax, DWORD PTR [eax+72]
test eax, eax
je SHORT $LN14@xmlTextRea
; 4239 : *file = (const char *) doc->URL;
mov DWORD PTR [edi], eax
; 4242 : }
; 4243 : return(ret);
mov eax, ecx
pop edi
; 4244 : }
; 4245 : return(-1);
; 4246 : }
pop esi
pop ebx
pop ebp
ret 0
$LN14@xmlTextRea:
; 4240 : else
; 4241 : ret = -1;
or ecx, -1
$LN15@xmlTextRea:
pop edi
; 4244 : }
; 4245 : return(-1);
; 4246 : }
pop esi
mov eax, ecx
pop ebx
pop ebp
ret 0
_xmlTextReaderLocator ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderValidityStructuredRelay
_TEXT SEGMENT
_userData$ = 8 ; size = 4
_error$ = 12 ; size = 4
_xmlTextReaderValidityStructuredRelay PROC ; COMDAT
; 4122 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _userData$[ebp]
mov ecx, DWORD PTR [eax+192]
test ecx, ecx
je SHORT $LN2@xmlTextRea
; 4123 : xmlTextReaderPtr reader = (xmlTextReaderPtr) userData;
; 4124 :
; 4125 : if (reader->sErrorFunc) {
; 4126 : reader->sErrorFunc(reader->errorFuncArg, error);
push DWORD PTR _error$[ebp]
push DWORD PTR [eax+112]
call ecx
; 4127 : } else {
; 4128 : xmlTextReaderStructuredError(reader, error);
; 4129 : }
; 4130 : }
add esp, 8
pop ebp
ret 0
$LN2@xmlTextRea:
; 4858 : if (error && reader->sErrorFunc) {
mov ecx, DWORD PTR _error$[ebp]
test ecx, ecx
je SHORT $LN6@xmlTextRea
mov eax, DWORD PTR [eax+272]
mov edx, DWORD PTR [eax+192]
test edx, edx
je SHORT $LN6@xmlTextRea
; 4859 : reader->sErrorFunc(reader->errorFuncArg, (xmlErrorPtr) error);
push ecx
push DWORD PTR [eax+112]
call edx
; 4127 : } else {
; 4128 : xmlTextReaderStructuredError(reader, error);
; 4129 : }
; 4130 : }
add esp, 8
$LN6@xmlTextRea:
pop ebp
ret 0
_xmlTextReaderValidityStructuredRelay ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderStructuredError
_TEXT SEGMENT
_ctxt$ = 8 ; size = 4
_error$ = 12 ; size = 4
_xmlTextReaderStructuredError PROC ; COMDAT
; 4853 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _error$[ebp]
test ecx, ecx
je SHORT $LN2@xmlTextRea
; 4854 : xmlParserCtxtPtr ctx = (xmlParserCtxtPtr) ctxt;
; 4855 :
; 4856 : xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx->_private;
mov eax, DWORD PTR _ctxt$[ebp]
mov eax, DWORD PTR [eax+272]
; 4857 :
; 4858 : if (error && reader->sErrorFunc) {
mov edx, DWORD PTR [eax+192]
test edx, edx
je SHORT $LN2@xmlTextRea
; 4859 : reader->sErrorFunc(reader->errorFuncArg, (xmlErrorPtr) error);
push ecx
push DWORD PTR [eax+112]
call edx
add esp, 8
$LN2@xmlTextRea:
; 4860 : }
; 4861 : }
pop ebp
ret 0
_xmlTextReaderStructuredError ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderValidityWarningRelay
_TEXT SEGMENT
_ctx$ = 8 ; size = 4
_msg$ = 12 ; size = 4
_xmlTextReaderValidityWarningRelay PROC ; COMDAT
; 4096 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
lea eax, DWORD PTR _msg$[ebp+4]
push eax
push DWORD PTR _msg$[ebp]
call _xmlTextReaderBuildMessage
mov esi, eax
add esp, 8
mov eax, DWORD PTR _ctx$[ebp]
mov ecx, DWORD PTR [eax+108]
test ecx, ecx
jne SHORT $LN2@xmlTextRea
; 4097 : xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx;
; 4098 :
; 4099 : char *str;
; 4100 :
; 4101 : va_list ap;
; 4102 :
; 4103 : va_start(ap, msg);
; 4104 : str = xmlTextReaderBuildMessage(msg, ap);
; 4105 : if (!reader->errorFunc) {
; 4106 : xmlTextReaderValidityWarning(ctx, "%s", str);
push esi
push OFFSET ??_C@_02DKCKIIND@?$CFs@
push eax
call _xmlTextReaderValidityWarning
add esp, 12 ; 0000000cH
; 4107 : } else {
jmp SHORT $LN3@xmlTextRea
$LN2@xmlTextRea:
; 4108 : reader->errorFunc(reader->errorFuncArg, str,
push 0
push 1
push esi
push DWORD PTR [eax+112]
call ecx
add esp, 16 ; 00000010H
$LN3@xmlTextRea:
; 4109 : XML_PARSER_SEVERITY_VALIDITY_WARNING,
; 4110 : NULL /* locator */ );
; 4111 : }
; 4112 : if (str != NULL)
test esi, esi
je SHORT $LN4@xmlTextRea
; 4113 : xmlFree(str);
push esi
call DWORD PTR _xmlFree
add esp, 4
$LN4@xmlTextRea:
pop esi
; 4114 : va_end(ap);
; 4115 : }
pop ebp
ret 0
_xmlTextReaderValidityWarningRelay ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderValidityErrorRelay
_TEXT SEGMENT
_ctx$ = 8 ; size = 4
_msg$ = 12 ; size = 4
_xmlTextReaderValidityErrorRelay PROC ; COMDAT
; 4073 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
lea eax, DWORD PTR _msg$[ebp+4]
push eax
push DWORD PTR _msg$[ebp]
call _xmlTextReaderBuildMessage
mov esi, eax
add esp, 8
mov eax, DWORD PTR _ctx$[ebp]
mov ecx, DWORD PTR [eax+108]
test ecx, ecx
jne SHORT $LN2@xmlTextRea
; 4074 : xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx;
; 4075 :
; 4076 : char *str;
; 4077 :
; 4078 : va_list ap;
; 4079 :
; 4080 : va_start(ap, msg);
; 4081 : str = xmlTextReaderBuildMessage(msg, ap);
; 4082 : if (!reader->errorFunc) {
; 4083 : xmlTextReaderValidityError(ctx, "%s", str);
push esi
push OFFSET ??_C@_02DKCKIIND@?$CFs@
push eax
call _xmlTextReaderValidityError
add esp, 12 ; 0000000cH
; 4084 : } else {
jmp SHORT $LN3@xmlTextRea
$LN2@xmlTextRea:
; 4085 : reader->errorFunc(reader->errorFuncArg, str,
push 0
push 2
push esi
push DWORD PTR [eax+112]
call ecx
add esp, 16 ; 00000010H
$LN3@xmlTextRea:
; 4086 : XML_PARSER_SEVERITY_VALIDITY_ERROR,
; 4087 : NULL /* locator */ );
; 4088 : }
; 4089 : if (str != NULL)
test esi, esi
je SHORT $LN4@xmlTextRea
; 4090 : xmlFree(str);
push esi
call DWORD PTR _xmlFree
add esp, 4
$LN4@xmlTextRea:
pop esi
; 4091 : va_end(ap);
; 4092 : }
pop ebp
ret 0
_xmlTextReaderValidityErrorRelay ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderValidityWarning
_TEXT SEGMENT
_ctxt$ = 8 ; size = 4
_msg$ = 12 ; size = 4
_xmlTextReaderValidityWarning PROC ; COMDAT
; 4910 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
push DWORD PTR _msg$[ebp]
call _xmlStrlen
add esp, 4
test eax, eax
je SHORT $LN5@xmlTextRea
; 4911 : va_list ap;
; 4912 :
; 4913 : int len = xmlStrlen((const xmlChar *) msg);
; 4914 :
; 4915 : if ((len != 0) && (msg[len - 1] != ':')) {
mov ecx, DWORD PTR _msg$[ebp]
cmp BYTE PTR [eax+ecx-1], 58 ; 0000003aH
je SHORT $LN5@xmlTextRea
; 4916 : /*
; 4917 : * some callbacks only report locator information:
; 4918 : * skip them (mimicking behaviour in error.c)
; 4919 : */
; 4920 : va_start(ap, msg);
; 4921 : xmlTextReaderGenericError(ctxt,
push esi
lea eax, DWORD PTR _msg$[ebp+4]
push eax
push ecx
call _xmlTextReaderBuildMessage
mov esi, eax
add esp, 8
; 4843 : if (str != NULL) {
test esi, esi
je SHORT $LN8@xmlTextRea
; 4841 : xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx->_private;
mov eax, DWORD PTR _ctxt$[ebp]
mov ecx, DWORD PTR [eax+272]
; 4844 : if (reader->errorFunc)
mov edx, DWORD PTR [ecx+108]
test edx, edx
je SHORT $LN6@xmlTextRea
; 4845 : reader->errorFunc(reader->errorFuncArg, str, severity,
push eax
push 1
push esi
push DWORD PTR [ecx+112]
call edx
add esp, 16 ; 00000010H
$LN6@xmlTextRea:
; 4846 : (xmlTextReaderLocatorPtr) ctx);
; 4847 : xmlFree(str);
push esi
call DWORD PTR _xmlFree
add esp, 4
$LN8@xmlTextRea:
pop esi
$LN5@xmlTextRea:
; 4922 : XML_PARSER_SEVERITY_VALIDITY_WARNING,
; 4923 : xmlTextReaderBuildMessage(msg, ap));
; 4924 : va_end(ap);
; 4925 : }
; 4926 : }
pop ebp
ret 0
_xmlTextReaderValidityWarning ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderValidityError
_TEXT SEGMENT
_ctxt$ = 8 ; size = 4
_msg$ = 12 ; size = 4
_xmlTextReaderValidityError PROC ; COMDAT
; 4890 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
push DWORD PTR _msg$[ebp]
call _xmlStrlen
add esp, 4
cmp eax, 1
jle SHORT $LN5@xmlTextRea
; 4891 : va_list ap;
; 4892 :
; 4893 : int len = xmlStrlen((const xmlChar *) msg);
; 4894 :
; 4895 : if ((len > 1) && (msg[len - 2] != ':')) {
mov ecx, DWORD PTR _msg$[ebp]
cmp BYTE PTR [eax+ecx-2], 58 ; 0000003aH
je SHORT $LN5@xmlTextRea
; 4896 : /*
; 4897 : * some callbacks only report locator information:
; 4898 : * skip them (mimicking behaviour in error.c)
; 4899 : */
; 4900 : va_start(ap, msg);
; 4901 : xmlTextReaderGenericError(ctxt,
push esi
lea eax, DWORD PTR _msg$[ebp+4]
push eax
push ecx
call _xmlTextReaderBuildMessage
mov esi, eax
add esp, 8
; 4843 : if (str != NULL) {
test esi, esi
je SHORT $LN8@xmlTextRea
; 4841 : xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx->_private;
mov eax, DWORD PTR _ctxt$[ebp]
mov ecx, DWORD PTR [eax+272]
; 4844 : if (reader->errorFunc)
mov edx, DWORD PTR [ecx+108]
test edx, edx
je SHORT $LN6@xmlTextRea
; 4845 : reader->errorFunc(reader->errorFuncArg, str, severity,
push eax
push 2
push esi
push DWORD PTR [ecx+112]
call edx
add esp, 16 ; 00000010H
$LN6@xmlTextRea:
; 4846 : (xmlTextReaderLocatorPtr) ctx);
; 4847 : xmlFree(str);
push esi
call DWORD PTR _xmlFree
add esp, 4
$LN8@xmlTextRea:
pop esi
$LN5@xmlTextRea:
; 4902 : XML_PARSER_SEVERITY_VALIDITY_ERROR,
; 4903 : xmlTextReaderBuildMessage(msg, ap));
; 4904 : va_end(ap);
; 4905 : }
; 4906 : }
pop ebp
ret 0
_xmlTextReaderValidityError ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderBuildMessage
_TEXT SEGMENT
_msg$ = 8 ; size = 4
_ap$ = 12 ; size = 4
_xmlTextReaderBuildMessage PROC ; COMDAT
; 4727 : xmlTextReaderBuildMessage(const char *msg, va_list ap) {
push ebp
mov ebp, esp
push ebx
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
xor esi, esi
xor edi, edi
; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h
; 1440 : int const _Result = __stdio_common_vsprintf(
call ___local_stdio_printf_options
push DWORD PTR _ap$[ebp]
mov ecx, eax
push edi
push DWORD PTR _msg$[ebp]
mov eax, DWORD PTR [ecx]
push edi
push edi
push DWORD PTR [ecx+4]
or eax, 2
push eax
call DWORD PTR __imp____stdio_common_vsprintf
; 1441 : _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR,
; 1442 : _Buffer, _BufferCount, _Format, NULL, _ArgList);
; 1443 :
; 1444 : return _Result < 0 ? -1 : _Result;
or ecx, -1
add esp, 28 ; 0000001cH
test eax, eax
cmovs eax, ecx
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; 4738 : if (chars < 0) {
test eax, eax
js SHORT $LN16@xmlTextRea
$LL2@xmlTextRea:
; 4740 : if (str)
; 4741 : xmlFree(str);
; 4742 : return NULL;
; 4743 : }
; 4744 : if ((chars < size) || (size == MAX_ERR_MSG_SIZE))
cmp eax, esi
jl $LN7@xmlTextRea
cmp esi, 64000 ; 0000fa00H
je $LN7@xmlTextRea
; 4745 : break;
; 4746 : if (chars < MAX_ERR_MSG_SIZE)
; 4747 : size = chars + 1;
lea esi, DWORD PTR [eax+1]
cmp eax, 64000 ; 0000fa00H
jl SHORT $LN9@xmlTextRea
; 4748 : else
; 4749 : size = MAX_ERR_MSG_SIZE;
mov esi, 64000 ; 0000fa00H
$LN9@xmlTextRea:
; 4750 : if ((larger = (char *) xmlRealloc(str, size)) == NULL) {
push esi
push edi
call DWORD PTR _xmlRealloc
mov ebx, eax
add esp, 8
test ebx, ebx
je SHORT $LN18@xmlTextRea
; 4755 : }
; 4756 : str = larger;
mov edi, ebx
; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h
; 1440 : int const _Result = __stdio_common_vsprintf(
call ___local_stdio_printf_options
push DWORD PTR _ap$[ebp]
mov ecx, eax
push 0
push DWORD PTR _msg$[ebp]
mov eax, DWORD PTR [ecx]
push esi
push ebx
push DWORD PTR [ecx+4]
or eax, 2
push eax
call DWORD PTR __imp____stdio_common_vsprintf
add esp, 28 ; 0000001cH
; 1441 : _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR,
; 1442 : _Buffer, _BufferCount, _Format, NULL, _ArgList);
; 1443 :
; 1444 : return _Result < 0 ? -1 : _Result;
mov ecx, -1
test eax, eax
cmovs eax, ecx
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; 4738 : if (chars < 0) {
test eax, eax
jns SHORT $LL2@xmlTextRea
$LN16@xmlTextRea:
; 4739 : xmlGenericError(xmlGenericErrorContext, "vsnprintf failed !\n");
call ___xmlGenericError
mov esi, eax
call ___xmlGenericErrorContext
push OFFSET ??_C@_0BE@KJPJIHAO@vsnprintf?5failed?5?$CB?6@
$LN23@xmlTextRea:
; 4754 : return NULL;
push DWORD PTR [eax]
mov eax, DWORD PTR [esi]
call eax
add esp, 8
test edi, edi
je SHORT $LN11@xmlTextRea
push edi
call DWORD PTR _xmlFree
add esp, 4
$LN11@xmlTextRea:
; 4760 : }
pop edi
pop esi
xor eax, eax
pop ebx
pop ebp
ret 0
$LN18@xmlTextRea:
; 4751 : xmlGenericError(xmlGenericErrorContext, "xmlRealloc failed !\n");
call ___xmlGenericError
mov esi, eax
call ___xmlGenericErrorContext
push OFFSET ??_C@_0BF@DCPGEBNC@xmlRealloc?5failed?5?$CB?6@
; 4752 : if (str)
; 4753 : xmlFree(str);
jmp SHORT $LN23@xmlTextRea
$LN7@xmlTextRea:
; 4757 : }
; 4758 :
; 4759 : return str;
mov eax, edi
pop edi
; 4760 : }
pop esi
pop ebx
pop ebp
ret 0
_xmlTextReaderBuildMessage ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderCollectSiblings
_TEXT SEGMENT
_node$ = 8 ; size = 4
_xmlTextReaderCollectSiblings PROC ; COMDAT
; 1245 : {
push ebp
mov ebp, esp
push ebx
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _node$[ebp]
test esi, esi
je SHORT $LN8@xmlTextRea
; 1246 : xmlBufferPtr buffer;
; 1247 : xmlChar *ret;
; 1248 :
; 1249 : if ((node == NULL) || (node->type == XML_NAMESPACE_DECL))
cmp DWORD PTR [esi+4], 18 ; 00000012H
je SHORT $LN8@xmlTextRea
; 1251 :
; 1252 : buffer = xmlBufferCreate();
call _xmlBufferCreate
mov ebx, eax
; 1253 : if (buffer == NULL)
test ebx, ebx
je SHORT $LN8@xmlTextRea
push edi
$LL18@xmlTextRea:
; 1257 : switch (node->type) {
mov eax, DWORD PTR [esi+4]
cmp eax, 1
je SHORT $LN11@xmlTextRea
add eax, -3 ; fffffffdH
cmp eax, 1
ja SHORT $LN2@xmlTextRea
; 1258 : case XML_TEXT_NODE:
; 1259 : case XML_CDATA_SECTION_NODE:
; 1260 : xmlBufferCat(buffer, node->content);
push DWORD PTR [esi+40]
push ebx
call _xmlBufferCat
add esp, 8
; 1261 : break;
jmp SHORT $LN2@xmlTextRea
$LN11@xmlTextRea:
; 1262 : case XML_ELEMENT_NODE: {
; 1263 : xmlChar *tmp;
; 1264 :
; 1265 : tmp = xmlTextReaderCollectSiblings(node->children);
push DWORD PTR [esi+12]
call _xmlTextReaderCollectSiblings
mov edi, eax
; 1266 : xmlBufferCat(buffer, tmp);
push edi
push ebx
call _xmlBufferCat
; 1267 : xmlFree(tmp);
push edi
call DWORD PTR _xmlFree
add esp, 16 ; 00000010H
$LN2@xmlTextRea:
; 1254 : return NULL;
; 1255 :
; 1256 : for ( ; node != NULL; node = node->next) {
mov esi, DWORD PTR [esi+24]
test esi, esi
jne SHORT $LL18@xmlTextRea
; 1268 : break;
; 1269 : }
; 1270 : default:
; 1271 : break;
; 1272 : }
; 1273 : }
; 1274 : ret = buffer->content;
mov esi, DWORD PTR [ebx]
; 1275 : buffer->content = NULL;
; 1276 : xmlBufferFree(buffer);
push ebx
mov DWORD PTR [ebx], 0
call _xmlBufferFree
add esp, 4
; 1277 : return(ret);
mov eax, esi
pop edi
pop esi
; 1278 : }
pop ebx
pop ebp
ret 0
$LN8@xmlTextRea:
pop esi
; 1250 : return(NULL);
xor eax, eax
; 1278 : }
pop ebx
pop ebp
ret 0
_xmlTextReaderCollectSiblings ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderDoExpand
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderDoExpand PROC ; COMDAT
; 1210 : xmlTextReaderDoExpand(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
je SHORT $LN6@xmlTextRea
; 1211 : int val;
; 1212 :
; 1213 : if ((reader == NULL) || (reader->node == NULL) || (reader->ctxt == NULL))
cmp DWORD PTR [esi+64], 0
je SHORT $LN6@xmlTextRea
cmp DWORD PTR [esi+20], 0
je SHORT $LN6@xmlTextRea
$LL4@xmlTextRea:
; 1214 : return(-1);
; 1215 : do {
; 1216 : if (reader->ctxt->instate == XML_PARSER_EOF) return(1);
mov ecx, DWORD PTR [esi+20]
cmp DWORD PTR [ecx+172], -1
je SHORT $LN30@xmlTextRea
; 1217 :
; 1218 : if (xmlTextReaderGetSuccessor(reader->node) != NULL)
mov eax, DWORD PTR [esi+64]
; 1188 : if (cur == NULL) return(NULL) ; /* ERROR */
test eax, eax
je SHORT $LN15@xmlTextRea
; 1189 : if (cur->next != NULL) return(cur->next) ;
cmp DWORD PTR [eax+24], 0
jne SHORT $LN30@xmlTextRea
npad 6
$LL16@xmlTextRea:
; 1190 : do {
; 1191 : cur = cur->parent;
mov eax, DWORD PTR [eax+20]
; 1192 : if (cur == NULL) break;
test eax, eax
je SHORT $LN15@xmlTextRea
; 1193 : if (cur->next != NULL) return(cur->next);
cmp DWORD PTR [eax+24], 0
je SHORT $LL16@xmlTextRea
; 1230 : return(1);
; 1231 : }
mov eax, 1
pop esi
pop ebp
ret 0
$LN15@xmlTextRea:
; 1219 : return(1);
; 1220 : if (reader->ctxt->nodeNr < reader->depth)
mov eax, DWORD PTR [ecx+56]
cmp eax, DWORD PTR [esi+72]
jl SHORT $LN30@xmlTextRea
; 1221 : return(1);
; 1222 : if (reader->mode == XML_TEXTREADER_MODE_EOF)
cmp DWORD PTR [esi], 3
je SHORT $LN30@xmlTextRea
; 1223 : return(1);
; 1224 : val = xmlTextReaderPushData(reader);
push esi
call _xmlTextReaderPushData
add esp, 4
; 1225 : if (val < 0){
test eax, eax
js SHORT $LN31@xmlTextRea
; 1227 : return(-1);
; 1228 : }
; 1229 : } while(reader->mode != XML_TEXTREADER_MODE_EOF);
cmp DWORD PTR [esi], 3
jne SHORT $LL4@xmlTextRea
$LN30@xmlTextRea:
; 1230 : return(1);
; 1231 : }
mov eax, 1
pop esi
pop ebp
ret 0
$LN31@xmlTextRea:
; 1226 : reader->mode = XML_TEXTREADER_MODE_ERROR;
mov DWORD PTR [esi], 2
$LN6@xmlTextRea:
; 1230 : return(1);
; 1231 : }
or eax, -1
pop esi
pop ebp
ret 0
_xmlTextReaderDoExpand ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderGetSuccessor
_TEXT SEGMENT
_cur$ = 8 ; size = 4
_xmlTextReaderGetSuccessor PROC ; COMDAT
; 1187 : xmlTextReaderGetSuccessor(xmlNodePtr cur) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _cur$[ebp]
test ecx, ecx
je SHORT $LN3@xmlTextRea
; 1188 : if (cur == NULL) return(NULL) ; /* ERROR */
; 1189 : if (cur->next != NULL) return(cur->next) ;
mov eax, DWORD PTR [ecx+24]
test eax, eax
jne SHORT $LN1@xmlTextRea
npad 5
$LL4@xmlTextRea:
; 1190 : do {
; 1191 : cur = cur->parent;
mov ecx, DWORD PTR [ecx+20]
; 1192 : if (cur == NULL) break;
test ecx, ecx
je SHORT $LN3@xmlTextRea
; 1193 : if (cur->next != NULL) return(cur->next);
mov eax, DWORD PTR [ecx+24]
test eax, eax
je SHORT $LL4@xmlTextRea
; 1196 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 1194 : } while (cur != NULL);
; 1195 : return(cur);
xor eax, eax
$LN1@xmlTextRea:
; 1196 : }
pop ebp
ret 0
_xmlTextReaderGetSuccessor ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderValidateEntity
_TEXT SEGMENT
_ctxt$1$ = -4 ; size = 4
_oldnode$1$ = 8 ; size = 4
_reader$ = 8 ; size = 4
_xmlTextReaderValidateEntity PROC ; COMDAT
; 1090 : xmlTextReaderValidateEntity(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
push ecx
push ebx
mov ebx, DWORD PTR _reader$[ebp]
mov ecx, OFFSET __BC13D883_xmlreader@c
push esi
push edi
call @__CheckForDebuggerJustMyCode@4
mov edi, DWORD PTR [ebx+64]
mov esi, edi
mov ecx, DWORD PTR [ebx+20]
mov DWORD PTR _oldnode$1$[ebp], edi
mov DWORD PTR _ctxt$1$[ebp], ecx
$LL4@xmlTextRea:
; 1091 : xmlNodePtr oldnode = reader->node;
; 1092 : xmlNodePtr node = reader->node;
; 1093 : xmlParserCtxtPtr ctxt = reader->ctxt;
; 1094 :
; 1095 : do {
; 1096 : if (node->type == XML_ENTITY_REF_NODE) {
mov eax, DWORD PTR [esi+4]
cmp eax, 5
jne SHORT $LN10@xmlTextRea
; 1097 : /*
; 1098 : * Case where the underlying tree is not availble, lookup the entity
; 1099 : * and walk it.
; 1100 : */
; 1101 : if ((node->children == NULL) && (ctxt->sax != NULL) &&
mov eax, DWORD PTR [esi+12]
test eax, eax
jne SHORT $LN76@xmlTextRea
mov eax, DWORD PTR [ecx]
test eax, eax
je SHORT $LN13@xmlTextRea
mov eax, DWORD PTR [eax+20]
test eax, eax
je SHORT $LN13@xmlTextRea
; 1102 : (ctxt->sax->getEntity != NULL)) {
; 1103 : node->children = (xmlNodePtr)
push DWORD PTR [esi+8]
push ecx
call eax
add esp, 8
mov DWORD PTR [esi+12], eax
; 1104 : ctxt->sax->getEntity(ctxt, node->name);
; 1105 : }
; 1106 :
; 1107 : if ((node->children != NULL) &&
; 1108 : (node->children->type == XML_ENTITY_DECL) &&
test eax, eax
je SHORT $LN13@xmlTextRea
$LN76@xmlTextRea:
cmp DWORD PTR [eax+4], 17 ; 00000011H
jne SHORT $LN13@xmlTextRea
cmp DWORD PTR [eax+12], 0
je SHORT $LN13@xmlTextRea
; 1109 : (node->children->children != NULL)) {
; 1110 : xmlTextReaderEntPush(reader, node);
push esi
push ebx
call _xmlTextReaderEntPush
; 1111 : node = node->children->children;
mov eax, DWORD PTR [esi+12]
add esp, 8
mov esi, DWORD PTR [eax+12]
; 1112 : continue;
jmp $LN2@xmlTextRea
$LN13@xmlTextRea:
; 1113 : } else {
; 1114 : /*
; 1115 : * The error has probably be raised already.
; 1116 : */
; 1117 : if (node == oldnode)
cmp esi, edi
je $LN32@xmlTextRea
; 1118 : break;
; 1119 : node = node->next;
mov esi, DWORD PTR [esi+24]
; 1120 : }
jmp SHORT $LN18@xmlTextRea
$LN10@xmlTextRea:
; 1121 : #ifdef LIBXML_REGEXP_ENABLED
; 1122 : } else if (node->type == XML_ELEMENT_NODE) {
cmp eax, 1
jne SHORT $LN16@xmlTextRea
; 1123 : reader->node = node;
; 1124 : xmlTextReaderValidatePush(reader);
push ebx
mov DWORD PTR [ebx+64], esi
call _xmlTextReaderValidatePush
add esp, 4
jmp SHORT $LN18@xmlTextRea
$LN16@xmlTextRea:
; 1125 : } else if ((node->type == XML_TEXT_NODE) ||
cmp eax, 3
je SHORT $LN19@xmlTextRea
cmp eax, 4
jne SHORT $LN18@xmlTextRea
$LN19@xmlTextRea:
; 1126 : (node->type == XML_CDATA_SECTION_NODE)) {
; 1127 : xmlTextReaderValidateCData(reader, node->content,
push DWORD PTR [esi+40]
call _xmlStrlen
push eax
push DWORD PTR [esi+40]
push ebx
call _xmlTextReaderValidateCData
add esp, 16 ; 00000010H
$LN18@xmlTextRea:
; 1128 : xmlStrlen(node->content));
; 1129 : #endif
; 1130 : }
; 1131 :
; 1132 : /*
; 1133 : * go to next node
; 1134 : */
; 1135 : if (node->children != NULL) {
mov eax, DWORD PTR [esi+12]
test eax, eax
jne $LN77@xmlTextRea
; 1136 : node = node->children;
; 1137 : continue;
; 1138 : } else if (node->type == XML_ELEMENT_NODE) {
cmp DWORD PTR [esi+4], 1
jne $LN22@xmlTextRea
; 1139 : xmlTextReaderValidatePop(reader);
push ebx
call _xmlTextReaderValidatePop
add esp, 4
; 1140 : }
; 1141 : if (node->next != NULL) {
; 1142 : node = node->next;
; 1143 : continue;
jmp $LN22@xmlTextRea
$LL7@xmlTextRea:
; 1144 : }
; 1145 : do {
; 1146 : node = node->parent;
mov esi, DWORD PTR [esi+20]
; 1147 : if (node->type == XML_ELEMENT_NODE) {
mov eax, DWORD PTR [esi+4]
cmp eax, 1
jne SHORT $LN59@xmlTextRea
; 1148 : xmlNodePtr tmp;
; 1149 : if (reader->entNr == 0) {
cmp DWORD PTR [ebx+96], 0
jne SHORT $LN26@xmlTextRea
; 1150 : while ((tmp = node->last) != NULL) {
mov edi, DWORD PTR [esi+16]
test edi, edi
je SHORT $LN72@xmlTextRea
npad 7
$LL8@xmlTextRea:
; 1151 : if ((tmp->extra & NODE_IS_PRESERVED) == 0) {
test BYTE PTR [edi+58], 2
jne SHORT $LN72@xmlTextRea
; 1152 : xmlUnlinkNode(tmp);
push edi
call _xmlUnlinkNode
; 1153 : xmlTextReaderFreeNode(reader, tmp);
push edi
push ebx
call _xmlTextReaderFreeNode
mov edi, DWORD PTR [esi+16]
add esp, 12 ; 0000000cH
test edi, edi
jne SHORT $LL8@xmlTextRea
$LN72@xmlTextRea:
; 1154 : } else
; 1155 : break;
; 1156 : }
; 1157 : }
; 1158 : reader->node = node;
mov edi, DWORD PTR _oldnode$1$[ebp]
$LN26@xmlTextRea:
; 1159 : xmlTextReaderValidatePop(reader);
push ebx
mov DWORD PTR [ebx+64], esi
call _xmlTextReaderValidatePop
mov eax, DWORD PTR [esi+4]
add esp, 4
$LN59@xmlTextRea:
; 1160 : }
; 1161 : if ((node->type == XML_ENTITY_DECL) &&
; 1162 : (reader->ent != NULL) && (reader->ent->children == node)) {
cmp eax, 17 ; 00000011H
jne SHORT $LN34@xmlTextRea
mov eax, DWORD PTR [ebx+92]
test eax, eax
je SHORT $LN34@xmlTextRea
cmp DWORD PTR [eax+12], esi
jne SHORT $LN34@xmlTextRea
; 643 : if (reader->entNr <= 0)
mov eax, DWORD PTR [ebx+96]
test eax, eax
jg SHORT $LN35@xmlTextRea
; 644 : return (NULL);
xor esi, esi
jmp SHORT $LN34@xmlTextRea
$LN35@xmlTextRea:
; 645 : reader->entNr--;
; 646 : if (reader->entNr > 0)
mov ecx, DWORD PTR [ebx+104]
dec eax
mov DWORD PTR [ebx+96], eax
test eax, eax
jle SHORT $LN36@xmlTextRea
; 647 : reader->ent = reader->entTab[reader->entNr - 1];
mov edx, DWORD PTR [ecx+eax*4-4]
jmp SHORT $LN37@xmlTextRea
$LN36@xmlTextRea:
; 648 : else
; 649 : reader->ent = NULL;
xor edx, edx
$LN37@xmlTextRea:
; 650 : ret = reader->entTab[reader->entNr];
mov DWORD PTR [ebx+92], edx
mov esi, DWORD PTR [ecx+eax*4]
; 651 : reader->entTab[reader->entNr] = NULL;
mov DWORD PTR [ecx+eax*4], 0
$LN34@xmlTextRea:
; 1163 : node = xmlTextReaderEntPop(reader);
; 1164 : }
; 1165 : if (node == oldnode)
cmp esi, edi
je SHORT $LN2@xmlTextRea
$LN22@xmlTextRea:
; 1166 : break;
; 1167 : if (node->next != NULL) {
; 1168 : node = node->next;
; 1169 : break;
; 1170 : }
; 1171 : } while ((node != NULL) && (node != oldnode));
; 1172 : } while ((node != NULL) && (node != oldnode));
mov eax, DWORD PTR [esi+24]
test eax, eax
je $LL7@xmlTextRea
$LN77@xmlTextRea:
mov esi, eax
$LN2@xmlTextRea:
test esi, esi
je SHORT $LN32@xmlTextRea
cmp esi, edi
je SHORT $LN32@xmlTextRea
mov ecx, DWORD PTR _ctxt$1$[ebp]
jmp $LL4@xmlTextRea
$LN32@xmlTextRea:
; 1173 : reader->node = oldnode;
; 1174 : }
mov DWORD PTR [ebx+64], edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
_xmlTextReaderValidateEntity ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderValidatePop
_TEXT SEGMENT
_qname$3$ = 8 ; size = 4
_reader$ = 8 ; size = 4
_xmlTextReaderValidatePop PROC ; COMDAT
; 1039 : xmlTextReaderValidatePop(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
push ebx
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edi, DWORD PTR _reader$[ebp]
cmp DWORD PTR [edi+8], 1
mov ebx, DWORD PTR [edi+64]
jne SHORT $LN6@xmlTextRea
; 1040 : xmlNodePtr node = reader->node;
; 1041 :
; 1042 : #ifdef LIBXML_VALID_ENABLED
; 1043 : if ((reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
; 1044 : (reader->ctxt != NULL) && (reader->ctxt->validate == 1)) {
mov eax, DWORD PTR [edi+20]
test eax, eax
je SHORT $LN6@xmlTextRea
cmp DWORD PTR [eax+104], 1
jne SHORT $LN6@xmlTextRea
; 1045 : if ((node->ns == NULL) || (node->ns->prefix == NULL)) {
mov ecx, DWORD PTR [ebx+36]
push esi
test ecx, ecx
je SHORT $LN5@xmlTextRea
mov ecx, DWORD PTR [ecx+12]
test ecx, ecx
je SHORT $LN5@xmlTextRea
; 1047 : reader->ctxt->myDoc, node, node->name);
; 1048 : } else {
; 1049 : /* TODO use the BuildQName interface */
; 1050 : xmlChar *qname;
; 1051 :
; 1052 : qname = xmlStrdup(node->ns->prefix);
push ecx
call _xmlStrdup
; 1053 : qname = xmlStrcat(qname, BAD_CAST ":");
push OFFSET ??_C@_01JLIPDDHJ@?3@
push eax
call _xmlStrcat
; 1054 : qname = xmlStrcat(qname, node->name);
push DWORD PTR [ebx+8]
push eax
call _xmlStrcat
; 1055 : reader->ctxt->valid &= xmlValidatePopElement(&reader->ctxt->vctxt,
mov ecx, DWORD PTR [edi+20]
mov esi, ecx
push eax
push ebx
mov DWORD PTR _qname$3$[ebp], eax
push DWORD PTR [ecx+8]
add ecx, 108 ; 0000006cH
push ecx
call _xmlValidatePopElement
and DWORD PTR [esi+100], eax
add esp, 36 ; 00000024H
; 1056 : reader->ctxt->myDoc, node, qname);
; 1057 : if (qname != NULL)
mov eax, DWORD PTR _qname$3$[ebp]
test eax, eax
je SHORT $LN12@xmlTextRea
; 1058 : xmlFree(qname);
push eax
call DWORD PTR _xmlFree
add esp, 4
jmp SHORT $LN12@xmlTextRea
$LN5@xmlTextRea:
; 1046 : reader->ctxt->valid &= xmlValidatePopElement(&reader->ctxt->vctxt,
push DWORD PTR [ebx+8]
mov esi, eax
push ebx
push DWORD PTR [eax+8]
add eax, 108 ; 0000006cH
push eax
call _xmlValidatePopElement
add esp, 16 ; 00000010H
and DWORD PTR [esi+100], eax
$LN12@xmlTextRea:
pop esi
$LN6@xmlTextRea:
; 1059 : }
; 1060 : }
; 1061 : #endif /* LIBXML_VALID_ENABLED */
; 1062 : #ifdef LIBXML_SCHEMAS_ENABLED
; 1063 : if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
cmp DWORD PTR [edi+8], 2
jne SHORT $LN10@xmlTextRea
mov ecx, DWORD PTR [edi+120]
test ecx, ecx
je SHORT $LN10@xmlTextRea
; 1064 : (reader->rngValidCtxt != NULL)) {
; 1065 : int ret;
; 1066 :
; 1067 : if (reader->rngFullNode != NULL) {
mov eax, DWORD PTR [edi+132]
test eax, eax
je SHORT $LN8@xmlTextRea
; 1068 : if (node == reader->rngFullNode)
cmp ebx, eax
jne SHORT $LN10@xmlTextRea
; 1069 : reader->rngFullNode = NULL;
mov DWORD PTR [edi+132], 0
pop edi
; 1077 : }
; 1078 : #endif
; 1079 : }
pop ebx
pop ebp
ret 0
$LN8@xmlTextRea:
; 1070 : return;
; 1071 : }
; 1072 : ret = xmlRelaxNGValidatePopElement(reader->rngValidCtxt,
mov eax, DWORD PTR [edi+20]
push ebx
push DWORD PTR [eax+8]
push ecx
call _xmlRelaxNGValidatePopElement
add esp, 12 ; 0000000cH
; 1073 : reader->ctxt->myDoc,
; 1074 : node);
; 1075 : if (ret != 1)
cmp eax, 1
je SHORT $LN10@xmlTextRea
; 1076 : reader->rngValidErrors++;
inc DWORD PTR [edi+128]
$LN10@xmlTextRea:
pop edi
; 1077 : }
; 1078 : #endif
; 1079 : }
pop ebx
pop ebp
ret 0
_xmlTextReaderValidatePop ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderValidateCData
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_data$ = 12 ; size = 4
_len$ = 16 ; size = 4
_xmlTextReaderValidateCData PROC ; COMDAT
; 1011 : const xmlChar *data, int len) {
push ebp
mov ebp, esp
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
mov ecx, DWORD PTR _data$[ebp]
mov eax, DWORD PTR [esi+8]
cmp eax, 1
jne SHORT $LN2@xmlTextRea
; 1012 : #ifdef LIBXML_VALID_ENABLED
; 1013 : if ((reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
; 1014 : (reader->ctxt != NULL) && (reader->ctxt->validate == 1)) {
mov edi, DWORD PTR [esi+20]
test edi, edi
je SHORT $LN5@xmlTextRea
cmp DWORD PTR [edi+104], 1
jne SHORT $LN5@xmlTextRea
; 1015 : reader->ctxt->valid &= xmlValidatePushCData(&reader->ctxt->vctxt,
push DWORD PTR _len$[ebp]
lea eax, DWORD PTR [edi+108]
push ecx
push eax
call _xmlValidatePushCData
mov ecx, DWORD PTR _data$[ebp]
add esp, 12 ; 0000000cH
and DWORD PTR [edi+100], eax
mov eax, DWORD PTR [esi+8]
$LN2@xmlTextRea:
; 1016 : data, len);
; 1017 : }
; 1018 : #endif /* LIBXML_VALID_ENABLED */
; 1019 : #ifdef LIBXML_SCHEMAS_ENABLED
; 1020 : if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
cmp eax, 2
jne SHORT $LN5@xmlTextRea
mov eax, DWORD PTR [esi+120]
test eax, eax
je SHORT $LN5@xmlTextRea
; 1021 : (reader->rngValidCtxt != NULL)) {
; 1022 : int ret;
; 1023 :
; 1024 : if (reader->rngFullNode != NULL) return;
cmp DWORD PTR [esi+132], 0
jne SHORT $LN5@xmlTextRea
; 1025 : ret = xmlRelaxNGValidatePushCData(reader->rngValidCtxt, data, len);
push DWORD PTR _len$[ebp]
push ecx
push eax
call _xmlRelaxNGValidatePushCData
add esp, 12 ; 0000000cH
; 1026 : if (ret != 1)
cmp eax, 1
je SHORT $LN5@xmlTextRea
; 1027 : reader->rngValidErrors++;
inc DWORD PTR [esi+128]
$LN5@xmlTextRea:
pop edi
; 1028 : }
; 1029 : #endif
; 1030 : }
pop esi
pop ebp
ret 0
_xmlTextReaderValidateCData ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderValidatePush
_TEXT SEGMENT
_qname$3$ = 8 ; size = 4
_reader$ = 8 ; size = 4
_xmlTextReaderValidatePush PROC ; COMDAT
; 948 : xmlTextReaderValidatePush(xmlTextReaderPtr reader ATTRIBUTE_UNUSED) {
push ebp
mov ebp, esp
push ebx
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edi, DWORD PTR _reader$[ebp]
cmp DWORD PTR [edi+8], 1
mov ebx, DWORD PTR [edi+64]
jne SHORT $LN6@xmlTextRea
; 949 : xmlNodePtr node = reader->node;
; 950 :
; 951 : #ifdef LIBXML_VALID_ENABLED
; 952 : if ((reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
; 953 : (reader->ctxt != NULL) && (reader->ctxt->validate == 1)) {
mov eax, DWORD PTR [edi+20]
test eax, eax
je SHORT $LN6@xmlTextRea
cmp DWORD PTR [eax+104], 1
jne SHORT $LN6@xmlTextRea
; 954 : if ((node->ns == NULL) || (node->ns->prefix == NULL)) {
mov ecx, DWORD PTR [ebx+36]
test ecx, ecx
je SHORT $LN5@xmlTextRea
mov ecx, DWORD PTR [ecx+12]
test ecx, ecx
je SHORT $LN5@xmlTextRea
; 956 : reader->ctxt->myDoc, node, node->name);
; 957 : } else {
; 958 : /* TODO use the BuildQName interface */
; 959 : xmlChar *qname;
; 960 :
; 961 : qname = xmlStrdup(node->ns->prefix);
push ecx
call _xmlStrdup
; 962 : qname = xmlStrcat(qname, BAD_CAST ":");
push OFFSET ??_C@_01JLIPDDHJ@?3@
push eax
call _xmlStrcat
; 963 : qname = xmlStrcat(qname, node->name);
push DWORD PTR [ebx+8]
push eax
call _xmlStrcat
; 964 : reader->ctxt->valid &= xmlValidatePushElement(&reader->ctxt->vctxt,
mov ecx, DWORD PTR [edi+20]
mov esi, ecx
push eax
push ebx
mov DWORD PTR _qname$3$[ebp], eax
push DWORD PTR [ecx+8]
add ecx, 108 ; 0000006cH
push ecx
call _xmlValidatePushElement
and DWORD PTR [esi+100], eax
add esp, 36 ; 00000024H
; 965 : reader->ctxt->myDoc, node, qname);
; 966 : if (qname != NULL)
mov eax, DWORD PTR _qname$3$[ebp]
test eax, eax
je SHORT $LN6@xmlTextRea
; 967 : xmlFree(qname);
push eax
call DWORD PTR _xmlFree
add esp, 4
jmp SHORT $LN6@xmlTextRea
$LN5@xmlTextRea:
; 955 : reader->ctxt->valid &= xmlValidatePushElement(&reader->ctxt->vctxt,
push DWORD PTR [ebx+8]
mov esi, eax
push ebx
push DWORD PTR [eax+8]
add eax, 108 ; 0000006cH
push eax
call _xmlValidatePushElement
add esp, 16 ; 00000010H
and DWORD PTR [esi+100], eax
$LN6@xmlTextRea:
; 968 : }
; 969 : }
; 970 : #endif /* LIBXML_VALID_ENABLED */
; 971 : #ifdef LIBXML_SCHEMAS_ENABLED
; 972 : if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
cmp DWORD PTR [edi+8], 2
jne SHORT $LN12@xmlTextRea
mov ecx, DWORD PTR [edi+120]
test ecx, ecx
je SHORT $LN12@xmlTextRea
; 973 : (reader->rngValidCtxt != NULL)) {
; 974 : int ret;
; 975 :
; 976 : if (reader->rngFullNode != NULL) return;
cmp DWORD PTR [edi+132], 0
jne SHORT $LN12@xmlTextRea
; 977 : ret = xmlRelaxNGValidatePushElement(reader->rngValidCtxt,
mov eax, DWORD PTR [edi+20]
push ebx
push DWORD PTR [eax+8]
push ecx
call _xmlRelaxNGValidatePushElement
add esp, 12 ; 0000000cH
; 978 : reader->ctxt->myDoc,
; 979 : node);
; 980 : if (ret == 0) {
test eax, eax
jne SHORT $LN11@xmlTextRea
; 981 : /*
; 982 : * this element requires a full tree
; 983 : */
; 984 : node = xmlTextReaderExpand(reader);
push edi
call _xmlTextReaderExpand
mov esi, eax
add esp, 4
; 985 : if (node == NULL) {
test esi, esi
jne SHORT $LN10@xmlTextRea
; 986 : printf("Expand failed !\n");
push OFFSET ??_C@_0BB@DOFEEJAH@Expand?5failed?5?$CB?6@
call _printf
add esp, 4
; 996 : reader->rngValidErrors++;
inc DWORD PTR [edi+128]
pop edi
; 997 : }
; 998 : #endif
; 999 : }
pop esi
pop ebx
pop ebp
ret 0
$LN10@xmlTextRea:
; 987 : ret = -1;
; 988 : } else {
; 989 : ret = xmlRelaxNGValidateFullElement(reader->rngValidCtxt,
mov eax, DWORD PTR [edi+20]
push esi
push DWORD PTR [eax+8]
push DWORD PTR [edi+120]
call _xmlRelaxNGValidateFullElement
add esp, 12 ; 0000000cH
; 990 : reader->ctxt->myDoc,
; 991 : node);
; 992 : reader->rngFullNode = node;
mov DWORD PTR [edi+132], esi
$LN11@xmlTextRea:
; 993 : }
; 994 : }
; 995 : if (ret != 1)
cmp eax, 1
je SHORT $LN12@xmlTextRea
; 996 : reader->rngValidErrors++;
inc DWORD PTR [edi+128]
$LN12@xmlTextRea:
pop edi
; 997 : }
; 998 : #endif
; 999 : }
pop esi
pop ebx
pop ebp
ret 0
_xmlTextReaderValidatePush ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderPushData
_TEXT SEGMENT
_oldstate$1$ = -4 ; size = 4
_alloc$1$ = 8 ; size = 4
_reader$ = 8 ; size = 4
_xmlTextReaderPushData PROC ; COMDAT
; 829 : xmlTextReaderPushData(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
push ecx
push ebx
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
mov ebx, DWORD PTR [esi+28]
test ebx, ebx
je $LN5@xmlTextRea
; 830 : xmlBufPtr inbuf;
; 831 : int val, s;
; 832 : xmlTextReaderState oldstate;
; 833 : int alloc;
; 834 :
; 835 : if ((reader->input == NULL) || (reader->input->buffer == NULL))
cmp DWORD PTR [ebx+16], 0
je $LN5@xmlTextRea
; 836 : return(-1);
; 837 :
; 838 : oldstate = reader->state;
mov edi, DWORD PTR [esi+16]
; 839 : reader->state = XML_TEXTREADER_NONE;
mov DWORD PTR [esi+16], -1
; 840 : inbuf = reader->input->buffer;
mov ebx, DWORD PTR [ebx+16]
; 841 : alloc = xmlBufGetAllocationScheme(inbuf);
push ebx
mov DWORD PTR _oldstate$1$[ebp], edi
call _xmlBufGetAllocationScheme
add esp, 4
mov ecx, eax
; 842 :
; 843 : while (reader->state == XML_TEXTREADER_NONE) {
cmp DWORD PTR [esi+16], -1
mov DWORD PTR _alloc$1$[ebp], ecx
jne $LN21@xmlTextRea
$LL2@xmlTextRea:
; 844 : if (xmlBufUse(inbuf) < reader->cur + CHUNK_SIZE) {
push ebx
call _xmlBufUse
mov ecx, DWORD PTR [esi+60]
add esp, 4
add ecx, 512 ; 00000200H
cmp eax, ecx
jae SHORT $LN12@xmlTextRea
; 845 : /*
; 846 : * Refill the buffer unless we are at the end of the stream
; 847 : */
; 848 : if (reader->mode != XML_TEXTREADER_MODE_EOF) {
cmp DWORD PTR [esi], 3
je $LN45@xmlTextRea
; 849 : val = xmlParserInputBufferRead(reader->input, 4096);
push 4096 ; 00001000H
push DWORD PTR [esi+28]
call _xmlParserInputBufferRead
mov ecx, eax
add esp, 8
; 850 : if ((val == 0) &&
test ecx, ecx
jne SHORT $LN46@xmlTextRea
cmp DWORD PTR _alloc$1$[ebp], 2
jne $LN36@xmlTextRea
; 851 : (alloc == XML_BUFFER_ALLOC_IMMUTABLE)) {
; 852 : if (xmlBufUse(inbuf) == reader->cur) {
push ebx
call _xmlBufUse
add esp, 4
cmp eax, DWORD PTR [esi+60]
jne SHORT $LN12@xmlTextRea
; 853 : reader->mode = XML_TEXTREADER_MODE_EOF;
mov DWORD PTR [esi], 3
; 854 : reader->state = oldstate;
mov DWORD PTR [esi+16], edi
jmp SHORT $LN12@xmlTextRea
$LN46@xmlTextRea:
; 855 : }
; 856 : } else if (val < 0) {
jns SHORT $LN12@xmlTextRea
; 857 : reader->mode = XML_TEXTREADER_MODE_EOF;
mov DWORD PTR [esi], 3
; 858 : reader->state = oldstate;
mov DWORD PTR [esi+16], edi
; 859 : if ((oldstate != XML_TEXTREADER_START) ||
test edi, edi
jne $LN35@xmlTextRea
mov eax, DWORD PTR [esi+20]
cmp DWORD PTR [eax+8], edi
jne $LN35@xmlTextRea
$LN12@xmlTextRea:
; 865 : break;
; 866 : }
; 867 :
; 868 : } else
; 869 : break;
; 870 : }
; 871 : /*
; 872 : * parse by block of CHUNK_SIZE bytes, various tests show that
; 873 : * it's the best tradeoff at least on a 1.2GH Duron
; 874 : */
; 875 : if (xmlBufUse(inbuf) >= reader->cur + CHUNK_SIZE) {
push ebx
call _xmlBufUse
mov ecx, DWORD PTR [esi+60]
add esp, 4
add ecx, 512 ; 00000200H
cmp eax, ecx
jb $LN17@xmlTextRea
; 876 : val = xmlParseChunk(reader->ctxt,
push 0
push 512 ; 00000200H
push ebx
call _xmlBufContent
add eax, DWORD PTR [esi+60]
add esp, 4
push eax
push DWORD PTR [esi+20]
call _xmlParseChunk
; 877 : (const char *) xmlBufContent(inbuf) + reader->cur,
; 878 : CHUNK_SIZE, 0);
; 879 : reader->cur += CHUNK_SIZE;
add DWORD PTR [esi+60], 512 ; 00000200H
add esp, 16 ; 00000010H
; 880 : if (val != 0)
test eax, eax
je SHORT $LN19@xmlTextRea
; 881 : reader->ctxt->wellFormed = 0;
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [eax+12], 0
$LN19@xmlTextRea:
; 882 : if (reader->ctxt->wellFormed == 0)
mov eax, DWORD PTR [esi+20]
cmp DWORD PTR [eax+12], 0
je $LN45@xmlTextRea
; 842 :
; 843 : while (reader->state == XML_TEXTREADER_NONE) {
cmp DWORD PTR [esi+16], -1
je $LL2@xmlTextRea
jmp $LN45@xmlTextRea
$LN36@xmlTextRea:
; 860 : (reader->ctxt->myDoc != NULL))
; 861 : return(val);
; 862 : } else if (val == 0) {
; 863 : /* mark the end of the stream and process the remains */
; 864 : reader->mode = XML_TEXTREADER_MODE_EOF;
mov DWORD PTR [esi], 3
; 892 : break;
; 893 : }
; 894 : }
; 895 :
; 896 : /*
; 897 : * Discard the consumed input when needed and possible
; 898 : */
; 899 : if (reader->mode == XML_TEXTREADER_MODE_INTERACTIVE) {
mov eax, 3
$LN22@xmlTextRea:
; 910 :
; 911 : /*
; 912 : * At the end of the stream signal that the work is done to the Push
; 913 : * parser.
; 914 : */
; 915 : else if (reader->mode == XML_TEXTREADER_MODE_EOF) {
cmp eax, 3
jne SHORT $LN31@xmlTextRea
; 916 : if (reader->state != XML_TEXTREADER_DONE) {
cmp DWORD PTR [esi+16], 5
je SHORT $LN31@xmlTextRea
; 917 : s = xmlBufUse(inbuf) - reader->cur;
push ebx
call _xmlBufUse
sub eax, DWORD PTR [esi+60]
add esp, 4
; 918 : val = xmlParseChunk(reader->ctxt,
push 1
push eax
push ebx
call _xmlBufContent
add eax, DWORD PTR [esi+60]
add esp, 4
push eax
push DWORD PTR [esi+20]
call _xmlParseChunk
; 919 : (const char *) xmlBufContent(inbuf) + reader->cur,
; 920 : s, 1);
; 921 : reader->cur = xmlBufUse(inbuf);
push ebx
mov edi, eax
call _xmlBufUse
add esp, 20 ; 00000014H
mov DWORD PTR [esi+60], eax
; 922 : reader->state = XML_TEXTREADER_DONE;
mov DWORD PTR [esi+16], 5
; 923 : if (val != 0) {
test edi, edi
je SHORT $LN31@xmlTextRea
; 924 : if (reader->ctxt->wellFormed)
mov eax, DWORD PTR [esi+20]
cmp DWORD PTR [eax+12], 0
je SHORT $LN5@xmlTextRea
; 925 : reader->ctxt->wellFormed = 0;
mov DWORD PTR [eax+12], 0
$LN31@xmlTextRea:
; 926 : else
; 927 : return(-1);
; 928 : }
; 929 : }
; 930 : }
; 931 : reader->state = oldstate;
mov eax, DWORD PTR _oldstate$1$[ebp]
mov DWORD PTR [esi+16], eax
; 932 : if (reader->ctxt->wellFormed == 0) {
mov eax, DWORD PTR [esi+20]
cmp DWORD PTR [eax+12], 0
jne $LN32@xmlTextRea
; 933 : reader->mode = XML_TEXTREADER_MODE_EOF;
mov DWORD PTR [esi], 3
$LN5@xmlTextRea:
pop edi
; 934 : return(-1);
; 935 : }
; 936 :
; 937 : return(0);
; 938 : }
pop esi
or eax, -1
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN35@xmlTextRea:
pop edi
pop esi
mov eax, ecx
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN17@xmlTextRea:
; 883 : break;
; 884 : } else {
; 885 : s = xmlBufUse(inbuf) - reader->cur;
push ebx
call _xmlBufUse
add esp, 4
mov edi, eax
sub edi, DWORD PTR [esi+60]
; 886 : val = xmlParseChunk(reader->ctxt,
push 0
push edi
push ebx
call _xmlBufContent
add eax, DWORD PTR [esi+60]
add esp, 4
push eax
push DWORD PTR [esi+20]
call _xmlParseChunk
; 887 : (const char *) xmlBufContent(inbuf) + reader->cur,
; 888 : s, 0);
; 889 : reader->cur += s;
add DWORD PTR [esi+60], edi
add esp, 16 ; 00000010H
; 890 : if (val != 0)
test eax, eax
je SHORT $LN45@xmlTextRea
; 891 : reader->ctxt->wellFormed = 0;
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [eax+12], 0
$LN45@xmlTextRea:
; 892 : break;
; 893 : }
; 894 : }
; 895 :
; 896 : /*
; 897 : * Discard the consumed input when needed and possible
; 898 : */
; 899 : if (reader->mode == XML_TEXTREADER_MODE_INTERACTIVE) {
mov ecx, DWORD PTR _alloc$1$[ebp]
$LN21@xmlTextRea:
mov eax, DWORD PTR [esi]
cmp eax, 1
jne $LN22@xmlTextRea
; 900 : if (alloc != XML_BUFFER_ALLOC_IMMUTABLE) {
cmp ecx, 2
je SHORT $LN31@xmlTextRea
; 901 : if ((reader->cur >= 4096) &&
cmp DWORD PTR [esi+60], 4096 ; 00001000H
jb $LN31@xmlTextRea
mov edi, DWORD PTR [esi+60]
push ebx
call _xmlBufUse
sub eax, edi
add esp, 4
cmp eax, 512 ; 00000200H
ja $LN31@xmlTextRea
; 902 : (xmlBufUse(inbuf) - reader->cur <= CHUNK_SIZE)) {
; 903 : val = xmlBufShrink(inbuf, reader->cur);
push edi
push ebx
call _xmlBufShrink
add esp, 8
; 904 : if (val >= 0) {
test eax, eax
js $LN31@xmlTextRea
; 905 : reader->cur -= val;
sub DWORD PTR [esi+60], eax
; 906 : }
; 907 : }
; 908 : }
; 909 : }
jmp $LN31@xmlTextRea
$LN32@xmlTextRea:
pop edi
; 934 : return(-1);
; 935 : }
; 936 :
; 937 : return(0);
; 938 : }
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret 0
_xmlTextReaderPushData ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderCDataBlock
_TEXT SEGMENT
_ctx$ = 8 ; size = 4
_ch$ = 12 ; size = 4
_len$ = 16 ; size = 4
_xmlTextReaderCDataBlock PROC ; COMDAT
; 807 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _ctx$[ebp]
mov eax, DWORD PTR [ecx+272]
test eax, eax
je SHORT $LN2@xmlTextRea
; 808 : xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
; 809 : xmlTextReaderPtr reader = ctxt->_private;
; 810 :
; 811 : #ifdef DEBUG_CALLBACKS
; 812 : printf("xmlTextReaderCDataBlock()\n");
; 813 : #endif
; 814 : if ((reader != NULL) && (reader->cdataBlock != NULL)) {
mov eax, DWORD PTR [eax+52]
test eax, eax
je SHORT $LN2@xmlTextRea
; 815 : reader->cdataBlock(ctx, ch, len);
mov DWORD PTR _ctx$[ebp], ecx
; 816 : }
; 817 : }
pop ebp
; 815 : reader->cdataBlock(ctx, ch, len);
jmp eax
$LN2@xmlTextRea:
; 816 : }
; 817 : }
pop ebp
ret 0
_xmlTextReaderCDataBlock ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderCharacters
_TEXT SEGMENT
_ctx$ = 8 ; size = 4
_ch$ = 12 ; size = 4
_len$ = 16 ; size = 4
_xmlTextReaderCharacters PROC ; COMDAT
; 785 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _ctx$[ebp]
mov eax, DWORD PTR [ecx+272]
test eax, eax
je SHORT $LN2@xmlTextRea
; 786 : xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
; 787 : xmlTextReaderPtr reader = ctxt->_private;
; 788 :
; 789 : #ifdef DEBUG_CALLBACKS
; 790 : printf("xmlTextReaderCharacters()\n");
; 791 : #endif
; 792 : if ((reader != NULL) && (reader->characters != NULL)) {
mov eax, DWORD PTR [eax+48]
test eax, eax
je SHORT $LN2@xmlTextRea
; 793 : reader->characters(ctx, ch, len);
mov DWORD PTR _ctx$[ebp], ecx
; 794 : }
; 795 : }
pop ebp
; 793 : reader->characters(ctx, ch, len);
jmp eax
$LN2@xmlTextRea:
; 794 : }
; 795 : }
pop ebp
ret 0
_xmlTextReaderCharacters ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderEndElementNs
_TEXT SEGMENT
_ctx$ = 8 ; size = 4
_localname$ = 12 ; size = 4
_prefix$ = 16 ; size = 4
_URI$ = 20 ; size = 4
_xmlTextReaderEndElementNs PROC ; COMDAT
; 762 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _ctx$[ebp]
mov eax, DWORD PTR [ecx+272]
test eax, eax
je SHORT $LN2@xmlTextRea
; 763 : xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
; 764 : xmlTextReaderPtr reader = ctxt->_private;
; 765 :
; 766 : #ifdef DEBUG_CALLBACKS
; 767 : printf("xmlTextReaderEndElementNs(%s)\n", localname);
; 768 : #endif
; 769 : if ((reader != NULL) && (reader->endElementNs != NULL)) {
mov eax, DWORD PTR [eax+44]
test eax, eax
je SHORT $LN2@xmlTextRea
; 770 : reader->endElementNs(ctx, localname, prefix, URI);
mov DWORD PTR _ctx$[ebp], ecx
; 771 : }
; 772 : }
pop ebp
; 770 : reader->endElementNs(ctx, localname, prefix, URI);
jmp eax
$LN2@xmlTextRea:
; 771 : }
; 772 : }
pop ebp
ret 0
_xmlTextReaderEndElementNs ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderStartElementNs
_TEXT SEGMENT
_ctx$ = 8 ; size = 4
_localname$ = 12 ; size = 4
_prefix$ = 16 ; size = 4
_URI$ = 20 ; size = 4
_nb_namespaces$ = 24 ; size = 4
_namespaces$ = 28 ; size = 4
_nb_attributes$ = 32 ; size = 4
_nb_defaulted$ = 36 ; size = 4
_attributes$ = 40 ; size = 4
_xmlTextReaderStartElementNs PROC ; COMDAT
; 728 : {
push ebp
mov ebp, esp
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edi, DWORD PTR _ctx$[ebp]
mov esi, DWORD PTR [edi+272]
test esi, esi
je SHORT $LN4@xmlTextRea
; 729 : xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
; 730 : xmlTextReaderPtr reader = ctxt->_private;
; 731 :
; 732 : #ifdef DEBUG_CALLBACKS
; 733 : printf("xmlTextReaderStartElementNs(%s)\n", localname);
; 734 : #endif
; 735 : if ((reader != NULL) && (reader->startElementNs != NULL)) {
mov eax, DWORD PTR [esi+40]
test eax, eax
je SHORT $LN3@xmlTextRea
; 736 : reader->startElementNs(ctx, localname, prefix, URI, nb_namespaces,
push DWORD PTR _attributes$[ebp]
push DWORD PTR _nb_defaulted$[ebp]
push DWORD PTR _nb_attributes$[ebp]
push DWORD PTR _namespaces$[ebp]
push DWORD PTR _nb_namespaces$[ebp]
push DWORD PTR _URI$[ebp]
push DWORD PTR _prefix$[ebp]
push DWORD PTR _localname$[ebp]
push edi
call eax
; 737 : namespaces, nb_attributes, nb_defaulted,
; 738 : attributes);
; 739 : if ((ctxt->node != NULL) && (ctxt->input != NULL) &&
; 740 : (ctxt->input->cur != NULL) && (ctxt->input->cur[0] == '/') &&
mov ecx, DWORD PTR [edi+52]
add esp, 36 ; 00000024H
test ecx, ecx
je SHORT $LN3@xmlTextRea
mov eax, DWORD PTR [edi+36]
test eax, eax
je SHORT $LN3@xmlTextRea
mov eax, DWORD PTR [eax+16]
test eax, eax
je SHORT $LN3@xmlTextRea
cmp BYTE PTR [eax], 47 ; 0000002fH
jne SHORT $LN3@xmlTextRea
cmp BYTE PTR [eax+1], 62 ; 0000003eH
jne SHORT $LN3@xmlTextRea
; 741 : (ctxt->input->cur[1] == '>'))
; 742 : ctxt->node->extra = NODE_IS_EMPTY;
mov eax, 1
mov WORD PTR [ecx+58], ax
$LN3@xmlTextRea:
; 743 : }
; 744 : if (reader != NULL)
; 745 : reader->state = XML_TEXTREADER_ELEMENT;
mov DWORD PTR [esi+16], 1
$LN4@xmlTextRea:
pop edi
; 746 : }
pop esi
pop ebp
ret 0
_xmlTextReaderStartElementNs ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderEndElement
_TEXT SEGMENT
_ctx$ = 8 ; size = 4
_fullname$ = 12 ; size = 4
_xmlTextReaderEndElement PROC ; COMDAT
; 691 : xmlTextReaderEndElement(void *ctx, const xmlChar *fullname) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _ctx$[ebp]
mov eax, DWORD PTR [ecx+272]
test eax, eax
je SHORT $LN2@xmlTextRea
; 692 : xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
; 693 : xmlTextReaderPtr reader = ctxt->_private;
; 694 :
; 695 : #ifdef DEBUG_CALLBACKS
; 696 : printf("xmlTextReaderEndElement(%s)\n", fullname);
; 697 : #endif
; 698 : if ((reader != NULL) && (reader->endElement != NULL)) {
mov eax, DWORD PTR [eax+36]
test eax, eax
je SHORT $LN2@xmlTextRea
; 699 : reader->endElement(ctx, fullname);
mov DWORD PTR _ctx$[ebp], ecx
; 700 : }
; 701 : }
pop ebp
; 699 : reader->endElement(ctx, fullname);
jmp eax
$LN2@xmlTextRea:
; 700 : }
; 701 : }
pop ebp
ret 0
_xmlTextReaderEndElement ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderStartElement
_TEXT SEGMENT
_ctx$ = 8 ; size = 4
_fullname$ = 12 ; size = 4
_atts$ = 16 ; size = 4
_xmlTextReaderStartElement PROC ; COMDAT
; 665 : const xmlChar **atts) {
push ebp
mov ebp, esp
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _ctx$[ebp]
mov edi, DWORD PTR [esi+272]
test edi, edi
je SHORT $LN4@xmlTextRea
; 666 : xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
; 667 : xmlTextReaderPtr reader = ctxt->_private;
; 668 :
; 669 : #ifdef DEBUG_CALLBACKS
; 670 : printf("xmlTextReaderStartElement(%s)\n", fullname);
; 671 : #endif
; 672 : if ((reader != NULL) && (reader->startElement != NULL)) {
mov eax, DWORD PTR [edi+32]
test eax, eax
je SHORT $LN3@xmlTextRea
; 673 : reader->startElement(ctx, fullname, atts);
push DWORD PTR _atts$[ebp]
push DWORD PTR _fullname$[ebp]
push esi
call eax
; 674 : if ((ctxt->node != NULL) && (ctxt->input != NULL) &&
; 675 : (ctxt->input->cur != NULL) && (ctxt->input->cur[0] == '/') &&
mov ecx, DWORD PTR [esi+52]
add esp, 12 ; 0000000cH
test ecx, ecx
je SHORT $LN3@xmlTextRea
mov eax, DWORD PTR [esi+36]
test eax, eax
je SHORT $LN3@xmlTextRea
mov eax, DWORD PTR [eax+16]
test eax, eax
je SHORT $LN3@xmlTextRea
cmp BYTE PTR [eax], 47 ; 0000002fH
jne SHORT $LN3@xmlTextRea
cmp BYTE PTR [eax+1], 62 ; 0000003eH
jne SHORT $LN3@xmlTextRea
; 676 : (ctxt->input->cur[1] == '>'))
; 677 : ctxt->node->extra = NODE_IS_EMPTY;
mov eax, 1
mov WORD PTR [ecx+58], ax
$LN3@xmlTextRea:
; 678 : }
; 679 : if (reader != NULL)
; 680 : reader->state = XML_TEXTREADER_ELEMENT;
mov DWORD PTR [edi+16], 1
$LN4@xmlTextRea:
pop edi
; 681 : }
pop esi
pop ebp
ret 0
_xmlTextReaderStartElement ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderEntPop
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderEntPop PROC ; COMDAT
; 640 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edx, DWORD PTR _reader$[ebp]
mov ecx, DWORD PTR [edx+96]
test ecx, ecx
jg SHORT $LN2@xmlTextRea
; 641 : xmlNodePtr ret;
; 642 :
; 643 : if (reader->entNr <= 0)
; 644 : return (NULL);
xor eax, eax
; 653 : }
pop ebp
ret 0
$LN2@xmlTextRea:
; 645 : reader->entNr--;
dec ecx
mov DWORD PTR [edx+96], ecx
; 646 : if (reader->entNr > 0)
test ecx, ecx
jle SHORT $LN3@xmlTextRea
; 647 : reader->ent = reader->entTab[reader->entNr - 1];
mov eax, DWORD PTR [edx+104]
mov eax, DWORD PTR [eax+ecx*4-4]
; 650 : ret = reader->entTab[reader->entNr];
mov DWORD PTR [edx+92], eax
mov eax, DWORD PTR [edx+104]
mov edx, DWORD PTR [eax+ecx*4]
; 651 : reader->entTab[reader->entNr] = NULL;
mov DWORD PTR [eax+ecx*4], 0
; 652 : return (ret);
mov eax, edx
; 653 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 648 : else
; 649 : reader->ent = NULL;
xor eax, eax
; 650 : ret = reader->entTab[reader->entNr];
mov DWORD PTR [edx+92], eax
mov eax, DWORD PTR [edx+104]
mov edx, DWORD PTR [eax+ecx*4]
; 651 : reader->entTab[reader->entNr] = NULL;
mov DWORD PTR [eax+ecx*4], 0
; 652 : return (ret);
mov eax, edx
; 653 : }
pop ebp
ret 0
_xmlTextReaderEntPop ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderEntPush
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_value$ = 12 ; size = 4
_xmlTextReaderEntPush PROC ; COMDAT
; 604 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
cmp DWORD PTR [esi+100], 0
jg SHORT $LN11@xmlTextRea
; 605 : if (reader->entMax <= 0) {
; 606 : reader->entMax = 10;
push 40 ; 00000028H
mov DWORD PTR [esi+100], 10 ; 0000000aH
; 607 : reader->entTab = (xmlNodePtr *) xmlMalloc(reader->entMax *
call DWORD PTR _xmlMalloc
add esp, 4
mov DWORD PTR [esi+104], eax
; 608 : sizeof(reader->entTab[0]));
; 609 : if (reader->entTab == NULL) {
test eax, eax
jne SHORT $LN11@xmlTextRea
; 610 : xmlGenericError(xmlGenericErrorContext, "xmlMalloc failed !\n");
call ___xmlGenericError
mov esi, eax
call ___xmlGenericErrorContext
push OFFSET ??_C@_0BE@MPMNBMMA@xmlMalloc?5failed?5?$CB?6@
push DWORD PTR [eax]
mov eax, DWORD PTR [esi]
call eax
add esp, 8
; 611 : return (0);
xor eax, eax
pop esi
; 628 : }
pop ebp
ret 0
$LN11@xmlTextRea:
; 612 : }
; 613 : }
; 614 : if (reader->entNr >= reader->entMax) {
mov eax, DWORD PTR [esi+100]
cmp DWORD PTR [esi+96], eax
jl SHORT $LN12@xmlTextRea
; 615 : reader->entMax *= 2;
add eax, eax
mov DWORD PTR [esi+100], eax
; 616 : reader->entTab =
shl eax, 2
push eax
push DWORD PTR [esi+104]
call DWORD PTR _xmlRealloc
add esp, 8
mov DWORD PTR [esi+104], eax
; 617 : (xmlNodePtr *) xmlRealloc(reader->entTab,
; 618 : reader->entMax *
; 619 : sizeof(reader->entTab[0]));
; 620 : if (reader->entTab == NULL) {
test eax, eax
jne SHORT $LN12@xmlTextRea
; 621 : xmlGenericError(xmlGenericErrorContext, "xmlRealloc failed !\n");
call ___xmlGenericError
mov esi, eax
call ___xmlGenericErrorContext
push OFFSET ??_C@_0BF@DCPGEBNC@xmlRealloc?5failed?5?$CB?6@
push DWORD PTR [eax]
mov eax, DWORD PTR [esi]
call eax
add esp, 8
; 622 : return (0);
xor eax, eax
pop esi
; 628 : }
pop ebp
ret 0
$LN12@xmlTextRea:
; 623 : }
; 624 : }
; 625 : reader->entTab[reader->entNr] = value;
mov edx, DWORD PTR [esi+96]
mov eax, DWORD PTR [esi+104]
mov ecx, DWORD PTR _value$[ebp]
mov DWORD PTR [eax+edx*4], ecx
; 626 : reader->ent = value;
; 627 : return (reader->entNr++);
mov eax, DWORD PTR [esi+96]
mov DWORD PTR [esi+92], ecx
lea ecx, DWORD PTR [eax+1]
mov DWORD PTR [esi+96], ecx
pop esi
; 628 : }
pop ebp
ret 0
_xmlTextReaderEntPush ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderFreeDoc
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_cur$ = 12 ; size = 4
_xmlTextReaderFreeDoc PROC ; COMDAT
; 518 : xmlTextReaderFreeDoc(xmlTextReaderPtr reader, xmlDocPtr cur) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _cur$[ebp]
test esi, esi
je $LN1@xmlTextRea
; 519 : xmlDtdPtr extSubset, intSubset;
; 520 :
; 521 : if (cur == NULL) return;
; 522 :
; 523 : if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue))
cmp DWORD PTR ___xmlRegisterCallbacks, 0
je SHORT $LN3@xmlTextRea
call ___xmlDeregisterNodeDefaultValue
cmp DWORD PTR [eax], 0
je SHORT $LN3@xmlTextRea
; 524 : xmlDeregisterNodeDefaultValue((xmlNodePtr) cur);
call ___xmlDeregisterNodeDefaultValue
push esi
mov eax, DWORD PTR [eax]
call eax
add esp, 4
$LN3@xmlTextRea:
; 525 :
; 526 : /*
; 527 : * Do this before freeing the children list to avoid ID lookups
; 528 : */
; 529 : if (cur->ids != NULL) xmlTextReaderFreeIDTable((xmlIDTablePtr) cur->ids);
mov eax, DWORD PTR [esi+64]
test eax, eax
je SHORT $LN17@xmlTextRea
; 507 : xmlHashFree(table, xmlTextReaderFreeIDTableEntry);
push OFFSET _xmlTextReaderFreeIDTableEntry
push eax
call _xmlHashFree
add esp, 8
$LN17@xmlTextRea:
; 530 : cur->ids = NULL;
; 531 : if (cur->refs != NULL) xmlFreeRefTable((xmlRefTablePtr) cur->refs);
mov eax, DWORD PTR [esi+68]
mov DWORD PTR [esi+64], 0
test eax, eax
je SHORT $LN5@xmlTextRea
push eax
call _xmlFreeRefTable
add esp, 4
$LN5@xmlTextRea:
; 532 : cur->refs = NULL;
; 533 : extSubset = cur->extSubset;
mov eax, DWORD PTR [esi+48]
push ebx
; 534 : intSubset = cur->intSubset;
; 535 : if (intSubset == extSubset)
; 536 : extSubset = NULL;
; 537 : if (extSubset != NULL) {
xor ebx, ebx
mov DWORD PTR [esi+68], 0
push edi
mov edi, DWORD PTR [esi+44]
cmp edi, eax
cmovne ebx, eax
test ebx, ebx
je SHORT $LN7@xmlTextRea
; 538 : xmlUnlinkNode((xmlNodePtr) cur->extSubset);
push eax
call _xmlUnlinkNode
; 539 : cur->extSubset = NULL;
; 540 : xmlFreeDtd(extSubset);
push ebx
mov DWORD PTR [esi+48], 0
call _xmlFreeDtd
add esp, 8
$LN7@xmlTextRea:
; 541 : }
; 542 : if (intSubset != NULL) {
test edi, edi
je SHORT $LN8@xmlTextRea
; 543 : xmlUnlinkNode((xmlNodePtr) cur->intSubset);
push DWORD PTR [esi+44]
call _xmlUnlinkNode
; 544 : cur->intSubset = NULL;
; 545 : xmlFreeDtd(intSubset);
push edi
mov DWORD PTR [esi+44], 0
call _xmlFreeDtd
add esp, 8
$LN8@xmlTextRea:
; 546 : }
; 547 :
; 548 : if (cur->children != NULL) xmlTextReaderFreeNodeList(reader, cur->children);
mov eax, DWORD PTR [esi+12]
pop edi
pop ebx
test eax, eax
je SHORT $LN9@xmlTextRea
push eax
push DWORD PTR _reader$[ebp]
call _xmlTextReaderFreeNodeList
add esp, 8
$LN9@xmlTextRea:
; 549 :
; 550 : if (cur->version != NULL) xmlFree((char *) cur->version);
mov eax, DWORD PTR [esi+56]
test eax, eax
je SHORT $LN10@xmlTextRea
push eax
call DWORD PTR _xmlFree
add esp, 4
$LN10@xmlTextRea:
; 551 : if (cur->name != NULL) xmlFree((char *) cur->name);
mov eax, DWORD PTR [esi+8]
test eax, eax
je SHORT $LN11@xmlTextRea
push eax
call DWORD PTR _xmlFree
add esp, 4
$LN11@xmlTextRea:
; 552 : if (cur->encoding != NULL) xmlFree((char *) cur->encoding);
mov eax, DWORD PTR [esi+60]
test eax, eax
je SHORT $LN12@xmlTextRea
push eax
call DWORD PTR _xmlFree
add esp, 4
$LN12@xmlTextRea:
; 553 : if (cur->oldNs != NULL) xmlFreeNsList(cur->oldNs);
mov eax, DWORD PTR [esi+52]
test eax, eax
je SHORT $LN13@xmlTextRea
push eax
call _xmlFreeNsList
add esp, 4
$LN13@xmlTextRea:
; 554 : if (cur->URL != NULL) xmlFree((char *) cur->URL);
mov eax, DWORD PTR [esi+72]
test eax, eax
je SHORT $LN14@xmlTextRea
push eax
call DWORD PTR _xmlFree
add esp, 4
$LN14@xmlTextRea:
; 555 : if (cur->dict != NULL) xmlDictFree(cur->dict);
mov eax, DWORD PTR [esi+80]
test eax, eax
je SHORT $LN15@xmlTextRea
push eax
call _xmlDictFree
add esp, 4
$LN15@xmlTextRea:
; 556 :
; 557 : xmlFree(cur);
push esi
call DWORD PTR _xmlFree
add esp, 4
$LN1@xmlTextRea:
pop esi
; 558 : }
pop ebp
ret 0
_xmlTextReaderFreeDoc ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderFreeIDTable
_TEXT SEGMENT
_table$ = 8 ; size = 4
_xmlTextReaderFreeIDTable PROC ; COMDAT
; 506 : xmlTextReaderFreeIDTable(xmlIDTablePtr table) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
push OFFSET _xmlTextReaderFreeIDTableEntry
push DWORD PTR _table$[ebp]
call _xmlHashFree
add esp, 8
; 507 : xmlHashFree(table, xmlTextReaderFreeIDTableEntry);
; 508 : }
pop ebp
ret 0
_xmlTextReaderFreeIDTable ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderFreeIDTableEntry
_TEXT SEGMENT
_id$ = 8 ; size = 4
_name$ = 12 ; size = 4
_xmlTextReaderFreeIDTableEntry PROC ; COMDAT
; 495 : xmlTextReaderFreeIDTableEntry(void *id, const xmlChar *name ATTRIBUTE_UNUSED) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
; 234 : if (id == NULL) return;
mov esi, DWORD PTR _id$[ebp]
xor eax, eax
test esi, esi
je SHORT $LN3@xmlTextRea
; 235 :
; 236 : if (id->doc != NULL)
mov ecx, DWORD PTR [esi+20]
test ecx, ecx
je SHORT $LN5@xmlTextRea
; 237 : dict = id->doc->dict;
mov eax, DWORD PTR [ecx+80]
$LN5@xmlTextRea:
; 238 :
; 239 : if (id->value != NULL)
mov ecx, DWORD PTR [esi+4]
test ecx, ecx
je SHORT $LN7@xmlTextRea
; 240 : DICT_FREE(id->value)
test eax, eax
je SHORT $LN8@xmlTextRea
push ecx
push eax
call _xmlDictOwns
add esp, 8
test eax, eax
jne SHORT $LN7@xmlTextRea
$LN8@xmlTextRea:
push DWORD PTR [esi+4]
call DWORD PTR _xmlFree
add esp, 4
$LN7@xmlTextRea:
; 241 : xmlFree(id);
push esi
call DWORD PTR _xmlFree
add esp, 4
$LN3@xmlTextRea:
pop esi
; 496 : xmlFreeID((xmlIDPtr) id);
; 497 : }
pop ebp
ret 0
_xmlTextReaderFreeIDTableEntry ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderFreePropList
_TEXT SEGMENT
_ID$1$ = -8 ; size = 4
_dict$1$ = -4 ; size = 4
_reader$ = 8 ; size = 4
_next$1$ = 12 ; size = 4
_cur$ = 12 ; size = 4
_xmlTextReaderFreePropList PROC ; COMDAT
; 327 : xmlTextReaderFreePropList(xmlTextReaderPtr reader, xmlAttrPtr cur) {
push ebp
mov ebp, esp
sub esp, 8
mov ecx, OFFSET __BC13D883_xmlreader@c
push esi
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _cur$[ebp]
test esi, esi
je $LN3@xmlTextRea
push ebx
push edi
mov edi, DWORD PTR _reader$[ebp]
$LL2@xmlTextRea:
; 328 : xmlAttrPtr next;
; 329 :
; 330 : while (cur != NULL) {
; 331 : next = cur->next;
mov ebx, DWORD PTR [esi+24]
mov DWORD PTR _next$1$[ebp], ebx
; 289 : if ((reader != NULL) && (reader->ctxt != NULL))
test edi, edi
je SHORT $LN6@xmlTextRea
mov eax, DWORD PTR [edi+20]
test eax, eax
je SHORT $LN6@xmlTextRea
; 290 : dict = reader->ctxt->dict;
mov eax, DWORD PTR [eax+296]
mov DWORD PTR _dict$1$[ebp], eax
jmp SHORT $LN7@xmlTextRea
$LN6@xmlTextRea:
; 291 : else
; 292 : dict = NULL;
mov DWORD PTR _dict$1$[ebp], 0
$LN7@xmlTextRea:
; 293 : if (cur == NULL) return;
; 294 :
; 295 : if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue))
cmp DWORD PTR ___xmlRegisterCallbacks, 0
je SHORT $LN9@xmlTextRea
call ___xmlDeregisterNodeDefaultValue
cmp DWORD PTR [eax], 0
je SHORT $LN9@xmlTextRea
; 296 : xmlDeregisterNodeDefaultValue((xmlNodePtr) cur);
call ___xmlDeregisterNodeDefaultValue
push esi
mov eax, DWORD PTR [eax]
call eax
add esp, 4
$LN9@xmlTextRea:
; 297 :
; 298 : /* Check for ID removal -> leading to invalid references ! */
; 299 : if ((cur->parent != NULL) && (cur->parent->doc != NULL) &&
mov ecx, DWORD PTR [esi+20]
test ecx, ecx
je SHORT $LN25@xmlTextRea
mov eax, DWORD PTR [ecx+32]
test eax, eax
je SHORT $LN25@xmlTextRea
cmp DWORD PTR [eax+44], 0
jne SHORT $LN11@xmlTextRea
cmp DWORD PTR [eax+48], 0
je SHORT $LN25@xmlTextRea
$LN11@xmlTextRea:
; 300 : ((cur->parent->doc->intSubset != NULL) ||
; 301 : (cur->parent->doc->extSubset != NULL))) {
; 302 : if (xmlIsID(cur->parent->doc, cur->parent, cur))
push esi
push ecx
push eax
call _xmlIsID
add esp, 12 ; 0000000cH
test eax, eax
je SHORT $LN25@xmlTextRea
; 303 : xmlTextReaderRemoveID(cur->parent->doc, cur);
mov eax, DWORD PTR [esi+20]
mov eax, DWORD PTR [eax+32]
; 259 : if (doc == NULL) return(-1);
test eax, eax
je SHORT $LN25@xmlTextRea
; 260 : if (attr == NULL) return(-1);
; 261 : table = (xmlIDTablePtr) doc->ids;
mov ebx, DWORD PTR [eax+64]
; 262 : if (table == NULL)
test ebx, ebx
je SHORT $LN61@xmlTextRea
; 263 : return(-1);
; 264 :
; 265 : ID = xmlNodeListGetString(doc, attr->children, 1);
push 1
push DWORD PTR [esi+12]
push eax
call _xmlNodeListGetString
add esp, 12 ; 0000000cH
mov DWORD PTR _ID$1$[ebp], eax
; 266 : if (ID == NULL)
test eax, eax
je SHORT $LN61@xmlTextRea
; 267 : return(-1);
; 268 : id = xmlHashLookup(table, ID);
push eax
push ebx
call _xmlHashLookup
; 269 : xmlFree(ID);
push DWORD PTR _ID$1$[ebp]
mov ebx, eax
call DWORD PTR _xmlFree
add esp, 12 ; 0000000cH
; 270 : if (id == NULL || id->attr != attr) {
test ebx, ebx
je SHORT $LN61@xmlTextRea
cmp DWORD PTR [ebx+8], esi
jne SHORT $LN61@xmlTextRea
; 271 : return(-1);
; 272 : }
; 273 : id->name = attr->name;
mov eax, DWORD PTR [esi+8]
mov DWORD PTR [ebx+12], eax
; 274 : id->attr = NULL;
mov DWORD PTR [ebx+8], 0
$LN61@xmlTextRea:
; 305 : if (cur->children != NULL)
mov ebx, DWORD PTR _next$1$[ebp]
$LN25@xmlTextRea:
mov eax, DWORD PTR [esi+12]
test eax, eax
je SHORT $LN13@xmlTextRea
; 306 : xmlTextReaderFreeNodeList(reader, cur->children);
push eax
push edi
call _xmlTextReaderFreeNodeList
add esp, 8
$LN13@xmlTextRea:
; 307 :
; 308 : DICT_FREE(cur->name);
mov eax, DWORD PTR [esi+8]
test eax, eax
je SHORT $LN14@xmlTextRea
mov ecx, DWORD PTR _dict$1$[ebp]
test ecx, ecx
je SHORT $LN15@xmlTextRea
push eax
push ecx
call _xmlDictOwns
add esp, 8
test eax, eax
jne SHORT $LN14@xmlTextRea
$LN15@xmlTextRea:
push DWORD PTR [esi+8]
call DWORD PTR _xmlFree
add esp, 4
$LN14@xmlTextRea:
; 309 : if ((reader != NULL) && (reader->ctxt != NULL) &&
test edi, edi
je SHORT $LN16@xmlTextRea
mov eax, DWORD PTR [edi+20]
test eax, eax
je SHORT $LN16@xmlTextRea
cmp DWORD PTR [eax+376], 100 ; 00000064H
jge SHORT $LN16@xmlTextRea
; 310 : (reader->ctxt->freeAttrsNr < 100)) {
; 311 : cur->next = reader->ctxt->freeAttrs;
mov eax, DWORD PTR [eax+380]
mov DWORD PTR [esi+24], eax
; 312 : reader->ctxt->freeAttrs = cur;
mov eax, DWORD PTR [edi+20]
mov DWORD PTR [eax+380], esi
; 313 : reader->ctxt->freeAttrsNr++;
mov eax, DWORD PTR [edi+20]
inc DWORD PTR [eax+376]
; 314 : } else {
jmp SHORT $LN17@xmlTextRea
$LN16@xmlTextRea:
; 315 : xmlFree(cur);
push esi
call DWORD PTR _xmlFree
add esp, 4
$LN17@xmlTextRea:
; 332 : xmlTextReaderFreeProp(reader, cur);
; 333 : cur = next;
mov esi, ebx
test ebx, ebx
jne $LL2@xmlTextRea
pop edi
pop ebx
$LN3@xmlTextRea:
pop esi
; 334 : }
; 335 : }
mov esp, ebp
pop ebp
ret 0
_xmlTextReaderFreePropList ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderFreeProp
_TEXT SEGMENT
_dict$1$ = 8 ; size = 4
_reader$ = 8 ; size = 4
_ID$1$ = 12 ; size = 4
_cur$ = 12 ; size = 4
_xmlTextReaderFreeProp PROC ; COMDAT
; 286 : xmlTextReaderFreeProp(xmlTextReaderPtr reader, xmlAttrPtr cur) {
push ebp
mov ebp, esp
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edi, DWORD PTR _reader$[ebp]
test edi, edi
je SHORT $LN2@xmlTextRea
; 287 : xmlDictPtr dict;
; 288 :
; 289 : if ((reader != NULL) && (reader->ctxt != NULL))
mov eax, DWORD PTR [edi+20]
test eax, eax
je SHORT $LN2@xmlTextRea
; 290 : dict = reader->ctxt->dict;
mov eax, DWORD PTR [eax+296]
mov DWORD PTR _dict$1$[ebp], eax
jmp SHORT $LN3@xmlTextRea
$LN2@xmlTextRea:
; 291 : else
; 292 : dict = NULL;
mov DWORD PTR _dict$1$[ebp], 0
$LN3@xmlTextRea:
; 293 : if (cur == NULL) return;
mov esi, DWORD PTR _cur$[ebp]
test esi, esi
je $LN13@xmlTextRea
; 294 :
; 295 : if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue))
cmp DWORD PTR ___xmlRegisterCallbacks, 0
je SHORT $LN5@xmlTextRea
call ___xmlDeregisterNodeDefaultValue
cmp DWORD PTR [eax], 0
je SHORT $LN5@xmlTextRea
; 296 : xmlDeregisterNodeDefaultValue((xmlNodePtr) cur);
call ___xmlDeregisterNodeDefaultValue
push esi
mov eax, DWORD PTR [eax]
call eax
add esp, 4
$LN5@xmlTextRea:
; 297 :
; 298 : /* Check for ID removal -> leading to invalid references ! */
; 299 : if ((cur->parent != NULL) && (cur->parent->doc != NULL) &&
mov ecx, DWORD PTR [esi+20]
test ecx, ecx
je SHORT $LN21@xmlTextRea
mov eax, DWORD PTR [ecx+32]
test eax, eax
je SHORT $LN21@xmlTextRea
cmp DWORD PTR [eax+44], 0
jne SHORT $LN7@xmlTextRea
cmp DWORD PTR [eax+48], 0
je SHORT $LN21@xmlTextRea
$LN7@xmlTextRea:
; 300 : ((cur->parent->doc->intSubset != NULL) ||
; 301 : (cur->parent->doc->extSubset != NULL))) {
; 302 : if (xmlIsID(cur->parent->doc, cur->parent, cur))
push esi
push ecx
push eax
call _xmlIsID
add esp, 12 ; 0000000cH
test eax, eax
je SHORT $LN21@xmlTextRea
; 303 : xmlTextReaderRemoveID(cur->parent->doc, cur);
mov eax, DWORD PTR [esi+20]
mov eax, DWORD PTR [eax+32]
; 259 : if (doc == NULL) return(-1);
test eax, eax
je SHORT $LN21@xmlTextRea
; 260 : if (attr == NULL) return(-1);
; 261 : table = (xmlIDTablePtr) doc->ids;
push ebx
mov ebx, DWORD PTR [eax+64]
; 262 : if (table == NULL)
test ebx, ebx
je SHORT $LN54@xmlTextRea
; 263 : return(-1);
; 264 :
; 265 : ID = xmlNodeListGetString(doc, attr->children, 1);
push 1
push DWORD PTR [esi+12]
push eax
call _xmlNodeListGetString
add esp, 12 ; 0000000cH
mov DWORD PTR _ID$1$[ebp], eax
; 266 : if (ID == NULL)
test eax, eax
je SHORT $LN54@xmlTextRea
; 267 : return(-1);
; 268 : id = xmlHashLookup(table, ID);
push eax
push ebx
call _xmlHashLookup
; 269 : xmlFree(ID);
push DWORD PTR _ID$1$[ebp]
mov ebx, eax
call DWORD PTR _xmlFree
add esp, 12 ; 0000000cH
; 270 : if (id == NULL || id->attr != attr) {
test ebx, ebx
je SHORT $LN54@xmlTextRea
cmp DWORD PTR [ebx+8], esi
jne SHORT $LN54@xmlTextRea
; 271 : return(-1);
; 272 : }
; 273 : id->name = attr->name;
mov eax, DWORD PTR [esi+8]
mov DWORD PTR [ebx+12], eax
; 274 : id->attr = NULL;
mov DWORD PTR [ebx+8], 0
$LN54@xmlTextRea:
pop ebx
$LN21@xmlTextRea:
; 304 : }
; 305 : if (cur->children != NULL)
mov eax, DWORD PTR [esi+12]
test eax, eax
je SHORT $LN9@xmlTextRea
; 306 : xmlTextReaderFreeNodeList(reader, cur->children);
push eax
push edi
call _xmlTextReaderFreeNodeList
add esp, 8
$LN9@xmlTextRea:
; 307 :
; 308 : DICT_FREE(cur->name);
mov ecx, DWORD PTR [esi+8]
test ecx, ecx
je SHORT $LN10@xmlTextRea
mov eax, DWORD PTR _dict$1$[ebp]
test eax, eax
je SHORT $LN11@xmlTextRea
push ecx
push eax
call _xmlDictOwns
add esp, 8
test eax, eax
jne SHORT $LN10@xmlTextRea
$LN11@xmlTextRea:
push DWORD PTR [esi+8]
call DWORD PTR _xmlFree
add esp, 4
$LN10@xmlTextRea:
; 309 : if ((reader != NULL) && (reader->ctxt != NULL) &&
test edi, edi
je SHORT $LN12@xmlTextRea
mov eax, DWORD PTR [edi+20]
test eax, eax
je SHORT $LN12@xmlTextRea
cmp DWORD PTR [eax+376], 100 ; 00000064H
jge SHORT $LN12@xmlTextRea
; 310 : (reader->ctxt->freeAttrsNr < 100)) {
; 311 : cur->next = reader->ctxt->freeAttrs;
mov eax, DWORD PTR [eax+380]
mov DWORD PTR [esi+24], eax
; 312 : reader->ctxt->freeAttrs = cur;
mov eax, DWORD PTR [edi+20]
mov DWORD PTR [eax+380], esi
; 313 : reader->ctxt->freeAttrsNr++;
mov eax, DWORD PTR [edi+20]
pop edi
; 316 : }
; 317 : }
pop esi
inc DWORD PTR [eax+376]
pop ebp
ret 0
$LN12@xmlTextRea:
; 314 : } else {
; 315 : xmlFree(cur);
push esi
call DWORD PTR _xmlFree
add esp, 4
$LN13@xmlTextRea:
; 316 : }
; 317 : }
pop edi
pop esi
pop ebp
ret 0
_xmlTextReaderFreeProp ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderRemoveID
_TEXT SEGMENT
_doc$ = 8 ; size = 4
_attr$ = 12 ; size = 4
_xmlTextReaderRemoveID PROC ; COMDAT
; 254 : xmlTextReaderRemoveID(xmlDocPtr doc, xmlAttrPtr attr) {
push ebp
mov ebp, esp
push ebx
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _doc$[ebp]
test eax, eax
je SHORT $LN7@xmlTextRea
; 255 : xmlIDTablePtr table;
; 256 : xmlIDPtr id;
; 257 : xmlChar *ID;
; 258 :
; 259 : if (doc == NULL) return(-1);
; 260 : if (attr == NULL) return(-1);
mov esi, DWORD PTR _attr$[ebp]
test esi, esi
je SHORT $LN7@xmlTextRea
; 261 : table = (xmlIDTablePtr) doc->ids;
mov edi, DWORD PTR [eax+64]
; 262 : if (table == NULL)
test edi, edi
je SHORT $LN7@xmlTextRea
; 263 : return(-1);
; 264 :
; 265 : ID = xmlNodeListGetString(doc, attr->children, 1);
push 1
push DWORD PTR [esi+12]
push eax
call _xmlNodeListGetString
mov ebx, eax
add esp, 12 ; 0000000cH
; 266 : if (ID == NULL)
test ebx, ebx
je SHORT $LN7@xmlTextRea
; 267 : return(-1);
; 268 : id = xmlHashLookup(table, ID);
push ebx
push edi
call _xmlHashLookup
; 269 : xmlFree(ID);
push ebx
mov edi, eax
call DWORD PTR _xmlFree
add esp, 12 ; 0000000cH
; 270 : if (id == NULL || id->attr != attr) {
test edi, edi
je SHORT $LN7@xmlTextRea
cmp DWORD PTR [edi+8], esi
jne SHORT $LN7@xmlTextRea
; 271 : return(-1);
; 272 : }
; 273 : id->name = attr->name;
mov eax, DWORD PTR [esi+8]
mov DWORD PTR [edi+12], eax
; 274 : id->attr = NULL;
; 275 : return(0);
xor eax, eax
mov DWORD PTR [edi+8], 0
pop edi
; 276 : }
pop esi
pop ebx
pop ebp
ret 0
$LN7@xmlTextRea:
pop edi
pop esi
or eax, -1
pop ebx
pop ebp
ret 0
_xmlTextReaderRemoveID ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlFreeID
_TEXT SEGMENT
_id$ = 8 ; size = 4
_xmlFreeID PROC ; COMDAT
; 231 : xmlFreeID(xmlIDPtr id) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _id$[ebp]
xor eax, eax
test esi, esi
je SHORT $LN1@xmlFreeID
; 232 : xmlDictPtr dict = NULL;
; 233 :
; 234 : if (id == NULL) return;
; 235 :
; 236 : if (id->doc != NULL)
mov ecx, DWORD PTR [esi+20]
test ecx, ecx
je SHORT $LN3@xmlFreeID
; 237 : dict = id->doc->dict;
mov eax, DWORD PTR [ecx+80]
$LN3@xmlFreeID:
; 238 :
; 239 : if (id->value != NULL)
mov ecx, DWORD PTR [esi+4]
test ecx, ecx
je SHORT $LN5@xmlFreeID
; 240 : DICT_FREE(id->value)
test eax, eax
je SHORT $LN6@xmlFreeID
push ecx
push eax
call _xmlDictOwns
add esp, 8
test eax, eax
jne SHORT $LN5@xmlFreeID
$LN6@xmlFreeID:
push DWORD PTR [esi+4]
call DWORD PTR _xmlFree
add esp, 4
$LN5@xmlFreeID:
; 241 : xmlFree(id);
push esi
call DWORD PTR _xmlFree
add esp, 4
$LN1@xmlFreeID:
pop esi
; 242 : }
pop ebp
ret 0
_xmlFreeID ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderFreeNodeList
_TEXT SEGMENT
_next$1$ = 8 ; size = 4
_reader$ = 8 ; size = 4
_cur$ = 12 ; size = 4
_xmlTextReaderFreeNodeList PROC ; COMDAT
; 346 : xmlTextReaderFreeNodeList(xmlTextReaderPtr reader, xmlNodePtr cur) {
push ebp
mov ebp, esp
push ebx
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edi, DWORD PTR _reader$[ebp]
test edi, edi
je SHORT $LN4@xmlTextRea
; 347 : xmlNodePtr next;
; 348 : xmlDictPtr dict;
; 349 :
; 350 : if ((reader != NULL) && (reader->ctxt != NULL))
mov eax, DWORD PTR [edi+20]
test eax, eax
je SHORT $LN4@xmlTextRea
; 351 : dict = reader->ctxt->dict;
mov ebx, DWORD PTR [eax+296]
jmp SHORT $LN5@xmlTextRea
$LN4@xmlTextRea:
; 352 : else
; 353 : dict = NULL;
xor ebx, ebx
$LN5@xmlTextRea:
; 354 : if (cur == NULL) return;
mov esi, DWORD PTR _cur$[ebp]
test esi, esi
je $LN3@xmlTextRea
; 355 : if (cur->type == XML_NAMESPACE_DECL) {
mov eax, DWORD PTR [esi+4]
cmp eax, 18 ; 00000012H
jne SHORT $LN7@xmlTextRea
; 356 : xmlFreeNsList((xmlNsPtr) cur);
push esi
call _xmlFreeNsList
; 415 : }
; 416 : }
add esp, 4
pop edi
pop esi
pop ebx
pop ebp
ret 0
$LN7@xmlTextRea:
; 357 : return;
; 358 : }
; 359 : if ((cur->type == XML_DOCUMENT_NODE) ||
cmp eax, 9
je $LN9@xmlTextRea
cmp eax, 13 ; 0000000dH
je $LN9@xmlTextRea
npad 5
$LL2@xmlTextRea:
; 362 : return;
; 363 : }
; 364 : while (cur != NULL) {
; 365 : next = cur->next;
; 366 : /* unroll to speed up freeing the document */
; 367 : if (cur->type != XML_DTD_NODE) {
mov ecx, DWORD PTR [esi+4]
mov eax, DWORD PTR [esi+24]
mov DWORD PTR _next$1$[ebp], eax
cmp ecx, 14 ; 0000000eH
je $LN25@xmlTextRea
; 368 :
; 369 : if ((cur->children != NULL) &&
mov eax, DWORD PTR [esi+12]
test eax, eax
je SHORT $LN11@xmlTextRea
cmp ecx, 5
je SHORT $LN11@xmlTextRea
; 370 : (cur->type != XML_ENTITY_REF_NODE)) {
; 371 : if (cur->children->parent == cur)
cmp DWORD PTR [eax+20], esi
jne SHORT $LN12@xmlTextRea
; 372 : xmlTextReaderFreeNodeList(reader, cur->children);
push eax
push edi
call _xmlTextReaderFreeNodeList
add esp, 8
$LN12@xmlTextRea:
; 373 : cur->children = NULL;
mov DWORD PTR [esi+12], 0
$LN11@xmlTextRea:
; 374 : }
; 375 :
; 376 : if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue))
cmp DWORD PTR ___xmlRegisterCallbacks, 0
je SHORT $LN13@xmlTextRea
call ___xmlDeregisterNodeDefaultValue
cmp DWORD PTR [eax], 0
je SHORT $LN13@xmlTextRea
; 377 : xmlDeregisterNodeDefaultValue(cur);
call ___xmlDeregisterNodeDefaultValue
push esi
mov eax, DWORD PTR [eax]
call eax
add esp, 4
$LN13@xmlTextRea:
; 378 :
; 379 : if (((cur->type == XML_ELEMENT_NODE) ||
; 380 : (cur->type == XML_XINCLUDE_START) ||
; 381 : (cur->type == XML_XINCLUDE_END)) &&
mov ecx, DWORD PTR [esi+4]
cmp ecx, 1
je SHORT $LN15@xmlTextRea
cmp ecx, 19 ; 00000013H
je SHORT $LN15@xmlTextRea
cmp ecx, 20 ; 00000014H
jne SHORT $LN14@xmlTextRea
$LN15@xmlTextRea:
mov eax, DWORD PTR [esi+44]
test eax, eax
je SHORT $LN14@xmlTextRea
; 382 : (cur->properties != NULL))
; 383 : xmlTextReaderFreePropList(reader, cur->properties);
push eax
push edi
call _xmlTextReaderFreePropList
mov ecx, DWORD PTR [esi+4]
add esp, 8
$LN14@xmlTextRea:
; 384 : if ((cur->content != (xmlChar *) &(cur->properties)) &&
; 385 : (cur->type != XML_ELEMENT_NODE) &&
; 386 : (cur->type != XML_XINCLUDE_START) &&
; 387 : (cur->type != XML_XINCLUDE_END) &&
mov edx, DWORD PTR [esi+40]
lea eax, DWORD PTR [esi+44]
cmp edx, eax
je SHORT $LN17@xmlTextRea
cmp ecx, 1
je SHORT $LN17@xmlTextRea
cmp ecx, 19 ; 00000013H
je SHORT $LN17@xmlTextRea
cmp ecx, 20 ; 00000014H
je SHORT $LN17@xmlTextRea
cmp ecx, 5
je SHORT $LN17@xmlTextRea
; 388 : (cur->type != XML_ENTITY_REF_NODE)) {
; 389 : DICT_FREE(cur->content);
test edx, edx
je SHORT $LN17@xmlTextRea
test ebx, ebx
je SHORT $LN18@xmlTextRea
push edx
push ebx
call _xmlDictOwns
add esp, 8
test eax, eax
jne SHORT $LN17@xmlTextRea
$LN18@xmlTextRea:
push DWORD PTR [esi+40]
call DWORD PTR _xmlFree
add esp, 4
$LN17@xmlTextRea:
; 390 : }
; 391 : if (((cur->type == XML_ELEMENT_NODE) ||
; 392 : (cur->type == XML_XINCLUDE_START) ||
; 393 : (cur->type == XML_XINCLUDE_END)) &&
mov eax, DWORD PTR [esi+4]
cmp eax, 1
je SHORT $LN20@xmlTextRea
cmp eax, 19 ; 00000013H
je SHORT $LN20@xmlTextRea
cmp eax, 20 ; 00000014H
jne SHORT $LN19@xmlTextRea
$LN20@xmlTextRea:
mov ecx, DWORD PTR [esi+48]
test ecx, ecx
je SHORT $LN19@xmlTextRea
; 394 : (cur->nsDef != NULL))
; 395 : xmlFreeNsList(cur->nsDef);
push ecx
call _xmlFreeNsList
mov eax, DWORD PTR [esi+4]
add esp, 4
$LN19@xmlTextRea:
; 396 :
; 397 : /*
; 398 : * we don't free element names here they are interned now
; 399 : */
; 400 : if ((cur->type != XML_TEXT_NODE) &&
cmp eax, 3
je SHORT $LN22@xmlTextRea
cmp eax, 8
je SHORT $LN22@xmlTextRea
; 401 : (cur->type != XML_COMMENT_NODE))
; 402 : DICT_FREE(cur->name);
mov eax, DWORD PTR [esi+8]
test eax, eax
je SHORT $LN22@xmlTextRea
test ebx, ebx
je SHORT $LN23@xmlTextRea
push eax
push ebx
call _xmlDictOwns
add esp, 8
test eax, eax
jne SHORT $LN22@xmlTextRea
$LN23@xmlTextRea:
push DWORD PTR [esi+8]
call DWORD PTR _xmlFree
add esp, 4
$LN22@xmlTextRea:
; 403 : if (((cur->type == XML_ELEMENT_NODE) ||
; 404 : (cur->type == XML_TEXT_NODE)) &&
; 405 : (reader != NULL) && (reader->ctxt != NULL) &&
mov eax, DWORD PTR [esi+4]
cmp eax, 1
je SHORT $LN26@xmlTextRea
cmp eax, 3
jne SHORT $LN24@xmlTextRea
$LN26@xmlTextRea:
test edi, edi
je SHORT $LN24@xmlTextRea
mov eax, DWORD PTR [edi+20]
test eax, eax
je SHORT $LN24@xmlTextRea
cmp DWORD PTR [eax+368], 100 ; 00000064H
jge SHORT $LN24@xmlTextRea
; 406 : (reader->ctxt->freeElemsNr < 100)) {
; 407 : cur->next = reader->ctxt->freeElems;
mov eax, DWORD PTR [eax+372]
mov DWORD PTR [esi+24], eax
; 408 : reader->ctxt->freeElems = cur;
mov eax, DWORD PTR [edi+20]
mov DWORD PTR [eax+372], esi
; 409 : reader->ctxt->freeElemsNr++;
mov eax, DWORD PTR [edi+20]
inc DWORD PTR [eax+368]
; 410 : } else {
jmp SHORT $LN33@xmlTextRea
$LN24@xmlTextRea:
; 411 : xmlFree(cur);
push esi
call DWORD PTR _xmlFree
add esp, 4
$LN33@xmlTextRea:
; 412 : }
; 413 : }
; 414 : cur = next;
mov eax, DWORD PTR _next$1$[ebp]
$LN25@xmlTextRea:
mov esi, eax
test eax, eax
jne $LL2@xmlTextRea
; 415 : }
; 416 : }
pop edi
pop esi
pop ebx
pop ebp
ret 0
$LN9@xmlTextRea:
; 360 : (cur->type == XML_HTML_DOCUMENT_NODE)) {
; 361 : xmlFreeDoc((xmlDocPtr) cur);
push esi
call _xmlFreeDoc
; 415 : }
; 416 : }
add esp, 4
$LN3@xmlTextRea:
pop edi
pop esi
pop ebx
pop ebp
ret 0
_xmlTextReaderFreeNodeList ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderFreeNode
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_cur$ = 12 ; size = 4
_xmlTextReaderFreeNode PROC ; COMDAT
; 427 : xmlTextReaderFreeNode(xmlTextReaderPtr reader, xmlNodePtr cur) {
push ebp
mov ebp, esp
push ebx
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edi, DWORD PTR _reader$[ebp]
test edi, edi
je SHORT $LN2@xmlTextRea
; 428 : xmlDictPtr dict;
; 429 :
; 430 : if ((reader != NULL) && (reader->ctxt != NULL))
mov eax, DWORD PTR [edi+20]
test eax, eax
je SHORT $LN2@xmlTextRea
; 431 : dict = reader->ctxt->dict;
mov ebx, DWORD PTR [eax+296]
jmp SHORT $LN3@xmlTextRea
$LN2@xmlTextRea:
; 432 : else
; 433 : dict = NULL;
xor ebx, ebx
$LN3@xmlTextRea:
; 434 : if (cur->type == XML_DTD_NODE) {
mov esi, DWORD PTR _cur$[ebp]
mov eax, DWORD PTR [esi+4]
cmp eax, 14 ; 0000000eH
jne SHORT $LN4@xmlTextRea
; 435 : xmlFreeDtd((xmlDtdPtr) cur);
push esi
call _xmlFreeDtd
; 491 : }
; 492 : }
add esp, 4
pop edi
pop esi
pop ebx
pop ebp
ret 0
$LN4@xmlTextRea:
; 436 : return;
; 437 : }
; 438 : if (cur->type == XML_NAMESPACE_DECL) {
cmp eax, 18 ; 00000012H
jne SHORT $LN5@xmlTextRea
; 439 : xmlFreeNs((xmlNsPtr) cur);
push esi
call _xmlFreeNs
; 491 : }
; 492 : }
add esp, 4
pop edi
pop esi
pop ebx
pop ebp
ret 0
$LN5@xmlTextRea:
; 440 : return;
; 441 : }
; 442 : if (cur->type == XML_ATTRIBUTE_NODE) {
cmp eax, 2
jne SHORT $LN6@xmlTextRea
; 443 : xmlTextReaderFreeProp(reader, (xmlAttrPtr) cur);
push esi
push edi
call _xmlTextReaderFreeProp
add esp, 8
pop edi
; 491 : }
; 492 : }
pop esi
pop ebx
pop ebp
ret 0
$LN6@xmlTextRea:
; 444 : return;
; 445 : }
; 446 :
; 447 : if ((cur->children != NULL) &&
mov ecx, DWORD PTR [esi+12]
test ecx, ecx
je SHORT $LN7@xmlTextRea
cmp eax, 5
je SHORT $LN7@xmlTextRea
; 448 : (cur->type != XML_ENTITY_REF_NODE)) {
; 449 : if (cur->children->parent == cur)
cmp DWORD PTR [ecx+20], esi
jne SHORT $LN8@xmlTextRea
; 450 : xmlTextReaderFreeNodeList(reader, cur->children);
push ecx
push edi
call _xmlTextReaderFreeNodeList
add esp, 8
$LN8@xmlTextRea:
; 451 : cur->children = NULL;
mov DWORD PTR [esi+12], 0
$LN7@xmlTextRea:
; 452 : }
; 453 :
; 454 : if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue))
cmp DWORD PTR ___xmlRegisterCallbacks, 0
je SHORT $LN9@xmlTextRea
call ___xmlDeregisterNodeDefaultValue
cmp DWORD PTR [eax], 0
je SHORT $LN9@xmlTextRea
; 455 : xmlDeregisterNodeDefaultValue(cur);
call ___xmlDeregisterNodeDefaultValue
push esi
mov eax, DWORD PTR [eax]
call eax
add esp, 4
$LN9@xmlTextRea:
; 456 :
; 457 : if (((cur->type == XML_ELEMENT_NODE) ||
; 458 : (cur->type == XML_XINCLUDE_START) ||
; 459 : (cur->type == XML_XINCLUDE_END)) &&
mov eax, DWORD PTR [esi+4]
cmp eax, 1
je SHORT $LN11@xmlTextRea
cmp eax, 19 ; 00000013H
je SHORT $LN11@xmlTextRea
cmp eax, 20 ; 00000014H
jne SHORT $LN10@xmlTextRea
$LN11@xmlTextRea:
mov eax, DWORD PTR [esi+44]
test eax, eax
je SHORT $LN10@xmlTextRea
; 460 : (cur->properties != NULL))
; 461 : xmlTextReaderFreePropList(reader, cur->properties);
push eax
push edi
call _xmlTextReaderFreePropList
add esp, 8
$LN10@xmlTextRea:
; 462 : if ((cur->content != (xmlChar *) &(cur->properties)) &&
; 463 : (cur->type != XML_ELEMENT_NODE) &&
; 464 : (cur->type != XML_XINCLUDE_START) &&
; 465 : (cur->type != XML_XINCLUDE_END) &&
mov ecx, DWORD PTR [esi+40]
lea eax, DWORD PTR [esi+44]
cmp ecx, eax
je SHORT $LN13@xmlTextRea
mov eax, DWORD PTR [esi+4]
cmp eax, 1
je SHORT $LN13@xmlTextRea
cmp eax, 19 ; 00000013H
je SHORT $LN13@xmlTextRea
cmp eax, 20 ; 00000014H
je SHORT $LN13@xmlTextRea
cmp eax, 5
je SHORT $LN13@xmlTextRea
; 466 : (cur->type != XML_ENTITY_REF_NODE)) {
; 467 : DICT_FREE(cur->content);
test ecx, ecx
je SHORT $LN13@xmlTextRea
test ebx, ebx
je SHORT $LN14@xmlTextRea
push ecx
push ebx
call _xmlDictOwns
add esp, 8
test eax, eax
jne SHORT $LN13@xmlTextRea
$LN14@xmlTextRea:
push DWORD PTR [esi+40]
call DWORD PTR _xmlFree
add esp, 4
$LN13@xmlTextRea:
; 468 : }
; 469 : if (((cur->type == XML_ELEMENT_NODE) ||
; 470 : (cur->type == XML_XINCLUDE_START) ||
; 471 : (cur->type == XML_XINCLUDE_END)) &&
mov eax, DWORD PTR [esi+4]
cmp eax, 1
je SHORT $LN16@xmlTextRea
cmp eax, 19 ; 00000013H
je SHORT $LN16@xmlTextRea
cmp eax, 20 ; 00000014H
jne SHORT $LN15@xmlTextRea
$LN16@xmlTextRea:
mov ecx, DWORD PTR [esi+48]
test ecx, ecx
je SHORT $LN15@xmlTextRea
; 472 : (cur->nsDef != NULL))
; 473 : xmlFreeNsList(cur->nsDef);
push ecx
call _xmlFreeNsList
mov eax, DWORD PTR [esi+4]
add esp, 4
$LN15@xmlTextRea:
; 474 :
; 475 : /*
; 476 : * we don't free names here they are interned now
; 477 : */
; 478 : if ((cur->type != XML_TEXT_NODE) &&
cmp eax, 3
je SHORT $LN18@xmlTextRea
cmp eax, 8
je SHORT $LN18@xmlTextRea
; 479 : (cur->type != XML_COMMENT_NODE))
; 480 : DICT_FREE(cur->name);
mov eax, DWORD PTR [esi+8]
test eax, eax
je SHORT $LN18@xmlTextRea
test ebx, ebx
je SHORT $LN19@xmlTextRea
push eax
push ebx
call _xmlDictOwns
add esp, 8
test eax, eax
jne SHORT $LN18@xmlTextRea
$LN19@xmlTextRea:
push DWORD PTR [esi+8]
call DWORD PTR _xmlFree
add esp, 4
$LN18@xmlTextRea:
; 481 :
; 482 : if (((cur->type == XML_ELEMENT_NODE) ||
; 483 : (cur->type == XML_TEXT_NODE)) &&
; 484 : (reader != NULL) && (reader->ctxt != NULL) &&
mov eax, DWORD PTR [esi+4]
cmp eax, 1
je SHORT $LN22@xmlTextRea
cmp eax, 3
jne SHORT $LN20@xmlTextRea
$LN22@xmlTextRea:
test edi, edi
je SHORT $LN20@xmlTextRea
mov eax, DWORD PTR [edi+20]
test eax, eax
je SHORT $LN20@xmlTextRea
cmp DWORD PTR [eax+368], 100 ; 00000064H
jge SHORT $LN20@xmlTextRea
; 485 : (reader->ctxt->freeElemsNr < 100)) {
; 486 : cur->next = reader->ctxt->freeElems;
mov eax, DWORD PTR [eax+372]
mov DWORD PTR [esi+24], eax
; 487 : reader->ctxt->freeElems = cur;
mov eax, DWORD PTR [edi+20]
mov DWORD PTR [eax+372], esi
; 488 : reader->ctxt->freeElemsNr++;
mov eax, DWORD PTR [edi+20]
pop edi
; 491 : }
; 492 : }
pop esi
pop ebx
inc DWORD PTR [eax+368]
pop ebp
ret 0
$LN20@xmlTextRea:
; 489 : } else {
; 490 : xmlFree(cur);
push esi
call DWORD PTR _xmlFree
; 491 : }
; 492 : }
add esp, 4
pop edi
pop esi
pop ebx
pop ebp
ret 0
_xmlTextReaderFreeNode ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderNextTree
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderNextTree PROC ; COMDAT
; 1892 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
jne SHORT $LN2@xmlTextRea
; 1893 : if (reader == NULL)
; 1894 : return(-1);
or eax, -1
pop esi
; 1947 :
; 1948 : return(1);
; 1949 : }
pop ebp
ret 0
$LN2@xmlTextRea:
; 1895 :
; 1896 : if (reader->state == XML_TEXTREADER_END)
mov ecx, DWORD PTR [esi+16]
cmp ecx, 2
je SHORT $LN15@xmlTextRea
; 1897 : return(0);
; 1898 :
; 1899 : if (reader->node == NULL) {
mov eax, DWORD PTR [esi+64]
test eax, eax
jne SHORT $LN4@xmlTextRea
; 1900 : if (reader->doc->children == NULL) {
mov eax, DWORD PTR [esi+4]
mov eax, DWORD PTR [eax+12]
test eax, eax
je SHORT $LN12@xmlTextRea
$LN14@xmlTextRea:
; 1947 :
; 1948 : return(1);
; 1949 : }
mov DWORD PTR [esi+64], eax
mov eax, 1
mov DWORD PTR [esi+16], 0
pop esi
pop ebp
ret 0
$LN4@xmlTextRea:
; 1901 : reader->state = XML_TEXTREADER_END;
; 1902 : return(0);
; 1903 : }
; 1904 :
; 1905 : reader->node = reader->doc->children;
; 1906 : reader->state = XML_TEXTREADER_START;
; 1907 : return(1);
; 1908 : }
; 1909 :
; 1910 : if (reader->state != XML_TEXTREADER_BACKTRACK) {
cmp ecx, 4
je SHORT $LN6@xmlTextRea
; 1911 : /* Here removed traversal to child, because we want to skip the subtree,
; 1912 : replace with traversal to sibling to skip subtree */
; 1913 : if (reader->node->next != 0) {
mov eax, DWORD PTR [eax+24]
test eax, eax
jne SHORT $LN14@xmlTextRea
; 1914 : /* Move to sibling if present,skipping sub-tree */
; 1915 : reader->node = reader->node->next;
; 1916 : reader->state = XML_TEXTREADER_START;
; 1917 : return(1);
; 1918 : }
; 1919 :
; 1920 : /* if reader->node->next is NULL mean no subtree for current node,
; 1921 : so need to move to sibling of parent node if present */
; 1922 : reader->state = XML_TEXTREADER_BACKTRACK;
; 1923 : /* This will move to parent if present */
; 1924 : xmlTextReaderRead(reader);
push esi
mov DWORD PTR [esi+16], 4
call _xmlTextReaderRead
mov eax, DWORD PTR [esi+64]
add esp, 4
$LN6@xmlTextRea:
; 1925 : }
; 1926 :
; 1927 : if (reader->node->next != 0) {
mov ecx, DWORD PTR [eax+24]
test ecx, ecx
je SHORT $LN8@xmlTextRea
; 1928 : reader->node = reader->node->next;
mov DWORD PTR [esi+64], ecx
; 1947 :
; 1948 : return(1);
; 1949 : }
mov eax, 1
mov DWORD PTR [esi+16], 0
pop esi
pop ebp
ret 0
$LN8@xmlTextRea:
; 1929 : reader->state = XML_TEXTREADER_START;
; 1930 : return(1);
; 1931 : }
; 1932 :
; 1933 : if (reader->node->parent != 0) {
mov eax, DWORD PTR [eax+20]
test eax, eax
je SHORT $LN9@xmlTextRea
; 1934 : if (reader->node->parent->type == XML_DOCUMENT_NODE) {
cmp DWORD PTR [eax+4], 9
jne SHORT $LN10@xmlTextRea
$LN12@xmlTextRea:
; 1935 : reader->state = XML_TEXTREADER_END;
mov DWORD PTR [esi+16], 2
$LN15@xmlTextRea:
; 1947 :
; 1948 : return(1);
; 1949 : }
xor eax, eax
pop esi
pop ebp
ret 0
$LN10@xmlTextRea:
; 1936 : return(0);
; 1937 : }
; 1938 :
; 1939 : reader->node = reader->node->parent;
; 1940 : reader->depth--;
dec DWORD PTR [esi+72]
; 1941 : reader->state = XML_TEXTREADER_BACKTRACK;
; 1942 : /* Repeat process to move to sibling of parent node if present */
; 1943 : xmlTextReaderNextTree(reader);
push esi
mov DWORD PTR [esi+64], eax
mov DWORD PTR [esi+16], 4
call _xmlTextReaderNextTree
add esp, 4
$LN9@xmlTextRea:
; 1944 : }
; 1945 :
; 1946 : reader->state = XML_TEXTREADER_END;
mov DWORD PTR [esi+16], 2
; 1947 :
; 1948 : return(1);
; 1949 : }
mov eax, 1
pop esi
pop ebp
ret 0
_xmlTextReaderNextTree ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderReadTree
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderReadTree PROC ; COMDAT
; 1962 : xmlTextReaderReadTree(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _reader$[ebp]
mov edx, DWORD PTR [ecx+16]
cmp edx, 2
jne SHORT $LN19@xmlTextRea
; 1963 : if (reader->state == XML_TEXTREADER_END)
; 1964 : return(0);
xor eax, eax
; 2022 : }
pop ebp
ret 0
$LN19@xmlTextRea:
; 1968 : if (reader->doc->children == NULL) {
mov eax, DWORD PTR [ecx+64]
push esi
$next_node$27:
; 1965 :
; 1966 : next_node:
; 1967 : if (reader->node == NULL) {
test eax, eax
jne SHORT $LN3@xmlTextRea
; 1968 : if (reader->doc->children == NULL) {
mov eax, DWORD PTR [ecx+4]
mov eax, DWORD PTR [eax+12]
test eax, eax
je $LN18@xmlTextRea
; 1969 : reader->state = XML_TEXTREADER_END;
; 1970 : return(0);
; 1971 : }
; 1972 :
; 1973 : reader->node = reader->doc->children;
mov DWORD PTR [ecx+64], eax
; 1974 : reader->state = XML_TEXTREADER_START;
xor edx, edx
mov DWORD PTR [ecx+16], 0
; 1975 : goto found_node;
jmp $found_node$28
$LN3@xmlTextRea:
; 1976 : }
; 1977 :
; 1978 : if ((reader->state != XML_TEXTREADER_BACKTRACK) &&
; 1979 : (reader->node->type != XML_DTD_NODE) &&
; 1980 : (reader->node->type != XML_XINCLUDE_START) &&
cmp edx, 4
je SHORT $LN7@xmlTextRea
mov edx, DWORD PTR [eax+4]
cmp edx, 14 ; 0000000eH
je SHORT $LN7@xmlTextRea
cmp edx, 19 ; 00000013H
je SHORT $LN7@xmlTextRea
cmp edx, 5
je SHORT $LN7@xmlTextRea
; 1981 : (reader->node->type != XML_ENTITY_REF_NODE)) {
; 1982 : if (reader->node->children != NULL) {
mov esi, DWORD PTR [eax+12]
test esi, esi
je SHORT $LN6@xmlTextRea
; 1983 : reader->node = reader->node->children;
; 1984 : reader->depth++;
inc DWORD PTR [ecx+72]
; 1985 : reader->state = XML_TEXTREADER_START;
mov eax, esi
mov DWORD PTR [ecx+64], esi
xor edx, edx
mov DWORD PTR [ecx+16], 0
; 1986 : goto found_node;
jmp SHORT $found_node$28
$LN6@xmlTextRea:
; 1987 : }
; 1988 :
; 1989 : if (reader->node->type == XML_ATTRIBUTE_NODE) {
cmp edx, 2
jne SHORT $LN7@xmlTextRea
; 1990 : reader->state = XML_TEXTREADER_BACKTRACK;
mov DWORD PTR [ecx+16], 4
mov edx, 4
; 1991 : goto found_node;
jmp SHORT $found_node$28
$LN7@xmlTextRea:
; 1992 : }
; 1993 : }
; 1994 :
; 1995 : if (reader->node->next != NULL) {
mov esi, DWORD PTR [eax+24]
test esi, esi
je SHORT $LN8@xmlTextRea
; 1996 : reader->node = reader->node->next;
mov DWORD PTR [ecx+64], esi
; 1997 : reader->state = XML_TEXTREADER_START;
xor edx, edx
mov DWORD PTR [ecx+16], 0
mov eax, esi
; 1998 : goto found_node;
jmp SHORT $found_node$28
$LN8@xmlTextRea:
; 1999 : }
; 2000 :
; 2001 : if (reader->node->parent != NULL) {
mov edx, DWORD PTR [eax+20]
test edx, edx
je SHORT $LN9@xmlTextRea
; 2002 : if ((reader->node->parent->type == XML_DOCUMENT_NODE) ||
mov esi, DWORD PTR [edx+4]
mov eax, edx
cmp esi, 9
je SHORT $LN18@xmlTextRea
cmp esi, 13 ; 0000000dH
je SHORT $LN18@xmlTextRea
; 2006 : }
; 2007 :
; 2008 : reader->node = reader->node->parent;
; 2009 : reader->depth--;
dec DWORD PTR [ecx+72]
mov DWORD PTR [ecx+64], edx
; 2010 : reader->state = XML_TEXTREADER_BACKTRACK;
mov edx, 4
mov DWORD PTR [ecx+16], 4
; 2011 : goto found_node;
jmp SHORT $found_node$28
$LN9@xmlTextRea:
; 2012 : }
; 2013 :
; 2014 : reader->state = XML_TEXTREADER_END;
mov DWORD PTR [ecx+16], 2
mov edx, 2
$found_node$28:
; 2015 :
; 2016 : found_node:
; 2017 : if ((reader->node->type == XML_XINCLUDE_START) ||
mov esi, DWORD PTR [eax+4]
cmp esi, 19 ; 00000013H
je $next_node$27
cmp esi, 20 ; 00000014H
je $next_node$27
; 2018 : (reader->node->type == XML_XINCLUDE_END))
; 2019 : goto next_node;
; 2020 :
; 2021 : return(1);
mov eax, 1
pop esi
; 2022 : }
pop ebp
ret 0
$LN18@xmlTextRea:
; 2003 : (reader->node->parent->type == XML_HTML_DOCUMENT_NODE)) {
; 2004 : reader->state = XML_TEXTREADER_END;
mov DWORD PTR [ecx+16], 2
; 2005 : return(0);
xor eax, eax
pop esi
; 2022 : }
pop ebp
ret 0
_xmlTextReaderReadTree ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderGetErrorHandler
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_f$ = 12 ; size = 4
_arg$ = 16 ; size = 4
_xmlTextReaderGetErrorHandler PROC ; COMDAT
; 5096 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _f$[ebp]
mov edx, DWORD PTR _reader$[ebp]
test ecx, ecx
je SHORT $LN2@xmlTextRea
; 5097 : if (f != NULL)
; 5098 : *f = reader->errorFunc;
mov eax, DWORD PTR [edx+108]
mov DWORD PTR [ecx], eax
$LN2@xmlTextRea:
; 5099 : if (arg != NULL)
mov ecx, DWORD PTR _arg$[ebp]
test ecx, ecx
je SHORT $LN3@xmlTextRea
; 5100 : *arg = reader->errorFuncArg;
mov eax, DWORD PTR [edx+112]
mov DWORD PTR [ecx], eax
$LN3@xmlTextRea:
; 5101 : }
pop ebp
ret 0
_xmlTextReaderGetErrorHandler ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderSetStructuredErrorHandler
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_f$ = 12 ; size = 4
_arg$ = 16 ; size = 4
_xmlTextReaderSetStructuredErrorHandler PROC ; COMDAT
; 5008 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
mov ecx, DWORD PTR _f$[ebp]
mov eax, DWORD PTR [esi+20]
mov eax, DWORD PTR [eax]
test ecx, ecx
je $LN2@xmlTextRea
; 5009 : if (f != NULL) {
; 5010 : reader->ctxt->sax->error = NULL;
; 5011 : reader->ctxt->sax->serror = xmlTextReaderStructuredError;
mov DWORD PTR [eax+88], 0
mov eax, DWORD PTR [esi+20]
mov eax, DWORD PTR [eax]
mov DWORD PTR [eax+124], OFFSET _xmlTextReaderStructuredError
; 5012 : reader->ctxt->vctxt.error = xmlTextReaderValidityError;
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [eax+112], OFFSET _xmlTextReaderValidityError
; 5013 : reader->ctxt->sax->warning = xmlTextReaderWarning;
mov eax, DWORD PTR [esi+20]
mov eax, DWORD PTR [eax]
mov DWORD PTR [eax+84], OFFSET _xmlTextReaderWarning
; 5014 : reader->ctxt->vctxt.warning = xmlTextReaderValidityWarning;
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [eax+116], OFFSET _xmlTextReaderValidityWarning
; 5015 : reader->sErrorFunc = f;
; 5016 : reader->errorFunc = NULL;
; 5017 : reader->errorFuncArg = arg;
mov eax, DWORD PTR _arg$[ebp]
mov DWORD PTR [esi+112], eax
; 5018 : #ifdef LIBXML_SCHEMAS_ENABLED
; 5019 : if (reader->rngValidCtxt) {
mov eax, DWORD PTR [esi+120]
mov DWORD PTR [esi+192], ecx
mov DWORD PTR [esi+108], 0
test eax, eax
je SHORT $LN4@xmlTextRea
; 5020 : xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL,
push esi
push 0
push 0
push eax
call _xmlRelaxNGSetValidErrors
; 5021 : reader);
; 5022 : xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt,
push esi
push OFFSET _xmlTextReaderValidityStructuredRelay
push DWORD PTR [esi+120]
call _xmlRelaxNGSetValidStructuredErrors
add esp, 28 ; 0000001cH
$LN4@xmlTextRea:
; 5023 : xmlTextReaderValidityStructuredRelay,
; 5024 : reader);
; 5025 : }
; 5026 : if (reader->xsdValidCtxt) {
mov eax, DWORD PTR [esi+140]
test eax, eax
je $LN7@xmlTextRea
; 5027 : xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL,
push esi
push 0
push 0
push eax
call _xmlSchemaSetValidErrors
; 5028 : reader);
; 5029 : xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt,
push esi
push OFFSET _xmlTextReaderValidityStructuredRelay
; 5055 : reader);
; 5056 : }
; 5057 : #endif
; 5058 : }
; 5059 : }
push DWORD PTR [esi+140]
call _xmlSchemaSetValidStructuredErrors
add esp, 28 ; 0000001cH
pop esi
pop ebp
ret 0
$LN2@xmlTextRea:
; 5030 : xmlTextReaderValidityStructuredRelay,
; 5031 : reader);
; 5032 : }
; 5033 : #endif
; 5034 : } else {
; 5035 : /* restore defaults */
; 5036 : reader->ctxt->sax->error = xmlParserError;
mov DWORD PTR [eax+88], OFFSET _xmlParserError
; 5037 : reader->ctxt->sax->serror = NULL;
mov eax, DWORD PTR [esi+20]
mov eax, DWORD PTR [eax]
mov DWORD PTR [eax+124], 0
; 5038 : reader->ctxt->vctxt.error = xmlParserValidityError;
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [eax+112], OFFSET _xmlParserValidityError
; 5039 : reader->ctxt->sax->warning = xmlParserWarning;
mov eax, DWORD PTR [esi+20]
mov eax, DWORD PTR [eax]
mov DWORD PTR [eax+84], OFFSET _xmlParserWarning
; 5040 : reader->ctxt->vctxt.warning = xmlParserValidityWarning;
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [eax+116], OFFSET _xmlParserValidityWarning
; 5041 : reader->errorFunc = NULL;
; 5042 : reader->sErrorFunc = NULL;
; 5043 : reader->errorFuncArg = NULL;
; 5044 : #ifdef LIBXML_SCHEMAS_ENABLED
; 5045 : if (reader->rngValidCtxt) {
mov eax, DWORD PTR [esi+120]
mov DWORD PTR [esi+108], 0
mov DWORD PTR [esi+192], 0
mov DWORD PTR [esi+112], 0
test eax, eax
je SHORT $LN6@xmlTextRea
; 5046 : xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL,
push esi
push 0
push 0
push eax
call _xmlRelaxNGSetValidErrors
; 5047 : reader);
; 5048 : xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL,
push esi
push 0
push DWORD PTR [esi+120]
call _xmlRelaxNGSetValidStructuredErrors
add esp, 28 ; 0000001cH
$LN6@xmlTextRea:
; 5049 : reader);
; 5050 : }
; 5051 : if (reader->xsdValidCtxt) {
mov eax, DWORD PTR [esi+140]
test eax, eax
je SHORT $LN7@xmlTextRea
; 5052 : xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL,
push esi
push 0
push 0
push eax
call _xmlSchemaSetValidErrors
; 5053 : reader);
; 5054 : xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL,
push esi
push 0
; 5055 : reader);
; 5056 : }
; 5057 : #endif
; 5058 : }
; 5059 : }
push DWORD PTR [esi+140]
call _xmlSchemaSetValidStructuredErrors
add esp, 28 ; 0000001cH
$LN7@xmlTextRea:
pop esi
pop ebp
ret 0
_xmlTextReaderSetStructuredErrorHandler ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderSetErrorHandler
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_f$ = 12 ; size = 4
_arg$ = 16 ; size = 4
_xmlTextReaderSetErrorHandler PROC ; COMDAT
; 4941 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
mov ecx, DWORD PTR _f$[ebp]
mov eax, DWORD PTR [esi+20]
mov eax, DWORD PTR [eax]
test ecx, ecx
je $LN2@xmlTextRea
; 4942 : if (f != NULL) {
; 4943 : reader->ctxt->sax->error = xmlTextReaderError;
; 4944 : reader->ctxt->sax->serror = NULL;
mov DWORD PTR [eax+88], OFFSET _xmlTextReaderError
mov eax, DWORD PTR [esi+20]
mov eax, DWORD PTR [eax]
mov DWORD PTR [eax+124], 0
; 4945 : reader->ctxt->vctxt.error = xmlTextReaderValidityError;
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [eax+112], OFFSET _xmlTextReaderValidityError
; 4946 : reader->ctxt->sax->warning = xmlTextReaderWarning;
mov eax, DWORD PTR [esi+20]
mov eax, DWORD PTR [eax]
mov DWORD PTR [eax+84], OFFSET _xmlTextReaderWarning
; 4947 : reader->ctxt->vctxt.warning = xmlTextReaderValidityWarning;
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [eax+116], OFFSET _xmlTextReaderValidityWarning
; 4948 : reader->errorFunc = f;
; 4949 : reader->sErrorFunc = NULL;
; 4950 : reader->errorFuncArg = arg;
mov eax, DWORD PTR _arg$[ebp]
mov DWORD PTR [esi+112], eax
; 4951 : #ifdef LIBXML_SCHEMAS_ENABLED
; 4952 : if (reader->rngValidCtxt) {
mov eax, DWORD PTR [esi+120]
mov DWORD PTR [esi+108], ecx
mov DWORD PTR [esi+192], 0
test eax, eax
je SHORT $LN4@xmlTextRea
; 4953 : xmlRelaxNGSetValidErrors(reader->rngValidCtxt,
push esi
push OFFSET _xmlTextReaderValidityWarningRelay
push OFFSET _xmlTextReaderValidityErrorRelay
push eax
call _xmlRelaxNGSetValidErrors
; 4954 : xmlTextReaderValidityErrorRelay,
; 4955 : xmlTextReaderValidityWarningRelay,
; 4956 : reader);
; 4957 : xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL,
push esi
push 0
push DWORD PTR [esi+120]
call _xmlRelaxNGSetValidStructuredErrors
add esp, 28 ; 0000001cH
$LN4@xmlTextRea:
; 4958 : reader);
; 4959 : }
; 4960 : if (reader->xsdValidCtxt) {
mov eax, DWORD PTR [esi+140]
test eax, eax
je $LN7@xmlTextRea
; 4961 : xmlSchemaSetValidErrors(reader->xsdValidCtxt,
push esi
push OFFSET _xmlTextReaderValidityWarningRelay
push OFFSET _xmlTextReaderValidityErrorRelay
; 4962 : xmlTextReaderValidityErrorRelay,
; 4963 : xmlTextReaderValidityWarningRelay,
; 4964 : reader);
; 4965 : xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL,
; 4966 : reader);
; 4967 : }
; 4968 : #endif
; 4969 : } else {
jmp SHORT $LN9@xmlTextRea
$LN2@xmlTextRea:
; 4970 : /* restore defaults */
; 4971 : reader->ctxt->sax->error = xmlParserError;
mov DWORD PTR [eax+88], OFFSET _xmlParserError
; 4972 : reader->ctxt->vctxt.error = xmlParserValidityError;
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [eax+112], OFFSET _xmlParserValidityError
; 4973 : reader->ctxt->sax->warning = xmlParserWarning;
mov eax, DWORD PTR [esi+20]
mov eax, DWORD PTR [eax]
mov DWORD PTR [eax+84], OFFSET _xmlParserWarning
; 4974 : reader->ctxt->vctxt.warning = xmlParserValidityWarning;
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [eax+116], OFFSET _xmlParserValidityWarning
; 4975 : reader->errorFunc = NULL;
; 4976 : reader->sErrorFunc = NULL;
; 4977 : reader->errorFuncArg = NULL;
; 4978 : #ifdef LIBXML_SCHEMAS_ENABLED
; 4979 : if (reader->rngValidCtxt) {
mov eax, DWORD PTR [esi+120]
mov DWORD PTR [esi+108], 0
mov DWORD PTR [esi+192], 0
mov DWORD PTR [esi+112], 0
test eax, eax
je SHORT $LN6@xmlTextRea
; 4980 : xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL,
push esi
push 0
push 0
push eax
call _xmlRelaxNGSetValidErrors
; 4981 : reader);
; 4982 : xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL,
push esi
push 0
push DWORD PTR [esi+120]
call _xmlRelaxNGSetValidStructuredErrors
add esp, 28 ; 0000001cH
$LN6@xmlTextRea:
; 4983 : reader);
; 4984 : }
; 4985 : if (reader->xsdValidCtxt) {
mov eax, DWORD PTR [esi+140]
test eax, eax
je SHORT $LN7@xmlTextRea
; 4986 : xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL,
push esi
push 0
push 0
$LN9@xmlTextRea:
; 4987 : reader);
; 4988 : xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL,
; 4989 : reader);
; 4990 : }
; 4991 : #endif
; 4992 : }
; 4993 : }
push eax
call _xmlSchemaSetValidErrors
push esi
push 0
push DWORD PTR [esi+140]
call _xmlSchemaSetValidStructuredErrors
add esp, 28 ; 0000001cH
$LN7@xmlTextRea:
pop esi
pop ebp
ret 0
_xmlTextReaderSetErrorHandler ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderLocatorBaseURI
_TEXT SEGMENT
_locator$ = 8 ; size = 4
_xmlTextReaderLocatorBaseURI PROC ; COMDAT
; 4808 : xmlTextReaderLocatorBaseURI(xmlTextReaderLocatorPtr locator) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _locator$[ebp]
test eax, eax
je SHORT $LN6@xmlTextRea
; 4809 : /* we know that locator is a xmlParserCtxtPtr */
; 4810 : xmlParserCtxtPtr ctx = (xmlParserCtxtPtr)locator;
; 4811 : xmlChar *ret = NULL;
; 4812 :
; 4813 : if (locator == NULL)
; 4814 : return(NULL);
; 4815 : if (ctx->node != NULL) {
mov ecx, DWORD PTR [eax+52]
test ecx, ecx
je SHORT $LN3@xmlTextRea
; 4816 : ret = xmlNodeGetBase(NULL,ctx->node);
push ecx
push 0
call _xmlNodeGetBase
add esp, 8
; 4826 : }
; 4827 : else {
; 4828 : ret = NULL;
; 4829 : }
; 4830 : }
; 4831 :
; 4832 : return ret;
; 4833 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 4817 : }
; 4818 : else {
; 4819 : /* inspired from error.c */
; 4820 : xmlParserInputPtr input;
; 4821 : input = ctx->input;
mov ecx, DWORD PTR [eax+36]
; 4822 : if ((input->filename == NULL) && (ctx->inputNr > 1))
cmp DWORD PTR [ecx+4], 0
jne SHORT $LN5@xmlTextRea
mov edx, DWORD PTR [eax+40]
cmp edx, 1
jle SHORT $LN5@xmlTextRea
; 4823 : input = ctx->inputTab[ctx->inputNr - 2];
mov eax, DWORD PTR [eax+48]
mov ecx, DWORD PTR [eax+edx*4-8]
$LN5@xmlTextRea:
; 4824 : if (input != NULL) {
test ecx, ecx
je SHORT $LN6@xmlTextRea
; 4825 : ret = xmlStrdup(BAD_CAST input->filename);
push DWORD PTR [ecx+4]
call _xmlStrdup
add esp, 4
; 4826 : }
; 4827 : else {
; 4828 : ret = NULL;
; 4829 : }
; 4830 : }
; 4831 :
; 4832 : return ret;
; 4833 : }
pop ebp
ret 0
$LN6@xmlTextRea:
xor eax, eax
pop ebp
ret 0
_xmlTextReaderLocatorBaseURI ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderLocatorLineNumber
_TEXT SEGMENT
_locator$ = 8 ; size = 4
_xmlTextReaderLocatorLineNumber PROC ; COMDAT
; 4771 : xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _locator$[ebp]
test eax, eax
je SHORT $LN6@xmlTextRea
; 4772 : /* we know that locator is a xmlParserCtxtPtr */
; 4773 : xmlParserCtxtPtr ctx = (xmlParserCtxtPtr)locator;
; 4774 : int ret = -1;
; 4775 :
; 4776 : if (locator == NULL)
; 4777 : return(-1);
; 4778 : if (ctx->node != NULL) {
mov ecx, DWORD PTR [eax+52]
test ecx, ecx
je SHORT $LN3@xmlTextRea
; 4779 : ret = xmlGetLineNo(ctx->node);
mov DWORD PTR _locator$[ebp], ecx
; 4789 : }
; 4790 : else {
; 4791 : ret = -1;
; 4792 : }
; 4793 : }
; 4794 :
; 4795 : return ret;
; 4796 : }
pop ebp
; 4779 : ret = xmlGetLineNo(ctx->node);
jmp _xmlGetLineNo
$LN3@xmlTextRea:
; 4780 : }
; 4781 : else {
; 4782 : /* inspired from error.c */
; 4783 : xmlParserInputPtr input;
; 4784 : input = ctx->input;
mov ecx, DWORD PTR [eax+36]
; 4785 : if ((input->filename == NULL) && (ctx->inputNr > 1))
cmp DWORD PTR [ecx+4], 0
jne SHORT $LN5@xmlTextRea
mov edx, DWORD PTR [eax+40]
cmp edx, 1
jle SHORT $LN5@xmlTextRea
; 4786 : input = ctx->inputTab[ctx->inputNr - 2];
mov eax, DWORD PTR [eax+48]
mov ecx, DWORD PTR [eax+edx*4-8]
$LN5@xmlTextRea:
; 4787 : if (input != NULL) {
test ecx, ecx
je SHORT $LN6@xmlTextRea
; 4788 : ret = input->line;
mov eax, DWORD PTR [ecx+28]
; 4789 : }
; 4790 : else {
; 4791 : ret = -1;
; 4792 : }
; 4793 : }
; 4794 :
; 4795 : return ret;
; 4796 : }
pop ebp
ret 0
$LN6@xmlTextRea:
or eax, -1
pop ebp
ret 0
_xmlTextReaderLocatorLineNumber ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlReaderNewIO
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_ioread$ = 12 ; size = 4
_ioclose$ = 16 ; size = 4
_ioctx$ = 20 ; size = 4
_URL$ = 24 ; size = 4
_encoding$ = 28 ; size = 4
_options$ = 32 ; size = 4
_xmlReaderNewIO PROC ; COMDAT
; 5732 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _ioread$[ebp]
test eax, eax
je SHORT $LN5@xmlReaderN
; 5733 : xmlParserInputBufferPtr input;
; 5734 :
; 5735 : if (ioread == NULL)
; 5736 : return (-1);
; 5737 : if (reader == NULL)
cmp DWORD PTR _reader$[ebp], 0
je SHORT $LN5@xmlReaderN
; 5738 : return (-1);
; 5739 :
; 5740 : input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx,
mov esi, DWORD PTR _ioclose$[ebp]
push 0
push DWORD PTR _ioctx$[ebp]
push esi
push eax
call _xmlParserInputBufferCreateIO
add esp, 16 ; 00000010H
; 5741 : XML_CHAR_ENCODING_NONE);
; 5742 : if (input == NULL) {
test eax, eax
jne SHORT $LN4@xmlReaderN
; 5743 : if (ioclose != NULL)
test esi, esi
je SHORT $LN5@xmlReaderN
; 5744 : ioclose(ioctx);
push DWORD PTR _ioctx$[ebp]
call esi
add esp, 4
$LN5@xmlReaderN:
; 5745 : return (-1);
or eax, -1
pop esi
; 5748 : }
pop ebp
ret 0
$LN4@xmlReaderN:
; 5746 : }
; 5747 : return (xmlTextReaderSetup(reader, input, URL, encoding, options));
push DWORD PTR _options$[ebp]
push DWORD PTR _encoding$[ebp]
push DWORD PTR _URL$[ebp]
push eax
push DWORD PTR _reader$[ebp]
call _xmlTextReaderSetup
add esp, 20 ; 00000014H
pop esi
; 5748 : }
pop ebp
ret 0
_xmlReaderNewIO ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlReaderNewFd
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_fd$ = 12 ; size = 4
_URL$ = 16 ; size = 4
_encoding$ = 20 ; size = 4
_options$ = 24 ; size = 4
_xmlReaderNewFd PROC ; COMDAT
; 5696 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _fd$[ebp]
test eax, eax
js SHORT $LN6@xmlReaderN
; 5697 : xmlParserInputBufferPtr input;
; 5698 :
; 5699 : if (fd < 0)
; 5700 : return (-1);
; 5701 : if (reader == NULL)
cmp DWORD PTR _reader$[ebp], 0
je SHORT $LN6@xmlReaderN
; 5702 : return (-1);
; 5703 :
; 5704 : input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE);
push 0
push eax
call _xmlParserInputBufferCreateFd
add esp, 8
; 5705 : if (input == NULL)
test eax, eax
je SHORT $LN6@xmlReaderN
; 5707 : input->closecallback = NULL;
mov DWORD PTR [eax+8], 0
; 5708 : return (xmlTextReaderSetup(reader, input, URL, encoding, options));
mov DWORD PTR _fd$[ebp], eax
; 5709 : }
pop ebp
; 5708 : return (xmlTextReaderSetup(reader, input, URL, encoding, options));
jmp _xmlTextReaderSetup
$LN6@xmlReaderN:
; 5706 : return (-1);
or eax, -1
; 5709 : }
pop ebp
ret 0
_xmlReaderNewFd ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlReaderNewMemory
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_buffer$ = 12 ; size = 4
_size$ = 16 ; size = 4
_URL$ = 20 ; size = 4
_encoding$ = 24 ; size = 4
_options$ = 28 ; size = 4
_xmlReaderNewMemory PROC ; COMDAT
; 5661 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
cmp DWORD PTR _reader$[ebp], 0
je SHORT $LN6@xmlReaderN
; 5662 : xmlParserInputBufferPtr input;
; 5663 :
; 5664 : if (reader == NULL)
; 5665 : return (-1);
; 5666 : if (buffer == NULL)
mov eax, DWORD PTR _buffer$[ebp]
test eax, eax
je SHORT $LN6@xmlReaderN
; 5667 : return (-1);
; 5668 :
; 5669 : input = xmlParserInputBufferCreateStatic(buffer, size,
push 0
push DWORD PTR _size$[ebp]
push eax
call _xmlParserInputBufferCreateStatic
add esp, 12 ; 0000000cH
; 5670 : XML_CHAR_ENCODING_NONE);
; 5671 : if (input == NULL) {
test eax, eax
je SHORT $LN6@xmlReaderN
; 5673 : }
; 5674 : return (xmlTextReaderSetup(reader, input, URL, encoding, options));
push DWORD PTR _options$[ebp]
push DWORD PTR _encoding$[ebp]
push DWORD PTR _URL$[ebp]
push eax
push DWORD PTR _reader$[ebp]
call _xmlTextReaderSetup
add esp, 20 ; 00000014H
; 5675 : }
pop ebp
ret 0
$LN6@xmlReaderN:
; 5672 : return (-1);
or eax, -1
; 5675 : }
pop ebp
ret 0
_xmlReaderNewMemory ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlReaderNewFile
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_filename$ = 12 ; size = 4
_encoding$ = 16 ; size = 4
_options$ = 20 ; size = 4
_xmlReaderNewFile PROC ; COMDAT
; 5627 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _filename$[ebp]
test esi, esi
je SHORT $LN6@xmlReaderN
; 5628 : xmlParserInputBufferPtr input;
; 5629 :
; 5630 : if (filename == NULL)
; 5631 : return (-1);
; 5632 : if (reader == NULL)
cmp DWORD PTR _reader$[ebp], 0
je SHORT $LN6@xmlReaderN
; 5633 : return (-1);
; 5634 :
; 5635 : input =
push 0
push esi
call _xmlParserInputBufferCreateFilename
add esp, 8
; 5636 : xmlParserInputBufferCreateFilename(filename,
; 5637 : XML_CHAR_ENCODING_NONE);
; 5638 : if (input == NULL)
test eax, eax
je SHORT $LN6@xmlReaderN
; 5640 : return (xmlTextReaderSetup(reader, input, filename, encoding, options));
push DWORD PTR _options$[ebp]
push DWORD PTR _encoding$[ebp]
push esi
push eax
push DWORD PTR _reader$[ebp]
call _xmlTextReaderSetup
add esp, 20 ; 00000014H
pop esi
; 5641 : }
pop ebp
ret 0
$LN6@xmlReaderN:
; 5639 : return (-1);
or eax, -1
pop esi
; 5641 : }
pop ebp
ret 0
_xmlReaderNewFile ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlReaderNewDoc
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_cur$ = 12 ; size = 4
_URL$ = 16 ; size = 4
_encoding$ = 20 ; size = 4
_options$ = 24 ; size = 4
_xmlReaderNewDoc PROC ; COMDAT
; 5597 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _cur$[ebp]
test esi, esi
je SHORT $LN10@xmlReaderN
; 5598 :
; 5599 : int len;
; 5600 :
; 5601 : if (cur == NULL)
; 5602 : return (-1);
; 5603 : if (reader == NULL)
cmp DWORD PTR _reader$[ebp], 0
je SHORT $LN10@xmlReaderN
; 5604 : return (-1);
; 5605 :
; 5606 : len = xmlStrlen(cur);
push esi
call _xmlStrlen
; 5669 : input = xmlParserInputBufferCreateStatic(buffer, size,
push 0
push eax
push esi
call _xmlParserInputBufferCreateStatic
add esp, 16 ; 00000010H
; 5670 : XML_CHAR_ENCODING_NONE);
; 5671 : if (input == NULL) {
test eax, eax
je SHORT $LN10@xmlReaderN
pop esi
; 5672 : return (-1);
; 5673 : }
; 5674 : return (xmlTextReaderSetup(reader, input, URL, encoding, options));
mov DWORD PTR _cur$[ebp], eax
; 5607 : return (xmlReaderNewMemory(reader, (const char *)cur, len,
; 5608 : URL, encoding, options));
; 5609 : }
pop ebp
; 5674 : return (xmlTextReaderSetup(reader, input, URL, encoding, options));
jmp _xmlTextReaderSetup
$LN10@xmlReaderN:
; 5607 : return (xmlReaderNewMemory(reader, (const char *)cur, len,
; 5608 : URL, encoding, options));
; 5609 : }
or eax, -1
pop esi
pop ebp
ret 0
_xmlReaderNewDoc ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlReaderNewWalker
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_doc$ = 12 ; size = 4
_xmlReaderNewWalker PROC ; COMDAT
; 5548 : {
push ebp
mov ebp, esp
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edi, DWORD PTR _doc$[ebp]
test edi, edi
je $LN10@xmlReaderN
; 5549 : if (doc == NULL)
; 5550 : return (-1);
; 5551 : if (reader == NULL)
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
je $LN10@xmlReaderN
; 5553 :
; 5554 : if (reader->input != NULL) {
mov eax, DWORD PTR [esi+28]
test eax, eax
je SHORT $LN4@xmlReaderN
; 5555 : xmlFreeParserInputBuffer(reader->input);
push eax
call _xmlFreeParserInputBuffer
add esp, 4
$LN4@xmlReaderN:
; 5556 : }
; 5557 : if (reader->ctxt != NULL) {
mov eax, DWORD PTR [esi+20]
test eax, eax
je SHORT $LN5@xmlReaderN
; 5558 : xmlCtxtReset(reader->ctxt);
push eax
call _xmlCtxtReset
add esp, 4
$LN5@xmlReaderN:
; 5559 : }
; 5560 :
; 5561 : reader->entNr = 0;
; 5562 : reader->input = NULL;
; 5563 : reader->mode = XML_TEXTREADER_MODE_INITIAL;
; 5564 : reader->node = NULL;
; 5565 : reader->curnode = NULL;
; 5566 : reader->base = 0;
; 5567 : reader->cur = 0;
; 5568 : reader->allocs = XML_TEXTREADER_CTXT;
; 5569 : reader->doc = doc;
; 5570 : reader->state = XML_TEXTREADER_START;
; 5571 : if (reader->dict == NULL) {
cmp DWORD PTR [esi+88], 0
mov DWORD PTR [esi+96], 0
mov DWORD PTR [esi+28], 0
mov DWORD PTR [esi], 0
mov DWORD PTR [esi+64], 0
mov DWORD PTR [esi+68], 0
mov DWORD PTR [esi+56], 0
mov DWORD PTR [esi+60], 0
mov DWORD PTR [esi+12], 2
mov DWORD PTR [esi+4], edi
mov DWORD PTR [esi+16], 0
jne SHORT $LN8@xmlReaderN
; 5572 : if ((reader->ctxt != NULL) && (reader->ctxt->dict != NULL))
mov eax, DWORD PTR [esi+20]
test eax, eax
je SHORT $LN7@xmlReaderN
mov eax, DWORD PTR [eax+296]
test eax, eax
jne SHORT $LN11@xmlReaderN
$LN7@xmlReaderN:
; 5573 : reader->dict = reader->ctxt->dict;
; 5574 : else
; 5575 : reader->dict = xmlDictCreate();
call _xmlDictCreate
$LN11@xmlReaderN:
; 5576 : }
; 5577 : return(0);
mov DWORD PTR [esi+88], eax
$LN8@xmlReaderN:
pop edi
xor eax, eax
; 5578 : }
pop esi
pop ebp
ret 0
$LN10@xmlReaderN:
pop edi
; 5552 : return (-1);
or eax, -1
; 5578 : }
pop esi
pop ebp
ret 0
_xmlReaderNewWalker ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlReaderForIO
_TEXT SEGMENT
_ioread$ = 8 ; size = 4
_ioclose$ = 12 ; size = 4
_ioctx$ = 16 ; size = 4
_URL$ = 20 ; size = 4
_encoding$ = 24 ; size = 4
_options$ = 28 ; size = 4
_xmlReaderForIO PROC ; COMDAT
; 5512 : {
push ebp
mov ebp, esp
push ebx
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _ioread$[ebp]
test eax, eax
je SHORT $LN4@xmlReaderF
; 5513 : xmlTextReaderPtr reader;
; 5514 : xmlParserInputBufferPtr input;
; 5515 :
; 5516 : if (ioread == NULL)
; 5517 : return (NULL);
; 5518 :
; 5519 : input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx,
mov ebx, DWORD PTR _ioctx$[ebp]
mov esi, DWORD PTR _ioclose$[ebp]
push 0
push ebx
push esi
push eax
call _xmlParserInputBufferCreateIO
mov edi, eax
add esp, 16 ; 00000010H
; 5520 : XML_CHAR_ENCODING_NONE);
; 5521 : if (input == NULL) {
test edi, edi
jne SHORT $LN3@xmlReaderF
; 5522 : if (ioclose != NULL)
test esi, esi
je SHORT $LN4@xmlReaderF
; 5523 : ioclose(ioctx);
push ebx
call esi
; 5534 : }
add esp, 4
$LN4@xmlReaderF:
pop edi
pop esi
xor eax, eax
pop ebx
pop ebp
ret 0
$LN3@xmlReaderF:
; 5524 : return (NULL);
; 5525 : }
; 5526 : reader = xmlNewTextReader(input, URL);
mov ebx, DWORD PTR _URL$[ebp]
push ebx
push edi
call _xmlNewTextReader
mov esi, eax
add esp, 8
; 5527 : if (reader == NULL) {
test esi, esi
jne SHORT $LN5@xmlReaderF
; 5528 : xmlFreeParserInputBuffer(input);
push edi
call _xmlFreeParserInputBuffer
; 5534 : }
add esp, 4
xor eax, eax
pop edi
pop esi
pop ebx
pop ebp
ret 0
$LN5@xmlReaderF:
; 5529 : return (NULL);
; 5530 : }
; 5531 : reader->allocs |= XML_TEXTREADER_INPUT;
; 5532 : xmlTextReaderSetup(reader, NULL, URL, encoding, options);
push DWORD PTR _options$[ebp]
or DWORD PTR [esi+12], 1
push DWORD PTR _encoding$[ebp]
push ebx
push 0
push esi
call _xmlTextReaderSetup
add esp, 20 ; 00000014H
; 5533 : return (reader);
mov eax, esi
pop edi
; 5534 : }
pop esi
pop ebx
pop ebp
ret 0
_xmlReaderForIO ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlReaderForFd
_TEXT SEGMENT
_fd$ = 8 ; size = 4
_URL$ = 12 ; size = 4
_encoding$ = 16 ; size = 4
_options$ = 20 ; size = 4
_xmlReaderForFd PROC ; COMDAT
; 5473 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _fd$[ebp]
test eax, eax
js SHORT $LN6@xmlReaderF
; 5474 : xmlTextReaderPtr reader;
; 5475 : xmlParserInputBufferPtr input;
; 5476 :
; 5477 : if (fd < 0)
; 5478 : return (NULL);
; 5479 :
; 5480 : input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE);
push 0
push eax
call _xmlParserInputBufferCreateFd
mov esi, eax
add esp, 8
; 5481 : if (input == NULL)
test esi, esi
je SHORT $LN6@xmlReaderF
; 5483 : input->closecallback = NULL;
push edi
; 5484 : reader = xmlNewTextReader(input, URL);
push DWORD PTR _URL$[ebp]
mov DWORD PTR [esi+8], 0
push esi
call _xmlNewTextReader
mov edi, eax
add esp, 8
; 5485 : if (reader == NULL) {
test edi, edi
jne SHORT $LN4@xmlReaderF
; 5486 : xmlFreeParserInputBuffer(input);
push esi
call _xmlFreeParserInputBuffer
add esp, 4
; 5487 : return (NULL);
xor eax, eax
pop edi
pop esi
; 5492 : }
pop ebp
ret 0
$LN4@xmlReaderF:
; 5488 : }
; 5489 : reader->allocs |= XML_TEXTREADER_INPUT;
; 5490 : xmlTextReaderSetup(reader, NULL, URL, encoding, options);
push DWORD PTR _options$[ebp]
or DWORD PTR [edi+12], 1
push DWORD PTR _encoding$[ebp]
push DWORD PTR _URL$[ebp]
push 0
push edi
call _xmlTextReaderSetup
add esp, 20 ; 00000014H
; 5491 : return (reader);
mov eax, edi
pop edi
pop esi
; 5492 : }
pop ebp
ret 0
$LN6@xmlReaderF:
; 5482 : return (NULL);
xor eax, eax
pop esi
; 5492 : }
pop ebp
ret 0
_xmlReaderForFd ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlReaderForMemory
_TEXT SEGMENT
_buffer$ = 8 ; size = 4
_size$ = 12 ; size = 4
_URL$ = 16 ; size = 4
_encoding$ = 20 ; size = 4
_options$ = 24 ; size = 4
_xmlReaderForMemory PROC ; COMDAT
; 5438 : {
push ebp
mov ebp, esp
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
push 0
push DWORD PTR _size$[ebp]
push DWORD PTR _buffer$[ebp]
call _xmlParserInputBufferCreateStatic
mov edi, eax
add esp, 12 ; 0000000cH
test edi, edi
jne SHORT $LN2@xmlReaderF
pop edi
; 5455 : }
pop ebp
ret 0
$LN2@xmlReaderF:
push esi
; 5439 : xmlTextReaderPtr reader;
; 5440 : xmlParserInputBufferPtr buf;
; 5441 :
; 5442 : buf = xmlParserInputBufferCreateStatic(buffer, size,
; 5443 : XML_CHAR_ENCODING_NONE);
; 5444 : if (buf == NULL) {
; 5445 : return (NULL);
; 5446 : }
; 5447 : reader = xmlNewTextReader(buf, URL);
push DWORD PTR _URL$[ebp]
push edi
call _xmlNewTextReader
mov esi, eax
add esp, 8
; 5448 : if (reader == NULL) {
test esi, esi
jne SHORT $LN3@xmlReaderF
; 5449 : xmlFreeParserInputBuffer(buf);
push edi
call _xmlFreeParserInputBuffer
add esp, 4
; 5450 : return (NULL);
xor eax, eax
pop esi
pop edi
; 5455 : }
pop ebp
ret 0
$LN3@xmlReaderF:
; 5451 : }
; 5452 : reader->allocs |= XML_TEXTREADER_INPUT;
; 5453 : xmlTextReaderSetup(reader, NULL, URL, encoding, options);
push DWORD PTR _options$[ebp]
or DWORD PTR [esi+12], 1
push DWORD PTR _encoding$[ebp]
push DWORD PTR _URL$[ebp]
push 0
push esi
call _xmlTextReaderSetup
add esp, 20 ; 00000014H
; 5454 : return (reader);
mov eax, esi
pop esi
pop edi
; 5455 : }
pop ebp
ret 0
_xmlReaderForMemory ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlReaderForFile
_TEXT SEGMENT
_filename$ = 8 ; size = 4
_encoding$ = 12 ; size = 4
_options$ = 16 ; size = 4
_xmlReaderForFile PROC ; COMDAT
; 5412 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
push DWORD PTR _filename$[ebp]
call _xmlNewTextReaderFilename
mov esi, eax
add esp, 4
test esi, esi
jne SHORT $LN2@xmlReaderF
pop esi
; 5420 : }
pop ebp
ret 0
$LN2@xmlReaderF:
; 5413 : xmlTextReaderPtr reader;
; 5414 :
; 5415 : reader = xmlNewTextReaderFilename(filename);
; 5416 : if (reader == NULL)
; 5417 : return (NULL);
; 5418 : xmlTextReaderSetup(reader, NULL, NULL, encoding, options);
push DWORD PTR _options$[ebp]
push DWORD PTR _encoding$[ebp]
push 0
push 0
push esi
call _xmlTextReaderSetup
add esp, 20 ; 00000014H
; 5419 : return (reader);
mov eax, esi
pop esi
; 5420 : }
pop ebp
ret 0
_xmlReaderForFile ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlReaderForDoc
_TEXT SEGMENT
_cur$ = 8 ; size = 4
_URL$ = 12 ; size = 4
_encoding$ = 16 ; size = 4
_options$ = 20 ; size = 4
_xmlReaderForDoc PROC ; COMDAT
; 5388 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _cur$[ebp]
test esi, esi
jne SHORT $LN2@xmlReaderF
; 5389 : int len;
; 5390 :
; 5391 : if (cur == NULL)
; 5392 : return (NULL);
xor eax, eax
pop esi
; 5396 : ((const char *) cur, len, URL, encoding, options));
; 5397 : }
pop ebp
ret 0
$LN2@xmlReaderF:
; 5393 : len = xmlStrlen(cur);
push esi
call _xmlStrlen
; 5394 :
; 5395 : return (xmlReaderForMemory
push DWORD PTR _options$[ebp]
push DWORD PTR _encoding$[ebp]
push DWORD PTR _URL$[ebp]
push eax
push esi
call _xmlReaderForMemory
add esp, 24 ; 00000018H
pop esi
; 5396 : ((const char *) cur, len, URL, encoding, options));
; 5397 : }
pop ebp
ret 0
_xmlReaderForDoc ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlReaderWalker
_TEXT SEGMENT
_doc$ = 8 ; size = 4
_xmlReaderWalker PROC ; COMDAT
; 5346 : {
push ebp
mov ebp, esp
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edi, DWORD PTR _doc$[ebp]
test edi, edi
jne SHORT $LN2@xmlReaderW
; 5347 : xmlTextReaderPtr ret;
; 5348 :
; 5349 : if (doc == NULL)
; 5350 : return(NULL);
xor eax, eax
pop edi
; 5371 : }
pop ebp
ret 0
$LN2@xmlReaderW:
push esi
; 5351 :
; 5352 : ret = xmlMalloc(sizeof(xmlTextReader));
push 196 ; 000000c4H
call DWORD PTR _xmlMalloc
mov esi, eax
add esp, 4
; 5353 : if (ret == NULL) {
test esi, esi
jne SHORT $LN3@xmlReaderW
; 5354 : xmlGenericError(xmlGenericErrorContext,
call ___xmlGenericError
mov esi, eax
call ___xmlGenericErrorContext
push OFFSET ??_C@_0CC@HCDAIILG@xmlNewTextReader?5?3?5malloc?5faile@
push DWORD PTR [eax]
mov eax, DWORD PTR [esi]
call eax
add esp, 8
; 5355 : "xmlNewTextReader : malloc failed\n");
; 5356 : return(NULL);
xor eax, eax
pop esi
pop edi
; 5371 : }
pop ebp
ret 0
$LN3@xmlReaderW:
; 5357 : }
; 5358 : memset(ret, 0, sizeof(xmlTextReader));
push 196 ; 000000c4H
push 0
push esi
call _memset
add esp, 12 ; 0000000cH
; 5359 : ret->entNr = 0;
; 5360 : ret->input = NULL;
; 5361 : ret->mode = XML_TEXTREADER_MODE_INITIAL;
; 5362 : ret->node = NULL;
; 5363 : ret->curnode = NULL;
; 5364 : ret->base = 0;
; 5365 : ret->cur = 0;
; 5366 : ret->allocs = XML_TEXTREADER_CTXT;
mov DWORD PTR [esi+12], 2
; 5367 : ret->doc = doc;
mov DWORD PTR [esi+4], edi
; 5368 : ret->state = XML_TEXTREADER_START;
mov DWORD PTR [esi+16], 0
; 5369 : ret->dict = xmlDictCreate();
call _xmlDictCreate
mov DWORD PTR [esi+88], eax
; 5370 : return(ret);
mov eax, esi
pop esi
pop edi
; 5371 : }
pop ebp
ret 0
_xmlReaderWalker ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderByteConsumed
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderByteConsumed PROC ; COMDAT
; 5329 : xmlTextReaderByteConsumed(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
je SHORT $LN3@xmlTextRea
; 5330 : if ((reader == NULL) || (reader->ctxt == NULL))
mov eax, DWORD PTR [eax+20]
test eax, eax
je SHORT $LN3@xmlTextRea
; 5332 : return(xmlByteConsumed(reader->ctxt));
mov DWORD PTR _reader$[ebp], eax
; 5333 : }
pop ebp
; 5332 : return(xmlByteConsumed(reader->ctxt));
jmp _xmlByteConsumed
$LN3@xmlTextRea:
; 5331 : return(-1);
or eax, -1
; 5333 : }
pop ebp
ret 0
_xmlTextReaderByteConsumed ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderStandalone
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderStandalone PROC ; COMDAT
; 4705 : xmlTextReaderStandalone(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _reader$[ebp]
test ecx, ecx
je SHORT $LN8@xmlTextRea
; 4706 : xmlDocPtr doc = NULL;
; 4707 : if (reader == NULL)
; 4708 : return(-1);
; 4709 : if (reader->doc != NULL)
mov eax, DWORD PTR [ecx+4]
test eax, eax
jne SHORT $LN10@xmlTextRea
; 4710 : doc = reader->doc;
; 4711 : else if (reader->ctxt != NULL)
mov eax, DWORD PTR [ecx+20]
test eax, eax
je SHORT $LN8@xmlTextRea
; 4712 : doc = reader->ctxt->myDoc;
mov eax, DWORD PTR [eax+8]
; 4713 : if (doc == NULL)
test eax, eax
je SHORT $LN8@xmlTextRea
$LN10@xmlTextRea:
; 4715 :
; 4716 : return(doc->standalone);
mov eax, DWORD PTR [eax+40]
; 4717 : }
pop ebp
ret 0
$LN8@xmlTextRea:
; 4714 : return(-1);
or eax, -1
; 4717 : }
pop ebp
ret 0
_xmlTextReaderStandalone ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderConstXmlVersion
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderConstXmlVersion PROC ; COMDAT
; 4677 : xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _reader$[ebp]
test ecx, ecx
je SHORT $LN11@xmlTextRea
; 4678 : xmlDocPtr doc = NULL;
; 4679 : if (reader == NULL)
; 4680 : return(NULL);
; 4681 : if (reader->doc != NULL)
mov eax, DWORD PTR [ecx+4]
test eax, eax
jne SHORT $LN13@xmlTextRea
; 4682 : doc = reader->doc;
; 4683 : else if (reader->ctxt != NULL)
mov eax, DWORD PTR [ecx+20]
test eax, eax
je SHORT $LN11@xmlTextRea
; 4684 : doc = reader->ctxt->myDoc;
mov eax, DWORD PTR [eax+8]
; 4685 : if (doc == NULL)
test eax, eax
je SHORT $LN11@xmlTextRea
$LN13@xmlTextRea:
; 4686 : return(NULL);
; 4687 :
; 4688 : if (doc->version == NULL)
mov eax, DWORD PTR [eax+56]
test eax, eax
je SHORT $LN11@xmlTextRea
; 4690 : else
; 4691 : return(CONSTSTR(doc->version));
push -1
push eax
push DWORD PTR [ecx+88]
call _xmlDictLookup
add esp, 12 ; 0000000cH
; 4692 : }
pop ebp
ret 0
$LN11@xmlTextRea:
; 4689 : return(NULL);
xor eax, eax
; 4692 : }
pop ebp
ret 0
_xmlTextReaderConstXmlVersion ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderSetSchema
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_schema$ = 12 ; size = 4
_xmlTextReaderSetSchema PROC ; COMDAT
; 4263 : xmlTextReaderSetSchema(xmlTextReaderPtr reader, xmlSchemaPtr schema) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
je $LN18@xmlTextRea
; 4264 : if (reader == NULL)
; 4265 : return(-1);
; 4266 : if (schema == NULL) {
cmp DWORD PTR _schema$[ebp], 0
jne SHORT $LN3@xmlTextRea
; 4267 : if (reader->xsdPlug != NULL) {
mov eax, DWORD PTR [esi+152]
test eax, eax
je SHORT $LN4@xmlTextRea
; 4268 : xmlSchemaSAXUnplug(reader->xsdPlug);
push eax
call _xmlSchemaSAXUnplug
add esp, 4
; 4269 : reader->xsdPlug = NULL;
mov DWORD PTR [esi+152], 0
$LN4@xmlTextRea:
; 4270 : }
; 4271 : if (reader->xsdValidCtxt != NULL) {
mov eax, DWORD PTR [esi+140]
test eax, eax
je SHORT $LN5@xmlTextRea
; 4272 : if (! reader->xsdPreserveCtxt)
cmp DWORD PTR [esi+144], 0
jne SHORT $LN6@xmlTextRea
; 4273 : xmlSchemaFreeValidCtxt(reader->xsdValidCtxt);
push eax
call _xmlSchemaFreeValidCtxt
add esp, 4
$LN6@xmlTextRea:
; 4274 : reader->xsdValidCtxt = NULL;
mov DWORD PTR [esi+140], 0
$LN5@xmlTextRea:
; 4275 : }
; 4276 : reader->xsdPreserveCtxt = 0;
; 4277 : if (reader->xsdSchemas != NULL) {
mov eax, DWORD PTR [esi+136]
mov DWORD PTR [esi+144], 0
test eax, eax
je SHORT $LN7@xmlTextRea
; 4278 : xmlSchemaFree(reader->xsdSchemas);
push eax
call _xmlSchemaFree
add esp, 4
; 4279 : reader->xsdSchemas = NULL;
mov DWORD PTR [esi+136], 0
$LN7@xmlTextRea:
; 4280 : }
; 4281 : return(0);
xor eax, eax
pop esi
; 4333 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 4282 : }
; 4283 : if (reader->mode != XML_TEXTREADER_MODE_INITIAL)
cmp DWORD PTR [esi], 0
jne $LN18@xmlTextRea
; 4284 : return(-1);
; 4285 : if (reader->xsdPlug != NULL) {
mov eax, DWORD PTR [esi+152]
test eax, eax
je SHORT $LN9@xmlTextRea
; 4286 : xmlSchemaSAXUnplug(reader->xsdPlug);
push eax
call _xmlSchemaSAXUnplug
add esp, 4
; 4287 : reader->xsdPlug = NULL;
mov DWORD PTR [esi+152], 0
$LN9@xmlTextRea:
; 4288 : }
; 4289 : if (reader->xsdValidCtxt != NULL) {
mov eax, DWORD PTR [esi+140]
test eax, eax
je SHORT $LN10@xmlTextRea
; 4290 : if (! reader->xsdPreserveCtxt)
cmp DWORD PTR [esi+144], 0
jne SHORT $LN11@xmlTextRea
; 4291 : xmlSchemaFreeValidCtxt(reader->xsdValidCtxt);
push eax
call _xmlSchemaFreeValidCtxt
add esp, 4
$LN11@xmlTextRea:
; 4292 : reader->xsdValidCtxt = NULL;
mov DWORD PTR [esi+140], 0
$LN10@xmlTextRea:
; 4293 : }
; 4294 : reader->xsdPreserveCtxt = 0;
; 4295 : if (reader->xsdSchemas != NULL) {
mov eax, DWORD PTR [esi+136]
mov DWORD PTR [esi+144], 0
test eax, eax
je SHORT $LN12@xmlTextRea
; 4296 : xmlSchemaFree(reader->xsdSchemas);
push eax
call _xmlSchemaFree
add esp, 4
; 4297 : reader->xsdSchemas = NULL;
mov DWORD PTR [esi+136], 0
$LN12@xmlTextRea:
; 4298 : }
; 4299 : reader->xsdValidCtxt = xmlSchemaNewValidCtxt(schema);
push DWORD PTR _schema$[ebp]
call _xmlSchemaNewValidCtxt
mov edx, eax
add esp, 4
mov DWORD PTR [esi+140], edx
; 4300 : if (reader->xsdValidCtxt == NULL) {
test edx, edx
jne SHORT $LN13@xmlTextRea
; 4301 : xmlSchemaFree(reader->xsdSchemas);
push DWORD PTR [esi+136]
call _xmlSchemaFree
add esp, 4
; 4302 : reader->xsdSchemas = NULL;
mov DWORD PTR [esi+136], 0
$LN18@xmlTextRea:
; 4333 : }
or eax, -1
pop esi
pop ebp
ret 0
$LN13@xmlTextRea:
; 4303 : return(-1);
; 4304 : }
; 4305 : reader->xsdPlug = xmlSchemaSAXPlug(reader->xsdValidCtxt,
mov ecx, DWORD PTR [esi+20]
lea eax, DWORD PTR [ecx+4]
push eax
push ecx
push edx
call _xmlSchemaSAXPlug
add esp, 12 ; 0000000cH
mov DWORD PTR [esi+152], eax
; 4306 : &(reader->ctxt->sax),
; 4307 : &(reader->ctxt->userData));
; 4308 : if (reader->xsdPlug == NULL) {
test eax, eax
jne SHORT $LN14@xmlTextRea
; 4309 : xmlSchemaFree(reader->xsdSchemas);
push DWORD PTR [esi+136]
call _xmlSchemaFree
; 4310 : reader->xsdSchemas = NULL;
; 4311 : xmlSchemaFreeValidCtxt(reader->xsdValidCtxt);
push DWORD PTR [esi+140]
mov DWORD PTR [esi+136], 0
call _xmlSchemaFreeValidCtxt
add esp, 8
; 4312 : reader->xsdValidCtxt = NULL;
mov DWORD PTR [esi+140], 0
; 4333 : }
or eax, -1
pop esi
pop ebp
ret 0
$LN14@xmlTextRea:
; 4313 : return(-1);
; 4314 : }
; 4315 : xmlSchemaValidateSetLocator(reader->xsdValidCtxt,
push esi
push OFFSET _xmlTextReaderLocator
push DWORD PTR [esi+140]
call _xmlSchemaValidateSetLocator
add esp, 12 ; 0000000cH
; 4316 : xmlTextReaderLocator,
; 4317 : (void *) reader);
; 4318 :
; 4319 : if (reader->errorFunc != NULL) {
cmp DWORD PTR [esi+108], 0
je SHORT $LN15@xmlTextRea
; 4320 : xmlSchemaSetValidErrors(reader->xsdValidCtxt,
push esi
push OFFSET _xmlTextReaderValidityWarningRelay
push OFFSET _xmlTextReaderValidityErrorRelay
push DWORD PTR [esi+140]
call _xmlSchemaSetValidErrors
add esp, 16 ; 00000010H
$LN15@xmlTextRea:
; 4321 : xmlTextReaderValidityErrorRelay,
; 4322 : xmlTextReaderValidityWarningRelay,
; 4323 : reader);
; 4324 : }
; 4325 : if (reader->sErrorFunc != NULL) {
cmp DWORD PTR [esi+192], 0
je SHORT $LN16@xmlTextRea
; 4326 : xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt,
push esi
push OFFSET _xmlTextReaderValidityStructuredRelay
push DWORD PTR [esi+140]
call _xmlSchemaSetValidStructuredErrors
add esp, 12 ; 0000000cH
$LN16@xmlTextRea:
; 4327 : xmlTextReaderValidityStructuredRelay,
; 4328 : reader);
; 4329 : }
; 4330 : reader->xsdValidErrors = 0;
mov DWORD PTR [esi+148], 0
; 4331 : reader->validate = XML_TEXTREADER_VALIDATE_XSD;
; 4332 : return(0);
xor eax, eax
mov DWORD PTR [esi+8], 4
pop esi
; 4333 : }
pop ebp
ret 0
_xmlTextReaderSetSchema ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderSchemaValidateCtxt
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_ctxt$ = 12 ; size = 4
_options$ = 16 ; size = 4
_xmlTextReaderSchemaValidateCtxt PROC ; COMDAT
; 4575 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
push DWORD PTR _options$[ebp]
push DWORD PTR _ctxt$[ebp]
push 0
push DWORD PTR _reader$[ebp]
call _xmlTextReaderSchemaValidateInternal
add esp, 16 ; 00000010H
; 4576 : return(xmlTextReaderSchemaValidateInternal(reader, NULL, ctxt, options));
; 4577 : }
pop ebp
ret 0
_xmlTextReaderSchemaValidateCtxt ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderSchemaValidate
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xsd$ = 12 ; size = 4
_xmlTextReaderSchemaValidate PROC ; COMDAT
; 4593 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
push 0
push 0
push DWORD PTR _xsd$[ebp]
push DWORD PTR _reader$[ebp]
call _xmlTextReaderSchemaValidateInternal
add esp, 16 ; 00000010H
; 4594 : return(xmlTextReaderSchemaValidateInternal(reader, xsd, NULL, 0));
; 4595 : }
pop ebp
ret 0
_xmlTextReaderSchemaValidate ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderRelaxNGSetSchema
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_schema$ = 12 ; size = 4
_xmlTextReaderRelaxNGSetSchema PROC ; COMDAT
; 4146 : xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, xmlRelaxNGPtr schema) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
je $LN15@xmlTextRea
; 4147 : if (reader == NULL)
; 4148 : return(-1);
; 4149 : if (schema == NULL) {
cmp DWORD PTR _schema$[ebp], 0
jne SHORT $LN3@xmlTextRea
; 4150 : if (reader->rngSchemas != NULL) {
mov eax, DWORD PTR [esi+116]
test eax, eax
je SHORT $LN4@xmlTextRea
; 4151 : xmlRelaxNGFree(reader->rngSchemas);
push eax
call _xmlRelaxNGFree
add esp, 4
; 4152 : reader->rngSchemas = NULL;
mov DWORD PTR [esi+116], 0
$LN4@xmlTextRea:
; 4153 : }
; 4154 : if (reader->rngValidCtxt != NULL) {
mov eax, DWORD PTR [esi+120]
test eax, eax
je SHORT $LN5@xmlTextRea
; 4155 : if (! reader->rngPreserveCtxt)
cmp DWORD PTR [esi+124], 0
jne SHORT $LN6@xmlTextRea
; 4156 : xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt);
push eax
call _xmlRelaxNGFreeValidCtxt
add esp, 4
$LN6@xmlTextRea:
; 4157 : reader->rngValidCtxt = NULL;
mov DWORD PTR [esi+120], 0
$LN5@xmlTextRea:
; 4158 : }
; 4159 : reader->rngPreserveCtxt = 0;
mov DWORD PTR [esi+124], 0
; 4160 : return(0);
xor eax, eax
pop esi
; 4192 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 4161 : }
; 4162 : if (reader->mode != XML_TEXTREADER_MODE_INITIAL)
cmp DWORD PTR [esi], 0
jne $LN15@xmlTextRea
; 4163 : return(-1);
; 4164 : if (reader->rngSchemas != NULL) {
mov eax, DWORD PTR [esi+116]
test eax, eax
je SHORT $LN8@xmlTextRea
; 4165 : xmlRelaxNGFree(reader->rngSchemas);
push eax
call _xmlRelaxNGFree
add esp, 4
; 4166 : reader->rngSchemas = NULL;
mov DWORD PTR [esi+116], 0
$LN8@xmlTextRea:
; 4167 : }
; 4168 : if (reader->rngValidCtxt != NULL) {
mov eax, DWORD PTR [esi+120]
test eax, eax
je SHORT $LN9@xmlTextRea
; 4169 : if (! reader->rngPreserveCtxt)
cmp DWORD PTR [esi+124], 0
jne SHORT $LN10@xmlTextRea
; 4170 : xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt);
push eax
call _xmlRelaxNGFreeValidCtxt
add esp, 4
$LN10@xmlTextRea:
; 4171 : reader->rngValidCtxt = NULL;
mov DWORD PTR [esi+120], 0
$LN9@xmlTextRea:
; 4172 : }
; 4173 : reader->rngPreserveCtxt = 0;
; 4174 : reader->rngValidCtxt = xmlRelaxNGNewValidCtxt(schema);
push DWORD PTR _schema$[ebp]
mov DWORD PTR [esi+124], 0
call _xmlRelaxNGNewValidCtxt
add esp, 4
mov DWORD PTR [esi+120], eax
; 4175 : if (reader->rngValidCtxt == NULL)
test eax, eax
je SHORT $LN15@xmlTextRea
; 4177 : if (reader->errorFunc != NULL) {
cmp DWORD PTR [esi+108], 0
je SHORT $LN12@xmlTextRea
; 4178 : xmlRelaxNGSetValidErrors(reader->rngValidCtxt,
push esi
push OFFSET _xmlTextReaderValidityWarningRelay
push OFFSET _xmlTextReaderValidityErrorRelay
push eax
call _xmlRelaxNGSetValidErrors
add esp, 16 ; 00000010H
$LN12@xmlTextRea:
; 4179 : xmlTextReaderValidityErrorRelay,
; 4180 : xmlTextReaderValidityWarningRelay,
; 4181 : reader);
; 4182 : }
; 4183 : if (reader->sErrorFunc != NULL) {
cmp DWORD PTR [esi+192], 0
je SHORT $LN13@xmlTextRea
; 4184 : xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt,
push esi
push OFFSET _xmlTextReaderValidityStructuredRelay
push DWORD PTR [esi+120]
call _xmlRelaxNGSetValidStructuredErrors
add esp, 12 ; 0000000cH
$LN13@xmlTextRea:
; 4185 : xmlTextReaderValidityStructuredRelay,
; 4186 : reader);
; 4187 : }
; 4188 : reader->rngValidErrors = 0;
mov DWORD PTR [esi+128], 0
; 4189 : reader->rngFullNode = NULL;
; 4190 : reader->validate = XML_TEXTREADER_VALIDATE_RNG;
; 4191 : return(0);
xor eax, eax
mov DWORD PTR [esi+132], 0
mov DWORD PTR [esi+8], 2
pop esi
; 4192 : }
pop ebp
ret 0
$LN15@xmlTextRea:
; 4176 : return(-1);
or eax, -1
pop esi
; 4192 : }
pop ebp
ret 0
_xmlTextReaderRelaxNGSetSchema ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderRelaxNGValidateCtxt
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_ctxt$ = 12 ; size = 4
_options$ = 16 ; size = 4
_xmlTextReaderRelaxNGValidateCtxt PROC ; COMDAT
; 4614 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
push DWORD PTR _options$[ebp]
push DWORD PTR _ctxt$[ebp]
push 0
push DWORD PTR _reader$[ebp]
call _xmlTextReaderRelaxNGValidateInternal
add esp, 16 ; 00000010H
; 4615 : return(xmlTextReaderRelaxNGValidateInternal(reader, NULL, ctxt, options));
; 4616 : }
pop ebp
ret 0
_xmlTextReaderRelaxNGValidateCtxt ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderRelaxNGValidate
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_rng$ = 12 ; size = 4
_xmlTextReaderRelaxNGValidate PROC ; COMDAT
; 4632 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
push 0
push 0
push DWORD PTR _rng$[ebp]
push DWORD PTR _reader$[ebp]
call _xmlTextReaderRelaxNGValidateInternal
add esp, 16 ; 00000010H
; 4633 : return(xmlTextReaderRelaxNGValidateInternal(reader, rng, NULL, 0));
; 4634 : }
pop ebp
ret 0
_xmlTextReaderRelaxNGValidate ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderIsValid
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderIsValid PROC ; COMDAT
; 5071 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _reader$[ebp]
test ecx, ecx
jne SHORT $LN2@xmlTextRea
; 5072 : if (reader == NULL)
; 5073 : return (-1);
or eax, -1
; 5083 : }
pop ebp
ret 0
$LN2@xmlTextRea:
; 5074 : #ifdef LIBXML_SCHEMAS_ENABLED
; 5075 : if (reader->validate == XML_TEXTREADER_VALIDATE_RNG)
mov eax, DWORD PTR [ecx+8]
cmp eax, 2
jne SHORT $LN3@xmlTextRea
; 5076 : return (reader->rngValidErrors == 0);
xor eax, eax
cmp DWORD PTR [ecx+128], eax
sete al
; 5083 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 5077 : if (reader->validate == XML_TEXTREADER_VALIDATE_XSD)
cmp eax, 4
jne SHORT $LN4@xmlTextRea
; 5078 : return (reader->xsdValidErrors == 0);
xor eax, eax
cmp DWORD PTR [ecx+148], eax
sete al
; 5083 : }
pop ebp
ret 0
$LN4@xmlTextRea:
; 5079 : #endif
; 5080 : if ((reader->ctxt != NULL) && (reader->ctxt->validate == 1))
mov eax, DWORD PTR [ecx+20]
test eax, eax
je SHORT $LN5@xmlTextRea
cmp DWORD PTR [eax+104], 1
jne SHORT $LN5@xmlTextRea
; 5081 : return (reader->ctxt->valid);
mov eax, DWORD PTR [eax+100]
; 5083 : }
pop ebp
ret 0
$LN5@xmlTextRea:
; 5082 : return (0);
xor eax, eax
; 5083 : }
pop ebp
ret 0
_xmlTextReaderIsValid ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderNextSibling
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderNextSibling PROC ; COMDAT
; 2036 : xmlTextReaderNextSibling(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
je SHORT $LN8@xmlTextRea
; 2037 : if (reader == NULL)
; 2038 : return(-1);
; 2039 : if (reader->doc == NULL) {
cmp DWORD PTR [eax+4], 0
je SHORT $LN8@xmlTextRea
; 2042 : }
; 2043 :
; 2044 : if (reader->state == XML_TEXTREADER_END)
cmp DWORD PTR [eax+16], 2
je SHORT $LN6@xmlTextRea
; 2045 : return(0);
; 2046 :
; 2047 : if (reader->node == NULL)
mov ecx, DWORD PTR [eax+64]
test ecx, ecx
jne SHORT $LN5@xmlTextRea
; 2048 : return(xmlTextReaderNextTree(reader));
mov DWORD PTR _reader$[ebp], eax
; 2057 : }
pop ebp
; 2048 : return(xmlTextReaderNextTree(reader));
jmp _xmlTextReaderNextTree
$LN5@xmlTextRea:
; 2049 :
; 2050 : if (reader->node->next != NULL) {
mov ecx, DWORD PTR [ecx+24]
test ecx, ecx
je SHORT $LN6@xmlTextRea
; 2051 : reader->node = reader->node->next;
mov DWORD PTR [eax+64], ecx
; 2052 : reader->state = XML_TEXTREADER_START;
mov DWORD PTR [eax+16], 0
; 2053 : return(1);
mov eax, 1
; 2057 : }
pop ebp
ret 0
$LN6@xmlTextRea:
; 2054 : }
; 2055 :
; 2056 : return(0);
xor eax, eax
; 2057 : }
pop ebp
ret 0
$LN8@xmlTextRea:
; 2040 : /* TODO */
; 2041 : return(-1);
or eax, -1
; 2057 : }
pop ebp
ret 0
_xmlTextReaderNextSibling ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderNext
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderNext PROC ; COMDAT
; 1669 : xmlTextReaderNext(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
jne SHORT $LN5@xmlTextRea
; 1670 : int ret;
; 1671 : xmlNodePtr cur;
; 1672 :
; 1673 : if (reader == NULL)
; 1674 : return(-1);
or eax, -1
pop esi
; 1689 : return(xmlTextReaderRead(reader));
; 1690 : }
pop ebp
ret 0
$LN5@xmlTextRea:
; 1675 : if (reader->doc != NULL)
cmp DWORD PTR [esi+4], 0
je SHORT $LN6@xmlTextRea
; 1676 : return(xmlTextReaderNextTree(reader));
push esi
call _xmlTextReaderNextTree
add esp, 4
pop esi
; 1689 : return(xmlTextReaderRead(reader));
; 1690 : }
pop ebp
ret 0
$LN6@xmlTextRea:
push edi
; 1677 : cur = reader->node;
mov edi, DWORD PTR [esi+64]
; 1678 : if ((cur == NULL) || (cur->type != XML_ELEMENT_NODE))
test edi, edi
je SHORT $LN8@xmlTextRea
cmp DWORD PTR [edi+4], 1
jne SHORT $LN8@xmlTextRea
; 1680 : if (reader->state == XML_TEXTREADER_END || reader->state == XML_TEXTREADER_BACKTRACK)
mov eax, DWORD PTR [esi+16]
cmp eax, 2
je SHORT $LN8@xmlTextRea
cmp eax, 4
je SHORT $LN8@xmlTextRea
; 1681 : return(xmlTextReaderRead(reader));
; 1682 : if (cur->extra & NODE_IS_EMPTY)
test BYTE PTR [edi+58], 1
jne SHORT $LN8@xmlTextRea
npad 2
$LL4@xmlTextRea:
; 1683 : return(xmlTextReaderRead(reader));
; 1684 : do {
; 1685 : ret = xmlTextReaderRead(reader);
push esi
call _xmlTextReaderRead
add esp, 4
; 1686 : if (ret != 1)
cmp eax, 1
jne SHORT $LN27@xmlTextRea
; 1687 : return(ret);
; 1688 : } while (reader->node != cur);
cmp DWORD PTR [esi+64], edi
jne SHORT $LL4@xmlTextRea
$LN8@xmlTextRea:
; 1679 : return(xmlTextReaderRead(reader));
push esi
call _xmlTextReaderRead
add esp, 4
$LN27@xmlTextRea:
pop edi
pop esi
; 1689 : return(xmlTextReaderRead(reader));
; 1690 : }
pop ebp
ret 0
_xmlTextReaderNext ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderExpand
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderExpand PROC ; COMDAT
; 1646 : xmlTextReaderExpand(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
je SHORT $LN3@xmlTextRea
; 1647 : if ((reader == NULL) || (reader->node == NULL))
mov eax, DWORD PTR [esi+64]
test eax, eax
je SHORT $LN3@xmlTextRea
; 1649 : if (reader->doc != NULL)
cmp DWORD PTR [esi+4], 0
jne SHORT $LN1@xmlTextRea
; 1650 : return(reader->node);
; 1651 : if (reader->ctxt == NULL)
cmp DWORD PTR [esi+20], 0
je SHORT $LN3@xmlTextRea
; 1652 : return(NULL);
; 1653 : if (xmlTextReaderDoExpand(reader) < 0)
push esi
call _xmlTextReaderDoExpand
add esp, 4
test eax, eax
js SHORT $LN3@xmlTextRea
; 1654 : return(NULL);
; 1655 : return(reader->node);
mov eax, DWORD PTR [esi+64]
pop esi
; 1656 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 1648 : return(NULL);
xor eax, eax
$LN1@xmlTextRea:
pop esi
; 1656 : }
pop ebp
ret 0
_xmlTextReaderExpand ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderCurrentDoc
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderCurrentDoc PROC ; COMDAT
; 4044 : xmlTextReaderCurrentDoc(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _reader$[ebp]
test ecx, ecx
je SHORT $LN5@xmlTextRea
; 4045 : if (reader == NULL)
; 4046 : return(NULL);
; 4047 : if (reader->doc != NULL)
mov eax, DWORD PTR [ecx+4]
test eax, eax
jne SHORT $LN1@xmlTextRea
; 4048 : return(reader->doc);
; 4049 : if ((reader->ctxt == NULL) || (reader->ctxt->myDoc == NULL))
mov eax, DWORD PTR [ecx+20]
test eax, eax
je SHORT $LN5@xmlTextRea
cmp DWORD PTR [eax+8], 0
je SHORT $LN5@xmlTextRea
; 4051 :
; 4052 : reader->preserve = 1;
mov DWORD PTR [ecx+80], 1
; 4053 : return(reader->ctxt->myDoc);
mov eax, DWORD PTR [eax+8]
; 4054 : }
pop ebp
ret 0
$LN5@xmlTextRea:
; 4050 : return(NULL);
xor eax, eax
$LN1@xmlTextRea:
; 4054 : }
pop ebp
ret 0
_xmlTextReaderCurrentDoc ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderPreservePattern
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_pattern$ = 12 ; size = 4
_namespaces$ = 16 ; size = 4
_xmlTextReaderPreservePattern PROC ; COMDAT
; 3994 : {
push ebp
mov ebp, esp
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edi, DWORD PTR _reader$[ebp]
test edi, edi
je SHORT $LN3@xmlTextRea
; 3995 : xmlPatternPtr comp;
; 3996 :
; 3997 : if ((reader == NULL) || (pattern == NULL))
mov eax, DWORD PTR _pattern$[ebp]
test eax, eax
je SHORT $LN3@xmlTextRea
; 3998 : return(-1);
; 3999 :
; 4000 : comp = xmlPatterncompile(pattern, reader->dict, 0, namespaces);
push DWORD PTR _namespaces$[ebp]
push 0
push DWORD PTR [edi+88]
push eax
call _xmlPatterncompile
mov esi, eax
add esp, 16 ; 00000010H
; 4001 : if (comp == NULL)
test esi, esi
je SHORT $LN3@xmlTextRea
; 4002 : return(-1);
; 4003 :
; 4004 : if (reader->patternMax <= 0) {
cmp DWORD PTR [edi+176], 0
jg SHORT $LN13@xmlTextRea
; 4005 : reader->patternMax = 4;
; 4006 : reader->patternTab = (xmlPatternPtr *) xmlMalloc(reader->patternMax *
push 16 ; 00000010H
mov DWORD PTR [edi+176], 4
call DWORD PTR _xmlMalloc
add esp, 4
mov DWORD PTR [edi+180], eax
; 4007 : sizeof(reader->patternTab[0]));
; 4008 : if (reader->patternTab == NULL) {
test eax, eax
jne SHORT $LN13@xmlTextRea
; 4009 : xmlGenericError(xmlGenericErrorContext, "xmlMalloc failed !\n");
call ___xmlGenericError
mov esi, eax
call ___xmlGenericErrorContext
push OFFSET ??_C@_0BE@MPMNBMMA@xmlMalloc?5failed?5?$CB?6@
push DWORD PTR [eax]
mov eax, DWORD PTR [esi]
call eax
add esp, 8
$LN3@xmlTextRea:
; 4028 : }
pop edi
or eax, -1
pop esi
pop ebp
ret 0
$LN13@xmlTextRea:
; 4010 : return (-1);
; 4011 : }
; 4012 : }
; 4013 : if (reader->patternNr >= reader->patternMax) {
mov ecx, DWORD PTR [edi+172]
mov eax, DWORD PTR [edi+176]
cmp ecx, eax
jl SHORT $LN14@xmlTextRea
; 4014 : xmlPatternPtr *tmp;
; 4015 : reader->patternMax *= 2;
add eax, eax
mov DWORD PTR [edi+176], eax
; 4016 : tmp = (xmlPatternPtr *) xmlRealloc(reader->patternTab,
shl eax, 2
push eax
push DWORD PTR [edi+180]
call DWORD PTR _xmlRealloc
add esp, 8
; 4017 : reader->patternMax *
; 4018 : sizeof(reader->patternTab[0]));
; 4019 : if (tmp == NULL) {
test eax, eax
jne SHORT $LN8@xmlTextRea
; 4020 : xmlGenericError(xmlGenericErrorContext, "xmlRealloc failed !\n");
call ___xmlGenericError
mov esi, eax
call ___xmlGenericErrorContext
push OFFSET ??_C@_0BF@DCPGEBNC@xmlRealloc?5failed?5?$CB?6@
push DWORD PTR [eax]
mov eax, DWORD PTR [esi]
call eax
; 4021 : reader->patternMax /= 2;
mov eax, DWORD PTR [edi+176]
add esp, 8
cdq
sub eax, edx
sar eax, 1
mov DWORD PTR [edi+176], eax
; 4028 : }
or eax, -1
pop edi
pop esi
pop ebp
ret 0
$LN8@xmlTextRea:
; 4022 : return (-1);
; 4023 : }
; 4024 : reader->patternTab = tmp;
mov ecx, DWORD PTR [edi+172]
mov DWORD PTR [edi+180], eax
$LN14@xmlTextRea:
; 4025 : }
; 4026 : reader->patternTab[reader->patternNr] = comp;
mov eax, DWORD PTR [edi+180]
mov DWORD PTR [eax+ecx*4], esi
; 4027 : return(reader->patternNr++);
mov eax, DWORD PTR [edi+172]
lea ecx, DWORD PTR [eax+1]
mov DWORD PTR [edi+172], ecx
pop edi
; 4028 : }
pop esi
pop ebp
ret 0
_xmlTextReaderPreservePattern ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderPreserve
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderPreserve PROC ; COMDAT
; 3950 : xmlTextReaderPreserve(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _reader$[ebp]
test ecx, ecx
je SHORT $LN15@xmlTextRea
; 3951 : xmlNodePtr cur, parent;
; 3952 :
; 3953 : if (reader == NULL)
; 3954 : return(NULL);
; 3955 :
; 3956 : if (reader->curnode != NULL)
mov eax, DWORD PTR [ecx+68]
test eax, eax
jne SHORT $LN17@xmlTextRea
; 3957 : cur = reader->curnode;
; 3958 : else
; 3959 : cur = reader->node;
mov eax, DWORD PTR [ecx+64]
; 3960 : if (cur == NULL)
test eax, eax
je SHORT $LN15@xmlTextRea
$LN17@xmlTextRea:
; 3962 :
; 3963 : if ((cur->type != XML_DOCUMENT_NODE) && (cur->type != XML_DTD_NODE)) {
mov edx, DWORD PTR [eax+4]
cmp edx, 9
je SHORT $LN8@xmlTextRea
cmp edx, 14 ; 0000000eH
je SHORT $LN8@xmlTextRea
; 3964 : cur->extra |= NODE_IS_PRESERVED;
; 3965 : cur->extra |= NODE_IS_SPRESERVED;
or WORD PTR [eax+58], 6
$LN8@xmlTextRea:
; 3966 : }
; 3967 : reader->preserves++;
inc DWORD PTR [ecx+184]
; 3968 :
; 3969 : parent = cur->parent;;
mov ecx, DWORD PTR [eax+20]
; 3970 : while (parent != NULL) {
test ecx, ecx
je SHORT $LN1@xmlTextRea
$LL2@xmlTextRea:
; 3971 : if (parent->type == XML_ELEMENT_NODE)
cmp DWORD PTR [ecx+4], 1
jne SHORT $LN9@xmlTextRea
; 3972 : parent->extra |= NODE_IS_PRESERVED;
or WORD PTR [ecx+58], 2
$LN9@xmlTextRea:
; 3973 : parent = parent->parent;
mov ecx, DWORD PTR [ecx+20]
test ecx, ecx
jne SHORT $LL2@xmlTextRea
; 3974 : }
; 3975 : return(cur);
; 3976 : }
pop ebp
ret 0
$LN15@xmlTextRea:
; 3961 : return(NULL);
xor eax, eax
$LN1@xmlTextRea:
; 3974 : }
; 3975 : return(cur);
; 3976 : }
pop ebp
ret 0
_xmlTextReaderPreserve ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderGetParserColumnNumber
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderGetParserColumnNumber PROC ; COMDAT
; 3911 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
je SHORT $LN3@xmlTextRea
; 3912 : if ((reader == NULL) || (reader->ctxt == NULL) ||
mov eax, DWORD PTR [eax+20]
test eax, eax
je SHORT $LN3@xmlTextRea
mov eax, DWORD PTR [eax+36]
test eax, eax
je SHORT $LN3@xmlTextRea
; 3915 : }
; 3916 : return (reader->ctxt->input->col);
mov eax, DWORD PTR [eax+32]
; 3917 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 3913 : (reader->ctxt->input == NULL)) {
; 3914 : return (0);
xor eax, eax
; 3917 : }
pop ebp
ret 0
_xmlTextReaderGetParserColumnNumber ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderGetParserLineNumber
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderGetParserLineNumber PROC ; COMDAT
; 3893 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
je SHORT $LN3@xmlTextRea
; 3894 : if ((reader == NULL) || (reader->ctxt == NULL) ||
mov eax, DWORD PTR [eax+20]
test eax, eax
je SHORT $LN3@xmlTextRea
mov eax, DWORD PTR [eax+36]
test eax, eax
je SHORT $LN3@xmlTextRea
; 3897 : }
; 3898 : return (reader->ctxt->input->line);
mov eax, DWORD PTR [eax+28]
; 3899 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 3895 : (reader->ctxt->input == NULL)) {
; 3896 : return (0);
xor eax, eax
; 3899 : }
pop ebp
ret 0
_xmlTextReaderGetParserLineNumber ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderCurrentNode
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderCurrentNode PROC ; COMDAT
; 3930 : xmlTextReaderCurrentNode(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
jne SHORT $LN2@xmlTextRea
; 3937 : }
pop ebp
ret 0
$LN2@xmlTextRea:
; 3931 : if (reader == NULL)
; 3932 : return(NULL);
; 3933 :
; 3934 : if (reader->curnode != NULL)
mov ecx, DWORD PTR [eax+68]
test ecx, ecx
je SHORT $LN3@xmlTextRea
; 3935 : return(reader->curnode);
mov eax, ecx
; 3937 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 3936 : return(reader->node);
mov eax, DWORD PTR [eax+64]
; 3937 : }
pop ebp
ret 0
_xmlTextReaderCurrentNode ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderGetParserProp
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_prop$ = 12 ; size = 4
_xmlTextReaderGetParserProp PROC ; COMDAT
; 3857 : xmlTextReaderGetParserProp(xmlTextReaderPtr reader, int prop) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edx, DWORD PTR _reader$[ebp]
test edx, edx
je SHORT $LN5@xmlTextRea
; 3858 : xmlParserProperties p = (xmlParserProperties) prop;
; 3859 : xmlParserCtxtPtr ctxt;
; 3860 :
; 3861 : if ((reader == NULL) || (reader->ctxt == NULL))
mov ecx, DWORD PTR [edx+20]
test ecx, ecx
je SHORT $LN5@xmlTextRea
; 3863 : ctxt = reader->ctxt;
; 3864 :
; 3865 : switch (p) {
mov eax, DWORD PTR _prop$[ebp]
dec eax
cmp eax, 3
ja SHORT $LN5@xmlTextRea
jmp DWORD PTR $LN16@xmlTextRea[eax*4]
$LN6@xmlTextRea:
; 3866 : case XML_PARSER_LOADDTD:
; 3867 : if ((ctxt->loadsubset != 0) || (ctxt->validate != 0))
cmp DWORD PTR [ecx+276], 0
jne SHORT $LN14@xmlTextRea
cmp DWORD PTR [ecx+104], 0
jne SHORT $LN14@xmlTextRea
$LN10@xmlTextRea:
; 3873 : return(0);
xor eax, eax
; 3878 : }
; 3879 : return(-1);
; 3880 : }
pop ebp
ret 0
$LN9@xmlTextRea:
; 3868 : return(1);
; 3869 : return(0);
; 3870 : case XML_PARSER_DEFAULTATTRS:
; 3871 : if (ctxt->loadsubset & XML_COMPLETE_ATTRS)
test BYTE PTR [ecx+276], 4
je SHORT $LN10@xmlTextRea
$LN14@xmlTextRea:
; 3872 : return(1);
mov eax, 1
; 3878 : }
; 3879 : return(-1);
; 3880 : }
pop ebp
ret 0
$LN11@xmlTextRea:
; 3874 : case XML_PARSER_VALIDATE:
; 3875 : return(reader->validate);
mov eax, DWORD PTR [edx+8]
; 3878 : }
; 3879 : return(-1);
; 3880 : }
pop ebp
ret 0
$LN12@xmlTextRea:
; 3876 : case XML_PARSER_SUBST_ENTITIES:
; 3877 : return(ctxt->replaceEntities);
mov eax, DWORD PTR [ecx+16]
; 3878 : }
; 3879 : return(-1);
; 3880 : }
pop ebp
ret 0
$LN5@xmlTextRea:
; 3862 : return(-1);
or eax, -1
; 3878 : }
; 3879 : return(-1);
; 3880 : }
pop ebp
ret 0
npad 3
$LN16@xmlTextRea:
DD $LN6@xmlTextRea
DD $LN9@xmlTextRea
DD $LN11@xmlTextRea
DD $LN12@xmlTextRea
_xmlTextReaderGetParserProp ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderSetParserProp
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_prop$ = 12 ; size = 4
_value$ = 16 ; size = 4
_xmlTextReaderSetParserProp PROC ; COMDAT
; 3800 : xmlTextReaderSetParserProp(xmlTextReaderPtr reader, int prop, int value) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edx, DWORD PTR _reader$[ebp]
test edx, edx
je $LN5@xmlTextRea
; 3801 : xmlParserProperties p = (xmlParserProperties) prop;
; 3802 : xmlParserCtxtPtr ctxt;
; 3803 :
; 3804 : if ((reader == NULL) || (reader->ctxt == NULL))
mov ecx, DWORD PTR [edx+20]
test ecx, ecx
je $LN5@xmlTextRea
; 3806 : ctxt = reader->ctxt;
; 3807 :
; 3808 : switch (p) {
mov eax, DWORD PTR _prop$[ebp]
dec eax
cmp eax, 3
ja $LN5@xmlTextRea
jmp DWORD PTR $LN23@xmlTextRea[eax*4]
$LN6@xmlTextRea:
; 3809 : case XML_PARSER_LOADDTD:
; 3810 : if (value != 0) {
cmp DWORD PTR _value$[ebp], 0
je SHORT $LN7@xmlTextRea
; 3811 : if (ctxt->loadsubset == 0) {
cmp DWORD PTR [ecx+276], 0
jne SHORT $LN17@xmlTextRea
; 3812 : if (reader->mode != XML_TEXTREADER_MODE_INITIAL)
cmp DWORD PTR [edx], 0
jne SHORT $LN5@xmlTextRea
; 3813 : return(-1);
; 3814 : ctxt->loadsubset = XML_DETECT_IDS;
mov DWORD PTR [ecx+276], 2
; 3834 : }
; 3835 : return(0);
xor eax, eax
; 3843 : }
; 3844 : return(-1);
; 3845 : }
pop ebp
ret 0
$LN7@xmlTextRea:
; 3815 : }
; 3816 : } else {
; 3817 : ctxt->loadsubset = 0;
mov DWORD PTR [ecx+276], 0
; 3834 : }
; 3835 : return(0);
xor eax, eax
; 3843 : }
; 3844 : return(-1);
; 3845 : }
pop ebp
ret 0
$LN11@xmlTextRea:
; 3818 : }
; 3819 : return(0);
; 3820 : case XML_PARSER_DEFAULTATTRS:
; 3821 : if (value != 0) {
cmp DWORD PTR _value$[ebp], 0
mov eax, DWORD PTR [ecx+276]
je SHORT $LN12@xmlTextRea
; 3822 : ctxt->loadsubset |= XML_COMPLETE_ATTRS;
or eax, 4
mov DWORD PTR [ecx+276], eax
; 3834 : }
; 3835 : return(0);
xor eax, eax
; 3843 : }
; 3844 : return(-1);
; 3845 : }
pop ebp
ret 0
$LN12@xmlTextRea:
; 3823 : } else {
; 3824 : if (ctxt->loadsubset & XML_COMPLETE_ATTRS)
test al, 4
je SHORT $LN17@xmlTextRea
; 3825 : ctxt->loadsubset -= XML_COMPLETE_ATTRS;
add eax, -4 ; fffffffcH
mov DWORD PTR [ecx+276], eax
; 3834 : }
; 3835 : return(0);
xor eax, eax
; 3843 : }
; 3844 : return(-1);
; 3845 : }
pop ebp
ret 0
$LN15@xmlTextRea:
; 3826 : }
; 3827 : return(0);
; 3828 : case XML_PARSER_VALIDATE:
; 3829 : if (value != 0) {
cmp DWORD PTR _value$[ebp], 0
je SHORT $LN16@xmlTextRea
; 3830 : ctxt->validate = 1;
mov DWORD PTR [ecx+104], 1
; 3834 : }
; 3835 : return(0);
xor eax, eax
mov DWORD PTR [edx+8], 1
; 3843 : }
; 3844 : return(-1);
; 3845 : }
pop ebp
ret 0
$LN16@xmlTextRea:
; 3831 : reader->validate = XML_TEXTREADER_VALIDATE_DTD;
; 3832 : } else {
; 3833 : ctxt->validate = 0;
mov DWORD PTR [ecx+104], 0
$LN17@xmlTextRea:
; 3834 : }
; 3835 : return(0);
xor eax, eax
; 3843 : }
; 3844 : return(-1);
; 3845 : }
pop ebp
ret 0
$LN18@xmlTextRea:
; 3836 : case XML_PARSER_SUBST_ENTITIES:
; 3837 : if (value != 0) {
; 3838 : ctxt->replaceEntities = 1;
; 3839 : } else {
; 3840 : ctxt->replaceEntities = 0;
; 3841 : }
; 3842 : return(0);
xor eax, eax
cmp DWORD PTR _value$[ebp], eax
setne al
mov DWORD PTR [ecx+16], eax
xor eax, eax
; 3843 : }
; 3844 : return(-1);
; 3845 : }
pop ebp
ret 0
$LN5@xmlTextRea:
; 3805 : return(-1);
or eax, -1
; 3843 : }
; 3844 : return(-1);
; 3845 : }
pop ebp
ret 0
$LN23@xmlTextRea:
DD $LN6@xmlTextRea
DD $LN11@xmlTextRea
DD $LN15@xmlTextRea
DD $LN18@xmlTextRea
_xmlTextReaderSetParserProp ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderConstEncoding
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderConstEncoding PROC ; COMDAT
; 2933 : xmlTextReaderConstEncoding(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _reader$[ebp]
test ecx, ecx
je SHORT $LN11@xmlTextRea
; 2934 : xmlDocPtr doc = NULL;
; 2935 : if (reader == NULL)
; 2936 : return(NULL);
; 2937 : if (reader->doc != NULL)
mov eax, DWORD PTR [ecx+4]
test eax, eax
jne SHORT $LN13@xmlTextRea
; 2938 : doc = reader->doc;
; 2939 : else if (reader->ctxt != NULL)
mov eax, DWORD PTR [ecx+20]
test eax, eax
je SHORT $LN11@xmlTextRea
; 2940 : doc = reader->ctxt->myDoc;
mov eax, DWORD PTR [eax+8]
; 2941 : if (doc == NULL)
test eax, eax
je SHORT $LN11@xmlTextRea
$LN13@xmlTextRea:
; 2942 : return(NULL);
; 2943 :
; 2944 : if (doc->encoding == NULL)
mov eax, DWORD PTR [eax+60]
test eax, eax
je SHORT $LN11@xmlTextRea
; 2946 : else
; 2947 : return(CONSTSTR(doc->encoding));
push -1
push eax
push DWORD PTR [ecx+88]
call _xmlDictLookup
add esp, 12 ; 0000000cH
; 2948 : }
pop ebp
ret 0
$LN11@xmlTextRea:
; 2945 : return(NULL);
xor eax, eax
; 2948 : }
pop ebp
ret 0
_xmlTextReaderConstEncoding ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderNormalization
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderNormalization PROC ; COMDAT
; 3775 : xmlTextReaderNormalization(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
xor eax, eax
cmp DWORD PTR _reader$[ebp], eax
setne al
lea eax, DWORD PTR [eax*2-1]
; 3776 : if (reader == NULL)
; 3777 : return(-1);
; 3778 : return(1);
; 3779 : }
pop ebp
ret 0
_xmlTextReaderNormalization ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderMoveToElement
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderMoveToElement PROC ; COMDAT
; 2865 : xmlTextReaderMoveToElement(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
je SHORT $LN7@xmlTextRea
; 2866 : if (reader == NULL)
; 2867 : return(-1);
; 2868 : if (reader->node == NULL)
mov ecx, DWORD PTR [eax+64]
test ecx, ecx
je SHORT $LN7@xmlTextRea
; 2870 : if (reader->node->type != XML_ELEMENT_NODE)
cmp DWORD PTR [ecx+4], 1
jne SHORT $LN5@xmlTextRea
; 2871 : return(0);
; 2872 : if (reader->curnode != NULL) {
cmp DWORD PTR [eax+68], 0
je SHORT $LN5@xmlTextRea
; 2873 : reader->curnode = NULL;
mov DWORD PTR [eax+68], 0
; 2874 : return(1);
mov eax, 1
; 2877 : }
pop ebp
ret 0
$LN5@xmlTextRea:
; 2875 : }
; 2876 : return(0);
xor eax, eax
; 2877 : }
pop ebp
ret 0
$LN7@xmlTextRea:
; 2869 : return(-1);
or eax, -1
; 2877 : }
pop ebp
ret 0
_xmlTextReaderMoveToElement ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderMoveToNextAttribute
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderMoveToNextAttribute PROC ; COMDAT
; 2826 : xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
je SHORT $LN12@xmlTextRea
; 2827 : if (reader == NULL)
; 2828 : return(-1);
; 2829 : if (reader->node == NULL)
mov ecx, DWORD PTR [eax+64]
test ecx, ecx
je SHORT $LN12@xmlTextRea
; 2831 : if (reader->node->type != XML_ELEMENT_NODE)
cmp DWORD PTR [ecx+4], 1
jne SHORT $LN10@xmlTextRea
; 2832 : return(0);
; 2833 : if (reader->curnode == NULL)
mov edx, DWORD PTR [eax+68]
test edx, edx
jne SHORT $LN5@xmlTextRea
; 2834 : return(xmlTextReaderMoveToFirstAttribute(reader));
mov DWORD PTR _reader$[ebp], eax
; 2853 : }
pop ebp
; 2834 : return(xmlTextReaderMoveToFirstAttribute(reader));
jmp _xmlTextReaderMoveToFirstAttribute
$LN5@xmlTextRea:
; 2835 :
; 2836 : if (reader->curnode->type == XML_NAMESPACE_DECL) {
cmp DWORD PTR [edx+4], 18 ; 00000012H
jne SHORT $LN6@xmlTextRea
; 2837 : xmlNsPtr ns = (xmlNsPtr) reader->curnode;
; 2838 : if (ns->next != NULL) {
mov edx, DWORD PTR [edx]
test edx, edx
je SHORT $LN8@xmlTextRea
; 2839 : reader->curnode = (xmlNodePtr) ns->next;
mov DWORD PTR [eax+68], edx
; 2840 : return(1);
mov eax, 1
; 2853 : }
pop ebp
ret 0
$LN8@xmlTextRea:
; 2841 : }
; 2842 : if (reader->node->properties != NULL) {
mov ecx, DWORD PTR [ecx+44]
$LN15@xmlTextRea:
; 2853 : }
test ecx, ecx
je SHORT $LN10@xmlTextRea
mov DWORD PTR [eax+68], ecx
mov eax, 1
pop ebp
ret 0
$LN6@xmlTextRea:
; 2843 : reader->curnode = (xmlNodePtr) reader->node->properties;
; 2844 : return(1);
; 2845 : }
; 2846 : return(0);
; 2847 : } else if ((reader->curnode->type == XML_ATTRIBUTE_NODE) &&
cmp DWORD PTR [edx+4], 2
jne SHORT $LN10@xmlTextRea
mov ecx, DWORD PTR [edx+24]
; 2848 : (reader->curnode->next != NULL)) {
; 2849 : reader->curnode = reader->curnode->next;
; 2850 : return(1);
jmp SHORT $LN15@xmlTextRea
$LN10@xmlTextRea:
; 2851 : }
; 2852 : return(0);
xor eax, eax
; 2853 : }
pop ebp
ret 0
$LN12@xmlTextRea:
; 2830 : return(-1);
or eax, -1
; 2853 : }
pop ebp
ret 0
_xmlTextReaderMoveToNextAttribute ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderMoveToFirstAttribute
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderMoveToFirstAttribute PROC ; COMDAT
; 2797 : xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _reader$[ebp]
test ecx, ecx
je SHORT $LN8@xmlTextRea
; 2798 : if (reader == NULL)
; 2799 : return(-1);
; 2800 : if (reader->node == NULL)
mov eax, DWORD PTR [ecx+64]
test eax, eax
je SHORT $LN8@xmlTextRea
; 2802 : if (reader->node->type != XML_ELEMENT_NODE)
cmp DWORD PTR [eax+4], 1
jne SHORT $LN6@xmlTextRea
; 2803 : return(0);
; 2804 :
; 2805 : if (reader->node->nsDef != NULL) {
mov edx, DWORD PTR [eax+48]
test edx, edx
je SHORT $LN5@xmlTextRea
; 2806 : reader->curnode = (xmlNodePtr) reader->node->nsDef;
mov DWORD PTR [ecx+68], edx
; 2807 : return(1);
mov eax, 1
; 2814 : }
pop ebp
ret 0
$LN5@xmlTextRea:
; 2808 : }
; 2809 : if (reader->node->properties != NULL) {
mov eax, DWORD PTR [eax+44]
test eax, eax
je SHORT $LN6@xmlTextRea
; 2810 : reader->curnode = (xmlNodePtr) reader->node->properties;
mov DWORD PTR [ecx+68], eax
; 2811 : return(1);
mov eax, 1
; 2814 : }
pop ebp
ret 0
$LN6@xmlTextRea:
; 2812 : }
; 2813 : return(0);
xor eax, eax
; 2814 : }
pop ebp
ret 0
$LN8@xmlTextRea:
; 2801 : return(-1);
or eax, -1
; 2814 : }
pop ebp
ret 0
_xmlTextReaderMoveToFirstAttribute ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderMoveToAttributeNs
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_localName$ = 12 ; size = 4
_namespaceURI$ = 16 ; size = 4
_xmlTextReaderMoveToAttributeNs PROC ; COMDAT
; 2739 : const xmlChar *localName, const xmlChar *namespaceURI) {
push ebp
mov ebp, esp
push ebx
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _reader$[ebp]
xor ebx, ebx
test ecx, ecx
je $LN7@xmlTextRea
; 2740 : xmlAttrPtr prop;
; 2741 : xmlNodePtr node;
; 2742 : xmlNsPtr ns;
; 2743 : xmlChar *prefix = NULL;
; 2744 :
; 2745 : if ((reader == NULL) || (localName == NULL) || (namespaceURI == NULL))
mov edi, DWORD PTR _localName$[ebp]
test edi, edi
je $LN7@xmlTextRea
mov eax, DWORD PTR _namespaceURI$[ebp]
test eax, eax
je $LN7@xmlTextRea
; 2746 : return(-1);
; 2747 : if (reader->node == NULL)
mov esi, DWORD PTR [ecx+64]
test esi, esi
je $LN7@xmlTextRea
; 2748 : return(-1);
; 2749 : if (reader->node->type != XML_ELEMENT_NODE)
cmp DWORD PTR [esi+4], 1
jne $LN3@xmlTextRea
; 2750 : return(0);
; 2751 : node = reader->node;
; 2752 :
; 2753 : if (xmlStrEqual(namespaceURI, BAD_CAST "http://www.w3.org/2000/xmlns/")) {
push OFFSET ??_C@_0BO@GBJIDPIB@http?3?1?1www?4w3?4org?12000?1xmlns?1@
push eax
call _xmlStrEqual
add esp, 8
test eax, eax
je SHORT $LN10@xmlTextRea
; 2754 : if (! xmlStrEqual(localName, BAD_CAST "xmlns")) {
push OFFSET ??_C@_05PPEFOGKI@xmlns@
push edi
call _xmlStrEqual
add esp, 8
test eax, eax
; 2755 : prefix = BAD_CAST localName;
; 2756 : }
; 2757 : ns = reader->node->nsDef;
mov eax, DWORD PTR _reader$[ebp]
cmove ebx, edi
mov eax, DWORD PTR [eax+64]
mov esi, DWORD PTR [eax+48]
; 2758 : while (ns != NULL) {
test esi, esi
je SHORT $LN3@xmlTextRea
npad 6
$LL2@xmlTextRea:
; 2759 : if ((prefix == NULL && ns->prefix == NULL) ||
test ebx, ebx
jne SHORT $LN27@xmlTextRea
cmp DWORD PTR [esi+12], ebx
je SHORT $LN13@xmlTextRea
$LN27@xmlTextRea:
mov eax, DWORD PTR [esi+12]
test eax, eax
je SHORT $LN12@xmlTextRea
push edi
push eax
call _xmlStrEqual
add esp, 8
test eax, eax
jne SHORT $LN13@xmlTextRea
$LN12@xmlTextRea:
; 2760 : ((ns->prefix != NULL) && (xmlStrEqual(ns->prefix, localName)))) {
; 2761 : reader->curnode = (xmlNodePtr) ns;
; 2762 : return(1);
; 2763 : }
; 2764 : ns = ns->next;
mov esi, DWORD PTR [esi]
test esi, esi
jne SHORT $LL2@xmlTextRea
; 2783 : }
; 2784 : return(0);
; 2785 : }
pop edi
pop esi
xor eax, eax
pop ebx
pop ebp
ret 0
$LN13@xmlTextRea:
mov eax, DWORD PTR _reader$[ebp]
pop edi
mov DWORD PTR [eax+68], esi
mov eax, 1
pop esi
pop ebx
pop ebp
ret 0
$LN10@xmlTextRea:
; 2765 : }
; 2766 : return(0);
; 2767 : }
; 2768 :
; 2769 : prop = node->properties;
mov esi, DWORD PTR [esi+44]
; 2770 : while (prop != NULL) {
test esi, esi
je SHORT $LN3@xmlTextRea
mov ebx, DWORD PTR _namespaceURI$[ebp]
$LL4@xmlTextRea:
; 2771 : /*
; 2772 : * One need to have
; 2773 : * - same attribute names
; 2774 : * - and the attribute carrying that namespace
; 2775 : */
; 2776 : if (xmlStrEqual(prop->name, localName) &&
push edi
push DWORD PTR [esi+8]
call _xmlStrEqual
add esp, 8
test eax, eax
je SHORT $LN15@xmlTextRea
mov eax, DWORD PTR [esi+36]
test eax, eax
je SHORT $LN15@xmlTextRea
push ebx
push DWORD PTR [eax+8]
call _xmlStrEqual
add esp, 8
test eax, eax
jne SHORT $LN13@xmlTextRea
$LN15@xmlTextRea:
; 2777 : ((prop->ns != NULL) &&
; 2778 : (xmlStrEqual(prop->ns->href, namespaceURI)))) {
; 2779 : reader->curnode = (xmlNodePtr) prop;
; 2780 : return(1);
; 2781 : }
; 2782 : prop = prop->next;
mov esi, DWORD PTR [esi+24]
test esi, esi
jne SHORT $LL4@xmlTextRea
$LN3@xmlTextRea:
pop edi
; 2783 : }
; 2784 : return(0);
; 2785 : }
pop esi
xor eax, eax
pop ebx
pop ebp
ret 0
$LN7@xmlTextRea:
pop edi
pop esi
or eax, -1
pop ebx
pop ebp
ret 0
_xmlTextReaderMoveToAttributeNs ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderMoveToAttribute
_TEXT SEGMENT
_prefix$ = -4 ; size = 4
_reader$ = 8 ; size = 4
_name$ = 12 ; size = 4
_xmlTextReaderMoveToAttribute PROC ; COMDAT
; 2634 : xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader, const xmlChar *name) {
push ebp
mov ebp, esp
push ecx
push ebx
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
mov DWORD PTR _prefix$[ebp], 0
test esi, esi
je $LN11@xmlTextRea
; 2635 : xmlChar *prefix = NULL;
; 2636 : xmlChar *localname;
; 2637 : xmlNsPtr ns;
; 2638 : xmlAttrPtr prop;
; 2639 :
; 2640 : if ((reader == NULL) || (name == NULL))
mov ebx, DWORD PTR _name$[ebp]
test ebx, ebx
je $LN11@xmlTextRea
; 2642 : if (reader->node == NULL)
mov eax, DWORD PTR [esi+64]
test eax, eax
je $LN11@xmlTextRea
; 2643 : return(-1);
; 2644 :
; 2645 : /* TODO: handle the xmlDecl */
; 2646 : if (reader->node->type != XML_ELEMENT_NODE)
cmp DWORD PTR [eax+4], 1
push edi
jne $LN23@xmlTextRea
; 2647 : return(0);
; 2648 :
; 2649 : localname = xmlSplitQName2(name, &prefix);
lea eax, DWORD PTR _prefix$[ebp]
push eax
push ebx
call _xmlSplitQName2
add esp, 8
mov edi, eax
; 2650 : if (localname == NULL) {
push OFFSET ??_C@_05PPEFOGKI@xmlns@
test edi, edi
jne $LN14@xmlTextRea
; 2651 : /*
; 2652 : * Namespace default decl
; 2653 : */
; 2654 : if (xmlStrEqual(name, BAD_CAST "xmlns")) {
push ebx
call _xmlStrEqual
mov ecx, DWORD PTR [esi+64]
add esp, 8
test eax, eax
je SHORT $LN15@xmlTextRea
; 2655 : ns = reader->node->nsDef;
mov eax, DWORD PTR [ecx+48]
; 2656 : while (ns != NULL) {
test eax, eax
je $LN23@xmlTextRea
npad 6
$LL2@xmlTextRea:
; 2657 : if (ns->prefix == NULL) {
cmp DWORD PTR [eax+12], 0
je SHORT $LN31@xmlTextRea
; 2659 : return(1);
; 2660 : }
; 2661 : ns = ns->next;
mov eax, DWORD PTR [eax]
test eax, eax
jne SHORT $LL2@xmlTextRea
; 2723 : return(1);
; 2724 : }
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN31@xmlTextRea:
; 2658 : reader->curnode = (xmlNodePtr) ns;
mov DWORD PTR [esi+68], eax
$LN25@xmlTextRea:
pop edi
pop esi
; 2676 : return(1);
mov eax, 1
; 2723 : return(1);
; 2724 : }
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN15@xmlTextRea:
; 2662 : }
; 2663 : return(0);
; 2664 : }
; 2665 :
; 2666 : prop = reader->node->properties;
mov esi, DWORD PTR [ecx+44]
; 2667 : while (prop != NULL) {
test esi, esi
je $LN23@xmlTextRea
npad 3
$LL4@xmlTextRea:
; 2668 : /*
; 2669 : * One need to have
; 2670 : * - same attribute names
; 2671 : * - and the attribute carrying that namespace
; 2672 : */
; 2673 : if ((xmlStrEqual(prop->name, name)) &&
push ebx
push DWORD PTR [esi+8]
call _xmlStrEqual
add esp, 8
test eax, eax
je SHORT $LN17@xmlTextRea
mov eax, DWORD PTR [esi+36]
test eax, eax
je SHORT $LN18@xmlTextRea
cmp DWORD PTR [eax+12], 0
je SHORT $LN18@xmlTextRea
$LN17@xmlTextRea:
; 2677 : }
; 2678 : prop = prop->next;
mov esi, DWORD PTR [esi+24]
test esi, esi
jne SHORT $LL4@xmlTextRea
; 2716 : return(0);
pop edi
pop esi
xor eax, eax
; 2723 : return(1);
; 2724 : }
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN18@xmlTextRea:
; 2674 : ((prop->ns == NULL) || (prop->ns->prefix == NULL))) {
; 2675 : reader->curnode = (xmlNodePtr) prop;
mov eax, DWORD PTR _reader$[ebp]
pop edi
mov DWORD PTR [eax+68], esi
; 2676 : return(1);
mov eax, 1
pop esi
; 2723 : return(1);
; 2724 : }
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN14@xmlTextRea:
; 2679 : }
; 2680 : return(0);
; 2681 : }
; 2682 :
; 2683 : /*
; 2684 : * Namespace default decl
; 2685 : */
; 2686 : if (xmlStrEqual(prefix, BAD_CAST "xmlns")) {
push DWORD PTR _prefix$[ebp]
call _xmlStrEqual
mov esi, DWORD PTR [esi+64]
add esp, 8
test eax, eax
je SHORT $LN19@xmlTextRea
; 2687 : ns = reader->node->nsDef;
mov esi, DWORD PTR [esi+48]
; 2688 : while (ns != NULL) {
test esi, esi
je SHORT $not_found$51
$LL6@xmlTextRea:
; 2689 : if ((ns->prefix != NULL) && (xmlStrEqual(ns->prefix, localname))) {
mov eax, DWORD PTR [esi+12]
test eax, eax
je SHORT $LN20@xmlTextRea
push edi
push eax
call _xmlStrEqual
add esp, 8
test eax, eax
jne SHORT $found$52
$LN20@xmlTextRea:
; 2690 : reader->curnode = (xmlNodePtr) ns;
; 2691 : goto found;
; 2692 : }
; 2693 : ns = ns->next;
mov esi, DWORD PTR [esi]
test esi, esi
jne SHORT $LL6@xmlTextRea
$not_found$51:
; 2710 : }
; 2711 : not_found:
; 2712 : if (localname != NULL)
; 2713 : xmlFree(localname);
push edi
call DWORD PTR _xmlFree
; 2714 : if (prefix != NULL)
mov eax, DWORD PTR _prefix$[ebp]
add esp, 4
test eax, eax
je SHORT $LN23@xmlTextRea
; 2715 : xmlFree(prefix);
push eax
call DWORD PTR _xmlFree
add esp, 4
$LN23@xmlTextRea:
; 2716 : return(0);
pop edi
pop esi
xor eax, eax
; 2723 : return(1);
; 2724 : }
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN19@xmlTextRea:
; 2694 : }
; 2695 : goto not_found;
; 2696 : }
; 2697 : prop = reader->node->properties;
mov esi, DWORD PTR [esi+44]
; 2698 : while (prop != NULL) {
test esi, esi
je SHORT $not_found$51
npad 2
$LL8@xmlTextRea:
; 2699 : /*
; 2700 : * One need to have
; 2701 : * - same attribute names
; 2702 : * - and the attribute carrying that namespace
; 2703 : */
; 2704 : if ((xmlStrEqual(prop->name, localname)) &&
; 2705 : (prop->ns != NULL) && (xmlStrEqual(prop->ns->prefix, prefix))) {
push edi
push DWORD PTR [esi+8]
call _xmlStrEqual
add esp, 8
test eax, eax
je SHORT $LN21@xmlTextRea
mov eax, DWORD PTR [esi+36]
test eax, eax
je SHORT $LN21@xmlTextRea
push DWORD PTR _prefix$[ebp]
push DWORD PTR [eax+12]
call _xmlStrEqual
add esp, 8
test eax, eax
jne SHORT $found$52
$LN21@xmlTextRea:
; 2706 : reader->curnode = (xmlNodePtr) prop;
; 2707 : goto found;
; 2708 : }
; 2709 : prop = prop->next;
mov esi, DWORD PTR [esi+24]
test esi, esi
jne SHORT $LL8@xmlTextRea
; 2698 : while (prop != NULL) {
jmp SHORT $not_found$51
$found$52:
; 2717 :
; 2718 : found:
; 2719 : if (localname != NULL)
mov eax, DWORD PTR _reader$[ebp]
; 2720 : xmlFree(localname);
push edi
mov DWORD PTR [eax+68], esi
call DWORD PTR _xmlFree
; 2721 : if (prefix != NULL)
mov eax, DWORD PTR _prefix$[ebp]
add esp, 4
test eax, eax
je $LN25@xmlTextRea
; 2722 : xmlFree(prefix);
push eax
call DWORD PTR _xmlFree
add esp, 4
mov eax, 1
pop edi
pop esi
; 2723 : return(1);
; 2724 : }
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN11@xmlTextRea:
pop esi
; 2641 : return(-1);
or eax, -1
; 2723 : return(1);
; 2724 : }
pop ebx
mov esp, ebp
pop ebp
ret 0
_xmlTextReaderMoveToAttribute ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderMoveToAttributeNo
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_no$ = 12 ; size = 4
_xmlTextReaderMoveToAttributeNo PROC ; COMDAT
; 2585 : xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader, int no) {
push ebp
mov ebp, esp
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
je SHORT $LN24@xmlTextRea
; 2586 : int i;
; 2587 : xmlAttrPtr cur;
; 2588 : xmlNsPtr ns;
; 2589 :
; 2590 : if (reader == NULL)
; 2591 : return(-1);
; 2592 : if (reader->node == NULL)
mov edi, DWORD PTR [esi+64]
test edi, edi
je SHORT $LN24@xmlTextRea
; 2593 : return(-1);
; 2594 : /* TODO: handle the xmlDecl */
; 2595 : if (reader->node->type != XML_ELEMENT_NODE)
cmp DWORD PTR [edi+4], 1
jne SHORT $LN24@xmlTextRea
; 2597 :
; 2598 : reader->curnode = NULL;
; 2599 :
; 2600 : ns = reader->node->nsDef;
; 2601 : for (i = 0;(i < no) && (ns != NULL);i++) {
mov edx, DWORD PTR _no$[ebp]
xor eax, eax
mov DWORD PTR [esi+68], 0
mov ecx, DWORD PTR [edi+48]
test edx, edx
jle SHORT $LN3@xmlTextRea
$LL4@xmlTextRea:
test ecx, ecx
je SHORT $LN11@xmlTextRea
; 2602 : ns = ns->next;
mov ecx, DWORD PTR [ecx]
inc eax
cmp eax, edx
jl SHORT $LL4@xmlTextRea
$LN3@xmlTextRea:
; 2603 : }
; 2604 : if (ns != NULL) {
test ecx, ecx
jne SHORT $LN6@xmlTextRea
$LN11@xmlTextRea:
; 2605 : reader->curnode = (xmlNodePtr) ns;
; 2606 : return(1);
; 2607 : }
; 2608 :
; 2609 : cur = reader->node->properties;
mov ecx, DWORD PTR [edi+44]
; 2610 : if (cur == NULL)
test ecx, ecx
je SHORT $LN17@xmlTextRea
; 2611 : return(0);
; 2612 : for (;i < no;i++) {
cmp eax, edx
jge SHORT $LN6@xmlTextRea
$LL7@xmlTextRea:
; 2613 : cur = cur->next;
mov ecx, DWORD PTR [ecx+24]
; 2614 : if (cur == NULL)
test ecx, ecx
je SHORT $LN17@xmlTextRea
; 2611 : return(0);
; 2612 : for (;i < no;i++) {
inc eax
cmp eax, edx
jl SHORT $LL7@xmlTextRea
$LN6@xmlTextRea:
pop edi
; 2616 : }
; 2617 : /* TODO walk the DTD if present */
; 2618 :
; 2619 : reader->curnode = (xmlNodePtr) cur;
; 2620 : return(1);
; 2621 : }
mov DWORD PTR [esi+68], ecx
mov eax, 1
pop esi
pop ebp
ret 0
$LN17@xmlTextRea:
pop edi
; 2615 : return(0);
xor eax, eax
; 2616 : }
; 2617 : /* TODO walk the DTD if present */
; 2618 :
; 2619 : reader->curnode = (xmlNodePtr) cur;
; 2620 : return(1);
; 2621 : }
pop esi
pop ebp
ret 0
$LN24@xmlTextRea:
pop edi
; 2596 : return(-1);
or eax, -1
; 2616 : }
; 2617 : /* TODO walk the DTD if present */
; 2618 :
; 2619 : reader->curnode = (xmlNodePtr) cur;
; 2620 : return(1);
; 2621 : }
pop esi
pop ebp
ret 0
_xmlTextReaderMoveToAttributeNo ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderLookupNamespace
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_prefix$ = 12 ; size = 4
_xmlTextReaderLookupNamespace PROC ; COMDAT
; 2559 : xmlTextReaderLookupNamespace(xmlTextReaderPtr reader, const xmlChar *prefix) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
je SHORT $LN6@xmlTextRea
; 2560 : xmlNsPtr ns;
; 2561 :
; 2562 : if (reader == NULL)
; 2563 : return(NULL);
; 2564 : if (reader->node == NULL)
mov eax, DWORD PTR [eax+64]
test eax, eax
je SHORT $LN6@xmlTextRea
; 2565 : return(NULL);
; 2566 :
; 2567 : ns = xmlSearchNs(reader->node->doc, reader->node, prefix);
push DWORD PTR _prefix$[ebp]
push eax
push DWORD PTR [eax+32]
call _xmlSearchNs
add esp, 12 ; 0000000cH
; 2568 : if (ns == NULL)
test eax, eax
je SHORT $LN6@xmlTextRea
; 2570 : return(xmlStrdup(ns->href));
push DWORD PTR [eax+8]
call _xmlStrdup
add esp, 4
; 2571 : }
pop ebp
ret 0
$LN6@xmlTextRea:
; 2569 : return(NULL);
xor eax, eax
; 2571 : }
pop ebp
ret 0
_xmlTextReaderLookupNamespace ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderGetRemainder
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderGetRemainder PROC ; COMDAT
; 2511 : xmlTextReaderGetRemainder(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
je $LN10@xmlTextRea
; 2512 : xmlParserInputBufferPtr ret = NULL;
; 2513 :
; 2514 : if (reader == NULL)
; 2515 : return(NULL);
; 2516 : if (reader->node == NULL)
cmp DWORD PTR [esi+64], 0
je $LN10@xmlTextRea
; 2517 : return(NULL);
; 2518 :
; 2519 : reader->node = NULL;
; 2520 : reader->curnode = NULL;
; 2521 : reader->mode = XML_TEXTREADER_MODE_EOF;
; 2522 : if (reader->ctxt != NULL) {
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [esi+64], 0
mov DWORD PTR [esi+68], 0
mov DWORD PTR [esi], 3
test eax, eax
je SHORT $LN5@xmlTextRea
; 2523 : xmlStopParser(reader->ctxt);
push eax
call _xmlStopParser
; 2524 : if (reader->ctxt->myDoc != NULL) {
mov eax, DWORD PTR [esi+20]
add esp, 4
mov ecx, DWORD PTR [eax+8]
test ecx, ecx
je SHORT $LN5@xmlTextRea
; 2525 : if (reader->preserve == 0)
cmp DWORD PTR [esi+80], 0
jne SHORT $LN6@xmlTextRea
; 2526 : xmlTextReaderFreeDoc(reader, reader->ctxt->myDoc);
push ecx
push esi
call _xmlTextReaderFreeDoc
mov eax, DWORD PTR [esi+20]
add esp, 8
$LN6@xmlTextRea:
; 2527 : reader->ctxt->myDoc = NULL;
mov DWORD PTR [eax+8], 0
$LN5@xmlTextRea:
; 2528 : }
; 2529 : }
; 2530 : if (reader->allocs & XML_TEXTREADER_INPUT) {
mov ecx, DWORD PTR [esi+12]
test cl, 1
je SHORT $LN7@xmlTextRea
; 2531 : ret = reader->input;
mov eax, DWORD PTR [esi+28]
; 2532 : reader->input = NULL;
; 2533 : reader->allocs -= XML_TEXTREADER_INPUT;
dec ecx
mov DWORD PTR [esi+28], 0
mov DWORD PTR [esi+12], ecx
pop esi
; 2542 : return(NULL);
; 2543 : }
; 2544 : return(ret);
; 2545 : }
pop ebp
ret 0
$LN7@xmlTextRea:
; 2534 : } else {
; 2535 : /*
; 2536 : * Hum, one may need to duplicate the data structure because
; 2537 : * without reference counting the input may be freed twice:
; 2538 : * - by the layer which allocated it.
; 2539 : * - by the layer to which would have been returned to.
; 2540 : */
; 2541 : TODO
call ___xmlGenericError
mov esi, eax
call ___xmlGenericErrorContext
push 2541 ; 000009edH
push OFFSET ??_C@_0GL@PIJMIJNC@c?3?2users?2dag?2documents?2_clients@
push OFFSET ??_C@_0BO@MDEMDPPE@Unimplemented?5block?5at?5?$CFs?3?$CFd?6@
push DWORD PTR [eax]
mov eax, DWORD PTR [esi]
call eax
add esp, 16 ; 00000010H
$LN10@xmlTextRea:
; 2542 : return(NULL);
; 2543 : }
; 2544 : return(ret);
; 2545 : }
xor eax, eax
pop esi
pop ebp
ret 0
_xmlTextReaderGetRemainder ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderGetAttributeNs
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_localName$ = 12 ; size = 4
_namespaceURI$ = 16 ; size = 4
_xmlTextReaderGetAttributeNs PROC ; COMDAT
; 2462 : const xmlChar *namespaceURI) {
push ebp
mov ebp, esp
push ebx
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
xor ebx, ebx
test esi, esi
je SHORT $LN5@xmlTextRea
; 2463 : xmlChar *prefix = NULL;
; 2464 : xmlNsPtr ns;
; 2465 :
; 2466 : if ((reader == NULL) || (localName == NULL))
mov edi, DWORD PTR _localName$[ebp]
test edi, edi
je SHORT $LN5@xmlTextRea
; 2467 : return(NULL);
; 2468 : if (reader->node == NULL)
mov eax, DWORD PTR [esi+64]
test eax, eax
je SHORT $LN5@xmlTextRea
; 2469 : return(NULL);
; 2470 : if (reader->curnode != NULL)
cmp DWORD PTR [esi+68], ebx
jne SHORT $LN5@xmlTextRea
; 2471 : return(NULL);
; 2472 :
; 2473 : /* TODO: handle the xmlDecl */
; 2474 : if (reader->node->type != XML_ELEMENT_NODE)
cmp DWORD PTR [eax+4], 1
jne SHORT $LN5@xmlTextRea
; 2475 : return(NULL);
; 2476 :
; 2477 : if (xmlStrEqual(namespaceURI, BAD_CAST "http://www.w3.org/2000/xmlns/")) {
push OFFSET ??_C@_0BO@GBJIDPIB@http?3?1?1www?4w3?4org?12000?1xmlns?1@
push DWORD PTR _namespaceURI$[ebp]
call _xmlStrEqual
add esp, 8
test eax, eax
je SHORT $LN9@xmlTextRea
; 2478 : if (! xmlStrEqual(localName, BAD_CAST "xmlns")) {
push OFFSET ??_C@_05PPEFOGKI@xmlns@
push edi
call _xmlStrEqual
add esp, 8
test eax, eax
; 2479 : prefix = BAD_CAST localName;
; 2480 : }
; 2481 : ns = reader->node->nsDef;
mov eax, DWORD PTR [esi+64]
cmove ebx, edi
mov esi, DWORD PTR [eax+48]
; 2482 : while (ns != NULL) {
test esi, esi
je SHORT $LN5@xmlTextRea
$LL2@xmlTextRea:
; 2483 : if ((prefix == NULL && ns->prefix == NULL) ||
test ebx, ebx
jne SHORT $LN20@xmlTextRea
cmp DWORD PTR [esi+12], ebx
je SHORT $LN12@xmlTextRea
$LN20@xmlTextRea:
mov eax, DWORD PTR [esi+12]
test eax, eax
je SHORT $LN11@xmlTextRea
push edi
push eax
call _xmlStrEqual
add esp, 8
test eax, eax
jne SHORT $LN12@xmlTextRea
$LN11@xmlTextRea:
; 2486 : }
; 2487 : ns = ns->next;
mov esi, DWORD PTR [esi]
test esi, esi
jne SHORT $LL2@xmlTextRea
$LN5@xmlTextRea:
pop edi
; 2493 : }
pop esi
xor eax, eax
pop ebx
pop ebp
ret 0
$LN12@xmlTextRea:
; 2484 : ((ns->prefix != NULL) && (xmlStrEqual(ns->prefix, localName)))) {
; 2485 : return xmlStrdup(ns->href);
push DWORD PTR [esi+8]
call _xmlStrdup
add esp, 4
pop edi
; 2493 : }
pop esi
pop ebx
pop ebp
ret 0
$LN9@xmlTextRea:
; 2488 : }
; 2489 : return NULL;
; 2490 : }
; 2491 :
; 2492 : return(xmlGetNsProp(reader->node, localName, namespaceURI));
push DWORD PTR _namespaceURI$[ebp]
push edi
push DWORD PTR [esi+64]
call _xmlGetNsProp
add esp, 12 ; 0000000cH
pop edi
; 2493 : }
pop esi
pop ebx
pop ebp
ret 0
_xmlTextReaderGetAttributeNs ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderGetAttribute
_TEXT SEGMENT
_prefix$ = -4 ; size = 4
_reader$ = 8 ; size = 4
_name$ = 12 ; size = 4
_xmlTextReaderGetAttribute PROC ; COMDAT
; 2389 : xmlTextReaderGetAttribute(xmlTextReaderPtr reader, const xmlChar *name) {
push ebp
mov ebp, esp
push ecx
push ebx
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
mov DWORD PTR _prefix$[ebp], 0
test esi, esi
je SHORT $LN7@xmlTextRea
; 2390 : xmlChar *prefix = NULL;
; 2391 : xmlChar *localname;
; 2392 : xmlNsPtr ns;
; 2393 : xmlChar *ret = NULL;
; 2394 :
; 2395 : if ((reader == NULL) || (name == NULL))
mov ebx, DWORD PTR _name$[ebp]
test ebx, ebx
je SHORT $LN7@xmlTextRea
; 2396 : return(NULL);
; 2397 : if (reader->node == NULL)
mov eax, DWORD PTR [esi+64]
test eax, eax
je SHORT $LN7@xmlTextRea
; 2398 : return(NULL);
; 2399 : if (reader->curnode != NULL)
cmp DWORD PTR [esi+68], 0
jne SHORT $LN7@xmlTextRea
; 2400 : return(NULL);
; 2401 :
; 2402 : /* TODO: handle the xmlDecl */
; 2403 : if (reader->node->type != XML_ELEMENT_NODE)
cmp DWORD PTR [eax+4], 1
jne SHORT $LN7@xmlTextRea
; 2404 : return(NULL);
; 2405 :
; 2406 : localname = xmlSplitQName2(name, &prefix);
lea eax, DWORD PTR _prefix$[ebp]
push eax
push ebx
call _xmlSplitQName2
add esp, 8
mov edi, eax
; 2407 : if (localname == NULL) {
push OFFSET ??_C@_05PPEFOGKI@xmlns@
test edi, edi
jne SHORT $LN11@xmlTextRea
; 2408 : /*
; 2409 : * Namespace default decl
; 2410 : */
; 2411 : if (xmlStrEqual(name, BAD_CAST "xmlns")) {
push ebx
call _xmlStrEqual
mov ecx, DWORD PTR [esi+64]
add esp, 8
test eax, eax
je SHORT $LN12@xmlTextRea
; 2412 : ns = reader->node->nsDef;
mov eax, DWORD PTR [ecx+48]
; 2413 : while (ns != NULL) {
test eax, eax
je SHORT $LN7@xmlTextRea
$LL2@xmlTextRea:
; 2414 : if (ns->prefix == NULL) {
cmp DWORD PTR [eax+12], 0
je SHORT $LN22@xmlTextRea
; 2416 : }
; 2417 : ns = ns->next;
mov eax, DWORD PTR [eax]
test eax, eax
jne SHORT $LL2@xmlTextRea
$LN7@xmlTextRea:
pop edi
; 2445 : return(ret);
; 2446 : }
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN22@xmlTextRea:
; 2415 : return(xmlStrdup(ns->href));
push DWORD PTR [eax+8]
call _xmlStrdup
add esp, 4
pop edi
; 2445 : return(ret);
; 2446 : }
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN12@xmlTextRea:
; 2418 : }
; 2419 : return NULL;
; 2420 : }
; 2421 : return(xmlGetNoNsProp(reader->node, name));
push ebx
push ecx
call _xmlGetNoNsProp
add esp, 8
pop edi
; 2445 : return(ret);
; 2446 : }
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN11@xmlTextRea:
; 2422 : }
; 2423 :
; 2424 : /*
; 2425 : * Namespace default decl
; 2426 : */
; 2427 : if (xmlStrEqual(prefix, BAD_CAST "xmlns")) {
push DWORD PTR _prefix$[ebp]
call _xmlStrEqual
mov ecx, DWORD PTR [esi+64]
add esp, 8
test eax, eax
je SHORT $LN14@xmlTextRea
; 2428 : ns = reader->node->nsDef;
mov esi, DWORD PTR [ecx+48]
; 2429 : while (ns != NULL) {
test esi, esi
je SHORT $LN32@xmlTextRea
npad 7
$LL4@xmlTextRea:
; 2430 : if ((ns->prefix != NULL) && (xmlStrEqual(ns->prefix, localname))) {
mov eax, DWORD PTR [esi+12]
test eax, eax
je SHORT $LN16@xmlTextRea
push edi
push eax
call _xmlStrEqual
add esp, 8
test eax, eax
jne SHORT $LN23@xmlTextRea
$LN16@xmlTextRea:
; 2432 : break;
; 2433 : }
; 2434 : ns = ns->next;
mov esi, DWORD PTR [esi]
test esi, esi
jne SHORT $LL4@xmlTextRea
$LN32@xmlTextRea:
; 2440 : }
; 2441 :
; 2442 : xmlFree(localname);
xor ebx, ebx
$LN17@xmlTextRea:
push edi
call DWORD PTR _xmlFree
; 2443 : if (prefix != NULL)
mov eax, DWORD PTR _prefix$[ebp]
add esp, 4
test eax, eax
je SHORT $LN18@xmlTextRea
; 2444 : xmlFree(prefix);
push eax
call DWORD PTR _xmlFree
add esp, 4
$LN18@xmlTextRea:
; 2445 : return(ret);
; 2446 : }
pop edi
pop esi
mov eax, ebx
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN23@xmlTextRea:
; 2431 : ret = xmlStrdup(ns->href);
push DWORD PTR [esi+8]
call _xmlStrdup
add esp, 4
mov ebx, eax
jmp SHORT $LN17@xmlTextRea
$LN14@xmlTextRea:
; 2435 : }
; 2436 : } else {
; 2437 : ns = xmlSearchNs(reader->node->doc, reader->node, prefix);
push DWORD PTR _prefix$[ebp]
push ecx
push DWORD PTR [ecx+32]
call _xmlSearchNs
add esp, 12 ; 0000000cH
; 2438 : if (ns != NULL)
test eax, eax
je SHORT $LN32@xmlTextRea
; 2439 : ret = xmlGetNsProp(reader->node, localname, ns->href);
push DWORD PTR [eax+8]
push edi
push DWORD PTR [esi+64]
call _xmlGetNsProp
add esp, 12 ; 0000000cH
mov ebx, eax
jmp SHORT $LN17@xmlTextRea
_xmlTextReaderGetAttribute ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderGetAttributeNo
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_no$ = 12 ; size = 4
_xmlTextReaderGetAttributeNo PROC ; COMDAT
; 2340 : xmlTextReaderGetAttributeNo(xmlTextReaderPtr reader, int no) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
je SHORT $LN19@xmlTextRea
; 2341 : xmlChar *ret;
; 2342 : int i;
; 2343 : xmlAttrPtr cur;
; 2344 : xmlNsPtr ns;
; 2345 :
; 2346 : if (reader == NULL)
; 2347 : return(NULL);
; 2348 : if (reader->node == NULL)
mov esi, DWORD PTR [eax+64]
test esi, esi
je SHORT $LN19@xmlTextRea
; 2349 : return(NULL);
; 2350 : if (reader->curnode != NULL)
cmp DWORD PTR [eax+68], 0
jne SHORT $LN19@xmlTextRea
; 2351 : return(NULL);
; 2352 : /* TODO: handle the xmlDecl */
; 2353 : if (reader->node->type != XML_ELEMENT_NODE)
cmp DWORD PTR [esi+4], 1
jne SHORT $LN19@xmlTextRea
; 2354 : return(NULL);
; 2355 :
; 2356 : ns = reader->node->nsDef;
; 2357 : for (i = 0;(i < no) && (ns != NULL);i++) {
mov edx, DWORD PTR _no$[ebp]
xor eax, eax
mov ecx, DWORD PTR [esi+48]
test edx, edx
jle SHORT $LN3@xmlTextRea
$LL4@xmlTextRea:
test ecx, ecx
je SHORT $LN12@xmlTextRea
; 2358 : ns = ns->next;
mov ecx, DWORD PTR [ecx]
inc eax
cmp eax, edx
jl SHORT $LL4@xmlTextRea
$LN3@xmlTextRea:
; 2359 : }
; 2360 : if (ns != NULL)
test ecx, ecx
je SHORT $LN12@xmlTextRea
; 2361 : return(xmlStrdup(ns->href));
push DWORD PTR [ecx+8]
call _xmlStrdup
add esp, 4
pop esi
; 2375 : return(ret);
; 2376 : }
pop ebp
ret 0
$LN12@xmlTextRea:
; 2362 :
; 2363 : cur = reader->node->properties;
mov ecx, DWORD PTR [esi+44]
; 2364 : if (cur == NULL)
test ecx, ecx
je SHORT $LN19@xmlTextRea
; 2365 : return(NULL);
; 2366 : for (;i < no;i++) {
cmp eax, edx
jge SHORT $LN6@xmlTextRea
npad 4
$LL7@xmlTextRea:
; 2367 : cur = cur->next;
mov ecx, DWORD PTR [ecx+24]
; 2368 : if (cur == NULL)
test ecx, ecx
je SHORT $LN19@xmlTextRea
; 2365 : return(NULL);
; 2366 : for (;i < no;i++) {
inc eax
cmp eax, edx
jl SHORT $LL7@xmlTextRea
$LN6@xmlTextRea:
; 2370 : }
; 2371 : /* TODO walk the DTD if present */
; 2372 :
; 2373 : ret = xmlNodeListGetString(reader->node->doc, cur->children, 1);
push 1
push DWORD PTR [ecx+12]
push DWORD PTR [esi+32]
call _xmlNodeListGetString
add esp, 12 ; 0000000cH
; 2374 : if (ret == NULL) return(xmlStrdup((xmlChar *)""));
test eax, eax
jne SHORT $LN1@xmlTextRea
push OFFSET ??_C@_00CNPNBAHC@@
call _xmlStrdup
add esp, 4
pop esi
; 2375 : return(ret);
; 2376 : }
pop ebp
ret 0
$LN19@xmlTextRea:
; 2369 : return(NULL);
xor eax, eax
$LN1@xmlTextRea:
pop esi
; 2375 : return(ret);
; 2376 : }
pop ebp
ret 0
_xmlTextReaderGetAttributeNo ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderClose
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderClose PROC ; COMDAT
; 2307 : xmlTextReaderClose(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
jne SHORT $LN2@xmlTextRea
; 2308 : if (reader == NULL)
; 2309 : return(-1);
or eax, -1
pop esi
; 2326 : }
pop ebp
ret 0
$LN2@xmlTextRea:
; 2310 : reader->node = NULL;
; 2311 : reader->curnode = NULL;
; 2312 : reader->mode = XML_TEXTREADER_MODE_CLOSED;
; 2313 : if (reader->ctxt != NULL) {
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [esi+64], 0
mov DWORD PTR [esi+68], 0
mov DWORD PTR [esi], 4
test eax, eax
je SHORT $LN4@xmlTextRea
; 2314 : xmlStopParser(reader->ctxt);
push eax
call _xmlStopParser
; 2315 : if (reader->ctxt->myDoc != NULL) {
mov eax, DWORD PTR [esi+20]
add esp, 4
mov ecx, DWORD PTR [eax+8]
test ecx, ecx
je SHORT $LN4@xmlTextRea
; 2316 : if (reader->preserve == 0)
cmp DWORD PTR [esi+80], 0
jne SHORT $LN5@xmlTextRea
; 2317 : xmlTextReaderFreeDoc(reader, reader->ctxt->myDoc);
push ecx
push esi
call _xmlTextReaderFreeDoc
mov eax, DWORD PTR [esi+20]
add esp, 8
$LN5@xmlTextRea:
; 2318 : reader->ctxt->myDoc = NULL;
mov DWORD PTR [eax+8], 0
$LN4@xmlTextRea:
; 2319 : }
; 2320 : }
; 2321 : if ((reader->input != NULL) && (reader->allocs & XML_TEXTREADER_INPUT)) {
mov eax, DWORD PTR [esi+28]
test eax, eax
je SHORT $LN6@xmlTextRea
test BYTE PTR [esi+12], 1
je SHORT $LN6@xmlTextRea
; 2322 : xmlFreeParserInputBuffer(reader->input);
push eax
call _xmlFreeParserInputBuffer
add esp, 4
; 2323 : reader->allocs -= XML_TEXTREADER_INPUT;
dec DWORD PTR [esi+12]
$LN6@xmlTextRea:
; 2324 : }
; 2325 : return(0);
xor eax, eax
pop esi
; 2326 : }
pop ebp
ret 0
_xmlTextReaderClose ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderValue
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderValue PROC ; COMDAT
; 3564 : xmlTextReaderValue(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
je SHORT $LN13@xmlTextRea
; 3565 : xmlNodePtr node;
; 3566 : if (reader == NULL)
; 3567 : return(NULL);
; 3568 : if (reader->node == NULL)
mov ecx, DWORD PTR [eax+64]
test ecx, ecx
je SHORT $LN13@xmlTextRea
; 3569 : return(NULL);
; 3570 : if (reader->curnode != NULL)
mov eax, DWORD PTR [eax+68]
test eax, eax
cmovne ecx, eax
; 3571 : node = reader->curnode;
; 3572 : else
; 3573 : node = reader->node;
; 3574 :
; 3575 : switch (node->type) {
mov eax, DWORD PTR [ecx+4]
add eax, -2 ; fffffffeH
cmp eax, 16 ; 00000010H
ja SHORT $LN13@xmlTextRea
movzx eax, BYTE PTR $LN16@xmlTextRea[eax]
jmp DWORD PTR $LN20@xmlTextRea[eax*4]
$LN8@xmlTextRea:
; 3576 : case XML_NAMESPACE_DECL:
; 3577 : return(xmlStrdup(((xmlNsPtr) node)->href));
push DWORD PTR [ecx+8]
call _xmlStrdup
add esp, 4
; 3598 : }
pop ebp
ret 0
$LN9@xmlTextRea:
; 3578 : case XML_ATTRIBUTE_NODE:{
; 3579 : xmlAttrPtr attr = (xmlAttrPtr) node;
; 3580 :
; 3581 : if (attr->parent != NULL)
mov eax, DWORD PTR [ecx+20]
mov ecx, DWORD PTR [ecx+12]
push 1
push ecx
test eax, eax
je SHORT $LN10@xmlTextRea
; 3582 : return (xmlNodeListGetString
push DWORD PTR [eax+32]
call _xmlNodeListGetString
add esp, 12 ; 0000000cH
; 3598 : }
pop ebp
ret 0
$LN10@xmlTextRea:
; 3583 : (attr->parent->doc, attr->children, 1));
; 3584 : else
; 3585 : return (xmlNodeListGetString(NULL, attr->children, 1));
push 0
call _xmlNodeListGetString
add esp, 12 ; 0000000cH
; 3598 : }
pop ebp
ret 0
$LN12@xmlTextRea:
; 3586 : break;
; 3587 : }
; 3588 : case XML_TEXT_NODE:
; 3589 : case XML_CDATA_SECTION_NODE:
; 3590 : case XML_PI_NODE:
; 3591 : case XML_COMMENT_NODE:
; 3592 : if (node->content != NULL)
mov eax, DWORD PTR [ecx+40]
test eax, eax
je SHORT $LN13@xmlTextRea
; 3593 : return (xmlStrdup(node->content));
mov DWORD PTR _reader$[ebp], eax
; 3598 : }
pop ebp
; 3593 : return (xmlStrdup(node->content));
jmp _xmlStrdup
$LN13@xmlTextRea:
; 3594 : default:
; 3595 : break;
; 3596 : }
; 3597 : return(NULL);
xor eax, eax
; 3598 : }
pop ebp
ret 0
npad 1
$LN20@xmlTextRea:
DD $LN9@xmlTextRea
DD $LN12@xmlTextRea
DD $LN8@xmlTextRea
DD $LN13@xmlTextRea
$LN16@xmlTextRea:
DB 0
DB 1
DB 1
DB 3
DB 3
DB 1
DB 1
DB 3
DB 3
DB 3
DB 3
DB 3
DB 3
DB 3
DB 3
DB 3
DB 2
_xmlTextReaderValue ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderXmlLang
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderXmlLang PROC ; COMDAT
; 3711 : xmlTextReaderXmlLang(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
je SHORT $LN5@xmlTextRea
; 3712 : if (reader == NULL)
; 3713 : return(NULL);
; 3714 : if (reader->node == NULL)
mov eax, DWORD PTR [eax+64]
test eax, eax
je SHORT $LN5@xmlTextRea
; 3716 : return(xmlNodeGetLang(reader->node));
mov DWORD PTR _reader$[ebp], eax
; 3717 : }
pop ebp
; 3716 : return(xmlNodeGetLang(reader->node));
jmp _xmlNodeGetLang
$LN5@xmlTextRea:
; 3715 : return(NULL);
xor eax, eax
; 3717 : }
pop ebp
ret 0
_xmlTextReaderXmlLang ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderPrefix
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderPrefix PROC ; COMDAT
; 3319 : xmlTextReaderPrefix(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
je SHORT $LN3@xmlTextRea
; 3320 : xmlNodePtr node;
; 3321 : if ((reader == NULL) || (reader->node == NULL))
mov ecx, DWORD PTR [eax+64]
test ecx, ecx
je SHORT $LN3@xmlTextRea
; 3323 : if (reader->curnode != NULL)
mov eax, DWORD PTR [eax+68]
test eax, eax
cmovne ecx, eax
; 3324 : node = reader->curnode;
; 3325 : else
; 3326 : node = reader->node;
; 3327 : if (node->type == XML_NAMESPACE_DECL) {
mov eax, DWORD PTR [ecx+4]
cmp eax, 18 ; 00000012H
jne SHORT $LN6@xmlTextRea
; 3328 : xmlNsPtr ns = (xmlNsPtr) node;
; 3329 : if (ns->prefix == NULL)
cmp DWORD PTR [ecx+12], 0
je SHORT $LN3@xmlTextRea
; 3330 : return(NULL);
; 3331 : return(xmlStrdup(BAD_CAST "xmlns"));
mov DWORD PTR _reader$[ebp], OFFSET ??_C@_05PPEFOGKI@xmlns@
; 3338 : return(NULL);
; 3339 : }
pop ebp
; 3330 : return(NULL);
; 3331 : return(xmlStrdup(BAD_CAST "xmlns"));
jmp _xmlStrdup
$LN6@xmlTextRea:
; 3332 : }
; 3333 : if ((node->type != XML_ELEMENT_NODE) &&
cmp eax, 1
je SHORT $LN8@xmlTextRea
cmp eax, 2
jne SHORT $LN3@xmlTextRea
$LN8@xmlTextRea:
; 3334 : (node->type != XML_ATTRIBUTE_NODE))
; 3335 : return(NULL);
; 3336 : if ((node->ns != NULL) && (node->ns->prefix != NULL))
mov eax, DWORD PTR [ecx+36]
test eax, eax
je SHORT $LN3@xmlTextRea
mov eax, DWORD PTR [eax+12]
test eax, eax
je SHORT $LN3@xmlTextRea
; 3337 : return(xmlStrdup(node->ns->prefix));
mov DWORD PTR _reader$[ebp], eax
; 3338 : return(NULL);
; 3339 : }
pop ebp
; 3337 : return(xmlStrdup(node->ns->prefix));
jmp _xmlStrdup
$LN3@xmlTextRea:
; 3322 : return(NULL);
xor eax, eax
; 3338 : return(NULL);
; 3339 : }
pop ebp
ret 0
_xmlTextReaderPrefix ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderNamespaceUri
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderNamespaceUri PROC ; COMDAT
; 3383 : xmlTextReaderNamespaceUri(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
je SHORT $LN3@xmlTextRea
; 3384 : xmlNodePtr node;
; 3385 : if ((reader == NULL) || (reader->node == NULL))
mov ecx, DWORD PTR [eax+64]
test ecx, ecx
je SHORT $LN3@xmlTextRea
; 3387 : if (reader->curnode != NULL)
mov eax, DWORD PTR [eax+68]
test eax, eax
cmovne ecx, eax
; 3388 : node = reader->curnode;
; 3389 : else
; 3390 : node = reader->node;
; 3391 : if (node->type == XML_NAMESPACE_DECL)
mov eax, DWORD PTR [ecx+4]
cmp eax, 18 ; 00000012H
jne SHORT $LN6@xmlTextRea
; 3392 : return(xmlStrdup(BAD_CAST "http://www.w3.org/2000/xmlns/"));
mov DWORD PTR _reader$[ebp], OFFSET ??_C@_0BO@GBJIDPIB@http?3?1?1www?4w3?4org?12000?1xmlns?1@
; 3398 : return(NULL);
; 3399 : }
pop ebp
; 3392 : return(xmlStrdup(BAD_CAST "http://www.w3.org/2000/xmlns/"));
jmp _xmlStrdup
$LN6@xmlTextRea:
; 3393 : if ((node->type != XML_ELEMENT_NODE) &&
cmp eax, 1
je SHORT $LN7@xmlTextRea
cmp eax, 2
jne SHORT $LN3@xmlTextRea
$LN7@xmlTextRea:
; 3394 : (node->type != XML_ATTRIBUTE_NODE))
; 3395 : return(NULL);
; 3396 : if (node->ns != NULL)
mov eax, DWORD PTR [ecx+36]
test eax, eax
je SHORT $LN3@xmlTextRea
; 3397 : return(xmlStrdup(node->ns->href));
push DWORD PTR [eax+8]
call _xmlStrdup
add esp, 4
; 3398 : return(NULL);
; 3399 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 3386 : return(NULL);
xor eax, eax
; 3398 : return(NULL);
; 3399 : }
pop ebp
ret 0
_xmlTextReaderNamespaceUri ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderName
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderName PROC ; COMDAT
; 3175 : xmlTextReaderName(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
je $LN5@xmlTextRea
; 3176 : xmlNodePtr node;
; 3177 : xmlChar *ret;
; 3178 :
; 3179 : if ((reader == NULL) || (reader->node == NULL))
mov esi, DWORD PTR [eax+64]
test esi, esi
je $LN5@xmlTextRea
; 3181 : if (reader->curnode != NULL)
mov eax, DWORD PTR [eax+68]
test eax, eax
cmovne esi, eax
; 3182 : node = reader->curnode;
; 3183 : else
; 3184 : node = reader->node;
; 3185 : switch (node->type) {
mov eax, DWORD PTR [esi+4]
dec eax
cmp eax, 20 ; 00000014H
ja $LN5@xmlTextRea
movzx eax, BYTE PTR $LN24@xmlTextRea[eax]
jmp DWORD PTR $LN28@xmlTextRea[eax*4]
$LN8@xmlTextRea:
; 3186 : case XML_ELEMENT_NODE:
; 3187 : case XML_ATTRIBUTE_NODE:
; 3188 : if ((node->ns == NULL) ||
mov eax, DWORD PTR [esi+36]
test eax, eax
je SHORT $LN10@xmlTextRea
mov eax, DWORD PTR [eax+12]
test eax, eax
je SHORT $LN10@xmlTextRea
; 3189 : (node->ns->prefix == NULL))
; 3190 : return(xmlStrdup(node->name));
; 3191 :
; 3192 : ret = xmlStrdup(node->ns->prefix);
push eax
call _xmlStrdup
; 3193 : ret = xmlStrcat(ret, BAD_CAST ":");
push OFFSET ??_C@_01JLIPDDHJ@?3@
push eax
call _xmlStrcat
; 3194 : ret = xmlStrcat(ret, node->name);
push DWORD PTR [esi+8]
push eax
call _xmlStrcat
add esp, 20 ; 00000014H
pop esi
; 3228 : return(ret);
; 3229 : }
; 3230 :
; 3231 : case XML_ELEMENT_DECL:
; 3232 : case XML_ATTRIBUTE_DECL:
; 3233 : case XML_ENTITY_DECL:
; 3234 : case XML_XINCLUDE_START:
; 3235 : case XML_XINCLUDE_END:
; 3236 : return(NULL);
; 3237 : }
; 3238 : return(NULL);
; 3239 : }
pop ebp
ret 0
$LN10@xmlTextRea:
push DWORD PTR [esi+8]
call _xmlStrdup
add esp, 4
pop esi
pop ebp
ret 0
$LN11@xmlTextRea:
pop esi
; 3195 : return(ret);
; 3196 : case XML_TEXT_NODE:
; 3197 : return(xmlStrdup(BAD_CAST "#text"));
mov DWORD PTR _reader$[ebp], OFFSET ??_C@_05NOBOONOA@?$CDtext@
; 3228 : return(ret);
; 3229 : }
; 3230 :
; 3231 : case XML_ELEMENT_DECL:
; 3232 : case XML_ATTRIBUTE_DECL:
; 3233 : case XML_ENTITY_DECL:
; 3234 : case XML_XINCLUDE_START:
; 3235 : case XML_XINCLUDE_END:
; 3236 : return(NULL);
; 3237 : }
; 3238 : return(NULL);
; 3239 : }
pop ebp
; 3195 : return(ret);
; 3196 : case XML_TEXT_NODE:
; 3197 : return(xmlStrdup(BAD_CAST "#text"));
jmp _xmlStrdup
$LN12@xmlTextRea:
pop esi
; 3198 : case XML_CDATA_SECTION_NODE:
; 3199 : return(xmlStrdup(BAD_CAST "#cdata-section"));
mov DWORD PTR _reader$[ebp], OFFSET ??_C@_0P@LIENAFBO@?$CDcdata?9section@
; 3228 : return(ret);
; 3229 : }
; 3230 :
; 3231 : case XML_ELEMENT_DECL:
; 3232 : case XML_ATTRIBUTE_DECL:
; 3233 : case XML_ENTITY_DECL:
; 3234 : case XML_XINCLUDE_START:
; 3235 : case XML_XINCLUDE_END:
; 3236 : return(NULL);
; 3237 : }
; 3238 : return(NULL);
; 3239 : }
pop ebp
; 3198 : case XML_CDATA_SECTION_NODE:
; 3199 : return(xmlStrdup(BAD_CAST "#cdata-section"));
jmp _xmlStrdup
$LN15@xmlTextRea:
pop esi
; 3200 : case XML_ENTITY_NODE:
; 3201 : case XML_ENTITY_REF_NODE:
; 3202 : return(xmlStrdup(node->name));
; 3203 : case XML_PI_NODE:
; 3204 : return(xmlStrdup(node->name));
; 3205 : case XML_COMMENT_NODE:
; 3206 : return(xmlStrdup(BAD_CAST "#comment"));
mov DWORD PTR _reader$[ebp], OFFSET ??_C@_08FBDKDMPC@?$CDcomment@
; 3228 : return(ret);
; 3229 : }
; 3230 :
; 3231 : case XML_ELEMENT_DECL:
; 3232 : case XML_ATTRIBUTE_DECL:
; 3233 : case XML_ENTITY_DECL:
; 3234 : case XML_XINCLUDE_START:
; 3235 : case XML_XINCLUDE_END:
; 3236 : return(NULL);
; 3237 : }
; 3238 : return(NULL);
; 3239 : }
pop ebp
; 3200 : case XML_ENTITY_NODE:
; 3201 : case XML_ENTITY_REF_NODE:
; 3202 : return(xmlStrdup(node->name));
; 3203 : case XML_PI_NODE:
; 3204 : return(xmlStrdup(node->name));
; 3205 : case XML_COMMENT_NODE:
; 3206 : return(xmlStrdup(BAD_CAST "#comment"));
jmp _xmlStrdup
$LN16@xmlTextRea:
pop esi
; 3207 : case XML_DOCUMENT_NODE:
; 3208 : case XML_HTML_DOCUMENT_NODE:
; 3209 : #ifdef LIBXML_DOCB_ENABLED
; 3210 : case XML_DOCB_DOCUMENT_NODE:
; 3211 : #endif
; 3212 : return(xmlStrdup(BAD_CAST "#document"));
mov DWORD PTR _reader$[ebp], OFFSET ??_C@_09DFKKGJPK@?$CDdocument@
; 3228 : return(ret);
; 3229 : }
; 3230 :
; 3231 : case XML_ELEMENT_DECL:
; 3232 : case XML_ATTRIBUTE_DECL:
; 3233 : case XML_ENTITY_DECL:
; 3234 : case XML_XINCLUDE_START:
; 3235 : case XML_XINCLUDE_END:
; 3236 : return(NULL);
; 3237 : }
; 3238 : return(NULL);
; 3239 : }
pop ebp
; 3207 : case XML_DOCUMENT_NODE:
; 3208 : case XML_HTML_DOCUMENT_NODE:
; 3209 : #ifdef LIBXML_DOCB_ENABLED
; 3210 : case XML_DOCB_DOCUMENT_NODE:
; 3211 : #endif
; 3212 : return(xmlStrdup(BAD_CAST "#document"));
jmp _xmlStrdup
$LN17@xmlTextRea:
pop esi
; 3213 : case XML_DOCUMENT_FRAG_NODE:
; 3214 : return(xmlStrdup(BAD_CAST "#document-fragment"));
mov DWORD PTR _reader$[ebp], OFFSET ??_C@_0BD@FMMPJIKP@?$CDdocument?9fragment@
; 3228 : return(ret);
; 3229 : }
; 3230 :
; 3231 : case XML_ELEMENT_DECL:
; 3232 : case XML_ATTRIBUTE_DECL:
; 3233 : case XML_ENTITY_DECL:
; 3234 : case XML_XINCLUDE_START:
; 3235 : case XML_XINCLUDE_END:
; 3236 : return(NULL);
; 3237 : }
; 3238 : return(NULL);
; 3239 : }
pop ebp
; 3213 : case XML_DOCUMENT_FRAG_NODE:
; 3214 : return(xmlStrdup(BAD_CAST "#document-fragment"));
jmp _xmlStrdup
$LN20@xmlTextRea:
; 3215 : case XML_NOTATION_NODE:
; 3216 : return(xmlStrdup(node->name));
; 3217 : case XML_DOCUMENT_TYPE_NODE:
; 3218 : case XML_DTD_NODE:
; 3219 : return(xmlStrdup(node->name));
; 3220 : case XML_NAMESPACE_DECL: {
; 3221 : xmlNsPtr ns = (xmlNsPtr) node;
; 3222 :
; 3223 : ret = xmlStrdup(BAD_CAST "xmlns");
push OFFSET ??_C@_05PPEFOGKI@xmlns@
call _xmlStrdup
add esp, 4
; 3224 : if (ns->prefix == NULL)
cmp DWORD PTR [esi+12], 0
je SHORT $LN1@xmlTextRea
; 3225 : return(ret);
; 3226 : ret = xmlStrcat(ret, BAD_CAST ":");
push OFFSET ??_C@_01JLIPDDHJ@?3@
push eax
call _xmlStrcat
; 3227 : ret = xmlStrcat(ret, ns->prefix);
push DWORD PTR [esi+12]
push eax
call _xmlStrcat
add esp, 16 ; 00000010H
pop esi
; 3228 : return(ret);
; 3229 : }
; 3230 :
; 3231 : case XML_ELEMENT_DECL:
; 3232 : case XML_ATTRIBUTE_DECL:
; 3233 : case XML_ENTITY_DECL:
; 3234 : case XML_XINCLUDE_START:
; 3235 : case XML_XINCLUDE_END:
; 3236 : return(NULL);
; 3237 : }
; 3238 : return(NULL);
; 3239 : }
pop ebp
ret 0
$LN5@xmlTextRea:
; 3180 : return(NULL);
xor eax, eax
$LN1@xmlTextRea:
pop esi
; 3228 : return(ret);
; 3229 : }
; 3230 :
; 3231 : case XML_ELEMENT_DECL:
; 3232 : case XML_ATTRIBUTE_DECL:
; 3233 : case XML_ENTITY_DECL:
; 3234 : case XML_XINCLUDE_START:
; 3235 : case XML_XINCLUDE_END:
; 3236 : return(NULL);
; 3237 : }
; 3238 : return(NULL);
; 3239 : }
pop ebp
ret 0
npad 1
$LN28@xmlTextRea:
DD $LN8@xmlTextRea
DD $LN11@xmlTextRea
DD $LN12@xmlTextRea
DD $LN10@xmlTextRea
DD $LN15@xmlTextRea
DD $LN16@xmlTextRea
DD $LN17@xmlTextRea
DD $LN5@xmlTextRea
DD $LN20@xmlTextRea
$LN24@xmlTextRea:
DB 0
DB 0
DB 1
DB 2
DB 3
DB 3
DB 3
DB 4
DB 5
DB 3
DB 6
DB 3
DB 5
DB 3
DB 7
DB 7
DB 7
DB 8
DB 7
DB 7
DB 5
_xmlTextReaderName ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderLocalName
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderLocalName PROC ; COMDAT
; 3113 : xmlTextReaderLocalName(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edx, DWORD PTR _reader$[ebp]
test edx, edx
je SHORT $LN3@xmlTextRea
; 3114 : xmlNodePtr node;
; 3115 : if ((reader == NULL) || (reader->node == NULL))
mov ecx, DWORD PTR [edx+64]
test ecx, ecx
je SHORT $LN3@xmlTextRea
; 3117 : if (reader->curnode != NULL)
mov eax, DWORD PTR [edx+68]
test eax, eax
cmovne ecx, eax
; 3118 : node = reader->curnode;
; 3119 : else
; 3120 : node = reader->node;
; 3121 : if (node->type == XML_NAMESPACE_DECL) {
mov eax, DWORD PTR [ecx+4]
cmp eax, 18 ; 00000012H
jne SHORT $LN8@xmlTextRea
; 3122 : xmlNsPtr ns = (xmlNsPtr) node;
; 3123 : if (ns->prefix == NULL)
mov eax, DWORD PTR [ecx+12]
test eax, eax
jne SHORT $LN7@xmlTextRea
; 3124 : return(xmlStrdup(BAD_CAST "xmlns"));
mov DWORD PTR _reader$[ebp], OFFSET ??_C@_05PPEFOGKI@xmlns@
; 3132 : }
pop ebp
; 3124 : return(xmlStrdup(BAD_CAST "xmlns"));
jmp _xmlStrdup
$LN7@xmlTextRea:
; 3125 : else
; 3126 : return(xmlStrdup(ns->prefix));
mov DWORD PTR _reader$[ebp], eax
; 3132 : }
pop ebp
; 3125 : else
; 3126 : return(xmlStrdup(ns->prefix));
jmp _xmlStrdup
$LN8@xmlTextRea:
; 3127 : }
; 3128 : if ((node->type != XML_ELEMENT_NODE) &&
cmp eax, 1
je SHORT $LN9@xmlTextRea
cmp eax, 2
je SHORT $LN9@xmlTextRea
; 3129 : (node->type != XML_ATTRIBUTE_NODE))
; 3130 : return(xmlTextReaderName(reader));
mov DWORD PTR _reader$[ebp], edx
; 3132 : }
pop ebp
; 3129 : (node->type != XML_ATTRIBUTE_NODE))
; 3130 : return(xmlTextReaderName(reader));
jmp _xmlTextReaderName
$LN9@xmlTextRea:
; 3131 : return(xmlStrdup(node->name));
push DWORD PTR [ecx+8]
call _xmlStrdup
add esp, 4
; 3132 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 3116 : return(NULL);
xor eax, eax
; 3132 : }
pop ebp
ret 0
_xmlTextReaderLocalName ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderBaseUri
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderBaseUri PROC ; COMDAT
; 3439 : xmlTextReaderBaseUri(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
je SHORT $LN3@xmlTextRea
; 3440 : if ((reader == NULL) || (reader->node == NULL))
mov eax, DWORD PTR [eax+64]
test eax, eax
je SHORT $LN3@xmlTextRea
; 3442 : return(xmlNodeGetBase(NULL, reader->node));
push eax
push 0
call _xmlNodeGetBase
add esp, 8
; 3443 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 3441 : return(NULL);
xor eax, eax
; 3443 : }
pop ebp
ret 0
_xmlTextReaderBaseUri ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderConstValue
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderConstValue PROC ; COMDAT
; 3610 : xmlTextReaderConstValue(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
je SHORT $LN17@xmlTextRea
; 3611 : xmlNodePtr node;
; 3612 : if (reader == NULL)
; 3613 : return(NULL);
; 3614 : if (reader->node == NULL)
mov edi, DWORD PTR [esi+64]
test edi, edi
je SHORT $LN17@xmlTextRea
; 3615 : return(NULL);
; 3616 : if (reader->curnode != NULL)
mov eax, DWORD PTR [esi+68]
test eax, eax
cmovne edi, eax
; 3617 : node = reader->curnode;
; 3618 : else
; 3619 : node = reader->node;
; 3620 :
; 3621 : switch (node->type) {
mov ecx, DWORD PTR [edi+4]
add ecx, -2 ; fffffffeH
cmp ecx, 16 ; 00000010H
ja SHORT $LN17@xmlTextRea
movzx ecx, BYTE PTR $LN19@xmlTextRea[ecx]
jmp DWORD PTR $LN21@xmlTextRea[ecx*4]
$LN8@xmlTextRea:
; 3622 : case XML_NAMESPACE_DECL:
; 3623 : return(((xmlNsPtr) node)->href);
mov eax, DWORD PTR [edi+8]
pop edi
; 3663 : default:
; 3664 : break;
; 3665 : }
; 3666 : return(NULL);
; 3667 : }
pop esi
pop ebp
ret 0
$LN9@xmlTextRea:
; 3624 : case XML_ATTRIBUTE_NODE:{
; 3625 : xmlAttrPtr attr = (xmlAttrPtr) node;
; 3626 : const xmlChar *ret;
; 3627 :
; 3628 : if ((attr->children != NULL) &&
; 3629 : (attr->children->type == XML_TEXT_NODE) &&
mov eax, DWORD PTR [edi+12]
test eax, eax
je SHORT $LN10@xmlTextRea
cmp DWORD PTR [eax+4], 3
jne SHORT $LN10@xmlTextRea
cmp DWORD PTR [eax+24], 0
jne SHORT $LN10@xmlTextRea
; 3630 : (attr->children->next == NULL))
; 3631 : return(attr->children->content);
mov eax, DWORD PTR [eax+40]
pop edi
; 3663 : default:
; 3664 : break;
; 3665 : }
; 3666 : return(NULL);
; 3667 : }
pop esi
pop ebp
ret 0
$LN10@xmlTextRea:
; 3632 : else {
; 3633 : if (reader->buffer == NULL) {
mov eax, DWORD PTR [esi+84]
test eax, eax
jne SHORT $LN12@xmlTextRea
; 3634 : reader->buffer = xmlBufCreateSize(100);
push 100 ; 00000064H
call _xmlBufCreateSize
add esp, 4
mov DWORD PTR [esi+84], eax
; 3635 : if (reader->buffer == NULL) {
test eax, eax
jne SHORT $LN14@xmlTextRea
; 3636 : xmlGenericError(xmlGenericErrorContext,
call ___xmlGenericError
mov esi, eax
call ___xmlGenericErrorContext
push OFFSET ??_C@_0CE@MNBJMFAB@xmlTextReaderSetup?5?3?5malloc?5fai@
push DWORD PTR [eax]
mov eax, DWORD PTR [esi]
call eax
add esp, 8
$LN17@xmlTextRea:
; 3663 : default:
; 3664 : break;
; 3665 : }
; 3666 : return(NULL);
; 3667 : }
xor eax, eax
$LN1@xmlTextRea:
pop edi
pop esi
pop ebp
ret 0
$LN14@xmlTextRea:
; 3637 : "xmlTextReaderSetup : malloc failed\n");
; 3638 : return (NULL);
; 3639 : }
; 3640 : xmlBufSetAllocationScheme(reader->buffer,
push 5
push eax
call _xmlBufSetAllocationScheme
add esp, 8
; 3641 : XML_BUFFER_ALLOC_BOUNDED);
; 3642 : } else
jmp SHORT $LN13@xmlTextRea
$LN12@xmlTextRea:
; 3643 : xmlBufEmpty(reader->buffer);
push eax
call _xmlBufEmpty
add esp, 4
$LN13@xmlTextRea:
; 3644 : xmlBufGetNodeContent(reader->buffer, node);
push edi
push DWORD PTR [esi+84]
call _xmlBufGetNodeContent
; 3645 : ret = xmlBufContent(reader->buffer);
push DWORD PTR [esi+84]
call _xmlBufContent
add esp, 12 ; 0000000cH
; 3646 : if (ret == NULL) {
test eax, eax
jne SHORT $LN1@xmlTextRea
; 3647 : /* error on the buffer best to reallocate */
; 3648 : xmlBufFree(reader->buffer);
push DWORD PTR [esi+84]
call _xmlBufFree
; 3649 : reader->buffer = xmlBufCreateSize(100);
push 100 ; 00000064H
call _xmlBufCreateSize
; 3650 : xmlBufSetAllocationScheme(reader->buffer,
push 5
push eax
mov DWORD PTR [esi+84], eax
call _xmlBufSetAllocationScheme
add esp, 16 ; 00000010H
; 3651 : XML_BUFFER_ALLOC_BOUNDED);
; 3652 : ret = BAD_CAST "";
mov eax, OFFSET ??_C@_00CNPNBAHC@@
pop edi
; 3663 : default:
; 3664 : break;
; 3665 : }
; 3666 : return(NULL);
; 3667 : }
pop esi
pop ebp
ret 0
$LN16@xmlTextRea:
; 3653 : }
; 3654 : return(ret);
; 3655 : }
; 3656 : break;
; 3657 : }
; 3658 : case XML_TEXT_NODE:
; 3659 : case XML_CDATA_SECTION_NODE:
; 3660 : case XML_PI_NODE:
; 3661 : case XML_COMMENT_NODE:
; 3662 : return(node->content);
mov eax, DWORD PTR [edi+40]
pop edi
; 3663 : default:
; 3664 : break;
; 3665 : }
; 3666 : return(NULL);
; 3667 : }
pop esi
pop ebp
ret 0
npad 2
$LN21@xmlTextRea:
DD $LN9@xmlTextRea
DD $LN16@xmlTextRea
DD $LN8@xmlTextRea
DD $LN17@xmlTextRea
$LN19@xmlTextRea:
DB 0
DB 1
DB 1
DB 3
DB 3
DB 1
DB 1
DB 3
DB 3
DB 3
DB 3
DB 3
DB 3
DB 3
DB 3
DB 3
DB 2
_xmlTextReaderConstValue ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderConstString
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_str$ = 12 ; size = 4
_xmlTextReaderConstString PROC ; COMDAT
; 3756 : xmlTextReaderConstString(xmlTextReaderPtr reader, const xmlChar *str) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
jne SHORT $LN2@xmlTextRea
; 3760 : }
pop ebp
ret 0
$LN2@xmlTextRea:
; 3757 : if (reader == NULL)
; 3758 : return(NULL);
; 3759 : return(CONSTSTR(str));
push -1
push DWORD PTR _str$[ebp]
push DWORD PTR [eax+88]
call _xmlDictLookup
add esp, 12 ; 0000000cH
; 3760 : }
pop ebp
ret 0
_xmlTextReaderConstString ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderConstXmlLang
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderConstXmlLang PROC ; COMDAT
; 3728 : xmlTextReaderConstXmlLang(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
je SHORT $LN6@xmlTextRea
; 3729 : xmlChar *tmp;
; 3730 : const xmlChar *ret;
; 3731 :
; 3732 : if (reader == NULL)
; 3733 : return(NULL);
; 3734 : if (reader->node == NULL)
mov eax, DWORD PTR [esi+64]
test eax, eax
je SHORT $LN6@xmlTextRea
; 3735 : return(NULL);
; 3736 : tmp = xmlNodeGetLang(reader->node);
push eax
call _xmlNodeGetLang
mov edi, eax
add esp, 4
; 3737 : if (tmp == NULL)
test edi, edi
je SHORT $LN6@xmlTextRea
; 3739 : ret = CONSTSTR(tmp);
push -1
push edi
push DWORD PTR [esi+88]
call _xmlDictLookup
; 3740 : xmlFree(tmp);
push edi
mov esi, eax
call DWORD PTR _xmlFree
add esp, 16 ; 00000010H
; 3741 : return(ret);
mov eax, esi
pop edi
; 3742 : }
pop esi
pop ebp
ret 0
$LN6@xmlTextRea:
pop edi
; 3738 : return(NULL);
xor eax, eax
; 3742 : }
pop esi
pop ebp
ret 0
_xmlTextReaderConstXmlLang ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderConstPrefix
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderConstPrefix PROC ; COMDAT
; 3351 : xmlTextReaderConstPrefix(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edx, DWORD PTR _reader$[ebp]
test edx, edx
je SHORT $LN3@xmlTextRea
; 3352 : xmlNodePtr node;
; 3353 : if ((reader == NULL) || (reader->node == NULL))
mov ecx, DWORD PTR [edx+64]
test ecx, ecx
je SHORT $LN3@xmlTextRea
; 3355 : if (reader->curnode != NULL)
mov eax, DWORD PTR [edx+68]
test eax, eax
cmovne ecx, eax
; 3356 : node = reader->curnode;
; 3357 : else
; 3358 : node = reader->node;
; 3359 : if (node->type == XML_NAMESPACE_DECL) {
mov eax, DWORD PTR [ecx+4]
cmp eax, 18 ; 00000012H
jne SHORT $LN6@xmlTextRea
; 3360 : xmlNsPtr ns = (xmlNsPtr) node;
; 3361 : if (ns->prefix == NULL)
cmp DWORD PTR [ecx+12], 0
je SHORT $LN3@xmlTextRea
; 3362 : return(NULL);
; 3363 : return(CONSTSTR(BAD_CAST "xmlns"));
push -1
push OFFSET ??_C@_05PPEFOGKI@xmlns@
push DWORD PTR [edx+88]
call _xmlDictLookup
add esp, 12 ; 0000000cH
; 3370 : return(NULL);
; 3371 : }
pop ebp
ret 0
$LN6@xmlTextRea:
; 3364 : }
; 3365 : if ((node->type != XML_ELEMENT_NODE) &&
cmp eax, 1
je SHORT $LN8@xmlTextRea
cmp eax, 2
jne SHORT $LN3@xmlTextRea
$LN8@xmlTextRea:
; 3366 : (node->type != XML_ATTRIBUTE_NODE))
; 3367 : return(NULL);
; 3368 : if ((node->ns != NULL) && (node->ns->prefix != NULL))
mov eax, DWORD PTR [ecx+36]
test eax, eax
je SHORT $LN3@xmlTextRea
mov eax, DWORD PTR [eax+12]
test eax, eax
je SHORT $LN3@xmlTextRea
; 3369 : return(CONSTSTR(node->ns->prefix));
push -1
push eax
push DWORD PTR [edx+88]
call _xmlDictLookup
add esp, 12 ; 0000000cH
; 3370 : return(NULL);
; 3371 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 3354 : return(NULL);
xor eax, eax
; 3370 : return(NULL);
; 3371 : }
pop ebp
ret 0
_xmlTextReaderConstPrefix ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderConstNamespaceUri
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderConstNamespaceUri PROC ; COMDAT
; 3411 : xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _reader$[ebp]
test ecx, ecx
je SHORT $LN3@xmlTextRea
; 3412 : xmlNodePtr node;
; 3413 : if ((reader == NULL) || (reader->node == NULL))
mov edx, DWORD PTR [ecx+64]
test edx, edx
je SHORT $LN3@xmlTextRea
; 3415 : if (reader->curnode != NULL)
mov eax, DWORD PTR [ecx+68]
test eax, eax
cmovne edx, eax
; 3416 : node = reader->curnode;
; 3417 : else
; 3418 : node = reader->node;
; 3419 : if (node->type == XML_NAMESPACE_DECL)
mov eax, DWORD PTR [edx+4]
cmp eax, 18 ; 00000012H
jne SHORT $LN6@xmlTextRea
; 3420 : return(CONSTSTR(BAD_CAST "http://www.w3.org/2000/xmlns/"));
push -1
push OFFSET ??_C@_0BO@GBJIDPIB@http?3?1?1www?4w3?4org?12000?1xmlns?1@
push DWORD PTR [ecx+88]
call _xmlDictLookup
add esp, 12 ; 0000000cH
; 3426 : return(NULL);
; 3427 : }
pop ebp
ret 0
$LN6@xmlTextRea:
; 3421 : if ((node->type != XML_ELEMENT_NODE) &&
cmp eax, 1
je SHORT $LN7@xmlTextRea
cmp eax, 2
jne SHORT $LN3@xmlTextRea
$LN7@xmlTextRea:
; 3422 : (node->type != XML_ATTRIBUTE_NODE))
; 3423 : return(NULL);
; 3424 : if (node->ns != NULL)
mov eax, DWORD PTR [edx+36]
test eax, eax
je SHORT $LN3@xmlTextRea
; 3425 : return(CONSTSTR(node->ns->href));
push -1
push DWORD PTR [eax+8]
push DWORD PTR [ecx+88]
call _xmlDictLookup
add esp, 12 ; 0000000cH
; 3426 : return(NULL);
; 3427 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 3414 : return(NULL);
xor eax, eax
; 3426 : return(NULL);
; 3427 : }
pop ebp
ret 0
_xmlTextReaderConstNamespaceUri ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderConstName
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderConstName PROC ; COMDAT
; 3251 : xmlTextReaderConstName(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _reader$[ebp]
test ecx, ecx
je $LN5@xmlTextRea
; 3252 : xmlNodePtr node;
; 3253 :
; 3254 : if ((reader == NULL) || (reader->node == NULL))
mov edx, DWORD PTR [ecx+64]
test edx, edx
je $LN5@xmlTextRea
; 3256 : if (reader->curnode != NULL)
mov eax, DWORD PTR [ecx+68]
test eax, eax
cmovne edx, eax
; 3257 : node = reader->curnode;
; 3258 : else
; 3259 : node = reader->node;
; 3260 : switch (node->type) {
mov eax, DWORD PTR [edx+4]
dec eax
cmp eax, 20 ; 00000014H
ja $LN5@xmlTextRea
movzx eax, BYTE PTR $LN24@xmlTextRea[eax]
jmp DWORD PTR $LN26@xmlTextRea[eax*4]
$LN8@xmlTextRea:
; 3261 : case XML_ELEMENT_NODE:
; 3262 : case XML_ATTRIBUTE_NODE:
; 3263 : if ((node->ns == NULL) ||
mov eax, DWORD PTR [edx+36]
test eax, eax
je SHORT $LN10@xmlTextRea
mov eax, DWORD PTR [eax+12]
test eax, eax
je SHORT $LN10@xmlTextRea
; 3266 : return(CONSTQSTR(node->ns->prefix, node->name));
push DWORD PTR [edx+8]
push eax
push DWORD PTR [ecx+88]
call _xmlDictQLookup
add esp, 12 ; 0000000cH
; 3297 : }
; 3298 :
; 3299 : case XML_ELEMENT_DECL:
; 3300 : case XML_ATTRIBUTE_DECL:
; 3301 : case XML_ENTITY_DECL:
; 3302 : case XML_XINCLUDE_START:
; 3303 : case XML_XINCLUDE_END:
; 3304 : return(NULL);
; 3305 : }
; 3306 : return(NULL);
; 3307 : }
pop ebp
ret 0
$LN10@xmlTextRea:
; 3264 : (node->ns->prefix == NULL))
; 3265 : return(node->name);
mov eax, DWORD PTR [edx+8]
; 3297 : }
; 3298 :
; 3299 : case XML_ELEMENT_DECL:
; 3300 : case XML_ATTRIBUTE_DECL:
; 3301 : case XML_ENTITY_DECL:
; 3302 : case XML_XINCLUDE_START:
; 3303 : case XML_XINCLUDE_END:
; 3304 : return(NULL);
; 3305 : }
; 3306 : return(NULL);
; 3307 : }
pop ebp
ret 0
$LN11@xmlTextRea:
; 3267 : case XML_TEXT_NODE:
; 3268 : return(CONSTSTR(BAD_CAST "#text"));
push -1
push OFFSET ??_C@_05NOBOONOA@?$CDtext@
push DWORD PTR [ecx+88]
call _xmlDictLookup
add esp, 12 ; 0000000cH
; 3297 : }
; 3298 :
; 3299 : case XML_ELEMENT_DECL:
; 3300 : case XML_ATTRIBUTE_DECL:
; 3301 : case XML_ENTITY_DECL:
; 3302 : case XML_XINCLUDE_START:
; 3303 : case XML_XINCLUDE_END:
; 3304 : return(NULL);
; 3305 : }
; 3306 : return(NULL);
; 3307 : }
pop ebp
ret 0
$LN12@xmlTextRea:
; 3269 : case XML_CDATA_SECTION_NODE:
; 3270 : return(CONSTSTR(BAD_CAST "#cdata-section"));
push -1
push OFFSET ??_C@_0P@LIENAFBO@?$CDcdata?9section@
push DWORD PTR [ecx+88]
call _xmlDictLookup
add esp, 12 ; 0000000cH
; 3297 : }
; 3298 :
; 3299 : case XML_ELEMENT_DECL:
; 3300 : case XML_ATTRIBUTE_DECL:
; 3301 : case XML_ENTITY_DECL:
; 3302 : case XML_XINCLUDE_START:
; 3303 : case XML_XINCLUDE_END:
; 3304 : return(NULL);
; 3305 : }
; 3306 : return(NULL);
; 3307 : }
pop ebp
ret 0
$LN13@xmlTextRea:
push -1
push DWORD PTR [edx+8]
push DWORD PTR [ecx+88]
call _xmlDictLookup
add esp, 12 ; 0000000cH
pop ebp
ret 0
$LN15@xmlTextRea:
; 3271 : case XML_ENTITY_NODE:
; 3272 : case XML_ENTITY_REF_NODE:
; 3273 : return(CONSTSTR(node->name));
; 3274 : case XML_PI_NODE:
; 3275 : return(CONSTSTR(node->name));
; 3276 : case XML_COMMENT_NODE:
; 3277 : return(CONSTSTR(BAD_CAST "#comment"));
push -1
push OFFSET ??_C@_08FBDKDMPC@?$CDcomment@
push DWORD PTR [ecx+88]
call _xmlDictLookup
add esp, 12 ; 0000000cH
; 3297 : }
; 3298 :
; 3299 : case XML_ELEMENT_DECL:
; 3300 : case XML_ATTRIBUTE_DECL:
; 3301 : case XML_ENTITY_DECL:
; 3302 : case XML_XINCLUDE_START:
; 3303 : case XML_XINCLUDE_END:
; 3304 : return(NULL);
; 3305 : }
; 3306 : return(NULL);
; 3307 : }
pop ebp
ret 0
$LN16@xmlTextRea:
; 3278 : case XML_DOCUMENT_NODE:
; 3279 : case XML_HTML_DOCUMENT_NODE:
; 3280 : #ifdef LIBXML_DOCB_ENABLED
; 3281 : case XML_DOCB_DOCUMENT_NODE:
; 3282 : #endif
; 3283 : return(CONSTSTR(BAD_CAST "#document"));
push -1
push OFFSET ??_C@_09DFKKGJPK@?$CDdocument@
push DWORD PTR [ecx+88]
call _xmlDictLookup
add esp, 12 ; 0000000cH
; 3297 : }
; 3298 :
; 3299 : case XML_ELEMENT_DECL:
; 3300 : case XML_ATTRIBUTE_DECL:
; 3301 : case XML_ENTITY_DECL:
; 3302 : case XML_XINCLUDE_START:
; 3303 : case XML_XINCLUDE_END:
; 3304 : return(NULL);
; 3305 : }
; 3306 : return(NULL);
; 3307 : }
pop ebp
ret 0
$LN17@xmlTextRea:
; 3284 : case XML_DOCUMENT_FRAG_NODE:
; 3285 : return(CONSTSTR(BAD_CAST "#document-fragment"));
push -1
push OFFSET ??_C@_0BD@FMMPJIKP@?$CDdocument?9fragment@
push DWORD PTR [ecx+88]
call _xmlDictLookup
add esp, 12 ; 0000000cH
; 3297 : }
; 3298 :
; 3299 : case XML_ELEMENT_DECL:
; 3300 : case XML_ATTRIBUTE_DECL:
; 3301 : case XML_ENTITY_DECL:
; 3302 : case XML_XINCLUDE_START:
; 3303 : case XML_XINCLUDE_END:
; 3304 : return(NULL);
; 3305 : }
; 3306 : return(NULL);
; 3307 : }
pop ebp
ret 0
$LN20@xmlTextRea:
; 3286 : case XML_NOTATION_NODE:
; 3287 : return(CONSTSTR(node->name));
; 3288 : case XML_DOCUMENT_TYPE_NODE:
; 3289 : case XML_DTD_NODE:
; 3290 : return(CONSTSTR(node->name));
; 3291 : case XML_NAMESPACE_DECL: {
; 3292 : xmlNsPtr ns = (xmlNsPtr) node;
; 3293 :
; 3294 : if (ns->prefix == NULL)
mov edx, DWORD PTR [edx+12]
mov eax, DWORD PTR [ecx+88]
test edx, edx
jne SHORT $LN21@xmlTextRea
; 3295 : return(CONSTSTR(BAD_CAST "xmlns"));
push -1
push OFFSET ??_C@_05PPEFOGKI@xmlns@
push eax
call _xmlDictLookup
add esp, 12 ; 0000000cH
; 3297 : }
; 3298 :
; 3299 : case XML_ELEMENT_DECL:
; 3300 : case XML_ATTRIBUTE_DECL:
; 3301 : case XML_ENTITY_DECL:
; 3302 : case XML_XINCLUDE_START:
; 3303 : case XML_XINCLUDE_END:
; 3304 : return(NULL);
; 3305 : }
; 3306 : return(NULL);
; 3307 : }
pop ebp
ret 0
$LN21@xmlTextRea:
; 3296 : return(CONSTQSTR(BAD_CAST "xmlns", ns->prefix));
push edx
push OFFSET ??_C@_05PPEFOGKI@xmlns@
push eax
call _xmlDictQLookup
add esp, 12 ; 0000000cH
; 3297 : }
; 3298 :
; 3299 : case XML_ELEMENT_DECL:
; 3300 : case XML_ATTRIBUTE_DECL:
; 3301 : case XML_ENTITY_DECL:
; 3302 : case XML_XINCLUDE_START:
; 3303 : case XML_XINCLUDE_END:
; 3304 : return(NULL);
; 3305 : }
; 3306 : return(NULL);
; 3307 : }
pop ebp
ret 0
$LN5@xmlTextRea:
; 3255 : return(NULL);
xor eax, eax
; 3297 : }
; 3298 :
; 3299 : case XML_ELEMENT_DECL:
; 3300 : case XML_ATTRIBUTE_DECL:
; 3301 : case XML_ENTITY_DECL:
; 3302 : case XML_XINCLUDE_START:
; 3303 : case XML_XINCLUDE_END:
; 3304 : return(NULL);
; 3305 : }
; 3306 : return(NULL);
; 3307 : }
pop ebp
ret 0
npad 3
$LN26@xmlTextRea:
DD $LN8@xmlTextRea
DD $LN11@xmlTextRea
DD $LN12@xmlTextRea
DD $LN13@xmlTextRea
DD $LN15@xmlTextRea
DD $LN16@xmlTextRea
DD $LN17@xmlTextRea
DD $LN5@xmlTextRea
DD $LN20@xmlTextRea
$LN24@xmlTextRea:
DB 0
DB 0
DB 1
DB 2
DB 3
DB 3
DB 3
DB 4
DB 5
DB 3
DB 6
DB 3
DB 5
DB 3
DB 7
DB 7
DB 7
DB 8
DB 7
DB 7
DB 5
_xmlTextReaderConstName ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderConstLocalName
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderConstLocalName PROC ; COMDAT
; 3144 : xmlTextReaderConstLocalName(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edx, DWORD PTR _reader$[ebp]
test edx, edx
je SHORT $LN3@xmlTextRea
; 3145 : xmlNodePtr node;
; 3146 : if ((reader == NULL) || (reader->node == NULL))
mov ecx, DWORD PTR [edx+64]
test ecx, ecx
je SHORT $LN3@xmlTextRea
; 3148 : if (reader->curnode != NULL)
mov eax, DWORD PTR [edx+68]
test eax, eax
cmovne ecx, eax
; 3149 : node = reader->curnode;
; 3150 : else
; 3151 : node = reader->node;
; 3152 : if (node->type == XML_NAMESPACE_DECL) {
mov eax, DWORD PTR [ecx+4]
cmp eax, 18 ; 00000012H
jne SHORT $LN8@xmlTextRea
; 3153 : xmlNsPtr ns = (xmlNsPtr) node;
; 3154 : if (ns->prefix == NULL)
mov eax, DWORD PTR [ecx+12]
test eax, eax
jne SHORT $LN1@xmlTextRea
; 3155 : return(CONSTSTR(BAD_CAST "xmlns"));
push -1
push OFFSET ??_C@_05PPEFOGKI@xmlns@
push DWORD PTR [edx+88]
call _xmlDictLookup
add esp, 12 ; 0000000cH
; 3163 : }
pop ebp
ret 0
$LN8@xmlTextRea:
; 3156 : else
; 3157 : return(ns->prefix);
; 3158 : }
; 3159 : if ((node->type != XML_ELEMENT_NODE) &&
cmp eax, 1
je SHORT $LN9@xmlTextRea
cmp eax, 2
je SHORT $LN9@xmlTextRea
; 3160 : (node->type != XML_ATTRIBUTE_NODE))
; 3161 : return(xmlTextReaderConstName(reader));
mov DWORD PTR _reader$[ebp], edx
; 3163 : }
pop ebp
; 3160 : (node->type != XML_ATTRIBUTE_NODE))
; 3161 : return(xmlTextReaderConstName(reader));
jmp _xmlTextReaderConstName
$LN9@xmlTextRea:
; 3162 : return(node->name);
mov eax, DWORD PTR [ecx+8]
; 3163 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 3147 : return(NULL);
xor eax, eax
$LN1@xmlTextRea:
; 3163 : }
pop ebp
ret 0
_xmlTextReaderConstLocalName ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderConstBaseUri
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderConstBaseUri PROC ; COMDAT
; 3455 : xmlTextReaderConstBaseUri(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
je SHORT $LN3@xmlTextRea
; 3456 : xmlChar *tmp;
; 3457 : const xmlChar *ret;
; 3458 :
; 3459 : if ((reader == NULL) || (reader->node == NULL))
mov eax, DWORD PTR [esi+64]
test eax, eax
je SHORT $LN3@xmlTextRea
; 3461 : tmp = xmlNodeGetBase(NULL, reader->node);
push eax
push 0
call _xmlNodeGetBase
mov edi, eax
add esp, 8
; 3462 : if (tmp == NULL)
test edi, edi
je SHORT $LN3@xmlTextRea
; 3463 : return(NULL);
; 3464 : ret = CONSTSTR(tmp);
push -1
push edi
push DWORD PTR [esi+88]
call _xmlDictLookup
; 3465 : xmlFree(tmp);
push edi
mov esi, eax
call DWORD PTR _xmlFree
add esp, 16 ; 00000010H
; 3466 : return(ret);
mov eax, esi
pop edi
; 3467 : }
pop esi
pop ebp
ret 0
$LN3@xmlTextRea:
pop edi
; 3460 : return(NULL);
xor eax, eax
; 3467 : }
pop esi
pop ebp
ret 0
_xmlTextReaderConstBaseUri ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderIsNamespaceDecl
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderIsNamespaceDecl PROC ; COMDAT
; 4650 : xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
je SHORT $LN9@xmlTextRea
; 4651 : xmlNodePtr node;
; 4652 : if (reader == NULL)
; 4653 : return(-1);
; 4654 : if (reader->node == NULL)
mov ecx, DWORD PTR [eax+64]
test ecx, ecx
je SHORT $LN9@xmlTextRea
; 4656 : if (reader->curnode != NULL)
mov eax, DWORD PTR [eax+68]
test eax, eax
cmovne ecx, eax
; 4657 : node = reader->curnode;
; 4658 : else
; 4659 : node = reader->node;
; 4660 :
; 4661 : if (XML_NAMESPACE_DECL == node->type)
xor eax, eax
cmp DWORD PTR [ecx+4], 18 ; 00000012H
sete al
; 4662 : return(1);
; 4663 : else
; 4664 : return(0);
; 4665 : }
pop ebp
ret 0
$LN9@xmlTextRea:
; 4655 : return(-1);
or eax, -1
; 4662 : return(1);
; 4663 : else
; 4664 : return(0);
; 4665 : }
pop ebp
ret 0
_xmlTextReaderIsNamespaceDecl ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderReadState
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderReadState PROC ; COMDAT
; 1629 : xmlTextReaderReadState(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
jne SHORT $LN2@xmlTextRea
; 1630 : if (reader == NULL)
; 1631 : return(-1);
or eax, -1
; 1633 : }
pop ebp
ret 0
$LN2@xmlTextRea:
; 1632 : return(reader->mode);
mov eax, DWORD PTR [eax]
; 1633 : }
pop ebp
ret 0
_xmlTextReaderReadState ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderQuoteChar
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderQuoteChar PROC ; COMDAT
; 3694 : xmlTextReaderQuoteChar(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
or ecx, -1
mov eax, 34 ; 00000022H
cmp DWORD PTR _reader$[ebp], 0
cmove eax, ecx
; 3695 : if (reader == NULL)
; 3696 : return(-1);
; 3697 : /* TODO maybe lookup the attribute value for " first */
; 3698 : return((int) '"');
; 3699 : }
pop ebp
ret 0
_xmlTextReaderQuoteChar ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderNodeType
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderNodeType PROC ; COMDAT
; 3011 : xmlTextReaderNodeType(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
je $LN2@xmlTextRea
; 3012 : xmlNodePtr node;
; 3013 :
; 3014 : if (reader == NULL)
; 3015 : return(-1);
; 3016 : if (reader->node == NULL)
mov edx, DWORD PTR [esi+64]
test edx, edx
je $LN26@xmlTextRea
; 3017 : return(XML_READER_TYPE_NONE);
; 3018 : if (reader->curnode != NULL)
mov eax, DWORD PTR [esi+68]
mov ecx, edx
test eax, eax
cmovne ecx, eax
; 3019 : node = reader->curnode;
; 3020 : else
; 3021 : node = reader->node;
; 3022 : switch (node->type) {
mov eax, DWORD PTR [ecx+4]
dec eax
cmp eax, 20 ; 00000014H
ja $LN2@xmlTextRea
jmp DWORD PTR $LN29@xmlTextRea[eax*4]
$LN8@xmlTextRea:
; 3023 : case XML_ELEMENT_NODE:
; 3024 : if ((reader->state == XML_TEXTREADER_END) ||
mov eax, DWORD PTR [esi+16]
cmp eax, 2
je SHORT $LN10@xmlTextRea
cmp eax, 4
je SHORT $LN10@xmlTextRea
; 3027 : return(XML_READER_TYPE_ELEMENT);
mov eax, 1
pop esi
; 3072 : }
pop ebp
ret 0
$LN10@xmlTextRea:
; 3025 : (reader->state == XML_TEXTREADER_BACKTRACK))
; 3026 : return(XML_READER_TYPE_END_ELEMENT);
mov eax, 15 ; 0000000fH
pop esi
; 3072 : }
pop ebp
ret 0
$LN11@xmlTextRea:
; 3028 : case XML_NAMESPACE_DECL:
; 3029 : case XML_ATTRIBUTE_NODE:
; 3030 : return(XML_READER_TYPE_ATTRIBUTE);
mov eax, 2
pop esi
; 3072 : }
pop ebp
ret 0
$LN12@xmlTextRea:
; 3031 : case XML_TEXT_NODE:
; 3032 : if (xmlIsBlankNode(reader->node)) {
push edx
call _xmlIsBlankNode
add esp, 4
test eax, eax
je SHORT $LN13@xmlTextRea
; 3033 : if (xmlNodeGetSpacePreserve(reader->node))
push DWORD PTR [esi+64]
call _xmlNodeGetSpacePreserve
add esp, 4
neg eax
sbb eax, eax
neg eax
add eax, 13 ; 0000000dH
pop esi
; 3072 : }
pop ebp
ret 0
$LN13@xmlTextRea:
; 3034 : return(XML_READER_TYPE_SIGNIFICANT_WHITESPACE);
; 3035 : else
; 3036 : return(XML_READER_TYPE_WHITESPACE);
; 3037 : } else {
; 3038 : return(XML_READER_TYPE_TEXT);
mov eax, 3
pop esi
; 3072 : }
pop ebp
ret 0
$LN14@xmlTextRea:
; 3039 : }
; 3040 : case XML_CDATA_SECTION_NODE:
; 3041 : return(XML_READER_TYPE_CDATA);
mov eax, 4
pop esi
; 3072 : }
pop ebp
ret 0
$LN18@xmlTextRea:
; 3042 : case XML_ENTITY_REF_NODE:
; 3043 : return(XML_READER_TYPE_ENTITY_REFERENCE);
mov eax, 5
pop esi
; 3072 : }
pop ebp
ret 0
$LN19@xmlTextRea:
; 3044 : case XML_ENTITY_NODE:
; 3045 : return(XML_READER_TYPE_ENTITY);
mov eax, 6
pop esi
; 3072 : }
pop ebp
ret 0
$LN20@xmlTextRea:
; 3046 : case XML_PI_NODE:
; 3047 : return(XML_READER_TYPE_PROCESSING_INSTRUCTION);
mov eax, 7
pop esi
; 3072 : }
pop ebp
ret 0
$LN21@xmlTextRea:
; 3048 : case XML_COMMENT_NODE:
; 3049 : return(XML_READER_TYPE_COMMENT);
mov eax, 8
pop esi
; 3072 : }
pop ebp
ret 0
$LN22@xmlTextRea:
; 3050 : case XML_DOCUMENT_NODE:
; 3051 : case XML_HTML_DOCUMENT_NODE:
; 3052 : #ifdef LIBXML_DOCB_ENABLED
; 3053 : case XML_DOCB_DOCUMENT_NODE:
; 3054 : #endif
; 3055 : return(XML_READER_TYPE_DOCUMENT);
mov eax, 9
pop esi
; 3072 : }
pop ebp
ret 0
$LN23@xmlTextRea:
; 3056 : case XML_DOCUMENT_FRAG_NODE:
; 3057 : return(XML_READER_TYPE_DOCUMENT_FRAGMENT);
mov eax, 11 ; 0000000bH
pop esi
; 3072 : }
pop ebp
ret 0
$LN24@xmlTextRea:
; 3058 : case XML_NOTATION_NODE:
; 3059 : return(XML_READER_TYPE_NOTATION);
mov eax, 12 ; 0000000cH
pop esi
; 3072 : }
pop ebp
ret 0
$LN25@xmlTextRea:
; 3060 : case XML_DOCUMENT_TYPE_NODE:
; 3061 : case XML_DTD_NODE:
; 3062 : return(XML_READER_TYPE_DOCUMENT_TYPE);
mov eax, 10 ; 0000000aH
pop esi
; 3072 : }
pop ebp
ret 0
$LN26@xmlTextRea:
; 3063 :
; 3064 : case XML_ELEMENT_DECL:
; 3065 : case XML_ATTRIBUTE_DECL:
; 3066 : case XML_ENTITY_DECL:
; 3067 : case XML_XINCLUDE_START:
; 3068 : case XML_XINCLUDE_END:
; 3069 : return(XML_READER_TYPE_NONE);
xor eax, eax
pop esi
; 3072 : }
pop ebp
ret 0
$LN2@xmlTextRea:
; 3070 : }
; 3071 : return(-1);
or eax, -1
pop esi
; 3072 : }
pop ebp
ret 0
npad 2
$LN29@xmlTextRea:
DD $LN8@xmlTextRea
DD $LN11@xmlTextRea
DD $LN12@xmlTextRea
DD $LN14@xmlTextRea
DD $LN18@xmlTextRea
DD $LN19@xmlTextRea
DD $LN20@xmlTextRea
DD $LN21@xmlTextRea
DD $LN22@xmlTextRea
DD $LN25@xmlTextRea
DD $LN23@xmlTextRea
DD $LN24@xmlTextRea
DD $LN22@xmlTextRea
DD $LN25@xmlTextRea
DD $LN26@xmlTextRea
DD $LN26@xmlTextRea
DD $LN26@xmlTextRea
DD $LN11@xmlTextRea
DD $LN26@xmlTextRea
DD $LN26@xmlTextRea
DD $LN22@xmlTextRea
_xmlTextReaderNodeType ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderIsEmptyElement
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderIsEmptyElement PROC ; COMDAT
; 3083 : xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
je SHORT $LN3@xmlTextRea
; 3084 : if ((reader == NULL) || (reader->node == NULL))
mov ecx, DWORD PTR [eax+64]
test ecx, ecx
je SHORT $LN3@xmlTextRea
; 3086 : if (reader->node->type != XML_ELEMENT_NODE)
cmp DWORD PTR [ecx+4], 1
jne SHORT $LN12@xmlTextRea
; 3087 : return(0);
; 3088 : if (reader->curnode != NULL)
cmp DWORD PTR [eax+68], 0
jne SHORT $LN12@xmlTextRea
; 3089 : return(0);
; 3090 : if (reader->node->children != NULL)
cmp DWORD PTR [ecx+12], 0
jne SHORT $LN12@xmlTextRea
; 3091 : return(0);
; 3092 : if (reader->state == XML_TEXTREADER_END)
cmp DWORD PTR [eax+16], 2
je SHORT $LN12@xmlTextRea
; 3094 : if (reader->doc != NULL)
cmp DWORD PTR [eax+4], 0
jne SHORT $LN11@xmlTextRea
; 3095 : return(1);
; 3096 : #ifdef LIBXML_XINCLUDE_ENABLED
; 3097 : if (reader->in_xinclude > 0)
cmp DWORD PTR [eax+168], 0
jg SHORT $LN11@xmlTextRea
; 3099 : #endif
; 3100 : return((reader->node->extra & NODE_IS_EMPTY) != 0);
movzx eax, WORD PTR [ecx+58]
and eax, 1
; 3101 : }
pop ebp
ret 0
$LN11@xmlTextRea:
; 3098 : return(1);
mov eax, 1
; 3101 : }
pop ebp
ret 0
$LN12@xmlTextRea:
; 3093 : return(0);
xor eax, eax
; 3101 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 3085 : return(-1);
or eax, -1
; 3101 : }
pop ebp
ret 0
_xmlTextReaderIsEmptyElement ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderIsDefault
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderIsDefault PROC ; COMDAT
; 3679 : xmlTextReaderIsDefault(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
neg eax
sbb eax, eax
neg eax
dec eax
; 3680 : if (reader == NULL)
; 3681 : return(-1);
; 3682 : return(0);
; 3683 : }
pop ebp
ret 0
_xmlTextReaderIsDefault ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderHasValue
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderHasValue PROC ; COMDAT
; 3529 : xmlTextReaderHasValue(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
jne SHORT $LN4@xmlTextRea
; 3530 : xmlNodePtr node;
; 3531 : if (reader == NULL)
; 3532 : return(-1);
or eax, -1
; 3552 : }
pop ebp
ret 0
$LN4@xmlTextRea:
; 3533 : if (reader->node == NULL)
mov ecx, DWORD PTR [eax+64]
test ecx, ecx
je SHORT $LN9@xmlTextRea
; 3534 : return(0);
; 3535 : if (reader->curnode != NULL)
mov eax, DWORD PTR [eax+68]
test eax, eax
cmovne ecx, eax
; 3536 : node = reader->curnode;
; 3537 : else
; 3538 : node = reader->node;
; 3539 :
; 3540 : switch (node->type) {
mov eax, DWORD PTR [ecx+4]
add eax, -2 ; fffffffeH
cmp eax, 16 ; 00000010H
ja SHORT $LN9@xmlTextRea
movzx eax, BYTE PTR $LN11@xmlTextRea[eax]
jmp DWORD PTR $LN13@xmlTextRea[eax*4]
$LN8@xmlTextRea:
; 3541 : case XML_ATTRIBUTE_NODE:
; 3542 : case XML_TEXT_NODE:
; 3543 : case XML_CDATA_SECTION_NODE:
; 3544 : case XML_PI_NODE:
; 3545 : case XML_COMMENT_NODE:
; 3546 : case XML_NAMESPACE_DECL:
; 3547 : return(1);
mov eax, 1
; 3552 : }
pop ebp
ret 0
$LN9@xmlTextRea:
; 3548 : default:
; 3549 : break;
; 3550 : }
; 3551 : return(0);
xor eax, eax
; 3552 : }
pop ebp
ret 0
$LN13@xmlTextRea:
DD $LN8@xmlTextRea
DD $LN9@xmlTextRea
$LN11@xmlTextRea:
DB 0
DB 0
DB 0
DB 1
DB 1
DB 0
DB 0
DB 1
DB 1
DB 1
DB 1
DB 1
DB 1
DB 1
DB 1
DB 1
DB 0
_xmlTextReaderHasValue ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderHasAttributes
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderHasAttributes PROC ; COMDAT
; 3502 : xmlTextReaderHasAttributes(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
jne SHORT $LN2@xmlTextRea
; 3503 : xmlNodePtr node;
; 3504 : if (reader == NULL)
; 3505 : return(-1);
or eax, -1
; 3518 : }
pop ebp
ret 0
$LN2@xmlTextRea:
; 3506 : if (reader->node == NULL)
mov ecx, DWORD PTR [eax+64]
test ecx, ecx
je SHORT $LN6@xmlTextRea
; 3507 : return(0);
; 3508 : if (reader->curnode != NULL)
mov eax, DWORD PTR [eax+68]
test eax, eax
cmovne ecx, eax
; 3509 : node = reader->curnode;
; 3510 : else
; 3511 : node = reader->node;
; 3512 :
; 3513 : if ((node->type == XML_ELEMENT_NODE) &&
cmp DWORD PTR [ecx+4], 1
jne SHORT $LN6@xmlTextRea
cmp DWORD PTR [ecx+44], 0
jne SHORT $LN7@xmlTextRea
cmp DWORD PTR [ecx+48], 0
je SHORT $LN6@xmlTextRea
$LN7@xmlTextRea:
; 3514 : ((node->properties != NULL) || (node->nsDef != NULL)))
; 3515 : return(1);
mov eax, 1
; 3518 : }
pop ebp
ret 0
$LN6@xmlTextRea:
; 3516 : /* TODO: handle the xmlDecl */
; 3517 : return(0);
xor eax, eax
; 3518 : }
pop ebp
ret 0
_xmlTextReaderHasAttributes ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderDepth
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderDepth PROC ; COMDAT
; 3478 : xmlTextReaderDepth(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov eax, DWORD PTR _reader$[ebp]
test eax, eax
jne SHORT $LN2@xmlTextRea
; 3479 : if (reader == NULL)
; 3480 : return(-1);
or eax, -1
; 3491 : }
pop ebp
ret 0
$LN2@xmlTextRea:
; 3481 : if (reader->node == NULL)
cmp DWORD PTR [eax+64], 0
jne SHORT $LN3@xmlTextRea
; 3482 : return(0);
xor eax, eax
; 3491 : }
pop ebp
ret 0
$LN3@xmlTextRea:
; 3483 :
; 3484 : if (reader->curnode != NULL) {
mov ecx, DWORD PTR [eax+68]
test ecx, ecx
je SHORT $LN4@xmlTextRea
; 3485 : if ((reader->curnode->type == XML_ATTRIBUTE_NODE) ||
mov ecx, DWORD PTR [ecx+4]
cmp ecx, 2
je SHORT $LN6@xmlTextRea
cmp ecx, 18 ; 00000012H
je SHORT $LN6@xmlTextRea
; 3488 : return(reader->depth + 2);
mov eax, DWORD PTR [eax+72]
add eax, 2
; 3491 : }
pop ebp
ret 0
$LN6@xmlTextRea:
; 3486 : (reader->curnode->type == XML_NAMESPACE_DECL))
; 3487 : return(reader->depth + 1);
mov eax, DWORD PTR [eax+72]
inc eax
; 3491 : }
pop ebp
ret 0
$LN4@xmlTextRea:
; 3489 : }
; 3490 : return(reader->depth);
mov eax, DWORD PTR [eax+72]
; 3491 : }
pop ebp
ret 0
_xmlTextReaderDepth ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderAttributeCount
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderAttributeCount PROC ; COMDAT
; 2965 : xmlTextReaderAttributeCount(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _reader$[ebp]
test ecx, ecx
jne SHORT $LN6@xmlTextRea
; 2966 : int ret;
; 2967 : xmlAttrPtr attr;
; 2968 : xmlNsPtr ns;
; 2969 : xmlNodePtr node;
; 2970 :
; 2971 : if (reader == NULL)
; 2972 : return(-1);
or eax, -1
; 2996 : }
; 2997 : return(ret);
; 2998 : }
pop ebp
ret 0
$LN6@xmlTextRea:
; 2973 : if (reader->node == NULL)
mov edx, DWORD PTR [ecx+64]
test edx, edx
je SHORT $LN12@xmlTextRea
; 2974 : return(0);
; 2975 :
; 2976 : if (reader->curnode != NULL)
mov eax, DWORD PTR [ecx+68]
test eax, eax
cmovne edx, eax
; 2977 : node = reader->curnode;
; 2978 : else
; 2979 : node = reader->node;
; 2980 :
; 2981 : if (node->type != XML_ELEMENT_NODE)
cmp DWORD PTR [edx+4], 1
jne SHORT $LN12@xmlTextRea
; 2982 : return(0);
; 2983 : if ((reader->state == XML_TEXTREADER_END) ||
mov eax, DWORD PTR [ecx+16]
cmp eax, 2
je SHORT $LN12@xmlTextRea
cmp eax, 4
je SHORT $LN12@xmlTextRea
; 2986 : ret = 0;
; 2987 : attr = node->properties;
mov ecx, DWORD PTR [edx+44]
xor eax, eax
; 2988 : while (attr != NULL) {
test ecx, ecx
je SHORT $LN3@xmlTextRea
$LL2@xmlTextRea:
; 2989 : ret++;
; 2990 : attr = attr->next;
mov ecx, DWORD PTR [ecx+24]
inc eax
test ecx, ecx
jne SHORT $LL2@xmlTextRea
$LN3@xmlTextRea:
; 2991 : }
; 2992 : ns = node->nsDef;
mov ecx, DWORD PTR [edx+48]
; 2993 : while (ns != NULL) {
test ecx, ecx
je SHORT $LN1@xmlTextRea
$LL4@xmlTextRea:
; 2994 : ret++;
; 2995 : ns = ns->next;
mov ecx, DWORD PTR [ecx]
inc eax
test ecx, ecx
jne SHORT $LL4@xmlTextRea
; 2996 : }
; 2997 : return(ret);
; 2998 : }
pop ebp
ret 0
$LN12@xmlTextRea:
; 2984 : (reader->state == XML_TEXTREADER_BACKTRACK))
; 2985 : return(0);
xor eax, eax
$LN1@xmlTextRea:
; 2996 : }
; 2997 : return(ret);
; 2998 : }
pop ebp
ret 0
_xmlTextReaderAttributeCount ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderReadAttributeValue
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderReadAttributeValue PROC ; COMDAT
; 2890 : xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
je $LN16@xmlTextRea
; 2891 : if (reader == NULL)
; 2892 : return(-1);
; 2893 : if (reader->node == NULL)
mov eax, DWORD PTR [esi+64]
test eax, eax
je $LN16@xmlTextRea
; 2895 : if (reader->curnode == NULL)
push edi
mov edi, DWORD PTR [esi+68]
test edi, edi
je $LN15@xmlTextRea
; 2896 : return(0);
; 2897 : if (reader->curnode->type == XML_ATTRIBUTE_NODE) {
mov ecx, DWORD PTR [edi+4]
cmp ecx, 2
jne SHORT $LN5@xmlTextRea
; 2898 : if (reader->curnode->children == NULL)
mov eax, DWORD PTR [edi+12]
; 2899 : return(0);
; 2900 : reader->curnode = reader->curnode->children;
jmp SHORT $LN19@xmlTextRea
$LN5@xmlTextRea:
; 2901 : } else if (reader->curnode->type == XML_NAMESPACE_DECL) {
cmp ecx, 18 ; 00000012H
jne SHORT $LN8@xmlTextRea
; 2902 : xmlNsPtr ns = (xmlNsPtr) reader->curnode;
; 2903 :
; 2904 : if (reader->faketext == NULL) {
mov edx, DWORD PTR [esi+76]
test edx, edx
jne SHORT $LN10@xmlTextRea
; 2905 : reader->faketext = xmlNewDocText(reader->node->doc,
push DWORD PTR [edi+8]
push DWORD PTR [eax+32]
call _xmlNewDocText
add esp, 8
mov DWORD PTR [esi+76], eax
; 2918 : reader->curnode = reader->curnode->next;
; 2919 : }
; 2920 : return(1);
mov DWORD PTR [esi+68], eax
mov eax, 1
pop edi
pop esi
; 2921 : }
pop ebp
ret 0
$LN10@xmlTextRea:
; 2906 : ns->href);
; 2907 : } else {
; 2908 : if ((reader->faketext->content != NULL) &&
mov ecx, DWORD PTR [edx+40]
test ecx, ecx
je SHORT $LN12@xmlTextRea
lea eax, DWORD PTR [edx+44]
cmp ecx, eax
je SHORT $LN12@xmlTextRea
; 2909 : (reader->faketext->content !=
; 2910 : (xmlChar *) &(reader->faketext->properties)))
; 2911 : xmlFree(reader->faketext->content);
push ecx
call DWORD PTR _xmlFree
add esp, 4
$LN12@xmlTextRea:
; 2912 : reader->faketext->content = xmlStrdup(ns->href);
push DWORD PTR [edi+8]
call _xmlStrdup
mov ecx, DWORD PTR [esi+76]
add esp, 4
mov DWORD PTR [ecx+40], eax
; 2913 : }
; 2914 : reader->curnode = reader->faketext;
mov eax, DWORD PTR [esi+76]
; 2918 : reader->curnode = reader->curnode->next;
; 2919 : }
; 2920 : return(1);
mov DWORD PTR [esi+68], eax
mov eax, 1
pop edi
pop esi
; 2921 : }
pop ebp
ret 0
$LN8@xmlTextRea:
; 2915 : } else {
; 2916 : if (reader->curnode->next == NULL)
mov eax, DWORD PTR [edi+24]
$LN19@xmlTextRea:
; 2918 : reader->curnode = reader->curnode->next;
; 2919 : }
; 2920 : return(1);
test eax, eax
je SHORT $LN15@xmlTextRea
mov DWORD PTR [esi+68], eax
mov eax, 1
pop edi
pop esi
; 2921 : }
pop ebp
ret 0
$LN15@xmlTextRea:
pop edi
; 2917 : return(0);
xor eax, eax
pop esi
; 2921 : }
pop ebp
ret 0
$LN16@xmlTextRea:
; 2894 : return(-1);
or eax, -1
pop esi
; 2921 : }
pop ebp
ret 0
_xmlTextReaderReadAttributeValue ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderReadString
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlTextReaderReadString PROC ; COMDAT
; 1797 : {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov ecx, DWORD PTR _reader$[ebp]
test ecx, ecx
je SHORT $LN5@xmlTextRea
; 1798 : xmlNodePtr node;
; 1799 :
; 1800 : if ((reader == NULL) || (reader->node == NULL))
mov esi, DWORD PTR [ecx+64]
test esi, esi
je SHORT $LN5@xmlTextRea
; 1802 :
; 1803 : node = (reader->curnode != NULL) ? reader->curnode : reader->node;
mov eax, DWORD PTR [ecx+68]
test eax, eax
cmovne esi, eax
; 1804 : switch (node->type) {
mov eax, DWORD PTR [esi+4]
sub eax, 1
je SHORT $LN8@xmlTextRea
sub eax, 1
je SHORT $LN10@xmlTextRea
sub eax, 1
jne SHORT $LN5@xmlTextRea
; 1805 : case XML_TEXT_NODE:
; 1806 : if (node->content != NULL)
mov eax, DWORD PTR [esi+40]
test eax, eax
je SHORT $LN5@xmlTextRea
pop esi
; 1807 : return(xmlStrdup(node->content));
mov DWORD PTR _reader$[ebp], eax
; 1816 : break;
; 1817 : default:
; 1818 : break;
; 1819 : }
; 1820 : return(NULL);
; 1821 : }
pop ebp
; 1807 : return(xmlStrdup(node->content));
jmp _xmlStrdup
$LN10@xmlTextRea:
; 1812 : }
; 1813 : break;
; 1814 : case XML_ATTRIBUTE_NODE:
; 1815 : TODO
call ___xmlGenericError
mov esi, eax
call ___xmlGenericErrorContext
push 1815 ; 00000717H
push OFFSET ??_C@_0GL@PIJMIJNC@c?3?2users?2dag?2documents?2_clients@
push OFFSET ??_C@_0BO@MDEMDPPE@Unimplemented?5block?5at?5?$CFs?3?$CFd?6@
push DWORD PTR [eax]
mov eax, DWORD PTR [esi]
call eax
add esp, 16 ; 00000010H
$LN5@xmlTextRea:
; 1801 : return(NULL);
xor eax, eax
pop esi
; 1816 : break;
; 1817 : default:
; 1818 : break;
; 1819 : }
; 1820 : return(NULL);
; 1821 : }
pop ebp
ret 0
$LN8@xmlTextRea:
; 1808 : break;
; 1809 : case XML_ELEMENT_NODE:
; 1810 : if (xmlTextReaderDoExpand(reader) != -1) {
push ecx
call _xmlTextReaderDoExpand
add esp, 4
cmp eax, -1
je SHORT $LN5@xmlTextRea
; 1811 : return xmlTextReaderCollectSiblings(node->children);
push DWORD PTR [esi+12]
call _xmlTextReaderCollectSiblings
add esp, 4
pop esi
; 1816 : break;
; 1817 : default:
; 1818 : break;
; 1819 : }
; 1820 : return(NULL);
; 1821 : }
pop ebp
ret 0
_xmlTextReaderReadString ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderReadOuterXml
_TEXT SEGMENT
_doc$1$ = 8 ; size = 4
_reader$ = 8 ; size = 4
_xmlTextReaderReadOuterXml PROC ; COMDAT
; 1752 : {
push ebp
mov ebp, esp
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edi, DWORD PTR _reader$[ebp]
mov esi, DWORD PTR [edi+64]
mov ecx, DWORD PTR [esi+32]
mov DWORD PTR _doc$1$[ebp], ecx
; 1647 : if ((reader == NULL) || (reader->node == NULL))
test esi, esi
je $LN14@xmlTextRea
; 1648 : return(NULL);
; 1649 : if (reader->doc != NULL)
cmp DWORD PTR [edi+4], 0
je SHORT $LN10@xmlTextRea
; 1650 : return(reader->node);
mov eax, esi
jmp SHORT $LN7@xmlTextRea
$LN10@xmlTextRea:
; 1651 : if (reader->ctxt == NULL)
cmp DWORD PTR [edi+20], 0
je $LN14@xmlTextRea
; 1652 : return(NULL);
; 1653 : if (xmlTextReaderDoExpand(reader) < 0)
push edi
call _xmlTextReaderDoExpand
add esp, 4
test eax, eax
js SHORT $LN14@xmlTextRea
; 1654 : return(NULL);
; 1655 : return(reader->node);
mov eax, DWORD PTR [edi+64]
mov ecx, DWORD PTR _doc$1$[ebp]
$LN7@xmlTextRea:
; 1753 : xmlChar *resbuf;
; 1754 : xmlNodePtr node;
; 1755 : xmlBufferPtr buff;
; 1756 : xmlDocPtr doc;
; 1757 :
; 1758 : node = reader->node;
; 1759 : doc = node->doc;
; 1760 : if (xmlTextReaderExpand(reader) == NULL) {
test eax, eax
je SHORT $LN14@xmlTextRea
; 1762 : }
; 1763 : /* XXX: Why is the node copied? */
; 1764 : if (node->type == XML_DTD_NODE) {
cmp DWORD PTR [esi+4], 14 ; 0000000eH
push ebx
jne SHORT $LN3@xmlTextRea
; 1765 : node = (xmlNodePtr) xmlCopyDtd((xmlDtdPtr) node);
push esi
call _xmlCopyDtd
add esp, 4
; 1766 : } else {
jmp SHORT $LN16@xmlTextRea
$LN3@xmlTextRea:
; 1767 : node = xmlDocCopyNode(node, doc, 1);
push 1
push ecx
push esi
call _xmlDocCopyNode
add esp, 12 ; 0000000cH
$LN16@xmlTextRea:
; 1768 : }
; 1769 : buff = xmlBufferCreate();
mov ebx, eax
call _xmlBufferCreate
; 1770 : if (xmlNodeDump(buff, doc, node, 0, 0) == -1) {
push 0
push 0
push ebx
push DWORD PTR _doc$1$[ebp]
mov edi, eax
push edi
call _xmlNodeDump
add esp, 20 ; 00000014H
push ebx
cmp eax, -1
jne SHORT $LN5@xmlTextRea
; 1771 : xmlFreeNode(node);
call _xmlFreeNode
; 1772 : xmlBufferFree(buff);
push edi
call _xmlBufferFree
add esp, 8
; 1773 : return NULL;
xor eax, eax
pop ebx
pop edi
; 1782 : }
pop esi
pop ebp
ret 0
$LN5@xmlTextRea:
; 1774 : }
; 1775 :
; 1776 : resbuf = buff->content;
mov esi, DWORD PTR [edi]
; 1777 : buff->content = NULL;
mov DWORD PTR [edi], 0
; 1778 :
; 1779 : xmlFreeNode(node);
call _xmlFreeNode
; 1780 : xmlBufferFree(buff);
push edi
call _xmlBufferFree
add esp, 8
; 1781 : return resbuf;
mov eax, esi
pop ebx
pop edi
; 1782 : }
pop esi
pop ebp
ret 0
$LN14@xmlTextRea:
pop edi
; 1761 : return NULL;
xor eax, eax
; 1782 : }
pop esi
pop ebp
ret 0
_xmlTextReaderReadOuterXml ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderReadInnerXml
_TEXT SEGMENT
_doc$1$ = -4 ; size = 4
_buff$1$ = 8 ; size = 4
_reader$ = 8 ; size = 4
_xmlTextReaderReadInnerXml PROC ; COMDAT
; 1705 : {
push ebp
mov ebp, esp
push ecx
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
; 1647 : if ((reader == NULL) || (reader->node == NULL))
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
je $LN21@xmlTextRea
mov eax, DWORD PTR [esi+64]
test eax, eax
je $LN21@xmlTextRea
; 1648 : return(NULL);
; 1649 : if (reader->doc != NULL)
cmp DWORD PTR [esi+4], 0
jne SHORT $LN24@xmlTextRea
; 1650 : return(reader->node);
; 1651 : if (reader->ctxt == NULL)
cmp DWORD PTR [esi+20], 0
je $LN21@xmlTextRea
; 1652 : return(NULL);
; 1653 : if (xmlTextReaderDoExpand(reader) < 0)
push esi
call _xmlTextReaderDoExpand
add esp, 4
test eax, eax
js $LN21@xmlTextRea
; 1654 : return(NULL);
; 1655 : return(reader->node);
mov eax, DWORD PTR [esi+64]
$LN24@xmlTextRea:
; 1706 : xmlChar *resbuf;
; 1707 : xmlNodePtr node, cur_node;
; 1708 : xmlBufferPtr buff, buff2;
; 1709 : xmlDocPtr doc;
; 1710 :
; 1711 : if (xmlTextReaderExpand(reader) == NULL) {
mov ecx, eax
test ecx, ecx
je $LN21@xmlTextRea
; 1713 : }
; 1714 : doc = reader->node->doc;
push ebx
mov ebx, DWORD PTR [eax+32]
push edi
mov DWORD PTR _doc$1$[ebp], ebx
; 1715 : buff = xmlBufferCreate();
call _xmlBufferCreate
; 1716 : for (cur_node = reader->node->children; cur_node != NULL;
mov ecx, DWORD PTR [esi+64]
mov DWORD PTR _buff$1$[ebp], eax
mov esi, DWORD PTR [ecx+12]
test esi, esi
je SHORT $LN3@xmlTextRea
npad 3
$LL4@xmlTextRea:
; 1717 : cur_node = cur_node->next) {
; 1718 : /* XXX: Why is the node copied? */
; 1719 : node = xmlDocCopyNode(cur_node, doc, 1);
push 1
push ebx
push esi
call _xmlDocCopyNode
mov ebx, eax
; 1720 : buff2 = xmlBufferCreate();
call _xmlBufferCreate
; 1721 : if (xmlNodeDump(buff2, doc, node, 0, 0) == -1) {
push 0
push 0
push ebx
push DWORD PTR _doc$1$[ebp]
mov edi, eax
push edi
call _xmlNodeDump
add esp, 32 ; 00000020H
cmp eax, -1
je SHORT $LN16@xmlTextRea
; 1726 : }
; 1727 : xmlBufferCat(buff, buff2->content);
push DWORD PTR [edi]
push DWORD PTR _buff$1$[ebp]
call _xmlBufferCat
; 1728 : xmlFreeNode(node);
push ebx
call _xmlFreeNode
; 1729 : xmlBufferFree(buff2);
push edi
call _xmlBufferFree
mov esi, DWORD PTR [esi+24]
add esp, 16 ; 00000010H
mov ebx, DWORD PTR _doc$1$[ebp]
test esi, esi
jne SHORT $LL4@xmlTextRea
; 1721 : if (xmlNodeDump(buff2, doc, node, 0, 0) == -1) {
mov eax, DWORD PTR _buff$1$[ebp]
$LN3@xmlTextRea:
; 1730 : }
; 1731 : resbuf = buff->content;
mov esi, DWORD PTR [eax]
; 1732 : buff->content = NULL;
; 1733 :
; 1734 : xmlBufferFree(buff);
push eax
mov DWORD PTR [eax], 0
call _xmlBufferFree
add esp, 4
; 1735 : return resbuf;
mov eax, esi
pop edi
pop ebx
pop esi
; 1736 : }
mov esp, ebp
pop ebp
ret 0
$LN16@xmlTextRea:
; 1722 : xmlFreeNode(node);
push ebx
call _xmlFreeNode
; 1723 : xmlBufferFree(buff2);
push edi
call _xmlBufferFree
; 1724 : xmlBufferFree(buff);
push DWORD PTR _buff$1$[ebp]
call _xmlBufferFree
add esp, 12 ; 0000000cH
; 1725 : return NULL;
xor eax, eax
pop edi
pop ebx
pop esi
; 1736 : }
mov esp, ebp
pop ebp
ret 0
$LN21@xmlTextRea:
; 1712 : return NULL;
xor eax, eax
pop esi
; 1736 : }
mov esp, ebp
pop ebp
ret 0
_xmlTextReaderReadInnerXml ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderRead
_TEXT SEGMENT
_oldnode$1$ = -12 ; size = 4
_olddepth$1$ = -8 ; size = 4
_oldstate$1$ = -4 ; size = 4
$T1 = 8 ; size = 4
_reader$ = 8 ; size = 4
_xmlTextReaderRead PROC ; COMDAT
; 1291 : xmlTextReaderRead(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
sub esp, 12 ; 0000000cH
push ebx
push esi
mov esi, DWORD PTR _reader$[ebp]
mov ecx, OFFSET __BC13D883_xmlreader@c
push edi
call @__CheckForDebuggerJustMyCode@4
xor eax, eax
mov DWORD PTR _olddepth$1$[ebp], 0
mov DWORD PTR _oldstate$1$[ebp], 0
mov DWORD PTR _oldnode$1$[ebp], eax
test esi, esi
je $LN122@xmlTextRea
; 1292 : int val, olddepth = 0;
; 1293 : xmlTextReaderState oldstate = XML_TEXTREADER_START;
; 1294 : xmlNodePtr oldnode = NULL;
; 1295 :
; 1296 :
; 1297 : if (reader == NULL)
; 1298 : return(-1);
; 1299 : reader->curnode = NULL;
mov edi, DWORD PTR [esi+4]
mov DWORD PTR [esi+68], eax
; 1300 : if (reader->doc != NULL)
test edi, edi
je $LN11@xmlTextRea
; 1963 : if (reader->state == XML_TEXTREADER_END)
mov ecx, DWORD PTR [esi+16]
cmp ecx, 2
je $LN132@xmlTextRea
; 1968 : if (reader->doc->children == NULL) {
mov eax, DWORD PTR [esi+64]
npad 2
$next_node$134:
; 1964 : return(0);
; 1965 :
; 1966 : next_node:
; 1967 : if (reader->node == NULL) {
test eax, eax
jne SHORT $LN74@xmlTextRea
; 1968 : if (reader->doc->children == NULL) {
mov eax, DWORD PTR [edi+12]
test eax, eax
je $LN90@xmlTextRea
; 1969 : reader->state = XML_TEXTREADER_END;
; 1970 : return(0);
; 1971 : }
; 1972 :
; 1973 : reader->node = reader->doc->children;
mov DWORD PTR [esi+64], eax
; 1974 : reader->state = XML_TEXTREADER_START;
xor ecx, ecx
mov DWORD PTR [esi+16], 0
; 1975 : goto found_node;
jmp $found_node$135
$LN74@xmlTextRea:
; 1976 : }
; 1977 :
; 1978 : if ((reader->state != XML_TEXTREADER_BACKTRACK) &&
; 1979 : (reader->node->type != XML_DTD_NODE) &&
; 1980 : (reader->node->type != XML_XINCLUDE_START) &&
cmp ecx, 4
je SHORT $LN78@xmlTextRea
mov ecx, DWORD PTR [eax+4]
cmp ecx, 14 ; 0000000eH
je SHORT $LN78@xmlTextRea
cmp ecx, 19 ; 00000013H
je SHORT $LN78@xmlTextRea
cmp ecx, 5
je SHORT $LN78@xmlTextRea
; 1981 : (reader->node->type != XML_ENTITY_REF_NODE)) {
; 1982 : if (reader->node->children != NULL) {
mov edx, DWORD PTR [eax+12]
test edx, edx
je SHORT $LN77@xmlTextRea
; 1983 : reader->node = reader->node->children;
; 1984 : reader->depth++;
inc DWORD PTR [esi+72]
; 1985 : reader->state = XML_TEXTREADER_START;
mov eax, edx
mov DWORD PTR [esi+64], edx
xor ecx, ecx
mov DWORD PTR [esi+16], 0
; 1986 : goto found_node;
jmp SHORT $found_node$135
$LN77@xmlTextRea:
; 1987 : }
; 1988 :
; 1989 : if (reader->node->type == XML_ATTRIBUTE_NODE) {
cmp ecx, 2
jne SHORT $LN78@xmlTextRea
; 1990 : reader->state = XML_TEXTREADER_BACKTRACK;
mov DWORD PTR [esi+16], 4
mov ecx, 4
; 1991 : goto found_node;
jmp SHORT $found_node$135
$LN78@xmlTextRea:
; 1992 : }
; 1993 : }
; 1994 :
; 1995 : if (reader->node->next != NULL) {
mov edx, DWORD PTR [eax+24]
test edx, edx
je SHORT $LN79@xmlTextRea
; 1996 : reader->node = reader->node->next;
mov DWORD PTR [esi+64], edx
; 1997 : reader->state = XML_TEXTREADER_START;
xor ecx, ecx
mov DWORD PTR [esi+16], 0
mov eax, edx
; 1998 : goto found_node;
jmp SHORT $found_node$135
$LN79@xmlTextRea:
; 1999 : }
; 2000 :
; 2001 : if (reader->node->parent != NULL) {
mov ecx, DWORD PTR [eax+20]
test ecx, ecx
je SHORT $LN80@xmlTextRea
; 2002 : if ((reader->node->parent->type == XML_DOCUMENT_NODE) ||
mov edx, DWORD PTR [ecx+4]
mov eax, ecx
cmp edx, 9
je SHORT $LN90@xmlTextRea
cmp edx, 13 ; 0000000dH
je SHORT $LN90@xmlTextRea
; 2003 : (reader->node->parent->type == XML_HTML_DOCUMENT_NODE)) {
; 2004 : reader->state = XML_TEXTREADER_END;
; 2005 : return(0);
; 2006 : }
; 2007 :
; 2008 : reader->node = reader->node->parent;
; 2009 : reader->depth--;
dec DWORD PTR [esi+72]
mov DWORD PTR [esi+64], ecx
; 2010 : reader->state = XML_TEXTREADER_BACKTRACK;
mov ecx, 4
mov DWORD PTR [esi+16], 4
; 2011 : goto found_node;
jmp SHORT $found_node$135
$LN80@xmlTextRea:
; 2012 : }
; 2013 :
; 2014 : reader->state = XML_TEXTREADER_END;
mov DWORD PTR [esi+16], 2
mov ecx, 2
$found_node$135:
; 2015 :
; 2016 : found_node:
; 2017 : if ((reader->node->type == XML_XINCLUDE_START) ||
mov edx, DWORD PTR [eax+4]
cmp edx, 19 ; 00000013H
je $next_node$134
cmp edx, 20 ; 00000014H
jne $LN70@xmlTextRea
; 2018 : (reader->node->type == XML_XINCLUDE_END))
; 2019 : goto next_node;
jmp $next_node$134
$LN90@xmlTextRea:
pop edi
; 1617 : return(0);
; 1618 : }
mov DWORD PTR [esi+16], 2
xor eax, eax
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN11@xmlTextRea:
; 1301 : return(xmlTextReaderReadTree(reader));
; 1302 : if (reader->ctxt == NULL)
mov eax, DWORD PTR [esi+20]
test eax, eax
je $LN122@xmlTextRea
; 1303 : return(-1);
; 1304 :
; 1305 : #ifdef DEBUG_READER
; 1306 : fprintf(stderr, "\nREAD ");
; 1307 : DUMP_READER
; 1308 : #endif
; 1309 : if (reader->mode == XML_TEXTREADER_MODE_INITIAL) {
cmp DWORD PTR [esi], 0
jne $LN13@xmlTextRea
; 1310 : reader->mode = XML_TEXTREADER_MODE_INTERACTIVE;
mov DWORD PTR [esi], 1
$LL4@xmlTextRea:
; 1311 : /*
; 1312 : * Initial state
; 1313 : */
; 1314 : do {
; 1315 : val = xmlTextReaderPushData(reader);
push esi
call _xmlTextReaderPushData
add esp, 4
; 1316 : if (val < 0){
test eax, eax
js $LN92@xmlTextRea
; 1318 : reader->state = XML_TEXTREADER_ERROR;
; 1319 : return(-1);
; 1320 : }
; 1321 : } while ((reader->ctxt->node == NULL) &&
mov eax, DWORD PTR [esi+20]
cmp DWORD PTR [eax+52], 0
jne SHORT $LN17@xmlTextRea
cmp DWORD PTR [esi], 3
lea edi, DWORD PTR [esi+16]
mov DWORD PTR $T1[ebp], edi
je SHORT $LN120@xmlTextRea
cmp DWORD PTR [edi], 5
jne SHORT $LL4@xmlTextRea
jmp SHORT $LN118@xmlTextRea
$LN120@xmlTextRea:
mov DWORD PTR $T1[ebp], edi
$LN118@xmlTextRea:
; 1322 : ((reader->mode != XML_TEXTREADER_MODE_EOF) &&
; 1323 : (reader->state != XML_TEXTREADER_DONE)));
; 1324 : if (reader->ctxt->node == NULL) {
; 1325 : if (reader->ctxt->myDoc != NULL) {
mov eax, DWORD PTR [eax+8]
test eax, eax
je SHORT $LN110@xmlTextRea
; 1326 : reader->node = reader->ctxt->myDoc->children;
mov eax, DWORD PTR [eax+12]
mov DWORD PTR [esi+64], eax
jmp SHORT $LN19@xmlTextRea
$LN110@xmlTextRea:
mov eax, DWORD PTR [esi+64]
mov DWORD PTR $T1[ebp], edi
$LN19@xmlTextRea:
; 1327 : }
; 1328 : if (reader->node == NULL){
test eax, eax
jne SHORT $LN18@xmlTextRea
; 1329 : reader->mode = XML_TEXTREADER_MODE_ERROR;
; 1330 : reader->state = XML_TEXTREADER_ERROR;
mov DWORD PTR [edi], 6
; 1617 : return(0);
; 1618 : }
or eax, -1
pop edi
mov DWORD PTR [esi], 2
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN17@xmlTextRea:
; 1331 : return(-1);
; 1332 : }
; 1333 : reader->state = XML_TEXTREADER_ELEMENT;
; 1334 : } else {
; 1335 : if (reader->ctxt->myDoc != NULL) {
mov ecx, DWORD PTR [eax+8]
test ecx, ecx
je SHORT $LN111@xmlTextRea
; 1336 : reader->node = reader->ctxt->myDoc->children;
mov ecx, DWORD PTR [ecx+12]
mov DWORD PTR [esi+64], ecx
jmp SHORT $LN21@xmlTextRea
$LN111@xmlTextRea:
mov ecx, DWORD PTR [esi+64]
$LN21@xmlTextRea:
; 1337 : }
; 1338 : if (reader->node == NULL)
test ecx, ecx
jne SHORT $LN22@xmlTextRea
; 1339 : reader->node = reader->ctxt->nodeTab[0];
mov eax, DWORD PTR [eax+64]
mov eax, DWORD PTR [eax]
mov DWORD PTR [esi+64], eax
$LN22@xmlTextRea:
; 1340 : reader->state = XML_TEXTREADER_ELEMENT;
lea edi, DWORD PTR [esi+16]
mov DWORD PTR $T1[ebp], edi
$LN18@xmlTextRea:
; 1341 : }
; 1342 : reader->depth = 0;
mov DWORD PTR [edi], 1
; 1343 : reader->ctxt->parseMode = XML_PARSE_READER;
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [esi+72], 0
mov DWORD PTR [eax+436], 5
; 1344 : goto node_found;
jmp $node_found$136
$LN92@xmlTextRea:
pop edi
; 1317 : reader->mode = XML_TEXTREADER_MODE_ERROR;
mov DWORD PTR [esi], 2
; 1617 : return(0);
; 1618 : }
or eax, -1
mov DWORD PTR [esi+16], 6
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN13@xmlTextRea:
; 1345 : }
; 1346 : oldstate = reader->state;
; 1347 : olddepth = reader->ctxt->nodeNr;
mov edx, DWORD PTR [eax+56]
lea edi, DWORD PTR [esi+16]
mov ecx, DWORD PTR [edi]
; 1348 : oldnode = reader->node;
mov eax, DWORD PTR [esi+64]
mov DWORD PTR $T1[ebp], edi
mov DWORD PTR _oldstate$1$[ebp], ecx
mov DWORD PTR _olddepth$1$[ebp], edx
mov DWORD PTR _oldnode$1$[ebp], eax
$get_next_node$137:
; 1349 :
; 1350 : get_next_node:
; 1351 : if (reader->node == NULL) {
test eax, eax
je $LN95@xmlTextRea
npad 4
$LL5@xmlTextRea:
; 1353 : return(0);
; 1354 : else
; 1355 : return(-1);
; 1356 : }
; 1357 :
; 1358 : /*
; 1359 : * If we are not backtracking on ancestors or examined nodes,
; 1360 : * that the parser didn't finished or that we arent at the end
; 1361 : * of stream, continue processing.
; 1362 : */
; 1363 : while ((reader->node != NULL) && (reader->node->next == NULL) &&
; 1364 : (reader->ctxt->nodeNr == olddepth) &&
; 1365 : ((oldstate == XML_TEXTREADER_BACKTRACK) ||
; 1366 : (reader->node->children == NULL) ||
; 1367 : (reader->node->type == XML_ENTITY_REF_NODE) ||
; 1368 : ((reader->node->children != NULL) &&
; 1369 : (reader->node->children->type == XML_TEXT_NODE) &&
; 1370 : (reader->node->children->next == NULL)) ||
; 1371 : (reader->node->type == XML_DTD_NODE) ||
; 1372 : (reader->node->type == XML_DOCUMENT_NODE) ||
; 1373 : (reader->node->type == XML_HTML_DOCUMENT_NODE)) &&
; 1374 : ((reader->ctxt->node == NULL) ||
; 1375 : (reader->ctxt->node == reader->node) ||
; 1376 : (reader->ctxt->node == reader->node->parent)) &&
mov ebx, DWORD PTR [eax+24]
test ebx, ebx
jne SHORT $LN6@xmlTextRea
mov edi, DWORD PTR [esi+20]
cmp DWORD PTR [edi+56], edx
jne SHORT $LN6@xmlTextRea
cmp ecx, 4
je SHORT $LN26@xmlTextRea
mov edx, DWORD PTR [eax+12]
test edx, edx
je SHORT $LN26@xmlTextRea
mov ecx, DWORD PTR [eax+4]
cmp ecx, 5
je SHORT $LN26@xmlTextRea
cmp DWORD PTR [edx+4], 3
jne SHORT $LN27@xmlTextRea
cmp DWORD PTR [edx+24], ebx
je SHORT $LN26@xmlTextRea
$LN27@xmlTextRea:
cmp ecx, 14 ; 0000000eH
je SHORT $LN26@xmlTextRea
cmp ecx, 9
je SHORT $LN26@xmlTextRea
cmp ecx, 13 ; 0000000dH
jne SHORT $LN131@xmlTextRea
$LN26@xmlTextRea:
mov ecx, DWORD PTR [edi+52]
test ecx, ecx
je SHORT $LN28@xmlTextRea
cmp ecx, eax
je SHORT $LN28@xmlTextRea
cmp ecx, DWORD PTR [eax+20]
jne SHORT $LN131@xmlTextRea
$LN28@xmlTextRea:
cmp DWORD PTR [edi+172], -1
je SHORT $LN131@xmlTextRea
; 1377 : (reader->ctxt->instate != XML_PARSER_EOF)) {
; 1378 : val = xmlTextReaderPushData(reader);
push esi
call _xmlTextReaderPushData
add esp, 4
; 1379 : if (val < 0){
test eax, eax
js $LN93@xmlTextRea
; 1382 : return(-1);
; 1383 : }
; 1384 : if (reader->node == NULL)
mov eax, DWORD PTR [esi+64]
test eax, eax
je $node_end$138
; 1353 : return(0);
; 1354 : else
; 1355 : return(-1);
; 1356 : }
; 1357 :
; 1358 : /*
; 1359 : * If we are not backtracking on ancestors or examined nodes,
; 1360 : * that the parser didn't finished or that we arent at the end
; 1361 : * of stream, continue processing.
; 1362 : */
; 1363 : while ((reader->node != NULL) && (reader->node->next == NULL) &&
; 1364 : (reader->ctxt->nodeNr == olddepth) &&
; 1365 : ((oldstate == XML_TEXTREADER_BACKTRACK) ||
; 1366 : (reader->node->children == NULL) ||
; 1367 : (reader->node->type == XML_ENTITY_REF_NODE) ||
; 1368 : ((reader->node->children != NULL) &&
; 1369 : (reader->node->children->type == XML_TEXT_NODE) &&
; 1370 : (reader->node->children->next == NULL)) ||
; 1371 : (reader->node->type == XML_DTD_NODE) ||
; 1372 : (reader->node->type == XML_DOCUMENT_NODE) ||
; 1373 : (reader->node->type == XML_HTML_DOCUMENT_NODE)) &&
; 1374 : ((reader->ctxt->node == NULL) ||
; 1375 : (reader->ctxt->node == reader->node) ||
; 1376 : (reader->ctxt->node == reader->node->parent)) &&
mov ecx, DWORD PTR _oldstate$1$[ebp]
mov edx, DWORD PTR _olddepth$1$[ebp]
jmp SHORT $LL5@xmlTextRea
$LN131@xmlTextRea:
; 1385 : goto node_end;
; 1386 : }
; 1387 : if (oldstate != XML_TEXTREADER_BACKTRACK) {
mov ecx, DWORD PTR _oldstate$1$[ebp]
$LN6@xmlTextRea:
cmp ecx, 4
je SHORT $LN32@xmlTextRea
; 1388 : if ((reader->node->children != NULL) &&
; 1389 : (reader->node->type != XML_ENTITY_REF_NODE) &&
; 1390 : (reader->node->type != XML_XINCLUDE_START) &&
mov edx, DWORD PTR [eax+12]
test edx, edx
je SHORT $LN32@xmlTextRea
mov ecx, DWORD PTR [eax+4]
cmp ecx, 5
je SHORT $LN128@xmlTextRea
cmp ecx, 19 ; 00000013H
je SHORT $LN128@xmlTextRea
cmp ecx, 14 ; 0000000eH
je SHORT $LN128@xmlTextRea
; 1391 : (reader->node->type != XML_DTD_NODE)) {
; 1392 : reader->node = reader->node->children;
; 1393 : reader->depth++;
; 1394 : reader->state = XML_TEXTREADER_ELEMENT;
mov eax, DWORD PTR $T1[ebp]
inc DWORD PTR [esi+72]
mov DWORD PTR [esi+64], edx
mov DWORD PTR [eax], 1
; 1395 : goto node_found;
jmp $node_found$136
$LN128@xmlTextRea:
; 1396 : }
; 1397 : }
; 1398 : if (reader->node->next != NULL) {
mov ecx, DWORD PTR _oldstate$1$[ebp]
$LN32@xmlTextRea:
test ebx, ebx
je $LN33@xmlTextRea
; 1399 : if ((oldstate == XML_TEXTREADER_ELEMENT) &&
; 1400 : (reader->node->type == XML_ELEMENT_NODE) &&
; 1401 : (reader->node->children == NULL) &&
; 1402 : ((reader->node->extra & NODE_IS_EMPTY) == 0)
; 1403 : #ifdef LIBXML_XINCLUDE_ENABLED
; 1404 : && (reader->in_xinclude <= 0)
cmp ecx, 1
jne SHORT $LN34@xmlTextRea
cmp DWORD PTR [eax+4], ecx
jne SHORT $LN34@xmlTextRea
cmp DWORD PTR [eax+12], 0
jne SHORT $LN34@xmlTextRea
test BYTE PTR [eax+58], cl
jne SHORT $LN34@xmlTextRea
cmp DWORD PTR [esi+168], 0
jg SHORT $LN34@xmlTextRea
; 1405 : #endif
; 1406 : ) {
; 1407 : reader->state = XML_TEXTREADER_END;
mov eax, DWORD PTR $T1[ebp]
mov DWORD PTR [eax], 2
; 1408 : goto node_found;
jmp $node_found$136
$LN34@xmlTextRea:
; 1409 : }
; 1410 : #ifdef LIBXML_REGEXP_ENABLED
; 1411 : if ((reader->validate) &&
cmp DWORD PTR [esi+8], 0
mov ecx, eax
je SHORT $LN35@xmlTextRea
cmp DWORD PTR [eax+4], 1
jne SHORT $LN35@xmlTextRea
; 1412 : (reader->node->type == XML_ELEMENT_NODE))
; 1413 : xmlTextReaderValidatePop(reader);
push esi
call _xmlTextReaderValidatePop
mov ecx, DWORD PTR [esi+64]
add esp, 4
$LN35@xmlTextRea:
; 1414 : #endif /* LIBXML_REGEXP_ENABLED */
; 1415 : if ((reader->preserves > 0) &&
mov eax, DWORD PTR [esi+184]
mov edx, eax
test eax, eax
jle SHORT $LN36@xmlTextRea
test BYTE PTR [ecx+58], 4
je SHORT $LN36@xmlTextRea
; 1416 : (reader->node->extra & NODE_IS_SPRESERVED))
; 1417 : reader->preserves--;
lea edx, DWORD PTR [eax-1]
mov DWORD PTR [esi+184], edx
$LN36@xmlTextRea:
; 1418 : reader->node = reader->node->next;
; 1419 : reader->state = XML_TEXTREADER_ELEMENT;
mov eax, DWORD PTR $T1[ebp]
mov edi, DWORD PTR [ecx+24]
mov DWORD PTR [esi+64], edi
mov DWORD PTR [eax], 1
; 1420 :
; 1421 : /*
; 1422 : * Cleanup of the old node
; 1423 : */
; 1424 : if ((reader->preserves == 0) &&
; 1425 : #ifdef LIBXML_XINCLUDE_ENABLED
; 1426 : (reader->in_xinclude == 0) &&
; 1427 : #endif
; 1428 : (reader->entNr == 0) &&
; 1429 : (reader->node->prev != NULL) &&
test edx, edx
jne $node_found$136
cmp DWORD PTR [esi+168], edx
jne $node_found$136
cmp DWORD PTR [esi+96], edx
jne $node_found$136
mov edi, DWORD PTR [edi+28]
test edi, edi
je $node_found$136
cmp DWORD PTR [edi+4], 14 ; 0000000eH
je $node_found$136
; 1430 : (reader->node->prev->type != XML_DTD_NODE)) {
; 1431 : xmlNodePtr tmp = reader->node->prev;
; 1432 : if ((tmp->extra & NODE_IS_PRESERVED) == 0) {
test BYTE PTR [edi+58], 2
jne $node_found$136
; 1433 : xmlUnlinkNode(tmp);
push edi
call _xmlUnlinkNode
; 1434 : xmlTextReaderFreeNode(reader, tmp);
push edi
push esi
call _xmlTextReaderFreeNode
add esp, 12 ; 0000000cH
; 1435 : }
; 1436 : }
; 1437 :
; 1438 : goto node_found;
jmp $node_found$136
$LN33@xmlTextRea:
; 1439 : }
; 1440 : if ((oldstate == XML_TEXTREADER_ELEMENT) &&
; 1441 : (reader->node->type == XML_ELEMENT_NODE) &&
; 1442 : (reader->node->children == NULL) &&
cmp ecx, 1
jne SHORT $LN39@xmlTextRea
cmp DWORD PTR [eax+4], ecx
jne SHORT $LN39@xmlTextRea
cmp DWORD PTR [eax+12], 0
jne SHORT $LN39@xmlTextRea
test BYTE PTR [eax+58], cl
jne SHORT $LN39@xmlTextRea
; 1443 : ((reader->node->extra & NODE_IS_EMPTY) == 0)) {;
; 1444 : reader->state = XML_TEXTREADER_END;
mov eax, DWORD PTR $T1[ebp]
mov DWORD PTR [eax], 2
; 1445 : goto node_found;
jmp $node_found$136
$LN39@xmlTextRea:
; 1446 : }
; 1447 : #ifdef LIBXML_REGEXP_ENABLED
; 1448 : if ((reader->validate != XML_TEXTREADER_NOT_VALIDATE) && (reader->node->type == XML_ELEMENT_NODE))
cmp DWORD PTR [esi+8], 0
mov ecx, eax
je SHORT $LN40@xmlTextRea
cmp DWORD PTR [eax+4], 1
jne SHORT $LN40@xmlTextRea
; 1449 : xmlTextReaderValidatePop(reader);
push esi
call _xmlTextReaderValidatePop
mov ecx, DWORD PTR [esi+64]
add esp, 4
$LN40@xmlTextRea:
; 1450 : #endif /* LIBXML_REGEXP_ENABLED */
; 1451 : if ((reader->preserves > 0) &&
mov eax, DWORD PTR [esi+184]
mov edx, eax
test eax, eax
jle SHORT $LN41@xmlTextRea
test BYTE PTR [ecx+58], 4
je SHORT $LN41@xmlTextRea
; 1452 : (reader->node->extra & NODE_IS_SPRESERVED))
; 1453 : reader->preserves--;
lea edx, DWORD PTR [eax-1]
mov DWORD PTR [esi+184], edx
$LN41@xmlTextRea:
; 1454 : reader->node = reader->node->parent;
mov edi, DWORD PTR [ecx+20]
mov DWORD PTR [esi+64], edi
; 1455 : if ((reader->node == NULL) ||
; 1456 : (reader->node->type == XML_DOCUMENT_NODE) ||
; 1457 : #ifdef LIBXML_DOCB_ENABLED
; 1458 : (reader->node->type == XML_DOCB_DOCUMENT_NODE) ||
test edi, edi
je $LN43@xmlTextRea
mov eax, DWORD PTR [edi+4]
cmp eax, 9
je $LN43@xmlTextRea
cmp eax, 21 ; 00000015H
je $LN43@xmlTextRea
cmp eax, 13 ; 0000000dH
je $LN43@xmlTextRea
; 1482 : }
; 1483 :
; 1484 : goto node_end;
; 1485 : }
; 1486 : if ((reader->preserves == 0) &&
; 1487 : #ifdef LIBXML_XINCLUDE_ENABLED
; 1488 : (reader->in_xinclude == 0) &&
; 1489 : #endif
; 1490 : (reader->entNr == 0) &&
; 1491 : (reader->node->last != NULL) &&
test edx, edx
jne SHORT $LN47@xmlTextRea
cmp DWORD PTR [esi+168], edx
jne SHORT $LN47@xmlTextRea
cmp DWORD PTR [esi+96], edx
jne SHORT $LN47@xmlTextRea
mov edi, DWORD PTR [edi+16]
test edi, edi
je SHORT $LN47@xmlTextRea
test BYTE PTR [edi+58], 2
jne SHORT $LN47@xmlTextRea
; 1492 : ((reader->node->last->extra & NODE_IS_PRESERVED) == 0)) {
; 1493 : xmlNodePtr tmp = reader->node->last;
; 1494 : xmlUnlinkNode(tmp);
push edi
call _xmlUnlinkNode
; 1495 : xmlTextReaderFreeNode(reader, tmp);
push edi
push esi
call _xmlTextReaderFreeNode
add esp, 12 ; 0000000cH
$LN47@xmlTextRea:
; 1496 : }
; 1497 : reader->depth--;
; 1498 : reader->state = XML_TEXTREADER_BACKTRACK;
mov eax, DWORD PTR $T1[ebp]
dec DWORD PTR [esi+72]
mov DWORD PTR [eax], 4
$node_found$136:
; 1499 :
; 1500 : node_found:
; 1501 : DUMP_READER
; 1502 :
; 1503 : /*
; 1504 : * If we are in the middle of a piece of CDATA make sure it's finished
; 1505 : */
; 1506 : if ((reader->node != NULL) &&
; 1507 : (reader->node->next == NULL) &&
mov eax, DWORD PTR [esi+64]
test eax, eax
je SHORT $LN50@xmlTextRea
cmp DWORD PTR [eax+24], 0
jne SHORT $LN50@xmlTextRea
mov eax, DWORD PTR [eax+4]
cmp eax, 3
je SHORT $LN49@xmlTextRea
cmp eax, 4
jne SHORT $LN50@xmlTextRea
$LN49@xmlTextRea:
; 1508 : ((reader->node->type == XML_TEXT_NODE) ||
; 1509 : (reader->node->type == XML_CDATA_SECTION_NODE))) {
; 1510 : if (xmlTextReaderExpand(reader) == NULL)
push esi
call _xmlTextReaderExpand
add esp, 4
test eax, eax
je $LN122@xmlTextRea
$LN50@xmlTextRea:
; 1511 : return -1;
; 1512 : }
; 1513 :
; 1514 : #ifdef LIBXML_XINCLUDE_ENABLED
; 1515 : /*
; 1516 : * Handle XInclude if asked for
; 1517 : */
; 1518 : if ((reader->xinclude) && (reader->node != NULL) &&
; 1519 : (reader->node->type == XML_ELEMENT_NODE) &&
; 1520 : (reader->node->ns != NULL) &&
cmp DWORD PTR [esi+156], 0
je $LN51@xmlTextRea
mov eax, DWORD PTR [esi+64]
test eax, eax
je $LN51@xmlTextRea
cmp DWORD PTR [eax+4], 1
jne $LN51@xmlTextRea
mov eax, DWORD PTR [eax+36]
test eax, eax
je $LN51@xmlTextRea
push OFFSET ??_C@_0CA@MIIEHMNN@http?3?1?1www?4w3?4org?12003?1XInclude@
push DWORD PTR [eax+8]
call _xmlStrEqual
add esp, 8
test eax, eax
jne SHORT $LN52@xmlTextRea
mov eax, DWORD PTR [esi+64]
push OFFSET ??_C@_0CA@JAOIMFBM@http?3?1?1www?4w3?4org?12001?1XInclude@
mov eax, DWORD PTR [eax+36]
push DWORD PTR [eax+8]
call _xmlStrEqual
add esp, 8
test eax, eax
je SHORT $LN51@xmlTextRea
$LN52@xmlTextRea:
; 1521 : ((xmlStrEqual(reader->node->ns->href, XINCLUDE_NS)) ||
; 1522 : (xmlStrEqual(reader->node->ns->href, XINCLUDE_OLD_NS)))) {
; 1523 : if (reader->xincctxt == NULL) {
cmp DWORD PTR [esi+164], 0
jne SHORT $LN53@xmlTextRea
; 1524 : reader->xincctxt = xmlXIncludeNewContext(reader->ctxt->myDoc);
mov eax, DWORD PTR [esi+20]
push DWORD PTR [eax+8]
call _xmlXIncludeNewContext
; 1525 : xmlXIncludeSetFlags(reader->xincctxt,
mov ecx, DWORD PTR [esi+188]
and ecx, -32769 ; ffff7fffH
mov DWORD PTR [esi+164], eax
push ecx
push eax
call _xmlXIncludeSetFlags
add esp, 12 ; 0000000cH
$LN53@xmlTextRea:
; 1526 : reader->parserFlags & (~XML_PARSE_NOXINCNODE));
; 1527 : }
; 1528 : /*
; 1529 : * expand that node and process it
; 1530 : */
; 1531 : if (xmlTextReaderExpand(reader) == NULL)
push esi
call _xmlTextReaderExpand
add esp, 4
test eax, eax
je $LN122@xmlTextRea
; 1532 : return -1;
; 1533 : xmlXIncludeProcessNode(reader->xincctxt, reader->node);
push DWORD PTR [esi+64]
push DWORD PTR [esi+164]
call _xmlXIncludeProcessNode
add esp, 8
$LN51@xmlTextRea:
; 1534 : }
; 1535 : if ((reader->node != NULL) && (reader->node->type == XML_XINCLUDE_START)) {
mov eax, DWORD PTR [esi+64]
test eax, eax
je $LN57@xmlTextRea
mov ecx, DWORD PTR [eax+4]
cmp ecx, 19 ; 00000013H
jne SHORT $LN55@xmlTextRea
; 1536 : reader->in_xinclude++;
inc DWORD PTR [esi+168]
; 1537 : goto get_next_node;
mov ecx, DWORD PTR _oldstate$1$[ebp]
mov edx, DWORD PTR _olddepth$1$[ebp]
jmp $get_next_node$137
$LN55@xmlTextRea:
; 1538 : }
; 1539 : if ((reader->node != NULL) && (reader->node->type == XML_XINCLUDE_END)) {
cmp ecx, 20 ; 00000014H
jne SHORT $LN112@xmlTextRea
; 1540 : reader->in_xinclude--;
dec DWORD PTR [esi+168]
; 1541 : goto get_next_node;
mov ecx, DWORD PTR _oldstate$1$[ebp]
mov edx, DWORD PTR _olddepth$1$[ebp]
jmp $get_next_node$137
$LN112@xmlTextRea:
; 1542 : }
; 1543 : #endif
; 1544 : /*
; 1545 : * Handle entities enter and exit when in entity replacement mode
; 1546 : */
; 1547 : if ((reader->node != NULL) &&
; 1548 : (reader->node->type == XML_ENTITY_REF_NODE) &&
; 1549 : (reader->ctxt != NULL) && (reader->ctxt->replaceEntities == 1)) {
cmp ecx, 5
jne SHORT $LN57@xmlTextRea
mov edx, DWORD PTR [esi+20]
test edx, edx
je SHORT $LN57@xmlTextRea
cmp DWORD PTR [edx+16], 1
jne SHORT $LN57@xmlTextRea
; 1550 : /*
; 1551 : * Case where the underlying tree is not availble, lookup the entity
; 1552 : * and walk it.
; 1553 : */
; 1554 : if ((reader->node->children == NULL) && (reader->ctxt->sax != NULL) &&
cmp DWORD PTR [eax+12], 0
mov ecx, eax
jne SHORT $LN59@xmlTextRea
mov edi, DWORD PTR [edx]
test edi, edi
je SHORT $LN59@xmlTextRea
mov ebx, DWORD PTR [edi+20]
test ebx, ebx
je SHORT $LN59@xmlTextRea
; 1555 : (reader->ctxt->sax->getEntity != NULL)) {
; 1556 : reader->node->children = (xmlNodePtr)
push DWORD PTR [eax+8]
mov edi, DWORD PTR [esi+64]
push edx
call ebx
mov DWORD PTR [edi+12], eax
add esp, 8
mov ecx, DWORD PTR [esi+64]
$LN59@xmlTextRea:
; 1557 : reader->ctxt->sax->getEntity(reader->ctxt, reader->node->name);
; 1558 : }
; 1559 :
; 1560 : if ((reader->node->children != NULL) &&
; 1561 : (reader->node->children->type == XML_ENTITY_DECL) &&
mov eax, DWORD PTR [ecx+12]
mov edi, ecx
test eax, eax
je SHORT $LN61@xmlTextRea
cmp DWORD PTR [eax+4], 17 ; 00000011H
jne SHORT $LN61@xmlTextRea
cmp DWORD PTR [eax+12], 0
je SHORT $LN61@xmlTextRea
; 1562 : (reader->node->children->children != NULL)) {
; 1563 : xmlTextReaderEntPush(reader, reader->node);
push ecx
push esi
call _xmlTextReaderEntPush
; 1564 : reader->node = reader->node->children->children;
mov eax, DWORD PTR [esi+64]
add esp, 8
mov eax, DWORD PTR [eax+12]
mov edi, DWORD PTR [eax+12]
mov DWORD PTR [esi+64], edi
; 1565 : }
; 1566 : #ifdef LIBXML_REGEXP_ENABLED
; 1567 : } else if ((reader->node != NULL) &&
jmp SHORT $LN61@xmlTextRea
$LN57@xmlTextRea:
; 1568 : (reader->node->type == XML_ENTITY_REF_NODE) &&
; 1569 : (reader->ctxt != NULL) && (reader->validate)) {
mov edi, eax
test eax, eax
je SHORT $LN61@xmlTextRea
cmp DWORD PTR [eax+4], 5
jne SHORT $LN61@xmlTextRea
cmp DWORD PTR [esi+20], 0
je SHORT $LN61@xmlTextRea
cmp DWORD PTR [esi+8], 0
je SHORT $LN61@xmlTextRea
; 1570 : xmlTextReaderValidateEntity(reader);
push esi
call _xmlTextReaderValidateEntity
mov edi, DWORD PTR [esi+64]
add esp, 4
$LN61@xmlTextRea:
; 1571 : #endif /* LIBXML_REGEXP_ENABLED */
; 1572 : }
; 1573 : if ((reader->node != NULL) &&
; 1574 : (reader->node->type == XML_ENTITY_DECL) &&
; 1575 : (reader->ent != NULL) && (reader->ent->children == reader->node)) {
test edi, edi
je SHORT $LN62@xmlTextRea
cmp DWORD PTR [edi+4], 17 ; 00000011H
jne SHORT $LN62@xmlTextRea
mov eax, DWORD PTR [esi+92]
test eax, eax
je SHORT $LN62@xmlTextRea
cmp DWORD PTR [eax+12], edi
jne SHORT $LN62@xmlTextRea
; 1576 : reader->node = xmlTextReaderEntPop(reader);
push esi
call _xmlTextReaderEntPop
; 1577 : reader->depth++;
; 1578 : goto get_next_node;
mov ecx, DWORD PTR _oldstate$1$[ebp]
add esp, 4
inc DWORD PTR [esi+72]
mov edx, DWORD PTR _olddepth$1$[ebp]
mov DWORD PTR [esi+64], eax
jmp $get_next_node$137
$LN93@xmlTextRea:
; 1380 : reader->mode = XML_TEXTREADER_MODE_ERROR;
; 1381 : reader->state = XML_TEXTREADER_ERROR;
mov eax, DWORD PTR $T1[ebp]
pop edi
mov DWORD PTR [esi], 2
; 1617 : return(0);
; 1618 : }
pop esi
mov DWORD PTR [eax], 6
or eax, -1
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN62@xmlTextRea:
; 1579 : }
; 1580 : #ifdef LIBXML_REGEXP_ENABLED
; 1581 : if ((reader->validate != XML_TEXTREADER_NOT_VALIDATE) && (reader->node != NULL)) {
cmp DWORD PTR [esi+8], 0
je SHORT $LN125@xmlTextRea
test edi, edi
je SHORT $LN125@xmlTextRea
; 1582 : xmlNodePtr node = reader->node;
; 1583 :
; 1584 : if ((node->type == XML_ELEMENT_NODE) &&
mov eax, DWORD PTR [edi+4]
cmp eax, 1
jne SHORT $LN64@xmlTextRea
mov ecx, DWORD PTR $T1[ebp]
mov eax, DWORD PTR [ecx]
cmp eax, 2
je SHORT $LN66@xmlTextRea
cmp eax, 4
je SHORT $LN66@xmlTextRea
; 1585 : ((reader->state != XML_TEXTREADER_END) &&
; 1586 : (reader->state != XML_TEXTREADER_BACKTRACK))) {
; 1587 : xmlTextReaderValidatePush(reader);
push esi
call _xmlTextReaderValidatePush
add esp, 4
jmp SHORT $LN125@xmlTextRea
$LN64@xmlTextRea:
; 1588 : } else if ((node->type == XML_TEXT_NODE) ||
cmp eax, 3
je SHORT $LN67@xmlTextRea
cmp eax, 4
jne SHORT $LN125@xmlTextRea
$LN67@xmlTextRea:
; 1589 : (node->type == XML_CDATA_SECTION_NODE)) {
; 1590 : xmlTextReaderValidateCData(reader, node->content,
push DWORD PTR [edi+40]
call _xmlStrlen
push eax
push DWORD PTR [edi+40]
push esi
call _xmlTextReaderValidateCData
add esp, 16 ; 00000010H
$LN125@xmlTextRea:
; 1591 : xmlStrlen(node->content));
; 1592 : }
; 1593 : }
; 1594 : #endif /* LIBXML_REGEXP_ENABLED */
; 1595 : #ifdef LIBXML_PATTERN_ENABLED
; 1596 : if ((reader->patternNr > 0) && (reader->state != XML_TEXTREADER_END) &&
mov ecx, DWORD PTR $T1[ebp]
$LN66@xmlTextRea:
mov eax, DWORD PTR [esi+172]
test eax, eax
jle SHORT $LN8@xmlTextRea
mov ecx, DWORD PTR [ecx]
cmp ecx, 2
je SHORT $LN8@xmlTextRea
cmp ecx, 4
je SHORT $LN8@xmlTextRea
; 1597 : (reader->state != XML_TEXTREADER_BACKTRACK)) {
; 1598 : int i;
; 1599 : for (i = 0;i < reader->patternNr;i++) {
xor edi, edi
test eax, eax
jle SHORT $LN8@xmlTextRea
npad 8
$LL9@xmlTextRea:
; 1600 : if (xmlPatternMatch(reader->patternTab[i], reader->node) == 1) {
mov eax, DWORD PTR [esi+180]
push DWORD PTR [esi+64]
push DWORD PTR [eax+edi*4]
call _xmlPatternMatch
add esp, 8
cmp eax, 1
je SHORT $LN99@xmlTextRea
; 1597 : (reader->state != XML_TEXTREADER_BACKTRACK)) {
; 1598 : int i;
; 1599 : for (i = 0;i < reader->patternNr;i++) {
inc edi
cmp edi, DWORD PTR [esi+172]
jl SHORT $LL9@xmlTextRea
; 1600 : if (xmlPatternMatch(reader->patternTab[i], reader->node) == 1) {
jmp SHORT $LN8@xmlTextRea
$LN99@xmlTextRea:
; 1601 : xmlTextReaderPreserve(reader);
push esi
call _xmlTextReaderPreserve
add esp, 4
$LN8@xmlTextRea:
; 1602 : break;
; 1603 : }
; 1604 : }
; 1605 : }
; 1606 : #endif /* LIBXML_PATTERN_ENABLED */
; 1607 : #ifdef LIBXML_SCHEMAS_ENABLED
; 1608 : if ((reader->validate == XML_TEXTREADER_VALIDATE_XSD) &&
; 1609 : (reader->xsdValidErrors == 0) &&
cmp DWORD PTR [esi+8], 4
jne SHORT $LN70@xmlTextRea
cmp DWORD PTR [esi+148], 0
jne SHORT $LN70@xmlTextRea
mov eax, DWORD PTR [esi+140]
test eax, eax
je SHORT $LN70@xmlTextRea
; 1610 : (reader->xsdValidCtxt != NULL)) {
; 1611 : reader->xsdValidErrors = !xmlSchemaIsValid(reader->xsdValidCtxt);
push eax
call _xmlSchemaIsValid
add esp, 4
neg eax
sbb eax, eax
inc eax
mov DWORD PTR [esi+148], eax
$LN70@xmlTextRea:
; 1617 : return(0);
; 1618 : }
pop edi
pop esi
mov eax, 1
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN43@xmlTextRea:
; 1459 : #endif
; 1460 : (reader->node->type == XML_HTML_DOCUMENT_NODE)) {
; 1461 : if (reader->mode != XML_TEXTREADER_MODE_EOF) {
cmp DWORD PTR [esi], 3
je SHORT $LN121@xmlTextRea
; 1462 : val = xmlParseChunk(reader->ctxt, "", 0, 1);
push 1
push 0
push OFFSET ??_C@_00CNPNBAHC@@
push DWORD PTR [esi+20]
call _xmlParseChunk
; 1463 : reader->state = XML_TEXTREADER_DONE;
mov ecx, DWORD PTR $T1[ebp]
add esp, 16 ; 00000010H
mov DWORD PTR [ecx], 5
; 1464 : if (val != 0)
test eax, eax
jne SHORT $LN122@xmlTextRea
$LN121@xmlTextRea:
; 1465 : return(-1);
; 1466 : }
; 1467 : reader->node = NULL;
; 1468 : reader->depth = -1;
; 1469 :
; 1470 : /*
; 1471 : * Cleanup of the old node
; 1472 : */
; 1473 : if ((oldnode != NULL) && (reader->preserves == 0) &&
; 1474 : #ifdef LIBXML_XINCLUDE_ENABLED
; 1475 : (reader->in_xinclude == 0) &&
; 1476 : #endif
; 1477 : (reader->entNr == 0) &&
; 1478 : (oldnode->type != XML_DTD_NODE) &&
mov ebx, DWORD PTR _oldnode$1$[ebp]
mov DWORD PTR [esi+64], 0
mov DWORD PTR [esi+72], -1
test ebx, ebx
je SHORT $node_end$138
cmp DWORD PTR [esi+184], 0
jne SHORT $node_end$138
cmp DWORD PTR [esi+168], 0
jne SHORT $node_end$138
cmp DWORD PTR [esi+96], 0
jne SHORT $node_end$138
cmp DWORD PTR [ebx+4], 14 ; 0000000eH
je SHORT $node_end$138
test BYTE PTR [ebx+58], 2
jne SHORT $node_end$138
; 1479 : ((oldnode->extra & NODE_IS_PRESERVED) == 0)) {
; 1480 : xmlUnlinkNode(oldnode);
push ebx
call _xmlUnlinkNode
; 1481 : xmlTextReaderFreeNode(reader, oldnode);
push ebx
push esi
call _xmlTextReaderFreeNode
add esp, 12 ; 0000000cH
$node_end$138:
; 1612 : }
; 1613 : #endif /* LIBXML_PATTERN_ENABLED */
; 1614 : return(1);
; 1615 : node_end:
; 1616 : reader->state = XML_TEXTREADER_DONE;
mov eax, DWORD PTR $T1[ebp]
mov DWORD PTR [eax], 5
$LN132@xmlTextRea:
; 1617 : return(0);
; 1618 : }
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret 0
$LN95@xmlTextRea:
; 1352 : if (reader->mode == XML_TEXTREADER_MODE_EOF)
cmp DWORD PTR [esi], 3
je SHORT $LN132@xmlTextRea
$LN122@xmlTextRea:
pop edi
; 1617 : return(0);
; 1618 : }
pop esi
or eax, -1
pop ebx
mov esp, ebp
pop ebp
ret 0
_xmlTextReaderRead ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlTextReaderSetup
_TEXT SEGMENT
_options$1$ = 8 ; size = 4
_reader$ = 8 ; size = 4
_input$ = 12 ; size = 4
_URL$ = 16 ; size = 4
_encoding$ = 20 ; size = 4
_options$ = 24 ; size = 4
_xmlTextReaderSetup PROC ; COMDAT
; 5125 : {
push ebp
mov ebp, esp
push ebx
push esi
mov esi, DWORD PTR _reader$[ebp]
mov ecx, OFFSET __BC13D883_xmlreader@c
push edi
call @__CheckForDebuggerJustMyCode@4
test esi, esi
jne SHORT $LN4@xmlTextRea
; 5126 : if (reader == NULL) {
; 5127 : if (input != NULL)
mov eax, DWORD PTR _input$[ebp]
test eax, eax
je $LN49@xmlTextRea
; 5128 : xmlFreeParserInputBuffer(input);
push eax
call _xmlFreeParserInputBuffer
add esp, 4
; 5313 : }
or eax, -1
pop edi
pop esi
pop ebx
pop ebp
ret 0
$LN4@xmlTextRea:
; 5129 : return (-1);
; 5130 : }
; 5131 :
; 5132 : /*
; 5133 : * we force the generation of compact text nodes on the reader
; 5134 : * since usr applications should never modify the tree
; 5135 : */
; 5136 : options |= XML_PARSE_COMPACT;
mov ebx, DWORD PTR _options$[ebp]
; 5137 :
; 5138 : reader->doc = NULL;
; 5139 : reader->entNr = 0;
; 5140 : reader->parserFlags = options;
; 5141 : reader->validate = XML_TEXTREADER_NOT_VALIDATE;
; 5142 : if ((input != NULL) && (reader->input != NULL) &&
mov edi, DWORD PTR _input$[ebp]
or ebx, 65536 ; 00010000H
mov DWORD PTR _options$1$[ebp], ebx
mov DWORD PTR [esi+4], 0
mov DWORD PTR [esi+96], 0
mov DWORD PTR [esi+188], ebx
mov DWORD PTR [esi+8], 0
test edi, edi
je SHORT $LN47@xmlTextRea
mov eax, DWORD PTR [esi+28]
test eax, eax
je SHORT $LN6@xmlTextRea
test BYTE PTR [esi+12], 1
je SHORT $LN6@xmlTextRea
; 5143 : (reader->allocs & XML_TEXTREADER_INPUT)) {
; 5144 : xmlFreeParserInputBuffer(reader->input);
push eax
call _xmlFreeParserInputBuffer
add esp, 4
; 5145 : reader->input = NULL;
; 5146 : reader->allocs -= XML_TEXTREADER_INPUT;
dec DWORD PTR [esi+12]
$LN6@xmlTextRea:
; 5147 : }
; 5148 : if (input != NULL) {
; 5149 : reader->input = input;
; 5150 : reader->allocs |= XML_TEXTREADER_INPUT;
or DWORD PTR [esi+12], 1
mov DWORD PTR [esi+28], edi
$LN47@xmlTextRea:
; 5151 : }
; 5152 : if (reader->buffer == NULL)
mov eax, DWORD PTR [esi+84]
test eax, eax
jne SHORT $LN9@xmlTextRea
; 5153 : reader->buffer = xmlBufCreateSize(100);
push 100 ; 00000064H
call _xmlBufCreateSize
add esp, 4
mov DWORD PTR [esi+84], eax
; 5154 : if (reader->buffer == NULL) {
test eax, eax
jne SHORT $LN9@xmlTextRea
$LN53@xmlTextRea:
; 5313 : }
call ___xmlGenericError
mov esi, eax
call ___xmlGenericErrorContext
push OFFSET ??_C@_0CE@MNBJMFAB@xmlTextReaderSetup?5?3?5malloc?5fai@
push DWORD PTR [eax]
mov eax, DWORD PTR [esi]
call eax
add esp, 8
$LN49@xmlTextRea:
pop edi
pop esi
or eax, -1
pop ebx
pop ebp
ret 0
$LN9@xmlTextRea:
; 5155 : xmlGenericError(xmlGenericErrorContext,
; 5156 : "xmlTextReaderSetup : malloc failed\n");
; 5157 : return (-1);
; 5158 : }
; 5159 : /* no operation on a reader should require a huge buffer */
; 5160 : xmlBufSetAllocationScheme(reader->buffer,
push 5
push eax
call _xmlBufSetAllocationScheme
; 5161 : XML_BUFFER_ALLOC_BOUNDED);
; 5162 : if (reader->sax == NULL)
mov eax, DWORD PTR [esi+24]
add esp, 8
test eax, eax
jne SHORT $LN11@xmlTextRea
; 5163 : reader->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
push 128 ; 00000080H
call DWORD PTR _xmlMalloc
add esp, 4
mov DWORD PTR [esi+24], eax
; 5164 : if (reader->sax == NULL) {
test eax, eax
je SHORT $LN53@xmlTextRea
$LN11@xmlTextRea:
; 5165 : xmlGenericError(xmlGenericErrorContext,
; 5166 : "xmlTextReaderSetup : malloc failed\n");
; 5167 : return (-1);
; 5168 : }
; 5169 : xmlSAXVersion(reader->sax, 2);
push 2
push eax
call _xmlSAXVersion
; 5170 : reader->startElement = reader->sax->startElement;
mov ecx, DWORD PTR [esi+24]
add esp, 8
mov eax, DWORD PTR [ecx+56]
mov DWORD PTR [esi+32], eax
; 5171 : reader->sax->startElement = xmlTextReaderStartElement;
mov DWORD PTR [ecx+56], OFFSET _xmlTextReaderStartElement
; 5172 : reader->endElement = reader->sax->endElement;
mov ecx, DWORD PTR [esi+24]
mov eax, DWORD PTR [ecx+60]
mov DWORD PTR [esi+36], eax
; 5173 : reader->sax->endElement = xmlTextReaderEndElement;
mov DWORD PTR [ecx+60], OFFSET _xmlTextReaderEndElement
; 5174 : #ifdef LIBXML_SAX1_ENABLED
; 5175 : if (reader->sax->initialized == XML_SAX2_MAGIC) {
mov ecx, DWORD PTR [esi+24]
cmp DWORD PTR [ecx+108], -554844497 ; deedbeafH
jne SHORT $LN12@xmlTextRea
; 5176 : #endif /* LIBXML_SAX1_ENABLED */
; 5177 : reader->startElementNs = reader->sax->startElementNs;
mov eax, DWORD PTR [ecx+116]
mov DWORD PTR [esi+40], eax
; 5178 : reader->sax->startElementNs = xmlTextReaderStartElementNs;
mov DWORD PTR [ecx+116], OFFSET _xmlTextReaderStartElementNs
; 5179 : reader->endElementNs = reader->sax->endElementNs;
mov ecx, DWORD PTR [esi+24]
mov eax, DWORD PTR [ecx+120]
mov DWORD PTR [esi+44], eax
; 5180 : reader->sax->endElementNs = xmlTextReaderEndElementNs;
mov DWORD PTR [ecx+120], OFFSET _xmlTextReaderEndElementNs
mov ecx, DWORD PTR [esi+24]
; 5181 : #ifdef LIBXML_SAX1_ENABLED
; 5182 : } else {
jmp SHORT $LN13@xmlTextRea
$LN12@xmlTextRea:
; 5183 : reader->startElementNs = NULL;
mov DWORD PTR [esi+40], 0
; 5184 : reader->endElementNs = NULL;
mov DWORD PTR [esi+44], 0
$LN13@xmlTextRea:
; 5185 : }
; 5186 : #endif /* LIBXML_SAX1_ENABLED */
; 5187 : reader->characters = reader->sax->characters;
mov eax, DWORD PTR [ecx+68]
mov DWORD PTR [esi+48], eax
; 5188 : reader->sax->characters = xmlTextReaderCharacters;
mov DWORD PTR [ecx+68], OFFSET _xmlTextReaderCharacters
; 5189 : reader->sax->ignorableWhitespace = xmlTextReaderCharacters;
mov eax, DWORD PTR [esi+24]
mov DWORD PTR [eax+72], OFFSET _xmlTextReaderCharacters
; 5190 : reader->cdataBlock = reader->sax->cdataBlock;
mov ecx, DWORD PTR [esi+24]
mov eax, DWORD PTR [ecx+100]
mov DWORD PTR [esi+52], eax
; 5191 : reader->sax->cdataBlock = xmlTextReaderCDataBlock;
mov DWORD PTR [ecx+100], OFFSET _xmlTextReaderCDataBlock
; 5192 :
; 5193 : reader->mode = XML_TEXTREADER_MODE_INITIAL;
mov DWORD PTR [esi], 0
; 5194 : reader->node = NULL;
mov DWORD PTR [esi+64], 0
; 5195 : reader->curnode = NULL;
mov DWORD PTR [esi+68], 0
; 5196 : if (input != NULL) {
test edi, edi
je $LN48@xmlTextRea
; 5197 : if (xmlBufUse(reader->input->buffer) < 4) {
mov eax, DWORD PTR [esi+28]
push DWORD PTR [eax+16]
call _xmlBufUse
add esp, 4
cmp eax, 4
jae SHORT $LN15@xmlTextRea
; 5198 : xmlParserInputBufferRead(input, 4);
push 4
push edi
call _xmlParserInputBufferRead
add esp, 8
$LN15@xmlTextRea:
; 5199 : }
; 5200 : if (reader->ctxt == NULL) {
mov eax, DWORD PTR [esi+20]
test eax, eax
jne SHORT $LN16@xmlTextRea
; 5201 : if (xmlBufUse(reader->input->buffer) >= 4) {
mov eax, DWORD PTR [esi+28]
push DWORD PTR [eax+16]
call _xmlBufUse
add esp, 4
cmp eax, 4
jb SHORT $LN18@xmlTextRea
; 5202 : reader->ctxt = xmlCreatePushParserCtxt(reader->sax, NULL,
mov eax, DWORD PTR [esi+28]
; 5203 : (const char *) xmlBufContent(reader->input->buffer),
; 5204 : 4, URL);
; 5205 : reader->base = 0;
; 5206 : reader->cur = 4;
mov edi, 4
push DWORD PTR [eax+16]
call _xmlBufContent
add esp, 4
mov ecx, edi
; 5207 : } else {
jmp SHORT $LN19@xmlTextRea
$LN18@xmlTextRea:
; 5208 : reader->ctxt =
; 5209 : xmlCreatePushParserCtxt(reader->sax, NULL, NULL, 0, URL);
; 5210 : reader->base = 0;
; 5211 : reader->cur = 0;
xor edi, edi
xor eax, eax
xor ecx, ecx
$LN19@xmlTextRea:
; 5212 : }
; 5213 : } else {
push DWORD PTR _URL$[ebp]
push ecx
push eax
mov eax, DWORD PTR [esi+24]
push 0
push eax
call _xmlCreatePushParserCtxt
mov DWORD PTR [esi+20], eax
add esp, 20 ; 00000014H
mov DWORD PTR [esi+56], 0
jmp SHORT $LN17@xmlTextRea
$LN16@xmlTextRea:
; 5214 : xmlParserInputPtr inputStream;
; 5215 : xmlParserInputBufferPtr buf;
; 5216 : xmlCharEncoding enc = XML_CHAR_ENCODING_NONE;
; 5217 :
; 5218 : xmlCtxtReset(reader->ctxt);
push eax
call _xmlCtxtReset
; 5219 : buf = xmlAllocParserInputBuffer(enc);
push 0
call _xmlAllocParserInputBuffer
mov edi, eax
add esp, 8
; 5220 : if (buf == NULL) return(-1);
test edi, edi
je $LN49@xmlTextRea
; 5221 : inputStream = xmlNewInputStream(reader->ctxt);
push DWORD PTR [esi+20]
call _xmlNewInputStream
mov ebx, eax
add esp, 4
; 5222 : if (inputStream == NULL) {
test ebx, ebx
jne SHORT $LN21@xmlTextRea
; 5223 : xmlFreeParserInputBuffer(buf);
push edi
call _xmlFreeParserInputBuffer
add esp, 4
; 5224 : return(-1);
or eax, -1
pop edi
; 5313 : }
pop esi
pop ebx
pop ebp
ret 0
$LN21@xmlTextRea:
; 5225 : }
; 5226 :
; 5227 : if (URL == NULL)
mov eax, DWORD PTR _URL$[ebp]
test eax, eax
je SHORT $LN23@xmlTextRea
$LN22@xmlTextRea:
; 5228 : inputStream->filename = NULL;
; 5229 : else
; 5230 : inputStream->filename = (char *)
push eax
call _xmlCanonicPath
add esp, 4
$LN23@xmlTextRea:
; 5231 : xmlCanonicPath((const xmlChar *) URL);
; 5232 : inputStream->buf = buf;
mov DWORD PTR [ebx+4], eax
mov DWORD PTR [ebx], edi
; 5233 : xmlBufResetInput(buf->buffer, inputStream);
push ebx
push DWORD PTR [edi+16]
call _xmlBufResetInput
; 5234 :
; 5235 : inputPush(reader->ctxt, inputStream);
push ebx
push DWORD PTR [esi+20]
call _inputPush
mov ebx, DWORD PTR _options$1$[ebp]
add esp, 16 ; 00000010H
; 5236 : reader->cur = 0;
xor edi, edi
$LN17@xmlTextRea:
; 5237 : }
; 5238 : if (reader->ctxt == NULL) {
mov DWORD PTR [esi+60], edi
cmp DWORD PTR [esi+20], 0
je $LN53@xmlTextRea
$LN48@xmlTextRea:
; 5239 : xmlGenericError(xmlGenericErrorContext,
; 5240 : "xmlTextReaderSetup : malloc failed\n");
; 5241 : return (-1);
; 5242 : }
; 5243 : }
; 5244 : if (reader->dict != NULL) {
mov ecx, DWORD PTR [esi+20]
mov eax, DWORD PTR [esi+88]
mov edx, DWORD PTR [ecx+296]
test eax, eax
je SHORT $LN25@xmlTextRea
; 5245 : if (reader->ctxt->dict != NULL) {
test edx, edx
je SHORT $LN27@xmlTextRea
; 5246 : if (reader->dict != reader->ctxt->dict) {
cmp eax, edx
je SHORT $LN26@xmlTextRea
; 5247 : xmlDictFree(reader->dict);
push eax
call _xmlDictFree
add esp, 4
; 5248 : reader->dict = reader->ctxt->dict;
; 5249 : }
; 5250 : } else {
jmp SHORT $LN52@xmlTextRea
$LN27@xmlTextRea:
; 5251 : reader->ctxt->dict = reader->dict;
mov DWORD PTR [ecx+296], eax
mov ecx, DWORD PTR [esi+20]
; 5252 : }
; 5253 : } else {
jmp SHORT $LN26@xmlTextRea
$LN25@xmlTextRea:
; 5254 : if (reader->ctxt->dict == NULL)
test edx, edx
jne SHORT $LN30@xmlTextRea
; 5255 : reader->ctxt->dict = xmlDictCreate();
call _xmlDictCreate
mov ecx, DWORD PTR [esi+20]
mov DWORD PTR [ecx+296], eax
$LN52@xmlTextRea:
; 5256 : reader->dict = reader->ctxt->dict;
; 5257 : }
; 5258 : reader->ctxt->_private = reader;
mov ecx, DWORD PTR [esi+20]
$LN30@xmlTextRea:
mov eax, DWORD PTR [ecx+296]
mov DWORD PTR [esi+88], eax
$LN26@xmlTextRea:
mov DWORD PTR [ecx+272], esi
; 5259 : reader->ctxt->linenumbers = 1;
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [eax+280], 1
; 5260 : reader->ctxt->dictNames = 1;
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [eax+364], 1
; 5261 : /*
; 5262 : * use the parser dictionary to allocate all elements and attributes names
; 5263 : */
; 5264 : reader->ctxt->docdict = 1;
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [eax+308], 1
; 5265 : reader->ctxt->parseMode = XML_PARSE_READER;
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [eax+436], 5
; 5266 :
; 5267 : #ifdef LIBXML_XINCLUDE_ENABLED
; 5268 : if (reader->xincctxt != NULL) {
mov eax, DWORD PTR [esi+164]
test eax, eax
je SHORT $LN31@xmlTextRea
; 5269 : xmlXIncludeFreeContext(reader->xincctxt);
push eax
call _xmlXIncludeFreeContext
add esp, 4
; 5270 : reader->xincctxt = NULL;
mov DWORD PTR [esi+164], 0
$LN31@xmlTextRea:
; 5271 : }
; 5272 : if (options & XML_PARSE_XINCLUDE) {
test ebx, 1024 ; 00000400H
je SHORT $LN32@xmlTextRea
; 5273 : reader->xinclude = 1;
; 5274 : reader->xinclude_name = xmlDictLookup(reader->dict, XINCLUDE_NODE, -1);
push -1
push OFFSET ??_C@_07FHOHOHLG@include@
push DWORD PTR [esi+88]
mov DWORD PTR [esi+156], 1
call _xmlDictLookup
add esp, 12 ; 0000000cH
mov DWORD PTR [esi+160], eax
; 5275 : options -= XML_PARSE_XINCLUDE;
sub ebx, 1024 ; 00000400H
; 5276 : } else
jmp SHORT $LN33@xmlTextRea
$LN32@xmlTextRea:
; 5277 : reader->xinclude = 0;
mov DWORD PTR [esi+156], 0
$LN33@xmlTextRea:
; 5278 : reader->in_xinclude = 0;
; 5279 : #endif
; 5280 : #ifdef LIBXML_PATTERN_ENABLED
; 5281 : if (reader->patternTab == NULL) {
cmp DWORD PTR [esi+180], 0
mov DWORD PTR [esi+168], 0
jne SHORT $LN45@xmlTextRea
; 5282 : reader->patternNr = 0;
mov DWORD PTR [esi+172], 0
; 5283 : reader->patternMax = 0;
mov DWORD PTR [esi+176], 0
jmp SHORT $LN3@xmlTextRea
$LN45@xmlTextRea:
mov ecx, DWORD PTR [esi+172]
; 5284 : }
; 5285 : while (reader->patternNr > 0) {
test ecx, ecx
jle SHORT $LN3@xmlTextRea
npad 6
$LL2@xmlTextRea:
; 5286 : reader->patternNr--;
; 5287 : if (reader->patternTab[reader->patternNr] != NULL) {
mov eax, DWORD PTR [esi+180]
dec ecx
mov DWORD PTR [esi+172], ecx
mov eax, DWORD PTR [eax+ecx*4]
test eax, eax
je SHORT $LN35@xmlTextRea
; 5288 : xmlFreePattern(reader->patternTab[reader->patternNr]);
push eax
call _xmlFreePattern
; 5289 : reader->patternTab[reader->patternNr] = NULL;
mov ecx, DWORD PTR [esi+172]
add esp, 4
mov eax, DWORD PTR [esi+180]
mov DWORD PTR [eax+ecx*4], 0
mov ecx, DWORD PTR [esi+172]
$LN35@xmlTextRea:
; 5284 : }
; 5285 : while (reader->patternNr > 0) {
test ecx, ecx
jg SHORT $LL2@xmlTextRea
$LN3@xmlTextRea:
; 5290 : }
; 5291 : }
; 5292 : #endif
; 5293 :
; 5294 : if (options & XML_PARSE_DTDVALID)
test bl, 16 ; 00000010H
je SHORT $LN36@xmlTextRea
; 5295 : reader->validate = XML_TEXTREADER_VALIDATE_DTD;
mov DWORD PTR [esi+8], 1
$LN36@xmlTextRea:
; 5296 :
; 5297 : xmlCtxtUseOptions(reader->ctxt, options);
push ebx
push DWORD PTR [esi+20]
call _xmlCtxtUseOptions
; 5298 : if (encoding != NULL) {
mov eax, DWORD PTR _encoding$[ebp]
add esp, 8
test eax, eax
je SHORT $LN38@xmlTextRea
; 5299 : xmlCharEncodingHandlerPtr hdlr;
; 5300 :
; 5301 : hdlr = xmlFindCharEncodingHandler(encoding);
push eax
call _xmlFindCharEncodingHandler
add esp, 4
; 5302 : if (hdlr != NULL)
test eax, eax
je SHORT $LN38@xmlTextRea
; 5303 : xmlSwitchToEncoding(reader->ctxt, hdlr);
push eax
push DWORD PTR [esi+20]
call _xmlSwitchToEncoding
add esp, 8
$LN38@xmlTextRea:
; 5304 : }
; 5305 : if ((URL != NULL) && (reader->ctxt->input != NULL) &&
mov ecx, DWORD PTR _URL$[ebp]
test ecx, ecx
je SHORT $LN39@xmlTextRea
mov eax, DWORD PTR [esi+20]
mov eax, DWORD PTR [eax+36]
test eax, eax
je SHORT $LN39@xmlTextRea
cmp DWORD PTR [eax+4], 0
jne SHORT $LN39@xmlTextRea
; 5306 : (reader->ctxt->input->filename == NULL))
; 5307 : reader->ctxt->input->filename = (char *)
push ecx
call _xmlStrdup
mov ecx, DWORD PTR [esi+20]
add esp, 4
mov ecx, DWORD PTR [ecx+36]
mov DWORD PTR [ecx+4], eax
$LN39@xmlTextRea:
; 5308 : xmlStrdup((const xmlChar *) URL);
; 5309 :
; 5310 : reader->doc = NULL;
pop edi
mov DWORD PTR [esi+4], 0
; 5311 :
; 5312 : return (0);
xor eax, eax
; 5313 : }
pop esi
pop ebx
pop ebp
ret 0
_xmlTextReaderSetup ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlFreeTextReader
_TEXT SEGMENT
_reader$ = 8 ; size = 4
_xmlFreeTextReader PROC ; COMDAT
; 2218 : xmlFreeTextReader(xmlTextReaderPtr reader) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _reader$[ebp]
test esi, esi
je $LN1@xmlFreeTex
; 2219 : if (reader == NULL)
; 2220 : return;
; 2221 : #ifdef LIBXML_SCHEMAS_ENABLED
; 2222 : if (reader->rngSchemas != NULL) {
mov eax, DWORD PTR [esi+116]
test eax, eax
je SHORT $LN6@xmlFreeTex
; 2223 : xmlRelaxNGFree(reader->rngSchemas);
push eax
call _xmlRelaxNGFree
add esp, 4
; 2224 : reader->rngSchemas = NULL;
mov DWORD PTR [esi+116], 0
$LN6@xmlFreeTex:
; 2225 : }
; 2226 : if (reader->rngValidCtxt != NULL) {
mov eax, DWORD PTR [esi+120]
test eax, eax
je SHORT $LN7@xmlFreeTex
; 2227 : if (! reader->rngPreserveCtxt)
cmp DWORD PTR [esi+124], 0
jne SHORT $LN8@xmlFreeTex
; 2228 : xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt);
push eax
call _xmlRelaxNGFreeValidCtxt
add esp, 4
$LN8@xmlFreeTex:
; 2229 : reader->rngValidCtxt = NULL;
mov DWORD PTR [esi+120], 0
$LN7@xmlFreeTex:
; 2230 : }
; 2231 : if (reader->xsdPlug != NULL) {
mov eax, DWORD PTR [esi+152]
test eax, eax
je SHORT $LN9@xmlFreeTex
; 2232 : xmlSchemaSAXUnplug(reader->xsdPlug);
push eax
call _xmlSchemaSAXUnplug
add esp, 4
; 2233 : reader->xsdPlug = NULL;
mov DWORD PTR [esi+152], 0
$LN9@xmlFreeTex:
; 2234 : }
; 2235 : if (reader->xsdValidCtxt != NULL) {
mov eax, DWORD PTR [esi+140]
test eax, eax
je SHORT $LN10@xmlFreeTex
; 2236 : if (! reader->xsdPreserveCtxt)
cmp DWORD PTR [esi+144], 0
jne SHORT $LN11@xmlFreeTex
; 2237 : xmlSchemaFreeValidCtxt(reader->xsdValidCtxt);
push eax
call _xmlSchemaFreeValidCtxt
add esp, 4
$LN11@xmlFreeTex:
; 2238 : reader->xsdValidCtxt = NULL;
mov DWORD PTR [esi+140], 0
$LN10@xmlFreeTex:
; 2239 : }
; 2240 : if (reader->xsdSchemas != NULL) {
mov eax, DWORD PTR [esi+136]
test eax, eax
je SHORT $LN12@xmlFreeTex
; 2241 : xmlSchemaFree(reader->xsdSchemas);
push eax
call _xmlSchemaFree
add esp, 4
; 2242 : reader->xsdSchemas = NULL;
mov DWORD PTR [esi+136], 0
$LN12@xmlFreeTex:
; 2243 : }
; 2244 : #endif
; 2245 : #ifdef LIBXML_XINCLUDE_ENABLED
; 2246 : if (reader->xincctxt != NULL)
mov eax, DWORD PTR [esi+164]
test eax, eax
je SHORT $LN13@xmlFreeTex
; 2247 : xmlXIncludeFreeContext(reader->xincctxt);
push eax
call _xmlXIncludeFreeContext
add esp, 4
$LN13@xmlFreeTex:
; 2248 : #endif
; 2249 : #ifdef LIBXML_PATTERN_ENABLED
; 2250 : if (reader->patternTab != NULL) {
mov eax, DWORD PTR [esi+180]
test eax, eax
je SHORT $LN14@xmlFreeTex
; 2251 : int i;
; 2252 : for (i = 0;i < reader->patternNr;i++) {
push edi
xor edi, edi
cmp DWORD PTR [esi+172], edi
jle SHORT $LN3@xmlFreeTex
; 2253 : if (reader->patternTab[i] != NULL)
mov edx, eax
$LL4@xmlFreeTex:
mov ecx, DWORD PTR [eax+edi*4]
test ecx, ecx
je SHORT $LN2@xmlFreeTex
; 2254 : xmlFreePattern(reader->patternTab[i]);
push ecx
call _xmlFreePattern
mov eax, DWORD PTR [esi+180]
add esp, 4
mov edx, eax
$LN2@xmlFreeTex:
; 2251 : int i;
; 2252 : for (i = 0;i < reader->patternNr;i++) {
inc edi
cmp edi, DWORD PTR [esi+172]
jl SHORT $LL4@xmlFreeTex
mov eax, edx
$LN3@xmlFreeTex:
; 2255 : }
; 2256 : xmlFree(reader->patternTab);
push eax
call DWORD PTR _xmlFree
add esp, 4
pop edi
$LN14@xmlFreeTex:
; 2257 : }
; 2258 : #endif
; 2259 : if (reader->faketext != NULL) {
mov eax, DWORD PTR [esi+76]
test eax, eax
je SHORT $LN16@xmlFreeTex
; 2260 : xmlFreeNode(reader->faketext);
push eax
call _xmlFreeNode
add esp, 4
$LN16@xmlFreeTex:
; 2261 : }
; 2262 : if (reader->ctxt != NULL) {
mov ecx, DWORD PTR [esi+20]
test ecx, ecx
je SHORT $LN22@xmlFreeTex
; 2263 : if (reader->dict == reader->ctxt->dict)
mov eax, DWORD PTR [esi+88]
cmp eax, DWORD PTR [ecx+296]
jne SHORT $LN18@xmlFreeTex
; 2264 : reader->dict = NULL;
mov DWORD PTR [esi+88], 0
$LN18@xmlFreeTex:
; 2265 : if (reader->ctxt->myDoc != NULL) {
mov eax, DWORD PTR [ecx+8]
test eax, eax
je SHORT $LN19@xmlFreeTex
; 2266 : if (reader->preserve == 0)
cmp DWORD PTR [esi+80], 0
jne SHORT $LN20@xmlFreeTex
; 2267 : xmlTextReaderFreeDoc(reader, reader->ctxt->myDoc);
push eax
push esi
call _xmlTextReaderFreeDoc
mov ecx, DWORD PTR [esi+20]
add esp, 8
$LN20@xmlFreeTex:
; 2268 : reader->ctxt->myDoc = NULL;
mov DWORD PTR [ecx+8], 0
mov ecx, DWORD PTR [esi+20]
$LN19@xmlFreeTex:
; 2269 : }
; 2270 : if ((reader->ctxt->vctxt.vstateTab != NULL) &&
mov eax, DWORD PTR [ecx+160]
test eax, eax
je SHORT $LN21@xmlFreeTex
cmp DWORD PTR [ecx+156], 0
jle SHORT $LN21@xmlFreeTex
; 2271 : (reader->ctxt->vctxt.vstateMax > 0)){
; 2272 : xmlFree(reader->ctxt->vctxt.vstateTab);
push eax
call DWORD PTR _xmlFree
; 2273 : reader->ctxt->vctxt.vstateTab = NULL;
mov eax, DWORD PTR [esi+20]
add esp, 4
mov DWORD PTR [eax+160], 0
; 2274 : reader->ctxt->vctxt.vstateMax = 0;
mov eax, DWORD PTR [esi+20]
mov DWORD PTR [eax+156], 0
$LN21@xmlFreeTex:
; 2275 : }
; 2276 : if (reader->allocs & XML_TEXTREADER_CTXT)
test BYTE PTR [esi+12], 2
je SHORT $LN22@xmlFreeTex
; 2277 : xmlFreeParserCtxt(reader->ctxt);
push DWORD PTR [esi+20]
call _xmlFreeParserCtxt
add esp, 4
$LN22@xmlFreeTex:
; 2278 : }
; 2279 : if (reader->sax != NULL)
mov eax, DWORD PTR [esi+24]
test eax, eax
je SHORT $LN23@xmlFreeTex
; 2280 : xmlFree(reader->sax);
push eax
call DWORD PTR _xmlFree
add esp, 4
$LN23@xmlFreeTex:
; 2281 : if ((reader->input != NULL) && (reader->allocs & XML_TEXTREADER_INPUT))
mov eax, DWORD PTR [esi+28]
test eax, eax
je SHORT $LN24@xmlFreeTex
test BYTE PTR [esi+12], 1
je SHORT $LN24@xmlFreeTex
; 2282 : xmlFreeParserInputBuffer(reader->input);
push eax
call _xmlFreeParserInputBuffer
add esp, 4
$LN24@xmlFreeTex:
; 2283 : if (reader->buffer != NULL)
mov eax, DWORD PTR [esi+84]
test eax, eax
je SHORT $LN25@xmlFreeTex
; 2284 : xmlBufFree(reader->buffer);
push eax
call _xmlBufFree
add esp, 4
$LN25@xmlFreeTex:
; 2285 : if (reader->entTab != NULL)
mov eax, DWORD PTR [esi+104]
test eax, eax
je SHORT $LN26@xmlFreeTex
; 2286 : xmlFree(reader->entTab);
push eax
call DWORD PTR _xmlFree
add esp, 4
$LN26@xmlFreeTex:
; 2287 : if (reader->dict != NULL)
mov eax, DWORD PTR [esi+88]
test eax, eax
je SHORT $LN27@xmlFreeTex
; 2288 : xmlDictFree(reader->dict);
push eax
call _xmlDictFree
add esp, 4
$LN27@xmlFreeTex:
; 2289 : xmlFree(reader);
push esi
call DWORD PTR _xmlFree
add esp, 4
$LN1@xmlFreeTex:
pop esi
; 2290 : }
pop ebp
ret 0
_xmlFreeTextReader ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlNewTextReaderFilename
_TEXT SEGMENT
_URI$ = 8 ; size = 4
_xmlNewTextReaderFilename PROC ; COMDAT
; 2188 : xmlNewTextReaderFilename(const char *URI) {
push ebp
mov ebp, esp
push ebx
push esi
push edi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov edi, DWORD PTR _URI$[ebp]
xor esi, esi
push esi
push edi
call _xmlParserInputBufferCreateFilename
mov ebx, eax
add esp, 8
test ebx, ebx
je SHORT $LN8@xmlNewText
; 2189 : xmlParserInputBufferPtr input;
; 2190 : xmlTextReaderPtr ret;
; 2191 : char *directory = NULL;
; 2192 :
; 2193 : input = xmlParserInputBufferCreateFilename(URI, XML_CHAR_ENCODING_NONE);
; 2194 : if (input == NULL)
; 2195 : return(NULL);
; 2196 : ret = xmlNewTextReader(input, URI);
push edi
push ebx
call _xmlNewTextReader
mov edi, eax
add esp, 8
; 2197 : if (ret == NULL) {
test edi, edi
jne SHORT $LN3@xmlNewText
; 2198 : xmlFreeParserInputBuffer(input);
push ebx
call _xmlFreeParserInputBuffer
add esp, 4
$LN8@xmlNewText:
; 2209 : }
pop edi
pop esi
xor eax, eax
pop ebx
pop ebp
ret 0
$LN3@xmlNewText:
; 2199 : return(NULL);
; 2200 : }
; 2201 : ret->allocs |= XML_TEXTREADER_INPUT;
; 2202 : if (ret->ctxt->directory == NULL)
mov eax, DWORD PTR [edi+20]
or DWORD PTR [edi+12], 1
cmp DWORD PTR [eax+180], esi
jne SHORT $LN4@xmlNewText
; 2203 : directory = xmlParserGetDirectory(URI);
push DWORD PTR _URI$[ebp]
call _xmlParserGetDirectory
mov esi, eax
add esp, 4
mov eax, DWORD PTR [edi+20]
$LN4@xmlNewText:
; 2204 : if ((ret->ctxt->directory == NULL) && (directory != NULL))
cmp DWORD PTR [eax+180], 0
jne SHORT $LN5@xmlNewText
test esi, esi
je SHORT $LN6@xmlNewText
; 2205 : ret->ctxt->directory = (char *) xmlStrdup((xmlChar *) directory);
push esi
call _xmlStrdup
mov ecx, DWORD PTR [edi+20]
add esp, 4
mov DWORD PTR [ecx+180], eax
$LN5@xmlNewText:
; 2206 : if (directory != NULL)
test esi, esi
je SHORT $LN6@xmlNewText
; 2207 : xmlFree(directory);
push esi
call DWORD PTR _xmlFree
add esp, 4
$LN6@xmlNewText:
; 2208 : return(ret);
mov eax, edi
pop edi
; 2209 : }
pop esi
pop ebx
pop ebp
ret 0
_xmlNewTextReaderFilename ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\users\dag\documents\_clients\codeproject authors group\windows on arm\libxml2\libxml2-2.9.9\xmlreader.c
; COMDAT _xmlNewTextReader
_TEXT SEGMENT
_input$ = 8 ; size = 4
_URI$ = 12 ; size = 4
_xmlNewTextReader PROC ; COMDAT
; 2074 : xmlNewTextReader(xmlParserInputBufferPtr input, const char *URI) {
push ebp
mov ebp, esp
push esi
mov ecx, OFFSET __BC13D883_xmlreader@c
call @__CheckForDebuggerJustMyCode@4
mov esi, DWORD PTR _input$[ebp]
test esi, esi
jne SHORT $LN2@xmlNewText
; 2075 : xmlTextReaderPtr ret;
; 2076 :
; 2077 : if (input == NULL)
; 2078 : return(NULL);
xor eax, eax
pop esi
; 2177 : }
pop ebp
ret 0
$LN2@xmlNewText:
push edi
; 2079 : ret = xmlMalloc(sizeof(xmlTextReader));
push 196 ; 000000c4H
call DWORD PTR _xmlMalloc
mov edi, eax
add esp, 4
; 2080 : if (ret == NULL) {
test edi, edi
jne SHORT $LN3@xmlNewText
; 2081 : xmlGenericError(xmlGenericErrorContext,
call ___xmlGenericError
mov esi, eax
call ___xmlGenericErrorContext
push OFFSET ??_C@_0CC@HCDAIILG@xmlNewTextReader?5?3?5malloc?5faile@
push DWORD PTR [eax]
mov eax, DWORD PTR [esi]
call eax
add esp, 8
; 2082 : "xmlNewTextReader : malloc failed\n");
; 2083 : return(NULL);
xor eax, eax
pop edi
pop esi
; 2177 : }
pop ebp
ret 0
$LN3@xmlNewText:
; 2084 : }
; 2085 : memset(ret, 0, sizeof(xmlTextReader));
push 196 ; 000000c4H
push 0
push edi
call _memset
; 2086 : ret->doc = NULL;
; 2087 : ret->entTab = NULL;
; 2088 : ret->entMax = 0;
; 2089 : ret->entNr = 0;
; 2090 : ret->input = input;
; 2091 : ret->buffer = xmlBufCreateSize(100);
push 100 ; 00000064H
mov DWORD PTR [edi+28], esi
call _xmlBufCreateSize
add esp, 16 ; 00000010H
mov DWORD PTR [edi+84], eax
; 2092 : if (ret->buffer == NULL) {
test eax, eax
jne SHORT $LN4@xmlNewText
; 2093 : xmlFree(ret);
push edi
call DWORD PTR _xmlFree
; 2094 : xmlGenericError(xmlGenericErrorContext,
call ___xmlGenericError
mov esi, eax
call ___xmlGenericErrorContext
push OFFSET ??_C@_0CC@HCDAIILG@xmlNewTextReader?5?3?5malloc?5faile@
push DWORD PTR [eax]
mov eax, DWORD PTR [esi]
call eax
add esp, 12 ; 0000000cH
; 2095 : "xmlNewTextReader : malloc failed\n");
; 2096 : return(NULL);
xor eax, eax
pop edi
pop esi
; 2177 : }
pop ebp
ret 0
$LN4@xmlNewText:
; 2097 : }
; 2098 : /* no operation on a reader should require a huge buffer */
; 2099 : xmlBufSetAllocationScheme(ret->buffer,
push 5
push eax
call _xmlBufSetAllocationScheme
; 2100 : XML_BUFFER_ALLOC_BOUNDED);
; 2101 : ret->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
push 128 ; 00000080H
call DWORD PTR _xmlMalloc
add esp, 12 ; 0000000cH
mov DWORD PTR [edi+24], eax
; 2102 : if (ret->sax == NULL) {
test eax, eax
jne SHORT $LN5@xmlNewText
; 2103 : xmlBufFree(ret->buffer);
push DWORD PTR [edi+84]
call _xmlBufFree
; 2104 : xmlFree(ret);
push edi
call DWORD PTR _xmlFree
; 2105 : xmlGenericError(xmlGenericErrorContext,
call ___xmlGenericError
mov esi, eax
call ___xmlGenericErrorContext
push OFFSET ??_C@_0CC@HCDAIILG@xmlNewTextReader?5?3?5malloc?5faile@
push DWORD PTR [eax]
mov eax, DWORD PTR [esi]
call eax
add esp, 16 ; 00000010H
; 2106 : "xmlNewTextReader : malloc failed\n");
; 2107 : return(NULL);
xor eax, eax
pop edi
pop esi
; 2177 : }
pop ebp
ret 0
$LN5@xmlNewText:
; 2108 : }
; 2109 : xmlSAXVersion(ret->sax, 2);
push 2
push eax
call _xmlSAXVersion
; 2110 : ret->startElement = ret->sax->startElement;
mov ecx, DWORD PTR [edi+24]
add esp, 8
mov eax, DWORD PTR [ecx+56]
mov DWORD PTR [edi+32], eax
; 2111 : ret->sax->startElement = xmlTextReaderStartElement;
mov DWORD PTR [ecx+56], OFFSET _xmlTextReaderStartElement
; 2112 : ret->endElement = ret->sax->endElement;
mov ecx, DWORD PTR [edi+24]
mov eax, DWORD PTR [ecx+60]
mov DWORD PTR [edi+36], eax
; 2113 : ret->sax->endElement = xmlTextReaderEndElement;
mov DWORD PTR [ecx+60], OFFSET _xmlTextReaderEndElement
; 2114 : #ifdef LIBXML_SAX1_ENABLED
; 2115 : if (ret->sax->initialized == XML_SAX2_MAGIC) {
mov ecx, DWORD PTR [edi+24]
cmp DWORD PTR [ecx+108], -554844497 ; deedbeafH
jne SHORT $LN6@xmlNewText
; 2116 : #endif /* LIBXML_SAX1_ENABLED */
; 2117 : ret->startElementNs = ret->sax->startElementNs;
mov eax, DWORD PTR [ecx+116]
mov DWORD PTR [edi+40], eax
; 2118 : ret->sax->startElementNs = xmlTextReaderStartElementNs;
mov DWORD PTR [ecx+116], OFFSET _xmlTextReaderStartElementNs
; 2119 : ret->endElementNs = ret->sax->endElementNs;
mov ecx, DWORD PTR [edi+24]
mov eax, DWORD PTR [ecx+120]
mov DWORD PTR [edi+44], eax
; 2120 : ret->sax->endElementNs = xmlTextReaderEndElementNs;
mov DWORD PTR [ecx+120], OFFSET _xmlTextReaderEndElementNs
mov ecx, DWORD PTR [edi+24]
; 2121 : #ifdef LIBXML_SAX1_ENABLED
; 2122 : } else {
jmp SHORT $LN7@xmlNewText
$LN6@xmlNewText:
; 2123 : ret->startElementNs = NULL;
mov DWORD PTR [edi+40], 0
; 2124 : ret->endElementNs = NULL;
mov DWORD PTR [edi+44], 0
$LN7@xmlNewText:
; 2125 : }
; 2126 : #endif /* LIBXML_SAX1_ENABLED */
; 2127 : ret->characters = ret->sax->characters;
mov eax, DWORD PTR [ecx+68]
mov DWORD PTR [edi+48], eax
; 2128 : ret->sax->characters = xmlTextReaderCharacters;
mov DWORD PTR [ecx+68], OFFSET _xmlTextReaderCharacters
; 2129 : ret->sax->ignorableWhitespace = xmlTextReaderCharacters;
mov eax, DWORD PTR [edi+24]
mov DWORD PTR [eax+72], OFFSET _xmlTextReaderCharacters
; 2130 : ret->cdataBlock = ret->sax->cdataBlock;
mov ecx, DWORD PTR [edi+24]
mov eax, DWORD PTR [ecx+100]
mov DWORD PTR [edi+52], eax
; 2131 : ret->sax->cdataBlock = xmlTextReaderCDataBlock;
mov DWORD PTR [ecx+100], OFFSET _xmlTextReaderCDataBlock
; 2132 :
; 2133 : ret->mode = XML_TEXTREADER_MODE_INITIAL;
; 2134 : ret->node = NULL;
; 2135 : ret->curnode = NULL;
; 2136 : if (xmlBufUse(ret->input->buffer) < 4) {
mov eax, DWORD PTR [edi+28]
mov DWORD PTR [edi], 0
mov DWORD PTR [edi+64], 0
mov DWORD PTR [edi+68], 0
push DWORD PTR [eax+16]
call _xmlBufUse
add esp, 4
cmp eax, 4
jae SHORT $LN8@xmlNewText
; 2137 : xmlParserInputBufferRead(input, 4);
push 4
push esi
call _xmlParserInputBufferRead
add esp, 8
$LN8@xmlNewText:
; 2138 : }
; 2139 : if (xmlBufUse(ret->input->buffer) >= 4) {
mov eax, DWORD PTR [edi+28]
push DWORD PTR [eax+16]
call _xmlBufUse
add esp, 4
cmp eax, 4
jb SHORT $LN9@xmlNewText
; 2140 : ret->ctxt = xmlCreatePushParserCtxt(ret->sax, NULL,
mov eax, DWORD PTR [edi+28]
; 2141 : (const char *) xmlBufContent(ret->input->buffer),
; 2142 : 4, URI);
; 2143 : ret->base = 0;
; 2144 : ret->cur = 4;
mov esi, 4
push DWORD PTR [eax+16]
call _xmlBufContent
add esp, 4
mov ecx, esi
; 2145 : } else {
jmp SHORT $LN10@xmlNewText
$LN9@xmlNewText:
; 2146 : ret->ctxt = xmlCreatePushParserCtxt(ret->sax, NULL, NULL, 0, URI);
; 2147 : ret->base = 0;
; 2148 : ret->cur = 0;
xor esi, esi
xor eax, eax
xor ecx, ecx
$LN10@xmlNewText:
; 2149 : }
; 2150 :
; 2151 : if (ret->ctxt == NULL) {
push DWORD PTR _URI$[ebp]
push ecx
push eax
mov eax, DWORD PTR [edi+24]
push 0
push eax
call _xmlCreatePushParserCtxt
mov DWORD PTR [edi+20], eax
add esp, 20 ; 00000014H
mov DWORD PTR [edi+56], 0
mov DWORD PTR [edi+60], esi
mov eax, DWORD PTR [edi+20]
test eax, eax
jne SHORT $LN11@xmlNewText
; 2152 : xmlGenericError(xmlGenericErrorContext,
call ___xmlGenericError
mov esi, eax
call ___xmlGenericErrorContext
push OFFSET ??_C@_0CC@HCDAIILG@xmlNewTextReader?5?3?5malloc?5faile@
push DWORD PTR [eax]
mov eax, DWORD PTR [esi]
call eax
; 2153 : "xmlNewTextReader : malloc failed\n");
; 2154 : xmlBufFree(ret->buffer);
push DWORD PTR [edi+84]
call _xmlBufFree
; 2155 : xmlFree(ret->sax);
push DWORD PTR [edi+24]
call DWORD PTR _xmlFree
; 2156 : xmlFree(ret);
push edi
call DWORD PTR _xmlFree
add esp, 20 ; 00000014H
; 2157 : return(NULL);
xor eax, eax
pop edi
pop esi
; 2177 : }
pop ebp
ret 0
$LN11@xmlNewText:
; 2158 : }
; 2159 : ret->ctxt->parseMode = XML_PARSE_READER;
mov DWORD PTR [eax+436], 5
; 2160 : ret->ctxt->_private = ret;
mov eax, DWORD PTR [edi+20]
mov DWORD PTR [eax+272], edi
; 2161 : ret->ctxt->linenumbers = 1;
mov eax, DWORD PTR [edi+20]
mov DWORD PTR [eax+280], 1
; 2162 : ret->ctxt->dictNames = 1;
mov eax, DWORD PTR [edi+20]
mov DWORD PTR [eax+364], 1
; 2163 : ret->allocs = XML_TEXTREADER_CTXT;
; 2164 : /*
; 2165 : * use the parser dictionary to allocate all elements and attributes names
; 2166 : */
; 2167 : ret->ctxt->docdict = 1;
; 2168 : ret->dict = ret->ctxt->dict;
; 2169 : #ifdef LIBXML_XINCLUDE_ENABLED
; 2170 : ret->xinclude = 0;
; 2171 : #endif
; 2172 : #ifdef LIBXML_PATTERN_ENABLED
; 2173 : ret->patternMax = 0;
; 2174 : ret->patternTab = NULL;
; 2175 : #endif
; 2176 : return(ret);
mov eax, edi
mov ecx, DWORD PTR [edi+20]
mov DWORD PTR [edi+12], 2
mov DWORD PTR [ecx+308], 1
mov ecx, DWORD PTR [edi+20]
mov ecx, DWORD PTR [ecx+296]
mov DWORD PTR [edi+88], ecx
mov DWORD PTR [edi+156], 0
mov DWORD PTR [edi+176], 0
mov DWORD PTR [edi+180], 0
pop edi
pop esi
; 2177 : }
pop ebp
ret 0
_xmlNewTextReader ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h
; COMDAT _vsnprintf
_TEXT SEGMENT
__Buffer$ = 8 ; size = 4
__BufferCount$ = 12 ; size = 4
__Format$ = 16 ; size = 4
__ArgList$ = 20 ; size = 4
_vsnprintf PROC ; COMDAT
; 1439 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __A452D4A0_stdio@h
call @__CheckForDebuggerJustMyCode@4
call ___local_stdio_printf_options
push DWORD PTR __ArgList$[ebp]
mov ecx, eax
push 0
push DWORD PTR __Format$[ebp]
push DWORD PTR __BufferCount$[ebp]
mov eax, DWORD PTR [ecx]
push DWORD PTR __Buffer$[ebp]
or eax, 2
push DWORD PTR [ecx+4]
push eax
call DWORD PTR __imp____stdio_common_vsprintf
or ecx, -1
add esp, 28 ; 0000001cH
test eax, eax
cmovs eax, ecx
; 1440 : int const _Result = __stdio_common_vsprintf(
; 1441 : _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR,
; 1442 : _Buffer, _BufferCount, _Format, NULL, _ArgList);
; 1443 :
; 1444 : return _Result < 0 ? -1 : _Result;
; 1445 : }
pop ebp
ret 0
_vsnprintf ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h
; COMDAT _printf
_TEXT SEGMENT
__Format$ = 8 ; size = 4
_printf PROC ; COMDAT
; 954 : {
push ebp
mov ebp, esp
push esi
push edi
mov ecx, OFFSET __A452D4A0_stdio@h
call @__CheckForDebuggerJustMyCode@4
mov edi, DWORD PTR __Format$[ebp]
push 1
call DWORD PTR __imp____acrt_iob_func
mov esi, eax
; 643 : return __stdio_common_vfprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Stream, _Format, _Locale, _ArgList);
call ___local_stdio_printf_options
lea ecx, DWORD PTR __Format$[ebp+4]
push ecx
push 0
push edi
push esi
push DWORD PTR [eax+4]
push DWORD PTR [eax]
call DWORD PTR __imp____stdio_common_vfprintf
add esp, 28 ; 0000001cH
; 955 : int _Result;
; 956 : va_list _ArgList;
; 957 : __crt_va_start(_ArgList, _Format);
; 958 : _Result = _vfprintf_l(stdout, _Format, NULL, _ArgList);
; 959 : __crt_va_end(_ArgList);
; 960 : return _Result;
pop edi
pop esi
; 961 : }
pop ebp
ret 0
_printf ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\stdio.h
; COMDAT __vfprintf_l
_TEXT SEGMENT
__Stream$ = 8 ; size = 4
__Format$ = 12 ; size = 4
__Locale$ = 16 ; size = 4
__ArgList$ = 20 ; size = 4
__vfprintf_l PROC ; COMDAT
; 642 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __A452D4A0_stdio@h
call @__CheckForDebuggerJustMyCode@4
call ___local_stdio_printf_options
push DWORD PTR __ArgList$[ebp]
push DWORD PTR __Locale$[ebp]
push DWORD PTR __Format$[ebp]
push DWORD PTR __Stream$[ebp]
push DWORD PTR [eax+4]
push DWORD PTR [eax]
call DWORD PTR __imp____stdio_common_vfprintf
add esp, 24 ; 00000018H
; 643 : return __stdio_common_vfprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Stream, _Format, _Locale, _ArgList);
; 644 : }
pop ebp
ret 0
__vfprintf_l ENDP
_TEXT ENDS
; Function compile flags: /Ogtp
; File c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\corecrt_stdio_config.h
; COMDAT ___local_stdio_printf_options
_TEXT SEGMENT
___local_stdio_printf_options PROC ; COMDAT
mov ecx, OFFSET __2CC6E67D_corecrt_stdio_config@h
call @__CheckForDebuggerJustMyCode@4
mov eax, OFFSET ?_OptionsStorage@?1??__local_stdio_printf_options@@9@9 ; `__local_stdio_printf_options'::`2'::_OptionsStorage
ret 0
___local_stdio_printf_options ENDP
_TEXT ENDS
END
|
test/Compiler/simple/Cubical-primitives-are-not-supported.agda | cruhland/agda | 1,989 | 14303 | <gh_stars>1000+
{-# OPTIONS --cubical #-}
open import Agda.Primitive.Cubical
|
src/shared/generic/lsc-internal-sha1.adb | Componolit/libsparkcrypto | 30 | 20863 | -------------------------------------------------------------------------------
-- This file is part of libsparkcrypto.
--
-- Copyright (C) 2011, <NAME>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- * Neither the name of the nor the names of its contributors may be used
-- to endorse or promote products derived from this software without
-- specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
-- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
with Interfaces;
with LSC.Internal.Ops32;
with LSC.Internal.Pad32;
with LSC.Internal.Byteorder32;
with LSC.Internal.Debug;
pragma Unreferenced (LSC.Internal.Debug);
package body LSC.Internal.SHA1 is
function Init_Data_Length return Data_Length;
function Init_Data_Length return Data_Length
is
begin
return Data_Length'(0, 0);
end Init_Data_Length;
---------------------------------------------------------------------------
procedure Add (Item : in out Data_Length;
Value : in Types.Word32)
with Depends => (Item =>+ Value);
procedure Add (Item : in out Data_Length;
Value : in Types.Word32)
is
begin
if Item.LSW > Types.Word32'Last - Value then
Item.MSW := Item.MSW + 1;
end if;
Item.LSW := Item.LSW + Value;
end Add;
----------------------------------------------------------------------------
function Ch
(x : Types.Word32;
y : Types.Word32;
z : Types.Word32)
return Types.Word32
with Post => Ch'Result = ((x and y) xor ((not x) and z))
is
pragma Inline (Ch);
begin
return (x and y) xor ((not x) and z);
end Ch;
----------------------------------------------------------------------------
function Maj
(x : Types.Word32;
y : Types.Word32;
z : Types.Word32)
return Types.Word32
with Post => Maj'Result = ((x and y) xor (x and z) xor (y and z))
is
pragma Inline (Maj);
begin
return (x and y) xor (x and z) xor (y and z);
end Maj;
---------------------------------------------------------------------------
function Context_Init return Context_Type
is
begin
return Context_Type'
(Length => Init_Data_Length,
H => Hash_Type'(0 => 16#67452301#,
1 => 16#efcdab89#,
2 => 16#98badcfe#,
3 => 16#10325476#,
4 => 16#c3d2e1f0#));
end Context_Init;
---------------------------------------------------------------------------
procedure Context_Update_Internal
(Context : in out Context_Type;
Block : in Block_Type)
with Depends => (Context =>+ Block);
procedure Context_Update_Internal
(Context : in out Context_Type;
Block : in Block_Type)
is
W : Schedule_Type := Null_Schedule;
a, b, c, d, e, Temp : Types.Word32;
begin
pragma Debug (Debug.Put_Line ("BLOCK UPDATE:"));
-- Print out initial state of H
pragma Debug (Debug.Put_Line ("SHA-1 initial hash values:"));
pragma Debug (Debug.Print_Word32_Array (Context.H, 2, Types.Index'Last, True));
-------------------------------------------
-- Section 6.1.2 SHA-1 Hash Computations
-------------------------------------------
-- 1. Prepare the message schedule, W(t):
for t in Schedule_Index range 0 .. 15
loop
W (t) := Byteorder32.Native_To_BE (Block (t));
end loop;
for t in Schedule_Index range 16 .. 79
loop
W (t) := Interfaces.Rotate_Left
(Ops32.XOR4
(W (t - 3),
W (t - 8),
W (t - 14),
W (t - 16)), 1);
end loop;
pragma Debug (Debug.Put_Line ("Message block:"));
pragma Debug (Debug.Print_Word32_Array (W, 2, 8, True));
-- 2. Initialize the five working variables a, b, c, d and e with the
-- (i-1)st hash value:
a := Context.H (0);
b := Context.H (1);
c := Context.H (2);
d := Context.H (3);
e := Context.H (4);
-- 3. For t = 0 to 79:
for I in Schedule_Index range 0 .. 19
loop
Temp := Interfaces.Rotate_Left (a, 5) + Ch (b, c, d) + e + K1 + W (I);
e := d;
d := c;
c := Interfaces.Rotate_Left (b, 30);
b := a;
a := Temp;
end loop;
for I in Schedule_Index range 20 .. 39
loop
Temp := Interfaces.Rotate_Left (a, 5) + Ops32.XOR3 (b, c, d) + e + K2 + W (I);
e := d;
d := c;
c := Interfaces.Rotate_Left (b, 30);
b := a;
a := Temp;
end loop;
for I in Schedule_Index range 40 .. 59
loop
Temp := Interfaces.Rotate_Left (a, 5) + Maj (b, c, d) + e + K3 + W (I);
e := d;
d := c;
c := Interfaces.Rotate_Left (b, 30);
b := a;
a := Temp;
end loop;
for I in Schedule_Index range 60 .. 79
loop
Temp := Interfaces.Rotate_Left (a, 5) + Ops32.XOR3 (b, c, d) + e + K4 + W (I);
e := d;
d := c;
c := Interfaces.Rotate_Left (b, 30);
b := a;
a := Temp;
end loop;
-- 4. Compute the i-th intermediate hash value H-i:
Context.H := Hash_Type'
(0 => a + Context.H (0),
1 => b + Context.H (1),
2 => c + Context.H (2),
3 => d + Context.H (3),
4 => e + Context.H (4));
pragma Debug (Debug.Put_Line ("SHA-1 final hash values:"));
pragma Debug (Debug.Print_Word32_Array (Context.H, 2, Types.Index'Last, True));
end Context_Update_Internal;
---------------------------------------------------------------------------
procedure Context_Update
(Context : in out Context_Type;
Block : in Block_Type)
is
begin
Context_Update_Internal (Context, Block);
Add (Context.Length, 512);
end Context_Update;
---------------------------------------------------------------------------
procedure Context_Finalize
(Context : in out Context_Type;
Block : in Block_Type;
Length : in Block_Length_Type)
is
Final_Block : Block_Type;
begin
pragma Debug (Debug.Put_Line ("FINAL BLOCK:"));
Final_Block := Block;
-- Add length of last block to data length.
Add (Context.Length, Length);
-- Set trailing '1' marker and zero out rest of the block.
Pad32.Block_Terminate (Block => Final_Block,
Length => Types.Word64 (Length));
-- Terminator and length values won't fit into current block.
if Length >= 448 then
Context_Update_Internal (Context => Context, Block => Final_Block);
Final_Block := Null_Block;
end if;
-- Set length in final block.
Final_Block (Block_Type'Last - 1) := Byteorder32.BE_To_Native (Context.Length.MSW);
Final_Block (Block_Type'Last) := Byteorder32.BE_To_Native (Context.Length.LSW);
Context_Update_Internal (Context => Context, Block => Final_Block);
end Context_Finalize;
---------------------------------------------------------------------------
function Get_Hash (Context : Context_Type) return Hash_Type is
begin
return Hash_Type'(0 => Byteorder32.BE_To_Native (Context.H (0)),
1 => Byteorder32.BE_To_Native (Context.H (1)),
2 => Byteorder32.BE_To_Native (Context.H (2)),
3 => Byteorder32.BE_To_Native (Context.H (3)),
4 => Byteorder32.BE_To_Native (Context.H (4)));
end Get_Hash;
---------------------------------------------------------------------------
procedure Hash_Context
(Message : in Message_Type;
Length : in Types.Word64;
Ctx : in out Context_Type)
is
Dummy : constant Block_Type := Null_Block;
Last_Length : Block_Length_Type;
Last_Block : Types.Word64;
begin
Last_Length := Types.Word32 (Length mod Block_Size);
Last_Block := Message'First + Length / Block_Size;
-- handle all blocks, but the last.
if Last_Block > Message'First then
for I in Message_Index range Message'First .. Last_Block - 1
loop
pragma Loop_Invariant
(Last_Block - 1 <= Message'Last and
(if Last_Length /= 0 then Last_Block <= Message'Last) and
I < Last_Block);
Context_Update (Ctx, Message (I));
end loop;
end if;
if Last_Length = 0 then
Context_Finalize (Ctx, Dummy, 0);
else
Context_Finalize (Ctx, Message (Last_Block), Last_Length);
end if;
end Hash_Context;
----------------------------------------------------------------------------
function Hash
(Message : Message_Type;
Length : Types.Word64) return Hash_Type
is
Ctx : Context_Type;
begin
Ctx := Context_Init;
Hash_Context (Message, Length, Ctx);
return Get_Hash (Ctx);
end Hash;
end LSC.Internal.SHA1;
|
oeis/262/A262414.asm | neoneye/loda-programs | 11 | 84103 | <gh_stars>10-100
; A262414: Number of (n+1) X (2+1) 0..1 arrays with each row divisible by 3 and column not divisible by 3, read as a binary number with top and left being the most significant bits.
; Submitted by <NAME>
; 0,4,12,48,144,468,1404,4320,12960,39204,117612,353808,1061424,3187188,9561564,28693440,86080320,258267204,774801612,2324483568,6973450704,20920588308,62761764924,188286003360,564858010080,1694576156004,5083728468012,15251191781328,45753575343984,137260745163828,411782235491484,1235346763870080,3706040291610240,11118121047017604,33354363141052812,100063089939719088,300189269819157264,900567811007153748,2701703433021461244,8105110303713429600,24315330911140288800,72945992747368004004
mov $1,3
pow $1,$0
div $0,2
mov $2,3
pow $2,$0
sub $1,$2
mov $0,$1
mul $0,2
|
src/Numeric/Nat/Divide.agda | L-TChen/agda-prelude | 111 | 5232 | <reponame>L-TChen/agda-prelude
module Numeric.Nat.Divide where
open import Prelude
open import Control.WellFounded
open import Numeric.Nat.Properties
open import Numeric.Nat.DivMod
open import Tactic.Nat
--- Divides predicate ---
data _Divides_ (a b : Nat) : Set where
factor : ∀ q (eq : q * a ≡ b) → a Divides b
pattern factor! q = factor q refl
get-factor : ∀ {a b} → a Divides b → Nat
get-factor (factor q _) = q
dividesToDivMod : ∀ {a b} {{_ : NonZero b}} → b Divides a → DivMod a b
dividesToDivMod {b = zero } {{}}
dividesToDivMod {b = suc b} (factor q eq) = qr q 0 auto (by eq)
mod-divides : ∀ {a b} {{_ : NonZero a}} → a Divides b → b mod a ≡ 0
mod-divides {zero} {{}}
mod-divides {suc a} {b} (factor q eq) =
rem-unique (b divmod suc a) (dividesToDivMod (factor q eq))
div-divides : ∀ {a b} {{_ : NonZero a}} → a Divides b → (b div a) * a ≡ b
div-divides {a} {b} a|b with divmod-sound a b
... | eq rewrite mod-divides a|b = by eq
private
safediv : Nat → Nat → Nat
safediv a 0 = 0
safediv a (suc b) = a div suc b
divides-safediv : ∀ {a b} → a Divides b → safediv b a * a ≡ b
divides-safediv {zero } (factor! _) = auto
divides-safediv {suc a} a|b = div-divides a|b
fast-divides : ∀ {a b} → a Divides b → a Divides b
fast-divides {a} {b} a|b = factor (safediv b a) (eraseEquality (divides-safediv a|b))
private
no-divides-suc-mod : ∀ {a b} q {r} → LessNat (suc r) a → q * a + suc r ≡ b → ¬ (a Divides b)
no-divides-suc-mod {zero} _ (diff _ ())
no-divides-suc-mod {suc a} q {r} lt eq (factor q′ eq′) =
refute (rem-unique
(dividesToDivMod (factor q′ eq′))
(qr q (suc r) lt eq))
no-divides-zero : ∀ {a} → ¬ (0 Divides suc a)
no-divides-zero {a} (factor q eq) = refute eq
_divides?_ : ∀ a b → Dec (a Divides b)
a divides? zero = yes (factor! 0)
zero divides? suc b = no no-divides-zero
suc a divides? suc b with suc b divmod suc a
suc a divides? suc b | qr q zero _ eq = yes (factor q (by eq))
suc a divides? suc b | qr q (suc r) lt eq₁ = no (no-divides-suc-mod q lt eq₁)
--- Instances ---
instance
SmashDivides : ∀ {a b} {{_ : NonZero a}} → Smashed (a Divides b)
SmashDivides {0} {{}}
smashed {{SmashDivides {a@(suc _)}}} {factor q eq} {factor q₁ refl} =
case mul-inj₁ q q₁ (suc _) eq of λ where refl → factor q $≡ smashed
|
src/interface/yaml-dom-loading.ads | robdaemon/AdaYaml | 32 | 25577 | <reponame>robdaemon/AdaYaml
-- part of AdaYaml, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "copying.txt"
with Yaml.Dom.Vectors;
with Yaml.Source;
with Yaml.Stream_Concept;
package Yaml.Dom.Loading is
-- equivalent to the composition of the "Parse" and "Compose" steps in the
-- YAML spec
function From_Source (Input : Source.Pointer) return Document_Reference;
function From_Source (Input : Source.Pointer) return Vectors.Vector;
-- as above, but does not read from an external source but from a String
function From_String (Input : String) return Document_Reference;
function From_String (Input : String) return Vectors.Vector;
generic
with package Stream is new Stream_Concept (<>);
package Stream_Loading is
-- equivalent to the "Compose" step in the YAML spec. Expects the input
-- to contain exactly one document, will raise a Compose_Error if the
-- stream contains multiple documents.
function Load_One (Input : in out Stream.Instance;
Pool : Text.Pool.Reference :=
Text.Pool.With_Capacity (Text.Pool.Default_Size))
return Document_Reference;
-- as above, but allows for multiple documents in a stream
function Load_All (Input : in out Stream.Instance;
Pool : Text.Pool.Reference :=
Text.Pool.With_Capacity (Text.Pool.Default_Size))
return Vectors.Vector
with Post => Integer (Load_All'Result.Length) > 0;
end Stream_Loading;
end Yaml.Dom.Loading;
|
oeis/175/A175659.asm | neoneye/loda-programs | 11 | 27435 | <gh_stars>10-100
; A175659: Eight bishops and one elephant on a 3 X 3 chessboard: a(n)= (3^(n+1)-Jacobsthal(n+1))-(3^n-Jacobsthal(n)), with Jacobsthal=A001045.
; Submitted by <NAME>
; 1,6,16,52,156,476,1436,4332,13036,39196,117756,353612,1061516,3185916,9560476,28686892,86071596,258236636,774753596,2324348172,6973219276,20920007356,62760721116,188283561452,564853480556,1694566034076,5083709287036,15251150230732,45753495431436,137260575772796,411781906275356,1235346076740012,3706038946047916,11118118269799516,33354357672710076,100063078744753292,300189247687505996,900567765969010236,2701703343720015196,8105110122786014572,24315330551609981676,72945992021333820956
mov $1,4
mov $2,1
mov $4,5
lpb $0
sub $0,1
mov $3,$2
mul $2,2
add $3,$4
mul $3,3
mov $4,$1
add $1,$3
add $4,4
add $1,$4
lpe
mov $0,$1
div $0,6
add $0,1
|
oeis/287/A287723.asm | neoneye/loda-programs | 11 | 174030 | <filename>oeis/287/A287723.asm
; A287723: Positions of 0 in A287722; complement of A287724.
; Submitted by <NAME>
; 2,4,7,9,11,13,16,18,21,23,25,27,30,32,34,36,39,41,44,46,48,50,53,55,58,60,62,64,67,69,71,73,76,78,81,83,85,87,90,92,94,96,99,101,104,106,108,110,113,115,118,120,122,124,127,129,131,133,136,138,141,143,145,147,150,152,155,157,159,161,164,166,168,170,173,175,178,180,182,184,187,189,191,193,196,198,201,203,205,207,210,212,215,217,219,221,224,226,228,230
mov $2,$0
mul $0,2
div $2,2
seq $2,19446 ; a(n) = ceiling(n/tau), where tau = (1+sqrt(5))/2.
add $2,$0
mov $0,$2
add $0,1
|
third-party/gmp/gmp-src/mpn/x86_64/bt1/aorsmul_1.asm | jhh67/chapel | 1,602 | 245136 | <gh_stars>1000+
dnl AMD64 mpn_addmul_1 and mpn_submul_1 optimised for AMD bt1/bt2.
dnl Copyright 2003-2005, 2007, 2008, 2011, 2012, 2018-2019 Free Software
dnl Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C AMD K8,K9 4.52 old measurement
C AMD K10 4.51 old measurement
C AMD bd1 4.66 old measurement
C AMD bd2 4.57 old measurement
C AMD bd3 ?
C AMD bd4 ?
C AMD zen ?
C AMD bt1 5.04
C AMD bt2 5.07
C Intel P4 16.8 18.6 old measurement
C Intel PNR 5.59 old measurement
C Intel NHM 5.39 old measurement
C Intel SBR 3.93 old measurement
C Intel IBR 3.59 old measurement
C Intel HWL 3.61 old measurement
C Intel BWL 2.76 old measurement
C Intel SKL 2.77 old measurement
C Intel atom 23 old measurement
C Intel SLM 8 old measurement
C Intel GLM ?
C VIA nano 5.63 old measurement
C The ALIGNment here might look completely ad-hoc. They are not.
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
ifdef(`OPERATION_addmul_1',`
define(`ADDSUB', `add')
define(`func', `mpn_addmul_1')
')
ifdef(`OPERATION_submul_1',`
define(`ADDSUB', `sub')
define(`func', `mpn_submul_1')
')
MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
C Standard parameters
define(`rp', `%rdi')
define(`up', `%rsi')
define(`n_param', `%rdx')
define(`v0', `%rcx')
C Standard allocations
define(`n', `%rbx')
define(`w0', `%r8')
define(`w1', `%r9')
define(`w2', `%r10')
define(`w3', `%r11')
C DOS64 parameters
IFDOS(` define(`rp', `%rcx') ') dnl
IFDOS(` define(`up', `%rsi') ') dnl
IFDOS(` define(`n_param', `%r8') ') dnl
IFDOS(` define(`v0', `%r9') ') dnl
C DOS64 allocations
IFDOS(` define(`n', `%rbx') ') dnl
IFDOS(` define(`w0', `%r8') ') dnl
IFDOS(` define(`w1', `%rdi') ') dnl
IFDOS(` define(`w2', `%r10') ') dnl
IFDOS(` define(`w3', `%r11') ') dnl
ASM_START()
TEXT
ALIGN(64)
PROLOGUE(func)
IFDOS(` push %rsi ')
IFDOS(` push %rdi ')
IFDOS(` mov %rdx, %rsi ')
push %rbx
mov (up), %rax
lea (rp,n_param,8), rp
lea (up,n_param,8), up
mov n_param, n
test $1, R8(n_param)
jne L(bx1)
L(bx0): mul v0
neg n
mov %rax, w0
mov %rdx, w1
test $2, R8(n)
jne L(L2)
L(b00): add $2, n
jmp L(L0)
ALIGN(16)
L(bx1): mul v0
test $2, R8(n)
je L(b01)
L(b11): mov %rax, w2
mov %rdx, w3
neg n
inc n
jmp L(L3)
ALIGN(16)
L(b01): sub $3, n
jc L(n1)
mov %rax, w2
mov %rdx, w3
neg n
ALIGN(16)
L(top): mov -16(up,n,8), %rax
mul v0
mov %rax, w0
mov %rdx, w1
ADDSUB w2, -24(rp,n,8)
adc w3, w0
adc $0, w1
L(L0): mov -8(up,n,8), %rax
mul v0
mov %rax, w2
mov %rdx, w3
ADDSUB w0, -16(rp,n,8)
adc w1, w2
adc $0, w3
L(L3): mov (up,n,8), %rax
mul v0
mov %rax, w0
mov %rdx, w1
ADDSUB w2, -8(rp,n,8)
adc w3, w0
adc $0, w1
L(L2): mov 8(up,n,8), %rax
mul v0
mov %rax, w2
mov %rdx, w3
ADDSUB w0, (rp,n,8)
adc w1, w2
adc $0, w3
add $4, n
js L(top)
L(end): xor R32(%rax), R32(%rax)
ADDSUB w2, -8(rp)
adc w3, %rax
pop %rbx
IFDOS(` pop %rdi ')
IFDOS(` pop %rsi ')
ret
ALIGN(32)
L(n1): ADDSUB %rax, -8(rp)
mov $0, R32(%rax)
adc %rdx, %rax
pop %rbx
IFDOS(` pop %rdi ')
IFDOS(` pop %rsi ')
ret
EPILOGUE()
|
strlen.asm | akruman/low-level-programming-c | 0 | 21445 | global _start
section .data
message: db 'asdc', 0
section .text
strlen:
xor rax,rax
.loop:
cmp byte[rdi + rax], 0
je .end
inc rax
jmp .loop
.end
ret
_start:
mov rdi, message
call strlen
mov rdi, rax ; mov ret, to prog retcode
mov rax,60
syscall |
c7612/a1/switch.asm | DimitryRakhlei/BTECH | 0 | 175748 | <reponame>DimitryRakhlei/BTECH
; Author: <NAME>
; Compile with:
; nasm -f elf switch.asm
; ld -m elf_i386 switch.o -o switch
; ALTERNATIVELY:
; make
;
%define SYS_EXIT 1
%define SYS_READ 3
%define SYS_WRITE 4
%define STDIN 0
%define STDOUT 1
%define STDERR 2
%define LF 10
%define MAX_IN_NUMBER 6
%define MAX_OUT_NUMBER 10
SECTION .data
failstr: db "Input must be between 0 and 65535", 0xa
failstrl: equ $-failstr
num1str: db "Num1 : "
num1strl: equ $-num1str
num2str: db "Num2 : "
num2strl: equ $-num2str
num3str: db "Num3 : "
num3strl: equ $-num3str
nvaluestr: db "nvalue : "
nvaluel: equ $-nvaluestr
defstr: db "Default", 0xa
defstrl: equ $-defstr
case0str: db "Case0: "
case0strl: equ $-case0str
case1str: db "Case1: "
case1strl: equ $-case1str
case2str: db "Case2: "
case2strl: equ $-case2str
case3str: db "Case3: "
case3strl: equ $-case3str
SECTION .bss
out_buffer resb MAX_OUT_NUMBER
in_buffer resb MAX_IN_NUMBER
number resd 1
num1 resd 1
num2 resd 1
num3 resd 1
nvalue resd 1
SECTION .text
;--------------------
global _start
;--------------------
;-------Main---------
;--------------------
_start:
; obtaining user inputs
call GetNum1Input
call GetNum2Input
call GetNum3Input
call GetNvalueInput
; starting switch
; nvalue increments intitially
mov eax, [nvalue]
inc eax
mov [nvalue], eax
; case 0 -> cannot happen because nvalue cannot be < 0
; and is incremented at the start
; still creating code to satisfy requirements
cmp eax, 0
je case_0
cmp eax, 1
je case_1
cmp eax, 2
je case_2
cmp eax, 3
je case_3
jmp case_def
;--------------------
;---Switch-Cases-----
;--------------------
case_0:
mov edx, [num1]
mov eax, [num2]
mul edx
mov [number], eax
mov ecx, case0str
mov edx, case0strl
call print
mov eax, [number]
call DisplayN
jmp exit ; break
case_1:
mov edx, [num2]
mov eax, [num3]
mul edx
mov [number], eax
mov ecx, case1str
mov edx, case1strl
call print
mov eax, [number]
call DisplayN
jmp exit ; break
case_2:
mov edx, [num1]
mov eax, [num3]
sub eax, edx
mov [number], eax
mov ecx, case2str
mov edx, case2strl
call print
mov eax, [number]
call DisplayN
jmp exit ; break
case_3:
mov edx, [num3]
mov eax, [num1]
sub eax, edx
mov [number], eax
mov ecx, case3str
mov edx, case3strl
call print
mov eax, [number]
call DisplayN
jmp exit ; break
case_def:; no break
mov ecx, defstr
mov edx, defstrl
call print
;--------------------
;----Cases-Over------
;--------------------
exit:
mov eax, SYS_EXIT
xor ebx, ebx
int 80h
;--------------------
;----End-of-Main-----
;--------------------
;--------------------
print:
mov eax, SYS_WRITE
mov ebx, STDOUT
int 80H
ret
;--------------------
;--------------------
Display:
mov edx, ecx
mov ecx, esi
mov ebx, STDOUT
mov eax, SYS_WRITE
int 80h
ret
;--------------------
;--------------------
DisplayN:
mov esi, out_buffer
mov ecx, MAX_OUT_NUMBER
call binasc
mov byte [esi + ecx], LF
inc ecx
call Display
ret
;--------------------
;--------------------
FailExit:
; input for num1
mov eax, SYS_WRITE
mov ebx, STDOUT
mov ecx, failstr
mov edx, failstrl
int 80H
mov eax, SYS_EXIT
xor ebx, ebx
int 80h
;--------------------
;--------------------
GetNum1Input:
; input for num1
mov eax, SYS_WRITE
mov ebx, STDOUT
mov ecx, num1str
mov edx, num1strl
int 80H
;read num1
mov eax, SYS_READ
mov ebx, STDIN
mov ecx, in_buffer
mov edx, MAX_IN_NUMBER
int 80H
push in_buffer
call atoi
add esp, 4
mov [num1], eax
call ValidateNumber
mov eax, [num1]
;call DisplayN ;; uncomment this for debug
ret
;--------------------
;--------------------
GetNum2Input:
; input for num2
mov eax, SYS_WRITE
mov ebx, STDOUT
mov ecx, num2str
mov edx, num2strl
int 80H
;read num2
mov eax, SYS_READ
mov ebx, STDIN
mov ecx, in_buffer
mov edx, MAX_IN_NUMBER
int 80H
push in_buffer
call atoi
add esp, 4
mov [num2], eax
call ValidateNumber
mov eax, [num2]
;call DisplayN ;; uncomment this for debug
ret
;--------------------
;--------------------
GetNum3Input:
; input for num3
mov eax, SYS_WRITE
mov ebx, STDOUT
mov ecx, num3str
mov edx, num3strl
int 80H
;read num3
mov eax, SYS_READ
mov ebx, STDIN
mov ecx, in_buffer
mov edx, MAX_IN_NUMBER
int 80H
push in_buffer
call atoi
add esp, 4
mov [num3], eax
call ValidateNumber
mov eax, [num3]
;call DisplayN ;; uncomment this for debug
ret
;--------------------
;--------------------
GetNvalueInput:
; input for Nvalue
mov eax, SYS_WRITE
mov ebx, STDOUT
mov ecx, nvaluestr
mov edx, nvaluel
int 80H
;read Nvalue
mov eax, SYS_READ
mov ebx, STDIN
mov ecx, in_buffer
mov edx, MAX_IN_NUMBER
int 80H
push in_buffer
call atoi
add esp, 4
mov [nvalue], eax
call ValidateNumber
mov eax, [nvalue]
;call DisplayN ;; uncomment this for debug
ret
;--------------------
;--------------------
ValidateNumber:
cmp eax, 0
jl FailExit
cmp eax, 65535
jg FailExit
ret
;--------------------
;--------------------
; Credit: <NAME> from nasm.us
atoi:
push ebx
mov edx, [esp + 8] ; pointer to string
xor ebx, ebx ; assume not negative
cmp byte [edx], '-'
jnz notneg
inc ebx ; indicate negative
inc edx ; move past the '-'
notneg:
xor eax, eax ; clear "result"
.top:
movzx ecx, byte [edx]
inc edx
cmp ecx, byte '0'
jb .done
cmp ecx, byte '9'
ja .done
; we have a valid character - multiply
; result-so-far by 10, subtract '0'
; from the character to convert it to
; a number, and add it to result.
lea eax, [eax + eax * 4]
lea eax, [eax * 2 + ecx - '0']
jmp short .top
.done:
test ebx, ebx
jz notminus
neg eax
notminus:
pop ebx
ret
;------------------------
;--------------------
; Credit: <NAME> - RIP, Chuck.
;convert binary to ascii
;call with eax = signed binary number
; esi = address of output string
; ecx = length of output string
;returns esi = 1st printed digit
; ecx = no of digits printed (includes sign if any)
; other registers preserved
binasc: push edx
push ebx
push edi
push eax
mov edi,esi ;save start of string
ba1: mov byte [esi],' ' ;fill string with blanks
inc esi
loop ba1
mov ebx,10 ;initialize divisor
or eax,eax ;value negative?
jns ba2 ;no problem
neg eax ;make it positive
ba2: xor edx,edx ;clear high part of dividend
div ebx ;divide by 10
add dl,'0' ;convert to ascii digit
dec esi ;step backwards through buffer
mov [esi],dl ;store digit
inc ecx
cmp esi,edi ;out of space
jz ba4 ;yes - quit
or eax,eax ;all digits printed?
jnz ba2 ;no - keep trucking
pop eax ;get original value
or eax,eax ;negative?
jns ba3 ;no - quit
dec esi ;place for sign
mov byte [esi],'-'
inc ecx ;add to char count
ba3: pop edi
pop ebx
pop edx
ret
ba4: pop eax
jmp ba3
;-------------------
|
Perm.agda | pigworker/InteriorDesign | 6 | 15809 | module Perm where
open import Basics
open import All
open import Splitting
data _~_ {X : Set} : List X -> List X -> Set where
[] : [] ~ []
_,-_ : forall {x xs ys zs} -> (x ,- []) <[ ys ]> zs -> xs ~ zs -> (x ,- xs) ~ ys
permute : {X : Set}{xs ys : List X} -> xs ~ ys ->
{P : X -> Set} -> All P xs -> All P ys
permute [] <> = <>
permute (i ,- is) (p , ps) = riffle i (p , <>) (permute is ps)
reflP : {X : Set}(xs : List X) -> xs ~ xs
reflP [] = []
reflP (x ,- xs) = sl (srs xs) ,- reflP xs
insP : forall {X : Set}{x : X}{xs xs' ys ys'} -> (x ,- []) <[ xs' ]> xs -> (x ,- []) <[ ys' ]> ys
-> xs ~ ys -> xs' ~ ys'
insP (sl i) j p with isSRS i
insP (sl .(srs _)) j p | mkSRS = j ,- p
insP (sr i) j (k ,- p) =
let _ , k' , j' = llswap (_ , j , k)
in k' ,- insP i j' p
l2r : forall {X : Set}{x : X}{xs xs' ys'}(i : (x ,- []) <[ xs' ]> xs)(p' : xs' ~ ys') ->
Sg (List X) \ ys -> Sg ((x ,- []) <[ ys' ]> ys) \ j -> xs ~ ys
l2r (sl i) (j ,- p) with isSRS i
l2r (sl .(srs _)) (j ,- p) | mkSRS = _ , j , p
l2r (sr i) (k' ,- p') with l2r i p'
... | _ , j' , p with llswap (_ , k' , j')
... | _ , j , k = _ , j , (k ,- p)
transP : {X : Set}{xs ys zs : List X} -> xs ~ ys -> ys ~ zs -> xs ~ zs
transP [] [] = []
transP (i ,- p) q' with l2r i q'
... | _ , j , q = j ,- transP p q
symP : {X : Set}{xs ys : List X} -> xs ~ ys -> ys ~ xs
symP [] = []
symP (i ,- p) = insP i (sl (srs _)) (symP p)
swapP : {X : Set}(xs ys : List X) -> (xs +L ys) ~ (ys +L xs)
swapP [] ys rewrite ys +L[] = reflP ys
swapP (x ,- xs) ys = insS ys x xs ,- swapP xs ys
catP : forall {X : Set}{as bs cs ds : List X} -> as ~ cs -> bs ~ ds -> (as +L bs) ~ (cs +L ds)
catP [] q = q
catP (x ,- p) q = catS x (srs _) ,- catP p q
permap : forall {X Y}(f : X -> Y){xs xs' : List X} -> xs ~ xs' -> list f xs ~ list f xs'
permap f [] = []
permap f (x ,- p) = splimap f x ,- permap f p
cartNil : forall {I}(is : List I){J} -> cart {J = J} is [] == []
cartNil [] = refl []
cartNil (i ,- is) = cartNil is
cartCons : forall {I J}(is : List I)(j : J)(js : List J) ->
cart is (j ,- js) ~ (list (_, j) is +L cart is js)
cartCons [] j js = []
cartCons (i ,- is) j js with catP (swapP (list (i ,_) js) (list (_, j) is)) (reflP (cart is js))
... | z rewrite assoc+L (list (i ,_) js) (list (_, j) is) (cart is js)
| assoc+L (list (_, j) is) (list (i ,_) js) (cart is js)
=
(sl (srs (list (_, j) is +L cart (i ,- is) js))) ,-
transP (catP (reflP (list (i ,_) js)) (cartCons is j js))
z
cartLemma : forall {I J}(is : List I)(js : List J) ->
cart is js ~ list swap (cart js is)
cartLemma {I}{J} [] js rewrite cartNil js {I} = []
cartLemma {I}{J} (i ,- is) js with catP (reflP (list (i ,_) js)) (cartLemma is js)
... | z rewrite sym (listlist swap (_, i) (i ,_) (\ j -> refl (i , j)) js)
| catNatural swap (list (_, i) js) (cart js is)
= transP
z
(symP (permap (\ ji -> snd ji , fst ji) (cartCons js i is)))
|
firmware/freertos/semaphore/lib/FreeRTOSV8.2.3/FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad_IAR_CCS/CCS_Only/RegTest.asm | NCTU-AUV/stm32_write_data_to_rpi | 0 | 85408 | <gh_stars>0
;
;/*
; FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.
;
;
; ***************************************************************************
; * *
; * FreeRTOS tutorial books are available in pdf and paperback. *
; * Complete, revised, and edited pdf reference manuals are also *
; * available. *
; * *
; * Purchasing FreeRTOS documentation will not only help you, by *
; * ensuring you get running as quickly as possible and with an *
; * in-depth knowledge of how to use FreeRTOS, it will also help *
; * the FreeRTOS project to continue with its mission of providing *
; * professional grade, cross platform, de facto standard solutions *
; * for microcontrollers - completely free of charge! *
; * *
; * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
; * *
; * Thank you for using FreeRTOS, and thank you for your support! *
; * *
; ***************************************************************************
;
;
; This file is part of the FreeRTOS distribution.
;
; FreeRTOS is free software; you can redistribute it and/or modify it under
; the terms of the GNU General Public License (version 2) as published by the
; Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
; >>>NOTE<<< The modification to the GPL is included to allow you to
; distribute a combined work that includes FreeRTOS without being obliged to
; provide the source code for proprietary components outside of the FreeRTOS
; kernel. FreeRTOS is distributed in the hope that it will be useful, but
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
; more details. You should have received a copy of the GNU General Public
; License and the FreeRTOS license exception along with FreeRTOS; if not it
; can be viewed here: http://www.freertos.org/a00114.html and also obtained
; by writing to <NAME>, contact details for whom are available on the
; FreeRTOS WEB site.
;
; 1 tab == 4 spaces!
;
; http://www.FreeRTOS.org - Documentation, latest information, license and
; contact details.
;
; http://www.SafeRTOS.com - A version that is certified for use in safety
; critical systems.
;
; http://www.OpenRTOS.com - Commercial support, development, porting,
; licensing and training services.
;*/
; * The definition of the "register test" tasks, as described at the top of
; * main.c
.include data_model.h
.if $DEFINED( __LARGE_DATA_MODEL__ )
.define "cmp.a", cmp_x
.define "incx.w", inc_x
.else
.define "cmp.w", cmp_x
.define "inc.w", inc_x
.endif
.global usRegTest1LoopCounter
.global usRegTest2LoopCounter
.global vPortYield
.def vRegTest1Implementation
.def vRegTest2Implementation
.text
.align 2
vRegTest1Implementation: .asmfunc
; Fill each general purpose register with a known value.
mov_x #0x4444, r4
mov_x #0x5555, r5
mov_x #0x6666, r6
mov_x #0x7777, r7
mov_x #0x8888, r8
mov_x #0x9999, r9
mov_x #0xaaaa, r10
mov_x #0xbbbb, r11
mov_x #0xcccc, r12
mov_x #0xdddd, r13
mov_x #0xeeee, r14
mov_x #0xffff, r15
prvRegTest1Loop:
; Test each general purpose register to check that it still contains the
; expected known value, jumping to vRegTest1Error if any register contains
; an unexpected value.
cmp_x #0x4444, r4
jne vRegTest1Error
cmp_x #0x5555, r5
jne vRegTest1Error
cmp_x #0x6666, r6
jne vRegTest1Error
cmp_x #0x7777, r7
jne vRegTest1Error
cmp_x #0x8888, r8
jne vRegTest1Error
cmp_x #0x9999, r9
jne vRegTest1Error
cmp_x #0xaaaa, r10
jne vRegTest1Error
cmp_x #0xbbbb, r11
jne vRegTest1Error
cmp_x #0xcccc, r12
jne vRegTest1Error
cmp_x #0xdddd, r13
jne vRegTest1Error
cmp_x #0xeeee, r14
jne vRegTest1Error
cmp_x #0xffff, r15
jne vRegTest1Error
; This task is still running without jumping to vRegTest1Error, so increment
; the loop counter so the check task knows the task is running error free.
inc_x &usRegTest1LoopCounter
; Loop again, performing the same tests.
jmp prvRegTest1Loop
nop
vRegTest1Error:
jmp vRegTest1Error
nop
.endasmfunc
; -----------------------------------------------------------
; See the comments in vRegTest1Implementation. This task is the same, it just uses
; different values in its registers.
.align 2
vRegTest2Implementation: .asmfunc
mov_x #0x4441, r4
mov_x #0x5551, r5
mov_x #0x6661, r6
mov_x #0x7771, r7
mov_x #0x8881, r8
mov_x #0x9991, r9
mov_x #0xaaa1, r10
mov_x #0xbbb1, r11
mov_x #0xccc1, r12
mov_x #0xddd1, r13
mov_x #0xeee1, r14
mov_x #0xfff1, r15
prvRegTest2Loop:
cmp_x #0x4441, r4
jne vRegTest2Error
cmp_x #0x5551, r5
jne vRegTest2Error
cmp_x #0x6661, r6
jne vRegTest2Error
cmp_x #0x7771, r7
jne vRegTest2Error
cmp_x #0x8881, r8
jne vRegTest2Error
cmp_x #0x9991, r9
jne vRegTest2Error
cmp_x #0xaaa1, r10
jne vRegTest2Error
cmp_x #0xbbb1, r11
jne vRegTest2Error
cmp_x #0xccc1, r12
jne vRegTest2Error
cmp_x #0xddd1, r13
jne vRegTest2Error
cmp_x #0xeee1, r14
jne vRegTest2Error
cmp_x #0xfff1, r15
jne vRegTest2Error
; Also perform a manual yield, just to increase the scope of the test.
call_x #vPortYield
inc_x &usRegTest2LoopCounter
jmp prvRegTest2Loop
nop
vRegTest2Error:
jmp vRegTest2Error
nop
.endasmfunc
; /*-----------------------------------------------------------
.end
|
testall.asm | MrGlockenspiel/sfxasm | 1 | 29762 | adc $0E
adc# $0E
add $0E
add# $0E
alt1
alt2
alt3
and $0E
and# $0E
asr
bcc 12
bcs 12
beq 12
bge 12
bic $0E
bic# $0E
blt 12
bmi 12
bne 12
bpl 12
bra 12
bvc 12
bvs 12
cache
cmode
cmp $0E
color
dec $0E
div2
fmult
from $0E
getb
getbh
getbl
getbs
getc
hib
ibt $03,$67
inc $0E
iwt $0E,$1234
jmp $0E
ldb $0E
ldw $0E
lea $0E,$1234
link $0E
ljmp $0E
lm $0E,$1234
lms $03,$67
lmult
lob
loop
lsr
merge
move $0A,$0E
moves $0A,$0E
mult $0E
mult# $0E
nop
not
or $0E
or# $0E
plot
ramb
rol
romb
ror
rpix
sbc $0E
sbk
sex
sm $0E,$1234
sms $03,$67
stb $0E
stop
stw $0E
sub $0E
sub# $0E
swap
to $0E
umult $0E
umult# $0E
with $0E
xor $0E
xor# $0E |
theorems/cohomology/SuspAdjointLoopIso.agda | mikeshulman/HoTT-Agda | 0 | 6130 | {-# OPTIONS --without-K --rewriting #-}
open import HoTT
open import homotopy.PtdAdjoint
open import homotopy.SuspAdjointLoop
open import cohomology.WithCoefficients
module cohomology.SuspAdjointLoopIso where
module SuspAdjointLoopIso {i} where
private
hadj : HomAdjoint {i} {i} Σ⊣Ω.SuspFunctor Σ⊣Ω.LoopFunctor
hadj = counit-unit-to-hom Σ⊣Ω.adj
module A = HomAdjoint hadj
module _ (X Y : Ptd i) where
abstract
pres-comp : (h₁ h₂ : ⊙Susp X ⊙→ ⊙Ω Y)
→ –> (A.eq X (⊙Ω Y)) (⊙Ω-∙ ⊙∘ ⊙fanout h₁ h₂)
== ⊙Ω-∙ ⊙∘ ⊙fanout (–> (A.eq X (⊙Ω Y)) h₁) (–> (A.eq X (⊙Ω Y)) h₂)
pres-comp h₁ h₂ =
B.nat-cod h₁ h₂ ⊙Ω-∙
∙ ap (_⊙∘ ⊙fanout (–> (A.eq X (⊙Ω Y)) h₁) (–> (A.eq X (⊙Ω Y)) h₂))
arr2-lemma
where
module A× = RightAdjoint× hadj
module B = RightAdjointBinary hadj
ap2-lemma : ∀ {i j k} {A : Type i} {B : Type j} {C : Type k}
(f : A × B → C) {r s : A × B} (p : r == s)
→ ap f p == ap2 (curry f) (ap fst p) (ap snd p)
ap2-lemma f idp = idp
⊙ap2-lemma : ∀ {i j k} {X : Ptd i} {Y : Ptd j} {Z : Ptd k}
(f : X ⊙× Y ⊙→ Z)
→ ⊙Ω-fmap f == ⊙Ω-fmap2 f ⊙∘ ⊙fanout (⊙Ω-fmap ⊙fst) (⊙Ω-fmap ⊙snd)
⊙ap2-lemma (f , idp) = ⊙λ= (ap2-lemma f) idp
arr2-lemma : B.arr2 ⊙Ω-∙ == ⊙Ω-∙
arr2-lemma =
⊙Ω-fmap ⊙Ω-∙ ⊙∘ A×.⊙out _ _
=⟨ ⊙ap2-lemma ⊙Ω-∙ |in-ctx _⊙∘ A×.⊙out _ _ ⟩
(⊙Ω-fmap2 ⊙Ω-∙ ⊙∘ A×.⊙into _ _) ⊙∘ A×.⊙out _ _
=⟨ ⊙∘-assoc (⊙Ω-fmap2 ⊙Ω-∙) (A×.⊙into _ _) (A×.⊙out _ _) ⟩
⊙Ω-fmap2 ⊙Ω-∙ ⊙∘ (A×.⊙into _ _ ⊙∘ A×.⊙out _ _)
=⟨ A×.⊙into-out _ _ |in-ctx ⊙Ω-fmap2 ⊙Ω-∙ ⊙∘_ ⟩
⊙Ω-fmap2 ⊙Ω-∙
=⟨ ⊙Ω-fmap2-∙ ⟩
⊙Ω-∙ ∎
iso : Trunc-⊙→Ω-group (⊙Susp X) Y ≃ᴳ Trunc-⊙→Ω-group X (⊙Ω Y)
iso = Trunc-group-emap (≃-to-≃ᴳˢ (A.eq X (⊙Ω Y)) pres-comp)
abstract
nat-dom : {X Y : Ptd i} (f : X ⊙→ Y) (Z : Ptd i)
→ fst (iso X Z) ∘ᴳ Trunc-⊙→Ω-group-fmap-dom (⊙Susp-fmap f) Z
== Trunc-⊙→Ω-group-fmap-dom f (⊙Ω Z) ∘ᴳ fst (iso Y Z)
nat-dom f Z = group-hom= $ λ= $ Trunc-elim
(λ _ → =-preserves-level Trunc-level)
(λ g → ap [_] (! (A.nat-dom f (⊙Ω Z) g)))
|
Common/ASM/Timer1_ASM.asm | anton-qiu/QuickRTOS | 0 | 95038 |
$INCLUDE (.\Common\ASM\include.asm)
AREA Timer_ASM_Code, CODE // READONLY, ALIGN=4
RSEG Timer_ASM_Code
; ENTRY
EXTERN DATA (vpTimer1Counter0_ISR)
EXTERN DATA (vpTimer1Counter1_ISR)
EXTERN DATA (vpTimer1Counter2_ISR)
EXTERN DATA (vpTimer1Counter3_ISR)
T1_INT_EN_MASK EQU 0x20
T1_INT_NUMBER EQU 0x05
T1_IR_ALL EQU 0xFF
T1_IR_MR0_MASK EQU 0x01
T1_IR_MR1_MASK EQU 0x02
T1_IR_MR2_MASK EQU 0x04
T1_IR_MR3_MASK EQU 0x08
T1_IR_CR0_MASK EQU 0x10
T1_IR_CR1_MASK EQU 0x20
T1_IR_CR2_MASK EQU 0x40
T1_IR_CR3_MASK EQU 0x80
T1_TCR_ENABLE EQU 0x01
T1_TCR_DISABLE EQU 0x00
T1_TCR_RESET EQU 0x02
T1_MCR0_MASK EQU 0x0007
T1_MCR1_MASK EQU 0x0038
T1_MCR2_MASK EQU 0x01C0
T1_MCR3_MASK EQU 0x0E00
;;/*******************************************************************************
;;* MACRO Name :
;;* Description :
;;*
;;*---------------------------------------------------------------------
;;* Global Variable : -
;;*
;;* Input Parameter : -
;;* Output Parameter : -
;;* Subroutine Called : -
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
TEMPLATE MACRO /* Currently no parameters */
//LOCAL local-labels /* Currently no LOCAL */
ENDM
;;/*******************************************************************************
;;* Function Name : void Timer1_ISR(void) INTERRUPT
;;* Description : Main Entry point to the Timer 1 ISR. This function will
;;* dispatch the execution to the corresponding handler depends on the
;;* interrupt source (Match on Counter 0, or Counter 1, Counter 2, or Counter 3)
;;*---------------------------------------------------------------------
;;* Global Variable : vpTimer1Counter0_ISR, vpTimer1Counter1_ISR,
;;* vpTimer1Counter2_ISR, vpTimer1Counter3_ISR
;;*
;;* Input Parameter : -
;;* Output Parameter : -
;;* Subroutine Called : -
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
IF (ENV_RVDS == 1)
GLOBAL Timer1_ISR
CODE32
Timer1_ISR PROC
ENDIF
IF (ENV_KEIL == 1)
PUBLIC Timer1_ISR?A
Timer1_ISR?A PROC CODE32
ENDIF
STMFD R13!, {R0-R12}
MRS R4, SPSR
TST R4, #0x00000020 ;; Check ARM/Thumb
SUBEQ LR, LR, #4 ;; Set ARM return
SUBNE LR, LR, #2 ;; Set Thumb return
STMFD SP!, {LR}
LDR R4, =T1IR ;; Read Timer 1 Interrupt Register
LDR R5,[R4]
MOV R8, #T1_IR_MR0_MASK ;; Counter Increment Interrupt Flag
TST R5, R8 ;; Check the current PIN value
BEQ Counter1_Int ;; skip if zero
;; Handle for Counter 0 Interrupt
;;-----------------------------------
LDR R6, =vpTimer1Counter0_ISR
LDR R5, [R6]
MOV LR, PC ;; Return Address
BX R5 ;; CALL vpTimer1Counter0_ISR()
Counter1_Int:
LDR R4, =T1IR ;; Read Timer 1 Interrupt Register
LDR R5,[R4]
MOV R8, #T1_IR_MR1_MASK ;; Alarm Interrupt Flag
TST R5, R8 ;; Check the current PIN value
BEQ Counter2_Int ;; skip if zero
;; Handle for Counter 1 Interrupt
;;-----------------------------------
LDR R6, =vpTimer1Counter1_ISR
LDR R5, [R6]
MOV LR, PC ;; Return Address
BX R5 ;; CALL vpTimer1Counter1_ISR()
Counter2_Int:
LDR R4, =T1IR ;; Read Timer 1 Interrupt Register
LDR R5,[R4]
MOV R8, #T1_IR_MR2_MASK ;; Alarm Interrupt Flag
TST R5, R8 ;; Check the current PIN value
BEQ Counter3_Int ;; skip if zero
;; Handle for Counter 1 Interrupt
;;-----------------------------------
LDR R6, =vpTimer1Counter2_ISR
LDR R5, [R6]
MOV LR, PC ;; Return Address
BX R5 ;; CALL vpTimer1Counter1_ISR()
Counter3_Int:
LDR R4, =T1IR ;; Read Timer 1 Interrupt Register
LDR R5,[R4]
MOV R8, #T1_IR_MR3_MASK ;; Alarm Interrupt Flag
TST R5, R8 ;; Check the current PIN value
BEQ Timer1_ISR_Exit ;; skip if zero
;; Handle for Counter 1 Interrupt
;;-----------------------------------
LDR R6, =vpTimer1Counter3_ISR
LDR R5, [R6]
MOV LR, PC ;; Return Address
BX R5 ;; CALL vpTimer1Counter1_ISR()
Timer1_ISR_Exit:
LDR R4, =T1IR
MOV R5, #T1_IR_ALL ;; Clear All Timer 1 Interrupt flag
STR R5, [R4]
;; MUST DO THIS BEFORE EXIT FROM INTERRUPT
LDR R4, =VICVectAddr ;;
MOV R5, #0x00000000 ;; Dummy
STR R5,[R4] ;; Update priority hardware
LDMFD SP!, {LR} ;; POP return address
LDMFD SP!, {R0-R12} ;; POP registers from stack
ADDS PC, LR, #0 ;; Return
ENDP
;;/*******************************************************************************
;;* Function Name : void Timer1_Connect(void CODE * pISRCode, BYTE bPriority);
;;* Description : Connect the Timer1 to its first level of ISR and assign
;;* the priority of Timer 1 interrupt.
;;*---------------------------------------------------------------------
;;* Global Variable : -
;;*
;;* Input Parameter : pISRCode, bPriority
;;* Output Parameter : -
;;* Subroutine Called : -
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
;; void Timer1_Connect(void CODE * pISRCode, BYTE bPriority);
IF (ENV_RVDS == 1)
GLOBAL Timer1_Connect
CODE32
Timer1_Connect PROC
ENDIF
IF (ENV_KEIL == 1)
PUBLIC Timer1_Connect?A
Timer1_Connect?A PROC CODE32
ENDIF
;;-----------------------------------
;; Disable Interrupt First
;;-----------------------------------
LDR R2, =VICIntEnable
LDR R3, [R2]
STMFD SP!, {R3} ;; Saves the original value of VICIntEnable
BIC R3, R3, #T1_INT_EN_MASK ;; Disable Timer 1 Interrupt (bit 4)
STR R3, [R2]
;;-----------------------------------
;; Initialize RTC Interupt (VIC) and enable RTC
;;-----------------------------------
AND R1, R1, #PRIORITY_MASK ;; priority 0 to 15
LDR R2, =VICVectCntl0
ADD R2, R2, R1, LSL #0x02 ;; VICVectCntl_N
MOV R3, #T1_INT_NUMBER ;; Set IRQ_N to RTC interrupt
ORR R3, R3, #0x20 ;; Enable IRQ_N
STR R3, [R2]
LDR R2, =VICVectAddr0
ADD R2, R2, R1, LSL #0x02 ;; VICVectAddr_N
;; LDR R0, =T1_ISR?A ;; Set The ISR (Fixed)
STR R0, [R2] ;; VICVectAddr_N = pISRCode;
LDR R2, =T1IR ;; Clear interupt flag, just in case
MOV R3, #T1_IR_ALL ;; Clear all timer 1 interrupt flag
STR R3, [R2]
LDR R2, =VICIntEnable
LDMIA SP!,{R3} ;; Restore the value of VICIntEnable
STR R3, [R2]
BX LR ;; Return
ENDP
;;/*******************************************************************************
;;* Function Name : void Timer1_Reset(void);
;;* Description : Reset Timer 1 Counter and Prescaler.
;;*---------------------------------------------------------------------
;;* Global Variable : -
;;*
;;* Input Parameter : -
;;* Output Parameter : -
;;* Subroutine Called : -
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
;; void Timer1_Reset(void);
IF (ENV_RVDS == 1)
GLOBAL Timer1_Reset
CODE32
Timer1_Reset PROC
ENDIF
IF (ENV_KEIL == 1)
PUBLIC Timer1_Reset?A
Timer1_Reset?A PROC CODE32
ENDIF
LDR R2, =T1TCR ;; Reset Timer 1 Counter and prescaler
MOV R3, #T1_TCR_RESET
STR R3, [R2]
BX LR ;; Return
ENDP
;;/*******************************************************************************
;;* Function Name : void Timer1_ClearInt(void);
;;* Description : Clear All Timer1 Interrupt Pending Flag.
;;*---------------------------------------------------------------------
;;* Global Variable : -
;;*
;;* Input Parameter : -
;;* Output Parameter : -
;;* Subroutine Called : -
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
;; void Timer1_ClearInt(void);
IF (ENV_RVDS == 1)
GLOBAL Timer1_ClearInt
CODE32
Timer1_ClearInt PROC
ENDIF
IF (ENV_KEIL == 1)
PUBLIC Timer1_ClearInt?A
Timer1_ClearInt?A PROC CODE32
ENDIF
LDR R2, =T1IR ;; Clear Timer 1 interupt flag
MOV R3, #T1_IR_ALL ;; Clear all timer 1 interrupt flag
STR R3, [R2]
BX LR ;; Return
ENDP
;;/*******************************************************************************
;;* Function Name : void Timer1_Enable(void);
;;* Description : Anable Timer 1 Interrupt and start the Timer 1.
;;*---------------------------------------------------------------------
;;* Global Variable : -
;;*
;;* Input Parameter : -
;;* Output Parameter : -
;;* Subroutine Called : -
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
;; void Timer1_Enable(void);
IF (ENV_RVDS == 1)
GLOBAL Timer1_Enable
CODE32
Timer1_Enable PROC
ENDIF
IF (ENV_KEIL == 1)
PUBLIC Timer1_Enable?A
Timer1_Enable?A PROC CODE32
ENDIF
LDR R2, =VICIntEnable
LDR R3, [R2]
ORR R3, R3, #T1_INT_EN_MASK ;; Enable Timer 1 Interrupt (bit 4)
STR R3, [R2]
LDR R2, =T1TCR ;; Enable Timer 1 (without reseting the timer)
MOV R3, #T1_TCR_ENABLE
STR R3, [R2]
BX LR ;; Return
ENDP
;;/*******************************************************************************
;;* Function Name : void Timer1_Disable(void);
;;* Description : Disable Timer 1 Interrupt and stop Timer 1.
;;*---------------------------------------------------------------------
;;* Global Variable : -
;;*
;;* Input Parameter : -
;;* Output Parameter : -
;;* Subroutine Called : -
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
;; void Timer1_Disable(void);
IF (ENV_RVDS == 1)
GLOBAL Timer1_Disable
CODE32
Timer1_Disable PROC
ENDIF
IF (ENV_KEIL == 1)
PUBLIC Timer1_Disable?A
Timer1_Disable?A PROC CODE32
ENDIF
;;-----------------------------------
;; Disable Interrupt
;;-----------------------------------
LDR R2, =VICIntEnable
LDR R3, [R2]
BIC R3, R3, #T1_INT_EN_MASK ;; Disable Timer 1 Interrupt (bit 4)
STR R3, [R2]
LDR R2, =T1TCR ;; Disable Timer 1 (without reseting the timer)
MOV R3, #T1_TCR_DISABLE
STR R3, [R2]
BX LR ;; Return
ENDP
;;/*******************************************************************************
;;* Function Name : void Timer1_InitPrescalerMode(TIMER_TYPE xPrescaler, BYTE bMode);
;;* Description : Set the Timer 1 prescaler and the Timer 1 clock source.
;;*---------------------------------------------------------------------
;;* Global Variable : -
;;*
;;* Input Parameter : xPrescaler, bMode (for clock source, etc)
;;* Output Parameter : -
;;* Subroutine Called : -
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
;; void Timer1_InitPrescalerMode(TIMER_TYPE xPrescaler, BYTE bMode);
IF (ENV_RVDS == 1)
GLOBAL Timer1_InitPrescalerMode
CODE32
Timer1_InitPrescalerMode PROC
ENDIF
IF (ENV_KEIL == 1)
PUBLIC Timer1_InitPrescalerMode?A
Timer1_InitPrescalerMode?A PROC CODE32
ENDIF
LDR R2, =T1CTCR ;; Set the mode
STR R1, [R2] ;; T1CTCR = bMode;
LDR R2, =T1PR ;; Set Maximum prescaler Value
STR R0, [R2] ;; T1PR = xPrescaler;
BX LR ;; Return
ENDP
;;--------
;;/*******************************************************************************
;;* Function Name : Timer1_SetCounter0()
;;* Description : Initialize ISR for Counter0, Set the Match Register 0,
;;* and set the Mode of Match on Counter 0.
;;*---------------------------------------------------------------------
;;* Global Variable : vpTimer1Counter0_ISR
;;*
;;* Input Parameter : pISRCode, xCounter, wMODE
;;* Output Parameter : -
;;* Subroutine Called : -
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
;; void Timer1_SetCounter0(P_ISR_CODE pISRCode, TIMER_TYPE xCounter, WORD wMODE); // BASE_TYPE xCounter, BASE_TYPE xPrescaler
IF (ENV_RVDS == 1)
GLOBAL Timer1_SetCounter0
CODE32
Timer1_SetCounter0 PROC
ENDIF
IF (ENV_KEIL == 1)
PUBLIC Timer1_SetCounter0?A
Timer1_SetCounter0?A PROC CODE32
ENDIF
LDR R3, =vpTimer1Counter0_ISR ;; Set the ISR
STR R0, [R3] ;; vpTimer1Counter0_ISR = pISRCode;
LDR R3, =T1MR0 ;; Set the Counter
STR R1, [R3] ;; T1MR0 = xCounter;
LDR R3, =T1MCR ;; Set the Mode
LDR R0, [R3]
AND R0, R0, #(~T1_MCR0_MASK) ;; NEED TO CHECK THIS INSTRUCTION!!
AND R2, R2, #T1_MCR0_MASK
ORR R2, R2, R0
STR R2, [R3]
BX LR ;; Return
ENDP
;;/*******************************************************************************
;;* Function Name : Timer1_SetCounter1()
;;* Description : Initialize ISR for Counter1, Set the Match Register 1,
;;* and set the Mode of Match on Counter 1.
;;*---------------------------------------------------------------------
;;* Global Variable : vpTimer1Counter1_ISR
;;*
;;* Input Parameter : pISRCode, xCounter, wMODE
;;* Output Parameter : -
;;* Subroutine Called : -
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
;; void Timer1_SetCounter1(P_ISR_CODE pISRCode, TIMER_TYPE xCounter); // BASE_TYPE xCounter, BASE_TYPE xPrescaler
IF (ENV_RVDS == 1)
GLOBAL Timer1_SetCounter1
CODE32
Timer1_SetCounter1 PROC
ENDIF
IF (ENV_KEIL == 1)
PUBLIC Timer1_SetCounter1?A
Timer1_SetCounter1?A PROC CODE32
ENDIF
LDR R3, =vpTimer1Counter1_ISR ;; Set the ISR
STR R0, [R3] ;; vpTimer1Counter1_ISR = pISRCode;
LDR R3, =T1MR1 ;; Set the Counter
STR R1, [R3] ;; T1MR1 = xCounter;
LDR R3, =T1MCR ;; Set the Mode
LDR R0, [R3]
AND R0, R0, #(~T1_MCR1_MASK) ;; NEED TO CHECK THIS INSTRUCTION!!
AND R2, R2, #T1_MCR1_MASK
ORR R2, R2, R0
STR R2, [R3]
BX LR ;; Return
ENDP
;;/*******************************************************************************
;;* Function Name : Timer1_SetCounter2()
;;* Description : Initialize ISR for Counter2, Set the Match Register 2,
;;* and set the Mode of Match on Counter 2.
;;*---------------------------------------------------------------------
;;* Global Variable : vpTimer1Counter2_ISR
;;*
;;* Input Parameter : pISRCode, xCounter, wMODE
;;* Output Parameter : -
;;* Subroutine Called : -
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
;; void Timer1_SetCounter2(P_ISR_CODE pISRCode, TIMER_TYPE xCounter); // BASE_TYPE xCounter, BASE_TYPE xPrescaler
IF (ENV_RVDS == 1)
GLOBAL Timer1_SetCounter2
CODE32
Timer1_SetCounter2 PROC
ENDIF
IF (ENV_KEIL == 1)
PUBLIC Timer1_SetCounter2?A
Timer1_SetCounter2?A PROC CODE32
ENDIF
LDR R3, =vpTimer1Counter2_ISR ;; Set the ISR
STR R0, [R3] ;; vpTimer1Counter2_ISR = pISRCode;
LDR R3, =T1MR2 ;; Set the Counter
STR R1, [R3] ;; T1MR2 = xCounter;
LDR R3, =T1MCR ;; Set the Mode
LDR R0, [R3]
AND R0, R0, #(~T1_MCR2_MASK) ;; NEED TO CHECK THIS INSTRUCTION!!
AND R2, R2, #T1_MCR2_MASK
ORR R2, R2, R0
STR R2, [R3]
BX LR ;; Return
ENDP
;;/*******************************************************************************
;;* Function Name : Timer1_SetCounter3()
;;* Description : Initialize ISR for Counter3, Set the Match Register 3,
;;* and set the Mode of Match on Counter 3.
;;*---------------------------------------------------------------------
;;* Global Variable : vpTimer1Counter3_ISR
;;*
;;* Input Parameter : pISRCode, xCounter, wMODE
;;* Output Parameter : -
;;* Subroutine Called : -
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
;; void Timer1_SetCounter3(P_ISR_CODE pISRCode, TIMER_TYPE xCounter); // BASE_TYPE xCounter, BASE_TYPE xPrescaler
IF (ENV_RVDS == 1)
GLOBAL Timer1_SetCounter3
CODE32
Timer1_SetCounter3 PROC
ENDIF
IF (ENV_KEIL == 1)
PUBLIC Timer1_SetCounter3?A
Timer1_SetCounter3?A PROC CODE32
ENDIF
LDR R3, =vpTimer1Counter3_ISR ;; Set the ISR
STR R0, [R3] ;; vpTimer1Counter3_ISR = pISRCode;
LDR R3, =T1MR3 ;; Set the Counter
STR R1, [R3] ;; T1MR3 = xCounter;
LDR R3, =T1MCR ;; Set the Mode
LDR R0, [R3]
AND R0, R0, #(~T1_MCR3_MASK) ;; NEED TO CHECK THIS INSTRUCTION!!
AND R2, R2, #T1_MCR3_MASK
ORR R2, R2, R0
STR R2, [R3]
BX LR ;; Return
ENDP
;;--------
;;/*******************************************************************************
;;* Function Name : Timer1_GetMaxCounter0()
;;* Description : Get the Maximum Counter Tick Value (value of Match Register)
;;*---------------------------------------------------------------------
;;* Global Variable : -
;;*
;;* Input Parameter : -
;;* Output Parameter : Return Maximum Counter Tick Value.
;;* Subroutine Called : -
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
;; TIMER_TYPE Timer1_GetMaxCounter0(void);
IF (ENV_RVDS == 1)
GLOBAL Timer1_GetMaxCounter0
CODE32
Timer1_GetMaxCounter0 PROC
ENDIF
IF (ENV_KEIL == 1)
PUBLIC Timer1_GetMaxCounter0?A
Timer1_GetMaxCounter0?A PROC CODE32
ENDIF
LDR R3, =T1MR0 ;;
LDR R0, [R3] ;; return (T1MR0);
BX LR ;; Return
ENDP
;; TIMER_TYPE Timer1_GetMaxCounter1(void);
IF (ENV_RVDS == 1)
GLOBAL Timer1_GetMaxCounter1
CODE32
Timer1_GetMaxCounter1 PROC
ENDIF
IF (ENV_KEIL == 1)
PUBLIC Timer1_GetMaxCounter1?A
Timer1_GetMaxCounter1?A PROC CODE32
ENDIF
LDR R3, =T1MR1 ;;
LDR R0, [R3] ;; return (T1MR1);
BX LR ;; Return
ENDP
;; TIMER_TYPE Timer1_GetMaxCounter2(void);
IF (ENV_RVDS == 1)
GLOBAL Timer1_GetMaxCounter2
CODE32
Timer1_GetMaxCounter2 PROC
ENDIF
IF (ENV_KEIL == 1)
PUBLIC Timer1_GetMaxCounter2?A
Timer1_GetMaxCounter2?A PROC CODE32
ENDIF
LDR R3, =T1MR2 ;;
LDR R0, [R3] ;; return (T1MR2);
BX LR ;; Return
ENDP
;; TIMER_TYPE Timer1_GetMaxCounter3(void);
IF (ENV_RVDS == 1)
GLOBAL Timer1_GetMaxCounter3
CODE32
Timer1_GetMaxCounter3 PROC
ENDIF
IF (ENV_KEIL == 1)
PUBLIC Timer1_GetMaxCounter3?A
Timer1_GetMaxCounter3?A PROC CODE32
ENDIF
LDR R3, =T1MR3 ;;
LDR R0, [R3] ;; return (T1MR3);
BX LR ;; Return
ENDP
;;--------
;;/*******************************************************************************
;;* Function Name : Timer1_GetTick()
;;* Description : Get the current value of Timer Counter.
;;*---------------------------------------------------------------------
;;* Global Variable : -
;;*
;;* Input Parameter : -
;;* Output Parameter : -
;;* Subroutine Called : -
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
;; TIMER_TYPE Timer1_GetTick(void);
IF (ENV_RVDS == 1)
GLOBAL Timer1_GetTick
CODE32
Timer1_GetTick PROC
ENDIF
IF (ENV_KEIL == 1)
PUBLIC Timer1_GetTick?A
Timer1_GetTick?A PROC CODE32
ENDIF
LDR R3, =T1TC ;;
LDR R0, [R3] ;; return (T1TC);
BX LR ;; Return
ENDP
END
|
Data/Nat/DM.agda | banacorn/numeral | 1 | 10070 | <gh_stars>1-10
------------------------------------------------------------------------
-- The Agda standard library
--
-- Integer division
------------------------------------------------------------------------
module Data.Nat.DM where
open import Data.Fin as Fin using (Fin; toℕ)
import Data.Fin.Properties as FinP
open import Data.Nat as Nat
open import Data.Nat.Properties as NatP
open import Data.Nat.Properties.Simple
open import Relation.Nullary.Decidable
open import Relation.Binary.PropositionalEquality as P using (_≡_)
import Relation.Binary.PropositionalEquality.TrustMe as TrustMe
using (erase)
open NatP.SemiringSolver
open P.≡-Reasoning
open Nat.≤-Reasoning
renaming (begin_ to start_; _∎ to _□; _≡⟨_⟩_ to _≡⟨_⟩′_)
infixl 7 _div_ _mod_ _divMod_
-- Integer division.
private
div-helper : ℕ → ℕ → ℕ → ℕ → ℕ
div-helper acc s zero n = acc
div-helper acc s (suc d) zero = div-helper (suc acc) s d s
div-helper acc s (suc d) (suc n) = div-helper acc s d n
-- {-# BUILTIN NATDIVSUCAUX div-helper #-}
_div_ : (dividend divisor : ℕ) {≢0 : False (divisor ≟ 0)} → ℕ
(d div 0) {}
(d div suc s) = div-helper 0 s d s
-- The remainder after integer division.
private
mod-helper : ℕ → ℕ → ℕ → ℕ → ℕ
mod-helper acc s zero n = acc
mod-helper acc s (suc d) zero = mod-helper zero s d s
mod-helper acc s (suc d) (suc n) = mod-helper (suc acc) s d n
-- {-# BUILTIN NATMODSUCAUX mod-helper #-}
-- The remainder is not too large.
mod-lemma : (acc d n : ℕ) →
let s = acc + n in
mod-helper acc s d n ≤ s
mod-lemma acc zero n = start
acc ≤⟨ m≤m+n acc n ⟩
acc + n □
mod-lemma acc (suc d) zero = start
mod-helper zero (acc + 0) d (acc + 0) ≤⟨ mod-lemma zero d (acc + 0) ⟩
acc + 0 □
mod-lemma acc (suc d) (suc n) =
P.subst (λ x → mod-helper (suc acc) x d n ≤ x)
(P.sym (+-suc acc n))
(mod-lemma (suc acc) d n)
_mod_ : (dividend divisor : ℕ) {≢0 : False (divisor ≟ 0)} → Fin divisor
(d mod 0) {}
(d mod suc s) =
Fin.fromℕ≤″ (mod-helper 0 s d s)
(Nat.erase (≤⇒≤″ (s≤s (mod-lemma 0 d s))))
-- Integer division with remainder.
private
-- The quotient and remainder are related to the dividend and
-- divisor in the right way.
division-lemma :
(mod-acc div-acc d n : ℕ) →
let s = mod-acc + n in
mod-acc + div-acc * suc s + d
≡
mod-helper mod-acc s d n + div-helper div-acc s d n * suc s
division-lemma mod-acc div-acc zero n = begin
mod-acc + div-acc * suc s + zero ≡⟨ +-right-identity _ ⟩
mod-acc + div-acc * suc s ∎
where s = mod-acc + n
division-lemma mod-acc div-acc (suc d) zero = begin
mod-acc + div-acc * suc s + suc d ≡⟨ solve 3
(λ mod-acc div-acc d →
let s = mod-acc :+ con 0 in
mod-acc :+ div-acc :* (con 1 :+ s) :+ (con 1 :+ d)
:=
(con 1 :+ div-acc) :* (con 1 :+ s) :+ d)
P.refl mod-acc div-acc d ⟩
suc div-acc * suc s + d ≡⟨ division-lemma zero (suc div-acc) d s ⟩
mod-helper zero s d s +
div-helper (suc div-acc) s d s * suc s ≡⟨⟩
mod-helper mod-acc s (suc d) zero +
div-helper div-acc s (suc d) zero * suc s ∎
where s = mod-acc + 0
division-lemma mod-acc div-acc (suc d) (suc n) = begin
mod-acc + div-acc * suc s + suc d ≡⟨ solve 4
(λ mod-acc div-acc n d →
mod-acc :+ div-acc :* (con 1 :+ (mod-acc :+ (con 1 :+ n))) :+ (con 1 :+ d)
:=
con 1 :+ mod-acc :+ div-acc :* (con 2 :+ mod-acc :+ n) :+ d)
P.refl mod-acc div-acc n d ⟩
suc mod-acc + div-acc * suc s′ + d ≡⟨ division-lemma (suc mod-acc) div-acc d n ⟩
mod-helper (suc mod-acc) s′ d n +
div-helper div-acc s′ d n * suc s′ ≡⟨ P.cong (λ s → mod-helper (suc mod-acc) s d n +
div-helper div-acc s d n * suc s)
(P.sym (+-suc mod-acc n)) ⟩
mod-helper (suc mod-acc) s d n +
div-helper div-acc s d n * suc s ≡⟨⟩
mod-helper mod-acc s (suc d) (suc n) +
div-helper div-acc s (suc d) (suc n) * suc s ∎
where
s = mod-acc + suc n
s′ = suc mod-acc + n
-- A specification of integer division.
record DivMod (dividend divisor : ℕ) {≢0 : False (divisor ≟ 0)} : Set where
constructor result
field
quotient : ℕ
remainder : Fin divisor
property : dividend ≡ toℕ remainder + quotient * divisor
div-eq : _div_ dividend divisor {≢0} ≡ quotient
mod-eq : _mod_ dividend divisor {≢0} ≡ remainder
_divMod_ : (dividend divisor : ℕ) {≢0 : False (divisor ≟ 0)} →
DivMod dividend divisor {≢0}
(d divMod 0) {}
(d divMod suc s) =
result
(d div suc s)
(d mod suc s)
(TrustMe.erase (begin
d
≡⟨ division-lemma 0 0 d s ⟩
mod-helper 0 s d s + div-helper 0 s d s * suc s
≡⟨ P.cong₂ _+_ (P.sym (FinP.toℕ-fromℕ≤ lemma)) P.refl ⟩
toℕ (Fin.fromℕ≤ lemma) + div-helper 0 s d s * suc s
≡⟨ P.cong (λ n → toℕ n + div-helper 0 s d s * suc s) (FinP.fromℕ≤≡fromℕ≤″ lemma _) ⟩
toℕ (Fin.fromℕ≤″ _ lemma′) + div-helper 0 s d s * suc s
∎))
_≡_.refl
_≡_.refl
where
lemma = s≤s (mod-lemma 0 d s)
lemma′ = Nat.erase (≤⇒≤″ lemma)
|
libsrc/_DEVELOPMENT/math/float/am9511/c/sdcc/cam32_sdcc_round.asm | dikdom/z88dk | 1 | 171644 |
SECTION code_fp_am9511
PUBLIC cam32_sdcc_round
EXTERN asm_sdcc_read1, _am9511_round
defc cam32_sdcc_round = _am9511_round
|
src/LibraBFT/Impl/Properties/Util.agda | LaudateCorpus1/bft-consensus-agda | 0 | 12732 | <reponame>LaudateCorpus1/bft-consensus-agda
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9.
Copyright (c) 2021, Oracle and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl
-}
-- This module contains definitions of properties of only the behavior of the
-- handlers, nothing concerning the system state.
open import LibraBFT.Base.Types
open import LibraBFT.Concrete.System.Parameters
open import LibraBFT.Concrete.Records
open import LibraBFT.Impl.Consensus.ConsensusTypes.Block as Block
open import LibraBFT.Impl.Consensus.EpochManagerTypes
import LibraBFT.Impl.Handle as Handle
open import LibraBFT.ImplShared.Base.Types
open import LibraBFT.ImplShared.Consensus.Types
open import LibraBFT.ImplShared.Consensus.Types.EpochDep
open import LibraBFT.ImplShared.Interface.Output
open import LibraBFT.ImplShared.Util.Dijkstra.All
open import Optics.All
open import Util.ByteString
open import Util.KVMap as Map
open import Util.Lemmas
open import Util.PKCS
open import Util.Prelude
open import LibraBFT.ImplShared.Util.HashCollisions Handle.InitHandler.initAndHandlers
open import LibraBFT.Abstract.Types.EpochConfig UID NodeId
open ParamsWithInitAndHandlers Handle.InitHandler.initAndHandlers
open import Yasm.Yasm ℓ-RoundManager ℓ-VSFP ConcSysParms
Handle.InitHandler.initAndHandlers
PeerCanSignForPK PeerCanSignForPK-stable
module LibraBFT.Impl.Properties.Util where
module Meta where
getLastVoteEpoch : SafetyData → Epoch
getLastVoteEpoch sd = (Maybe-maybe{B = const Epoch} (_^∙ vEpoch) (sd ^∙ sdEpoch)) ∘ (_^∙ sdLastVote) $ sd
-- getLastVoteEpoch rm = (maybe{B = const Epoch} (_^∙ vEpoch) (rm ^∙ pssSafetyData-rm ∙ sdEpoch)) ∘ (_^∙ pssSafetyData-rm ∙ sdLastVote) $ rm
getLastVoteRound : SafetyData → Round
getLastVoteRound = (Maybe-maybe{B = const Round} (_^∙ vRound) 0) ∘ (_^∙ sdLastVote)
-- getLastVoteRound = maybe{B = const Round} (_^∙ vRound) 0 ∘ (_^∙ pssSafetyData-rm ∙ sdLastVote)
subst-getLastVoteRound : ∀ {sd1 sd2} → sd1 ≡ sd2 → getLastVoteRound sd1 ≡ getLastVoteRound sd2
subst-getLastVoteRound refl = refl
module OutputProps where
module _ (outs : List Output) where
None : Set
None = outs ≡ []
NoVotes = NoneOfKind outs isSendVote?
NoProposals = NoneOfKind outs isBroadcastProposal?
NoSyncInfos = NoneOfKind outs isBroadcastSyncInfo?
NoMsgs = NoneOfKind outs isOutputMsg?
NoErrors = NoneOfKind outs isLogErr?
NoMsgs⇒× : NoMsgs → NoProposals × NoVotes × NoSyncInfos
proj₁ (NoMsgs⇒× noMsgs) =
filter-∪?-[]₁ outs isBroadcastProposal? _ noMsgs
proj₁ (proj₂ (NoMsgs⇒× noMsgs)) =
filter-∪?-[]₂ outs _ isSendVote?
(filter-∪?-[]₂ outs _ _ noMsgs)
proj₂ (proj₂ (NoMsgs⇒× noMsgs)) =
filter-∪?-[]₁ outs isBroadcastSyncInfo? _
(filter-∪?-[]₂ outs _ _ noMsgs)
NoMsgs⇒NoProposals : NoMsgs → NoProposals
NoMsgs⇒NoProposals = proj₁ ∘ NoMsgs⇒×
NoMsgs⇒NoVotes : NoMsgs → NoVotes
NoMsgs⇒NoVotes = proj₁ ∘ proj₂ ∘ NoMsgs⇒×
OneVote : VoteMsg → List Author → Set
OneVote vm pids = List-filter isSendVote? outs ≡ (SendVote vm pids ∷ [])
++-NoMsgs = λ xs ys → ++-NoneOfKind xs ys isOutputMsg?
++-NoVotes = λ xs ys → ++-NoneOfKind xs ys isSendVote?
++-NoProposals = λ xs ys → ++-NoneOfKind xs ys isBroadcastProposal?
++-NoVotes-OneVote : ∀ xs ys {vm} {pids} → NoVotes xs → OneVote ys vm pids
→ OneVote (xs ++ ys) vm pids
++-NoVotes-OneVote xs ys nv ov
rewrite List-filter-++ isSendVote? xs ys
| nv = ov
++-OneVote-NoVotes : ∀ xs {vm pids} ys → OneVote xs vm pids → NoVotes ys
→ OneVote (xs ++ ys) vm pids
++-OneVote-NoVotes xs ys ov nv
rewrite List-filter-++ isSendVote? xs ys
| nv
| ov = refl
module BlockProps (b : Block) where
∈BlockTree_ : BlockTree → Set
∈BlockTree bt = ∃[ eb ] (btGetBlock (b ^∙ bId) bt ≡ just eb)
∈BlockStore_ : BlockStore → Set
∈BlockStore bs = ∈BlockTree (bs ^∙ bsInner)
∈RoundManager_ : RoundManager → Set
∈RoundManager rm = ∈BlockStore (rm ^∙ lBlockStore)
module QCProps where
data _∈BlockTree_ (qc : QuorumCert) (bt : BlockTree) : Set where
inHQC : qc ≡ bt ^∙ btHighestQuorumCert → qc ∈BlockTree bt
inHCC : qc ≡ bt ^∙ btHighestCommitCert → qc ∈BlockTree bt
_∈RoundManager_ : (qc : QuorumCert) (rm : RoundManager) → Set
qc ∈RoundManager rm = qc ∈BlockTree (rm ^∙ lBlockStore ∙ bsInner)
∈Post⇒∈PreOr' : ∀ {A : Set} (_QC∈_ : QuorumCert → A → Set) (Q : QuorumCert → Set) (pre post : A) → Set
∈Post⇒∈PreOr' _QC∈_ Q pre post = ∀ qc → qc QC∈ post → qc QC∈ pre ⊎ Q qc
∈Post⇒∈PreOr'-∙ : ∀ {A B : Set}
→ (l : Lens A B)
→ (_QC∈B_ : QuorumCert → B → Set)
→ (_QC∈A_ : QuorumCert → A → Set)
→ (∀ {q st} → q QC∈B (st ^∙ l) → q QC∈A st)
→ (∀ {q st} → q QC∈A st → q QC∈B (st ^∙ l))
→ (Q : QuorumCert → Set)
→ (pre post : A)
→ ∈Post⇒∈PreOr' _QC∈B_ Q (pre ^∙ l) (post ^∙ l)
→ ∈Post⇒∈PreOr' _QC∈A_ Q pre post
∈Post⇒∈PreOr'-∙ l _QC∈B_ _QC∈A_ prfBA prfAB Q pre post QCB qc qc∈Apost =
⊎-map₁ prfBA (QCB qc (prfAB qc∈Apost))
∈Post⇒∈PreOr-∙-BT-RM : _
∈Post⇒∈PreOr-∙-BT-RM = ∈Post⇒∈PreOr'-∙ lBlockTree _∈BlockTree_ _∈RoundManager_ id id
∈Post⇒∈PreOrBT : (Q : QuorumCert → Set) (pre post : BlockTree) → Set
∈Post⇒∈PreOrBT = ∈Post⇒∈PreOr' _∈BlockTree_
∈BlockTree-upd-hqc : ∀ {bt1 bt2}
→ {Q : QuorumCert → Set}
→ bt1 ≡L bt2 at btHighestCommitCert
→ Q (bt2 ^∙ btHighestQuorumCert)
→ ∈Post⇒∈PreOrBT Q bt1 bt2
∈BlockTree-upd-hqc refl Q _ (inHQC refl) = inj₂ Q
∈BlockTree-upd-hqc refl _ _ (inHCC refl) = inj₁ (inHCC refl)
∈BlockTree-upd-hcc : ∀ {bt1 bt2}
→ {Q : QuorumCert → Set}
→ bt1 ≡L bt2 at btHighestQuorumCert
→ Q (bt2 ^∙ btHighestCommitCert)
→ ∈Post⇒∈PreOrBT Q bt1 bt2
∈BlockTree-upd-hcc refl _ _ (inHQC refl) = inj₁ (inHQC refl)
∈BlockTree-upd-hcc refl Q _ (inHCC refl) = inj₂ Q
∈Post⇒∈PreOr : (Q : QuorumCert → Set) (pre post : RoundManager) → Set
∈Post⇒∈PreOr = ∈Post⇒∈PreOr' _∈RoundManager_
∈Post⇒∈PreOr'-refl : ∀ {A : Set}
→ (_QC∈_ : QuorumCert → A → Set) (Q : QuorumCert → Set)
→ ∀ {pre : A}
→ ∈Post⇒∈PreOr' _QC∈_ Q pre pre
∈Post⇒∈PreOr'-refl _ _ _ = inj₁
∈Post⇒∈PreOrBT-QCs≡ : ∀ {bt1 bt2}
→ (Q : QuorumCert → Set)
→ bt1 ≡L bt2 at btHighestCommitCert
→ bt1 ≡L bt2 at btHighestQuorumCert
→ ∈Post⇒∈PreOrBT Q bt1 bt2
∈Post⇒∈PreOrBT-QCs≡ Q refl refl _ (inHQC refl) = inj₁ (inHQC refl)
∈Post⇒∈PreOrBT-QCs≡ Q refl refl _ (inHCC refl) = inj₁ (inHCC refl)
∈Post⇒∈PreOr'-trans : ∀ {A : Set}
→ (_QC∈_ : QuorumCert → A → Set) (Q : QuorumCert → Set)
→ ∀ {pre int post : A}
→ ∈Post⇒∈PreOr' _QC∈_ Q pre int
→ ∈Post⇒∈PreOr' _QC∈_ Q int post
→ ∈Post⇒∈PreOr' _QC∈_ Q pre post
∈Post⇒∈PreOr'-trans _QC∈_ Q pre→int int→post qc qc∈post
with int→post qc qc∈post
... | Right y = Right y
... | Left x
with pre→int qc x
... | Right y = Right y
... | Left x₁ = Left x₁
∈Post⇒∈PreOrBT-trans : ∀ (Q : QuorumCert → Set) {pre int post}
→ ∈Post⇒∈PreOrBT Q pre int
→ ∈Post⇒∈PreOrBT Q int post
→ ∈Post⇒∈PreOrBT Q pre post
∈Post⇒∈PreOrBT-trans = ∈Post⇒∈PreOr'-trans _∈BlockTree_
-- TODO-1: Factor out a property about a single output:
-- λ out → ∃₂ λ qc nm → qc QC∈NM nm × nm Msg∈Out out
OutputQc∈RoundManager : List Output → RoundManager → Set
OutputQc∈RoundManager outs rm =
All (λ out → ∀ qc nm → qc QC∈NM nm → nm Msg∈Out out → qc ∈RoundManager rm) outs
¬OutputQc : List Output → Set
¬OutputQc outs = All (λ out → ∀ qc nm → qc QC∈NM nm → nm Msg∈Out out → ⊥) outs
++-OutputQc∈RoundManager
: ∀ {rm outs₁ outs₂}
→ OutputQc∈RoundManager outs₁ rm → OutputQc∈RoundManager outs₂ rm
→ OutputQc∈RoundManager (outs₁ ++ outs₂) rm
++-OutputQc∈RoundManager = All-++
++-¬OutputQc : ∀ {outs₁ outs₂} → ¬OutputQc outs₁ → ¬OutputQc outs₂
→ ¬OutputQc (outs₁ ++ outs₂)
++-¬OutputQc = All-++
NoMsgs⇒¬OutputQc : ∀ outs → OutputProps.NoMsgs outs → ¬OutputQc outs
NoMsgs⇒¬OutputQc outs noMsgs =
All-map help (noneOfKind⇒All¬ outs _ noMsgs)
where
help : ∀ {out : Output} → ¬ IsOutputMsg out → ∀ qc nm → qc QC∈NM nm → nm Msg∈Out out → ⊥
help ¬msg qc .(P _) qc∈m inBP = ¬msg (Left tt)
help ¬msg qc .(V _) qc∈m inSV = ¬msg (Right (Right tt))
¬OutputQc⇒OutputQc∈RoundManager : ∀ outs rm → ¬OutputQc outs → OutputQc∈RoundManager outs rm
¬OutputQc⇒OutputQc∈RoundManager outs rm noOutQcs =
All-map (λ ¬outqc qc nm qc∈nm nm∈out → ⊥-elim (¬outqc qc nm qc∈nm nm∈out))
noOutQcs
NoMsgs⇒OutputQc∈RoundManager : ∀ outs rm → OutputProps.NoMsgs outs → OutputQc∈RoundManager outs rm
NoMsgs⇒OutputQc∈RoundManager outs rm noMsgs =
¬OutputQc⇒OutputQc∈RoundManager outs rm (NoMsgs⇒¬OutputQc outs noMsgs)
SigForVote∈Rm-SentB4 : Vote → PK → QuorumCert → RoundManager → SentMessages → Set
SigForVote∈Rm-SentB4 v pk qc rm pool =
qc ∈RoundManager rm
→ WithVerSig pk v →
∀ {vs : Author × Signature} → let (pid , sig) = vs in
vs ∈ qcVotes qc → rebuildVote qc vs ≈Vote v
→ ¬(∈BootstrapInfo-impl fakeBootstrapInfo sig)
→ MsgWithSig∈ pk sig pool
SigsForVotes∈Rm-SentB4 : SentMessages → RoundManager → Set
SigsForVotes∈Rm-SentB4 pool rm = ∀ {qc v pk} → SigForVote∈Rm-SentB4 v pk qc rm pool
++-SigsForVote∈Rm-SentB4
: ∀ {pool rm} → (msgs : SentMessages) → SigsForVotes∈Rm-SentB4 pool rm
→ SigsForVotes∈Rm-SentB4 (msgs ++ pool) rm
++-SigsForVote∈Rm-SentB4{pool} msgs sfvb4 qc∈rm sig vs∈qc rbld≈v ¬bootstrap =
MsgWithSig∈-++ʳ{ms = msgs} (sfvb4 qc∈rm sig vs∈qc rbld≈v ¬bootstrap)
module Invariants where
------------ properties for BlockTree validity
-- The property that a block tree `bt` has only valid QCs with respect to epoch config `𝓔`
AllValidQCs : (𝓔 : EpochConfig) (bt : BlockTree) → Set
AllValidQCs 𝓔 bt = (hash : HashValue) → Maybe-maybe (WithEC.MetaIsValidQC 𝓔) ⊤ (lookup hash (bt ^∙ btIdToQuorumCert))
AllValidBlocks : BlockTree → Set
AllValidBlocks bt = ∀ {bid eb}
→ btGetBlock bid bt ≡ just eb
→ BlockId-correct (eb ^∙ ebBlock) × BlockHash≡ (eb ^∙ ebBlock) bid
------------ types for and definitions of invariants for BlockTree, BlockStore, SafetyData, SafetyRules
record ECinfo : Set where
constructor mkECinfo
field
ecVV : ValidatorVerifier
ecEP : Epoch
open ECinfo
WithECinfo : Set → Set
WithECinfo A = A × ECinfo
BlockTree-EC = WithECinfo BlockTree
BlockStore-EC = WithECinfo BlockStore
module _ (btEC : BlockTree-EC) where
private
bt = proj₁ btEC
eci = proj₂ btEC
vv = ecVV eci
ep = ecEP eci
record BlockTreeInv : Set where
constructor mkBlockTreeInv
field
allValidQCs : (vvC : ValidatorVerifier-correct $ vv) → AllValidQCs (α-EC-VV (vv , vvC) ep) bt
allValidBlocks : AllValidBlocks bt
open BlockTreeInv
module _ (bsEC : BlockStore-EC) where
private
bs = proj₁ bsEC
eci = proj₂ bsEC
record BlockStoreInv : Set where
constructor mkBlockStoreInv
field
blockTreeValid : BlockTreeInv (bs ^∙ bsInner , eci)
open BlockStoreInv
module _ (sd : SafetyData) where
-- SafetyRules invariants
record SafetyDataInv : Set where
constructor mkSafetyDataInv
field
lvEpoch≡ : Meta.getLastVoteEpoch sd ≡ sd ^∙ sdEpoch
lvRound≤ : Meta.getLastVoteRound sd ≤ sd ^∙ sdLastVotedRound
open SafetyDataInv
subst-SafetyDataInv : ∀ {sd1 sd2}
→ sd1 ^∙ sdLastVote ≡ sd2 ^∙ sdLastVote
→ sd1 ^∙ sdEpoch ≡ sd2 ^∙ sdEpoch
→ sd1 ^∙ sdLastVotedRound ≡ sd2 ^∙ sdLastVotedRound
→ SafetyDataInv sd1 → SafetyDataInv sd2
subst-SafetyDataInv refl refl refl (mkSafetyDataInv lvEpoch≡₁ lvRound≤₁) =
mkSafetyDataInv lvEpoch≡₁ lvRound≤₁
module _ (sr : SafetyRules) where
-- SafetyRules invariants
record SafetyRulesInv : Set where
constructor mkSafetyRulesInv
field
sdInv : SafetyDataInv (sr ^∙ srPersistentStorage ∙ pssSafetyData)
open SafetyRulesInv
------------ types for and definition of RoundManagerInv
EpochsMatch : RoundManager → Set
EpochsMatch rm = rm ^∙ rmEpochState ∙ esEpoch ≡ rm ^∙ pssSafetyData-rm ∙ sdEpoch
rm→ECinfo : RoundManager → ECinfo
rm→ECinfo rm = mkECinfo (rm ^∙ rmEpochState ∙ esVerifier) (rm ^∙ rmEpoch)
rm→BlockTree-EC : RoundManager → BlockTree-EC
rm→BlockTree-EC rm = (rm ^∙ lBlockStore ∙ bsInner , rm→ECinfo rm)
rm→BlockStore-EC : RoundManager → BlockStore-EC
rm→BlockStore-EC rm = (rm ^∙ lBlockStore , rm→ECinfo rm)
-- NOTE: This will be proved by induction on reachable states using the
-- property that peer handlers preserve invariants. That is to say, many of
-- these cannot be proven as a post-condition of the peer handler: one can
-- only prove of the handler that if the invariant holds for the prestate,
-- then it holds for the poststate.
record RoundManagerInv (rm : RoundManager) : Set where
constructor mkRoundManagerInv
field
rmCorrect : ValidatorVerifier-correct (rm ^∙ rmValidatorVerifer)
rmEpochsMatch : EpochsMatch rm
rmBlockStoreInv : BlockStoreInv (rm→BlockStore-EC rm)
rmSafetyRulesInv : SafetyRulesInv (rm ^∙ lSafetyRules)
open RoundManagerInv
-- This is just the beginning of the invariant for EpochManager, collecting properties we already
-- expect to be required even though the top-level peer state is RoundManager for now (in future,
-- when we prove properties related to epoch change, the peers state will become EpochManager).
record EpochManagerInv (em : EpochManager) : Set where
constructor mkEpochManagerInv
field
-- SafetyRule properties
emiSRI : ∀ {sr} → em ^∙ emSafetyRulesManager ∙ srmInternalSafetyRules ≡ SRWLocal sr
→ SafetyRulesInv sr × sr ^∙ srPersistentStorage ∙ pssSafetyData ∙ sdLastVote ≡ nothing
open EpochManagerInv
hash≡⇒≈Block : ∀ {b1 b2 : Block}
→ BlockId-correct b1
→ BlockId-correct b2
→ BlockHash≡ b1 (b2 ^∙ bId)
→ b1 ≈Block b2
hash≡⇒≈Block {b1} {b2} refl refl hashb1≡idb2
with hashBD-inj hashb1≡idb2
...| bdInj = sameBlockData⇒≈ {b1} {b2} hashb1≡idb2 bdInj
module Reqs (b : Block) (bt : BlockTree) where
-- TODO: State and use assumptions about hash collisions. The following is one example that will
-- likely need to be refined.
NoHC1 = ∀ {eb}
→ btGetBlock (b ^∙ bId) bt ≡ just eb
→ BlockId-correct b
→ (eb ^∙ ebBlock) ≈Block b
-- TODO: probably don't need this generality, consider moving into Handle.Properties (only place
-- it is used so far), then we could streamline as rmi is required only to avoid cyclic lookups
module _ {st} (reach : ReachableSystemState st)
{pm : ProposalMsg} {sndr : NodeId} (nm∈pool : (sndr , P pm) ∈ msgPool st)
(pid : NodeId) (ini : initialised st pid ≡ initd) where
open PerReachableState reach
private
rm = peerStates st pid
bt = rm ^∙ lBlockTree
b = pm ^∙ pmProposal
nohc : RoundManagerInv rm
→ rm ^∙ lBlockTree ≡ bt
→ BlockId-correct b
→ Reqs.NoHC1 b bt
nohc rmi refl refl {eb} jeb refl
with allValidBlocks (blockTreeValid (rmBlockStoreInv rmi)) jeb
...| bidCorr , bid
with (blockData-bsl (b ^∙ bBlockData)) ≟-BSL (blockData-bsl (eb ^∙ ebBlock ∙ bBlockData))
...| yes bsls≡ = hash≡⇒≈Block {eb ^∙ ebBlock} {b} bidCorr refl bid
...| no neq rewrite sym bid
= ⊥-elim (meta-no-collision-in-sys (msgRmHC (inP nm∈pool (inPM inB))
ini
(inRM (inBS jeb inB))
(sym bid)
neq))
-- Valid blocks have IDs computed by the hash of their BlockData
-- These are passed as module parameters through the proofs
ValidBlock = Σ Block BlockId-correct
vbBlock : ValidBlock → Block
vbBlock = proj₁
vbValid : (vb : ValidBlock) → BlockId-correct (vbBlock vb)
vbValid = proj₂
------------ Preserves and related definitions and utilities
Preserves : ∀ {ℓ} {A : Set} → (P : A → Set ℓ) (pre post : A) → Set ℓ
Preserves Pred pre post = Pred pre → Pred post
PreservesL : ∀ {ℓ} {A B : Set}
→ (P : A → Set ℓ) (l : Lens A B)
→ (b₁ b₂ : B) → Set ℓ
PreservesL Pred l b₁ b₂ = ∀ a → Preserves Pred (a & l ∙~ b₁) (a & l ∙~ b₂)
reflPreserves : ∀ {ℓ} {A : Set} (P : A → Set ℓ) → Reflexive (Preserves P)
reflPreserves Pred = id
reflPreservesRoundManagerInv : Reflexive (Preserves RoundManagerInv)
reflPreservesRoundManagerInv = reflPreserves RoundManagerInv
transPreserves : ∀ {ℓ} {A : Set} (P : A → Set ℓ) → Transitive (Preserves P)
transPreserves Pred p₁ p₂ = p₂ ∘ p₁
transPreservesL : ∀ {ℓ} {A B : Set}
→ (P : A → Set ℓ) (l : Lens A B)
→ {b₁ b₂ b₃ : B}
→ PreservesL P l b₁ b₂
→ PreservesL P l b₂ b₃
→ PreservesL P l b₁ b₃
transPreservesL Pred l p₁ p₂ a = transPreserves Pred (p₁ a) (p₂ a)
transPreservesRoundManagerInv : Transitive (Preserves RoundManagerInv)
transPreservesRoundManagerInv = transPreserves RoundManagerInv
BSInv⇒BTInv-pres : ∀ {eci} {pre post : BlockStore}
→ Preserves BlockStoreInv (pre , eci) (post , eci)
→ Preserves BlockTreeInv (pre ^∙ bsInner , eci) (post ^∙ bsInner , eci)
BSInv⇒BTInv-pres presBS btiPre = BlockStoreInv.blockTreeValid (presBS $ mkBlockStoreInv btiPre)
mkPreservesSafetyRulesInv
: ∀ {pre post}
→ Preserves SafetyDataInv (pre ^∙ srPersistentStorage ∙ pssSafetyData) (post ^∙ srPersistentStorage ∙ pssSafetyData)
→ Preserves SafetyRulesInv pre post
mkPreservesSafetyRulesInv lvP (mkSafetyRulesInv lv) = mkSafetyRulesInv (lvP lv)
mkPreservesRoundManagerInv
: ∀ {pre post}
→ Preserves ValidatorVerifier-correct (pre ^∙ rmValidatorVerifer) (post ^∙ rmValidatorVerifer)
→ Preserves EpochsMatch pre post
→ Preserves BlockStoreInv (rm→BlockStore-EC pre) (rm→BlockStore-EC post)
→ Preserves SafetyRulesInv (pre ^∙ rmSafetyRules) (post ^∙ rmSafetyRules)
→ Preserves RoundManagerInv pre post
mkPreservesRoundManagerInv rmP emP bsP srP (mkRoundManagerInv rmCorrect epochsMatch bsInv srInv) =
mkRoundManagerInv (rmP rmCorrect) (emP epochsMatch) (bsP bsInv) (srP srInv)
module InitProofDefs where
open Invariants
-- RoundManager properties
_IsNormalRoundManagerOf_ : RoundManager → EpochManager → Set
_IsNormalRoundManagerOf_ rm em =
em ^∙ emProcessor ≡ just (RoundProcessorNormal rm)
IsNormalRoundManagerOf-inj :
∀ {em} {rm1} {rm2}
→ rm1 IsNormalRoundManagerOf em
→ rm2 IsNormalRoundManagerOf em
→ rm1 ≡ rm2
IsNormalRoundManagerOf-inj refl refl = refl
InitSdLV≡ : RoundManager → Maybe Vote → Set
InitSdLV≡ rm mv = rm ^∙ rmSafetyRules ∙ srPersistentStorage
∙ pssSafetyData ∙ sdLastVote ≡ mv
InitSigs∈bs : RoundManager → Set
InitSigs∈bs rm = ∀ {bsi vs qc}
→ vs ∈ qcVotes qc
→ qc QCProps.∈RoundManager rm
→ ∈BootstrapInfo-impl bsi (proj₂ vs)
-- Message properties
-- During epoch initialisation, no messages are sent
-- EXCEPT the leader of Round 1 SENDS a ProposalMsg during initialization.
-- Rust/Haskell impls do not include signatures in the genesis QC's LIWS.
-- The initial proposal for (Epoch N) (Round 1) is built on a QC with empty signatures.
InitIsInitPM' : NetworkMsg → Set
InitIsInitPM' m = ∃[ pm ] ( m ≡ P pm
× ∀ {vs qc}
→ vs ∈ qcVotes qc
→ qc QC∈NM m
→ ⊥)
InitIsInitPM : List (Action NetworkMsg) → Set
InitIsInitPM acts = ∀ {m}
→ send m ∈ acts
→ InitIsInitPM' m
record InitContractOk (mv : Maybe Vote) (rm : RoundManager) (outs : List Output) : Set where
constructor mkInitContractOk
field
rmInv : RoundManagerInv rm
sdLV≡ : InitSdLV≡ rm mv
sigs∈bs : InitSigs∈bs rm
isInitPM : InitIsInitPM (outputsToActions {State = rm} outs)
open InitContractOk
EMInitCond : Maybe Vote → EpochManager × List Output → Set
EMInitCond mv (em , outs) = ∃[ rm ] ( rm IsNormalRoundManagerOf em × InitContractOk mv rm outs )
InitContract : Maybe Vote → EitherD-Post ErrLog (EpochManager × List Output)
InitContract _ (Left x) = ⊤
InitContract mv (Right em×outs) = EMInitCond mv em×outs
module RoundManagerTransProps where
-- Relations between the pre/poststate which may or may not hold, depending on
-- the particular peer handler invoked
-- - The epoch is unchanged
NoEpochChange : (pre post : RoundManager) → Set
NoEpochChange pre post = pre ≡L post at rmEpoch
reflNoEpochChange : Reflexive NoEpochChange
reflNoEpochChange = refl
transNoEpochChange : Transitive NoEpochChange
transNoEpochChange = trans
NoSafetyDataChange : (pre post : RoundManager) → Set
NoSafetyDataChange pre post = pre ≡L post at pssSafetyData-rm
reflNoSafetyDataChange : Reflexive NoSafetyDataChange
reflNoSafetyDataChange = refl
transNoSafetyDataChange : Transitive NoSafetyDataChange
transNoSafetyDataChange = trans
-- - state changes from generating or not generating a vote
LastVoteIs : RoundManager → Vote → Set
LastVoteIs rm v = just v ≡ rm ^∙ pssSafetyData-rm ∙ sdLastVote
module _ (pre post : RoundManager) (vote : Vote) where
record VoteOldGenerated : Set where
constructor mkVoteOldGenerated
field
-- NOTE: The implementation maintains an invariant that the round
-- associated with `sdLastVote` (if the vote exists) is less than or
-- equal to the field `sdLastVotedRound`.
lvr≡ : pre ≡L post at pssSafetyData-rm ∙ sdLastVotedRound
lv≡ : pre ≡L post at pssSafetyData-rm ∙ sdLastVote
record VoteNewGenerated : Set where
constructor mkVoteNewGenerated
field
lvr< : pre [ _<_ ]L post at pssSafetyData-rm ∙ sdLastVotedRound
lvr≡ : vote ^∙ vRound ≡ post ^∙ pssSafetyData-rm ∙ sdLastVotedRound
-- NOTE: This is saying that /state changes/ associated to generating a vote
-- have occurred, not that the generated vote has been sent.
record VoteGenerated : Set where
constructor mkVoteGenerated
field
lv≡v : LastVoteIs post vote
voteSrc : VoteOldGenerated ⊎ VoteNewGenerated
isVoteNewGenerated : VoteGenerated → Bool
isVoteNewGenerated = isRight ∘ VoteGenerated.voteSrc
reflVoteOldGenerated : ∀ {v} → Reflexive (λ pre post → VoteOldGenerated pre post v)
reflVoteOldGenerated = mkVoteOldGenerated refl refl
VoteGeneratedNotSaved : (pre post : RoundManager) → Set
VoteGeneratedNotSaved pre post = ∃[ v ] VoteGenerated pre post v
module _ (pre post : RoundManager) where
-- In
-- `LibraBFT.Impl.Consensus.SafetyRules.SafetyRules.agda::contructAndSignVoteM`,
-- it is possible for us to update the field `pssSafetyData-rm ∙ sdLastVotedRound`
-- without actually returning a vote. Therefore, the most we can say after
-- returing from this function is that this field in the poststate is greater
-- than or equal to the value it started at in the prestate.
--
-- However, it is also possible to return a vote *without* updating the last
-- voted round. Many functions in `LibraBFT.Impl.Consensus.RoundManager` neither
-- return a vote nor update the last voted round, and the lemma
-- `pseudotransVoteSent` in those cases -- but is unprovable if we do not
-- distinguish the cases where the last voted round cannot be increased.
-- Therefore, it is convenient to track in the type of `NoVoteSent`, with the
-- parameter `lvr≡?`, which case we are dealing with
record VoteNotGenerated (lvr≡? : Bool) : Set where
constructor mkVoteNotGenerated
field
lv≡ : pre ≡L post at pssSafetyData-rm ∙ sdLastVote
lvr≤ : pre [ if lvr≡? then _≡_ else _<_ ]L post at pssSafetyData-rm ∙ sdLastVotedRound
reflVoteNotGenerated : Reflexive (λ pre post → VoteNotGenerated pre post true)
reflVoteNotGenerated = mkVoteNotGenerated refl refl
transVoteNotGenerated
: ∀ {s₁ s₂ s₃ lvr≡?₁ lvr≡?₂}
→ VoteNotGenerated s₁ s₂ lvr≡?₁ → VoteNotGenerated s₂ s₃ lvr≡?₂
→ VoteNotGenerated s₁ s₃ (lvr≡?₁ ∧ lvr≡?₂)
transVoteNotGenerated {lvr≡?₁ = false} {false} (mkVoteNotGenerated lv≡ lvr≤) (mkVoteNotGenerated lv≡₁ lvr≤₁) =
mkVoteNotGenerated (trans lv≡ lv≡₁) (<-trans lvr≤ lvr≤₁)
transVoteNotGenerated {lvr≡?₁ = false} {true} (mkVoteNotGenerated lv≡ lvr≤) (mkVoteNotGenerated lv≡₁ lvr≤₁) =
mkVoteNotGenerated (trans lv≡ lv≡₁) (≤-trans lvr≤ (≡⇒≤ lvr≤₁))
transVoteNotGenerated {lvr≡?₁ = true} {false} (mkVoteNotGenerated lv≡ lvr≤) (mkVoteNotGenerated lv≡₁ lvr≤₁) =
mkVoteNotGenerated (trans lv≡ lv≡₁) (≤-trans (s≤s (≡⇒≤ lvr≤)) lvr≤₁)
transVoteNotGenerated {lvr≡?₁ = true} {true} (mkVoteNotGenerated lv≡ lvr≤) (mkVoteNotGenerated lv≡₁ lvr≤₁) =
mkVoteNotGenerated (trans lv≡ lv≡₁) (trans lvr≤ lvr≤₁)
glue-VoteGenerated-VoteNotGenerated
: ∀ {s₁ s₂ s₃ v} → VoteGenerated s₁ s₂ v → VoteNotGenerated s₂ s₃ true
→ VoteGenerated s₁ s₃ v
glue-VoteGenerated-VoteNotGenerated (mkVoteGenerated lv≡v (inj₁ (mkVoteOldGenerated lvr≡₁ lv≡₁))) (mkVoteNotGenerated lv≡ lvr≤) =
mkVoteGenerated (trans lv≡v lv≡) (inj₁ (mkVoteOldGenerated (trans lvr≡₁ lvr≤) (trans lv≡₁ lv≡)))
glue-VoteGenerated-VoteNotGenerated (mkVoteGenerated lv≡v (inj₂ (mkVoteNewGenerated lvr< lvr≡))) (mkVoteNotGenerated lv≡ lvr≤) =
mkVoteGenerated ((trans lv≡v lv≡)) (inj₂ (mkVoteNewGenerated (≤-trans lvr< (≡⇒≤ lvr≤)) (trans lvr≡ lvr≤)))
glue-VoteNotGenerated-VoteGenerated
: ∀ {s₁ s₂ s₃ v} → VoteNotGenerated s₁ s₂ true → VoteGenerated s₂ s₃ v
→ VoteGenerated s₁ s₃ v
glue-VoteNotGenerated-VoteGenerated (mkVoteNotGenerated lv≡ lvr≤) (mkVoteGenerated lv≡v (inj₁ (mkVoteOldGenerated lvr≡₁ lv≡₁))) =
mkVoteGenerated lv≡v (inj₁ (mkVoteOldGenerated (trans lvr≤ lvr≡₁) (trans lv≡ lv≡₁)))
glue-VoteNotGenerated-VoteGenerated (mkVoteNotGenerated lv≡ lvr≤) (mkVoteGenerated lv≡v (inj₂ (mkVoteNewGenerated lvr<₁ lvr≡₁))) =
mkVoteGenerated lv≡v (inj₂ (mkVoteNewGenerated (≤-trans (s≤s (≡⇒≤ lvr≤)) lvr<₁) lvr≡₁))
glue-VoteNotGenerated-VoteGeneratedNotSaved
: ∀ {s₁ s₂ s₃} → VoteNotGenerated s₁ s₂ true → VoteGeneratedNotSaved s₂ s₃
→ VoteGeneratedNotSaved s₁ s₃
glue-VoteNotGenerated-VoteGeneratedNotSaved vng (v , vg) =
v , glue-VoteNotGenerated-VoteGenerated vng vg
-- Properties for voting
module Voting where
open Invariants
VoteEpochIs : (vote : Vote) (e : Epoch) → Set
VoteEpochIs vote e = vote ^∙ vEpoch ≡ e
VoteRoundIs : (vote : Vote) (r : Round) → Set
VoteRoundIs vote r = vote ^∙ vRound ≡ r
record VoteMadeFromBlock (vote : Vote) (block : Block) : Set where
constructor mkVoteMadeFromBlock
field
epoch≡ : vote ^∙ vEpoch ≡ block ^∙ bEpoch
round≡ : vote ^∙ vRound ≡ block ^∙ bRound
proposedId≡ : vote ^∙ vProposedId ≡ block ^∙ bId
VoteMadeFromBlock⇒VoteEpochRoundIs : ∀ {v b} → VoteMadeFromBlock v b → VoteEpochIs v (b ^∙ bEpoch) × VoteRoundIs v (b ^∙ bRound)
VoteMadeFromBlock⇒VoteEpochRoundIs (mkVoteMadeFromBlock epoch≡ round≡ proposedID) = epoch≡ , round≡
VoteTriggeredByBlock : (vote : Vote) (block : Block) (new? : Bool) → Set
VoteTriggeredByBlock vote block true = VoteMadeFromBlock vote block
VoteTriggeredByBlock vote block false = VoteRoundIs vote (block ^∙ bRound)
record VoteGeneratedCorrect (pre post : RoundManager) (vote : Vote) (block : Block) : Set where
constructor mkVoteGeneratedCorrect
field
state : RoundManagerTransProps.VoteGenerated pre post vote
voteNew? = RoundManagerTransProps.isVoteNewGenerated pre post vote state
field
blockTriggered : VoteTriggeredByBlock vote block voteNew?
substVoteGeneratedCorrect
: ∀ {pre post vote} (block₁ block₂ : Block) → block₁ ≈Block block₂
→ VoteGeneratedCorrect pre post vote block₁ → VoteGeneratedCorrect pre post vote block₂
substVoteGeneratedCorrect block₁ block₂ bd≡ (mkVoteGeneratedCorrect state blockTriggered)
with state
...| RoundManagerTransProps.mkVoteGenerated lv≡v voteSrc
with voteSrc
...| Left vog rewrite bd≡ =
mkVoteGeneratedCorrect (RoundManagerTransProps.mkVoteGenerated lv≡v (Left vog)) blockTriggered
...| Right vng
with blockTriggered
...| mkVoteMadeFromBlock epoch≡ round≡ proposedID rewrite bd≡
= mkVoteGeneratedCorrect
(RoundManagerTransProps.mkVoteGenerated lv≡v (Right vng))
(mkVoteMadeFromBlock epoch≡ round≡ proposedID)
record VoteGeneratedUnsavedCorrect (pre post : RoundManager) (block : Block) : Set where
constructor mkVoteGeneratedUnsavedCorrect
field
vote : Vote
voteGenCorrect : VoteGeneratedCorrect pre post vote block
glue-VoteGeneratedCorrect-VoteNotGenerated
: ∀ {s₁ s₂ s₃ vote block}
→ VoteGeneratedCorrect s₁ s₂ vote block
→ RoundManagerTransProps.VoteNotGenerated s₂ s₃ true
→ VoteGeneratedCorrect s₁ s₃ vote block
glue-VoteGeneratedCorrect-VoteNotGenerated vgc@(mkVoteGeneratedCorrect vg@(RoundManagerTransProps.mkVoteGenerated lv≡v (inj₁ oldVG)) blockTriggered) vng =
mkVoteGeneratedCorrect (RoundManagerTransProps.glue-VoteGenerated-VoteNotGenerated vg vng) blockTriggered
glue-VoteGeneratedCorrect-VoteNotGenerated vgc@(mkVoteGeneratedCorrect vg@(RoundManagerTransProps.mkVoteGenerated lv≡v (inj₂ newVG)) blockTriggered) vng =
mkVoteGeneratedCorrect (RoundManagerTransProps.glue-VoteGenerated-VoteNotGenerated vg vng) blockTriggered
glue-VoteNotGenerated-VoteGeneratedCorrect
: ∀ {s₁ s₂ s₃ vote block}
→ RoundManagerTransProps.VoteNotGenerated s₁ s₂ true
→ VoteGeneratedCorrect s₂ s₃ vote block
→ VoteGeneratedCorrect s₁ s₃ vote block
glue-VoteNotGenerated-VoteGeneratedCorrect vng (mkVoteGeneratedCorrect vg@(RoundManagerTransProps.mkVoteGenerated lv≡v (inj₁ oldVG)) blockTriggered) =
mkVoteGeneratedCorrect (RoundManagerTransProps.glue-VoteNotGenerated-VoteGenerated vng vg) blockTriggered
glue-VoteNotGenerated-VoteGeneratedCorrect vng (mkVoteGeneratedCorrect vg@(RoundManagerTransProps.mkVoteGenerated lv≡v (inj₂ newVG)) blockTriggered) =
mkVoteGeneratedCorrect (RoundManagerTransProps.glue-VoteNotGenerated-VoteGenerated vng vg)
blockTriggered
glue-VoteNotGenerated-VoteGeneratedUnsavedCorrect
: ∀ {s₁ s₂ s₃ block}
→ RoundManagerTransProps.VoteNotGenerated s₁ s₂ true
→ VoteGeneratedUnsavedCorrect s₂ s₃ block
→ VoteGeneratedUnsavedCorrect s₁ s₃ block
glue-VoteNotGenerated-VoteGeneratedUnsavedCorrect vng (mkVoteGeneratedUnsavedCorrect vote voteGenCorrect) =
mkVoteGeneratedUnsavedCorrect vote (glue-VoteNotGenerated-VoteGeneratedCorrect vng voteGenCorrect)
-- The handler correctly voted (including state updates) on `block`, assuming
-- the safety data epoch matches the block epoch.
record VoteSentCorrect (pre post : RoundManager) (outs : List Output) (block : Block) : Set where
constructor mkVoteSentCorrect
field
vm : VoteMsg
pid : Author
voteMsgOuts : OutputProps.OneVote outs vm (pid ∷ [])
vgCorrect : VoteGeneratedCorrect pre post (vm ^∙ vmVote) block
open VoteGeneratedCorrect vgCorrect
-- The handler correctly did not vote on `block`
record VoteUnsentCorrect (pre post : RoundManager) (outs : List Output) (block : Block) (lvr≡? : Bool) : Set where
constructor mkVoteUnsentCorrect
field
noVoteMsgOuts : OutputProps.NoVotes outs
nvg⊎vgusc : RoundManagerTransProps.VoteNotGenerated pre post lvr≡? ⊎ VoteGeneratedUnsavedCorrect pre post block
glue-VoteNotGenerated-VoteUnsentCorrect
: ∀ {s₁ s₂ s₃ outs₁ outs₂ block lvr≡?}
→ RoundManagerTransProps.VoteNotGenerated s₁ s₂ true → OutputProps.NoVotes outs₁
→ VoteUnsentCorrect s₂ s₃ outs₂ block lvr≡?
→ VoteUnsentCorrect s₁ s₃ (outs₁ ++ outs₂) block lvr≡?
glue-VoteNotGenerated-VoteUnsentCorrect{outs₁ = outs₁} vng₁ nvo (mkVoteUnsentCorrect noVoteMsgOuts (inj₁ vng₂)) =
mkVoteUnsentCorrect (OutputProps.++-NoVotes outs₁ _ nvo noVoteMsgOuts) (inj₁ (RoundManagerTransProps.transVoteNotGenerated vng₁ vng₂))
glue-VoteNotGenerated-VoteUnsentCorrect{outs₁ = outs₁} vng₁ nvo (mkVoteUnsentCorrect noVoteMsgOuts (inj₂ vgus)) =
mkVoteUnsentCorrect ((OutputProps.++-NoVotes outs₁ _ nvo noVoteMsgOuts)) (inj₂ (glue-VoteNotGenerated-VoteGeneratedUnsavedCorrect vng₁ vgus))
-- The handler correctly attempted to vote on `block`, assuming the safety
-- data epoch matches the block epoch.
VoteAttemptCorrect : (pre post : RoundManager) (outs : List Output) (block : Block) → Set
VoteAttemptCorrect pre post outs block =
(∃[ lvr≡? ] VoteUnsentCorrect pre post outs block lvr≡?) ⊎ VoteSentCorrect pre post outs block
-- The voting process ended before `pssSafetyData-rm` could be updated
voteAttemptBailed : ∀ {rm block} outs → OutputProps.NoVotes outs → VoteAttemptCorrect rm rm outs block
voteAttemptBailed outs noVotesOuts = inj₁ (true , mkVoteUnsentCorrect noVotesOuts (inj₁ RoundManagerTransProps.reflVoteNotGenerated))
glue-VoteNotGenerated-VoteAttemptCorrect
: ∀ {s₁ s₂ s₃ outs₁ outs₂ block}
→ RoundManagerTransProps.VoteNotGenerated s₁ s₂ true → OutputProps.NoVotes outs₁
→ VoteAttemptCorrect s₂ s₃ outs₂ block
→ VoteAttemptCorrect s₁ s₃ (outs₁ ++ outs₂) block
glue-VoteNotGenerated-VoteAttemptCorrect{outs₁ = outs₁} vng nvo (inj₁ (lvr≡? , vusCorrect)) =
inj₁ (lvr≡? , glue-VoteNotGenerated-VoteUnsentCorrect{outs₁ = outs₁} vng nvo vusCorrect)
glue-VoteNotGenerated-VoteAttemptCorrect{outs₁ = outs₁} vng nvo (inj₂ (mkVoteSentCorrect vm pid voteMsgOuts vgCorrect)) =
inj₂ (mkVoteSentCorrect vm pid (OutputProps.++-NoVotes-OneVote outs₁ _ nvo voteMsgOuts) (glue-VoteNotGenerated-VoteGeneratedCorrect vng vgCorrect))
VoteAttemptEpochReq : ∀ {pre post outs block} → VoteAttemptCorrect pre post outs block → Set
VoteAttemptEpochReq (inj₁ (_ , mkVoteUnsentCorrect _ (inj₁ _))) =
⊤
VoteAttemptEpochReq{pre}{block = block} (inj₁ (_ , mkVoteUnsentCorrect _ (inj₂ _))) =
pre ^∙ pssSafetyData-rm ∙ sdEpoch ≡ (block ^∙ bEpoch)
VoteAttemptEpochReq{pre}{block = block} (inj₂ _) =
pre ^∙ pssSafetyData-rm ∙ sdEpoch ≡ (block ^∙ bEpoch)
voteAttemptEpochReq!
: ∀ {pre post outs block} → (vac : VoteAttemptCorrect pre post outs block)
→ pre ^∙ pssSafetyData-rm ∙ sdEpoch ≡ block ^∙ bEpoch → VoteAttemptEpochReq vac
voteAttemptEpochReq! (inj₁ (_ , mkVoteUnsentCorrect _ (inj₁ _))) eq = tt
voteAttemptEpochReq! (inj₁ (_ , mkVoteUnsentCorrect _ (inj₂ _))) eq = eq
voteAttemptEpochReq! (inj₂ _) eq = eq
record VoteAttemptCorrectWithEpochReq (pre post : RoundManager) (outs : List Output) (block : Block) : Set where
constructor mkVoteAttemptCorrectWithEpochReq
field
voteAttempt : VoteAttemptCorrect pre post outs block
sdEpoch≡? : VoteAttemptEpochReq voteAttempt
voteAttemptCorrectAndSent⇒voteSentCorrect : ∀ {pre post outs block vm}
→ send (V vm) ∈ outputsToActions{pre} outs
→ VoteAttemptCorrectWithEpochReq pre post outs block
→ VoteSentCorrect pre post outs block
voteAttemptCorrectAndSent⇒voteSentCorrect{pre}{outs = outs} vm∈outs (mkVoteAttemptCorrectWithEpochReq (Left (_ , mkVoteUnsentCorrect noVoteMsgOuts _)) _) =
⊥-elim (sendVote∉actions{outs}{st = pre} (sym noVoteMsgOuts) vm∈outs)
voteAttemptCorrectAndSent⇒voteSentCorrect{pre}{outs = outs}{vm = vm} vm∈outs (mkVoteAttemptCorrectWithEpochReq (Right vsc) _) = vsc
|
test/Succeed/Issue203.agda | shlevy/agda | 1,989 | 4473 | <filename>test/Succeed/Issue203.agda
{-# OPTIONS --allow-unsolved-metas #-}
module Issue203 where
open import Common.Level
-- Should work but give unsolved metas (type of b)
data ↓ {a b} (A : Set a) : Set a where
[_] : (x : A) → ↓ A
mutual -- avoid freezing
-- Shouldn't instantiate the level of Σ to a
data Σ {a b} (A : Set a) (B : A → Set b) : Set _ where
_,_ : (x : A) (y : B x) → Σ A B
instantiateToMax : ∀ {a b}(A : Set a)(B : A → Set b) → Set (a ⊔ b)
instantiateToMax = Σ
|
oeis/099/A099909.asm | neoneye/loda-programs | 11 | 29553 | ; A099909: (prime(n)*(prime(n+1)-1) + (prime(n)-1)*prime(n+1)) / 2.
; Submitted by <NAME>
; 11,29,68,131,206,305,416,641,869,1113,1478,1721,1976,2441,3071,3539,4023,4688,5111,5691,6476,7301,8540,9698,10301,10916,11555,12206,14231,16508,17813,18905,20567,22349,23553,25431,27056,28721,30791,32219,34385,36671,37826,39005,41784,46836,50396,51755,53126,55451,57359,60245,64253,67331,70481,72629,74793,77558,79241,82631,89651,95168,97031,98906,104603,111213,116597,120755,122846,126371,131390,136521,140991,144776,148601,154040,158798,163604,170957,175979,181025,186191,189651,194036,198461
add $0,1
seq $0,40 ; The prime numbers.
seq $0,13636 ; n*nextprime(n).
mov $1,$0
mul $0,2
seq $1,3415 ; a(n) = n' = arithmetic derivative of n: a(0) = a(1) = 0, a(prime) = 1, a(mn) = m*a(n) + n*a(m).
sub $0,$1
div $0,2
|
array/MaxInArray.asm | gmarciani/assimply | 1 | 163665 | # @Name: MaxInArray
# @Description: The program computes (recursively) the maximum in an array A of size 10.
#
# @Author: <NAME> <<EMAIL>>
.data
msg_welcome: .asciiz "Il programma determina ricorsivamente l'elemento massimo di un array 10-dimensionale.\n\n"
msg_result: .asciiz "\nElemento maggiore: "
A: .word 2,4,6,8,10,3,6,9,12,15
dimensione_array: .word 10
.text
.globl main
### MAIN ###
main:
la $a0,msg_welcome #carica l'indirizzo di msg_welcome.
addi $v0,$zero,4 #codice servizio print string.
syscall
la $a0,dimensione_array #carica l'indirizzo di dimensione_array.
lw $s0,0($a0) #$s0=dimensione_array=n.
la $s1,A #$s0=(A), cioè indirizzo di base di A.
addi $a0,$s0,0 #$a0=n.
addi $a1,$s1,0 #$a1=(A+0).
jal max_array
nop
result:
addi $t0,$v1,0 #$t0=$v1=risultato max_array.
la $a0,msg_result #carica l'indirizzo di msg_result.
addi $v0,$zero,4 #codice servizio print string.
syscall
addi $a0,$t0,0 #$a0=$t0=risultato max_array.
addi $v0,$zero,1 #codice servizio print int.
syscall
exit_program:
addi $v0,$zero,10 #codice servizio exit.
syscall
### FINE MAIN ###
### FUNZIONE int max_array(int n, int *A): $a0=n, $a1=(A+0), $v1=max_array(n,A). ###
max_array:
subu $sp,$sp,20 #alloca uno stack frame da 20 byte. 1 locazione per $ra, 1 locazione per $a0=n, 1 locazione per $a1=(A+0), 1 locazione per il risultato di max_array(A+1, n-1), 1 locazione per il risultato di max(A[0],max_array(A+1, n-1)).
sw $ra,0($sp) #carica nello stack frame l'indirizzo di ritorno.
sw $a0,4($sp) #carica nello stack frame n.
sw $a1,8($sp) #carica nello stack frame (A+0).
addi $t2,$zero,1 #$t2=1.
beq $a0,$t2,caso_1_elemento #salta a caso_1_elemento sse n=1. Base della ricorsione: max_array(1,(A+0))=*(A+0).
nop
subu $a0,$a0,1 #$a0=($a0-1)=(n-1), argomento per max_array((n-1),(A+1)).
addi $a1,$a1,4 #$a1=($a1+4)=(A+1), argomento per max_array((n-1),(A+1)).. Nota: ricorda l'indirizzamento al byte.
jal max_array #chiama max_array((n-1),(A+1)).
nop
sw $v1,12($sp) #carica nello stack frame il valore massimo del sottoarray.
lw $t4,8($sp) #$t4=(A+0).
lw $t0,0($t4) #t0=*(A+0), argomento per max(*(A+0),max_array((n-1),(A+1))).
lw $t1,12($sp) #t1=max_array((n-1),(A+1)), argomento per max(*(A+0),max_array((n-1),(A+1))).
jal funzione_max #chiama max(*(A+0),max_array((n-1),(A+1))).
nop
sw $v0,16($sp) #carica nello stack il valore massimo nell'array, calcolato dalla funzione max(n,(A+0)).
lw $ra,0($sp) #carica l'indirizzo di ritorno.
addi $sp,$sp,20 #dealloca lo stack frame.
addi $v1,$v0,0 #$v1=$v0
jr $ra
caso_1_elemento:
lw $t4,8($sp) #$t4=(A+0).
lw $v1,0($t4) #$v1=*(A+0). Base della ricorsione: max_array(1,(A+0))=*(A+0).
lw $ra,0($sp) #carica dallo stack frame l'indirizzo di ritorno.
addi $sp,$sp,20 #dealloca lo stack frame di max_array(n,(A+0)).
jr $ra
### FINE FUNZIONE max_array(n,(A+0)) ###
######################################################################################
######################################################################################
## Progetto: MaxInArray Ricorsivo ##
## Linguaggio: Assembler MIPS ##
## Data: febbraio 2012 ##
## ##
## Descrizione: Il programma determina ricorsivamente l'elemento massimo ##
## in un'array 10-dimensionale allocato del data segment. ##
## ##
## Autore: <NAME> ##
## ##
## Blog: giacomomarciani.wordpress.com ##
## Mail: <EMAIL> ##
######################################################################################
######################################################################################
### FUNZIONE int max(int x, int y): $t0=x, $t1=y, $v0=max(x,y). ###
funzione_max:
subu $sp,$sp,12 #alloca uno stack frame per funzione_max da 12 byte. 1 locazione per $ra, 1 locazione per $t0=x, 1 locazione per $t1=y.
sw $ra,0($sp) #carica nello stack frame l'indirizzo di ritorno.
sw $t0,4($sp) #carica nello stack frame l'argomento $t0=x.
sw $t1,8($sp) #carica nello stack frame l'argomento $t1=y.
slt $t3,$t0,$t1 #$t3=1 iff x<y.
beq $t3,$zero,max_x #salta a max_x sse x>y.
max_y:
addi $v0,$t1,0 #$v0=risultato funzione_max=y.
lw $ra,0($sp) #carica dallo stack frame di funzione_max l'indirizzo di ritorno.
addi $sp,$sp,12 #dealloca lo stack frame di funzione_max.
jr $ra
max_x:
addi $v0,$t0,0 #$v0=risultato funzione_max=x.
lw $ra,0($sp) #carica dallo stack frame di funzione_max l'indirizzo di ritorno.
addi $sp,$sp,12 #dealloca lo stack frame di funzione_max.
jr $ra
### FINE FUNZIONE int max(int x, int y) ###
|
examples/Termination/Ord.agda | shlevy/agda | 1,989 | 1131 | <reponame>shlevy/agda
module Ord where
data Nat : Set where
Z : Nat
S : Nat -> Nat
data Ord : Set where
z : Ord
lim : (Nat -> Ord) -> Ord
zp : Ord -> Ord
zp z = z
zp (lim f) = lim (\x -> zp (f x))
|
utils/outputbuffer.asm | peter-mount/departures8bit | 0 | 16702 | <gh_stars>0
; **********************************************************************
; Output buffer
; **********************************************************************
; outputReset - reset output buffer
;
; on exit:
; A undefined
; X preserved
; Y current buffer size
.outputReset
LDA #0 ; Set length to 0
STA outputLength
STA outputBuffer ; Terminate buffer
RTS
; outputTerminate Terminate output with 0
;
; on exit:
; A undefined
; X preserved
; Y current buffer size
.outputTerminate
LDA #0
LDY outputLength
STA outputBuffer,Y
RTS
; outputAppendHexChar Append A to buffer in hex
;
; on entry:
; A value to append
;
; on exit:
; A preserved
; X preserved
; Y preserved
; tempA value of A
.outputAppendHexChar
{
STA tempA
PHAXY
LDA tempA
LSR A
LSR A
LSR A
LSR A
JSR appendHex
LDA tempA
JSR appendHex
PLAXY
RTS
.lookup EQUS "0123456789ABCDEF"
.appendHex
AND #&0F ; mask lower nibble
TAY
LDA lookup,Y ; A from lookup table, run through to outputAppend
}
; outputAppend Append a to outputBuffer
;
; on entry:
; A byte to append
;
; on exit:
; A preserved
; X preserved
; Y current buffer size
.outputAppend
LDY outputLength
STA outputBuffer,Y
INY
STY outputLength
RTS
; outputAppendString - Append string to output
;
; on entry:
; X,Y Address of string to append
;
; on exit:
; A undefined
; X undefined
; Y undefined
.outputAppendString
{
STX stringPointer ; Store string address
STY stringPointer+1
LDY #0 ; start at string start
LDX outputLength ; append index
.loop
LDA (stringPointer),Y ; Read until 0
STA outputBuffer,X ; Store in buffer
BEQ end ; Finish when at end
INY ; next src index
BEQ end
INX ; next dest index
BNE loop ; looop until buffer end
.end
STX outputLength ; store new length
RTS
}
|
RecursiveTypes/Syntax/UnfoldedOrFixpoint.agda | nad/codata | 1 | 14697 | ------------------------------------------------------------------------
-- A view of the syntax
------------------------------------------------------------------------
module RecursiveTypes.Syntax.UnfoldedOrFixpoint where
open import RecursiveTypes.Syntax
open import RecursiveTypes.Substitution
-- Unfolded types, i.e. types where the outermost construction is
-- not a fixpoint.
infixr 10 _⟶_
data Unfolded {n} : Ty n → Set where
⊥ : Unfolded ⊥
⊤ : Unfolded ⊤
var : ∀ x → Unfolded (var x)
_⟶_ : (τ₁ τ₂ : Ty n) → Unfolded (τ₁ ⟶ τ₂)
-- A view of types as either unfolded (U) or fixpoints (Μ).
data U∨Μ {n} : Ty n → Set where
unfolded : ∀ {σ} (u : Unfolded σ) → U∨Μ σ
fixpoint : ∀ {τ₁ τ₂} (u : U∨Μ unfold[μ τ₁ ⟶ τ₂ ]) → U∨Μ (μ τ₁ ⟶ τ₂)
u∨μ : ∀ {n} (σ : Ty n) → U∨Μ σ
u∨μ ⊥ = unfolded ⊥
u∨μ ⊤ = unfolded ⊤
u∨μ (var x) = unfolded (var x)
u∨μ (τ₁ ⟶ τ₂) = unfolded (τ₁ ⟶ τ₂)
u∨μ (μ τ₁ ⟶ τ₂) =
fixpoint (unfolded ((τ₁ [0≔ μ τ₁ ⟶ τ₂ ]) ⟶ (τ₂ [0≔ μ τ₁ ⟶ τ₂ ])))
u∨μ⁻¹ : ∀ {n} {σ : Ty n} → U∨Μ σ → Ty n
u∨μ⁻¹ {σ = σ} _ = σ
|
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/日本_Ver3/asm/zel_rmdt19.asm | prismotizm/gigaleak | 0 | 173460 | <filename>other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/日本_Ver3/asm/zel_rmdt19.asm
Name: zel_rmdt19.asm
Type: file
Size: 64599
Last-Modified: '2016-05-13T04:36:32Z'
SHA-1: F97B65D081A462754186D025E999DB7418759049
Description: null
|
source/web/servlet/http/servlet-http_responses.ads | reznikmm/matreshka | 24 | 27273 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014-2019, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.Calendars;
with League.Holders;
with League.IRIs;
with League.Strings;
with League.String_Vectors;
with Servlet.HTTP_Cookies;
with Servlet.Responses;
package Servlet.HTTP_Responses is
pragma Preelaborate;
type Status_Code is
(Continue,
-- Status code (100) indicating the client can continue.
Switching_Protocols,
-- Status code (101) indicating the server is switching protocols
-- according to Upgrade header.
OK,
-- Status code (200) indicating the request succeeded normally.
Created,
-- Status code (201) indicating the request succeeded and created a new
-- resource on the server.
Accepted,
-- Status code (202) indicating that a request was accepted for
-- processing, but was not completed.
Non_Authoritative_Information,
-- Status code (203) indicating that the meta information presented by
-- the client did not originate from the server.
No_Content,
-- Status code (204) indicating that the request succeeded but that there
-- was no new information to return.
Reset_Content,
-- Status code (205) indicating that the agent SHOULD reset the document
-- view which caused the request to be sent.
Partial_Content,
-- Status code (206) indicating that the server has fulfilled the partial
-- GET request for the resource.
Multiple_Choices,
-- Status code (300) indicating that the requested resource corresponds
-- to any one of a set of representations, each with its own specific
-- location.
Moved_Permanently,
-- Status code (301) indicating that the resource has permanently moved
-- to a new location, and that future references should use a new URI
-- with their requests.
Moved_Temporarily,
-- Status code (302) indicating that the resource has temporarily moved
-- to another location, but that future references should still use the
-- original URI to access the resource.
Found,
-- Status code (302) indicating that the resource reside temporarily
-- under a different URI.
See_Other,
-- Status code (303) indicating that the response to the request can be
-- found under a different URI.
Not_Modified,
-- Status code (304) indicating that a conditional GET operation found
-- that the resource was available and not modified.
Use_Proxy,
-- Status code (305) indicating that the requested resource MUST be
-- accessed through the proxy given by the Location field.
Temporary_Redirect,
-- Status code (307) indicating that the requested resource resides
-- temporarily under a different URI.
Bad_Request,
-- Status code (400) indicating the request sent by the client was
-- syntactically incorrect.
Unauthorized,
-- Status code (401) indicating that the request requires HTTP
-- authentication.
Payment_Required,
-- Status code (402) reserved for future use.
Forbidden,
-- Status code (403) indicating the server understood the request but
-- refused to fulfill it.
Not_Found,
-- Status code (404) indicating that the requested resource is not
-- available.
Method_Not_Allowed,
-- Status code (405) indicating that the method specified in the
-- Request-Line is not allowed for the resource identified by the
-- Request-URI.
Not_Acceptable,
-- Status code (406) indicating that the resource identified by the
-- request is only capable of generating response entities which have
-- content characteristics not acceptable according to the accept headers
-- sent in the request.
Proxy_Authentication_Required,
-- Status code (407) indicating that the client MUST first authenticate
-- itself with the proxy.
Request_Timeout,
-- Status code (408) indicating that the client did not produce a request
-- within the time that the server was prepared to wait.
Conflict,
-- Status code (409) indicating that the request could not be completed
-- due to a conflict with the current state of the resource.
Gone,
-- Status code (410) indicating that the resource is no longer available
-- at the server and no forwarding address is known.
Length_Required,
-- Status code (411) indicating that the request cannot be handled
-- without a defined Content-Length.
Precondition_Failed,
-- Status code (412) indicating that the precondition given in one or
-- more of the request-header fields evaluated to false when it was
-- tested on the server.
Request_Entity_Too_Large,
-- Status code (413) indicating that the server is refusing to process
-- the request because the request entity is larger than the server is
-- willing or able to process.
Request_URI_Too_Long,
-- Status code (414) indicating that the server is refusing to service
-- the request because the Request-URI is longer than the server is
-- willing to interpret.
Unsupported_Media_Type,
-- Status code (415) indicating that the server is refusing to service
-- the request because the entity of the request is in a format not
-- supported by the requested resource for the requested method.
Requested_Range_Not_Satisfiable,
-- Status code (416) indicating that the server cannot serve the
-- requested byte range.
Expectation_Failed,
-- Status code (417) indicating that the server could not meet the
-- expectation given in the Expect request header.
Internal_Server_Error,
-- Status code (500) indicating an error inside the HTTP server which
-- prevented it from fulfilling the request.
Not_Implemented,
-- Status code (501) indicating the HTTP server does not support the
-- functionality needed to fulfill the request.
Bad_Gateway,
-- Status code (502) indicating that the HTTP server received an invalid
-- response from a server it consulted when acting as a proxy or gateway.
Service_Unavailable,
-- Status code (503) indicating that the HTTP server is temporarily
-- overloaded, and unable to handle the request.
Gateway_Timeout,
-- Status code (504) indicating that the server did not receive a timely
-- response from the upstream server while acting as a gateway or proxy.
HTTP_Version_Not_Supported);
-- Status code (505) indicating that the server does not support or
-- refuses to support the HTTP protocol version that was used in the
-- request message.
type HTTP_Servlet_Response is limited interface
and Servlet.Responses.Servlet_Response;
not overriding procedure Add_Cookie
(Self : in out HTTP_Servlet_Response;
Cookie : Servlet.HTTP_Cookies.Cookie) is abstract;
-- Adds the specified cookie to the response. This method can be called
-- multiple times to set more than one cookie.
not overriding procedure Add_Date_Header
(Self : in out HTTP_Servlet_Response;
Name : League.Strings.Universal_String;
Value : League.Calendars.Date_Time) is abstract;
-- Adds a response header with the given name and date-value. This method
-- allows response headers to have multiple values.
not overriding procedure Add_Header
(Self : in out HTTP_Servlet_Response;
Name : League.Strings.Universal_String;
Value : League.Strings.Universal_String) is abstract;
-- Adds a response header with the given name and value. This method allows
-- response headers to have multiple values.
not overriding procedure Add_Integer_Header
(Self : in out HTTP_Servlet_Response;
Name : League.Strings.Universal_String;
Value : League.Holders.Universal_Integer) is abstract;
-- Adds a response header with the given name and integer value. This
-- method allows response headers to have multiple values.
not overriding function Contains_Header
(Self : in out HTTP_Servlet_Response;
Name : League.Strings.Universal_String) return Boolean is abstract;
-- Returns a boolean indicating whether the named response header has
-- already been set.
function Get_Header
(Self : in out HTTP_Servlet_Response'Class;
Name : League.Strings.Universal_String)
return League.Strings.Universal_String;
-- Return the value for the specified header, or empty string if this
-- header has not been set. If more than one value was added for this name,
-- only the first is returned; use Get_Headers to retrieve all of them.
not overriding function Get_Header_Names
(Self : in out HTTP_Servlet_Response)
return League.String_Vectors.Universal_String_Vector is abstract;
-- Return all the header names set for this response.
not overriding function Get_Headers
(Self : in out HTTP_Servlet_Response;
Name : League.Strings.Universal_String)
return League.String_Vectors.Universal_String_Vector is abstract;
-- Return all the header values associated with the specified header name.
not overriding function Get_Status
(Self : HTTP_Servlet_Response) return Status_Code is abstract;
-- Gets the current status code of this response.
procedure Send_Error
(Self : in out HTTP_Servlet_Response'Class;
Code : Status_Code);
-- Sends an error response to the client using the specified status code
-- and clears the buffer. The server will preserve cookies and may clear or
-- update any headers needed to serve the error page as a valid response.
-- If an error-page declaration has been made for the web application
-- corresponding to the status code passed in, it will be served back the
-- error page.
--
-- If the response has already been committed, this subprogram raise an
-- Program_Error exception. After using this method, the response should be
-- considered to be committed and should not be written to.
not overriding procedure Send_Error
(Self : in out HTTP_Servlet_Response;
Code : Status_Code;
Message : League.Strings.Universal_String) is abstract;
-- Sends an error response to the client using the specified status and
-- clears the buffer. The server defaults to creating the response to look
-- like an HTML-formatted server error page containing the specified
-- message, setting the content type to "text/html". The server will
-- preserve cookies and may clear or update any headers needed to serve the
-- error page as a valid response. If an error-page declaration has been
-- made for the web application corresponding to the status code passed in,
-- it will be served back in preference to the suggested msg parameter and
-- the msg parameter will be ignored.
--
-- If the response has already been committed, this method throws an
-- Program_Error. After using this method, the response should be
-- considered to be committed and should not be written to.
not overriding procedure Send_Redirect
(Self : in out HTTP_Servlet_Response;
Location : League.IRIs.IRI) is abstract;
-- Sends a temporary redirect response to the client using the specified
-- redirect location URL and clears the buffer. The buffer will be replaced
-- with the data set by this method. Calling this method sets the status
-- code to SC_FOUND 302 (Found). This method can accept relative URLs;the
-- servlet container must convert the relative URL to an absolute URL
-- before sending the response to the client. If the location is relative
-- without a leading '/' the container interprets it as relative to the
-- current request URI. If the location is relative with a leading '/' the
-- container interprets it as relative to the servlet container root. If
-- the location is relative with two leading '/' the container interprets
-- it as a network-path reference (see RFC 3986: Uniform Resource
-- Identifier (URI): Generic Syntax, section 4.2 "Relative Reference").
--
-- If the response has already been committed, this method throws an
-- IllegalStateException. After using this method, the response should be
-- considered to be committed and should not be written to.
not overriding procedure Set_Date_Header
(Self : in out HTTP_Servlet_Response;
Name : League.Strings.Universal_String;
Value : League.Calendars.Date_Time) is abstract;
-- Sets a response header with the given name and date-value. If the header
-- had already been set, the new value overwrites the previous one. The
-- Contains_Header method can be used to test for the presence of a header
-- before setting its value.
not overriding procedure Set_Header
(Self : in out HTTP_Servlet_Response;
Name : League.Strings.Universal_String;
Value : League.Strings.Universal_String) is abstract;
-- Sets a response header with the given name and value. If the header had
-- already been set, the new value overwrites the previous one. The
-- Contains_Header method can be used to test for the presence of a header
-- before setting its value.
not overriding procedure Set_Integer_Header
(Self : in out HTTP_Servlet_Response;
Name : League.Strings.Universal_String;
Value : League.Holders.Universal_Integer) is abstract;
-- Sets a response header with the given name and integer value. If the
-- header had already been set, the new value overwrites the previous one.
-- The Contains_Header method can be used to test for the presence of a
-- header before setting its value.
not overriding procedure Set_Status
(Self : in out HTTP_Servlet_Response;
Code : Status_Code) is abstract;
-- Sets the status code for this response.
end Servlet.HTTP_Responses;
|
src/Categories/Functor/Construction/Zero.agda | Trebor-Huang/agda-categories | 279 | 14125 | <filename>src/Categories/Functor/Construction/Zero.agda
{-# OPTIONS --without-K --safe #-}
module Categories.Functor.Construction.Zero where
-- The Zero functor maps everything to the initial object of a
-- category (when it exists). Note quite const.
open import Level
open import Categories.Category
open import Categories.Functor using (Functor)
open import Categories.Object.Initial
private
variable
o ℓ e : Level
C D : Category o ℓ e
Zero : Initial D → Functor C D
Zero {D = D} init = record
{ F₀ = λ _ → ⊥
; F₁ = λ _ → id
; identity = Equiv.refl
; homomorphism = Equiv.sym identity²
; F-resp-≈ = λ _ → Equiv.refl
}
where
open Initial init
open Category D
|
assembler/test.asm | jbchouinard/eight | 2 | 103374 | ; Multiply a 16 bit int by an 8 bit int
begin: lod a,[result + 1]
add a,[num1 + 1] ; Add low-order byte
sto [result + 1],a
lod a,[result]
adc a,[num1] ; Add high-order byte
sto [result],a
lod a,[num2 + 1]
sub a, one ; Decrement second number
sto [num2 + 1]
jnz begin
hlt
one: 01h
num1: 00h, a7h
num2: 00h, 1ch ; first byte must be zero
result: 00h, 00h
|
oeis/214/A214282.asm | neoneye/loda-programs | 11 | 26634 | ; A214282: Largest Euler characteristic of a downset on an n-dimensional cube.
; 1,1,1,3,6,10,15,35,70,126,210,462,924,1716,3003,6435,12870,24310,43758,92378,184756,352716,646646,1352078,2704156,5200300,9657700,20058300,40116600,77558760,145422675,300540195,601080390,1166803110,2203961430,4537567650,9075135300,17672631900,33578000610,68923264410,137846528820,269128937220,513791607420,1052049481860,2104098963720,4116715363800,7890371113950,16123801841550,32247603683100,63205303218876,121548660036300,247959266474052,495918532948104,973469712824056,1877405874732108
mov $1,$0
div $1,2
mov $2,$1
mod $1,2
add $1,$2
bin $0,$1
|
gcc-gcc-7_3_0-release/gcc/ada/exp_util.adb | best08618/asylo | 7 | 11008 | <reponame>best08618/asylo
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E X P _ U T I L --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Aspects; use Aspects;
with Atree; use Atree;
with Casing; use Casing;
with Checks; use Checks;
with Debug; use Debug;
with Einfo; use Einfo;
with Elists; use Elists;
with Errout; use Errout;
with Exp_Aggr; use Exp_Aggr;
with Exp_Ch6; use Exp_Ch6;
with Exp_Ch7; use Exp_Ch7;
with Exp_Ch11; use Exp_Ch11;
with Ghost; use Ghost;
with Inline; use Inline;
with Itypes; use Itypes;
with Lib; use Lib;
with Nlists; use Nlists;
with Nmake; use Nmake;
with Opt; use Opt;
with Restrict; use Restrict;
with Rident; use Rident;
with Sem; use Sem;
with Sem_Aux; use Sem_Aux;
with Sem_Ch3; use Sem_Ch3;
with Sem_Ch6; use Sem_Ch6;
with Sem_Ch8; use Sem_Ch8;
with Sem_Ch12; use Sem_Ch12;
with Sem_Ch13; use Sem_Ch13;
with Sem_Disp; use Sem_Disp;
with Sem_Eval; use Sem_Eval;
with Sem_Res; use Sem_Res;
with Sem_Type; use Sem_Type;
with Sem_Util; use Sem_Util;
with Snames; use Snames;
with Stand; use Stand;
with Stringt; use Stringt;
with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Ttypes; use Ttypes;
with Urealp; use Urealp;
with Validsw; use Validsw;
with GNAT.HTable; use GNAT.HTable;
package body Exp_Util is
---------------------------------------------------------
-- Handling of inherited class-wide pre/postconditions --
---------------------------------------------------------
-- Following AI12-0113, the expression for a class-wide condition is
-- transformed for a subprogram that inherits it, by replacing calls
-- to primitive operations of the original controlling type into the
-- corresponding overriding operations of the derived type. The following
-- hash table manages this mapping, and is expanded on demand whenever
-- such inherited expression needs to be constructed.
-- The mapping is also used to check whether an inherited operation has
-- a condition that depends on overridden operations. For such an
-- operation we must create a wrapper that is then treated as a normal
-- overriding. In SPARK mode such operations are illegal.
-- For a given root type there may be several type extensions with their
-- own overriding operations, so at various times a given operation of
-- the root will be mapped into different overridings. The root type is
-- also mapped into the current type extension to indicate that its
-- operations are mapped into the overriding operations of that current
-- type extension.
Primitives_Mapping_Size : constant := 511;
subtype Num_Primitives is Integer range 0 .. Primitives_Mapping_Size - 1;
function Entity_Hash (E : Entity_Id) return Num_Primitives;
package Primitives_Mapping is new GNAT.HTable.Simple_HTable
(Header_Num => Num_Primitives,
Key => Entity_Id,
Element => Entity_Id,
No_element => Empty,
Hash => Entity_Hash,
Equal => "=");
-----------------------
-- Local Subprograms --
-----------------------
function Build_Task_Array_Image
(Loc : Source_Ptr;
Id_Ref : Node_Id;
A_Type : Entity_Id;
Dyn : Boolean := False) return Node_Id;
-- Build function to generate the image string for a task that is an array
-- component, concatenating the images of each index. To avoid storage
-- leaks, the string is built with successive slice assignments. The flag
-- Dyn indicates whether this is called for the initialization procedure of
-- an array of tasks, or for the name of a dynamically created task that is
-- assigned to an indexed component.
function Build_Task_Image_Function
(Loc : Source_Ptr;
Decls : List_Id;
Stats : List_Id;
Res : Entity_Id) return Node_Id;
-- Common processing for Task_Array_Image and Task_Record_Image. Build
-- function body that computes image.
procedure Build_Task_Image_Prefix
(Loc : Source_Ptr;
Len : out Entity_Id;
Res : out Entity_Id;
Pos : out Entity_Id;
Prefix : Entity_Id;
Sum : Node_Id;
Decls : List_Id;
Stats : List_Id);
-- Common processing for Task_Array_Image and Task_Record_Image. Create
-- local variables and assign prefix of name to result string.
function Build_Task_Record_Image
(Loc : Source_Ptr;
Id_Ref : Node_Id;
Dyn : Boolean := False) return Node_Id;
-- Build function to generate the image string for a task that is a record
-- component. Concatenate name of variable with that of selector. The flag
-- Dyn indicates whether this is called for the initialization procedure of
-- record with task components, or for a dynamically created task that is
-- assigned to a selected component.
procedure Evaluate_Slice_Bounds (Slice : Node_Id);
-- Force evaluation of bounds of a slice, which may be given by a range
-- or by a subtype indication with or without a constraint.
function Find_DIC_Type (Typ : Entity_Id) return Entity_Id;
-- Subsidiary to all Build_DIC_Procedure_xxx routines. Find the type which
-- defines the Default_Initial_Condition pragma of type Typ. This is either
-- Typ itself or a parent type when the pragma is inherited.
function Make_CW_Equivalent_Type
(T : Entity_Id;
E : Node_Id) return Entity_Id;
-- T is a class-wide type entity, E is the initial expression node that
-- constrains T in case such as: " X: T := E" or "new T'(E)". This function
-- returns the entity of the Equivalent type and inserts on the fly the
-- necessary declaration such as:
--
-- type anon is record
-- _parent : Root_Type (T); constrained with E discriminants (if any)
-- Extension : String (1 .. expr to match size of E);
-- end record;
--
-- This record is compatible with any object of the class of T thanks to
-- the first field and has the same size as E thanks to the second.
function Make_Literal_Range
(Loc : Source_Ptr;
Literal_Typ : Entity_Id) return Node_Id;
-- Produce a Range node whose bounds are:
-- Low_Bound (Literal_Type) ..
-- Low_Bound (Literal_Type) + (Length (Literal_Typ) - 1)
-- this is used for expanding declarations like X : String := "sdfgdfg";
--
-- If the index type of the target array is not integer, we generate:
-- Low_Bound (Literal_Type) ..
-- Literal_Type'Val
-- (Literal_Type'Pos (Low_Bound (Literal_Type))
-- + (Length (Literal_Typ) -1))
function Make_Non_Empty_Check
(Loc : Source_Ptr;
N : Node_Id) return Node_Id;
-- Produce a boolean expression checking that the unidimensional array
-- node N is not empty.
function New_Class_Wide_Subtype
(CW_Typ : Entity_Id;
N : Node_Id) return Entity_Id;
-- Create an implicit subtype of CW_Typ attached to node N
function Requires_Cleanup_Actions
(L : List_Id;
Lib_Level : Boolean;
Nested_Constructs : Boolean) return Boolean;
-- Given a list L, determine whether it contains one of the following:
--
-- 1) controlled objects
-- 2) library-level tagged types
--
-- Lib_Level is True when the list comes from a construct at the library
-- level, and False otherwise. Nested_Constructs is True when any nested
-- packages declared in L must be processed, and False otherwise.
-------------------------------------
-- Activate_Atomic_Synchronization --
-------------------------------------
procedure Activate_Atomic_Synchronization (N : Node_Id) is
Msg_Node : Node_Id;
begin
case Nkind (Parent (N)) is
-- Check for cases of appearing in the prefix of a construct where we
-- don't need atomic synchronization for this kind of usage.
when
-- Nothing to do if we are the prefix of an attribute, since we
-- do not want an atomic sync operation for things like 'Size.
N_Attribute_Reference
-- The N_Reference node is like an attribute
| N_Reference
-- Nothing to do for a reference to a component (or components)
-- of a composite object. Only reads and updates of the object
-- as a whole require atomic synchronization (RM C.6 (15)).
| N_Indexed_Component
| N_Selected_Component
| N_Slice
=>
-- For all the above cases, nothing to do if we are the prefix
if Prefix (Parent (N)) = N then
return;
end if;
when others =>
null;
end case;
-- Nothing to do for the identifier in an object renaming declaration,
-- the renaming itself does not need atomic synchronization.
if Nkind (Parent (N)) = N_Object_Renaming_Declaration then
return;
end if;
-- Go ahead and set the flag
Set_Atomic_Sync_Required (N);
-- Generate info message if requested
if Warn_On_Atomic_Synchronization then
case Nkind (N) is
when N_Identifier =>
Msg_Node := N;
when N_Expanded_Name
| N_Selected_Component
=>
Msg_Node := Selector_Name (N);
when N_Explicit_Dereference
| N_Indexed_Component
=>
Msg_Node := Empty;
when others =>
pragma Assert (False);
return;
end case;
if Present (Msg_Node) then
Error_Msg_N
("info: atomic synchronization set for &?N?", Msg_Node);
else
Error_Msg_N
("info: atomic synchronization set?N?", N);
end if;
end if;
end Activate_Atomic_Synchronization;
----------------------
-- Adjust_Condition --
----------------------
procedure Adjust_Condition (N : Node_Id) is
begin
if No (N) then
return;
end if;
declare
Loc : constant Source_Ptr := Sloc (N);
T : constant Entity_Id := Etype (N);
Ti : Entity_Id;
begin
-- Defend against a call where the argument has no type, or has a
-- type that is not Boolean. This can occur because of prior errors.
if No (T) or else not Is_Boolean_Type (T) then
return;
end if;
-- Apply validity checking if needed
if Validity_Checks_On and Validity_Check_Tests then
Ensure_Valid (N);
end if;
-- Immediate return if standard boolean, the most common case,
-- where nothing needs to be done.
if Base_Type (T) = Standard_Boolean then
return;
end if;
-- Case of zero/non-zero semantics or non-standard enumeration
-- representation. In each case, we rewrite the node as:
-- ityp!(N) /= False'Enum_Rep
-- where ityp is an integer type with large enough size to hold any
-- value of type T.
if Nonzero_Is_True (T) or else Has_Non_Standard_Rep (T) then
if Esize (T) <= Esize (Standard_Integer) then
Ti := Standard_Integer;
else
Ti := Standard_Long_Long_Integer;
end if;
Rewrite (N,
Make_Op_Ne (Loc,
Left_Opnd => Unchecked_Convert_To (Ti, N),
Right_Opnd =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Enum_Rep,
Prefix =>
New_Occurrence_Of (First_Literal (T), Loc))));
Analyze_And_Resolve (N, Standard_Boolean);
else
Rewrite (N, Convert_To (Standard_Boolean, N));
Analyze_And_Resolve (N, Standard_Boolean);
end if;
end;
end Adjust_Condition;
------------------------
-- Adjust_Result_Type --
------------------------
procedure Adjust_Result_Type (N : Node_Id; T : Entity_Id) is
begin
-- Ignore call if current type is not Standard.Boolean
if Etype (N) /= Standard_Boolean then
return;
end if;
-- If result is already of correct type, nothing to do. Note that
-- this will get the most common case where everything has a type
-- of Standard.Boolean.
if Base_Type (T) = Standard_Boolean then
return;
else
declare
KP : constant Node_Kind := Nkind (Parent (N));
begin
-- If result is to be used as a Condition in the syntax, no need
-- to convert it back, since if it was changed to Standard.Boolean
-- using Adjust_Condition, that is just fine for this usage.
if KP in N_Raise_xxx_Error or else KP in N_Has_Condition then
return;
-- If result is an operand of another logical operation, no need
-- to reset its type, since Standard.Boolean is just fine, and
-- such operations always do Adjust_Condition on their operands.
elsif KP in N_Op_Boolean
or else KP in N_Short_Circuit
or else KP = N_Op_Not
then
return;
-- Otherwise we perform a conversion from the current type, which
-- must be Standard.Boolean, to the desired type. Use the base
-- type to prevent spurious constraint checks that are extraneous
-- to the transformation. The type and its base have the same
-- representation, standard or otherwise.
else
Set_Analyzed (N);
Rewrite (N, Convert_To (Base_Type (T), N));
Analyze_And_Resolve (N, Base_Type (T));
end if;
end;
end if;
end Adjust_Result_Type;
--------------------------
-- Append_Freeze_Action --
--------------------------
procedure Append_Freeze_Action (T : Entity_Id; N : Node_Id) is
Fnode : Node_Id;
begin
Ensure_Freeze_Node (T);
Fnode := Freeze_Node (T);
if No (Actions (Fnode)) then
Set_Actions (Fnode, New_List (N));
else
Append (N, Actions (Fnode));
end if;
end Append_Freeze_Action;
---------------------------
-- Append_Freeze_Actions --
---------------------------
procedure Append_Freeze_Actions (T : Entity_Id; L : List_Id) is
Fnode : Node_Id;
begin
if No (L) then
return;
end if;
Ensure_Freeze_Node (T);
Fnode := Freeze_Node (T);
if No (Actions (Fnode)) then
Set_Actions (Fnode, L);
else
Append_List (L, Actions (Fnode));
end if;
end Append_Freeze_Actions;
------------------------------------
-- Build_Allocate_Deallocate_Proc --
------------------------------------
procedure Build_Allocate_Deallocate_Proc
(N : Node_Id;
Is_Allocate : Boolean)
is
Desig_Typ : Entity_Id;
Expr : Node_Id;
Pool_Id : Entity_Id;
Proc_To_Call : Node_Id := Empty;
Ptr_Typ : Entity_Id;
function Find_Object (E : Node_Id) return Node_Id;
-- Given an arbitrary expression of an allocator, try to find an object
-- reference in it, otherwise return the original expression.
function Is_Allocate_Deallocate_Proc (Subp : Entity_Id) return Boolean;
-- Determine whether subprogram Subp denotes a custom allocate or
-- deallocate.
-----------------
-- Find_Object --
-----------------
function Find_Object (E : Node_Id) return Node_Id is
Expr : Node_Id;
begin
pragma Assert (Is_Allocate);
Expr := E;
loop
if Nkind (Expr) = N_Explicit_Dereference then
Expr := Prefix (Expr);
elsif Nkind (Expr) = N_Qualified_Expression then
Expr := Expression (Expr);
elsif Nkind (Expr) = N_Unchecked_Type_Conversion then
-- When interface class-wide types are involved in allocation,
-- the expander introduces several levels of address arithmetic
-- to perform dispatch table displacement. In this scenario the
-- object appears as:
-- Tag_Ptr (Base_Address (<object>'Address))
-- Detect this case and utilize the whole expression as the
-- "object" since it now points to the proper dispatch table.
if Is_RTE (Etype (Expr), RE_Tag_Ptr) then
exit;
-- Continue to strip the object
else
Expr := Expression (Expr);
end if;
else
exit;
end if;
end loop;
return Expr;
end Find_Object;
---------------------------------
-- Is_Allocate_Deallocate_Proc --
---------------------------------
function Is_Allocate_Deallocate_Proc (Subp : Entity_Id) return Boolean is
begin
-- Look for a subprogram body with only one statement which is a
-- call to Allocate_Any_Controlled / Deallocate_Any_Controlled.
if Ekind (Subp) = E_Procedure
and then Nkind (Parent (Parent (Subp))) = N_Subprogram_Body
then
declare
HSS : constant Node_Id :=
Handled_Statement_Sequence (Parent (Parent (Subp)));
Proc : Entity_Id;
begin
if Present (Statements (HSS))
and then Nkind (First (Statements (HSS))) =
N_Procedure_Call_Statement
then
Proc := Entity (Name (First (Statements (HSS))));
return
Is_RTE (Proc, RE_Allocate_Any_Controlled)
or else Is_RTE (Proc, RE_Deallocate_Any_Controlled);
end if;
end;
end if;
return False;
end Is_Allocate_Deallocate_Proc;
-- Start of processing for Build_Allocate_Deallocate_Proc
begin
-- Obtain the attributes of the allocation / deallocation
if Nkind (N) = N_Free_Statement then
Expr := Expression (N);
Ptr_Typ := Base_Type (Etype (Expr));
Proc_To_Call := Procedure_To_Call (N);
else
if Nkind (N) = N_Object_Declaration then
Expr := Expression (N);
else
Expr := N;
end if;
-- In certain cases an allocator with a qualified expression may
-- be relocated and used as the initialization expression of a
-- temporary:
-- before:
-- Obj : Ptr_Typ := new Desig_Typ'(...);
-- after:
-- Tmp : Ptr_Typ := new Desig_Typ'(...);
-- Obj : Ptr_Typ := Tmp;
-- Since the allocator is always marked as analyzed to avoid infinite
-- expansion, it will never be processed by this routine given that
-- the designated type needs finalization actions. Detect this case
-- and complete the expansion of the allocator.
if Nkind (Expr) = N_Identifier
and then Nkind (Parent (Entity (Expr))) = N_Object_Declaration
and then Nkind (Expression (Parent (Entity (Expr)))) = N_Allocator
then
Build_Allocate_Deallocate_Proc (Parent (Entity (Expr)), True);
return;
end if;
-- The allocator may have been rewritten into something else in which
-- case the expansion performed by this routine does not apply.
if Nkind (Expr) /= N_Allocator then
return;
end if;
Ptr_Typ := Base_Type (Etype (Expr));
Proc_To_Call := Procedure_To_Call (Expr);
end if;
Pool_Id := Associated_Storage_Pool (Ptr_Typ);
Desig_Typ := Available_View (Designated_Type (Ptr_Typ));
-- Handle concurrent types
if Is_Concurrent_Type (Desig_Typ)
and then Present (Corresponding_Record_Type (Desig_Typ))
then
Desig_Typ := Corresponding_Record_Type (Desig_Typ);
end if;
-- Do not process allocations / deallocations without a pool
if No (Pool_Id) then
return;
-- Do not process allocations on / deallocations from the secondary
-- stack.
elsif Is_RTE (Pool_Id, RE_SS_Pool) then
return;
-- Optimize the case where we are using the default Global_Pool_Object,
-- and we don't need the heavy finalization machinery.
elsif Pool_Id = RTE (RE_Global_Pool_Object)
and then not Needs_Finalization (Desig_Typ)
then
return;
-- Do not replicate the machinery if the allocator / free has already
-- been expanded and has a custom Allocate / Deallocate.
elsif Present (Proc_To_Call)
and then Is_Allocate_Deallocate_Proc (Proc_To_Call)
then
return;
end if;
if Needs_Finalization (Desig_Typ) then
-- Certain run-time configurations and targets do not provide support
-- for controlled types.
if Restriction_Active (No_Finalization) then
return;
-- Do nothing if the access type may never allocate / deallocate
-- objects.
elsif No_Pool_Assigned (Ptr_Typ) then
return;
end if;
-- The allocation / deallocation of a controlled object must be
-- chained on / detached from a finalization master.
pragma Assert (Present (Finalization_Master (Ptr_Typ)));
-- The only other kind of allocation / deallocation supported by this
-- routine is on / from a subpool.
elsif Nkind (Expr) = N_Allocator
and then No (Subpool_Handle_Name (Expr))
then
return;
end if;
declare
Loc : constant Source_Ptr := Sloc (N);
Addr_Id : constant Entity_Id := Make_Temporary (Loc, 'A');
Alig_Id : constant Entity_Id := Make_Temporary (Loc, 'L');
Proc_Id : constant Entity_Id := Make_Temporary (Loc, 'P');
Size_Id : constant Entity_Id := Make_Temporary (Loc, 'S');
Actuals : List_Id;
Fin_Addr_Id : Entity_Id;
Fin_Mas_Act : Node_Id;
Fin_Mas_Id : Entity_Id;
Proc_To_Call : Entity_Id;
Subpool : Node_Id := Empty;
begin
-- Step 1: Construct all the actuals for the call to library routine
-- Allocate_Any_Controlled / Deallocate_Any_Controlled.
-- a) Storage pool
Actuals := New_List (New_Occurrence_Of (Pool_Id, Loc));
if Is_Allocate then
-- b) Subpool
if Nkind (Expr) = N_Allocator then
Subpool := Subpool_Handle_Name (Expr);
end if;
-- If a subpool is present it can be an arbitrary name, so make
-- the actual by copying the tree.
if Present (Subpool) then
Append_To (Actuals, New_Copy_Tree (Subpool, New_Sloc => Loc));
else
Append_To (Actuals, Make_Null (Loc));
end if;
-- c) Finalization master
if Needs_Finalization (Desig_Typ) then
Fin_Mas_Id := Finalization_Master (Ptr_Typ);
Fin_Mas_Act := New_Occurrence_Of (Fin_Mas_Id, Loc);
-- Handle the case where the master is actually a pointer to a
-- master. This case arises in build-in-place functions.
if Is_Access_Type (Etype (Fin_Mas_Id)) then
Append_To (Actuals, Fin_Mas_Act);
else
Append_To (Actuals,
Make_Attribute_Reference (Loc,
Prefix => Fin_Mas_Act,
Attribute_Name => Name_Unrestricted_Access));
end if;
else
Append_To (Actuals, Make_Null (Loc));
end if;
-- d) Finalize_Address
-- Primitive Finalize_Address is never generated in CodePeer mode
-- since it contains an Unchecked_Conversion.
if Needs_Finalization (Desig_Typ) and then not CodePeer_Mode then
Fin_Addr_Id := Finalize_Address (Desig_Typ);
pragma Assert (Present (Fin_Addr_Id));
Append_To (Actuals,
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Fin_Addr_Id, Loc),
Attribute_Name => Name_Unrestricted_Access));
else
Append_To (Actuals, Make_Null (Loc));
end if;
end if;
-- e) Address
-- f) Storage_Size
-- g) Alignment
Append_To (Actuals, New_Occurrence_Of (Addr_Id, Loc));
Append_To (Actuals, New_Occurrence_Of (Size_Id, Loc));
if Is_Allocate or else not Is_Class_Wide_Type (Desig_Typ) then
Append_To (Actuals, New_Occurrence_Of (Alig_Id, Loc));
-- For deallocation of class-wide types we obtain the value of
-- alignment from the Type Specific Record of the deallocated object.
-- This is needed because the frontend expansion of class-wide types
-- into equivalent types confuses the back end.
else
-- Generate:
-- Obj.all'Alignment
-- ... because 'Alignment applied to class-wide types is expanded
-- into the code that reads the value of alignment from the TSD
-- (see Expand_N_Attribute_Reference)
Append_To (Actuals,
Unchecked_Convert_To (RTE (RE_Storage_Offset),
Make_Attribute_Reference (Loc,
Prefix =>
Make_Explicit_Dereference (Loc, Relocate_Node (Expr)),
Attribute_Name => Name_Alignment)));
end if;
-- h) Is_Controlled
if Needs_Finalization (Desig_Typ) then
declare
Flag_Id : constant Entity_Id := Make_Temporary (Loc, 'F');
Flag_Expr : Node_Id;
Param : Node_Id;
Temp : Node_Id;
begin
if Is_Allocate then
Temp := Find_Object (Expression (Expr));
else
Temp := Expr;
end if;
-- Processing for allocations where the expression is a subtype
-- indication.
if Is_Allocate
and then Is_Entity_Name (Temp)
and then Is_Type (Entity (Temp))
then
Flag_Expr :=
New_Occurrence_Of
(Boolean_Literals
(Needs_Finalization (Entity (Temp))), Loc);
-- The allocation / deallocation of a class-wide object relies
-- on a runtime check to determine whether the object is truly
-- controlled or not. Depending on this check, the finalization
-- machinery will request or reclaim extra storage reserved for
-- a list header.
elsif Is_Class_Wide_Type (Desig_Typ) then
-- Detect a special case where interface class-wide types
-- are involved as the object appears as:
-- Tag_Ptr (Base_Address (<object>'Address))
-- The expression already yields the proper tag, generate:
-- Temp.all
if Is_RTE (Etype (Temp), RE_Tag_Ptr) then
Param :=
Make_Explicit_Dereference (Loc,
Prefix => Relocate_Node (Temp));
-- In the default case, obtain the tag of the object about
-- to be allocated / deallocated. Generate:
-- Temp'Tag
else
Param :=
Make_Attribute_Reference (Loc,
Prefix => Relocate_Node (Temp),
Attribute_Name => Name_Tag);
end if;
-- Generate:
-- Needs_Finalization (<Param>)
Flag_Expr :=
Make_Function_Call (Loc,
Name =>
New_Occurrence_Of (RTE (RE_Needs_Finalization), Loc),
Parameter_Associations => New_List (Param));
-- Processing for generic actuals
elsif Is_Generic_Actual_Type (Desig_Typ) then
Flag_Expr :=
New_Occurrence_Of (Boolean_Literals
(Needs_Finalization (Base_Type (Desig_Typ))), Loc);
-- The object does not require any specialized checks, it is
-- known to be controlled.
else
Flag_Expr := New_Occurrence_Of (Standard_True, Loc);
end if;
-- Create the temporary which represents the finalization state
-- of the expression. Generate:
--
-- F : constant Boolean := <Flag_Expr>;
Insert_Action (N,
Make_Object_Declaration (Loc,
Defining_Identifier => Flag_Id,
Constant_Present => True,
Object_Definition =>
New_Occurrence_Of (Standard_Boolean, Loc),
Expression => Flag_Expr));
Append_To (Actuals, New_Occurrence_Of (Flag_Id, Loc));
end;
-- The object is not controlled
else
Append_To (Actuals, New_Occurrence_Of (Standard_False, Loc));
end if;
-- i) On_Subpool
if Is_Allocate then
Append_To (Actuals,
New_Occurrence_Of (Boolean_Literals (Present (Subpool)), Loc));
end if;
-- Step 2: Build a wrapper Allocate / Deallocate which internally
-- calls Allocate_Any_Controlled / Deallocate_Any_Controlled.
-- Select the proper routine to call
if Is_Allocate then
Proc_To_Call := RTE (RE_Allocate_Any_Controlled);
else
Proc_To_Call := RTE (RE_Deallocate_Any_Controlled);
end if;
-- Create a custom Allocate / Deallocate routine which has identical
-- profile to that of System.Storage_Pools.
Insert_Action (N,
Make_Subprogram_Body (Loc,
Specification =>
-- procedure Pnn
Make_Procedure_Specification (Loc,
Defining_Unit_Name => Proc_Id,
Parameter_Specifications => New_List (
-- P : Root_Storage_Pool
Make_Parameter_Specification (Loc,
Defining_Identifier => Make_Temporary (Loc, 'P'),
Parameter_Type =>
New_Occurrence_Of (RTE (RE_Root_Storage_Pool), Loc)),
-- A : [out] Address
Make_Parameter_Specification (Loc,
Defining_Identifier => Addr_Id,
Out_Present => Is_Allocate,
Parameter_Type =>
New_Occurrence_Of (RTE (RE_Address), Loc)),
-- S : Storage_Count
Make_Parameter_Specification (Loc,
Defining_Identifier => Size_Id,
Parameter_Type =>
New_Occurrence_Of (RTE (RE_Storage_Count), Loc)),
-- L : Storage_Count
Make_Parameter_Specification (Loc,
Defining_Identifier => Alig_Id,
Parameter_Type =>
New_Occurrence_Of (RTE (RE_Storage_Count), Loc)))),
Declarations => No_List,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => New_List (
Make_Procedure_Call_Statement (Loc,
Name => New_Occurrence_Of (Proc_To_Call, Loc),
Parameter_Associations => Actuals)))));
-- The newly generated Allocate / Deallocate becomes the default
-- procedure to call when the back end processes the allocation /
-- deallocation.
if Is_Allocate then
Set_Procedure_To_Call (Expr, Proc_Id);
else
Set_Procedure_To_Call (N, Proc_Id);
end if;
end;
end Build_Allocate_Deallocate_Proc;
-------------------------------
-- Build_Abort_Undefer_Block --
-------------------------------
function Build_Abort_Undefer_Block
(Loc : Source_Ptr;
Stmts : List_Id;
Context : Node_Id) return Node_Id
is
Exceptions_OK : constant Boolean :=
not Restriction_Active (No_Exception_Propagation);
AUD : Entity_Id;
Blk : Node_Id;
Blk_Id : Entity_Id;
HSS : Node_Id;
begin
-- The block should be generated only when undeferring abort in the
-- context of a potential exception.
pragma Assert (Abort_Allowed and Exceptions_OK);
-- Generate:
-- begin
-- <Stmts>
-- at end
-- Abort_Undefer_Direct;
-- end;
AUD := RTE (RE_Abort_Undefer_Direct);
HSS :=
Make_Handled_Sequence_Of_Statements (Loc,
Statements => Stmts,
At_End_Proc => New_Occurrence_Of (AUD, Loc));
Blk :=
Make_Block_Statement (Loc,
Handled_Statement_Sequence => HSS);
Set_Is_Abort_Block (Blk);
Add_Block_Identifier (Blk, Blk_Id);
Expand_At_End_Handler (HSS, Blk_Id);
-- Present the Abort_Undefer_Direct function to the back end to inline
-- the call to the routine.
Add_Inlined_Body (AUD, Context);
return Blk;
end Build_Abort_Undefer_Block;
---------------------------------
-- Build_Class_Wide_Expression --
---------------------------------
procedure Build_Class_Wide_Expression
(Prag : Node_Id;
Subp : Entity_Id;
Par_Subp : Entity_Id;
Adjust_Sloc : Boolean)
is
function Replace_Entity (N : Node_Id) return Traverse_Result;
-- Replace reference to formal of inherited operation or to primitive
-- operation of root type, with corresponding entity for derived type,
-- when constructing the class-wide condition of an overriding
-- subprogram.
--------------------
-- Replace_Entity --
--------------------
function Replace_Entity (N : Node_Id) return Traverse_Result is
New_E : Entity_Id;
begin
if Adjust_Sloc then
Adjust_Inherited_Pragma_Sloc (N);
end if;
if Nkind (N) = N_Identifier
and then Present (Entity (N))
and then
(Is_Formal (Entity (N)) or else Is_Subprogram (Entity (N)))
and then
(Nkind (Parent (N)) /= N_Attribute_Reference
or else Attribute_Name (Parent (N)) /= Name_Class)
then
-- The replacement does not apply to dispatching calls within the
-- condition, but only to calls whose static tag is that of the
-- parent type.
if Is_Subprogram (Entity (N))
and then Nkind (Parent (N)) = N_Function_Call
and then Present (Controlling_Argument (Parent (N)))
then
return OK;
end if;
-- Determine whether entity has a renaming
New_E := Primitives_Mapping.Get (Entity (N));
if Present (New_E) then
Rewrite (N, New_Occurrence_Of (New_E, Sloc (N)));
end if;
-- Check that there are no calls left to abstract operations if
-- the current subprogram is not abstract.
if Nkind (Parent (N)) = N_Function_Call
and then N = Name (Parent (N))
then
if not Is_Abstract_Subprogram (Subp)
and then Is_Abstract_Subprogram (Entity (N))
then
Error_Msg_Sloc := Sloc (Current_Scope);
Error_Msg_NE
("cannot call abstract subprogram in inherited condition "
& "for&#", N, Current_Scope);
-- In SPARK mode, reject an inherited condition for an
-- inherited operation if it contains a call to an overriding
-- operation, because this implies that the pre/postconditions
-- of the inherited operation have changed silently.
elsif SPARK_Mode = On
and then Warn_On_Suspicious_Contract
and then Present (Alias (Subp))
and then Present (New_E)
and then Comes_From_Source (New_E)
then
Error_Msg_N
("cannot modify inherited condition (SPARK RM 6.1.1(1))",
Parent (Subp));
Error_Msg_Sloc := Sloc (New_E);
Error_Msg_Node_2 := Subp;
Error_Msg_NE
("\overriding of&# forces overriding of&",
Parent (Subp), New_E);
end if;
end if;
-- Update type of function call node, which should be the same as
-- the function's return type.
if Is_Subprogram (Entity (N))
and then Nkind (Parent (N)) = N_Function_Call
then
Set_Etype (Parent (N), Etype (Entity (N)));
end if;
-- The whole expression will be reanalyzed
elsif Nkind (N) in N_Has_Etype then
Set_Analyzed (N, False);
end if;
return OK;
end Replace_Entity;
procedure Replace_Condition_Entities is
new Traverse_Proc (Replace_Entity);
-- Local variables
Par_Formal : Entity_Id;
Subp_Formal : Entity_Id;
-- Start of processing for Build_Class_Wide_Expression
begin
-- Add mapping from old formals to new formals
Par_Formal := First_Formal (Par_Subp);
Subp_Formal := First_Formal (Subp);
while Present (Par_Formal) and then Present (Subp_Formal) loop
Primitives_Mapping.Set (Par_Formal, Subp_Formal);
Next_Formal (Par_Formal);
Next_Formal (Subp_Formal);
end loop;
Replace_Condition_Entities (Prag);
end Build_Class_Wide_Expression;
--------------------
-- Build_DIC_Call --
--------------------
function Build_DIC_Call
(Loc : Source_Ptr;
Obj_Id : Entity_Id;
Typ : Entity_Id) return Node_Id
is
Proc_Id : constant Entity_Id := DIC_Procedure (Typ);
Formal_Typ : constant Entity_Id := Etype (First_Formal (Proc_Id));
begin
return
Make_Procedure_Call_Statement (Loc,
Name => New_Occurrence_Of (Proc_Id, Loc),
Parameter_Associations => New_List (
Make_Unchecked_Type_Conversion (Loc,
Subtype_Mark => New_Occurrence_Of (Formal_Typ, Loc),
Expression => New_Occurrence_Of (Obj_Id, Loc))));
end Build_DIC_Call;
------------------------------
-- Build_DIC_Procedure_Body --
------------------------------
-- WARNING: This routine manages Ghost regions. Return statements must be
-- replaced by gotos which jump to the end of the routine and restore the
-- Ghost mode.
procedure Build_DIC_Procedure_Body (Typ : Entity_Id) is
procedure Add_DIC_Check
(DIC_Prag : Node_Id;
DIC_Expr : Node_Id;
Stmts : in out List_Id);
-- Subsidiary to all Add_xxx_DIC routines. Add a runtime check to verify
-- assertion expression DIC_Expr of pragma DIC_Prag. All generated code
-- is added to list Stmts.
procedure Add_Inherited_DIC
(DIC_Prag : Node_Id;
Par_Typ : Entity_Id;
Deriv_Typ : Entity_Id;
Stmts : in out List_Id);
-- Add a runtime check to verify the assertion expression of inherited
-- pragma DIC_Prag. Par_Typ is parent type, which is also the owner of
-- the DIC pragma. Deriv_Typ is the derived type inheriting the DIC
-- pragma. All generated code is added to list Stmts.
procedure Add_Inherited_Tagged_DIC
(DIC_Prag : Node_Id;
Par_Typ : Entity_Id;
Deriv_Typ : Entity_Id;
Stmts : in out List_Id);
-- Add a runtime check to verify assertion expression DIC_Expr of
-- inherited pragma DIC_Prag. This routine applies class-wide pre- and
-- postcondition-like runtime semantics to the check. Par_Typ is the
-- parent type whose DIC pragma is being inherited. Deriv_Typ is the
-- derived type inheriting the DIC pragma. All generated code is added
-- to list Stmts.
procedure Add_Own_DIC
(DIC_Prag : Node_Id;
DIC_Typ : Entity_Id;
Stmts : in out List_Id);
-- Add a runtime check to verify the assertion expression of pragma
-- DIC_Prag. DIC_Typ is the owner of the DIC pragma. All generated code
-- is added to list Stmts.
procedure Replace_Object_And_Primitive_References
(Expr : Node_Id;
Par_Typ : Entity_Id;
Deriv_Typ : Entity_Id;
Par_Obj : Entity_Id := Empty;
Deriv_Obj : Entity_Id := Empty);
-- Expr denotes an arbitrary expression. Par_Typ is a parent type in a
-- type hierarchy. Deriv_Typ is a type derived from Par_Typ. Par_Obj is
-- the formal parameter which emulates the current instance of Par_Typ.
-- Deriv_Obj is the formal parameter which emulates the current instance
-- of Deriv_Typ. Perform the following substitutions:
--
-- * Replace a reference to Par_Obj with a reference to Deriv_Obj if
-- applicable.
--
-- * Replace a call to an overridden parent primitive with a call to
-- the overriding derived type primitive.
--
-- * Replace a call to an inherited parent primitive with a call to
-- the internally-generated inherited derived type primitive.
procedure Replace_Type_References
(Expr : Node_Id;
Typ : Entity_Id;
Obj_Id : Entity_Id);
-- Substitute all references of the current instance of type Typ with
-- references to formal parameter Obj_Id within expression Expr.
-------------------
-- Add_DIC_Check --
-------------------
procedure Add_DIC_Check
(DIC_Prag : Node_Id;
DIC_Expr : Node_Id;
Stmts : in out List_Id)
is
Loc : constant Source_Ptr := Sloc (DIC_Prag);
Nam : constant Name_Id := Original_Aspect_Pragma_Name (DIC_Prag);
begin
-- The DIC pragma is ignored, nothing left to do
if Is_Ignored (DIC_Prag) then
null;
-- Otherwise the DIC expression must be checked at runtime. Generate:
-- pragma Check (<Nam>, <DIC_Expr>);
else
Append_New_To (Stmts,
Make_Pragma (Loc,
Pragma_Identifier =>
Make_Identifier (Loc, Name_Check),
Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Make_Identifier (Loc, Nam)),
Make_Pragma_Argument_Association (Loc,
Expression => DIC_Expr))));
end if;
end Add_DIC_Check;
-----------------------
-- Add_Inherited_DIC --
-----------------------
procedure Add_Inherited_DIC
(DIC_Prag : Node_Id;
Par_Typ : Entity_Id;
Deriv_Typ : Entity_Id;
Stmts : in out List_Id)
is
Deriv_Proc : constant Entity_Id := DIC_Procedure (Deriv_Typ);
Deriv_Obj : constant Entity_Id := First_Entity (Deriv_Proc);
Par_Proc : constant Entity_Id := DIC_Procedure (Par_Typ);
Par_Obj : constant Entity_Id := First_Entity (Par_Proc);
Loc : constant Source_Ptr := Sloc (DIC_Prag);
begin
pragma Assert (Present (Deriv_Proc) and then Present (Par_Proc));
-- Verify the inherited DIC assertion expression by calling the DIC
-- procedure of the parent type.
-- Generate:
-- <Par_Typ>DIC (Par_Typ (_object));
Append_New_To (Stmts,
Make_Procedure_Call_Statement (Loc,
Name => New_Occurrence_Of (Par_Proc, Loc),
Parameter_Associations => New_List (
Convert_To
(Typ => Etype (Par_Obj),
Expr => New_Occurrence_Of (Deriv_Obj, Loc)))));
end Add_Inherited_DIC;
------------------------------
-- Add_Inherited_Tagged_DIC --
------------------------------
procedure Add_Inherited_Tagged_DIC
(DIC_Prag : Node_Id;
Par_Typ : Entity_Id;
Deriv_Typ : Entity_Id;
Stmts : in out List_Id)
is
Deriv_Decl : constant Node_Id := Declaration_Node (Deriv_Typ);
Deriv_Proc : constant Entity_Id := DIC_Procedure (Deriv_Typ);
DIC_Args : constant List_Id :=
Pragma_Argument_Associations (DIC_Prag);
DIC_Arg : constant Node_Id := First (DIC_Args);
DIC_Expr : constant Node_Id := Expression_Copy (DIC_Arg);
Par_Proc : constant Entity_Id := DIC_Procedure (Par_Typ);
Expr : Node_Id;
begin
-- The processing of an inherited DIC assertion expression starts off
-- with a copy of the original parent expression where all references
-- to the parent type have already been replaced with references to
-- the _object formal parameter of the parent type's DIC procedure.
pragma Assert (Present (DIC_Expr));
Expr := New_Copy_Tree (DIC_Expr);
-- Perform the following substitutions:
-- * Replace a reference to the _object parameter of the parent
-- type's DIC procedure with a reference to the _object parameter
-- of the derived types' DIC procedure.
-- * Replace a call to an overridden parent primitive with a call
-- to the overriding derived type primitive.
-- * Replace a call to an inherited parent primitive with a call to
-- the internally-generated inherited derived type primitive.
-- Note that primitives defined in the private part are automatically
-- handled by the overriding/inheritance mechanism and do not require
-- an extra replacement pass.
pragma Assert (Present (Deriv_Proc) and then Present (Par_Proc));
Replace_Object_And_Primitive_References
(Expr => Expr,
Par_Typ => Par_Typ,
Deriv_Typ => Deriv_Typ,
Par_Obj => First_Formal (Par_Proc),
Deriv_Obj => First_Formal (Deriv_Proc));
-- Preanalyze the DIC expression to detect errors and at the same
-- time capture the visibility of the proper package part.
Set_Parent (Expr, Deriv_Decl);
Preanalyze_Assert_Expression (Expr, Any_Boolean);
-- Once the DIC assertion expression is fully processed, add a check
-- to the statements of the DIC procedure.
Add_DIC_Check
(DIC_Prag => DIC_Prag,
DIC_Expr => Expr,
Stmts => Stmts);
end Add_Inherited_Tagged_DIC;
-----------------
-- Add_Own_DIC --
-----------------
procedure Add_Own_DIC
(DIC_Prag : Node_Id;
DIC_Typ : Entity_Id;
Stmts : in out List_Id)
is
DIC_Args : constant List_Id :=
Pragma_Argument_Associations (DIC_Prag);
DIC_Arg : constant Node_Id := First (DIC_Args);
DIC_Asp : constant Node_Id := Corresponding_Aspect (DIC_Prag);
DIC_Expr : constant Node_Id := Get_Pragma_Arg (DIC_Arg);
DIC_Proc : constant Entity_Id := DIC_Procedure (DIC_Typ);
Obj_Id : constant Entity_Id := First_Formal (DIC_Proc);
procedure Preanalyze_Own_DIC_For_ASIS;
-- Preanalyze the original DIC expression of an aspect or a source
-- pragma for ASIS.
---------------------------------
-- Preanalyze_Own_DIC_For_ASIS --
---------------------------------
procedure Preanalyze_Own_DIC_For_ASIS is
Expr : Node_Id := Empty;
begin
-- The DIC pragma is a source construct, preanalyze the original
-- expression of the pragma.
if Comes_From_Source (DIC_Prag) then
Expr := DIC_Expr;
-- Otherwise preanalyze the expression of the corresponding aspect
elsif Present (DIC_Asp) then
Expr := Expression (DIC_Asp);
end if;
-- The expression must be subjected to the same substitutions as
-- the copy used in the generation of the runtime check.
if Present (Expr) then
Replace_Type_References
(Expr => Expr,
Typ => DIC_Typ,
Obj_Id => Obj_Id);
Preanalyze_Assert_Expression (Expr, Any_Boolean);
end if;
end Preanalyze_Own_DIC_For_ASIS;
-- Local variables
Typ_Decl : constant Node_Id := Declaration_Node (DIC_Typ);
Expr : Node_Id;
-- Start of processing for Add_Own_DIC
begin
Expr := New_Copy_Tree (DIC_Expr);
-- Perform the following substitution:
-- * Replace the current instance of DIC_Typ with a reference to
-- the _object formal parameter of the DIC procedure.
Replace_Type_References
(Expr => Expr,
Typ => DIC_Typ,
Obj_Id => Obj_Id);
-- Preanalyze the DIC expression to detect errors and at the same
-- time capture the visibility of the proper package part.
Set_Parent (Expr, Typ_Decl);
Preanalyze_Assert_Expression (Expr, Any_Boolean);
-- Save a copy of the expression with all replacements and analysis
-- already taken place in case a derived type inherits the pragma.
-- The copy will be used as the foundation of the derived type's own
-- version of the DIC assertion expression.
if Is_Tagged_Type (DIC_Typ) then
Set_Expression_Copy (DIC_Arg, New_Copy_Tree (Expr));
end if;
-- If the pragma comes from an aspect specification, replace the
-- saved expression because all type references must be substituted
-- for the call to Preanalyze_Spec_Expression in Check_Aspect_At_xxx
-- routines.
if Present (DIC_Asp) then
Set_Entity (Identifier (DIC_Asp), New_Copy_Tree (Expr));
end if;
-- Preanalyze the original DIC expression for ASIS
if ASIS_Mode then
Preanalyze_Own_DIC_For_ASIS;
end if;
-- Once the DIC assertion expression is fully processed, add a check
-- to the statements of the DIC procedure.
Add_DIC_Check
(DIC_Prag => DIC_Prag,
DIC_Expr => Expr,
Stmts => Stmts);
end Add_Own_DIC;
---------------------------------------------
-- Replace_Object_And_Primitive_References --
---------------------------------------------
procedure Replace_Object_And_Primitive_References
(Expr : Node_Id;
Par_Typ : Entity_Id;
Deriv_Typ : Entity_Id;
Par_Obj : Entity_Id := Empty;
Deriv_Obj : Entity_Id := Empty)
is
function Replace_Ref (Ref : Node_Id) return Traverse_Result;
-- Substitute a reference to an entity with a reference to the
-- corresponding entity stored in in table Primitives_Mapping.
-----------------
-- Replace_Ref --
-----------------
function Replace_Ref (Ref : Node_Id) return Traverse_Result is
Context : constant Node_Id := Parent (Ref);
Loc : constant Source_Ptr := Sloc (Ref);
New_Id : Entity_Id;
New_Ref : Node_Id;
Ref_Id : Entity_Id;
Result : Traverse_Result;
begin
Result := OK;
-- The current node denotes a reference
if Nkind (Ref) in N_Has_Entity and then Present (Entity (Ref)) then
Ref_Id := Entity (Ref);
New_Id := Primitives_Mapping.Get (Ref_Id);
-- The reference mentions a parent type primitive which has a
-- corresponding derived type primitive.
if Present (New_Id) then
New_Ref := New_Occurrence_Of (New_Id, Loc);
-- The reference mentions the _object parameter of the parent
-- type's DIC procedure.
elsif Present (Par_Obj)
and then Present (Deriv_Obj)
and then Ref_Id = Par_Obj
then
New_Ref := New_Occurrence_Of (Deriv_Obj, Loc);
-- The reference to _object acts as an actual parameter in a
-- subprogram call which may be invoking a primitive of the
-- parent type:
-- Primitive (... _object ...);
-- The parent type primitive may not be overridden nor
-- inherited when it is declared after the derived type
-- definition:
-- type Parent is tagged private;
-- type Child is new Parent with private;
-- procedure Primitive (Obj : Parent);
-- In this scenario the _object parameter is converted to
-- the parent type.
if Nkind_In (Context, N_Function_Call,
N_Procedure_Call_Statement)
and then
No (Primitives_Mapping.Get (Entity (Name (Context))))
then
New_Ref := Convert_To (Par_Typ, New_Ref);
-- Do not process the generated type conversion because
-- both the parent type and the derived type are in the
-- Primitives_Mapping table. This will clobber the type
-- conversion by resetting its subtype mark.
Result := Skip;
end if;
-- Otherwise there is nothing to replace
else
New_Ref := Empty;
end if;
if Present (New_Ref) then
Rewrite (Ref, New_Ref);
-- Update the return type when the context of the reference
-- acts as the name of a function call. Note that the update
-- should not be performed when the reference appears as an
-- actual in the call.
if Nkind (Context) = N_Function_Call
and then Name (Context) = Ref
then
Set_Etype (Context, Etype (New_Id));
end if;
end if;
end if;
-- Reanalyze the reference due to potential replacements
if Nkind (Ref) in N_Has_Etype then
Set_Analyzed (Ref, False);
end if;
return Result;
end Replace_Ref;
procedure Replace_Refs is new Traverse_Proc (Replace_Ref);
-- Start of processing for Replace_Object_And_Primitive_References
begin
-- Map each primitive operation of the parent type to the proper
-- primitive of the derived type.
Update_Primitives_Mapping_Of_Types
(Par_Typ => Par_Typ,
Deriv_Typ => Deriv_Typ);
-- Inspect the input expression and perform substitutions where
-- necessary.
Replace_Refs (Expr);
end Replace_Object_And_Primitive_References;
-----------------------------
-- Replace_Type_References --
-----------------------------
procedure Replace_Type_References
(Expr : Node_Id;
Typ : Entity_Id;
Obj_Id : Entity_Id)
is
procedure Replace_Type_Ref (N : Node_Id);
-- Substitute a single reference of the current instance of type Typ
-- with a reference to Obj_Id.
----------------------
-- Replace_Type_Ref --
----------------------
procedure Replace_Type_Ref (N : Node_Id) is
Ref : Node_Id;
begin
-- Decorate the reference to Typ even though it may be rewritten
-- further down. This is done for two reasons:
-- 1) ASIS has all necessary semantic information in the
-- original tree.
-- 2) Routines which examine properties of the Original_Node
-- have some semantic information.
if Nkind (N) = N_Identifier then
Set_Entity (N, Typ);
Set_Etype (N, Typ);
elsif Nkind (N) = N_Selected_Component then
Analyze (Prefix (N));
Set_Entity (Selector_Name (N), Typ);
Set_Etype (Selector_Name (N), Typ);
end if;
-- Perform the following substitution:
-- Typ --> _object
Ref := Make_Identifier (Sloc (N), Chars (Obj_Id));
Set_Entity (Ref, Obj_Id);
Set_Etype (Ref, Typ);
Rewrite (N, Ref);
Set_Comes_From_Source (N, True);
end Replace_Type_Ref;
procedure Replace_Type_Refs is
new Replace_Type_References_Generic (Replace_Type_Ref);
-- Start of processing for Replace_Type_References
begin
Replace_Type_Refs (Expr, Typ);
end Replace_Type_References;
-- Local variables
Loc : constant Source_Ptr := Sloc (Typ);
DIC_Prag : Node_Id;
DIC_Typ : Entity_Id;
Dummy_1 : Entity_Id;
Dummy_2 : Entity_Id;
Mode : Ghost_Mode_Type;
Proc_Body : Node_Id;
Proc_Body_Id : Entity_Id;
Proc_Decl : Node_Id;
Proc_Id : Entity_Id;
Stmts : List_Id := No_List;
Work_Typ : Entity_Id;
-- The working type
-- Start of processing for Build_DIC_Procedure_Body
begin
Work_Typ := Base_Type (Typ);
-- Do not process class-wide types as these are Itypes, but lack a first
-- subtype (see below).
if Is_Class_Wide_Type (Work_Typ) then
return;
-- Do not process the underlying full view of a private type. There is
-- no way to get back to the partial view, plus the body will be built
-- by the full view or the base type.
elsif Is_Underlying_Full_View (Work_Typ) then
return;
-- Use the first subtype when dealing with various base types
elsif Is_Itype (Work_Typ) then
Work_Typ := First_Subtype (Work_Typ);
-- The input denotes the corresponding record type of a protected or a
-- task type. Work with the concurrent type because the corresponding
-- record type may not be visible to clients of the type.
elsif Ekind (Work_Typ) = E_Record_Type
and then Is_Concurrent_Record_Type (Work_Typ)
then
Work_Typ := Corresponding_Concurrent_Type (Work_Typ);
end if;
-- The working type may be subject to pragma Ghost. Set the mode now to
-- ensure that the DIC procedure is properly marked as Ghost.
Set_Ghost_Mode (Work_Typ, Mode);
-- The working type must be either define a DIC pragma of its own or
-- inherit one from a parent type.
pragma Assert (Has_DIC (Work_Typ));
-- Recover the type which defines the DIC pragma. This is either the
-- working type itself or a parent type when the pragma is inherited.
DIC_Typ := Find_DIC_Type (Work_Typ);
pragma Assert (Present (DIC_Typ));
DIC_Prag := Get_Pragma (DIC_Typ, Pragma_Default_Initial_Condition);
pragma Assert (Present (DIC_Prag));
-- Nothing to do if pragma DIC appears without an argument or its sole
-- argument is "null".
if not Is_Verifiable_DIC_Pragma (DIC_Prag) then
goto Leave;
end if;
-- The working type may lack a DIC procedure declaration. This may be
-- due to several reasons:
-- * The working type's own DIC pragma does not contain a verifiable
-- assertion expression. In this case there is no need to build a
-- DIC procedure because there is nothing to check.
-- * The working type derives from a parent type. In this case a DIC
-- procedure should be built only when the inherited DIC pragma has
-- a verifiable assertion expression.
Proc_Id := DIC_Procedure (Work_Typ);
-- Build a DIC procedure declaration when the working type derives from
-- a parent type.
if No (Proc_Id) then
Build_DIC_Procedure_Declaration (Work_Typ);
Proc_Id := DIC_Procedure (Work_Typ);
end if;
-- At this point there should be a DIC procedure declaration
pragma Assert (Present (Proc_Id));
Proc_Decl := Unit_Declaration_Node (Proc_Id);
-- Nothing to do if the DIC procedure already has a body
if Present (Corresponding_Body (Proc_Decl)) then
goto Leave;
end if;
-- Emulate the environment of the DIC procedure by installing its scope
-- and formal parameters.
Push_Scope (Proc_Id);
Install_Formals (Proc_Id);
-- The working type defines its own DIC pragma. Replace the current
-- instance of the working type with the formal of the DIC procedure.
-- Note that there is no need to consider inherited DIC pragmas from
-- parent types because the working type's DIC pragma "hides" all
-- inherited DIC pragmas.
if Has_Own_DIC (Work_Typ) then
pragma Assert (DIC_Typ = Work_Typ);
Add_Own_DIC
(DIC_Prag => DIC_Prag,
DIC_Typ => DIC_Typ,
Stmts => Stmts);
-- Otherwise the working type inherits a DIC pragma from a parent type
else
pragma Assert (Has_Inherited_DIC (Work_Typ));
pragma Assert (DIC_Typ /= Work_Typ);
-- The working type is tagged. The verification of the assertion
-- expression is subject to the same semantics as class-wide pre-
-- and postconditions.
if Is_Tagged_Type (Work_Typ) then
Add_Inherited_Tagged_DIC
(DIC_Prag => DIC_Prag,
Par_Typ => DIC_Typ,
Deriv_Typ => Work_Typ,
Stmts => Stmts);
-- Otherwise the working type is not tagged. Verify the assertion
-- expression of the inherited DIC pragma by directly calling the
-- DIC procedure of the parent type.
else
Add_Inherited_DIC
(DIC_Prag => DIC_Prag,
Par_Typ => DIC_Typ,
Deriv_Typ => Work_Typ,
Stmts => Stmts);
end if;
end if;
End_Scope;
-- Produce an empty completing body in the following cases:
-- * Assertions are disabled
-- * The DIC Assertion_Policy is Ignore
-- * Pragma DIC appears without an argument
-- * Pragma DIC appears with argument "null"
if No (Stmts) then
Stmts := New_List (Make_Null_Statement (Loc));
end if;
-- Generate:
-- procedure <Work_Typ>DIC (_object : <Work_Typ>) is
-- begin
-- <Stmts>
-- end <Work_Typ>DIC;
Proc_Body :=
Make_Subprogram_Body (Loc,
Specification =>
Copy_Subprogram_Spec (Parent (Proc_Id)),
Declarations => Empty_List,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => Stmts));
Proc_Body_Id := Defining_Entity (Proc_Body);
-- Perform minor decoration in case the body is not analyzed
Set_Ekind (Proc_Body_Id, E_Subprogram_Body);
Set_Etype (Proc_Body_Id, Standard_Void_Type);
Set_Scope (Proc_Body_Id, Current_Scope);
-- Link both spec and body to avoid generating duplicates
Set_Corresponding_Body (Proc_Decl, Proc_Body_Id);
Set_Corresponding_Spec (Proc_Body, Proc_Id);
-- The body should not be inserted into the tree when the context is
-- ASIS or a generic unit because it is not part of the template. Note
-- that the body must still be generated in order to resolve the DIC
-- assertion expression.
if ASIS_Mode or Inside_A_Generic then
null;
-- Semi-insert the body into the tree for GNATprove by setting its
-- Parent field. This allows for proper upstream tree traversals.
elsif GNATprove_Mode then
Set_Parent (Proc_Body, Parent (Declaration_Node (Work_Typ)));
-- Otherwise the body is part of the freezing actions of the working
-- type.
else
Append_Freeze_Action (Work_Typ, Proc_Body);
end if;
<<Leave>>
Restore_Ghost_Mode (Mode);
end Build_DIC_Procedure_Body;
-------------------------------------
-- Build_DIC_Procedure_Declaration --
-------------------------------------
-- WARNING: This routine manages Ghost regions. Return statements must be
-- replaced by gotos which jump to the end of the routine and restore the
-- Ghost mode.
procedure Build_DIC_Procedure_Declaration (Typ : Entity_Id) is
Loc : constant Source_Ptr := Sloc (Typ);
DIC_Prag : Node_Id;
DIC_Typ : Entity_Id;
Mode : Ghost_Mode_Type;
Proc_Decl : Node_Id;
Proc_Id : Entity_Id;
Typ_Decl : Node_Id;
CRec_Typ : Entity_Id;
-- The corresponding record type of Full_Typ
Full_Base : Entity_Id;
-- The base type of Full_Typ
Full_Typ : Entity_Id;
-- The full view of working type
Obj_Id : Entity_Id;
-- The _object formal parameter of the DIC procedure
Priv_Typ : Entity_Id;
-- The partial view of working type
Work_Typ : Entity_Id;
-- The working type
begin
Work_Typ := Base_Type (Typ);
-- Do not process class-wide types as these are Itypes, but lack a first
-- subtype (see below).
if Is_Class_Wide_Type (Work_Typ) then
return;
-- Do not process the underlying full view of a private type. There is
-- no way to get back to the partial view, plus the body will be built
-- by the full view or the base type.
elsif Is_Underlying_Full_View (Work_Typ) then
return;
-- Use the first subtype when dealing with various base types
elsif Is_Itype (Work_Typ) then
Work_Typ := First_Subtype (Work_Typ);
-- The input denotes the corresponding record type of a protected or a
-- task type. Work with the concurrent type because the corresponding
-- record type may not be visible to clients of the type.
elsif Ekind (Work_Typ) = E_Record_Type
and then Is_Concurrent_Record_Type (Work_Typ)
then
Work_Typ := Corresponding_Concurrent_Type (Work_Typ);
end if;
-- The working type may be subject to pragma Ghost. Set the mode now to
-- ensure that the DIC procedure is properly marked as Ghost.
Set_Ghost_Mode (Work_Typ, Mode);
-- The type must be either subject to a DIC pragma or inherit one from a
-- parent type.
pragma Assert (Has_DIC (Work_Typ));
-- Recover the type which defines the DIC pragma. This is either the
-- working type itself or a parent type when the pragma is inherited.
DIC_Typ := Find_DIC_Type (Work_Typ);
pragma Assert (Present (DIC_Typ));
DIC_Prag := Get_Pragma (DIC_Typ, Pragma_Default_Initial_Condition);
pragma Assert (Present (DIC_Prag));
-- Nothing to do if pragma DIC appears without an argument or its sole
-- argument is "null".
if not Is_Verifiable_DIC_Pragma (DIC_Prag) then
goto Leave;
-- Nothing to do if the type already has a DIC procedure
elsif Present (DIC_Procedure (Work_Typ)) then
goto Leave;
end if;
Proc_Id :=
Make_Defining_Identifier (Loc,
Chars =>
New_External_Name (Chars (Work_Typ), "Default_Initial_Condition"));
-- Perform minor decoration in case the declaration is not analyzed
Set_Ekind (Proc_Id, E_Procedure);
Set_Etype (Proc_Id, Standard_Void_Type);
Set_Scope (Proc_Id, Current_Scope);
Set_Is_DIC_Procedure (Proc_Id);
Set_DIC_Procedure (Work_Typ, Proc_Id);
-- The DIC procedure requires debug info when the assertion expression
-- is subject to Source Coverage Obligations.
if Opt.Generate_SCO then
Set_Needs_Debug_Info (Proc_Id);
end if;
-- Obtain all views of the input type
Get_Views (Work_Typ, Priv_Typ, Full_Typ, Full_Base, CRec_Typ);
-- Associate the DIC procedure and various relevant flags with all views
Propagate_DIC_Attributes (Priv_Typ, From_Typ => Work_Typ);
Propagate_DIC_Attributes (Full_Typ, From_Typ => Work_Typ);
Propagate_DIC_Attributes (Full_Base, From_Typ => Work_Typ);
Propagate_DIC_Attributes (CRec_Typ, From_Typ => Work_Typ);
-- The declaration of the DIC procedure must be inserted after the
-- declaration of the partial view as this allows for proper external
-- visibility.
if Present (Priv_Typ) then
Typ_Decl := Declaration_Node (Priv_Typ);
-- Derived types with the full view as parent do not have a partial
-- view. Insert the DIC procedure after the derived type.
else
Typ_Decl := Declaration_Node (Full_Typ);
end if;
-- The type should have a declarative node
pragma Assert (Present (Typ_Decl));
-- Create the formal parameter which emulates the variable-like behavior
-- of the type's current instance.
Obj_Id := Make_Defining_Identifier (Loc, Chars => Name_uObject);
-- Perform minor decoration in case the declaration is not analyzed
Set_Ekind (Obj_Id, E_In_Parameter);
Set_Etype (Obj_Id, Work_Typ);
Set_Scope (Obj_Id, Proc_Id);
Set_First_Entity (Proc_Id, Obj_Id);
-- Generate:
-- procedure <Work_Typ>DIC (_object : <Work_Typ>);
Proc_Decl :=
Make_Subprogram_Declaration (Loc,
Specification =>
Make_Procedure_Specification (Loc,
Defining_Unit_Name => Proc_Id,
Parameter_Specifications => New_List (
Make_Parameter_Specification (Loc,
Defining_Identifier => Obj_Id,
Parameter_Type =>
New_Occurrence_Of (Work_Typ, Loc)))));
-- The declaration should not be inserted into the tree when the context
-- is ASIS or a generic unit because it is not part of the template.
if ASIS_Mode or Inside_A_Generic then
null;
-- Semi-insert the declaration into the tree for GNATprove by setting
-- its Parent field. This allows for proper upstream tree traversals.
elsif GNATprove_Mode then
Set_Parent (Proc_Decl, Parent (Typ_Decl));
-- Otherwise insert the declaration
else
Insert_After_And_Analyze (Typ_Decl, Proc_Decl);
end if;
<<Leave>>
Restore_Ghost_Mode (Mode);
end Build_DIC_Procedure_Declaration;
--------------------------
-- Build_Procedure_Form --
--------------------------
procedure Build_Procedure_Form (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Subp : constant Entity_Id := Defining_Entity (N);
Func_Formal : Entity_Id;
Proc_Formals : List_Id;
Proc_Decl : Node_Id;
begin
-- No action needed if this transformation was already done, or in case
-- of subprogram renaming declarations.
if Nkind (Specification (N)) = N_Procedure_Specification
or else Nkind (N) = N_Subprogram_Renaming_Declaration
then
return;
end if;
-- Ditto when dealing with an expression function, where both the
-- original expression and the generated declaration end up being
-- expanded here.
if Rewritten_For_C (Subp) then
return;
end if;
Proc_Formals := New_List;
-- Create a list of formal parameters with the same types as the
-- function.
Func_Formal := First_Formal (Subp);
while Present (Func_Formal) loop
Append_To (Proc_Formals,
Make_Parameter_Specification (Loc,
Defining_Identifier =>
Make_Defining_Identifier (Loc, Chars (Func_Formal)),
Parameter_Type =>
New_Occurrence_Of (Etype (Func_Formal), Loc)));
Next_Formal (Func_Formal);
end loop;
-- Add an extra out parameter to carry the function result
Name_Len := 6;
Name_Buffer (1 .. Name_Len) := "RESULT";
Append_To (Proc_Formals,
Make_Parameter_Specification (Loc,
Defining_Identifier =>
Make_Defining_Identifier (Loc, Chars => Name_Find),
Out_Present => True,
Parameter_Type => New_Occurrence_Of (Etype (Subp), Loc)));
-- The new procedure declaration is inserted immediately after the
-- function declaration. The processing in Build_Procedure_Body_Form
-- relies on this order.
Proc_Decl :=
Make_Subprogram_Declaration (Loc,
Specification =>
Make_Procedure_Specification (Loc,
Defining_Unit_Name =>
Make_Defining_Identifier (Loc, Chars (Subp)),
Parameter_Specifications => Proc_Formals));
Insert_After_And_Analyze (Unit_Declaration_Node (Subp), Proc_Decl);
-- Entity of procedure must remain invisible so that it does not
-- overload subsequent references to the original function.
Set_Is_Immediately_Visible (Defining_Entity (Proc_Decl), False);
-- Mark the function as having a procedure form and link the function
-- and its internally built procedure.
Set_Rewritten_For_C (Subp);
Set_Corresponding_Procedure (Subp, Defining_Entity (Proc_Decl));
Set_Corresponding_Function (Defining_Entity (Proc_Decl), Subp);
end Build_Procedure_Form;
------------------------
-- Build_Runtime_Call --
------------------------
function Build_Runtime_Call (Loc : Source_Ptr; RE : RE_Id) return Node_Id is
begin
-- If entity is not available, we can skip making the call (this avoids
-- junk duplicated error messages in a number of cases).
if not RTE_Available (RE) then
return Make_Null_Statement (Loc);
else
return
Make_Procedure_Call_Statement (Loc,
Name => New_Occurrence_Of (RTE (RE), Loc));
end if;
end Build_Runtime_Call;
------------------------
-- Build_SS_Mark_Call --
------------------------
function Build_SS_Mark_Call
(Loc : Source_Ptr;
Mark : Entity_Id) return Node_Id
is
begin
-- Generate:
-- Mark : constant Mark_Id := SS_Mark;
return
Make_Object_Declaration (Loc,
Defining_Identifier => Mark,
Constant_Present => True,
Object_Definition =>
New_Occurrence_Of (RTE (RE_Mark_Id), Loc),
Expression =>
Make_Function_Call (Loc,
Name => New_Occurrence_Of (RTE (RE_SS_Mark), Loc)));
end Build_SS_Mark_Call;
---------------------------
-- Build_SS_Release_Call --
---------------------------
function Build_SS_Release_Call
(Loc : Source_Ptr;
Mark : Entity_Id) return Node_Id
is
begin
-- Generate:
-- SS_Release (Mark);
return
Make_Procedure_Call_Statement (Loc,
Name =>
New_Occurrence_Of (RTE (RE_SS_Release), Loc),
Parameter_Associations => New_List (
New_Occurrence_Of (Mark, Loc)));
end Build_SS_Release_Call;
----------------------------
-- Build_Task_Array_Image --
----------------------------
-- This function generates the body for a function that constructs the
-- image string for a task that is an array component. The function is
-- local to the init proc for the array type, and is called for each one
-- of the components. The constructed image has the form of an indexed
-- component, whose prefix is the outer variable of the array type.
-- The n-dimensional array type has known indexes Index, Index2...
-- Id_Ref is an indexed component form created by the enclosing init proc.
-- Its successive indexes are Val1, Val2, ... which are the loop variables
-- in the loops that call the individual task init proc on each component.
-- The generated function has the following structure:
-- function F return String is
-- Pref : string renames Task_Name;
-- T1 : String := Index1'Image (Val1);
-- ...
-- Tn : String := indexn'image (Valn);
-- Len : Integer := T1'Length + ... + Tn'Length + n + 1;
-- -- Len includes commas and the end parentheses.
-- Res : String (1..Len);
-- Pos : Integer := Pref'Length;
--
-- begin
-- Res (1 .. Pos) := Pref;
-- Pos := Pos + 1;
-- Res (Pos) := '(';
-- Pos := Pos + 1;
-- Res (Pos .. Pos + T1'Length - 1) := T1;
-- Pos := Pos + T1'Length;
-- Res (Pos) := '.';
-- Pos := Pos + 1;
-- ...
-- Res (Pos .. Pos + Tn'Length - 1) := Tn;
-- Res (Len) := ')';
--
-- return Res;
-- end F;
--
-- Needless to say, multidimensional arrays of tasks are rare enough that
-- the bulkiness of this code is not really a concern.
function Build_Task_Array_Image
(Loc : Source_Ptr;
Id_Ref : Node_Id;
A_Type : Entity_Id;
Dyn : Boolean := False) return Node_Id
is
Dims : constant Nat := Number_Dimensions (A_Type);
-- Number of dimensions for array of tasks
Temps : array (1 .. Dims) of Entity_Id;
-- Array of temporaries to hold string for each index
Indx : Node_Id;
-- Index expression
Len : Entity_Id;
-- Total length of generated name
Pos : Entity_Id;
-- Running index for substring assignments
Pref : constant Entity_Id := Make_Temporary (Loc, 'P');
-- Name of enclosing variable, prefix of resulting name
Res : Entity_Id;
-- String to hold result
Val : Node_Id;
-- Value of successive indexes
Sum : Node_Id;
-- Expression to compute total size of string
T : Entity_Id;
-- Entity for name at one index position
Decls : constant List_Id := New_List;
Stats : constant List_Id := New_List;
begin
-- For a dynamic task, the name comes from the target variable. For a
-- static one it is a formal of the enclosing init proc.
if Dyn then
Get_Name_String (Chars (Entity (Prefix (Id_Ref))));
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => Pref,
Object_Definition => New_Occurrence_Of (Standard_String, Loc),
Expression =>
Make_String_Literal (Loc,
Strval => String_From_Name_Buffer)));
else
Append_To (Decls,
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Pref,
Subtype_Mark => New_Occurrence_Of (Standard_String, Loc),
Name => Make_Identifier (Loc, Name_uTask_Name)));
end if;
Indx := First_Index (A_Type);
Val := First (Expressions (Id_Ref));
for J in 1 .. Dims loop
T := Make_Temporary (Loc, 'T');
Temps (J) := T;
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => T,
Object_Definition => New_Occurrence_Of (Standard_String, Loc),
Expression =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Image,
Prefix => New_Occurrence_Of (Etype (Indx), Loc),
Expressions => New_List (New_Copy_Tree (Val)))));
Next_Index (Indx);
Next (Val);
end loop;
Sum := Make_Integer_Literal (Loc, Dims + 1);
Sum :=
Make_Op_Add (Loc,
Left_Opnd => Sum,
Right_Opnd =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Length,
Prefix => New_Occurrence_Of (Pref, Loc),
Expressions => New_List (Make_Integer_Literal (Loc, 1))));
for J in 1 .. Dims loop
Sum :=
Make_Op_Add (Loc,
Left_Opnd => Sum,
Right_Opnd =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Length,
Prefix =>
New_Occurrence_Of (Temps (J), Loc),
Expressions => New_List (Make_Integer_Literal (Loc, 1))));
end loop;
Build_Task_Image_Prefix (Loc, Len, Res, Pos, Pref, Sum, Decls, Stats);
Set_Character_Literal_Name (Char_Code (Character'Pos ('(')));
Append_To (Stats,
Make_Assignment_Statement (Loc,
Name =>
Make_Indexed_Component (Loc,
Prefix => New_Occurrence_Of (Res, Loc),
Expressions => New_List (New_Occurrence_Of (Pos, Loc))),
Expression =>
Make_Character_Literal (Loc,
Chars => Name_Find,
Char_Literal_Value => UI_From_Int (Character'Pos ('(')))));
Append_To (Stats,
Make_Assignment_Statement (Loc,
Name => New_Occurrence_Of (Pos, Loc),
Expression =>
Make_Op_Add (Loc,
Left_Opnd => New_Occurrence_Of (Pos, Loc),
Right_Opnd => Make_Integer_Literal (Loc, 1))));
for J in 1 .. Dims loop
Append_To (Stats,
Make_Assignment_Statement (Loc,
Name =>
Make_Slice (Loc,
Prefix => New_Occurrence_Of (Res, Loc),
Discrete_Range =>
Make_Range (Loc,
Low_Bound => New_Occurrence_Of (Pos, Loc),
High_Bound =>
Make_Op_Subtract (Loc,
Left_Opnd =>
Make_Op_Add (Loc,
Left_Opnd => New_Occurrence_Of (Pos, Loc),
Right_Opnd =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Length,
Prefix =>
New_Occurrence_Of (Temps (J), Loc),
Expressions =>
New_List (Make_Integer_Literal (Loc, 1)))),
Right_Opnd => Make_Integer_Literal (Loc, 1)))),
Expression => New_Occurrence_Of (Temps (J), Loc)));
if J < Dims then
Append_To (Stats,
Make_Assignment_Statement (Loc,
Name => New_Occurrence_Of (Pos, Loc),
Expression =>
Make_Op_Add (Loc,
Left_Opnd => New_Occurrence_Of (Pos, Loc),
Right_Opnd =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Length,
Prefix => New_Occurrence_Of (Temps (J), Loc),
Expressions =>
New_List (Make_Integer_Literal (Loc, 1))))));
Set_Character_Literal_Name (Char_Code (Character'Pos (',')));
Append_To (Stats,
Make_Assignment_Statement (Loc,
Name => Make_Indexed_Component (Loc,
Prefix => New_Occurrence_Of (Res, Loc),
Expressions => New_List (New_Occurrence_Of (Pos, Loc))),
Expression =>
Make_Character_Literal (Loc,
Chars => Name_Find,
Char_Literal_Value => UI_From_Int (Character'Pos (',')))));
Append_To (Stats,
Make_Assignment_Statement (Loc,
Name => New_Occurrence_Of (Pos, Loc),
Expression =>
Make_Op_Add (Loc,
Left_Opnd => New_Occurrence_Of (Pos, Loc),
Right_Opnd => Make_Integer_Literal (Loc, 1))));
end if;
end loop;
Set_Character_Literal_Name (Char_Code (Character'Pos (')')));
Append_To (Stats,
Make_Assignment_Statement (Loc,
Name =>
Make_Indexed_Component (Loc,
Prefix => New_Occurrence_Of (Res, Loc),
Expressions => New_List (New_Occurrence_Of (Len, Loc))),
Expression =>
Make_Character_Literal (Loc,
Chars => Name_Find,
Char_Literal_Value => UI_From_Int (Character'Pos (')')))));
return Build_Task_Image_Function (Loc, Decls, Stats, Res);
end Build_Task_Array_Image;
----------------------------
-- Build_Task_Image_Decls --
----------------------------
function Build_Task_Image_Decls
(Loc : Source_Ptr;
Id_Ref : Node_Id;
A_Type : Entity_Id;
In_Init_Proc : Boolean := False) return List_Id
is
Decls : constant List_Id := New_List;
T_Id : Entity_Id := Empty;
Decl : Node_Id;
Expr : Node_Id := Empty;
Fun : Node_Id := Empty;
Is_Dyn : constant Boolean :=
Nkind (Parent (Id_Ref)) = N_Assignment_Statement
and then
Nkind (Expression (Parent (Id_Ref))) = N_Allocator;
begin
-- If Discard_Names or No_Implicit_Heap_Allocations are in effect,
-- generate a dummy declaration only.
if Restriction_Active (No_Implicit_Heap_Allocations)
or else Global_Discard_Names
then
T_Id := Make_Temporary (Loc, 'J');
Name_Len := 0;
return
New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => T_Id,
Object_Definition => New_Occurrence_Of (Standard_String, Loc),
Expression =>
Make_String_Literal (Loc,
Strval => String_From_Name_Buffer)));
else
if Nkind (Id_Ref) = N_Identifier
or else Nkind (Id_Ref) = N_Defining_Identifier
then
-- For a simple variable, the image of the task is built from
-- the name of the variable. To avoid possible conflict with the
-- anonymous type created for a single protected object, add a
-- numeric suffix.
T_Id :=
Make_Defining_Identifier (Loc,
New_External_Name (Chars (Id_Ref), 'T', 1));
Get_Name_String (Chars (Id_Ref));
Expr :=
Make_String_Literal (Loc,
Strval => String_From_Name_Buffer);
elsif Nkind (Id_Ref) = N_Selected_Component then
T_Id :=
Make_Defining_Identifier (Loc,
New_External_Name (Chars (Selector_Name (Id_Ref)), 'T'));
Fun := Build_Task_Record_Image (Loc, Id_Ref, Is_Dyn);
elsif Nkind (Id_Ref) = N_Indexed_Component then
T_Id :=
Make_Defining_Identifier (Loc,
New_External_Name (Chars (A_Type), 'N'));
Fun := Build_Task_Array_Image (Loc, Id_Ref, A_Type, Is_Dyn);
end if;
end if;
if Present (Fun) then
Append (Fun, Decls);
Expr := Make_Function_Call (Loc,
Name => New_Occurrence_Of (Defining_Entity (Fun), Loc));
if not In_Init_Proc then
Set_Uses_Sec_Stack (Defining_Entity (Fun));
end if;
end if;
Decl := Make_Object_Declaration (Loc,
Defining_Identifier => T_Id,
Object_Definition => New_Occurrence_Of (Standard_String, Loc),
Constant_Present => True,
Expression => Expr);
Append (Decl, Decls);
return Decls;
end Build_Task_Image_Decls;
-------------------------------
-- Build_Task_Image_Function --
-------------------------------
function Build_Task_Image_Function
(Loc : Source_Ptr;
Decls : List_Id;
Stats : List_Id;
Res : Entity_Id) return Node_Id
is
Spec : Node_Id;
begin
Append_To (Stats,
Make_Simple_Return_Statement (Loc,
Expression => New_Occurrence_Of (Res, Loc)));
Spec := Make_Function_Specification (Loc,
Defining_Unit_Name => Make_Temporary (Loc, 'F'),
Result_Definition => New_Occurrence_Of (Standard_String, Loc));
-- Calls to 'Image use the secondary stack, which must be cleaned up
-- after the task name is built.
return Make_Subprogram_Body (Loc,
Specification => Spec,
Declarations => Decls,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc, Statements => Stats));
end Build_Task_Image_Function;
-----------------------------
-- Build_Task_Image_Prefix --
-----------------------------
procedure Build_Task_Image_Prefix
(Loc : Source_Ptr;
Len : out Entity_Id;
Res : out Entity_Id;
Pos : out Entity_Id;
Prefix : Entity_Id;
Sum : Node_Id;
Decls : List_Id;
Stats : List_Id)
is
begin
Len := Make_Temporary (Loc, 'L', Sum);
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => Len,
Object_Definition => New_Occurrence_Of (Standard_Integer, Loc),
Expression => Sum));
Res := Make_Temporary (Loc, 'R');
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => Res,
Object_Definition =>
Make_Subtype_Indication (Loc,
Subtype_Mark => New_Occurrence_Of (Standard_String, Loc),
Constraint =>
Make_Index_Or_Discriminant_Constraint (Loc,
Constraints =>
New_List (
Make_Range (Loc,
Low_Bound => Make_Integer_Literal (Loc, 1),
High_Bound => New_Occurrence_Of (Len, Loc)))))));
-- Indicate that the result is an internal temporary, so it does not
-- receive a bogus initialization when declaration is expanded. This
-- is both efficient, and prevents anomalies in the handling of
-- dynamic objects on the secondary stack.
Set_Is_Internal (Res);
Pos := Make_Temporary (Loc, 'P');
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => Pos,
Object_Definition => New_Occurrence_Of (Standard_Integer, Loc)));
-- Pos := Prefix'Length;
Append_To (Stats,
Make_Assignment_Statement (Loc,
Name => New_Occurrence_Of (Pos, Loc),
Expression =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Length,
Prefix => New_Occurrence_Of (Prefix, Loc),
Expressions => New_List (Make_Integer_Literal (Loc, 1)))));
-- Res (1 .. Pos) := Prefix;
Append_To (Stats,
Make_Assignment_Statement (Loc,
Name =>
Make_Slice (Loc,
Prefix => New_Occurrence_Of (Res, Loc),
Discrete_Range =>
Make_Range (Loc,
Low_Bound => Make_Integer_Literal (Loc, 1),
High_Bound => New_Occurrence_Of (Pos, Loc))),
Expression => New_Occurrence_Of (Prefix, Loc)));
Append_To (Stats,
Make_Assignment_Statement (Loc,
Name => New_Occurrence_Of (Pos, Loc),
Expression =>
Make_Op_Add (Loc,
Left_Opnd => New_Occurrence_Of (Pos, Loc),
Right_Opnd => Make_Integer_Literal (Loc, 1))));
end Build_Task_Image_Prefix;
-----------------------------
-- Build_Task_Record_Image --
-----------------------------
function Build_Task_Record_Image
(Loc : Source_Ptr;
Id_Ref : Node_Id;
Dyn : Boolean := False) return Node_Id
is
Len : Entity_Id;
-- Total length of generated name
Pos : Entity_Id;
-- Index into result
Res : Entity_Id;
-- String to hold result
Pref : constant Entity_Id := Make_Temporary (Loc, 'P');
-- Name of enclosing variable, prefix of resulting name
Sum : Node_Id;
-- Expression to compute total size of string
Sel : Entity_Id;
-- Entity for selector name
Decls : constant List_Id := New_List;
Stats : constant List_Id := New_List;
begin
-- For a dynamic task, the name comes from the target variable. For a
-- static one it is a formal of the enclosing init proc.
if Dyn then
Get_Name_String (Chars (Entity (Prefix (Id_Ref))));
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => Pref,
Object_Definition => New_Occurrence_Of (Standard_String, Loc),
Expression =>
Make_String_Literal (Loc,
Strval => String_From_Name_Buffer)));
else
Append_To (Decls,
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Pref,
Subtype_Mark => New_Occurrence_Of (Standard_String, Loc),
Name => Make_Identifier (Loc, Name_uTask_Name)));
end if;
Sel := Make_Temporary (Loc, 'S');
Get_Name_String (Chars (Selector_Name (Id_Ref)));
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => Sel,
Object_Definition => New_Occurrence_Of (Standard_String, Loc),
Expression =>
Make_String_Literal (Loc,
Strval => String_From_Name_Buffer)));
Sum := Make_Integer_Literal (Loc, Nat (Name_Len + 1));
Sum :=
Make_Op_Add (Loc,
Left_Opnd => Sum,
Right_Opnd =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Length,
Prefix =>
New_Occurrence_Of (Pref, Loc),
Expressions => New_List (Make_Integer_Literal (Loc, 1))));
Build_Task_Image_Prefix (Loc, Len, Res, Pos, Pref, Sum, Decls, Stats);
Set_Character_Literal_Name (Char_Code (Character'Pos ('.')));
-- Res (Pos) := '.';
Append_To (Stats,
Make_Assignment_Statement (Loc,
Name => Make_Indexed_Component (Loc,
Prefix => New_Occurrence_Of (Res, Loc),
Expressions => New_List (New_Occurrence_Of (Pos, Loc))),
Expression =>
Make_Character_Literal (Loc,
Chars => Name_Find,
Char_Literal_Value =>
UI_From_Int (Character'Pos ('.')))));
Append_To (Stats,
Make_Assignment_Statement (Loc,
Name => New_Occurrence_Of (Pos, Loc),
Expression =>
Make_Op_Add (Loc,
Left_Opnd => New_Occurrence_Of (Pos, Loc),
Right_Opnd => Make_Integer_Literal (Loc, 1))));
-- Res (Pos .. Len) := Selector;
Append_To (Stats,
Make_Assignment_Statement (Loc,
Name => Make_Slice (Loc,
Prefix => New_Occurrence_Of (Res, Loc),
Discrete_Range =>
Make_Range (Loc,
Low_Bound => New_Occurrence_Of (Pos, Loc),
High_Bound => New_Occurrence_Of (Len, Loc))),
Expression => New_Occurrence_Of (Sel, Loc)));
return Build_Task_Image_Function (Loc, Decls, Stats, Res);
end Build_Task_Record_Image;
---------------------------------------
-- Build_Transient_Object_Statements --
---------------------------------------
procedure Build_Transient_Object_Statements
(Obj_Decl : Node_Id;
Fin_Call : out Node_Id;
Hook_Assign : out Node_Id;
Hook_Clear : out Node_Id;
Hook_Decl : out Node_Id;
Ptr_Decl : out Node_Id;
Finalize_Obj : Boolean := True)
is
Loc : constant Source_Ptr := Sloc (Obj_Decl);
Obj_Id : constant Entity_Id := Defining_Entity (Obj_Decl);
Obj_Typ : constant Entity_Id := Base_Type (Etype (Obj_Id));
Desig_Typ : Entity_Id;
Hook_Expr : Node_Id;
Hook_Id : Entity_Id;
Obj_Ref : Node_Id;
Ptr_Typ : Entity_Id;
begin
-- Recover the type of the object
Desig_Typ := Obj_Typ;
if Is_Access_Type (Desig_Typ) then
Desig_Typ := Available_View (Designated_Type (Desig_Typ));
end if;
-- Create an access type which provides a reference to the transient
-- object. Generate:
-- type Ptr_Typ is access all Desig_Typ;
Ptr_Typ := Make_Temporary (Loc, 'A');
Set_Ekind (Ptr_Typ, E_General_Access_Type);
Set_Directly_Designated_Type (Ptr_Typ, Desig_Typ);
Ptr_Decl :=
Make_Full_Type_Declaration (Loc,
Defining_Identifier => Ptr_Typ,
Type_Definition =>
Make_Access_To_Object_Definition (Loc,
All_Present => True,
Subtype_Indication => New_Occurrence_Of (Desig_Typ, Loc)));
-- Create a temporary check which acts as a hook to the transient
-- object. Generate:
-- Hook : Ptr_Typ := null;
Hook_Id := Make_Temporary (Loc, 'T');
Set_Ekind (Hook_Id, E_Variable);
Set_Etype (Hook_Id, Ptr_Typ);
Hook_Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Hook_Id,
Object_Definition => New_Occurrence_Of (Ptr_Typ, Loc),
Expression => Make_Null (Loc));
-- Mark the temporary as a hook. This signals the machinery in
-- Build_Finalizer to recognize this special case.
Set_Status_Flag_Or_Transient_Decl (Hook_Id, Obj_Decl);
-- Hook the transient object to the temporary. Generate:
-- Hook := Ptr_Typ (Obj_Id);
-- <or>
-- Hool := Obj_Id'Unrestricted_Access;
if Is_Access_Type (Obj_Typ) then
Hook_Expr :=
Unchecked_Convert_To (Ptr_Typ, New_Occurrence_Of (Obj_Id, Loc));
else
Hook_Expr :=
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Obj_Id, Loc),
Attribute_Name => Name_Unrestricted_Access);
end if;
Hook_Assign :=
Make_Assignment_Statement (Loc,
Name => New_Occurrence_Of (Hook_Id, Loc),
Expression => Hook_Expr);
-- Crear the hook prior to finalizing the object. Generate:
-- Hook := null;
Hook_Clear :=
Make_Assignment_Statement (Loc,
Name => New_Occurrence_Of (Hook_Id, Loc),
Expression => Make_Null (Loc));
-- Finalize the object. Generate:
-- [Deep_]Finalize (Obj_Ref[.all]);
if Finalize_Obj then
Obj_Ref := New_Occurrence_Of (Obj_Id, Loc);
if Is_Access_Type (Obj_Typ) then
Obj_Ref := Make_Explicit_Dereference (Loc, Obj_Ref);
Set_Etype (Obj_Ref, Desig_Typ);
end if;
Fin_Call :=
Make_Final_Call
(Obj_Ref => Obj_Ref,
Typ => Desig_Typ);
-- Otherwise finalize the hook. Generate:
-- [Deep_]Finalize (Hook.all);
else
Fin_Call :=
Make_Final_Call (
Obj_Ref =>
Make_Explicit_Dereference (Loc,
Prefix => New_Occurrence_Of (Hook_Id, Loc)),
Typ => Desig_Typ);
end if;
end Build_Transient_Object_Statements;
-----------------------------
-- Check_Float_Op_Overflow --
-----------------------------
procedure Check_Float_Op_Overflow (N : Node_Id) is
begin
-- Return if no check needed
if not Is_Floating_Point_Type (Etype (N))
or else not (Do_Overflow_Check (N) and then Check_Float_Overflow)
-- In CodePeer_Mode, rely on the overflow check flag being set instead
-- and do not expand the code for float overflow checking.
or else CodePeer_Mode
then
return;
end if;
-- Otherwise we replace the expression by
-- do Tnn : constant ftype := expression;
-- constraint_error when not Tnn'Valid;
-- in Tnn;
declare
Loc : constant Source_Ptr := Sloc (N);
Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', N);
Typ : constant Entity_Id := Etype (N);
begin
-- Turn off the Do_Overflow_Check flag, since we are doing that work
-- right here. We also set the node as analyzed to prevent infinite
-- recursion from repeating the operation in the expansion.
Set_Do_Overflow_Check (N, False);
Set_Analyzed (N, True);
-- Do the rewrite to include the check
Rewrite (N,
Make_Expression_With_Actions (Loc,
Actions => New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => Tnn,
Object_Definition => New_Occurrence_Of (Typ, Loc),
Constant_Present => True,
Expression => Relocate_Node (N)),
Make_Raise_Constraint_Error (Loc,
Condition =>
Make_Op_Not (Loc,
Right_Opnd =>
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Tnn, Loc),
Attribute_Name => Name_Valid)),
Reason => CE_Overflow_Check_Failed)),
Expression => New_Occurrence_Of (Tnn, Loc)));
Analyze_And_Resolve (N, Typ);
end;
end Check_Float_Op_Overflow;
----------------------------------
-- Component_May_Be_Bit_Aligned --
----------------------------------
function Component_May_Be_Bit_Aligned (Comp : Entity_Id) return Boolean is
UT : Entity_Id;
begin
-- If no component clause, then everything is fine, since the back end
-- never bit-misaligns by default, even if there is a pragma Packed for
-- the record.
if No (Comp) or else No (Component_Clause (Comp)) then
return False;
end if;
UT := Underlying_Type (Etype (Comp));
-- It is only array and record types that cause trouble
if not Is_Record_Type (UT) and then not Is_Array_Type (UT) then
return False;
-- If we know that we have a small (64 bits or less) record or small
-- bit-packed array, then everything is fine, since the back end can
-- handle these cases correctly.
elsif Esize (Comp) <= 64
and then (Is_Record_Type (UT) or else Is_Bit_Packed_Array (UT))
then
return False;
-- Otherwise if the component is not byte aligned, we know we have the
-- nasty unaligned case.
elsif Normalized_First_Bit (Comp) /= Uint_0
or else Esize (Comp) mod System_Storage_Unit /= Uint_0
then
return True;
-- If we are large and byte aligned, then OK at this level
else
return False;
end if;
end Component_May_Be_Bit_Aligned;
----------------------------------------
-- Containing_Package_With_Ext_Axioms --
----------------------------------------
function Containing_Package_With_Ext_Axioms
(E : Entity_Id) return Entity_Id
is
begin
-- E is the package or generic package which is externally axiomatized
if Ekind_In (E, E_Generic_Package, E_Package)
and then Has_Annotate_Pragma_For_External_Axiomatization (E)
then
return E;
end if;
-- If E's scope is axiomatized, E is axiomatized
if Present (Scope (E)) then
declare
First_Ax_Parent_Scope : constant Entity_Id :=
Containing_Package_With_Ext_Axioms (Scope (E));
begin
if Present (First_Ax_Parent_Scope) then
return First_Ax_Parent_Scope;
end if;
end;
end if;
-- Otherwise, if E is a package instance, it is axiomatized if the
-- corresponding generic package is axiomatized.
if Ekind (E) = E_Package then
declare
Par : constant Node_Id := Parent (E);
Decl : Node_Id;
begin
if Nkind (Par) = N_Defining_Program_Unit_Name then
Decl := Parent (Par);
else
Decl := Par;
end if;
if Present (Generic_Parent (Decl)) then
return
Containing_Package_With_Ext_Axioms (Generic_Parent (Decl));
end if;
end;
end if;
return Empty;
end Containing_Package_With_Ext_Axioms;
-------------------------------
-- Convert_To_Actual_Subtype --
-------------------------------
procedure Convert_To_Actual_Subtype (Exp : Entity_Id) is
Act_ST : Entity_Id;
begin
Act_ST := Get_Actual_Subtype (Exp);
if Act_ST = Etype (Exp) then
return;
else
Rewrite (Exp, Convert_To (Act_ST, Relocate_Node (Exp)));
Analyze_And_Resolve (Exp, Act_ST);
end if;
end Convert_To_Actual_Subtype;
-----------------------------------
-- Corresponding_Runtime_Package --
-----------------------------------
function Corresponding_Runtime_Package (Typ : Entity_Id) return RTU_Id is
function Has_One_Entry_And_No_Queue (T : Entity_Id) return Boolean;
-- Return True if protected type T has one entry and the maximum queue
-- length is one.
--------------------------------
-- Has_One_Entry_And_No_Queue --
--------------------------------
function Has_One_Entry_And_No_Queue (T : Entity_Id) return Boolean is
Item : Entity_Id;
Is_First : Boolean := True;
begin
Item := First_Entity (T);
while Present (Item) loop
if Is_Entry (Item) then
-- The protected type has more than one entry
if not Is_First then
return False;
end if;
-- The queue length is not one
if not Restriction_Active (No_Entry_Queue)
and then Get_Max_Queue_Length (Item) /= Uint_1
then
return False;
end if;
Is_First := False;
end if;
Next_Entity (Item);
end loop;
return True;
end Has_One_Entry_And_No_Queue;
-- Local variables
Pkg_Id : RTU_Id := RTU_Null;
-- Start of processing for Corresponding_Runtime_Package
begin
pragma Assert (Is_Concurrent_Type (Typ));
if Ekind (Typ) in Protected_Kind then
if Has_Entries (Typ)
-- A protected type without entries that covers an interface and
-- overrides the abstract routines with protected procedures is
-- considered equivalent to a protected type with entries in the
-- context of dispatching select statements. It is sufficient to
-- check for the presence of an interface list in the declaration
-- node to recognize this case.
or else Present (Interface_List (Parent (Typ)))
-- Protected types with interrupt handlers (when not using a
-- restricted profile) are also considered equivalent to
-- protected types with entries. The types which are used
-- (Static_Interrupt_Protection and Dynamic_Interrupt_Protection)
-- are derived from Protection_Entries.
or else (Has_Attach_Handler (Typ) and then not Restricted_Profile)
or else Has_Interrupt_Handler (Typ)
then
if Abort_Allowed
or else Restriction_Active (No_Select_Statements) = False
or else not Has_One_Entry_And_No_Queue (Typ)
or else (Has_Attach_Handler (Typ)
and then not Restricted_Profile)
then
Pkg_Id := System_Tasking_Protected_Objects_Entries;
else
Pkg_Id := System_Tasking_Protected_Objects_Single_Entry;
end if;
else
Pkg_Id := System_Tasking_Protected_Objects;
end if;
end if;
return Pkg_Id;
end Corresponding_Runtime_Package;
-----------------------------------
-- Current_Sem_Unit_Declarations --
-----------------------------------
function Current_Sem_Unit_Declarations return List_Id is
U : Node_Id := Unit (Cunit (Current_Sem_Unit));
Decls : List_Id;
begin
-- If the current unit is a package body, locate the visible
-- declarations of the package spec.
if Nkind (U) = N_Package_Body then
U := Unit (Library_Unit (Cunit (Current_Sem_Unit)));
end if;
if Nkind (U) = N_Package_Declaration then
U := Specification (U);
Decls := Visible_Declarations (U);
if No (Decls) then
Decls := New_List;
Set_Visible_Declarations (U, Decls);
end if;
else
Decls := Declarations (U);
if No (Decls) then
Decls := New_List;
Set_Declarations (U, Decls);
end if;
end if;
return Decls;
end Current_Sem_Unit_Declarations;
-----------------------
-- Duplicate_Subexpr --
-----------------------
function Duplicate_Subexpr
(Exp : Node_Id;
Name_Req : Boolean := False;
Renaming_Req : Boolean := False) return Node_Id
is
begin
Remove_Side_Effects (Exp, Name_Req, Renaming_Req);
return New_Copy_Tree (Exp);
end Duplicate_Subexpr;
---------------------------------
-- Duplicate_Subexpr_No_Checks --
---------------------------------
function Duplicate_Subexpr_No_Checks
(Exp : Node_Id;
Name_Req : Boolean := False;
Renaming_Req : Boolean := False;
Related_Id : Entity_Id := Empty;
Is_Low_Bound : Boolean := False;
Is_High_Bound : Boolean := False) return Node_Id
is
New_Exp : Node_Id;
begin
Remove_Side_Effects
(Exp => Exp,
Name_Req => Name_Req,
Renaming_Req => Renaming_Req,
Related_Id => Related_Id,
Is_Low_Bound => Is_Low_Bound,
Is_High_Bound => Is_High_Bound);
New_Exp := New_Copy_Tree (Exp);
Remove_Checks (New_Exp);
return New_Exp;
end Duplicate_Subexpr_No_Checks;
-----------------------------------
-- Duplicate_Subexpr_Move_Checks --
-----------------------------------
function Duplicate_Subexpr_Move_Checks
(Exp : Node_Id;
Name_Req : Boolean := False;
Renaming_Req : Boolean := False) return Node_Id
is
New_Exp : Node_Id;
begin
Remove_Side_Effects (Exp, Name_Req, Renaming_Req);
New_Exp := New_Copy_Tree (Exp);
Remove_Checks (Exp);
return New_Exp;
end Duplicate_Subexpr_Move_Checks;
--------------------
-- Ensure_Defined --
--------------------
procedure Ensure_Defined (Typ : Entity_Id; N : Node_Id) is
IR : Node_Id;
begin
-- An itype reference must only be created if this is a local itype, so
-- that gigi can elaborate it on the proper objstack.
if Is_Itype (Typ) and then Scope (Typ) = Current_Scope then
IR := Make_Itype_Reference (Sloc (N));
Set_Itype (IR, Typ);
Insert_Action (N, IR);
end if;
end Ensure_Defined;
-----------------
-- Entity_Hash --
-----------------
function Entity_Hash (E : Entity_Id) return Num_Primitives is
begin
return Num_Primitives (E mod Primitives_Mapping_Size);
end Entity_Hash;
--------------------
-- Entry_Names_OK --
--------------------
function Entry_Names_OK return Boolean is
begin
return
not Restricted_Profile
and then not Global_Discard_Names
and then not Restriction_Active (No_Implicit_Heap_Allocations)
and then not Restriction_Active (No_Local_Allocators);
end Entry_Names_OK;
-------------------
-- Evaluate_Name --
-------------------
procedure Evaluate_Name (Nam : Node_Id) is
K : constant Node_Kind := Nkind (Nam);
begin
-- For an explicit dereference, we simply force the evaluation of the
-- name expression. The dereference provides a value that is the address
-- for the renamed object, and it is precisely this value that we want
-- to preserve.
if K = N_Explicit_Dereference then
Force_Evaluation (Prefix (Nam));
-- For a selected component, we simply evaluate the prefix
elsif K = N_Selected_Component then
Evaluate_Name (Prefix (Nam));
-- For an indexed component, or an attribute reference, we evaluate the
-- prefix, which is itself a name, recursively, and then force the
-- evaluation of all the subscripts (or attribute expressions).
elsif Nkind_In (K, N_Indexed_Component, N_Attribute_Reference) then
Evaluate_Name (Prefix (Nam));
declare
E : Node_Id;
begin
E := First (Expressions (Nam));
while Present (E) loop
Force_Evaluation (E);
if Original_Node (E) /= E then
Set_Do_Range_Check (E, Do_Range_Check (Original_Node (E)));
end if;
Next (E);
end loop;
end;
-- For a slice, we evaluate the prefix, as for the indexed component
-- case and then, if there is a range present, either directly or as the
-- constraint of a discrete subtype indication, we evaluate the two
-- bounds of this range.
elsif K = N_Slice then
Evaluate_Name (Prefix (Nam));
Evaluate_Slice_Bounds (Nam);
-- For a type conversion, the expression of the conversion must be the
-- name of an object, and we simply need to evaluate this name.
elsif K = N_Type_Conversion then
Evaluate_Name (Expression (Nam));
-- For a function call, we evaluate the call
elsif K = N_Function_Call then
Force_Evaluation (Nam);
-- The remaining cases are direct name, operator symbol and character
-- literal. In all these cases, we do nothing, since we want to
-- reevaluate each time the renamed object is used.
else
return;
end if;
end Evaluate_Name;
---------------------------
-- Evaluate_Slice_Bounds --
---------------------------
procedure Evaluate_Slice_Bounds (Slice : Node_Id) is
DR : constant Node_Id := Discrete_Range (Slice);
Constr : Node_Id;
Rexpr : Node_Id;
begin
if Nkind (DR) = N_Range then
Force_Evaluation (Low_Bound (DR));
Force_Evaluation (High_Bound (DR));
elsif Nkind (DR) = N_Subtype_Indication then
Constr := Constraint (DR);
if Nkind (Constr) = N_Range_Constraint then
Rexpr := Range_Expression (Constr);
Force_Evaluation (Low_Bound (Rexpr));
Force_Evaluation (High_Bound (Rexpr));
end if;
end if;
end Evaluate_Slice_Bounds;
---------------------
-- Evolve_And_Then --
---------------------
procedure Evolve_And_Then (Cond : in out Node_Id; Cond1 : Node_Id) is
begin
if No (Cond) then
Cond := Cond1;
else
Cond :=
Make_And_Then (Sloc (Cond1),
Left_Opnd => Cond,
Right_Opnd => Cond1);
end if;
end Evolve_And_Then;
--------------------
-- Evolve_Or_Else --
--------------------
procedure Evolve_Or_Else (Cond : in out Node_Id; Cond1 : Node_Id) is
begin
if No (Cond) then
Cond := Cond1;
else
Cond :=
Make_Or_Else (Sloc (Cond1),
Left_Opnd => Cond,
Right_Opnd => Cond1);
end if;
end Evolve_Or_Else;
-----------------------------------------
-- Expand_Static_Predicates_In_Choices --
-----------------------------------------
procedure Expand_Static_Predicates_In_Choices (N : Node_Id) is
pragma Assert (Nkind_In (N, N_Case_Statement_Alternative, N_Variant));
Choices : constant List_Id := Discrete_Choices (N);
Choice : Node_Id;
Next_C : Node_Id;
P : Node_Id;
C : Node_Id;
begin
Choice := First (Choices);
while Present (Choice) loop
Next_C := Next (Choice);
-- Check for name of subtype with static predicate
if Is_Entity_Name (Choice)
and then Is_Type (Entity (Choice))
and then Has_Predicates (Entity (Choice))
then
-- Loop through entries in predicate list, converting to choices
-- and inserting in the list before the current choice. Note that
-- if the list is empty, corresponding to a False predicate, then
-- no choices are inserted.
P := First (Static_Discrete_Predicate (Entity (Choice)));
while Present (P) loop
-- If low bound and high bounds are equal, copy simple choice
if Expr_Value (Low_Bound (P)) = Expr_Value (High_Bound (P)) then
C := New_Copy (Low_Bound (P));
-- Otherwise copy a range
else
C := New_Copy (P);
end if;
-- Change Sloc to referencing choice (rather than the Sloc of
-- the predicate declaration element itself).
Set_Sloc (C, Sloc (Choice));
Insert_Before (Choice, C);
Next (P);
end loop;
-- Delete the predicated entry
Remove (Choice);
end if;
-- Move to next choice to check
Choice := Next_C;
end loop;
end Expand_Static_Predicates_In_Choices;
------------------------------
-- Expand_Subtype_From_Expr --
------------------------------
-- This function is applicable for both static and dynamic allocation of
-- objects which are constrained by an initial expression. Basically it
-- transforms an unconstrained subtype indication into a constrained one.
-- The expression may also be transformed in certain cases in order to
-- avoid multiple evaluation. In the static allocation case, the general
-- scheme is:
-- Val : T := Expr;
-- is transformed into
-- Val : Constrained_Subtype_of_T := Maybe_Modified_Expr;
--
-- Here are the main cases :
--
-- <if Expr is a Slice>
-- Val : T ([Index_Subtype (Expr)]) := Expr;
--
-- <elsif Expr is a String Literal>
-- Val : T (T'First .. T'First + Length (string literal) - 1) := Expr;
--
-- <elsif Expr is Constrained>
-- subtype T is Type_Of_Expr
-- Val : T := Expr;
--
-- <elsif Expr is an entity_name>
-- Val : T (constraints taken from Expr) := Expr;
--
-- <else>
-- type Axxx is access all T;
-- Rval : Axxx := Expr'ref;
-- Val : T (constraints taken from Rval) := Rval.all;
-- ??? note: when the Expression is allocated in the secondary stack
-- we could use it directly instead of copying it by declaring
-- Val : T (...) renames Rval.all
procedure Expand_Subtype_From_Expr
(N : Node_Id;
Unc_Type : Entity_Id;
Subtype_Indic : Node_Id;
Exp : Node_Id;
Related_Id : Entity_Id := Empty)
is
Loc : constant Source_Ptr := Sloc (N);
Exp_Typ : constant Entity_Id := Etype (Exp);
T : Entity_Id;
begin
-- In general we cannot build the subtype if expansion is disabled,
-- because internal entities may not have been defined. However, to
-- avoid some cascaded errors, we try to continue when the expression is
-- an array (or string), because it is safe to compute the bounds. It is
-- in fact required to do so even in a generic context, because there
-- may be constants that depend on the bounds of a string literal, both
-- standard string types and more generally arrays of characters.
-- In GNATprove mode, these extra subtypes are not needed
if GNATprove_Mode then
return;
end if;
if not Expander_Active
and then (No (Etype (Exp)) or else not Is_String_Type (Etype (Exp)))
then
return;
end if;
if Nkind (Exp) = N_Slice then
declare
Slice_Type : constant Entity_Id := Etype (First_Index (Exp_Typ));
begin
Rewrite (Subtype_Indic,
Make_Subtype_Indication (Loc,
Subtype_Mark => New_Occurrence_Of (Unc_Type, Loc),
Constraint =>
Make_Index_Or_Discriminant_Constraint (Loc,
Constraints => New_List
(New_Occurrence_Of (Slice_Type, Loc)))));
-- This subtype indication may be used later for constraint checks
-- we better make sure that if a variable was used as a bound of
-- of the original slice, its value is frozen.
Evaluate_Slice_Bounds (Exp);
end;
elsif Ekind (Exp_Typ) = E_String_Literal_Subtype then
Rewrite (Subtype_Indic,
Make_Subtype_Indication (Loc,
Subtype_Mark => New_Occurrence_Of (Unc_Type, Loc),
Constraint =>
Make_Index_Or_Discriminant_Constraint (Loc,
Constraints => New_List (
Make_Literal_Range (Loc,
Literal_Typ => Exp_Typ)))));
-- If the type of the expression is an internally generated type it
-- may not be necessary to create a new subtype. However there are two
-- exceptions: references to the current instances, and aliased array
-- object declarations for which the back end has to create a template.
elsif Is_Constrained (Exp_Typ)
and then not Is_Class_Wide_Type (Unc_Type)
and then
(Nkind (N) /= N_Object_Declaration
or else not Is_Entity_Name (Expression (N))
or else not Comes_From_Source (Entity (Expression (N)))
or else not Is_Array_Type (Exp_Typ)
or else not Aliased_Present (N))
then
if Is_Itype (Exp_Typ) then
-- Within an initialization procedure, a selected component
-- denotes a component of the enclosing record, and it appears as
-- an actual in a call to its own initialization procedure. If
-- this component depends on the outer discriminant, we must
-- generate the proper actual subtype for it.
if Nkind (Exp) = N_Selected_Component
and then Within_Init_Proc
then
declare
Decl : constant Node_Id :=
Build_Actual_Subtype_Of_Component (Exp_Typ, Exp);
begin
if Present (Decl) then
Insert_Action (N, Decl);
T := Defining_Identifier (Decl);
else
T := Exp_Typ;
end if;
end;
-- No need to generate a new subtype
else
T := Exp_Typ;
end if;
else
T := Make_Temporary (Loc, 'T');
Insert_Action (N,
Make_Subtype_Declaration (Loc,
Defining_Identifier => T,
Subtype_Indication => New_Occurrence_Of (Exp_Typ, Loc)));
-- This type is marked as an itype even though it has an explicit
-- declaration since otherwise Is_Generic_Actual_Type can get
-- set, resulting in the generation of spurious errors. (See
-- sem_ch8.Analyze_Package_Renaming and sem_type.covers)
Set_Is_Itype (T);
Set_Associated_Node_For_Itype (T, Exp);
end if;
Rewrite (Subtype_Indic, New_Occurrence_Of (T, Loc));
-- Nothing needs to be done for private types with unknown discriminants
-- if the underlying type is not an unconstrained composite type or it
-- is an unchecked union.
elsif Is_Private_Type (Unc_Type)
and then Has_Unknown_Discriminants (Unc_Type)
and then (not Is_Composite_Type (Underlying_Type (Unc_Type))
or else Is_Constrained (Underlying_Type (Unc_Type))
or else Is_Unchecked_Union (Underlying_Type (Unc_Type)))
then
null;
-- Case of derived type with unknown discriminants where the parent type
-- also has unknown discriminants.
elsif Is_Record_Type (Unc_Type)
and then not Is_Class_Wide_Type (Unc_Type)
and then Has_Unknown_Discriminants (Unc_Type)
and then Has_Unknown_Discriminants (Underlying_Type (Unc_Type))
then
-- Nothing to be done if no underlying record view available
-- If this is a limited type derived from a type with unknown
-- discriminants, do not expand either, so that subsequent expansion
-- of the call can add build-in-place parameters to call.
if No (Underlying_Record_View (Unc_Type))
or else Is_Limited_Type (Unc_Type)
then
null;
-- Otherwise use the Underlying_Record_View to create the proper
-- constrained subtype for an object of a derived type with unknown
-- discriminants.
else
Remove_Side_Effects (Exp);
Rewrite (Subtype_Indic,
Make_Subtype_From_Expr (Exp, Underlying_Record_View (Unc_Type)));
end if;
-- Renamings of class-wide interface types require no equivalent
-- constrained type declarations because we only need to reference
-- the tag component associated with the interface. The same is
-- presumably true for class-wide types in general, so this test
-- is broadened to include all class-wide renamings, which also
-- avoids cases of unbounded recursion in Remove_Side_Effects.
-- (Is this really correct, or are there some cases of class-wide
-- renamings that require action in this procedure???)
elsif Present (N)
and then Nkind (N) = N_Object_Renaming_Declaration
and then Is_Class_Wide_Type (Unc_Type)
then
null;
-- In Ada 95 nothing to be done if the type of the expression is limited
-- because in this case the expression cannot be copied, and its use can
-- only be by reference.
-- In Ada 2005 the context can be an object declaration whose expression
-- is a function that returns in place. If the nominal subtype has
-- unknown discriminants, the call still provides constraints on the
-- object, and we have to create an actual subtype from it.
-- If the type is class-wide, the expression is dynamically tagged and
-- we do not create an actual subtype either. Ditto for an interface.
-- For now this applies only if the type is immutably limited, and the
-- function being called is build-in-place. This will have to be revised
-- when build-in-place functions are generalized to other types.
elsif Is_Limited_View (Exp_Typ)
and then
(Is_Class_Wide_Type (Exp_Typ)
or else Is_Interface (Exp_Typ)
or else not Has_Unknown_Discriminants (Exp_Typ)
or else not Is_Composite_Type (Unc_Type))
then
null;
-- For limited objects initialized with build in place function calls,
-- nothing to be done; otherwise we prematurely introduce an N_Reference
-- node in the expression initializing the object, which breaks the
-- circuitry that detects and adds the additional arguments to the
-- called function.
elsif Is_Build_In_Place_Function_Call (Exp) then
null;
else
Remove_Side_Effects (Exp);
Rewrite (Subtype_Indic,
Make_Subtype_From_Expr (Exp, Unc_Type, Related_Id));
end if;
end Expand_Subtype_From_Expr;
----------------------
-- Finalize_Address --
----------------------
function Finalize_Address (Typ : Entity_Id) return Entity_Id is
Utyp : Entity_Id := Typ;
begin
-- Handle protected class-wide or task class-wide types
if Is_Class_Wide_Type (Utyp) then
if Is_Concurrent_Type (Root_Type (Utyp)) then
Utyp := Root_Type (Utyp);
elsif Is_Private_Type (Root_Type (Utyp))
and then Present (Full_View (Root_Type (Utyp)))
and then Is_Concurrent_Type (Full_View (Root_Type (Utyp)))
then
Utyp := Full_View (Root_Type (Utyp));
end if;
end if;
-- Handle private types
if Is_Private_Type (Utyp) and then Present (Full_View (Utyp)) then
Utyp := Full_View (Utyp);
end if;
-- Handle protected and task types
if Is_Concurrent_Type (Utyp)
and then Present (Corresponding_Record_Type (Utyp))
then
Utyp := Corresponding_Record_Type (Utyp);
end if;
Utyp := Underlying_Type (Base_Type (Utyp));
-- Deal with untagged derivation of private views. If the parent is
-- now known to be protected, the finalization routine is the one
-- defined on the corresponding record of the ancestor (corresponding
-- records do not automatically inherit operations, but maybe they
-- should???)
if Is_Untagged_Derivation (Typ) then
if Is_Protected_Type (Typ) then
Utyp := Corresponding_Record_Type (Root_Type (Base_Type (Typ)));
else
Utyp := Underlying_Type (Root_Type (Base_Type (Typ)));
if Is_Protected_Type (Utyp) then
Utyp := Corresponding_Record_Type (Utyp);
end if;
end if;
end if;
-- If the underlying_type is a subtype, we are dealing with the
-- completion of a private type. We need to access the base type and
-- generate a conversion to it.
if Utyp /= Base_Type (Utyp) then
pragma Assert (Is_Private_Type (Typ));
Utyp := Base_Type (Utyp);
end if;
-- When dealing with an internally built full view for a type with
-- unknown discriminants, use the original record type.
if Is_Underlying_Record_View (Utyp) then
Utyp := Etype (Utyp);
end if;
return TSS (Utyp, TSS_Finalize_Address);
end Finalize_Address;
-------------------
-- Find_DIC_Type --
-------------------
function Find_DIC_Type (Typ : Entity_Id) return Entity_Id is
Curr_Typ : Entity_Id;
-- The current type being examined in the parent hierarchy traversal
DIC_Typ : Entity_Id;
-- The type which carries the DIC pragma. This variable denotes the
-- partial view when private types are involved.
Par_Typ : Entity_Id;
-- The parent type of the current type. This variable denotes the full
-- view when private types are involved.
begin
-- The input type defines its own DIC pragma, therefore it is the owner
if Has_Own_DIC (Typ) then
DIC_Typ := Typ;
-- Otherwise the DIC pragma is inherited from a parent type
else
pragma Assert (Has_Inherited_DIC (Typ));
-- Climb the parent chain
Curr_Typ := Typ;
loop
-- Inspect the parent type. Do not consider subtypes as they
-- inherit the DIC attributes from their base types.
DIC_Typ := Base_Type (Etype (Curr_Typ));
-- Look at the full view of a private type because the type may
-- have a hidden parent introduced in the full view.
Par_Typ := DIC_Typ;
if Is_Private_Type (Par_Typ)
and then Present (Full_View (Par_Typ))
then
Par_Typ := Full_View (Par_Typ);
end if;
-- Stop the climb once the nearest parent type which defines a DIC
-- pragma of its own is encountered or when the root of the parent
-- chain is reached.
exit when Has_Own_DIC (DIC_Typ) or else Curr_Typ = Par_Typ;
Curr_Typ := Par_Typ;
end loop;
end if;
return DIC_Typ;
end Find_DIC_Type;
------------------------
-- Find_Interface_ADT --
------------------------
function Find_Interface_ADT
(T : Entity_Id;
Iface : Entity_Id) return Elmt_Id
is
ADT : Elmt_Id;
Typ : Entity_Id := T;
begin
pragma Assert (Is_Interface (Iface));
-- Handle private types
if Has_Private_Declaration (Typ) and then Present (Full_View (Typ)) then
Typ := Full_View (Typ);
end if;
-- Handle access types
if Is_Access_Type (Typ) then
Typ := Designated_Type (Typ);
end if;
-- Handle task and protected types implementing interfaces
if Is_Concurrent_Type (Typ) then
Typ := Corresponding_Record_Type (Typ);
end if;
pragma Assert
(not Is_Class_Wide_Type (Typ)
and then Ekind (Typ) /= E_Incomplete_Type);
if Is_Ancestor (Iface, Typ, Use_Full_View => True) then
return First_Elmt (Access_Disp_Table (Typ));
else
ADT := Next_Elmt (Next_Elmt (First_Elmt (Access_Disp_Table (Typ))));
while Present (ADT)
and then Present (Related_Type (Node (ADT)))
and then Related_Type (Node (ADT)) /= Iface
and then not Is_Ancestor (Iface, Related_Type (Node (ADT)),
Use_Full_View => True)
loop
Next_Elmt (ADT);
end loop;
pragma Assert (Present (Related_Type (Node (ADT))));
return ADT;
end if;
end Find_Interface_ADT;
------------------------
-- Find_Interface_Tag --
------------------------
function Find_Interface_Tag
(T : Entity_Id;
Iface : Entity_Id) return Entity_Id
is
AI_Tag : Entity_Id;
Found : Boolean := False;
Typ : Entity_Id := T;
procedure Find_Tag (Typ : Entity_Id);
-- Internal subprogram used to recursively climb to the ancestors
--------------
-- Find_Tag --
--------------
procedure Find_Tag (Typ : Entity_Id) is
AI_Elmt : Elmt_Id;
AI : Node_Id;
begin
-- This routine does not handle the case in which the interface is an
-- ancestor of Typ. That case is handled by the enclosing subprogram.
pragma Assert (Typ /= Iface);
-- Climb to the root type handling private types
if Present (Full_View (Etype (Typ))) then
if Full_View (Etype (Typ)) /= Typ then
Find_Tag (Full_View (Etype (Typ)));
end if;
elsif Etype (Typ) /= Typ then
Find_Tag (Etype (Typ));
end if;
-- Traverse the list of interfaces implemented by the type
if not Found
and then Present (Interfaces (Typ))
and then not (Is_Empty_Elmt_List (Interfaces (Typ)))
then
-- Skip the tag associated with the primary table
pragma Assert (Etype (First_Tag_Component (Typ)) = RTE (RE_Tag));
AI_Tag := Next_Tag_Component (First_Tag_Component (Typ));
pragma Assert (Present (AI_Tag));
AI_Elmt := First_Elmt (Interfaces (Typ));
while Present (AI_Elmt) loop
AI := Node (AI_Elmt);
if AI = Iface
or else Is_Ancestor (Iface, AI, Use_Full_View => True)
then
Found := True;
return;
end if;
AI_Tag := Next_Tag_Component (AI_Tag);
Next_Elmt (AI_Elmt);
end loop;
end if;
end Find_Tag;
-- Start of processing for Find_Interface_Tag
begin
pragma Assert (Is_Interface (Iface));
-- Handle access types
if Is_Access_Type (Typ) then
Typ := Designated_Type (Typ);
end if;
-- Handle class-wide types
if Is_Class_Wide_Type (Typ) then
Typ := Root_Type (Typ);
end if;
-- Handle private types
if Has_Private_Declaration (Typ) and then Present (Full_View (Typ)) then
Typ := Full_View (Typ);
end if;
-- Handle entities from the limited view
if Ekind (Typ) = E_Incomplete_Type then
pragma Assert (Present (Non_Limited_View (Typ)));
Typ := Non_Limited_View (Typ);
end if;
-- Handle task and protected types implementing interfaces
if Is_Concurrent_Type (Typ) then
Typ := Corresponding_Record_Type (Typ);
end if;
-- If the interface is an ancestor of the type, then it shared the
-- primary dispatch table.
if Is_Ancestor (Iface, Typ, Use_Full_View => True) then
pragma Assert (Etype (First_Tag_Component (Typ)) = RTE (RE_Tag));
return First_Tag_Component (Typ);
-- Otherwise we need to search for its associated tag component
else
Find_Tag (Typ);
pragma Assert (Found);
return AI_Tag;
end if;
end Find_Interface_Tag;
---------------------------
-- Find_Optional_Prim_Op --
---------------------------
function Find_Optional_Prim_Op
(T : Entity_Id; Name : Name_Id) return Entity_Id
is
Prim : Elmt_Id;
Typ : Entity_Id := T;
Op : Entity_Id;
begin
if Is_Class_Wide_Type (Typ) then
Typ := Root_Type (Typ);
end if;
Typ := Underlying_Type (Typ);
-- Loop through primitive operations
Prim := First_Elmt (Primitive_Operations (Typ));
while Present (Prim) loop
Op := Node (Prim);
-- We can retrieve primitive operations by name if it is an internal
-- name. For equality we must check that both of its operands have
-- the same type, to avoid confusion with user-defined equalities
-- than may have a non-symmetric signature.
exit when Chars (Op) = Name
and then
(Name /= Name_Op_Eq
or else Etype (First_Formal (Op)) = Etype (Last_Formal (Op)));
Next_Elmt (Prim);
end loop;
return Node (Prim); -- Empty if not found
end Find_Optional_Prim_Op;
---------------------------
-- Find_Optional_Prim_Op --
---------------------------
function Find_Optional_Prim_Op
(T : Entity_Id;
Name : TSS_Name_Type) return Entity_Id
is
Inher_Op : Entity_Id := Empty;
Own_Op : Entity_Id := Empty;
Prim_Elmt : Elmt_Id;
Prim_Id : Entity_Id;
Typ : Entity_Id := T;
begin
if Is_Class_Wide_Type (Typ) then
Typ := Root_Type (Typ);
end if;
Typ := Underlying_Type (Typ);
-- This search is based on the assertion that the dispatching version
-- of the TSS routine always precedes the real primitive.
Prim_Elmt := First_Elmt (Primitive_Operations (Typ));
while Present (Prim_Elmt) loop
Prim_Id := Node (Prim_Elmt);
if Is_TSS (Prim_Id, Name) then
if Present (Alias (Prim_Id)) then
Inher_Op := Prim_Id;
else
Own_Op := Prim_Id;
end if;
end if;
Next_Elmt (Prim_Elmt);
end loop;
if Present (Own_Op) then
return Own_Op;
elsif Present (Inher_Op) then
return Inher_Op;
else
return Empty;
end if;
end Find_Optional_Prim_Op;
------------------
-- Find_Prim_Op --
------------------
function Find_Prim_Op
(T : Entity_Id; Name : Name_Id) return Entity_Id
is
Result : constant Entity_Id := Find_Optional_Prim_Op (T, Name);
begin
if No (Result) then
raise Program_Error;
end if;
return Result;
end Find_Prim_Op;
------------------
-- Find_Prim_Op --
------------------
function Find_Prim_Op
(T : Entity_Id;
Name : TSS_Name_Type) return Entity_Id
is
Result : constant Entity_Id := Find_Optional_Prim_Op (T, Name);
begin
if No (Result) then
raise Program_Error;
end if;
return Result;
end Find_Prim_Op;
----------------------------
-- Find_Protection_Object --
----------------------------
function Find_Protection_Object (Scop : Entity_Id) return Entity_Id is
S : Entity_Id;
begin
S := Scop;
while Present (S) loop
if Ekind_In (S, E_Entry, E_Entry_Family, E_Function, E_Procedure)
and then Present (Protection_Object (S))
then
return Protection_Object (S);
end if;
S := Scope (S);
end loop;
-- If we do not find a Protection object in the scope chain, then
-- something has gone wrong, most likely the object was never created.
raise Program_Error;
end Find_Protection_Object;
--------------------------
-- Find_Protection_Type --
--------------------------
function Find_Protection_Type (Conc_Typ : Entity_Id) return Entity_Id is
Comp : Entity_Id;
Typ : Entity_Id := Conc_Typ;
begin
if Is_Concurrent_Type (Typ) then
Typ := Corresponding_Record_Type (Typ);
end if;
-- Since restriction violations are not considered serious errors, the
-- expander remains active, but may leave the corresponding record type
-- malformed. In such cases, component _object is not available so do
-- not look for it.
if not Analyzed (Typ) then
return Empty;
end if;
Comp := First_Component (Typ);
while Present (Comp) loop
if Chars (Comp) = Name_uObject then
return Base_Type (Etype (Comp));
end if;
Next_Component (Comp);
end loop;
-- The corresponding record of a protected type should always have an
-- _object field.
raise Program_Error;
end Find_Protection_Type;
-----------------------
-- Find_Hook_Context --
-----------------------
function Find_Hook_Context (N : Node_Id) return Node_Id is
Par : Node_Id;
Top : Node_Id;
Wrapped_Node : Node_Id;
-- Note: if we are in a transient scope, we want to reuse it as
-- the context for actions insertion, if possible. But if N is itself
-- part of the stored actions for the current transient scope,
-- then we need to insert at the appropriate (inner) location in
-- the not as an action on Node_To_Be_Wrapped.
In_Cond_Expr : constant Boolean := Within_Case_Or_If_Expression (N);
begin
-- When the node is inside a case/if expression, the lifetime of any
-- temporary controlled object is extended. Find a suitable insertion
-- node by locating the topmost case or if expressions.
if In_Cond_Expr then
Par := N;
Top := N;
while Present (Par) loop
if Nkind_In (Original_Node (Par), N_Case_Expression,
N_If_Expression)
then
Top := Par;
-- Prevent the search from going too far
elsif Is_Body_Or_Package_Declaration (Par) then
exit;
end if;
Par := Parent (Par);
end loop;
-- The topmost case or if expression is now recovered, but it may
-- still not be the correct place to add generated code. Climb to
-- find a parent that is part of a declarative or statement list,
-- and is not a list of actuals in a call.
Par := Top;
while Present (Par) loop
if Is_List_Member (Par)
and then not Nkind_In (Par, N_Component_Association,
N_Discriminant_Association,
N_Parameter_Association,
N_Pragma_Argument_Association)
and then not Nkind_In (Parent (Par), N_Function_Call,
N_Procedure_Call_Statement,
N_Entry_Call_Statement)
then
return Par;
-- Prevent the search from going too far
elsif Is_Body_Or_Package_Declaration (Par) then
exit;
end if;
Par := Parent (Par);
end loop;
return Par;
else
Par := N;
while Present (Par) loop
-- Keep climbing past various operators
if Nkind (Parent (Par)) in N_Op
or else Nkind_In (Parent (Par), N_And_Then, N_Or_Else)
then
Par := Parent (Par);
else
exit;
end if;
end loop;
Top := Par;
-- The node may be located in a pragma in which case return the
-- pragma itself:
-- pragma Precondition (... and then Ctrl_Func_Call ...);
-- Similar case occurs when the node is related to an object
-- declaration or assignment:
-- Obj [: Some_Typ] := ... and then Ctrl_Func_Call ...;
-- Another case to consider is when the node is part of a return
-- statement:
-- return ... and then Ctrl_Func_Call ...;
-- Another case is when the node acts as a formal in a procedure
-- call statement:
-- Proc (... and then Ctrl_Func_Call ...);
if Scope_Is_Transient then
Wrapped_Node := Node_To_Be_Wrapped;
else
Wrapped_Node := Empty;
end if;
while Present (Par) loop
if Par = Wrapped_Node
or else Nkind_In (Par, N_Assignment_Statement,
N_Object_Declaration,
N_Pragma,
N_Procedure_Call_Statement,
N_Simple_Return_Statement)
then
return Par;
-- Prevent the search from going too far
elsif Is_Body_Or_Package_Declaration (Par) then
exit;
end if;
Par := Parent (Par);
end loop;
-- Return the topmost short circuit operator
return Top;
end if;
end Find_Hook_Context;
------------------------------
-- Following_Address_Clause --
------------------------------
function Following_Address_Clause (D : Node_Id) return Node_Id is
Id : constant Entity_Id := Defining_Identifier (D);
Result : Node_Id;
Par : Node_Id;
function Check_Decls (D : Node_Id) return Node_Id;
-- This internal function differs from the main function in that it
-- gets called to deal with a following package private part, and
-- it checks declarations starting with D (the main function checks
-- declarations following D). If D is Empty, then Empty is returned.
-----------------
-- Check_Decls --
-----------------
function Check_Decls (D : Node_Id) return Node_Id is
Decl : Node_Id;
begin
Decl := D;
while Present (Decl) loop
if Nkind (Decl) = N_At_Clause
and then Chars (Identifier (Decl)) = Chars (Id)
then
return Decl;
elsif Nkind (Decl) = N_Attribute_Definition_Clause
and then Chars (Decl) = Name_Address
and then Chars (Name (Decl)) = Chars (Id)
then
return Decl;
end if;
Next (Decl);
end loop;
-- Otherwise not found, return Empty
return Empty;
end Check_Decls;
-- Start of processing for Following_Address_Clause
begin
-- If parser detected no address clause for the identifier in question,
-- then the answer is a quick NO, without the need for a search.
if not Get_Name_Table_Boolean1 (Chars (Id)) then
return Empty;
end if;
-- Otherwise search current declarative unit
Result := Check_Decls (Next (D));
if Present (Result) then
return Result;
end if;
-- Check for possible package private part following
Par := Parent (D);
if Nkind (Par) = N_Package_Specification
and then Visible_Declarations (Par) = List_Containing (D)
and then Present (Private_Declarations (Par))
then
-- Private part present, check declarations there
return Check_Decls (First (Private_Declarations (Par)));
else
-- No private part, clause not found, return Empty
return Empty;
end if;
end Following_Address_Clause;
----------------------
-- Force_Evaluation --
----------------------
procedure Force_Evaluation
(Exp : Node_Id;
Name_Req : Boolean := False;
Related_Id : Entity_Id := Empty;
Is_Low_Bound : Boolean := False;
Is_High_Bound : Boolean := False;
Mode : Force_Evaluation_Mode := Relaxed)
is
begin
Remove_Side_Effects
(Exp => Exp,
Name_Req => Name_Req,
Variable_Ref => True,
Renaming_Req => False,
Related_Id => Related_Id,
Is_Low_Bound => Is_Low_Bound,
Is_High_Bound => Is_High_Bound,
Check_Side_Effects =>
Is_Static_Expression (Exp)
or else Mode = Relaxed);
end Force_Evaluation;
---------------------------------
-- Fully_Qualified_Name_String --
---------------------------------
function Fully_Qualified_Name_String
(E : Entity_Id;
Append_NUL : Boolean := True) return String_Id
is
procedure Internal_Full_Qualified_Name (E : Entity_Id);
-- Compute recursively the qualified name without NUL at the end, adding
-- it to the currently started string being generated
----------------------------------
-- Internal_Full_Qualified_Name --
----------------------------------
procedure Internal_Full_Qualified_Name (E : Entity_Id) is
Ent : Entity_Id;
begin
-- Deal properly with child units
if Nkind (E) = N_Defining_Program_Unit_Name then
Ent := Defining_Identifier (E);
else
Ent := E;
end if;
-- Compute qualification recursively (only "Standard" has no scope)
if Present (Scope (Scope (Ent))) then
Internal_Full_Qualified_Name (Scope (Ent));
Store_String_Char (Get_Char_Code ('.'));
end if;
-- Every entity should have a name except some expanded blocks
-- don't bother about those.
if Chars (Ent) = No_Name then
return;
end if;
-- Generates the entity name in upper case
Get_Decoded_Name_String (Chars (Ent));
Set_All_Upper_Case;
Store_String_Chars (Name_Buffer (1 .. Name_Len));
return;
end Internal_Full_Qualified_Name;
-- Start of processing for Full_Qualified_Name
begin
Start_String;
Internal_Full_Qualified_Name (E);
if Append_NUL then
Store_String_Char (Get_Char_Code (ASCII.NUL));
end if;
return End_String;
end Fully_Qualified_Name_String;
------------------------
-- Generate_Poll_Call --
------------------------
procedure Generate_Poll_Call (N : Node_Id) is
begin
-- No poll call if polling not active
if not Polling_Required then
return;
-- Otherwise generate require poll call
else
Insert_Before_And_Analyze (N,
Make_Procedure_Call_Statement (Sloc (N),
Name => New_Occurrence_Of (RTE (RE_Poll), Sloc (N))));
end if;
end Generate_Poll_Call;
---------------------------------
-- Get_Current_Value_Condition --
---------------------------------
-- Note: the implementation of this procedure is very closely tied to the
-- implementation of Set_Current_Value_Condition. In the Get procedure, we
-- interpret Current_Value fields set by the Set procedure, so the two
-- procedures need to be closely coordinated.
procedure Get_Current_Value_Condition
(Var : Node_Id;
Op : out Node_Kind;
Val : out Node_Id)
is
Loc : constant Source_Ptr := Sloc (Var);
Ent : constant Entity_Id := Entity (Var);
procedure Process_Current_Value_Condition
(N : Node_Id;
S : Boolean);
-- N is an expression which holds either True (S = True) or False (S =
-- False) in the condition. This procedure digs out the expression and
-- if it refers to Ent, sets Op and Val appropriately.
-------------------------------------
-- Process_Current_Value_Condition --
-------------------------------------
procedure Process_Current_Value_Condition
(N : Node_Id;
S : Boolean)
is
Cond : Node_Id;
Prev_Cond : Node_Id;
Sens : Boolean;
begin
Cond := N;
Sens := S;
loop
Prev_Cond := Cond;
-- Deal with NOT operators, inverting sense
while Nkind (Cond) = N_Op_Not loop
Cond := Right_Opnd (Cond);
Sens := not Sens;
end loop;
-- Deal with conversions, qualifications, and expressions with
-- actions.
while Nkind_In (Cond,
N_Type_Conversion,
N_Qualified_Expression,
N_Expression_With_Actions)
loop
Cond := Expression (Cond);
end loop;
exit when Cond = Prev_Cond;
end loop;
-- Deal with AND THEN and AND cases
if Nkind_In (Cond, N_And_Then, N_Op_And) then
-- Don't ever try to invert a condition that is of the form of an
-- AND or AND THEN (since we are not doing sufficiently general
-- processing to allow this).
if Sens = False then
Op := N_Empty;
Val := Empty;
return;
end if;
-- Recursively process AND and AND THEN branches
Process_Current_Value_Condition (Left_Opnd (Cond), True);
if Op /= N_Empty then
return;
end if;
Process_Current_Value_Condition (Right_Opnd (Cond), True);
return;
-- Case of relational operator
elsif Nkind (Cond) in N_Op_Compare then
Op := Nkind (Cond);
-- Invert sense of test if inverted test
if Sens = False then
case Op is
when N_Op_Eq => Op := N_Op_Ne;
when N_Op_Ne => Op := N_Op_Eq;
when N_Op_Lt => Op := N_Op_Ge;
when N_Op_Gt => Op := N_Op_Le;
when N_Op_Le => Op := N_Op_Gt;
when N_Op_Ge => Op := N_Op_Lt;
when others => raise Program_Error;
end case;
end if;
-- Case of entity op value
if Is_Entity_Name (Left_Opnd (Cond))
and then Ent = Entity (Left_Opnd (Cond))
and then Compile_Time_Known_Value (Right_Opnd (Cond))
then
Val := Right_Opnd (Cond);
-- Case of value op entity
elsif Is_Entity_Name (Right_Opnd (Cond))
and then Ent = Entity (Right_Opnd (Cond))
and then Compile_Time_Known_Value (Left_Opnd (Cond))
then
Val := Left_Opnd (Cond);
-- We are effectively swapping operands
case Op is
when N_Op_Eq => null;
when N_Op_Ne => null;
when N_Op_Lt => Op := N_Op_Gt;
when N_Op_Gt => Op := N_Op_Lt;
when N_Op_Le => Op := N_Op_Ge;
when N_Op_Ge => Op := N_Op_Le;
when others => raise Program_Error;
end case;
else
Op := N_Empty;
end if;
return;
elsif Nkind_In (Cond,
N_Type_Conversion,
N_Qualified_Expression,
N_Expression_With_Actions)
then
Cond := Expression (Cond);
-- Case of Boolean variable reference, return as though the
-- reference had said var = True.
else
if Is_Entity_Name (Cond) and then Ent = Entity (Cond) then
Val := New_Occurrence_Of (Standard_True, Sloc (Cond));
if Sens = False then
Op := N_Op_Ne;
else
Op := N_Op_Eq;
end if;
end if;
end if;
end Process_Current_Value_Condition;
-- Start of processing for Get_Current_Value_Condition
begin
Op := N_Empty;
Val := Empty;
-- Immediate return, nothing doing, if this is not an object
if Ekind (Ent) not in Object_Kind then
return;
end if;
-- Otherwise examine current value
declare
CV : constant Node_Id := Current_Value (Ent);
Sens : Boolean;
Stm : Node_Id;
begin
-- If statement. Condition is known true in THEN section, known False
-- in any ELSIF or ELSE part, and unknown outside the IF statement.
if Nkind (CV) = N_If_Statement then
-- Before start of IF statement
if Loc < Sloc (CV) then
return;
-- After end of IF statement
elsif Loc >= Sloc (CV) + Text_Ptr (UI_To_Int (End_Span (CV))) then
return;
end if;
-- At this stage we know that we are within the IF statement, but
-- unfortunately, the tree does not record the SLOC of the ELSE so
-- we cannot use a simple SLOC comparison to distinguish between
-- the then/else statements, so we have to climb the tree.
declare
N : Node_Id;
begin
N := Parent (Var);
while Parent (N) /= CV loop
N := Parent (N);
-- If we fall off the top of the tree, then that's odd, but
-- perhaps it could occur in some error situation, and the
-- safest response is simply to assume that the outcome of
-- the condition is unknown. No point in bombing during an
-- attempt to optimize things.
if No (N) then
return;
end if;
end loop;
-- Now we have N pointing to a node whose parent is the IF
-- statement in question, so now we can tell if we are within
-- the THEN statements.
if Is_List_Member (N)
and then List_Containing (N) = Then_Statements (CV)
then
Sens := True;
-- If the variable reference does not come from source, we
-- cannot reliably tell whether it appears in the else part.
-- In particular, if it appears in generated code for a node
-- that requires finalization, it may be attached to a list
-- that has not been yet inserted into the code. For now,
-- treat it as unknown.
elsif not Comes_From_Source (N) then
return;
-- Otherwise we must be in ELSIF or ELSE part
else
Sens := False;
end if;
end;
-- ELSIF part. Condition is known true within the referenced
-- ELSIF, known False in any subsequent ELSIF or ELSE part,
-- and unknown before the ELSE part or after the IF statement.
elsif Nkind (CV) = N_Elsif_Part then
-- if the Elsif_Part had condition_actions, the elsif has been
-- rewritten as a nested if, and the original elsif_part is
-- detached from the tree, so there is no way to obtain useful
-- information on the current value of the variable.
-- Can this be improved ???
if No (Parent (CV)) then
return;
end if;
Stm := Parent (CV);
-- If the tree has been otherwise rewritten there is nothing
-- else to be done either.
if Nkind (Stm) /= N_If_Statement then
return;
end if;
-- Before start of ELSIF part
if Loc < Sloc (CV) then
return;
-- After end of IF statement
elsif Loc >= Sloc (Stm) +
Text_Ptr (UI_To_Int (End_Span (Stm)))
then
return;
end if;
-- Again we lack the SLOC of the ELSE, so we need to climb the
-- tree to see if we are within the ELSIF part in question.
declare
N : Node_Id;
begin
N := Parent (Var);
while Parent (N) /= Stm loop
N := Parent (N);
-- If we fall off the top of the tree, then that's odd, but
-- perhaps it could occur in some error situation, and the
-- safest response is simply to assume that the outcome of
-- the condition is unknown. No point in bombing during an
-- attempt to optimize things.
if No (N) then
return;
end if;
end loop;
-- Now we have N pointing to a node whose parent is the IF
-- statement in question, so see if is the ELSIF part we want.
-- the THEN statements.
if N = CV then
Sens := True;
-- Otherwise we must be in subsequent ELSIF or ELSE part
else
Sens := False;
end if;
end;
-- Iteration scheme of while loop. The condition is known to be
-- true within the body of the loop.
elsif Nkind (CV) = N_Iteration_Scheme then
declare
Loop_Stmt : constant Node_Id := Parent (CV);
begin
-- Before start of body of loop
if Loc < Sloc (Loop_Stmt) then
return;
-- After end of LOOP statement
elsif Loc >= Sloc (End_Label (Loop_Stmt)) then
return;
-- We are within the body of the loop
else
Sens := True;
end if;
end;
-- All other cases of Current_Value settings
else
return;
end if;
-- If we fall through here, then we have a reportable condition, Sens
-- is True if the condition is true and False if it needs inverting.
Process_Current_Value_Condition (Condition (CV), Sens);
end;
end Get_Current_Value_Condition;
---------------------
-- Get_Stream_Size --
---------------------
function Get_Stream_Size (E : Entity_Id) return Uint is
begin
-- If we have a Stream_Size clause for this type use it
if Has_Stream_Size_Clause (E) then
return Static_Integer (Expression (Stream_Size_Clause (E)));
-- Otherwise the Stream_Size if the size of the type
else
return Esize (E);
end if;
end Get_Stream_Size;
---------------------------
-- Has_Access_Constraint --
---------------------------
function Has_Access_Constraint (E : Entity_Id) return Boolean is
Disc : Entity_Id;
T : constant Entity_Id := Etype (E);
begin
if Has_Per_Object_Constraint (E) and then Has_Discriminants (T) then
Disc := First_Discriminant (T);
while Present (Disc) loop
if Is_Access_Type (Etype (Disc)) then
return True;
end if;
Next_Discriminant (Disc);
end loop;
return False;
else
return False;
end if;
end Has_Access_Constraint;
-----------------------------------------------------
-- Has_Annotate_Pragma_For_External_Axiomatization --
-----------------------------------------------------
function Has_Annotate_Pragma_For_External_Axiomatization
(E : Entity_Id) return Boolean
is
function Is_Annotate_Pragma_For_External_Axiomatization
(N : Node_Id) return Boolean;
-- Returns whether N is
-- pragma Annotate (GNATprove, External_Axiomatization);
----------------------------------------------------
-- Is_Annotate_Pragma_For_External_Axiomatization --
----------------------------------------------------
-- The general form of pragma Annotate is
-- pragma Annotate (IDENTIFIER [, IDENTIFIER {, ARG}]);
-- ARG ::= NAME | EXPRESSION
-- The first two arguments are by convention intended to refer to an
-- external tool and a tool-specific function. These arguments are
-- not analyzed.
-- The following is used to annotate a package specification which
-- GNATprove should treat specially, because the axiomatization of
-- this unit is given by the user instead of being automatically
-- generated.
-- pragma Annotate (GNATprove, External_Axiomatization);
function Is_Annotate_Pragma_For_External_Axiomatization
(N : Node_Id) return Boolean
is
Name_GNATprove : constant String :=
"gnatprove";
Name_External_Axiomatization : constant String :=
"external_axiomatization";
-- Special names
begin
if Nkind (N) = N_Pragma
and then Get_Pragma_Id (N) = Pragma_Annotate
and then List_Length (Pragma_Argument_Associations (N)) = 2
then
declare
Arg1 : constant Node_Id :=
First (Pragma_Argument_Associations (N));
Arg2 : constant Node_Id := Next (Arg1);
Nam1 : Name_Id;
Nam2 : Name_Id;
begin
-- Fill in Name_Buffer with Name_GNATprove first, and then with
-- Name_External_Axiomatization so that Name_Find returns the
-- corresponding name. This takes care of all possible casings.
Name_Len := 0;
Add_Str_To_Name_Buffer (Name_GNATprove);
Nam1 := Name_Find;
Name_Len := 0;
Add_Str_To_Name_Buffer (Name_External_Axiomatization);
Nam2 := Name_Find;
return Chars (Get_Pragma_Arg (Arg1)) = Nam1
and then
Chars (Get_Pragma_Arg (Arg2)) = Nam2;
end;
else
return False;
end if;
end Is_Annotate_Pragma_For_External_Axiomatization;
-- Local variables
Decl : Node_Id;
Vis_Decls : List_Id;
N : Node_Id;
-- Start of processing for Has_Annotate_Pragma_For_External_Axiomatization
begin
if Nkind (Parent (E)) = N_Defining_Program_Unit_Name then
Decl := Parent (Parent (E));
else
Decl := Parent (E);
end if;
Vis_Decls := Visible_Declarations (Decl);
N := First (Vis_Decls);
while Present (N) loop
-- Skip declarations generated by the frontend. Skip all pragmas
-- that are not the desired Annotate pragma. Stop the search on
-- the first non-pragma source declaration.
if Comes_From_Source (N) then
if Nkind (N) = N_Pragma then
if Is_Annotate_Pragma_For_External_Axiomatization (N) then
return True;
end if;
else
return False;
end if;
end if;
Next (N);
end loop;
return False;
end Has_Annotate_Pragma_For_External_Axiomatization;
--------------------
-- Homonym_Number --
--------------------
function Homonym_Number (Subp : Entity_Id) return Nat is
Count : Nat;
Hom : Entity_Id;
begin
Count := 1;
Hom := Homonym (Subp);
while Present (Hom) loop
if Scope (Hom) = Scope (Subp) then
Count := Count + 1;
end if;
Hom := Homonym (Hom);
end loop;
return Count;
end Homonym_Number;
-----------------------------------
-- In_Library_Level_Package_Body --
-----------------------------------
function In_Library_Level_Package_Body (Id : Entity_Id) return Boolean is
begin
-- First determine whether the entity appears at the library level, then
-- look at the containing unit.
if Is_Library_Level_Entity (Id) then
declare
Container : constant Node_Id := Cunit (Get_Source_Unit (Id));
begin
return Nkind (Unit (Container)) = N_Package_Body;
end;
end if;
return False;
end In_Library_Level_Package_Body;
------------------------------
-- In_Unconditional_Context --
------------------------------
function In_Unconditional_Context (Node : Node_Id) return Boolean is
P : Node_Id;
begin
P := Node;
while Present (P) loop
case Nkind (P) is
when N_Subprogram_Body => return True;
when N_If_Statement => return False;
when N_Loop_Statement => return False;
when N_Case_Statement => return False;
when others => P := Parent (P);
end case;
end loop;
return False;
end In_Unconditional_Context;
-------------------
-- Insert_Action --
-------------------
procedure Insert_Action (Assoc_Node : Node_Id; Ins_Action : Node_Id) is
begin
if Present (Ins_Action) then
Insert_Actions (Assoc_Node, New_List (Ins_Action));
end if;
end Insert_Action;
-- Version with check(s) suppressed
procedure Insert_Action
(Assoc_Node : Node_Id; Ins_Action : Node_Id; Suppress : Check_Id)
is
begin
Insert_Actions (Assoc_Node, New_List (Ins_Action), Suppress);
end Insert_Action;
-------------------------
-- Insert_Action_After --
-------------------------
procedure Insert_Action_After
(Assoc_Node : Node_Id;
Ins_Action : Node_Id)
is
begin
Insert_Actions_After (Assoc_Node, New_List (Ins_Action));
end Insert_Action_After;
--------------------
-- Insert_Actions --
--------------------
procedure Insert_Actions (Assoc_Node : Node_Id; Ins_Actions : List_Id) is
N : Node_Id;
P : Node_Id;
Wrapped_Node : Node_Id := Empty;
begin
if No (Ins_Actions) or else Is_Empty_List (Ins_Actions) then
return;
end if;
-- Ignore insert of actions from inside default expression (or other
-- similar "spec expression") in the special spec-expression analyze
-- mode. Any insertions at this point have no relevance, since we are
-- only doing the analyze to freeze the types of any static expressions.
-- See section "Handling of Default Expressions" in the spec of package
-- Sem for further details.
if In_Spec_Expression then
return;
end if;
-- If the action derives from stuff inside a record, then the actions
-- are attached to the current scope, to be inserted and analyzed on
-- exit from the scope. The reason for this is that we may also be
-- generating freeze actions at the same time, and they must eventually
-- be elaborated in the correct order.
if Is_Record_Type (Current_Scope)
and then not Is_Frozen (Current_Scope)
then
if No (Scope_Stack.Table
(Scope_Stack.Last).Pending_Freeze_Actions)
then
Scope_Stack.Table (Scope_Stack.Last).Pending_Freeze_Actions :=
Ins_Actions;
else
Append_List
(Ins_Actions,
Scope_Stack.Table (Scope_Stack.Last).Pending_Freeze_Actions);
end if;
return;
end if;
-- We now intend to climb up the tree to find the right point to
-- insert the actions. We start at Assoc_Node, unless this node is a
-- subexpression in which case we start with its parent. We do this for
-- two reasons. First it speeds things up. Second, if Assoc_Node is
-- itself one of the special nodes like N_And_Then, then we assume that
-- an initial request to insert actions for such a node does not expect
-- the actions to get deposited in the node for later handling when the
-- node is expanded, since clearly the node is being dealt with by the
-- caller. Note that in the subexpression case, N is always the child we
-- came from.
-- N_Raise_xxx_Error is an annoying special case, it is a statement
-- if it has type Standard_Void_Type, and a subexpression otherwise.
-- Procedure calls, and similarly procedure attribute references, are
-- also statements.
if Nkind (Assoc_Node) in N_Subexpr
and then (Nkind (Assoc_Node) not in N_Raise_xxx_Error
or else Etype (Assoc_Node) /= Standard_Void_Type)
and then Nkind (Assoc_Node) /= N_Procedure_Call_Statement
and then (Nkind (Assoc_Node) /= N_Attribute_Reference
or else not Is_Procedure_Attribute_Name
(Attribute_Name (Assoc_Node)))
then
N := Assoc_Node;
P := Parent (Assoc_Node);
-- Non-subexpression case. Note that N is initially Empty in this case
-- (N is only guaranteed Non-Empty in the subexpr case).
else
N := Empty;
P := Assoc_Node;
end if;
-- Capture root of the transient scope
if Scope_Is_Transient then
Wrapped_Node := Node_To_Be_Wrapped;
end if;
loop
pragma Assert (Present (P));
-- Make sure that inserted actions stay in the transient scope
if Present (Wrapped_Node) and then N = Wrapped_Node then
Store_Before_Actions_In_Scope (Ins_Actions);
return;
end if;
case Nkind (P) is
-- Case of right operand of AND THEN or OR ELSE. Put the actions
-- in the Actions field of the right operand. They will be moved
-- out further when the AND THEN or OR ELSE operator is expanded.
-- Nothing special needs to be done for the left operand since
-- in that case the actions are executed unconditionally.
when N_Short_Circuit =>
if N = Right_Opnd (P) then
-- We are now going to either append the actions to the
-- actions field of the short-circuit operation. We will
-- also analyze the actions now.
-- This analysis is really too early, the proper thing would
-- be to just park them there now, and only analyze them if
-- we find we really need them, and to it at the proper
-- final insertion point. However attempting to this proved
-- tricky, so for now we just kill current values before and
-- after the analyze call to make sure we avoid peculiar
-- optimizations from this out of order insertion.
Kill_Current_Values;
-- If P has already been expanded, we can't park new actions
-- on it, so we need to expand them immediately, introducing
-- an Expression_With_Actions. N can't be an expression
-- with actions, or else then the actions would have been
-- inserted at an inner level.
if Analyzed (P) then
pragma Assert (Nkind (N) /= N_Expression_With_Actions);
Rewrite (N,
Make_Expression_With_Actions (Sloc (N),
Actions => Ins_Actions,
Expression => Relocate_Node (N)));
Analyze_And_Resolve (N);
elsif Present (Actions (P)) then
Insert_List_After_And_Analyze
(Last (Actions (P)), Ins_Actions);
else
Set_Actions (P, Ins_Actions);
Analyze_List (Actions (P));
end if;
Kill_Current_Values;
return;
end if;
-- Then or Else dependent expression of an if expression. Add
-- actions to Then_Actions or Else_Actions field as appropriate.
-- The actions will be moved further out when the if is expanded.
when N_If_Expression =>
declare
ThenX : constant Node_Id := Next (First (Expressions (P)));
ElseX : constant Node_Id := Next (ThenX);
begin
-- If the enclosing expression is already analyzed, as
-- is the case for nested elaboration checks, insert the
-- conditional further out.
if Analyzed (P) then
null;
-- Actions belong to the then expression, temporarily place
-- them as Then_Actions of the if expression. They will be
-- moved to the proper place later when the if expression
-- is expanded.
elsif N = ThenX then
if Present (Then_Actions (P)) then
Insert_List_After_And_Analyze
(Last (Then_Actions (P)), Ins_Actions);
else
Set_Then_Actions (P, Ins_Actions);
Analyze_List (Then_Actions (P));
end if;
return;
-- Actions belong to the else expression, temporarily place
-- them as Else_Actions of the if expression. They will be
-- moved to the proper place later when the if expression
-- is expanded.
elsif N = ElseX then
if Present (Else_Actions (P)) then
Insert_List_After_And_Analyze
(Last (Else_Actions (P)), Ins_Actions);
else
Set_Else_Actions (P, Ins_Actions);
Analyze_List (Else_Actions (P));
end if;
return;
-- Actions belong to the condition. In this case they are
-- unconditionally executed, and so we can continue the
-- search for the proper insert point.
else
null;
end if;
end;
-- Alternative of case expression, we place the action in the
-- Actions field of the case expression alternative, this will
-- be handled when the case expression is expanded.
when N_Case_Expression_Alternative =>
if Present (Actions (P)) then
Insert_List_After_And_Analyze
(Last (Actions (P)), Ins_Actions);
else
Set_Actions (P, Ins_Actions);
Analyze_List (Actions (P));
end if;
return;
-- Case of appearing within an Expressions_With_Actions node. When
-- the new actions come from the expression of the expression with
-- actions, they must be added to the existing actions. The other
-- alternative is when the new actions are related to one of the
-- existing actions of the expression with actions, and should
-- never reach here: if actions are inserted on a statement
-- within the Actions of an expression with actions, or on some
-- sub-expression of such a statement, then the outermost proper
-- insertion point is right before the statement, and we should
-- never climb up as far as the N_Expression_With_Actions itself.
when N_Expression_With_Actions =>
if N = Expression (P) then
if Is_Empty_List (Actions (P)) then
Append_List_To (Actions (P), Ins_Actions);
Analyze_List (Actions (P));
else
Insert_List_After_And_Analyze
(Last (Actions (P)), Ins_Actions);
end if;
return;
else
raise Program_Error;
end if;
-- Case of appearing in the condition of a while expression or
-- elsif. We insert the actions into the Condition_Actions field.
-- They will be moved further out when the while loop or elsif
-- is analyzed.
when N_Elsif_Part
| N_Iteration_Scheme
=>
if N = Condition (P) then
if Present (Condition_Actions (P)) then
Insert_List_After_And_Analyze
(Last (Condition_Actions (P)), Ins_Actions);
else
Set_Condition_Actions (P, Ins_Actions);
-- Set the parent of the insert actions explicitly. This
-- is not a syntactic field, but we need the parent field
-- set, in particular so that freeze can understand that
-- it is dealing with condition actions, and properly
-- insert the freezing actions.
Set_Parent (Ins_Actions, P);
Analyze_List (Condition_Actions (P));
end if;
return;
end if;
-- Statements, declarations, pragmas, representation clauses
when
-- Statements
N_Procedure_Call_Statement
| N_Statement_Other_Than_Procedure_Call
-- Pragmas
| N_Pragma
-- Representation_Clause
| N_At_Clause
| N_Attribute_Definition_Clause
| N_Enumeration_Representation_Clause
| N_Record_Representation_Clause
-- Declarations
| N_Abstract_Subprogram_Declaration
| N_Entry_Body
| N_Exception_Declaration
| N_Exception_Renaming_Declaration
| N_Expression_Function
| N_Formal_Abstract_Subprogram_Declaration
| N_Formal_Concrete_Subprogram_Declaration
| N_Formal_Object_Declaration
| N_Formal_Type_Declaration
| N_Full_Type_Declaration
| N_Function_Instantiation
| N_Generic_Function_Renaming_Declaration
| N_Generic_Package_Declaration
| N_Generic_Package_Renaming_Declaration
| N_Generic_Procedure_Renaming_Declaration
| N_Generic_Subprogram_Declaration
| N_Implicit_Label_Declaration
| N_Incomplete_Type_Declaration
| N_Number_Declaration
| N_Object_Declaration
| N_Object_Renaming_Declaration
| N_Package_Body
| N_Package_Body_Stub
| N_Package_Declaration
| N_Package_Instantiation
| N_Package_Renaming_Declaration
| N_Private_Extension_Declaration
| N_Private_Type_Declaration
| N_Procedure_Instantiation
| N_Protected_Body
| N_Protected_Body_Stub
| N_Protected_Type_Declaration
| N_Single_Task_Declaration
| N_Subprogram_Body
| N_Subprogram_Body_Stub
| N_Subprogram_Declaration
| N_Subprogram_Renaming_Declaration
| N_Subtype_Declaration
| N_Task_Body
| N_Task_Body_Stub
| N_Task_Type_Declaration
-- Use clauses can appear in lists of declarations
| N_Use_Package_Clause
| N_Use_Type_Clause
-- Freeze entity behaves like a declaration or statement
| N_Freeze_Entity
| N_Freeze_Generic_Entity
=>
-- Do not insert here if the item is not a list member (this
-- happens for example with a triggering statement, and the
-- proper approach is to insert before the entire select).
if not Is_List_Member (P) then
null;
-- Do not insert if parent of P is an N_Component_Association
-- node (i.e. we are in the context of an N_Aggregate or
-- N_Extension_Aggregate node. In this case we want to insert
-- before the entire aggregate.
elsif Nkind (Parent (P)) = N_Component_Association then
null;
-- Do not insert if the parent of P is either an N_Variant node
-- or an N_Record_Definition node, meaning in either case that
-- P is a member of a component list, and that therefore the
-- actions should be inserted outside the complete record
-- declaration.
elsif Nkind_In (Parent (P), N_Variant, N_Record_Definition) then
null;
-- Do not insert freeze nodes within the loop generated for
-- an aggregate, because they may be elaborated too late for
-- subsequent use in the back end: within a package spec the
-- loop is part of the elaboration procedure and is only
-- elaborated during the second pass.
-- If the loop comes from source, or the entity is local to the
-- loop itself it must remain within.
elsif Nkind (Parent (P)) = N_Loop_Statement
and then not Comes_From_Source (Parent (P))
and then Nkind (First (Ins_Actions)) = N_Freeze_Entity
and then
Scope (Entity (First (Ins_Actions))) /= Current_Scope
then
null;
-- Otherwise we can go ahead and do the insertion
elsif P = Wrapped_Node then
Store_Before_Actions_In_Scope (Ins_Actions);
return;
else
Insert_List_Before_And_Analyze (P, Ins_Actions);
return;
end if;
-- A special case, N_Raise_xxx_Error can act either as a statement
-- or a subexpression. We tell the difference by looking at the
-- Etype. It is set to Standard_Void_Type in the statement case.
when N_Raise_xxx_Error =>
if Etype (P) = Standard_Void_Type then
if P = Wrapped_Node then
Store_Before_Actions_In_Scope (Ins_Actions);
else
Insert_List_Before_And_Analyze (P, Ins_Actions);
end if;
return;
-- In the subexpression case, keep climbing
else
null;
end if;
-- If a component association appears within a loop created for
-- an array aggregate, attach the actions to the association so
-- they can be subsequently inserted within the loop. For other
-- component associations insert outside of the aggregate. For
-- an association that will generate a loop, its Loop_Actions
-- attribute is already initialized (see exp_aggr.adb).
-- The list of Loop_Actions can in turn generate additional ones,
-- that are inserted before the associated node. If the associated
-- node is outside the aggregate, the new actions are collected
-- at the end of the Loop_Actions, to respect the order in which
-- they are to be elaborated.
when N_Component_Association
| N_Iterated_Component_Association
=>
if Nkind (Parent (P)) = N_Aggregate
and then Present (Loop_Actions (P))
then
if Is_Empty_List (Loop_Actions (P)) then
Set_Loop_Actions (P, Ins_Actions);
Analyze_List (Ins_Actions);
else
declare
Decl : Node_Id;
begin
-- Check whether these actions were generated by a
-- declaration that is part of the Loop_Actions for
-- the component_association.
Decl := Assoc_Node;
while Present (Decl) loop
exit when Parent (Decl) = P
and then Is_List_Member (Decl)
and then
List_Containing (Decl) = Loop_Actions (P);
Decl := Parent (Decl);
end loop;
if Present (Decl) then
Insert_List_Before_And_Analyze
(Decl, Ins_Actions);
else
Insert_List_After_And_Analyze
(Last (Loop_Actions (P)), Ins_Actions);
end if;
end;
end if;
return;
else
null;
end if;
-- Another special case, an attribute denoting a procedure call
when N_Attribute_Reference =>
if Is_Procedure_Attribute_Name (Attribute_Name (P)) then
if P = Wrapped_Node then
Store_Before_Actions_In_Scope (Ins_Actions);
else
Insert_List_Before_And_Analyze (P, Ins_Actions);
end if;
return;
-- In the subexpression case, keep climbing
else
null;
end if;
-- A contract node should not belong to the tree
when N_Contract =>
raise Program_Error;
-- For all other node types, keep climbing tree
when N_Abortable_Part
| N_Accept_Alternative
| N_Access_Definition
| N_Access_Function_Definition
| N_Access_Procedure_Definition
| N_Access_To_Object_Definition
| N_Aggregate
| N_Allocator
| N_Aspect_Specification
| N_Case_Expression
| N_Case_Statement_Alternative
| N_Character_Literal
| N_Compilation_Unit
| N_Compilation_Unit_Aux
| N_Component_Clause
| N_Component_Declaration
| N_Component_Definition
| N_Component_List
| N_Constrained_Array_Definition
| N_Decimal_Fixed_Point_Definition
| N_Defining_Character_Literal
| N_Defining_Identifier
| N_Defining_Operator_Symbol
| N_Defining_Program_Unit_Name
| N_Delay_Alternative
| N_Delta_Aggregate
| N_Delta_Constraint
| N_Derived_Type_Definition
| N_Designator
| N_Digits_Constraint
| N_Discriminant_Association
| N_Discriminant_Specification
| N_Empty
| N_Entry_Body_Formal_Part
| N_Entry_Call_Alternative
| N_Entry_Declaration
| N_Entry_Index_Specification
| N_Enumeration_Type_Definition
| N_Error
| N_Exception_Handler
| N_Expanded_Name
| N_Explicit_Dereference
| N_Extension_Aggregate
| N_Floating_Point_Definition
| N_Formal_Decimal_Fixed_Point_Definition
| N_Formal_Derived_Type_Definition
| N_Formal_Discrete_Type_Definition
| N_Formal_Floating_Point_Definition
| N_Formal_Modular_Type_Definition
| N_Formal_Ordinary_Fixed_Point_Definition
| N_Formal_Package_Declaration
| N_Formal_Private_Type_Definition
| N_Formal_Incomplete_Type_Definition
| N_Formal_Signed_Integer_Type_Definition
| N_Function_Call
| N_Function_Specification
| N_Generic_Association
| N_Handled_Sequence_Of_Statements
| N_Identifier
| N_In
| N_Index_Or_Discriminant_Constraint
| N_Indexed_Component
| N_Integer_Literal
| N_Iterator_Specification
| N_Itype_Reference
| N_Label
| N_Loop_Parameter_Specification
| N_Mod_Clause
| N_Modular_Type_Definition
| N_Not_In
| N_Null
| N_Op_Abs
| N_Op_Add
| N_Op_And
| N_Op_Concat
| N_Op_Divide
| N_Op_Eq
| N_Op_Expon
| N_Op_Ge
| N_Op_Gt
| N_Op_Le
| N_Op_Lt
| N_Op_Minus
| N_Op_Mod
| N_Op_Multiply
| N_Op_Ne
| N_Op_Not
| N_Op_Or
| N_Op_Plus
| N_Op_Rem
| N_Op_Rotate_Left
| N_Op_Rotate_Right
| N_Op_Shift_Left
| N_Op_Shift_Right
| N_Op_Shift_Right_Arithmetic
| N_Op_Subtract
| N_Op_Xor
| N_Operator_Symbol
| N_Ordinary_Fixed_Point_Definition
| N_Others_Choice
| N_Package_Specification
| N_Parameter_Association
| N_Parameter_Specification
| N_Pop_Constraint_Error_Label
| N_Pop_Program_Error_Label
| N_Pop_Storage_Error_Label
| N_Pragma_Argument_Association
| N_Procedure_Specification
| N_Protected_Definition
| N_Push_Constraint_Error_Label
| N_Push_Program_Error_Label
| N_Push_Storage_Error_Label
| N_Qualified_Expression
| N_Quantified_Expression
| N_Raise_Expression
| N_Range
| N_Range_Constraint
| N_Real_Literal
| N_Real_Range_Specification
| N_Record_Definition
| N_Reference
| N_SCIL_Dispatch_Table_Tag_Init
| N_SCIL_Dispatching_Call
| N_SCIL_Membership_Test
| N_Selected_Component
| N_Signed_Integer_Type_Definition
| N_Single_Protected_Declaration
| N_Slice
| N_String_Literal
| N_Subtype_Indication
| N_Subunit
| N_Target_Name
| N_Task_Definition
| N_Terminate_Alternative
| N_Triggering_Alternative
| N_Type_Conversion
| N_Unchecked_Expression
| N_Unchecked_Type_Conversion
| N_Unconstrained_Array_Definition
| N_Unused_At_End
| N_Unused_At_Start
| N_Variant
| N_Variant_Part
| N_Validate_Unchecked_Conversion
| N_With_Clause
=>
null;
end case;
-- If we fall through above tests, keep climbing tree
N := P;
if Nkind (Parent (N)) = N_Subunit then
-- This is the proper body corresponding to a stub. Insertion must
-- be done at the point of the stub, which is in the declarative
-- part of the parent unit.
P := Corresponding_Stub (Parent (N));
else
P := Parent (N);
end if;
end loop;
end Insert_Actions;
-- Version with check(s) suppressed
procedure Insert_Actions
(Assoc_Node : Node_Id;
Ins_Actions : List_Id;
Suppress : Check_Id)
is
begin
if Suppress = All_Checks then
declare
Sva : constant Suppress_Array := Scope_Suppress.Suppress;
begin
Scope_Suppress.Suppress := (others => True);
Insert_Actions (Assoc_Node, Ins_Actions);
Scope_Suppress.Suppress := Sva;
end;
else
declare
Svg : constant Boolean := Scope_Suppress.Suppress (Suppress);
begin
Scope_Suppress.Suppress (Suppress) := True;
Insert_Actions (Assoc_Node, Ins_Actions);
Scope_Suppress.Suppress (Suppress) := Svg;
end;
end if;
end Insert_Actions;
--------------------------
-- Insert_Actions_After --
--------------------------
procedure Insert_Actions_After
(Assoc_Node : Node_Id;
Ins_Actions : List_Id)
is
begin
if Scope_Is_Transient and then Assoc_Node = Node_To_Be_Wrapped then
Store_After_Actions_In_Scope (Ins_Actions);
else
Insert_List_After_And_Analyze (Assoc_Node, Ins_Actions);
end if;
end Insert_Actions_After;
------------------------
-- Insert_Declaration --
------------------------
procedure Insert_Declaration (N : Node_Id; Decl : Node_Id) is
P : Node_Id;
begin
pragma Assert (Nkind (N) in N_Subexpr);
-- Climb until we find a procedure or a package
P := N;
loop
pragma Assert (Present (Parent (P)));
P := Parent (P);
if Is_List_Member (P) then
exit when Nkind_In (Parent (P), N_Package_Specification,
N_Subprogram_Body);
-- Special handling for handled sequence of statements, we must
-- insert in the statements not the exception handlers!
if Nkind (Parent (P)) = N_Handled_Sequence_Of_Statements then
P := First (Statements (Parent (P)));
exit;
end if;
end if;
end loop;
-- Now do the insertion
Insert_Before (P, Decl);
Analyze (Decl);
end Insert_Declaration;
---------------------------------
-- Insert_Library_Level_Action --
---------------------------------
procedure Insert_Library_Level_Action (N : Node_Id) is
Aux : constant Node_Id := Aux_Decls_Node (Cunit (Main_Unit));
begin
Push_Scope (Cunit_Entity (Main_Unit));
-- ??? should this be Current_Sem_Unit instead of Main_Unit?
if No (Actions (Aux)) then
Set_Actions (Aux, New_List (N));
else
Append (N, Actions (Aux));
end if;
Analyze (N);
Pop_Scope;
end Insert_Library_Level_Action;
----------------------------------
-- Insert_Library_Level_Actions --
----------------------------------
procedure Insert_Library_Level_Actions (L : List_Id) is
Aux : constant Node_Id := Aux_Decls_Node (Cunit (Main_Unit));
begin
if Is_Non_Empty_List (L) then
Push_Scope (Cunit_Entity (Main_Unit));
-- ??? should this be Current_Sem_Unit instead of Main_Unit?
if No (Actions (Aux)) then
Set_Actions (Aux, L);
Analyze_List (L);
else
Insert_List_After_And_Analyze (Last (Actions (Aux)), L);
end if;
Pop_Scope;
end if;
end Insert_Library_Level_Actions;
----------------------
-- Inside_Init_Proc --
----------------------
function Inside_Init_Proc return Boolean is
S : Entity_Id;
begin
S := Current_Scope;
while Present (S) and then S /= Standard_Standard loop
if Is_Init_Proc (S) then
return True;
else
S := Scope (S);
end if;
end loop;
return False;
end Inside_Init_Proc;
----------------------------
-- Is_All_Null_Statements --
----------------------------
function Is_All_Null_Statements (L : List_Id) return Boolean is
Stm : Node_Id;
begin
Stm := First (L);
while Present (Stm) loop
if Nkind (Stm) /= N_Null_Statement then
return False;
end if;
Next (Stm);
end loop;
return True;
end Is_All_Null_Statements;
--------------------------------------------------
-- Is_Displacement_Of_Object_Or_Function_Result --
--------------------------------------------------
function Is_Displacement_Of_Object_Or_Function_Result
(Obj_Id : Entity_Id) return Boolean
is
function Is_Controlled_Function_Call (N : Node_Id) return Boolean;
-- Determine if particular node denotes a controlled function call. The
-- call may have been heavily expanded.
function Is_Displace_Call (N : Node_Id) return Boolean;
-- Determine whether a particular node is a call to Ada.Tags.Displace.
-- The call might be nested within other actions such as conversions.
function Is_Source_Object (N : Node_Id) return Boolean;
-- Determine whether a particular node denotes a source object
---------------------------------
-- Is_Controlled_Function_Call --
---------------------------------
function Is_Controlled_Function_Call (N : Node_Id) return Boolean is
Expr : Node_Id := Original_Node (N);
begin
-- When a function call appears in Object.Operation format, the
-- original representation has several possible forms depending on
-- the availability and form of actual parameters:
-- Obj.Func N_Selected_Component
-- Obj.Func (Actual) N_Indexed_Component
-- Obj.Func (Formal => Actual) N_Function_Call, whose Name is an
-- N_Selected_Component
loop
if Nkind (Expr) = N_Function_Call then
Expr := Name (Expr);
-- "Obj.Func (Actual)" case
elsif Nkind (Expr) = N_Indexed_Component then
Expr := Prefix (Expr);
-- "Obj.Func" or "Obj.Func (Formal => Actual) case
elsif Nkind (Expr) = N_Selected_Component then
Expr := Selector_Name (Expr);
else
exit;
end if;
end loop;
return
Nkind (Expr) in N_Has_Entity
and then Present (Entity (Expr))
and then Ekind (Entity (Expr)) = E_Function
and then Needs_Finalization (Etype (Entity (Expr)));
end Is_Controlled_Function_Call;
----------------------
-- Is_Displace_Call --
----------------------
function Is_Displace_Call (N : Node_Id) return Boolean is
Call : Node_Id := N;
begin
-- Strip various actions which may precede a call to Displace
loop
if Nkind (Call) = N_Explicit_Dereference then
Call := Prefix (Call);
elsif Nkind_In (Call, N_Type_Conversion,
N_Unchecked_Type_Conversion)
then
Call := Expression (Call);
else
exit;
end if;
end loop;
return
Present (Call)
and then Nkind (Call) = N_Function_Call
and then Is_RTE (Entity (Name (Call)), RE_Displace);
end Is_Displace_Call;
----------------------
-- Is_Source_Object --
----------------------
function Is_Source_Object (N : Node_Id) return Boolean is
begin
return
Present (N)
and then Nkind (N) in N_Has_Entity
and then Is_Object (Entity (N))
and then Comes_From_Source (N);
end Is_Source_Object;
-- Local variables
Decl : constant Node_Id := Parent (Obj_Id);
Obj_Typ : constant Entity_Id := Base_Type (Etype (Obj_Id));
Orig_Decl : constant Node_Id := Original_Node (Decl);
-- Start of processing for Is_Displacement_Of_Object_Or_Function_Result
begin
-- Case 1:
-- Obj : CW_Type := Function_Call (...);
-- rewritten into:
-- Tmp : ... := Function_Call (...)'reference;
-- Obj : CW_Type renames (... Ada.Tags.Displace (Tmp));
-- where the return type of the function and the class-wide type require
-- dispatch table pointer displacement.
-- Case 2:
-- Obj : CW_Type := Src_Obj;
-- rewritten into:
-- Obj : CW_Type renames (... Ada.Tags.Displace (Src_Obj));
-- where the type of the source object and the class-wide type require
-- dispatch table pointer displacement.
return
Nkind (Decl) = N_Object_Renaming_Declaration
and then Nkind (Orig_Decl) = N_Object_Declaration
and then Comes_From_Source (Orig_Decl)
and then Is_Class_Wide_Type (Obj_Typ)
and then Is_Displace_Call (Renamed_Object (Obj_Id))
and then
(Is_Controlled_Function_Call (Expression (Orig_Decl))
or else Is_Source_Object (Expression (Orig_Decl)));
end Is_Displacement_Of_Object_Or_Function_Result;
------------------------------
-- Is_Finalizable_Transient --
------------------------------
function Is_Finalizable_Transient
(Decl : Node_Id;
Rel_Node : Node_Id) return Boolean
is
Obj_Id : constant Entity_Id := Defining_Identifier (Decl);
Obj_Typ : constant Entity_Id := Base_Type (Etype (Obj_Id));
function Initialized_By_Access (Trans_Id : Entity_Id) return Boolean;
-- Determine whether transient object Trans_Id is initialized either
-- by a function call which returns an access type or simply renames
-- another pointer.
function Initialized_By_Aliased_BIP_Func_Call
(Trans_Id : Entity_Id) return Boolean;
-- Determine whether transient object Trans_Id is initialized by a
-- build-in-place function call where the BIPalloc parameter is of
-- value 1 and BIPaccess is not null. This case creates an aliasing
-- between the returned value and the value denoted by BIPaccess.
function Is_Aliased
(Trans_Id : Entity_Id;
First_Stmt : Node_Id) return Boolean;
-- Determine whether transient object Trans_Id has been renamed or
-- aliased through 'reference in the statement list starting from
-- First_Stmt.
function Is_Allocated (Trans_Id : Entity_Id) return Boolean;
-- Determine whether transient object Trans_Id is allocated on the heap
function Is_Iterated_Container
(Trans_Id : Entity_Id;
First_Stmt : Node_Id) return Boolean;
-- Determine whether transient object Trans_Id denotes a container which
-- is in the process of being iterated in the statement list starting
-- from First_Stmt.
---------------------------
-- Initialized_By_Access --
---------------------------
function Initialized_By_Access (Trans_Id : Entity_Id) return Boolean is
Expr : constant Node_Id := Expression (Parent (Trans_Id));
begin
return
Present (Expr)
and then Nkind (Expr) /= N_Reference
and then Is_Access_Type (Etype (Expr));
end Initialized_By_Access;
------------------------------------------
-- Initialized_By_Aliased_BIP_Func_Call --
------------------------------------------
function Initialized_By_Aliased_BIP_Func_Call
(Trans_Id : Entity_Id) return Boolean
is
Call : Node_Id := Expression (Parent (Trans_Id));
begin
-- Build-in-place calls usually appear in 'reference format
if Nkind (Call) = N_Reference then
Call := Prefix (Call);
end if;
if Is_Build_In_Place_Function_Call (Call) then
declare
Access_Nam : Name_Id := No_Name;
Access_OK : Boolean := False;
Actual : Node_Id;
Alloc_Nam : Name_Id := No_Name;
Alloc_OK : Boolean := False;
Formal : Node_Id;
Func_Id : Entity_Id;
Param : Node_Id;
begin
-- Examine all parameter associations of the function call
Param := First (Parameter_Associations (Call));
while Present (Param) loop
if Nkind (Param) = N_Parameter_Association
and then Nkind (Selector_Name (Param)) = N_Identifier
then
Actual := Explicit_Actual_Parameter (Param);
Formal := Selector_Name (Param);
-- Construct the names of formals BIPaccess and BIPalloc
-- using the function name retrieved from an arbitrary
-- formal.
if Access_Nam = No_Name
and then Alloc_Nam = No_Name
and then Present (Entity (Formal))
then
Func_Id := Scope (Entity (Formal));
Access_Nam :=
New_External_Name (Chars (Func_Id),
BIP_Formal_Suffix (BIP_Object_Access));
Alloc_Nam :=
New_External_Name (Chars (Func_Id),
BIP_Formal_Suffix (BIP_Alloc_Form));
end if;
-- A match for BIPaccess => Temp has been found
if Chars (Formal) = Access_Nam
and then Nkind (Actual) /= N_Null
then
Access_OK := True;
end if;
-- A match for BIPalloc => 1 has been found
if Chars (Formal) = Alloc_Nam
and then Nkind (Actual) = N_Integer_Literal
and then Intval (Actual) = Uint_1
then
Alloc_OK := True;
end if;
end if;
Next (Param);
end loop;
return Access_OK and Alloc_OK;
end;
end if;
return False;
end Initialized_By_Aliased_BIP_Func_Call;
----------------
-- Is_Aliased --
----------------
function Is_Aliased
(Trans_Id : Entity_Id;
First_Stmt : Node_Id) return Boolean
is
function Find_Renamed_Object (Ren_Decl : Node_Id) return Entity_Id;
-- Given an object renaming declaration, retrieve the entity of the
-- renamed name. Return Empty if the renamed name is anything other
-- than a variable or a constant.
-------------------------
-- Find_Renamed_Object --
-------------------------
function Find_Renamed_Object (Ren_Decl : Node_Id) return Entity_Id is
Ren_Obj : Node_Id := Empty;
function Find_Object (N : Node_Id) return Traverse_Result;
-- Try to detect an object which is either a constant or a
-- variable.
-----------------
-- Find_Object --
-----------------
function Find_Object (N : Node_Id) return Traverse_Result is
begin
-- Stop the search once a constant or a variable has been
-- detected.
if Nkind (N) = N_Identifier
and then Present (Entity (N))
and then Ekind_In (Entity (N), E_Constant, E_Variable)
then
Ren_Obj := Entity (N);
return Abandon;
end if;
return OK;
end Find_Object;
procedure Search is new Traverse_Proc (Find_Object);
-- Local variables
Typ : constant Entity_Id := Etype (Defining_Identifier (Ren_Decl));
-- Start of processing for Find_Renamed_Object
begin
-- Actions related to dispatching calls may appear as renamings of
-- tags. Do not process this type of renaming because it does not
-- use the actual value of the object.
if not Is_RTE (Typ, RE_Tag_Ptr) then
Search (Name (Ren_Decl));
end if;
return Ren_Obj;
end Find_Renamed_Object;
-- Local variables
Expr : Node_Id;
Ren_Obj : Entity_Id;
Stmt : Node_Id;
-- Start of processing for Is_Aliased
begin
-- A controlled transient object is not considered aliased when it
-- appears inside an expression_with_actions node even when there are
-- explicit aliases of it:
-- do
-- Trans_Id : Ctrl_Typ ...; -- transient object
-- Alias : ... := Trans_Id; -- object is aliased
-- Val : constant Boolean :=
-- ... Alias ...; -- aliasing ends
-- <finalize Trans_Id> -- object safe to finalize
-- in Val end;
-- Expansion ensures that all aliases are encapsulated in the actions
-- list and do not leak to the expression by forcing the evaluation
-- of the expression.
if Nkind (Rel_Node) = N_Expression_With_Actions then
return False;
-- Otherwise examine the statements after the controlled transient
-- object and look for various forms of aliasing.
else
Stmt := First_Stmt;
while Present (Stmt) loop
if Nkind (Stmt) = N_Object_Declaration then
Expr := Expression (Stmt);
-- Aliasing of the form:
-- Obj : ... := Trans_Id'reference;
if Present (Expr)
and then Nkind (Expr) = N_Reference
and then Nkind (Prefix (Expr)) = N_Identifier
and then Entity (Prefix (Expr)) = Trans_Id
then
return True;
end if;
elsif Nkind (Stmt) = N_Object_Renaming_Declaration then
Ren_Obj := Find_Renamed_Object (Stmt);
-- Aliasing of the form:
-- Obj : ... renames ... Trans_Id ...;
if Present (Ren_Obj) and then Ren_Obj = Trans_Id then
return True;
end if;
end if;
Next (Stmt);
end loop;
return False;
end if;
end Is_Aliased;
------------------
-- Is_Allocated --
------------------
function Is_Allocated (Trans_Id : Entity_Id) return Boolean is
Expr : constant Node_Id := Expression (Parent (Trans_Id));
begin
return
Is_Access_Type (Etype (Trans_Id))
and then Present (Expr)
and then Nkind (Expr) = N_Allocator;
end Is_Allocated;
---------------------------
-- Is_Iterated_Container --
---------------------------
function Is_Iterated_Container
(Trans_Id : Entity_Id;
First_Stmt : Node_Id) return Boolean
is
Aspect : Node_Id;
Call : Node_Id;
Iter : Entity_Id;
Param : Node_Id;
Stmt : Node_Id;
Typ : Entity_Id;
begin
-- It is not possible to iterate over containers in non-Ada 2012 code
if Ada_Version < Ada_2012 then
return False;
end if;
Typ := Etype (Trans_Id);
-- Handle access type created for secondary stack use
if Is_Access_Type (Typ) then
Typ := Designated_Type (Typ);
end if;
-- Look for aspect Default_Iterator. It may be part of a type
-- declaration for a container, or inherited from a base type
-- or parent type.
Aspect := Find_Value_Of_Aspect (Typ, Aspect_Default_Iterator);
if Present (Aspect) then
Iter := Entity (Aspect);
-- Examine the statements following the container object and
-- look for a call to the default iterate routine where the
-- first parameter is the transient. Such a call appears as:
-- It : Access_To_CW_Iterator :=
-- Iterate (Tran_Id.all, ...)'reference;
Stmt := First_Stmt;
while Present (Stmt) loop
-- Detect an object declaration which is initialized by a
-- secondary stack function call.
if Nkind (Stmt) = N_Object_Declaration
and then Present (Expression (Stmt))
and then Nkind (Expression (Stmt)) = N_Reference
and then Nkind (Prefix (Expression (Stmt))) = N_Function_Call
then
Call := Prefix (Expression (Stmt));
-- The call must invoke the default iterate routine of
-- the container and the transient object must appear as
-- the first actual parameter. Skip any calls whose names
-- are not entities.
if Is_Entity_Name (Name (Call))
and then Entity (Name (Call)) = Iter
and then Present (Parameter_Associations (Call))
then
Param := First (Parameter_Associations (Call));
if Nkind (Param) = N_Explicit_Dereference
and then Entity (Prefix (Param)) = Trans_Id
then
return True;
end if;
end if;
end if;
Next (Stmt);
end loop;
end if;
return False;
end Is_Iterated_Container;
-- Local variables
Desig : Entity_Id := Obj_Typ;
-- Start of processing for Is_Finalizable_Transient
begin
-- Handle access types
if Is_Access_Type (Desig) then
Desig := Available_View (Designated_Type (Desig));
end if;
return
Ekind_In (Obj_Id, E_Constant, E_Variable)
and then Needs_Finalization (Desig)
and then Requires_Transient_Scope (Desig)
and then Nkind (Rel_Node) /= N_Simple_Return_Statement
-- Do not consider a transient object that was already processed
and then not Is_Finalized_Transient (Obj_Id)
-- Do not consider renamed or 'reference-d transient objects because
-- the act of renaming extends the object's lifetime.
and then not Is_Aliased (Obj_Id, Decl)
-- Do not consider transient objects allocated on the heap since
-- they are attached to a finalization master.
and then not Is_Allocated (Obj_Id)
-- If the transient object is a pointer, check that it is not
-- initialized by a function that returns a pointer or acts as a
-- renaming of another pointer.
and then
(not Is_Access_Type (Obj_Typ)
or else not Initialized_By_Access (Obj_Id))
-- Do not consider transient objects which act as indirect aliases
-- of build-in-place function results.
and then not Initialized_By_Aliased_BIP_Func_Call (Obj_Id)
-- Do not consider conversions of tags to class-wide types
and then not Is_Tag_To_Class_Wide_Conversion (Obj_Id)
-- Do not consider iterators because those are treated as normal
-- controlled objects and are processed by the usual finalization
-- machinery. This avoids the double finalization of an iterator.
and then not Is_Iterator (Desig)
-- Do not consider containers in the context of iterator loops. Such
-- transient objects must exist for as long as the loop is around,
-- otherwise any operation carried out by the iterator will fail.
and then not Is_Iterated_Container (Obj_Id, Decl);
end Is_Finalizable_Transient;
---------------------------------
-- Is_Fully_Repped_Tagged_Type --
---------------------------------
function Is_Fully_Repped_Tagged_Type (T : Entity_Id) return Boolean is
U : constant Entity_Id := Underlying_Type (T);
Comp : Entity_Id;
begin
if No (U) or else not Is_Tagged_Type (U) then
return False;
elsif Has_Discriminants (U) then
return False;
elsif not Has_Specified_Layout (U) then
return False;
end if;
-- Here we have a tagged type, see if it has any unlayed out fields
-- other than a possible tag and parent fields. If so, we return False.
Comp := First_Component (U);
while Present (Comp) loop
if not Is_Tag (Comp)
and then Chars (Comp) /= Name_uParent
and then No (Component_Clause (Comp))
then
return False;
else
Next_Component (Comp);
end if;
end loop;
-- All components are layed out
return True;
end Is_Fully_Repped_Tagged_Type;
----------------------------------
-- Is_Library_Level_Tagged_Type --
----------------------------------
function Is_Library_Level_Tagged_Type (Typ : Entity_Id) return Boolean is
begin
return Is_Tagged_Type (Typ) and then Is_Library_Level_Entity (Typ);
end Is_Library_Level_Tagged_Type;
--------------------------
-- Is_Non_BIP_Func_Call --
--------------------------
function Is_Non_BIP_Func_Call (Expr : Node_Id) return Boolean is
begin
-- The expected call is of the format
--
-- Func_Call'reference
return
Nkind (Expr) = N_Reference
and then Nkind (Prefix (Expr)) = N_Function_Call
and then not Is_Build_In_Place_Function_Call (Prefix (Expr));
end Is_Non_BIP_Func_Call;
------------------------------------
-- Is_Object_Access_BIP_Func_Call --
------------------------------------
function Is_Object_Access_BIP_Func_Call
(Expr : Node_Id;
Obj_Id : Entity_Id) return Boolean
is
Access_Nam : Name_Id := No_Name;
Actual : Node_Id;
Call : Node_Id;
Formal : Node_Id;
Param : Node_Id;
begin
-- Build-in-place calls usually appear in 'reference format. Note that
-- the accessibility check machinery may add an extra 'reference due to
-- side effect removal.
Call := Expr;
while Nkind (Call) = N_Reference loop
Call := Prefix (Call);
end loop;
if Nkind_In (Call, N_Qualified_Expression,
N_Unchecked_Type_Conversion)
then
Call := Expression (Call);
end if;
if Is_Build_In_Place_Function_Call (Call) then
-- Examine all parameter associations of the function call
Param := First (Parameter_Associations (Call));
while Present (Param) loop
if Nkind (Param) = N_Parameter_Association
and then Nkind (Selector_Name (Param)) = N_Identifier
then
Formal := Selector_Name (Param);
Actual := Explicit_Actual_Parameter (Param);
-- Construct the name of formal BIPaccess. It is much easier to
-- extract the name of the function using an arbitrary formal's
-- scope rather than the Name field of Call.
if Access_Nam = No_Name and then Present (Entity (Formal)) then
Access_Nam :=
New_External_Name
(Chars (Scope (Entity (Formal))),
BIP_Formal_Suffix (BIP_Object_Access));
end if;
-- A match for BIPaccess => Obj_Id'Unrestricted_Access has been
-- found.
if Chars (Formal) = Access_Nam
and then Nkind (Actual) = N_Attribute_Reference
and then Attribute_Name (Actual) = Name_Unrestricted_Access
and then Nkind (Prefix (Actual)) = N_Identifier
and then Entity (Prefix (Actual)) = Obj_Id
then
return True;
end if;
end if;
Next (Param);
end loop;
end if;
return False;
end Is_Object_Access_BIP_Func_Call;
----------------------------------
-- Is_Possibly_Unaligned_Object --
----------------------------------
function Is_Possibly_Unaligned_Object (N : Node_Id) return Boolean is
T : constant Entity_Id := Etype (N);
begin
-- If renamed object, apply test to underlying object
if Is_Entity_Name (N)
and then Is_Object (Entity (N))
and then Present (Renamed_Object (Entity (N)))
then
return Is_Possibly_Unaligned_Object (Renamed_Object (Entity (N)));
end if;
-- Tagged and controlled types and aliased types are always aligned, as
-- are concurrent types.
if Is_Aliased (T)
or else Has_Controlled_Component (T)
or else Is_Concurrent_Type (T)
or else Is_Tagged_Type (T)
or else Is_Controlled (T)
then
return False;
end if;
-- If this is an element of a packed array, may be unaligned
if Is_Ref_To_Bit_Packed_Array (N) then
return True;
end if;
-- Case of indexed component reference: test whether prefix is unaligned
if Nkind (N) = N_Indexed_Component then
return Is_Possibly_Unaligned_Object (Prefix (N));
-- Case of selected component reference
elsif Nkind (N) = N_Selected_Component then
declare
P : constant Node_Id := Prefix (N);
C : constant Entity_Id := Entity (Selector_Name (N));
M : Nat;
S : Nat;
begin
-- If component reference is for an array with non-static bounds,
-- then it is always aligned: we can only process unaligned arrays
-- with static bounds (more precisely compile time known bounds).
if Is_Array_Type (T)
and then not Compile_Time_Known_Bounds (T)
then
return False;
end if;
-- If component is aliased, it is definitely properly aligned
if Is_Aliased (C) then
return False;
end if;
-- If component is for a type implemented as a scalar, and the
-- record is packed, and the component is other than the first
-- component of the record, then the component may be unaligned.
if Is_Packed (Etype (P))
and then Represented_As_Scalar (Etype (C))
and then First_Entity (Scope (C)) /= C
then
return True;
end if;
-- Compute maximum possible alignment for T
-- If alignment is known, then that settles things
if Known_Alignment (T) then
M := UI_To_Int (Alignment (T));
-- If alignment is not known, tentatively set max alignment
else
M := Ttypes.Maximum_Alignment;
-- We can reduce this if the Esize is known since the default
-- alignment will never be more than the smallest power of 2
-- that does not exceed this Esize value.
if Known_Esize (T) then
S := UI_To_Int (Esize (T));
while (M / 2) >= S loop
M := M / 2;
end loop;
end if;
end if;
-- The following code is historical, it used to be present but it
-- is too cautious, because the front-end does not know the proper
-- default alignments for the target. Also, if the alignment is
-- not known, the front end can't know in any case. If a copy is
-- needed, the back-end will take care of it. This whole section
-- including this comment can be removed later ???
-- If the component reference is for a record that has a specified
-- alignment, and we either know it is too small, or cannot tell,
-- then the component may be unaligned.
-- What is the following commented out code ???
-- if Known_Alignment (Etype (P))
-- and then Alignment (Etype (P)) < Ttypes.Maximum_Alignment
-- and then M > Alignment (Etype (P))
-- then
-- return True;
-- end if;
-- Case of component clause present which may specify an
-- unaligned position.
if Present (Component_Clause (C)) then
-- Otherwise we can do a test to make sure that the actual
-- start position in the record, and the length, are both
-- consistent with the required alignment. If not, we know
-- that we are unaligned.
declare
Align_In_Bits : constant Nat := M * System_Storage_Unit;
begin
if Component_Bit_Offset (C) mod Align_In_Bits /= 0
or else Esize (C) mod Align_In_Bits /= 0
then
return True;
end if;
end;
end if;
-- Otherwise, for a component reference, test prefix
return Is_Possibly_Unaligned_Object (P);
end;
-- If not a component reference, must be aligned
else
return False;
end if;
end Is_Possibly_Unaligned_Object;
---------------------------------
-- Is_Possibly_Unaligned_Slice --
---------------------------------
function Is_Possibly_Unaligned_Slice (N : Node_Id) return Boolean is
begin
-- Go to renamed object
if Is_Entity_Name (N)
and then Is_Object (Entity (N))
and then Present (Renamed_Object (Entity (N)))
then
return Is_Possibly_Unaligned_Slice (Renamed_Object (Entity (N)));
end if;
-- The reference must be a slice
if Nkind (N) /= N_Slice then
return False;
end if;
-- We only need to worry if the target has strict alignment
if not Target_Strict_Alignment then
return False;
end if;
-- If it is a slice, then look at the array type being sliced
declare
Sarr : constant Node_Id := Prefix (N);
-- Prefix of the slice, i.e. the array being sliced
Styp : constant Entity_Id := Etype (Prefix (N));
-- Type of the array being sliced
Pref : Node_Id;
Ptyp : Entity_Id;
begin
-- The problems arise if the array object that is being sliced
-- is a component of a record or array, and we cannot guarantee
-- the alignment of the array within its containing object.
-- To investigate this, we look at successive prefixes to see
-- if we have a worrisome indexed or selected component.
Pref := Sarr;
loop
-- Case of array is part of an indexed component reference
if Nkind (Pref) = N_Indexed_Component then
Ptyp := Etype (Prefix (Pref));
-- The only problematic case is when the array is packed, in
-- which case we really know nothing about the alignment of
-- individual components.
if Is_Bit_Packed_Array (Ptyp) then
return True;
end if;
-- Case of array is part of a selected component reference
elsif Nkind (Pref) = N_Selected_Component then
Ptyp := Etype (Prefix (Pref));
-- We are definitely in trouble if the record in question
-- has an alignment, and either we know this alignment is
-- inconsistent with the alignment of the slice, or we don't
-- know what the alignment of the slice should be.
if Known_Alignment (Ptyp)
and then (Unknown_Alignment (Styp)
or else Alignment (Styp) > Alignment (Ptyp))
then
return True;
end if;
-- We are in potential trouble if the record type is packed.
-- We could special case when we know that the array is the
-- first component, but that's not such a simple case ???
if Is_Packed (Ptyp) then
return True;
end if;
-- We are in trouble if there is a component clause, and
-- either we do not know the alignment of the slice, or
-- the alignment of the slice is inconsistent with the
-- bit position specified by the component clause.
declare
Field : constant Entity_Id := Entity (Selector_Name (Pref));
begin
if Present (Component_Clause (Field))
and then
(Unknown_Alignment (Styp)
or else
(Component_Bit_Offset (Field) mod
(System_Storage_Unit * Alignment (Styp))) /= 0)
then
return True;
end if;
end;
-- For cases other than selected or indexed components we know we
-- are OK, since no issues arise over alignment.
else
return False;
end if;
-- We processed an indexed component or selected component
-- reference that looked safe, so keep checking prefixes.
Pref := Prefix (Pref);
end loop;
end;
end Is_Possibly_Unaligned_Slice;
-------------------------------
-- Is_Related_To_Func_Return --
-------------------------------
function Is_Related_To_Func_Return (Id : Entity_Id) return Boolean is
Expr : constant Node_Id := Related_Expression (Id);
begin
return
Present (Expr)
and then Nkind (Expr) = N_Explicit_Dereference
and then Nkind (Parent (Expr)) = N_Simple_Return_Statement;
end Is_Related_To_Func_Return;
--------------------------------
-- Is_Ref_To_Bit_Packed_Array --
--------------------------------
function Is_Ref_To_Bit_Packed_Array (N : Node_Id) return Boolean is
Result : Boolean;
Expr : Node_Id;
begin
if Is_Entity_Name (N)
and then Is_Object (Entity (N))
and then Present (Renamed_Object (Entity (N)))
then
return Is_Ref_To_Bit_Packed_Array (Renamed_Object (Entity (N)));
end if;
if Nkind_In (N, N_Indexed_Component, N_Selected_Component) then
if Is_Bit_Packed_Array (Etype (Prefix (N))) then
Result := True;
else
Result := Is_Ref_To_Bit_Packed_Array (Prefix (N));
end if;
if Result and then Nkind (N) = N_Indexed_Component then
Expr := First (Expressions (N));
while Present (Expr) loop
Force_Evaluation (Expr);
Next (Expr);
end loop;
end if;
return Result;
else
return False;
end if;
end Is_Ref_To_Bit_Packed_Array;
--------------------------------
-- Is_Ref_To_Bit_Packed_Slice --
--------------------------------
function Is_Ref_To_Bit_Packed_Slice (N : Node_Id) return Boolean is
begin
if Nkind (N) = N_Type_Conversion then
return Is_Ref_To_Bit_Packed_Slice (Expression (N));
elsif Is_Entity_Name (N)
and then Is_Object (Entity (N))
and then Present (Renamed_Object (Entity (N)))
then
return Is_Ref_To_Bit_Packed_Slice (Renamed_Object (Entity (N)));
elsif Nkind (N) = N_Slice
and then Is_Bit_Packed_Array (Etype (Prefix (N)))
then
return True;
elsif Nkind_In (N, N_Indexed_Component, N_Selected_Component) then
return Is_Ref_To_Bit_Packed_Slice (Prefix (N));
else
return False;
end if;
end Is_Ref_To_Bit_Packed_Slice;
-----------------------
-- Is_Renamed_Object --
-----------------------
function Is_Renamed_Object (N : Node_Id) return Boolean is
Pnod : constant Node_Id := Parent (N);
Kind : constant Node_Kind := Nkind (Pnod);
begin
if Kind = N_Object_Renaming_Declaration then
return True;
elsif Nkind_In (Kind, N_Indexed_Component, N_Selected_Component) then
return Is_Renamed_Object (Pnod);
else
return False;
end if;
end Is_Renamed_Object;
--------------------------------------
-- Is_Secondary_Stack_BIP_Func_Call --
--------------------------------------
function Is_Secondary_Stack_BIP_Func_Call (Expr : Node_Id) return Boolean is
Alloc_Nam : Name_Id := No_Name;
Actual : Node_Id;
Call : Node_Id := Expr;
Formal : Node_Id;
Param : Node_Id;
begin
-- Build-in-place calls usually appear in 'reference format. Note that
-- the accessibility check machinery may add an extra 'reference due to
-- side effect removal.
while Nkind (Call) = N_Reference loop
Call := Prefix (Call);
end loop;
if Nkind_In (Call, N_Qualified_Expression,
N_Unchecked_Type_Conversion)
then
Call := Expression (Call);
end if;
if Is_Build_In_Place_Function_Call (Call) then
-- Examine all parameter associations of the function call
Param := First (Parameter_Associations (Call));
while Present (Param) loop
if Nkind (Param) = N_Parameter_Association
and then Nkind (Selector_Name (Param)) = N_Identifier
then
Formal := Selector_Name (Param);
Actual := Explicit_Actual_Parameter (Param);
-- Construct the name of formal BIPalloc. It is much easier to
-- extract the name of the function using an arbitrary formal's
-- scope rather than the Name field of Call.
if Alloc_Nam = No_Name and then Present (Entity (Formal)) then
Alloc_Nam :=
New_External_Name
(Chars (Scope (Entity (Formal))),
BIP_Formal_Suffix (BIP_Alloc_Form));
end if;
-- A match for BIPalloc => 2 has been found
if Chars (Formal) = Alloc_Nam
and then Nkind (Actual) = N_Integer_Literal
and then Intval (Actual) = Uint_2
then
return True;
end if;
end if;
Next (Param);
end loop;
end if;
return False;
end Is_Secondary_Stack_BIP_Func_Call;
-------------------------------------
-- Is_Tag_To_Class_Wide_Conversion --
-------------------------------------
function Is_Tag_To_Class_Wide_Conversion
(Obj_Id : Entity_Id) return Boolean
is
Expr : constant Node_Id := Expression (Parent (Obj_Id));
begin
return
Is_Class_Wide_Type (Etype (Obj_Id))
and then Present (Expr)
and then Nkind (Expr) = N_Unchecked_Type_Conversion
and then Etype (Expression (Expr)) = RTE (RE_Tag);
end Is_Tag_To_Class_Wide_Conversion;
----------------------------
-- Is_Untagged_Derivation --
----------------------------
function Is_Untagged_Derivation (T : Entity_Id) return Boolean is
begin
return (not Is_Tagged_Type (T) and then Is_Derived_Type (T))
or else
(Is_Private_Type (T) and then Present (Full_View (T))
and then not Is_Tagged_Type (Full_View (T))
and then Is_Derived_Type (Full_View (T))
and then Etype (Full_View (T)) /= T);
end Is_Untagged_Derivation;
---------------------------
-- Is_Volatile_Reference --
---------------------------
function Is_Volatile_Reference (N : Node_Id) return Boolean is
begin
-- Only source references are to be treated as volatile, internally
-- generated stuff cannot have volatile external effects.
if not Comes_From_Source (N) then
return False;
-- Never true for reference to a type
elsif Is_Entity_Name (N) and then Is_Type (Entity (N)) then
return False;
-- Never true for a compile time known constant
elsif Compile_Time_Known_Value (N) then
return False;
-- True if object reference with volatile type
elsif Is_Volatile_Object (N) then
return True;
-- True if reference to volatile entity
elsif Is_Entity_Name (N) then
return Treat_As_Volatile (Entity (N));
-- True for slice of volatile array
elsif Nkind (N) = N_Slice then
return Is_Volatile_Reference (Prefix (N));
-- True if volatile component
elsif Nkind_In (N, N_Indexed_Component, N_Selected_Component) then
if (Is_Entity_Name (Prefix (N))
and then Has_Volatile_Components (Entity (Prefix (N))))
or else (Present (Etype (Prefix (N)))
and then Has_Volatile_Components (Etype (Prefix (N))))
then
return True;
else
return Is_Volatile_Reference (Prefix (N));
end if;
-- Otherwise false
else
return False;
end if;
end Is_Volatile_Reference;
--------------------
-- Kill_Dead_Code --
--------------------
procedure Kill_Dead_Code (N : Node_Id; Warn : Boolean := False) is
W : Boolean := Warn;
-- Set False if warnings suppressed
begin
if Present (N) then
Remove_Warning_Messages (N);
-- Generate warning if appropriate
if W then
-- We suppress the warning if this code is under control of an
-- if statement, whose condition is a simple identifier, and
-- either we are in an instance, or warnings off is set for this
-- identifier. The reason for killing it in the instance case is
-- that it is common and reasonable for code to be deleted in
-- instances for various reasons.
-- Could we use Is_Statically_Unevaluated here???
if Nkind (Parent (N)) = N_If_Statement then
declare
C : constant Node_Id := Condition (Parent (N));
begin
if Nkind (C) = N_Identifier
and then
(In_Instance
or else (Present (Entity (C))
and then Has_Warnings_Off (Entity (C))))
then
W := False;
end if;
end;
end if;
-- Generate warning if not suppressed
if W then
Error_Msg_F
("?t?this code can never be executed and has been deleted!",
N);
end if;
end if;
-- Recurse into block statements and bodies to process declarations
-- and statements.
if Nkind (N) = N_Block_Statement
or else Nkind (N) = N_Subprogram_Body
or else Nkind (N) = N_Package_Body
then
Kill_Dead_Code (Declarations (N), False);
Kill_Dead_Code (Statements (Handled_Statement_Sequence (N)));
if Nkind (N) = N_Subprogram_Body then
Set_Is_Eliminated (Defining_Entity (N));
end if;
elsif Nkind (N) = N_Package_Declaration then
Kill_Dead_Code (Visible_Declarations (Specification (N)));
Kill_Dead_Code (Private_Declarations (Specification (N)));
-- ??? After this point, Delete_Tree has been called on all
-- declarations in Specification (N), so references to entities
-- therein look suspicious.
declare
E : Entity_Id := First_Entity (Defining_Entity (N));
begin
while Present (E) loop
if Ekind (E) = E_Operator then
Set_Is_Eliminated (E);
end if;
Next_Entity (E);
end loop;
end;
-- Recurse into composite statement to kill individual statements in
-- particular instantiations.
elsif Nkind (N) = N_If_Statement then
Kill_Dead_Code (Then_Statements (N));
Kill_Dead_Code (Elsif_Parts (N));
Kill_Dead_Code (Else_Statements (N));
elsif Nkind (N) = N_Loop_Statement then
Kill_Dead_Code (Statements (N));
elsif Nkind (N) = N_Case_Statement then
declare
Alt : Node_Id;
begin
Alt := First (Alternatives (N));
while Present (Alt) loop
Kill_Dead_Code (Statements (Alt));
Next (Alt);
end loop;
end;
elsif Nkind (N) = N_Case_Statement_Alternative then
Kill_Dead_Code (Statements (N));
-- Deal with dead instances caused by deleting instantiations
elsif Nkind (N) in N_Generic_Instantiation then
Remove_Dead_Instance (N);
end if;
end if;
end Kill_Dead_Code;
-- Case where argument is a list of nodes to be killed
procedure Kill_Dead_Code (L : List_Id; Warn : Boolean := False) is
N : Node_Id;
W : Boolean;
begin
W := Warn;
if Is_Non_Empty_List (L) then
N := First (L);
while Present (N) loop
Kill_Dead_Code (N, W);
W := False;
Next (N);
end loop;
end if;
end Kill_Dead_Code;
------------------------
-- Known_Non_Negative --
------------------------
function Known_Non_Negative (Opnd : Node_Id) return Boolean is
begin
if Is_OK_Static_Expression (Opnd) and then Expr_Value (Opnd) >= 0 then
return True;
else
declare
Lo : constant Node_Id := Type_Low_Bound (Etype (Opnd));
begin
return
Is_OK_Static_Expression (Lo) and then Expr_Value (Lo) >= 0;
end;
end if;
end Known_Non_Negative;
--------------------
-- Known_Non_Null --
--------------------
function Known_Non_Null (N : Node_Id) return Boolean is
begin
-- Checks for case where N is an entity reference
if Is_Entity_Name (N) and then Present (Entity (N)) then
declare
E : constant Entity_Id := Entity (N);
Op : Node_Kind;
Val : Node_Id;
begin
-- First check if we are in decisive conditional
Get_Current_Value_Condition (N, Op, Val);
if Known_Null (Val) then
if Op = N_Op_Eq then
return False;
elsif Op = N_Op_Ne then
return True;
end if;
end if;
-- If OK to do replacement, test Is_Known_Non_Null flag
if OK_To_Do_Constant_Replacement (E) then
return Is_Known_Non_Null (E);
-- Otherwise if not safe to do replacement, then say so
else
return False;
end if;
end;
-- True if access attribute
elsif Nkind (N) = N_Attribute_Reference
and then Nam_In (Attribute_Name (N), Name_Access,
Name_Unchecked_Access,
Name_Unrestricted_Access)
then
return True;
-- True if allocator
elsif Nkind (N) = N_Allocator then
return True;
-- For a conversion, true if expression is known non-null
elsif Nkind (N) = N_Type_Conversion then
return Known_Non_Null (Expression (N));
-- Above are all cases where the value could be determined to be
-- non-null. In all other cases, we don't know, so return False.
else
return False;
end if;
end Known_Non_Null;
----------------
-- Known_Null --
----------------
function Known_Null (N : Node_Id) return Boolean is
begin
-- Checks for case where N is an entity reference
if Is_Entity_Name (N) and then Present (Entity (N)) then
declare
E : constant Entity_Id := Entity (N);
Op : Node_Kind;
Val : Node_Id;
begin
-- Constant null value is for sure null
if Ekind (E) = E_Constant
and then Known_Null (Constant_Value (E))
then
return True;
end if;
-- First check if we are in decisive conditional
Get_Current_Value_Condition (N, Op, Val);
if Known_Null (Val) then
if Op = N_Op_Eq then
return True;
elsif Op = N_Op_Ne then
return False;
end if;
end if;
-- If OK to do replacement, test Is_Known_Null flag
if OK_To_Do_Constant_Replacement (E) then
return Is_Known_Null (E);
-- Otherwise if not safe to do replacement, then say so
else
return False;
end if;
end;
-- True if explicit reference to null
elsif Nkind (N) = N_Null then
return True;
-- For a conversion, true if expression is known null
elsif Nkind (N) = N_Type_Conversion then
return Known_Null (Expression (N));
-- Above are all cases where the value could be determined to be null.
-- In all other cases, we don't know, so return False.
else
return False;
end if;
end Known_Null;
-----------------------------
-- Make_CW_Equivalent_Type --
-----------------------------
-- Create a record type used as an equivalent of any member of the class
-- which takes its size from exp.
-- Generate the following code:
-- type Equiv_T is record
-- _parent : T (List of discriminant constraints taken from Exp);
-- Ext__50 : Storage_Array (1 .. (Exp'size - Typ'object_size)/8);
-- end Equiv_T;
--
-- ??? Note that this type does not guarantee same alignment as all
-- derived types
function Make_CW_Equivalent_Type
(T : Entity_Id;
E : Node_Id) return Entity_Id
is
Loc : constant Source_Ptr := Sloc (E);
Root_Typ : constant Entity_Id := Root_Type (T);
List_Def : constant List_Id := Empty_List;
Comp_List : constant List_Id := New_List;
Equiv_Type : Entity_Id;
Range_Type : Entity_Id;
Str_Type : Entity_Id;
Constr_Root : Entity_Id;
Sizexpr : Node_Id;
begin
-- If the root type is already constrained, there are no discriminants
-- in the expression.
if not Has_Discriminants (Root_Typ)
or else Is_Constrained (Root_Typ)
then
Constr_Root := Root_Typ;
-- At this point in the expansion, non-limited view of the type
-- must be available, otherwise the error will be reported later.
if From_Limited_With (Constr_Root)
and then Present (Non_Limited_View (Constr_Root))
then
Constr_Root := Non_Limited_View (Constr_Root);
end if;
else
Constr_Root := Make_Temporary (Loc, 'R');
-- subtype cstr__n is T (List of discr constraints taken from Exp)
Append_To (List_Def,
Make_Subtype_Declaration (Loc,
Defining_Identifier => Constr_Root,
Subtype_Indication => Make_Subtype_From_Expr (E, Root_Typ)));
end if;
-- Generate the range subtype declaration
Range_Type := Make_Temporary (Loc, 'G');
if not Is_Interface (Root_Typ) then
-- subtype rg__xx is
-- Storage_Offset range 1 .. (Expr'size - typ'size) / Storage_Unit
Sizexpr :=
Make_Op_Subtract (Loc,
Left_Opnd =>
Make_Attribute_Reference (Loc,
Prefix =>
OK_Convert_To (T, Duplicate_Subexpr_No_Checks (E)),
Attribute_Name => Name_Size),
Right_Opnd =>
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Constr_Root, Loc),
Attribute_Name => Name_Object_Size));
else
-- subtype rg__xx is
-- Storage_Offset range 1 .. Expr'size / Storage_Unit
Sizexpr :=
Make_Attribute_Reference (Loc,
Prefix =>
OK_Convert_To (T, Duplicate_Subexpr_No_Checks (E)),
Attribute_Name => Name_Size);
end if;
Set_Paren_Count (Sizexpr, 1);
Append_To (List_Def,
Make_Subtype_Declaration (Loc,
Defining_Identifier => Range_Type,
Subtype_Indication =>
Make_Subtype_Indication (Loc,
Subtype_Mark => New_Occurrence_Of (RTE (RE_Storage_Offset), Loc),
Constraint => Make_Range_Constraint (Loc,
Range_Expression =>
Make_Range (Loc,
Low_Bound => Make_Integer_Literal (Loc, 1),
High_Bound =>
Make_Op_Divide (Loc,
Left_Opnd => Sizexpr,
Right_Opnd => Make_Integer_Literal (Loc,
Intval => System_Storage_Unit)))))));
-- subtype str__nn is Storage_Array (rg__x);
Str_Type := Make_Temporary (Loc, 'S');
Append_To (List_Def,
Make_Subtype_Declaration (Loc,
Defining_Identifier => Str_Type,
Subtype_Indication =>
Make_Subtype_Indication (Loc,
Subtype_Mark => New_Occurrence_Of (RTE (RE_Storage_Array), Loc),
Constraint =>
Make_Index_Or_Discriminant_Constraint (Loc,
Constraints =>
New_List (New_Occurrence_Of (Range_Type, Loc))))));
-- type Equiv_T is record
-- [ _parent : Tnn; ]
-- E : Str_Type;
-- end Equiv_T;
Equiv_Type := Make_Temporary (Loc, 'T');
Set_Ekind (Equiv_Type, E_Record_Type);
Set_Parent_Subtype (Equiv_Type, Constr_Root);
-- Set Is_Class_Wide_Equivalent_Type very early to trigger the special
-- treatment for this type. In particular, even though _parent's type
-- is a controlled type or contains controlled components, we do not
-- want to set Has_Controlled_Component on it to avoid making it gain
-- an unwanted _controller component.
Set_Is_Class_Wide_Equivalent_Type (Equiv_Type);
-- A class-wide equivalent type does not require initialization
Set_Suppress_Initialization (Equiv_Type);
if not Is_Interface (Root_Typ) then
Append_To (Comp_List,
Make_Component_Declaration (Loc,
Defining_Identifier =>
Make_Defining_Identifier (Loc, Name_uParent),
Component_Definition =>
Make_Component_Definition (Loc,
Aliased_Present => False,
Subtype_Indication => New_Occurrence_Of (Constr_Root, Loc))));
end if;
Append_To (Comp_List,
Make_Component_Declaration (Loc,
Defining_Identifier => Make_Temporary (Loc, 'C'),
Component_Definition =>
Make_Component_Definition (Loc,
Aliased_Present => False,
Subtype_Indication => New_Occurrence_Of (Str_Type, Loc))));
Append_To (List_Def,
Make_Full_Type_Declaration (Loc,
Defining_Identifier => Equiv_Type,
Type_Definition =>
Make_Record_Definition (Loc,
Component_List =>
Make_Component_List (Loc,
Component_Items => Comp_List,
Variant_Part => Empty))));
-- Suppress all checks during the analysis of the expanded code to avoid
-- the generation of spurious warnings under ZFP run-time.
Insert_Actions (E, List_Def, Suppress => All_Checks);
return Equiv_Type;
end Make_CW_Equivalent_Type;
-------------------------
-- Make_Invariant_Call --
-------------------------
function Make_Invariant_Call (Expr : Node_Id) return Node_Id is
Loc : constant Source_Ptr := Sloc (Expr);
Typ : constant Entity_Id := Base_Type (Etype (Expr));
Proc_Id : Entity_Id;
begin
pragma Assert (Has_Invariants (Typ));
Proc_Id := Invariant_Procedure (Typ);
pragma Assert (Present (Proc_Id));
return
Make_Procedure_Call_Statement (Loc,
Name => New_Occurrence_Of (Proc_Id, Loc),
Parameter_Associations => New_List (Relocate_Node (Expr)));
end Make_Invariant_Call;
------------------------
-- Make_Literal_Range --
------------------------
function Make_Literal_Range
(Loc : Source_Ptr;
Literal_Typ : Entity_Id) return Node_Id
is
Lo : constant Node_Id :=
New_Copy_Tree (String_Literal_Low_Bound (Literal_Typ));
Index : constant Entity_Id := Etype (Lo);
Hi : Node_Id;
Length_Expr : constant Node_Id :=
Make_Op_Subtract (Loc,
Left_Opnd =>
Make_Integer_Literal (Loc,
Intval => String_Literal_Length (Literal_Typ)),
Right_Opnd =>
Make_Integer_Literal (Loc, 1));
begin
Set_Analyzed (Lo, False);
if Is_Integer_Type (Index) then
Hi :=
Make_Op_Add (Loc,
Left_Opnd => New_Copy_Tree (Lo),
Right_Opnd => Length_Expr);
else
Hi :=
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Val,
Prefix => New_Occurrence_Of (Index, Loc),
Expressions => New_List (
Make_Op_Add (Loc,
Left_Opnd =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Pos,
Prefix => New_Occurrence_Of (Index, Loc),
Expressions => New_List (New_Copy_Tree (Lo))),
Right_Opnd => Length_Expr)));
end if;
return
Make_Range (Loc,
Low_Bound => Lo,
High_Bound => Hi);
end Make_Literal_Range;
--------------------------
-- Make_Non_Empty_Check --
--------------------------
function Make_Non_Empty_Check
(Loc : Source_Ptr;
N : Node_Id) return Node_Id
is
begin
return
Make_Op_Ne (Loc,
Left_Opnd =>
Make_Attribute_Reference (Loc,
Attribute_Name => Name_Length,
Prefix => Duplicate_Subexpr_No_Checks (N, Name_Req => True)),
Right_Opnd =>
Make_Integer_Literal (Loc, 0));
end Make_Non_Empty_Check;
-------------------------
-- Make_Predicate_Call --
-------------------------
-- WARNING: This routine manages Ghost regions. Return statements must be
-- replaced by gotos which jump to the end of the routine and restore the
-- Ghost mode.
function Make_Predicate_Call
(Typ : Entity_Id;
Expr : Node_Id;
Mem : Boolean := False) return Node_Id
is
Loc : constant Source_Ptr := Sloc (Expr);
Call : Node_Id;
Func_Id : Entity_Id;
Mode : Ghost_Mode_Type;
begin
pragma Assert (Present (Predicate_Function (Typ)));
-- The related type may be subject to pragma Ghost. Set the mode now to
-- ensure that the call is properly marked as Ghost.
Set_Ghost_Mode (Typ, Mode);
-- Call special membership version if requested and available
if Mem and then Present (Predicate_Function_M (Typ)) then
Func_Id := Predicate_Function_M (Typ);
else
Func_Id := Predicate_Function (Typ);
end if;
-- Case of calling normal predicate function
Call :=
Make_Function_Call (Loc,
Name => New_Occurrence_Of (Func_Id, Loc),
Parameter_Associations => New_List (Relocate_Node (Expr)));
Restore_Ghost_Mode (Mode);
return Call;
end Make_Predicate_Call;
--------------------------
-- Make_Predicate_Check --
--------------------------
function Make_Predicate_Check
(Typ : Entity_Id;
Expr : Node_Id) return Node_Id
is
procedure Replace_Subtype_Reference (N : Node_Id);
-- Replace current occurrences of the subtype to which a dynamic
-- predicate applies, by the expression that triggers a predicate
-- check. This is needed for aspect Predicate_Failure, for which
-- we do not generate a wrapper procedure, but simply modify the
-- expression for the pragma of the predicate check.
--------------------------------
-- Replace_Subtype_Reference --
--------------------------------
procedure Replace_Subtype_Reference (N : Node_Id) is
begin
Rewrite (N, New_Copy_Tree (Expr));
-- We want to treat the node as if it comes from source, so
-- that ASIS will not ignore it.
Set_Comes_From_Source (N, True);
end Replace_Subtype_Reference;
procedure Replace_Subtype_References is
new Replace_Type_References_Generic (Replace_Subtype_Reference);
-- Local variables
Loc : constant Source_Ptr := Sloc (Expr);
Arg_List : List_Id;
Fail_Expr : Node_Id;
Nam : Name_Id;
-- Start of processing for Make_Predicate_Check
begin
-- If predicate checks are suppressed, then return a null statement. For
-- this call, we check only the scope setting. If the caller wants to
-- check a specific entity's setting, they must do it manually.
if Predicate_Checks_Suppressed (Empty) then
return Make_Null_Statement (Loc);
end if;
-- Do not generate a check within an internal subprogram (stream
-- functions and the like, including including predicate functions).
if Within_Internal_Subprogram then
return Make_Null_Statement (Loc);
end if;
-- Compute proper name to use, we need to get this right so that the
-- right set of check policies apply to the Check pragma we are making.
if Has_Dynamic_Predicate_Aspect (Typ) then
Nam := Name_Dynamic_Predicate;
elsif Has_Static_Predicate_Aspect (Typ) then
Nam := Name_Static_Predicate;
else
Nam := Name_Predicate;
end if;
Arg_List := New_List (
Make_Pragma_Argument_Association (Loc,
Expression => Make_Identifier (Loc, Nam)),
Make_Pragma_Argument_Association (Loc,
Expression => Make_Predicate_Call (Typ, Expr)));
-- If subtype has Predicate_Failure defined, add the correponding
-- expression as an additional pragma parameter, after replacing
-- current instances with the expression being checked.
if Has_Aspect (Typ, Aspect_Predicate_Failure) then
Fail_Expr :=
New_Copy_Tree
(Expression (Find_Aspect (Typ, Aspect_Predicate_Failure)));
Replace_Subtype_References (Fail_Expr, Typ);
Append_To (Arg_List,
Make_Pragma_Argument_Association (Loc,
Expression => Fail_Expr));
end if;
return
Make_Pragma (Loc,
Chars => Name_Check,
Pragma_Argument_Associations => Arg_List);
end Make_Predicate_Check;
----------------------------
-- Make_Subtype_From_Expr --
----------------------------
-- 1. If Expr is an unconstrained array expression, creates
-- Unc_Type(Expr'first(1)..Expr'last(1),..., Expr'first(n)..Expr'last(n))
-- 2. If Expr is a unconstrained discriminated type expression, creates
-- Unc_Type(Expr.Discr1, ... , Expr.Discr_n)
-- 3. If Expr is class-wide, creates an implicit class-wide subtype
function Make_Subtype_From_Expr
(E : Node_Id;
Unc_Typ : Entity_Id;
Related_Id : Entity_Id := Empty) return Node_Id
is
List_Constr : constant List_Id := New_List;
Loc : constant Source_Ptr := Sloc (E);
D : Entity_Id;
Full_Exp : Node_Id;
Full_Subtyp : Entity_Id;
High_Bound : Entity_Id;
Index_Typ : Entity_Id;
Low_Bound : Entity_Id;
Priv_Subtyp : Entity_Id;
Utyp : Entity_Id;
begin
if Is_Private_Type (Unc_Typ)
and then Has_Unknown_Discriminants (Unc_Typ)
then
-- The caller requests a unique external name for both the private
-- and the full subtype.
if Present (Related_Id) then
Full_Subtyp :=
Make_Defining_Identifier (Loc,
Chars => New_External_Name (Chars (Related_Id), 'C'));
Priv_Subtyp :=
Make_Defining_Identifier (Loc,
Chars => New_External_Name (Chars (Related_Id), 'P'));
else
Full_Subtyp := Make_Temporary (Loc, 'C');
Priv_Subtyp := Make_Temporary (Loc, 'P');
end if;
-- Prepare the subtype completion. Use the base type to find the
-- underlying type because the type may be a generic actual or an
-- explicit subtype.
Utyp := Underlying_Type (Base_Type (Unc_Typ));
Full_Exp :=
Unchecked_Convert_To (Utyp, Duplicate_Subexpr_No_Checks (E));
Set_Parent (Full_Exp, Parent (E));
Insert_Action (E,
Make_Subtype_Declaration (Loc,
Defining_Identifier => Full_Subtyp,
Subtype_Indication => Make_Subtype_From_Expr (Full_Exp, Utyp)));
-- Define the dummy private subtype
Set_Ekind (Priv_Subtyp, Subtype_Kind (Ekind (Unc_Typ)));
Set_Etype (Priv_Subtyp, Base_Type (Unc_Typ));
Set_Scope (Priv_Subtyp, Full_Subtyp);
Set_Is_Constrained (Priv_Subtyp);
Set_Is_Tagged_Type (Priv_Subtyp, Is_Tagged_Type (Unc_Typ));
Set_Is_Itype (Priv_Subtyp);
Set_Associated_Node_For_Itype (Priv_Subtyp, E);
if Is_Tagged_Type (Priv_Subtyp) then
Set_Class_Wide_Type
(Base_Type (Priv_Subtyp), Class_Wide_Type (Unc_Typ));
Set_Direct_Primitive_Operations (Priv_Subtyp,
Direct_Primitive_Operations (Unc_Typ));
end if;
Set_Full_View (Priv_Subtyp, Full_Subtyp);
return New_Occurrence_Of (Priv_Subtyp, Loc);
elsif Is_Array_Type (Unc_Typ) then
Index_Typ := First_Index (Unc_Typ);
for J in 1 .. Number_Dimensions (Unc_Typ) loop
-- Capture the bounds of each index constraint in case the context
-- is an object declaration of an unconstrained type initialized
-- by a function call:
-- Obj : Unconstr_Typ := Func_Call;
-- This scenario requires secondary scope management and the index
-- constraint cannot depend on the temporary used to capture the
-- result of the function call.
-- SS_Mark;
-- Temp : Unconstr_Typ_Ptr := Func_Call'reference;
-- subtype S is Unconstr_Typ (Temp.all'First .. Temp.all'Last);
-- Obj : S := Temp.all;
-- SS_Release; -- Temp is gone at this point, bounds of S are
-- -- non existent.
-- Generate:
-- Low_Bound : constant Base_Type (Index_Typ) := E'First (J);
Low_Bound := Make_Temporary (Loc, 'B');
Insert_Action (E,
Make_Object_Declaration (Loc,
Defining_Identifier => Low_Bound,
Object_Definition =>
New_Occurrence_Of (Base_Type (Etype (Index_Typ)), Loc),
Constant_Present => True,
Expression =>
Make_Attribute_Reference (Loc,
Prefix => Duplicate_Subexpr_No_Checks (E),
Attribute_Name => Name_First,
Expressions => New_List (
Make_Integer_Literal (Loc, J)))));
-- Generate:
-- High_Bound : constant Base_Type (Index_Typ) := E'Last (J);
High_Bound := Make_Temporary (Loc, 'B');
Insert_Action (E,
Make_Object_Declaration (Loc,
Defining_Identifier => High_Bound,
Object_Definition =>
New_Occurrence_Of (Base_Type (Etype (Index_Typ)), Loc),
Constant_Present => True,
Expression =>
Make_Attribute_Reference (Loc,
Prefix => Duplicate_Subexpr_No_Checks (E),
Attribute_Name => Name_Last,
Expressions => New_List (
Make_Integer_Literal (Loc, J)))));
Append_To (List_Constr,
Make_Range (Loc,
Low_Bound => New_Occurrence_Of (Low_Bound, Loc),
High_Bound => New_Occurrence_Of (High_Bound, Loc)));
Index_Typ := Next_Index (Index_Typ);
end loop;
elsif Is_Class_Wide_Type (Unc_Typ) then
declare
CW_Subtype : Entity_Id;
EQ_Typ : Entity_Id := Empty;
begin
-- A class-wide equivalent type is not needed on VM targets
-- because the VM back-ends handle the class-wide object
-- initialization itself (and doesn't need or want the
-- additional intermediate type to handle the assignment).
if Expander_Active and then Tagged_Type_Expansion then
-- If this is the class-wide type of a completion that is a
-- record subtype, set the type of the class-wide type to be
-- the full base type, for use in the expanded code for the
-- equivalent type. Should this be done earlier when the
-- completion is analyzed ???
if Is_Private_Type (Etype (Unc_Typ))
and then
Ekind (Full_View (Etype (Unc_Typ))) = E_Record_Subtype
then
Set_Etype (Unc_Typ, Base_Type (Full_View (Etype (Unc_Typ))));
end if;
EQ_Typ := Make_CW_Equivalent_Type (Unc_Typ, E);
end if;
CW_Subtype := New_Class_Wide_Subtype (Unc_Typ, E);
Set_Equivalent_Type (CW_Subtype, EQ_Typ);
Set_Cloned_Subtype (CW_Subtype, Base_Type (Unc_Typ));
return New_Occurrence_Of (CW_Subtype, Loc);
end;
-- Indefinite record type with discriminants
else
D := First_Discriminant (Unc_Typ);
while Present (D) loop
Append_To (List_Constr,
Make_Selected_Component (Loc,
Prefix => Duplicate_Subexpr_No_Checks (E),
Selector_Name => New_Occurrence_Of (D, Loc)));
Next_Discriminant (D);
end loop;
end if;
return
Make_Subtype_Indication (Loc,
Subtype_Mark => New_Occurrence_Of (Unc_Typ, Loc),
Constraint =>
Make_Index_Or_Discriminant_Constraint (Loc,
Constraints => List_Constr));
end Make_Subtype_From_Expr;
----------------------------
-- Matching_Standard_Type --
----------------------------
function Matching_Standard_Type (Typ : Entity_Id) return Entity_Id is
pragma Assert (Is_Scalar_Type (Typ));
Siz : constant Uint := Esize (Typ);
begin
-- Floating-point cases
if Is_Floating_Point_Type (Typ) then
if Siz <= Esize (Standard_Short_Float) then
return Standard_Short_Float;
elsif Siz <= Esize (Standard_Float) then
return Standard_Float;
elsif Siz <= Esize (Standard_Long_Float) then
return Standard_Long_Float;
elsif Siz <= Esize (Standard_Long_Long_Float) then
return Standard_Long_Long_Float;
else
raise Program_Error;
end if;
-- Integer cases (includes fixed-point types)
-- Unsigned integer cases (includes normal enumeration types)
elsif Is_Unsigned_Type (Typ) then
if Siz <= Esize (Standard_Short_Short_Unsigned) then
return Standard_Short_Short_Unsigned;
elsif Siz <= Esize (Standard_Short_Unsigned) then
return Standard_Short_Unsigned;
elsif Siz <= Esize (Standard_Unsigned) then
return Standard_Unsigned;
elsif Siz <= Esize (Standard_Long_Unsigned) then
return Standard_Long_Unsigned;
elsif Siz <= Esize (Standard_Long_Long_Unsigned) then
return Standard_Long_Long_Unsigned;
else
raise Program_Error;
end if;
-- Signed integer cases
else
if Siz <= Esize (Standard_Short_Short_Integer) then
return Standard_Short_Short_Integer;
elsif Siz <= Esize (Standard_Short_Integer) then
return Standard_Short_Integer;
elsif Siz <= Esize (Standard_Integer) then
return Standard_Integer;
elsif Siz <= Esize (Standard_Long_Integer) then
return Standard_Long_Integer;
elsif Siz <= Esize (Standard_Long_Long_Integer) then
return Standard_Long_Long_Integer;
else
raise Program_Error;
end if;
end if;
end Matching_Standard_Type;
-----------------------------
-- May_Generate_Large_Temp --
-----------------------------
-- At the current time, the only types that we return False for (i.e. where
-- we decide we know they cannot generate large temps) are ones where we
-- know the size is 256 bits or less at compile time, and we are still not
-- doing a thorough job on arrays and records ???
function May_Generate_Large_Temp (Typ : Entity_Id) return Boolean is
begin
if not Size_Known_At_Compile_Time (Typ) then
return False;
elsif Esize (Typ) /= 0 and then Esize (Typ) <= 256 then
return False;
elsif Is_Array_Type (Typ)
and then Present (Packed_Array_Impl_Type (Typ))
then
return May_Generate_Large_Temp (Packed_Array_Impl_Type (Typ));
-- We could do more here to find other small types ???
else
return True;
end if;
end May_Generate_Large_Temp;
------------------------
-- Needs_Finalization --
------------------------
function Needs_Finalization (T : Entity_Id) return Boolean is
function Has_Some_Controlled_Component (Rec : Entity_Id) return Boolean;
-- If type is not frozen yet, check explicitly among its components,
-- because the Has_Controlled_Component flag is not necessarily set.
-----------------------------------
-- Has_Some_Controlled_Component --
-----------------------------------
function Has_Some_Controlled_Component
(Rec : Entity_Id) return Boolean
is
Comp : Entity_Id;
begin
if Has_Controlled_Component (Rec) then
return True;
elsif not Is_Frozen (Rec) then
if Is_Record_Type (Rec) then
Comp := First_Entity (Rec);
while Present (Comp) loop
if not Is_Type (Comp)
and then Needs_Finalization (Etype (Comp))
then
return True;
end if;
Next_Entity (Comp);
end loop;
return False;
else
return
Is_Array_Type (Rec)
and then Needs_Finalization (Component_Type (Rec));
end if;
else
return False;
end if;
end Has_Some_Controlled_Component;
-- Start of processing for Needs_Finalization
begin
-- Certain run-time configurations and targets do not provide support
-- for controlled types.
if Restriction_Active (No_Finalization) then
return False;
-- C++ types are not considered controlled. It is assumed that the
-- non-Ada side will handle their clean up.
elsif Convention (T) = Convention_CPP then
return False;
-- Never needs finalization if Disable_Controlled set
elsif Disable_Controlled (T) then
return False;
elsif Is_Class_Wide_Type (T) and then Disable_Controlled (Etype (T)) then
return False;
else
-- Class-wide types are treated as controlled because derivations
-- from the root type can introduce controlled components.
return Is_Class_Wide_Type (T)
or else Is_Controlled (T)
or else Has_Some_Controlled_Component (T)
or else
(Is_Concurrent_Type (T)
and then Present (Corresponding_Record_Type (T))
and then Needs_Finalization (Corresponding_Record_Type (T)));
end if;
end Needs_Finalization;
----------------------------
-- Needs_Constant_Address --
----------------------------
function Needs_Constant_Address
(Decl : Node_Id;
Typ : Entity_Id) return Boolean
is
begin
-- If we have no initialization of any kind, then we don't need to place
-- any restrictions on the address clause, because the object will be
-- elaborated after the address clause is evaluated. This happens if the
-- declaration has no initial expression, or the type has no implicit
-- initialization, or the object is imported.
-- The same holds for all initialized scalar types and all access types.
-- Packed bit arrays of size up to 64 are represented using a modular
-- type with an initialization (to zero) and can be processed like other
-- initialized scalar types.
-- If the type is controlled, code to attach the object to a
-- finalization chain is generated at the point of declaration, and
-- therefore the elaboration of the object cannot be delayed: the
-- address expression must be a constant.
if No (Expression (Decl))
and then not Needs_Finalization (Typ)
and then
(not Has_Non_Null_Base_Init_Proc (Typ)
or else Is_Imported (Defining_Identifier (Decl)))
then
return False;
elsif (Present (Expression (Decl)) and then Is_Scalar_Type (Typ))
or else Is_Access_Type (Typ)
or else
(Is_Bit_Packed_Array (Typ)
and then Is_Modular_Integer_Type (Packed_Array_Impl_Type (Typ)))
then
return False;
else
-- Otherwise, we require the address clause to be constant because
-- the call to the initialization procedure (or the attach code) has
-- to happen at the point of the declaration.
-- Actually the IP call has been moved to the freeze actions anyway,
-- so maybe we can relax this restriction???
return True;
end if;
end Needs_Constant_Address;
----------------------------
-- New_Class_Wide_Subtype --
----------------------------
function New_Class_Wide_Subtype
(CW_Typ : Entity_Id;
N : Node_Id) return Entity_Id
is
Res : constant Entity_Id := Create_Itype (E_Void, N);
Res_Name : constant Name_Id := Chars (Res);
Res_Scope : constant Entity_Id := Scope (Res);
begin
Copy_Node (CW_Typ, Res);
Set_Comes_From_Source (Res, False);
Set_Sloc (Res, Sloc (N));
Set_Is_Itype (Res);
Set_Associated_Node_For_Itype (Res, N);
Set_Is_Public (Res, False); -- By default, may be changed below.
Set_Public_Status (Res);
Set_Chars (Res, Res_Name);
Set_Scope (Res, Res_Scope);
Set_Ekind (Res, E_Class_Wide_Subtype);
Set_Next_Entity (Res, Empty);
Set_Etype (Res, Base_Type (CW_Typ));
Set_Is_Frozen (Res, False);
Set_Freeze_Node (Res, Empty);
return (Res);
end New_Class_Wide_Subtype;
--------------------------------
-- Non_Limited_Designated_Type --
---------------------------------
function Non_Limited_Designated_Type (T : Entity_Id) return Entity_Id is
Desig : constant Entity_Id := Designated_Type (T);
begin
if Has_Non_Limited_View (Desig) then
return Non_Limited_View (Desig);
else
return Desig;
end if;
end Non_Limited_Designated_Type;
-----------------------------------
-- OK_To_Do_Constant_Replacement --
-----------------------------------
function OK_To_Do_Constant_Replacement (E : Entity_Id) return Boolean is
ES : constant Entity_Id := Scope (E);
CS : Entity_Id;
begin
-- Do not replace statically allocated objects, because they may be
-- modified outside the current scope.
if Is_Statically_Allocated (E) then
return False;
-- Do not replace aliased or volatile objects, since we don't know what
-- else might change the value.
elsif Is_Aliased (E) or else Treat_As_Volatile (E) then
return False;
-- Debug flag -gnatdM disconnects this optimization
elsif Debug_Flag_MM then
return False;
-- Otherwise check scopes
else
CS := Current_Scope;
loop
-- If we are in right scope, replacement is safe
if CS = ES then
return True;
-- Packages do not affect the determination of safety
elsif Ekind (CS) = E_Package then
exit when CS = Standard_Standard;
CS := Scope (CS);
-- Blocks do not affect the determination of safety
elsif Ekind (CS) = E_Block then
CS := Scope (CS);
-- Loops do not affect the determination of safety. Note that we
-- kill all current values on entry to a loop, so we are just
-- talking about processing within a loop here.
elsif Ekind (CS) = E_Loop then
CS := Scope (CS);
-- Otherwise, the reference is dubious, and we cannot be sure that
-- it is safe to do the replacement.
else
exit;
end if;
end loop;
return False;
end if;
end OK_To_Do_Constant_Replacement;
------------------------------------
-- Possible_Bit_Aligned_Component --
------------------------------------
function Possible_Bit_Aligned_Component (N : Node_Id) return Boolean is
begin
-- Do not process an unanalyzed node because it is not yet decorated and
-- most checks performed below will fail.
if not Analyzed (N) then
return False;
end if;
case Nkind (N) is
-- Case of indexed component
when N_Indexed_Component =>
declare
P : constant Node_Id := Prefix (N);
Ptyp : constant Entity_Id := Etype (P);
begin
-- If we know the component size and it is less than 64, then
-- we are definitely OK. The back end always does assignment of
-- misaligned small objects correctly.
if Known_Static_Component_Size (Ptyp)
and then Component_Size (Ptyp) <= 64
then
return False;
-- Otherwise, we need to test the prefix, to see if we are
-- indexing from a possibly unaligned component.
else
return Possible_Bit_Aligned_Component (P);
end if;
end;
-- Case of selected component
when N_Selected_Component =>
declare
P : constant Node_Id := Prefix (N);
Comp : constant Entity_Id := Entity (Selector_Name (N));
begin
-- If there is no component clause, then we are in the clear
-- since the back end will never misalign a large component
-- unless it is forced to do so. In the clear means we need
-- only the recursive test on the prefix.
if Component_May_Be_Bit_Aligned (Comp) then
return True;
else
return Possible_Bit_Aligned_Component (P);
end if;
end;
-- For a slice, test the prefix, if that is possibly misaligned,
-- then for sure the slice is.
when N_Slice =>
return Possible_Bit_Aligned_Component (Prefix (N));
-- For an unchecked conversion, check whether the expression may
-- be bit-aligned.
when N_Unchecked_Type_Conversion =>
return Possible_Bit_Aligned_Component (Expression (N));
-- If we have none of the above, it means that we have fallen off the
-- top testing prefixes recursively, and we now have a stand alone
-- object, where we don't have a problem, unless this is a renaming,
-- in which case we need to look into the renamed object.
when others =>
if Is_Entity_Name (N)
and then Present (Renamed_Object (Entity (N)))
then
return
Possible_Bit_Aligned_Component (Renamed_Object (Entity (N)));
else
return False;
end if;
end case;
end Possible_Bit_Aligned_Component;
-----------------------------------------------
-- Process_Statements_For_Controlled_Objects --
-----------------------------------------------
procedure Process_Statements_For_Controlled_Objects (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
function Are_Wrapped (L : List_Id) return Boolean;
-- Determine whether list L contains only one statement which is a block
function Wrap_Statements_In_Block
(L : List_Id;
Scop : Entity_Id := Current_Scope) return Node_Id;
-- Given a list of statements L, wrap it in a block statement and return
-- the generated node. Scop is either the current scope or the scope of
-- the context (if applicable).
-----------------
-- Are_Wrapped --
-----------------
function Are_Wrapped (L : List_Id) return Boolean is
Stmt : constant Node_Id := First (L);
begin
return
Present (Stmt)
and then No (Next (Stmt))
and then Nkind (Stmt) = N_Block_Statement;
end Are_Wrapped;
------------------------------
-- Wrap_Statements_In_Block --
------------------------------
function Wrap_Statements_In_Block
(L : List_Id;
Scop : Entity_Id := Current_Scope) return Node_Id
is
Block_Id : Entity_Id;
Block_Nod : Node_Id;
Iter_Loop : Entity_Id;
begin
Block_Nod :=
Make_Block_Statement (Loc,
Declarations => No_List,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => L));
-- Create a label for the block in case the block needs to manage the
-- secondary stack. A label allows for flag Uses_Sec_Stack to be set.
Add_Block_Identifier (Block_Nod, Block_Id);
-- When wrapping the statements of an iterator loop, check whether
-- the loop requires secondary stack management and if so, propagate
-- the appropriate flags to the block. This ensures that the cursor
-- is properly cleaned up at each iteration of the loop.
Iter_Loop := Find_Enclosing_Iterator_Loop (Scop);
if Present (Iter_Loop) then
Set_Uses_Sec_Stack (Block_Id, Uses_Sec_Stack (Iter_Loop));
-- Secondary stack reclamation is suppressed when the associated
-- iterator loop contains a return statement which uses the stack.
Set_Sec_Stack_Needed_For_Return
(Block_Id, Sec_Stack_Needed_For_Return (Iter_Loop));
end if;
return Block_Nod;
end Wrap_Statements_In_Block;
-- Local variables
Block : Node_Id;
-- Start of processing for Process_Statements_For_Controlled_Objects
begin
-- Whenever a non-handled statement list is wrapped in a block, the
-- block must be explicitly analyzed to redecorate all entities in the
-- list and ensure that a finalizer is properly built.
case Nkind (N) is
when N_Conditional_Entry_Call
| N_Elsif_Part
| N_If_Statement
| N_Selective_Accept
=>
-- Check the "then statements" for elsif parts and if statements
if Nkind_In (N, N_Elsif_Part, N_If_Statement)
and then not Is_Empty_List (Then_Statements (N))
and then not Are_Wrapped (Then_Statements (N))
and then Requires_Cleanup_Actions
(Then_Statements (N), False, False)
then
Block := Wrap_Statements_In_Block (Then_Statements (N));
Set_Then_Statements (N, New_List (Block));
Analyze (Block);
end if;
-- Check the "else statements" for conditional entry calls, if
-- statements and selective accepts.
if Nkind_In (N, N_Conditional_Entry_Call,
N_If_Statement,
N_Selective_Accept)
and then not Is_Empty_List (Else_Statements (N))
and then not Are_Wrapped (Else_Statements (N))
and then Requires_Cleanup_Actions
(Else_Statements (N), False, False)
then
Block := Wrap_Statements_In_Block (Else_Statements (N));
Set_Else_Statements (N, New_List (Block));
Analyze (Block);
end if;
when N_Abortable_Part
| N_Accept_Alternative
| N_Case_Statement_Alternative
| N_Delay_Alternative
| N_Entry_Call_Alternative
| N_Exception_Handler
| N_Loop_Statement
| N_Triggering_Alternative
=>
if not Is_Empty_List (Statements (N))
and then not Are_Wrapped (Statements (N))
and then Requires_Cleanup_Actions (Statements (N), False, False)
then
if Nkind (N) = N_Loop_Statement
and then Present (Identifier (N))
then
Block :=
Wrap_Statements_In_Block
(L => Statements (N),
Scop => Entity (Identifier (N)));
else
Block := Wrap_Statements_In_Block (Statements (N));
end if;
Set_Statements (N, New_List (Block));
Analyze (Block);
end if;
when others =>
null;
end case;
end Process_Statements_For_Controlled_Objects;
------------------
-- Power_Of_Two --
------------------
function Power_Of_Two (N : Node_Id) return Nat is
Typ : constant Entity_Id := Etype (N);
pragma Assert (Is_Integer_Type (Typ));
Siz : constant Nat := UI_To_Int (Esize (Typ));
Val : Uint;
begin
if not Compile_Time_Known_Value (N) then
return 0;
else
Val := Expr_Value (N);
for J in 1 .. Siz - 1 loop
if Val = Uint_2 ** J then
return J;
end if;
end loop;
return 0;
end if;
end Power_Of_Two;
----------------------
-- Remove_Init_Call --
----------------------
function Remove_Init_Call
(Var : Entity_Id;
Rep_Clause : Node_Id) return Node_Id
is
Par : constant Node_Id := Parent (Var);
Typ : constant Entity_Id := Etype (Var);
Init_Proc : Entity_Id;
-- Initialization procedure for Typ
function Find_Init_Call_In_List (From : Node_Id) return Node_Id;
-- Look for init call for Var starting at From and scanning the
-- enclosing list until Rep_Clause or the end of the list is reached.
----------------------------
-- Find_Init_Call_In_List --
----------------------------
function Find_Init_Call_In_List (From : Node_Id) return Node_Id is
Init_Call : Node_Id;
begin
Init_Call := From;
while Present (Init_Call) and then Init_Call /= Rep_Clause loop
if Nkind (Init_Call) = N_Procedure_Call_Statement
and then Is_Entity_Name (Name (Init_Call))
and then Entity (Name (Init_Call)) = Init_Proc
then
return Init_Call;
end if;
Next (Init_Call);
end loop;
return Empty;
end Find_Init_Call_In_List;
Init_Call : Node_Id;
-- Start of processing for Find_Init_Call
begin
if Present (Initialization_Statements (Var)) then
Init_Call := Initialization_Statements (Var);
Set_Initialization_Statements (Var, Empty);
elsif not Has_Non_Null_Base_Init_Proc (Typ) then
-- No init proc for the type, so obviously no call to be found
return Empty;
else
-- We might be able to handle other cases below by just properly
-- setting Initialization_Statements at the point where the init proc
-- call is generated???
Init_Proc := Base_Init_Proc (Typ);
-- First scan the list containing the declaration of Var
Init_Call := Find_Init_Call_In_List (From => Next (Par));
-- If not found, also look on Var's freeze actions list, if any,
-- since the init call may have been moved there (case of an address
-- clause applying to Var).
if No (Init_Call) and then Present (Freeze_Node (Var)) then
Init_Call :=
Find_Init_Call_In_List (First (Actions (Freeze_Node (Var))));
end if;
-- If the initialization call has actuals that use the secondary
-- stack, the call may have been wrapped into a temporary block, in
-- which case the block itself has to be removed.
if No (Init_Call) and then Nkind (Next (Par)) = N_Block_Statement then
declare
Blk : constant Node_Id := Next (Par);
begin
if Present
(Find_Init_Call_In_List
(First (Statements (Handled_Statement_Sequence (Blk)))))
then
Init_Call := Blk;
end if;
end;
end if;
end if;
if Present (Init_Call) then
Remove (Init_Call);
end if;
return Init_Call;
end Remove_Init_Call;
-------------------------
-- Remove_Side_Effects --
-------------------------
procedure Remove_Side_Effects
(Exp : Node_Id;
Name_Req : Boolean := False;
Renaming_Req : Boolean := False;
Variable_Ref : Boolean := False;
Related_Id : Entity_Id := Empty;
Is_Low_Bound : Boolean := False;
Is_High_Bound : Boolean := False;
Check_Side_Effects : Boolean := True)
is
function Build_Temporary
(Loc : Source_Ptr;
Id : Character;
Related_Nod : Node_Id := Empty) return Entity_Id;
-- Create an external symbol of the form xxx_FIRST/_LAST if Related_Nod
-- is present (xxx is taken from the Chars field of Related_Nod),
-- otherwise it generates an internal temporary.
---------------------
-- Build_Temporary --
---------------------
function Build_Temporary
(Loc : Source_Ptr;
Id : Character;
Related_Nod : Node_Id := Empty) return Entity_Id
is
Temp_Nam : Name_Id;
begin
-- The context requires an external symbol
if Present (Related_Id) then
if Is_Low_Bound then
Temp_Nam := New_External_Name (Chars (Related_Id), "_FIRST");
else pragma Assert (Is_High_Bound);
Temp_Nam := New_External_Name (Chars (Related_Id), "_LAST");
end if;
return Make_Defining_Identifier (Loc, Temp_Nam);
-- Otherwise generate an internal temporary
else
return Make_Temporary (Loc, Id, Related_Nod);
end if;
end Build_Temporary;
-- Local variables
Loc : constant Source_Ptr := Sloc (Exp);
Exp_Type : constant Entity_Id := Etype (Exp);
Svg_Suppress : constant Suppress_Record := Scope_Suppress;
Def_Id : Entity_Id;
E : Node_Id;
New_Exp : Node_Id;
Ptr_Typ_Decl : Node_Id;
Ref_Type : Entity_Id;
Res : Node_Id;
-- Start of processing for Remove_Side_Effects
begin
-- Handle cases in which there is nothing to do. In GNATprove mode,
-- removal of side effects is useful for the light expansion of
-- renamings. This removal should only occur when not inside a
-- generic and not doing a pre-analysis.
if not Expander_Active
and (Inside_A_Generic or not Full_Analysis or not GNATprove_Mode)
then
return;
-- Cannot generate temporaries if the invocation to remove side effects
-- was issued too early and the type of the expression is not resolved
-- (this happens because routines Duplicate_Subexpr_XX implicitly invoke
-- Remove_Side_Effects).
elsif No (Exp_Type)
or else Ekind (Exp_Type) = E_Access_Attribute_Type
then
return;
-- Nothing to do if prior expansion determined that a function call does
-- not require side effect removal.
elsif Nkind (Exp) = N_Function_Call
and then No_Side_Effect_Removal (Exp)
then
return;
-- No action needed for side-effect free expressions
elsif Check_Side_Effects
and then Side_Effect_Free (Exp, Name_Req, Variable_Ref)
then
return;
end if;
-- The remaining processing is done with all checks suppressed
-- Note: from now on, don't use return statements, instead do a goto
-- Leave, to ensure that we properly restore Scope_Suppress.Suppress.
Scope_Suppress.Suppress := (others => True);
-- If this is an elementary or a small not by-reference record type, and
-- we need to capture the value, just make a constant; this is cheap and
-- objects of both kinds of types can be bit aligned, so it might not be
-- possible to generate a reference to them. Likewise if this is not a
-- name reference, except for a type conversion because we would enter
-- an infinite recursion with Checks.Apply_Predicate_Check if the target
-- type has predicates (and type conversions need a specific treatment
-- anyway, see below). Also do it if we have a volatile reference and
-- Name_Req is not set (see comments for Side_Effect_Free).
if (Is_Elementary_Type (Exp_Type)
or else (Is_Record_Type (Exp_Type)
and then Known_Static_RM_Size (Exp_Type)
and then RM_Size (Exp_Type) <= 64
and then not Has_Discriminants (Exp_Type)
and then not Is_By_Reference_Type (Exp_Type)))
and then (Variable_Ref
or else (not Is_Name_Reference (Exp)
and then Nkind (Exp) /= N_Type_Conversion)
or else (not Name_Req
and then Is_Volatile_Reference (Exp)))
then
Def_Id := Build_Temporary (Loc, 'R', Exp);
Set_Etype (Def_Id, Exp_Type);
Res := New_Occurrence_Of (Def_Id, Loc);
-- If the expression is a packed reference, it must be reanalyzed and
-- expanded, depending on context. This is the case for actuals where
-- a constraint check may capture the actual before expansion of the
-- call is complete.
if Nkind (Exp) = N_Indexed_Component
and then Is_Packed (Etype (Prefix (Exp)))
then
Set_Analyzed (Exp, False);
Set_Analyzed (Prefix (Exp), False);
end if;
-- Generate:
-- Rnn : Exp_Type renames Expr;
if Renaming_Req then
E :=
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Def_Id,
Subtype_Mark => New_Occurrence_Of (Exp_Type, Loc),
Name => Relocate_Node (Exp));
-- Generate:
-- Rnn : constant Exp_Type := Expr;
else
E :=
Make_Object_Declaration (Loc,
Defining_Identifier => Def_Id,
Object_Definition => New_Occurrence_Of (Exp_Type, Loc),
Constant_Present => True,
Expression => Relocate_Node (Exp));
Set_Assignment_OK (E);
end if;
Insert_Action (Exp, E);
-- If the expression has the form v.all then we can just capture the
-- pointer, and then do an explicit dereference on the result, but
-- this is not right if this is a volatile reference.
elsif Nkind (Exp) = N_Explicit_Dereference
and then not Is_Volatile_Reference (Exp)
then
Def_Id := Build_Temporary (Loc, 'R', Exp);
Res :=
Make_Explicit_Dereference (Loc, New_Occurrence_Of (Def_Id, Loc));
Insert_Action (Exp,
Make_Object_Declaration (Loc,
Defining_Identifier => Def_Id,
Object_Definition =>
New_Occurrence_Of (Etype (Prefix (Exp)), Loc),
Constant_Present => True,
Expression => Relocate_Node (Prefix (Exp))));
-- Similar processing for an unchecked conversion of an expression of
-- the form v.all, where we want the same kind of treatment.
elsif Nkind (Exp) = N_Unchecked_Type_Conversion
and then Nkind (Expression (Exp)) = N_Explicit_Dereference
then
Remove_Side_Effects (Expression (Exp), Name_Req, Variable_Ref);
goto Leave;
-- If this is a type conversion, leave the type conversion and remove
-- the side effects in the expression. This is important in several
-- circumstances: for change of representations, and also when this is a
-- view conversion to a smaller object, where gigi can end up creating
-- its own temporary of the wrong size.
elsif Nkind (Exp) = N_Type_Conversion then
Remove_Side_Effects (Expression (Exp), Name_Req, Variable_Ref);
-- Generating C code the type conversion of an access to constrained
-- array type into an access to unconstrained array type involves
-- initializing a fat pointer and the expression must be free of
-- side effects to safely compute its bounds.
if Modify_Tree_For_C
and then Is_Access_Type (Etype (Exp))
and then Is_Array_Type (Designated_Type (Etype (Exp)))
and then not Is_Constrained (Designated_Type (Etype (Exp)))
then
Def_Id := Build_Temporary (Loc, 'R', Exp);
Set_Etype (Def_Id, Exp_Type);
Res := New_Occurrence_Of (Def_Id, Loc);
Insert_Action (Exp,
Make_Object_Declaration (Loc,
Defining_Identifier => Def_Id,
Object_Definition => New_Occurrence_Of (Exp_Type, Loc),
Constant_Present => True,
Expression => Relocate_Node (Exp)));
else
goto Leave;
end if;
-- If this is an unchecked conversion that Gigi can't handle, make
-- a copy or a use a renaming to capture the value.
elsif Nkind (Exp) = N_Unchecked_Type_Conversion
and then not Safe_Unchecked_Type_Conversion (Exp)
then
if CW_Or_Has_Controlled_Part (Exp_Type) then
-- Use a renaming to capture the expression, rather than create
-- a controlled temporary.
Def_Id := Build_Temporary (Loc, 'R', Exp);
Res := New_Occurrence_Of (Def_Id, Loc);
Insert_Action (Exp,
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Def_Id,
Subtype_Mark => New_Occurrence_Of (Exp_Type, Loc),
Name => Relocate_Node (Exp)));
else
Def_Id := Build_Temporary (Loc, 'R', Exp);
Set_Etype (Def_Id, Exp_Type);
Res := New_Occurrence_Of (Def_Id, Loc);
E :=
Make_Object_Declaration (Loc,
Defining_Identifier => Def_Id,
Object_Definition => New_Occurrence_Of (Exp_Type, Loc),
Constant_Present => not Is_Variable (Exp),
Expression => Relocate_Node (Exp));
Set_Assignment_OK (E);
Insert_Action (Exp, E);
end if;
-- For expressions that denote names, we can use a renaming scheme.
-- This is needed for correctness in the case of a volatile object of
-- a non-volatile type because the Make_Reference call of the "default"
-- approach would generate an illegal access value (an access value
-- cannot designate such an object - see Analyze_Reference).
elsif Is_Name_Reference (Exp)
-- We skip using this scheme if we have an object of a volatile
-- type and we do not have Name_Req set true (see comments for
-- Side_Effect_Free).
and then (Name_Req or else not Treat_As_Volatile (Exp_Type))
then
Def_Id := Build_Temporary (Loc, 'R', Exp);
Res := New_Occurrence_Of (Def_Id, Loc);
Insert_Action (Exp,
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Def_Id,
Subtype_Mark => New_Occurrence_Of (Exp_Type, Loc),
Name => Relocate_Node (Exp)));
-- If this is a packed reference, or a selected component with
-- a non-standard representation, a reference to the temporary
-- will be replaced by a copy of the original expression (see
-- Exp_Ch2.Expand_Renaming). Otherwise the temporary must be
-- elaborated by gigi, and is of course not to be replaced in-line
-- by the expression it renames, which would defeat the purpose of
-- removing the side-effect.
if Nkind_In (Exp, N_Selected_Component, N_Indexed_Component)
and then Has_Non_Standard_Rep (Etype (Prefix (Exp)))
then
null;
else
Set_Is_Renaming_Of_Object (Def_Id, False);
end if;
-- Avoid generating a variable-sized temporary, by generating the
-- reference just for the function call. The transformation could be
-- refined to apply only when the array component is constrained by a
-- discriminant???
elsif Nkind (Exp) = N_Selected_Component
and then Nkind (Prefix (Exp)) = N_Function_Call
and then Is_Array_Type (Exp_Type)
then
Remove_Side_Effects (Prefix (Exp), Name_Req, Variable_Ref);
goto Leave;
-- Otherwise we generate a reference to the expression
else
-- An expression which is in SPARK mode is considered side effect
-- free if the resulting value is captured by a variable or a
-- constant.
if GNATprove_Mode
and then Nkind (Parent (Exp)) = N_Object_Declaration
then
goto Leave;
-- When generating C code we cannot consider side effect free object
-- declarations that have discriminants and are initialized by means
-- of a function call since on this target there is no secondary
-- stack to store the return value and the expander may generate an
-- extra call to the function to compute the discriminant value. In
-- addition, for targets that have secondary stack, the expansion of
-- functions with side effects involves the generation of an access
-- type to capture the return value stored in the secondary stack;
-- by contrast when generating C code such expansion generates an
-- internal object declaration (no access type involved) which must
-- be identified here to avoid entering into a never-ending loop
-- generating internal object declarations.
elsif Modify_Tree_For_C
and then Nkind (Parent (Exp)) = N_Object_Declaration
and then
(Nkind (Exp) /= N_Function_Call
or else not Has_Discriminants (Exp_Type)
or else Is_Internal_Name
(Chars (Defining_Identifier (Parent (Exp)))))
then
goto Leave;
end if;
-- Special processing for function calls that return a limited type.
-- We need to build a declaration that will enable build-in-place
-- expansion of the call. This is not done if the context is already
-- an object declaration, to prevent infinite recursion.
-- This is relevant only in Ada 2005 mode. In Ada 95 programs we have
-- to accommodate functions returning limited objects by reference.
if Ada_Version >= Ada_2005
and then Nkind (Exp) = N_Function_Call
and then Is_Limited_View (Etype (Exp))
and then Nkind (Parent (Exp)) /= N_Object_Declaration
then
declare
Obj : constant Entity_Id := Make_Temporary (Loc, 'F', Exp);
Decl : Node_Id;
begin
Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Obj,
Object_Definition => New_Occurrence_Of (Exp_Type, Loc),
Expression => Relocate_Node (Exp));
Insert_Action (Exp, Decl);
Set_Etype (Obj, Exp_Type);
Rewrite (Exp, New_Occurrence_Of (Obj, Loc));
goto Leave;
end;
end if;
Def_Id := Build_Temporary (Loc, 'R', Exp);
-- The regular expansion of functions with side effects involves the
-- generation of an access type to capture the return value found on
-- the secondary stack. Since SPARK (and why) cannot process access
-- types, use a different approach which ignores the secondary stack
-- and "copies" the returned object.
-- When generating C code, no need for a 'reference since the
-- secondary stack is not supported.
if GNATprove_Mode or Modify_Tree_For_C then
Res := New_Occurrence_Of (Def_Id, Loc);
Ref_Type := Exp_Type;
-- Regular expansion utilizing an access type and 'reference
else
Res :=
Make_Explicit_Dereference (Loc,
Prefix => New_Occurrence_Of (Def_Id, Loc));
-- Generate:
-- type Ann is access all <Exp_Type>;
Ref_Type := Make_Temporary (Loc, 'A');
Ptr_Typ_Decl :=
Make_Full_Type_Declaration (Loc,
Defining_Identifier => Ref_Type,
Type_Definition =>
Make_Access_To_Object_Definition (Loc,
All_Present => True,
Subtype_Indication =>
New_Occurrence_Of (Exp_Type, Loc)));
Insert_Action (Exp, Ptr_Typ_Decl);
end if;
E := Exp;
if Nkind (E) = N_Explicit_Dereference then
New_Exp := Relocate_Node (Prefix (E));
else
E := Relocate_Node (E);
-- Do not generate a 'reference in SPARK mode or C generation
-- since the access type is not created in the first place.
if GNATprove_Mode or Modify_Tree_For_C then
New_Exp := E;
-- Otherwise generate reference, marking the value as non-null
-- since we know it cannot be null and we don't want a check.
else
New_Exp := Make_Reference (Loc, E);
Set_Is_Known_Non_Null (Def_Id);
end if;
end if;
if Is_Delayed_Aggregate (E) then
-- The expansion of nested aggregates is delayed until the
-- enclosing aggregate is expanded. As aggregates are often
-- qualified, the predicate applies to qualified expressions as
-- well, indicating that the enclosing aggregate has not been
-- expanded yet. At this point the aggregate is part of a
-- stand-alone declaration, and must be fully expanded.
if Nkind (E) = N_Qualified_Expression then
Set_Expansion_Delayed (Expression (E), False);
Set_Analyzed (Expression (E), False);
else
Set_Expansion_Delayed (E, False);
end if;
Set_Analyzed (E, False);
end if;
-- Generating C code of object declarations that have discriminants
-- and are initialized by means of a function call we propagate the
-- discriminants of the parent type to the internally built object.
-- This is needed to avoid generating an extra call to the called
-- function.
-- For example, if we generate here the following declaration, it
-- will be expanded later adding an extra call to evaluate the value
-- of the discriminant (needed to compute the size of the object).
--
-- type Rec (D : Integer) is ...
-- Obj : constant Rec := SomeFunc;
if Modify_Tree_For_C
and then Nkind (Parent (Exp)) = N_Object_Declaration
and then Has_Discriminants (Exp_Type)
and then Nkind (Exp) = N_Function_Call
then
Insert_Action (Exp,
Make_Object_Declaration (Loc,
Defining_Identifier => Def_Id,
Object_Definition => New_Copy_Tree
(Object_Definition (Parent (Exp))),
Constant_Present => True,
Expression => New_Exp));
else
Insert_Action (Exp,
Make_Object_Declaration (Loc,
Defining_Identifier => Def_Id,
Object_Definition => New_Occurrence_Of (Ref_Type, Loc),
Constant_Present => True,
Expression => New_Exp));
end if;
end if;
-- Preserve the Assignment_OK flag in all copies, since at least one
-- copy may be used in a context where this flag must be set (otherwise
-- why would the flag be set in the first place).
Set_Assignment_OK (Res, Assignment_OK (Exp));
-- Finally rewrite the original expression and we are done
Rewrite (Exp, Res);
Analyze_And_Resolve (Exp, Exp_Type);
<<Leave>>
Scope_Suppress := Svg_Suppress;
end Remove_Side_Effects;
---------------------------
-- Represented_As_Scalar --
---------------------------
function Represented_As_Scalar (T : Entity_Id) return Boolean is
UT : constant Entity_Id := Underlying_Type (T);
begin
return Is_Scalar_Type (UT)
or else (Is_Bit_Packed_Array (UT)
and then Is_Scalar_Type (Packed_Array_Impl_Type (UT)));
end Represented_As_Scalar;
------------------------------
-- Requires_Cleanup_Actions --
------------------------------
function Requires_Cleanup_Actions
(N : Node_Id;
Lib_Level : Boolean) return Boolean
is
At_Lib_Level : constant Boolean :=
Lib_Level
and then Nkind_In (N, N_Package_Body,
N_Package_Specification);
-- N is at the library level if the top-most context is a package and
-- the path taken to reach N does not inlcude non-package constructs.
begin
case Nkind (N) is
when N_Accept_Statement
| N_Block_Statement
| N_Entry_Body
| N_Package_Body
| N_Protected_Body
| N_Subprogram_Body
| N_Task_Body
=>
return
Requires_Cleanup_Actions (Declarations (N), At_Lib_Level, True)
or else
(Present (Handled_Statement_Sequence (N))
and then
Requires_Cleanup_Actions
(Statements (Handled_Statement_Sequence (N)),
At_Lib_Level, True));
when N_Package_Specification =>
return
Requires_Cleanup_Actions
(Visible_Declarations (N), At_Lib_Level, True)
or else
Requires_Cleanup_Actions
(Private_Declarations (N), At_Lib_Level, True);
when others =>
return False;
end case;
end Requires_Cleanup_Actions;
------------------------------
-- Requires_Cleanup_Actions --
------------------------------
function Requires_Cleanup_Actions
(L : List_Id;
Lib_Level : Boolean;
Nested_Constructs : Boolean) return Boolean
is
Decl : Node_Id;
Expr : Node_Id;
Obj_Id : Entity_Id;
Obj_Typ : Entity_Id;
Pack_Id : Entity_Id;
Typ : Entity_Id;
begin
if No (L)
or else Is_Empty_List (L)
then
return False;
end if;
Decl := First (L);
while Present (Decl) loop
-- Library-level tagged types
if Nkind (Decl) = N_Full_Type_Declaration then
Typ := Defining_Identifier (Decl);
-- Ignored Ghost types do not need any cleanup actions because
-- they will not appear in the final tree.
if Is_Ignored_Ghost_Entity (Typ) then
null;
elsif Is_Tagged_Type (Typ)
and then Is_Library_Level_Entity (Typ)
and then Convention (Typ) = Convention_Ada
and then Present (Access_Disp_Table (Typ))
and then RTE_Available (RE_Unregister_Tag)
and then not Is_Abstract_Type (Typ)
and then not No_Run_Time_Mode
then
return True;
end if;
-- Regular object declarations
elsif Nkind (Decl) = N_Object_Declaration then
Obj_Id := Defining_Identifier (Decl);
Obj_Typ := Base_Type (Etype (Obj_Id));
Expr := Expression (Decl);
-- Bypass any form of processing for objects which have their
-- finalization disabled. This applies only to objects at the
-- library level.
if Lib_Level and then Finalize_Storage_Only (Obj_Typ) then
null;
-- Finalization of transient objects are treated separately in
-- order to handle sensitive cases. These include:
-- * Aggregate expansion
-- * If, case, and expression with actions expansion
-- * Transient scopes
-- If one of those contexts has marked the transient object as
-- ignored, do not generate finalization actions for it.
elsif Is_Finalized_Transient (Obj_Id)
or else Is_Ignored_Transient (Obj_Id)
then
null;
-- Ignored Ghost objects do not need any cleanup actions because
-- they will not appear in the final tree.
elsif Is_Ignored_Ghost_Entity (Obj_Id) then
null;
-- The expansion of iterator loops generates an object declaration
-- where the Ekind is explicitly set to loop parameter. This is to
-- ensure that the loop parameter behaves as a constant from user
-- code point of view. Such object are never controlled and do not
-- require cleanup actions. An iterator loop over a container of
-- controlled objects does not produce such object declarations.
elsif Ekind (Obj_Id) = E_Loop_Parameter then
return False;
-- The object is of the form:
-- Obj : [constant] Typ [:= Expr];
--
-- Do not process tag-to-class-wide conversions because they do
-- not yield an object. Do not process the incomplete view of a
-- deferred constant. Note that an object initialized by means
-- of a build-in-place function call may appear as a deferred
-- constant after expansion activities. These kinds of objects
-- must be finalized.
elsif not Is_Imported (Obj_Id)
and then Needs_Finalization (Obj_Typ)
and then not Is_Tag_To_Class_Wide_Conversion (Obj_Id)
and then not (Ekind (Obj_Id) = E_Constant
and then not Has_Completion (Obj_Id)
and then No (BIP_Initialization_Call (Obj_Id)))
then
return True;
-- The object is of the form:
-- Obj : Access_Typ := Non_BIP_Function_Call'reference;
--
-- Obj : Access_Typ :=
-- BIP_Function_Call (BIPalloc => 2, ...)'reference;
elsif Is_Access_Type (Obj_Typ)
and then Needs_Finalization
(Available_View (Designated_Type (Obj_Typ)))
and then Present (Expr)
and then
(Is_Secondary_Stack_BIP_Func_Call (Expr)
or else
(Is_Non_BIP_Func_Call (Expr)
and then not Is_Related_To_Func_Return (Obj_Id)))
then
return True;
-- Processing for "hook" objects generated for transient objects
-- declared inside an Expression_With_Actions.
elsif Is_Access_Type (Obj_Typ)
and then Present (Status_Flag_Or_Transient_Decl (Obj_Id))
and then Nkind (Status_Flag_Or_Transient_Decl (Obj_Id)) =
N_Object_Declaration
then
return True;
-- Processing for intermediate results of if expressions where
-- one of the alternatives uses a controlled function call.
elsif Is_Access_Type (Obj_Typ)
and then Present (Status_Flag_Or_Transient_Decl (Obj_Id))
and then Nkind (Status_Flag_Or_Transient_Decl (Obj_Id)) =
N_Defining_Identifier
and then Present (Expr)
and then Nkind (Expr) = N_Null
then
return True;
-- Simple protected objects which use type System.Tasking.
-- Protected_Objects.Protection to manage their locks should be
-- treated as controlled since they require manual cleanup.
elsif Ekind (Obj_Id) = E_Variable
and then (Is_Simple_Protected_Type (Obj_Typ)
or else Has_Simple_Protected_Object (Obj_Typ))
then
return True;
end if;
-- Specific cases of object renamings
elsif Nkind (Decl) = N_Object_Renaming_Declaration then
Obj_Id := Defining_Identifier (Decl);
Obj_Typ := Base_Type (Etype (Obj_Id));
-- Bypass any form of processing for objects which have their
-- finalization disabled. This applies only to objects at the
-- library level.
if Lib_Level and then Finalize_Storage_Only (Obj_Typ) then
null;
-- Ignored Ghost object renamings do not need any cleanup actions
-- because they will not appear in the final tree.
elsif Is_Ignored_Ghost_Entity (Obj_Id) then
null;
-- Return object of a build-in-place function. This case is
-- recognized and marked by the expansion of an extended return
-- statement (see Expand_N_Extended_Return_Statement).
elsif Needs_Finalization (Obj_Typ)
and then Is_Return_Object (Obj_Id)
and then Present (Status_Flag_Or_Transient_Decl (Obj_Id))
then
return True;
-- Detect a case where a source object has been initialized by
-- a controlled function call or another object which was later
-- rewritten as a class-wide conversion of Ada.Tags.Displace.
-- Obj1 : CW_Type := Src_Obj;
-- Obj2 : CW_Type := Function_Call (...);
-- Obj1 : CW_Type renames (... Ada.Tags.Displace (Src_Obj));
-- Tmp : ... := Function_Call (...)'reference;
-- Obj2 : CW_Type renames (... Ada.Tags.Displace (Tmp));
elsif Is_Displacement_Of_Object_Or_Function_Result (Obj_Id) then
return True;
end if;
-- Inspect the freeze node of an access-to-controlled type and look
-- for a delayed finalization master. This case arises when the
-- freeze actions are inserted at a later time than the expansion of
-- the context. Since Build_Finalizer is never called on a single
-- construct twice, the master will be ultimately left out and never
-- finalized. This is also needed for freeze actions of designated
-- types themselves, since in some cases the finalization master is
-- associated with a designated type's freeze node rather than that
-- of the access type (see handling for freeze actions in
-- Build_Finalization_Master).
elsif Nkind (Decl) = N_Freeze_Entity
and then Present (Actions (Decl))
then
Typ := Entity (Decl);
-- Freeze nodes for ignored Ghost types do not need cleanup
-- actions because they will never appear in the final tree.
if Is_Ignored_Ghost_Entity (Typ) then
null;
elsif ((Is_Access_Type (Typ)
and then not Is_Access_Subprogram_Type (Typ)
and then Needs_Finalization
(Available_View (Designated_Type (Typ))))
or else (Is_Type (Typ) and then Needs_Finalization (Typ)))
and then Requires_Cleanup_Actions
(Actions (Decl), Lib_Level, Nested_Constructs)
then
return True;
end if;
-- Nested package declarations
elsif Nested_Constructs
and then Nkind (Decl) = N_Package_Declaration
then
Pack_Id := Defining_Entity (Decl);
-- Do not inspect an ignored Ghost package because all code found
-- within will not appear in the final tree.
if Is_Ignored_Ghost_Entity (Pack_Id) then
null;
elsif Ekind (Pack_Id) /= E_Generic_Package
and then Requires_Cleanup_Actions
(Specification (Decl), Lib_Level)
then
return True;
end if;
-- Nested package bodies
elsif Nested_Constructs and then Nkind (Decl) = N_Package_Body then
-- Do not inspect an ignored Ghost package body because all code
-- found within will not appear in the final tree.
if Is_Ignored_Ghost_Entity (Defining_Entity (Decl)) then
null;
elsif Ekind (Corresponding_Spec (Decl)) /= E_Generic_Package
and then Requires_Cleanup_Actions (Decl, Lib_Level)
then
return True;
end if;
elsif Nkind (Decl) = N_Block_Statement
and then
-- Handle a rare case caused by a controlled transient object
-- created as part of a record init proc. The variable is wrapped
-- in a block, but the block is not associated with a transient
-- scope.
(Inside_Init_Proc
-- Handle the case where the original context has been wrapped in
-- a block to avoid interference between exception handlers and
-- At_End handlers. Treat the block as transparent and process its
-- contents.
or else Is_Finalization_Wrapper (Decl))
then
if Requires_Cleanup_Actions (Decl, Lib_Level) then
return True;
end if;
end if;
Next (Decl);
end loop;
return False;
end Requires_Cleanup_Actions;
------------------------------------
-- Safe_Unchecked_Type_Conversion --
------------------------------------
-- Note: this function knows quite a bit about the exact requirements of
-- Gigi with respect to unchecked type conversions, and its code must be
-- coordinated with any changes in Gigi in this area.
-- The above requirements should be documented in Sinfo ???
function Safe_Unchecked_Type_Conversion (Exp : Node_Id) return Boolean is
Otyp : Entity_Id;
Ityp : Entity_Id;
Oalign : Uint;
Ialign : Uint;
Pexp : constant Node_Id := Parent (Exp);
begin
-- If the expression is the RHS of an assignment or object declaration
-- we are always OK because there will always be a target.
-- Object renaming declarations, (generated for view conversions of
-- actuals in inlined calls), like object declarations, provide an
-- explicit type, and are safe as well.
if (Nkind (Pexp) = N_Assignment_Statement
and then Expression (Pexp) = Exp)
or else Nkind_In (Pexp, N_Object_Declaration,
N_Object_Renaming_Declaration)
then
return True;
-- If the expression is the prefix of an N_Selected_Component we should
-- also be OK because GCC knows to look inside the conversion except if
-- the type is discriminated. We assume that we are OK anyway if the
-- type is not set yet or if it is controlled since we can't afford to
-- introduce a temporary in this case.
elsif Nkind (Pexp) = N_Selected_Component
and then Prefix (Pexp) = Exp
then
if No (Etype (Pexp)) then
return True;
else
return
not Has_Discriminants (Etype (Pexp))
or else Is_Constrained (Etype (Pexp));
end if;
end if;
-- Set the output type, this comes from Etype if it is set, otherwise we
-- take it from the subtype mark, which we assume was already fully
-- analyzed.
if Present (Etype (Exp)) then
Otyp := Etype (Exp);
else
Otyp := Entity (Subtype_Mark (Exp));
end if;
-- The input type always comes from the expression, and we assume this
-- is indeed always analyzed, so we can simply get the Etype.
Ityp := Etype (Expression (Exp));
-- Initialize alignments to unknown so far
Oalign := No_Uint;
Ialign := No_Uint;
-- Replace a concurrent type by its corresponding record type and each
-- type by its underlying type and do the tests on those. The original
-- type may be a private type whose completion is a concurrent type, so
-- find the underlying type first.
if Present (Underlying_Type (Otyp)) then
Otyp := Underlying_Type (Otyp);
end if;
if Present (Underlying_Type (Ityp)) then
Ityp := Underlying_Type (Ityp);
end if;
if Is_Concurrent_Type (Otyp) then
Otyp := Corresponding_Record_Type (Otyp);
end if;
if Is_Concurrent_Type (Ityp) then
Ityp := Corresponding_Record_Type (Ityp);
end if;
-- If the base types are the same, we know there is no problem since
-- this conversion will be a noop.
if Implementation_Base_Type (Otyp) = Implementation_Base_Type (Ityp) then
return True;
-- Same if this is an upwards conversion of an untagged type, and there
-- are no constraints involved (could be more general???)
elsif Etype (Ityp) = Otyp
and then not Is_Tagged_Type (Ityp)
and then not Has_Discriminants (Ityp)
and then No (First_Rep_Item (Base_Type (Ityp)))
then
return True;
-- If the expression has an access type (object or subprogram) we assume
-- that the conversion is safe, because the size of the target is safe,
-- even if it is a record (which might be treated as having unknown size
-- at this point).
elsif Is_Access_Type (Ityp) then
return True;
-- If the size of output type is known at compile time, there is never
-- a problem. Note that unconstrained records are considered to be of
-- known size, but we can't consider them that way here, because we are
-- talking about the actual size of the object.
-- We also make sure that in addition to the size being known, we do not
-- have a case which might generate an embarrassingly large temp in
-- stack checking mode.
elsif Size_Known_At_Compile_Time (Otyp)
and then
(not Stack_Checking_Enabled
or else not May_Generate_Large_Temp (Otyp))
and then not (Is_Record_Type (Otyp) and then not Is_Constrained (Otyp))
then
return True;
-- If either type is tagged, then we know the alignment is OK so Gigi
-- will be able to use pointer punning.
elsif Is_Tagged_Type (Otyp) or else Is_Tagged_Type (Ityp) then
return True;
-- If either type is a limited record type, we cannot do a copy, so say
-- safe since there's nothing else we can do.
elsif Is_Limited_Record (Otyp) or else Is_Limited_Record (Ityp) then
return True;
-- Conversions to and from packed array types are always ignored and
-- hence are safe.
elsif Is_Packed_Array_Impl_Type (Otyp)
or else Is_Packed_Array_Impl_Type (Ityp)
then
return True;
end if;
-- The only other cases known to be safe is if the input type's
-- alignment is known to be at least the maximum alignment for the
-- target or if both alignments are known and the output type's
-- alignment is no stricter than the input's. We can use the component
-- type alignment for an array if a type is an unpacked array type.
if Present (Alignment_Clause (Otyp)) then
Oalign := Expr_Value (Expression (Alignment_Clause (Otyp)));
elsif Is_Array_Type (Otyp)
and then Present (Alignment_Clause (Component_Type (Otyp)))
then
Oalign := Expr_Value (Expression (Alignment_Clause
(Component_Type (Otyp))));
end if;
if Present (Alignment_Clause (Ityp)) then
Ialign := Expr_Value (Expression (Alignment_Clause (Ityp)));
elsif Is_Array_Type (Ityp)
and then Present (Alignment_Clause (Component_Type (Ityp)))
then
Ialign := Expr_Value (Expression (Alignment_Clause
(Component_Type (Ityp))));
end if;
if Ialign /= No_Uint and then Ialign > Maximum_Alignment then
return True;
elsif Ialign /= No_Uint
and then Oalign /= No_Uint
and then Ialign <= Oalign
then
return True;
-- Otherwise, Gigi cannot handle this and we must make a temporary
else
return False;
end if;
end Safe_Unchecked_Type_Conversion;
---------------------------------
-- Set_Current_Value_Condition --
---------------------------------
-- Note: the implementation of this procedure is very closely tied to the
-- implementation of Get_Current_Value_Condition. Here we set required
-- Current_Value fields, and in Get_Current_Value_Condition, we interpret
-- them, so they must have a consistent view.
procedure Set_Current_Value_Condition (Cnode : Node_Id) is
procedure Set_Entity_Current_Value (N : Node_Id);
-- If N is an entity reference, where the entity is of an appropriate
-- kind, then set the current value of this entity to Cnode, unless
-- there is already a definite value set there.
procedure Set_Expression_Current_Value (N : Node_Id);
-- If N is of an appropriate form, sets an appropriate entry in current
-- value fields of relevant entities. Multiple entities can be affected
-- in the case of an AND or AND THEN.
------------------------------
-- Set_Entity_Current_Value --
------------------------------
procedure Set_Entity_Current_Value (N : Node_Id) is
begin
if Is_Entity_Name (N) then
declare
Ent : constant Entity_Id := Entity (N);
begin
-- Don't capture if not safe to do so
if not Safe_To_Capture_Value (N, Ent, Cond => True) then
return;
end if;
-- Here we have a case where the Current_Value field may need
-- to be set. We set it if it is not already set to a compile
-- time expression value.
-- Note that this represents a decision that one condition
-- blots out another previous one. That's certainly right if
-- they occur at the same level. If the second one is nested,
-- then the decision is neither right nor wrong (it would be
-- equally OK to leave the outer one in place, or take the new
-- inner one. Really we should record both, but our data
-- structures are not that elaborate.
if Nkind (Current_Value (Ent)) not in N_Subexpr then
Set_Current_Value (Ent, Cnode);
end if;
end;
end if;
end Set_Entity_Current_Value;
----------------------------------
-- Set_Expression_Current_Value --
----------------------------------
procedure Set_Expression_Current_Value (N : Node_Id) is
Cond : Node_Id;
begin
Cond := N;
-- Loop to deal with (ignore for now) any NOT operators present. The
-- presence of NOT operators will be handled properly when we call
-- Get_Current_Value_Condition.
while Nkind (Cond) = N_Op_Not loop
Cond := Right_Opnd (Cond);
end loop;
-- For an AND or AND THEN, recursively process operands
if Nkind (Cond) = N_Op_And or else Nkind (Cond) = N_And_Then then
Set_Expression_Current_Value (Left_Opnd (Cond));
Set_Expression_Current_Value (Right_Opnd (Cond));
return;
end if;
-- Check possible relational operator
if Nkind (Cond) in N_Op_Compare then
if Compile_Time_Known_Value (Right_Opnd (Cond)) then
Set_Entity_Current_Value (Left_Opnd (Cond));
elsif Compile_Time_Known_Value (Left_Opnd (Cond)) then
Set_Entity_Current_Value (Right_Opnd (Cond));
end if;
elsif Nkind_In (Cond,
N_Type_Conversion,
N_Qualified_Expression,
N_Expression_With_Actions)
then
Set_Expression_Current_Value (Expression (Cond));
-- Check possible boolean variable reference
else
Set_Entity_Current_Value (Cond);
end if;
end Set_Expression_Current_Value;
-- Start of processing for Set_Current_Value_Condition
begin
Set_Expression_Current_Value (Condition (Cnode));
end Set_Current_Value_Condition;
--------------------------
-- Set_Elaboration_Flag --
--------------------------
procedure Set_Elaboration_Flag (N : Node_Id; Spec_Id : Entity_Id) is
Loc : constant Source_Ptr := Sloc (N);
Ent : constant Entity_Id := Elaboration_Entity (Spec_Id);
Asn : Node_Id;
begin
if Present (Ent) then
-- Nothing to do if at the compilation unit level, because in this
-- case the flag is set by the binder generated elaboration routine.
if Nkind (Parent (N)) = N_Compilation_Unit then
null;
-- Here we do need to generate an assignment statement
else
Check_Restriction (No_Elaboration_Code, N);
Asn :=
Make_Assignment_Statement (Loc,
Name => New_Occurrence_Of (Ent, Loc),
Expression => Make_Integer_Literal (Loc, Uint_1));
if Nkind (Parent (N)) = N_Subunit then
Insert_After (Corresponding_Stub (Parent (N)), Asn);
else
Insert_After (N, Asn);
end if;
Analyze (Asn);
-- Kill current value indication. This is necessary because the
-- tests of this flag are inserted out of sequence and must not
-- pick up bogus indications of the wrong constant value.
Set_Current_Value (Ent, Empty);
-- If the subprogram is in the current declarative part and
-- 'access has been applied to it, generate an elaboration
-- check at the beginning of the declarations of the body.
if Nkind (N) = N_Subprogram_Body
and then Address_Taken (Spec_Id)
and then
Ekind_In (Scope (Spec_Id), E_Block, E_Procedure, E_Function)
then
declare
Loc : constant Source_Ptr := Sloc (N);
Decls : constant List_Id := Declarations (N);
Chk : Node_Id;
begin
-- No need to generate this check if first entry in the
-- declaration list is a raise of Program_Error now.
if Present (Decls)
and then Nkind (First (Decls)) = N_Raise_Program_Error
then
return;
end if;
-- Otherwise generate the check
Chk :=
Make_Raise_Program_Error (Loc,
Condition =>
Make_Op_Eq (Loc,
Left_Opnd => New_Occurrence_Of (Ent, Loc),
Right_Opnd => Make_Integer_Literal (Loc, Uint_0)),
Reason => PE_Access_Before_Elaboration);
if No (Decls) then
Set_Declarations (N, New_List (Chk));
else
Prepend (Chk, Decls);
end if;
Analyze (Chk);
end;
end if;
end if;
end if;
end Set_Elaboration_Flag;
----------------------------
-- Set_Renamed_Subprogram --
----------------------------
procedure Set_Renamed_Subprogram (N : Node_Id; E : Entity_Id) is
begin
-- If input node is an identifier, we can just reset it
if Nkind (N) = N_Identifier then
Set_Chars (N, Chars (E));
Set_Entity (N, E);
-- Otherwise we have to do a rewrite, preserving Comes_From_Source
else
declare
CS : constant Boolean := Comes_From_Source (N);
begin
Rewrite (N, Make_Identifier (Sloc (N), Chars (E)));
Set_Entity (N, E);
Set_Comes_From_Source (N, CS);
Set_Analyzed (N, True);
end;
end if;
end Set_Renamed_Subprogram;
----------------------
-- Side_Effect_Free --
----------------------
function Side_Effect_Free
(N : Node_Id;
Name_Req : Boolean := False;
Variable_Ref : Boolean := False) return Boolean
is
Typ : constant Entity_Id := Etype (N);
-- Result type of the expression
function Safe_Prefixed_Reference (N : Node_Id) return Boolean;
-- The argument N is a construct where the Prefix is dereferenced if it
-- is an access type and the result is a variable. The call returns True
-- if the construct is side effect free (not considering side effects in
-- other than the prefix which are to be tested by the caller).
function Within_In_Parameter (N : Node_Id) return Boolean;
-- Determines if N is a subcomponent of a composite in-parameter. If so,
-- N is not side-effect free when the actual is global and modifiable
-- indirectly from within a subprogram, because it may be passed by
-- reference. The front-end must be conservative here and assume that
-- this may happen with any array or record type. On the other hand, we
-- cannot create temporaries for all expressions for which this
-- condition is true, for various reasons that might require clearing up
-- ??? For example, discriminant references that appear out of place, or
-- spurious type errors with class-wide expressions. As a result, we
-- limit the transformation to loop bounds, which is so far the only
-- case that requires it.
-----------------------------
-- Safe_Prefixed_Reference --
-----------------------------
function Safe_Prefixed_Reference (N : Node_Id) return Boolean is
begin
-- If prefix is not side effect free, definitely not safe
if not Side_Effect_Free (Prefix (N), Name_Req, Variable_Ref) then
return False;
-- If the prefix is of an access type that is not access-to-constant,
-- then this construct is a variable reference, which means it is to
-- be considered to have side effects if Variable_Ref is set True.
elsif Is_Access_Type (Etype (Prefix (N)))
and then not Is_Access_Constant (Etype (Prefix (N)))
and then Variable_Ref
then
-- Exception is a prefix that is the result of a previous removal
-- of side-effects.
return Is_Entity_Name (Prefix (N))
and then not Comes_From_Source (Prefix (N))
and then Ekind (Entity (Prefix (N))) = E_Constant
and then Is_Internal_Name (Chars (Entity (Prefix (N))));
-- If the prefix is an explicit dereference then this construct is a
-- variable reference, which means it is to be considered to have
-- side effects if Variable_Ref is True.
-- We do NOT exclude dereferences of access-to-constant types because
-- we handle them as constant view of variables.
elsif Nkind (Prefix (N)) = N_Explicit_Dereference
and then Variable_Ref
then
return False;
-- Note: The following test is the simplest way of solving a complex
-- problem uncovered by the following test (Side effect on loop bound
-- that is a subcomponent of a global variable:
-- with Text_Io; use Text_Io;
-- procedure Tloop is
-- type X is
-- record
-- V : Natural := 4;
-- S : String (1..5) := (others => 'a');
-- end record;
-- X1 : X;
-- procedure Modi;
-- generic
-- with procedure Action;
-- procedure Loop_G (Arg : X; Msg : String)
-- procedure Loop_G (Arg : X; Msg : String) is
-- begin
-- Put_Line ("begin loop_g " & Msg & " will loop till: "
-- & Natural'Image (Arg.V));
-- for Index in 1 .. Arg.V loop
-- Text_Io.Put_Line
-- (Natural'Image (Index) & " " & Arg.S (Index));
-- if Index > 2 then
-- Modi;
-- end if;
-- end loop;
-- Put_Line ("end loop_g " & Msg);
-- end;
-- procedure Loop1 is new Loop_G (Modi);
-- procedure Modi is
-- begin
-- X1.V := 1;
-- Loop1 (X1, "from modi");
-- end;
--
-- begin
-- Loop1 (X1, "initial");
-- end;
-- The output of the above program should be:
-- begin loop_g initial will loop till: 4
-- 1 a
-- 2 a
-- 3 a
-- begin loop_g from modi will loop till: 1
-- 1 a
-- end loop_g from modi
-- 4 a
-- begin loop_g from modi will loop till: 1
-- 1 a
-- end loop_g from modi
-- end loop_g initial
-- If a loop bound is a subcomponent of a global variable, a
-- modification of that variable within the loop may incorrectly
-- affect the execution of the loop.
elsif Nkind (Parent (Parent (N))) = N_Loop_Parameter_Specification
and then Within_In_Parameter (Prefix (N))
and then Variable_Ref
then
return False;
-- All other cases are side effect free
else
return True;
end if;
end Safe_Prefixed_Reference;
-------------------------
-- Within_In_Parameter --
-------------------------
function Within_In_Parameter (N : Node_Id) return Boolean is
begin
if not Comes_From_Source (N) then
return False;
elsif Is_Entity_Name (N) then
return Ekind (Entity (N)) = E_In_Parameter;
elsif Nkind_In (N, N_Indexed_Component, N_Selected_Component) then
return Within_In_Parameter (Prefix (N));
else
return False;
end if;
end Within_In_Parameter;
-- Start of processing for Side_Effect_Free
begin
-- If volatile reference, always consider it to have side effects
if Is_Volatile_Reference (N) then
return False;
end if;
-- Note on checks that could raise Constraint_Error. Strictly, if we
-- take advantage of 11.6, these checks do not count as side effects.
-- However, we would prefer to consider that they are side effects,
-- since the back end CSE does not work very well on expressions which
-- can raise Constraint_Error. On the other hand if we don't consider
-- them to be side effect free, then we get some awkward expansions
-- in -gnato mode, resulting in code insertions at a point where we
-- do not have a clear model for performing the insertions.
-- Special handling for entity names
if Is_Entity_Name (N) then
-- A type reference is always side effect free
if Is_Type (Entity (N)) then
return True;
-- Variables are considered to be a side effect if Variable_Ref
-- is set or if we have a volatile reference and Name_Req is off.
-- If Name_Req is True then we can't help returning a name which
-- effectively allows multiple references in any case.
elsif Is_Variable (N, Use_Original_Node => False) then
return not Variable_Ref
and then (not Is_Volatile_Reference (N) or else Name_Req);
-- Any other entity (e.g. a subtype name) is definitely side
-- effect free.
else
return True;
end if;
-- A value known at compile time is always side effect free
elsif Compile_Time_Known_Value (N) then
return True;
-- A variable renaming is not side-effect free, because the renaming
-- will function like a macro in the front-end in some cases, and an
-- assignment can modify the component designated by N, so we need to
-- create a temporary for it.
-- The guard testing for Entity being present is needed at least in
-- the case of rewritten predicate expressions, and may well also be
-- appropriate elsewhere. Obviously we can't go testing the entity
-- field if it does not exist, so it's reasonable to say that this is
-- not the renaming case if it does not exist.
elsif Is_Entity_Name (Original_Node (N))
and then Present (Entity (Original_Node (N)))
and then Is_Renaming_Of_Object (Entity (Original_Node (N)))
and then Ekind (Entity (Original_Node (N))) /= E_Constant
then
declare
RO : constant Node_Id :=
Renamed_Object (Entity (Original_Node (N)));
begin
-- If the renamed object is an indexed component, or an
-- explicit dereference, then the designated object could
-- be modified by an assignment.
if Nkind_In (RO, N_Indexed_Component,
N_Explicit_Dereference)
then
return False;
-- A selected component must have a safe prefix
elsif Nkind (RO) = N_Selected_Component then
return Safe_Prefixed_Reference (RO);
-- In all other cases, designated object cannot be changed so
-- we are side effect free.
else
return True;
end if;
end;
-- Remove_Side_Effects generates an object renaming declaration to
-- capture the expression of a class-wide expression. In VM targets
-- the frontend performs no expansion for dispatching calls to
-- class- wide types since they are handled by the VM. Hence, we must
-- locate here if this node corresponds to a previous invocation of
-- Remove_Side_Effects to avoid a never ending loop in the frontend.
elsif not Tagged_Type_Expansion
and then not Comes_From_Source (N)
and then Nkind (Parent (N)) = N_Object_Renaming_Declaration
and then Is_Class_Wide_Type (Typ)
then
return True;
-- Generating C the type conversion of an access to constrained array
-- type into an access to unconstrained array type involves initializing
-- a fat pointer and the expression cannot be assumed to be free of side
-- effects since it must referenced several times to compute its bounds.
elsif Modify_Tree_For_C
and then Nkind (N) = N_Type_Conversion
and then Is_Access_Type (Typ)
and then Is_Array_Type (Designated_Type (Typ))
and then not Is_Constrained (Designated_Type (Typ))
then
return False;
end if;
-- For other than entity names and compile time known values,
-- check the node kind for special processing.
case Nkind (N) is
-- An attribute reference is side effect free if its expressions
-- are side effect free and its prefix is side effect free or
-- is an entity reference.
-- Is this right? what about x'first where x is a variable???
when N_Attribute_Reference =>
return
Side_Effect_Free (Expressions (N), Name_Req, Variable_Ref)
and then Attribute_Name (N) /= Name_Input
and then (Is_Entity_Name (Prefix (N))
or else Side_Effect_Free
(Prefix (N), Name_Req, Variable_Ref));
-- A binary operator is side effect free if and both operands are
-- side effect free. For this purpose binary operators include
-- membership tests and short circuit forms.
when N_Binary_Op
| N_Membership_Test
| N_Short_Circuit
=>
return Side_Effect_Free (Left_Opnd (N), Name_Req, Variable_Ref)
and then
Side_Effect_Free (Right_Opnd (N), Name_Req, Variable_Ref);
-- An explicit dereference is side effect free only if it is
-- a side effect free prefixed reference.
when N_Explicit_Dereference =>
return Safe_Prefixed_Reference (N);
-- An expression with action is side effect free if its expression
-- is side effect free and it has no actions.
when N_Expression_With_Actions =>
return
Is_Empty_List (Actions (N))
and then Side_Effect_Free
(Expression (N), Name_Req, Variable_Ref);
-- A call to _rep_to_pos is side effect free, since we generate
-- this pure function call ourselves. Moreover it is critically
-- important to make this exception, since otherwise we can have
-- discriminants in array components which don't look side effect
-- free in the case of an array whose index type is an enumeration
-- type with an enumeration rep clause.
-- All other function calls are not side effect free
when N_Function_Call =>
return
Nkind (Name (N)) = N_Identifier
and then Is_TSS (Name (N), TSS_Rep_To_Pos)
and then Side_Effect_Free
(First (Parameter_Associations (N)),
Name_Req, Variable_Ref);
-- An IF expression is side effect free if it's of a scalar type, and
-- all its components are all side effect free (conditions and then
-- actions and else actions). We restrict to scalar types, since it
-- is annoying to deal with things like (if A then B else C)'First
-- where the type involved is a string type.
when N_If_Expression =>
return
Is_Scalar_Type (Typ)
and then Side_Effect_Free
(Expressions (N), Name_Req, Variable_Ref);
-- An indexed component is side effect free if it is a side
-- effect free prefixed reference and all the indexing
-- expressions are side effect free.
when N_Indexed_Component =>
return
Side_Effect_Free (Expressions (N), Name_Req, Variable_Ref)
and then Safe_Prefixed_Reference (N);
-- A type qualification is side effect free if the expression
-- is side effect free.
when N_Qualified_Expression =>
return Side_Effect_Free (Expression (N), Name_Req, Variable_Ref);
-- A selected component is side effect free only if it is a side
-- effect free prefixed reference.
when N_Selected_Component =>
return Safe_Prefixed_Reference (N);
-- A range is side effect free if the bounds are side effect free
when N_Range =>
return Side_Effect_Free (Low_Bound (N), Name_Req, Variable_Ref)
and then
Side_Effect_Free (High_Bound (N), Name_Req, Variable_Ref);
-- A slice is side effect free if it is a side effect free
-- prefixed reference and the bounds are side effect free.
when N_Slice =>
return
Side_Effect_Free (Discrete_Range (N), Name_Req, Variable_Ref)
and then Safe_Prefixed_Reference (N);
-- A type conversion is side effect free if the expression to be
-- converted is side effect free.
when N_Type_Conversion =>
return Side_Effect_Free (Expression (N), Name_Req, Variable_Ref);
-- A unary operator is side effect free if the operand
-- is side effect free.
when N_Unary_Op =>
return Side_Effect_Free (Right_Opnd (N), Name_Req, Variable_Ref);
-- An unchecked type conversion is side effect free only if it
-- is safe and its argument is side effect free.
when N_Unchecked_Type_Conversion =>
return
Safe_Unchecked_Type_Conversion (N)
and then Side_Effect_Free
(Expression (N), Name_Req, Variable_Ref);
-- An unchecked expression is side effect free if its expression
-- is side effect free.
when N_Unchecked_Expression =>
return Side_Effect_Free (Expression (N), Name_Req, Variable_Ref);
-- A literal is side effect free
when N_Character_Literal
| N_Integer_Literal
| N_Real_Literal
| N_String_Literal
=>
return True;
-- We consider that anything else has side effects. This is a bit
-- crude, but we are pretty close for most common cases, and we
-- are certainly correct (i.e. we never return True when the
-- answer should be False).
when others =>
return False;
end case;
end Side_Effect_Free;
-- A list is side effect free if all elements of the list are side
-- effect free.
function Side_Effect_Free
(L : List_Id;
Name_Req : Boolean := False;
Variable_Ref : Boolean := False) return Boolean
is
N : Node_Id;
begin
if L = No_List or else L = Error_List then
return True;
else
N := First (L);
while Present (N) loop
if not Side_Effect_Free (N, Name_Req, Variable_Ref) then
return False;
else
Next (N);
end if;
end loop;
return True;
end if;
end Side_Effect_Free;
----------------------------------
-- Silly_Boolean_Array_Not_Test --
----------------------------------
-- This procedure implements an odd and silly test. We explicitly check
-- for the case where the 'First of the component type is equal to the
-- 'Last of this component type, and if this is the case, we make sure
-- that constraint error is raised. The reason is that the NOT is bound
-- to cause CE in this case, and we will not otherwise catch it.
-- No such check is required for AND and OR, since for both these cases
-- False op False = False, and True op True = True. For the XOR case,
-- see Silly_Boolean_Array_Xor_Test.
-- Believe it or not, this was reported as a bug. Note that nearly always,
-- the test will evaluate statically to False, so the code will be
-- statically removed, and no extra overhead caused.
procedure Silly_Boolean_Array_Not_Test (N : Node_Id; T : Entity_Id) is
Loc : constant Source_Ptr := Sloc (N);
CT : constant Entity_Id := Component_Type (T);
begin
-- The check we install is
-- constraint_error when
-- component_type'first = component_type'last
-- and then array_type'Length /= 0)
-- We need the last guard because we don't want to raise CE for empty
-- arrays since no out of range values result. (Empty arrays with a
-- component type of True .. True -- very useful -- even the ACATS
-- does not test that marginal case).
Insert_Action (N,
Make_Raise_Constraint_Error (Loc,
Condition =>
Make_And_Then (Loc,
Left_Opnd =>
Make_Op_Eq (Loc,
Left_Opnd =>
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (CT, Loc),
Attribute_Name => Name_First),
Right_Opnd =>
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (CT, Loc),
Attribute_Name => Name_Last)),
Right_Opnd => Make_Non_Empty_Check (Loc, Right_Opnd (N))),
Reason => CE_Range_Check_Failed));
end Silly_Boolean_Array_Not_Test;
----------------------------------
-- Silly_Boolean_Array_Xor_Test --
----------------------------------
-- This procedure implements an odd and silly test. We explicitly check
-- for the XOR case where the component type is True .. True, since this
-- will raise constraint error. A special check is required since CE
-- will not be generated otherwise (cf Expand_Packed_Not).
-- No such check is required for AND and OR, since for both these cases
-- False op False = False, and True op True = True, and no check is
-- required for the case of False .. False, since False xor False = False.
-- See also Silly_Boolean_Array_Not_Test
procedure Silly_Boolean_Array_Xor_Test (N : Node_Id; T : Entity_Id) is
Loc : constant Source_Ptr := Sloc (N);
CT : constant Entity_Id := Component_Type (T);
begin
-- The check we install is
-- constraint_error when
-- Boolean (component_type'First)
-- and then Boolean (component_type'Last)
-- and then array_type'Length /= 0)
-- We need the last guard because we don't want to raise CE for empty
-- arrays since no out of range values result (Empty arrays with a
-- component type of True .. True -- very useful -- even the ACATS
-- does not test that marginal case).
Insert_Action (N,
Make_Raise_Constraint_Error (Loc,
Condition =>
Make_And_Then (Loc,
Left_Opnd =>
Make_And_Then (Loc,
Left_Opnd =>
Convert_To (Standard_Boolean,
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (CT, Loc),
Attribute_Name => Name_First)),
Right_Opnd =>
Convert_To (Standard_Boolean,
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (CT, Loc),
Attribute_Name => Name_Last))),
Right_Opnd => Make_Non_Empty_Check (Loc, Right_Opnd (N))),
Reason => CE_Range_Check_Failed));
end Silly_Boolean_Array_Xor_Test;
--------------------------
-- Target_Has_Fixed_Ops --
--------------------------
Integer_Sized_Small : Ureal;
-- Set to 2.0 ** -(Integer'Size - 1) the first time that this function is
-- called (we don't want to compute it more than once).
Long_Integer_Sized_Small : Ureal;
-- Set to 2.0 ** -(Long_Integer'Size - 1) the first time that this function
-- is called (we don't want to compute it more than once)
First_Time_For_THFO : Boolean := True;
-- Set to False after first call (if Fractional_Fixed_Ops_On_Target)
function Target_Has_Fixed_Ops
(Left_Typ : Entity_Id;
Right_Typ : Entity_Id;
Result_Typ : Entity_Id) return Boolean
is
function Is_Fractional_Type (Typ : Entity_Id) return Boolean;
-- Return True if the given type is a fixed-point type with a small
-- value equal to 2 ** (-(T'Object_Size - 1)) and whose values have
-- an absolute value less than 1.0. This is currently limited to
-- fixed-point types that map to Integer or Long_Integer.
------------------------
-- Is_Fractional_Type --
------------------------
function Is_Fractional_Type (Typ : Entity_Id) return Boolean is
begin
if Esize (Typ) = Standard_Integer_Size then
return Small_Value (Typ) = Integer_Sized_Small;
elsif Esize (Typ) = Standard_Long_Integer_Size then
return Small_Value (Typ) = Long_Integer_Sized_Small;
else
return False;
end if;
end Is_Fractional_Type;
-- Start of processing for Target_Has_Fixed_Ops
begin
-- Return False if Fractional_Fixed_Ops_On_Target is false
if not Fractional_Fixed_Ops_On_Target then
return False;
end if;
-- Here the target has Fractional_Fixed_Ops, if first time, compute
-- standard constants used by Is_Fractional_Type.
if First_Time_For_THFO then
First_Time_For_THFO := False;
Integer_Sized_Small :=
UR_From_Components
(Num => Uint_1,
Den => UI_From_Int (Standard_Integer_Size - 1),
Rbase => 2);
Long_Integer_Sized_Small :=
UR_From_Components
(Num => Uint_1,
Den => UI_From_Int (Standard_Long_Integer_Size - 1),
Rbase => 2);
end if;
-- Return True if target supports fixed-by-fixed multiply/divide for
-- fractional fixed-point types (see Is_Fractional_Type) and the operand
-- and result types are equivalent fractional types.
return Is_Fractional_Type (Base_Type (Left_Typ))
and then Is_Fractional_Type (Base_Type (Right_Typ))
and then Is_Fractional_Type (Base_Type (Result_Typ))
and then Esize (Left_Typ) = Esize (Right_Typ)
and then Esize (Left_Typ) = Esize (Result_Typ);
end Target_Has_Fixed_Ops;
------------------------------------------
-- Type_May_Have_Bit_Aligned_Components --
------------------------------------------
function Type_May_Have_Bit_Aligned_Components
(Typ : Entity_Id) return Boolean
is
begin
-- Array type, check component type
if Is_Array_Type (Typ) then
return
Type_May_Have_Bit_Aligned_Components (Component_Type (Typ));
-- Record type, check components
elsif Is_Record_Type (Typ) then
declare
E : Entity_Id;
begin
E := First_Component_Or_Discriminant (Typ);
while Present (E) loop
if Component_May_Be_Bit_Aligned (E)
or else Type_May_Have_Bit_Aligned_Components (Etype (E))
then
return True;
end if;
Next_Component_Or_Discriminant (E);
end loop;
return False;
end;
-- Type other than array or record is always OK
else
return False;
end if;
end Type_May_Have_Bit_Aligned_Components;
-------------------------------
-- Update_Primitives_Mapping --
-------------------------------
procedure Update_Primitives_Mapping
(Inher_Id : Entity_Id;
Subp_Id : Entity_Id)
is
begin
Update_Primitives_Mapping_Of_Types
(Par_Typ => Find_Dispatching_Type (Inher_Id),
Deriv_Typ => Find_Dispatching_Type (Subp_Id));
end Update_Primitives_Mapping;
----------------------------------------
-- Update_Primitives_Mapping_Of_Types --
----------------------------------------
procedure Update_Primitives_Mapping_Of_Types
(Par_Typ : Entity_Id;
Deriv_Typ : Entity_Id)
is
procedure Add_Primitive (Prim : Entity_Id);
-- Find a primitive in the inheritance/overriding chain starting from
-- Prim whose dispatching type is parent type Par_Typ and add a mapping
-- between the result and primitive Prim.
-------------------
-- Add_Primitive --
-------------------
procedure Add_Primitive (Prim : Entity_Id) is
function Ancestor_Primitive (Subp : Entity_Id) return Entity_Id;
-- Return the next ancestor primitive in the inheritance/overriding
-- chain of subprogram Subp. Return Empty if no such primitive is
-- available.
------------------------
-- Ancestor_Primitive --
------------------------
function Ancestor_Primitive (Subp : Entity_Id) return Entity_Id is
Inher_Prim : constant Entity_Id := Alias (Subp);
Over_Prim : constant Entity_Id := Overridden_Operation (Subp);
begin
-- The current subprogram overrides an ancestor primitive
if Present (Over_Prim) then
return Over_Prim;
-- The current subprogram is an internally generated alias of an
-- inherited ancestor primitive.
elsif Present (Inher_Prim) then
return Inher_Prim;
-- Otherwise the current subprogram is the root of the inheritance
-- or overriding chain.
else
return Empty;
end if;
end Ancestor_Primitive;
-- Local variables
Par_Prim : Entity_Id;
-- Start of processing for Add_Primitive
begin
-- Inspect both the inheritance chain through the Alias attribute and
-- the overriding chain through the Overridden_Operation looking for
-- an ancestor primitive with the appropriate dispatching type.
Par_Prim := Prim;
while Present (Par_Prim) loop
exit when Find_Dispatching_Type (Par_Prim) = Par_Typ;
Par_Prim := Ancestor_Primitive (Par_Prim);
end loop;
-- Create a mapping of the form:
-- Parent type primitive -> derived type primitive
if Present (Par_Prim) then
Primitives_Mapping.Set (Par_Prim, Prim);
end if;
end Add_Primitive;
-- Local variables
Deriv_Prim : Entity_Id;
Par_Prim : Entity_Id;
Par_Prims : Elist_Id;
Prim_Elmt : Elmt_Id;
-- Start of processing for Update_Primitives_Mapping_Of_Types
begin
-- Nothing to do if there are no types to work with
if No (Par_Typ) or else No (Deriv_Typ) then
return;
-- Nothing to do if the mapping already exists
elsif Primitives_Mapping.Get (Par_Typ) = Deriv_Typ then
return;
end if;
-- Create a mapping of the form:
-- Parent type -> Derived type
-- to prevent any subsequent attempts to produce the same relations.
Primitives_Mapping.Set (Par_Typ, Deriv_Typ);
-- Inspect the primitives of the derived type and determine whether they
-- relate to the primitives of the parent type. If there is a meaningful
-- relation, create a mapping of the form:
-- Parent type primitive -> Derived type primitive
if Present (Direct_Primitive_Operations (Deriv_Typ)) then
Prim_Elmt := First_Elmt (Direct_Primitive_Operations (Deriv_Typ));
while Present (Prim_Elmt) loop
Deriv_Prim := Node (Prim_Elmt);
if Is_Subprogram (Deriv_Prim)
and then Find_Dispatching_Type (Deriv_Prim) = Deriv_Typ
then
Add_Primitive (Deriv_Prim);
end if;
Next_Elmt (Prim_Elmt);
end loop;
end if;
-- If the parent operation is an interface operation, the overriding
-- indicator is not present. Instead, we get from the interface
-- operation the primitive of the current type that implements it.
if Is_Interface (Par_Typ) then
Par_Prims := Collect_Primitive_Operations (Par_Typ);
if Present (Par_Prims) then
Prim_Elmt := First_Elmt (Par_Prims);
while Present (Prim_Elmt) loop
Par_Prim := Node (Prim_Elmt);
Deriv_Prim :=
Find_Primitive_Covering_Interface (Deriv_Typ, Par_Prim);
if Present (Deriv_Prim) then
Primitives_Mapping.Set (Par_Prim, Deriv_Prim);
end if;
Next_Elmt (Prim_Elmt);
end loop;
end if;
end if;
end Update_Primitives_Mapping_Of_Types;
----------------------------------
-- Within_Case_Or_If_Expression --
----------------------------------
function Within_Case_Or_If_Expression (N : Node_Id) return Boolean is
Par : Node_Id;
begin
-- Locate an enclosing case or if expression. Note that these constructs
-- can be expanded into Expression_With_Actions, hence the test of the
-- original node.
Par := Parent (N);
while Present (Par) loop
if Nkind_In (Original_Node (Par), N_Case_Expression,
N_If_Expression)
then
return True;
-- Prevent the search from going too far
elsif Is_Body_Or_Package_Declaration (Par) then
return False;
end if;
Par := Parent (Par);
end loop;
return False;
end Within_Case_Or_If_Expression;
--------------------------------
-- Within_Internal_Subprogram --
--------------------------------
function Within_Internal_Subprogram return Boolean is
S : Entity_Id;
begin
S := Current_Scope;
while Present (S) and then not Is_Subprogram (S) loop
S := Scope (S);
end loop;
return Present (S)
and then Get_TSS_Name (S) /= TSS_Null
and then not Is_Predicate_Function (S)
and then not Is_Predicate_Function_M (S);
end Within_Internal_Subprogram;
end Exp_Util;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/aggr12.adb | best08618/asylo | 7 | 3204 | <reponame>best08618/asylo<gh_stars>1-10
-- { dg-do compile }
-- { dg-options "-fdump-tree-original" }
package body Aggr12 is
procedure Print (Data : String) is
begin
null;
end;
procedure Test is
begin
Print (Hair_Color_Type'Image (A.I1));
Print (Hair_Color_Type'Image (A.I2));
end;
end Aggr12;
-- { dg-final { scan-tree-dump-not "{.i1=0, .i2=2}" "original" } }
|
source/nodes/program-nodes-function_body_stubs.adb | optikos/oasis | 0 | 30005 | <filename>source/nodes/program-nodes-function_body_stubs.adb
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
package body Program.Nodes.Function_Body_Stubs is
function Create
(Not_Token : Program.Lexical_Elements.Lexical_Element_Access;
Overriding_Token : Program.Lexical_Elements.Lexical_Element_Access;
Function_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Left_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Right_Bracket_Token : Program.Lexical_Elements.Lexical_Element_Access;
Return_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Not_Token_2 : Program.Lexical_Elements.Lexical_Element_Access;
Null_Token : Program.Lexical_Elements.Lexical_Element_Access;
Result_Subtype : not null Program.Elements.Element_Access;
Is_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
Separate_Token : not null Program.Lexical_Elements
.Lexical_Element_Access;
With_Token : Program.Lexical_Elements.Lexical_Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Semicolon_Token : not null Program.Lexical_Elements
.Lexical_Element_Access)
return Function_Body_Stub is
begin
return Result : Function_Body_Stub :=
(Not_Token => Not_Token, Overriding_Token => Overriding_Token,
Function_Token => Function_Token, Name => Name,
Left_Bracket_Token => Left_Bracket_Token, Parameters => Parameters,
Right_Bracket_Token => Right_Bracket_Token,
Return_Token => Return_Token, Not_Token_2 => Not_Token_2,
Null_Token => Null_Token, Result_Subtype => Result_Subtype,
Is_Token => Is_Token, Separate_Token => Separate_Token,
With_Token => With_Token, Aspects => Aspects,
Semicolon_Token => Semicolon_Token, Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
function Create
(Name : not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access;
Parameters : Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access;
Result_Subtype : not null Program.Elements.Element_Access;
Aspects : Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False;
Has_Not : Boolean := False;
Has_Overriding : Boolean := False;
Has_Not_Null : Boolean := False)
return Implicit_Function_Body_Stub is
begin
return Result : Implicit_Function_Body_Stub :=
(Name => Name, Parameters => Parameters,
Result_Subtype => Result_Subtype, Aspects => Aspects,
Is_Part_Of_Implicit => Is_Part_Of_Implicit,
Is_Part_Of_Inherited => Is_Part_Of_Inherited,
Is_Part_Of_Instance => Is_Part_Of_Instance, Has_Not => Has_Not,
Has_Overriding => Has_Overriding, Has_Not_Null => Has_Not_Null,
Enclosing_Element => null)
do
Initialize (Result);
end return;
end Create;
overriding function Name
(Self : Base_Function_Body_Stub)
return not null Program.Elements.Defining_Identifiers
.Defining_Identifier_Access is
begin
return Self.Name;
end Name;
overriding function Parameters
(Self : Base_Function_Body_Stub)
return Program.Elements.Parameter_Specifications
.Parameter_Specification_Vector_Access is
begin
return Self.Parameters;
end Parameters;
overriding function Result_Subtype
(Self : Base_Function_Body_Stub)
return not null Program.Elements.Element_Access is
begin
return Self.Result_Subtype;
end Result_Subtype;
overriding function Aspects
(Self : Base_Function_Body_Stub)
return Program.Elements.Aspect_Specifications
.Aspect_Specification_Vector_Access is
begin
return Self.Aspects;
end Aspects;
overriding function Not_Token
(Self : Function_Body_Stub)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Not_Token;
end Not_Token;
overriding function Overriding_Token
(Self : Function_Body_Stub)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Overriding_Token;
end Overriding_Token;
overriding function Function_Token
(Self : Function_Body_Stub)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Function_Token;
end Function_Token;
overriding function Left_Bracket_Token
(Self : Function_Body_Stub)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Left_Bracket_Token;
end Left_Bracket_Token;
overriding function Right_Bracket_Token
(Self : Function_Body_Stub)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Right_Bracket_Token;
end Right_Bracket_Token;
overriding function Return_Token
(Self : Function_Body_Stub)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Return_Token;
end Return_Token;
overriding function Not_Token_2
(Self : Function_Body_Stub)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Not_Token_2;
end Not_Token_2;
overriding function Null_Token
(Self : Function_Body_Stub)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Null_Token;
end Null_Token;
overriding function Is_Token
(Self : Function_Body_Stub)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Is_Token;
end Is_Token;
overriding function Separate_Token
(Self : Function_Body_Stub)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Separate_Token;
end Separate_Token;
overriding function With_Token
(Self : Function_Body_Stub)
return Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.With_Token;
end With_Token;
overriding function Semicolon_Token
(Self : Function_Body_Stub)
return not null Program.Lexical_Elements.Lexical_Element_Access is
begin
return Self.Semicolon_Token;
end Semicolon_Token;
overriding function Has_Not (Self : Function_Body_Stub) return Boolean is
begin
return Self.Not_Token.Assigned;
end Has_Not;
overriding function Has_Overriding
(Self : Function_Body_Stub)
return Boolean is
begin
return Self.Overriding_Token.Assigned;
end Has_Overriding;
overriding function Has_Not_Null
(Self : Function_Body_Stub)
return Boolean is
begin
return Self.Null_Token.Assigned;
end Has_Not_Null;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Function_Body_Stub)
return Boolean is
begin
return Self.Is_Part_Of_Implicit;
end Is_Part_Of_Implicit;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Function_Body_Stub)
return Boolean is
begin
return Self.Is_Part_Of_Inherited;
end Is_Part_Of_Inherited;
overriding function Is_Part_Of_Instance
(Self : Implicit_Function_Body_Stub)
return Boolean is
begin
return Self.Is_Part_Of_Instance;
end Is_Part_Of_Instance;
overriding function Has_Not
(Self : Implicit_Function_Body_Stub)
return Boolean is
begin
return Self.Has_Not;
end Has_Not;
overriding function Has_Overriding
(Self : Implicit_Function_Body_Stub)
return Boolean is
begin
return Self.Has_Overriding;
end Has_Overriding;
overriding function Has_Not_Null
(Self : Implicit_Function_Body_Stub)
return Boolean is
begin
return Self.Has_Not_Null;
end Has_Not_Null;
procedure Initialize
(Self : aliased in out Base_Function_Body_Stub'Class) is
begin
Set_Enclosing_Element (Self.Name, Self'Unchecked_Access);
for Item in Self.Parameters.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
Set_Enclosing_Element (Self.Result_Subtype, Self'Unchecked_Access);
for Item in Self.Aspects.Each_Element loop
Set_Enclosing_Element (Item.Element, Self'Unchecked_Access);
end loop;
null;
end Initialize;
overriding function Is_Function_Body_Stub_Element
(Self : Base_Function_Body_Stub)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Function_Body_Stub_Element;
overriding function Is_Declaration_Element
(Self : Base_Function_Body_Stub)
return Boolean is
pragma Unreferenced (Self);
begin
return True;
end Is_Declaration_Element;
overriding procedure Visit
(Self : not null access Base_Function_Body_Stub;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class) is
begin
Visitor.Function_Body_Stub (Self);
end Visit;
overriding function To_Function_Body_Stub_Text
(Self : aliased in out Function_Body_Stub)
return Program.Elements.Function_Body_Stubs
.Function_Body_Stub_Text_Access is
begin
return Self'Unchecked_Access;
end To_Function_Body_Stub_Text;
overriding function To_Function_Body_Stub_Text
(Self : aliased in out Implicit_Function_Body_Stub)
return Program.Elements.Function_Body_Stubs
.Function_Body_Stub_Text_Access is
pragma Unreferenced (Self);
begin
return null;
end To_Function_Body_Stub_Text;
end Program.Nodes.Function_Body_Stubs;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.