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
|
---|---|---|---|---|
programs/oeis/254/A254029.asm | karttu/loda | 1 | 4992 | ; A254029: Positive solutions of Monkey and Coconut Problem for the classic case (5 sailors, 1 coconut to the monkey): a(n) = 15625*n - 4 for n >= 1.
; 15621,31246,46871,62496,78121,93746,109371,124996,140621,156246,171871,187496,203121,218746,234371,249996,265621,281246,296871,312496,328121,343746,359371,374996,390621,406246,421871,437496,453121,468746,484371,499996,515621,531246,546871,562496,578121,593746,609371,624996,640621,656246,671871,687496,703121,718746,734371,749996,765621,781246,796871,812496,828121,843746,859371,874996,890621,906246,921871,937496,953121,968746,984371,999996,1015621,1031246,1046871,1062496,1078121,1093746,1109371,1124996,1140621,1156246,1171871,1187496,1203121,1218746,1234371,1249996,1265621,1281246,1296871,1312496,1328121,1343746,1359371,1374996,1390621,1406246,1421871,1437496,1453121,1468746,1484371,1499996,1515621,1531246,1546871,1562496,1578121,1593746,1609371,1624996,1640621,1656246,1671871,1687496,1703121,1718746,1734371,1749996,1765621,1781246,1796871,1812496,1828121,1843746,1859371,1874996,1890621,1906246,1921871,1937496,1953121,1968746,1984371,1999996,2015621,2031246,2046871,2062496,2078121,2093746,2109371,2124996,2140621,2156246,2171871,2187496,2203121,2218746,2234371,2249996,2265621,2281246,2296871,2312496,2328121,2343746,2359371,2374996,2390621,2406246,2421871,2437496,2453121,2468746,2484371,2499996,2515621,2531246,2546871,2562496,2578121,2593746,2609371,2624996,2640621,2656246,2671871,2687496,2703121,2718746,2734371,2749996,2765621,2781246,2796871,2812496,2828121,2843746,2859371,2874996,2890621,2906246,2921871,2937496,2953121,2968746,2984371,2999996,3015621,3031246,3046871,3062496,3078121,3093746,3109371,3124996,3140621,3156246,3171871,3187496,3203121,3218746,3234371,3249996,3265621,3281246,3296871,3312496,3328121,3343746,3359371,3374996,3390621,3406246,3421871,3437496,3453121,3468746,3484371,3499996,3515621,3531246,3546871,3562496,3578121,3593746,3609371,3624996,3640621,3656246,3671871,3687496,3703121,3718746,3734371,3749996,3765621,3781246,3796871,3812496,3828121,3843746,3859371,3874996,3890621,3906246
mov $1,$0
mul $1,15625
add $1,15621
|
Library/Trans/Graphics/Vector/EPS/Export/exportArc.asm | steakknife/pcgeos | 504 | 168427 | <reponame>steakknife/pcgeos<gh_stars>100-1000
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1993 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: PostScript translation library
FILE: exportArc.asm
AUTHOR: <NAME>, Jan 18, 1993
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 1/18/93 Initial revision
DESCRIPTION:
Special code to deal with 3Point arcs.
$Id: exportArc.asm,v 1.1 97/04/07 11:25:16 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ExportArc segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Convert3PointToNormalArc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Does most of the work to deal with 3Point arcs
CALLED BY: INTERNAL
EmitDrawArc3Point, EmitFillArc3Point
PASS: ds:si - points to some type of 3PointArc GStringElement
TGSLocals - stack frame inherited
RETURN: es:di - offset into string buffer after coords written
DESTROYED: ax,bx,cx,dx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 1/18/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
Convert3PointToNormalArc proc far
uses si, ds
tgs local TGSLocals
.enter inherit
; first do some pre-processing of the coords so that we are
; all on the same page when it comes to parameters. This is
; based, of course, on the opcode. There are 5 opcodes all
; together. The 3 draw ones are grouped together, and the
; 2 fill ones are together (sequential in enum value).
clr bh
mov bl, ds:[si].ODATP_opcode ; grab the opcode
sub bl, GR_DRAW_ARC_3POINT ; make into table entry
cmp bl, GR_DRAW_REL_ARC_3POINT_TO-GR_DRAW_ARC_3POINT ;fill?
jbe haveTableIndex ; yes, continue
; if we are doing a fill operation, map the fill ones to the
; draw ones, since (coordinate wise) we'll be producing the
; same thing.
sub bl, GR_FILL_ARC_3POINT-GR_DRAW_ARC_3POINT
; OK, now we know what we're dealing with. Call the right
; setup routine
haveTableIndex:
shl bx, 1 ; *2 for word index
call cs:arc3CoordSetup[bx] ; setup coords
; OK, now they are all reduced to one ThreePointArcParams
; structure. Get on with the real work. We need to calculate
; the bounds of the rectangle that encloses the ellipse that
; defines the arc, along with the starting and ending angles.
call Order3PointsInArc ; put points in order
call Convert3PointToBounds ; bounds => AX,BX,CX,DX
call CalcArcAngles ;
; OK, we have it all. Output the hooey.
segmov es, ss, di
lea di, tgs.TGS_buffer ; es:di -> buffer
movdw bxax, tgs.TGS_newArc.CAP_ang1
call WWFixedToAscii
mov al, ' '
stosb
movdw bxax, tgs.TGS_newArc.CAP_ang2
call WWFixedToAscii
mov al, ' '
stosb
clr bx, ax
tst tgs.TGS_xfactor ; check to see what it is
jz x2OK
movdw bxax, tgs.TGS_newArc.CAP_br.PF_x
x2OK:
call WWFixedToAscii ; save coordinate value
mov al, ' '
stosb
clr bx, ax
tst tgs.TGS_xfactor ; check to see what it is
jz x1OK
movdw bxax, tgs.TGS_newArc.CAP_tl.PF_x
x1OK:
call WWFixedToAscii ; save coordinate value
mov al, ' '
stosb
clr bx, ax
tst tgs.TGS_yfactor ; check to see what it is
jz y2OK
movdw bxax, tgs.TGS_newArc.CAP_br.PF_y
y2OK:
call WWFixedToAscii ; save coordinate value
mov al, ' '
stosb
clr bx, ax
tst tgs.TGS_yfactor ; check to see what it is
jz y1OK
movdw bxax, tgs.TGS_newArc.CAP_tl.PF_y
y1OK:
call WWFixedToAscii ; save coordinate value
mov al, ' '
stosb
.leave
ret
Convert3PointToNormalArc endp
arc3CoordSetup label nptr
word offset Setup3PointArc
word offset Setup3PointArcTo
word offset Setup3PointRelArcTo
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Setup3PointArc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Coord setup routine
CALLED BY: INTERNAL
Convert3PointToNormalArc
PASS: ds:si - pointer to OpDrawArc3Point or OpFillArc3Point struct
tgs - TGSLocals stack frame
RETURN: fill in tgs.TGS_arc field
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 1/18/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
Setup3PointArc proc near
uses es, si, di, cx
tgs local TGSLocals
.enter inherit
; this is easy, just copy the info over
add si, offset ODATP_close ; get to start of struct
mov cx, size ThreePointArcParams
segmov es, ss, di
lea di, tgs.TGS_arc ; es:di -> destination
rep movsb
.leave
ret
Setup3PointArc endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Setup3PointArcTo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Coord setup routine
CALLED BY: INTERNAL
Convert3PointToNormalArc
PASS: ds:si - pointer to OpDrawArc3PointTo or OpFillArc3PointTo
struct
tgs - TGSLocals stack frame
RETURN: fill in tgs.TGS_arc field
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 1/18/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
Setup3PointArcTo proc near
uses ax, bx, es, si, di, cx
tgs local TGSLocals
.enter inherit
; this is a little tougher than the last. Copy the last
; part and get the current position to fill in the first.
mov ax, ds:[si].ODATPT_close ; get close type
mov tgs.TGS_arc.TPAP_close, ax
mov di, tgs.TGS_gstate ; so we can get the current pos
call GrGetCurPosWWFixed
movdw tgs.TGS_arc.TPAP_point1.PF_x, dxcx ; store first coord
movdw tgs.TGS_arc.TPAP_point1.PF_y, bxax
add si, offset ODATPT_x2 ; get to start of struct
mov cx, 2*(size PointWWFixed) ; copying 2 coords
segmov es, ss, di
lea di, tgs.TGS_arc.TPAP_point2.PF_x ; es:di -> destination
rep movsb
.leave
ret
Setup3PointArcTo endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Setup3PointRelArcTo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Coord setup routine
CALLED BY: INTERNAL
Convert3PointToNormalArc
PASS: ds:si - pointer to OpDrawRElArc3Point struct
tgs - TGSLocals stack frame
RETURN: fill in tgs.TGS_arc field
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 1/18/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
Setup3PointRelArcTo proc near
uses si, di, cx, ax, bx, dx
tgs local TGSLocals
.enter inherit
; get current position and calc the other coords based on
; the relative coords stored in the element
mov ax, ds:[si].ODRATPT_close ; get close type
mov tgs.TGS_arc.TPAP_close, ax
mov di, tgs.TGS_gstate ; so we can get the current pos
call GrGetCurPosWWFixed
movdw tgs.TGS_arc.TPAP_point1.PF_x, dxcx ; store first coord
movdw tgs.TGS_arc.TPAP_point1.PF_y, bxax
adddw dxcx, ds:[si].ODRATPT_x2 ; get rel coords
adddw bxax, ds:[si].ODRATPT_y2
movdw tgs.TGS_arc.TPAP_point1.PF_x, dxcx
movdw tgs.TGS_arc.TPAP_point1.PF_y, bxax
movdw dxcx, ds:[si].ODRATPT_x3 ; get rel coords
movdw bxax, ds:[si].ODRATPT_y3
adddw dxcx, tgs.TGS_arc.TPAP_point1.PF_x
adddw bxax, tgs.TGS_arc.TPAP_point1.PF_y
movdw tgs.TGS_arc.TPAP_point3.PF_x, dxcx
movdw tgs.TGS_arc.TPAP_point3.PF_y, bxax
.leave
ret
Setup3PointRelArcTo endp
;-----------------------------------------------------------------------
; These were taken/modified from the kernel code for 3 point arcs
;-----------------------------------------------------------------------
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Order3PointsInArc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Due to the implementation of arcs/ellipses by CalcConic(),
it is necessary to have the 1st point appear 1st when
moving counter-clockwise around the ellipse, starting at 0
degrees
CALLED BY: SetupArc3PointLow
PASS: tgs - inherited TGSLocals stack frame
RETURN: If necessary, Points #1 & #3 swapped
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
There is a simple algorithm:
Transform all three points to device coordinates
Find line between #1 & #3
If #2 is above line
If #1 is not above/right #3, swap
Else
If #3 is not above/right #1, swap
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 10/22/91 Initial version
jim 1/18/93 modified for use with PS xlation lib
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
Order3PointsInArc proc near
uses ds, di
tgs local TGSLocals
.enter inherit
; save the coords, transform the 3 points by the GState
; do the calc and then restore the points.
pushwwf tgs.TGS_arc.TPAP_point1.PF_x
pushwwf tgs.TGS_arc.TPAP_point1.PF_y
pushwwf tgs.TGS_arc.TPAP_point2.PF_x
pushwwf tgs.TGS_arc.TPAP_point2.PF_y
pushwwf tgs.TGS_arc.TPAP_point3.PF_x
pushwwf tgs.TGS_arc.TPAP_point3.PF_y
; Determine slope of a line between Point #1 & Point #3
;
movdw dxcx, tgs.TGS_arc.TPAP_point3.PF_y
movdw bxax, tgs.TGS_arc.TPAP_point3.PF_x
subwwf dxcx, tgs.TGS_arc.TPAP_point1.PF_y ; dxcx = deltaY
subwwf bxax, tgs.TGS_arc.TPAP_point1.PF_x ; bxax = deltaX
call GrSDivWWFixed ; slope => DX.CX
LONG jc vert ; deal with vertical
; Now get the Y intercept (plug in Point #1)
;
movwwf bxax, dxcx ; slope => BX.AX
movwwf dxcx, tgs.TGS_arc.TPAP_point1.PF_x ; pop P1_x
call GrMulWWFixed ; mX1 => DX.CX
subwwf dxcx, tgs.TGS_arc.TPAP_point1.PF_y ; dxcx = -b
negwwf dxcx ; dxcx = b
pushwwf dxcx ; save b
; Now evaluate X2 along the line between #1 & #3
;
movwwf dxcx, tgs.TGS_arc.TPAP_point2.PF_x ; restore X2
call GrMulWWFixed ; *slope
popwwf bxax ; restore value of b
addwwf bxax, dxcx ; bxax = y intercept
movwwf dxcx, tgs.TGS_arc.TPAP_point2.PF_y ; dxcx = xformed Y2
; Finally, we have enough information to decide if we
; need to swap points. First find the position of Point #2 wrt
; the line between #1 & #3 (check Y intercept (bxax).Then check
; to see if #1 or #3 is above-right of the other.
;
clr si
jgewwf dxcx, bxax, above ; jump if so
inc si ; bump swap count
above:
movwwf dxcx, tgs.TGS_arc.TPAP_point1.PF_x
movwwf bxax, tgs.TGS_arc.TPAP_point3.PF_x
jlwwf dxcx, bxax, checkSwap
jgwwf dxcx, bxax, left
movwwf dxcx, tgs.TGS_arc.TPAP_point1.PF_y
movwwf bxax, tgs.TGS_arc.TPAP_point3.PF_y
jgwwf dxcx, bxax, checkSwap ; compare y1 vs. y3
left:
inc si ; increment swap count
; Now see if we need to swap points. First restore original
; coordinates.
checkSwap:
popwwf tgs.TGS_arc.TPAP_point3.PF_y
popwwf tgs.TGS_arc.TPAP_point3.PF_x
popwwf tgs.TGS_arc.TPAP_point2.PF_y
popwwf tgs.TGS_arc.TPAP_point2.PF_x
popwwf tgs.TGS_arc.TPAP_point1.PF_y
popwwf tgs.TGS_arc.TPAP_point1.PF_x
test si, 1 ; 1's bit set ??
jnz done
movwwf dxcx, tgs.TGS_arc.TPAP_point1.PF_x ; swap 'em
movwwf bxax, tgs.TGS_arc.TPAP_point1.PF_y
xchgwwf dxcx, tgs.TGS_arc.TPAP_point3.PF_x
xchgwwf bxax, tgs.TGS_arc.TPAP_point3.PF_y
movwwf tgs.TGS_arc.TPAP_point1.PF_x, dxcx ; swap 'em
movwwf tgs.TGS_arc.TPAP_point1.PF_y, bxax
done:
.leave
ret
; Deal with point #1 & #3 being vertically aligned. Points must
; occur in counter-clockwise order.
vert:
clr si
movwwf dxcx, tgs.TGS_arc.TPAP_point1.PF_y ; dxcx = y1
movwwf bxax, tgs.TGS_arc.TPAP_point3.PF_y ; bxax = y3
jlwwf dxcx, bxax, point1Above ; compare y1 & y3
inc si ; pt #3 is above #1
point1Above:
movwwf dxcx, tgs.TGS_arc.TPAP_point2.PF_x
movwwf bxax, tgs.TGS_arc.TPAP_point3.PF_x
jgewwf dxcx, bxax, point2Right
dec si
point2Right:
inc si ; pt #2 is right of #3
jmp checkSwap
Order3PointsInArc endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Convert3PointToBounds
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Convert from a 3-point description of an arc to one described
by the bounds of an ellipse (actually a circle)
CALLED BY: SetupArc3PointLow
PASS: tgs - inherited TGSLocals stack frame
RETURN: tgs.TGS_newArc.CAP_bounds filled in
DESTROYED: SI
PSEUDO CODE/STRATEGY:
We use the following theorem:
The perpendicular bisectors of the two chords defined
by the 3 passed points must intersect at the origin
of the circle.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 9/ 3/91 Initial version
jim 1/18/93 modified for use in PS xlation lib
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
Convert3PointToBounds proc near
tgs local TGSLocals
.enter inherit
; Calculate x1, x2, y1, & y2
;
movwwf bxax, tgs.TGS_arc.TPAP_point1.PF_x
addwwf bxax, tgs.TGS_arc.TPAP_point2.PF_x
sarwwf bxax
movwwf tgs.TGS_newArc.CAP_p1.PF_x, bxax
movwwf bxax, tgs.TGS_arc.TPAP_point1.PF_y
addwwf bxax, tgs.TGS_arc.TPAP_point2.PF_y
sarwwf bxax
movwwf tgs.TGS_newArc.CAP_p1.PF_y, bxax
movwwf bxax, tgs.TGS_arc.TPAP_point2.PF_y
addwwf bxax, tgs.TGS_arc.TPAP_point3.PF_y
sarwwf bxax
movwwf tgs.TGS_newArc.CAP_p2.PF_y, bxax
movwwf bxax, tgs.TGS_arc.TPAP_point2.PF_x
addwwf bxax, tgs.TGS_arc.TPAP_point3.PF_x
sarwwf bxax
movwwf tgs.TGS_newArc.CAP_p2.PF_x, bxax
; Calculate m1' & m2'
;
movwwf bxax, tgs.TGS_arc.TPAP_point1.PF_y ; load Y1
subwwf bxax, tgs.TGS_arc.TPAP_point2.PF_y ; bxax = -dY
movwwf dxcx, tgs.TGS_arc.TPAP_point2.PF_x ; load X2
subwwf dxcx, tgs.TGS_arc.TPAP_point1.PF_x ; dxcx = dX
call CalcInverseSlope ; m1' = -((D-B)/(C-A)) ^ -1
movwwf tgs.TGS_newArc.CAP_m1, dxcx
movwwf bxax, tgs.TGS_arc.TPAP_point2.PF_y ; load Y2
subwwf bxax, tgs.TGS_arc.TPAP_point3.PF_y ; bxax = -dY
movwwf dxcx, tgs.TGS_arc.TPAP_point3.PF_x ; load X3
subwwf dxcx, tgs.TGS_arc.TPAP_point2.PF_x ; dxcx = dX
call CalcInverseSlope ; m2' = -((E-D)/F-C)) ^ -1
movwwf tgs.TGS_newArc.CAP_m2, dxcx
; Calculate the center of the circle
;
call CalcLineLineIntersection ; find center
; We are now very close. Find the distance from the center
; of the circle to any of the three points (we'll use
; Point #3), and then return the bounds of the ellipse
;
call CalcPointPointDistance ; distance => SI.DI
movwwf tgs.TGS_newArc.CAP_radius, sidi
movwwf tgs.TGS_newArc.CAP_center.PF_x, bxax
movwwf tgs.TGS_newArc.CAP_center.PF_y, dxcx
addwwf dxcx, sidi
movwwf tgs.TGS_newArc.CAP_br.PF_y, dxcx
addwwf bxax, sidi
movwwf tgs.TGS_newArc.CAP_br.PF_x, bxax
movwwf bxax, tgs.TGS_newArc.CAP_center.PF_y
subwwf bxax, sidi
movwwf tgs.TGS_newArc.CAP_tl.PF_y, bxax
movwwf bxax, tgs.TGS_newArc.CAP_center.PF_x
subwwf bxax, sidi
movwwf tgs.TGS_newArc.CAP_tl.PF_x, bxax
.leave
ret
Convert3PointToBounds endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CalcArcAngles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get start/end angles for 3Point arc
CALLED BY: INTERNAL
Convert3PointToNormalArc
PASS: tgs - inherited stack frame
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 1/18/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CalcArcAngles proc near
uses ax,bx,cx,dx
tgs local TGSLocals
.enter inherit
; calculate angle 1
movwwf dxcx, tgs.TGS_arc.TPAP_point1.PF_y
subwwf dxcx, tgs.TGS_newArc.CAP_center.PF_y
movwwf bxax, tgs.TGS_newArc.CAP_radius
call GrSDivWWFixed
movwwf bxax, tgs.TGS_arc.TPAP_point1.PF_x
subwwf bxax, tgs.TGS_newArc.CAP_center.PF_x
call GrQuickArcSine ; dxcx = angle
movwwf tgs.TGS_newArc.CAP_ang1, dxcx
; calculate angle 2
movwwf dxcx, tgs.TGS_arc.TPAP_point3.PF_y
subwwf dxcx, tgs.TGS_newArc.CAP_center.PF_y
movwwf bxax, tgs.TGS_newArc.CAP_radius
call GrSDivWWFixed
movwwf bxax, tgs.TGS_arc.TPAP_point3.PF_x
subwwf bxax, tgs.TGS_newArc.CAP_center.PF_x
call GrQuickArcSine ; dxcx = angle
movwwf tgs.TGS_newArc.CAP_ang2, dxcx
.leave
ret
CalcArcAngles endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CalcInverseSlope
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Calculates the inverse slope of a line, based upon two
points on the line.
CALLED BY: INTERNAL
PASS: dxcx = deltaX
bxax = -deltaY
RETURN: dxcx = slope
DESTROYED: AX, BX, CX, DX
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 9/10/91 Initial version
jim 1/18/93 modified for use with EPS lib
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CalcInverseSlope proc near
uses si
.enter
; See if we have a horizontal line
;
mov si, bx ; check for deltaY = 0
or si, ax
jz horizontal ; yes, so return big inv slope
; Else calculate slope
;
call GrSDivWWFixed ; dxcx = -deltaY/deltaX
done:
.leave
ret
horizontal:
movdw dxcx, 0x7fffffff ; largest possible slope
jmp done
CalcInverseSlope endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CalcLineLineIntersection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Calculate the intersection between two lines
CALLED BY: Convert3PointToBounds
PASS: tgs - inherited stack frame
RETURN: BX.AX = X point of intersection
DX.CX = Y point of intersection
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
We know: Y = mX + b. Calculate the b value for each line,
and then find x0. Once we have x0, we can plug it into
either equation to get y0
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 9/24/91 Initial version
jim 1/18/93 modified for use with EPS lib
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CalcLineLineIntersection proc near
uses di, si
tgs local TGSLocals
.enter inherit
; First, let's do a little checking for co-linear Points
; or for vertical (infinite) slopes
;
movwwf bxax, tgs.TGS_newArc.CAP_m2
cmpwwf bxax, 0x7fffffff ; infinite slope ??
jne calc ; nope, so calculate
xchgwwf tgs.TGS_newArc.CAP_m1, bxax ; swap m1 & m2,
movwwf tgs.TGS_newArc.CAP_m2, bxax ; x1 & x2, y1 & y2
xchgwwf tgs.TGS_newArc.CAP_p1.PF_x,\
tgs.TGS_newArc.CAP_p2.PF_x, cx
xchgwwf tgs.TGS_newArc.CAP_p1.PF_y,\
tgs.TGS_newArc.CAP_p2.PF_y, cx
; First calculate b2 (b2 = y2 - m2x2) (store in SI.DI)
calc:
movwwf dxcx, tgs.TGS_newArc.CAP_p2.PF_x
call GrMulWWFixed ; result => DX.CX
movwwf sidi, tgs.TGS_newArc.CAP_p2.PF_y
subwwf sidi, dxcx ; b2 => SI.DI
; Now calculate -b1 (b1 = y1 - m1x1) (store in DX.CX)
;
movwwf bxax, tgs.TGS_newArc.CAP_m1
movwwf dxcx, tgs.TGS_newArc.CAP_p1.PF_x
cmpwwf bxax, 0x7fffffff ; inifinte slope ??
je foundX0 ; if so, x0 is in DX.CX
call GrMulWWFixed ; result => DX.CX
subwwf dxcx, tgs.TGS_newArc.CAP_p1.PF_y
; Now calculate x0 (x0 = (b2-b1)/(m1-m2)) (store in BX.AX)
;
subwwf bxax, tgs.TGS_newArc.CAP_m2
addwwf dxcx, sidi ; b2 - b1 => DX.CX
call GrSDivWWFixed ; x0 => DX.CX
foundX0:
movwwf bxax, dxcx
; Finally calculate y0 (y0 = m2x0 + b2)
;
movwwf dxcx, tgs.TGS_newArc.CAP_m2
call GrMulWWFixed ; result => DX.CX
addwwf dxcx, sidi ; add in b2
.leave
ret
CalcLineLineIntersection endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CalcPointPointDistance
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Calcs distance between two points
CALLED BY: INTERNAL
PASS: BX.AX = X1
DX.CX = Y1
tgs - inherited TGSLocals
RETURN: Carry = Clear (success)
SI.DI = Distance
Carry = Set
DI,SI = Destroyed
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/ 9/90 Initial version
don 9/10/91 Optimized a bit, inverted carry returned
jim 12/4/92 changed to take a pointer to TPAP structure
jim 1/18/93 changed again for EPS lib
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CalcPointPointDistance proc near
uses ax, bx, cx, dx, bp
tgs local TGSLocals
.enter inherit
; Calculate deltas. If horizontal or vertical, optimize
;
subwwf bxax, tgs.TGS_arc.TPAP_point3.PF_x ; get abs dX
tst bx
jns doneX
negwwf bxax
doneX:
subwwf dxcx, tgs.TGS_arc.TPAP_point3.PF_y ; get abs dY
tst dx
jns doneY
negwwf dxcx
doneY:
movwwf sidi, bxax
tstwwf dxcx ; vertical diff ?
jz done ; none, dist => BX.AX
movwwf sidi, dxcx
tstwwf bxax ; horizontal diff ?
jz done ; none, dist => DX.CX
; Square the deltas, and calc square root of sum
;
call SqrWWFixed ; deltaX ^ 2 => DX:CX
mov_tr bp, ax ; save fraction part
movwwf bxax, sidi ; deltaY => BX.AX
movdw sidi, dxcx ; partial sum => SI:DI
call SqrWWFixed ; deltaY ^ 2 => DX:CX
adddwf dxcxax, sidibp
call SqrRootDWFixed ; distance => dx.cx
movwwf sidi, dxcx ; want it in SI.DI
cmc ; invert the carry
done:
.leave
ret
CalcPointPointDistance endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SqrWWFixed
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Square a WWFixed, yielding a dword
CALLED BY: ConjugateEllipse
PASS: BX.AX = WWFixed value to square
RETURN: DX:CX:AX = DWFixed result
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/ 8/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SqrWWFixed proc near
.enter
; Set up registers, and multiply
;
movdw dxcx, bxax
call MulWWFixed ; DWFixed result => DX:CX.AX
.leave
ret
SqrWWFixed endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MulWWFixed
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Multiply two WWFixed values together, yielding a DWord
CALLED BY: INTERNAL
PASS: BX.AX = WWFixed (mulitplier)
DX.CX = WWFixed (multiplicand)
RETURN: DX:CX.AX= DWFixed (Signed result)
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
Do full mulitply, but round the low 16 bits of the result.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 08/90 Initial version
Don 11/91 Changed to return DWord
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MulWWFixed proc near
uses bx, si, di
multiplicand local dword
frac local word
.enter
; Some set-up work. Determine sign of result, and
; prepare for multiplication
;
mov si, dx ; si = negate flag
xor si, bx
pushf ; save sign flag
clrdw sidi ; initialize result
; check each operand, make sure both are positive
;
tst dx ; check multiplicand
jns doneMultiplicand ; nope, continue
negwwf dxcx ; do 32-bit negate
doneMultiplicand:
tst bx ; check multiplier
jns doneMultiplier ; nope, straight to mul
negwwf bxax ; do 32-bit negate
doneMultiplier:
; now we have two unsigned factors. Do the multiply
;
xchg ax, cx ; dx.ax = multiplicand
; bx.cx = mulitplier
mov multiplicand.low, ax ; save away one factor
mov multiplicand.high, dx
mul cx ; multiply low factors
mov frac, dx ; save away partial result
mov ax, multiplicand.high ; get next victim
mul cx
add frac, ax
adc di, dx ; can't overflow to high word
mov ax, multiplicand.low ; continue with partial results
mul bx
add frac, ax ; finish off calc
adc di, dx
adc si, 0
mov ax, multiplicand.high
mul bx
add di, ax
adc si, dx
; all done with multiply, set up result regs
;
mov ax, frac
movdw dxcx, sidi ; DWFixed result => DX:CX.AX
; multiply is done, check to see if we have to negate the res
;
popf ; see if result is negative
jns done ; nope, exit
negdwf dxcxax ; yes, do it
done:
.leave
ret
MulWWFixed endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SqrRootDWFixed
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Calculate the square root of a DWFixed number
CALLED BY: CalcPointPointDistance()
PASS: DX:CX.AX = DWFixed number (dword integer, word fraction)
RETURN: DX.CX = WWFixed result
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 8/ 3/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SqrRootDWFixed proc near
.enter
; Take the square root of the WWFixed number
;
tst dx ; check the high word
jnz doDWFixed ; it's non-zero, so jump
mov dx, cx
mov cx, ax ; WWFixed => DX.CX
call GrSqrRootWWFixed ; result => DX.CX
done:
.leave
ret
; Take the square root of a DWFixed number.
; For now, we'll just ignore the fraction
doDWFixed:
call GrSqrRootWWFixed ; result/256 => DX.CX
mov ax, cx ; result => dx.ax
mov cx, 8 ; (2^16)^.5 = 2^8
shiftLeft:
shlwwf dxax
loop shiftLeft
mov cx, ax ; dxcx = result
jmp done
SqrRootDWFixed endp
ExportArc ends
|
test/Compiler/with-stdlib/DivMod.agda | andreasabel/agda-with-old-branches | 3 | 2043 | <reponame>andreasabel/agda-with-old-branches<filename>test/Compiler/with-stdlib/DivMod.agda
module DivMod where
open import IO
open import Data.Nat
open import Data.Nat.DivMod
open import Coinduction
open import Data.String
open import Data.Fin
g : ℕ
g = 7 div 5
k : ℕ
k = toℕ (7 mod 5)
showNat : ℕ → String
showNat zero = "Z"
showNat (suc x) = "S (" ++ showNat x ++ ")"
main = run (♯ (putStrLn (showNat g)) >> ♯ (putStrLn (showNat k)))
|
list_chrome_safari_tabs.applescript | mkusaka/tab-poller | 0 | 978 | set _output to ""
tell application "Safari"
set _window_index to 1
repeat with _window in windows
try
set _tab_count to (count of tabs in _window)
set _tab_index to 1
repeat with _tab in tabs of _window
set _output to _output & "Safari:" &(_window_index as string) & ":" & (_tab_index as string) & "
" & url of _tab & "
" & name of _tab & "
"
set _tab_index to _tab_index + 1
end repeat
end try
set _window_index to _window_index + 1
end repeat
end tell
tell application "Google Chrome"
set _window_index to 1
repeat with _window in windows
try
set _tab_count to (count of tabs in _window)
set _tab_index to 1
repeat with _tab in tabs of _window
set _output to _output & "Google Chrome:" &(_window_index as string) & ":" & (_tab_index as string) & "
" & url of _tab & "
" & title of _tab & "
"
set _tab_index to _tab_index + 1
end repeat
end try
set _window_index to _window_index + 1
end repeat
end tell
_output
|
src/aco-protocols-service_data-clients.adb | jonashaggstrom/ada-canopen | 6 | 18563 | <reponame>jonashaggstrom/ada-canopen<filename>src/aco-protocols-service_data-clients.adb<gh_stars>1-10
package body ACO.Protocols.Service_Data.Clients is
overriding
procedure Handle_Message
(This : in out Client;
Msg : in ACO.Messages.Message;
Endpoint : in ACO.SDO_Sessions.Endpoint_Type)
is
use ACO.SDO_Commands;
use type ACO.SDO_Sessions.Services;
Service : constant ACO.SDO_Sessions.Services :=
This.Sessions.Service (Endpoint.Id);
State_Error : Boolean := False;
begin
case Get_CS (Msg) is
when Download_Initiate_Conf =>
This.SDO_Log (ACO.Log.Debug, "Client: Handling Download Initiate");
if Service = ACO.SDO_Sessions.Download then
This.Download_Init (Msg, Endpoint);
else
State_Error := True;
end if;
when Download_Segment_Conf =>
This.SDO_Log (ACO.Log.Debug, "Client: Handling Download Segment");
if Service = ACO.SDO_Sessions.Download then
This.Download_Segment (Msg, Endpoint);
else
State_Error := True;
end if;
when Upload_Initiate_Conf =>
This.SDO_Log (ACO.Log.Debug, "Client: Handling Upload Initiate");
if Service = ACO.SDO_Sessions.Upload then
This.Upload_Init (Msg, Endpoint);
else
State_Error := True;
end if;
when Upload_Segment_Conf =>
This.SDO_Log (ACO.Log.Debug, "Client: Handling Upload Segment");
if Service = ACO.SDO_Sessions.Upload then
This.Upload_Segment (Msg, Endpoint);
else
State_Error := True;
end if;
when Abort_Req =>
This.SDO_Log (ACO.Log.Debug, "Client: Handling Abort");
This.Abort_All (Msg, Endpoint);
when others =>
null;
end case;
if State_Error then
This.Send_Abort
(Endpoint => Endpoint,
Error => Failed_To_Transfer_Or_Store_Data_Due_To_Local_Control);
end if;
end Handle_Message;
procedure Download_Init
(This : in out Client;
Msg : in ACO.Messages.Message;
Endpoint : in ACO.SDO_Sessions.Endpoint_Type)
is
pragma Unreferenced (Msg);
Id : constant ACO.SDO_Sessions.Valid_Endpoint_Nr := Endpoint.Id;
Session : ACO.SDO_Sessions.SDO_Session := This.Sessions.Get (Id);
Bytes_Remain : constant Natural :=
This.Sessions.Length_Buffer (Endpoint.Id);
begin
if Bytes_Remain = 0 then
This.SDO_Log (ACO.Log.Debug, "Client: Expedited download completed");
This.Stop_Alarm (Id);
This.Indicate_Status (Session, ACO.SDO_Sessions.Complete);
else
This.Start_Alarm (Id);
Session.Toggle := False;
This.Send_Buffered (Endpoint, Session.Toggle);
This.Indicate_Status (Session, ACO.SDO_Sessions.Pending);
end if;
end Download_Init;
procedure Download_Segment
(This : in out Client;
Msg : in ACO.Messages.Message;
Endpoint : in ACO.SDO_Sessions.Endpoint_Type)
is
use ACO.SDO_Commands;
Resp : constant Download_Segment_Resp := Convert (Msg);
Id : constant ACO.SDO_Sessions.Valid_Endpoint_Nr := Endpoint.Id;
Session : ACO.SDO_Sessions.SDO_Session := This.Sessions.Get (Id);
Status : ACO.SDO_Sessions.SDO_Status;
Bytes_Remain : constant Natural :=
This.Sessions.Length_Buffer (Endpoint.Id);
begin
if Resp.Toggle = Session.Toggle then
if Bytes_Remain = 0 then
This.SDO_Log (ACO.Log.Debug, "Client: Segment download completed");
This.Stop_Alarm (Id);
Status := ACO.SDO_Sessions.Complete;
else
Session.Toggle := not Session.Toggle;
This.Send_Buffered (Endpoint, Session.Toggle);
This.Start_Alarm (Id);
Status := ACO.SDO_Sessions.Pending;
end if;
else
This.Send_Abort (Endpoint => Endpoint,
Error => Toggle_Bit_Not_Altered,
Index => Session.Index);
This.Stop_Alarm (Id);
Status := ACO.SDO_Sessions.Error;
end if;
This.Indicate_Status (Session, Status);
end Download_Segment;
procedure Send_Buffered
(This : in out Client;
Endpoint : in ACO.SDO_Sessions.Endpoint_Type;
Toggle : in Boolean)
is
use ACO.SDO_Commands;
Bytes_Remain : constant Natural :=
This.Sessions.Length_Buffer (Endpoint.Id);
begin
if Bytes_Remain = 0 then
return;
end if;
declare
Bytes_To_Send : constant Positive :=
Natural'Min (Bytes_Remain, Segment_Data'Length);
Data : ACO.Messages.Data_Array (0 .. Bytes_To_Send - 1);
Cmd : Download_Segment_Cmd;
begin
This.Sessions.Get_Buffer (Endpoint.Id, Data);
Cmd := Create (Toggle => Toggle,
Is_Complete => (Bytes_To_Send = Bytes_Remain),
Data => Data);
This.Send_SDO (Endpoint => Endpoint,
Raw_Data => Cmd.Raw);
This.SDO_Log
(ACO.Log.Debug, "Sent data of length" & Bytes_To_Send'Img);
end;
end Send_Buffered;
procedure Upload_Init
(This : in out Client;
Msg : in ACO.Messages.Message;
Endpoint : in ACO.SDO_Sessions.Endpoint_Type)
is
use ACO.SDO_Commands;
Resp : constant Upload_Initiate_Resp := Convert (Msg);
Index : constant ACO.OD_Types.Entry_Index := Get_Index (Msg);
Error : Error_Type := Nothing;
Session : ACO.SDO_Sessions.SDO_Session;
Status : ACO.SDO_Sessions.SDO_Status;
Cmd : Upload_Segment_Cmd;
Id : constant ACO.SDO_Sessions.Valid_Endpoint_Nr := Endpoint.Id;
begin
if not Resp.Is_Size_Indicated then
Error := Command_Specifier_Not_Valid_Or_Unknown;
elsif Get_Data_Size (Resp) > ACO.Configuration.Max_SDO_Transfer_Size then
Error := General_Error;
end if;
Session := This.Sessions.Get (Id);
if Error /= Nothing then
Status := ACO.SDO_Sessions.Error;
elsif Resp.Is_Expedited then
Status := ACO.SDO_Sessions.Complete;
else
Status := ACO.SDO_Sessions.Pending;
end if;
case Status is
when ACO.SDO_Sessions.Error =>
This.Send_Abort (Endpoint, Error, Index);
This.Stop_Alarm (Id);
when ACO.SDO_Sessions.Complete =>
This.Sessions.Put_Buffer
(Id => Id,
Data => Resp.Data (0 .. 3 - Natural (Resp.Nof_No_Data)));
This.SDO_Log (ACO.Log.Debug, "Client: Expedited upload completed");
This.Stop_Alarm (Id);
when ACO.SDO_Sessions.Pending =>
-- TODO: Remember expected data size?
This.Sessions.Clear_Buffer (Id);
Session.Toggle := False;
Cmd := Create (Session.Toggle);
This.Send_SDO (Endpoint, Cmd.Raw);
This.Start_Alarm (Id);
end case;
This.Indicate_Status (Session, Status);
end Upload_Init;
procedure Upload_Segment
(This : in out Client;
Msg : in ACO.Messages.Message;
Endpoint : in ACO.SDO_Sessions.Endpoint_Type)
is
use ACO.SDO_Commands;
Resp : constant Upload_Segment_Resp := Convert (Msg);
Session : ACO.SDO_Sessions.SDO_Session;
Status : ACO.SDO_Sessions.SDO_Status;
Id : constant ACO.SDO_Sessions.Valid_Endpoint_Nr := Endpoint.Id;
begin
Session := This.Sessions.Get (Id);
if Resp.Toggle = Session.Toggle then
This.Sessions.Put_Buffer
(Id => Id,
Data => Resp.Data (0 .. 6 - Natural (Resp.Nof_No_Data)));
if Resp.Is_Complete then
This.SDO_Log (ACO.Log.Debug, "Client: Segmented upload completed");
This.Stop_Alarm (Id);
Status := ACO.SDO_Sessions.Complete;
else
Session.Toggle := not Session.Toggle;
declare
Cmd : constant Upload_Segment_Cmd := Create (Session.Toggle);
begin
This.Send_SDO (Endpoint, Cmd.Raw);
end;
This.Start_Alarm (Id);
Status := ACO.SDO_Sessions.Pending;
end if;
else
This.Send_Abort (Endpoint => Endpoint,
Error => Toggle_Bit_Not_Altered,
Index => Session.Index);
This.Stop_Alarm (Id);
Status := ACO.SDO_Sessions.Error;
end if;
This.Indicate_Status (Session, Status);
end Upload_Segment;
procedure Write_Remote_Entry
(This : in out Client;
Node : in ACO.Messages.Node_Nr;
Index : in ACO.OD_Types.Object_Index;
Subindex : in ACO.OD_Types.Object_Subindex;
An_Entry : in ACO.OD_Types.Entry_Base'Class;
Endpoint_Id : out ACO.SDO_Sessions.Endpoint_Nr)
is
use ACO.Configuration;
use type ACO.SDO_Sessions.Services;
Endpoint : constant ACO.SDO_Sessions.Endpoint_Type :=
Client'Class (This).Get_Endpoint (Server_Node => Node);
Size : constant Natural := An_Entry.Data_Length;
begin
Endpoint_Id := ACO.SDO_Sessions.No_Endpoint_Id;
-- TODO: Make pre-condition tests instead?
if Endpoint.Id = ACO.SDO_Sessions.No_Endpoint_Id then
This.SDO_Log (ACO.Log.Warning,
"Node" & Node'Img & " is not a server for any Client");
return;
elsif This.Sessions.Service (Endpoint.Id) /= ACO.SDO_Sessions.None then
This.SDO_Log (ACO.Log.Warning,
"Client endpoint" & Endpoint.Id'Img & " already in use");
return;
elsif not (Size in 1 .. Max_SDO_Transfer_Size) then
This.SDO_Log (ACO.Log.Warning,
"Size" & Size'Img & " bytes of entry is too large or 0");
return;
end if;
Endpoint_Id := Endpoint.Id;
This.Sessions.Clear_Buffer (Endpoint.Id);
declare
use ACO.SDO_Commands;
Cmd : Download_Initiate_Cmd;
begin
if Size <= Expedited_Data'Length then
Cmd := Create (Index => (Index, Subindex),
Data => ACO.Messages.Data_Array (An_Entry.Read));
else
This.Sessions.Put_Buffer
(Endpoint.Id, ACO.Messages.Data_Array (An_Entry.Read));
Cmd := Create (Index => (Index, Subindex),
Size => Size);
end if;
This.Send_SDO (Endpoint, Cmd.Raw);
end;
This.Start_Alarm (Endpoint.Id);
This.Indicate_Status
(Session =>
ACO.SDO_Sessions.Create_Download (Endpoint, (Index, Subindex)),
Status => ACO.SDO_Sessions.Pending);
end Write_Remote_Entry;
procedure Read_Remote_Entry
(This : in out Client;
Node : in ACO.Messages.Node_Nr;
Index : in ACO.OD_Types.Object_Index;
Subindex : in ACO.OD_Types.Object_Subindex;
Endpoint_Id : out ACO.SDO_Sessions.Endpoint_Nr)
is
use type ACO.SDO_Sessions.Services;
Endpoint : constant ACO.SDO_Sessions.Endpoint_Type :=
Client'Class (This).Get_Endpoint (Server_Node => Node);
Cmd : ACO.SDO_Commands.Upload_Initiate_Cmd;
begin
Endpoint_Id := Endpoint.Id;
-- TODO: Make pre-condition tests instead?
if Endpoint.Id = ACO.SDO_Sessions.No_Endpoint_Id then
This.SDO_Log (ACO.Log.Warning,
"Node" & Node'Img & " is not a server for any Client");
return;
elsif This.Sessions.Service (Endpoint.Id) /= ACO.SDO_Sessions.None then
Endpoint_Id := ACO.SDO_Sessions.No_Endpoint_Id;
This.SDO_Log (ACO.Log.Warning,
"Client endpoint" & Endpoint.Id'Img & " already in use");
return;
end if;
Cmd := ACO.SDO_Commands.Create ((Index, Subindex));
This.Send_SDO (Endpoint, Cmd.Raw);
This.Start_Alarm (Endpoint.Id);
This.Indicate_Status
(Session =>
ACO.SDO_Sessions.Create_Upload (Endpoint, (Index, Subindex)),
Status => ACO.SDO_Sessions.Pending);
end Read_Remote_Entry;
procedure Get_Read_Entry
(This : in out Client;
Endpoint_Id : in ACO.SDO_Sessions.Valid_Endpoint_Nr;
Read_Entry : in out ACO.OD_Types.Entry_Base'Class)
is
Data : ACO.Messages.Data_Array (0 .. Read_Entry.Data_Length - 1);
begin
This.Sessions.Get_Buffer (Endpoint_Id, Data);
Read_Entry.Write (ACO.OD_Types.Byte_Array (Data));
This.Sessions.Clear (Endpoint_Id);
end Get_Read_Entry;
end ACO.Protocols.Service_Data.Clients;
|
malban/Release/VRelease/Release.History/VRelease_2017_04_07/Song/pattern10.asm | mikepea/vectrex-playground | 5 | 93517 | <filename>malban/Release/VRelease/Release.History/VRelease_2017_04_07/Song/pattern10.asm
; this file is part of Release, written by Malban in 2017
;
HAS_VOICE0 = 1
HAS_TONE0 = 1
FIRST7 = $3E
dw $0044
pattern10Data:
db $FF, $18, $97, $DE, $63, $FE, $1A, $7E, $E6, $34
db $ED, $FC, $70, $30, $7B, $9E, $43, $CD, $DD, $E2
db $78, $E0, $60, $7F, $EF, $47, $6F, $27, $F7, $F5
db $1F, $7B, $C9, $F9, $8C, $4B, $B5, $69, $D7, $48
db $E9, $24, $9F, $3C, $33, $C7, $7A, $3B, $79, $3E
db $DF, $A8, $F4, $DE, $4F, $94, $62, $5C, $2B, $4D
db $A4, $69, $24, $FD, $CF, $21, $E6, $EE, $F1, $3C
db $70, $30, $1D, $CE, $97, $77, $69, $E3, $81, $81
db $FF, $BD, $1D, $BC, $9F, $DF, $D4, $7D, $EF, $27
db $E6, $31, $2E, $D5, $A7, $5D, $23, $A4, $92, $7C
db $F0, $CF, $73, $C8, $78, $BB, $BD, $4F, $1C, $0C
db $00 |
dialectica-cats/prelude.agda | heades/AUGL | 0 | 10402 | module prelude where
open import level public
open import product public
open import product-thms public
open import sum public
open import empty public
open import unit public
open import functions renaming (id to id-set) public
open import eq public
open import list public
open import list-thms public
open import bool public
open import nat public
open import nat-thms public
-- Extensionality will be used when proving equivalences of morphisms.
postulate ext-set : ∀{l1 l2 : level} → extensionality {l1} {l2}
-- These are isomorphisms, but Agda has no way to prove these as
-- equivalences. They are consistent to adopt as equivalences by
-- univalence:
postulate ∧-unit : ∀{ℓ}{A : Set ℓ} → A ≡ (⊤ {ℓ} ∧ A)
postulate ∧-assoc : ∀{ℓ}{A B C : Set ℓ} → (A ∧ (B ∧ C)) ≡ ((A ∧ B) ∧ C)
postulate ∧-twist : ∀{ℓ}{A B : Set ℓ} → (A ∧ B) ≡ (B ∧ A)
-- Provable from the above axioms:
postulate assoc-twist₁ : {A B C D : Set} → ((A × C) × (B × D)) ≡ ((A × B) × (C × D))
-- The following defines a commutative monoid as lists:
_* = 𝕃
postulate *-comm : ∀{A : Set}{l₁ l₂ : A *} → l₁ ++ l₂ ≡ l₂ ++ l₁
|
examples/examplesPaperJFP/safeFibStackMachineObjectOriented.agda | agda/ooAgda | 23 | 3729 | module examplesPaperJFP.safeFibStackMachineObjectOriented where
open import Data.Nat
open import Data.List
open import Data.Vec
open import Data.Sum
open import Data.Fin renaming (_+_ to _+f_)
open import Data.Product
open import examplesPaperJFP.StatefulObject
open import examplesPaperJFP.StackBisim
open import examplesPaperJFP.triangleRightOperator
{- Object based version of safe stack
it is essentially the last part of safeFibStackMachine.agda
with the names simplified -}
{- the state is what we are computing right now:
fib n menas we need to compute fib n
val k means we have computed the value k
-}
data FibState : Set where
fib : ℕ → FibState
val : ℕ → FibState
data FibStackEl : Set where
_+• : ℕ → FibStackEl
•+fib_ : ℕ → FibStackEl
FibStack : ℕ → Set
FibStack = Objectˢ (StackInterfaceˢ FibStackEl)
FibStackmachine : Set
FibStackmachine = Σ[ n ∈ ℕ ] (FibState × FibStack n)
reduce : FibStackmachine → FibStackmachine ⊎ ℕ
reduce (n , fib 0 , stack) = inj₁ (n , val 1 , stack)
reduce (n , fib 1 , stack) = inj₁ (n , val 1 , stack)
reduce (n , fib (suc (suc m)) , stack) =
objectMethod stack (push (•+fib m)) ▹ λ { (_ , stack₁) →
inj₁ ( suc n , fib (suc m) , stack₁) }
reduce (0 , val k , stack) = inj₂ k
reduce (suc n , val k , stack) =
objectMethod stack pop ▹ λ { (k′ +• , stack₁) →
inj₁ (n , val (k′ + k) , stack₁)
; (•+fib m , stack₁) →
objectMethod stack₁ (push (k +•)) ▹ λ { (_ , stack₂) →
inj₁ (suc n , fib m , stack₂) }}
iter : (m : ℕ) → FibStackmachine → FibStackmachine ⊎ ℕ
iter 0 s = inj₁ s
iter (suc n) s with reduce s
... | inj₁ s′ = iter n s′
... | inj₂ m = inj₂ m
computeFib : ℕ → ℕ → FibStackmachine ⊎ ℕ
computeFib n m = iter n (0 , fib m , stack [])
fibO0 : FibStackmachine ⊎ ℕ
fibO0 = computeFib 2 0
-- evaluates to inj₂ 1
fibO1 : FibStackmachine ⊎ ℕ
fibO1 = computeFib 2 1
-- evaluates to inj₂ 1
fibO2 : FibStackmachine ⊎ ℕ
fibO2 = computeFib 10 2
-- evaluates to inj₂ 2
fibO3 : FibStackmachine ⊎ ℕ
fibO3 = computeFib 14 3
-- evaluates to inj₂ 3
fibO4 : FibStackmachine ⊎ ℕ
fibO4 = computeFib 30 4
-- evaluates to inj₂ 5
fibO5 : FibStackmachine ⊎ ℕ
fibO5 = computeFib 30 5
-- evaluates to inj₂ 8
{-# TERMINATING #-}
computeFibRec : FibStackmachine → ℕ
computeFibRec s with reduce s
... | inj₁ s′ = computeFibRec s′
... | inj₂ k = k
fibUsingStack : ℕ → ℕ
fibUsingStack m = computeFibRec (0 , fib m , stack [])
test : List ℕ
test = fibUsingStack 0 ∷ fibUsingStack 1 ∷ fibUsingStack 2 ∷ fibUsingStack 3 ∷ fibUsingStack 4 ∷ fibUsingStack 5 ∷ fibUsingStack 6 ∷ []
testExpected : List ℕ
testExpected = 1 ∷ 1 ∷ 2 ∷ 3 ∷ 5 ∷ 8 ∷ 13 ∷ []
|
libsrc/games/c128/bit_open_di.asm | meesokim/z88dk | 0 | 16049 | ; $Id: bit_open_di.asm,v 1.2 2015/01/19 01:32:44 pauloscustodio Exp $
;
; TRS-80 1 bit sound functions
;
; Open sound and disable interrupts for exact timing
;
; <NAME> - 8/4/2008
;
PUBLIC bit_open_di
EXTERN bit_open
.bit_open_di
jp bit_open
ret
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1925.asm | ljhsiun2/medusa | 9 | 81743 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r15
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x1d368, %r15
nop
sub %rdi, %rdi
movb $0x61, (%r15)
nop
xor %r13, %r13
lea addresses_WT_ht+0x1c928, %rdi
nop
sub %r8, %r8
mov $0x6162636465666768, %r11
movq %r11, %xmm5
movups %xmm5, (%rdi)
nop
nop
add %rbp, %rbp
lea addresses_WC_ht+0x15268, %r13
nop
nop
nop
nop
nop
and %r9, %r9
movw $0x6162, (%r13)
nop
xor %r13, %r13
lea addresses_A_ht+0x1ab58, %rsi
lea addresses_D_ht+0x17668, %rdi
sub $10427, %r11
mov $63, %rcx
rep movsw
nop
nop
nop
nop
add %rcx, %rcx
lea addresses_D_ht+0x11358, %r11
nop
nop
nop
nop
nop
add $55829, %rbp
mov $0x6162636465666768, %rcx
movq %rcx, %xmm3
vmovups %ymm3, (%r11)
sub %rdi, %rdi
lea addresses_WC_ht+0x15768, %rcx
nop
nop
nop
nop
sub $57663, %r15
vmovups (%rcx), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $0, %xmm2, %r11
nop
nop
nop
nop
nop
add $63102, %rdi
lea addresses_WT_ht+0x10768, %rdi
nop
nop
and $56915, %rbp
mov (%rdi), %r8w
nop
nop
nop
nop
nop
xor $51808, %r11
lea addresses_D_ht+0x1969c, %r13
clflush (%r13)
nop
sub $11079, %r15
mov (%r13), %r9
nop
nop
nop
nop
xor %rbp, %rbp
lea addresses_A_ht+0x8b30, %rsi
clflush (%rsi)
nop
cmp %r8, %r8
mov (%rsi), %rdi
nop
and %rcx, %rcx
lea addresses_WT_ht+0x14156, %rbp
sub %r15, %r15
mov (%rbp), %r8w
nop
inc %rcx
lea addresses_D_ht+0x15768, %rsi
nop
dec %rbp
mov $0x6162636465666768, %r8
movq %r8, %xmm2
vmovups %ymm2, (%rsi)
nop
nop
lfence
lea addresses_D_ht+0xfee8, %rsi
lea addresses_WT_ht+0x9368, %rdi
nop
cmp $31962, %r8
mov $61, %rcx
rep movsw
nop
xor $38859, %r9
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r15
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
// Load
lea addresses_WC+0x9988, %r10
nop
nop
nop
nop
mfence
mov (%r10), %ecx
nop
nop
dec %rbx
// REPMOV
lea addresses_A+0x11d68, %rsi
lea addresses_WT+0x14a22, %rdi
xor %r9, %r9
mov $43, %rcx
rep movsw
add %rdi, %rdi
// Faulty Load
lea addresses_D+0x12368, %r14
nop
add $26220, %rsi
mov (%r14), %edi
lea oracles, %r14
and $0xff, %rdi
shlq $12, %rdi
mov (%r14,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': False, 'type': 'addresses_D'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5, 'same': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'}
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_A'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_WT'}, 'OP': 'REPM'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 10, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 0, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 9, 'same': True, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'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
*/
|
programs/oeis/139/A139268.asm | karttu/loda | 1 | 161042 | ; A139268: Twice nonagonal numbers (or twice 9-gonal numbers): a(n) = n(7n-5).
; 0,2,18,48,92,150,222,308,408,522,650,792,948,1118,1302,1500,1712,1938,2178,2432,2700,2982,3278,3588,3912,4250,4602,4968,5348,5742,6150,6572,7008,7458,7922,8400,8892,9398,9918,10452,11000
mov $1,7
mul $1,$0
sub $1,5
mul $1,$0
|
oeis/047/A047855.asm | neoneye/loda-programs | 11 | 102943 | ; A047855: a(n) = T(7, n), array T given by A047848.
; 1,2,12,112,1112,11112,111112,1111112,11111112,111111112,1111111112,11111111112,111111111112,1111111111112,11111111111112,111111111111112,1111111111111112,11111111111111112,111111111111111112,1111111111111111112,11111111111111111112,111111111111111111112,1111111111111111111112,11111111111111111111112,111111111111111111111112,1111111111111111111111112,11111111111111111111111112,111111111111111111111111112,1111111111111111111111111112,11111111111111111111111111112,111111111111111111111111111112
mov $1,10
pow $1,$0
div $1,9
add $1,1
mov $0,$1
|
ioctl/IodBlockRemovable.asm | osfree-project/FamilyAPI | 1 | 245104 | ;--------------------------------------------------------
; Category 8 Function 20H Block Removable - not supported for versions below DOS 3.2
;--------------------------------------------------------
;
;
;
IODBLOCKREMOVABLE PROC NEAR
RET
IODBLOCKREMOVABLE ENDP
|
src/gnat/prj-attr-pm.adb | Letractively/ada-gen | 0 | 12364 | <gh_stars>0
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P R J . A T T R . P M --
-- --
-- B o d y --
-- --
-- Copyright (C) 2004-2010, 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. --
-- --
------------------------------------------------------------------------------
package body Prj.Attr.PM is
-------------------
-- Add_Attribute --
-------------------
procedure Add_Attribute
(To_Package : Package_Node_Id;
Attribute_Name : Name_Id;
Attribute_Node : out Attribute_Node_Id)
is
begin
-- Only add attribute if package is already defined and is not unknown
if To_Package /= Empty_Package and then
To_Package /= Unknown_Package
then
Attrs.Append (
(Name => Attribute_Name,
Var_Kind => Undefined,
Optional_Index => False,
Attr_Kind => Unknown,
Read_Only => False,
Others_Allowed => False,
Next =>
Package_Attributes.Table (To_Package.Value).First_Attribute));
Package_Attributes.Table (To_Package.Value).First_Attribute :=
Attrs.Last;
Attribute_Node := (Value => Attrs.Last);
end if;
end Add_Attribute;
-------------------------
-- Add_Unknown_Package --
-------------------------
procedure Add_Unknown_Package (Name : Name_Id; Id : out Package_Node_Id) is
begin
Package_Attributes.Increment_Last;
Id := (Value => Package_Attributes.Last);
Package_Attributes.Table (Id.Value) :=
(Name => Name,
Known => False,
First_Attribute => Empty_Attr);
end Add_Unknown_Package;
end Prj.Attr.PM;
|
TotalParserCombinators/Recogniser/Expression.agda | nad/parser-combinators | 1 | 15098 | <reponame>nad/parser-combinators
------------------------------------------------------------------------
-- Example: Left recursive expression grammar
------------------------------------------------------------------------
module TotalParserCombinators.Recogniser.Expression where
open import Codata.Musical.Notation
open import Data.Bool
open import Data.Char as Char using (Char)
open import Data.List
open import Data.String as String using (String)
open import Function
open import Relation.Binary.PropositionalEquality
open import TotalParserCombinators.BreadthFirst
import TotalParserCombinators.Lib as Lib
open import TotalParserCombinators.Recogniser
------------------------------------------------------------------------
-- Lifted versions of some parsers
-- Specific tokens.
tok : Char → P Char []
tok c = lift $ Lib.Token.tok Char Char._≟_ c
-- Numbers.
number : P Char []
number = lift Lib.number
------------------------------------------------------------------------
-- An expression grammar
-- t ∷= t '+' f ∣ f
-- f ∷= f '*' a ∣ a
-- a ∷= '(' t ')' ∣ n
mutual
term = ♯ term · tok '+' · factor
∣ factor
factor = ♯ factor · tok '*' · atom
∣ atom
atom = tok '(' · ♯ term · tok ')'
∣ number
------------------------------------------------------------------------
-- Unit tests
module Tests where
test : ∀ {n} → P Char n → String → Bool
test p s = not $ null $ parse ⟦ p ⟧ (String.toList s)
ex₁ : test term "1*(2+3)" ≡ true
ex₁ = refl
ex₂ : test term "1*(2+3" ≡ false
ex₂ = refl
|
Parametric/Change/Evaluation.agda | inc-lc/ilc-agda | 10 | 2224 | <gh_stars>1-10
------------------------------------------------------------------------
-- INCREMENTAL λ-CALCULUS
--
-- Connecting Parametric.Change.Term and Parametric.Change.Value.
------------------------------------------------------------------------
import Parametric.Syntax.Type as Type
import Parametric.Syntax.Term as Term
import Parametric.Denotation.Value as Value
import Parametric.Denotation.Evaluation as Evaluation
import Parametric.Change.Type as ChangeType
import Parametric.Change.Term as ChangeTerm
import Parametric.Change.Value as ChangeValue
module Parametric.Change.Evaluation
{Base : Type.Structure}
{Const : Term.Structure Base}
(⟦_⟧Base : Value.Structure Base)
(⟦_⟧Const : Evaluation.Structure Const ⟦_⟧Base)
(ΔBase : ChangeType.Structure Base)
(apply-base : ChangeTerm.ApplyStructure Const ΔBase)
(diff-base : ChangeTerm.DiffStructure Const ΔBase)
(nil-base : ChangeTerm.NilStructure Const ΔBase)
(⟦apply-base⟧ : ChangeValue.ApplyStructure Const ⟦_⟧Base ΔBase)
(⟦diff-base⟧ : ChangeValue.DiffStructure Const ⟦_⟧Base ΔBase)
(⟦nil-base⟧ : ChangeValue.NilStructure Const ⟦_⟧Base ΔBase)
where
open Type.Structure Base
open Term.Structure Base Const
open Value.Structure Base ⟦_⟧Base
open Evaluation.Structure Const ⟦_⟧Base ⟦_⟧Const
open ChangeType.Structure Base ΔBase
open ChangeTerm.Structure Const ΔBase apply-base diff-base nil-base
open ChangeValue.Structure Const ⟦_⟧Base ΔBase ⟦apply-base⟧ ⟦diff-base⟧ ⟦nil-base⟧
open import Relation.Binary.PropositionalEquality
open import Base.Denotation.Notation
open import Postulate.Extensionality
-- Extension point 1: Relating ⊕ and its value on base types
ApplyStructure : Set
ApplyStructure = ∀ ι {Γ} →
{t : Term Γ (base ι)} {Δt : Term Γ (ΔType (base ι))} {ρ : ⟦ Γ ⟧} →
⟦ t ⟧ ρ ⟦⊕₍ base ι ₎⟧ ⟦ Δt ⟧ ρ ≡ ⟦ t ⊕₍ base ι ₎ Δt ⟧ ρ
-- Extension point 2: Relating ⊝ and its value on base types
DiffStructure : Set
DiffStructure = ∀ ι {Γ} →
{s : Term Γ (base ι)} {t : Term Γ (base ι)} {ρ : ⟦ Γ ⟧} →
⟦ s ⟧ ρ ⟦⊝₍ base ι ₎⟧ ⟦ t ⟧ ρ ≡ ⟦ s ⊝₍ base ι ₎ t ⟧ ρ
-- Extension point 3: Relating nil-term and its value on base types
NilStructure : Set
NilStructure = ∀ ι {Γ} →
{t : Term Γ (base ι)} {ρ : ⟦ Γ ⟧} →
⟦nil₍ base ι ₎⟧ (⟦ t ⟧ ρ) ≡ ⟦ onil₍ base ι ₎ t ⟧ ρ
module Structure
(meaning-⊕-base : ApplyStructure)
(meaning-⊝-base : DiffStructure)
(meaning-onil-base : NilStructure)
where
-- unique names with unambiguous types
-- to help type inference figure things out
private
module Disambiguation where
infixr 9 _⋆_
_⋆_ : Type → Context → Context
_⋆_ = _•_
-- We provide: Relating ⊕ and ⊝ and their values on arbitrary types.
meaning-⊕ : ∀ {τ Γ}
{t : Term Γ τ} {Δt : Term Γ (ΔType τ)} {ρ : ⟦ Γ ⟧} →
⟦ t ⟧ ρ ⟦⊕₍ τ ₎⟧ ⟦ Δt ⟧ ρ ≡ ⟦ t ⊕₍ τ ₎ Δt ⟧ ρ
meaning-⊝ : ∀ {τ Γ}
{s : Term Γ τ} {t : Term Γ τ} {ρ : ⟦ Γ ⟧} →
⟦ s ⟧ ρ ⟦⊝₍ τ ₎⟧ ⟦ t ⟧ ρ ≡ ⟦ s ⊝₍ τ ₎ t ⟧ ρ
meaning-onil : ∀ {τ Γ}
{t : Term Γ τ} {ρ : ⟦ Γ ⟧} →
⟦nil₍ τ ₎⟧ (⟦ t ⟧ ρ) ≡ ⟦ onil₍ τ ₎ t ⟧ ρ
meaning-⊕ {base ι} {Γ} {τ} {Δt} {ρ} = meaning-⊕-base ι {Γ} {τ} {Δt} {ρ}
meaning-⊕ {σ ⇒ τ} {Γ} {t} {Δt} {ρ} = ext (λ v →
let
Γ′ = σ ⋆ (σ ⇒ τ) ⋆ ΔType (σ ⇒ τ) ⋆ Γ
ρ′ : ⟦ Γ′ ⟧
ρ′ = v • (⟦ t ⟧ ρ) • (⟦ Δt ⟧ ρ) • ρ
x : Term Γ′ σ
x = var this
f : Term Γ′ (σ ⇒ τ)
f = var (that this)
Δf : Term Γ′ (ΔType (σ ⇒ τ))
Δf = var (that (that this))
y = app f x
Δy = app (app Δf x) (onil x)
in
begin
⟦ t ⟧ ρ v ⟦⊕₍ τ ₎⟧ ⟦ Δt ⟧ ρ v (⟦nil₍ σ ₎⟧ v)
≡⟨ cong (λ hole → ⟦ t ⟧ ρ v ⟦⊕₍ τ ₎⟧ ⟦ Δt ⟧ ρ v hole)
(meaning-onil {t = x} {ρ′}) ⟩
⟦ t ⟧ ρ v ⟦⊕₍ τ ₎⟧ ⟦ Δt ⟧ ρ v (⟦ onil x ⟧ ρ′)
≡⟨ meaning-⊕ {t = y} {Δt = Δy} {ρ′} ⟩
⟦ y ⊕₍ τ ₎ Δy ⟧ ρ′
∎)
where
open ≡-Reasoning
open Disambiguation
meaning-⊝ {base ι} {Γ} {s} {t} {ρ} = meaning-⊝-base ι {Γ} {s} {t} {ρ}
meaning-⊝ {σ ⇒ τ} {Γ} {s} {t} {ρ} =
ext (λ v → ext (λ Δv →
let
Γ′ = ΔType σ ⋆ σ ⋆ (σ ⇒ τ) ⋆ (σ ⇒ τ) ⋆ Γ
ρ′ : ⟦ Γ′ ⟧Context
ρ′ = Δv • v • ⟦ t ⟧Term ρ • ⟦ s ⟧Term ρ • ρ
Δx : Term Γ′ (ΔType σ)
Δx = var this
x : Term Γ′ σ
x = var (that this)
f : Term Γ′ (σ ⇒ τ)
f = var (that (that this))
g : Term Γ′ (σ ⇒ τ)
g = var (that (that (that this)))
y = app f x
y′ = app g (x ⊕₍ σ ₎ Δx)
in
begin
⟦ s ⟧ ρ (v ⟦⊕₍ σ ₎⟧ Δv) ⟦⊝₍ τ ₎⟧ ⟦ t ⟧ ρ v
≡⟨ cong (λ hole → ⟦ s ⟧ ρ hole ⟦⊝₍ τ ₎⟧ ⟦ t ⟧ ρ v)
(meaning-⊕ {t = x} {Δt = Δx} {ρ′}) ⟩
⟦ s ⟧ ρ (⟦ x ⊕₍ σ ₎ Δx ⟧ ρ′) ⟦⊝₍ τ ₎⟧ ⟦ t ⟧ ρ v
≡⟨ meaning-⊝ {s = y′} {y} {ρ′} ⟩
⟦ y′ ⊝ y ⟧ ρ′
∎))
where
open ≡-Reasoning
open Disambiguation
meaning-onil {base ι} {Γ} {t} {ρ} = meaning-onil-base ι {Γ} {t} {ρ}
meaning-onil {σ ⇒ τ} {Γ} {t} {ρ} = meaning-⊝ {σ ⇒ τ} {Γ} {t} {t} {ρ}
-- Ideally, this proof should simply be:
-- meaning-⊝ {σ ⇒ τ} {Γ} {t} {t} {ρ}
--
-- However, the types of the results don't match because using onil constructs
-- different environments.
|
newEmptyCombinedGrammar.g4 | EgorSidorov/swiftCompiler | 1 | 4868 | <filename>newEmptyCombinedGrammar.g4
grammar newEmptyCombinedGrammar;
|
_lessons/06-dynamic/code/state_machine.als | HanielB/2021.1-fm | 0 | 3960 | sig State {
successor : set State
}
sig Initial extends State {}
pred atLeastOneInitial {
some Initial
}
pred deterministic {
one Initial
all s: State | lone s.successor
}
pred nondeterministic {
atLeastOneInitial
not deterministic
}
pred unreachable {
atLeastOneInitial
some State - Initial.*successor
}
pred reachable {
atLeastOneInitial
not unreachable
}
pred connected {
atLeastOneInitial
all s: State | State in s.*successor
}
pred deadlock {
atLeastOneInitial
some s: Initial.*successor | no s.successor
}
pred livelock {
atLeastOneInitial
-- c is the cycle state, l is the livelocked state
some c: State | some l: State | {
-- c is reachable from an initial state without using l
c in Initial.*(successor - (State -> l) - (l -> State))
-- c is in a cycle not containing l
c in c.^(successor - (State -> l) - (l -> State))
-- l is reachable from the cycle
l in c.^successor
}
}
run {deadlock}
|
toggle_dark_mode.applescript | emanuelbesliu/applescripts | 0 | 1895 | <reponame>emanuelbesliu/applescripts<filename>toggle_dark_mode.applescript
tell application "System Events"
tell appearance preferences
if dark mode is false then
set dark mode to true
else
set dark mode to false
end if
end tell
end tell
|
projects/batfish/src/main/antlr4/org/batfish/grammar/palo_alto/PaloAlto_shared.g4 | loftwah/batfish | 2 | 2099 | parser grammar PaloAlto_shared;
import PaloAlto_common, PaloAlto_service, PaloAlto_service_group;
options {
tokenVocab = PaloAltoLexer;
}
s_shared
:
SHARED
(
ss_common
| ss_null
)
;
// Common syntax between set shared and set vsys
ss_common
:
s_service
| s_service_group
| ss_log_settings
;
ss_log_settings
:
LOG_SETTINGS
(
ssl_syslog
)
;
ss_null
:
BOTNET
null_rest_of_line
;
ssl_syslog
:
SYSLOG name = variable
(
ssls_server
)
;
ssls_server
:
SERVER name = variable
(
sslss_server
)
;
sslss_server
:
SERVER address = variable
;
|
source/streams/machine-w64-mingw32/s-natiio.adb | ytomino/drake | 33 | 1623 | with Ada.Exception_Identification.From_Here;
with System.Address_To_Named_Access_Conversions;
with System.Standard_Allocators;
with System.System_Allocators;
with C.basetsd;
with C.string;
with C.wincon;
with C.winerror;
package body System.Native_IO is
use Ada.Exception_Identification.From_Here;
use type Ada.IO_Modes.File_Shared;
use type Ada.IO_Modes.File_Shared_Spec;
use type Ada.Streams.Stream_Element_Offset;
use type Storage_Elements.Storage_Offset;
use type C.size_t;
use type C.windef.UINT;
use type C.windef.WINBOOL;
use type C.winnt.ULONGLONG;
package Name_Pointer_Conv is
new Address_To_Named_Access_Conversions (Name_Character, Name_Pointer);
Temp_Prefix : constant C.winnt.WCHAR_array (0 .. 3) := (
C.winnt.WCHAR'Val (Wide_Character'Pos ('A')),
C.winnt.WCHAR'Val (Wide_Character'Pos ('D')),
C.winnt.WCHAR'Val (Wide_Character'Pos ('A')),
C.winnt.WCHAR'Val (0));
-- implementation
procedure Free (Item : in out Name_Pointer) is
begin
Standard_Allocators.Free (Name_Pointer_Conv.To_Address (Item));
Item := null;
end Free;
procedure New_External_Name (
Item : String;
Out_Item : aliased out Name_Pointer) is
begin
Out_Item := Name_Pointer_Conv.To_Pointer (
Standard_Allocators.Allocate (
(Item'Length * Zero_Terminated_WStrings.Expanding + 2) -- '*' & NUL
* (C.winnt.WCHAR'Size / Standard'Storage_Unit)));
declare
Out_Item_All : Name_String (0 .. 1); -- at least
for Out_Item_All'Address use Name_Pointer_Conv.To_Address (Out_Item);
begin
Out_Item_All (0) := Name_Character'Val (Wide_Character'Pos ('*'));
Zero_Terminated_WStrings.To_C (Item, Out_Item_All (1)'Access);
end;
end New_External_Name;
procedure Open_Temporary (
Handle : aliased out Handle_Type;
Out_Item : aliased out Name_Pointer)
is
use type C.winnt.HANDLE;
Temp_Dir : C.winnt.WCHAR_array (0 .. C.windef.MAX_PATH - 1);
Temp_Name : C.winnt.WCHAR_array (0 .. C.windef.MAX_PATH - 1);
Out_Length : C.size_t;
begin
-- compose template
if C.winbase.GetTempPath (Temp_Dir'Length, Temp_Dir (0)'Access) = 0
or else C.winbase.GetTempFileName (
Temp_Dir (0)'Access,
Temp_Prefix (0)'Access,
0,
Temp_Name (0)'Access) = 0
then
Raise_Exception (Use_Error'Identity);
end if;
-- open
Handle := C.winbase.CreateFile (
lpFileName => Temp_Name (0)'Access,
dwDesiredAccess =>
C.winnt.GENERIC_READ
or C.winnt.GENERIC_WRITE, -- full access for Reset/Set_Mode
dwShareMode =>
C.winnt.FILE_SHARE_READ
or C.winnt.FILE_SHARE_WRITE,
lpSecurityAttributes => null,
dwCreationDisposition => C.winbase.TRUNCATE_EXISTING,
dwFlagsAndAttributes =>
C.winnt.FILE_ATTRIBUTE_TEMPORARY
or C.winbase.FILE_FLAG_DELETE_ON_CLOSE,
hTemplateFile => C.winnt.HANDLE (Null_Address));
if Handle = C.winbase.INVALID_HANDLE_VALUE then
Raise_Exception (IO_Exception_Id (C.winbase.GetLastError));
end if;
-- allocate filename
Out_Length := C.string.wcslen (Temp_Name (0)'Access);
Out_Item := Name_Pointer_Conv.To_Pointer (
Standard_Allocators.Allocate (
(Storage_Elements.Storage_Offset (Out_Length) + 1) -- NUL
* (C.winnt.WCHAR'Size / Standard'Storage_Unit)));
declare
Out_Item_All : C.winnt.WCHAR_array (0 .. Out_Length); -- NUL
for Out_Item_All'Address use Name_Pointer_Conv.To_Address (Out_Item);
begin
Out_Item_All := Temp_Name (0 .. Out_Length); -- including nul
end;
end Open_Temporary;
procedure Open_Ordinary (
Method : Open_Method;
Handle : aliased out Handle_Type;
Mode : File_Mode;
Name : not null Name_Pointer;
Form : Packed_Form)
is
use type C.winnt.HANDLE;
Masked_Mode : constant File_Mode := Mode and Read_Write_Mask;
DesiredAccess : C.windef.DWORD;
ShareMode : C.windef.DWORD;
CreationDisposition : C.windef.DWORD;
Shared : Ada.IO_Modes.File_Shared;
Error : C.windef.DWORD;
begin
-- modes
if Form.Shared /= Ada.IO_Modes.By_Mode then
Shared := Ada.IO_Modes.File_Shared (Form.Shared);
else
if Masked_Mode = Read_Only_Mode then
Shared := Ada.IO_Modes.Read_Only;
else
Shared := Ada.IO_Modes.Deny;
end if;
end if;
DesiredAccess := Masked_Mode;
case Method is
when Create =>
Shared := Ada.IO_Modes.Deny;
DesiredAccess := DesiredAccess or C.winnt.GENERIC_WRITE;
if Form.Overwrite then
if Mode = Write_Only_Mode then
-- Out_File
CreationDisposition := C.winbase.CREATE_ALWAYS;
else
-- In_File, Inout_File, or Append_File
CreationDisposition := C.winbase.OPEN_ALWAYS;
end if;
else
CreationDisposition := C.winbase.CREATE_NEW;
end if;
when Open =>
if Mode = Write_Only_Mode then
-- Out_File
CreationDisposition := C.winbase.TRUNCATE_EXISTING;
else
-- In_File, Inout_File, or Append_File
CreationDisposition := C.winbase.OPEN_EXISTING;
end if;
when Reset =>
CreationDisposition := C.winbase.OPEN_EXISTING; -- no truncation
end case;
if Shared /= Ada.IO_Modes.Allow then
if Form.Wait then
-- use LockFileEx
ShareMode := C.winnt.FILE_SHARE_READ or C.winnt.FILE_SHARE_WRITE;
else
declare
Lock_Flags : constant
array (
Ada.IO_Modes.File_Shared range
Ada.IO_Modes.Read_Only .. Ada.IO_Modes.Deny) of
C.windef.DWORD := (
Ada.IO_Modes.Read_Only => C.winnt.FILE_SHARE_READ,
Ada.IO_Modes.Deny => 0);
begin
ShareMode := Lock_Flags (Shared);
end;
end if;
else
ShareMode := C.winnt.FILE_SHARE_READ or C.winnt.FILE_SHARE_WRITE;
end if;
-- open
Handle := C.winbase.CreateFile (
lpFileName => Name,
dwDesiredAccess => DesiredAccess,
dwShareMode => ShareMode,
lpSecurityAttributes => null,
dwCreationDisposition => CreationDisposition,
dwFlagsAndAttributes => C.winnt.FILE_ATTRIBUTE_NORMAL,
hTemplateFile => C.winnt.HANDLE (Null_Address));
if Handle = C.winbase.INVALID_HANDLE_VALUE then
Error := C.winbase.GetLastError;
case Error is
when C.winerror.ERROR_FILE_NOT_FOUND
| C.winerror.ERROR_PATH_NOT_FOUND
| C.winerror.ERROR_FILE_EXISTS -- CREATE_NEW
| C.winerror.ERROR_INVALID_NAME
| C.winerror.ERROR_ALREADY_EXISTS =>
Raise_Exception (Name_Error'Identity);
when C.winerror.ERROR_SHARING_VIOLATION =>
Raise_Exception (Tasking_Error'Identity);
-- Is Tasking_Error suitable?
when others =>
Raise_Exception (IO_Exception_Id (Error));
end case;
end if;
if Shared /= Ada.IO_Modes.Allow and then Form.Wait then
declare
Flags : constant
array (
Ada.IO_Modes.File_Shared range
Ada.IO_Modes.Read_Only .. Ada.IO_Modes.Deny) of
C.windef.DWORD := (
Ada.IO_Modes.Read_Only => 0,
Ada.IO_Modes.Deny => C.winbase.LOCKFILE_EXCLUSIVE_LOCK);
Overlapped : aliased C.winbase.OVERLAPPED :=
(0, 0, (0, 0, 0), C.winnt.HANDLE (Null_Address));
begin
if C.winbase.LockFileEx (
hFile => Handle,
dwFlags => Flags (Shared),
dwReserved => 0,
nNumberOfBytesToLockLow => C.windef.DWORD'Last,
nNumberOfBytesToLockHigh => C.windef.DWORD'Last,
lpOverlapped => Overlapped'Access) =
C.windef.FALSE
then
Raise_Exception (Tasking_Error'Identity);
-- Is Tasking_Error suitable?
end if;
end;
end if;
end Open_Ordinary;
procedure Close_Ordinary (
Handle : Handle_Type;
Name : Name_Pointer;
Raise_On_Error : Boolean)
is
pragma Unreferenced (Name);
Success : C.windef.WINBOOL;
begin
Success := C.winbase.CloseHandle (Handle);
if Success = C.windef.FALSE and then Raise_On_Error then
Raise_Exception (IO_Exception_Id (C.winbase.GetLastError));
end if;
end Close_Ordinary;
procedure Delete_Ordinary (
Handle : Handle_Type;
Name : Name_Pointer;
Raise_On_Error : Boolean)
is
Success : C.windef.WINBOOL;
begin
Success := C.winbase.CloseHandle (Handle);
if Success /= C.windef.FALSE then
Success := C.winbase.DeleteFile (Name);
end if;
if Success = C.windef.FALSE and then Raise_On_Error then
Raise_Exception (IO_Exception_Id (C.winbase.GetLastError));
end if;
end Delete_Ordinary;
function Is_Terminal (Handle : Handle_Type) return Boolean is
Mode : aliased C.windef.DWORD;
begin
return C.winbase.GetFileType (Handle) = C.winbase.FILE_TYPE_CHAR
and then C.wincon.GetConsoleMode (Handle, Mode'Access) /=
C.windef.FALSE;
end Is_Terminal;
function Is_Seekable (Handle : Handle_Type) return Boolean is
begin
return C.winbase.SetFilePointerEx (
Handle,
(Unchecked_Tag => 2, QuadPart => 0),
null,
C.winbase.FILE_CURRENT) /=
C.windef.FALSE;
end Is_Seekable;
function Block_Size (Handle : Handle_Type)
return Ada.Streams.Stream_Element_Count
is
File_Type : C.windef.DWORD;
Result : Ada.Streams.Stream_Element_Count;
begin
File_Type := C.winbase.GetFileType (Handle);
if File_Type /= C.winbase.FILE_TYPE_DISK then
-- no buffering for terminal, pipe and unknown device
Result := 0;
else
-- disk file
Result := Ada.Streams.Stream_Element_Offset (
System_Allocators.Page_Size);
end if;
return Result;
end Block_Size;
procedure Read (
Handle : Handle_Type;
Item : Address;
Length : Ada.Streams.Stream_Element_Offset;
Out_Length : out Ada.Streams.Stream_Element_Offset)
is
Read_Size : aliased C.windef.DWORD;
Success : C.windef.WINBOOL;
begin
Success := C.winbase.ReadFile (
Handle,
C.windef.LPVOID (Item),
C.windef.DWORD (Length),
Read_Size'Access,
lpOverlapped => null);
Out_Length := Ada.Streams.Stream_Element_Offset (Read_Size);
if Success = C.windef.FALSE then
case C.winbase.GetLastError is
when C.winerror.ERROR_BROKEN_PIPE
| C.winerror.ERROR_NO_DATA =>
-- closed pipe
-- this subprogram is called from End_Of_File
-- because no buffering on pipe
Out_Length := 0;
when others =>
Out_Length := -1;
end case;
end if;
end Read;
procedure Write (
Handle : Handle_Type;
Item : Address;
Length : Ada.Streams.Stream_Element_Offset;
Out_Length : out Ada.Streams.Stream_Element_Offset)
is
Written_Size : aliased C.windef.DWORD;
Success : C.windef.WINBOOL;
begin
Success := C.winbase.WriteFile (
Handle,
C.windef.LPCVOID (Item),
C.windef.DWORD (Length),
Written_Size'Access,
lpOverlapped => null);
Out_Length := Ada.Streams.Stream_Element_Offset (Written_Size);
if Success = C.windef.FALSE then
case C.winbase.GetLastError is
when C.winerror.ERROR_BROKEN_PIPE
| C.winerror.ERROR_NO_DATA =>
Out_Length := 0;
when others =>
Out_Length := -1;
end case;
end if;
end Write;
procedure Flush (Handle : Handle_Type) is
begin
if C.winbase.FlushFileBuffers (Handle) = C.windef.FALSE then
case C.winbase.GetLastError is
when C.winerror.ERROR_INVALID_HANDLE =>
null; -- means fd is not file but terminal, pipe, etc
when others =>
Raise_Exception (Device_Error'Identity);
end case;
end if;
end Flush;
procedure Set_Relative_Index (
Handle : Handle_Type;
Relative_To : Ada.Streams.Stream_Element_Offset;
Whence : Whence_Type;
New_Index : out Ada.Streams.Stream_Element_Offset)
is
liDistanceToMove : C.winnt.LARGE_INTEGER;
liNewFilePointer : aliased C.winnt.LARGE_INTEGER;
begin
liDistanceToMove.QuadPart := C.winnt.LONGLONG (Relative_To);
if C.winbase.SetFilePointerEx (
Handle,
liDistanceToMove,
liNewFilePointer'Access,
Whence) =
C.windef.FALSE
then
Raise_Exception (IO_Exception_Id (C.winbase.GetLastError));
end if;
New_Index :=
Ada.Streams.Stream_Element_Offset (liNewFilePointer.QuadPart) + 1;
end Set_Relative_Index;
function Index (Handle : Handle_Type)
return Ada.Streams.Stream_Element_Offset
is
liDistanceToMove : C.winnt.LARGE_INTEGER;
liNewFilePointer : aliased C.winnt.LARGE_INTEGER;
begin
liDistanceToMove.QuadPart := 0;
if C.winbase.SetFilePointerEx (
Handle,
liDistanceToMove,
liNewFilePointer'Access,
C.winbase.FILE_CURRENT) =
C.windef.FALSE
then
Raise_Exception (IO_Exception_Id (C.winbase.GetLastError));
end if;
return Ada.Streams.Stream_Element_Offset (liNewFilePointer.QuadPart) + 1;
end Index;
function Size (Handle : Handle_Type)
return Ada.Streams.Stream_Element_Count
is
liFileSize : aliased C.winnt.LARGE_INTEGER;
begin
if C.winbase.GetFileSizeEx (Handle, liFileSize'Access) =
C.windef.FALSE
then
Raise_Exception (IO_Exception_Id (C.winbase.GetLastError));
end if;
return Ada.Streams.Stream_Element_Offset (liFileSize.QuadPart);
end Size;
function Standard_Input return Handle_Type is
begin
return C.winbase.GetStdHandle (C.winbase.STD_INPUT_HANDLE);
end Standard_Input;
function Standard_Output return Handle_Type is
begin
return C.winbase.GetStdHandle (C.winbase.STD_OUTPUT_HANDLE);
end Standard_Output;
function Standard_Error return Handle_Type is
begin
return C.winbase.GetStdHandle (C.winbase.STD_ERROR_HANDLE);
end Standard_Error;
procedure Initialize (
Standard_Input_Handle : aliased in out Handle_Type;
Standard_Output_Handle : aliased in out Handle_Type;
Standard_Error_Handle : aliased in out Handle_Type) is
begin
Standard_Input_Handle := Standard_Input;
Standard_Output_Handle := Standard_Output;
Standard_Error_Handle := Standard_Error;
end Initialize;
procedure Open_Pipe (
Reading_Handle : aliased out Handle_Type;
Writing_Handle : aliased out Handle_Type) is
begin
if C.winbase.CreatePipe (
Reading_Handle'Access,
Writing_Handle'Access,
null,
0) =
C.windef.FALSE
then
Raise_Exception (Use_Error'Identity);
end if;
end Open_Pipe;
procedure Map (
Mapping : out Mapping_Type;
Handle : Handle_Type;
Mode : File_Mode;
Private_Copy : Boolean;
Offset : Ada.Streams.Stream_Element_Offset; -- 1-origin
Size : Ada.Streams.Stream_Element_Count)
is
use type C.winnt.HANDLE;
Protect : C.windef.DWORD;
Desired_Access : C.windef.DWORD;
Mapped_Offset : C.winnt.ULARGE_INTEGER;
Mapped_Size : C.winnt.ULARGE_INTEGER;
Mapped_Address : C.windef.LPVOID;
File_Mapping : C.winnt.HANDLE;
begin
if Private_Copy then
Protect := C.winnt.PAGE_WRITECOPY;
Desired_Access := C.winbase.FILE_MAP_COPY;
elsif Mode = Read_Only_Mode then
Protect := C.winnt.PAGE_READONLY;
Desired_Access := C.winbase.FILE_MAP_READ;
else -- Write_Only_Mode or Read_Write_Mode
Protect := C.winnt.PAGE_READWRITE;
Desired_Access := C.winbase.FILE_MAP_WRITE;
end if;
Mapped_Offset.QuadPart := C.winnt.ULONGLONG (Offset) - 1;
Mapped_Size.QuadPart := C.winnt.ULONGLONG (Size);
File_Mapping := C.winbase.CreateFileMapping (
Handle,
null,
Protect,
Mapped_Size.HighPart,
Mapped_Size.LowPart,
null);
if File_Mapping = C.winbase.INVALID_HANDLE_VALUE then
Raise_Exception (Use_Error'Identity);
end if;
Mapped_Address := C.winbase.MapViewOfFileEx (
File_Mapping,
Desired_Access,
Mapped_Offset.HighPart,
Mapped_Offset.LowPart,
C.basetsd.SIZE_T (Mapped_Size.QuadPart),
C.windef.LPVOID (Null_Address));
if Address (Mapped_Address) = Null_Address then
if C.winbase.CloseHandle (File_Mapping) = C.windef.FALSE then
null; -- raise Use_Error;
end if;
Raise_Exception (Use_Error'Identity);
end if;
Mapping.Storage_Address := Address (Mapped_Address);
Mapping.Storage_Size := Storage_Elements.Storage_Offset (Size);
Mapping.File_Mapping := File_Mapping;
end Map;
procedure Unmap (
Mapping : in out Mapping_Type;
Raise_On_Error : Boolean) is
begin
if (C.winbase.UnmapViewOfFile (
C.windef.LPCVOID (Mapping.Storage_Address)) =
C.windef.FALSE
or else C.winbase.CloseHandle (Mapping.File_Mapping) =
C.windef.FALSE)
and then Raise_On_Error
then
Raise_Exception (Use_Error'Identity);
end if;
Mapping.Storage_Address := Null_Address;
Mapping.Storage_Size := 0;
end Unmap;
function IO_Exception_Id (Error : C.windef.DWORD)
return Ada.Exception_Identification.Exception_Id is
begin
case Error is
when C.winerror.ERROR_WRITE_FAULT
| C.winerror.ERROR_READ_FAULT
| C.winerror.ERROR_GEN_FAILURE
| C.winerror.ERROR_IO_DEVICE =>
return Device_Error'Identity;
when others =>
return Use_Error'Identity;
end case;
end IO_Exception_Id;
end System.Native_IO;
|
oeis/315/A315728.asm | neoneye/loda-programs | 11 | 13314 | <gh_stars>10-100
; A315728: Coordination sequence Gal.6.342.6 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; Submitted by <NAME>
; 1,6,12,18,22,26,32,36,40,46,52,58,64,70,76,80,84,90,94,98,104,110,116,122,128,134,138,142,148,152,156,162,168,174,180,186,192,196,200,206,210,214,220,226,232,238,244,250,254,258
mov $1,$0
seq $1,311523 ; Coordination sequence Gal.6.119.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.
mov $2,$0
mul $0,10
sub $0,1
mod $0,$1
add $0,1
mov $3,$2
mul $3,4
add $0,$3
|
src/Builtin/Float.agda | lclem/agda-prelude | 0 | 6023 | <filename>src/Builtin/Float.agda
module Builtin.Float where
open import Prelude
open import Prelude.Equality.Unsafe
open import Agda.Builtin.Float
open Agda.Builtin.Float public using (Float)
natToFloat : Nat → Float
natToFloat = primNatToFloat
intToFloat : Int → Float
intToFloat (pos x) = natToFloat x
intToFloat (negsuc x) = primFloatMinus -1.0 (natToFloat x)
instance
EqFloat : Eq Float
_==_ {{EqFloat}} x y with primFloatEquality x y
... | true = yes unsafeEqual
... | false = no unsafeNotEqual
data LessFloat (x y : Float) : Set where
less-float : primFloatLess x y ≡ true → LessFloat x y
instance
OrdFloat : Ord Float
OrdFloat = defaultOrd cmpFloat
where
cmpFloat : ∀ x y → Comparison LessFloat x y
cmpFloat x y with inspect (primFloatLess x y)
... | true with≡ eq = less (less-float eq)
... | false with≡ _ with inspect (primFloatLess y x)
... | true with≡ eq = greater (less-float eq)
... | false with≡ _ = equal unsafeEqual
OrdLawsFloat : Ord/Laws Float
Ord/Laws.super OrdLawsFloat = it
less-antirefl {{OrdLawsFloat}} (less-float eq) = unsafeNotEqual eq
less-trans {{OrdLawsFloat}} (less-float _) (less-float _) = less-float unsafeEqual
instance
ShowFloat : Show Float
ShowFloat = simpleShowInstance primShowFloat
instance
NumFloat : Number Float
Number.Constraint NumFloat _ = ⊤
Number.fromNat NumFloat x = primNatToFloat x
SemiringFloat : Semiring Float
Semiring.zro SemiringFloat = 0.0
Semiring.one SemiringFloat = 1.0
Semiring._+_ SemiringFloat = primFloatPlus
Semiring._*_ SemiringFloat = primFloatTimes
SubFloat : Subtractive Float
Subtractive._-_ SubFloat = primFloatMinus
Subtractive.negate SubFloat = primFloatNegate
NegFloat : Negative Float
Negative.Constraint NegFloat _ = ⊤
Negative.fromNeg NegFloat x = negate (primNatToFloat x)
FracFloat : Fractional Float
Fractional.Constraint FracFloat _ _ = ⊤
Fractional._/_ FracFloat x y = primFloatDiv x y
floor = primFloor
round = primRound
ceiling = primCeiling
exp = primExp
ln = primLog
sin = primSin
sqrt = primFloatSqrt
π : Float
π = 3.141592653589793
cos : Float → Float
cos x = sin (π / 2.0 - x)
tan : Float → Float
tan x = sin x / cos x
log : Float → Float → Float
log base x = ln x / ln base
_**_ : Float → Float → Float
a ** x = exp (x * ln a)
NaN : Float
NaN = 0.0 / 0.0
Inf : Float
Inf = 1.0 / 0.0
-Inf : Float
-Inf = -1.0 / 0.0
|
oeis/016/A016227.asm | neoneye/loda-programs | 11 | 175438 | <reponame>neoneye/loda-programs
; A016227: Expansion of 1/((1-x)(1-4x)(1-12x)).
; Submitted by <NAME>(s1)
; 1,17,225,2785,33761,406497,4883425,58622945,703562721,8443102177,101318624225,1215829083105,14589971366881,175079745881057,2100957308486625,25211489133495265,302537875328566241
mov $2,1
lpb $0
sub $0,1
add $1,$2
mul $1,12
mul $2,4
add $2,1
lpe
add $1,$2
mov $0,$1
|
src/fot/LTC-PCF/Data/Nat/Rec.agda | asr/fotc | 11 | 3209 | ---------------------------------------------------------------------------
-- The rec definition using the fixed-point combinator
---------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module LTC-PCF.Data.Nat.Rec where
open import LTC-PCF.Base
---------------------------------------------------------------------------
-- Let T = D → D → (D → D → D) → D be a type. Instead of defining
-- rec : T → T, we use the LTC-PCF λ-abstraction and application to
-- avoid use a polymorphic fixed-point operator.
rech : D → D
rech r = lam (λ n → lam (λ a → lam (λ f →
if (iszero₁ n)
then a
else f · pred₁ n · (r · pred₁ n · a · f))))
rec : D → D → D → D
rec n a f = fix rech · n · a · f
|
popkcel/winx64.asm | popkc/popkcel | 0 | 240161 | .CODE
PUBLIC popkcSetjmp
PUBLIC popkcLongjmp
popkcSetjmp PROC
mov [rcx],rbx
mov [rcx+8h],rsi
mov [rcx+10h],rdi
mov [rcx+18h],rbp
mov [rcx+20h],r12
mov [rcx+28h],r13
mov [rcx+30h],r14
mov [rcx+38h],r15
movdqu [rcx+40h],xmm6
movdqu [rcx+50h],xmm7
movdqu [rcx+60h],xmm8
movdqu [rcx+70h],xmm9
movdqu [rcx+80h],xmm10
movdqu [rcx+90h],xmm11
movdqu [rcx+0a0h],xmm12
movdqu [rcx+0b0h],xmm13
movdqu [rcx+0c0h],xmm14
movdqu [rcx+0d0h],xmm15
mov rdx,[rsp]
mov [rcx+0e0h],rdx
lea rdx,[rsp+8h]
mov [rcx+0e8h],rdx
xor rax,rax
ret
popkcSetjmp ENDP
popkcLongjmp PROC
mov rax,rdx
test rax,rax
jnz bwl
inc rax
bwl:
mov rbx,[rcx]
mov rsi,[rcx+8h]
mov rdi,[rcx+10h]
mov rbp,[rcx+18h]
mov r12,[rcx+20h]
mov r13,[rcx+28h]
mov r14,[rcx+30h]
mov r15,[rcx+38h]
movdqu xmm6,[rcx+40h]
movdqu xmm7,[rcx+50h]
movdqu xmm8,[rcx+60h]
movdqu xmm9,[rcx+70h]
movdqu xmm10,[rcx+80h]
movdqu xmm11,[rcx+90h]
movdqu xmm12,[rcx+0a0h]
movdqu xmm13,[rcx+0b0h]
movdqu xmm14,[rcx+0c0h]
movdqu xmm15,[rcx+0d0h]
mov rdx,[rcx+0e0h]
mov rsp,[rcx+0e8h]
jmp rdx
popkcLongjmp ENDP
END
|
alloy4fun_models/trashltl/models/9/76XnFgiMRo579fBfN.als | Kaixi26/org.alloytools.alloy | 0 | 1644 | open main
pred id76XnFgiMRo579fBfN_prop10 {
always all f: File | once f in Protected implies always f in Protected
}
pred __repair { id76XnFgiMRo579fBfN_prop10 }
check __repair { id76XnFgiMRo579fBfN_prop10 <=> prop10o } |
labs/lab4/lab04B/lab04B/main.asm | stanley-jc/COMP2121 | 2 | 96947 | ;
; lab04B.asm
;
; Created: 9/20/2017 18:10:33 PM
; Author : <NAME>
;
; Replace with your application code
.include "m2560def.inc"
.def flag = r15 ;use flag to store the result
.def temp =r16
.def row =r17
.def col =r18
.def mask =r19
.def temp2 =r20
.def nletters = r21
.def lcd_temp = r22
.equ PORTLDIR = 0xF0
.equ INITCOLMASK = 0xEF
.equ INITROWMASK = 0x01
.equ ROWMASK = 0x0F
.equ LCD_RS = 7
.equ LCD_E = 6
.equ LCD_RW = 5
.equ LCD_BE = 4
.equ HOB_LABEL = 0b00100000 ;high order bit for symbols
.equ HOB_NUM = 0b00110000 ;high order bit for numbers
.equ HOB_CHAR = 0b01000000 ;high order bit for characters
.macro do_lcd_command
ldi r16, @0
rcall lcd_command
rcall lcd_wait
.endmacro
.macro do_lcd_data
mov r16, @0
rcall lcd_data
rcall lcd_wait
.endmacro
.macro lcd_set
sbi PORTA, @0
.endmacro
.macro lcd_clr
cbi PORTA, @0
.endmacro
.cseg
jmp RESET
.org 0x72
RESET:
ldi temp, low(RAMEND)
out SPL, temp
ldi temp, high(RAMEND)
out SPH, temp
ldi temp, PORTLDIR ; columns are outputs, rows are inputs
STS DDRL, temp ; cannot use out
;ser temp
;out DDRC, temp ; Make PORTC all outputs
;out PORTC, temp ; Turn on all the LEDs
ser temp
out DDRF, temp ;set F&A as output
out DDRA, temp
clr temp
out PORTF, temp
out PORTA, temp
do_lcd_command 0b00111000 ; 2x5x7
rcall sleep_5ms
do_lcd_command 0b00111000 ; 2x5x7
rcall sleep_1ms
do_lcd_command 0b00111000 ; 2x5x7
do_lcd_command 0b00111000 ; 2x5x7
do_lcd_command 0b00001000 ; display off?
do_lcd_command 0b00000001 ; clear display
do_lcd_command 0b00000110 ; increment, no display shift
do_lcd_command 0b00001110 ; Cursor on, bar, no blink
clr nletters
rjmp main;
clear_display:
rcall sleep_5ms
rcall sleep_5ms
rcall sleep_5ms
rcall sleep_5ms
rcall sleep_5ms
do_lcd_command 0b00000001 ; clear display
clr nletters
rjmp end_clear
; main keeps scanning the keypad to find which key is pressed.
main:
ldi temp, 16
cp nletters, temp
breq clear_display
end_clear:
ldi mask, INITCOLMASK ; initial column mask
clr col ; initial column
colloop:
STS PORTL, mask ; set column to mask value
; (sets column 0 off)
ldi temp, 0xFF ; implement a delay so the
; hardware can stabilize
delay:
dec temp
brne delay
LDS temp, PINL ; read PORTL. Cannot use in
andi temp, ROWMASK ; read only the row bits
cpi temp, 0xF ; check if any rows are grounded
breq nextcol ; if not go to the next column
ldi mask, INITROWMASK ; initialise row check
clr row ; initial row
rowloop:
mov temp2, temp
and temp2, mask ; check masked bit
brne skipconv ; if the result is non-zero,
; we need to look again
rcall convert ; if bit is clear, convert the bitcode
jmp main ; and start again
skipconv:
inc row ; else move to the next row
lsl mask ; shift the mask to the next bit
jmp rowloop
nextcol:
cpi col, 3 ; check if we are on the last column
breq main ; if so, no buttons were pushed,
; so start again.
sec ; else shift the column mask:
; We must set the carry bit
rol mask ; and then rotate left by a bit,
; shifting the carry into
; bit zero. We need this to make
; sure all the rows have
; pull-up resistors
inc col ; increment column value
jmp colloop ; and check the next column
; convert function converts the row and column given to a
; binary number and also outputs the value to PORTC.
; Inputs come from registers row and col and output is in
; temp.
convert:
cpi col, 3 ; if column is 3 we have a letter
breq letters
cpi row, 3 ; if row is 3 we have a symbol or 0
breq symbols
mov temp, row ; otherwise we have a number (1-9)
lsl temp ; temp = row * 2
add temp, row ; temp = row * 3
add temp, col ; add the column address
; to get the offset from 1
inc temp ; add 1. Value of switch is
; row*3 + col + 1.
mov lcd_temp, temp; store the value into lcd output register
ldi temp, HOB_NUM
or lcd_temp, temp; OR the high order bit with the value for outputting to lcd.
jmp convert_end
letters:
ldi temp, 0x1
add temp, row ; increment from 0xA by the row value
mov lcd_temp, temp
;subi lcd_temp, 9; subtract 9 to get the right LCD code
ldi temp, HOB_CHAR
or lcd_temp, temp; OR the high order bit with the value for outputting to lcd.
jmp convert_end
symbols:
cpi col, 0 ; check if we have a star
breq star
cpi col, 1 ; or if we have zero
breq zero
ldi temp, 0xF ; we'll output 0xF for hash
mov lcd_temp, temp;
subi lcd_temp, 12; subtract 13 for hash
ldi temp, HOB_LABEL
or lcd_temp, temp; OR the high order bit with the value for outputting to lcd.
jmp convert_end
star:
ldi temp, 0xE ; we'll output 0xE for star
mov lcd_temp, temp;
subi lcd_temp, 4; subtract 5 for star
ldi temp, HOB_LABEL;
or lcd_temp, temp
jmp convert_end
zero:
clr temp ; set to zero
mov lcd_temp, temp
ldi temp, HOB_NUM
or lcd_temp, temp
convert_end:
LDS temp, PINL ; read PORTL. Cannot use in
mov flag, temp
;out PORTC, temp ; write value to PORTC
do_lcd_data lcd_temp; output the value to the LCD
inc nletters; increment the counter for how many chars have been written
preserve:
rcall sleep_5ms
LDS temp, PINL ; read PORTL. Cannot use in
cp temp, flag
breq preserve
ret ; return to caller
;
; Send a command to the LCD (r16)
;
lcd_command:
out PORTF, r16
nop
lcd_set LCD_E
nop
nop
nop
lcd_clr LCD_E
nop
nop
nop
ret
lcd_data:
out PORTF, r16
lcd_set LCD_RS
nop
nop
nop
lcd_set LCD_E
nop
nop
nop
lcd_clr LCD_E
nop
nop
nop
lcd_clr LCD_RS
ret
lcd_wait:
push r16
clr r16
out DDRF, r16
out PORTF, r16
lcd_set LCD_RW
lcd_wait_loop:
nop
lcd_set LCD_E
nop
nop
nop
in r16, PINF
lcd_clr LCD_E
sbrc r16, 7
rjmp lcd_wait_loop
lcd_clr LCD_RW
ser r16
out DDRF, r16
pop r16
ret
.equ F_CPU = 16000000
.equ DELAY_1MS = F_CPU / 4 / 1000 - 4
; 4 cycles per iteration - setup/call-return overhead
sleep_1ms:
push r24
push r25
ldi r25, high(DELAY_1MS)
ldi r24, low(DELAY_1MS)
delayloop_1ms:
sbiw r25:r24, 1
brne delayloop_1ms
pop r25
pop r24
ret
sleep_5ms:
rcall sleep_1ms
rcall sleep_1ms
rcall sleep_1ms
rcall sleep_1ms
rcall sleep_1ms
ret |
programs/oeis/060/A060145.asm | neoneye/loda | 22 | 240701 | ; A060145: a(n) = floor(n/tau) - floor(n/(1 + tau)).
; 0,0,1,0,1,2,1,2,1,2,3,2,3,4,3,4,3,4,5,4,5,4,5,6,5,6,7,6,7,6,7,8,7,8,9,8,9,8,9,10,9,10,9,10,11,10,11,12,11,12,11,12,13,12,13,12,13,14,13,14,15,14,15,14,15,16,15,16,17,16,17,16,17,18,17,18,17,18,19,18,19,20,19,20,19,20,21,20,21,22,21,22,21,22,23,22,23,22,23,24
trn $0,1
seq $0,339765 ; a(n) = 2*floor(n*phi) - 3*n, where phi = (1+sqrt(5))/2.
add $0,1
|
Driver/Printer/PrintCom/Cursor/cursorConvert216.asm | steakknife/pcgeos | 504 | 1430 |
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Berkeley Softworks 1990 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Epson type 9-pin print drivers
FILE: cursorConvert216.asm
AUTHOR: <NAME>, 14 March 1990
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Dave 3/14/90 Initial revision
Dave 3/92 moved from epson9 to printcom
DESCRIPTION:
This file contains most of the code to implement the epson FX type
print driver cursor movement support
The cursor position is kept in 2 words: integer 216ths in Y and
integer 72nds in X
$Id: cursorConvert216.asm,v 1.1 97/04/18 11:49:34 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrConvertToDriverCoordinates
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
convert a value passed in 1/72" units in dx.ax to 1/216" units in dx
CALLED BY:
PASS:
dx.ax = WWFixed value to convert.
RETURN:
dx = value in 1/216" units
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Dave 02/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrConvertToDriverCoordinates proc near
uses cx
.enter
mov cx,dx ;save x1
shl ax,1 ;x2
rcl dx,1
add dx,cx ;add together for x3: integer done....
.leave
ret
PrConvertToDriverCoordinates endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrConvertFromDriverCoordinates
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
convert a value passed in 1/216" units in dx to 1/72" units in dx.ax
CALLED BY:
PASS:
dx = value in 1/216" units
RETURN:
dx.ax = WWFixed value in 1/72nd " units
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Dave 02/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrConvertFromDriverCoordinates proc near
uses cx,bx
.enter
clr ax ;get the fractions to zero.
mov cx,ax
mov bx,3 ;we divide by 3
call GrUDivWWFixed ;do the divide
mov ax,cx ;move the fraction to our reg format
.leave
ret
PrConvertFromDriverCoordinates endp
|
rdpfuzz-dynamorio/clients/drcachesim/tests/allasm_aarch64_prefetch.asm | fengjixuchui/rdpfuzz | 107 | 97671 | <filename>rdpfuzz-dynamorio/clients/drcachesim/tests/allasm_aarch64_prefetch.asm<gh_stars>100-1000
/* **********************************************************
* Copyright (c) 2020 Google, Inc. All rights reserved.
* Copyright (c) 2016 ARM Limited. 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 ARM Limited 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 ARM LIMITED 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.
*/
.global _start
.align 6
_start:
// Align stack pointer and get some space.
mov x0, sp
bic x0, x0, #63
mov x1, x0 // x1 is top of region
sub x0, x0, #1024 // x0 is bottom of region
mov sp, x0
adr x0, helloworld
adr x1, .
// prefetch_read_l1
prfm pldl1keep, [x0]
prfum pldl1keep, [x0]
// prefetch_read_l1_nt
prfm pldl1strm, [x0]
prfum pldl1strm, [x0]
prfum pldl1strm, [x0]
// prefetch_read_l2
prfm pldl2keep, [x0]
prfum pldl2keep, [x0]
prfm pldl2keep, [x0]
prfum pldl2keep, [x0]
// prefetch_read_l2_nt
prfm pldl2strm, [x0]
prfm pldl2strm, [x0]
prfum pldl2strm, [x0]
prfum pldl2strm, [x0]
prfum pldl2strm, [x0]
// prefetch_read_l3
prfm pldl3keep, [x0]
prfm pldl3keep, [x0]
prfm pldl3keep, [x0]
prfum pldl3keep, [x0]
prfum pldl3keep, [x0]
prfum pldl3keep, [x0]
// prefetch_read_l3_nt
prfm pldl3strm, [x0]
prfm pldl3strm, [x0]
prfm pldl3strm, [x0]
prfm pldl3strm, [x0]
prfum pldl3strm, [x0]
prfum pldl3strm, [x0]
prfum pldl3strm, [x0]
// prefetch_instr_l1
prfm plil1keep, [x0]
prfm plil1keep, [x0]
prfm plil1keep, [x0]
prfum plil1keep, [x0]
prfum plil1keep, [x0]
prfum plil1keep, [x0]
prfum plil1keep, [x0]
// prefetch_instr_l1_nt
prfm plil1strm, [x0]
prfm plil1strm, [x0]
prfm plil1strm, [x0]
prfum plil1strm, [x0]
prfum plil1strm, [x0]
prfum plil1strm, [x0]
// prefetch_instr_l2
prfm plil2keep, [x0]
prfm plil2keep, [x0]
prfm plil2keep, [x0]
prfum plil2keep, [x0]
prfum plil2keep, [x0]
// prefetch_instr_l2_nt
prfm plil2strm, [x0]
prfm plil2strm, [x0]
prfum plil2strm, [x0]
prfum plil2strm, [x0]
// prefetch_instr_l3
prfm plil3keep, [x0]
prfum plil3keep, [x0]
prfum plil3keep, [x0]
// prefetch_instr_l3_nt
prfm plil3strm, [x0]
prfum plil3strm, [x0]
// prefetch_write_l1
prfm pstl1keep, [x1]
prfm pstl1keep, [x1]
prfum pstl1keep, [x1]
prfum pstl1keep, [x1]
prfum pstl1keep, [x1]
// prefetch_write_l1_nt
prfm pstl1strm, [x1]
prfm pstl1strm, [x1]
prfum pstl1strm, [x1]
prfum pstl1strm, [x1]
// prefetch_write_l2
prfm pstl2keep, [x1]
prfm pstl2keep, [x1]
prfum pstl2keep, [x1]
// prefetch_write_l2_nt
prfm pstl2strm, [x1]
prfum pstl2strm, [x1]
// prefetch_write_l3
prfm pstl3keep, [x1]
prfm pstl3keep, [x1]
prfm pstl3keep, [x1]
prfum pstl3keep, [x1]
prfum pstl3keep, [x1]
prfum pstl3keep, [x1]
prfum pstl3keep, [x1]
// prefetch_write_l3_nt
prfm pstl3strm, [x1]
prfm pstl3strm, [x1]
prfm pstl3strm, [x1]
prfum pstl3strm, [x1]
prfum pstl3strm, [x1]
prfum pstl3strm, [x1]
// Exit.
mov w0, #1 // stdout
adr x1, helloworld
mov w2, #14 // sizeof(helloworld)
mov w8, #64 // SYS_write
svc #0
mov w0, #0 // status
mov w8, #94 // SYS_exit_group
svc #0
.data
.align 6
helloworld:
.ascii "Hello, world!\n"
|
programs/oeis/005/A005766.asm | jmorken/loda | 1 | 246178 | <filename>programs/oeis/005/A005766.asm
; A005766: a(n) = cost of minimal multiplication-cost addition chain for n.
; 0,1,3,5,9,12,18,21,29,34,44,48,60,67,81,85,101,110,128,134,154,165,187,192,216,229,255,263,291,306,336,341,373,390,424,434,470,489,527,534,574,595,637,649,693,716,762,768,816,841,891,905,957,984,1038,1047,1103,1132,1190,1206,1266,1297,1359,1365,1429,1462,1528,1546,1614,1649,1719,1730,1802,1839,1913,1933,2009,2048,2126,2134,2214,2255,2337,2359,2443,2486,2572,2585,2673,2718,2808,2832,2924,2971,3065,3072,3168,3217,3315,3341,3441,3492,3594,3609,3713,3766,3872,3900,4008,4063,4173,4183,4295,4352,4466,4496,4612,4671,4789,4806,4926,4987,5109,5141,5265,5328,5454,5461,5589,5654,5784,5818,5950,6017,6151,6170,6306,6375,6513,6549,6689,6760,6902,6914,7058,7131,7277,7315,7463,7538,7688,7709,7861,7938,8092,8132,8288,8367,8525,8534,8694,8775,8937,8979,9143,9226,9392,9415,9583,9668,9838,9882,10054,10141,10315,10329,10505,10594,10772,10818,10998,11089,11271,11296,11480,11573,11759,11807,11995,12090,12280,12288,12480,12577,12771,12821,13017,13116,13314,13341,13541,13642,13844,13896,14100,14203,14409,14425,14633,14738,14948,15002,15214,15321,15535,15564,15780,15889,16107,16163,16383,16494,16716,16727,16951,17064,17290,17348,17576,17691,17921,17952,18184,18301,18535,18595,18831,18950,19188,19206,19446,19567,19809,19871,20115,20238,20484,20517,20765,20890
mov $2,$0
mov $5,$0
lpb $2
mov $0,$5
sub $2,1
sub $0,$2
add $0,4
mov $4,3
lpb $0
mov $3,$0
div $0,2
gcd $3,2
pow $0,$3
add $0,2
add $4,1
lpe
mov $3,$4
add $3,$0
add $3,1
mov $6,$3
sub $6,8
add $1,$6
lpe
|
pwnlib/shellcraft/templates/amd64/linux/getppid.asm | IMULMUL/python3-pwntools | 325 | 4958 | <filename>pwnlib/shellcraft/templates/amd64/linux/getppid.asm
<%
from pwnlib.shellcraft.amd64.linux import syscall
%>
<%page args=""/>
<%docstring>
Invokes the syscall getppid. See 'man 2 getppid' for more information.
Arguments:
</%docstring>
${syscall('SYS_getppid')}
|
FileAcc/FileAcc.asm | PluMGMK/DOS32pae | 20 | 162011 | <filename>FileAcc/FileAcc.asm<gh_stars>10-100
;--- sample demonstrating the use of the added dosext.obj module
;--- reads file c:\config.sys into buffer,
;--- then writes buffer contents to stdout.
.386
.model flat, stdcall
option casemap:none
option proc:private
lf equ 10
;--- define a string
CStr macro text:vararg
local sym
.const
sym db text,0
.code
exitm <offset sym>
endm
include dpmi.inc
_InitExtender proto c
.data
szFile db "c:\config.sys",0
.data?
buff db 10000h dup (?)
.code
include printf.inc
main proc c
local dwSize:dword
local hFile:dword
mov hFile,-1
;--- init DOS extender.
;--- after successful initialization, DOS functions
;--- 3Fh (read file), 40h (write file) and (71)6Ch (open file)
;--- are directly supported by int 21h.
call _InitExtender
.if !eax
invoke printf, CStr("extender init error",lf)
jmp exit
.endif
;--- open file (LFN version)
mov esi, offset szFile
mov bx,3040h
mov cx,0
mov dx,1
mov di,0
mov ax,716ch
int 21h
.if CARRY?
invoke printf, CStr("cannot open file '%s'",lf), esi
jmp exit
.endif
mov ebx, eax
mov hFile, eax
;--- read file
mov ecx,sizeof buff
mov edx,offset buff
mov ax,3F00h
int 21h
.if CARRY?
invoke printf, CStr("cannot read file '%s', handle=%X",lf), addr szFile, ebx
jmp exit
.endif
mov dwSize, eax
invoke printf, CStr("read %u bytes from file '%s'",lf), dwSize, addr szFile
;--- write file to stdout
mov bx,1
mov ecx,dwSize
mov edx,offset buff
mov ax,4000h
int 21h
exit:
.if hFile != -1
;--- close file
mov ebx, hFile
mov ah,3Eh
int 21h
.endif
ret
main endp
end main
|
tools-src/gnu/gcc/gcc/ada/s-valwch.adb | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 18979 | <reponame>enfoTek/tomato.linksys.e2000.nvram-mod
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . V A L _ W C H A R --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-1997, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with System.Val_Util; use System.Val_Util;
with System.WCh_Con; use System.WCh_Con;
with System.WCh_StW; use System.WCh_StW;
package body System.Val_WChar is
--------------------------
-- Value_Wide_Character --
--------------------------
function Value_Wide_Character
(Str : String;
EM : WC_Encoding_Method)
return Wide_Character
is
F : Natural;
L : Natural;
S : String (Str'Range) := Str;
begin
Normalize_String (S, F, L);
-- Character literal case
if S (F) = ''' and then S (L) = ''' then
-- If just three characters, simple character case
if L - F = 2 then
return Wide_Character'Val (Character'Pos (S (F + 1)));
-- Otherwise must be a wide character in quotes. The easiest
-- thing is to convert the string to a wide string and then
-- pick up the single character that it should contain.
else
declare
WS : constant Wide_String :=
String_To_Wide_String (S (F + 1 .. L - 1), EM);
begin
if WS'Length /= 1 then
raise Constraint_Error;
else
return WS (WS'First);
end if;
end;
end if;
-- the last two values of the type have language-defined names:
elsif S = "FFFE" then
return Wide_Character'Val (16#FFFE#);
elsif S = "FFFF" then
return Wide_Character'Val (16#FFFF#);
-- Otherwise must be a control character
else
for C in Character'Val (16#00#) .. Character'Val (16#1F#) loop
if S (F .. L) = Character'Image (C) then
return Wide_Character'Val (Character'Pos (C));
end if;
end loop;
for C in Character'Val (16#7F#) .. Character'Val (16#9F#) loop
if S (F .. L) = Character'Image (C) then
return Wide_Character'Val (Character'Pos (C));
end if;
end loop;
raise Constraint_Error;
end if;
end Value_Wide_Character;
end System.Val_WChar;
|
Task/Caesar-cipher/Ada/caesar-cipher.ada | LaudateCorpus1/RosettaCodeData | 1 | 16145 | <reponame>LaudateCorpus1/RosettaCodeData<gh_stars>1-10
with Ada.Text_IO;
procedure Caesar is
type M26 is mod 26;
function To_M26(C: Character; Offset: Character) return M26 is
begin
return M26(Character'Pos(C)-Character'Pos(Offset));
end To_M26;
function To_Character(Value: in M26; Offset: Character)
return Character is
begin
return Character'Val(Integer(Value)+Character'Pos(Offset));
end To_Character;
function Encrypt (Plain: String; Key: M26) return String is
Ciph: String(Plain'Range);
begin
for I in Plain'Range loop
case Plain(I) is
when 'A' .. 'Z' =>
Ciph(I) := To_Character(To_M26(Plain(I), 'A')+Key, 'A');
when 'a' .. 'z' =>
Ciph(I) := To_Character(To_M26(Plain(I), 'a')+Key, 'a');
when others =>
Ciph(I) := Plain(I);
end case;
end loop;
return Ciph;
end Encrypt;
Text: String := Ada.Text_IO.Get_Line;
Key: M26 := 3; -- Default key from "<NAME>"
begin -- Caesar main program
Ada.Text_IO.Put_Line("Plaintext ------------>" & Text);
Text := Encrypt(Text, Key);
Ada.Text_IO.Put_Line("Ciphertext ----------->" & Text);
Ada.Text_IO.Put_Line("Decrypted Ciphertext ->" & Encrypt(Text, -Key));
end Caesar;
|
oeis/021/A021903.asm | neoneye/loda-programs | 11 | 245445 | <reponame>neoneye/loda-programs<filename>oeis/021/A021903.asm
; A021903: Decimal expansion of 1/899.
; Submitted by <NAME>(s1.)
; 0,0,1,1,1,2,3,4,7,0,5,2,2,8,0,3,1,1,4,5,7,1,7,4,6,3,8,4,8,7,2,0,8,0,0,8,8,9,8,7,7,6,4,1,8,2,4,2,4,9,1,6,5,7,3,9,7,1,0,7,8,9,7,6,6,4,0,7,1,1,9,0,2,1,1,3,4,5,9,3,9,9,3,3,2,5,9,1,7,6,8,6,3,1,8,1,3,1,2,5
add $0,1
mov $2,10
pow $2,$0
div $2,899
mov $0,$2
mod $0,10
|
3-mid/impact/source/3d/collision/shapes/impact-d3-striding_mesh-triangle_index_vertex_array.adb | charlie5/lace | 20 | 10489 | <reponame>charlie5/lace
-- #include "impact.d3.striding_Mesh.triangle_index_vertex_array.h"
package body impact.d3.striding_Mesh.triangle_index_vertex_array
--
--
--
is
procedure addIndexedMesh (Self : in out Item; mesh : in btIndexedMesh)
is
begin
Self.m_indexedMeshes.append (mesh);
-- Self.m_indexedMeshes[m_indexedMeshes.size()-1].m_indexType = indexType;
end addIndexedMesh;
overriding function getNumSubParts (Self : in Item) return Natural
is
begin
return Natural (Self.m_indexedMeshes.Length);
end getNumSubParts;
function getIndexedMeshArray (Self : access Item) return access IndexedMeshArray
is
begin
return Self.m_indexedMeshes'Access;
end getIndexedMeshArray;
overriding procedure destruct (Self : in out Item)
is
begin
null;
end destruct;
overriding procedure getLockedVertexIndexBase (Self : in out Item; vertexbase : out impact.d3.Containers.real_Pointer;
stride : in out Integer;
indexbase : out swig.Pointers.unsigned_Pointer;
indexstride : in out Integer;
numfaces : in out Integer;
subpart : in Integer := 0)
is
pragma Assert (subpart < Self.getNumSubParts);
mesh : btIndexedMesh renames Self.m_indexedMeshes (subpart);
begin
-- numverts := mesh.m_numVertices;
vertexbase := mesh.m_vertexBase;
-- vertexStride := mesh.m_vertexStride;
numfaces := mesh.m_numTriangles;
indexbase := mesh.m_triangleIndexBase;
indexstride := mesh.m_triangleIndexStride;
-- indicestype := mesh.m_indexType;
-- type = mesh.m_vertexType;
end getLockedVertexIndexBase;
overriding procedure getLockedReadOnlyVertexIndexBase (Self : in Item; vertexbase : out impact.d3.Containers.real_Pointer;
numverts : out Integer;
stride : out Integer;
indexbase : out swig.Pointers.unsigned_Pointer; -- unsigned_char_Pointer;
indexstride : out Integer;
numfaces : out Integer;
subpart : in Integer := 0)
is
mesh : btIndexedMesh renames Self.m_indexedMeshes (subpart);
begin
numverts := mesh.m_numVertices;
vertexbase := mesh.m_vertexBase;
-- type = mesh.m_vertexType;
Stride := mesh.m_vertexStride;
numfaces := mesh.m_numTriangles;
indexbase := mesh.m_triangleIndexBase;
indexstride := mesh.m_triangleIndexStride;
-- indicestype := mesh.m_indexType;
end getLockedReadOnlyVertexIndexBase;
overriding procedure unLockVertexBase (Self : in out Item; subpart : in Integer)
is
pragma Unreferenced (Self, subpart);
begin
return;
end unLockVertexBase;
overriding procedure unLockReadOnlyVertexBase (Self : in Item; subpart : in Integer)
is
pragma Unreferenced (Self, subpart);
begin
return;
end unLockReadOnlyVertexBase;
overriding procedure setPremadeAabb (Self : in out Item; aabbMin, aabbMax : in math.Vector_3)
is
begin
Self.m_aabbMin := aabbMin;
Self.m_aabbMax := aabbMax;
Self.m_hasAabb := True;
end setPremadeAabb;
overriding procedure getPremadeAabb (Self : in Item; aabbMin, aabbMax : out math.Vector_3)
is
begin
aabbMin := Self.m_aabbMin;
aabbMax := Self.m_aabbMax;
end getPremadeAabb;
overriding function hasPremadeAabb (Self : in Item) return Boolean
is
begin
return Self.m_hasAabb;
end hasPremadeAabb;
end impact.d3.striding_Mesh.triangle_index_vertex_array;
-- Just to be backwards compatible ...
--
-- impact.d3.striding_Mesh.triangle_index_vertex_array::impact.d3.striding_Mesh.triangle_index_vertex_array(int numTriangles,int* triangleIndexBase,int triangleIndexStride,int numVertices,impact.d3.Scalar* vertexBase,int vertexStride)
-- : m_hasAabb(0)
-- {
-- btIndexedMesh mesh;
--
-- mesh.m_numTriangles = numTriangles;
-- mesh.m_triangleIndexBase = (const unsigned char *)triangleIndexBase;
-- mesh.m_triangleIndexStride = triangleIndexStride;
-- mesh.m_numVertices = numVertices;
-- mesh.m_vertexBase = (const unsigned char *)vertexBase;
-- mesh.m_vertexStride = vertexStride;
--
-- addIndexedMesh(mesh);
--
-- }
|
Library/Text/Text/textManager.asm | steakknife/pcgeos | 504 | 246548 | COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1988 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: UserInterface/Text
FILE: textManager.asm
REVISION HISTORY:
Name Date Description
---- ---- -----------
John 12-Jun-89 Initial version
DESCRIPTION:
$Id: textManager.asm,v 1.2 98/03/24 23:00:58 gene Exp $
------------------------------------------------------------------------------@
;-----------------------------------------------------------------------------
; Include common definitions
;-----------------------------------------------------------------------------
include textGeode.def
include texttext.def
include textattr.def
include textgr.def
include texttrans.def
include textpen.def
include textssp.def
include textline.def
include textstorage.def
include textregion.def
include textselect.def
include textundo.def
include hwr.def
include Internal/im.def
include Internal/heapInt.def
include Internal/semInt.def
ifdef USE_FEP
include Internal/fepDr.def
include driver.def
endif
include system.def
UseLib spell.def
;-----------------------------------------------------------------------------
; Include definitions for this module
;-----------------------------------------------------------------------------
include tConstant.def
include tVariable.def
;-----------------------------------------------------------------------------
; Include code
;-----------------------------------------------------------------------------
; Resources:
; Text - core calculation and display
; TextInstance - initilization, relocation, setting instance data,
; open/close stuff, obscure methods
; TextAttributes - charAttr and paraAttr related
; TextGraphic - graphics hanndling
; TextBorder - border, background color, tab line related
; TextSearchSpell - search & replace and spell check code
;-----------------------------------------------------------------------------
; Entry Point routines
include textEntry.asm
ifdef USE_FEP
include textFep.asm
endif ; USE_FEP
;==============
; Utility routines
include textUtils.asm
; Core calculation and display code; resource(s): Text, TextInstance
; (init code in TextInstance)
include textCalc.asm
include textCalcObject.asm
include textReplace.asm
;-----------------------------------------------------------------------------
; Selection Code
;-----------------------------------------------------------------------------
include textGState.asm
include textOutput.asm
include textScroll.asm
include textScrollOneLine.asm
include textStuff.asm
include textMethodDraw.asm
;
; Hopefully everything in textMethodManip.asm will migrate to other files and
; we can remove it entirely.
;
include textMethodManip.asm
include textCompatibility.asm
include textMethodSet.asm
include textMethodGet.asm
include textMethodClipboard.asm
include textOptimizedUpdate.asm
include textMethodInput.asm
include textFilter.asm
;==============
; Instance data related code; resource(s): TextInstance
include textInstance.asm
include textMethodGeometry.asm
include textMethodInstance.asm ;except ~20 bytes in Text
;==============
; Border, background color, tab line related code; resource(s): TextBorder
include textBGBorder.asm
;==============
; Suspend/unsuspend; resource(s): TextAttributes
include textSuspend.asm
include textC.asm
|
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/ツール/tool/map/sfc/ysm_map.asm | prismotizm/gigaleak | 0 | 82687 | <reponame>prismotizm/gigaleak<filename>other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/ツール/tool/map/sfc/ysm_map.asm
Name: ysm_map.asm
Type: file
Size: 48782
Last-Modified: '2016-05-13T04:52:57Z'
SHA-1: 41D7728DB4F9CFB2C63537E14548609DDE1C87EF
Description: null
|
public/wintab/wintabx/close.asm | DannyParker0001/Kisak-Strike | 252 | 243310 | include xlibproc.inc
include Wintab.inc
PROC_TEMPLATE WTClose, 1, Wintab, -, 22
|
programs/oeis/083/A083028.asm | jmorken/loda | 1 | 84683 | <reponame>jmorken/loda<filename>programs/oeis/083/A083028.asm<gh_stars>1-10
; A083028: Numbers that are congruent to {0, 2, 3, 5, 7, 8, 11} mod 12.
; 0,2,3,5,7,8,11,12,14,15,17,19,20,23,24,26,27,29,31,32,35,36,38,39,41,43,44,47,48,50,51,53,55,56,59,60,62,63,65,67,68,71,72,74,75,77,79,80,83,84,86,87,89,91,92,95,96,98,99,101,103,104,107,108,110,111
mul $0,4
mov $1,2
mov $2,2
lpb $0
trn $0,2
add $0,1
add $1,$0
trn $0,3
trn $2,1
add $0,$2
sub $1,$0
trn $0,3
lpe
sub $1,2
|
case-studies/performance/verification/alloy/ppc/tests/lwswr000.als | uwplse/memsynth | 19 | 5165 | <reponame>uwplse/memsynth
module tests/lwswr000
open program
open model
/**
PPC lwswr000
"DpdR Fre LwSyncsWR Fre LwSyncsWR DpdR Fre LwSyncsWR Fre LwSyncsWR"
Cycle=DpdR Fre LwSyncsWR Fre LwSyncsWR DpdR Fre LwSyncsWR Fre LwSyncsWR
Relax=LwSyncsWR
Safe=Fre DpdR
{
0:r2=x;
1:r2=x; 1:r6=y;
2:r2=y;
3:r2=y; 3:r6=x;
}
P0 | P1 | P2 | P3 ;
li r1,1 | li r1,2 | li r1,1 | li r1,2 ;
stw r1,0(r2) | stw r1,0(r2) | stw r1,0(r2) | stw r1,0(r2) ;
lwsync | lwsync | lwsync | lwsync ;
lwz r3,0(r2) | lwz r3,0(r2) | lwz r3,0(r2) | lwz r3,0(r2) ;
| xor r4,r3,r3 | | xor r4,r3,r3 ;
| lwzx r5,r4,r6 | | lwzx r5,r4,r6 ;
exists
(x=2 /\ y=2 /\ 0:r3=1 /\ 1:r3=2 /\ 1:r5=0 /\ 2:r3=1 /\ 3:r3=2 /\ 3:r5=0)
**/
one sig x, y extends Location {}
one sig P1, P2, P3, P4 extends Processor {}
one sig op1 extends Write {}
one sig op2 extends Lwsync {}
one sig op3 extends Read {}
one sig op4 extends Write {}
one sig op5 extends Lwsync {}
one sig op6 extends Read {}
one sig op7 extends Read {}
one sig op8 extends Write {}
one sig op9 extends Lwsync {}
one sig op10 extends Read {}
one sig op11 extends Write {}
one sig op12 extends Lwsync {}
one sig op13 extends Read {}
one sig op14 extends Read {}
fact {
P1.write[1, op1, x, 1]
P1.lwsync[2, op2]
P1.read[3, op3, x, 1]
P2.write[4, op4, x, 2]
P2.lwsync[5, op5]
P2.read[6, op6, x, 2]
P2.read[7, op7, y, 0] and op7.dep[op6]
P3.write[8, op8, y, 1]
P3.lwsync[9, op9]
P3.read[10, op10, y, 1]
P4.write[11, op11, y, 2]
P4.lwsync[12, op12]
P4.read[13, op13, y, 2]
P4.read[14, op14, x, 0] and op14.dep[op13]
}
fact {
y.final[2]
x.final[2]
}
Allowed:
run { Allowed_PPC } for 5 int expect 1 |
libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sccz80/esx_f_getfree.asm | Toysoft/z88dk | 0 | 21215 | ; uint32_t esx_f_getfree(void)
SECTION code_esxdos
PUBLIC esx_f_getfree
EXTERN asm_esx_f_getfree
defc esx_f_getfree = asm_esx_f_getfree
|
linear_algebra/givens_qr_method.adb | jscparker/math_packages | 30 | 5343 |
---------------------------------------------------------------------------
-- package body Givens_QR_Method
-- Copyright (C) 2011-2018 <NAME>
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
---------------------------------------------------------------------------
with Ada.Numerics;
with Ada.Numerics.Generic_Elementary_Functions;
with Givens_Rotation;
package body Givens_QR_Method is
package math is new Ada.Numerics.Generic_Elementary_Functions (Real);
use math;
package Rotate is new Givens_Rotation (Real); use Rotate;
Zero : constant Real := +0.0;
One : constant Real := +1.0;
Two : constant Real := +2.0;
function Identity return A_Matrix is
Q : A_Matrix;
begin
Q := (others => (others => Zero));
for c in C_Index loop
Q(c, c) := One;
end loop;
return Q;
end Identity;
type Rotation is record
sn : Real := Zero;
cn : Real := One;
cn_minus_1 : Real := Zero;
sn_minus_1 : Real := Zero;
P_bigger_than_L : Boolean := True;
Skip_Rotation : Boolean := True;
Pivot_Col : C_Index := C_Index'First;
Hi_Row : R_Index := R_Index'First;
Lo_Row : R_Index := R_Index'First;
end record;
---------------------------------
-- Lower_Diagonal_QR_Iteration --
---------------------------------
-- Operates only on square real blocks.
procedure Lower_Diagonal_QR_Iteration
(A : in out A_Matrix;
Q : in out A_Matrix;
Shift : in Real;
Starting_Col : in C_Index := C_Index'First;
Final_Col : in C_Index := C_Index'Last)
is
Hi_Row, Lo_Row : R_Index;
P, L : Real;
Rotations : array (C_Index) of Rotation;
sn, cn : Real;
cn_minus_1 : Real;
sn_minus_1 : Real;
P_bigger_than_L : Boolean;
Skip_Rotation : Boolean;
-------------------------------------------
-- e_Multiply_A_on_RHS_with_Transpose_of --
-------------------------------------------
-- multiply A on the right by R_transpose:
-- A = A * R_transpose
--
-- Use enhanced precision rotations here.
procedure e_Multiply_A_on_RHS_with_Transpose_of
(R : in Rotation)
is
sn : constant Real := R.sn;
cn : constant Real := R.cn;
cn_minus_1 : constant Real := R.cn_minus_1;
sn_minus_1 : constant Real := R.sn_minus_1;
P_bigger_than_L : constant Boolean := R.P_bigger_than_L;
Skip_Rotation : constant Boolean := R.Skip_Rotation;
Pivot_Row : constant R_Index := R.Hi_Row;
Low_Row : constant R_Index := R.Lo_Row;
A_pvt, A_low : Real;
begin
if Skip_Rotation then return; end if;
-- Rotate corresponding columns. Multiply on RHS by transpose
-- of above givens matrix (second step of similarity transformation).
-- (Low_Row is Lo visually, but its index is higher than Pivot's.)
if P_bigger_than_L then -- |s| < |c|
for r in Starting_Col .. Final_Col loop
A_pvt := A(r, Pivot_Row);
A_low := A(r, Low_Row);
A(r, Pivot_Row) := A_pvt + (cn_minus_1*A_pvt + sn * A_low);
A(r, Low_Row) := A_low + (-sn * A_pvt + cn_minus_1*A_low);
end loop;
else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1
for r in Starting_Col .. Final_Col loop
A_pvt := A(r, Pivot_Row);
A_low := A(r, Low_Row);
A(r, Pivot_Row) := A_low + (cn * A_pvt + sn_minus_1*A_low);
A(r, Low_Row) :=-A_pvt + (-sn_minus_1*A_pvt + cn * A_low);
end loop;
end if;
end e_Multiply_A_on_RHS_with_Transpose_of;
-----------------------------------------
-- Rotate_to_Kill_Element_Lo_of_pCol --
-----------------------------------------
-- Try to zero out A(Lo_Row, Pivot_Col) with a similarity transformation.
-- In other words, multiply A on left by R:
--
-- A = R * A
--
-- and multiply Q on right by R_transpose:
--
-- Q = Q * R_transpose
procedure Rotate_to_Kill_Element_Lo_of_pCol
(R : in Rotation)
is
sn : constant Real := R.sn;
cn : constant Real := R.cn;
cn_minus_1 : constant Real := R.cn_minus_1;
sn_minus_1 : constant Real := R.sn_minus_1;
P_bigger_than_L : constant Boolean := R.P_bigger_than_L;
Skip_Rotation : constant Boolean := R.Skip_Rotation;
Pivot_Col : constant C_Index := R.Pivot_Col;
Pivot_Row : constant R_Index := R.Hi_Row;
Low_Row : constant R_Index := R.Lo_Row;
A_pvt, A_low, Q_pvt, Q_low : Real;
begin
if Skip_Rotation then return; end if;
if P_bigger_than_L then -- |s| < |c|
--for c in Starting_Col .. Final_Col loop
for c in Pivot_Col .. Final_Col loop -- works only for upper hessenbergs
A_pvt := A(Pivot_Row, c);
A_low := A(Low_Row, c);
A(Pivot_Row, c) := A_pvt + (cn_minus_1*A_pvt + sn * A_low);
A(Low_Row, c) := A_low + (-sn * A_pvt + cn_minus_1*A_low);
end loop;
else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1
--for c in Starting_Col .. Final_Col loop
for c in Pivot_Col .. Final_Col loop -- works only for upper hessenbergs
A_pvt := A(Pivot_Row, c);
A_low := A(Low_Row, c);
A(Pivot_Row, c) := A_low + (cn * A_pvt + sn_minus_1*A_low);
A(Low_Row, c) :=-A_pvt + (-sn_minus_1*A_pvt + cn * A_low);
end loop;
end if;
-- Rotate corresponding columns of Q. (Multiply on RHS by transpose
-- of above givens matrix to accumulate full Q.)
if P_bigger_than_L then -- |s| < |c|
for r in Starting_Col .. Final_Col loop
Q_pvt := Q(r, Pivot_Row);
Q_low := Q(r, Low_Row);
Q(r, Pivot_Row) := Q_pvt + (cn_minus_1*Q_pvt + sn * Q_low);
Q(r, Low_Row) := Q_low + (-sn * Q_pvt + cn_minus_1*Q_low);
end loop;
else -- Abs_P <= Abs_L, so abs t := abs (P / L) <= 1
for r in Starting_Col .. Final_Col loop
Q_pvt := Q(r, Pivot_Row);
Q_low := Q(r, Low_Row);
Q(r, Pivot_Row) := Q_low + (cn * Q_pvt + sn_minus_1*Q_low);
Q(r, Low_Row) :=-Q_pvt + (-sn_minus_1*Q_pvt + cn * Q_low);
end loop;
end if;
end Rotate_to_Kill_Element_Lo_of_pCol;
-- Sum = Small + Large. Lost_Bits = Small - (Sum - Large)
procedure Sum_with_Dropped_Bits
(A, B : in Real;
Sum : out Real;
Dropped_Bits : out Real)
is
begin
Sum := A + B;
if Abs A > Abs B then
Dropped_Bits := B - (Sum - A);
else
Dropped_Bits := A - (Sum - B);
end if;
end Sum_with_Dropped_Bits;
type Diag_Storage is array(C_Index) of Real;
Lost_Bits : Diag_Storage;
hypot : Real := Zero;
begin
if (Final_Col - Starting_Col) < 2 then return; end if;
Lost_Bits := (others => 0.0);
-- Subtract 'Shift' from each diagonal element of A.
-- Sum = A(c, c) + (-Shift)
-- Sum = Small + Large. Lost_Bits = Small - (Sum - Large)
declare
Sum, Dropped_Bits : Real;
begin
if Abs Shift > Zero then
for c in Starting_Col .. Final_Col loop
Sum_with_Dropped_Bits (A(c,c), -Shift, Sum, Dropped_Bits);
A(c, c) := Sum;
Lost_Bits(c) := Dropped_Bits;
end loop;
else
Lost_Bits := (others => 0.0);
end if;
end;
for Pivot_Col in Starting_Col .. Final_Col-1 loop
Hi_Row := Pivot_Col;
Lo_Row := Hi_Row + 1;
P := A(Hi_Row, Pivot_Col);
L := A(Lo_Row, Pivot_Col);
Get_Rotation_That_Zeros_Out_Low
(P, L, sn, cn, cn_minus_1, sn_minus_1, hypot, P_bigger_than_L, Skip_Rotation);
Rotations(Pivot_Col).sn := sn;
Rotations(Pivot_Col).cn := cn;
Rotations(Pivot_Col).cn_minus_1 := cn_minus_1;
Rotations(Pivot_Col).sn_minus_1 := sn_minus_1;
Rotations(Pivot_Col).P_bigger_than_L := P_bigger_than_L;
Rotations(Pivot_Col).Skip_Rotation := Skip_Rotation;
Rotations(Pivot_Col).Pivot_Col := Pivot_Col;
Rotations(Pivot_Col).Hi_Row := Hi_Row;
Rotations(Pivot_Col).Lo_Row := Lo_Row;
--Rotations(Pivot_Col).Skip_Rotation := false; -- for testing
Rotate_to_Kill_Element_Lo_of_pCol (Rotations(Pivot_Col));
-- Zeroes out A(Lo_Row, Pivot_Col)
-- Updates A and Q as global memory.
-- Applies rotation by multiplying Givens Matrix on LHS of A.
-- Then multiplies transpose of Givens Matrix on RHS of Q.
A(Lo_Row, Pivot_Col) := Zero;
A(Hi_Row, Pivot_Col) := Real'Copy_Sign(hypot, A(Hi_Row, Pivot_Col));
end loop; -- over Pivot_Col
-- These can be done inside the above loop (after a delay of 1 step):
for Pivot_Col in Starting_Col .. Final_Col-1 loop
e_Multiply_A_on_RHS_with_Transpose_of (Rotations(Pivot_Col));
end loop;
-- Add Shift back to A:
for c in Starting_Col .. Final_Col loop
A(c, c) := (A(c, c) + Shift) + Lost_Bits(c); -- best default
end loop;
end Lower_Diagonal_QR_Iteration;
end Givens_QR_Method;
|
src/main/antlr4/io/horizondb/db/parser/Hql.g4 | blerer/horizondb | 12 | 3848 | <gh_stars>10-100
grammar Hql;
fragment A_
: 'a'
| 'A'
;
fragment B_
: 'b'
| 'B'
;
fragment C_
: 'c'
| 'C'
;
fragment D_
: 'd'
| 'D'
;
fragment E_
: 'e'
| 'E'
;
fragment F_
: 'f'
| 'F'
;
fragment G_
: 'g'
| 'G'
;
fragment H_
: 'h'
| 'H'
;
fragment I_
: 'i'
| 'I'
;
fragment J_
: 'j'
| 'J'
;
fragment K_
: 'k'
| 'K'
;
fragment L_
: 'l'
| 'L'
;
fragment M_
: 'm'
| 'M'
;
fragment N_
: 'n'
| 'N'
;
fragment O_
: 'o'
| 'O'
;
fragment P_
: 'p'
| 'P'
;
fragment Q_
: 'q'
| 'Q'
;
fragment R_
: 'r'
| 'R'
;
fragment S_
: 's'
| 'S'
;
fragment T_
: 't'
| 'T'
;
fragment U_
: 'u'
| 'U'
;
fragment V_
: 'v'
| 'V'
;
fragment W_
: 'w'
| 'W'
;
fragment X_
: 'x'
| 'X'
;
fragment Y_
: 'y'
| 'Y'
;
fragment Z_
: 'z'
| 'Z'
;
AND
: A_ N_ D_
;
BETWEEN
: B_ E_ T_ W_ E_ E_ N_
;
BYTE
: B_ Y_ T_ E_
;
CREATE
: C_ R_ E_ A_ T_ E_
;
DATABASE
: D_ A_ T_ A_ B_ A_ S_ E_
;
DECIMAL
: D_ E_ C_ I_ M_ A_ L_
;
DROP
: D_ R_ O_ P_
;
FROM
: F_ R_ O_ M_
;
IN
: I_ N_
;
INTO
: I_ N_ T_ O_
;
INSERT
: I_ N_ S_ E_ R_ T_
;
INTEGER
: I_ N_ T_ E_ G_ E_ R_
;
LONG
: L_ O_ N_ G_
;
MICROSECONDS
: M_ I_ C_ R_ O_ S_ E_ C_ O_ N_ D_ S_
;
MICROSECONDS_TIMESTAMP
: MICROSECONDS'_' T_ I_ M_ E_ S_ T_ A_ M_ P_
;
MILLISECONDS
: M_ I_ L_ L_ I_ S_ E_ C_ O_ N_ D_ S_
;
MILLISECONDS_TIMESTAMP
: MILLISECONDS'_' T_ I_ M_ E_ S_ T_ A_ M_ P_
;
NANOSECONDS
: N_ A_ N_ O_ S_ E_ C_ O_ N_ D_ S_
;
NANOSECONDS_TIMESTAMP
: NANOSECONDS'_' T_ I_ M_ E_ S_ T_ A_ M_ P_
;
NOT
: N_ O_ T_
;
OR
: O_ R_
;
SECONDS
: S_ E_ C_ O_ N_ D_ S_
;
SECONDS_TIMESTAMP
: SECONDS'_' T_ I_ M_ E_ S_ T_ A_ M_ P_
;
SELECT
: S_ E_ L_ E_ C_ T_
;
TIMESERIES
: T_ I_ M_ E_ S_ E_ R_ I_ E_ S_
;
TIME_UNIT
: T_ I_ M_ E_'_' U_ N_ I_ T_
;
TIMEZONE
: T_ I_ M_ E_ Z_ O_ N_ E_
;
USE
: U_ S_ E_
;
VALUES
: V_ A_ L_ U_ E_ S_;
WHERE
: W_ H_ E_ R_ E_
;
statements
: (statement ';')*
;
statement
: select
| insert
| useDatabase
| createTimeSeries
| dropTimeSeries
| createDatabase
| dropDatabase
;
createDatabase
: CREATE DATABASE ID
;
dropDatabase
: DROP DATABASE ID
;
createTimeSeries
: CREATE TIMESERIES (databaseName'.')?timeSeriesName '(' recordsDefinition ')' timeSeriesOptions
;
dropTimeSeries
: DROP TIMESERIES (databaseName'.')?timeSeriesName
;
recordsDefinition
: recordDefinition (',' recordDefinition)*
;
recordDefinition
: ID '(' fieldsDefinition ')'
;
fieldsDefinition
: fieldDefinition (',' fieldDefinition)*
;
fieldDefinition
: ID type
;
timeSeriesOptions
: (timeSeriesOption)*
;
timeSeriesOption
: TIMEZONE '=' STRING
| TIME_UNIT '=' timeUnit
;
timeUnit
: NANOSECONDS
| MICROSECONDS
| MILLISECONDS
| SECONDS
;
type
: BYTE
| INTEGER
| LONG
| DECIMAL
| NANOSECONDS_TIMESTAMP
| MICROSECONDS_TIMESTAMP
| MILLISECONDS_TIMESTAMP
| SECONDS_TIMESTAMP
;
useDatabase
: USE ID
;
insert
: INSERT INTO (databaseName'.')?recordName ('(' fieldList ')')? VALUES '(' valueList ')'
;
timeSeriesName
: ID
;
databaseName
: ID
;
recordName
: timeSeriesName'.'ID
;
fieldList
: ID (',' ID )*
;
valueList
: value (',' value )*
;
select
: SELECT selectList FROM (databaseName'.')?ID (whereClause)?
;
selectList
: '*'
| selectListElement (',' selectListElement )*
;
selectListElement
: ID'.*'
| ID'.'ID
;
whereClause
: WHERE predicate
;
predicate
: '('predicate')'
| predicate AND predicate
| predicate OR predicate
| inPredicate
| betweenPredicate
| simplePredicate
;
inPredicate
: ID NOT? IN '(' (value (',' value )*)? ')'
;
betweenPredicate
: ID NOT? BETWEEN value AND value
;
simplePredicate
: ID operator value
;
operator
: '='
| '>='
| '>'
| '<='
| '<'
| '!='
;
value
: STRING
| timeValue
| NUMBER
;
timeValue
: NUMBER ('s' | 'ms' | 'µs' | 'ns')
| '\'' DATE (TIME)? '\''
;
DATE
: '0'..'3' '0'..'9' '-' '0'..'1' '0'..'9' '-' '0'..'9' '0'..'9' '0'..'9' '0'..'9'
;
TIME
: '0'..'2' '0'..'9' ':' '0'..'5' '0'..'9' ':' '0'..'5' '0'..'9' '.' ('0'..'9' '0'..'9' '0'..'9')?
;
ID
: ID_LETTER (ID_LETTER | DIGIT)*
;
fragment ID_LETTER
: 'a'..'z'
|'A'..'Z'
|'_'
;
fragment DIGIT
: '0'..'9'
;
NUMBER
: '0'..'9' ('0'..'9')* ('.' '0'..'9' ('0'..'9')*)* ('E' '-'* '0'..'9' ('0'..'9')*)*
;
STRING
: '\'' .*?'\''
;
WS
: [ \t\r\n]+ -> skip
; |
oeis/177/A177353.asm | neoneye/loda-programs | 11 | 245498 | <filename>oeis/177/A177353.asm
; A177353: n! (mod n^2+1).
; Submitted by <NAME>
; 1,2,6,7,16,17,40,20,30,72,108,45,20,188,206,115,240,0,12,266,0,355,440,17,612,271,260,485,302,459,884,750,930,936,1064,1088,860,0,196,1430,1218,1725,0,143,916,870,0,1990,2024,2419,2,2610,2770,1355,2040,99,0,465,310,2015,432,3125,1480,2074,2982,3912,740,0,3950,0,200,0,0,219,3944,2809,4460,975,5726,4551,306,1925,0,3992,3980,3965,2600,3800,6188,4220,738,1420,7150,5091,3734,4680,8840,255,0,803
add $0,1
pow $0,2
add $0,1
mov $2,$0
seq $0,214080 ; a(n) = (floor(sqrt(n)))!
mod $0,$2
|
programs/oeis/132/A132233.asm | neoneye/loda | 22 | 165425 | <gh_stars>10-100
; A132233: Primes congruent to 13 (mod 30).
; 13,43,73,103,163,193,223,283,313,373,433,463,523,613,643,673,733,823,853,883,1033,1063,1093,1123,1153,1213,1303,1423,1453,1483,1543,1663,1693,1723,1753,1783,1873,1933,1993,2053,2083,2113,2143,2203,2293,2383,2473,2503,2593,2683,2713,2803,2833,2953,3163,3253,3313,3343,3373,3433,3463,3583,3613,3643,3673,3733,3793,3823,3853,3943,4003,4093,4153,4243,4273,4363,4423,4483,4513,4603,4663,4723,4783,4813,4903,4933,4993,5023,5113,5233,5323,5413,5443,5503,5563,5623,5653,5683,5743,5923
mov $2,$0
add $2,1
pow $2,2
lpb $2
add $1,12
sub $2,1
mov $3,$1
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,18
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
div $1,2
sub $1,22
mul $1,2
add $1,27
mov $0,$1
|
programs/oeis/131/A131028.asm | neoneye/loda | 22 | 95462 | <filename>programs/oeis/131/A131028.asm
; A131028: Periodic sequence (7, 4, 1, 1, 4, 7).
; 7,4,1,1,4,7,7,4,1,1,4,7,7,4,1,1,4,7,7,4,1,1,4,7,7,4,1,1,4,7,7,4,1,1,4,7,7,4,1,1,4,7,7,4,1,1,4,7,7,4,1,1,4,7,7,4,1,1,4,7,7,4,1,1,4,7,7,4,1,1,4,7,7,4,1,1,4,7,7,4,1,1,4,7,7,4,1,1,4,7,7,4,1,1,4,7,7,4,1,1
sub $0,739
dif $0,2
gcd $0,$0
add $0,1
mod $0,3
mul $0,3
add $0,1
|
src/svg.adb | SKNZ/BoiteMaker | 0 | 8590 | <reponame>SKNZ/BoiteMaker<gh_stars>0
with ada.strings.unbounded;
use ada.strings.unbounded;
with point_list;
use point_list;
with point;
use point;
with halfbox_panel;
use halfbox_panel;
with halfbox;
use halfbox;
with logger;
use logger;
with imagemagick;
package body svg is
function get_svg(box : box_parts_t; input_border_color, input_fill_color, pattern : string) return string is
base_pos : point_t;
selected_fill_color : unbounded_string := to_unbounded_string(input_fill_color);
selected_border_color : unbounded_string := to_unbounded_string(input_border_color);
function export_polygon(polygon : point_list.node_ptr) return unbounded_string is
svg_text : unbounded_string := to_unbounded_string(svg_polygon_begin)
& selected_border_color
& svg_polygon_fill_style
& selected_fill_color
& svg_polygon_end_style;
curr_point : point_list.node_ptr := polygon;
curr_pos : point_t;
begin
while has_next(curr_point) loop
curr_pos := elem(curr_point);
append(svg_text,
float'image(base_pos.x + curr_pos.x)
& ','
& float'image(base_pos.y + curr_pos.y)
& ' ');
curr_point := move_next(curr_point);
end loop;
return svg_text & svg_polygon_end;
end;
function export_panel(panel : halfbox_panel_t) return unbounded_string is
begin
return export_polygon(panel.polygon);
end;
function export_halfbox (halfbox : halfbox_t) return string is
svg_text : unbounded_string;
begin
svg_text := export_panel(halfbox.panel_bottom);
base_pos := (base_pos.x + float(halfbox.info.length) + 5.0, base_pos.y);
append(svg_text, export_panel(halfbox.panel_front));
base_pos := (base_pos.x + float(halfbox.info.length) + 5.0, base_pos.y);
append(svg_text, export_panel(halfbox.panel_back));
base_pos := (base_pos.x + float(halfbox.info.length) + 5.0, base_pos.y);
append(svg_text, export_panel(halfbox.panel_left));
base_pos := (base_pos.x + float(halfbox.info.width) + 10.0, base_pos.y);
append(svg_text, export_panel(halfbox.panel_right));
base_pos := (0.0, base_pos.y + float(integer'max(halfbox.info.width, halfbox.info.height)) + 10.0);
return to_string(svg_text);
end;
svg_defs : unbounded_string := to_unbounded_string("");
begin
debug("Export en svg");
-- selected_fill_color est init. avec input_fill_color pour valeur
if length(selected_fill_color) = 0 then
debug("Pas de couleur de remplissage. Default: " & default_fill_color);
selected_fill_color := to_unbounded_string(default_fill_color);
end if;
-- selected_border_color est init. avec input_border_color pour valeur
if length(selected_border_color) = 0 then
debug("Pas de couleur de bordure. Default: " & default_border_color);
selected_border_color := to_unbounded_string(default_border_color);
end if;
if pattern'length /= 0 then
declare
base64 : unbounded_string;
w,h : integer;
begin
imagemagick.get_base64(pattern, base64, w, h);
svg_defs :=
tab & "<defs>" & lf &
tab & " <pattern id=""polyfill"" patternUnits=""userSpaceOnUse"" width=""" & integer'image(w) & """ height=""" & integer'image(h) & """>" & lf &
tab & " <image xlink:href=""" & base64 & """ x=""0"" y=""0"" width=""" & integer'image(w) & """ height=""" & integer'image(h) & """ />" & lf &
tab & " </pattern>" & lf &
tab & "</defs>" & lf;
selected_fill_color := to_unbounded_string("url(#polyfill)");
end;
end if;
return
to_string(svg_header
& svg_defs
& export_halfbox(box.lower_halfbox)
& export_halfbox(box.inner_halfbox)
& export_halfbox(box.upper_halfbox)
& svg_footer);
end;
end svg;
|
vp9/encoder/arm/neon/vp9_dct_ht_16x16_neon_asm.asm | ittiamvpx/libvpx | 14 | 82034 | <gh_stars>10-100
;
; Copyright (c) 2013 The WebM project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
cospi_1_64 EQU 16364
cospi_2_64 EQU 16305
cospi_3_64 EQU 16207
cospi_4_64 EQU 16069
cospi_5_64 EQU 15893
cospi_6_64 EQU 15679
cospi_7_64 EQU 15426
cospi_8_64 EQU 15137
cospi_9_64 EQU 14811
cospi_10_64 EQU 14449
cospi_11_64 EQU 14053
cospi_12_64 EQU 13623
cospi_13_64 EQU 13160
cospi_14_64 EQU 12665
cospi_15_64 EQU 12140
cospi_16_64 EQU 11585
cospi_17_64 EQU 11003
cospi_18_64 EQU 10394
cospi_19_64 EQU 9760
cospi_20_64 EQU 9102
cospi_21_64 EQU 8423
cospi_22_64 EQU 7723
cospi_23_64 EQU 7005
cospi_24_64 EQU 6270
cospi_25_64 EQU 5520
cospi_26_64 EQU 4756
cospi_27_64 EQU 3981
cospi_28_64 EQU 3196
cospi_29_64 EQU 2404
cospi_30_64 EQU 1606
cospi_31_64 EQU 804
EXPORT |vp9_fdct16x16_neon|
EXPORT |vp9_fht16x16_neon|
ARM
REQUIRE8
PRESERVE8
AREA ||.text||, CODE, READONLY, ALIGN=2
AREA Block, CODE, READONLY
;---------------------------------------------------------------------------
; Load values to 16 q registers
MACRO
LOAD_INPUT $ptr, $stride
vld1.64 q0, [$ptr], $stride
vld1.64 q1, [$ptr], $stride
vld1.64 q2, [$ptr], $stride
vld1.64 q3, [$ptr], $stride
vld1.64 q4, [$ptr], $stride
vld1.64 q5, [$ptr], $stride
vld1.64 q6, [$ptr], $stride
vld1.64 q7, [$ptr], $stride
vld1.64 q8, [$ptr], $stride
vld1.64 q9, [$ptr], $stride
vld1.64 q10, [$ptr], $stride
vld1.64 q11, [$ptr], $stride
vld1.64 q12, [$ptr], $stride
vld1.64 q13, [$ptr], $stride
vld1.64 q14, [$ptr], $stride
vld1.64 q15, [$ptr], $stride
MEND
;---------------------------------------------------------------------------
;Transpose a 8x8 16bit data matrix. Datas are loaded in q8-q15.
MACRO
TRANSPOSE8X8_Q8_TO_Q15
vswp d17, d24
vswp d23, d30
vswp d21, d28
vswp d19, d26
vtrn.32 q8, q10
vtrn.32 q9, q11
vtrn.32 q12, q14
vtrn.32 q13, q15
vtrn.16 q8, q9
vtrn.16 q10, q11
vtrn.16 q12, q13
vtrn.16 q14, q15
MEND
;---------------------------------------------------------------------------
; Transpose a 8x8 16bit data matrix. Datas are loaded in q0-q7.
MACRO
TRANSPOSE8X8_Q0_TO_Q7
vswp d1, d8
vswp d7, d14
vswp d5, d12
vswp d3, d10
vtrn.32 q0, q2
vtrn.32 q1, q3
vtrn.32 q4, q6
vtrn.32 q5, q7
vtrn.16 q0, q1
vtrn.16 q2, q3
vtrn.16 q4, q5
vtrn.16 q6, q7
MEND
; --------------------------------------------------------------------------
; Multiply all registers(q0-q15) by 4
MACRO
MULTIPLY_BY_4_Q0_TO_Q15
vshl.i16 q0, q0, #2
vshl.i16 q1, q1, #2
vshl.i16 q2, q2, #2
vshl.i16 q3, q3, #2
vshl.i16 q4, q4, #2
vshl.i16 q5, q5, #2
vshl.i16 q6, q6, #2
vshl.i16 q7, q7, #2
vshl.i16 q8, q8, #2
vshl.i16 q9, q9, #2
vshl.i16 q10, q10, #2
vshl.i16 q11, q11, #2
vshl.i16 q12, q12, #2
vshl.i16 q13, q13, #2
vshl.i16 q14, q14, #2
vshl.i16 q15, q15, #2
MEND
; --------------------------------------------------------------------------
; $diff cannot be same as $ip1 or $ip2
MACRO
DO_BUTTERFLY_NO_COEFFS $ip1, $ip2, $sum, $diff
vsub.s16 $diff, $ip1, $ip2
vadd.s16 $sum, $ip1, $ip2
MEND
; --------------------------------------------------------------------------
; Touches q12, q15 and the input registers
; valid output registers are anything but q12, q15, $ip1, $ip2
; temp1 and temp2 are Q registers used as temporary registers
; temp1 cannot be same as output registers, q12, q15
; temp2 cannot be same as input registers, q12, q15
MACRO
DO_BUTTERFLY_SYM_COEFFS $ip1, $ip2, $ip3, $ip4, $constant, $op1, $op2, $op3, $op4, $temp1, $temp2
; generate scalar constants
mov r8, #$constant & 0xFF00
add r8, #$constant & 0x00FF
vdup.16 $op4, r8
vmull.s16 q12, $ip1, $op4
vmull.s16 q15, $ip3, $op4
vadd.s32 $temp2, q12, q15
vsub.s32 q12, q12, q15
vqrshrn.s32 $op1, $temp2, #14
vqrshrn.s32 $op3, q12, #14
vdup.16 $op4, r8
vmull.s16 q12, $ip2, $op4
vmull.s16 q15, $ip4, $op4
vadd.s32 $temp1, q12, q15
vsub.s32 q12, q12, q15
vqrshrn.s32 $op2, $temp1, #14
vqrshrn.s32 $op4, q12, #14
MEND
; --------------------------------------------------------------------------
; Touches q8-q12, q15 (q13-q14 are preserved)
; valid output registers are anything but q8-q11
MACRO
DO_BUTTERFLY_DCT $ip1, $ip2, $ip3, $ip4, $first_constant, $second_constant, $op1, $op2, $op3, $op4
; generate the constants
mov r8, #$first_constant & 0xFF00
mov r12, #$second_constant & 0xFF00
add r8, #$first_constant & 0x00FF
add r12, #$second_constant & 0x00FF
; generate vector constants
vdup.16 d30, r8
vdup.16 d31, r12
; (used) two for inputs (ip3-ip2), one for constants (q15)
; do some multiplications (ordered for maximum latency hiding)
vmull.s16 q8, $ip1, d30
vmull.s16 q10, $ip3, d31
vmull.s16 q9, $ip2, d30
vmull.s16 q11, $ip4, d31
vmull.s16 q12, $ip1, d31
; (used) five for intermediate (q8-q12), one for constants (q15)
; do some addition/subtractions (to get back two register)
vsub.s32 q8, q8, q10
vsub.s32 q9, q9, q11
; do more multiplications (ordered for maximum latency hiding)
vmull.s16 q10, $ip2, d31
vmull.s16 q11, $ip3, d30
vmull.s16 q15, $ip4, d30
; (used) six for intermediate (q8-q12, q15)
; do more addition/subtractions
vadd.s32 q11, q12, q11
vadd.s32 q10, q10, q15
vqrshrn.s32 $op1,q8, #14
vqrshrn.s32 $op2,q9, #14
; (used) four for intermediate (q8-q11)
; dct_const_round_shift
vqrshrn.s32 $op3,q11, #14
vqrshrn.s32 $op4,q10, #14
MEND
; --------------------------------------------------------------------------
; BUTTERFLY for DST
; Touches q12, q14
; valid output registers are anything but q12 ,q14, $ip1, $ip2, $ip3, $ip4
MACRO
DO_BUTTERFLY_DST $ip1, $ip2, $ip3, $ip4, $first_constant, $second_constant, $op1, $op2, $op3, $op4
; generate the constants
mov r8, #$first_constant & 0xFF00
mov r12, #$second_constant & 0xFF00
add r8, #$first_constant & 0x00FF
add r12, #$second_constant & 0x00FF
; generate vector constants
vdup.16 d28, r8
vdup.16 d29, r12
; do some multiplications (ordered for maximum latency hiding)
vmull.s16 $op1, $ip1, d28
vmull.s16 $op3, $ip3, d29
vmull.s16 $op2, $ip2, d28
vmull.s16 $op4, $ip4, d29
vmull.s16 q12, $ip1, d29
vsub.s32 $op1, $op1, $op3
vsub.s32 $op2, $op2, $op4
; do more multiplications (ordered for maximum latency hiding)
vmull.s16 $op3, $ip3, d28
vmull.s16 $op4, $ip2, d29
vmull.s16 q14, $ip4, d28
; do more addition/subtractions
vadd.s32 $op3, $op3, q12
vadd.s32 $op4, $op4, q14
MEND
; --------------------------------------------------------------------------
; BUTTERFLY and ROUND SHIFT for DST
; Touches q12, q14
; valid output registers are anything but q12 ,q14, $ip1 or $ip2
; modifies values of $ip1 and $ip2
MACRO
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT $ip1, $ip2, $ip3, $ip4, $op1, $op2, $op3, $op4
vadd.s32 q12, $ip1, $ip3
vadd.s32 q14, $ip2, $ip4
vsub.s32 $ip1, $ip1, $ip3
vsub.s32 $ip2, $ip2, $ip4
vqrshrn.s32 $op1, q12, #14
vqrshrn.s32 $op2, q14, #14
vqrshrn.s32 $op3, $ip1, #14
vqrshrn.s32 $op4, $ip2, #14
MEND
; --------------------------------------------------------------------------
; Calculate the input for the DCT transform
; Inputs
; q0 - q15 : Rows1 to Row16 (8 cols)
; Outputs
; q0 - q15 : Rows1 to Row16 (8 cols)
MACRO
CALC_INPUT_FOR_DCT $temp_buffer $pass
vst1.64 {q15}, [$temp_buffer]
vadd.s16 q0, q0, q15 ; (in_pass0[0*stride] + in_pass0[15*stride])
vsub.s16 q15, q1, q14 ; (in_pass0[1*stride] - in_pass0[14*stride])
vadd.s16 q1, q1, q14 ; (in_pass0[1*stride] + in_pass0[14*stride])
vsub.s16 q14, q2, q13 ; (in_pass0[2*stride] - in_pass0[13*stride])
vadd.s16 q2, q2, q13 ; (in_pass0[2*stride] + in_pass0[13*stride])
vsub.s16 q13, q3, q12 ; (in_pass0[3*stride] - in_pass0[12*stride])
vadd.s16 q3, q3, q12 ; (in_pass0[3*stride] + in_pass0[12*stride])
vsub.s16 q12, q4, q11 ; (in_pass0[4*stride] - in_pass0[11*stride])
vadd.s16 q4, q4, q11 ; (in_pass0[4*stride] + in_pass0[11*stride])
vsub.s16 q11, q5, q10 ; (in_pass0[5*stride] - in_pass0[10*stride])
vadd.s16 q5, q5, q10 ; (in_pass0[5*stride] + in_pass0[10*stride])
vsub.s16 q10, q6, q9 ; (in_pass0[6*stride] - in_pass0[9*stride])
vadd.s16 q6, q6, q9 ; (in_pass0[6*stride] + in_pass0[9*stride])
vsub.s16 q9, q7, q8 ; (in_pass0[7*stride] - in_pass0[8*stride])
vadd.s16 q7, q7, q8 ; (in_pass0[7*stride] + in_pass0[8*stride])
vld1.64 q8, [$temp_buffer]
vshl.i16 q8, q8, #1
vsub.s16 q8, q0, q8 ; (in_pass0[0*stride] - in_pass0[15*stride])
; multiplying by 4
IF $pass = 0
MULTIPLY_BY_4_Q0_TO_Q15
ENDIF
MEND
; --------------------------------------------------------------------------
; Rounds and shifts value in input registers(for pass=1)
; Inputs
; q0 - q15 : Rows1 to Row16 (8 cols)
; Outputs
; q0 - q15 : Rows1 to Row16 (8 cols)
; touches r8,two vector push and pops
MACRO
ROUND_SHIFT $transform
vpush {q15}
mov r8, #1
vdup.16 q15, r8
; adding 1
vadd.s16 q0, q0, q15
vadd.s16 q1, q1, q15
vadd.s16 q2, q2, q15
vadd.s16 q3, q3, q15
vadd.s16 q4, q4, q15
vadd.s16 q5, q5, q15
vadd.s16 q6, q6, q15
vadd.s16 q7, q7, q15
vadd.s16 q8, q8, q15
vadd.s16 q9, q9, q15
vadd.s16 q10, q10, q15
vadd.s16 q11, q11, q15
vadd.s16 q12, q12, q15
vadd.s16 q13, q13, q15
vadd.s16 q14, q14, q15
; if hybrid tranform ,outptr[j * 16 + i] =
; (temp_out[j] + 1 + (temp_out[j] < 0)) >> 2;
IF $transform = hybrid
vshr.u16 q15, q0, #15 ;taking sign bit and adding
vadd.s16 q0, q0, q15
vshr.u16 q15, q1, #15
vadd.s16 q1, q1, q15
vshr.u16 q15, q2, #15
vadd.s16 q2, q2, q15
vshr.u16 q15, q3, #15
vadd.s16 q3, q3, q15
vshr.u16 q15, q4, #15
vadd.s16 q4, q4, q15
vshr.u16 q15, q5, #15
vadd.s16 q5, q5, q15
vshr.u16 q15, q6, #15
vadd.s16 q6, q6, q15
vshr.u16 q15, q7, #15
vadd.s16 q7, q7, q15
vshr.u16 q15, q8, #15
vadd.s16 q8, q8, q15
vshr.u16 q15, q9, #15
vadd.s16 q9, q9, q15
vshr.u16 q15, q10, #15
vadd.s16 q10, q10, q15
vshr.u16 q15, q11, #15
vadd.s16 q11, q11, q15
vshr.u16 q15, q12, #15
vadd.s16 q12, q12, q15
vshr.u16 q15, q13, #15
vadd.s16 q13, q13, q15
vshr.u16 q15, q14, #15
vadd.s16 q14, q14, q15
ENDIF
vpop {q15}
vpush {q14}
vdup.16 q14, r8
vadd.s16 q15, q14, q15
IF $transform = hybrid
vshr.u16 q14, q15, #15
vadd.s16 q15, q14, q15
ENDIF
vpop {q14}
; divide by 4
vshr.s16 q0, q0, #2
vshr.s16 q1, q1, #2
vshr.s16 q2, q2, #2
vshr.s16 q3, q3, #2
vshr.s16 q4, q4, #2
vshr.s16 q5, q5, #2
vshr.s16 q6, q6, #2
vshr.s16 q7, q7, #2
vshr.s16 q8, q8, #2
vshr.s16 q9, q9, #2
vshr.s16 q10, q10, #2
vshr.s16 q11, q11, #2
vshr.s16 q12, q12, #2
vshr.s16 q13, q13, #2
vshr.s16 q14, q14, #2
vshr.s16 q15, q15, #2
MEND
; --------------------------------------------------------------------------
; Does the following tasks
; - calculates DCT transform for a single pass
; - even rows of outputs are stored in intermediate buffer(r5)
; - odd rows of output are returned in registers q1,q3,q5,q7,q9,q11,q13
; and q15
; - [r7] is used as intermediate buffer
; Inputs
; q0 - q15 : Rows1 to Row16 (8 cols)
; Outputs
; q1,q3,... q15 : all odd from Rows1 to Row15 (8 cols)
; touches all q registers, r8, r12, r3, r4, r11
MACRO
DCT_SINGLE_PASS
mov r11, r7
; store step1[i] values for temporary work registers
; destination buffer is also used as intermediate buffer
vst1.64 {q9}, [r7], r6
vst1.64 {q10}, [r7], r6
vst1.64 {q11}, [r7], r6
vst1.64 {q12}, [r7], r6
vst1.64 {q13}, [r7], r6
vst1.64 {q14}, [r7], r6
vst1.64 {q15}, [r7], r6
vst1.64 {q8}, [r7], r6
; stage 1
DO_BUTTERFLY_NO_COEFFS q0, q7, q0, q14
DO_BUTTERFLY_NO_COEFFS q1, q6, q1, q7
DO_BUTTERFLY_NO_COEFFS q2, q5, q2, q6
DO_BUTTERFLY_NO_COEFFS q3, q4, q3, q5
; fdct4(step, step);
DO_BUTTERFLY_NO_COEFFS q0, q3, q4, q13
DO_BUTTERFLY_NO_COEFFS q1, q2, q0, q3
; t0 = (x0 + x1) * cospi_16_64;
; t1 = (x0 - x1) * cospi_16_64;
; out[0] = fdct_round_shift(t0);
; out[8] = fdct_round_shift(t1);
DO_BUTTERFLY_SYM_COEFFS d8, d9, d0, d1, cospi_16_64, d2, d3, d4, d5, q4, q2
; t2 = x3 * cospi_8_64 + x2 * cospi_24_64;
; t3 = x3 * cospi_24_64 - x2 * cospi_8_64;
; out[4] = fdct_round_shift(t2);
; out[12] = fdct_round_shift(t3);
DO_BUTTERFLY_DCT d26, d27, d6, d7, cospi_24_64, cospi_8_64, d0, d1, d8, d9
; Stage 2
; t0 = (s6 - s5) * cospi_16_64;
; t1 = (s6 + s5) * cospi_16_64;
; t2 = fdct_round_shift(t0);
; t3 = fdct_round_shift(t1);
DO_BUTTERFLY_SYM_COEFFS d14, d15, d12, d13, cospi_16_64, d6, d7, d26, d27, q7, q13
; Stage 3
DO_BUTTERFLY_NO_COEFFS q5, q13, q7, q6
DO_BUTTERFLY_NO_COEFFS q14, q3, q5, q13
; Stage 4
; t0 = x0 * cospi_28_64 + x3 * cospi_4_64;
; t3 = x3 * cospi_28_64 + x0 * -cospi_4_64;
; out[2] = fdct_round_shift(t0);
; out[14] = fdct_round_shift(t3);
DO_BUTTERFLY_DCT d10, d11, d14, d15, cospi_28_64, cospi_4_64, d6, d7, d28, d29
; t1 = x1 * cospi_12_64 + x2 * cospi_20_64;
; t2 = x2 * cospi_12_64 + x1 * -cospi_20_64;
; out[6] = fdct_round_shift(t2);
; out[10] = fdct_round_shift(t1);
DO_BUTTERFLY_DCT d26, d27, d12, d13, cospi_12_64, cospi_20_64, d10, d11, d14, d15
; storing all even values of the output
vst1.64 {q1}, [r5], r6
vst1.64 {q14}, [r5], r6
vst1.64 {q4}, [r5], r6
vst1.64 {q5}, [r5], r6
vst1.64 {q2}, [r5], r6
vst1.64 {q7}, [r5], r6
vst1.64 {q0}, [r5], r6
vst1.64 {q3}, [r5], r6
; Work on the next eight values; step1 -> odd_results
mov r7, r11
vld1.64 {q0}, [r7], r6
vld1.64 {q1}, [r7], r6
vld1.64 {q2}, [r7], r6
vld1.64 {q3}, [r7], r6
vld1.64 {q4}, [r7], r6
vld1.64 {q5}, [r7], r6
vld1.64 {q6}, [r7], r6
vld1.64 {q7}, [r7], r6
; step 2
; temp1 = (step1[5] - step1[2]) * cospi_16_64;
; temp2 = (step1[5] + step1[2]) * cospi_16_64;
; step2[2] = fdct_round_shift(temp1);
; step2[5] = fdct_round_shift(temp2);
DO_BUTTERFLY_SYM_COEFFS d10 d11, d4, d5 ,cospi_16_64, d26, d27, d28, d29, q5, q14
; temp2 = (step1[4] - step1[3]) * cospi_16_64;
; temp1 = (step1[4] + step1[3]) * cospi_16_64;
; step2[3] = fdct_round_shift(temp2);
; step2[4] = fdct_round_shift(temp1);
DO_BUTTERFLY_SYM_COEFFS d8, d9, d6, d7, cospi_16_64, d10, d11, d4, d5, q4, q2
; step 3
DO_BUTTERFLY_NO_COEFFS q0, q2, q0, q3
DO_BUTTERFLY_NO_COEFFS q1, q14, q1, q2
DO_BUTTERFLY_NO_COEFFS q7, q5, q7, q4
DO_BUTTERFLY_NO_COEFFS q6, q13, q6, q5
; step 4
; temp1 = step3[1] * -cospi_8_64 + step3[6] * cospi_24_64;
; temp2 = step3[1] * cospi_24_64 + step3[6] * cospi_8_64
; step2[1] = fdct_round_shift(temp1);
; step2[6] = fdct_round_shift(temp2);
DO_BUTTERFLY_DCT d12, d13, d2, d3, cospi_24_64, cospi_8_64, d26, d27, d28, d29
; temp2 = step3[2] * cospi_24_64 + step3[5] * cospi_8_64;
; temp1 = step3[2] * cospi_8_64 - step3[5] * cospi_24_64;
; step2[2] = fdct_round_shift(temp2);
; step2[5] = fdct_round_shift(temp1);
DO_BUTTERFLY_DCT d4, d5, d10, d11, cospi_8_64, cospi_24_64, d30, d31, d10, d11
; step 5
DO_BUTTERFLY_NO_COEFFS q3, q5, q3, q2
DO_BUTTERFLY_NO_COEFFS q0, q13, q0, q1
vswp.s16 q2, q3
DO_BUTTERFLY_NO_COEFFS q4, q15, q4, q5
DO_BUTTERFLY_NO_COEFFS q7, q14, q14, q6
vswp.s16 q4, q5
; step 6
; temp1 = step1[1] * -cospi_18_64 + step1[6] * cospi_14_64
; out[7] = fdct_round_shift(temp1);
; temp2 = step1[1] * cospi_14_64 + step1[6] * cospi_18_64;
; out[9] = fdct_round_shift(temp2);
DO_BUTTERFLY_DCT d12, d13, d2, d3, cospi_14_64, cospi_18_64, d14, d15, d12, d13
; temp2 = step1[0] * -cospi_2_64 + step1[7] * cospi_30_64;
; out[15] = fdct_round_shift(temp2);
; temp1 = step1[0] * cospi_30_64 + step1[7] * cospi_2_64;
; out[1] = fdct_round_shift(temp1);
DO_BUTTERFLY_DCT d28, d29, d0, d1, cospi_30_64, cospi_2_64, d0, d1, d2, d3
; temp1 = step1[3] * -cospi_26_64 + step1[4] * cospi_6_64;
; out[3] = fdct_round_shift(temp1);
; temp2 = step1[3] * cospi_6_64 + step1[4] * cospi_26_64;
; out[13] = fdct_round_shift(temp2)
DO_BUTTERFLY_DCT d8, d9, d6, d7, cospi_6_64, cospi_26_64, d6, d7, d8, d9
; temp2 = step1[2] * -cospi_10_64 + step1[5] * cospi_22_64;
; out[11] = fdct_round_shift(temp2);
; temp1 = step1[2] * cospi_22_64 + step1[5] * cospi_10_64;
; out[5] = fdct_round_shift(temp1);
DO_BUTTERFLY_DCT d10, d11, d4, d5, cospi_22_64, cospi_10_64, d4, d5, d10, d11
vmov.i16 q9, q6
vmov.i16 q15, q0
vmov.i16 q13, q4
vmov.i16 q11, q2
MEND
; --------------------------------------------------------------------------
; Does the following tasks
; - calculates DST transform for a single pass
; - even rows of outputs are stored in intermediate buffer[r5]
; - odd rows of output are returned in registers q1,q3,q5,q7,q9,q11,q13
; and q15
; - [r7] is used as intermediate buffer
; Inputs
; q0 - q15 : Rows1 to Row16 (8 cols)
; Outputs
; q1,q3,... q15 : all odd from Rows1 to Row15 (8 cols)
; touches all q registers, r8, r12, r3, r4, r11
MACRO
DST_SINGLE_PASS
mov r11, r5
; store rows 13,4,9,6,3,12,1,14 to intermediate buffer
; destination buffer is also used as intermediate buffer
vst1.64 {q11}, [r5], r6
vst1.64 {q4}, [r5], r6
vst1.64 {q9}, [r5], r6
vst1.64 {q6}, [r5], r6
vst1.64 {q3}, [r5], r6
vst1.64 {q12}, [r5], r6
vst1.64 {q1}, [r5], r6
vst1.64 {q14}, [r5], r6
; stage 1 for x0,x1,x2,x3,x8,x9,x10,x11
; s0 = x0 * cospi_1_64 + x1 * cospi_31_64;
; s1 = x0 * cospi_31_64 - x1 * cospi_1_64;
DO_BUTTERFLY_DST d30, d31, d0, d1, cospi_31_64, cospi_1_64, q4, q11, q6, q9
; s8 = x8 * cospi_17_64 + x9 * cospi_15_64;
; s9 = x8 * cospi_15_64 - x9 * cospi_17_64;
DO_BUTTERFLY_DST d14, d15, d16, d17, cospi_15_64, cospi_17_64, q3, q1, q15, q0
; x9 = fdct_round_shift(s1 - s9) ; x1 = fdct_round_shift(s1 + s9);
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT q4, q11, q3, q1, d14, d15, d8, d9
; x8 = fdct_round_shift(s0 - s8), ;x0 = fdct_round_shift(s0 + s8);
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT q6, q9, q15, q0, d16, d17, d12, d13
; s2 = x2 * cospi_5_64 + x3 * cospi_27_64;
; s3 = x2 * cospi_27_64 - x3 * cospi_5_64;
DO_BUTTERFLY_DST d26, d27, d4, d5, cospi_27_64, cospi_5_64, q3, q1, q9, q11
; s10 = x10 * cospi_21_64 + x11 * cospi_11_64;
; s11 = x10 * cospi_11_64 - x11 * cospi_21_64;
DO_BUTTERFLY_DST d10, d11, d20, d21, cospi_11_64, cospi_21_64, q0, q15, q13, q2
; x3 = fdct_round_shift(s3 + s11);,x11 = fdct_round_shift(s3 - s11);
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT q3, q1, q0, q15, d0, d1, d6, d7
; x2 = fdct_round_shift(s2 + s10);, x10 = fdct_round_shift(s2 - s10);
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT q9, q11, q13, q2, d4, d5, d2, d3
; move x0,x1,x2 ,x3,x4,x5,x6,x7 to intermediate buffer
mov r10, r7
vst1.64 {q6}, [r7], r6
vst1.64 {q4}, [r7], r6
vst1.64 {q1}, [r7], r6
vst1.64 {q3}, [r7], r6
vst1.64 {q8}, [r7], r6
vst1.64 {q7}, [r7], r6
vst1.64 {q2}, [r7], r6
vst1.64 {q0}, [r7], r6
; stage 1 for x4,x5,x6,x7,x12,x13,x114,x15
; load rows 13,4,9,6,3,12,1,14 from intermediate buffer
mov r5, r11
vld1.64 {q15}, [r5], r6
vld1.64 {q0}, [r5], r6
vld1.64 {q13}, [r5], r6
vld1.64 {q2}, [r5], r6
vld1.64 {q7}, [r5], r6
vld1.64 {q8}, [r5], r6
vld1.64 {q5}, [r5], r6
vld1.64 {q10}, [r5], r6
; s4 = x4 * cospi_9_64 + x5 * cospi_23_64;
; s5 = x4 * cospi_23_64 - x5 * cospi_9_64;
DO_BUTTERFLY_DST d30, d31, d0, d1, cospi_23_64, cospi_9_64, q4, q11, q6, q9
; s12 = x12 * cospi_25_64 + x13 * cospi_7_64;
; s13 = x12 * cospi_7_64 - x13 * cospi_25_64;
DO_BUTTERFLY_DST d14, d15, d16, d17, cospi_7_64, cospi_25_64, q3, q1, q15, q0
; x4 = fdct_round_shift(s4 + s12); x12 = fdct_round_shift(s4 - s12);
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT q4, q11, q3, q1, d14, d15, d8, d9
; x5 = fdct_round_shift(s5 + s13), x13 = fdct_round_shift(s5 - s13);
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT q6, q9, q15, q0, d16, d17, d12, d13
; s6 = x6 * cospi_13_64 + x7 * cospi_19_64;
; s7 = x6 * cospi_19_64 - x7 * cospi_13_64;
DO_BUTTERFLY_DST d26, d27, d4, d5, cospi_19_64, cospi_13_64, q3, q1, q9, q11
; s14 = x14 * cospi_29_64 + x15 * cospi_3_64;
; s15 = x14 * cospi_3_64 - x15 * cospi_29_64;
DO_BUTTERFLY_DST d10, d11, d20, d21, cospi_3_64, cospi_29_64, q0, q15, q13, q2
; x6 = fdct_round_shift(s6 + s14), x14 = fdct_round_shift(s6 - s14);
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT q3, q1, q0, q15, d0, d1, d6, d7
; x7 = fdct_round_shift(s7 + s15), x15 = fdct_round_shift(s7 - s15);
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT q9, q11, q13, q2, d4, d5, d2, d3
mov r7, r10
; load x8 - x11 after stage 1
vld1.64 {q5}, [r7], r6
vld1.64 {q9}, [r7], r6
vld1.64 {q10}, [r7], r6
vld1.64 {q11}, [r7], r6
; store x4 - x7 after stage 1
mov r7, r10
vst1.64 {q8}, [r7], r6
vst1.64 {q7}, [r7], r6
vst1.64 {q2}, [r7], r6
vst1.64 {q0}, [r7], r6
; stage 2 for x8,x9,x10,x11, x12,x13,x14,x15
; s8 = x8 * cospi_4_64 + x9 * cospi_28_64;
; s9 = x8 * cospi_28_64 - x9 * cospi_4_64;
DO_BUTTERFLY_DST d10, d11, d18, d19, cospi_28_64, cospi_4_64, q2, q0, q7, q8
; s12 = - x12 * cospi_28_64 + x13 * cospi_4_64;
; s13 = x12 * cospi_4_64 + x13 * cospi_28_64;
DO_BUTTERFLY_DST d8, d9, d12, d13, cospi_4_64, cospi_28_64, q5, q9, q13, q15
; x8 = fdct_round_shift(s8 + s12); x12 = fdct_round_shift(s8 - s12);
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT q7, q8, q5, q9, d10, d11, d14, d15
; x9 = fdct_round_shift(s9 + s13);, x13 = fdct_round_shift(s9 - s13);
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT q2, q0, q13, q15, d30, d31, d4, d5
; s10 = x10 * cospi_20_64 + x11 * cospi_12_64;
; s11 = x10 * cospi_12_64 - x11 * cospi_20_64;
DO_BUTTERFLY_DST d20, d21, d22, d23, cospi_12_64, cospi_20_64, q9, q6, q4, q0
; s14 = - x14 * cospi_12_64 + x15 * cospi_20_64;
; s15 = x14 * cospi_20_64 + x15 * cospi_12_64;
DO_BUTTERFLY_DST d6, d7, d2, d3, cospi_20_64, cospi_12_64, q8, q13, q10, q11
; x10 = fdct_round_shift(s10 + s14); x14 = fdct_round_shift(s10 - s14);
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT q4, q0, q8, q13, d16, d17, d8, d9
; x11 = fdct_round_shift(s11 + s15); x15 = fdct_round_shift(s11 - s15);
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT q9, q6, q10, q11, d20, d21, d18, d19
; stage 3 for x8,x9,x10,x11, x12,x13,x14,x15
;s12 = x12 * cospi_8_64 + x13 * cospi_24_64;
;s13 = x12 * cospi_24_64 - x13 * cospi_8_64;
DO_BUTTERFLY_DST d14, d15, d4, d5, cospi_24_64, cospi_8_64, q0, q1, q3, q6
; s14 = - x14 * cospi_24_64 + x15 * cospi_8_64;
; s15 = x14 * cospi_8_64 + x15 * cospi_24_64
DO_BUTTERFLY_DST d18, d19, d8, d9, cospi_8_64, cospi_24_64, q11, q13, q7, q2
; x12 = fdct_round_shift(s12 + s14); x14 = fdct_round_shift(s12 - s14);
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT q3, q6, q11, q13, d22, d23, d26, d27
; x13 = fdct_round_shift(s13 + s15), x15 = fdct_round_shift(s13 - s15);
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT q0, q1, q7, q2, d14, d15, d4, d5
; x8 = s8 + s10;
; x9 = s9 + s11;
; x10 = s8 - s10;
; x11 = s9 - s11;
DO_BUTTERFLY_NO_COEFFS q5, q8, q5, q0
DO_BUTTERFLY_NO_COEFFS q15, q10, q1, q8
; stage 4 for x8,x9,x10,x11, x12,x13,x14,x15
mov r5, r11
add r5, r5, r6
vswp.s16 q5, q0
; output[2] = x12 , store output[2] to intermediate buffer
vst1.64 {q11}, [r5], r6
; s10 = cospi_16_64 * (x10 + x11);
; s11 = cospi_16_64 * (- x10 + x11);
; x10 = fdct_round_shift(s10);
; x11 = fdct_round_shift(s11);
DO_BUTTERFLY_SYM_COEFFS d16, d17, d10, d11, cospi_16_64, d28, d29, d22, d23, q8, q11
add r5, r5, r6
; output[6] = x10 , store output[2] to intermediate buffer
vst1.64 {q14}, [r5], r6
; s14 = (- cospi_16_64) * (x14 + x15);
; s15 = cospi_16_64 * (x14 - x15);
; x14 = fdct_round_shift(s14);
; x15 = fdct_round_shift(s15);
DO_BUTTERFLY_SYM_COEFFS d4, d5, d26, d27, -cospi_16_64, d18, d19, d16, d17, q2, q8
add r5, r5, r6
; output[10] = x15 , store output[10] to intermediate buffer
vst1.64 {q8}, [r5], r6
add r5, r5, r6
; output[14] = x9 , store output[14] to intermediate buffer
vst1.64 {q1}, [r5], r6
vneg.s16 q0, q0
vneg.s16 q7, q7
; storing odd rows of ouputs in stack
vpush {q7}
vpush {q11}
vpush {q9}
vpush {q0}
; load x0 - x7 after stage 1
mov r7, r10
vld1.64 {q0}, [r7], r6
vld1.64 {q1}, [r7], r6
vld1.64 {q3}, [r7], r6
vld1.64 {q6}, [r7], r6
vld1.64 {q11}, [r7], r6
vld1.64 {q12}, [r7], r6
vld1.64 {q13}, [r7], r6
vld1.64 {q14}, [r7], r6
; stage 2 for x0 -x7
DO_BUTTERFLY_NO_COEFFS q11, q0, q5, q7
DO_BUTTERFLY_NO_COEFFS q12, q1, q15, q2
DO_BUTTERFLY_NO_COEFFS q13, q3, q8, q4
DO_BUTTERFLY_NO_COEFFS q14, q6, q10, q9
; stage 3 for x0 - x7
; s4 = x4 * cospi_8_64 + x5 * cospi_24_64;
; s5 = x4 * cospi_24_64 - x5 * cospi_8_64;
DO_BUTTERFLY_DST d14, d15, d4, d5, cospi_24_64, cospi_8_64, q0, q1, q3, q6
; s6 = - x6 * cospi_24_64 + x7 * cospi_8_64;
; s7 = x6 * cospi_8_64 + x7 * cospi_24_64;
DO_BUTTERFLY_DST d18, d19, d8, d9, cospi_8_64, cospi_24_64, q11, q13, q7, q2
; x4 = fdct_round_shift(s4 + s6),x6 = fdct_round_shift(s4 - s6);
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT q3, q6, q11, q13, d22, d23, d26, d27
; x5 = fdct_round_shift(s5 + s7) x7 = fdct_round_shift(s5 - s7);
DO_BUTTERFLY_WITHOUT_COEFFS_AND_ROUNDSHIFT q0, q1, q7, q2, d14, d15, d4, d5
; x0 = s0 + s2;
; x1 = s1 + s3;
; x2 = s0 - s2;
; x3 = s1 - s3;
DO_BUTTERFLY_NO_COEFFS q5, q8, q5, q0
DO_BUTTERFLY_NO_COEFFS q15, q10, q1, q8
vswp.s16 q5, q0
; stage 4 for x0 -x7
mov r5, r11
; output[0] = x0 , store output[0] to intermediate buffer
vst1.64 {q0}, [r5], r6
vneg.s16 q3, q11 ; output[3] = - x4;
; s6 = cospi_16_64 * (x6 + x7);
; s7 = cospi_16_64 * (- x6 + x7);
; x6 = fdct_round_shift(s6);
; x7 = fdct_round_shift(s7);
DO_BUTTERFLY_SYM_COEFFS d4, d5, d26, d27 ,cospi_16_64, d28, d29, d22, d23, q2, q11
add r5, r5, r6
; output[4] = x6 , store output[4] to intermediate buffer
vst1.64 {q14}, [r5], r6
; s2 = (- cospi_16_64) * (x2 + x3);
; s3 = cospi_16_64 * (x2 - x3);
; x2 = fdct_round_shift(s2);
; x3 = fdct_round_shift(s3)
DO_BUTTERFLY_SYM_COEFFS d16, d17, d10, d11, -cospi_16_64, d0, d1, d28, d29, q8, q14
add r5, r5, r6
; output[8] = x3 , store output[8] to intermediate buffer
vst1.64 {q14}, [r5], r6
add r5, r5, r6
; output[12] = x5 , store output[12] to intermediate buffer
vst1.64 {q7}, [r5], r6
vmov.s16 q7, q0
vneg.s16 q15, q1
vpop {q1}
vpop {q5}
vpop {q9}
vpop {q13}
MEND
;---------------------------------------------------------------------------
; BLOCK A = rows 1 to 8 cols 1 to 8
; BLOCK B = rows 9 to 16 cols 1 to 8
; BLOCK C = rows 1 to 8 cols 9 to 16
; BLOCK D = rows 9 to 16 cols 9 to 16
; DCT_SINGLE_PASS/DST_SINGLE_PASS process 16 rows and 8 columns in a pass
; Output buffer is also used as intermediate buffer
; Code flow:
; - Call DCT_SINGLE_PASS/DST_SINGLE_PASS for BLOCK A and B
; - Call DCT_SINGLE_PASS/DST_SINGLE_PASS for BLOCK C and D
; - Transpose the intermediate outputs of BLOCK B and D
; - Call DCT_SINGLE_PASS/DST_SINGLE_PASS for BLOCK B and D
; - Transpose the result and store the final output for BLOCK B and D
; - Transpose the intermediate outputs of BLOCK A and C
; - Call DCT_SINGLE_PASS/DST_SINGLE_PASS for BLOCK A and C
; - Transpose the result and store the final output for BLOCK A and C
|vp9_fht16x16_neon| PROC
cmp r3, #0 ; if type = DCT_DCT branch to
; vp9_fdct16x16_neon
beq vp9_fdct16x16_neon
push {r4-r12, lr} ; push registers to stack
vpush {d8-d15}
mov r9, r3
lsl r2, r2, #1 ; r2 = stride * 2
push {r2}
mov r5, r0
; load 16 rows and 8 columns(1-8)(BLOCK A and B)
LOAD_INPUT r5, r2
mov r2, #32
lsl r6, r2, #1 ; r3 = stride * 4
mov r5, r1
; if stage 1 = DST
ands r3, r9, #1
beq dct1
; DST STAGE 1
; calculate input for pass = 0
MULTIPLY_BY_4_Q0_TO_Q15
mov r5, r1
add r7, r5, r2
bl dst_single_pass ; BLOCK A and B
b end_stage_1_col_1_8
dct1
; calculate input for pass = 0
CALC_INPUT_FOR_DCT r5, 0
mov r5, r1
add r7, r5, r2
bl dct_single_pass
end_stage_1_col_1_8
mov r5, r1
add r7, r5, r2
; store the odd rows to intermediate buffer (BLOCK A and B)
vst1.64 {q1}, [r7], r6
vst1.64 {q3}, [r7], r6
vst1.64 {q5}, [r7], r6
vst1.64 {q7}, [r7], r6
vst1.64 {q9}, [r7], r6
vst1.64 {q11}, [r7], r6
vst1.64 {q13}, [r7], r6
vst1.64 {q15}, [r7], r6
add r5, r0, #16
; load 16 rows and 8 columns(9 - 16)(BLOCK C and D)
pop {r2}
LOAD_INPUT r5, r2
add r5, r1, #16
mov r2, #32
ands r3, r9, #1
beq dct2
MULTIPLY_BY_4_Q0_TO_Q15
add r5, r1, #16
add r7, r5, r2
bl dst_single_pass ; BLOCK C and D
b end_stage_1_col_9_16
dct2
CALC_INPUT_FOR_DCT r5, 0
add r5, r1, #16
add r7, r5, r2
bl dct_single_pass
end_stage_1_col_9_16
add r5, r1, #16
add r7, r5, r2
; store the top four odd rows (of BLOCK C)
vst1.64 {q1}, [r7], r6
vst1.64 {q3}, [r7], r6
vst1.64 {q5}, [r7], r6
vst1.64 {q7}, [r7], r6
add r5, r1, #16
add r5, r5, r6, lsl #2
; load even rows(8 -12) cols (9 -16) of BLOCK D
vld1.64 q8, [r5], r6
vld1.64 q10, [r5], r6
vld1.64 q12, [r5], r6
vld1.64 q14, [r5], r6
; now registers q8 - q15 have intermediate values after first pass
; of rows(9 - 16) and cols (9 - 16)
TRANSPOSE8X8_Q8_TO_Q15 ; BLOCK D
add r5, r1, r6, lsl #2
; load intermediate values of rows(9 - 6) and cols (1- 8) (BLOCK B)
vld1.64 q0, [r5], r2
vld1.64 q1, [r5], r2
vld1.64 q2, [r5], r2
vld1.64 q3, [r5], r2
vld1.64 q4, [r5], r2
vld1.64 q5, [r5], r2
vld1.64 q6, [r5], r2
vld1.64 q7, [r5], r2
TRANSPOSE8X8_Q0_TO_Q7 ; BLOCK B
ands r3, r9, #2
; if stage 2 = DST
; round and divide by 4 before second pass
ROUND_SHIFT hybrid
beq dct3
; DST STAGE 2
add r5, r1, r6, lsl #2
add r7, r5, #16
mov r6, r2
; DCT second pass ; BLOCK B and D
bl dst_single_pass
b end_stage_2_col_9_16
; DCT_STAGE2
; round and divide by 4 before second pass
dct3;
add r5, r1, r6, lsl #2
CALC_INPUT_FOR_DCT r5, 1
add r5, r1, r6, lsl #2
add r7, r5, #16
mov r6, r2
bl dct_single_pass
end_stage_2_col_9_16
lsl r6, r2, #1 ; r3 = stride * 4
add r5, r1, r6, lsl #2
; load the even rows from intermediate buffer
vld1.64 q0, [r5], r2 ; BLOCK B and D
vld1.64 q2, [r5], r2
vld1.64 q4, [r5], r2
vld1.64 q6, [r5], r2
vld1.64 q8, [r5], r2
vld1.64 q10, [r5], r2
vld1.64 q12, [r5], r2
vld1.64 q14, [r5], r2
TRANSPOSE8X8_Q0_TO_Q7 ; BLOCK B and D
TRANSPOSE8X8_Q8_TO_Q15
mov r5, r1
add r5, r1, r6, lsl #2
add r10, r5, #16
; store the result to output
; rows(8 - 16) and cols (1 - 16) ; BLOCK B and D
vst1.64 {q0}, [r5], r2
vst1.64 {q1}, [r5], r2
vst1.64 {q2}, [r5], r2
vst1.64 {q3}, [r5], r2
vst1.64 {q4}, [r5], r2
vst1.64 {q5}, [r5], r2
vst1.64 {q6}, [r5], r2
vst1.64 {q7}, [r5], r2
vst1.64 {q8}, [r10], r2
vst1.64 {q9}, [r10], r2
vst1.64 {q10}, [r10], r2
vst1.64 {q11}, [r10], r2
vst1.64 {q12}, [r10], r2
vst1.64 {q13}, [r10], r2
vst1.64 {q14}, [r10], r2
vst1.64 {q15}, [r10], r2
add r5, r1, #16
; load intermediate values of rows(1 - 8) and cols (9 - 18)
vld1.64 q8, [r5], r2 ; BLOCK C
vld1.64 q9, [r5], r2
vld1.64 q10, [r5], r2
vld1.64 q11, [r5], r2
vld1.64 q12, [r5], r2
vld1.64 q13, [r5], r2
vld1.64 q14, [r5], r2
vld1.64 q15, [r5], r2
mov r5, r1
; load intermediate values of rows(1 - 8) and cols (1 - 8)
vld1.64 q0, [r5], r2 ; BLOCK A
vld1.64 q1, [r5], r2
vld1.64 q2, [r5], r2
vld1.64 q3, [r5], r2
vld1.64 q4, [r5], r2
vld1.64 q5, [r5], r2
vld1.64 q6, [r5], r2
vld1.64 q7, [r5], r2
TRANSPOSE8X8_Q0_TO_Q7 ; BLOCK A
TRANSPOSE8X8_Q8_TO_Q15 ; BLOCK C
ands r3, r9, #2
ROUND_SHIFT hybrid
beq dct4
; second pass for rows(1 - 16) and cols (1 - 8)
mov r5, r1
add r7, r1, #16
add r5, r1, #0
mov r6, r2
bl dst_single_pass
b end_stage_2_col_1_8
; second pass for rows(1 - 16) and cols (1 - 8)
dct4
mov r5, r1
CALC_INPUT_FOR_DCT r5, 1
add r7, r1, #16
add r5, r1, #0
mov r6, r2
bl dct_single_pass
end_stage_2_col_1_8
lsl r6, r2, #1 ; r3 = stride * 4
mov r5, r1
; load the even rows from intermediate buffer
vld1.64 q0, [r5], r2
vld1.64 q2, [r5], r2
vld1.64 q4, [r5], r2
vld1.64 q6, [r5], r2
vld1.64 q8, [r5], r2
vld1.64 q10, [r5], r2
vld1.64 q12, [r5], r2
vld1.64 q14, [r5], r2
TRANSPOSE8X8_Q0_TO_Q7 ; BLOCK A
TRANSPOSE8X8_Q8_TO_Q15 ; BLOCK C
; store the result to output
; rows(1 - 8) and cols (1 - 16)
mov r5, r1
add r10, r5, #16
vst1.64 {q0}, [r5], r2
vst1.64 {q1}, [r5], r2
vst1.64 {q2}, [r5], r2
vst1.64 {q3}, [r5], r2
vst1.64 {q4}, [r5], r2
vst1.64 {q5}, [r5], r2
vst1.64 {q6}, [r5], r2
vst1.64 {q7}, [r5], r2
vst1.64 {q8}, [r10], r2
vst1.64 {q9}, [r10], r2
vst1.64 {q10}, [r10], r2
vst1.64 {q11}, [r10], r2
vst1.64 {q12}, [r10], r2
vst1.64 {q13}, [r10], r2
vst1.64 {q14}, [r10], r2
vst1.64 {q15}, [r10], r2
vpop {d8-d15}
pop {r4-r12, pc}
ENDP
|vp9_fdct16x16_neon| PROC
push {r4-r12, lr} ; push registers to stack
vpush {d8-d15}
mov r14, r2
lsl r2, r2, #1
push {r2}
mov r5, r0
; load 16 rows and 8 columns(1-8)
LOAD_INPUT r5, r2
mov r2, #32
lsl r6, r2, #1 ; r3 = stride * 4
mov r5, r1
; calculate input for pass = 0
CALC_INPUT_FOR_DCT r5, 0
mov r5, r1
add r7, r5, r2
; DCT SINGLE PASS
bl dct_single_pass
mov r5, r1
add r7, r5, r2
; Store the odd rows to intermediate buffer
vst1.64 {q1}, [r7], r6
vst1.64 {q3}, [r7], r6
vst1.64 {q5}, [r7], r6
vst1.64 {q7}, [r7], r6
vst1.64 {q9}, [r7], r6
vst1.64 {q11}, [r7], r6
vst1.64 {q13}, [r7], r6
vst1.64 {q15}, [r7], r6
add r5, r0, #16
; load 16 rows and 8 columns(9 - 16)
pop {r2}
LOAD_INPUT r5, r2
mov r2, #32
add r5, r1, #16
CALC_INPUT_FOR_DCT r5, 0
add r5, r1, #16
add r7, r5, r2
; DCT SINGLE PASS
bl dct_single_pass
add r5, r1, #16
add r7, r5, r2
; store the top four odd rows
vst1.64 {q1}, [r7], r6
vst1.64 {q3}, [r7], r6
vst1.64 {q5}, [r7], r6
vst1.64 {q7}, [r7], r6
add r5, r1, #16
add r5, r5, r6, lsl #2
; load even rows(8 -12) cols (9 -16)
vld1.64 q8, [r5], r6
vld1.64 q10, [r5], r6
vld1.64 q12, [r5], r6
vld1.64 q14, [r5], r6
; now registers q8 - q15 have intermediate values after first pass
; of rows(9 - 16) and cols (9 - 16)
TRANSPOSE8X8_Q8_TO_Q15
add r5, r1, r6, lsl #2
; load intermediate values of rows(1 - 8) and cols (9 - 16)
vld1.64 q0, [r5], r2
vld1.64 q1, [r5], r2
vld1.64 q2, [r5], r2
vld1.64 q3, [r5], r2
vld1.64 q4, [r5], r2
vld1.64 q5, [r5], r2
vld1.64 q6, [r5], r2
vld1.64 q7, [r5], r2
TRANSPOSE8X8_Q0_TO_Q7
; roundinf before second pass
ROUND_SHIFT dct
add r5, r1, r6, lsl #2
CALC_INPUT_FOR_DCT r5, 1
add r5, r1, r6, lsl #2
add r7, r5, #16
mov r6, r2
; DCT second pass
bl dct_single_pass
lsl r6, r2, #1 ; r3 = stride * 4
add r5, r1, r6, lsl #2
; load the even rows from intermediate buffer
vld1.64 q0, [r5], r2
vld1.64 q2, [r5], r2
vld1.64 q4, [r5], r2
vld1.64 q6, [r5], r2
vld1.64 q8, [r5], r2
vld1.64 q10, [r5], r2
vld1.64 q12, [r5], r2
vld1.64 q14, [r5], r2
TRANSPOSE8X8_Q0_TO_Q7
TRANSPOSE8X8_Q8_TO_Q15
mov r5, r1
add r5, r1, r6, lsl #2
add r10, r5, #16
; store the result to output
;rows(8 - 16) and cols (1 - 16)
vst1.64 {q0}, [r5], r2
vst1.64 {q1}, [r5], r2
vst1.64 {q2}, [r5], r2
vst1.64 {q3}, [r5], r2
vst1.64 {q4}, [r5], r2
vst1.64 {q5}, [r5], r2
vst1.64 {q6}, [r5], r2
vst1.64 {q7}, [r5], r2
vst1.64 {q8}, [r10], r2
vst1.64 {q9}, [r10], r2
vst1.64 {q10}, [r10], r2
vst1.64 {q11}, [r10], r2
vst1.64 {q12}, [r10], r2
vst1.64 {q13}, [r10], r2
vst1.64 {q14}, [r10], r2
vst1.64 {q15}, [r10], r2
add r5, r1, #16
; load intermediate values of rows(9 - 16) and cols (1 - 8)
vld1.64 q8, [r5], r2
vld1.64 q9, [r5], r2
vld1.64 q10, [r5], r2
vld1.64 q11, [r5], r2
vld1.64 q12, [r5], r2
vld1.64 q13, [r5], r2
vld1.64 q14, [r5], r2
vld1.64 q15, [r5], r2
mov r5, r1
; load intermediate values of rows(1 - 8) and cols (1 - 8)
vld1.64 q0, [r5], r2
vld1.64 q1, [r5], r2
vld1.64 q2, [r5], r2
vld1.64 q3, [r5], r2
vld1.64 q4, [r5], r2
vld1.64 q5, [r5], r2
vld1.64 q6, [r5], r2
vld1.64 q7, [r5], r2
TRANSPOSE8X8_Q0_TO_Q7
TRANSPOSE8X8_Q8_TO_Q15
; second pass for rows(1 - 16) and cols (1 - 8)
ROUND_SHIFT dct
mov r5, r1
CALC_INPUT_FOR_DCT r5, 1
add r7, r1, #16
add r5, r1, #0
mov r6, r2
; DCT second pass
bl dct_single_pass
lsl r6, r2, #1 ; r3 = stride * 4
mov r5, r1
; load the even rows from intermediate buffer
vld1.64 q0, [r5], r2
vld1.64 q2, [r5], r2
vld1.64 q4, [r5], r2
vld1.64 q6, [r5], r2
vld1.64 q8, [r5], r2
vld1.64 q10, [r5], r2
vld1.64 q12, [r5], r2
vld1.64 q14, [r5], r2
TRANSPOSE8X8_Q0_TO_Q7
TRANSPOSE8X8_Q8_TO_Q15
; store the result to output
; rows(1 - 8) and cols (1 - 16)
mov r5, r1
add r10, r5, #16
vst1.64 {q0}, [r5], r2
vst1.64 {q1}, [r5], r2
vst1.64 {q2}, [r5], r2
vst1.64 {q3}, [r5], r2
vst1.64 {q4}, [r5], r2
vst1.64 {q5}, [r5], r2
vst1.64 {q6}, [r5], r2
vst1.64 {q7}, [r5], r2
vst1.64 {q8}, [r10], r2
vst1.64 {q9}, [r10], r2
vst1.64 {q10}, [r10], r2
vst1.64 {q11}, [r10], r2
vst1.64 {q12}, [r10], r2
vst1.64 {q13}, [r10], r2
vst1.64 {q14}, [r10], r2
vst1.64 {q15}, [r10], r2
vpop {d8-d15}
pop {r4-r12, pc}
ENDP
; --------------------------------------------------------------------------
; Labeling DCT_SINGLE_PASS and DST_SINGLE_PASS.
; Eventhough DCT_SINGLE_PASS and DST_SINGLE_PASS are coded as macros
; they are not called as macros from the main function to reduce code size
; for better instruction cache performance. Instead we define them under a
; label here and the main function calls this label using Branch and link.
dct_single_pass
DCT_SINGLE_PASS
mov pc, lr
dst_single_pass
DST_SINGLE_PASS
mov pc, lr
END
|
commands/system/toggle-desktop-icons.applescript | daviddzhou/script-commands | 1 | 2085 | #!/usr/bin/osascript
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Toggle Desktop Icons
# @raycast.mode silent
# @raycast.packageName System
# Optional parameters:
# @raycast.icon 🖥
# @raycast.author Raycast
# @raycast.authorURL https://raycast.com
# @raycast.description A script command to show and hide icons of Desktop folder
try
set CurSet to do shell script "defaults read com.apple.finder CreateDesktop"
on error
set CurSet to "1"
end try
if CurSet is "1" then
set NewSet to false
else
set NewSet to true
end if
do shell script "defaults write com.apple.finder CreateDesktop -bool " & NewSet
tell application "Finder" to quit
set inTime to current date
repeat
-- check Finder process not exist
tell application "System Events"
if "Finder" is not in (get name of processes) then exit repeat
end tell
-- if repeat run for 10s, exit repeat
if (current date) - inTime is greater than 10 then exit repeat
delay 0.2
end repeat
tell application "Finder"
try
activate
end try
end tell |
Transynther/x86/_processed/AVXALIGN/_ht_zr_/i9-9900K_12_0xca_notsx.log_21829_1273.asm | ljhsiun2/medusa | 9 | 96416 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x1b8ab, %r9
add $9149, %r8
movb $0x61, (%r9)
nop
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_UC_ht+0x16dc1, %r10
nop
nop
nop
xor $32880, %r14
mov $0x6162636465666768, %r8
movq %r8, (%r10)
xor %rbx, %rbx
lea addresses_WT_ht+0x1aeab, %r9
nop
nop
nop
nop
and %rsi, %rsi
mov $0x6162636465666768, %r14
movq %r14, (%r9)
nop
sub %rsi, %rsi
lea addresses_WC_ht+0x3e03, %rsi
lea addresses_A_ht+0x26ab, %rdi
nop
nop
nop
nop
nop
and %r9, %r9
mov $79, %rcx
rep movsq
nop
nop
and $55630, %r10
lea addresses_A_ht+0x1003c, %rsi
add $57088, %rbx
movl $0x61626364, (%rsi)
add $9081, %rcx
lea addresses_UC_ht+0x13eab, %r14
nop
sub %rdi, %rdi
movl $0x61626364, (%r14)
nop
inc %rbx
lea addresses_A_ht+0x1ddb, %rsi
nop
nop
nop
nop
sub $3083, %r10
movb $0x61, (%rsi)
nop
nop
nop
nop
and $18691, %r14
lea addresses_D_ht+0x15713, %rsi
lea addresses_A_ht+0xa52b, %rdi
clflush (%rsi)
nop
nop
nop
nop
sub $4721, %r8
mov $70, %rcx
rep movsw
inc %rsi
lea addresses_D_ht+0x12fd1, %r8
nop
nop
nop
nop
nop
xor $2707, %r10
movw $0x6162, (%r8)
add %r8, %r8
lea addresses_UC_ht+0x7cb, %rcx
nop
nop
sub %rsi, %rsi
mov $0x6162636465666768, %r9
movq %r9, (%rcx)
nop
nop
nop
nop
add $7288, %rsi
lea addresses_WC_ht+0xfad, %r9
add $54301, %r14
movb $0x61, (%r9)
nop
cmp %r9, %r9
lea addresses_D_ht+0x5eb3, %r9
nop
nop
nop
nop
dec %r10
mov (%r9), %ebx
nop
nop
cmp %r9, %r9
lea addresses_UC_ht+0x584b, %rcx
nop
nop
nop
nop
nop
inc %r8
movups (%rcx), %xmm4
vpextrq $1, %xmm4, %r9
nop
nop
nop
nop
sub $30562, %rcx
lea addresses_WT_ht+0x1a283, %rcx
nop
nop
nop
nop
inc %r9
movw $0x6162, (%rcx)
nop
nop
nop
nop
sub %r9, %r9
lea addresses_D_ht+0x73ab, %rsi
lea addresses_normal_ht+0xed64, %rdi
cmp %rbx, %rbx
mov $6, %rcx
rep movsw
nop
nop
sub %r14, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %r15
push %r9
// Faulty Load
mov $0xeab, %r9
xor $56741, %r14
vmovntdqa (%r9), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %r12
lea oracles, %r9
and $0xff, %r12
shlq $12, %r12
mov (%r9,%r12,1), %r12
pop %r9
pop %r15
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_P', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_P', 'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 4}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}, 'dst': {'same': True, 'congruent': 5, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}}
{'46': 2213, '00': 5707, '48': 13909}
48 46 48 48 48 00 48 48 00 48 00 48 48 00 48 48 48 48 48 00 48 48 00 48 48 46 48 00 48 48 48 48 48 00 46 48 48 48 00 48 48 00 00 48 00 48 00 48 48 00 48 48 00 48 48 48 46 48 00 48 48 00 48 46 48 48 00 48 00 48 48 00 46 48 46 48 00 00 00 00 46 48 48 48 48 00 48 00 48 00 48 48 48 48 48 00 48 48 48 48 48 48 48 46 00 00 46 48 48 48 48 48 00 48 48 00 48 00 48 48 46 00 48 00 00 48 00 48 48 46 48 48 00 48 48 00 48 48 00 48 48 00 48 48 48 00 48 00 48 48 48 48 48 48 48 48 00 48 48 48 48 48 00 48 48 00 46 48 48 00 48 00 48 46 48 48 00 48 48 48 48 48 00 48 48 00 48 48 00 46 48 48 00 48 48 46 48 48 46 48 46 00 46 48 48 48 00 48 48 00 48 48 48 00 48 00 00 48 00 00 00 00 46 48 48 48 48 00 48 48 48 48 00 48 00 48 00 48 48 46 48 48 46 48 48 00 48 48 46 48 48 48 48 48 48 48 00 48 00 46 48 48 00 00 46 48 48 48 00 48 00 48 48 48 48 46 00 48 00 48 48 00 46 48 48 48 00 48 48 00 48 48 48 00 48 00 48 48 48 00 48 00 48 48 48 00 48 00 00 48 46 48 48 00 48 48 46 48 48 46 48 48 00 48 48 48 00 48 00 48 00 48 48 48 48 48 48 48 48 00 48 48 48 48 48 48 00 48 46 48 48 00 48 48 46 48 48 48 48 48 48 48 00 48 48 00 48 48 46 48 00 48 48 48 48 00 48 48 48 48 46 48 46 48 48 00 48 48 46 48 48 00 46 48 48 48 46 00 48 00 48 48 48 00 48 00 48 48 48 00 48 48 48 00 48 48 46 48 48 46 48 48 00 48 48 46 00 00 46 46 00 46 48 48 48 46 00 00 48 00 00 48 00 48 48 00 48 48 00 48 48 46 48 48 48 48 48 46 48 00 48 48 00 48 48 46 48 00 48 48 00 48 48 00 48 48 00 48 48 48 48 48 48 00 48 48 48 00 00 48 00 48 48 00 48 48 00 00 48 48 46 00 48 00 48 48 48 48 46 00 48 00 48 48 48 48 48 48 00 48 46 48 48 48 00 48 48 48 48 00 48 48 48 48 48 00 48 48 48 00 48 48 48 46 48 00 48 48 00 48 48 46 48 48 46 48 00 00 48 00 00 48 00 00 48 00 00 46 00 46 46 48 48 00 48 48 46 00 00 46 48 48 48 48 46 00 48 00 48 00 00 00 46 48 46 48 48 48 48 48 48 48 48 00 48 48 46 48 48 48 48 00 46 48 00 48 00 48 48 48 00 48 48 48 00 48 00 48 00 00 00 46 46 48 48 48 00 48 48 48 00 48 48 48 48 48 00 48 48 48 48 48 48 00 48 00 48 48 00 48 00 00 00 48 00 00 48 00 00 46 48 48 00 48 48 48 00 48 48 48 48 48 46 48 48 00 48 48 48 48 46 46 00 46 48 00 48 00 48 00 48 48 46 00 48 00 48 48 48 48 48 48 48 48 48 48 00 48 48 00 00 46 48 00 00 46 46 48 48 48 00 48 00 48 00 48 00 48 48 48 48 48 00 48 48 00 48 48 00 48 48 48 48 48 00 46 48 00 48 00 48 48 46 48 48 46 48 48 00 48 48 46 48 48 46 48 48 48 48 48 48 48 48 00 48 00 48 00 00 00 46 00 48 00 48 48 48 00 48 48 48 00 48 48 48 48 00 48 48 48 00 48 48 48 46 00 46 48 48 48 48 48 48 00 48 48 48 00 48 46 48 48 48 46 48 48 48 48 48 00 48 48 48 48 00 48 46 48 48 48 00 48 48 48 48 00 48 00 48 48 00 48 48 00 48 48 00 48 00 00 48 48 00 48 48 46 48 48 48 00 48 48 48 48 46 48 48 00 48 00 48 46 48 48 48 48 48 48 00 48 48 48 00 48 48 00 48 48 48 48 00 48 46 48 48 48 48 48 48 48 48 48 46 48 48 48 48 48 48 48 00 48 48 48 48 00 48 48 46 48 00 00 48 00 48 48 48 00 48 00 48 00 48 46 48 48 48 46 48 00 48 00 48 48 00 48 48 46 48 48 00 48 48 48 00 00 46 48 48 48 48 48 48 48 48 00 48 48 48 48 48 00 48 48 48 00 48 48 46 48
*/
|
programs/oeis/047/A047444.asm | neoneye/loda | 22 | 12821 | ; A047444: Numbers that are congruent to {0, 3, 5, 6} mod 8.
; 0,3,5,6,8,11,13,14,16,19,21,22,24,27,29,30,32,35,37,38,40,43,45,46,48,51,53,54,56,59,61,62,64,67,69,70,72,75,77,78,80,83,85,86,88,91,93,94,96,99,101,102,104,107,109,110,112,115,117,118,120,123,125
mov $1,$0
mul $0,4
add $1,21
mod $1,4
add $0,$1
div $0,2
|
oeis/168/A168088.asm | neoneye/loda-programs | 11 | 241202 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A168088: a(n) = 2^tetranacci(n).
; Submitted by <NAME>
; 1,1,1,2,2,4,16,256,32768,536870912,72057594037927936,324518553658426726783156020576256,411376139330301510538742295639337626245683966408394965837152256,5164499756173817179311838344006023748659411585658447025661318713081295244033682389259290706560275662871806343945494986752
seq $0,78 ; Tetranacci numbers: a(n) = a(n-1) + a(n-2) + a(n-3) + a(n-4) for n >= 4 with a(0) = a(1) = a(2) = 0 and a(3) = 1.
seq $0,335843 ; a(n) is the number of n-digit positive integers with exactly two distinct base 10 digits.
div $0,81
add $0,1
|
programs/oeis/087/A087131.asm | neoneye/loda | 22 | 15122 | ; A087131: a(n) = 2^n*Lucas(n), where Lucas = A000032.
; 2,2,12,32,112,352,1152,3712,12032,38912,125952,407552,1318912,4268032,13811712,44695552,144637952,468058112,1514668032,4901568512,15861809152,51329892352,166107021312,537533612032,1739495309312
seq $0,14335 ; Exponential convolution of Fibonacci numbers with themselves (divided by 2).
mul $0,10
add $0,2
|
Src/Ant32/foo.asm | geoffthorpe/ant-architecture | 0 | 864 | <filename>Src/Ant32/foo.asm
lc g0, 10
push g0
pop g1
halt
|
oeis/099/A099801.asm | neoneye/loda-programs | 11 | 28424 | ; A099801: PrimePi(2n+1), the number of primes less than or equal to 2n+1.
; Submitted by <NAME>(w2)
; 0,2,3,4,4,5,6,6,7,8,8,9,9,9,10,11,11,11,12,12,13,14,14,15,15,15,16,16,16,17,18,18,18,19,19,20,21,21,21,22,22,23,23,23,24,24,24,24,25,25,26,27,27,28,29,29,30,30,30,30,30,30,30,31,31,32,32,32,33,34,34,34,34,34,35,36,36,36,37,37,37,38,38,39,39,39,40,40,40,41,42,42,42,42,42,43,44,44,45,46
mul $0,2
add $0,1
lpb $0
sub $0,1
div $0,2
mul $0,2
trn $0,1
seq $0,151799 ; Version 2 of the "previous prime" function: largest prime < n.
sub $0,1
add $1,1
lpe
mov $0,$1
|
programs/oeis/004/A004646.asm | neoneye/loda | 22 | 160950 | ; A004646: Powers of 2 written in base 7.
; 1,2,4,11,22,44,121,242,514,1331,2662,5654,14641,32612,65524,164351,362032,1054064,2141161,4312352,11625034,23553101,50436202,131205404,262414111,555131222,1443262444,3216555221,6436443442,16206220214,35415440431,104134211162,211301422354,422603145041,1145506323112,2324315646224,4651634625451,12633602554232,25600505441464,54501314213261,142302631426552,314605563156434,632514456346201,1565332246025402,3463664525054104,10260662353141211,20551655036312422,41433643105625144,113200616214553321,226401535432436642,456103404165206614,1245210111363416531,2523420223060136362,5350140446150306054,14030311225330615141,31060622453661533312,62151545240653366624,154333423511640066551,342000150323610166432,1014000330650520366164,2031000661631341065361,4062001653563012164052,11154003640456024361134,22341010611245052052301,45012021522523134134602,123024043345346301302504,246051120024025602605311,525132240051054505513622,1353264510132142314330544,3036562320264314631661421,6106454640561632563653142,15216242611453565460636314,33435515523240464251605631,100204334346511261533514562,200412002026322553400332454,401124004055645440100665241,1102251011144624210201663512,2204532022322551420403660324,4412364044645433141110650651,12125061122624166312221631632,24253152245551365624443563564,51536334524433064552220460461,133406002352166162434441251252,300115005034365355202212532534,600233013102064043404425365401,1500466026204161120112154064102,3301265055411352240224341161204,6602563144123034510452012352411,16505456321246102321234025035122,36314245642525204642501053103244,105631524615353412615302136206521,214563352534040125533604305416342,432460035401110254400511614136014,1165250104102220542101323531305031,2363530211204441414202650362613062,5060360422412213131405631055526154,13151051145124426263114562144355341,26332132323252155556232454322044012,55664264646534344445465241644121024,144661562626402022224263513621242051
mov $1,2
pow $1,$0
seq $1,7093 ; Numbers in base 7.
mov $0,$1
|
resources/scripts/api/robtex.ads | omarafify1990/Amass | 1 | 7700 | <reponame>omarafify1990/Amass
-- Copyright 2021 <NAME>. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local json = require("json")
name = "Robtex"
type = "api"
function start()
setratelimit(1)
end
function vertical(ctx, domain)
local cfg = datasrc_config()
if (cfg == nil) then
return
end
local url = "https://freeapi.robtex.com/pdns/forward/" .. domain
local resp, err = request(ctx, {
['url']=url,
headers={['Content-Type']="application/json"},
})
if (err ~= nil and err ~= "") then
return
end
local j = json.decode("{\"results\": [" .. resp .. "]}")
if (j == nil or #(j.results) == 0) then
return
end
for _, rr in pairs(j.results) do
if (rr.rrtype == "A") then
local d = ipinfo(ctx, rr.rrdata, cfg.ttl)
if (d == nil) then
return
end
extractnames(ctx, d)
elseif (rr.rrtype == "NS" or rr.rrtype == "MX") then
sendnames(ctx, rr.rrdata)
end
end
end
function asn(ctx, addr, asn)
local cfg = datasrc_config()
if (cfg == nil) then
return
end
local d
local prefix
if (asn == 0) then
if (addr == "") then
return
end
d = ipinfo(ctx, addr, cfg.ttl)
if (d == nil) then
return
end
asn = d.as
prefix = d.bgproute
end
local cidrs = netblocks(ctx, asn, cfg.ttl)
if (cidrs == nil or #cidrs == 0) then
return
end
if (prefix == "") then
prefix = cidrs[1]
parts = split(prefix, "/")
addr = parts[1]
d = ipinfo(ctx, addr, cfg.ttl)
if (d == nil) then
return
end
end
extractnames(ctx, d)
local desc = d.asname
if (desc == nil) then
desc = ""
end
if (string.len(desc) < string.len(d.whoisdesc)) then
desc = d.whoisdesc
end
if (d.asdesc ~= nil and string.len(d.asdesc) > 0) then
desc = desc .. " - " .. d.asdesc
elseif (d.routedesc ~= nil and string.len(d.routedesc) > 0) then
desc = desc .. " - " .. d.routedesc
end
newasn(ctx, {
['addr']=addr,
['asn']=asn,
['prefix']=prefix,
['desc']=desc,
['netblocks']=cidrs,
})
end
function ipinfo(ctx, addr, ttl)
local url = "https://freeapi.robtex.com/ipquery/" .. addr
local resp, err = request(ctx, {
['url']=url,
headers={['Content-Type']="application/json"},
})
if (err ~= nil and err ~= "") then
return nil
end
local j = json.decode(resp)
if (j == nil or j.status ~= "ok") then
return nil
end
return j
end
function extractnames(ctx, djson)
local sections = {"act", "acth", "pas", "pash"}
for _, s in pairs(sections) do
if (djson[s] ~= nil and #(djson[s]) > 0) then
for _, name in pairs(djson[s]) do
if inscope(ctx, name.o) then
newname(ctx, name.o)
end
end
end
end
end
function netblocks(ctx, asn, ttl)
local url = "https://freeapi.robtex.com/asquery/" .. tostring(asn)
local resp, err = request(ctx, {
['url']=url,
headers={['Content-Type']="application/json"},
})
if (err ~= nil and err ~= "") then
return nil
end
local j = json.decode(resp)
if (j == nil or j.status ~= "ok") then
return nil
end
local netblocks = {}
for _, net in pairs(j.nets) do
table.insert(netblocks, net.n)
end
if (#netblocks == 0) then
return nil
end
return netblocks
end
function sendnames(ctx, content)
local names = find(content, subdomainre)
if (names == nil) then
return
end
local found = {}
for i, v in pairs(names) do
if (found[v] == nil) then
newname(ctx, v)
found[v] = true
end
end
end
function split(str, delim)
local result = {}
local pattern = "[^%" .. delim .. "]+"
local matches = find(str, pattern)
if (matches == nil or #matches == 0) then
return result
end
for i, match in pairs(matches) do
table.insert(result, match)
end
return result
end
|
bfloat/debug_fsin.asm | DW0RKiN/Floating-point-Library-for-Z80 | 12 | 85824 | <reponame>DW0RKiN/Floating-point-Library-for-Z80<filename>bfloat/debug_fsin.asm
if not defined FSIN
INCLUDE "print_fp.asm"
; HL = ln(abs(HL))
DEBUG@FSIN:
FSIN:
CALL @FSIN ; 3:17
PUSH HL ; 1:11
LD HL, 'S'+'N' * 256 ; 3:10 "SN"
LD A, COL_BLUE ; 2:7
JP PRINT_XFP ; 3:10
else
if not defined DEBUG@FSIN
.WARNING You must include the file: debug_fsin.asm before.
endif
endif
|
grep.asm | PieMyth/cs333 | 0 | 19731 |
_grep: file format elf32-i386
Disassembly of section .text:
00000000 <grep>:
char buf[1024];
int match(char*, char*);
void
grep(char *pattern, int fd)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 18 sub $0x18,%esp
int n, m;
char *p, *q;
m = 0;
6: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){
d: e9 b6 00 00 00 jmp c8 <grep+0xc8>
m += n;
12: 8b 45 ec mov -0x14(%ebp),%eax
15: 01 45 f4 add %eax,-0xc(%ebp)
buf[m] = '\0';
18: 8b 45 f4 mov -0xc(%ebp),%eax
1b: 05 60 0f 00 00 add $0xf60,%eax
20: c6 00 00 movb $0x0,(%eax)
p = buf;
23: c7 45 f0 60 0f 00 00 movl $0xf60,-0x10(%ebp)
while((q = strchr(p, '\n')) != 0){
2a: eb 4a jmp 76 <grep+0x76>
*q = 0;
2c: 8b 45 e8 mov -0x18(%ebp),%eax
2f: c6 00 00 movb $0x0,(%eax)
if(match(pattern, p)){
32: 83 ec 08 sub $0x8,%esp
35: ff 75 f0 pushl -0x10(%ebp)
38: ff 75 08 pushl 0x8(%ebp)
3b: e8 9a 01 00 00 call 1da <match>
40: 83 c4 10 add $0x10,%esp
43: 85 c0 test %eax,%eax
45: 74 26 je 6d <grep+0x6d>
*q = '\n';
47: 8b 45 e8 mov -0x18(%ebp),%eax
4a: c6 00 0a movb $0xa,(%eax)
write(1, p, q+1 - p);
4d: 8b 45 e8 mov -0x18(%ebp),%eax
50: 83 c0 01 add $0x1,%eax
53: 89 c2 mov %eax,%edx
55: 8b 45 f0 mov -0x10(%ebp),%eax
58: 29 c2 sub %eax,%edx
5a: 89 d0 mov %edx,%eax
5c: 83 ec 04 sub $0x4,%esp
5f: 50 push %eax
60: ff 75 f0 pushl -0x10(%ebp)
63: 6a 01 push $0x1
65: e8 16 06 00 00 call 680 <write>
6a: 83 c4 10 add $0x10,%esp
}
p = q+1;
6d: 8b 45 e8 mov -0x18(%ebp),%eax
70: 83 c0 01 add $0x1,%eax
73: 89 45 f0 mov %eax,-0x10(%ebp)
m = 0;
while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){
m += n;
buf[m] = '\0';
p = buf;
while((q = strchr(p, '\n')) != 0){
76: 83 ec 08 sub $0x8,%esp
79: 6a 0a push $0xa
7b: ff 75 f0 pushl -0x10(%ebp)
7e: e8 89 03 00 00 call 40c <strchr>
83: 83 c4 10 add $0x10,%esp
86: 89 45 e8 mov %eax,-0x18(%ebp)
89: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
8d: 75 9d jne 2c <grep+0x2c>
*q = '\n';
write(1, p, q+1 - p);
}
p = q+1;
}
if(p == buf)
8f: 81 7d f0 60 0f 00 00 cmpl $0xf60,-0x10(%ebp)
96: 75 07 jne 9f <grep+0x9f>
m = 0;
98: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
if(m > 0){
9f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
a3: 7e 23 jle c8 <grep+0xc8>
m -= p - buf;
a5: 8b 45 f0 mov -0x10(%ebp),%eax
a8: ba 60 0f 00 00 mov $0xf60,%edx
ad: 29 d0 sub %edx,%eax
af: 29 45 f4 sub %eax,-0xc(%ebp)
memmove(buf, p, m);
b2: 83 ec 04 sub $0x4,%esp
b5: ff 75 f4 pushl -0xc(%ebp)
b8: ff 75 f0 pushl -0x10(%ebp)
bb: 68 60 0f 00 00 push $0xf60
c0: e8 56 05 00 00 call 61b <memmove>
c5: 83 c4 10 add $0x10,%esp
{
int n, m;
char *p, *q;
m = 0;
while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){
c8: 8b 45 f4 mov -0xc(%ebp),%eax
cb: ba ff 03 00 00 mov $0x3ff,%edx
d0: 29 c2 sub %eax,%edx
d2: 89 d0 mov %edx,%eax
d4: 89 c2 mov %eax,%edx
d6: 8b 45 f4 mov -0xc(%ebp),%eax
d9: 05 60 0f 00 00 add $0xf60,%eax
de: 83 ec 04 sub $0x4,%esp
e1: 52 push %edx
e2: 50 push %eax
e3: ff 75 0c pushl 0xc(%ebp)
e6: e8 8d 05 00 00 call 678 <read>
eb: 83 c4 10 add $0x10,%esp
ee: 89 45 ec mov %eax,-0x14(%ebp)
f1: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
f5: 0f 8f 17 ff ff ff jg 12 <grep+0x12>
if(m > 0){
m -= p - buf;
memmove(buf, p, m);
}
}
}
fb: 90 nop
fc: c9 leave
fd: c3 ret
000000fe <main>:
int
main(int argc, char *argv[])
{
fe: 8d 4c 24 04 lea 0x4(%esp),%ecx
102: 83 e4 f0 and $0xfffffff0,%esp
105: ff 71 fc pushl -0x4(%ecx)
108: 55 push %ebp
109: 89 e5 mov %esp,%ebp
10b: 53 push %ebx
10c: 51 push %ecx
10d: 83 ec 10 sub $0x10,%esp
110: 89 cb mov %ecx,%ebx
int fd, i;
char *pattern;
if(argc <= 1){
112: 83 3b 01 cmpl $0x1,(%ebx)
115: 7f 17 jg 12e <main+0x30>
printf(2, "usage: grep pattern [file ...]\n");
117: 83 ec 08 sub $0x8,%esp
11a: 68 f0 0b 00 00 push $0xbf0
11f: 6a 02 push $0x2
121: e8 11 07 00 00 call 837 <printf>
126: 83 c4 10 add $0x10,%esp
exit();
129: e8 32 05 00 00 call 660 <exit>
}
pattern = argv[1];
12e: 8b 43 04 mov 0x4(%ebx),%eax
131: 8b 40 04 mov 0x4(%eax),%eax
134: 89 45 f0 mov %eax,-0x10(%ebp)
if(argc <= 2){
137: 83 3b 02 cmpl $0x2,(%ebx)
13a: 7f 15 jg 151 <main+0x53>
grep(pattern, 0);
13c: 83 ec 08 sub $0x8,%esp
13f: 6a 00 push $0x0
141: ff 75 f0 pushl -0x10(%ebp)
144: e8 b7 fe ff ff call 0 <grep>
149: 83 c4 10 add $0x10,%esp
exit();
14c: e8 0f 05 00 00 call 660 <exit>
}
for(i = 2; i < argc; i++){
151: c7 45 f4 02 00 00 00 movl $0x2,-0xc(%ebp)
158: eb 74 jmp 1ce <main+0xd0>
if((fd = open(argv[i], 0)) < 0){
15a: 8b 45 f4 mov -0xc(%ebp),%eax
15d: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
164: 8b 43 04 mov 0x4(%ebx),%eax
167: 01 d0 add %edx,%eax
169: 8b 00 mov (%eax),%eax
16b: 83 ec 08 sub $0x8,%esp
16e: 6a 00 push $0x0
170: 50 push %eax
171: e8 2a 05 00 00 call 6a0 <open>
176: 83 c4 10 add $0x10,%esp
179: 89 45 ec mov %eax,-0x14(%ebp)
17c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
180: 79 29 jns 1ab <main+0xad>
printf(1, "grep: cannot open %s\n", argv[i]);
182: 8b 45 f4 mov -0xc(%ebp),%eax
185: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
18c: 8b 43 04 mov 0x4(%ebx),%eax
18f: 01 d0 add %edx,%eax
191: 8b 00 mov (%eax),%eax
193: 83 ec 04 sub $0x4,%esp
196: 50 push %eax
197: 68 10 0c 00 00 push $0xc10
19c: 6a 01 push $0x1
19e: e8 94 06 00 00 call 837 <printf>
1a3: 83 c4 10 add $0x10,%esp
exit();
1a6: e8 b5 04 00 00 call 660 <exit>
}
grep(pattern, fd);
1ab: 83 ec 08 sub $0x8,%esp
1ae: ff 75 ec pushl -0x14(%ebp)
1b1: ff 75 f0 pushl -0x10(%ebp)
1b4: e8 47 fe ff ff call 0 <grep>
1b9: 83 c4 10 add $0x10,%esp
close(fd);
1bc: 83 ec 0c sub $0xc,%esp
1bf: ff 75 ec pushl -0x14(%ebp)
1c2: e8 c1 04 00 00 call 688 <close>
1c7: 83 c4 10 add $0x10,%esp
if(argc <= 2){
grep(pattern, 0);
exit();
}
for(i = 2; i < argc; i++){
1ca: 83 45 f4 01 addl $0x1,-0xc(%ebp)
1ce: 8b 45 f4 mov -0xc(%ebp),%eax
1d1: 3b 03 cmp (%ebx),%eax
1d3: 7c 85 jl 15a <main+0x5c>
exit();
}
grep(pattern, fd);
close(fd);
}
exit();
1d5: e8 86 04 00 00 call 660 <exit>
000001da <match>:
int matchhere(char*, char*);
int matchstar(int, char*, char*);
int
match(char *re, char *text)
{
1da: 55 push %ebp
1db: 89 e5 mov %esp,%ebp
1dd: 83 ec 08 sub $0x8,%esp
if(re[0] == '^')
1e0: 8b 45 08 mov 0x8(%ebp),%eax
1e3: 0f b6 00 movzbl (%eax),%eax
1e6: 3c 5e cmp $0x5e,%al
1e8: 75 17 jne 201 <match+0x27>
return matchhere(re+1, text);
1ea: 8b 45 08 mov 0x8(%ebp),%eax
1ed: 83 c0 01 add $0x1,%eax
1f0: 83 ec 08 sub $0x8,%esp
1f3: ff 75 0c pushl 0xc(%ebp)
1f6: 50 push %eax
1f7: e8 38 00 00 00 call 234 <matchhere>
1fc: 83 c4 10 add $0x10,%esp
1ff: eb 31 jmp 232 <match+0x58>
do{ // must look at empty string
if(matchhere(re, text))
201: 83 ec 08 sub $0x8,%esp
204: ff 75 0c pushl 0xc(%ebp)
207: ff 75 08 pushl 0x8(%ebp)
20a: e8 25 00 00 00 call 234 <matchhere>
20f: 83 c4 10 add $0x10,%esp
212: 85 c0 test %eax,%eax
214: 74 07 je 21d <match+0x43>
return 1;
216: b8 01 00 00 00 mov $0x1,%eax
21b: eb 15 jmp 232 <match+0x58>
}while(*text++ != '\0');
21d: 8b 45 0c mov 0xc(%ebp),%eax
220: 8d 50 01 lea 0x1(%eax),%edx
223: 89 55 0c mov %edx,0xc(%ebp)
226: 0f b6 00 movzbl (%eax),%eax
229: 84 c0 test %al,%al
22b: 75 d4 jne 201 <match+0x27>
return 0;
22d: b8 00 00 00 00 mov $0x0,%eax
}
232: c9 leave
233: c3 ret
00000234 <matchhere>:
// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
234: 55 push %ebp
235: 89 e5 mov %esp,%ebp
237: 83 ec 08 sub $0x8,%esp
if(re[0] == '\0')
23a: 8b 45 08 mov 0x8(%ebp),%eax
23d: 0f b6 00 movzbl (%eax),%eax
240: 84 c0 test %al,%al
242: 75 0a jne 24e <matchhere+0x1a>
return 1;
244: b8 01 00 00 00 mov $0x1,%eax
249: e9 99 00 00 00 jmp 2e7 <matchhere+0xb3>
if(re[1] == '*')
24e: 8b 45 08 mov 0x8(%ebp),%eax
251: 83 c0 01 add $0x1,%eax
254: 0f b6 00 movzbl (%eax),%eax
257: 3c 2a cmp $0x2a,%al
259: 75 21 jne 27c <matchhere+0x48>
return matchstar(re[0], re+2, text);
25b: 8b 45 08 mov 0x8(%ebp),%eax
25e: 8d 50 02 lea 0x2(%eax),%edx
261: 8b 45 08 mov 0x8(%ebp),%eax
264: 0f b6 00 movzbl (%eax),%eax
267: 0f be c0 movsbl %al,%eax
26a: 83 ec 04 sub $0x4,%esp
26d: ff 75 0c pushl 0xc(%ebp)
270: 52 push %edx
271: 50 push %eax
272: e8 72 00 00 00 call 2e9 <matchstar>
277: 83 c4 10 add $0x10,%esp
27a: eb 6b jmp 2e7 <matchhere+0xb3>
if(re[0] == '$' && re[1] == '\0')
27c: 8b 45 08 mov 0x8(%ebp),%eax
27f: 0f b6 00 movzbl (%eax),%eax
282: 3c 24 cmp $0x24,%al
284: 75 1d jne 2a3 <matchhere+0x6f>
286: 8b 45 08 mov 0x8(%ebp),%eax
289: 83 c0 01 add $0x1,%eax
28c: 0f b6 00 movzbl (%eax),%eax
28f: 84 c0 test %al,%al
291: 75 10 jne 2a3 <matchhere+0x6f>
return *text == '\0';
293: 8b 45 0c mov 0xc(%ebp),%eax
296: 0f b6 00 movzbl (%eax),%eax
299: 84 c0 test %al,%al
29b: 0f 94 c0 sete %al
29e: 0f b6 c0 movzbl %al,%eax
2a1: eb 44 jmp 2e7 <matchhere+0xb3>
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
2a3: 8b 45 0c mov 0xc(%ebp),%eax
2a6: 0f b6 00 movzbl (%eax),%eax
2a9: 84 c0 test %al,%al
2ab: 74 35 je 2e2 <matchhere+0xae>
2ad: 8b 45 08 mov 0x8(%ebp),%eax
2b0: 0f b6 00 movzbl (%eax),%eax
2b3: 3c 2e cmp $0x2e,%al
2b5: 74 10 je 2c7 <matchhere+0x93>
2b7: 8b 45 08 mov 0x8(%ebp),%eax
2ba: 0f b6 10 movzbl (%eax),%edx
2bd: 8b 45 0c mov 0xc(%ebp),%eax
2c0: 0f b6 00 movzbl (%eax),%eax
2c3: 38 c2 cmp %al,%dl
2c5: 75 1b jne 2e2 <matchhere+0xae>
return matchhere(re+1, text+1);
2c7: 8b 45 0c mov 0xc(%ebp),%eax
2ca: 8d 50 01 lea 0x1(%eax),%edx
2cd: 8b 45 08 mov 0x8(%ebp),%eax
2d0: 83 c0 01 add $0x1,%eax
2d3: 83 ec 08 sub $0x8,%esp
2d6: 52 push %edx
2d7: 50 push %eax
2d8: e8 57 ff ff ff call 234 <matchhere>
2dd: 83 c4 10 add $0x10,%esp
2e0: eb 05 jmp 2e7 <matchhere+0xb3>
return 0;
2e2: b8 00 00 00 00 mov $0x0,%eax
}
2e7: c9 leave
2e8: c3 ret
000002e9 <matchstar>:
// matchstar: search for c*re at beginning of text
int matchstar(int c, char *re, char *text)
{
2e9: 55 push %ebp
2ea: 89 e5 mov %esp,%ebp
2ec: 83 ec 08 sub $0x8,%esp
do{ // a * matches zero or more instances
if(matchhere(re, text))
2ef: 83 ec 08 sub $0x8,%esp
2f2: ff 75 10 pushl 0x10(%ebp)
2f5: ff 75 0c pushl 0xc(%ebp)
2f8: e8 37 ff ff ff call 234 <matchhere>
2fd: 83 c4 10 add $0x10,%esp
300: 85 c0 test %eax,%eax
302: 74 07 je 30b <matchstar+0x22>
return 1;
304: b8 01 00 00 00 mov $0x1,%eax
309: eb 29 jmp 334 <matchstar+0x4b>
}while(*text!='\0' && (*text++==c || c=='.'));
30b: 8b 45 10 mov 0x10(%ebp),%eax
30e: 0f b6 00 movzbl (%eax),%eax
311: 84 c0 test %al,%al
313: 74 1a je 32f <matchstar+0x46>
315: 8b 45 10 mov 0x10(%ebp),%eax
318: 8d 50 01 lea 0x1(%eax),%edx
31b: 89 55 10 mov %edx,0x10(%ebp)
31e: 0f b6 00 movzbl (%eax),%eax
321: 0f be c0 movsbl %al,%eax
324: 3b 45 08 cmp 0x8(%ebp),%eax
327: 74 c6 je 2ef <matchstar+0x6>
329: 83 7d 08 2e cmpl $0x2e,0x8(%ebp)
32d: 74 c0 je 2ef <matchstar+0x6>
return 0;
32f: b8 00 00 00 00 mov $0x0,%eax
}
334: c9 leave
335: c3 ret
00000336 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
336: 55 push %ebp
337: 89 e5 mov %esp,%ebp
339: 57 push %edi
33a: 53 push %ebx
asm volatile("cld; rep stosb" :
33b: 8b 4d 08 mov 0x8(%ebp),%ecx
33e: 8b 55 10 mov 0x10(%ebp),%edx
341: 8b 45 0c mov 0xc(%ebp),%eax
344: 89 cb mov %ecx,%ebx
346: 89 df mov %ebx,%edi
348: 89 d1 mov %edx,%ecx
34a: fc cld
34b: f3 aa rep stos %al,%es:(%edi)
34d: 89 ca mov %ecx,%edx
34f: 89 fb mov %edi,%ebx
351: 89 5d 08 mov %ebx,0x8(%ebp)
354: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
357: 90 nop
358: 5b pop %ebx
359: 5f pop %edi
35a: 5d pop %ebp
35b: c3 ret
0000035c <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
35c: 55 push %ebp
35d: 89 e5 mov %esp,%ebp
35f: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
362: 8b 45 08 mov 0x8(%ebp),%eax
365: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
368: 90 nop
369: 8b 45 08 mov 0x8(%ebp),%eax
36c: 8d 50 01 lea 0x1(%eax),%edx
36f: 89 55 08 mov %edx,0x8(%ebp)
372: 8b 55 0c mov 0xc(%ebp),%edx
375: 8d 4a 01 lea 0x1(%edx),%ecx
378: 89 4d 0c mov %ecx,0xc(%ebp)
37b: 0f b6 12 movzbl (%edx),%edx
37e: 88 10 mov %dl,(%eax)
380: 0f b6 00 movzbl (%eax),%eax
383: 84 c0 test %al,%al
385: 75 e2 jne 369 <strcpy+0xd>
;
return os;
387: 8b 45 fc mov -0x4(%ebp),%eax
}
38a: c9 leave
38b: c3 ret
0000038c <strcmp>:
int
strcmp(const char *p, const char *q)
{
38c: 55 push %ebp
38d: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
38f: eb 08 jmp 399 <strcmp+0xd>
p++, q++;
391: 83 45 08 01 addl $0x1,0x8(%ebp)
395: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
399: 8b 45 08 mov 0x8(%ebp),%eax
39c: 0f b6 00 movzbl (%eax),%eax
39f: 84 c0 test %al,%al
3a1: 74 10 je 3b3 <strcmp+0x27>
3a3: 8b 45 08 mov 0x8(%ebp),%eax
3a6: 0f b6 10 movzbl (%eax),%edx
3a9: 8b 45 0c mov 0xc(%ebp),%eax
3ac: 0f b6 00 movzbl (%eax),%eax
3af: 38 c2 cmp %al,%dl
3b1: 74 de je 391 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
3b3: 8b 45 08 mov 0x8(%ebp),%eax
3b6: 0f b6 00 movzbl (%eax),%eax
3b9: 0f b6 d0 movzbl %al,%edx
3bc: 8b 45 0c mov 0xc(%ebp),%eax
3bf: 0f b6 00 movzbl (%eax),%eax
3c2: 0f b6 c0 movzbl %al,%eax
3c5: 29 c2 sub %eax,%edx
3c7: 89 d0 mov %edx,%eax
}
3c9: 5d pop %ebp
3ca: c3 ret
000003cb <strlen>:
uint
strlen(char *s)
{
3cb: 55 push %ebp
3cc: 89 e5 mov %esp,%ebp
3ce: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
3d1: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
3d8: eb 04 jmp 3de <strlen+0x13>
3da: 83 45 fc 01 addl $0x1,-0x4(%ebp)
3de: 8b 55 fc mov -0x4(%ebp),%edx
3e1: 8b 45 08 mov 0x8(%ebp),%eax
3e4: 01 d0 add %edx,%eax
3e6: 0f b6 00 movzbl (%eax),%eax
3e9: 84 c0 test %al,%al
3eb: 75 ed jne 3da <strlen+0xf>
;
return n;
3ed: 8b 45 fc mov -0x4(%ebp),%eax
}
3f0: c9 leave
3f1: c3 ret
000003f2 <memset>:
void*
memset(void *dst, int c, uint n)
{
3f2: 55 push %ebp
3f3: 89 e5 mov %esp,%ebp
stosb(dst, c, n);
3f5: 8b 45 10 mov 0x10(%ebp),%eax
3f8: 50 push %eax
3f9: ff 75 0c pushl 0xc(%ebp)
3fc: ff 75 08 pushl 0x8(%ebp)
3ff: e8 32 ff ff ff call 336 <stosb>
404: 83 c4 0c add $0xc,%esp
return dst;
407: 8b 45 08 mov 0x8(%ebp),%eax
}
40a: c9 leave
40b: c3 ret
0000040c <strchr>:
char*
strchr(const char *s, char c)
{
40c: 55 push %ebp
40d: 89 e5 mov %esp,%ebp
40f: 83 ec 04 sub $0x4,%esp
412: 8b 45 0c mov 0xc(%ebp),%eax
415: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
418: eb 14 jmp 42e <strchr+0x22>
if(*s == c)
41a: 8b 45 08 mov 0x8(%ebp),%eax
41d: 0f b6 00 movzbl (%eax),%eax
420: 3a 45 fc cmp -0x4(%ebp),%al
423: 75 05 jne 42a <strchr+0x1e>
return (char*)s;
425: 8b 45 08 mov 0x8(%ebp),%eax
428: eb 13 jmp 43d <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
42a: 83 45 08 01 addl $0x1,0x8(%ebp)
42e: 8b 45 08 mov 0x8(%ebp),%eax
431: 0f b6 00 movzbl (%eax),%eax
434: 84 c0 test %al,%al
436: 75 e2 jne 41a <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
438: b8 00 00 00 00 mov $0x0,%eax
}
43d: c9 leave
43e: c3 ret
0000043f <gets>:
char*
gets(char *buf, int max)
{
43f: 55 push %ebp
440: 89 e5 mov %esp,%ebp
442: 83 ec 18 sub $0x18,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
445: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
44c: eb 42 jmp 490 <gets+0x51>
cc = read(0, &c, 1);
44e: 83 ec 04 sub $0x4,%esp
451: 6a 01 push $0x1
453: 8d 45 ef lea -0x11(%ebp),%eax
456: 50 push %eax
457: 6a 00 push $0x0
459: e8 1a 02 00 00 call 678 <read>
45e: 83 c4 10 add $0x10,%esp
461: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
464: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
468: 7e 33 jle 49d <gets+0x5e>
break;
buf[i++] = c;
46a: 8b 45 f4 mov -0xc(%ebp),%eax
46d: 8d 50 01 lea 0x1(%eax),%edx
470: 89 55 f4 mov %edx,-0xc(%ebp)
473: 89 c2 mov %eax,%edx
475: 8b 45 08 mov 0x8(%ebp),%eax
478: 01 c2 add %eax,%edx
47a: 0f b6 45 ef movzbl -0x11(%ebp),%eax
47e: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
480: 0f b6 45 ef movzbl -0x11(%ebp),%eax
484: 3c 0a cmp $0xa,%al
486: 74 16 je 49e <gets+0x5f>
488: 0f b6 45 ef movzbl -0x11(%ebp),%eax
48c: 3c 0d cmp $0xd,%al
48e: 74 0e je 49e <gets+0x5f>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
490: 8b 45 f4 mov -0xc(%ebp),%eax
493: 83 c0 01 add $0x1,%eax
496: 3b 45 0c cmp 0xc(%ebp),%eax
499: 7c b3 jl 44e <gets+0xf>
49b: eb 01 jmp 49e <gets+0x5f>
cc = read(0, &c, 1);
if(cc < 1)
break;
49d: 90 nop
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
49e: 8b 55 f4 mov -0xc(%ebp),%edx
4a1: 8b 45 08 mov 0x8(%ebp),%eax
4a4: 01 d0 add %edx,%eax
4a6: c6 00 00 movb $0x0,(%eax)
return buf;
4a9: 8b 45 08 mov 0x8(%ebp),%eax
}
4ac: c9 leave
4ad: c3 ret
000004ae <stat>:
int
stat(char *n, struct stat *st)
{
4ae: 55 push %ebp
4af: 89 e5 mov %esp,%ebp
4b1: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
4b4: 83 ec 08 sub $0x8,%esp
4b7: 6a 00 push $0x0
4b9: ff 75 08 pushl 0x8(%ebp)
4bc: e8 df 01 00 00 call 6a0 <open>
4c1: 83 c4 10 add $0x10,%esp
4c4: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
4c7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
4cb: 79 07 jns 4d4 <stat+0x26>
return -1;
4cd: b8 ff ff ff ff mov $0xffffffff,%eax
4d2: eb 25 jmp 4f9 <stat+0x4b>
r = fstat(fd, st);
4d4: 83 ec 08 sub $0x8,%esp
4d7: ff 75 0c pushl 0xc(%ebp)
4da: ff 75 f4 pushl -0xc(%ebp)
4dd: e8 d6 01 00 00 call 6b8 <fstat>
4e2: 83 c4 10 add $0x10,%esp
4e5: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
4e8: 83 ec 0c sub $0xc,%esp
4eb: ff 75 f4 pushl -0xc(%ebp)
4ee: e8 95 01 00 00 call 688 <close>
4f3: 83 c4 10 add $0x10,%esp
return r;
4f6: 8b 45 f0 mov -0x10(%ebp),%eax
}
4f9: c9 leave
4fa: c3 ret
000004fb <atoi>:
int
atoi(const char *s)
{
4fb: 55 push %ebp
4fc: 89 e5 mov %esp,%ebp
4fe: 83 ec 10 sub $0x10,%esp
int n, sign;
n = 0;
501: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while (*s == ' ') s++;
508: eb 04 jmp 50e <atoi+0x13>
50a: 83 45 08 01 addl $0x1,0x8(%ebp)
50e: 8b 45 08 mov 0x8(%ebp),%eax
511: 0f b6 00 movzbl (%eax),%eax
514: 3c 20 cmp $0x20,%al
516: 74 f2 je 50a <atoi+0xf>
sign = (*s == '-') ? -1 : 1;
518: 8b 45 08 mov 0x8(%ebp),%eax
51b: 0f b6 00 movzbl (%eax),%eax
51e: 3c 2d cmp $0x2d,%al
520: 75 07 jne 529 <atoi+0x2e>
522: b8 ff ff ff ff mov $0xffffffff,%eax
527: eb 05 jmp 52e <atoi+0x33>
529: b8 01 00 00 00 mov $0x1,%eax
52e: 89 45 f8 mov %eax,-0x8(%ebp)
if (*s == '+' || *s == '-')
531: 8b 45 08 mov 0x8(%ebp),%eax
534: 0f b6 00 movzbl (%eax),%eax
537: 3c 2b cmp $0x2b,%al
539: 74 0a je 545 <atoi+0x4a>
53b: 8b 45 08 mov 0x8(%ebp),%eax
53e: 0f b6 00 movzbl (%eax),%eax
541: 3c 2d cmp $0x2d,%al
543: 75 2b jne 570 <atoi+0x75>
s++;
545: 83 45 08 01 addl $0x1,0x8(%ebp)
while('0' <= *s && *s <= '9')
549: eb 25 jmp 570 <atoi+0x75>
n = n*10 + *s++ - '0';
54b: 8b 55 fc mov -0x4(%ebp),%edx
54e: 89 d0 mov %edx,%eax
550: c1 e0 02 shl $0x2,%eax
553: 01 d0 add %edx,%eax
555: 01 c0 add %eax,%eax
557: 89 c1 mov %eax,%ecx
559: 8b 45 08 mov 0x8(%ebp),%eax
55c: 8d 50 01 lea 0x1(%eax),%edx
55f: 89 55 08 mov %edx,0x8(%ebp)
562: 0f b6 00 movzbl (%eax),%eax
565: 0f be c0 movsbl %al,%eax
568: 01 c8 add %ecx,%eax
56a: 83 e8 30 sub $0x30,%eax
56d: 89 45 fc mov %eax,-0x4(%ebp)
n = 0;
while (*s == ' ') s++;
sign = (*s == '-') ? -1 : 1;
if (*s == '+' || *s == '-')
s++;
while('0' <= *s && *s <= '9')
570: 8b 45 08 mov 0x8(%ebp),%eax
573: 0f b6 00 movzbl (%eax),%eax
576: 3c 2f cmp $0x2f,%al
578: 7e 0a jle 584 <atoi+0x89>
57a: 8b 45 08 mov 0x8(%ebp),%eax
57d: 0f b6 00 movzbl (%eax),%eax
580: 3c 39 cmp $0x39,%al
582: 7e c7 jle 54b <atoi+0x50>
n = n*10 + *s++ - '0';
return sign*n;
584: 8b 45 f8 mov -0x8(%ebp),%eax
587: 0f af 45 fc imul -0x4(%ebp),%eax
}
58b: c9 leave
58c: c3 ret
0000058d <atoo>:
int
atoo(const char *s)
{
58d: 55 push %ebp
58e: 89 e5 mov %esp,%ebp
590: 83 ec 10 sub $0x10,%esp
int n, sign;
n = 0;
593: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while (*s == ' ') s++;
59a: eb 04 jmp 5a0 <atoo+0x13>
59c: 83 45 08 01 addl $0x1,0x8(%ebp)
5a0: 8b 45 08 mov 0x8(%ebp),%eax
5a3: 0f b6 00 movzbl (%eax),%eax
5a6: 3c 20 cmp $0x20,%al
5a8: 74 f2 je 59c <atoo+0xf>
sign = (*s == '-') ? -1 : 1;
5aa: 8b 45 08 mov 0x8(%ebp),%eax
5ad: 0f b6 00 movzbl (%eax),%eax
5b0: 3c 2d cmp $0x2d,%al
5b2: 75 07 jne 5bb <atoo+0x2e>
5b4: b8 ff ff ff ff mov $0xffffffff,%eax
5b9: eb 05 jmp 5c0 <atoo+0x33>
5bb: b8 01 00 00 00 mov $0x1,%eax
5c0: 89 45 f8 mov %eax,-0x8(%ebp)
if (*s == '+' || *s == '-')
5c3: 8b 45 08 mov 0x8(%ebp),%eax
5c6: 0f b6 00 movzbl (%eax),%eax
5c9: 3c 2b cmp $0x2b,%al
5cb: 74 0a je 5d7 <atoo+0x4a>
5cd: 8b 45 08 mov 0x8(%ebp),%eax
5d0: 0f b6 00 movzbl (%eax),%eax
5d3: 3c 2d cmp $0x2d,%al
5d5: 75 27 jne 5fe <atoo+0x71>
s++;
5d7: 83 45 08 01 addl $0x1,0x8(%ebp)
while('0' <= *s && *s <= '7')
5db: eb 21 jmp 5fe <atoo+0x71>
n = n*8 + *s++ - '0';
5dd: 8b 45 fc mov -0x4(%ebp),%eax
5e0: 8d 0c c5 00 00 00 00 lea 0x0(,%eax,8),%ecx
5e7: 8b 45 08 mov 0x8(%ebp),%eax
5ea: 8d 50 01 lea 0x1(%eax),%edx
5ed: 89 55 08 mov %edx,0x8(%ebp)
5f0: 0f b6 00 movzbl (%eax),%eax
5f3: 0f be c0 movsbl %al,%eax
5f6: 01 c8 add %ecx,%eax
5f8: 83 e8 30 sub $0x30,%eax
5fb: 89 45 fc mov %eax,-0x4(%ebp)
n = 0;
while (*s == ' ') s++;
sign = (*s == '-') ? -1 : 1;
if (*s == '+' || *s == '-')
s++;
while('0' <= *s && *s <= '7')
5fe: 8b 45 08 mov 0x8(%ebp),%eax
601: 0f b6 00 movzbl (%eax),%eax
604: 3c 2f cmp $0x2f,%al
606: 7e 0a jle 612 <atoo+0x85>
608: 8b 45 08 mov 0x8(%ebp),%eax
60b: 0f b6 00 movzbl (%eax),%eax
60e: 3c 37 cmp $0x37,%al
610: 7e cb jle 5dd <atoo+0x50>
n = n*8 + *s++ - '0';
return sign*n;
612: 8b 45 f8 mov -0x8(%ebp),%eax
615: 0f af 45 fc imul -0x4(%ebp),%eax
}
619: c9 leave
61a: c3 ret
0000061b <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
61b: 55 push %ebp
61c: 89 e5 mov %esp,%ebp
61e: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
621: 8b 45 08 mov 0x8(%ebp),%eax
624: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
627: 8b 45 0c mov 0xc(%ebp),%eax
62a: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
62d: eb 17 jmp 646 <memmove+0x2b>
*dst++ = *src++;
62f: 8b 45 fc mov -0x4(%ebp),%eax
632: 8d 50 01 lea 0x1(%eax),%edx
635: 89 55 fc mov %edx,-0x4(%ebp)
638: 8b 55 f8 mov -0x8(%ebp),%edx
63b: 8d 4a 01 lea 0x1(%edx),%ecx
63e: 89 4d f8 mov %ecx,-0x8(%ebp)
641: 0f b6 12 movzbl (%edx),%edx
644: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
646: 8b 45 10 mov 0x10(%ebp),%eax
649: 8d 50 ff lea -0x1(%eax),%edx
64c: 89 55 10 mov %edx,0x10(%ebp)
64f: 85 c0 test %eax,%eax
651: 7f dc jg 62f <memmove+0x14>
*dst++ = *src++;
return vdst;
653: 8b 45 08 mov 0x8(%ebp),%eax
}
656: c9 leave
657: c3 ret
00000658 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
658: b8 01 00 00 00 mov $0x1,%eax
65d: cd 40 int $0x40
65f: c3 ret
00000660 <exit>:
SYSCALL(exit)
660: b8 02 00 00 00 mov $0x2,%eax
665: cd 40 int $0x40
667: c3 ret
00000668 <wait>:
SYSCALL(wait)
668: b8 03 00 00 00 mov $0x3,%eax
66d: cd 40 int $0x40
66f: c3 ret
00000670 <pipe>:
SYSCALL(pipe)
670: b8 04 00 00 00 mov $0x4,%eax
675: cd 40 int $0x40
677: c3 ret
00000678 <read>:
SYSCALL(read)
678: b8 05 00 00 00 mov $0x5,%eax
67d: cd 40 int $0x40
67f: c3 ret
00000680 <write>:
SYSCALL(write)
680: b8 10 00 00 00 mov $0x10,%eax
685: cd 40 int $0x40
687: c3 ret
00000688 <close>:
SYSCALL(close)
688: b8 15 00 00 00 mov $0x15,%eax
68d: cd 40 int $0x40
68f: c3 ret
00000690 <kill>:
SYSCALL(kill)
690: b8 06 00 00 00 mov $0x6,%eax
695: cd 40 int $0x40
697: c3 ret
00000698 <exec>:
SYSCALL(exec)
698: b8 07 00 00 00 mov $0x7,%eax
69d: cd 40 int $0x40
69f: c3 ret
000006a0 <open>:
SYSCALL(open)
6a0: b8 0f 00 00 00 mov $0xf,%eax
6a5: cd 40 int $0x40
6a7: c3 ret
000006a8 <mknod>:
SYSCALL(mknod)
6a8: b8 11 00 00 00 mov $0x11,%eax
6ad: cd 40 int $0x40
6af: c3 ret
000006b0 <unlink>:
SYSCALL(unlink)
6b0: b8 12 00 00 00 mov $0x12,%eax
6b5: cd 40 int $0x40
6b7: c3 ret
000006b8 <fstat>:
SYSCALL(fstat)
6b8: b8 08 00 00 00 mov $0x8,%eax
6bd: cd 40 int $0x40
6bf: c3 ret
000006c0 <link>:
SYSCALL(link)
6c0: b8 13 00 00 00 mov $0x13,%eax
6c5: cd 40 int $0x40
6c7: c3 ret
000006c8 <mkdir>:
SYSCALL(mkdir)
6c8: b8 14 00 00 00 mov $0x14,%eax
6cd: cd 40 int $0x40
6cf: c3 ret
000006d0 <chdir>:
SYSCALL(chdir)
6d0: b8 09 00 00 00 mov $0x9,%eax
6d5: cd 40 int $0x40
6d7: c3 ret
000006d8 <dup>:
SYSCALL(dup)
6d8: b8 0a 00 00 00 mov $0xa,%eax
6dd: cd 40 int $0x40
6df: c3 ret
000006e0 <getpid>:
SYSCALL(getpid)
6e0: b8 0b 00 00 00 mov $0xb,%eax
6e5: cd 40 int $0x40
6e7: c3 ret
000006e8 <sbrk>:
SYSCALL(sbrk)
6e8: b8 0c 00 00 00 mov $0xc,%eax
6ed: cd 40 int $0x40
6ef: c3 ret
000006f0 <sleep>:
SYSCALL(sleep)
6f0: b8 0d 00 00 00 mov $0xd,%eax
6f5: cd 40 int $0x40
6f7: c3 ret
000006f8 <uptime>:
SYSCALL(uptime)
6f8: b8 0e 00 00 00 mov $0xe,%eax
6fd: cd 40 int $0x40
6ff: c3 ret
00000700 <halt>:
SYSCALL(halt)
700: b8 16 00 00 00 mov $0x16,%eax
705: cd 40 int $0x40
707: c3 ret
00000708 <date>:
SYSCALL(date)
708: b8 17 00 00 00 mov $0x17,%eax
70d: cd 40 int $0x40
70f: c3 ret
00000710 <getuid>:
SYSCALL(getuid)
710: b8 18 00 00 00 mov $0x18,%eax
715: cd 40 int $0x40
717: c3 ret
00000718 <getgid>:
SYSCALL(getgid)
718: b8 19 00 00 00 mov $0x19,%eax
71d: cd 40 int $0x40
71f: c3 ret
00000720 <getppid>:
SYSCALL(getppid)
720: b8 1a 00 00 00 mov $0x1a,%eax
725: cd 40 int $0x40
727: c3 ret
00000728 <setuid>:
SYSCALL(setuid)
728: b8 1b 00 00 00 mov $0x1b,%eax
72d: cd 40 int $0x40
72f: c3 ret
00000730 <setgid>:
SYSCALL(setgid)
730: b8 1c 00 00 00 mov $0x1c,%eax
735: cd 40 int $0x40
737: c3 ret
00000738 <getprocs>:
SYSCALL(getprocs)
738: b8 1d 00 00 00 mov $0x1d,%eax
73d: cd 40 int $0x40
73f: c3 ret
00000740 <setpriority>:
SYSCALL(setpriority)
740: b8 1e 00 00 00 mov $0x1e,%eax
745: cd 40 int $0x40
747: c3 ret
00000748 <chmod>:
SYSCALL(chmod)
748: b8 1f 00 00 00 mov $0x1f,%eax
74d: cd 40 int $0x40
74f: c3 ret
00000750 <chown>:
SYSCALL(chown)
750: b8 20 00 00 00 mov $0x20,%eax
755: cd 40 int $0x40
757: c3 ret
00000758 <chgrp>:
SYSCALL(chgrp)
758: b8 21 00 00 00 mov $0x21,%eax
75d: cd 40 int $0x40
75f: c3 ret
00000760 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
760: 55 push %ebp
761: 89 e5 mov %esp,%ebp
763: 83 ec 18 sub $0x18,%esp
766: 8b 45 0c mov 0xc(%ebp),%eax
769: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
76c: 83 ec 04 sub $0x4,%esp
76f: 6a 01 push $0x1
771: 8d 45 f4 lea -0xc(%ebp),%eax
774: 50 push %eax
775: ff 75 08 pushl 0x8(%ebp)
778: e8 03 ff ff ff call 680 <write>
77d: 83 c4 10 add $0x10,%esp
}
780: 90 nop
781: c9 leave
782: c3 ret
00000783 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
783: 55 push %ebp
784: 89 e5 mov %esp,%ebp
786: 53 push %ebx
787: 83 ec 24 sub $0x24,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
78a: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
791: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
795: 74 17 je 7ae <printint+0x2b>
797: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
79b: 79 11 jns 7ae <printint+0x2b>
neg = 1;
79d: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
7a4: 8b 45 0c mov 0xc(%ebp),%eax
7a7: f7 d8 neg %eax
7a9: 89 45 ec mov %eax,-0x14(%ebp)
7ac: eb 06 jmp 7b4 <printint+0x31>
} else {
x = xx;
7ae: 8b 45 0c mov 0xc(%ebp),%eax
7b1: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
7b4: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
7bb: 8b 4d f4 mov -0xc(%ebp),%ecx
7be: 8d 41 01 lea 0x1(%ecx),%eax
7c1: 89 45 f4 mov %eax,-0xc(%ebp)
7c4: 8b 5d 10 mov 0x10(%ebp),%ebx
7c7: 8b 45 ec mov -0x14(%ebp),%eax
7ca: ba 00 00 00 00 mov $0x0,%edx
7cf: f7 f3 div %ebx
7d1: 89 d0 mov %edx,%eax
7d3: 0f b6 80 1c 0f 00 00 movzbl 0xf1c(%eax),%eax
7da: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
7de: 8b 5d 10 mov 0x10(%ebp),%ebx
7e1: 8b 45 ec mov -0x14(%ebp),%eax
7e4: ba 00 00 00 00 mov $0x0,%edx
7e9: f7 f3 div %ebx
7eb: 89 45 ec mov %eax,-0x14(%ebp)
7ee: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
7f2: 75 c7 jne 7bb <printint+0x38>
if(neg)
7f4: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
7f8: 74 2d je 827 <printint+0xa4>
buf[i++] = '-';
7fa: 8b 45 f4 mov -0xc(%ebp),%eax
7fd: 8d 50 01 lea 0x1(%eax),%edx
800: 89 55 f4 mov %edx,-0xc(%ebp)
803: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
808: eb 1d jmp 827 <printint+0xa4>
putc(fd, buf[i]);
80a: 8d 55 dc lea -0x24(%ebp),%edx
80d: 8b 45 f4 mov -0xc(%ebp),%eax
810: 01 d0 add %edx,%eax
812: 0f b6 00 movzbl (%eax),%eax
815: 0f be c0 movsbl %al,%eax
818: 83 ec 08 sub $0x8,%esp
81b: 50 push %eax
81c: ff 75 08 pushl 0x8(%ebp)
81f: e8 3c ff ff ff call 760 <putc>
824: 83 c4 10 add $0x10,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
827: 83 6d f4 01 subl $0x1,-0xc(%ebp)
82b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
82f: 79 d9 jns 80a <printint+0x87>
putc(fd, buf[i]);
}
831: 90 nop
832: 8b 5d fc mov -0x4(%ebp),%ebx
835: c9 leave
836: c3 ret
00000837 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
837: 55 push %ebp
838: 89 e5 mov %esp,%ebp
83a: 83 ec 28 sub $0x28,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
83d: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
844: 8d 45 0c lea 0xc(%ebp),%eax
847: 83 c0 04 add $0x4,%eax
84a: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
84d: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
854: e9 59 01 00 00 jmp 9b2 <printf+0x17b>
c = fmt[i] & 0xff;
859: 8b 55 0c mov 0xc(%ebp),%edx
85c: 8b 45 f0 mov -0x10(%ebp),%eax
85f: 01 d0 add %edx,%eax
861: 0f b6 00 movzbl (%eax),%eax
864: 0f be c0 movsbl %al,%eax
867: 25 ff 00 00 00 and $0xff,%eax
86c: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
86f: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
873: 75 2c jne 8a1 <printf+0x6a>
if(c == '%'){
875: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
879: 75 0c jne 887 <printf+0x50>
state = '%';
87b: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
882: e9 27 01 00 00 jmp 9ae <printf+0x177>
} else {
putc(fd, c);
887: 8b 45 e4 mov -0x1c(%ebp),%eax
88a: 0f be c0 movsbl %al,%eax
88d: 83 ec 08 sub $0x8,%esp
890: 50 push %eax
891: ff 75 08 pushl 0x8(%ebp)
894: e8 c7 fe ff ff call 760 <putc>
899: 83 c4 10 add $0x10,%esp
89c: e9 0d 01 00 00 jmp 9ae <printf+0x177>
}
} else if(state == '%'){
8a1: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
8a5: 0f 85 03 01 00 00 jne 9ae <printf+0x177>
if(c == 'd'){
8ab: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
8af: 75 1e jne 8cf <printf+0x98>
printint(fd, *ap, 10, 1);
8b1: 8b 45 e8 mov -0x18(%ebp),%eax
8b4: 8b 00 mov (%eax),%eax
8b6: 6a 01 push $0x1
8b8: 6a 0a push $0xa
8ba: 50 push %eax
8bb: ff 75 08 pushl 0x8(%ebp)
8be: e8 c0 fe ff ff call 783 <printint>
8c3: 83 c4 10 add $0x10,%esp
ap++;
8c6: 83 45 e8 04 addl $0x4,-0x18(%ebp)
8ca: e9 d8 00 00 00 jmp 9a7 <printf+0x170>
} else if(c == 'x' || c == 'p'){
8cf: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
8d3: 74 06 je 8db <printf+0xa4>
8d5: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
8d9: 75 1e jne 8f9 <printf+0xc2>
printint(fd, *ap, 16, 0);
8db: 8b 45 e8 mov -0x18(%ebp),%eax
8de: 8b 00 mov (%eax),%eax
8e0: 6a 00 push $0x0
8e2: 6a 10 push $0x10
8e4: 50 push %eax
8e5: ff 75 08 pushl 0x8(%ebp)
8e8: e8 96 fe ff ff call 783 <printint>
8ed: 83 c4 10 add $0x10,%esp
ap++;
8f0: 83 45 e8 04 addl $0x4,-0x18(%ebp)
8f4: e9 ae 00 00 00 jmp 9a7 <printf+0x170>
} else if(c == 's'){
8f9: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
8fd: 75 43 jne 942 <printf+0x10b>
s = (char*)*ap;
8ff: 8b 45 e8 mov -0x18(%ebp),%eax
902: 8b 00 mov (%eax),%eax
904: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
907: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
90b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
90f: 75 25 jne 936 <printf+0xff>
s = "(null)";
911: c7 45 f4 26 0c 00 00 movl $0xc26,-0xc(%ebp)
while(*s != 0){
918: eb 1c jmp 936 <printf+0xff>
putc(fd, *s);
91a: 8b 45 f4 mov -0xc(%ebp),%eax
91d: 0f b6 00 movzbl (%eax),%eax
920: 0f be c0 movsbl %al,%eax
923: 83 ec 08 sub $0x8,%esp
926: 50 push %eax
927: ff 75 08 pushl 0x8(%ebp)
92a: e8 31 fe ff ff call 760 <putc>
92f: 83 c4 10 add $0x10,%esp
s++;
932: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
936: 8b 45 f4 mov -0xc(%ebp),%eax
939: 0f b6 00 movzbl (%eax),%eax
93c: 84 c0 test %al,%al
93e: 75 da jne 91a <printf+0xe3>
940: eb 65 jmp 9a7 <printf+0x170>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
942: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
946: 75 1d jne 965 <printf+0x12e>
putc(fd, *ap);
948: 8b 45 e8 mov -0x18(%ebp),%eax
94b: 8b 00 mov (%eax),%eax
94d: 0f be c0 movsbl %al,%eax
950: 83 ec 08 sub $0x8,%esp
953: 50 push %eax
954: ff 75 08 pushl 0x8(%ebp)
957: e8 04 fe ff ff call 760 <putc>
95c: 83 c4 10 add $0x10,%esp
ap++;
95f: 83 45 e8 04 addl $0x4,-0x18(%ebp)
963: eb 42 jmp 9a7 <printf+0x170>
} else if(c == '%'){
965: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
969: 75 17 jne 982 <printf+0x14b>
putc(fd, c);
96b: 8b 45 e4 mov -0x1c(%ebp),%eax
96e: 0f be c0 movsbl %al,%eax
971: 83 ec 08 sub $0x8,%esp
974: 50 push %eax
975: ff 75 08 pushl 0x8(%ebp)
978: e8 e3 fd ff ff call 760 <putc>
97d: 83 c4 10 add $0x10,%esp
980: eb 25 jmp 9a7 <printf+0x170>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
982: 83 ec 08 sub $0x8,%esp
985: 6a 25 push $0x25
987: ff 75 08 pushl 0x8(%ebp)
98a: e8 d1 fd ff ff call 760 <putc>
98f: 83 c4 10 add $0x10,%esp
putc(fd, c);
992: 8b 45 e4 mov -0x1c(%ebp),%eax
995: 0f be c0 movsbl %al,%eax
998: 83 ec 08 sub $0x8,%esp
99b: 50 push %eax
99c: ff 75 08 pushl 0x8(%ebp)
99f: e8 bc fd ff ff call 760 <putc>
9a4: 83 c4 10 add $0x10,%esp
}
state = 0;
9a7: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
9ae: 83 45 f0 01 addl $0x1,-0x10(%ebp)
9b2: 8b 55 0c mov 0xc(%ebp),%edx
9b5: 8b 45 f0 mov -0x10(%ebp),%eax
9b8: 01 d0 add %edx,%eax
9ba: 0f b6 00 movzbl (%eax),%eax
9bd: 84 c0 test %al,%al
9bf: 0f 85 94 fe ff ff jne 859 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
9c5: 90 nop
9c6: c9 leave
9c7: c3 ret
000009c8 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
9c8: 55 push %ebp
9c9: 89 e5 mov %esp,%ebp
9cb: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
9ce: 8b 45 08 mov 0x8(%ebp),%eax
9d1: 83 e8 08 sub $0x8,%eax
9d4: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
9d7: a1 48 0f 00 00 mov 0xf48,%eax
9dc: 89 45 fc mov %eax,-0x4(%ebp)
9df: eb 24 jmp a05 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
9e1: 8b 45 fc mov -0x4(%ebp),%eax
9e4: 8b 00 mov (%eax),%eax
9e6: 3b 45 fc cmp -0x4(%ebp),%eax
9e9: 77 12 ja 9fd <free+0x35>
9eb: 8b 45 f8 mov -0x8(%ebp),%eax
9ee: 3b 45 fc cmp -0x4(%ebp),%eax
9f1: 77 24 ja a17 <free+0x4f>
9f3: 8b 45 fc mov -0x4(%ebp),%eax
9f6: 8b 00 mov (%eax),%eax
9f8: 3b 45 f8 cmp -0x8(%ebp),%eax
9fb: 77 1a ja a17 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
9fd: 8b 45 fc mov -0x4(%ebp),%eax
a00: 8b 00 mov (%eax),%eax
a02: 89 45 fc mov %eax,-0x4(%ebp)
a05: 8b 45 f8 mov -0x8(%ebp),%eax
a08: 3b 45 fc cmp -0x4(%ebp),%eax
a0b: 76 d4 jbe 9e1 <free+0x19>
a0d: 8b 45 fc mov -0x4(%ebp),%eax
a10: 8b 00 mov (%eax),%eax
a12: 3b 45 f8 cmp -0x8(%ebp),%eax
a15: 76 ca jbe 9e1 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
a17: 8b 45 f8 mov -0x8(%ebp),%eax
a1a: 8b 40 04 mov 0x4(%eax),%eax
a1d: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
a24: 8b 45 f8 mov -0x8(%ebp),%eax
a27: 01 c2 add %eax,%edx
a29: 8b 45 fc mov -0x4(%ebp),%eax
a2c: 8b 00 mov (%eax),%eax
a2e: 39 c2 cmp %eax,%edx
a30: 75 24 jne a56 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
a32: 8b 45 f8 mov -0x8(%ebp),%eax
a35: 8b 50 04 mov 0x4(%eax),%edx
a38: 8b 45 fc mov -0x4(%ebp),%eax
a3b: 8b 00 mov (%eax),%eax
a3d: 8b 40 04 mov 0x4(%eax),%eax
a40: 01 c2 add %eax,%edx
a42: 8b 45 f8 mov -0x8(%ebp),%eax
a45: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
a48: 8b 45 fc mov -0x4(%ebp),%eax
a4b: 8b 00 mov (%eax),%eax
a4d: 8b 10 mov (%eax),%edx
a4f: 8b 45 f8 mov -0x8(%ebp),%eax
a52: 89 10 mov %edx,(%eax)
a54: eb 0a jmp a60 <free+0x98>
} else
bp->s.ptr = p->s.ptr;
a56: 8b 45 fc mov -0x4(%ebp),%eax
a59: 8b 10 mov (%eax),%edx
a5b: 8b 45 f8 mov -0x8(%ebp),%eax
a5e: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
a60: 8b 45 fc mov -0x4(%ebp),%eax
a63: 8b 40 04 mov 0x4(%eax),%eax
a66: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
a6d: 8b 45 fc mov -0x4(%ebp),%eax
a70: 01 d0 add %edx,%eax
a72: 3b 45 f8 cmp -0x8(%ebp),%eax
a75: 75 20 jne a97 <free+0xcf>
p->s.size += bp->s.size;
a77: 8b 45 fc mov -0x4(%ebp),%eax
a7a: 8b 50 04 mov 0x4(%eax),%edx
a7d: 8b 45 f8 mov -0x8(%ebp),%eax
a80: 8b 40 04 mov 0x4(%eax),%eax
a83: 01 c2 add %eax,%edx
a85: 8b 45 fc mov -0x4(%ebp),%eax
a88: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
a8b: 8b 45 f8 mov -0x8(%ebp),%eax
a8e: 8b 10 mov (%eax),%edx
a90: 8b 45 fc mov -0x4(%ebp),%eax
a93: 89 10 mov %edx,(%eax)
a95: eb 08 jmp a9f <free+0xd7>
} else
p->s.ptr = bp;
a97: 8b 45 fc mov -0x4(%ebp),%eax
a9a: 8b 55 f8 mov -0x8(%ebp),%edx
a9d: 89 10 mov %edx,(%eax)
freep = p;
a9f: 8b 45 fc mov -0x4(%ebp),%eax
aa2: a3 48 0f 00 00 mov %eax,0xf48
}
aa7: 90 nop
aa8: c9 leave
aa9: c3 ret
00000aaa <morecore>:
static Header*
morecore(uint nu)
{
aaa: 55 push %ebp
aab: 89 e5 mov %esp,%ebp
aad: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
if(nu < 4096)
ab0: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
ab7: 77 07 ja ac0 <morecore+0x16>
nu = 4096;
ab9: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
ac0: 8b 45 08 mov 0x8(%ebp),%eax
ac3: c1 e0 03 shl $0x3,%eax
ac6: 83 ec 0c sub $0xc,%esp
ac9: 50 push %eax
aca: e8 19 fc ff ff call 6e8 <sbrk>
acf: 83 c4 10 add $0x10,%esp
ad2: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
ad5: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
ad9: 75 07 jne ae2 <morecore+0x38>
return 0;
adb: b8 00 00 00 00 mov $0x0,%eax
ae0: eb 26 jmp b08 <morecore+0x5e>
hp = (Header*)p;
ae2: 8b 45 f4 mov -0xc(%ebp),%eax
ae5: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
ae8: 8b 45 f0 mov -0x10(%ebp),%eax
aeb: 8b 55 08 mov 0x8(%ebp),%edx
aee: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
af1: 8b 45 f0 mov -0x10(%ebp),%eax
af4: 83 c0 08 add $0x8,%eax
af7: 83 ec 0c sub $0xc,%esp
afa: 50 push %eax
afb: e8 c8 fe ff ff call 9c8 <free>
b00: 83 c4 10 add $0x10,%esp
return freep;
b03: a1 48 0f 00 00 mov 0xf48,%eax
}
b08: c9 leave
b09: c3 ret
00000b0a <malloc>:
void*
malloc(uint nbytes)
{
b0a: 55 push %ebp
b0b: 89 e5 mov %esp,%ebp
b0d: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
b10: 8b 45 08 mov 0x8(%ebp),%eax
b13: 83 c0 07 add $0x7,%eax
b16: c1 e8 03 shr $0x3,%eax
b19: 83 c0 01 add $0x1,%eax
b1c: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
b1f: a1 48 0f 00 00 mov 0xf48,%eax
b24: 89 45 f0 mov %eax,-0x10(%ebp)
b27: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
b2b: 75 23 jne b50 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
b2d: c7 45 f0 40 0f 00 00 movl $0xf40,-0x10(%ebp)
b34: 8b 45 f0 mov -0x10(%ebp),%eax
b37: a3 48 0f 00 00 mov %eax,0xf48
b3c: a1 48 0f 00 00 mov 0xf48,%eax
b41: a3 40 0f 00 00 mov %eax,0xf40
base.s.size = 0;
b46: c7 05 44 0f 00 00 00 movl $0x0,0xf44
b4d: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
b50: 8b 45 f0 mov -0x10(%ebp),%eax
b53: 8b 00 mov (%eax),%eax
b55: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
b58: 8b 45 f4 mov -0xc(%ebp),%eax
b5b: 8b 40 04 mov 0x4(%eax),%eax
b5e: 3b 45 ec cmp -0x14(%ebp),%eax
b61: 72 4d jb bb0 <malloc+0xa6>
if(p->s.size == nunits)
b63: 8b 45 f4 mov -0xc(%ebp),%eax
b66: 8b 40 04 mov 0x4(%eax),%eax
b69: 3b 45 ec cmp -0x14(%ebp),%eax
b6c: 75 0c jne b7a <malloc+0x70>
prevp->s.ptr = p->s.ptr;
b6e: 8b 45 f4 mov -0xc(%ebp),%eax
b71: 8b 10 mov (%eax),%edx
b73: 8b 45 f0 mov -0x10(%ebp),%eax
b76: 89 10 mov %edx,(%eax)
b78: eb 26 jmp ba0 <malloc+0x96>
else {
p->s.size -= nunits;
b7a: 8b 45 f4 mov -0xc(%ebp),%eax
b7d: 8b 40 04 mov 0x4(%eax),%eax
b80: 2b 45 ec sub -0x14(%ebp),%eax
b83: 89 c2 mov %eax,%edx
b85: 8b 45 f4 mov -0xc(%ebp),%eax
b88: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
b8b: 8b 45 f4 mov -0xc(%ebp),%eax
b8e: 8b 40 04 mov 0x4(%eax),%eax
b91: c1 e0 03 shl $0x3,%eax
b94: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
b97: 8b 45 f4 mov -0xc(%ebp),%eax
b9a: 8b 55 ec mov -0x14(%ebp),%edx
b9d: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
ba0: 8b 45 f0 mov -0x10(%ebp),%eax
ba3: a3 48 0f 00 00 mov %eax,0xf48
return (void*)(p + 1);
ba8: 8b 45 f4 mov -0xc(%ebp),%eax
bab: 83 c0 08 add $0x8,%eax
bae: eb 3b jmp beb <malloc+0xe1>
}
if(p == freep)
bb0: a1 48 0f 00 00 mov 0xf48,%eax
bb5: 39 45 f4 cmp %eax,-0xc(%ebp)
bb8: 75 1e jne bd8 <malloc+0xce>
if((p = morecore(nunits)) == 0)
bba: 83 ec 0c sub $0xc,%esp
bbd: ff 75 ec pushl -0x14(%ebp)
bc0: e8 e5 fe ff ff call aaa <morecore>
bc5: 83 c4 10 add $0x10,%esp
bc8: 89 45 f4 mov %eax,-0xc(%ebp)
bcb: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
bcf: 75 07 jne bd8 <malloc+0xce>
return 0;
bd1: b8 00 00 00 00 mov $0x0,%eax
bd6: eb 13 jmp beb <malloc+0xe1>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
bd8: 8b 45 f4 mov -0xc(%ebp),%eax
bdb: 89 45 f0 mov %eax,-0x10(%ebp)
bde: 8b 45 f4 mov -0xc(%ebp),%eax
be1: 8b 00 mov (%eax),%eax
be3: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
be6: e9 6d ff ff ff jmp b58 <malloc+0x4e>
}
beb: c9 leave
bec: c3 ret
|
src/bases.ads | thindil/steamsky | 80 | 6033 | <filename>src/bases.ads
-- Copyright 2016-2021 <NAME>
--
-- This file is part of Steam Sky.
--
-- Steam Sky is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- Steam Sky is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>.
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Containers.Vectors; use Ada.Containers;
with Ada.Containers.Indefinite_Vectors;
with Game; use Game;
with Crew; use Crew;
with Factions; use Factions;
with Items; use Items;
with Missions; use Missions;
with Ships; use Ships;
-- ****h* Bases/Bases
-- FUNCTION
-- Provide code for manipulate sky bases
-- SOURCE
package Bases is
-- ****
-- ****s* Bases/Bases.Recruit_Data
-- FUNCTION
-- Data structure for recruits
-- PARAMETERS
-- Name - Name of recruit
-- Gender - Gender of recruit
-- Skills - Names indexes, levels and experience in skills of recruit
-- Cost - Cost of enlist of recruit
-- Attributes - Names indexes, levels and experience in attributes of
-- recruit
-- Inventory - Owned items by recruit
-- Equipment - Items indexes from inventory used by recruit: 1 - weapon,
-- 2 - shield, 3 - helmet, 4 - torso, 5 - arms, 6 - legs,
-- 7 - tool
-- Payment - How much money recruit will take as payment each day.
-- Home_Base - Index of base from which recruit is
-- Faction - Index of faction to which recruit belongs
-- SOURCE
type Recruit_Data is new Mob_Record with record
Name: Unbounded_String;
Gender: Character;
Price: Positive;
Inventory: UnboundedString_Container.Vector;
Equipment: Equipment_Array;
Payment: Positive;
Home_Base: Bases_Range;
Faction: Unbounded_String;
end record;
-- ****
-- ****t* Bases/Bases.Recruit_Container
-- FUNCTION
-- Used to store sky bases recruits data
-- SOURCE
package Recruit_Container is new Indefinite_Vectors
(Index_Type => Positive, Element_Type => Recruit_Data);
-- ****
-- ****s* Bases/Bases.Base_Cargo
-- FUNCTION
-- Data structure for bases cargo
-- PARAMETERS
-- Proto_Index - Index of item prototype
-- Amount - Amount of items
-- Durability - Durability of items
-- Price - Current price of item
-- SOURCE
type Base_Cargo is record
Proto_Index: Unbounded_String;
Amount: Natural;
Durability: Items_Durability;
Price: Natural;
end record;
-- ****
-- ****t* Bases/Bases.BaseCargo_Container
-- FUNCTION
-- Used to store sky bases cargos
-- SOURCE
package BaseCargo_Container is new Vectors
(Index_Type => Positive, Element_Type => Base_Cargo);
-- ****
-- ****t* Bases/Bases.Bases_Size
-- FUNCTION
-- Bases sizes
-- SOURCE
type Bases_Size is (SMALL, MEDIUM, BIG, UNKNOWN) with
Default_Value => MEDIUM;
-- ****
-- ****s* Bases/Bases.Base_Record
-- FUNCTION
-- Data structure for bases
-- PARAMETERS
-- Name - Base name
-- Visited - Time when player last visited base
-- Sky_X - X coordinate on sky map
-- Sky_Y - Y coordinate on sky map
-- Base_Type - Type of base
-- Population - Amount of people in base
-- Recruit_Date - Time when recruits was generated
-- Recruits - List of available recruits
-- Known - Did base is know to player
-- Asked_For_Bases - Did player asked for bases in this base
-- Asked_For_Events - Time when players asked for events in this base
-- Reputation - Reputation level and progress of player
-- Missions_Date - Time when missions was generated
-- Missions - List of available missions
-- Owner - Index of faction which own base
-- Cargo - List of all cargo in base
-- Size - Size of base
-- SOURCE
type Base_Record is record
Name: Unbounded_String;
Visited: Date_Record;
Sky_X: Map_X_Range;
Sky_Y: Map_Y_Range;
Base_Type: Unbounded_String;
Population: Natural;
Recruit_Date: Date_Record;
Recruits: Recruit_Container.Vector;
Known: Boolean;
Asked_For_Bases: Boolean;
Asked_For_Events: Date_Record;
Reputation: Reputation_Array;
Missions_Date: Date_Record;
Missions: Mission_Container.Vector;
Owner: Unbounded_String;
Cargo: BaseCargo_Container.Vector;
Size: Bases_Size;
end record;
-- ****
-- ****v* Bases/Bases.SkyBases
-- FUNCTION
-- List of sky bases
-- SOURCE
Sky_Bases: array(Bases_Range) of Base_Record;
-- ****
-- ****v* Bases/Bases.Base_Syllables_Pre
-- FUNCTION
-- List of pre syllables for generating bases names
-- SOURCE
Base_Syllables_Pre: UnboundedString_Container.Vector;
-- ****
-- ****v* Bases/Bases.Base_Syllables_Start
-- FUNCTION
-- List of first syllables for generating bases names
-- SOURCE
Base_Syllables_Start: UnboundedString_Container.Vector;
-- ****
-- ****v* Bases/Bases.Base_Syllables_End
-- FUNCTION
-- List of second syllables for generating bases names
-- SOURCE
Base_Syllables_End: UnboundedString_Container.Vector;
-- ****
-- ****v* Bases/Bases.Base_Syllables_Post
-- FUNCTION
-- List of post syllables for generating bases names
-- SOURCE
Base_Syllables_Post: UnboundedString_Container.Vector;
-- ****
-- ****f* Bases/Bases.Gain_Rep
-- FUNCTION
-- Gain reputation in selected base
-- PARAMETERS
-- Base_Index - Index of the base in which player gained or lose reputation
-- Points - Amount of reputation points to gain or lose
-- SOURCE
procedure Gain_Rep(Base_Index: Bases_Range; Points: Integer) with
Test_Case => (Name => "Test_GainRep", Mode => Robustness);
-- ****
-- ****f* Bases/Bases.Count_Price
-- FUNCTION
-- Count price for actions with bases (buying/selling/docking/ect)
-- PARAMETERS
-- Price - Cost of action with the base
-- Trader_Index - Index of crew member assigned as trader or 0 if noone is
-- assigned
-- Reduce - If true, reduce cost of action, otherwise raise. Default
-- is true
-- RESULT
-- Parameter Cost
-- SOURCE
procedure Count_Price
(Price: in out Natural; Trader_Index: Crew_Container.Extended_Index;
Reduce: Boolean := True) with
Pre => Trader_Index <= Player_Ship.Crew.Last_Index,
Test_Case => (Name => "Test_CountPrice", Mode => Nominal);
-- ****
-- ****f* Bases/Bases.Generate_Base_Name
-- FUNCTION
-- Generate random name for base based on faction
-- PARAMETERS
-- Faction_Index - Index of faction to which base belong
-- RESULT
-- Random name for the sky base
-- SOURCE
function Generate_Base_Name
(Faction_Index: Unbounded_String) return Unbounded_String with
Pre => Factions_Container.Contains
(Container => Factions_List, Key => Faction_Index),
Post => Length(Source => Generate_Base_Name'Result) > 0,
Test_Case => (Name => "Test_GenerateBaseName", Mode => Nominal);
-- ****
-- ****f* Bases/Bases.Generate_Recruits
-- FUNCTION
-- Generate if needed new recruits in base
-- SOURCE
procedure Generate_Recruits with
Test_Case => (Name => "Test_GenerateRecruits", Mode => Robustness);
-- ****
-- ****f* Bases/Bases.Ask_For_Bases
-- FUNCTION
-- Ask in base for direction for other bases
-- SOURCE
procedure Ask_For_Bases with
Test_Case => (Name => "Test_AskForBases", Mode => Robustness);
-- ****
-- ****f* Bases/Bases.Ask_For_Events
-- FUNCTION
-- Ask in base for direction for random events
-- SOURCE
procedure Ask_For_Events with
Test_Case => (Name => "Test_AskForEvents", Mode => Robustness);
-- ****
-- ****f* Bases/Bases.Update_Population
-- FUNCTION
-- Update base population if needed
-- SOURCE
procedure Update_Population with
Test_Case => (Name => "Test_UpdatePopulation", Mode => Robustness);
-- ****
-- ****f* Bases/Bases.Update_Prices
-- FUNCTION
-- Random changes of items prices in base
-- SOURCE
procedure Update_Prices with
Test_Case => (Name => "Test_UpdatePrices", Mode => Robustness);
-- ****
end Bases;
|
out/Prod/Syntax.agda | JoeyEremondi/agda-soas | 39 | 4977 | <filename>out/Prod/Syntax.agda
{-
This second-order term syntax was created from the following second-order syntax description:
syntax Prod | P
type
_⊗_ : 2-ary | l40
term
pair : α β -> α ⊗ β | ⟨_,_⟩
fst : α ⊗ β -> α
snd : α ⊗ β -> β
theory
(fβ) a : α b : β |> fst (pair(a, b)) = a
(sβ) a : α b : β |> snd (pair(a, b)) = b
(pη) p : α ⊗ β |> pair (fst(p), snd(p)) = p
-}
module Prod.Syntax where
open import SOAS.Common
open import SOAS.Context
open import SOAS.Variable
open import SOAS.Families.Core
open import SOAS.Construction.Structure
open import SOAS.ContextMaps.Inductive
open import SOAS.Metatheory.Syntax
open import Prod.Signature
private
variable
Γ Δ Π : Ctx
α β : PT
𝔛 : Familyₛ
-- Inductive term declaration
module P:Terms (𝔛 : Familyₛ) where
data P : Familyₛ where
var : ℐ ⇾̣ P
mvar : 𝔛 α Π → Sub P Π Γ → P α Γ
⟨_,_⟩ : P α Γ → P β Γ → P (α ⊗ β) Γ
fst : P (α ⊗ β) Γ → P α Γ
snd : P (α ⊗ β) Γ → P β Γ
open import SOAS.Metatheory.MetaAlgebra ⅀F 𝔛
Pᵃ : MetaAlg P
Pᵃ = record
{ 𝑎𝑙𝑔 = λ where
(pairₒ ⋮ a , b) → ⟨_,_⟩ a b
(fstₒ ⋮ a) → fst a
(sndₒ ⋮ a) → snd a
; 𝑣𝑎𝑟 = var ; 𝑚𝑣𝑎𝑟 = λ 𝔪 mε → mvar 𝔪 (tabulate mε) }
module Pᵃ = MetaAlg Pᵃ
module _ {𝒜 : Familyₛ}(𝒜ᵃ : MetaAlg 𝒜) where
open MetaAlg 𝒜ᵃ
𝕤𝕖𝕞 : P ⇾̣ 𝒜
𝕊 : Sub P Π Γ → Π ~[ 𝒜 ]↝ Γ
𝕊 (t ◂ σ) new = 𝕤𝕖𝕞 t
𝕊 (t ◂ σ) (old v) = 𝕊 σ v
𝕤𝕖𝕞 (mvar 𝔪 mε) = 𝑚𝑣𝑎𝑟 𝔪 (𝕊 mε)
𝕤𝕖𝕞 (var v) = 𝑣𝑎𝑟 v
𝕤𝕖𝕞 (⟨_,_⟩ a b) = 𝑎𝑙𝑔 (pairₒ ⋮ 𝕤𝕖𝕞 a , 𝕤𝕖𝕞 b)
𝕤𝕖𝕞 (fst a) = 𝑎𝑙𝑔 (fstₒ ⋮ 𝕤𝕖𝕞 a)
𝕤𝕖𝕞 (snd a) = 𝑎𝑙𝑔 (sndₒ ⋮ 𝕤𝕖𝕞 a)
𝕤𝕖𝕞ᵃ⇒ : MetaAlg⇒ Pᵃ 𝒜ᵃ 𝕤𝕖𝕞
𝕤𝕖𝕞ᵃ⇒ = record
{ ⟨𝑎𝑙𝑔⟩ = λ{ {t = t} → ⟨𝑎𝑙𝑔⟩ t }
; ⟨𝑣𝑎𝑟⟩ = refl
; ⟨𝑚𝑣𝑎𝑟⟩ = λ{ {𝔪 = 𝔪}{mε} → cong (𝑚𝑣𝑎𝑟 𝔪) (dext (𝕊-tab mε)) } }
where
open ≡-Reasoning
⟨𝑎𝑙𝑔⟩ : (t : ⅀ P α Γ) → 𝕤𝕖𝕞 (Pᵃ.𝑎𝑙𝑔 t) ≡ 𝑎𝑙𝑔 (⅀₁ 𝕤𝕖𝕞 t)
⟨𝑎𝑙𝑔⟩ (pairₒ ⋮ _) = refl
⟨𝑎𝑙𝑔⟩ (fstₒ ⋮ _) = refl
⟨𝑎𝑙𝑔⟩ (sndₒ ⋮ _) = refl
𝕊-tab : (mε : Π ~[ P ]↝ Γ)(v : ℐ α Π) → 𝕊 (tabulate mε) v ≡ 𝕤𝕖𝕞 (mε v)
𝕊-tab mε new = refl
𝕊-tab mε (old v) = 𝕊-tab (mε ∘ old) v
module _ (g : P ⇾̣ 𝒜)(gᵃ⇒ : MetaAlg⇒ Pᵃ 𝒜ᵃ g) where
open MetaAlg⇒ gᵃ⇒
𝕤𝕖𝕞! : (t : P α Γ) → 𝕤𝕖𝕞 t ≡ g t
𝕊-ix : (mε : Sub P Π Γ)(v : ℐ α Π) → 𝕊 mε v ≡ g (index mε v)
𝕊-ix (x ◂ mε) new = 𝕤𝕖𝕞! x
𝕊-ix (x ◂ mε) (old v) = 𝕊-ix mε v
𝕤𝕖𝕞! (mvar 𝔪 mε) rewrite cong (𝑚𝑣𝑎𝑟 𝔪) (dext (𝕊-ix mε))
= trans (sym ⟨𝑚𝑣𝑎𝑟⟩) (cong (g ∘ mvar 𝔪) (tab∘ix≈id mε))
𝕤𝕖𝕞! (var v) = sym ⟨𝑣𝑎𝑟⟩
𝕤𝕖𝕞! (⟨_,_⟩ a b) rewrite 𝕤𝕖𝕞! a | 𝕤𝕖𝕞! b = sym ⟨𝑎𝑙𝑔⟩
𝕤𝕖𝕞! (fst a) rewrite 𝕤𝕖𝕞! a = sym ⟨𝑎𝑙𝑔⟩
𝕤𝕖𝕞! (snd a) rewrite 𝕤𝕖𝕞! a = sym ⟨𝑎𝑙𝑔⟩
-- Syntax instance for the signature
P:Syn : Syntax
P:Syn = record
{ ⅀F = ⅀F
; ⅀:CS = ⅀:CompatStr
; mvarᵢ = P:Terms.mvar
; 𝕋:Init = λ 𝔛 → let open P:Terms 𝔛 in record
{ ⊥ = P ⋉ Pᵃ
; ⊥-is-initial = record { ! = λ{ {𝒜 ⋉ 𝒜ᵃ} → 𝕤𝕖𝕞 𝒜ᵃ ⋉ 𝕤𝕖𝕞ᵃ⇒ 𝒜ᵃ }
; !-unique = λ{ {𝒜 ⋉ 𝒜ᵃ} (f ⋉ fᵃ⇒) {x = t} → 𝕤𝕖𝕞! 𝒜ᵃ f fᵃ⇒ t } } } }
-- Instantiation of the syntax and metatheory
open Syntax P:Syn public
open P:Terms public
open import SOAS.Families.Build public
open import SOAS.Syntax.Shorthands Pᵃ public
open import SOAS.Metatheory P:Syn public
|
oeis/105/A105042.asm | neoneye/loda-programs | 11 | 22075 | ; A105042: Numbers n such that 10n - 1 is prime.
; Submitted by <NAME>
; 2,3,6,8,9,11,14,15,18,20,23,24,27,35,36,38,39,41,42,44,45,48,50,51,57,60,62,66,71,72,74,77,81,83,84,86,92,93,101,102,104,105,107,111,113,123,125,126,128,129,132,140,141,143,144,146,149,150,155,156,158,161,162,167,170,171,176,179,188,189,195,198,200,203,204,207,209,210,213,218,224,227,231,234,239,240,246,254,255,258,261,266,269,270,272,273,275,279,282,288
mov $2,36
mul $2,$0
mov $4,18
lpb $2
mov $3,$4
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
mov $1,$0
max $1,0
cmp $1,$0
mul $2,$1
sub $2,1
add $4,10
lpe
mov $0,$4
sub $0,16
div $0,10
add $0,2
|
examples/UnSized/Console.agda | agda/ooAgda | 23 | 8095 | <reponame>agda/ooAgda
module UnSized.Console where
open import UnSizedIO.Base hiding (main)
open import UnSizedIO.Console hiding (main)
open import NativeIO
{-# TERMINATING #-}
myProgram : IOConsole Unit
force myProgram = exec' getLine λ line →
delay (exec' (putStrLn line) λ _ →
delay (exec' (putStrLn line) λ _ →
myProgram
))
main : NativeIO Unit
main = translateIOConsole myProgram
|
source/required/s-caun16.ads | ytomino/drake | 33 | 6589 | <filename>source/required/s-caun16.ads
pragma License (Unrestricted);
-- implementation unit required by compiler
with System.Packed_Arrays;
package System.Compare_Array_Unsigned_16 is
pragma Preelaborate;
-- It can not be Pure, subprograms would become __attribute__((const)).
type Unsigned_16 is mod 2 ** 16;
for Unsigned_16'Size use 16;
for Unsigned_16'Alignment use 1;
package Ordering is new Packed_Arrays.Ordering (Unsigned_16);
-- required to compare arrays by compiler (s-caun16.ads)
function Compare_Array_U16 (
Left : Address;
Right : Address;
Left_Len : Natural;
Right_Len : Natural)
return Integer
renames Ordering.Compare;
end System.Compare_Array_Unsigned_16;
|
.emacs.d/elpa/ada-ref-man-2012.5/progs/arm_sub.ads | caqg/linux-home | 0 | 20818 | with ARM_Output;
with ARM_Index;
package ARM_Subindex is
--
-- Ada reference manual formatter (ARM_Form).
--
-- This package contains the database to store subindex items for
-- non-normative appendixes.
--
-- ---------------------------------------
-- Copyright 2005, 2011
-- AXE Consultants. All rights reserved.
-- P.O. Box 1512, Madison WI 53701
-- E-Mail: <EMAIL>
--
-- ARM_Form is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License version 3
-- as published by the Free Software Foundation.
--
-- AXE CONSULTANTS MAKES THIS TOOL AND SOURCE CODE AVAILABLE ON AN "AS IS"
-- BASIS AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE ACCURACY,
-- CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR FUNCTIONING OF THIS TOOL.
-- IN NO EVENT WILL AXE CONSULTANTS BE LIABLE FOR ANY GENERAL,
-- CONSEQUENTIAL, INDIRECT, INCIDENTAL, EXEMPLARY, OR SPECIAL DAMAGES,
-- EVEN IF AXE CONSULTANTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-- DAMAGES.
--
-- A copy of the GNU General Public License is available in the file
-- gpl-3-0.txt in the standard distribution of the ARM_Form tool.
-- Otherwise, see <http://www.gnu.org/licenses/>.
--
-- If the GPLv3 license is not satisfactory for your needs, a commercial
-- use license is available for this tool. Contact Randy at AXE Consultants
-- for more information.
--
-- ---------------------------------------
--
-- Edit History:
--
-- 10/28/05 - RLB - Created package.
-- 10/18/11 - RLB - Changed to GPLv3 license.
type Subindex_Type is tagged limited private;
Not_Valid_Error : exception;
procedure Create (Subindex_Object : in out Subindex_Type);
-- Initialize a Subindex object.
procedure Destroy (Subindex_Object : in out Subindex_Type);
-- Destroy a Subindex object, freeing any resources used.
type Subindex_Item_Kind_Type is (Top_Level, In_Unit,
Child_of_Parent, Subtype_In_Unit,
Description_In_Unit, Raised_Belonging_to_Unit);
procedure Insert (Subindex_Object : in out Subindex_Type;
Entity : in String;
From_Unit : in String := "";
Kind : in Subindex_Item_Kind_Type := Top_Level;
Clause : in String := "";
Paragraph : in String := "";
Key : in ARM_Index.Index_Key);
-- Insert an item into the Subindex object.
-- The Key must be one returned by ARM_Index.Add or ARM_Index.Get_Key.
-- Raises Not_Valid_Error if In_Unit, Clause, or Paragraph is not
-- empty when the kind does not use it.
procedure Write_Subindex (
Subindex_Object : in out Subindex_Type;
Output_Object : in out ARM_Output.Output_Type'Class;
Use_Paragraphs : in Boolean := True;
Minimize_Lines : in Boolean := False);
-- Generate the given subindex to Output_Object.
-- References include paragraph numbers if Use_Paragraphs is true.
-- Try to minimize lines if Minimize_Lines is True.
private
type Item;
type Item_List is access all Item;
type Subindex_Type is tagged limited record
Is_Valid : Boolean := False;
List : Item_List;
Item_Count : Natural;
end record;
end ARM_Subindex;
|
programs/oeis/040/A040055.asm | neoneye/loda | 22 | 102045 | ; A040055: Continued fraction for sqrt(63).
; 7,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1
mov $1,$0
cmp $0,0
sub $1,$0
gcd $1,2
add $1,5
add $0,$1
mul $0,$1
sub $0,35
|
alloy4fun_models/trashltl/models/4/om8hLues5RwQwfTHE.als | Kaixi26/org.alloytools.alloy | 0 | 1550 | open main
pred idom8hLues5RwQwfTHE_prop5 {
eventually some f:File | no f & File
}
pred __repair { idom8hLues5RwQwfTHE_prop5 }
check __repair { idom8hLues5RwQwfTHE_prop5 <=> prop5o } |
smash/shellcode_nz.nasm | phaser/smashing_the_stack | 1 | 4625 | <filename>smash/shellcode_nz.nasm
bits 64
section .text
global _start
_start:
nop
jmp jmp_call64
call_back64:
; execve
pop rsi
mov rax, 0xFFFFFFFFFFFFFFFF
sub rax, 0xFFFFFFFFFFFFFFC4
mov rdi, rsi ; *filename
xor rsi, rsi ; *argv
xor rdx, rdx ; *envp
syscall
; exit
xor rdi,rdi ; zero rdi (rdi hold return value)
mov rax, 0xFFFFFFFFFFFFFFFF ; set syscall number to 60 (0x3c hex)
sub rax, 0xFFFFFFFFFFFFFFC3
syscall ; call kernel
jmp_call64:
call call_back64
file db "/bin/sh",0
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1835.asm | ljhsiun2/medusa | 9 | 18349 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1835.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x1ad00, %rdx
nop
nop
nop
nop
nop
add $18439, %r14
and $0xffffffffffffffc0, %rdx
vmovaps (%rdx), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %r9
nop
nop
and %r8, %r8
lea addresses_D_ht+0x14800, %rax
nop
nop
nop
nop
xor $5234, %r12
and $0xffffffffffffffc0, %rax
movntdqa (%rax), %xmm3
vpextrq $0, %xmm3, %rdx
nop
nop
add $21511, %rax
lea addresses_WC_ht+0x7e0, %r12
nop
add %r14, %r14
mov $0x6162636465666768, %rax
movq %rax, %xmm5
movups %xmm5, (%r12)
nop
nop
nop
nop
nop
and %r12, %r12
lea addresses_UC_ht+0x3d00, %rsi
lea addresses_D_ht+0x8e80, %rdi
nop
nop
nop
nop
nop
cmp $6215, %rax
mov $118, %rcx
rep movsb
nop
nop
nop
mfence
lea addresses_D_ht+0x2ae0, %r9
nop
nop
nop
sub %rcx, %rcx
movups (%r9), %xmm7
vpextrq $0, %xmm7, %rdx
nop
nop
nop
nop
nop
xor $34155, %rcx
lea addresses_normal_ht+0xd300, %rsi
lea addresses_normal_ht+0x16940, %rdi
nop
nop
nop
cmp $34262, %r8
mov $71, %rcx
rep movsl
nop
nop
nop
cmp %rsi, %rsi
lea addresses_WC_ht+0x1a8fc, %rsi
lea addresses_WT_ht+0x5750, %rdi
nop
nop
nop
dec %r8
mov $39, %rcx
rep movsb
nop
nop
nop
nop
and %rax, %rax
lea addresses_WC_ht+0x13f10, %rsi
lea addresses_normal_ht+0x80d8, %rdi
nop
nop
nop
nop
cmp $56497, %r8
mov $70, %rcx
rep movsl
nop
nop
nop
and %rax, %rax
lea addresses_normal_ht+0x1d600, %rsi
lea addresses_UC_ht+0x3d00, %rdi
nop
inc %r12
mov $114, %rcx
rep movsb
nop
nop
nop
nop
sub $13272, %r14
lea addresses_normal_ht+0x300, %rdi
nop
nop
nop
and %r12, %r12
vmovups (%rdi), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %r14
nop
nop
nop
nop
nop
sub %r8, %r8
lea addresses_WC_ht+0xe480, %r12
sub %rdi, %rdi
mov $0x6162636465666768, %r14
movq %r14, (%r12)
xor $20276, %rdi
lea addresses_WC_ht+0x19900, %r14
nop
nop
nop
nop
cmp $25433, %rsi
movb $0x61, (%r14)
nop
nop
nop
sub $32299, %r9
lea addresses_WT_ht+0x1d262, %r14
nop
add $24066, %r12
movl $0x61626364, (%r14)
nop
nop
sub %r12, %r12
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_WT+0x15de0, %rsi
lea addresses_WT+0x15500, %rdi
clflush (%rdi)
nop
nop
cmp %r12, %r12
mov $96, %rcx
rep movsw
nop
add %rcx, %rcx
// Faulty Load
lea addresses_WC+0xdd00, %rbp
nop
nop
sub $49115, %r12
mov (%rbp), %rdi
lea oracles, %rsi
and $0xff, %rdi
shlq $12, %rdi
mov (%rsi,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT', 'congruent': 8, 'same': False}}
[Faulty Load]
{'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'AVXalign': True, 'size': 32, 'NT': True, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': True, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 3}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 3}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 1}}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
|
libsrc/_DEVELOPMENT/arch/zx/nirvanap/c/sdcc/NIRVANAP_paintC_callee.asm | teknoplop/z88dk | 0 | 240133 | ; ----------------------------------------------------------------
; Z88DK INTERFACE LIBRARY FOR NIRVANA+ ENGINE - by <NAME>
;
; See "nirvana+.h" for further details
; ----------------------------------------------------------------
; void NIRVANAP_paintC(unsigned char *attrs, unsigned int lin, unsigned int col)
; callee
SECTION code_clib
SECTION code_nirvanap
PUBLIC _NIRVANAP_paintC_callee
EXTERN asm_NIRVANAP_paintC
_NIRVANAP_paintC_callee:
pop hl ; RET address
pop bc ; attrs
pop de ; lin
ld d,e
ex (sp),hl ; col
ld e,l
jp asm_NIRVANAP_paintC
|
src/openapi-streams-forms.ads | mgrojo/swagger-ada | 0 | 2009 | -----------------------------------------------------------------------
-- openapi-streams-forms -- x-www-form-urlencoded streams
-- Copyright (C) 2018, 2022 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Streams;
with Util.Streams.Texts;
with Util.Serialize.IO;
package OpenAPI.Streams.Forms is
type Output_Stream is limited new Util.Serialize.IO.Output_Stream with private;
procedure Initialize (Stream : in out Output_Stream;
Buffer : in Util.Streams.Texts.Print_Stream_Access);
-- Flush the buffer (if any) to the sink.
overriding
procedure Flush (Stream : in out Output_Stream);
-- Close the sink.
overriding
procedure Close (Stream : in out Output_Stream);
-- Write the buffer array to the output stream.
overriding
procedure Write (Stream : in out Output_Stream;
Buffer : in Ada.Streams.Stream_Element_Array);
-- Start a document.
overriding
procedure Start_Document (Stream : in out Output_Stream) is null;
-- Finish a document.
overriding
procedure End_Document (Stream : in out Output_Stream) is null;
overriding
procedure Start_Entity (Stream : in out Output_Stream;
Name : in String) is null;
procedure End_Entity (Stream : in out Output_Stream;
Name : in String) is null;
-- Write the attribute name/value pair.
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in String);
overriding
procedure Write_Wide_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Wide_Wide_String);
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Integer);
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Boolean);
overriding
procedure Write_Attribute (Stream : in out Output_Stream;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Write the attribute with a null value.
overriding
procedure Write_Null_Attribute (Stream : in out Output_Stream;
Name : in String);
-- Write the entity value.
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in String);
overriding
procedure Write_Wide_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Wide_Wide_String);
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Boolean);
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Integer);
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Ada.Calendar.Time);
overriding
procedure Write_Long_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Long_Long_Integer);
overriding
procedure Write_Enum_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in String);
overriding
procedure Write_Entity (Stream : in out Output_Stream;
Name : in String;
Value : in Util.Beans.Objects.Object);
-- Write an entity with a null value.
overriding
procedure Write_Null_Entity (Stream : in out Output_Stream;
Name : in String);
private
type Output_Stream is limited new Util.Serialize.IO.Output_Stream with record
Stream : Util.Streams.Texts.Print_Stream_Access;
Has_Param : Boolean := False;
end record;
end OpenAPI.Streams.Forms;
|
8088/cga/interlace/25.asm | reenigne/reenigne | 92 | 96268 | org 0x100
cpu 8086
xor ax,ax
mov ds,ax
mov byte[0x485],16 ; Request 25 line mode
ret
|
source/league/league-pretty_printers.adb | svn2github/matreshka | 24 | 23495 | <reponame>svn2github/matreshka
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2015-2017, <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.Strings.Hash;
package body League.Pretty_Printers is
------------
-- Append --
------------
procedure Append
(Self : in out Printer;
Item : Output_Item;
Index : out Document_Index)
is
Cursor : constant Maps.Cursor := Self.Back.Find (Item);
begin
if Maps.Has_Element (Cursor) then
Index := Maps.Element (Cursor);
else
Self.Store.Append (Item);
Index := Self.Store.Last_Index;
Self.Back.Insert (Item, Index);
end if;
end Append;
------------
-- Append --
------------
not overriding function Append
(Self : Document'Class;
Right : Document'Class) return Document
is
Index : Document_Index;
begin
Self.Printer.Concat (Self.Index, Right.Index, Index);
return (Self.Printer, Index);
end Append;
------------
-- Append --
------------
not overriding procedure Append
(Self : in out Document;
Right : Document'Class) is
begin
Self.Printer.Concat (Self.Index, Right.Index, Self.Index);
end Append;
------------
-- Concat --
------------
procedure Concat
(Self : in out Printer;
Left : Document_Index;
Right : Document_Index;
Result : out Document_Index) is
begin
Self.Append ((Concat_Output, Left, Right), Result);
end Concat;
-------------
-- Flatten --
-------------
procedure Flatten
(Self : in out Printer;
Input : Document_Index;
Result : out Document_Index)
is
Item : constant Output_Item := Self.Store.Element (Input);
Temp : Document_Index;
Down : Document_Index;
begin
case Item.Kind is
when Empty_Output | Text_Output =>
Result := Input;
when Concat_Output =>
Self.Flatten (Item.Left, Down);
Self.Flatten (Item.Right, Temp);
Self.Append ((Concat_Output, Down, Temp), Result);
when Nest_Output =>
Self.Flatten (Item.Down, Result);
when New_Line_Output =>
declare
Space : constant Output_Item :=
(Kind => Text_Output, Text => Item.Gap);
begin
Self.Append (Space, Result);
end;
when Union_Output =>
Self.Flatten (Item.Left, Result);
end case;
end Flatten;
-----------
-- Group --
-----------
procedure Group
(Self : in out Printer;
Input : Document_Index;
Result : out Document_Index)
is
Down : Document_Index;
begin
Self.Flatten (Input, Down);
if Input = Down then
Result := Input;
else
Self.Append ((Union_Output, Down, Input), Result);
end if;
end Group;
-----------
-- Group --
-----------
not overriding function Group (Self : Document'Class) return Document is
Index : Document_Index;
begin
Self.Printer.Group (Self.Index, Index);
return (Self.Printer, Index);
end Group;
-----------
-- Group --
-----------
not overriding procedure Group (Self : in out Document) is
begin
Self.Printer.Group (Self.Index, Self.Index);
end Group;
----------
-- Hash --
----------
function Hash (Item : Output_Item) return Ada.Containers.Hash_Type is
use type Ada.Containers.Hash_Type;
begin
case Item.Kind is
when Empty_Output =>
return 1;
when New_Line_Output =>
return League.Strings.Hash (Item.Gap) * 11;
when Text_Output =>
return League.Strings.Hash (Item.Text);
when Nest_Output =>
return Ada.Containers.Hash_Type (Item.Indent) * 1046527 +
Ada.Containers.Hash_Type (Item.Down);
when Union_Output =>
return Ada.Containers.Hash_Type (Item.Left) * 1046527 +
16127 * Ada.Containers.Hash_Type (Item.Right);
when Concat_Output =>
return Ada.Containers.Hash_Type (Item.Left) * 1046527 -
16127 * Ada.Containers.Hash_Type (Item.Right);
end case;
end Hash;
----------
-- Nest --
----------
procedure Nest
(Self : in out Printer;
Indent : Natural;
Input : Document_Index;
Result : out Document_Index) is
begin
Self.Append ((Nest_Output, Indent, Input), Result);
end Nest;
----------
-- Nest --
----------
not overriding function Nest
(Self : Document'Class;
Indent : Natural) return Document
is
Index : Document_Index;
begin
Self.Printer.Nest (Indent, Self.Index, Index);
return (Self.Printer, Index);
end Nest;
----------
-- Nest --
----------
not overriding procedure Nest
(Self : in out Document;
Indent : Natural) is
begin
Self.Printer.Nest (Indent, Self.Index, Self.Index);
end Nest;
------------------
-- New_Document --
------------------
not overriding function New_Document
(Self : access Printer'Class) return Document
is
Index : Document_Index;
begin
Self.Nil (Index);
return (Self.all'Unchecked_Access, Index);
end New_Document;
--------------
-- New_Line --
--------------
procedure New_Line
(Self : in out Printer;
Result : out Document_Index;
Gap : League.Strings.Universal_String) is
begin
Self.Append ((New_Line_Output, Gap), Result);
end New_Line;
--------------
-- New_Line --
--------------
not overriding function New_Line
(Self : Document'Class;
Gap : Wide_Wide_String := " ") return Document
is
Index : Document_Index;
begin
Self.Printer.New_Line (Index, League.Strings.To_Universal_String (Gap));
Self.Printer.Concat (Self.Index, Index, Index);
return (Self.Printer, Index);
end New_Line;
--------------
-- New_Line --
--------------
not overriding procedure New_Line
(Self : in out Document;
Gap : Wide_Wide_String := " ")
is
Index : Document_Index;
begin
Self.Printer.New_Line (Index, League.Strings.To_Universal_String (Gap));
Self.Printer.Concat (Self.Index, Index, Self.Index);
end New_Line;
---------
-- Nil --
---------
procedure Nil
(Self : in out Printer;
Result : out Document_Index) is
begin
Self.Append ((Kind => Empty_Output), Result);
end Nil;
------------
-- Pretty --
------------
function Pretty
(Self : in out Printer;
Width : Positive;
Input : Document'Class)
return League.String_Vectors.Universal_String_Vector
is
package Formatted_Documents is
-- Formatted document is represented as sequence of Items.
-- Item is either text (without new line) or
-- new line together with indent spaces.
type Item;
type Document is access all Item'Class;
type Item is abstract tagged limited record
Next : aliased Document;
end record;
type Text_Collector is record
Lines : League.String_Vectors.Universal_String_Vector;
Last : League.Strings.Universal_String;
Last_Used : Boolean := False;
end record;
procedure Append_Last_Line (Result : in out Text_Collector);
not overriding procedure Append
(Self : Item;
Result : in out Text_Collector) is abstract;
-- Append text representation of given item to Result
type Text_Item is new Item with record
Text : League.Strings.Universal_String;
end record;
overriding procedure Append
(Self : Text_Item;
Result : in out Text_Collector);
type Line_Item is new Item with record
Indent : Natural;
end record;
overriding procedure Append
(Self : Line_Item;
Result : in out Text_Collector);
type Pair;
type Pair_Access is access all Pair;
type Pair is record
Indent : Natural;
Document : Pretty_Printers.Document_Index;
Next : Pair_Access;
end record;
function New_Pair
(Indent : Natural;
Doc : Pretty_Printers.Document_Index;
Next : Pair_Access) return not null Pair_Access;
function Best
(Offset : Natural;
List : not null Pair_Access) return Document;
function Layout (Input : Document)
return League.String_Vectors.Universal_String_Vector;
end Formatted_Documents;
package body Formatted_Documents is
Free_List : Pair_Access;
function Fits
(Offset : Natural;
List : not null Pair_Access) return Boolean;
procedure Free_Pair (Value : Pair_Access);
------------
-- Append --
------------
overriding procedure Append
(Self : Text_Item;
Result : in out Text_Collector) is
begin
Result.Last.Append (Self.Text);
Result.Last_Used := True;
end Append;
------------
-- Append --
------------
overriding procedure Append
(Self : Line_Item;
Result : in out Text_Collector)
is
Space : constant Wide_Wide_String := (1 .. Self.Indent => ' ');
begin
Append_Last_Line (Result);
Result.Last.Append (Space);
end Append;
----------------------
-- Append_Last_Line --
----------------------
procedure Append_Last_Line (Result : in out Text_Collector) is
begin
if not Result.Last_Used then
Result.Last_Used := True;
elsif Result.Last.Count (' ') = Result.Last.Length then
-- if line with spaces only, output an empty line
Result.Last.Clear;
Result.Lines.Append (Result.Last);
else
Result.Lines.Append (Result.Last);
Result.Last.Clear;
end if;
end Append_Last_Line;
----------
-- Best --
----------
function Best
(Offset : Natural;
List : not null Pair_Access) return Document
is
Placed : Natural := Offset;
Head : not null Pair_Access := List;
Tail : Pair_Access; -- Shortcut for Head.Next
Result : aliased Document;
Hook : access Document := Result'Access;
Indent : Natural;
Item : Pretty_Printers.Output_Item;
Pairs : Natural := 0; -- Count of pair at the top of Tail
-- allocated in this call of Fits
begin
loop
Indent := Head.Indent;
Tail := Head.Next;
Item := Self.Store.Element (Head.Document);
if Pairs > 0 then
Pairs := Pairs - 1;
Free_Pair (Head);
end if;
case Item.Kind is
when Empty_Output =>
exit when Tail = null;
Head := Tail;
when Concat_Output =>
Head := New_Pair (Indent, Item.Right, Tail);
Head := New_Pair (Indent, Item.Left, Head);
Pairs := Pairs + 2;
when Nest_Output =>
Head := New_Pair (Indent + Item.Indent, Item.Down, Tail);
Pairs := Pairs + 1;
when Text_Output =>
Hook.all := new Text_Item'(null, Item.Text);
exit when Tail = null;
Hook := Hook.all.Next'Access;
Placed := Placed + Item.Text.Length;
Head := Tail;
when New_Line_Output =>
Hook.all := new Line_Item'(null, Indent);
exit when Tail = null;
Hook := Hook.all.Next'Access;
Placed := Indent;
Head := Tail;
when Union_Output =>
if Width >= Placed then
Head := New_Pair (Indent, Item.Left, Tail);
if Fits (Placed, Head) then
Hook.all := Best (Placed, Head);
Free_Pair (Head);
exit;
end if;
end if;
Head := New_Pair (Indent, Item.Right, Tail);
Hook.all := Best (Placed, Head);
Free_Pair (Head);
exit;
end case;
end loop;
-- Here we can free any Pair allocated in this call
for J in 1 .. Pairs loop
Head := Tail;
Tail := Tail.Next;
Free_Pair (Head);
end loop;
return Result;
end Best;
----------
-- Fits --
----------
function Fits
(Offset : Natural;
List : not null Pair_Access) return Boolean
is
-- This is simplified version of Best that check if result of
-- corresponding Best call fits into Width or not without
-- actual constructing of formated document
Placed : Natural := Offset;
Head : not null Pair_Access := List;
Tail : Pair_Access; -- Shortcut for Head.Next
Result : Boolean := False;
Indent : Natural;
Item : Pretty_Printers.Output_Item;
Pairs : Natural := 0; -- Count of pair at the top of Tail
-- allocated in this call of Fits
begin
loop
Indent := Head.Indent;
Tail := Head.Next;
Item := Self.Store.Element (Head.Document);
if Pairs > 0 then
Pairs := Pairs - 1;
Free_Pair (Head);
end if;
case Item.Kind is
when Empty_Output =>
exit when Tail = null;
Head := Tail;
when Concat_Output =>
Head := New_Pair (Indent, Item.Right, Tail);
Head := New_Pair (Indent, Item.Left, Head);
Pairs := Pairs + 2;
when Nest_Output =>
Head := New_Pair (Indent + Item.Indent, Item.Down, Tail);
Pairs := Pairs + 1;
when Text_Output =>
Placed := Placed + Item.Text.Length;
if Tail = null or Placed > Width then
Result := Placed <= Width;
exit;
end if;
Head := Tail;
when New_Line_Output =>
Result := True;
exit;
when Union_Output =>
if Width >= Placed then
Head := New_Pair (Indent, Item.Left, Tail);
Result := Fits (Placed, Head);
Free_Pair (Head);
exit when Result;
end if;
Head := New_Pair (Indent, Item.Right, Tail);
Result := Fits (Placed, Head);
Free_Pair (Head);
exit;
end case;
end loop;
-- Here we can free any Pair allocated in this call
for J in 1 .. Pairs loop
Head := Tail;
Tail := Tail.Next;
Free_Pair (Head);
end loop;
return Result;
end Fits;
---------------
-- Free_Pair --
---------------
procedure Free_Pair (Value : Pair_Access) is
begin
Value.Next := Free_List;
Free_List := Value;
end Free_Pair;
------------
-- Layout --
------------
function Layout (Input : Document)
return League.String_Vectors.Universal_String_Vector
is
Next : Document := Input;
Result : Text_Collector;
begin
while Next /= null loop
Next.Append (Result);
Next := Next.Next;
end loop;
Append_Last_Line (Result);
return Result.Lines;
end Layout;
--------------
-- New_Pair --
--------------
function New_Pair
(Indent : Natural;
Doc : Pretty_Printers.Document_Index;
Next : Pair_Access) return not null Pair_Access is
begin
if Free_List = null then
return new Pair'(Indent, Doc, Next);
else
return Value : constant not null Pair_Access := Free_List do
Free_List := Value.Next;
Value.all := (Indent, Doc, Next);
end return;
end if;
end New_Pair;
end Formatted_Documents;
Temp : Formatted_Documents.Document;
begin
Temp := Formatted_Documents.Best
(Offset => 0,
List => Formatted_Documents.New_Pair (0, Input.Index, null));
return Formatted_Documents.Layout (Temp);
end Pretty;
---------
-- Put --
---------
not overriding function Put
(Self : Document'Class;
Right : League.Strings.Universal_String) return Document
is
Index : Document_Index;
begin
Self.Printer.Text (Right, Index);
Self.Printer.Concat (Self.Index, Index, Index);
return (Self.Printer, Index);
end Put;
---------
-- Put --
---------
not overriding function Put
(Self : Document'Class;
Right : Wide_Wide_String) return Document is
begin
return Self.Put (League.Strings.To_Universal_String (Right));
end Put;
---------
-- Put --
---------
not overriding procedure Put
(Self : in out Document;
Right : League.Strings.Universal_String)
is
Index : Document_Index;
begin
Self.Printer.Text (Right, Index);
Self.Printer.Concat (Self.Index, Index, Self.Index);
end Put;
---------
-- Put --
---------
not overriding procedure Put
(Self : in out Document;
Right : Wide_Wide_String) is
begin
Self.Put (League.Strings.To_Universal_String (Right));
end Put;
--------------
-- Put_Line --
--------------
not overriding procedure Put_Line
(Self : in out Document;
Right : Wide_Wide_String) is
begin
Self.Put (Right);
Self.New_Line;
end Put_Line;
----------
-- Text --
----------
procedure Text
(Self : in out Printer;
Line : League.Strings.Universal_String;
Result : out Document_Index) is
begin
Self.Append ((Text_Output, Line), Result);
end Text;
end League.Pretty_Printers;
|
engine/items/tmhm.asm | adhi-thirumala/EvoYellow | 16 | 166174 | ; checks if the mon in [wWhichPokemon] already knows the move in [wMoveNum]
CheckIfMoveIsKnown:
ld a, [wWhichPokemon]
ld hl, wPartyMon1Moves
ld bc, wPartyMon2 - wPartyMon1
call AddNTimes
ld a, [wMoveNum]
ld b, a
ld c, NUM_MOVES
.loop
ld a, [hli]
cp b
jr z, .alreadyKnown ; found a match
dec c
jr nz, .loop
and a
ret
.alreadyKnown
ld hl, AlreadyKnowsText
call PrintText
scf
ret
AlreadyKnowsText:
TX_FAR _AlreadyKnowsText
db "@"
|
modules/parsers/parser-hdbdd/src/main/antlr4/com/sap/xsk/parser/hdbdd/core/Cds.g4 | ThuF/xsk | 0 | 183 | grammar Cds;
cdsFile: namespaceRule
usingRule*
topLevelSymbol?;
namespaceRule: NAMESPACE members+=ID ('.' members+=ID)* ';';
usingRule: USING pack+=ID ('.' pack+=ID)* '::' members+=ID ('.' members+=ID)* (AS alias=ID)? ';';
topLevelSymbol: contextRule | entityRule | structuredDataTypeRule | dataTypeRule;
contextRule: annotationRule* CONTEXT ID '{' (contextRule | entityRule | structuredDataTypeRule | dataTypeRule)* '}' ';';
entityRule: annotationRule* ENTITY ID '{' (association | elementDeclRule)* '}' ';'?;
structuredDataTypeRule: annotationRule* TYPE ID '{' fieldDeclRule* '}' ';';
dataTypeRule: TYPE ID ':' typeAssignRule ';';
fieldDeclRule: ID ':' typeAssignRule ';';
typeAssignRule: ref=ID '(' args+=INTEGER (',' args+=INTEGER)* ')' # AssignBuiltInTypeWithArgs
| HANA '.' ref=ID # AssignHanaType
| HANA '.' ref=ID '(' args+=INTEGER (',' args+=INTEGER)* ')' # AssignHanaTypeWithArgs
| TYPE_OF? pathSubMembers+=ID ('.'pathSubMembers+=ID)* # AssignType
;
elementDeclRule: annotationRule* (key=KEY)? ID ':' typeAssignRule defaultValue? elementConstraints? ';';
elementConstraints: 'null' | 'not null';
association: ID ':' ASSOCIATION cardinality? TO associationTarget (managedForeignKeys | unmanagedForeignKey)* ';';
associationTarget: pathSubMembers+=ID ('.' pathSubMembers+=ID)* ;
unmanagedForeignKey: ON pathSubMembers+=ID ('.' pathSubMembers+=ID)* '=' source=ID;
managedForeignKeys: '{' foreignKey (',' foreignKey)* '}';
foreignKey: pathSubMembers+=ID ('.' pathSubMembers+=ID)*;
cardinality: '[' ASSOCIATION_MIN (max=INTEGER | many='*') ']' # MinMaxCardinality
| '[' (max=INTEGER | many='*') ']' # MaxCardinality
| '[' ']' # NoCardinality
;
defaultValue: DEFAULT value=(STRING | INTEGER | DECIMAL | LOCAL_TIME | LOCAL_DATE | UTC_DATE_TIME | UTC_TIMESTAMP | NULL);
annotationRule: '@' ID ':' annValue #AnnObjectRule
| '@' annId=ID '.' prop=ID ':' annValue #AnnPropertyRule
| '@' ID #AnnMarkerRule
;
annValue: arrRule | enumRule | obj | literal=(STRING | BOOLEAN);
enumRule: '#' ID;
arrRule: '[' annValue (',' annValue)* ']';
obj: '{' keyValue (',' keyValue)* '}';
keyValue: ID ':' annValue;
KEY: K E Y;
NAMESPACE: N A M E S P A C E;
AS: 'as';
ENTITY: 'entity';
TYPE: 'type';
HANA: 'hana';
CONTEXT: C O N T E X T;
USING: U S I N G;
ASSOCIATION: A S S O C I A T I O N;
TO: 'to' ;
ON: 'on';
NULL: 'null';
DEFAULT: D E F A U L T;
ASSOCIATION_MIN: INTEGER '..';
BOOLEAN: 'true' | 'false';
ID: ([a-z] | [A-Z])(([a-z] | [A-Z])+ | INTEGER | '_')*;
SEMICOLUMN: ';';
INTEGER: SignedInteger;
DECIMAL: DecimalFloatingPointLiteral;
LOCAL_TIME: LocalTime;
LOCAL_DATE: LocalDate;
UTC_DATE_TIME: UTCDateTime;
UTC_TIMESTAMP: UTCTimestamp;
STRING: '\'' (~["\\\r\n] | EscapeSequence)*? '\'' { setText(getText().substring(1, getText().length() - 1)); };
TYPE_OF: 'type' WS 'of';
WS : [ \\\t\r\n]+ -> skip;
LINE_COMMENT : '//' .*? '\r'? '\n' -> skip ; // Match "//" stuff '\n'
LINE_COMMENT2 : '/*' .*? '*/' -> skip ; // Match "/* */" stuff
fragment EscapeSequence
: '\\' [btnfr"'\\]
| '\\' ([0-3]? [0-7])? [0-7]
| '\\' 'u'+ HexDigit HexDigit HexDigit HexDigit
;
fragment HexDigits
: HexDigit ((HexDigit | '_')* HexDigit)?
;
fragment HexDigit
: [0-9a-fA-F]
;
fragment Digits: [0-9]+;
fragment Digit: [0-9];
fragment Sign: '-';
fragment
DecimalFloatingPointLiteral
: SignedInteger '.' Digits? ExponentPart?
| SignedInteger ExponentPart
;
fragment
ExponentPart
: ExponentIndicator SignedInteger
;
fragment
ExponentIndicator
: [eE]
;
fragment
SignedInteger
: Sign? Digits
;
fragment LocalDate: 'date' '\'' Date '\'';
fragment LocalTime: 'time' '\'' Time '\'';
fragment UTCDateTime: 'timestamp' '\'' Date Time '\'';
fragment UTCTimestamp: 'timestamp' '\'' Date TimeWithPrecision '\'';
fragment Date: Digit[4] '-' Digit[2] '-' Digit[2];
fragment Time: Digit[2] ':' Digit[2] (':' Digit[2])?;
fragment TimeWithPrecision: Digit[2] ':' Digit[2] ':' Digit[2] ('.' Digit[1-7])?;
A : 'A'|'a';
B : 'B'|'b';
C : 'C'|'c';
D : 'D'|'d';
E : 'E'|'e';
F : 'F'|'f';
G : 'G'|'g';
H : 'H'|'h';
I : 'I'|'i';
J : 'J'|'j';
K : 'K'|'k';
L : 'L'|'l';
M : 'M'|'m';
N : 'N'|'n';
O : 'O'|'o';
P : 'P'|'p';
Q : 'Q'|'q';
R : 'R'|'r';
S : 'S'|'s';
T : 'T'|'t';
U : 'U'|'u';
V : 'V'|'v';
W : 'W'|'w';
X : 'X'|'x';
Y : 'Y'|'y';
Z : 'Z'|'z';
|
libsrc/_DEVELOPMENT/adt/w_vector/c/sccz80/w_vector_insert_n.asm | meesokim/z88dk | 0 | 177935 | <gh_stars>0
; size_t w_vector_insert_n(w_vector_t *v, size_t idx, size_t n, void *item)
SECTION code_adt_w_vector
PUBLIC w_vector_insert_n
EXTERN asm_w_vector_insert_n
w_vector_insert_n:
pop ix
pop af
pop de
pop bc
pop hl
push hl
push bc
push de
push af
push ix
jp asm_w_vector_insert_n
|
examples/stm32f1/swo/main.adb | ekoeppen/STM32_Generic_Ada_Drivers | 1 | 20750 | <filename>examples/stm32f1/swo/main.adb
with Last_Chance_Handler; pragma Unreferenced (Last_Chance_Handler);
with Ada.Real_Time; use Ada.Real_Time;
with Ada.Text_IO; use Ada.Text_IO;
with STM32GD.Board; use STM32GD.Board;
with STM32GD.GPIO; use STM32GD.GPIO;
with STM32GD.GPIO.Pin;
with STM32GD.EXTI;
with STM32_SVD.AFIO;
with STM32_SVD.RCC;
procedure Main is
Next_Release : Time := Clock;
Period : constant Time_Span := Milliseconds (500); -- arbitrary
begin
Init;
-- STM32_SVD.AFIO.AFIO_Periph.MAPR.SWJ_CFG := 2#010#;
LED2.Set;
Put_Line ("Starting");
loop
LED2.Toggle;
Next_Release := Next_Release + Period;
delay until Next_Release;
Put_Line ("Ping");
end loop;
end Main;
|
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-coinve.adb | orb-zhuchen/Orb | 0 | 26759 | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . I N D E F I N I T E _ V E C T O R S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2004-2019, 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. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- This unit was originally developed by <NAME>. --
------------------------------------------------------------------------------
with Ada.Containers.Generic_Array_Sort;
with Ada.Unchecked_Deallocation;
with System; use type System.Address;
package body Ada.Containers.Indefinite_Vectors is
pragma Warnings (Off, "variable ""Busy*"" is not referenced");
pragma Warnings (Off, "variable ""Lock*"" is not referenced");
-- See comment in Ada.Containers.Helpers
procedure Free is
new Ada.Unchecked_Deallocation (Elements_Type, Elements_Access);
procedure Free is
new Ada.Unchecked_Deallocation (Element_Type, Element_Access);
procedure Append_Slow_Path
(Container : in out Vector;
New_Item : Element_Type;
Count : Count_Type);
-- This is the slow path for Append. This is split out to minimize the size
-- of Append, because we have Inline (Append).
---------
-- "&" --
---------
-- We decide that the capacity of the result of "&" is the minimum needed
-- -- the sum of the lengths of the vector parameters. We could decide to
-- make it larger, but we have no basis for knowing how much larger, so we
-- just allocate the minimum amount of storage.
function "&" (Left, Right : Vector) return Vector is
begin
return Result : Vector do
Reserve_Capacity (Result, Length (Left) + Length (Right));
Append (Result, Left);
Append (Result, Right);
end return;
end "&";
function "&" (Left : Vector; Right : Element_Type) return Vector is
begin
return Result : Vector do
Reserve_Capacity (Result, Length (Left) + 1);
Append (Result, Left);
Append (Result, Right);
end return;
end "&";
function "&" (Left : Element_Type; Right : Vector) return Vector is
begin
return Result : Vector do
Reserve_Capacity (Result, 1 + Length (Right));
Append (Result, Left);
Append (Result, Right);
end return;
end "&";
function "&" (Left, Right : Element_Type) return Vector is
begin
return Result : Vector do
Reserve_Capacity (Result, 1 + 1);
Append (Result, Left);
Append (Result, Right);
end return;
end "&";
---------
-- "=" --
---------
overriding function "=" (Left, Right : Vector) return Boolean is
begin
if Left.Last /= Right.Last then
return False;
end if;
if Left.Length = 0 then
return True;
end if;
declare
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
begin
for J in Index_Type range Index_Type'First .. Left.Last loop
if Left.Elements.EA (J) = null then
if Right.Elements.EA (J) /= null then
return False;
end if;
elsif Right.Elements.EA (J) = null then
return False;
elsif Left.Elements.EA (J).all /= Right.Elements.EA (J).all then
return False;
end if;
end loop;
end;
return True;
end "=";
------------
-- Adjust --
------------
procedure Adjust (Container : in out Vector) is
begin
-- If the counts are nonzero, execution is technically erroneous, but
-- it seems friendly to allow things like concurrent "=" on shared
-- constants.
Zero_Counts (Container.TC);
if Container.Last = No_Index then
Container.Elements := null;
return;
end if;
declare
L : constant Index_Type := Container.Last;
E : Elements_Array renames
Container.Elements.EA (Index_Type'First .. L);
begin
Container.Elements := null;
Container.Last := No_Index;
Container.Elements := new Elements_Type (L);
for J in E'Range loop
if E (J) /= null then
Container.Elements.EA (J) := new Element_Type'(E (J).all);
end if;
Container.Last := J;
end loop;
end;
end Adjust;
------------
-- Append --
------------
procedure Append (Container : in out Vector; New_Item : Vector) is
begin
if Is_Empty (New_Item) then
return;
elsif Checks and then Container.Last = Index_Type'Last then
raise Constraint_Error with "vector is already at its maximum length";
else
Insert (Container, Container.Last + 1, New_Item);
end if;
end Append;
procedure Append
(Container : in out Vector;
New_Item : Element_Type;
Count : Count_Type := 1)
is
begin
-- In the general case, we pass the buck to Insert, but for efficiency,
-- we check for the usual case where Count = 1 and the vector has enough
-- room for at least one more element.
if Count = 1
and then Container.Elements /= null
and then Container.Last /= Container.Elements.Last
then
TC_Check (Container.TC);
-- Increment Container.Last after assigning the New_Item, so we
-- leave the Container unmodified in case Finalize/Adjust raises
-- an exception.
declare
New_Last : constant Index_Type := Container.Last + 1;
-- The element allocator may need an accessibility check in the
-- case actual type is class-wide or has access discriminants
-- (see RM 4.8(10.1) and AI12-0035).
pragma Unsuppress (Accessibility_Check);
begin
Container.Elements.EA (New_Last) := new Element_Type'(New_Item);
Container.Last := New_Last;
end;
else
Append_Slow_Path (Container, New_Item, Count);
end if;
end Append;
----------------------
-- Append_Slow_Path --
----------------------
procedure Append_Slow_Path
(Container : in out Vector;
New_Item : Element_Type;
Count : Count_Type)
is
begin
if Count = 0 then
return;
elsif Checks and then Container.Last = Index_Type'Last then
raise Constraint_Error with "vector is already at its maximum length";
else
Insert (Container, Container.Last + 1, New_Item, Count);
end if;
end Append_Slow_Path;
------------
-- Assign --
------------
procedure Assign (Target : in out Vector; Source : Vector) is
begin
if Target'Address = Source'Address then
return;
else
Target.Clear;
Target.Append (Source);
end if;
end Assign;
--------------
-- Capacity --
--------------
function Capacity (Container : Vector) return Count_Type is
begin
if Container.Elements = null then
return 0;
else
return Container.Elements.EA'Length;
end if;
end Capacity;
-----------
-- Clear --
-----------
procedure Clear (Container : in out Vector) is
begin
TC_Check (Container.TC);
while Container.Last >= Index_Type'First loop
declare
X : Element_Access := Container.Elements.EA (Container.Last);
begin
Container.Elements.EA (Container.Last) := null;
Container.Last := Container.Last - 1;
Free (X);
end;
end loop;
end Clear;
------------------------
-- Constant_Reference --
------------------------
function Constant_Reference
(Container : aliased Vector;
Position : Cursor) return Constant_Reference_Type
is
begin
if Checks then
if Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
if Position.Container /= Container'Unrestricted_Access then
raise Program_Error with "Position cursor denotes wrong container";
end if;
if Position.Index > Position.Container.Last then
raise Constraint_Error with "Position cursor is out of range";
end if;
end if;
declare
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
-- The following will raise Constraint_Error if Element is null
return R : constant Constant_Reference_Type :=
(Element => Container.Elements.EA (Position.Index),
Control => (Controlled with TC))
do
Lock (TC.all);
end return;
end;
end Constant_Reference;
function Constant_Reference
(Container : aliased Vector;
Index : Index_Type) return Constant_Reference_Type
is
begin
if Checks and then Index > Container.Last then
raise Constraint_Error with "Index is out of range";
end if;
declare
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
-- The following will raise Constraint_Error if Element is null
return R : constant Constant_Reference_Type :=
(Element => Container.Elements.EA (Index),
Control => (Controlled with TC))
do
Lock (TC.all);
end return;
end;
end Constant_Reference;
--------------
-- Contains --
--------------
function Contains
(Container : Vector;
Item : Element_Type) return Boolean
is
begin
return Find_Index (Container, Item) /= No_Index;
end Contains;
----------
-- Copy --
----------
function Copy
(Source : Vector;
Capacity : Count_Type := 0) return Vector
is
C : Count_Type;
begin
if Capacity < Source.Length then
if Checks and then Capacity /= 0 then
raise Capacity_Error
with "Requested capacity is less than Source length";
end if;
C := Source.Length;
else
C := Capacity;
end if;
return Target : Vector do
Target.Reserve_Capacity (C);
Target.Assign (Source);
end return;
end Copy;
------------
-- Delete --
------------
procedure Delete
(Container : in out Vector;
Index : Extended_Index;
Count : Count_Type := 1)
is
Old_Last : constant Index_Type'Base := Container.Last;
New_Last : Index_Type'Base;
Count2 : Count_Type'Base; -- count of items from Index to Old_Last
J : Index_Type'Base; -- first index of items that slide down
begin
-- Delete removes items from the vector, the number of which is the
-- minimum of the specified Count and the items (if any) that exist from
-- Index to Container.Last. There are no constraints on the specified
-- value of Count (it can be larger than what's available at this
-- position in the vector, for example), but there are constraints on
-- the allowed values of the Index.
-- As a precondition on the generic actual Index_Type, the base type
-- must include Index_Type'Pred (Index_Type'First); this is the value
-- that Container.Last assumes when the vector is empty. However, we do
-- not allow that as the value for Index when specifying which items
-- should be deleted, so we must manually check. (That the user is
-- allowed to specify the value at all here is a consequence of the
-- declaration of the Extended_Index subtype, which includes the values
-- in the base range that immediately precede and immediately follow the
-- values in the Index_Type.)
if Checks and then Index < Index_Type'First then
raise Constraint_Error with "Index is out of range (too small)";
end if;
-- We do allow a value greater than Container.Last to be specified as
-- the Index, but only if it's immediately greater. This allows the
-- corner case of deleting no items from the back end of the vector to
-- be treated as a no-op. (It is assumed that specifying an index value
-- greater than Last + 1 indicates some deeper flaw in the caller's
-- algorithm, so that case is treated as a proper error.)
if Index > Old_Last then
if Checks and then Index > Old_Last + 1 then
raise Constraint_Error with "Index is out of range (too large)";
else
return;
end if;
end if;
-- Here and elsewhere we treat deleting 0 items from the container as a
-- no-op, even when the container is busy, so we simply return.
if Count = 0 then
return;
end if;
-- The internal elements array isn't guaranteed to exist unless we have
-- elements, so we handle that case here in order to avoid having to
-- check it later. (Note that an empty vector can never be busy, so
-- there's no semantic harm in returning early.)
if Container.Is_Empty then
return;
end if;
-- The tampering bits exist to prevent an item from being deleted (or
-- otherwise harmfully manipulated) while it is being visited. Query,
-- Update, and Iterate increment the busy count on entry, and decrement
-- the count on exit. Delete checks the count to determine whether it is
-- being called while the associated callback procedure is executing.
TC_Check (Container.TC);
-- We first calculate what's available for deletion starting at
-- Index. Here and elsewhere we use the wider of Index_Type'Base and
-- Count_Type'Base as the type for intermediate values. (See function
-- Length for more information.)
if Count_Type'Base'Last >= Index_Type'Pos (Index_Type'Base'Last) then
Count2 := Count_Type'Base (Old_Last) - Count_Type'Base (Index) + 1;
else
Count2 := Count_Type'Base (Old_Last - Index + 1);
end if;
-- If the number of elements requested (Count) for deletion is equal to
-- (or greater than) the number of elements available (Count2) for
-- deletion beginning at Index, then everything from Index to
-- Container.Last is deleted (this is equivalent to Delete_Last).
if Count >= Count2 then
-- Elements in an indefinite vector are allocated, so we must iterate
-- over the loop and deallocate elements one-at-a-time. We work from
-- back to front, deleting the last element during each pass, in
-- order to gracefully handle deallocation failures.
declare
EA : Elements_Array renames Container.Elements.EA;
begin
while Container.Last >= Index loop
declare
K : constant Index_Type := Container.Last;
X : Element_Access := EA (K);
begin
-- We first isolate the element we're deleting, removing it
-- from the vector before we attempt to deallocate it, in
-- case the deallocation fails.
EA (K) := null;
Container.Last := K - 1;
-- Container invariants have been restored, so it is now
-- safe to attempt to deallocate the element.
Free (X);
end;
end loop;
end;
return;
end if;
-- There are some elements that aren't being deleted (the requested
-- count was less than the available count), so we must slide them down
-- to Index. We first calculate the index values of the respective array
-- slices, using the wider of Index_Type'Base and Count_Type'Base as the
-- type for intermediate calculations. For the elements that slide down,
-- index value New_Last is the last index value of their new home, and
-- index value J is the first index of their old home.
if Index_Type'Base'Last >= Count_Type_Last then
New_Last := Old_Last - Index_Type'Base (Count);
J := Index + Index_Type'Base (Count);
else
New_Last := Index_Type'Base (Count_Type'Base (Old_Last) - Count);
J := Index_Type'Base (Count_Type'Base (Index) + Count);
end if;
-- The internal elements array isn't guaranteed to exist unless we have
-- elements, but we have that guarantee here because we know we have
-- elements to slide. The array index values for each slice have
-- already been determined, so what remains to be done is to first
-- deallocate the elements that are being deleted, and then slide down
-- to Index the elements that aren't being deleted.
declare
EA : Elements_Array renames Container.Elements.EA;
begin
-- Before we can slide down the elements that aren't being deleted,
-- we need to deallocate the elements that are being deleted.
for K in Index .. J - 1 loop
declare
X : Element_Access := EA (K);
begin
-- First we remove the element we're about to deallocate from
-- the vector, in case the deallocation fails, in order to
-- preserve representation invariants.
EA (K) := null;
-- The element has been removed from the vector, so it is now
-- safe to attempt to deallocate it.
Free (X);
end;
end loop;
EA (Index .. New_Last) := EA (J .. Old_Last);
Container.Last := New_Last;
end;
end Delete;
procedure Delete
(Container : in out Vector;
Position : in out Cursor;
Count : Count_Type := 1)
is
begin
if Checks then
if Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
elsif Position.Container /= Container'Unrestricted_Access then
raise Program_Error with "Position cursor denotes wrong container";
elsif Position.Index > Container.Last then
raise Program_Error with "Position index is out of range";
end if;
end if;
Delete (Container, Position.Index, Count);
Position := No_Element;
end Delete;
------------------
-- Delete_First --
------------------
procedure Delete_First
(Container : in out Vector;
Count : Count_Type := 1)
is
begin
if Count = 0 then
return;
elsif Count >= Length (Container) then
Clear (Container);
return;
else
Delete (Container, Index_Type'First, Count);
end if;
end Delete_First;
-----------------
-- Delete_Last --
-----------------
procedure Delete_Last
(Container : in out Vector;
Count : Count_Type := 1)
is
begin
-- It is not permitted to delete items while the container is busy (for
-- example, we're in the middle of a passive iteration). However, we
-- always treat deleting 0 items as a no-op, even when we're busy, so we
-- simply return without checking.
if Count = 0 then
return;
end if;
-- We cannot simply subsume the empty case into the loop below (the loop
-- would iterate 0 times), because we rename the internal array object
-- (which is allocated), but an empty vector isn't guaranteed to have
-- actually allocated an array. (Note that an empty vector can never be
-- busy, so there's no semantic harm in returning early here.)
if Container.Is_Empty then
return;
end if;
-- The tampering bits exist to prevent an item from being deleted (or
-- otherwise harmfully manipulated) while it is being visited. Query,
-- Update, and Iterate increment the busy count on entry, and decrement
-- the count on exit. Delete_Last checks the count to determine whether
-- it is being called while the associated callback procedure is
-- executing.
TC_Check (Container.TC);
-- Elements in an indefinite vector are allocated, so we must iterate
-- over the loop and deallocate elements one-at-a-time. We work from
-- back to front, deleting the last element during each pass, in order
-- to gracefully handle deallocation failures.
declare
E : Elements_Array renames Container.Elements.EA;
begin
for Indx in 1 .. Count_Type'Min (Count, Container.Length) loop
declare
J : constant Index_Type := Container.Last;
X : Element_Access := E (J);
begin
-- Note that we first isolate the element we're deleting,
-- removing it from the vector, before we actually deallocate
-- it, in order to preserve representation invariants even if
-- the deallocation fails.
E (J) := null;
Container.Last := J - 1;
-- Container invariants have been restored, so it is now safe
-- to deallocate the element.
Free (X);
end;
end loop;
end;
end Delete_Last;
-------------
-- Element --
-------------
function Element
(Container : Vector;
Index : Index_Type) return Element_Type
is
begin
if Checks and then Index > Container.Last then
raise Constraint_Error with "Index is out of range";
end if;
declare
EA : constant Element_Access := Container.Elements.EA (Index);
begin
if Checks and then EA = null then
raise Constraint_Error with "element is empty";
else
return EA.all;
end if;
end;
end Element;
function Element (Position : Cursor) return Element_Type is
begin
if Checks then
if Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
if Position.Index > Position.Container.Last then
raise Constraint_Error with "Position cursor is out of range";
end if;
end if;
declare
EA : constant Element_Access :=
Position.Container.Elements.EA (Position.Index);
begin
if Checks and then EA = null then
raise Constraint_Error with "element is empty";
else
return EA.all;
end if;
end;
end Element;
--------------
-- Finalize --
--------------
procedure Finalize (Container : in out Vector) is
begin
Clear (Container); -- Checks busy-bit
declare
X : Elements_Access := Container.Elements;
begin
Container.Elements := null;
Free (X);
end;
end Finalize;
procedure Finalize (Object : in out Iterator) is
begin
Unbusy (Object.Container.TC);
end Finalize;
----------
-- Find --
----------
function Find
(Container : Vector;
Item : Element_Type;
Position : Cursor := No_Element) return Cursor
is
begin
if Checks and then Position.Container /= null then
if Position.Container /= Container'Unrestricted_Access then
raise Program_Error with "Position cursor denotes wrong container";
end if;
if Position.Index > Container.Last then
raise Program_Error with "Position index is out of range";
end if;
end if;
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
declare
Lock : With_Lock (Container.TC'Unrestricted_Access);
begin
for J in Position.Index .. Container.Last loop
if Container.Elements.EA (J).all = Item then
return Cursor'(Container'Unrestricted_Access, J);
end if;
end loop;
return No_Element;
end;
end Find;
----------------
-- Find_Index --
----------------
function Find_Index
(Container : Vector;
Item : Element_Type;
Index : Index_Type := Index_Type'First) return Extended_Index
is
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
Lock : With_Lock (Container.TC'Unrestricted_Access);
begin
for Indx in Index .. Container.Last loop
if Container.Elements.EA (Indx).all = Item then
return Indx;
end if;
end loop;
return No_Index;
end Find_Index;
-----------
-- First --
-----------
function First (Container : Vector) return Cursor is
begin
if Is_Empty (Container) then
return No_Element;
end if;
return (Container'Unrestricted_Access, Index_Type'First);
end First;
function First (Object : Iterator) return Cursor is
begin
-- The value of the iterator object's Index component influences the
-- behavior of the First (and Last) selector function.
-- When the Index component is No_Index, this means the iterator
-- object was constructed without a start expression, in which case the
-- (forward) iteration starts from the (logical) beginning of the entire
-- sequence of items (corresponding to Container.First, for a forward
-- iterator).
-- Otherwise, this is iteration over a partial sequence of items.
-- When the Index component isn't No_Index, the iterator object was
-- constructed with a start expression, that specifies the position
-- from which the (forward) partial iteration begins.
if Object.Index = No_Index then
return First (Object.Container.all);
else
return Cursor'(Object.Container, Object.Index);
end if;
end First;
-------------------
-- First_Element --
-------------------
function First_Element (Container : Vector) return Element_Type is
begin
if Checks and then Container.Last = No_Index then
raise Constraint_Error with "Container is empty";
end if;
declare
EA : constant Element_Access :=
Container.Elements.EA (Index_Type'First);
begin
if Checks and then EA = null then
raise Constraint_Error with "first element is empty";
else
return EA.all;
end if;
end;
end First_Element;
-----------------
-- First_Index --
-----------------
function First_Index (Container : Vector) return Index_Type is
pragma Unreferenced (Container);
begin
return Index_Type'First;
end First_Index;
---------------------
-- Generic_Sorting --
---------------------
package body Generic_Sorting is
-----------------------
-- Local Subprograms --
-----------------------
function Is_Less (L, R : Element_Access) return Boolean;
pragma Inline (Is_Less);
-------------
-- Is_Less --
-------------
function Is_Less (L, R : Element_Access) return Boolean is
begin
if L = null then
return R /= null;
elsif R = null then
return False;
else
return L.all < R.all;
end if;
end Is_Less;
---------------
-- Is_Sorted --
---------------
function Is_Sorted (Container : Vector) return Boolean is
begin
if Container.Last <= Index_Type'First then
return True;
end if;
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
declare
Lock : With_Lock (Container.TC'Unrestricted_Access);
E : Elements_Array renames Container.Elements.EA;
begin
for J in Index_Type'First .. Container.Last - 1 loop
if Is_Less (E (J + 1), E (J)) then
return False;
end if;
end loop;
return True;
end;
end Is_Sorted;
-----------
-- Merge --
-----------
procedure Merge (Target, Source : in out Vector) is
I, J : Index_Type'Base;
begin
-- The semantics of Merge changed slightly per AI05-0021. It was
-- originally the case that if Target and Source denoted the same
-- container object, then the GNAT implementation of Merge did
-- nothing. However, it was argued that RM05 did not precisely
-- specify the semantics for this corner case. The decision of the
-- ARG was that if Target and Source denote the same non-empty
-- container object, then Program_Error is raised.
if Source.Last < Index_Type'First then -- Source is empty
return;
end if;
if Checks and then Target'Address = Source'Address then
raise Program_Error with
"Target and Source denote same non-empty container";
end if;
if Target.Last < Index_Type'First then -- Target is empty
Move (Target => Target, Source => Source);
return;
end if;
TC_Check (Source.TC);
I := Target.Last; -- original value (before Set_Length)
Target.Set_Length (Length (Target) + Length (Source));
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
declare
TA : Elements_Array renames Target.Elements.EA;
SA : Elements_Array renames Source.Elements.EA;
Lock_Target : With_Lock (Target.TC'Unchecked_Access);
Lock_Source : With_Lock (Source.TC'Unchecked_Access);
begin
J := Target.Last; -- new value (after Set_Length)
while Source.Last >= Index_Type'First loop
pragma Assert
(Source.Last <= Index_Type'First
or else not (Is_Less (SA (Source.Last),
SA (Source.Last - 1))));
if I < Index_Type'First then
declare
Src : Elements_Array renames
SA (Index_Type'First .. Source.Last);
begin
TA (Index_Type'First .. J) := Src;
Src := (others => null);
end;
Source.Last := No_Index;
exit;
end if;
pragma Assert
(I <= Index_Type'First
or else not (Is_Less (TA (I), TA (I - 1))));
declare
Src : Element_Access renames SA (Source.Last);
Tgt : Element_Access renames TA (I);
begin
if Is_Less (Src, Tgt) then
Target.Elements.EA (J) := Tgt;
Tgt := null;
I := I - 1;
else
Target.Elements.EA (J) := Src;
Src := null;
Source.Last := Source.Last - 1;
end if;
end;
J := J - 1;
end loop;
end;
end Merge;
----------
-- Sort --
----------
procedure Sort (Container : in out Vector) is
procedure Sort is new Generic_Array_Sort
(Index_Type => Index_Type,
Element_Type => Element_Access,
Array_Type => Elements_Array,
"<" => Is_Less);
-- Start of processing for Sort
begin
if Container.Last <= Index_Type'First then
return;
end if;
-- The exception behavior for the vector container must match that
-- for the list container, so we check for cursor tampering here
-- (which will catch more things) instead of for element tampering
-- (which will catch fewer things). It's true that the elements of
-- this vector container could be safely moved around while (say) an
-- iteration is taking place (iteration only increments the busy
-- counter), and so technically all we would need here is a test for
-- element tampering (indicated by the lock counter), that's simply
-- an artifact of our array-based implementation. Logically Sort
-- requires a check for cursor tampering.
TC_Check (Container.TC);
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
declare
Lock : With_Lock (Container.TC'Unchecked_Access);
begin
Sort (Container.Elements.EA (Index_Type'First .. Container.Last));
end;
end Sort;
end Generic_Sorting;
------------------------
-- Get_Element_Access --
------------------------
function Get_Element_Access
(Position : Cursor) return not null Element_Access
is
Ptr : constant Element_Access :=
Position.Container.Elements.EA (Position.Index);
begin
-- An indefinite vector may contain spaces that hold no elements.
-- Any iteration over an indefinite vector with spaces will raise
-- Constraint_Error.
if Ptr = null then
raise Constraint_Error;
else
return Ptr;
end if;
end Get_Element_Access;
-----------------
-- Has_Element --
-----------------
function Has_Element (Position : Cursor) return Boolean is
begin
if Position.Container = null then
return False;
else
return Position.Index <= Position.Container.Last;
end if;
end Has_Element;
------------
-- Insert --
------------
procedure Insert
(Container : in out Vector;
Before : Extended_Index;
New_Item : Element_Type;
Count : Count_Type := 1)
is
Old_Length : constant Count_Type := Container.Length;
Max_Length : Count_Type'Base; -- determined from range of Index_Type
New_Length : Count_Type'Base; -- sum of current length and Count
New_Last : Index_Type'Base; -- last index of vector after insertion
Index : Index_Type'Base; -- scratch for intermediate values
J : Count_Type'Base; -- scratch
New_Capacity : Count_Type'Base; -- length of new, expanded array
Dst_Last : Index_Type'Base; -- last index of new, expanded array
Dst : Elements_Access; -- new, expanded internal array
begin
if Checks then
-- As a precondition on the generic actual Index_Type, the base type
-- must include Index_Type'Pred (Index_Type'First); this is the value
-- that Container.Last assumes when the vector is empty. However, we
-- do not allow that as the value for Index when specifying where the
-- new items should be inserted, so we must manually check. (That the
-- user is allowed to specify the value at all here is a consequence
-- of the declaration of the Extended_Index subtype, which includes
-- the values in the base range that immediately precede and
-- immediately follow the values in the Index_Type.)
if Before < Index_Type'First then
raise Constraint_Error with
"Before index is out of range (too small)";
end if;
-- We do allow a value greater than Container.Last to be specified as
-- the Index, but only if it's immediately greater. This allows for
-- the case of appending items to the back end of the vector. (It is
-- assumed that specifying an index value greater than Last + 1
-- indicates some deeper flaw in the caller's algorithm, so that case
-- is treated as a proper error.)
if Before > Container.Last + 1 then
raise Constraint_Error with
"Before index is out of range (too large)";
end if;
end if;
-- We treat inserting 0 items into the container as a no-op, even when
-- the container is busy, so we simply return.
if Count = 0 then
return;
end if;
-- There are two constraints we need to satisfy. The first constraint is
-- that a container cannot have more than Count_Type'Last elements, so
-- we must check the sum of the current length and the insertion count.
-- Note: we cannot simply add these values, because of the possibility
-- of overflow.
if Checks and then Old_Length > Count_Type'Last - Count then
raise Constraint_Error with "Count is out of range";
end if;
-- It is now safe compute the length of the new vector, without fear of
-- overflow.
New_Length := Old_Length + Count;
-- The second constraint is that the new Last index value cannot exceed
-- Index_Type'Last. In each branch below, we calculate the maximum
-- length (computed from the range of values in Index_Type), and then
-- compare the new length to the maximum length. If the new length is
-- acceptable, then we compute the new last index from that.
if Index_Type'Base'Last >= Count_Type_Last then
-- We have to handle the case when there might be more values in the
-- range of Index_Type than in the range of Count_Type.
if Index_Type'First <= 0 then
-- We know that No_Index (the same as Index_Type'First - 1) is
-- less than 0, so it is safe to compute the following sum without
-- fear of overflow.
Index := No_Index + Index_Type'Base (Count_Type'Last);
if Index <= Index_Type'Last then
-- We have determined that range of Index_Type has at least as
-- many values as in Count_Type, so Count_Type'Last is the
-- maximum number of items that are allowed.
Max_Length := Count_Type'Last;
else
-- The range of Index_Type has fewer values than in Count_Type,
-- so the maximum number of items is computed from the range of
-- the Index_Type.
Max_Length := Count_Type'Base (Index_Type'Last - No_Index);
end if;
else
-- No_Index is equal or greater than 0, so we can safely compute
-- the difference without fear of overflow (which we would have to
-- worry about if No_Index were less than 0, but that case is
-- handled above).
if Index_Type'Last - No_Index >= Count_Type_Last then
-- We have determined that range of Index_Type has at least as
-- many values as in Count_Type, so Count_Type'Last is the
-- maximum number of items that are allowed.
Max_Length := Count_Type'Last;
else
-- The range of Index_Type has fewer values than in Count_Type,
-- so the maximum number of items is computed from the range of
-- the Index_Type.
Max_Length := Count_Type'Base (Index_Type'Last - No_Index);
end if;
end if;
elsif Index_Type'First <= 0 then
-- We know that No_Index (the same as Index_Type'First - 1) is less
-- than 0, so it is safe to compute the following sum without fear of
-- overflow.
J := Count_Type'Base (No_Index) + Count_Type'Last;
if J <= Count_Type'Base (Index_Type'Last) then
-- We have determined that range of Index_Type has at least as
-- many values as in Count_Type, so Count_Type'Last is the maximum
-- number of items that are allowed.
Max_Length := Count_Type'Last;
else
-- The range of Index_Type has fewer values than Count_Type does,
-- so the maximum number of items is computed from the range of
-- the Index_Type.
Max_Length :=
Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index);
end if;
else
-- No_Index is equal or greater than 0, so we can safely compute the
-- difference without fear of overflow (which we would have to worry
-- about if No_Index were less than 0, but that case is handled
-- above).
Max_Length :=
Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index);
end if;
-- We have just computed the maximum length (number of items). We must
-- now compare the requested length to the maximum length, as we do not
-- allow a vector expand beyond the maximum (because that would create
-- an internal array with a last index value greater than
-- Index_Type'Last, with no way to index those elements).
if Checks and then New_Length > Max_Length then
raise Constraint_Error with "Count is out of range";
end if;
-- New_Last is the last index value of the items in the container after
-- insertion. Use the wider of Index_Type'Base and Count_Type'Base to
-- compute its value from the New_Length.
if Index_Type'Base'Last >= Count_Type_Last then
New_Last := No_Index + Index_Type'Base (New_Length);
else
New_Last := Index_Type'Base (Count_Type'Base (No_Index) + New_Length);
end if;
if Container.Elements = null then
pragma Assert (Container.Last = No_Index);
-- This is the simplest case, with which we must always begin: we're
-- inserting items into an empty vector that hasn't allocated an
-- internal array yet. Note that we don't need to check the busy bit
-- here, because an empty container cannot be busy.
-- In an indefinite vector, elements are allocated individually, and
-- stored as access values on the internal array (the length of which
-- represents the vector "capacity"), which is separately allocated.
Container.Elements := new Elements_Type (New_Last);
-- The element backbone has been successfully allocated, so now we
-- allocate the elements.
for Idx in Container.Elements.EA'Range loop
-- In order to preserve container invariants, we always attempt
-- the element allocation first, before setting the Last index
-- value, in case the allocation fails (either because there is no
-- storage available, or because element initialization fails).
declare
-- The element allocator may need an accessibility check in the
-- case actual type is class-wide or has access discriminants
-- (see RM 4.8(10.1) and AI12-0035).
pragma Unsuppress (Accessibility_Check);
begin
Container.Elements.EA (Idx) := new Element_Type'(New_Item);
end;
-- The allocation of the element succeeded, so it is now safe to
-- update the Last index, restoring container invariants.
Container.Last := Idx;
end loop;
return;
end if;
-- The tampering bits exist to prevent an item from being harmfully
-- manipulated while it is being visited. Query, Update, and Iterate
-- increment the busy count on entry, and decrement the count on
-- exit. Insert checks the count to determine whether it is being called
-- while the associated callback procedure is executing.
TC_Check (Container.TC);
if New_Length <= Container.Elements.EA'Length then
-- In this case, we're inserting elements into a vector that has
-- already allocated an internal array, and the existing array has
-- enough unused storage for the new items.
declare
E : Elements_Array renames Container.Elements.EA;
K : Index_Type'Base;
begin
if Before > Container.Last then
-- The new items are being appended to the vector, so no
-- sliding of existing elements is required.
for Idx in Before .. New_Last loop
-- In order to preserve container invariants, we always
-- attempt the element allocation first, before setting the
-- Last index value, in case the allocation fails (either
-- because there is no storage available, or because element
-- initialization fails).
declare
-- The element allocator may need an accessibility check
-- in case the actual type is class-wide or has access
-- discriminants (see RM 4.8(10.1) and AI12-0035).
pragma Unsuppress (Accessibility_Check);
begin
E (Idx) := new Element_Type'(New_Item);
end;
-- The allocation of the element succeeded, so it is now
-- safe to update the Last index, restoring container
-- invariants.
Container.Last := Idx;
end loop;
else
-- The new items are being inserted before some existing
-- elements, so we must slide the existing elements up to their
-- new home. We use the wider of Index_Type'Base and
-- Count_Type'Base as the type for intermediate index values.
if Index_Type'Base'Last >= Count_Type_Last then
Index := Before + Index_Type'Base (Count);
else
Index := Index_Type'Base (Count_Type'Base (Before) + Count);
end if;
-- The new items are being inserted in the middle of the array,
-- in the range [Before, Index). Copy the existing elements to
-- the end of the array, to make room for the new items.
E (Index .. New_Last) := E (Before .. Container.Last);
Container.Last := New_Last;
-- We have copied the existing items up to the end of the
-- array, to make room for the new items in the middle of
-- the array. Now we actually allocate the new items.
-- Note: initialize K outside loop to make it clear that
-- K always has a value if the exception handler triggers.
K := Before;
declare
-- The element allocator may need an accessibility check in
-- the case the actual type is class-wide or has access
-- discriminants (see RM 4.8(10.1) and AI12-0035).
pragma Unsuppress (Accessibility_Check);
begin
while K < Index loop
E (K) := new Element_Type'(New_Item);
K := K + 1;
end loop;
exception
when others =>
-- Values in the range [Before, K) were successfully
-- allocated, but values in the range [K, Index) are
-- stale (these array positions contain copies of the
-- old items, that did not get assigned a new item,
-- because the allocation failed). We must finish what
-- we started by clearing out all of the stale values,
-- leaving a "hole" in the middle of the array.
E (K .. Index - 1) := (others => null);
raise;
end;
end if;
end;
return;
end if;
-- In this case, we're inserting elements into a vector that has already
-- allocated an internal array, but the existing array does not have
-- enough storage, so we must allocate a new, longer array. In order to
-- guarantee that the amortized insertion cost is O(1), we always
-- allocate an array whose length is some power-of-two factor of the
-- current array length. (The new array cannot have a length less than
-- the New_Length of the container, but its last index value cannot be
-- greater than Index_Type'Last.)
New_Capacity := Count_Type'Max (1, Container.Elements.EA'Length);
while New_Capacity < New_Length loop
if New_Capacity > Count_Type'Last / 2 then
New_Capacity := Count_Type'Last;
exit;
end if;
New_Capacity := 2 * New_Capacity;
end loop;
if New_Capacity > Max_Length then
-- We have reached the limit of capacity, so no further expansion
-- will occur. (This is not a problem, as there is never a need to
-- have more capacity than the maximum container length.)
New_Capacity := Max_Length;
end if;
-- We have computed the length of the new internal array (and this is
-- what "vector capacity" means), so use that to compute its last index.
if Index_Type'Base'Last >= Count_Type_Last then
Dst_Last := No_Index + Index_Type'Base (New_Capacity);
else
Dst_Last :=
Index_Type'Base (Count_Type'Base (No_Index) + New_Capacity);
end if;
-- Now we allocate the new, longer internal array. If the allocation
-- fails, we have not changed any container state, so no side-effect
-- will occur as a result of propagating the exception.
Dst := new Elements_Type (Dst_Last);
-- We have our new internal array. All that needs to be done now is to
-- copy the existing items (if any) from the old array (the "source"
-- array) to the new array (the "destination" array), and then
-- deallocate the old array.
declare
Src : Elements_Access := Container.Elements;
begin
Dst.EA (Index_Type'First .. Before - 1) :=
Src.EA (Index_Type'First .. Before - 1);
if Before > Container.Last then
-- The new items are being appended to the vector, so no
-- sliding of existing elements is required.
-- We have copied the elements from to the old source array to the
-- new destination array, so we can now deallocate the old array.
Container.Elements := Dst;
Free (Src);
-- Now we append the new items.
for Idx in Before .. New_Last loop
-- In order to preserve container invariants, we always attempt
-- the element allocation first, before setting the Last index
-- value, in case the allocation fails (either because there
-- is no storage available, or because element initialization
-- fails).
declare
-- The element allocator may need an accessibility check in
-- the case the actual type is class-wide or has access
-- discriminants (see RM 4.8(10.1) and AI12-0035).
pragma Unsuppress (Accessibility_Check);
begin
Dst.EA (Idx) := new Element_Type'(New_Item);
end;
-- The allocation of the element succeeded, so it is now safe
-- to update the Last index, restoring container invariants.
Container.Last := Idx;
end loop;
else
-- The new items are being inserted before some existing elements,
-- so we must slide the existing elements up to their new home.
if Index_Type'Base'Last >= Count_Type_Last then
Index := Before + Index_Type'Base (Count);
else
Index := Index_Type'Base (Count_Type'Base (Before) + Count);
end if;
Dst.EA (Index .. New_Last) := Src.EA (Before .. Container.Last);
-- We have copied the elements from to the old source array to the
-- new destination array, so we can now deallocate the old array.
Container.Elements := Dst;
Container.Last := New_Last;
Free (Src);
-- The new array has a range in the middle containing null access
-- values. Fill in that partition of the array with the new items.
for Idx in Before .. Index - 1 loop
-- Note that container invariants have already been satisfied
-- (in particular, the Last index value of the vector has
-- already been updated), so if this allocation fails we simply
-- let it propagate.
declare
-- The element allocator may need an accessibility check in
-- the case the actual type is class-wide or has access
-- discriminants (see RM 4.8(10.1) and AI12-0035).
pragma Unsuppress (Accessibility_Check);
begin
Dst.EA (Idx) := new Element_Type'(New_Item);
end;
end loop;
end if;
end;
end Insert;
procedure Insert
(Container : in out Vector;
Before : Extended_Index;
New_Item : Vector)
is
N : constant Count_Type := Length (New_Item);
J : Index_Type'Base;
begin
-- Use Insert_Space to create the "hole" (the destination slice) into
-- which we copy the source items.
Insert_Space (Container, Before, Count => N);
if N = 0 then
-- There's nothing else to do here (vetting of parameters was
-- performed already in Insert_Space), so we simply return.
return;
end if;
if Container'Address /= New_Item'Address then
-- This is the simple case. New_Item denotes an object different
-- from Container, so there's nothing special we need to do to copy
-- the source items to their destination, because all of the source
-- items are contiguous.
declare
subtype Src_Index_Subtype is Index_Type'Base range
Index_Type'First .. New_Item.Last;
Src : Elements_Array renames
New_Item.Elements.EA (Src_Index_Subtype);
Dst : Elements_Array renames Container.Elements.EA;
Dst_Index : Index_Type'Base;
begin
Dst_Index := Before - 1;
for Src_Index in Src'Range loop
Dst_Index := Dst_Index + 1;
if Src (Src_Index) /= null then
Dst (Dst_Index) := new Element_Type'(Src (Src_Index).all);
end if;
end loop;
end;
return;
end if;
-- New_Item denotes the same object as Container, so an insertion has
-- potentially split the source items. The first source slice is
-- [Index_Type'First, Before), and the second source slice is
-- [J, Container.Last], where index value J is the first index of the
-- second slice. (J gets computed below, but only after we have
-- determined that the second source slice is non-empty.) The
-- destination slice is always the range [Before, J). We perform the
-- copy in two steps, using each of the two slices of the source items.
declare
L : constant Index_Type'Base := Before - 1;
subtype Src_Index_Subtype is Index_Type'Base range
Index_Type'First .. L;
Src : Elements_Array renames
Container.Elements.EA (Src_Index_Subtype);
Dst : Elements_Array renames Container.Elements.EA;
Dst_Index : Index_Type'Base;
begin
-- We first copy the source items that precede the space we
-- inserted. (If Before equals Index_Type'First, then this first
-- source slice will be empty, which is harmless.)
Dst_Index := Before - 1;
for Src_Index in Src'Range loop
Dst_Index := Dst_Index + 1;
if Src (Src_Index) /= null then
Dst (Dst_Index) := new Element_Type'(Src (Src_Index).all);
end if;
end loop;
if Src'Length = N then
-- The new items were effectively appended to the container, so we
-- have already copied all of the items that need to be copied.
-- We return early here, even though the source slice below is
-- empty (so the assignment would be harmless), because we want to
-- avoid computing J, which will overflow if J is greater than
-- Index_Type'Base'Last.
return;
end if;
end;
-- Index value J is the first index of the second source slice. (It is
-- also 1 greater than the last index of the destination slice.) Note:
-- avoid computing J if J is greater than Index_Type'Base'Last, in order
-- to avoid overflow. Prevent that by returning early above, immediately
-- after copying the first slice of the source, and determining that
-- this second slice of the source is empty.
if Index_Type'Base'Last >= Count_Type_Last then
J := Before + Index_Type'Base (N);
else
J := Index_Type'Base (Count_Type'Base (Before) + N);
end if;
declare
subtype Src_Index_Subtype is Index_Type'Base range
J .. Container.Last;
Src : Elements_Array renames
Container.Elements.EA (Src_Index_Subtype);
Dst : Elements_Array renames Container.Elements.EA;
Dst_Index : Index_Type'Base;
begin
-- We next copy the source items that follow the space we inserted.
-- Index value Dst_Index is the first index of that portion of the
-- destination that receives this slice of the source. (For the
-- reasons given above, this slice is guaranteed to be non-empty.)
if Index_Type'Base'Last >= Count_Type_Last then
Dst_Index := J - Index_Type'Base (Src'Length);
else
Dst_Index := Index_Type'Base (Count_Type'Base (J) - Src'Length);
end if;
for Src_Index in Src'Range loop
if Src (Src_Index) /= null then
Dst (Dst_Index) := new Element_Type'(Src (Src_Index).all);
end if;
Dst_Index := Dst_Index + 1;
end loop;
end;
end Insert;
procedure Insert
(Container : in out Vector;
Before : Cursor;
New_Item : Vector)
is
Index : Index_Type'Base;
begin
if Checks and then Before.Container /= null
and then Before.Container /= Container'Unrestricted_Access
then
raise Program_Error with "Before cursor denotes wrong container";
end if;
if Is_Empty (New_Item) then
return;
end if;
if Before.Container = null or else Before.Index > Container.Last then
if Checks and then Container.Last = Index_Type'Last then
raise Constraint_Error with
"vector is already at its maximum length";
end if;
Index := Container.Last + 1;
else
Index := Before.Index;
end if;
Insert (Container, Index, New_Item);
end Insert;
procedure Insert
(Container : in out Vector;
Before : Cursor;
New_Item : Vector;
Position : out Cursor)
is
Index : Index_Type'Base;
begin
if Checks and then Before.Container /= null
and then Before.Container /= Container'Unrestricted_Access
then
raise Program_Error with "Before cursor denotes wrong container";
end if;
if Is_Empty (New_Item) then
if Before.Container = null or else Before.Index > Container.Last then
Position := No_Element;
else
Position := (Container'Unrestricted_Access, Before.Index);
end if;
return;
end if;
if Before.Container = null or else Before.Index > Container.Last then
if Checks and then Container.Last = Index_Type'Last then
raise Constraint_Error with
"vector is already at its maximum length";
end if;
Index := Container.Last + 1;
else
Index := Before.Index;
end if;
Insert (Container, Index, New_Item);
Position := (Container'Unrestricted_Access, Index);
end Insert;
procedure Insert
(Container : in out Vector;
Before : Cursor;
New_Item : Element_Type;
Count : Count_Type := 1)
is
Index : Index_Type'Base;
begin
if Checks and then Before.Container /= null
and then Before.Container /= Container'Unrestricted_Access
then
raise Program_Error with "Before cursor denotes wrong container";
end if;
if Count = 0 then
return;
end if;
if Before.Container = null or else Before.Index > Container.Last then
if Checks and then Container.Last = Index_Type'Last then
raise Constraint_Error with
"vector is already at its maximum length";
end if;
Index := Container.Last + 1;
else
Index := Before.Index;
end if;
Insert (Container, Index, New_Item, Count);
end Insert;
procedure Insert
(Container : in out Vector;
Before : Cursor;
New_Item : Element_Type;
Position : out Cursor;
Count : Count_Type := 1)
is
Index : Index_Type'Base;
begin
if Checks and then Before.Container /= null
and then Before.Container /= Container'Unrestricted_Access
then
raise Program_Error with "Before cursor denotes wrong container";
end if;
if Count = 0 then
if Before.Container = null or else Before.Index > Container.Last then
Position := No_Element;
else
Position := (Container'Unrestricted_Access, Before.Index);
end if;
return;
end if;
if Before.Container = null or else Before.Index > Container.Last then
if Checks and then Container.Last = Index_Type'Last then
raise Constraint_Error with
"vector is already at its maximum length";
end if;
Index := Container.Last + 1;
else
Index := Before.Index;
end if;
Insert (Container, Index, New_Item, Count);
Position := (Container'Unrestricted_Access, Index);
end Insert;
------------------
-- Insert_Space --
------------------
procedure Insert_Space
(Container : in out Vector;
Before : Extended_Index;
Count : Count_Type := 1)
is
Old_Length : constant Count_Type := Container.Length;
Max_Length : Count_Type'Base; -- determined from range of Index_Type
New_Length : Count_Type'Base; -- sum of current length and Count
New_Last : Index_Type'Base; -- last index of vector after insertion
Index : Index_Type'Base; -- scratch for intermediate values
J : Count_Type'Base; -- scratch
New_Capacity : Count_Type'Base; -- length of new, expanded array
Dst_Last : Index_Type'Base; -- last index of new, expanded array
Dst : Elements_Access; -- new, expanded internal array
begin
if Checks then
-- As a precondition on the generic actual Index_Type, the base type
-- must include Index_Type'Pred (Index_Type'First); this is the value
-- that Container.Last assumes when the vector is empty. However, we
-- do not allow that as the value for Index when specifying where the
-- new items should be inserted, so we must manually check. (That the
-- user is allowed to specify the value at all here is a consequence
-- of the declaration of the Extended_Index subtype, which includes
-- the values in the base range that immediately precede and
-- immediately follow the values in the Index_Type.)
if Before < Index_Type'First then
raise Constraint_Error with
"Before index is out of range (too small)";
end if;
-- We do allow a value greater than Container.Last to be specified as
-- the Index, but only if it's immediately greater. This allows for
-- the case of appending items to the back end of the vector. (It is
-- assumed that specifying an index value greater than Last + 1
-- indicates some deeper flaw in the caller's algorithm, so that case
-- is treated as a proper error.)
if Before > Container.Last + 1 then
raise Constraint_Error with
"Before index is out of range (too large)";
end if;
end if;
-- We treat inserting 0 items into the container as a no-op, even when
-- the container is busy, so we simply return.
if Count = 0 then
return;
end if;
-- There are two constraints we need to satisfy. The first constraint is
-- that a container cannot have more than Count_Type'Last elements, so
-- we must check the sum of the current length and the insertion count.
-- Note: we cannot simply add these values, because of the possibility
-- of overflow.
if Checks and then Old_Length > Count_Type'Last - Count then
raise Constraint_Error with "Count is out of range";
end if;
-- It is now safe compute the length of the new vector, without fear of
-- overflow.
New_Length := Old_Length + Count;
-- The second constraint is that the new Last index value cannot exceed
-- Index_Type'Last. In each branch below, we calculate the maximum
-- length (computed from the range of values in Index_Type), and then
-- compare the new length to the maximum length. If the new length is
-- acceptable, then we compute the new last index from that.
if Index_Type'Base'Last >= Count_Type_Last then
-- We have to handle the case when there might be more values in the
-- range of Index_Type than in the range of Count_Type.
if Index_Type'First <= 0 then
-- We know that No_Index (the same as Index_Type'First - 1) is
-- less than 0, so it is safe to compute the following sum without
-- fear of overflow.
Index := No_Index + Index_Type'Base (Count_Type'Last);
if Index <= Index_Type'Last then
-- We have determined that range of Index_Type has at least as
-- many values as in Count_Type, so Count_Type'Last is the
-- maximum number of items that are allowed.
Max_Length := Count_Type'Last;
else
-- The range of Index_Type has fewer values than in Count_Type,
-- so the maximum number of items is computed from the range of
-- the Index_Type.
Max_Length := Count_Type'Base (Index_Type'Last - No_Index);
end if;
else
-- No_Index is equal or greater than 0, so we can safely compute
-- the difference without fear of overflow (which we would have to
-- worry about if No_Index were less than 0, but that case is
-- handled above).
if Index_Type'Last - No_Index >= Count_Type_Last then
-- We have determined that range of Index_Type has at least as
-- many values as in Count_Type, so Count_Type'Last is the
-- maximum number of items that are allowed.
Max_Length := Count_Type'Last;
else
-- The range of Index_Type has fewer values than in Count_Type,
-- so the maximum number of items is computed from the range of
-- the Index_Type.
Max_Length := Count_Type'Base (Index_Type'Last - No_Index);
end if;
end if;
elsif Index_Type'First <= 0 then
-- We know that No_Index (the same as Index_Type'First - 1) is less
-- than 0, so it is safe to compute the following sum without fear of
-- overflow.
J := Count_Type'Base (No_Index) + Count_Type'Last;
if J <= Count_Type'Base (Index_Type'Last) then
-- We have determined that range of Index_Type has at least as
-- many values as in Count_Type, so Count_Type'Last is the maximum
-- number of items that are allowed.
Max_Length := Count_Type'Last;
else
-- The range of Index_Type has fewer values than Count_Type does,
-- so the maximum number of items is computed from the range of
-- the Index_Type.
Max_Length :=
Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index);
end if;
else
-- No_Index is equal or greater than 0, so we can safely compute the
-- difference without fear of overflow (which we would have to worry
-- about if No_Index were less than 0, but that case is handled
-- above).
Max_Length :=
Count_Type'Base (Index_Type'Last) - Count_Type'Base (No_Index);
end if;
-- We have just computed the maximum length (number of items). We must
-- now compare the requested length to the maximum length, as we do not
-- allow a vector expand beyond the maximum (because that would create
-- an internal array with a last index value greater than
-- Index_Type'Last, with no way to index those elements).
if Checks and then New_Length > Max_Length then
raise Constraint_Error with "Count is out of range";
end if;
-- New_Last is the last index value of the items in the container after
-- insertion. Use the wider of Index_Type'Base and Count_Type'Base to
-- compute its value from the New_Length.
if Index_Type'Base'Last >= Count_Type_Last then
New_Last := No_Index + Index_Type'Base (New_Length);
else
New_Last := Index_Type'Base (Count_Type'Base (No_Index) + New_Length);
end if;
if Container.Elements = null then
pragma Assert (Container.Last = No_Index);
-- This is the simplest case, with which we must always begin: we're
-- inserting items into an empty vector that hasn't allocated an
-- internal array yet. Note that we don't need to check the busy bit
-- here, because an empty container cannot be busy.
-- In an indefinite vector, elements are allocated individually, and
-- stored as access values on the internal array (the length of which
-- represents the vector "capacity"), which is separately allocated.
-- We have no elements here (because we're inserting "space"), so all
-- we need to do is allocate the backbone.
Container.Elements := new Elements_Type (New_Last);
Container.Last := New_Last;
return;
end if;
-- The tampering bits exist to prevent an item from being harmfully
-- manipulated while it is being visited. Query, Update, and Iterate
-- increment the busy count on entry, and decrement the count on exit.
-- Insert checks the count to determine whether it is being called while
-- the associated callback procedure is executing.
TC_Check (Container.TC);
if New_Length <= Container.Elements.EA'Length then
-- In this case, we are inserting elements into a vector that has
-- already allocated an internal array, and the existing array has
-- enough unused storage for the new items.
declare
E : Elements_Array renames Container.Elements.EA;
begin
if Before <= Container.Last then
-- The new space is being inserted before some existing
-- elements, so we must slide the existing elements up to
-- their new home. We use the wider of Index_Type'Base and
-- Count_Type'Base as the type for intermediate index values.
if Index_Type'Base'Last >= Count_Type_Last then
Index := Before + Index_Type'Base (Count);
else
Index := Index_Type'Base (Count_Type'Base (Before) + Count);
end if;
E (Index .. New_Last) := E (Before .. Container.Last);
E (Before .. Index - 1) := (others => null);
end if;
end;
Container.Last := New_Last;
return;
end if;
-- In this case, we're inserting elements into a vector that has already
-- allocated an internal array, but the existing array does not have
-- enough storage, so we must allocate a new, longer array. In order to
-- guarantee that the amortized insertion cost is O(1), we always
-- allocate an array whose length is some power-of-two factor of the
-- current array length. (The new array cannot have a length less than
-- the New_Length of the container, but its last index value cannot be
-- greater than Index_Type'Last.)
New_Capacity := Count_Type'Max (1, Container.Elements.EA'Length);
while New_Capacity < New_Length loop
if New_Capacity > Count_Type'Last / 2 then
New_Capacity := Count_Type'Last;
exit;
end if;
New_Capacity := 2 * New_Capacity;
end loop;
if New_Capacity > Max_Length then
-- We have reached the limit of capacity, so no further expansion
-- will occur. (This is not a problem, as there is never a need to
-- have more capacity than the maximum container length.)
New_Capacity := Max_Length;
end if;
-- We have computed the length of the new internal array (and this is
-- what "vector capacity" means), so use that to compute its last index.
if Index_Type'Base'Last >= Count_Type_Last then
Dst_Last := No_Index + Index_Type'Base (New_Capacity);
else
Dst_Last :=
Index_Type'Base (Count_Type'Base (No_Index) + New_Capacity);
end if;
-- Now we allocate the new, longer internal array. If the allocation
-- fails, we have not changed any container state, so no side-effect
-- will occur as a result of propagating the exception.
Dst := new Elements_Type (Dst_Last);
-- We have our new internal array. All that needs to be done now is to
-- copy the existing items (if any) from the old array (the "source"
-- array) to the new array (the "destination" array), and then
-- deallocate the old array.
declare
Src : Elements_Access := Container.Elements;
begin
Dst.EA (Index_Type'First .. Before - 1) :=
Src.EA (Index_Type'First .. Before - 1);
if Before <= Container.Last then
-- The new items are being inserted before some existing elements,
-- so we must slide the existing elements up to their new home.
if Index_Type'Base'Last >= Count_Type_Last then
Index := Before + Index_Type'Base (Count);
else
Index := Index_Type'Base (Count_Type'Base (Before) + Count);
end if;
Dst.EA (Index .. New_Last) := Src.EA (Before .. Container.Last);
end if;
-- We have copied the elements from to the old, source array to the
-- new, destination array, so we can now restore invariants, and
-- deallocate the old array.
Container.Elements := Dst;
Container.Last := New_Last;
Free (Src);
end;
end Insert_Space;
procedure Insert_Space
(Container : in out Vector;
Before : Cursor;
Position : out Cursor;
Count : Count_Type := 1)
is
Index : Index_Type'Base;
begin
if Checks and then Before.Container /= null
and then Before.Container /= Container'Unrestricted_Access
then
raise Program_Error with "Before cursor denotes wrong container";
end if;
if Count = 0 then
if Before.Container = null or else Before.Index > Container.Last then
Position := No_Element;
else
Position := (Container'Unrestricted_Access, Before.Index);
end if;
return;
end if;
if Before.Container = null or else Before.Index > Container.Last then
if Checks and then Container.Last = Index_Type'Last then
raise Constraint_Error with
"vector is already at its maximum length";
end if;
Index := Container.Last + 1;
else
Index := Before.Index;
end if;
Insert_Space (Container, Index, Count);
Position := (Container'Unrestricted_Access, Index);
end Insert_Space;
--------------
-- Is_Empty --
--------------
function Is_Empty (Container : Vector) return Boolean is
begin
return Container.Last < Index_Type'First;
end Is_Empty;
-------------
-- Iterate --
-------------
procedure Iterate
(Container : Vector;
Process : not null access procedure (Position : Cursor))
is
Busy : With_Busy (Container.TC'Unrestricted_Access);
begin
for Indx in Index_Type'First .. Container.Last loop
Process (Cursor'(Container'Unrestricted_Access, Indx));
end loop;
end Iterate;
function Iterate
(Container : Vector)
return Vector_Iterator_Interfaces.Reversible_Iterator'Class
is
V : constant Vector_Access := Container'Unrestricted_Access;
begin
-- The value of its Index component influences the behavior of the First
-- and Last selector functions of the iterator object. When the Index
-- component is No_Index (as is the case here), this means the iterator
-- object was constructed without a start expression. This is a complete
-- iterator, meaning that the iteration starts from the (logical)
-- beginning of the sequence of items.
-- Note: For a forward iterator, Container.First is the beginning, and
-- for a reverse iterator, Container.Last is the beginning.
return It : constant Iterator :=
(Limited_Controlled with
Container => V,
Index => No_Index)
do
Busy (Container.TC'Unrestricted_Access.all);
end return;
end Iterate;
function Iterate
(Container : Vector;
Start : Cursor)
return Vector_Iterator_Interfaces.Reversible_Iterator'Class
is
V : constant Vector_Access := Container'Unrestricted_Access;
begin
-- It was formerly the case that when Start = No_Element, the partial
-- iterator was defined to behave the same as for a complete iterator,
-- and iterate over the entire sequence of items. However, those
-- semantics were unintuitive and arguably error-prone (it is too easy
-- to accidentally create an endless loop), and so they were changed,
-- per the ARG meeting in Denver on 2011/11. However, there was no
-- consensus about what positive meaning this corner case should have,
-- and so it was decided to simply raise an exception. This does imply,
-- however, that it is not possible to use a partial iterator to specify
-- an empty sequence of items.
if Checks then
if Start.Container = null then
raise Constraint_Error with
"Start position for iterator equals No_Element";
end if;
if Start.Container /= V then
raise Program_Error with
"Start cursor of Iterate designates wrong vector";
end if;
if Start.Index > V.Last then
raise Constraint_Error with
"Start position for iterator equals No_Element";
end if;
end if;
-- The value of its Index component influences the behavior of the First
-- and Last selector functions of the iterator object. When the Index
-- component is not No_Index (as is the case here), it means that this
-- is a partial iteration, over a subset of the complete sequence of
-- items. The iterator object was constructed with a start expression,
-- indicating the position from which the iteration begins. Note that
-- the start position has the same value irrespective of whether this
-- is a forward or reverse iteration.
return It : constant Iterator :=
(Limited_Controlled with
Container => V,
Index => Start.Index)
do
Busy (Container.TC'Unrestricted_Access.all);
end return;
end Iterate;
----------
-- Last --
----------
function Last (Container : Vector) return Cursor is
begin
if Is_Empty (Container) then
return No_Element;
end if;
return (Container'Unrestricted_Access, Container.Last);
end Last;
function Last (Object : Iterator) return Cursor is
begin
-- The value of the iterator object's Index component influences the
-- behavior of the Last (and First) selector function.
-- When the Index component is No_Index, this means the iterator
-- object was constructed without a start expression, in which case the
-- (reverse) iteration starts from the (logical) beginning of the entire
-- sequence (corresponding to Container.Last, for a reverse iterator).
-- Otherwise, this is iteration over a partial sequence of items.
-- When the Index component is not No_Index, the iterator object was
-- constructed with a start expression, that specifies the position
-- from which the (reverse) partial iteration begins.
if Object.Index = No_Index then
return Last (Object.Container.all);
else
return Cursor'(Object.Container, Object.Index);
end if;
end Last;
------------------
-- Last_Element --
------------------
function Last_Element (Container : Vector) return Element_Type is
begin
if Checks and then Container.Last = No_Index then
raise Constraint_Error with "Container is empty";
end if;
declare
EA : constant Element_Access :=
Container.Elements.EA (Container.Last);
begin
if Checks and then EA = null then
raise Constraint_Error with "last element is empty";
else
return EA.all;
end if;
end;
end Last_Element;
----------------
-- Last_Index --
----------------
function Last_Index (Container : Vector) return Extended_Index is
begin
return Container.Last;
end Last_Index;
------------
-- Length --
------------
function Length (Container : Vector) return Count_Type is
L : constant Index_Type'Base := Container.Last;
F : constant Index_Type := Index_Type'First;
begin
-- The base range of the index type (Index_Type'Base) might not include
-- all values for length (Count_Type). Contrariwise, the index type
-- might include values outside the range of length. Hence we use
-- whatever type is wider for intermediate values when calculating
-- length. Note that no matter what the index type is, the maximum
-- length to which a vector is allowed to grow is always the minimum
-- of Count_Type'Last and (IT'Last - IT'First + 1).
-- For example, an Index_Type with range -127 .. 127 is only guaranteed
-- to have a base range of -128 .. 127, but the corresponding vector
-- would have lengths in the range 0 .. 255. In this case we would need
-- to use Count_Type'Base for intermediate values.
-- Another case would be the index range -2**63 + 1 .. -2**63 + 10. The
-- vector would have a maximum length of 10, but the index values lie
-- outside the range of Count_Type (which is only 32 bits). In this
-- case we would need to use Index_Type'Base for intermediate values.
if Count_Type'Base'Last >= Index_Type'Pos (Index_Type'Base'Last) then
return Count_Type'Base (L) - Count_Type'Base (F) + 1;
else
return Count_Type (L - F + 1);
end if;
end Length;
----------
-- Move --
----------
procedure Move
(Target : in out Vector;
Source : in out Vector)
is
begin
if Target'Address = Source'Address then
return;
end if;
TC_Check (Source.TC);
Clear (Target); -- Checks busy-bit
declare
Target_Elements : constant Elements_Access := Target.Elements;
begin
Target.Elements := Source.Elements;
Source.Elements := Target_Elements;
end;
Target.Last := Source.Last;
Source.Last := No_Index;
end Move;
----------
-- Next --
----------
function Next (Position : Cursor) return Cursor is
begin
if Position.Container = null then
return No_Element;
elsif Position.Index < Position.Container.Last then
return (Position.Container, Position.Index + 1);
else
return No_Element;
end if;
end Next;
function Next (Object : Iterator; Position : Cursor) return Cursor is
begin
if Position.Container = null then
return No_Element;
elsif Checks and then Position.Container /= Object.Container then
raise Program_Error with
"Position cursor of Next designates wrong vector";
else
return Next (Position);
end if;
end Next;
procedure Next (Position : in out Cursor) is
begin
if Position.Container = null then
return;
elsif Position.Index < Position.Container.Last then
Position.Index := Position.Index + 1;
else
Position := No_Element;
end if;
end Next;
-------------
-- Prepend --
-------------
procedure Prepend (Container : in out Vector; New_Item : Vector) is
begin
Insert (Container, Index_Type'First, New_Item);
end Prepend;
procedure Prepend
(Container : in out Vector;
New_Item : Element_Type;
Count : Count_Type := 1)
is
begin
Insert (Container, Index_Type'First, New_Item, Count);
end Prepend;
--------------
-- Previous --
--------------
function Previous (Position : Cursor) return Cursor is
begin
if Position.Container = null then
return No_Element;
elsif Position.Index > Index_Type'First then
return (Position.Container, Position.Index - 1);
else
return No_Element;
end if;
end Previous;
function Previous (Object : Iterator; Position : Cursor) return Cursor is
begin
if Position.Container = null then
return No_Element;
elsif Checks and then Position.Container /= Object.Container then
raise Program_Error with
"Position cursor of Previous designates wrong vector";
else
return Previous (Position);
end if;
end Previous;
procedure Previous (Position : in out Cursor) is
begin
if Position.Container = null then
return;
elsif Position.Index > Index_Type'First then
Position.Index := Position.Index - 1;
else
Position := No_Element;
end if;
end Previous;
----------------------
-- Pseudo_Reference --
----------------------
function Pseudo_Reference
(Container : aliased Vector'Class) return Reference_Control_Type
is
TC : constant Tamper_Counts_Access := Container.TC'Unrestricted_Access;
begin
return R : constant Reference_Control_Type := (Controlled with TC) do
Lock (TC.all);
end return;
end Pseudo_Reference;
-------------------
-- Query_Element --
-------------------
procedure Query_Element
(Container : Vector;
Index : Index_Type;
Process : not null access procedure (Element : Element_Type))
is
Lock : With_Lock (Container.TC'Unrestricted_Access);
V : Vector renames Container'Unrestricted_Access.all;
begin
if Checks and then Index > Container.Last then
raise Constraint_Error with "Index is out of range";
end if;
if Checks and then V.Elements.EA (Index) = null then
raise Constraint_Error with "element is null";
end if;
Process (V.Elements.EA (Index).all);
end Query_Element;
procedure Query_Element
(Position : Cursor;
Process : not null access procedure (Element : Element_Type))
is
begin
if Checks and then Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
else
Query_Element (Position.Container.all, Position.Index, Process);
end if;
end Query_Element;
----------
-- Read --
----------
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Container : out Vector)
is
Length : Count_Type'Base;
Last : Index_Type'Base := Index_Type'Pred (Index_Type'First);
B : Boolean;
begin
Clear (Container);
Count_Type'Base'Read (Stream, Length);
if Length > Capacity (Container) then
Reserve_Capacity (Container, Capacity => Length);
end if;
for J in Count_Type range 1 .. Length loop
Last := Last + 1;
Boolean'Read (Stream, B);
if B then
Container.Elements.EA (Last) :=
new Element_Type'(Element_Type'Input (Stream));
end if;
Container.Last := Last;
end loop;
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Position : out Cursor)
is
begin
raise Program_Error with "attempt to stream vector cursor";
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Read;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Constant_Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Read;
---------------
-- Reference --
---------------
function Reference
(Container : aliased in out Vector;
Position : Cursor) return Reference_Type
is
begin
if Checks then
if Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
if Position.Container /= Container'Unrestricted_Access then
raise Program_Error with "Position cursor denotes wrong container";
end if;
if Position.Index > Position.Container.Last then
raise Constraint_Error with "Position cursor is out of range";
end if;
end if;
declare
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
-- The following will raise Constraint_Error if Element is null
return R : constant Reference_Type :=
(Element => Container.Elements.EA (Position.Index),
Control => (Controlled with TC))
do
Lock (TC.all);
end return;
end;
end Reference;
function Reference
(Container : aliased in out Vector;
Index : Index_Type) return Reference_Type
is
begin
if Checks and then Index > Container.Last then
raise Constraint_Error with "Index is out of range";
end if;
declare
TC : constant Tamper_Counts_Access :=
Container.TC'Unrestricted_Access;
begin
-- The following will raise Constraint_Error if Element is null
return R : constant Reference_Type :=
(Element => Container.Elements.EA (Index),
Control => (Controlled with TC))
do
Lock (TC.all);
end return;
end;
end Reference;
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element
(Container : in out Vector;
Index : Index_Type;
New_Item : Element_Type)
is
begin
if Checks and then Index > Container.Last then
raise Constraint_Error with "Index is out of range";
end if;
TE_Check (Container.TC);
declare
X : Element_Access := Container.Elements.EA (Index);
-- The element allocator may need an accessibility check in the case
-- where the actual type is class-wide or has access discriminants
-- (see RM 4.8(10.1) and AI12-0035).
pragma Unsuppress (Accessibility_Check);
begin
Container.Elements.EA (Index) := new Element_Type'(New_Item);
Free (X);
end;
end Replace_Element;
procedure Replace_Element
(Container : in out Vector;
Position : Cursor;
New_Item : Element_Type)
is
begin
if Checks then
if Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
end if;
if Position.Container /= Container'Unrestricted_Access then
raise Program_Error with "Position cursor denotes wrong container";
end if;
if Position.Index > Container.Last then
raise Constraint_Error with "Position cursor is out of range";
end if;
end if;
TE_Check (Container.TC);
declare
X : Element_Access := Container.Elements.EA (Position.Index);
-- The element allocator may need an accessibility check in the case
-- where the actual type is class-wide or has access discriminants
-- (see RM 4.8(10.1) and AI12-0035).
pragma Unsuppress (Accessibility_Check);
begin
Container.Elements.EA (Position.Index) := new Element_Type'(New_Item);
Free (X);
end;
end Replace_Element;
----------------------
-- Reserve_Capacity --
----------------------
procedure Reserve_Capacity
(Container : in out Vector;
Capacity : Count_Type)
is
N : constant Count_Type := Length (Container);
Index : Count_Type'Base;
Last : Index_Type'Base;
begin
-- Reserve_Capacity can be used to either expand the storage available
-- for elements (this would be its typical use, in anticipation of
-- future insertion), or to trim back storage. In the latter case,
-- storage can only be trimmed back to the limit of the container
-- length. Note that Reserve_Capacity neither deletes (active) elements
-- nor inserts elements; it only affects container capacity, never
-- container length.
if Capacity = 0 then
-- This is a request to trim back storage, to the minimum amount
-- possible given the current state of the container.
if N = 0 then
-- The container is empty, so in this unique case we can
-- deallocate the entire internal array. Note that an empty
-- container can never be busy, so there's no need to check the
-- tampering bits.
declare
X : Elements_Access := Container.Elements;
begin
-- First we remove the internal array from the container, to
-- handle the case when the deallocation raises an exception
-- (although that's unlikely, since this is simply an array of
-- access values, all of which are null).
Container.Elements := null;
-- Container invariants have been restored, so it is now safe
-- to attempt to deallocate the internal array.
Free (X);
end;
elsif N < Container.Elements.EA'Length then
-- The container is not empty, and the current length is less than
-- the current capacity, so there's storage available to trim. In
-- this case, we allocate a new internal array having a length
-- that exactly matches the number of items in the
-- container. (Reserve_Capacity does not delete active elements,
-- so this is the best we can do with respect to minimizing
-- storage).
TC_Check (Container.TC);
declare
subtype Array_Index_Subtype is Index_Type'Base range
Index_Type'First .. Container.Last;
Src : Elements_Array renames
Container.Elements.EA (Array_Index_Subtype);
X : Elements_Access := Container.Elements;
begin
-- Although we have isolated the old internal array that we're
-- going to deallocate, we don't deallocate it until we have
-- successfully allocated a new one. If there is an exception
-- during allocation (because there is not enough storage), we
-- let it propagate without causing any side-effect.
Container.Elements := new Elements_Type'(Container.Last, Src);
-- We have successfully allocated a new internal array (with a
-- smaller length than the old one, and containing a copy of
-- just the active elements in the container), so we can
-- deallocate the old array.
Free (X);
end;
end if;
return;
end if;
-- Reserve_Capacity can be used to expand the storage available for
-- elements, but we do not let the capacity grow beyond the number of
-- values in Index_Type'Range. (Were it otherwise, there would be no way
-- to refer to the elements with index values greater than
-- Index_Type'Last, so that storage would be wasted.) Here we compute
-- the Last index value of the new internal array, in a way that avoids
-- any possibility of overflow.
if Index_Type'Base'Last >= Count_Type_Last then
-- We perform a two-part test. First we determine whether the
-- computed Last value lies in the base range of the type, and then
-- determine whether it lies in the range of the index (sub)type.
-- Last must satisfy this relation:
-- First + Length - 1 <= Last
-- We regroup terms:
-- First - 1 <= Last - Length
-- Which can rewrite as:
-- No_Index <= Last - Length
if Checks and then
Index_Type'Base'Last - Index_Type'Base (Capacity) < No_Index
then
raise Constraint_Error with "Capacity is out of range";
end if;
-- We now know that the computed value of Last is within the base
-- range of the type, so it is safe to compute its value:
Last := No_Index + Index_Type'Base (Capacity);
-- Finally we test whether the value is within the range of the
-- generic actual index subtype:
if Checks and then Last > Index_Type'Last then
raise Constraint_Error with "Capacity is out of range";
end if;
elsif Index_Type'First <= 0 then
-- Here we can compute Last directly, in the normal way. We know that
-- No_Index is less than 0, so there is no danger of overflow when
-- adding the (positive) value of Capacity.
Index := Count_Type'Base (No_Index) + Capacity; -- Last
if Checks and then Index > Count_Type'Base (Index_Type'Last) then
raise Constraint_Error with "Capacity is out of range";
end if;
-- We know that the computed value (having type Count_Type) of Last
-- is within the range of the generic actual index subtype, so it is
-- safe to convert to Index_Type:
Last := Index_Type'Base (Index);
else
-- Here Index_Type'First (and Index_Type'Last) is positive, so we
-- must test the length indirectly (by working backwards from the
-- largest possible value of Last), in order to prevent overflow.
Index := Count_Type'Base (Index_Type'Last) - Capacity; -- No_Index
if Checks and then Index < Count_Type'Base (No_Index) then
raise Constraint_Error with "Capacity is out of range";
end if;
-- We have determined that the value of Capacity would not create a
-- Last index value outside of the range of Index_Type, so we can now
-- safely compute its value.
Last := Index_Type'Base (Count_Type'Base (No_Index) + Capacity);
end if;
-- The requested capacity is non-zero, but we don't know yet whether
-- this is a request for expansion or contraction of storage.
if Container.Elements = null then
-- The container is empty (it doesn't even have an internal array),
-- so this represents a request to allocate storage having the given
-- capacity.
Container.Elements := new Elements_Type (Last);
return;
end if;
if Capacity <= N then
-- This is a request to trim back storage, but only to the limit of
-- what's already in the container. (Reserve_Capacity never deletes
-- active elements, it only reclaims excess storage.)
if N < Container.Elements.EA'Length then
-- The container is not empty (because the requested capacity is
-- positive, and less than or equal to the container length), and
-- the current length is less than the current capacity, so there
-- is storage available to trim. In this case, we allocate a new
-- internal array having a length that exactly matches the number
-- of items in the container.
TC_Check (Container.TC);
declare
subtype Array_Index_Subtype is Index_Type'Base range
Index_Type'First .. Container.Last;
Src : Elements_Array renames
Container.Elements.EA (Array_Index_Subtype);
X : Elements_Access := Container.Elements;
begin
-- Although we have isolated the old internal array that we're
-- going to deallocate, we don't deallocate it until we have
-- successfully allocated a new one. If there is an exception
-- during allocation (because there is not enough storage), we
-- let it propagate without causing any side-effect.
Container.Elements := new Elements_Type'(Container.Last, Src);
-- We have successfully allocated a new internal array (with a
-- smaller length than the old one, and containing a copy of
-- just the active elements in the container), so it is now
-- safe to deallocate the old array.
Free (X);
end;
end if;
return;
end if;
-- The requested capacity is larger than the container length (the
-- number of active elements). Whether this represents a request for
-- expansion or contraction of the current capacity depends on what the
-- current capacity is.
if Capacity = Container.Elements.EA'Length then
-- The requested capacity matches the existing capacity, so there's
-- nothing to do here. We treat this case as a no-op, and simply
-- return without checking the busy bit.
return;
end if;
-- There is a change in the capacity of a non-empty container, so a new
-- internal array will be allocated. (The length of the new internal
-- array could be less or greater than the old internal array. We know
-- only that the length of the new internal array is greater than the
-- number of active elements in the container.) We must check whether
-- the container is busy before doing anything else.
TC_Check (Container.TC);
-- We now allocate a new internal array, having a length different from
-- its current value.
declare
X : Elements_Access := Container.Elements;
subtype Index_Subtype is Index_Type'Base range
Index_Type'First .. Container.Last;
begin
-- We now allocate a new internal array, having a length different
-- from its current value.
Container.Elements := new Elements_Type (Last);
-- We have successfully allocated the new internal array, so now we
-- move the existing elements from the existing the old internal
-- array onto the new one. Note that we're just copying access
-- values, to this should not raise any exceptions.
Container.Elements.EA (Index_Subtype) := X.EA (Index_Subtype);
-- We have moved the elements from the old internal array, so now we
-- can deallocate it.
Free (X);
end;
end Reserve_Capacity;
----------------------
-- Reverse_Elements --
----------------------
procedure Reverse_Elements (Container : in out Vector) is
begin
if Container.Length <= 1 then
return;
end if;
-- The exception behavior for the vector container must match that for
-- the list container, so we check for cursor tampering here (which will
-- catch more things) instead of for element tampering (which will catch
-- fewer things). It's true that the elements of this vector container
-- could be safely moved around while (say) an iteration is taking place
-- (iteration only increments the busy counter), and so technically all
-- we would need here is a test for element tampering (indicated by the
-- lock counter), that's simply an artifact of our array-based
-- implementation. Logically Reverse_Elements requires a check for
-- cursor tampering.
TC_Check (Container.TC);
declare
I : Index_Type;
J : Index_Type;
E : Elements_Array renames Container.Elements.EA;
begin
I := Index_Type'First;
J := Container.Last;
while I < J loop
declare
EI : constant Element_Access := E (I);
begin
E (I) := E (J);
E (J) := EI;
end;
I := I + 1;
J := J - 1;
end loop;
end;
end Reverse_Elements;
------------------
-- Reverse_Find --
------------------
function Reverse_Find
(Container : Vector;
Item : Element_Type;
Position : Cursor := No_Element) return Cursor
is
Last : Index_Type'Base;
begin
if Checks and then Position.Container /= null
and then Position.Container /= Container'Unrestricted_Access
then
raise Program_Error with "Position cursor denotes wrong container";
end if;
Last :=
(if Position.Container = null or else Position.Index > Container.Last
then Container.Last
else Position.Index);
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
declare
Lock : With_Lock (Container.TC'Unrestricted_Access);
begin
for Indx in reverse Index_Type'First .. Last loop
if Container.Elements.EA (Indx) /= null
and then Container.Elements.EA (Indx).all = Item
then
return Cursor'(Container'Unrestricted_Access, Indx);
end if;
end loop;
return No_Element;
end;
end Reverse_Find;
------------------------
-- Reverse_Find_Index --
------------------------
function Reverse_Find_Index
(Container : Vector;
Item : Element_Type;
Index : Index_Type := Index_Type'Last) return Extended_Index
is
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
Lock : With_Lock (Container.TC'Unrestricted_Access);
Last : constant Index_Type'Base :=
Index_Type'Min (Container.Last, Index);
begin
for Indx in reverse Index_Type'First .. Last loop
if Container.Elements.EA (Indx) /= null
and then Container.Elements.EA (Indx).all = Item
then
return Indx;
end if;
end loop;
return No_Index;
end Reverse_Find_Index;
---------------------
-- Reverse_Iterate --
---------------------
procedure Reverse_Iterate
(Container : Vector;
Process : not null access procedure (Position : Cursor))
is
Busy : With_Busy (Container.TC'Unrestricted_Access);
begin
for Indx in reverse Index_Type'First .. Container.Last loop
Process (Cursor'(Container'Unrestricted_Access, Indx));
end loop;
end Reverse_Iterate;
----------------
-- Set_Length --
----------------
procedure Set_Length (Container : in out Vector; Length : Count_Type) is
Count : constant Count_Type'Base := Container.Length - Length;
begin
-- Set_Length allows the user to set the length explicitly, instead of
-- implicitly as a side-effect of deletion or insertion. If the
-- requested length is less than the current length, this is equivalent
-- to deleting items from the back end of the vector. If the requested
-- length is greater than the current length, then this is equivalent to
-- inserting "space" (nonce items) at the end.
if Count >= 0 then
Container.Delete_Last (Count);
elsif Checks and then Container.Last >= Index_Type'Last then
raise Constraint_Error with "vector is already at its maximum length";
else
Container.Insert_Space (Container.Last + 1, -Count);
end if;
end Set_Length;
----------
-- Swap --
----------
procedure Swap (Container : in out Vector; I, J : Index_Type) is
begin
if Checks then
if I > Container.Last then
raise Constraint_Error with "I index is out of range";
end if;
if J > Container.Last then
raise Constraint_Error with "J index is out of range";
end if;
end if;
if I = J then
return;
end if;
TE_Check (Container.TC);
declare
EI : Element_Access renames Container.Elements.EA (I);
EJ : Element_Access renames Container.Elements.EA (J);
EI_Copy : constant Element_Access := EI;
begin
EI := EJ;
EJ := EI_Copy;
end;
end Swap;
procedure Swap
(Container : in out Vector;
I, J : Cursor)
is
begin
if Checks then
if I.Container = null then
raise Constraint_Error with "I cursor has no element";
end if;
if J.Container = null then
raise Constraint_Error with "J cursor has no element";
end if;
if I.Container /= Container'Unrestricted_Access then
raise Program_Error with "I cursor denotes wrong container";
end if;
if J.Container /= Container'Unrestricted_Access then
raise Program_Error with "J cursor denotes wrong container";
end if;
end if;
Swap (Container, I.Index, J.Index);
end Swap;
---------------
-- To_Cursor --
---------------
function To_Cursor
(Container : Vector;
Index : Extended_Index) return Cursor
is
begin
if Index not in Index_Type'First .. Container.Last then
return No_Element;
end if;
return Cursor'(Container'Unrestricted_Access, Index);
end To_Cursor;
--------------
-- To_Index --
--------------
function To_Index (Position : Cursor) return Extended_Index is
begin
if Position.Container = null then
return No_Index;
elsif Position.Index <= Position.Container.Last then
return Position.Index;
else
return No_Index;
end if;
end To_Index;
---------------
-- To_Vector --
---------------
function To_Vector (Length : Count_Type) return Vector is
Index : Count_Type'Base;
Last : Index_Type'Base;
Elements : Elements_Access;
begin
if Length = 0 then
return Empty_Vector;
end if;
-- We create a vector object with a capacity that matches the specified
-- Length, but we do not allow the vector capacity (the length of the
-- internal array) to exceed the number of values in Index_Type'Range
-- (otherwise, there would be no way to refer to those components via an
-- index). We must therefore check whether the specified Length would
-- create a Last index value greater than Index_Type'Last.
if Index_Type'Base'Last >= Count_Type_Last then
-- We perform a two-part test. First we determine whether the
-- computed Last value lies in the base range of the type, and then
-- determine whether it lies in the range of the index (sub)type.
-- Last must satisfy this relation:
-- First + Length - 1 <= Last
-- We regroup terms:
-- First - 1 <= Last - Length
-- Which can rewrite as:
-- No_Index <= Last - Length
if Checks and then
Index_Type'Base'Last - Index_Type'Base (Length) < No_Index
then
raise Constraint_Error with "Length is out of range";
end if;
-- We now know that the computed value of Last is within the base
-- range of the type, so it is safe to compute its value:
Last := No_Index + Index_Type'Base (Length);
-- Finally we test whether the value is within the range of the
-- generic actual index subtype:
if Checks and then Last > Index_Type'Last then
raise Constraint_Error with "Length is out of range";
end if;
elsif Index_Type'First <= 0 then
-- Here we can compute Last directly, in the normal way. We know that
-- No_Index is less than 0, so there is no danger of overflow when
-- adding the (positive) value of Length.
Index := Count_Type'Base (No_Index) + Length; -- Last
if Checks and then Index > Count_Type'Base (Index_Type'Last) then
raise Constraint_Error with "Length is out of range";
end if;
-- We know that the computed value (having type Count_Type) of Last
-- is within the range of the generic actual index subtype, so it is
-- safe to convert to Index_Type:
Last := Index_Type'Base (Index);
else
-- Here Index_Type'First (and Index_Type'Last) is positive, so we
-- must test the length indirectly (by working backwards from the
-- largest possible value of Last), in order to prevent overflow.
Index := Count_Type'Base (Index_Type'Last) - Length; -- No_Index
if Checks and then Index < Count_Type'Base (No_Index) then
raise Constraint_Error with "Length is out of range";
end if;
-- We have determined that the value of Length would not create a
-- Last index value outside of the range of Index_Type, so we can now
-- safely compute its value.
Last := Index_Type'Base (Count_Type'Base (No_Index) + Length);
end if;
Elements := new Elements_Type (Last);
return Vector'(Controlled with Elements, Last, TC => <>);
end To_Vector;
function To_Vector
(New_Item : Element_Type;
Length : Count_Type) return Vector
is
Index : Count_Type'Base;
Last : Index_Type'Base;
Elements : Elements_Access;
begin
if Length = 0 then
return Empty_Vector;
end if;
-- We create a vector object with a capacity that matches the specified
-- Length, but we do not allow the vector capacity (the length of the
-- internal array) to exceed the number of values in Index_Type'Range
-- (otherwise, there would be no way to refer to those components via an
-- index). We must therefore check whether the specified Length would
-- create a Last index value greater than Index_Type'Last.
if Index_Type'Base'Last >= Count_Type_Last then
-- We perform a two-part test. First we determine whether the
-- computed Last value lies in the base range of the type, and then
-- determine whether it lies in the range of the index (sub)type.
-- Last must satisfy this relation:
-- First + Length - 1 <= Last
-- We regroup terms:
-- First - 1 <= Last - Length
-- Which can rewrite as:
-- No_Index <= Last - Length
if Checks and then
Index_Type'Base'Last - Index_Type'Base (Length) < No_Index
then
raise Constraint_Error with "Length is out of range";
end if;
-- We now know that the computed value of Last is within the base
-- range of the type, so it is safe to compute its value:
Last := No_Index + Index_Type'Base (Length);
-- Finally we test whether the value is within the range of the
-- generic actual index subtype:
if Checks and then Last > Index_Type'Last then
raise Constraint_Error with "Length is out of range";
end if;
elsif Index_Type'First <= 0 then
-- Here we can compute Last directly, in the normal way. We know that
-- No_Index is less than 0, so there is no danger of overflow when
-- adding the (positive) value of Length.
Index := Count_Type'Base (No_Index) + Length; -- Last
if Checks and then Index > Count_Type'Base (Index_Type'Last) then
raise Constraint_Error with "Length is out of range";
end if;
-- We know that the computed value (having type Count_Type) of Last
-- is within the range of the generic actual index subtype, so it is
-- safe to convert to Index_Type:
Last := Index_Type'Base (Index);
else
-- Here Index_Type'First (and Index_Type'Last) is positive, so we
-- must test the length indirectly (by working backwards from the
-- largest possible value of Last), in order to prevent overflow.
Index := Count_Type'Base (Index_Type'Last) - Length; -- No_Index
if Checks and then Index < Count_Type'Base (No_Index) then
raise Constraint_Error with "Length is out of range";
end if;
-- We have determined that the value of Length would not create a
-- Last index value outside of the range of Index_Type, so we can now
-- safely compute its value.
Last := Index_Type'Base (Count_Type'Base (No_Index) + Length);
end if;
Elements := new Elements_Type (Last);
-- We use Last as the index of the loop used to populate the internal
-- array with items. In general, we prefer to initialize the loop index
-- immediately prior to entering the loop. However, Last is also used in
-- the exception handler (to reclaim elements that have been allocated,
-- before propagating the exception), and the initialization of Last
-- after entering the block containing the handler confuses some static
-- analysis tools, with respect to whether Last has been properly
-- initialized when the handler executes. So here we initialize our loop
-- variable earlier than we prefer, before entering the block, so there
-- is no ambiguity.
Last := Index_Type'First;
declare
-- The element allocator may need an accessibility check in the case
-- where the actual type is class-wide or has access discriminants
-- (see RM 4.8(10.1) and AI12-0035).
pragma Unsuppress (Accessibility_Check);
begin
loop
Elements.EA (Last) := new Element_Type'(New_Item);
exit when Last = Elements.Last;
Last := Last + 1;
end loop;
exception
when others =>
for J in Index_Type'First .. Last - 1 loop
Free (Elements.EA (J));
end loop;
Free (Elements);
raise;
end;
return (Controlled with Elements, Last, TC => <>);
end To_Vector;
--------------------
-- Update_Element --
--------------------
procedure Update_Element
(Container : in out Vector;
Index : Index_Type;
Process : not null access procedure (Element : in out Element_Type))
is
Lock : With_Lock (Container.TC'Unchecked_Access);
begin
if Checks and then Index > Container.Last then
raise Constraint_Error with "Index is out of range";
end if;
if Checks and then Container.Elements.EA (Index) = null then
raise Constraint_Error with "element is null";
end if;
Process (Container.Elements.EA (Index).all);
end Update_Element;
procedure Update_Element
(Container : in out Vector;
Position : Cursor;
Process : not null access procedure (Element : in out Element_Type))
is
begin
if Checks then
if Position.Container = null then
raise Constraint_Error with "Position cursor has no element";
elsif Position.Container /= Container'Unrestricted_Access then
raise Program_Error with "Position cursor denotes wrong container";
end if;
end if;
Update_Element (Container, Position.Index, Process);
end Update_Element;
-----------
-- Write --
-----------
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Container : Vector)
is
N : constant Count_Type := Length (Container);
begin
Count_Type'Base'Write (Stream, N);
if N = 0 then
return;
end if;
declare
E : Elements_Array renames Container.Elements.EA;
begin
for Indx in Index_Type'First .. Container.Last loop
if E (Indx) = null then
Boolean'Write (Stream, False);
else
Boolean'Write (Stream, True);
Element_Type'Output (Stream, E (Indx).all);
end if;
end loop;
end;
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Position : Cursor)
is
begin
raise Program_Error with "attempt to stream vector cursor";
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Write;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Constant_Reference_Type)
is
begin
raise Program_Error with "attempt to stream reference";
end Write;
end Ada.Containers.Indefinite_Vectors;
|
oeis/025/A025964.asm | neoneye/loda-programs | 11 | 177427 | ; A025964: Expansion of 1/((1-2x)(1-4x)(1-5x)(1-12x)).
; Submitted by <NAME>
; 1,23,359,4843,61287,753315,9137263,110167211,1324737623,15911030707,191005360767,2292437677179,27511152416359,330143464656899,3961770291040271,47541489215721547,570499107794719095
mov $1,1
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
seq $0,16294 ; Expansion of 1/((1-2x)(1-4x)(1-12x)).
mul $1,5
add $1,$0
lpe
mov $0,$1
|
Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i7-7700_9_0xca.log_21829_1459.asm | ljhsiun2/medusa | 9 | 246022 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i7-7700_9_0xca.log_21829_1459.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x10d77, %rax
nop
cmp $37290, %rsi
mov $0x6162636465666768, %r11
movq %r11, (%rax)
nop
xor $23715, %rbp
lea addresses_WT_ht+0x3307, %rsi
lea addresses_WC_ht+0x16647, %rdi
nop
nop
nop
nop
and $42055, %r14
mov $123, %rcx
rep movsb
nop
nop
nop
sub %rcx, %rcx
lea addresses_UC_ht+0x9807, %rdi
clflush (%rdi)
nop
add %rax, %rax
mov (%rdi), %r14w
nop
nop
cmp $5056, %rsi
lea addresses_WT_ht+0x15fe7, %rsi
lea addresses_WC_ht+0x1db2f, %rdi
nop
nop
nop
nop
nop
and $56311, %r8
mov $78, %rcx
rep movsw
nop
cmp %rdi, %rdi
lea addresses_normal_ht+0x2247, %r14
nop
nop
nop
nop
add $62447, %rdi
movb $0x61, (%r14)
nop
nop
nop
inc %rbp
lea addresses_normal_ht+0x3087, %rsi
lea addresses_D_ht+0x156e7, %rdi
nop
nop
nop
nop
nop
cmp %r14, %r14
mov $33, %rcx
rep movsq
nop
nop
nop
nop
xor %rsi, %rsi
lea addresses_WT_ht+0xde7, %r11
lfence
movb $0x61, (%r11)
nop
nop
nop
nop
nop
dec %rsi
lea addresses_D_ht+0xe247, %rsi
lea addresses_UC_ht+0xf0a7, %rdi
and %rax, %rax
mov $12, %rcx
rep movsl
xor %rcx, %rcx
lea addresses_UC_ht+0xa557, %r14
nop
nop
nop
sub %rsi, %rsi
mov (%r14), %bp
nop
nop
nop
nop
nop
xor $19906, %r8
lea addresses_WT_ht+0x65f9, %r8
clflush (%r8)
nop
xor $50725, %rdi
mov (%r8), %eax
xor %r14, %r14
lea addresses_UC_ht+0x6647, %rsi
lea addresses_normal_ht+0x7307, %rdi
cmp %r11, %r11
mov $49, %rcx
rep movsw
nop
nop
nop
nop
nop
add $19426, %r8
lea addresses_WC_ht+0x18c7, %r11
nop
nop
nop
add $10279, %rax
mov (%r11), %r14w
nop
and %rax, %rax
lea addresses_WT_ht+0x18b0a, %rsi
lea addresses_WT_ht+0x5ac7, %rdi
clflush (%rsi)
nop
nop
nop
and $63900, %rbp
mov $102, %rcx
rep movsl
nop
nop
and %rax, %rax
lea addresses_normal_ht+0x3247, %rsi
nop
nop
add %rdi, %rdi
movw $0x6162, (%rsi)
nop
nop
nop
nop
mfence
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r8
push %r9
push %rax
push %rdx
// Faulty Load
lea addresses_UC+0x18247, %rax
nop
nop
xor %r9, %r9
mov (%rax), %edx
lea oracles, %r12
and $0xff, %rdx
shlq $12, %rdx
mov (%r12,%rdx,1), %rdx
pop %rdx
pop %rax
pop %r9
pop %r8
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': True, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': True, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': True, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': True, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 6, 'same': True, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 5, 'AVXalign': True, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_normal_ht'}}
{'44': 6280, '49': 13, '00': 15501, '04': 35}
00 00 00 00 00 44 00 44 00 44 00 00 44 00 00 00 00 00 44 00 00 00 00 44 00 00 00 44 00 00 00 00 44 00 00 00 44 00 00 00 00 00 00 00 00 44 00 44 44 44 00 44 00 00 44 00 00 00 00 00 00 00 00 00 00 00 44 44 00 44 00 44 44 44 00 00 00 00 00 00 00 00 00 44 44 00 44 00 00 00 00 44 00 00 44 44 00 44 44 00 00 00 00 44 00 00 44 44 44 00 44 44 00 44 00 44 00 00 00 00 00 00 00 44 00 44 44 00 44 00 00 00 00 00 00 00 00 00 00 44 04 44 44 44 00 00 44 44 00 44 00 00 00 00 00 00 00 00 00 44 00 00 00 44 00 44 00 00 00 00 00 00 00 44 00 00 00 00 00 44 00 00 44 44 00 44 00 44 00 00 00 00 00 00 00 00 00 00 00 00 44 44 44 00 44 00 00 00 44 00 00 00 00 44 44 00 44 00 44 00 00 44 00 00 00 44 00 00 44 00 44 00 00 00 44 00 00 44 44 00 00 44 44 00 44 44 00 00 44 00 00 00 00 44 00 00 00 00 44 44 44 00 44 00 00 00 00 00 44 00 00 00 00 44 00 44 00 44 44 44 44 44 00 00 00 00 00 44 00 00 00 00 44 00 00 00 44 00 00 44 44 44 00 00 44 00 00 00 00 44 00 44 44 44 44 00 00 00 00 44 00 00 00 00 00 00 00 00 00 44 00 00 00 00 00 44 49 44 00 44 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 44 44 00 44 00 44 44 00 00 00 00 00 44 00 00 00 44 00 00 44 00 44 00 00 00 00 00 44 00 00 00 00 00 44 00 00 00 44 44 00 00 44 00 44 44 44 00 00 00 00 00 00 00 00 00 00 44 44 44 44 00 00 00 00 00 00 44 44 44 00 00 44 00 00 00 44 00 44 00 44 44 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 44 00 00 44 00 00 44 00 00 00 00 00 00 00 00 00 00 44 44 00 00 00 00 00 44 00 44 44 00 00 00 00 00 00 00 00 44 44 44 00 00 44 00 44 44 00 00 00 00 44 00 44 00 44 00 00 44 00 00 00 00 44 44 44 44 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 44 00 44 00 00 00 44 44 44 00 44 44 00 00 44 00 00 44 44 00 00 00 00 00 44 00 00 00 00 44 00 00 00 00 00 44 00 00 00 00 00 00 00 00 44 00 44 00 00 00 00 44 00 44 00 00 00 00 44 00 00 44 00 00 00 00 00 00 00 00 44 00 00 00 00 44 00 44 00 00 44 00 00 00 00 44 44 00 00 00 00 00 44 00 00 00 44 00 00 44 44 00 00 00 00 00 44 00 00 00 00 00 00 00 00 44 00 00 00 00 00 00 00 00 44 00 44 00 00 44 00 00 00 00 44 44 44 00 44 00 00 44 00 44 00 00 44 00 00 00 00 00 44 00 44 00 44 00 44 00 00 44 00 00 44 44 00 44 00 00 00 44 44 00 00 00 44 00 00 44 00 44 00 00 00 00 44 44 00 44 00 00 00 00 00 00 44 00 44 00 44 00 00 00 44 00 44 00 44 00 00 00 00 44 00 00 44 00 00 00 00 00 00 00 44 00 00 00 44 00 00 00 00 44 00 44 00 00 44 44 44 44 00 00 00 44 00 00 00 44 44 00 44 00 44 00 00 00 00 00 00 00 00 00 00 44 00 00 44 44 44 44 00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 44 00 44 00 00 00 00 00 00 00 00 00 00 44 00 44 44 44 00 00 44 44 00 00 00 44 00 44 00 44 44 44 00 00 44 00 00 00 00 44 00 00 44 00 00 00 44 44 00 00 00 00 44 00 00 00 00 00 00 44 00 00 00 00 44 44 00 44 00 00 00 44 44 00 44 00 00 44 44 00 00 44 44 44 00 00 00 00 00 00 00 00 00 00 44 00 00 44 00 00 00 00 44 00 44 00 44 00 00 00 00 00 44 44 00 44 44 00 44 00 00 00 44 00 44 00 44 44 00 44 00 00 44 44 00 00 44 44 00 00 44 00 00 44 00 00 44 44 00 00 44 00 00 44 00 00 44 44 00 44 44 00 44 44 00 00 00 44 00 00 44 00 00
*/
|
source/amf/mof/cmof/amf-internals-tables-cmof_metamodel-objects.ads | svn2github/matreshka | 24 | 585 | <reponame>svn2github/matreshka
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- This file is generated, don't edit it.
------------------------------------------------------------------------------
package AMF.Internals.Tables.CMOF_Metamodel.Objects is
procedure Initialize;
private
procedure Initialize_1 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_2 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_3 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_4 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_5 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_6 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_7 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_8 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_9 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_10 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_11 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_12 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_13 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_14 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_15 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_16 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_17 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_18 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_19 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_20 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_21 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_22 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_23 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_24 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_25 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_26 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_27 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_28 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_29 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_30 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_31 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_32 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_33 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_34 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_35 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_36 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_37 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_38 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_39 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_40 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_41 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_42 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_43 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_44 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_45 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_46 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_47 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_48 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_49 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_50 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_51 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_52 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_53 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_54 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_55 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_56 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_57 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_58 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_59 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_60 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_61 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_62 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_63 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_64 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_65 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_66 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_67 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_68 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_69 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_70 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_71 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_72 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_73 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_74 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_75 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_76 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_77 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_78 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_79 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_80 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_81 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_82 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_83 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_84 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_85 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_86 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_87 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_88 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_89 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_90 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_91 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_92 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_93 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_94 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_95 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_96 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_97 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_98 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_99 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_100 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_101 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_102 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_103 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_104 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_105 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_106 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_107 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_108 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_109 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_110 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_111 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_112 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_113 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_114 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_115 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_116 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_117 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_118 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_119 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_120 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_121 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_122 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_123 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_124 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_125 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_126 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_127 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_128 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_129 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_130 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_131 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_132 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_133 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_134 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_135 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_136 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_137 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_138 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_139 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_140 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_141 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_142 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_143 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_144 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_145 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_146 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_147 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_148 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_149 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_150 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_151 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_152 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_153 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_154 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_155 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_156 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_157 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_158 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_159 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_160 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_161 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_162 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_163 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_164 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_165 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_166 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_167 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_168 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_169 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_170 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_171 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_172 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_173 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_174 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_175 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_176 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_177 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_178 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_179 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_180 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_181 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_182 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_183 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_184 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_185 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_186 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_187 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_188 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_189 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_190 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_191 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_192 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_193 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_194 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_195 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_196 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_197 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_198 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_199 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_200 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_201 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_202 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_203 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_204 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_205 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_206 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_207 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_208 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_209 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_210 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_211 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_212 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_213 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_214 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_215 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_216 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_217 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_218 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_219 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_220 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_221 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_222 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_223 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_224 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_225 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_226 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_227 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_228 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_229 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_230 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_231 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_232 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_233 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_234 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_235 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_236 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_237 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_238 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_239 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_240 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_241 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_242 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_243 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_244 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_245 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_246 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_247 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_248 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_249 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_250 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_251 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_252 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_253 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_254 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_255 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_256 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_257 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_258 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_259 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_260 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_261 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_262 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_263 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_264 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_265 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_266 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_267 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_268 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_269 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_270 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_271 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_272 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_273 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_274 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_275 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_276 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_277 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_278 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_279 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_280 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_281 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_282 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_283 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_284 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_285 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_286 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_287 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_288 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_289 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_290 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_291 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_292 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_293 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_294 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_295 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_296 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_297 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_298 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_299 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_300 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_301 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_302 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_303 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_304 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_305 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_306 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_307 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_308 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_309 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_310 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_311 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_312 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_313 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_314 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_315 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_316 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_317 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_318 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_319 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_320 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_321 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_322 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_323 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_324 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_325 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_326 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_327 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_328 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_329 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_330 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_331 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_332 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_333 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_334 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_335 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_336 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_337 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_338 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_339 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_340 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_341 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_342 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_343 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_344 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_345 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_346 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_347 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_348 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_349 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_350 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_351 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_352 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_353 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_354 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_355 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_356 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_357 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_358 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_359 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_360 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_361 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_362 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_363 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_364 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_365 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_366 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_367 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_368 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_369 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_370 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_371 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_372 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_373 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_374 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_375 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_376 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_377 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_378 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_379 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_380 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_381 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_382 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_383 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_384 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_385 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_386 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_387 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_388 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_389 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_390 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_391 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_392 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_393 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_394 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_395 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_396 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_397 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_398 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_399 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_400 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_401 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_402 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_403 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_404 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_405 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_406 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_407 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_408 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_409 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_410 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_411 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_412 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_413 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_414 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_415 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_416 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_417 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_418 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_419 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_420 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_421 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_422 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_423 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_424 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_425 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_426 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_427 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_428 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_429 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_430 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_431 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_432 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_433 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_434 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_435 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_436 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_437 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_438 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_439 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_440 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_441 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_442 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_443 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_444 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_445 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_446 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_447 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_448 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_449 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_450 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_451 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_452 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_453 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_454 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_455 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_456 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_457 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_458 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_459 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_460 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_461 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_462 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_463 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_464 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_465 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_466 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_467 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_468 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_469 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_470 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_471 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_472 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_473 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_474 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_475 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_476 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_477 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_478 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_479 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_480 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_481 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_482 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_483 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_484 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_485 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_486 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_487 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_488 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_489 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_490 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_491 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_492 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_493 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_494 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_495 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_496 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_497 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_498 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_499 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_500 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_501 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_502 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_503 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_504 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_505 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_506 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_507 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_508 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_509 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_510 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_511 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_512 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_513 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_514 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_515 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_516 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_517 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_518 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_519 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_520 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_521 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_522 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_523 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_524 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_525 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_526 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_527 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_528 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_529 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_530 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_531 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_532 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_533 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_534 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_535 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_536 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_537 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_538 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_539 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_540 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_541 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_542 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_543 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_544 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_545 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_546 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_547 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_548 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_549 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_550 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_551 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_552 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_553 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_554 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_555 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_556 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_557 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_558 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_559 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_560 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_561 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_562 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_563 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_564 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_565 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_566 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_567 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_568 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_569 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_570 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_571 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_572 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_573 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_574 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_575 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_576 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_577 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_578 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_579 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_580 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_581 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_582 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_583 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_584 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_585 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_586 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_587 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_588 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_589 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_590 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_591 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_592 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_593 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_594 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_595 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_596 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_597 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_598 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_599 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_600 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_601 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_602 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_603 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_604 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_605 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_606 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_607 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_608 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_609 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_610 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_611 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_612 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_613 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_614 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_615 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_616 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_617 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_618 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_619 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_620 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_621 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_622 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_623 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_624 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_625 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_626 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_627 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_628 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_629 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_630 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_631 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_632 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_633 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_634 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_635 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_636 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_637 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_638 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_639 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_640 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_641 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_642 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_643 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_644 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_645 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_646 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_647 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_648 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_649 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_650 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_651 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_652 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_653 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_654 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_655 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_656 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_657 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_658 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_659 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_660 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_661 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_662 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_663 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_664 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_665 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_666 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_667 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_668 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_669 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_670 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_671 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_672 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_673 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_674 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_675 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_676 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_677 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_678 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_679 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_680 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_681 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_682 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_683 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_684 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_685 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_686 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_687 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_688 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_689 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_690 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_691 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_692 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_693 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_694 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_695 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_696 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_697 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_698 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_699 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_700 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_701 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_702 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_703 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_704 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_705 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_706 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_707 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_708 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_709 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_710 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_711 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_712 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_713 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_714 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_715 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_716 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_717 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_718 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_719 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_720 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_721 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_722 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_723 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_724 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_725 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_726 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_727 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_728 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_729 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_730 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_731 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_732 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_733 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_734 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_735 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_736 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_737 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_738 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_739 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_740 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_741 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_742 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_743 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_744 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_745 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_746 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_747 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_748 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_749 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_750 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_751 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_752 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_753 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_754 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_755 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_756 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_757 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_758 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_759 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_760 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_761 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_762 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_763 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_764 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_765 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_766 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_767 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_768 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_769 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_770 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_771 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_772 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_773 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_774 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_775 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_776 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_777 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_778 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_779 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_780 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_781 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_782 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_783 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_784 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_785 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_786 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_787 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_788 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_789 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_790 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_791 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_792 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_793 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_794 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_795 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_796 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_797 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_798 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_799 (Extent : AMF.Internals.AMF_Extent);
procedure Initialize_800 (Extent : AMF.Internals.AMF_Extent);
end AMF.Internals.Tables.CMOF_Metamodel.Objects;
|
src/main/antlr4/imports/Instructions.g4 | Yucukof/edu-antlr4-toy-parser-to-nbc | 0 | 2887 | <gh_stars>0
grammar Instructions;
import Expressions
, Words;
instruction: skip='skip' # SkipInstr
| IF expression THEN body (ELSE body)? DONE # IfInstr
| WHILE expression DO body DONE # WhileInstr
| SET variable TO expression # SetInstr
| COMPUTE expression # ComputeInstr
| NEXT action # NextInstr
;
body: instruction+
;
action: (MOVE|SHOOT) (NORTH|SOUTH|EAST|WEST)
| USE (MAP|RADAR|RADIO|FRUITS|SODA)
| DO NOTHING
;
|
oeis/049/A049859.asm | neoneye/loda-programs | 11 | 23492 | <filename>oeis/049/A049859.asm<gh_stars>10-100
; A049859: a(n) = Sum_{k=0,1,2,...,n-4,n-2,n-1} a(k); a(n-3) is not a summand; 3 initial terms required.
; Submitted by <NAME>
; 0,1,3,4,7,12,23,43,81,151,282,526,982,1833,3422,6388,11925,22261,41556,77575,144814,270333,504647,942055,1758591,3282868,6128328,11440120,21355963,39866466,74421140,138926437,259342371,484130068
mov $2,1
mov $3,3
lpb $0
sub $0,1
sub $3,$4
add $1,$3
mov $3,$4
mov $4,$2
mov $2,$3
add $2,$1
add $5,$4
mov $3,$5
lpe
mov $0,$4
|
dependencies/agar/ada-gui/UNIT_TESTS/ada_size.adb | amvb/GUCEF | 5 | 16976 | <gh_stars>1-10
-- auto generated, do not edit
with ada.text_io;
with ada.command_line;
with agar;
with agar.gui;
with agar.gui.colors;
with agar.gui.pixelformat;
with agar.gui.point;
with agar.gui.rect;
with agar.gui.style;
with agar.gui.surface;
with agar.gui.text;
with agar.gui.unit;
with agar.gui.view;
with agar.gui.widget;
with agar.gui.widget.box;
with agar.gui.widget.button;
with agar.gui.widget.checkbox;
with agar.gui.widget.combo;
with agar.gui.widget.console;
with agar.gui.widget.editable;
with agar.gui.widget.file_dialog;
with agar.gui.widget.fixed;
with agar.gui.widget.fixed_plotter;
with agar.gui.widget.graph;
with agar.gui.widget.hbox;
with agar.gui.widget.hsvpal;
with agar.gui.widget.icon;
with agar.gui.widget.label;
with agar.gui.widget.menu;
with agar.gui.widget.mpane;
with agar.gui.widget.notebook;
with agar.gui.widget.numerical;
with agar.gui.widget.pane;
with agar.gui.widget.pixmap;
with agar.gui.widget.progress_bar;
with agar.gui.widget.radio;
with agar.gui.widget.scrollbar;
with agar.gui.widget.separator;
with agar.gui.widget.slider;
with agar.gui.widget.socket;
with agar.gui.widget.table;
with agar.gui.widget.textbox;
with agar.gui.widget.titlebar;
with agar.gui.widget.tlist;
with agar.gui.widget.toolbar;
with agar.gui.widget.ucombo;
with agar.gui.widget.vbox;
with agar.gui.window;
procedure ada_size is
package io renames ada.text_io;
package cmdline renames ada.command_line;
-- generic types
type generic_t is new integer;
type generic_access_t is access all generic_t;
-- package instantiations
package gen_agar_gui_widget_fixed is new agar.gui.widget.fixed
(child_type => generic_t, child_access_type => generic_access_t);
-- type names
agar_gui_colors_blend_func_t : aliased string := "agar.gui.colors.blend_func_t";
agar_gui_colors_color_t : aliased string := "agar.gui.colors.color_t";
agar_gui_pixelformat_pixel_format_access_t : aliased string := "agar.gui.pixelformat.pixel_format_access_t";
agar_gui_pixelformat_pixel_format_t : aliased string := "agar.gui.pixelformat.pixel_format_t";
agar_gui_point_point_t : aliased string := "agar.gui.point.point_t";
agar_gui_rect_rect_access_t : aliased string := "agar.gui.rect.rect_access_t";
agar_gui_rect_rect_t : aliased string := "agar.gui.rect.rect_t";
agar_gui_rect_rect2_access_t : aliased string := "agar.gui.rect.rect2_access_t";
agar_gui_rect_rect2_t : aliased string := "agar.gui.rect.rect2_t";
agar_gui_style_style_access_t : aliased string := "agar.gui.style.style_access_t";
agar_gui_style_style_t : aliased string := "agar.gui.style.style_t";
agar_gui_surface_surface_access_t : aliased string := "agar.gui.surface.surface_access_t";
agar_gui_surface_surface_t : aliased string := "agar.gui.surface.surface_t";
agar_gui_text_font_access_t : aliased string := "agar.gui.text.font_access_t";
agar_gui_text_font_t : aliased string := "agar.gui.text.font_t";
agar_gui_text_font_type_t : aliased string := "agar.gui.text.font_type_t";
agar_gui_text_glyph_access_t : aliased string := "agar.gui.text.glyph_access_t";
agar_gui_text_glyph_t : aliased string := "agar.gui.text.glyph_t";
agar_gui_text_justify_t : aliased string := "agar.gui.text.justify_t";
agar_gui_text_metrics_access_t : aliased string := "agar.gui.text.metrics_access_t";
agar_gui_text_metrics_t : aliased string := "agar.gui.text.metrics_t";
agar_gui_text_msg_title_t : aliased string := "agar.gui.text.msg_title_t";
agar_gui_text_state_access_t : aliased string := "agar.gui.text.state_access_t";
agar_gui_text_state_t : aliased string := "agar.gui.text.state_t";
agar_gui_text_static_font_access_t : aliased string := "agar.gui.text.static_font_access_t";
agar_gui_text_static_font_t : aliased string := "agar.gui.text.static_font_t";
agar_gui_text_valign_t : aliased string := "agar.gui.text.valign_t";
agar_gui_unit_unit_t : aliased string := "agar.gui.unit.unit_t";
agar_gui_view_display_t : aliased string := "agar.gui.view.display_t";
agar_gui_widget_binding_access_t : aliased string := "agar.gui.widget.binding_access_t";
agar_gui_widget_binding_t : aliased string := "agar.gui.widget.binding_t";
agar_gui_widget_binding_type_t : aliased string := "agar.gui.widget.binding_type_t";
agar_gui_widget_box_box_access_t : aliased string := "agar.gui.widget.box.box_access_t";
agar_gui_widget_box_box_t : aliased string := "agar.gui.widget.box.box_t";
agar_gui_widget_box_type_t : aliased string := "agar.gui.widget.box.type_t";
agar_gui_widget_button_button_access_t : aliased string := "agar.gui.widget.button.button_access_t";
agar_gui_widget_button_button_t : aliased string := "agar.gui.widget.button.button_t";
agar_gui_widget_checkbox_checkbox_access_t : aliased string := "agar.gui.widget.checkbox.checkbox_access_t";
agar_gui_widget_checkbox_checkbox_t : aliased string := "agar.gui.widget.checkbox.checkbox_t";
agar_gui_widget_class_access_t : aliased string := "agar.gui.widget.class_access_t";
agar_gui_widget_class_t : aliased string := "agar.gui.widget.class_t";
agar_gui_widget_combo_combo_access_t : aliased string := "agar.gui.widget.combo.combo_access_t";
agar_gui_widget_combo_combo_t : aliased string := "agar.gui.widget.combo.combo_t";
agar_gui_widget_console_console_access_t : aliased string := "agar.gui.widget.console.console_access_t";
agar_gui_widget_console_console_t : aliased string := "agar.gui.widget.console.console_t";
agar_gui_widget_console_line_access_t : aliased string := "agar.gui.widget.console.line_access_t";
agar_gui_widget_console_line_t : aliased string := "agar.gui.widget.console.line_t";
agar_gui_widget_editable_editable_access_t : aliased string := "agar.gui.widget.editable.editable_access_t";
agar_gui_widget_editable_editable_t : aliased string := "agar.gui.widget.editable.editable_t";
agar_gui_widget_editable_encoding_t : aliased string := "agar.gui.widget.editable.encoding_t";
agar_gui_widget_file_dialog_file_dialog_access_t : aliased string := "agar.gui.widget.file_dialog.file_dialog_access_t";
agar_gui_widget_file_dialog_file_dialog_t : aliased string := "agar.gui.widget.file_dialog.file_dialog_t";
agar_gui_widget_file_dialog_filetype_access_t : aliased string := "agar.gui.widget.file_dialog.filetype_access_t";
agar_gui_widget_file_dialog_filetype_t : aliased string := "agar.gui.widget.file_dialog.filetype_t";
agar_gui_widget_file_dialog_option_access_t : aliased string := "agar.gui.widget.file_dialog.option_access_t";
agar_gui_widget_file_dialog_option_t : aliased string := "agar.gui.widget.file_dialog.option_t";
agar_gui_widget_file_dialog_option_type_t : aliased string := "agar.gui.widget.file_dialog.option_type_t";
agar_gui_widget_fixed_fixed_access_t : aliased string := "agar.gui.widget.fixed.fixed_access_t";
agar_gui_widget_fixed_fixed_t : aliased string := "agar.gui.widget.fixed.fixed_t";
agar_gui_widget_fixed_plotter_item_access_t : aliased string := "agar.gui.widget.fixed_plotter.item_access_t";
agar_gui_widget_fixed_plotter_item_t : aliased string := "agar.gui.widget.fixed_plotter.item_t";
agar_gui_widget_fixed_plotter_plotter_access_t : aliased string := "agar.gui.widget.fixed_plotter.plotter_access_t";
agar_gui_widget_fixed_plotter_plotter_t : aliased string := "agar.gui.widget.fixed_plotter.plotter_t";
agar_gui_widget_fixed_plotter_type_t : aliased string := "agar.gui.widget.fixed_plotter.type_t";
agar_gui_widget_flag_descr_access_t : aliased string := "agar.gui.widget.flag_descr_access_t";
agar_gui_widget_flag_descr_t : aliased string := "agar.gui.widget.flag_descr_t";
agar_gui_widget_graph_edge_access_t : aliased string := "agar.gui.widget.graph.edge_access_t";
agar_gui_widget_graph_edge_t : aliased string := "agar.gui.widget.graph.edge_t";
agar_gui_widget_graph_graph_access_t : aliased string := "agar.gui.widget.graph.graph_access_t";
agar_gui_widget_graph_graph_t : aliased string := "agar.gui.widget.graph.graph_t";
agar_gui_widget_graph_vertex_access_t : aliased string := "agar.gui.widget.graph.vertex_access_t";
agar_gui_widget_graph_vertex_style_t : aliased string := "agar.gui.widget.graph.vertex_style_t";
agar_gui_widget_graph_vertex_t : aliased string := "agar.gui.widget.graph.vertex_t";
agar_gui_widget_hbox_hbox_access_t : aliased string := "agar.gui.widget.hbox.hbox_access_t";
agar_gui_widget_hbox_hbox_t : aliased string := "agar.gui.widget.hbox.hbox_t";
agar_gui_widget_hsvpal_hsvpal_access_t : aliased string := "agar.gui.widget.hsvpal.hsvpal_access_t";
agar_gui_widget_hsvpal_hsvpal_t : aliased string := "agar.gui.widget.hsvpal.hsvpal_t";
agar_gui_widget_icon_icon_access_t : aliased string := "agar.gui.widget.icon.icon_access_t";
agar_gui_widget_icon_icon_t : aliased string := "agar.gui.widget.icon.icon_t";
agar_gui_widget_label_flag_t : aliased string := "agar.gui.widget.label.flag_t";
agar_gui_widget_label_format_func_t : aliased string := "agar.gui.widget.label.format_func_t";
agar_gui_widget_label_format_spec_access_t : aliased string := "agar.gui.widget.label.format_spec_access_t";
agar_gui_widget_label_format_spec_t : aliased string := "agar.gui.widget.label.format_spec_t";
agar_gui_widget_label_label_access_t : aliased string := "agar.gui.widget.label.label_access_t";
agar_gui_widget_label_label_t : aliased string := "agar.gui.widget.label.label_t";
agar_gui_widget_label_type_t : aliased string := "agar.gui.widget.label.type_t";
agar_gui_widget_menu_binding_t : aliased string := "agar.gui.widget.menu.binding_t";
agar_gui_widget_menu_item_access_t : aliased string := "agar.gui.widget.menu.item_access_t";
agar_gui_widget_menu_item_t : aliased string := "agar.gui.widget.menu.item_t";
agar_gui_widget_menu_menu_access_t : aliased string := "agar.gui.widget.menu.menu_access_t";
agar_gui_widget_menu_menu_t : aliased string := "agar.gui.widget.menu.menu_t";
agar_gui_widget_menu_popup_menu_access_t : aliased string := "agar.gui.widget.menu.popup_menu_access_t";
agar_gui_widget_menu_popup_menu_t : aliased string := "agar.gui.widget.menu.popup_menu_t";
agar_gui_widget_menu_view_access_t : aliased string := "agar.gui.widget.menu.view_access_t";
agar_gui_widget_menu_view_t : aliased string := "agar.gui.widget.menu.view_t";
agar_gui_widget_mpane_layout_t : aliased string := "agar.gui.widget.mpane.layout_t";
agar_gui_widget_mpane_mpane_access_t : aliased string := "agar.gui.widget.mpane.mpane_access_t";
agar_gui_widget_mpane_mpane_t : aliased string := "agar.gui.widget.mpane.mpane_t";
agar_gui_widget_notebook_notebook_access_t : aliased string := "agar.gui.widget.notebook.notebook_access_t";
agar_gui_widget_notebook_notebook_t : aliased string := "agar.gui.widget.notebook.notebook_t";
agar_gui_widget_notebook_tab_access_t : aliased string := "agar.gui.widget.notebook.tab_access_t";
agar_gui_widget_notebook_tab_alignment_t : aliased string := "agar.gui.widget.notebook.tab_alignment_t";
agar_gui_widget_notebook_tab_t : aliased string := "agar.gui.widget.notebook.tab_t";
agar_gui_widget_numerical_numerical_access_t : aliased string := "agar.gui.widget.numerical.numerical_access_t";
agar_gui_widget_numerical_numerical_t : aliased string := "agar.gui.widget.numerical.numerical_t";
agar_gui_widget_pane_pane_access_t : aliased string := "agar.gui.widget.pane.pane_access_t";
agar_gui_widget_pane_pane_t : aliased string := "agar.gui.widget.pane.pane_t";
agar_gui_widget_pane_type_t : aliased string := "agar.gui.widget.pane.type_t";
agar_gui_widget_pixmap_pixmap_access_t : aliased string := "agar.gui.widget.pixmap.pixmap_access_t";
agar_gui_widget_pixmap_pixmap_t : aliased string := "agar.gui.widget.pixmap.pixmap_t";
agar_gui_widget_progress_bar_progress_bar_access_t : aliased string := "agar.gui.widget.progress_bar.progress_bar_access_t";
agar_gui_widget_progress_bar_progress_bar_t : aliased string := "agar.gui.widget.progress_bar.progress_bar_t";
agar_gui_widget_progress_bar_type_t : aliased string := "agar.gui.widget.progress_bar.type_t";
agar_gui_widget_radio_item_access_t : aliased string := "agar.gui.widget.radio.item_access_t";
agar_gui_widget_radio_item_t : aliased string := "agar.gui.widget.radio.item_t";
agar_gui_widget_radio_radio_access_t : aliased string := "agar.gui.widget.radio.radio_access_t";
agar_gui_widget_radio_radio_t : aliased string := "agar.gui.widget.radio.radio_t";
agar_gui_widget_scrollbar_button_t : aliased string := "agar.gui.widget.scrollbar.button_t";
agar_gui_widget_scrollbar_scrollbar_access_t : aliased string := "agar.gui.widget.scrollbar.scrollbar_access_t";
agar_gui_widget_scrollbar_scrollbar_t : aliased string := "agar.gui.widget.scrollbar.scrollbar_t";
agar_gui_widget_scrollbar_type_t : aliased string := "agar.gui.widget.scrollbar.type_t";
agar_gui_widget_separator_separator_access_t : aliased string := "agar.gui.widget.separator.separator_access_t";
agar_gui_widget_separator_separator_t : aliased string := "agar.gui.widget.separator.separator_t";
agar_gui_widget_separator_type_t : aliased string := "agar.gui.widget.separator.type_t";
agar_gui_widget_size_req_access_t : aliased string := "agar.gui.widget.size_req_access_t";
agar_gui_widget_size_req_t : aliased string := "agar.gui.widget.size_req_t";
agar_gui_widget_size_spec_t : aliased string := "agar.gui.widget.size_spec_t";
agar_gui_widget_slider_button_t : aliased string := "agar.gui.widget.slider.button_t";
agar_gui_widget_slider_slider_access_t : aliased string := "agar.gui.widget.slider.slider_access_t";
agar_gui_widget_slider_slider_t : aliased string := "agar.gui.widget.slider.slider_t";
agar_gui_widget_slider_type_t : aliased string := "agar.gui.widget.slider.type_t";
agar_gui_widget_socket_bg_type_t : aliased string := "agar.gui.widget.socket.bg_type_t";
agar_gui_widget_socket_socket_access_t : aliased string := "agar.gui.widget.socket.socket_access_t";
agar_gui_widget_socket_socket_t : aliased string := "agar.gui.widget.socket.socket_t";
agar_gui_widget_table_cell_access_t : aliased string := "agar.gui.widget.table.cell_access_t";
agar_gui_widget_table_cell_t : aliased string := "agar.gui.widget.table.cell_t";
agar_gui_widget_table_cell_type_t : aliased string := "agar.gui.widget.table.cell_type_t";
agar_gui_widget_table_column_access_t : aliased string := "agar.gui.widget.table.column_access_t";
agar_gui_widget_table_column_t : aliased string := "agar.gui.widget.table.column_t";
agar_gui_widget_table_popup_access_t : aliased string := "agar.gui.widget.table.popup_access_t";
agar_gui_widget_table_popup_t : aliased string := "agar.gui.widget.table.popup_t";
agar_gui_widget_table_select_mode_t : aliased string := "agar.gui.widget.table.select_mode_t";
agar_gui_widget_table_table_access_t : aliased string := "agar.gui.widget.table.table_access_t";
agar_gui_widget_table_table_t : aliased string := "agar.gui.widget.table.table_t";
agar_gui_widget_textbox_textbox_access_t : aliased string := "agar.gui.widget.textbox.textbox_access_t";
agar_gui_widget_textbox_textbox_t : aliased string := "agar.gui.widget.textbox.textbox_t";
agar_gui_widget_titlebar_titlebar_access_t : aliased string := "agar.gui.widget.titlebar.titlebar_access_t";
agar_gui_widget_titlebar_titlebar_t : aliased string := "agar.gui.widget.titlebar.titlebar_t";
agar_gui_widget_tlist_item_access_t : aliased string := "agar.gui.widget.tlist.item_access_t";
agar_gui_widget_tlist_item_t : aliased string := "agar.gui.widget.tlist.item_t";
agar_gui_widget_tlist_popup_access_t : aliased string := "agar.gui.widget.tlist.popup_access_t";
agar_gui_widget_tlist_popup_t : aliased string := "agar.gui.widget.tlist.popup_t";
agar_gui_widget_tlist_tlist_access_t : aliased string := "agar.gui.widget.tlist.tlist_access_t";
agar_gui_widget_tlist_tlist_t : aliased string := "agar.gui.widget.tlist.tlist_t";
agar_gui_widget_toolbar_toolbar_access_t : aliased string := "agar.gui.widget.toolbar.toolbar_access_t";
agar_gui_widget_toolbar_toolbar_t : aliased string := "agar.gui.widget.toolbar.toolbar_t";
agar_gui_widget_toolbar_type_t : aliased string := "agar.gui.widget.toolbar.type_t";
agar_gui_widget_ucombo_ucombo_access_t : aliased string := "agar.gui.widget.ucombo.ucombo_access_t";
agar_gui_widget_ucombo_ucombo_t : aliased string := "agar.gui.widget.ucombo.ucombo_t";
agar_gui_widget_vbox_vbox_access_t : aliased string := "agar.gui.widget.vbox.vbox_access_t";
agar_gui_widget_vbox_vbox_t : aliased string := "agar.gui.widget.vbox.vbox_t";
agar_gui_widget_widget_access_t : aliased string := "agar.gui.widget.widget_access_t";
agar_gui_widget_widget_t : aliased string := "agar.gui.widget.widget_t";
agar_gui_window_alignment_t : aliased string := "agar.gui.window.alignment_t";
agar_gui_window_close_action_t : aliased string := "agar.gui.window.close_action_t";
agar_gui_window_window_access_t : aliased string := "agar.gui.window.window_access_t";
agar_gui_window_window_t : aliased string := "agar.gui.window.window_t";
type type_t is record
name : access string;
size : natural;
end record;
type type_lookup_t is array (natural range <>) of type_t;
types : aliased constant type_lookup_t := (
(agar_gui_colors_blend_func_t'access, agar.gui.colors.blend_func_t'size),
(agar_gui_colors_color_t'access, agar.gui.colors.color_t'size),
(agar_gui_pixelformat_pixel_format_access_t'access, agar.gui.pixelformat.pixel_format_access_t'size),
(agar_gui_pixelformat_pixel_format_t'access, agar.gui.pixelformat.pixel_format_t'size),
(agar_gui_point_point_t'access, agar.gui.point.point_t'size),
(agar_gui_rect_rect_access_t'access, agar.gui.rect.rect_access_t'size),
(agar_gui_rect_rect_t'access, agar.gui.rect.rect_t'size),
(agar_gui_rect_rect2_access_t'access, agar.gui.rect.rect2_access_t'size),
(agar_gui_rect_rect2_t'access, agar.gui.rect.rect2_t'size),
(agar_gui_style_style_access_t'access, agar.gui.style.style_access_t'size),
(agar_gui_style_style_t'access, agar.gui.style.style_t'size),
(agar_gui_surface_surface_access_t'access, agar.gui.surface.surface_access_t'size),
(agar_gui_surface_surface_t'access, agar.gui.surface.surface_t'size),
(agar_gui_text_font_access_t'access, agar.gui.text.font_access_t'size),
(agar_gui_text_font_t'access, agar.gui.text.font_t'size),
(agar_gui_text_font_type_t'access, agar.gui.text.font_type_t'size),
(agar_gui_text_glyph_access_t'access, agar.gui.text.glyph_access_t'size),
(agar_gui_text_glyph_t'access, agar.gui.text.glyph_t'size),
(agar_gui_text_justify_t'access, agar.gui.text.justify_t'size),
(agar_gui_text_metrics_access_t'access, agar.gui.text.metrics_access_t'size),
(agar_gui_text_metrics_t'access, agar.gui.text.metrics_t'size),
(agar_gui_text_msg_title_t'access, agar.gui.text.msg_title_t'size),
(agar_gui_text_state_access_t'access, agar.gui.text.state_access_t'size),
(agar_gui_text_state_t'access, agar.gui.text.state_t'size),
(agar_gui_text_static_font_access_t'access, agar.gui.text.static_font_access_t'size),
(agar_gui_text_static_font_t'access, agar.gui.text.static_font_t'size),
(agar_gui_text_valign_t'access, agar.gui.text.valign_t'size),
(agar_gui_unit_unit_t'access, agar.gui.unit.unit_t'size),
(agar_gui_view_display_t'access, agar.gui.view.display_t'size),
(agar_gui_widget_binding_access_t'access, agar.gui.widget.binding_access_t'size),
(agar_gui_widget_binding_t'access, agar.gui.widget.binding_t'size),
(agar_gui_widget_binding_type_t'access, agar.gui.widget.binding_type_t'size),
(agar_gui_widget_box_box_access_t'access, agar.gui.widget.box.box_access_t'size),
(agar_gui_widget_box_box_t'access, agar.gui.widget.box.box_t'size),
(agar_gui_widget_box_type_t'access, agar.gui.widget.box.type_t'size),
(agar_gui_widget_button_button_access_t'access, agar.gui.widget.button.button_access_t'size),
(agar_gui_widget_button_button_t'access, agar.gui.widget.button.button_t'size),
(agar_gui_widget_checkbox_checkbox_access_t'access, agar.gui.widget.checkbox.checkbox_access_t'size),
(agar_gui_widget_checkbox_checkbox_t'access, agar.gui.widget.checkbox.checkbox_t'size),
(agar_gui_widget_class_access_t'access, agar.gui.widget.class_access_t'size),
(agar_gui_widget_class_t'access, agar.gui.widget.class_t'size),
(agar_gui_widget_combo_combo_access_t'access, agar.gui.widget.combo.combo_access_t'size),
(agar_gui_widget_combo_combo_t'access, agar.gui.widget.combo.combo_t'size),
(agar_gui_widget_console_console_access_t'access, agar.gui.widget.console.console_access_t'size),
(agar_gui_widget_console_console_t'access, agar.gui.widget.console.console_t'size),
(agar_gui_widget_console_line_access_t'access, agar.gui.widget.console.line_access_t'size),
(agar_gui_widget_console_line_t'access, agar.gui.widget.console.line_t'size),
(agar_gui_widget_editable_editable_access_t'access, agar.gui.widget.editable.editable_access_t'size),
(agar_gui_widget_editable_editable_t'access, agar.gui.widget.editable.editable_t'size),
(agar_gui_widget_editable_encoding_t'access, agar.gui.widget.editable.encoding_t'size),
(agar_gui_widget_file_dialog_file_dialog_access_t'access, agar.gui.widget.file_dialog.file_dialog_access_t'size),
(agar_gui_widget_file_dialog_file_dialog_t'access, agar.gui.widget.file_dialog.file_dialog_t'size),
(agar_gui_widget_file_dialog_filetype_access_t'access, agar.gui.widget.file_dialog.filetype_access_t'size),
(agar_gui_widget_file_dialog_filetype_t'access, agar.gui.widget.file_dialog.filetype_t'size),
(agar_gui_widget_file_dialog_option_access_t'access, agar.gui.widget.file_dialog.option_access_t'size),
(agar_gui_widget_file_dialog_option_t'access, agar.gui.widget.file_dialog.option_t'size),
(agar_gui_widget_file_dialog_option_type_t'access, agar.gui.widget.file_dialog.option_type_t'size),
(agar_gui_widget_fixed_fixed_access_t'access, gen_agar_gui_widget_fixed.fixed_access_t'size),
(agar_gui_widget_fixed_fixed_t'access, gen_agar_gui_widget_fixed.fixed_t'size),
(agar_gui_widget_fixed_plotter_item_access_t'access, agar.gui.widget.fixed_plotter.item_access_t'size),
(agar_gui_widget_fixed_plotter_item_t'access, agar.gui.widget.fixed_plotter.item_t'size),
(agar_gui_widget_fixed_plotter_plotter_access_t'access, agar.gui.widget.fixed_plotter.plotter_access_t'size),
(agar_gui_widget_fixed_plotter_plotter_t'access, agar.gui.widget.fixed_plotter.plotter_t'size),
(agar_gui_widget_fixed_plotter_type_t'access, agar.gui.widget.fixed_plotter.type_t'size),
(agar_gui_widget_flag_descr_access_t'access, agar.gui.widget.flag_descr_access_t'size),
(agar_gui_widget_flag_descr_t'access, agar.gui.widget.flag_descr_t'size),
(agar_gui_widget_graph_edge_access_t'access, agar.gui.widget.graph.edge_access_t'size),
(agar_gui_widget_graph_edge_t'access, agar.gui.widget.graph.edge_t'size),
(agar_gui_widget_graph_graph_access_t'access, agar.gui.widget.graph.graph_access_t'size),
(agar_gui_widget_graph_graph_t'access, agar.gui.widget.graph.graph_t'size),
(agar_gui_widget_graph_vertex_access_t'access, agar.gui.widget.graph.vertex_access_t'size),
(agar_gui_widget_graph_vertex_style_t'access, agar.gui.widget.graph.vertex_style_t'size),
(agar_gui_widget_graph_vertex_t'access, agar.gui.widget.graph.vertex_t'size),
(agar_gui_widget_hbox_hbox_access_t'access, agar.gui.widget.hbox.hbox_access_t'size),
(agar_gui_widget_hbox_hbox_t'access, agar.gui.widget.hbox.hbox_t'size),
(agar_gui_widget_hsvpal_hsvpal_access_t'access, agar.gui.widget.hsvpal.hsvpal_access_t'size),
(agar_gui_widget_hsvpal_hsvpal_t'access, agar.gui.widget.hsvpal.hsvpal_t'size),
(agar_gui_widget_icon_icon_access_t'access, agar.gui.widget.icon.icon_access_t'size),
(agar_gui_widget_icon_icon_t'access, agar.gui.widget.icon.icon_t'size),
(agar_gui_widget_label_flag_t'access, agar.gui.widget.label.flag_t'size),
(agar_gui_widget_label_format_func_t'access, agar.gui.widget.label.format_func_t'size),
(agar_gui_widget_label_format_spec_access_t'access, agar.gui.widget.label.format_spec_access_t'size),
(agar_gui_widget_label_format_spec_t'access, agar.gui.widget.label.format_spec_t'size),
(agar_gui_widget_label_label_access_t'access, agar.gui.widget.label.label_access_t'size),
(agar_gui_widget_label_label_t'access, agar.gui.widget.label.label_t'size),
(agar_gui_widget_label_type_t'access, agar.gui.widget.label.type_t'size),
(agar_gui_widget_menu_binding_t'access, agar.gui.widget.menu.binding_t'size),
(agar_gui_widget_menu_item_access_t'access, agar.gui.widget.menu.item_access_t'size),
(agar_gui_widget_menu_item_t'access, agar.gui.widget.menu.item_t'size),
(agar_gui_widget_menu_menu_access_t'access, agar.gui.widget.menu.menu_access_t'size),
(agar_gui_widget_menu_menu_t'access, agar.gui.widget.menu.menu_t'size),
(agar_gui_widget_menu_popup_menu_access_t'access, agar.gui.widget.menu.popup_menu_access_t'size),
(agar_gui_widget_menu_popup_menu_t'access, agar.gui.widget.menu.popup_menu_t'size),
(agar_gui_widget_menu_view_access_t'access, agar.gui.widget.menu.view_access_t'size),
(agar_gui_widget_menu_view_t'access, agar.gui.widget.menu.view_t'size),
(agar_gui_widget_mpane_layout_t'access, agar.gui.widget.mpane.layout_t'size),
(agar_gui_widget_mpane_mpane_access_t'access, agar.gui.widget.mpane.mpane_access_t'size),
(agar_gui_widget_mpane_mpane_t'access, agar.gui.widget.mpane.mpane_t'size),
(agar_gui_widget_notebook_notebook_access_t'access, agar.gui.widget.notebook.notebook_access_t'size),
(agar_gui_widget_notebook_notebook_t'access, agar.gui.widget.notebook.notebook_t'size),
(agar_gui_widget_notebook_tab_access_t'access, agar.gui.widget.notebook.tab_access_t'size),
(agar_gui_widget_notebook_tab_alignment_t'access, agar.gui.widget.notebook.tab_alignment_t'size),
(agar_gui_widget_notebook_tab_t'access, agar.gui.widget.notebook.tab_t'size),
(agar_gui_widget_numerical_numerical_access_t'access, agar.gui.widget.numerical.numerical_access_t'size),
(agar_gui_widget_numerical_numerical_t'access, agar.gui.widget.numerical.numerical_t'size),
(agar_gui_widget_pane_pane_access_t'access, agar.gui.widget.pane.pane_access_t'size),
(agar_gui_widget_pane_pane_t'access, agar.gui.widget.pane.pane_t'size),
(agar_gui_widget_pane_type_t'access, agar.gui.widget.pane.type_t'size),
(agar_gui_widget_pixmap_pixmap_access_t'access, agar.gui.widget.pixmap.pixmap_access_t'size),
(agar_gui_widget_pixmap_pixmap_t'access, agar.gui.widget.pixmap.pixmap_t'size),
(agar_gui_widget_progress_bar_progress_bar_access_t'access, agar.gui.widget.progress_bar.progress_bar_access_t'size),
(agar_gui_widget_progress_bar_progress_bar_t'access, agar.gui.widget.progress_bar.progress_bar_t'size),
(agar_gui_widget_progress_bar_type_t'access, agar.gui.widget.progress_bar.type_t'size),
(agar_gui_widget_radio_item_access_t'access, agar.gui.widget.radio.item_access_t'size),
(agar_gui_widget_radio_item_t'access, agar.gui.widget.radio.item_t'size),
(agar_gui_widget_radio_radio_access_t'access, agar.gui.widget.radio.radio_access_t'size),
(agar_gui_widget_radio_radio_t'access, agar.gui.widget.radio.radio_t'size),
(agar_gui_widget_scrollbar_button_t'access, agar.gui.widget.scrollbar.button_t'size),
(agar_gui_widget_scrollbar_scrollbar_access_t'access, agar.gui.widget.scrollbar.scrollbar_access_t'size),
(agar_gui_widget_scrollbar_scrollbar_t'access, agar.gui.widget.scrollbar.scrollbar_t'size),
(agar_gui_widget_scrollbar_type_t'access, agar.gui.widget.scrollbar.type_t'size),
(agar_gui_widget_separator_separator_access_t'access, agar.gui.widget.separator.separator_access_t'size),
(agar_gui_widget_separator_separator_t'access, agar.gui.widget.separator.separator_t'size),
(agar_gui_widget_separator_type_t'access, agar.gui.widget.separator.type_t'size),
(agar_gui_widget_size_req_access_t'access, agar.gui.widget.size_req_access_t'size),
(agar_gui_widget_size_req_t'access, agar.gui.widget.size_req_t'size),
(agar_gui_widget_size_spec_t'access, agar.gui.widget.size_spec_t'size),
(agar_gui_widget_slider_button_t'access, agar.gui.widget.slider.button_t'size),
(agar_gui_widget_slider_slider_access_t'access, agar.gui.widget.slider.slider_access_t'size),
(agar_gui_widget_slider_slider_t'access, agar.gui.widget.slider.slider_t'size),
(agar_gui_widget_slider_type_t'access, agar.gui.widget.slider.type_t'size),
(agar_gui_widget_socket_bg_type_t'access, agar.gui.widget.socket.bg_type_t'size),
(agar_gui_widget_socket_socket_access_t'access, agar.gui.widget.socket.socket_access_t'size),
(agar_gui_widget_socket_socket_t'access, agar.gui.widget.socket.socket_t'size),
(agar_gui_widget_table_cell_access_t'access, agar.gui.widget.table.cell_access_t'size),
(agar_gui_widget_table_cell_t'access, agar.gui.widget.table.cell_t'size),
(agar_gui_widget_table_cell_type_t'access, agar.gui.widget.table.cell_type_t'size),
(agar_gui_widget_table_column_access_t'access, agar.gui.widget.table.column_access_t'size),
(agar_gui_widget_table_column_t'access, agar.gui.widget.table.column_t'size),
(agar_gui_widget_table_popup_access_t'access, agar.gui.widget.table.popup_access_t'size),
(agar_gui_widget_table_popup_t'access, agar.gui.widget.table.popup_t'size),
(agar_gui_widget_table_select_mode_t'access, agar.gui.widget.table.select_mode_t'size),
(agar_gui_widget_table_table_access_t'access, agar.gui.widget.table.table_access_t'size),
(agar_gui_widget_table_table_t'access, agar.gui.widget.table.table_t'size),
(agar_gui_widget_textbox_textbox_access_t'access, agar.gui.widget.textbox.textbox_access_t'size),
(agar_gui_widget_textbox_textbox_t'access, agar.gui.widget.textbox.textbox_t'size),
(agar_gui_widget_titlebar_titlebar_access_t'access, agar.gui.widget.titlebar.titlebar_access_t'size),
(agar_gui_widget_titlebar_titlebar_t'access, agar.gui.widget.titlebar.titlebar_t'size),
(agar_gui_widget_tlist_item_access_t'access, agar.gui.widget.tlist.item_access_t'size),
(agar_gui_widget_tlist_item_t'access, agar.gui.widget.tlist.item_t'size),
(agar_gui_widget_tlist_popup_access_t'access, agar.gui.widget.tlist.popup_access_t'size),
(agar_gui_widget_tlist_popup_t'access, agar.gui.widget.tlist.popup_t'size),
(agar_gui_widget_tlist_tlist_access_t'access, agar.gui.widget.tlist.tlist_access_t'size),
(agar_gui_widget_tlist_tlist_t'access, agar.gui.widget.tlist.tlist_t'size),
(agar_gui_widget_toolbar_toolbar_access_t'access, agar.gui.widget.toolbar.toolbar_access_t'size),
(agar_gui_widget_toolbar_toolbar_t'access, agar.gui.widget.toolbar.toolbar_t'size),
(agar_gui_widget_toolbar_type_t'access, agar.gui.widget.toolbar.type_t'size),
(agar_gui_widget_ucombo_ucombo_access_t'access, agar.gui.widget.ucombo.ucombo_access_t'size),
(agar_gui_widget_ucombo_ucombo_t'access, agar.gui.widget.ucombo.ucombo_t'size),
(agar_gui_widget_vbox_vbox_access_t'access, agar.gui.widget.vbox.vbox_access_t'size),
(agar_gui_widget_vbox_vbox_t'access, agar.gui.widget.vbox.vbox_t'size),
(agar_gui_widget_widget_access_t'access, agar.gui.widget.widget_access_t'size),
(agar_gui_widget_widget_t'access, agar.gui.widget.widget_t'size),
(agar_gui_window_alignment_t'access, agar.gui.window.alignment_t'size),
(agar_gui_window_close_action_t'access, agar.gui.window.close_action_t'size),
(agar_gui_window_window_access_t'access, agar.gui.window.window_access_t'size),
(agar_gui_window_window_t'access, agar.gui.window.window_t'size)
);
procedure find (name : string) is
begin
for index in types'range loop
if types (index).name.all = name then
io.put_line (natural'image (types (index).size));
return;
end if;
end loop;
raise program_error with "fatal: unknown ada type";
end find;
begin
if cmdline.argument_count /= 1 then
raise program_error with "fatal: incorrect number of args";
end if;
find (cmdline.argument (1));
end ada_size;
|
Transynther/x86/_processed/NC/_st_sm_/i7-7700_9_0x48.log_2_1865.asm | ljhsiun2/medusa | 9 | 88591 | <filename>Transynther/x86/_processed/NC/_st_sm_/i7-7700_9_0x48.log_2_1865.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r15
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x18285, %rax
clflush (%rax)
nop
nop
xor %rdi, %rdi
movw $0x6162, (%rax)
nop
nop
nop
and $47030, %r11
lea addresses_WT_ht+0x1db05, %r15
nop
and $52328, %r11
mov $0x6162636465666768, %rdi
movq %rdi, %xmm1
and $0xffffffffffffffc0, %r15
vmovntdq %ymm1, (%r15)
nop
sub $33516, %rax
lea addresses_WT_ht+0x15275, %rdx
nop
and $8006, %rbp
movb $0x61, (%rdx)
nop
nop
sub $59088, %rdx
lea addresses_normal_ht+0x1cd29, %r15
cmp %rbp, %rbp
mov (%r15), %r11d
nop
nop
nop
nop
xor %rax, %rax
lea addresses_WC_ht+0x1c825, %rsi
lea addresses_WT_ht+0x16ec5, %rdi
nop
inc %rax
mov $112, %rcx
rep movsl
nop
nop
nop
nop
xor %r11, %r11
lea addresses_WC_ht+0x1bb05, %r11
xor $58410, %rax
movl $0x61626364, (%r11)
nop
nop
nop
add %rdx, %rdx
lea addresses_UC_ht+0x16085, %rsi
lea addresses_D_ht+0xa105, %rdi
nop
nop
nop
inc %rax
mov $14, %rcx
rep movsb
nop
cmp %rbp, %rbp
lea addresses_A_ht+0x7355, %r15
nop
nop
nop
nop
nop
and %rdi, %rdi
mov (%r15), %eax
nop
xor %rdx, %rdx
lea addresses_D_ht+0x7abf, %rdi
clflush (%rdi)
nop
nop
nop
nop
sub %r11, %r11
mov (%rdi), %si
inc %r15
lea addresses_WT_ht+0x11e45, %rax
clflush (%rax)
nop
nop
nop
nop
and %r11, %r11
mov $0x6162636465666768, %rbp
movq %rbp, (%rax)
nop
nop
nop
nop
nop
cmp $52887, %rax
lea addresses_WC_ht+0x1df85, %rsi
nop
nop
nop
nop
and $38150, %rdx
movw $0x6162, (%rsi)
nop
nop
nop
nop
nop
cmp %rax, %rax
lea addresses_UC_ht+0x1719d, %rcx
cmp $55614, %rbp
movw $0x6162, (%rcx)
nop
nop
nop
sub %rbp, %rbp
lea addresses_UC_ht+0x13f05, %rdx
sub $64214, %r15
mov (%rdx), %r11w
nop
nop
mfence
lea addresses_WT_ht+0x1a6b5, %rdx
nop
and $35630, %rbp
movb (%rdx), %r11b
nop
nop
nop
nop
nop
inc %rbp
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r15
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r9
push %rbp
push %rbx
push %rdi
push %rdx
// Load
lea addresses_D+0x9a85, %r12
nop
nop
dec %rdi
movb (%r12), %r9b
nop
and %r9, %r9
// Store
lea addresses_RW+0x8bee, %rbx
nop
sub $41516, %rdx
movb $0x51, (%rbx)
nop
nop
xor $52149, %rdi
// Store
mov $0x305, %r13
inc %r9
mov $0x5152535455565758, %rbx
movq %rbx, %xmm7
vmovups %ymm7, (%r13)
nop
nop
nop
nop
inc %rdx
// Store
mov $0x2f64f0000000305, %r12
nop
nop
add %rbp, %rbp
movl $0x51525354, (%r12)
// Exception!!!
nop
nop
nop
nop
nop
mov (0), %rbp
nop
nop
nop
nop
cmp %r9, %r9
// Store
lea addresses_normal+0x1a015, %rbp
nop
nop
nop
dec %r9
movw $0x5152, (%rbp)
xor $57550, %rdx
// Store
mov $0x7c3f8a0000000f05, %rdi
nop
and $64755, %rdx
movl $0x51525354, (%rdi)
add $14997, %r13
// Store
mov $0x7c3f8a0000000f05, %r9
nop
nop
xor %rbp, %rbp
movw $0x5152, (%r9)
nop
nop
sub $43397, %rdi
// Store
lea addresses_US+0xf691, %r13
sub $59338, %rdx
movw $0x5152, (%r13)
nop
nop
xor %rbx, %rbx
// Store
lea addresses_D+0xbbe5, %r12
nop
nop
sub %rdi, %rdi
movw $0x5152, (%r12)
// Exception!!!
nop
nop
mov (0), %rbx
nop
nop
nop
nop
xor %rdx, %rdx
// Store
lea addresses_WT+0x155c5, %r12
clflush (%r12)
nop
nop
nop
nop
nop
and $7214, %rdi
movw $0x5152, (%r12)
nop
nop
nop
dec %r13
// Faulty Load
mov $0x7c3f8a0000000f05, %r12
nop
cmp $7916, %rbp
mov (%r12), %dx
lea oracles, %rbx
and $0xff, %rdx
shlq $12, %rdx
mov (%rbx,%rdx,1), %rdx
pop %rdx
pop %rdi
pop %rbx
pop %rbp
pop %r9
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 7, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': True, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 9, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 9, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 7, 'size': 2, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 8, 'size': 32, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 9, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 4, 'size': 4, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': True, 'congruent': 6, 'size': 8, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': True, 'congruent': 7, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 10, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 4, 'size': 1, 'same': False, 'NT': False}}
{'52': 2}
52 52
*/
|
oeis/338/A338467.asm | neoneye/loda-programs | 11 | 1437 | <filename>oeis/338/A338467.asm
; A338467: a(n+1) = prime(n) + 2*n - a(n). a(1) = 1.
; Submitted by <NAME>
; 1,3,4,7,8,13,12,19,16,25,24,29,32,35,36,41,44,49,48,57,54,61,62,67,70,77,76,81,82,85,88,101,94,109,98,121,102,129,110,135,118,143,122,155,126,161,130,175,144,181,148,187,156,191,168,199,176,207,180,215
mov $2,$0
mov $3,$0
mod $3,2
mov $0,$3
add $0,$2
seq $2,36467 ; a(n) + a(n-1) = n-th prime.
add $0,$2
|
Sept10/2.asm | s10singh97/Microprocessor_Lab | 0 | 4740 |
;ASCII to Hex
MVI a,43h
mvi d,30H
mvi e,37H
cpi 41H
jc less
sub e
sta 4000H
hlt
less: sub d
sta 4000H
hlt |
resources/scripts/api/onyphe.ads | Elon143/Amass | 7,053 | 12423 | <gh_stars>1000+
-- Copyright 2021 <NAME>. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local json = require("json")
name = "ONYPHE"
type = "api"
function start()
set_rate_limit(1)
end
function check()
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c ~= nil and c.key ~= nil and c.key ~= "") then
return true
end
return false
end
function vertical(ctx, domain)
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c == nil or c.key == nil or c.key == "") then
return
end
for page=1,1000 do
local resp, err = request(ctx, {
['url']=vert_url(domain, page),
headers={
['Content-Type']="application/json",
['Authorization']="apikey " .. c.key,
},
})
if (err ~= nil and err ~= "") then
log(ctx, "vertical request to service failed: " .. err)
return
end
d = json.decode(resp)
if (d == nil or d.count == 0) then
return
end
for _, r in pairs(d.results) do
if (r['@category'] == "resolver") then
new_name(ctx, r['hostname'])
new_addr(ctx, r['ip'], r['hostname'])
else
for _, name in pairs(r['hostname']) do
if in_scope(ctx, name) then
new_name(ctx, name)
end
end
if (r['subject'] ~= nil) then
for _, name in pairs(r['subject']['altname']) do
if in_scope(ctx, name) then
new_name(ctx, name)
end
end
end
if (r['subdomains'] ~= nil) then
for _, name in pairs(r['subdomains']) do
if in_scope(ctx, name) then
new_name(ctx, name)
end
end
end
end
if (r['reverse'] ~= nil and in_scope(ctx, r['reverse'])) then
new_name(ctx, r['reverse'])
end
if (r['forward'] ~= nil and in_scope(ctx, r['forward'])) then
new_name(ctx, r['forward'])
end
end
if page == d.max_page then
break
end
end
end
function vert_url(domain, pagenum)
return "https://www.onyphe.io/api/v2/summary/domain/" .. domain .. "?page=" .. pagenum
end
function horizontal(ctx, domain)
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
if (c == nil or c.key == nil or c.key == "") then
return
end
local ips, err = resolve(ctx, domain, "A")
if (err ~= nil and err ~= "") then
log(ctx, "horizontal resolve request to service failed: " .. err)
return
end
for _, ip in pairs(ips) do
for page=1,1000 do
local resp, err = request(ctx, {
['url']=horizon_url(ip, page),
headers={
['Content-Type']="application/json",
['Authorization']="apikey " .. c.key,
},
})
if (err ~= nil and err ~= "") then
log(ctx, "horizontal request to service failed: " .. err)
return
end
d = json.decode(resp)
if (d == nil or d.count == 0) then
return
end
for _, r in pairs(d.results) do
if (r['@category'] == "resolver") then
associated(ctx, domain, r['domain'])
elseif (r['@category'] == "datascan" and r['domain'] ~= nil) then
for _, name in pairs(r['domain']) do
associated(ctx, domain, name)
end
end
end
if page == r.max_page then
break
end
end
end
end
function horizon_url(ip, pagenum)
return "https://www.onyphe.io/api/v2/summary/ip/" .. ip .. "?page=" .. pagenum
end
|
32bits.asm | leo-ventura/computer-architecture | 0 | 165116 | <filename>32bits.asm
; Programa para o primeiro trabalho de progrmação no Simus
; Alunos: <NAME>
; <NAME>
; <NAME>
;
; Grupo B
;-------------------------------------------------------------
; Como nosso acumulador tem apenas 8 bits, precisaremos de 4 leituras
; para lermos todos os 4 bits passados
ORG 400
ZEROS: DB 0 ; define um byte para contar a quantidade de zeros
UNS: DB 0 ; define um byte para contar a quantidade de uns
LIDOS: DB 0 ; quantidade de bytes lidos
BLIDOS: DB 0 ; quantidade de bits lidos
CURRENT: DB 0 ; numero sendo tratado atualmente
ORG 200
ContaUnsZeros: ; rotina que irá receber 32 bits na pilha
; e um operando no acumulador dizendo o que contar
XOR #0 ; testa se acumulador é zero
JZ ZERO ; desvia se for zero
UM: ; rotina para contar uns
LDA #0
STA BLIDOS ; colocando 0 na quantidade de bits lidos
POP ; salva primeiro byte no acumulador
STA CURRENT ; salva numero que vai ser analisado
UMLEBIT:
LDA CURRENT ; carrega numero que vai ser analisado
SHR ; faz shift para direita (se for 1, vai acender carry)
STA CURRENT ; salva numero depois do shift
JC INCUM ; incrementa o contador UNS se tiver carry
UMINCRET:
LDA #1
ADD BLIDOS ; incrementa 1 em BLIDOS, salva no acc
STA BLIDOS ; salva em BLIDOS
LDA #8 ; carrega 8 no acumulador
XOR BLIDOS ; compara 8 com B_LIDOS para acender as flags
JNZ UMLEBIT ; se BLIDOS nao for igual a 8, ainda tem bits para ler
; caso contrario, vai para comparação de bytes lidos
LDA #1 ; carrega 1 no acumulador
ADD LIDOS ; soma com LIDOS, salva no acc
STA LIDOS ; incrementa 1 em LIDOS
LDA #4 ; 32 bits em bytes
XOR LIDOS ; compara 4 com a quantidade de bytes lidos
JZ FIM ; se lidos == 4, acaba o programa
JMP UM ; lê proximo byte
ZERO: ; rotina para contar zeros
LDA #0
STA BLIDOS ; colocando 0 na quantidade de bits lidos
POP ; salva primeiro byte no acumulador
STA CURRENT ; salva numero que vai ser analisado
ZEROLEBIT:
LDA CURRENT ; carrega numero que vai ser analisado
SHR ; faz shift para direita (se for 0, não vai acender carry)
STA CURRENT ; salva numero depois do shift
JNC INCZERO ; incrementa o contador ZEROS se não tiver carry
ZINCRET:
LDA #1
ADD BLIDOS ; incrementa 1 em BLIDOS
STA BLIDOS ; salva em BLIDOS
LDA #8 ; carrega 8 no acumulador
XOR BLIDOS ; compara 8 com B_LIDOS para acender as flags
JNZ ZEROLEBIT ; se B_LIDOS nao for igual a 8, ainda tem bits para ler
; caso contrario, vai para comparação de bytes lidos
LDA #1 ; carrega 1 no acc
ADD LIDOS ; soma 1 a LIDOS
STA LIDOS ; salva em LIDOS: incrementa 1 em LIDOS
LDA #4 ; 32 bits em bytes
XOR LIDOS ; compara 4 com a quantidade de bytes lidos
JZ FIM ; se lidos == 4, acaba o programa
JMP ZERO ; lê proximo byte
INCUM: ; rotina para incrementar contador UNS
LDA #1
ADD UNS
STA UNS
JMP UMINCRET
INCZERO: ; rotina para incrementar contador ZEROS
LDA #1
ADD ZEROS
STA ZEROS
JMP ZINCRET
FIM:
HLT
END 0
ORG 100
P: DW A
A: DB 254, 254, 255, 255
ORG 0
MAIN:
LDA #0 ; quero calcular quantidade de 1
LDS P ; aponta sp pra P
JMP ContaUnsZeros ; pula pra rotina |
programs/oeis/247/A247974.asm | jmorken/loda | 1 | 25710 | <filename>programs/oeis/247/A247974.asm
; A247974: Numbers k such that A247973(k+1) = A247973(k).
; 1,6,11,15,20,25,29,34,39,43,48,52,57,62,66,71,76,80,85,90,94,99,104,108,113,118,122,127,132,136,141,146,150,155,160,164,169,174,178,183,188,192,197,202,206,211,216,220,225,230,234,239,244,248,253,258
mov $1,$0
add $1,5
mov $2,$0
mov $3,$0
add $0,5
sub $2,6
mul $2,2
lpb $0
sub $0,2
trn $2,6
mov $4,1
trn $4,$2
sub $0,$4
trn $0,1
sub $1,1
mov $2,8
lpe
lpb $3
add $1,4
sub $3,1
lpe
sub $1,2
|
drivers/dynamics.adb | sciencylab/lagrangian-solver | 0 | 15164 | with Numerics, Ada.Text_IO;
use Numerics, Ada.Text_IO;
procedure Dynamics is
use Real_IO, Int_IO, Real_Functions;
Dt_Exception : exception;
function Func (X : in Real_Array) return Real_Array is
Result : Real_Array (X'Range);
Q : Real_Array renames X (1 .. 2);
P : constant Real_Array (1 .. 2) := X (3 .. 4);
Q_Dot : Real_Array (1 .. 2);
Cts : constant Real := Cos (Q (1) + Q (2));
Det : constant Real := 1.1 * (6.1 + 4.0 * Cts) - (2.0 + Cts) ** 2;
C : constant Real := Cos (0.5 * (Q (1) + Q (2)));
S : constant Real := Sin (0.5 * (Q (1) + Q (2)));
A, B, D : Real;
α : constant Real := 1.0;
PE_G, PE_M, KE : Real_Array (1 .. 2);
begin
if abs (Det) < 1.0e-5 then
Put ("Det = "); Put (Det); New_Line;
Put ("t = "); Put (X (1)); New_Line;
Put ("s = "); Put (X (2)); New_Line;
end if;
pragma Assert (abs (Det) > 1.0e-5, "Determinant in Func is zero");
Q_Dot (1) := (1.1 * P (1) - (2.0 + Cts) * P (2)) / Det;
Q_Dot (2) := ((6.1 + 4.0 * Cts) * P (2) - (2.0 + Cts) * P (1)) / Det;
Result (1 .. 2) := Q_Dot;
A := -0.25 * Sin (2.0 * (Q (1) + Q (2)))
+ (3.0 * S) / (16.0 * C ** 4) * Cos (2.0 * (Q (1) + Q (2)))
- (3.0 * S) / (64.0 * C ** 6)
* (Cos (Q (1)) + Cos (2.0 * Q (1) + Q (2)))
* (Cos (Q (2)) + Cos (2.0 * Q (2) + Q (1)));
D := 3.0 / (32.0 * C ** 5);
B := D * (Cos (Q (2)) + Cos (2.0 * Q (2) + Q (1)));
D := D * (Cos (Q (1)) + Cos (2.0 * Q (1) + Q (2)));
KE (1) := -Q (1) * (Q (1) + Q (2)) * Sin (Q (1) + Q (2));
KE (2) := KE (1);
PE_G (1) := -Sin (Q (1)) - 2.0 * Sin (2.0 * Q (1) + Q (2));
PE_G (2) := -Sin (2.0 * Q (1) + Q (2));
PE_M (1) := Sin (2.0 * Q (1))
- A + B * (Sin (Q (1)) + 2.0 * Sin (2.0 * Q (1) + Q (2)))
+ D * Sin (Q (1) + 2.0 * Q (2));
PE_M (2) := Sin (2.0 * Q (2))
- A + B * Sin (2.0 * Q (1) + Q (2))
+ D * (Sin (Q (2)) + 2.0 * Sin (2.0 * Q (2) + Q (1)));
Result (3 .. 4) := KE - PE_G - (α / 6.0) * PE_M;
return Result;
end Func;
function Bogack_Shampine (X : in Real_Array;
Dt : in Real;
Err : out Real) return Real_Array is
K1, K2, K3, K4, Y, Z : Real_Array (X'Range);
begin
K1 := Func (X);
K2 := Func (X + 0.50 * Dt * K1);
K3 := Func (X + 0.75 * Dt * K2);
Y := X + (Dt / 9.0) * (2.0 * K1 + 3.0 * K2 + 4.0 * K3);
K4 := Func (Y);
Z := X + (Dt / 24.0) * (7.0 * K1 + 6.0 * K2 + 8.0 * K3 + 3.0 * K4);
Err := Norm (Z - Y);
return Z;
end Bogack_Shampine;
procedure Update (X : in out Real_Array;
T : in out Real;
Dt : in out Real) is
Eps : constant Real := 1.0e-8;
Err : Real := 1.0;
Y : Real_Array (X'Range);
Tstep : Real := Dt;
begin
while Err > Eps loop
Y := Bogack_Shampine (X, Tstep, Err);
if (Err <= Eps) then
X := Y;
T := T + Tstep;
end if;
if Tstep < 1.0e-12 then raise Dt_Exception; end if;
Tstep := 0.8 * Tstep * (Eps / (Err + 1.0e-20)) ** 0.3;
end loop;
Dt := Tstep;
end Update;
procedure Print (File : in File_Type;
X : in Real_Array;
T : in Real) is
X1, Y1, X2, Y2 : Real;
begin
X1 := -Sin (X (1));
Y1 := Cos (X (1));
X2 := X1 - Sin (2.0 * X (1) + X (2));
Y2 := Y1 + Cos (2.0 * X (1) + X (2));
-- time
Put (File, T); Put (File, ", ");
-- position of ball 2
Put (File, X1); Put (File, ", ");
Put (File, Y1); Put (File, ", ");
-- position of ball 3
Put (File, X2); Put (File, ", ");
Put (File, Y2); New_Line (File);
end Print;
procedure Print_XYZ (File : in File_Type;
X : in Real_Array;
T : in Real) is
X1, Y1, X2, Y2 : Real;
R : constant Real := 10.0;
begin
X1 := -R * Sin (X (1));
Y1 := R * Cos (X (1));
X2 := X1 - R * Sin (2.0 * X (1) + X (2));
Y2 := Y1 + R * Cos (2.0 * X (1) + X (2));
-- print header
Put_Line (File, "3");
Put_Line (File, "Properties=pos:R:2");
-- position of ball 1
Put_Line (File, "0.0 0.0 5.0");
-- position of ball 2
Put (File => File, Item => X1);
Put (File => File, Item => " ");
Put (File => File, Item => Y1);
Put (File => File, Item => " ");
Put (File => File, Item => "5.0");
New_Line (File => File);
-- position of ball 3
Put (File => File, Item => X2);
Put (File => File, Item => " ");
Put (File => File, Item => Y2);
Put (File => File, Item => " ");
Put (File => File, Item => "5.0");
New_Line (File => File);
end Print_XYZ;
function Momenta (X : in Real_Array) return Real_Array is
use Real_Functions;
C : constant Real := Cos (X (1) + X (2));
P : Real_Array := X;
begin
P (3) := (6.1 + 4.0 * C) * X (3) + (2.0 + C) * X (4);
P (4) := (2.0 + C) * X (3) + 1.1 * X (4);
return P;
end Momenta;
-- Initial Conditions ----
X : Real_Array := (0.0, 0.0, 0.1, 0.0);
T : Real := 0.0;
Dt : Real := 1.0e-1;
File : File_Type;
XYZ : File_Type;
Time : Real := T;
Iter : Nat := 1;
begin
X := Momenta (X);
Create (File, Name => "output.csv");
Create (XYZ, Name => "out.xyz");
Put_Line (File, "t, x1, y1, x2, y2");
Print (File, X, T);
Put (T); New_Line;
while T < 1.0e2 loop
Time := T + 1.0e-2;
while T < Time loop
if Dt > Time - T then Dt := Time - T; end if;
Update (X, T, Dt);
end loop;
Print (File, X, T);
Print_XYZ (XYZ, X, T);
Put (T); Put (" ");
Put (Dt); New_Line;
end loop;
end Dynamics;
|
1-base/math/source/generic/pure/geometry/any_math-any_geometry-any_d3-any_modeller-any_forge.ads | charlie5/lace | 20 | 4334 | generic
package any_Math.any_Geometry.any_d3.any_Modeller.any_Forge
--
-- Provides constructors for several geometry primitives.
--
is
function to_Box_Model (half_Extents : in Vector_3 := (0.5, 0.5, 0.5)) return a_Model;
function to_Capsule_Model (Length : in Real := 1.0;
Radius : in Real := 0.5) return a_Model;
type Latitude is range -90 .. 90;
type Longitude is range 0 .. 359;
no_Id : constant := Positive'Last;
type Vertex is
record
Id : Positive := no_Id;
Site : any_Geometry.any_d3.Site;
end record;
type longitude_Line is array (Latitude) of Vertex;
type polar_Model is array (Longitude) of longitude_Line;
type Vertices is array (Positive range <>) of Vertex;
type Triangle is array (Positive range 1 .. 3) of Positive;
type Triangles is array (Positive range <>) of Triangle;
-- type mesh_Model (num_Vertices : Positive;
-- num_Triangles : Positive) is
-- record
-- Vertices : mesh.Vertices (1 .. num_Vertices);
-- Triangles : mesh.Triangles (1 .. num_Triangles);
-- end record;
function polar_Model_from (Model_Filename : in String) return polar_model;
function mesh_Model_from (Model : in polar_Model) return a_Model; -- mesh_Model;
end any_Math.any_Geometry.any_d3.any_Modeller.any_Forge;
|
libsrc/graphics/text6/loadudg6.asm | meesokim/z88dk | 0 | 82169 | <gh_stars>0
;
; Generic pseudo graphics routines for text-only platforms
; Version for the 2x3 graphics symbols
;
; Written by <NAME> 2014
;
;
; Load a 2x3 pseudo-graphics at HL position,
; starting from character C up to character B-1
;
;
; $Id: loadudg6.asm,v 1.4 2015/01/19 01:32:51 pauloscustodio Exp $
;
PUBLIC loadudg6
.loadudg6
;push bc
ld d,c
call setbyte
ld (hl),a
inc hl
call setbyte
call setbyte
ld (hl),a
inc hl
;pop bc
ld c,d
inc c
ld a,b
cp c
jr nz,loadudg6
ret
.setbyte
call setbyte2
rr c
rr c
ld (hl),a
inc hl
ld (hl),a
inc hl
ret
.setbyte2
xor a
bit 0,c
jr z,noright
ld a,$0f
.noright
bit 1,c
ret z
add $f0
ret
|
engine/pokemon/categories.asm | Trap-Master/spacworld97-thingy | 0 | 85865 | <reponame>Trap-Master/spacworld97-thingy
GetMoveCategoryName:
; Copy the category name of move b to wStringBuffer1.
ld a, b
dec a
ld bc, MOVE_LENGTH
ld hl, Moves + MOVE_TYPE
call AddNTimes
ld a, BANK(Moves)
call GetFarByte
; Mask out the type
and $ff ^ TYPE_MASK
; Shift the category bits into the range 0-2
rlc a
rlc a
dec a
ld hl, CategoryNames
ld e, a
ld d, 0
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld de, wStringBuffer1
ld bc, MOVE_NAME_LENGTH
jp CopyBytes
INCLUDE "data/types/category_names.asm"
|
Applications/Google-Chrome/window/front tab/title.applescript | looking-for-a-job/applescript-examples | 1 | 1049 | <reponame>looking-for-a-job/applescript-examples
#!/usr/bin/osascript
tell application "Google Chrome"
if count of windows is not 0 then return title of active tab of front window
end tell
|
source/numerics/a-nscoar.ads | ytomino/drake | 33 | 1097 | <reponame>ytomino/drake
pragma License (Unrestricted);
with Ada.Numerics.Generic_Complex_Arrays;
with Ada.Numerics.Short_Complex_Types;
with Ada.Numerics.Short_Real_Arrays;
package Ada.Numerics.Short_Complex_Arrays is
new Generic_Complex_Arrays (Short_Real_Arrays, Short_Complex_Types);
pragma Pure (Ada.Numerics.Short_Complex_Arrays);
|
Cats/Category/Constructions/Iso.agda | alessio-b-zak/cats | 0 | 1765 | <filename>Cats/Category/Constructions/Iso.agda
module Cats.Category.Constructions.Iso where
open import Relation.Binary using (IsEquivalence ; Setoid)
open import Level
open import Cats.Category.Base
open import Cats.Util.Conv
import Relation.Binary.EqReasoning as EqReasoning
import Cats.Category.Constructions.Epi as Epi
import Cats.Category.Constructions.Mono as Mono
module Build {lo la l≈} (Cat : Category lo la l≈) where
private open module Cat = Category Cat
open Cat.≈-Reasoning
open Epi.Build Cat
open Mono.Build Cat
record _≅_ (A B : Obj) : Set (lo ⊔ la ⊔ l≈) where
field
forth : A ⇒ B
back : B ⇒ A
back-forth : back ∘ forth ≈ id
forth-back : forth ∘ back ≈ id
open _≅_
instance
HasArrow-≅ : ∀ {A B} → HasArrow (A ≅ B) lo la l≈
HasArrow-≅ = record { Cat = Cat ; _⃗ = forth }
≅-equiv : IsEquivalence _≅_
≅-equiv = record { refl = refl ; sym = sym ; trans = trans }
where
refl : ∀ {A} → A ≅ A
refl {A} = record
{ forth = id
; back = id
; back-forth = id-l
; forth-back = id-l
}
sym : ∀ {A B} → A ≅ B → B ≅ A
sym iso = record
{ forth = back iso
; back = forth iso
; back-forth = forth-back iso
; forth-back = back-forth iso
}
trans : ∀ {A B C : Obj} → A ≅ B → B ≅ C → A ≅ C
trans {A} {B} {C} A≅B B≅C = record
{ forth = forth B≅C ∘ forth A≅B
; back = back A≅B ∘ back B≅C
; back-forth
= begin
(back A≅B ∘ back B≅C) ∘ forth B≅C ∘ forth A≅B
≈⟨ assoc ⟩
back A≅B ∘ back B≅C ∘ forth B≅C ∘ forth A≅B
≈⟨ ∘-resp-r (≈.trans unassoc (∘-resp-l (back-forth B≅C))) ⟩
back A≅B ∘ id ∘ forth A≅B
≈⟨ ∘-resp-r id-l ⟩
back A≅B ∘ forth A≅B
≈⟨ back-forth A≅B ⟩
id
∎
; forth-back
= begin
(forth B≅C ∘ forth A≅B) ∘ back A≅B ∘ back B≅C
≈⟨ assoc ⟩
forth B≅C ∘ forth A≅B ∘ back A≅B ∘ back B≅C
≈⟨ ∘-resp-r (≈.trans unassoc (∘-resp-l (forth-back A≅B))) ⟩
forth B≅C ∘ id ∘ back B≅C
≈⟨ ∘-resp-r id-l ⟩
forth B≅C ∘ back B≅C
≈⟨ forth-back B≅C ⟩
id
∎
}
≅-Setoid : Setoid lo (lo ⊔ la ⊔ l≈)
≅-Setoid = record
{ Carrier = Obj
; _≈_ = _≅_
; isEquivalence = ≅-equiv
}
module ≅ = IsEquivalence ≅-equiv
module ≅-Reasoning = EqReasoning ≅-Setoid
iso-mono : ∀ {A B} (iso : A ≅ B) → IsMono (forth iso)
iso-mono iso {g = g} {h} iso∘g≈iso∘h
= begin
g
≈⟨ ≈.sym id-l ⟩
id ∘ g
≈⟨ ∘-resp-l (≈.sym (back-forth iso)) ⟩
(back iso ∘ forth iso) ∘ g
≈⟨ assoc ⟩
back iso ∘ forth iso ∘ g
≈⟨ ∘-resp-r iso∘g≈iso∘h ⟩
back iso ∘ forth iso ∘ h
≈⟨ unassoc ⟩
(back iso ∘ forth iso) ∘ h
≈⟨ ∘-resp-l (back-forth iso) ⟩
id ∘ h
≈⟨ id-l ⟩
h
∎
iso-epi : ∀ {A B} (iso : A ≅ B) → IsEpi (forth iso)
iso-epi iso {g = g} {h} g∘iso≈h∘iso
= begin
g
≈⟨ ≈.sym id-r ⟩
g ∘ id
≈⟨ ∘-resp-r (≈.sym (forth-back iso)) ⟩
g ∘ forth iso ∘ back iso
≈⟨ unassoc ⟩
(g ∘ forth iso) ∘ back iso
≈⟨ ∘-resp-l g∘iso≈h∘iso ⟩
(h ∘ forth iso) ∘ back iso
≈⟨ assoc ⟩
h ∘ forth iso ∘ back iso
≈⟨ ∘-resp-r (forth-back iso) ⟩
h ∘ id
≈⟨ id-r ⟩
h
∎
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.