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
|
---|---|---|---|---|
mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb/library-asm/asin.asm | gb-archive/really-old-stuff | 10 | 176042 | #include once <stackf.asm>
ASIN: ; Computes ASIN using ROM FP-CALC
call __FPSTACK_PUSH
rst 28h ; ROM CALC
defb 22h ; ASIN
defb 38h ; END CALC
jp __FPSTACK_POP
|
src/002/separated.adb | xeenta/learning-ada | 0 | 27374 | package body Separated is
procedure Watch_Me is separate;
function Look_Out return Float is (5.0);
end Separated;
|
source/containers/a-cogeso.ads | ytomino/drake | 33 | 29654 | pragma License (Unrestricted);
-- Ada 2012
generic
type Index_Type is (<>);
with function Before (Left, Right : Index_Type) return Boolean;
with procedure Swap (Left, Right : Index_Type);
procedure Ada.Containers.Generic_Sort (First, Last : Index_Type'Base);
pragma Pure (Ada.Containers.Generic_Sort);
|
Universe/spawn_new_ship.asm | ped7g/EliteNext | 9 | 86744 | <filename>Universe/spawn_new_ship.asm<gh_stars>1-10
.NW1 \ found Room, a FRIN(X) that is still empty. Allowed to add ship, type is in T.
20 32 37 JSR &3732 \ GINF \ Get INFo pointer for slot X from UNIV
A5 D1 LDA &D1 \ T \ the ship type
30 52 BMI NW2 \ Planet/sun, hop inner workspace to just store ship type.
0A ASL A \ type*=2 to get
A8 TAY \ hull index for table at XX21= &5600
B9 FF 55 LDA &55FF,Y \ XX21-1,Y
F0 F0 BEQ NW3 \ no address hi, ship not added.
85 1F STA &1F \ XX0+1 \ hull pointer hi
B9 FE 55 LDA &55FE,Y \ XX21-2,Y
85 1E STA &1E \ XX0 \ hull pointer lo
C0 04 CPY #4 \ #2*SST
F0 30 BEQ NW6 \ if ship type #SST space station
A0 05 LDY #5 \ hull byte#5 = maxlines for using ship lines stack
B1 1E LDA (&1E),Y \ (XX0),Y
85 06 STA &06 \ T1
AD B0 03 LDA &03B0 \ SLSP \ ship lines pointer
38 SEC \ ship lines pointer - maxlines
E5 06 SBC &06 \ T1
85 67 STA &67 \ XX19 \ temp pointer lo for lines
AD B1 03 LDA &03B1 \ SLSP+1
E9 00 SBC #0 \ hi
85 68 STA &68 \ XX19+1
A5 67 LDA &67 \ XX19
E5 20 SBC &20 \ INF \ info pointer gives present top of all workspace heap
A8 TAY \ compare later to number of bytes, 37, needed for ship workspace
A5 68 LDA &68 \ XX19+1
E5 21 SBC &21 \ INF+1
90 C6 BCC NW3+1 \ rts if too low, not enough space.
D0 04 BNE NW4 \ enough space, else if hi match look at lo
C0 25 CPY #&25 \ NI% = #37 each ship workspace size
90 C0 BCC NW3+1 \ rts if too low, not enough space
.NW4 \ Enough space for lines
A5 67 LDA &67 \ XX19 \ temp pointer lo for lines
8D B0 03 STA &03B0 \ SLSP \ ship lines pointer
A5 68 LDA &68 \ XX19+1
8D B1 03 STA &03B1 \ SLSP+1
.NW6 \ also New Space Station #SST arrives here
A0 0E LDY #14 \ Hull byte#14 = energy
B1 1E LDA (&1E),Y \ (XX0),Y
85 69 STA &69 \ INWK+35 \ energy
A0 13 LDY #19 \ Hull byte#19 = laser|missile info
B1 1E LDA (&1E),Y \ (XX0),Y
29 07 AND #7 \ only lower 3 bits are number of missiles
85 65 STA &65 \ INWK+31 \ display exploding state|missiles
A5 D1 LDA &D1 \ T \ reload ship Type
.NW2 \ also Planet/sun store ship type
9D 11 03 STA &0311,X \ FRIN,X \ the type for each nearby ship
AA TAX \ slot info lost, X is now ship type.
30 0E BMI NW8 \ hop over as planet
E0 03 CPX #3 \ #ESC
90 07 BCC NW7 \ < 3 type is not junk
E0 0B CPX #11 \ #CYL
B0 03 BCS NW7 \ >= 11 type is not junk
EE 3E 03 INC &033E \ JUNK \ esc plate oil boulder asteroid splinter shuttle transporter
.NW7 \ not junk
FE 1E 03 INC &031E,X \ MANY,X \ the total number of ships of type X
.NW8 \ hopped as planet/sun
A4 D1 LDY &D1 \ T \ the ship type, index to ship type NEWB at E%
B9 3D 56 LDA &563D,Y \ XX21-1+2*31,Y \ E%-1,Y
29 6F AND #&6F \ clear bits7,4 of hull's NEWB, has escape capsule and ?
05 6A ORA &6A \ INWK+36 \ NEWB
85 6A STA &6A \ INWK+36 \ NEWB \ keep previous bits for remove, inno, docking, pirate, angry ..
A0 24 LDY #36 \ #(NI%-1) start Y counter for inner workspace
.NWL3 \ move workspace out, counter Y
B9 46 00 LDA &0046,Y \ INWK,Y
91 20 STA (&20),Y \ (INF),Y
88 DEY \ next byte
10 F8 BPL NWL3 \ loop Y
38 SEC \ success in creating new ship, keep carry set.
60 RTS
.NwS1 \ -> &37FC \ flip signs and X+=2 needed by new space station
B5 46 LDA &46,X \ INWK,X
49 80 EOR #&80 \ flip sg coordinate
95 46 STA &46,X \ INWK,X
E8 INX
E8 INX \ X+=2
60
.FoundFreeSlot: ; New Ship – Add ship OK now hl = address of free slot (hopefully won't need index)
ld a,FreeListSize ;
sub b ; a = FreeList - Index, so if it was item 12 then 12-12 = 0
add UniverseBasePage ; Now a = page number to swap in for data
.DerriveType
ld a,(varT)
bits 7,a
jr nz, .PlanetOrSun
.ItsNotPlanetOrSun:
sla ; A *= 2
ld b,0
ld b,a ; save into b reg
ld hl, HULLINDEX
add hl,a ; HL = HULLINDEX[A]
ld d,(hl)
inc hl
ld e,(hl) ; de = address of hull data
ld a,d
cp 0 ;
jr z, .CleanUpWorkspace ; (NW3) if h = 0 then no ship data so just exit setting INF to b reg
ld (XX0),de ; may not be needed after optimisation
ld hl,XX21-2
cp ShipSST ; is ship hull index = 4?
jr z,.ItsASpaceStation
ld hl,(XX0) ; hl = address of hull data
ld ixh,h
ld ixl,l ; ix = address of hull data
ld a,(ix+5) ; hull byte#5 = maxlines for using ship lines stack
ld (varT1),a ; store in T1 for now
ld hl,(SLSP) ; ship lines pointer, WHERE is this set? (Must be iniitalise earlier as its actually a variable heap)
or a ; clear carry flag
sub hl,a ; hl = (SLSP) - varT1
ld (XX19),hl ; XX19+XX20 = (SLSP)-varT1
ld bc,(INF)
or a ; clear carry flag
sub hl,bc ; hl = (SLSP)-varT1 - INFO info pointer gives present top of all workspace heap
ld iyh,h
ld iyl,l ; compare later to number of bytes, 37, needed for ship workspace
ld a,(XX20) ; High byte of XX19
ld hl,INF+1 ; High byte of inf
sub hl ;
ret nc ; Return if carry clear so not enough space
jr nz, .enoughHeapSpace ; not equal to zero so enoug space
; ">Is there any heap maangment code in this lot for lines?"
; ">We may just binbag all that and just have a bank per ship, as we have enough ram"
at herer
85 67 STA &67 \ XX19 \ temp pointer lo for lines
AD B1 03 LDA &03B1 \ SLSP+1
E9 00 SBC #0 \ hi
85 68 STA &68 \ XX19+1
A5 67 LDA &67 \ XX19
E5 20 SBC &20 \ INF \ info pointer gives present top of all workspace heap
A8 TAY \ compare later to number of bytes, 37, needed for ship workspace
A5 68 LDA &68 \ XX19+1
E5 21 SBC &21 \ INF+1
90 C6 BCC NW3+1 \ rts if too low, not enough space.
D0 04 BNE NW4 \ enough space, else if hi match look at lo
C0 25 CPY #&25 \ NI% = #37 each ship workspace size
90 C0 BCC NW3+1 \ rts if too low, not enough space
.NW4 \ Enough space for lines
A5 67 LDA &67 \ XX19 \ temp pointer lo for lines
8D B0 03 STA &03B0 \ SLSP \ ship lines pointer
A5 68 LDA &68 \ XX19+1
8D B1 03 STA &03B1 \ SLSP+1
.NW6 \ also New Space Station #SST arrives here
A0 0E LDY #14 \ Hull byte#14 = energy
B1 1E LDA (&1E),Y \ (XX0),Y
85 69 STA &69 \ INWK+35 \ energy
A0 13 LDY #19 \ Hull byte#19 = laser|missile info
B1 1E LDA (&1E),Y \ (XX0),Y
29 07 AND #7 \ only lower 3 bits are number of missiles
85 65 STA &65 \ INWK+31 \ display exploding state|missiles
A5 D1 LDA &D1 \ T \ reload ship Type
.NW2 \ also Planet/sun store ship type
9D 11 03 STA &0311,X \ FRIN,X \ the type for each nearby ship
AA TAX \ slot info lost, X is now ship type.
30 0E BMI NW8 \ hop over as planet
E0 03 CPX #3 \ #ESC
90 07 BCC NW7 \ < 3 type is not junk
E0 0B CPX #11 \ #CYL
B0 03 BCS NW7 \ >= 11 type is not junk
EE 3E 03 INC &033E \ JUNK \ esc plate oil boulder asteroid splinter shuttle transporter
.NW7 \ not junk
FE 1E 03 INC &031E,X \ MANY,X \ the total number of ships of type X
.NW8 \ hopped as planet/sun
A4 D1 LDY &D1 \ T \ the ship type, index to ship type NEWB at E%
B9 3D 56 LDA &563D,Y \ XX21-1+2*31,Y \ E%-1,Y
29 6F AND #&6F \ clear bits7,4 of hull's NEWB, has escape capsule and ?
05 6A ORA &6A \ INWK+36 \ NEWB
85 6A STA &6A \ INWK+36 \ NEWB \ keep previous bits for remove, inno, docking, pirate, angry ..
A0 24 LDY #36 \ #(NI%-1) start Y counter for inner workspace
.NWL3 \ move workspace out, counter Y
B9 46 00 LDA &0046,Y \ INWK,Y
91 20 STA (&20),Y \ (INF),Y
88 DEY \ next byte
10 F8 BPL NWL3 \ loop Y
38 SEC \ success in creating new ship, keep carry set.
60 RTS
.CleanUpWorkspace: ;.NWL3 \ move workspace out, counter Y
ld hl, INWK
ld a,b
add hl, a hl = INWK [b]
ld a,(hl)
ld (INF),a
djnz .CleanUpWorkspace
scf ; Set carry flag to denote success
ret
.NwS1 \ -> &37FC \ flip signs and X+=2 needed by new space station
B5 46 LDA &46,X \ INWK,X
49 80 EOR #&80 \ flip sg coordinate
95 46 STA &46,X \ INWK,X
E8 INX
E8 INX \ X+=2
60 RTS
|
oeis/001/A001287.asm | neoneye/loda-programs | 11 | 1777 | ; A001287: a(n) = binomial coefficient C(n,10).
; 1,11,66,286,1001,3003,8008,19448,43758,92378,184756,352716,646646,1144066,1961256,3268760,5311735,8436285,13123110,20030010,30045015,44352165,64512240,92561040,131128140,183579396,254186856,348330136,472733756,635745396,847660528,1121099408,1471442973,1917334783,2481256778,3190187286,4076350421,5178066751,6540715896,8217822536,10272278170,12777711870,15820024220,19499099620,23930713170,29248649430,35607051480,43183019880,52179482355,62828356305,75394027566,90177170226,107518933731,127805525001
add $0,10
bin $0,10
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1722.asm | ljhsiun2/medusa | 9 | 178378 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1722.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r15
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0xd437, %rax
inc %r15
movl $0x61626364, (%rax)
nop
inc %r15
lea addresses_normal_ht+0xbe93, %rsi
lea addresses_WT_ht+0xebbf, %rdi
nop
sub $8567, %r10
mov $104, %rcx
rep movsw
nop
nop
nop
nop
cmp $22647, %r13
lea addresses_A_ht+0x1aee3, %rsi
nop
nop
add %r13, %r13
mov $0x6162636465666768, %r10
movq %r10, (%rsi)
nop
nop
and $1749, %rax
lea addresses_WC_ht+0x8eb7, %rsi
lea addresses_D_ht+0x16257, %rdi
nop
nop
nop
nop
nop
cmp $23517, %rdx
mov $16, %rcx
rep movsb
nop
nop
add $45371, %r10
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r8
push %r9
push %rbx
push %rdx
// Faulty Load
lea addresses_UC+0x112b7, %rbx
nop
dec %r10
movups (%rbx), %xmm6
vpextrq $0, %xmm6, %rdx
lea oracles, %r8
and $0xff, %rdx
shlq $12, %rdx
mov (%r8,%rdx,1), %rdx
pop %rdx
pop %rbx
pop %r9
pop %r8
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_UC', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_UC', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
src/untyped-spans.agda | xoltar/cedille | 0 | 2712 | <reponame>xoltar/cedille<gh_stars>0
import cedille-options
open import general-util
module untyped-spans (options : cedille-options.options) {F : Set → Set} {{monadF : monad F}} where
open import lib
open import ctxt
open import cedille-types
open import spans options {F}
open import syntax-util
open import to-string options
untyped-term-spans : term → spanM ⊤
untyped-type-spans : type → spanM ⊤
untyped-kind-spans : kind → spanM ⊤
untyped-tk-spans : tk → spanM ⊤
untyped-liftingType-spans : liftingType → spanM ⊤
untyped-optTerm-spans : optTerm → spanM (posinfo → posinfo)
untyped-optType-spans : optType → spanM ⊤
untyped-optGuide-spans : optGuide → spanM ⊤
untyped-lterms-spans : lterms → spanM ⊤
untyped-optClass-spans : optClass → spanM ⊤
untyped-defTermOrType-spans : defTermOrType → spanM (spanM ⊤ → spanM ⊤)
untyped-var-spans : posinfo → var → (ctxt → posinfo → var → checking-mode → 𝕃 tagged-val → err-m → span) → spanM ⊤ → spanM ⊤
untyped-var-spans pi x f m = get-ctxt λ Γ → with-ctxt (ctxt-var-decl-loc pi x Γ) (get-ctxt λ Γ → spanM-add (f Γ pi x untyped [] nothing) ≫span m)
untyped-term-spans (App t me t') = untyped-term-spans t ≫span untyped-term-spans t' ≫span spanM-add (App-span ff t t' untyped [] nothing)
untyped-term-spans (AppTp t T) = untyped-term-spans t ≫span untyped-type-spans T ≫span spanM-add (AppTp-span t T untyped [] nothing)
untyped-term-spans (Beta pi ot ot') = untyped-optTerm-spans ot ≫=span λ f → untyped-optTerm-spans ot' ≫=span λ f' → spanM-add (Beta-span pi (f' (f (posinfo-plus pi 1))) untyped [] nothing)
untyped-term-spans (Chi pi mT t) = untyped-optType-spans mT ≫span untyped-term-spans t ≫span get-ctxt λ Γ → spanM-add (Chi-span Γ pi mT t untyped [] nothing)
untyped-term-spans (Delta pi mT t) = untyped-optType-spans mT ≫span untyped-term-spans t ≫span get-ctxt λ Γ → spanM-add (Delta-span Γ pi mT t untyped [] nothing)
untyped-term-spans (Epsilon pi lr mm t) = untyped-term-spans t ≫span spanM-add (Epsilon-span pi lr mm t untyped [] nothing)
untyped-term-spans (Hole pi) = get-ctxt λ Γ → spanM-add (hole-span Γ pi nothing [])
untyped-term-spans (IotaPair pi t t' og pi') = untyped-term-spans t ≫span untyped-term-spans t' ≫span untyped-optGuide-spans og ≫span spanM-add (IotaPair-span pi pi' untyped [] nothing)
untyped-term-spans (IotaProj t n pi) = untyped-term-spans t ≫span spanM-add (IotaProj-span t pi untyped [] nothing)
untyped-term-spans (Lam pi l pi' x oc t) = untyped-optClass-spans oc ≫span get-ctxt λ Γ → spanM-add (Lam-span Γ untyped pi l x oc t [] nothing) ≫span untyped-var-spans pi' x Var-span (untyped-term-spans t)
untyped-term-spans (Let pi d t) = untyped-defTermOrType-spans d ≫=span λ f → f (untyped-term-spans t) ≫span get-ctxt λ Γ → spanM-add (Let-span Γ untyped pi d t [] nothing)
untyped-term-spans (Open pi x t) = untyped-term-spans t ≫span spanM-add (mk-span "Open" pi (term-end-pos t) [] nothing)
untyped-term-spans (Parens pi t pi') = untyped-term-spans t
untyped-term-spans (Phi pi t t' t'' pi') = untyped-term-spans t ≫span untyped-term-spans t' ≫span untyped-term-spans t'' ≫span spanM-add (Phi-span pi pi' untyped [] nothing)
untyped-term-spans (Rho pi op on t og t') = untyped-term-spans t ≫span untyped-term-spans t' ≫span spanM-add (mk-span "Rho" pi (term-end-pos t') (ll-data-term :: [ checking-data untyped ]) nothing)
untyped-term-spans (Sigma pi t) = untyped-term-spans t ≫span get-ctxt λ Γ → spanM-add (mk-span "Sigma" pi (term-end-pos t) (ll-data-term :: [ checking-data untyped ]) nothing)
untyped-term-spans (Theta pi θ t ls) = untyped-term-spans t ≫span untyped-lterms-spans ls ≫span get-ctxt λ Γ → spanM-add (Theta-span Γ pi θ t ls untyped [] nothing)
untyped-term-spans (Var pi x) = get-ctxt λ Γ →
spanM-add (Var-span Γ pi x untyped [] (if ctxt-binds-var Γ x then nothing else just "This variable is not currently in scope."))
untyped-term-spans (Mu pi x t ot pi' cs pi'') = spanM-add (Mu-span t [] nothing)
untyped-term-spans (Mu' pi t ot pi' cs pi'') = spanM-add (Mu-span t [] nothing)
untyped-type-spans (Abs pi b pi' x atk T) = untyped-tk-spans atk ≫span spanM-add (TpQuant-span (me-unerased b) pi x atk T untyped [] nothing) ≫span untyped-var-spans pi' x (if tk-is-type atk then Var-span else TpVar-span) (untyped-type-spans T)
untyped-type-spans (Iota pi pi' x T T') = untyped-type-spans T ≫span spanM-add (Iota-span pi T' untyped [] nothing) ≫span untyped-var-spans pi' x TpVar-span (untyped-type-spans T')
untyped-type-spans (Lft pi pi' x t lT) = untyped-liftingType-spans lT ≫span spanM-add (Lft-span pi x t untyped [] nothing) ≫span untyped-var-spans pi' x Var-span (untyped-term-spans t)
untyped-type-spans (NoSpans T pi) = spanMok
untyped-type-spans (TpApp T T') = untyped-type-spans T ≫span untyped-type-spans T' ≫span spanM-add (TpApp-span T T' untyped [] nothing)
untyped-type-spans (TpAppt T t) = untyped-type-spans T ≫span untyped-term-spans t ≫span spanM-add (TpAppt-span T t untyped [] nothing)
untyped-type-spans (TpArrow T a T') = untyped-type-spans T ≫span untyped-type-spans T' ≫span spanM-add (TpArrow-span T T' untyped [] nothing)
untyped-type-spans (TpEq pi t t' pi') = untyped-term-spans t ≫span untyped-term-spans t' ≫span spanM-add (TpEq-span pi t t' pi' untyped [] nothing)
untyped-type-spans (TpHole pi) = get-ctxt λ Γ → spanM-add (tp-hole-span Γ pi nothing [])
untyped-type-spans (TpLambda pi pi' x atk T) = untyped-tk-spans atk ≫span spanM-add (TpLambda-span pi pi' atk T untyped [] nothing) ≫span untyped-var-spans pi' x TpVar-span (untyped-type-spans T)
untyped-type-spans (TpParens pi T pi') = untyped-type-spans T
untyped-type-spans (TpVar pi x) = get-ctxt λ Γ →
spanM-add (TpVar-span Γ pi x untyped [] (if ctxt-binds-var Γ x then nothing else just "This variable is not currently in scope."))
untyped-type-spans (TpLet pi d T) = untyped-defTermOrType-spans d ≫=span λ f → f (untyped-type-spans T) ≫span get-ctxt λ Γ → spanM-add (TpLet-span Γ untyped pi d T [] nothing)
untyped-kind-spans (KndArrow k k') = untyped-kind-spans k ≫span untyped-kind-spans k' ≫span spanM-add (KndArrow-span k k' untyped nothing)
untyped-kind-spans (KndParens pi k pi') = untyped-kind-spans k
untyped-kind-spans (KndPi pi pi' x atk k) = untyped-tk-spans atk ≫span spanM-add (KndPi-span pi x atk k untyped nothing) ≫span untyped-var-spans pi' x (if tk-is-type atk then Var-span else TpVar-span) (untyped-kind-spans k)
untyped-kind-spans (KndTpArrow T k) = untyped-type-spans T ≫span untyped-kind-spans k ≫span spanM-add (KndTpArrow-span T k untyped nothing)
untyped-kind-spans (KndVar pi x as) = get-ctxt λ Γ →
spanM-add (KndVar-span Γ (pi , x) (kvar-end-pos pi x as) ParamsNil untyped [] (if ctxt-binds-var Γ x then nothing else just "This variable is not currently in scope."))
untyped-kind-spans (Star pi) = spanM-add (Star-span pi untyped nothing)
untyped-liftingType-spans lT = spanMok -- Unimplemented
untyped-tk-spans (Tkt T) = untyped-type-spans T
untyped-tk-spans (Tkk k) = untyped-kind-spans k
untyped-optTerm-spans NoTerm = spanMr λ pi → pi
untyped-optTerm-spans (SomeTerm t pi) = untyped-term-spans t ≫span spanMr λ _ → pi
untyped-optType-spans NoType = spanMok
untyped-optType-spans (SomeType T) = untyped-type-spans T
untyped-optGuide-spans NoGuide = spanMok
untyped-optGuide-spans (Guide pi x T) = untyped-var-spans pi x Var-span (untyped-type-spans T)
untyped-lterms-spans (LtermsNil pi) = spanMok
untyped-lterms-spans (LtermsCons me t ls) = untyped-term-spans t ≫span untyped-lterms-spans ls
untyped-optClass-spans NoClass = spanMok
untyped-optClass-spans (SomeClass atk) = untyped-tk-spans atk
untyped-defTermOrType-spans (DefTerm pi x NoType t) = untyped-term-spans t ≫span get-ctxt λ Γ → with-ctxt (ctxt-var-decl-loc pi x Γ) (spanMr λ x → x)
untyped-defTermOrType-spans (DefTerm pi x (SomeType T) t) = untyped-term-spans t ≫span untyped-type-spans T ≫span get-ctxt λ Γ → with-ctxt (ctxt-var-decl-loc pi x Γ) (spanMr λ x → x)
untyped-defTermOrType-spans (DefType pi x k T) = untyped-kind-spans k ≫span untyped-type-spans T ≫span get-ctxt λ Γ → with-ctxt (ctxt-var-decl-loc pi x Γ) (spanMr λ x → x)
|
atari/rainbow/rainbow.asm | JonathanGzzBen/c-study | 0 | 170672 | processor 6502
include "vcs.h"
include "macro.h"
seg code
org $F000
Start:
CLEAN_START ; macro to safely clear memory and TIA
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Start a new frame by turning on VBLANK and VSYNC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NextFrame:
lda #2 ; same as binary value %00000010
sta VBLANK ; turn on VBLANK
sta VSYNC ; turn on VSYNC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Generate the three lines of VSYNC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
sta WSYNC ; first scanline
sta WSYNC ; second scanline
sta WSYNC ; third scanline
lda #0
sta VSYNC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Let the TIA output the recommended 37 scanlines of VBLANK
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ldx #37 ; X = 37 (to count 37 scanlines)
LoopVBlank:
sta WSYNC ; hit WSYNC and wait for the next scanline
dex ; X--
bne LoopVBlank ; loop while X != 0
lda #0
sta VBLANK ; turn off VBLANK
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Draw 192 visible scanlines (kernel)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ldx #192 ; counter for 192 visible scanlines
LoopScanline:
stx COLUBK ; set the background color
sta WSYNC ; wait for the next scanline
dex ; X--
bne LoopScanline ; loop while X != 192
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Output 30 more VBLANK lines (overscan) to complete our frame
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
lda #2 ; hit and turn on VBLANK again
sta VBLANK
ldx #30 ; counter for 30 scanlines
LoopOverscan:
sta VBLANK ; wait for the next scanline
dex ; X--
bne LoopOverscan ; loop while X != 0
jmp NextFrame
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Complete my ROM size to 4KB
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
org $FFFC
.word Start
.word Start |
base/mvdm/wow16/mmsystem/mmtask/mmtask.asm | npocmaka/Windows-Server-2003 | 17 | 81040 | <reponame>npocmaka/Windows-Server-2003
PAGE 58,132
;*****************************************************************************
TITLE MMTASK.ASM - Windows MultiMedia Systems Task Stub
;*****************************************************************************
;
; Copyright (C) Microsoft Corporation 1985-1990. All rights reserved.
;
; Title: MMTASK.asm - a windows application that acts as a
; task stub.
;
; Version: 1.00
;
; Date: 12-Mar-1990
;
; Author: ROBWI
;
;-----------------------------------------------------------------------------
;
; Change log:
;
; DATE REV DESCRIPTION
; ----------- --- --------------------------------------------------------
; 12-Mar-1990 ROBWI First Version
; 18-APR-1990 ROBWI Moved from idle.asm to mmtask.asm
;
;=============================================================================
?WIN=0
?PLM=1
PMODE = 1
.xlist
include cmacros.inc
.list
wptr equ WORD PTR
; The following structure should be used to access high and low
; words of a DWORD. This means that "word ptr foo[2]" -> "foo.hi".
LONG struc
lo dw ?
hi dw ?
LONG ends
FARPOINTER struc
off dw ?
sel dw ?
FARPOINTER ends
;----------------------------------------------------------------------
;
; MMTASKSTRUC : The following structure should be passed to mmtask (in
; the command line) when it is exec'd.
MMTASKSTRUC struc
lpfn dd ? ; fp to function to call.
inst dd ? ; instance data to pass to lpfn
dwstck dd ? ; stack size.
MMTASKSTRUC ends
EXIT_PROCESS equ 1
;-----------------------------------------------------------------------;
;
; externals from KERNEL
externFP WaitEvent
externFP PostEvent
externFP OldYield
externFP InitTask
externFP InitApp ; to get a msg q so that we can call user
externFP OutputDebugString
externFP SetMessageQueue
sBegin DATA
assumes DS,DATA
; Stuff needed to avoid the C runtime coming in
DD 0 ; So null pointers get 0
maxRsrvPtrs = 5
DW maxRsrvPtrs
usedRsrvPtrs = 0
labelDP <PUBLIC,rsrvptrs>
DefRsrvPtr MACRO name
globalW name,0
usedRsrvPtrs = usedRsrvPtrs + 1
ENDM
DefRsrvPtr pLocalHeap ; Local heap pointer
DefRsrvPtr pAtomTable ; Atom table pointer
DefRsrvPtr pStackTop ; top of stack
DefRsrvPtr pStackMin ; minimum value of SP
DefRsrvPtr pStackBot ; bottom of stack
if maxRsrvPtrs-usedRsrvPtrs
DW maxRsrvPtrs-usedRsrvPtrs DUP (0)
endif
public __acrtused
__acrtused = 1
loadparams DB (SIZE MMTASKSTRUC) DUP (0)
sEnd DATA
sBegin Code
assumes cs, Code
assumes ds, Data
assumes es, nothing
assumes ss, nothing
;--------------------------Private-Routine-----------------------------;
;
; @doc INTERNAL MMTASKAPP
;
; @asm AppEntry | called when the APP is loaded
;
; @reg CX | size of heap
; @reg DI | module handle
; @reg DS | automatic data segment
; @reg ES:SI | address of command line (not used)
; @reg
;
; @rdesc Register values at return
;
; @reg AX | 1 if success, 0 if error
;
; @uses AX BX CX DX FLAGS
;
; @comm Preserves: SI DI DS BP
;
; Calls: None
;
; History:
;
; 06-27-89 -by- <NAME> [ToddLa] Created shell appentry
; routine
; 03-13-90 -stolen- <NAME> [RobWi] Added all kinds o'
; stuff for making it an MMTASK application.
;
;-----------------------------------------------------------------------;
cProc AppEntry,<FAR,PUBLIC,NODATA>,<>
cBegin
; Copy the parameters out of the command line before
; InitTask gets a chance to modify them.
push di
push si
push cx
; switch ds and es so that we can do a string move
; into the data segment
push ds ; save ds o
mov ax, es
mov ds, ax ; ds = es 0
pop es ; es = ds 0
; copy the command line if it is the correct length
mov si, 81h
lea di, loadparams
mov cx, SIZE MMTASKSTRUC / 2
xor ax, ax
mov al, byte ptr ds:[80h]
shr ax, 1
cmp ax, cx ; Q: structure size correct
jne Skip_Copy ; N: Skip the copy
.ERRNZ SIZE MMTASKSTRUC MOD 2
cld ; Y: Copy the structure
rep movsw
Skip_Copy:
; restore original es and ds
push es
mov ax, ds
mov es, ax ; es = ds = es 0
pop ds
pop cx
pop si
pop di
; pretend the command string is 0 length.
xor ax, ax
mov es:[80h], ax
; initialize the task and the event queue
cCall InitTask
cCall InitApp, <di>
cCall SetMessageQueue, <64>
or ax,ax
jz MMTASKexit
; DX is now the CmdShow value.
; CX is stack size.
; event count is initially one so call waitevent to clear the event count
cCall WaitEvent, <0>
; check parameters
mov dx, loadparams.lpfn.hi
or dx, dx ; callback ok?
jz MMTASKExit ; N: out'a here
cCall OldYield ; be polite.
mov ax, loadparams.inst.lo
mov dx, loadparams.inst.hi
cCall loadparams.lpfn, <dx, ax>
MMTASKExit:
ifdef DEBUG
; lets make sure the app did not do anything evil
cmp wptr ds:[0],0
jne evil
cmp wptr ds:[2],0
jne evil
cmp wptr ds:[4],5
jne evil
je not_evil
evil:
lea ax,evil_str
cCall OuputDebugString, <cs,ax>
int 3
jmp not_evil
evil_str:
db "MMTASK: NULL pointer assignment!",13,10,0
not_evil:
endif
; before we actualy exit lets yield, so we don't re-enter
; USERS AppExit code.....
cCall OldYield
cCall OldYield
cCall OldYield
mov ah, 4Ch
int 21h
cEnd
sEnd
end AppEntry
|
programs/oeis/047/A047308.asm | karttu/loda | 1 | 378 | ; A047308: Numbers that are congruent to {0, 3, 4, 5, 6} mod 7.
; 0,3,4,5,6,7,10,11,12,13,14,17,18,19,20,21,24,25,26,27,28,31,32,33,34,35,38,39,40,41,42,45,46,47,48,49,52,53,54,55,56,59,60,61,62,63,66,67,68,69,70,73,74,75,76,77
mov $1,$0
add $1,4
div $1,5
mul $1,2
add $1,$0
|
archive/agda-1/UnifyMguCorrectG.agda | m0davis/oscar | 0 | 13977 | open import Relation.Binary using (IsDecEquivalence)
open import Agda.Builtin.Equality
module UnifyMguCorrectG (FunctionName : Set) ⦃ isDecEquivalenceA : IsDecEquivalence (_≡_ {A = FunctionName}) ⦄ (PredicateName VariableName : Set) where
open import UnifyTermF FunctionName
open import UnifyMguF FunctionName
open import UnifyMguCorrectF FunctionName
open import Data.Nat
open import Data.Vec
open import Function
open import Data.Fin renaming (thin to thinF; thick to thickF)
data Formula (n : ℕ) : Set
where
atomic : PredicateName → ∀ {t} → Vec (Term n) t → Formula n
logical : Formula n →
Formula n →
Formula n
quantified : Formula (suc n) → Formula n
open import Relation.Binary.PropositionalEquality
instance ThinFormula : Thin Formula
Thin.thin ThinFormula x (atomic x₁ x₂) = atomic x₁ (thin x x₂)
Thin.thin ThinFormula x (logical x₁ x₂) = logical (thin x x₁) (thin x x₂)
Thin.thin ThinFormula x (quantified x₁) = quantified (thin zero x₁)
Thin.thinfact1 ThinFormula f {atomic pn1 ts1} {atomic pn2 ts2} r = {!!}
Thin.thinfact1 ThinFormula f {atomic x x₁} {logical y y₁} ()
Thin.thinfact1 ThinFormula f {atomic x x₁} {quantified y} ()
Thin.thinfact1 ThinFormula f {logical x x₁} {atomic x₂ x₃} ()
Thin.thinfact1 ThinFormula f {logical x x₁} {logical y y₁} x₂ = {!!}
Thin.thinfact1 ThinFormula f {logical x x₁} {quantified y} ()
Thin.thinfact1 ThinFormula f {quantified x} {atomic x₁ x₂} ()
Thin.thinfact1 ThinFormula f {quantified x} {logical y y₁} ()
Thin.thinfact1 ThinFormula f {quantified x} {quantified y} x₁ = {!!}
foo~ : ∀ {m₁ n₁} →
(Fin m₁ → Term n₁) →
Fin (suc m₁) → Term (suc n₁)
foo~ f = (λ { zero → i zero ; (suc x) → thin zero (f x)})
foo~i≐i : ∀ {m} → foo~ {m} i ≐ i
foo~i≐i zero = refl
foo~i≐i (suc x) = refl
instance SubstitutionFormula : Substitution Formula
Substitution._◃_ SubstitutionFormula = _◃′_ where
_◃′_ : ∀ {m n} -> (f : m ~> n) -> Formula m -> Formula n
f ◃′ atomic 𝑃 τs = atomic 𝑃 (f ◃ τs)
f ◃′ logical φ₁ φ₂ = logical (f ◃ φ₁) (f ◃ φ₂)
f ◃′ quantified φ = quantified (foo~ f ◃ φ)
instance SubstitutionExtensionalityFormula : SubstitutionExtensionality Formula
SubstitutionExtensionality.◃ext SubstitutionExtensionalityFormula x (atomic x₁ x₂) = cong (atomic x₁) (◃ext x x₂)
SubstitutionExtensionality.◃ext SubstitutionExtensionalityFormula x (logical t t₁) = cong₂ logical (◃ext x t) (◃ext x t₁)
SubstitutionExtensionality.◃ext SubstitutionExtensionalityFormula x (quantified t) = cong quantified ((◃ext (λ { zero → refl ; (suc x₁) → cong (mapTerm suc) (x x₁)}) t)) --
instance SubFact1Formula : Sub.Fact1 Formula
Sub.Fact1.fact1 SubFact1Formula (atomic x x₁) = cong (atomic x) (Sub.fact1 x₁)
Sub.Fact1.fact1 SubFact1Formula (logical t t₁) = cong₂ logical (Sub.fact1 t) (Sub.fact1 t₁)
Sub.Fact1.fact1 SubFact1Formula {n} (quantified φ) = cong quantified (trans (◃ext {Formula} {_} {_} {foo~ {_} i} {i} (foo~i≐i {_}) φ) (Sub.fact1 φ))
Unifies⋆F : ∀ {m} (s t : Formula m) -> Property⋆ m
Unifies⋆F s t f = f ◃ s ≡ f ◃ t
|
examples/shared/hello_world_blinky/src/control.ads | webgeeks/Ada_Drivers_Library | 0 | 13117 | <filename>examples/shared/hello_world_blinky/src/control.ads<gh_stars>0
with STM32.Board; use STM32.Board;
with HAL; use HAL;
with STM32.GPIO; use STM32.GPIO;
with STM32.Device; use STM32.Device;
with Ada.Real_Time; use Ada.Real_Time;
with STM32.Timers; use STM32.Timers;
with STM32.PWM; use STM32.PWM;
package control is
Selected_Timer : STM32.Timers.Timer renames Timer_4;
Timer_AF : constant STM32.GPIO_Alternate_Function := GPIO_AF_TIM4_2;
Servo_Channel : constant Timer_Channel := Channel_1;
Motor_Channel : constant Timer_Channel := Channel_2;
Seed_Channel : constant Timer_Channel := Channel_3;
Soil_Channel : constant Timer_Channel := Channel_4;
LED_For : constant array (Timer_Channel) of User_LED :=
(Channel_1 => Green_LED,
Channel_2 => Orange_LED,
Channel_3 => Red_LED,
Channel_4 => Blue_LED);
Requested_Frequency : constant Hertz := 50; -- arbitrary
Servo_Control : PWM_Modulator;
Motor_Control : PWM_Modulator;
Soil_Control : PWM_Modulator;
Seed_Control : PWM_Modulator;
procedure Intialize_Controls;
procedure right;
procedure left;
procedure forward;
procedure backward;
procedure front;
procedure stop;
procedure Drop_Seed;
procedure Measure;
end control;
|
asm/Cumulative-Countdown.asm | hixio-mh/hrm-cpu | 24 | 176583 | -- HUMAN RESOURCE MACHINE PROGRAM --
a:
INBOX
JUMPZ d
COPYTO 0
COPYTO 1
b:
BUMPDN 0
JUMPZ c
ADD 1
COPYTO 1
JUMP b
c:
COPYFROM 1
d:
OUTBOX
JUMP a
DEFINE LABEL 0
<KEY>;
DEFINE LABEL 1
<KEY>
<KEY>
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_14_566.asm | ljhsiun2/medusa | 9 | 27179 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r8
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x1af78, %r14
nop
nop
nop
nop
nop
xor $33542, %r13
mov (%r14), %rcx
sub %rsi, %rsi
lea addresses_D_ht+0xd778, %rdx
xor %r14, %r14
movl $0x61626364, (%rdx)
xor $56836, %r8
lea addresses_WC_ht+0x18978, %rsi
lea addresses_WT_ht+0x1178, %rdi
nop
nop
nop
dec %rbx
mov $100, %rcx
rep movsw
nop
nop
nop
nop
nop
inc %r13
lea addresses_WT_ht+0x7b78, %r8
nop
nop
nop
nop
add %rcx, %rcx
vmovups (%r8), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %rdx
nop
nop
nop
cmp %rbx, %rbx
lea addresses_WT_ht+0x19f8, %rbx
clflush (%rbx)
nop
nop
nop
cmp $17853, %r8
and $0xffffffffffffffc0, %rbx
movaps (%rbx), %xmm3
vpextrq $0, %xmm3, %rcx
nop
nop
xor $54082, %rdx
lea addresses_D_ht+0x1e778, %rsi
lea addresses_WT_ht+0x1e378, %rdi
nop
nop
nop
nop
nop
cmp %r13, %r13
mov $55, %rcx
rep movsq
xor $20579, %r8
lea addresses_A_ht+0x125f8, %rsi
lea addresses_A_ht+0x194b8, %rdi
nop
xor $50785, %rbx
mov $39, %rcx
rep movsl
add %rbx, %rbx
lea addresses_WT_ht+0x11c06, %rdi
nop
nop
nop
nop
nop
xor $64449, %rdx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm1
movups %xmm1, (%rdi)
nop
cmp $47568, %rbx
lea addresses_WT_ht+0xfdfc, %r14
nop
nop
nop
nop
mfence
vmovups (%r14), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %rcx
xor %rdi, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
// Store
lea addresses_PSE+0x6778, %r9
nop
nop
nop
nop
and %rbp, %rbp
movl $0x51525354, (%r9)
nop
nop
and $31655, %r11
// REPMOV
lea addresses_A+0x4f78, %rsi
lea addresses_D+0x9978, %rdi
nop
cmp $20647, %r13
mov $2, %rcx
rep movsb
nop
nop
and $41154, %r11
// Store
mov $0xd783f0000000199, %r11
inc %r9
mov $0x5152535455565758, %rcx
movq %rcx, %xmm3
movups %xmm3, (%r11)
nop
nop
cmp $57288, %r11
// Store
lea addresses_normal+0x13118, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
and %rsi, %rsi
movl $0x51525354, (%rdi)
nop
nop
nop
dec %r9
// Store
lea addresses_UC+0x17b78, %rbp
nop
nop
nop
nop
nop
sub %r13, %r13
mov $0x5152535455565758, %r10
movq %r10, %xmm2
vmovups %ymm2, (%rbp)
sub $43957, %rdi
// Store
lea addresses_A+0x14778, %rbp
nop
nop
nop
nop
sub %r11, %r11
mov $0x5152535455565758, %rsi
movq %rsi, %xmm4
movups %xmm4, (%rbp)
// Exception!!!
nop
nop
mov (0), %rdi
nop
cmp $9034, %rbp
// Store
lea addresses_RW+0x12998, %r11
cmp $56996, %rsi
movl $0x51525354, (%r11)
nop
nop
nop
nop
xor $8798, %rsi
// Store
lea addresses_UC+0x978, %rdi
nop
nop
nop
nop
nop
add %rsi, %rsi
mov $0x5152535455565758, %r9
movq %r9, (%rdi)
xor %rbp, %rbp
// Faulty Load
lea addresses_A+0x4f78, %rcx
and %r11, %r11
mov (%rcx), %bp
lea oracles, %r9
and $0xff, %rbp
shlq $12, %rbp
mov (%r9,%rbp,1), %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': True, 'congruent': 0, 'type': 'addresses_A'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_D'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 9}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2}}
{'35': 14}
35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
|
llvm-gcc-4.2-2.9/gcc/ada/sem_attr.adb | vidkidz/crossbridge | 1 | 27683 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S E M _ A T T R --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2006, 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, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
with Atree; use Atree;
with Checks; use Checks;
with Einfo; use Einfo;
with Errout; use Errout;
with Eval_Fat;
with Exp_Util; use Exp_Util;
with Expander; use Expander;
with Freeze; use Freeze;
with Lib; use Lib;
with Lib.Xref; use Lib.Xref;
with Namet; use Namet;
with Nlists; use Nlists;
with Nmake; use Nmake;
with Opt; use Opt;
with Restrict; use Restrict;
with Rident; use Rident;
with Rtsfind; use Rtsfind;
with Sdefault; use Sdefault;
with Sem; use Sem;
with Sem_Cat; use Sem_Cat;
with Sem_Ch6; use Sem_Ch6;
with Sem_Ch8; use Sem_Ch8;
with Sem_Dist; use Sem_Dist;
with Sem_Eval; use Sem_Eval;
with Sem_Res; use Sem_Res;
with Sem_Type; use Sem_Type;
with Sem_Util; use Sem_Util;
with Stand; use Stand;
with Sinfo; use Sinfo;
with Sinput; use Sinput;
with Stringt; use Stringt;
with Targparm; use Targparm;
with Ttypes; use Ttypes;
with Ttypef; use Ttypef;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
with Urealp; use Urealp;
package body Sem_Attr is
True_Value : constant Uint := Uint_1;
False_Value : constant Uint := Uint_0;
-- Synonyms to be used when these constants are used as Boolean values
Bad_Attribute : exception;
-- Exception raised if an error is detected during attribute processing,
-- used so that we can abandon the processing so we don't run into
-- trouble with cascaded errors.
-- The following array is the list of attributes defined in the Ada 83 RM
Attribute_83 : constant Attribute_Class_Array := Attribute_Class_Array'(
Attribute_Address |
Attribute_Aft |
Attribute_Alignment |
Attribute_Base |
Attribute_Callable |
Attribute_Constrained |
Attribute_Count |
Attribute_Delta |
Attribute_Digits |
Attribute_Emax |
Attribute_Epsilon |
Attribute_First |
Attribute_First_Bit |
Attribute_Fore |
Attribute_Image |
Attribute_Large |
Attribute_Last |
Attribute_Last_Bit |
Attribute_Leading_Part |
Attribute_Length |
Attribute_Machine_Emax |
Attribute_Machine_Emin |
Attribute_Machine_Mantissa |
Attribute_Machine_Overflows |
Attribute_Machine_Radix |
Attribute_Machine_Rounds |
Attribute_Mantissa |
Attribute_Pos |
Attribute_Position |
Attribute_Pred |
Attribute_Range |
Attribute_Safe_Emax |
Attribute_Safe_Large |
Attribute_Safe_Small |
Attribute_Size |
Attribute_Small |
Attribute_Storage_Size |
Attribute_Succ |
Attribute_Terminated |
Attribute_Val |
Attribute_Value |
Attribute_Width => True,
others => False);
-----------------------
-- Local_Subprograms --
-----------------------
procedure Eval_Attribute (N : Node_Id);
-- Performs compile time evaluation of attributes where possible, leaving
-- the Is_Static_Expression/Raises_Constraint_Error flags appropriately
-- set, and replacing the node with a literal node if the value can be
-- computed at compile time. All static attribute references are folded,
-- as well as a number of cases of non-static attributes that can always
-- be computed at compile time (e.g. floating-point model attributes that
-- are applied to non-static subtypes). Of course in such cases, the
-- Is_Static_Expression flag will not be set on the resulting literal.
-- Note that the only required action of this procedure is to catch the
-- static expression cases as described in the RM. Folding of other cases
-- is done where convenient, but some additional non-static folding is in
-- N_Expand_Attribute_Reference in cases where this is more convenient.
function Is_Anonymous_Tagged_Base
(Anon : Entity_Id;
Typ : Entity_Id)
return Boolean;
-- For derived tagged types that constrain parent discriminants we build
-- an anonymous unconstrained base type. We need to recognize the relation
-- between the two when analyzing an access attribute for a constrained
-- component, before the full declaration for Typ has been analyzed, and
-- where therefore the prefix of the attribute does not match the enclosing
-- scope.
-----------------------
-- Analyze_Attribute --
-----------------------
procedure Analyze_Attribute (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Aname : constant Name_Id := Attribute_Name (N);
P : constant Node_Id := Prefix (N);
Exprs : constant List_Id := Expressions (N);
Attr_Id : constant Attribute_Id := Get_Attribute_Id (Aname);
E1 : Node_Id;
E2 : Node_Id;
P_Type : Entity_Id;
-- Type of prefix after analysis
P_Base_Type : Entity_Id;
-- Base type of prefix after analysis
-----------------------
-- Local Subprograms --
-----------------------
procedure Analyze_Access_Attribute;
-- Used for Access, Unchecked_Access, Unrestricted_Access attributes.
-- Internally, Id distinguishes which of the three cases is involved.
procedure Check_Array_Or_Scalar_Type;
-- Common procedure used by First, Last, Range attribute to check
-- that the prefix is a constrained array or scalar type, or a name
-- of an array object, and that an argument appears only if appropriate
-- (i.e. only in the array case).
procedure Check_Array_Type;
-- Common semantic checks for all array attributes. Checks that the
-- prefix is a constrained array type or the name of an array object.
-- The error message for non-arrays is specialized appropriately.
procedure Check_Asm_Attribute;
-- Common semantic checks for Asm_Input and Asm_Output attributes
procedure Check_Component;
-- Common processing for Bit_Position, First_Bit, Last_Bit, and
-- Position. Checks prefix is an appropriate selected component.
procedure Check_Decimal_Fixed_Point_Type;
-- Check that prefix of attribute N is a decimal fixed-point type
procedure Check_Dereference;
-- If the prefix of attribute is an object of an access type, then
-- introduce an explicit deference, and adjust P_Type accordingly.
procedure Check_Discrete_Type;
-- Verify that prefix of attribute N is a discrete type
procedure Check_E0;
-- Check that no attribute arguments are present
procedure Check_Either_E0_Or_E1;
-- Check that there are zero or one attribute arguments present
procedure Check_E1;
-- Check that exactly one attribute argument is present
procedure Check_E2;
-- Check that two attribute arguments are present
procedure Check_Enum_Image;
-- If the prefix type is an enumeration type, set all its literals
-- as referenced, since the image function could possibly end up
-- referencing any of the literals indirectly.
procedure Check_Fixed_Point_Type;
-- Verify that prefix of attribute N is a fixed type
procedure Check_Fixed_Point_Type_0;
-- Verify that prefix of attribute N is a fixed type and that
-- no attribute expressions are present
procedure Check_Floating_Point_Type;
-- Verify that prefix of attribute N is a float type
procedure Check_Floating_Point_Type_0;
-- Verify that prefix of attribute N is a float type and that
-- no attribute expressions are present
procedure Check_Floating_Point_Type_1;
-- Verify that prefix of attribute N is a float type and that
-- exactly one attribute expression is present
procedure Check_Floating_Point_Type_2;
-- Verify that prefix of attribute N is a float type and that
-- two attribute expressions are present
procedure Legal_Formal_Attribute;
-- Common processing for attributes Definite, Has_Access_Values,
-- and Has_Discriminants
procedure Check_Integer_Type;
-- Verify that prefix of attribute N is an integer type
procedure Check_Library_Unit;
-- Verify that prefix of attribute N is a library unit
procedure Check_Modular_Integer_Type;
-- Verify that prefix of attribute N is a modular integer type
procedure Check_Not_Incomplete_Type;
-- Check that P (the prefix of the attribute) is not an incomplete
-- type or a private type for which no full view has been given.
procedure Check_Object_Reference (P : Node_Id);
-- Check that P (the prefix of the attribute) is an object reference
procedure Check_Program_Unit;
-- Verify that prefix of attribute N is a program unit
procedure Check_Real_Type;
-- Verify that prefix of attribute N is fixed or float type
procedure Check_Scalar_Type;
-- Verify that prefix of attribute N is a scalar type
procedure Check_Standard_Prefix;
-- Verify that prefix of attribute N is package Standard
procedure Check_Stream_Attribute (Nam : TSS_Name_Type);
-- Validity checking for stream attribute. Nam is the TSS name of the
-- corresponding possible defined attribute function (e.g. for the
-- Read attribute, Nam will be TSS_Stream_Read).
procedure Check_Task_Prefix;
-- Verify that prefix of attribute N is a task or task type
procedure Check_Type;
-- Verify that the prefix of attribute N is a type
procedure Check_Unit_Name (Nod : Node_Id);
-- Check that Nod is of the form of a library unit name, i.e that
-- it is an identifier, or a selected component whose prefix is
-- itself of the form of a library unit name. Note that this is
-- quite different from Check_Program_Unit, since it only checks
-- the syntactic form of the name, not the semantic identity. This
-- is because it is used with attributes (Elab_Body, Elab_Spec, and
-- UET_Address) which can refer to non-visible unit.
procedure Error_Attr (Msg : String; Error_Node : Node_Id);
pragma No_Return (Error_Attr);
procedure Error_Attr;
pragma No_Return (Error_Attr);
-- Posts error using Error_Msg_N at given node, sets type of attribute
-- node to Any_Type, and then raises Bad_Attribute to avoid any further
-- semantic processing. The message typically contains a % insertion
-- character which is replaced by the attribute name. The call with
-- no arguments is used when the caller has already generated the
-- required error messages.
procedure Standard_Attribute (Val : Int);
-- Used to process attributes whose prefix is package Standard which
-- yield values of type Universal_Integer. The attribute reference
-- node is rewritten with an integer literal of the given value.
procedure Unexpected_Argument (En : Node_Id);
-- Signal unexpected attribute argument (En is the argument)
procedure Validate_Non_Static_Attribute_Function_Call;
-- Called when processing an attribute that is a function call to a
-- non-static function, i.e. an attribute function that either takes
-- non-scalar arguments or returns a non-scalar result. Verifies that
-- such a call does not appear in a preelaborable context.
------------------------------
-- Analyze_Access_Attribute --
------------------------------
procedure Analyze_Access_Attribute is
Acc_Type : Entity_Id;
Scop : Entity_Id;
Typ : Entity_Id;
function Build_Access_Object_Type (DT : Entity_Id) return Entity_Id;
-- Build an access-to-object type whose designated type is DT,
-- and whose Ekind is appropriate to the attribute type. The
-- type that is constructed is returned as the result.
procedure Build_Access_Subprogram_Type (P : Node_Id);
-- Build an access to subprogram whose designated type is
-- the type of the prefix. If prefix is overloaded, so it the
-- node itself. The result is stored in Acc_Type.
------------------------------
-- Build_Access_Object_Type --
------------------------------
function Build_Access_Object_Type (DT : Entity_Id) return Entity_Id is
Typ : Entity_Id;
begin
if Aname = Name_Unrestricted_Access then
Typ :=
New_Internal_Entity
(E_Allocator_Type, Current_Scope, Loc, 'A');
else
Typ :=
New_Internal_Entity
(E_Access_Attribute_Type, Current_Scope, Loc, 'A');
end if;
Set_Etype (Typ, Typ);
Init_Size_Align (Typ);
Set_Is_Itype (Typ);
Set_Associated_Node_For_Itype (Typ, N);
Set_Directly_Designated_Type (Typ, DT);
return Typ;
end Build_Access_Object_Type;
----------------------------------
-- Build_Access_Subprogram_Type --
----------------------------------
procedure Build_Access_Subprogram_Type (P : Node_Id) is
Index : Interp_Index;
It : Interp;
function Get_Kind (E : Entity_Id) return Entity_Kind;
-- Distinguish between access to regular/protected subprograms
--------------
-- Get_Kind --
--------------
function Get_Kind (E : Entity_Id) return Entity_Kind is
begin
if Convention (E) = Convention_Protected then
return E_Access_Protected_Subprogram_Type;
else
return E_Access_Subprogram_Type;
end if;
end Get_Kind;
-- Start of processing for Build_Access_Subprogram_Type
begin
-- In the case of an access to subprogram, use the name of the
-- subprogram itself as the designated type. Type-checking in
-- this case compares the signatures of the designated types.
Set_Etype (N, Any_Type);
if not Is_Overloaded (P) then
if not Is_Intrinsic_Subprogram (Entity (P)) then
Acc_Type :=
New_Internal_Entity
(Get_Kind (Entity (P)), Current_Scope, Loc, 'A');
Set_Etype (Acc_Type, Acc_Type);
Set_Directly_Designated_Type (Acc_Type, Entity (P));
Set_Etype (N, Acc_Type);
end if;
else
Get_First_Interp (P, Index, It);
while Present (It.Nam) loop
if not Is_Intrinsic_Subprogram (It.Nam) then
Acc_Type :=
New_Internal_Entity
(Get_Kind (It.Nam), Current_Scope, Loc, 'A');
Set_Etype (Acc_Type, Acc_Type);
Set_Directly_Designated_Type (Acc_Type, It.Nam);
Add_One_Interp (N, Acc_Type, Acc_Type);
end if;
Get_Next_Interp (Index, It);
end loop;
end if;
if Etype (N) = Any_Type then
Error_Attr ("prefix of % attribute cannot be intrinsic", P);
end if;
end Build_Access_Subprogram_Type;
-- Start of processing for Analyze_Access_Attribute
begin
Check_E0;
if Nkind (P) = N_Character_Literal then
Error_Attr
("prefix of % attribute cannot be enumeration literal", P);
end if;
-- Case of access to subprogram
if Is_Entity_Name (P)
and then Is_Overloadable (Entity (P))
then
-- Not allowed for nested subprograms if No_Implicit_Dynamic_Code
-- restriction set (since in general a trampoline is required).
if not Is_Library_Level_Entity (Entity (P)) then
Check_Restriction (No_Implicit_Dynamic_Code, P);
end if;
if Is_Always_Inlined (Entity (P)) then
Error_Attr
("prefix of % attribute cannot be Inline_Always subprogram",
P);
end if;
-- Build the appropriate subprogram type
Build_Access_Subprogram_Type (P);
-- For unrestricted access, kill current values, since this
-- attribute allows a reference to a local subprogram that
-- could modify local variables to be passed out of scope
if Aname = Name_Unrestricted_Access then
Kill_Current_Values;
end if;
return;
-- Component is an operation of a protected type
elsif Nkind (P) = N_Selected_Component
and then Is_Overloadable (Entity (Selector_Name (P)))
then
if Ekind (Entity (Selector_Name (P))) = E_Entry then
Error_Attr ("prefix of % attribute must be subprogram", P);
end if;
Build_Access_Subprogram_Type (Selector_Name (P));
return;
end if;
-- Deal with incorrect reference to a type, but note that some
-- accesses are allowed (references to the current type instance).
if Is_Entity_Name (P) then
Typ := Entity (P);
-- The reference may appear in an aggregate that has been expanded
-- into a loop. Locate scope of type definition, if any.
Scop := Current_Scope;
while Ekind (Scop) = E_Loop loop
Scop := Scope (Scop);
end loop;
if Is_Type (Typ) then
-- OK if we are within the scope of a limited type
-- let's mark the component as having per object constraint
if Is_Anonymous_Tagged_Base (Scop, Typ) then
Typ := Scop;
Set_Entity (P, Typ);
Set_Etype (P, Typ);
end if;
if Typ = Scop then
declare
Q : Node_Id := Parent (N);
begin
while Present (Q)
and then Nkind (Q) /= N_Component_Declaration
loop
Q := Parent (Q);
end loop;
if Present (Q) then
Set_Has_Per_Object_Constraint (
Defining_Identifier (Q), True);
end if;
end;
if Nkind (P) = N_Expanded_Name then
Error_Msg_N
("current instance prefix must be a direct name", P);
end if;
-- If a current instance attribute appears within a
-- a component constraint it must appear alone; other
-- contexts (default expressions, within a task body)
-- are not subject to this restriction.
if not In_Default_Expression
and then not Has_Completion (Scop)
and then
Nkind (Parent (N)) /= N_Discriminant_Association
and then
Nkind (Parent (N)) /= N_Index_Or_Discriminant_Constraint
then
Error_Msg_N
("current instance attribute must appear alone", N);
end if;
-- OK if we are in initialization procedure for the type
-- in question, in which case the reference to the type
-- is rewritten as a reference to the current object.
elsif Ekind (Scop) = E_Procedure
and then Is_Init_Proc (Scop)
and then Etype (First_Formal (Scop)) = Typ
then
Rewrite (N,
Make_Attribute_Reference (Loc,
Prefix => Make_Identifier (Loc, Name_uInit),
Attribute_Name => Name_Unrestricted_Access));
Analyze (N);
return;
-- OK if a task type, this test needs sharpening up ???
elsif Is_Task_Type (Typ) then
null;
-- Otherwise we have an error case
else
Error_Attr ("% attribute cannot be applied to type", P);
return;
end if;
end if;
end if;
-- If we fall through, we have a normal access to object case.
-- Unrestricted_Access is legal wherever an allocator would be
-- legal, so its Etype is set to E_Allocator. The expected type
-- of the other attributes is a general access type, and therefore
-- we label them with E_Access_Attribute_Type.
if not Is_Overloaded (P) then
Acc_Type := Build_Access_Object_Type (P_Type);
Set_Etype (N, Acc_Type);
else
declare
Index : Interp_Index;
It : Interp;
begin
Set_Etype (N, Any_Type);
Get_First_Interp (P, Index, It);
while Present (It.Typ) loop
Acc_Type := Build_Access_Object_Type (It.Typ);
Add_One_Interp (N, Acc_Type, Acc_Type);
Get_Next_Interp (Index, It);
end loop;
end;
end if;
-- If we have an access to an object, and the attribute comes
-- from source, then set the object as potentially source modified.
-- We do this because the resulting access pointer can be used to
-- modify the variable, and we might not detect this, leading to
-- some junk warnings.
if Is_Entity_Name (P) then
Set_Never_Set_In_Source (Entity (P), False);
end if;
-- Check for aliased view unless unrestricted case. We allow
-- a nonaliased prefix when within an instance because the
-- prefix may have been a tagged formal object, which is
-- defined to be aliased even when the actual might not be
-- (other instance cases will have been caught in the generic).
-- Similarly, within an inlined body we know that the attribute
-- is legal in the original subprogram, and therefore legal in
-- the expansion.
if Aname /= Name_Unrestricted_Access
and then not Is_Aliased_View (P)
and then not In_Instance
and then not In_Inlined_Body
then
Error_Attr ("prefix of % attribute must be aliased", P);
end if;
end Analyze_Access_Attribute;
--------------------------------
-- Check_Array_Or_Scalar_Type --
--------------------------------
procedure Check_Array_Or_Scalar_Type is
Index : Entity_Id;
D : Int;
-- Dimension number for array attributes
begin
-- Case of string literal or string literal subtype. These cases
-- cannot arise from legal Ada code, but the expander is allowed
-- to generate them. They require special handling because string
-- literal subtypes do not have standard bounds (the whole idea
-- of these subtypes is to avoid having to generate the bounds)
if Ekind (P_Type) = E_String_Literal_Subtype then
Set_Etype (N, Etype (First_Index (P_Base_Type)));
return;
-- Scalar types
elsif Is_Scalar_Type (P_Type) then
Check_Type;
if Present (E1) then
Error_Attr ("invalid argument in % attribute", E1);
else
Set_Etype (N, P_Base_Type);
return;
end if;
-- The following is a special test to allow 'First to apply to
-- private scalar types if the attribute comes from generated
-- code. This occurs in the case of Normalize_Scalars code.
elsif Is_Private_Type (P_Type)
and then Present (Full_View (P_Type))
and then Is_Scalar_Type (Full_View (P_Type))
and then not Comes_From_Source (N)
then
Set_Etype (N, Implementation_Base_Type (P_Type));
-- Array types other than string literal subtypes handled above
else
Check_Array_Type;
-- We know prefix is an array type, or the name of an array
-- object, and that the expression, if present, is static
-- and within the range of the dimensions of the type.
pragma Assert (Is_Array_Type (P_Type));
Index := First_Index (P_Base_Type);
if No (E1) then
-- First dimension assumed
Set_Etype (N, Base_Type (Etype (Index)));
else
D := UI_To_Int (Intval (E1));
for J in 1 .. D - 1 loop
Next_Index (Index);
end loop;
Set_Etype (N, Base_Type (Etype (Index)));
Set_Etype (E1, Standard_Integer);
end if;
end if;
end Check_Array_Or_Scalar_Type;
----------------------
-- Check_Array_Type --
----------------------
procedure Check_Array_Type is
D : Int;
-- Dimension number for array attributes
begin
-- If the type is a string literal type, then this must be generated
-- internally, and no further check is required on its legality.
if Ekind (P_Type) = E_String_Literal_Subtype then
return;
-- If the type is a composite, it is an illegal aggregate, no point
-- in going on.
elsif P_Type = Any_Composite then
raise Bad_Attribute;
end if;
-- Normal case of array type or subtype
Check_Either_E0_Or_E1;
Check_Dereference;
if Is_Array_Type (P_Type) then
if not Is_Constrained (P_Type)
and then Is_Entity_Name (P)
and then Is_Type (Entity (P))
then
-- Note: we do not call Error_Attr here, since we prefer to
-- continue, using the relevant index type of the array,
-- even though it is unconstrained. This gives better error
-- recovery behavior.
Error_Msg_Name_1 := Aname;
Error_Msg_N
("prefix for % attribute must be constrained array", P);
end if;
D := Number_Dimensions (P_Type);
else
if Is_Private_Type (P_Type) then
Error_Attr
("prefix for % attribute may not be private type", P);
elsif Is_Access_Type (P_Type)
and then Is_Array_Type (Designated_Type (P_Type))
and then Is_Entity_Name (P)
and then Is_Type (Entity (P))
then
Error_Attr ("prefix of % attribute cannot be access type", P);
elsif Attr_Id = Attribute_First
or else
Attr_Id = Attribute_Last
then
Error_Attr ("invalid prefix for % attribute", P);
else
Error_Attr ("prefix for % attribute must be array", P);
end if;
end if;
if Present (E1) then
Resolve (E1, Any_Integer);
Set_Etype (E1, Standard_Integer);
if not Is_Static_Expression (E1)
or else Raises_Constraint_Error (E1)
then
Flag_Non_Static_Expr
("expression for dimension must be static!", E1);
Error_Attr;
elsif UI_To_Int (Expr_Value (E1)) > D
or else UI_To_Int (Expr_Value (E1)) < 1
then
Error_Attr ("invalid dimension number for array type", E1);
end if;
end if;
end Check_Array_Type;
-------------------------
-- Check_Asm_Attribute --
-------------------------
procedure Check_Asm_Attribute is
begin
Check_Type;
Check_E2;
-- Check first argument is static string expression
Analyze_And_Resolve (E1, Standard_String);
if Etype (E1) = Any_Type then
return;
elsif not Is_OK_Static_Expression (E1) then
Flag_Non_Static_Expr
("constraint argument must be static string expression!", E1);
Error_Attr;
end if;
-- Check second argument is right type
Analyze_And_Resolve (E2, Entity (P));
-- Note: that is all we need to do, we don't need to check
-- that it appears in a correct context. The Ada type system
-- will do that for us.
end Check_Asm_Attribute;
---------------------
-- Check_Component --
---------------------
procedure Check_Component is
begin
Check_E0;
if Nkind (P) /= N_Selected_Component
or else
(Ekind (Entity (Selector_Name (P))) /= E_Component
and then
Ekind (Entity (Selector_Name (P))) /= E_Discriminant)
then
Error_Attr
("prefix for % attribute must be selected component", P);
end if;
end Check_Component;
------------------------------------
-- Check_Decimal_Fixed_Point_Type --
------------------------------------
procedure Check_Decimal_Fixed_Point_Type is
begin
Check_Type;
if not Is_Decimal_Fixed_Point_Type (P_Type) then
Error_Attr
("prefix of % attribute must be decimal type", P);
end if;
end Check_Decimal_Fixed_Point_Type;
-----------------------
-- Check_Dereference --
-----------------------
procedure Check_Dereference is
begin
-- Case of a subtype mark
if Is_Entity_Name (P)
and then Is_Type (Entity (P))
then
return;
end if;
-- Case of an expression
Resolve (P);
if Is_Access_Type (P_Type) then
-- If there is an implicit dereference, then we must freeze
-- the designated type of the access type, since the type of
-- the referenced array is this type (see AI95-00106).
Freeze_Before (N, Designated_Type (P_Type));
Rewrite (P,
Make_Explicit_Dereference (Sloc (P),
Prefix => Relocate_Node (P)));
Analyze_And_Resolve (P);
P_Type := Etype (P);
if P_Type = Any_Type then
raise Bad_Attribute;
end if;
P_Base_Type := Base_Type (P_Type);
end if;
end Check_Dereference;
-------------------------
-- Check_Discrete_Type --
-------------------------
procedure Check_Discrete_Type is
begin
Check_Type;
if not Is_Discrete_Type (P_Type) then
Error_Attr ("prefix of % attribute must be discrete type", P);
end if;
end Check_Discrete_Type;
--------------
-- Check_E0 --
--------------
procedure Check_E0 is
begin
if Present (E1) then
Unexpected_Argument (E1);
end if;
end Check_E0;
--------------
-- Check_E1 --
--------------
procedure Check_E1 is
begin
Check_Either_E0_Or_E1;
if No (E1) then
-- Special-case attributes that are functions and that appear as
-- the prefix of another attribute. Error is posted on parent.
if Nkind (Parent (N)) = N_Attribute_Reference
and then (Attribute_Name (Parent (N)) = Name_Address
or else
Attribute_Name (Parent (N)) = Name_Code_Address
or else
Attribute_Name (Parent (N)) = Name_Access)
then
Error_Msg_Name_1 := Attribute_Name (Parent (N));
Error_Msg_N ("illegal prefix for % attribute", Parent (N));
Set_Etype (Parent (N), Any_Type);
Set_Entity (Parent (N), Any_Type);
raise Bad_Attribute;
else
Error_Attr ("missing argument for % attribute", N);
end if;
end if;
end Check_E1;
--------------
-- Check_E2 --
--------------
procedure Check_E2 is
begin
if No (E1) then
Error_Attr ("missing arguments for % attribute (2 required)", N);
elsif No (E2) then
Error_Attr ("missing argument for % attribute (2 required)", N);
end if;
end Check_E2;
---------------------------
-- Check_Either_E0_Or_E1 --
---------------------------
procedure Check_Either_E0_Or_E1 is
begin
if Present (E2) then
Unexpected_Argument (E2);
end if;
end Check_Either_E0_Or_E1;
----------------------
-- Check_Enum_Image --
----------------------
procedure Check_Enum_Image is
Lit : Entity_Id;
begin
if Is_Enumeration_Type (P_Base_Type) then
Lit := First_Literal (P_Base_Type);
while Present (Lit) loop
Set_Referenced (Lit);
Next_Literal (Lit);
end loop;
end if;
end Check_Enum_Image;
----------------------------
-- Check_Fixed_Point_Type --
----------------------------
procedure Check_Fixed_Point_Type is
begin
Check_Type;
if not Is_Fixed_Point_Type (P_Type) then
Error_Attr ("prefix of % attribute must be fixed point type", P);
end if;
end Check_Fixed_Point_Type;
------------------------------
-- Check_Fixed_Point_Type_0 --
------------------------------
procedure Check_Fixed_Point_Type_0 is
begin
Check_Fixed_Point_Type;
Check_E0;
end Check_Fixed_Point_Type_0;
-------------------------------
-- Check_Floating_Point_Type --
-------------------------------
procedure Check_Floating_Point_Type is
begin
Check_Type;
if not Is_Floating_Point_Type (P_Type) then
Error_Attr ("prefix of % attribute must be float type", P);
end if;
end Check_Floating_Point_Type;
---------------------------------
-- Check_Floating_Point_Type_0 --
---------------------------------
procedure Check_Floating_Point_Type_0 is
begin
Check_Floating_Point_Type;
Check_E0;
end Check_Floating_Point_Type_0;
---------------------------------
-- Check_Floating_Point_Type_1 --
---------------------------------
procedure Check_Floating_Point_Type_1 is
begin
Check_Floating_Point_Type;
Check_E1;
end Check_Floating_Point_Type_1;
---------------------------------
-- Check_Floating_Point_Type_2 --
---------------------------------
procedure Check_Floating_Point_Type_2 is
begin
Check_Floating_Point_Type;
Check_E2;
end Check_Floating_Point_Type_2;
------------------------
-- Check_Integer_Type --
------------------------
procedure Check_Integer_Type is
begin
Check_Type;
if not Is_Integer_Type (P_Type) then
Error_Attr ("prefix of % attribute must be integer type", P);
end if;
end Check_Integer_Type;
------------------------
-- Check_Library_Unit --
------------------------
procedure Check_Library_Unit is
begin
if not Is_Compilation_Unit (Entity (P)) then
Error_Attr ("prefix of % attribute must be library unit", P);
end if;
end Check_Library_Unit;
--------------------------------
-- Check_Modular_Integer_Type --
--------------------------------
procedure Check_Modular_Integer_Type is
begin
Check_Type;
if not Is_Modular_Integer_Type (P_Type) then
Error_Attr
("prefix of % attribute must be modular integer type", P);
end if;
end Check_Modular_Integer_Type;
-------------------------------
-- Check_Not_Incomplete_Type --
-------------------------------
procedure Check_Not_Incomplete_Type is
E : Entity_Id;
Typ : Entity_Id;
begin
-- Ada 2005 (AI-50217, AI-326): If the prefix is an explicit
-- dereference we have to check wrong uses of incomplete types
-- (other wrong uses are checked at their freezing point).
-- Example 1: Limited-with
-- limited with Pkg;
-- package P is
-- type Acc is access Pkg.T;
-- X : Acc;
-- S : Integer := X.all'Size; -- ERROR
-- end P;
-- Example 2: Tagged incomplete
-- type T is tagged;
-- type Acc is access all T;
-- X : Acc;
-- S : constant Integer := X.all'Size; -- ERROR
-- procedure Q (Obj : Integer := X.all'Alignment); -- ERROR
if Ada_Version >= Ada_05
and then Nkind (P) = N_Explicit_Dereference
then
E := P;
while Nkind (E) = N_Explicit_Dereference loop
E := Prefix (E);
end loop;
if From_With_Type (Etype (E)) then
Error_Attr
("prefix of % attribute cannot be an incomplete type", P);
else
if Is_Access_Type (Etype (E)) then
Typ := Directly_Designated_Type (Etype (E));
else
Typ := Etype (E);
end if;
if Ekind (Typ) = E_Incomplete_Type
and then No (Full_View (Typ))
then
Error_Attr
("prefix of % attribute cannot be an incomplete type", P);
end if;
end if;
end if;
if not Is_Entity_Name (P)
or else not Is_Type (Entity (P))
or else In_Default_Expression
then
return;
else
Check_Fully_Declared (P_Type, P);
end if;
end Check_Not_Incomplete_Type;
----------------------------
-- Check_Object_Reference --
----------------------------
procedure Check_Object_Reference (P : Node_Id) is
Rtyp : Entity_Id;
begin
-- If we need an object, and we have a prefix that is the name of
-- a function entity, convert it into a function call.
if Is_Entity_Name (P)
and then Ekind (Entity (P)) = E_Function
then
Rtyp := Etype (Entity (P));
Rewrite (P,
Make_Function_Call (Sloc (P),
Name => Relocate_Node (P)));
Analyze_And_Resolve (P, Rtyp);
-- Otherwise we must have an object reference
elsif not Is_Object_Reference (P) then
Error_Attr ("prefix of % attribute must be object", P);
end if;
end Check_Object_Reference;
------------------------
-- Check_Program_Unit --
------------------------
procedure Check_Program_Unit is
begin
if Is_Entity_Name (P) then
declare
K : constant Entity_Kind := Ekind (Entity (P));
T : constant Entity_Id := Etype (Entity (P));
begin
if K in Subprogram_Kind
or else K in Task_Kind
or else K in Protected_Kind
or else K = E_Package
or else K in Generic_Unit_Kind
or else (K = E_Variable
and then
(Is_Task_Type (T)
or else
Is_Protected_Type (T)))
then
return;
end if;
end;
end if;
Error_Attr ("prefix of % attribute must be program unit", P);
end Check_Program_Unit;
---------------------
-- Check_Real_Type --
---------------------
procedure Check_Real_Type is
begin
Check_Type;
if not Is_Real_Type (P_Type) then
Error_Attr ("prefix of % attribute must be real type", P);
end if;
end Check_Real_Type;
-----------------------
-- Check_Scalar_Type --
-----------------------
procedure Check_Scalar_Type is
begin
Check_Type;
if not Is_Scalar_Type (P_Type) then
Error_Attr ("prefix of % attribute must be scalar type", P);
end if;
end Check_Scalar_Type;
---------------------------
-- Check_Standard_Prefix --
---------------------------
procedure Check_Standard_Prefix is
begin
Check_E0;
if Nkind (P) /= N_Identifier
or else Chars (P) /= Name_Standard
then
Error_Attr ("only allowed prefix for % attribute is Standard", P);
end if;
end Check_Standard_Prefix;
----------------------------
-- Check_Stream_Attribute --
----------------------------
procedure Check_Stream_Attribute (Nam : TSS_Name_Type) is
Etyp : Entity_Id;
Btyp : Entity_Id;
begin
Validate_Non_Static_Attribute_Function_Call;
-- With the exception of 'Input, Stream attributes are procedures,
-- and can only appear at the position of procedure calls. We check
-- for this here, before they are rewritten, to give a more precise
-- diagnostic.
if Nam = TSS_Stream_Input then
null;
elsif Is_List_Member (N)
and then Nkind (Parent (N)) /= N_Procedure_Call_Statement
and then Nkind (Parent (N)) /= N_Aggregate
then
null;
else
Error_Attr
("invalid context for attribute%, which is a procedure", N);
end if;
Check_Type;
Btyp := Implementation_Base_Type (P_Type);
-- Stream attributes not allowed on limited types unless the
-- attribute reference was generated by the expander (in which
-- case the underlying type will be used, as described in Sinfo),
-- or the attribute was specified explicitly for the type itself
-- or one of its ancestors (taking visibility rules into account if
-- in Ada 2005 mode), or a pragma Stream_Convert applies to Btyp
-- (with no visibility restriction).
if Comes_From_Source (N)
and then not Stream_Attribute_Available (P_Type, Nam)
and then not Has_Rep_Pragma (Btyp, Name_Stream_Convert)
then
Error_Msg_Name_1 := Aname;
if Is_Limited_Type (P_Type) then
Error_Msg_NE
("limited type& has no% attribute", P, P_Type);
Explain_Limited_Type (P_Type, P);
else
Error_Msg_NE
("attribute% for type& is not available", P, P_Type);
end if;
end if;
-- Check for violation of restriction No_Stream_Attributes
if Is_RTE (P_Type, RE_Exception_Id)
or else
Is_RTE (P_Type, RE_Exception_Occurrence)
then
Check_Restriction (No_Exception_Registration, P);
end if;
-- Here we must check that the first argument is an access type
-- that is compatible with Ada.Streams.Root_Stream_Type'Class.
Analyze_And_Resolve (E1);
Etyp := Etype (E1);
-- Note: the double call to Root_Type here is needed because the
-- root type of a class-wide type is the corresponding type (e.g.
-- X for X'Class, and we really want to go to the root.
if not Is_Access_Type (Etyp)
or else Root_Type (Root_Type (Designated_Type (Etyp))) /=
RTE (RE_Root_Stream_Type)
then
Error_Attr
("expected access to Ada.Streams.Root_Stream_Type''Class", E1);
end if;
-- Check that the second argument is of the right type if there is
-- one (the Input attribute has only one argument so this is skipped)
if Present (E2) then
Analyze (E2);
if Nam = TSS_Stream_Read
and then not Is_OK_Variable_For_Out_Formal (E2)
then
Error_Attr
("second argument of % attribute must be a variable", E2);
end if;
Resolve (E2, P_Type);
end if;
end Check_Stream_Attribute;
-----------------------
-- Check_Task_Prefix --
-----------------------
procedure Check_Task_Prefix is
begin
Analyze (P);
-- Ada 2005 (AI-345): Attribute 'Terminated can be applied to
-- task interface class-wide types.
if Is_Task_Type (Etype (P))
or else (Is_Access_Type (Etype (P))
and then Is_Task_Type (Designated_Type (Etype (P))))
or else (Ada_Version >= Ada_05
and then Ekind (Etype (P)) = E_Class_Wide_Type
and then Is_Interface (Etype (P))
and then Is_Task_Interface (Etype (P)))
then
Resolve (P);
else
if Ada_Version >= Ada_05 then
Error_Attr ("prefix of % attribute must be a task or a task "
& "interface class-wide object", P);
else
Error_Attr ("prefix of % attribute must be a task", P);
end if;
end if;
end Check_Task_Prefix;
----------------
-- Check_Type --
----------------
-- The possibilities are an entity name denoting a type, or an
-- attribute reference that denotes a type (Base or Class). If
-- the type is incomplete, replace it with its full view.
procedure Check_Type is
begin
if not Is_Entity_Name (P)
or else not Is_Type (Entity (P))
then
Error_Attr ("prefix of % attribute must be a type", P);
elsif Ekind (Entity (P)) = E_Incomplete_Type
and then Present (Full_View (Entity (P)))
then
P_Type := Full_View (Entity (P));
Set_Entity (P, P_Type);
end if;
end Check_Type;
---------------------
-- Check_Unit_Name --
---------------------
procedure Check_Unit_Name (Nod : Node_Id) is
begin
if Nkind (Nod) = N_Identifier then
return;
elsif Nkind (Nod) = N_Selected_Component then
Check_Unit_Name (Prefix (Nod));
if Nkind (Selector_Name (Nod)) = N_Identifier then
return;
end if;
end if;
Error_Attr ("argument for % attribute must be unit name", P);
end Check_Unit_Name;
----------------
-- Error_Attr --
----------------
procedure Error_Attr is
begin
Set_Etype (N, Any_Type);
Set_Entity (N, Any_Type);
raise Bad_Attribute;
end Error_Attr;
procedure Error_Attr (Msg : String; Error_Node : Node_Id) is
begin
Error_Msg_Name_1 := Aname;
Error_Msg_N (Msg, Error_Node);
Error_Attr;
end Error_Attr;
----------------------------
-- Legal_Formal_Attribute --
----------------------------
procedure Legal_Formal_Attribute is
begin
Check_E0;
if not Is_Entity_Name (P)
or else not Is_Type (Entity (P))
then
Error_Attr ("prefix of % attribute must be generic type", N);
elsif Is_Generic_Actual_Type (Entity (P))
or else In_Instance
or else In_Inlined_Body
then
null;
elsif Is_Generic_Type (Entity (P)) then
if not Is_Indefinite_Subtype (Entity (P)) then
Error_Attr
("prefix of % attribute must be indefinite generic type", N);
end if;
else
Error_Attr
("prefix of % attribute must be indefinite generic type", N);
end if;
Set_Etype (N, Standard_Boolean);
end Legal_Formal_Attribute;
------------------------
-- Standard_Attribute --
------------------------
procedure Standard_Attribute (Val : Int) is
begin
Check_Standard_Prefix;
-- First a special check (more like a kludge really). For GNAT5
-- on Windows, the alignments in GCC are severely mixed up. In
-- particular, we have a situation where the maximum alignment
-- that GCC thinks is possible is greater than the guaranteed
-- alignment at run-time. That causes many problems. As a partial
-- cure for this situation, we force a value of 4 for the maximum
-- alignment attribute on this target. This still does not solve
-- all problems, but it helps.
-- A further (even more horrible) dimension to this kludge is now
-- installed. There are two uses for Maximum_Alignment, one is to
-- determine the maximum guaranteed alignment, that's the one we
-- want the kludge to yield as 4. The other use is to maximally
-- align objects, we can't use 4 here, since for example, long
-- long integer has an alignment of 8, so we will get errors.
-- It is of course impossible to determine which use the programmer
-- has in mind, but an approximation for now is to disconnect the
-- kludge if the attribute appears in an alignment clause.
-- To be removed if GCC ever gets its act together here ???
Alignment_Kludge : declare
P : Node_Id;
function On_X86 return Boolean;
-- Determine if target is x86 (ia32), return True if so
------------
-- On_X86 --
------------
function On_X86 return Boolean is
T : constant String := Sdefault.Target_Name.all;
begin
-- There is no clean way to check this. That's not surprising,
-- the front end should not be doing this kind of test ???. The
-- way we do it is test for either "86" or "pentium" being in
-- the string for the target name. However, we need to exclude
-- x86_64 for this check.
for J in T'First .. T'Last - 1 loop
if (T (J .. J + 1) = "86"
and then
(J + 4 > T'Last
or else T (J + 2 .. J + 4) /= "_64"))
or else (J <= T'Last - 6
and then T (J .. J + 6) = "pentium")
then
return True;
end if;
end loop;
return False;
end On_X86;
begin
if Aname = Name_Maximum_Alignment and then On_X86 then
P := Parent (N);
while Nkind (P) in N_Subexpr loop
P := Parent (P);
end loop;
if Nkind (P) /= N_Attribute_Definition_Clause
or else Chars (P) /= Name_Alignment
then
Rewrite (N, Make_Integer_Literal (Loc, 4));
Analyze (N);
return;
end if;
end if;
end Alignment_Kludge;
-- Normally we get the value from gcc ???
Rewrite (N, Make_Integer_Literal (Loc, Val));
Analyze (N);
end Standard_Attribute;
-------------------------
-- Unexpected Argument --
-------------------------
procedure Unexpected_Argument (En : Node_Id) is
begin
Error_Attr ("unexpected argument for % attribute", En);
end Unexpected_Argument;
-------------------------------------------------
-- Validate_Non_Static_Attribute_Function_Call --
-------------------------------------------------
-- This function should be moved to Sem_Dist ???
procedure Validate_Non_Static_Attribute_Function_Call is
begin
if In_Preelaborated_Unit
and then not In_Subprogram_Or_Concurrent_Unit
then
Flag_Non_Static_Expr
("non-static function call in preelaborated unit!", N);
end if;
end Validate_Non_Static_Attribute_Function_Call;
-----------------------------------------------
-- Start of Processing for Analyze_Attribute --
-----------------------------------------------
begin
-- Immediate return if unrecognized attribute (already diagnosed
-- by parser, so there is nothing more that we need to do)
if not Is_Attribute_Name (Aname) then
raise Bad_Attribute;
end if;
-- Deal with Ada 83 and Features issues
if Comes_From_Source (N) then
if not Attribute_83 (Attr_Id) then
if Ada_Version = Ada_83 and then Comes_From_Source (N) then
Error_Msg_Name_1 := Aname;
Error_Msg_N ("(Ada 83) attribute% is not standard?", N);
end if;
if Attribute_Impl_Def (Attr_Id) then
Check_Restriction (No_Implementation_Attributes, N);
end if;
end if;
end if;
-- Remote access to subprogram type access attribute reference needs
-- unanalyzed copy for tree transformation. The analyzed copy is used
-- for its semantic information (whether prefix is a remote subprogram
-- name), the unanalyzed copy is used to construct new subtree rooted
-- with N_Aggregate which represents a fat pointer aggregate.
if Aname = Name_Access then
Discard_Node (Copy_Separate_Tree (N));
end if;
-- Analyze prefix and exit if error in analysis. If the prefix is an
-- incomplete type, use full view if available. A special case is
-- that we never analyze the prefix of an Elab_Body or Elab_Spec
-- or UET_Address attribute.
if Aname /= Name_Elab_Body
and then
Aname /= Name_Elab_Spec
and then
Aname /= Name_UET_Address
then
Analyze (P);
P_Type := Etype (P);
if Is_Entity_Name (P)
and then Present (Entity (P))
and then Is_Type (Entity (P))
then
if Ekind (Entity (P)) = E_Incomplete_Type then
P_Type := Get_Full_View (P_Type);
Set_Entity (P, P_Type);
Set_Etype (P, P_Type);
elsif Entity (P) = Current_Scope
and then Is_Record_Type (Entity (P))
then
-- Use of current instance within the type. Verify that if the
-- attribute appears within a constraint, it yields an access
-- type, other uses are illegal.
declare
Par : Node_Id;
begin
Par := Parent (N);
while Present (Par)
and then Nkind (Parent (Par)) /= N_Component_Definition
loop
Par := Parent (Par);
end loop;
if Present (Par)
and then Nkind (Par) = N_Subtype_Indication
then
if Attr_Id /= Attribute_Access
and then Attr_Id /= Attribute_Unchecked_Access
and then Attr_Id /= Attribute_Unrestricted_Access
then
Error_Msg_N
("in a constraint the current instance can only"
& " be used with an access attribute", N);
end if;
end if;
end;
end if;
end if;
if P_Type = Any_Type then
raise Bad_Attribute;
end if;
P_Base_Type := Base_Type (P_Type);
end if;
-- Analyze expressions that may be present, exiting if an error occurs
if No (Exprs) then
E1 := Empty;
E2 := Empty;
else
E1 := First (Exprs);
Analyze (E1);
-- Check for missing or bad expression (result of previous error)
if No (E1) or else Etype (E1) = Any_Type then
raise Bad_Attribute;
end if;
E2 := Next (E1);
if Present (E2) then
Analyze (E2);
if Etype (E2) = Any_Type then
raise Bad_Attribute;
end if;
if Present (Next (E2)) then
Unexpected_Argument (Next (E2));
end if;
end if;
end if;
-- Ada 2005 (AI-345): Ensure that the compiler gives exactly the current
-- output compiling in Ada 95 mode
if Ada_Version < Ada_05
and then Is_Overloaded (P)
and then Aname /= Name_Access
and then Aname /= Name_Address
and then Aname /= Name_Code_Address
and then Aname /= Name_Count
and then Aname /= Name_Unchecked_Access
then
Error_Attr ("ambiguous prefix for % attribute", P);
elsif Ada_Version >= Ada_05
and then Is_Overloaded (P)
and then Aname /= Name_Access
and then Aname /= Name_Address
and then Aname /= Name_Code_Address
and then Aname /= Name_Unchecked_Access
then
-- Ada 2005 (AI-345): Since protected and task types have primitive
-- entry wrappers, the attributes Count, Caller and AST_Entry require
-- a context check
if Ada_Version >= Ada_05
and then (Aname = Name_Count
or else Aname = Name_Caller
or else Aname = Name_AST_Entry)
then
declare
Count : Natural := 0;
I : Interp_Index;
It : Interp;
begin
Get_First_Interp (P, I, It);
while Present (It.Nam) loop
if Comes_From_Source (It.Nam) then
Count := Count + 1;
else
Remove_Interp (I);
end if;
Get_Next_Interp (I, It);
end loop;
if Count > 1 then
Error_Attr ("ambiguous prefix for % attribute", P);
else
Set_Is_Overloaded (P, False);
end if;
end;
else
Error_Attr ("ambiguous prefix for % attribute", P);
end if;
end if;
-- Remaining processing depends on attribute
case Attr_Id is
------------------
-- Abort_Signal --
------------------
when Attribute_Abort_Signal =>
Check_Standard_Prefix;
Rewrite (N,
New_Reference_To (Stand.Abort_Signal, Loc));
Analyze (N);
------------
-- Access --
------------
when Attribute_Access =>
Analyze_Access_Attribute;
-------------
-- Address --
-------------
when Attribute_Address =>
Check_E0;
-- Check for some junk cases, where we have to allow the address
-- attribute but it does not make much sense, so at least for now
-- just replace with Null_Address.
-- We also do this if the prefix is a reference to the AST_Entry
-- attribute. If expansion is active, the attribute will be
-- replaced by a function call, and address will work fine and
-- get the proper value, but if expansion is not active, then
-- the check here allows proper semantic analysis of the reference.
-- An Address attribute created by expansion is legal even when it
-- applies to other entity-denoting expressions.
if Is_Entity_Name (P) then
declare
Ent : constant Entity_Id := Entity (P);
begin
if Is_Subprogram (Ent) then
if not Is_Library_Level_Entity (Ent) then
Check_Restriction (No_Implicit_Dynamic_Code, P);
end if;
Set_Address_Taken (Ent);
-- An Address attribute is accepted when generated by
-- the compiler for dispatching operation, and an error
-- is issued once the subprogram is frozen (to avoid
-- confusing errors about implicit uses of Address in
-- the dispatch table initialization).
if Is_Always_Inlined (Entity (P))
and then Comes_From_Source (P)
then
Error_Attr
("prefix of % attribute cannot be Inline_Always" &
" subprogram", P);
end if;
elsif Is_Object (Ent)
or else Ekind (Ent) = E_Label
then
Set_Address_Taken (Ent);
-- If we have an address of an object, and the attribute
-- comes from source, then set the object as potentially
-- source modified. We do this because the resulting address
-- can potentially be used to modify the variable and we
-- might not detect this, leading to some junk warnings.
Set_Never_Set_In_Source (Ent, False);
elsif (Is_Concurrent_Type (Etype (Ent))
and then Etype (Ent) = Base_Type (Ent))
or else Ekind (Ent) = E_Package
or else Is_Generic_Unit (Ent)
then
Rewrite (N,
New_Occurrence_Of (RTE (RE_Null_Address), Sloc (N)));
else
Error_Attr ("invalid prefix for % attribute", P);
end if;
end;
elsif Nkind (P) = N_Attribute_Reference
and then Attribute_Name (P) = Name_AST_Entry
then
Rewrite (N,
New_Occurrence_Of (RTE (RE_Null_Address), Sloc (N)));
elsif Is_Object_Reference (P) then
null;
elsif Nkind (P) = N_Selected_Component
and then Is_Subprogram (Entity (Selector_Name (P)))
then
null;
-- What exactly are we allowing here ??? and is this properly
-- documented in the sinfo documentation for this node ???
elsif not Comes_From_Source (N) then
null;
else
Error_Attr ("invalid prefix for % attribute", P);
end if;
Set_Etype (N, RTE (RE_Address));
------------------
-- Address_Size --
------------------
when Attribute_Address_Size =>
Standard_Attribute (System_Address_Size);
--------------
-- Adjacent --
--------------
when Attribute_Adjacent =>
Check_Floating_Point_Type_2;
Set_Etype (N, P_Base_Type);
Resolve (E1, P_Base_Type);
Resolve (E2, P_Base_Type);
---------
-- Aft --
---------
when Attribute_Aft =>
Check_Fixed_Point_Type_0;
Set_Etype (N, Universal_Integer);
---------------
-- Alignment --
---------------
when Attribute_Alignment =>
-- Don't we need more checking here, cf Size ???
Check_E0;
Check_Not_Incomplete_Type;
Set_Etype (N, Universal_Integer);
---------------
-- Asm_Input --
---------------
when Attribute_Asm_Input =>
Check_Asm_Attribute;
Set_Etype (N, RTE (RE_Asm_Input_Operand));
----------------
-- Asm_Output --
----------------
when Attribute_Asm_Output =>
Check_Asm_Attribute;
if Etype (E2) = Any_Type then
return;
elsif Aname = Name_Asm_Output then
if not Is_Variable (E2) then
Error_Attr
("second argument for Asm_Output is not variable", E2);
end if;
end if;
Note_Possible_Modification (E2);
Set_Etype (N, RTE (RE_Asm_Output_Operand));
---------------
-- AST_Entry --
---------------
when Attribute_AST_Entry => AST_Entry : declare
Ent : Entity_Id;
Pref : Node_Id;
Ptyp : Entity_Id;
Indexed : Boolean;
-- Indicates if entry family index is present. Note the coding
-- here handles the entry family case, but in fact it cannot be
-- executed currently, because pragma AST_Entry does not permit
-- the specification of an entry family.
procedure Bad_AST_Entry;
-- Signal a bad AST_Entry pragma
function OK_Entry (E : Entity_Id) return Boolean;
-- Checks that E is of an appropriate entity kind for an entry
-- (i.e. E_Entry if Index is False, or E_Entry_Family if Index
-- is set True for the entry family case). In the True case,
-- makes sure that Is_AST_Entry is set on the entry.
procedure Bad_AST_Entry is
begin
Error_Attr ("prefix for % attribute must be task entry", P);
end Bad_AST_Entry;
function OK_Entry (E : Entity_Id) return Boolean is
Result : Boolean;
begin
if Indexed then
Result := (Ekind (E) = E_Entry_Family);
else
Result := (Ekind (E) = E_Entry);
end if;
if Result then
if not Is_AST_Entry (E) then
Error_Msg_Name_2 := Aname;
Error_Attr
("% attribute requires previous % pragma", P);
end if;
end if;
return Result;
end OK_Entry;
-- Start of processing for AST_Entry
begin
Check_VMS (N);
Check_E0;
-- Deal with entry family case
if Nkind (P) = N_Indexed_Component then
Pref := Prefix (P);
Indexed := True;
else
Pref := P;
Indexed := False;
end if;
Ptyp := Etype (Pref);
if Ptyp = Any_Type or else Error_Posted (Pref) then
return;
end if;
-- If the prefix is a selected component whose prefix is of an
-- access type, then introduce an explicit dereference.
-- ??? Could we reuse Check_Dereference here?
if Nkind (Pref) = N_Selected_Component
and then Is_Access_Type (Ptyp)
then
Rewrite (Pref,
Make_Explicit_Dereference (Sloc (Pref),
Relocate_Node (Pref)));
Analyze_And_Resolve (Pref, Designated_Type (Ptyp));
end if;
-- Prefix can be of the form a.b, where a is a task object
-- and b is one of the entries of the corresponding task type.
if Nkind (Pref) = N_Selected_Component
and then OK_Entry (Entity (Selector_Name (Pref)))
and then Is_Object_Reference (Prefix (Pref))
and then Is_Task_Type (Etype (Prefix (Pref)))
then
null;
-- Otherwise the prefix must be an entry of a containing task,
-- or of a variable of the enclosing task type.
else
if Nkind (Pref) = N_Identifier
or else Nkind (Pref) = N_Expanded_Name
then
Ent := Entity (Pref);
if not OK_Entry (Ent)
or else not In_Open_Scopes (Scope (Ent))
then
Bad_AST_Entry;
end if;
else
Bad_AST_Entry;
end if;
end if;
Set_Etype (N, RTE (RE_AST_Handler));
end AST_Entry;
----------
-- Base --
----------
-- Note: when the base attribute appears in the context of a subtype
-- mark, the analysis is done by Sem_Ch8.Find_Type, rather than by
-- the following circuit.
when Attribute_Base => Base : declare
Typ : Entity_Id;
begin
Check_Either_E0_Or_E1;
Find_Type (P);
Typ := Entity (P);
if Ada_Version >= Ada_95
and then not Is_Scalar_Type (Typ)
and then not Is_Generic_Type (Typ)
then
Error_Msg_N ("prefix of Base attribute must be scalar type", N);
elsif Sloc (Typ) = Standard_Location
and then Base_Type (Typ) = Typ
and then Warn_On_Redundant_Constructs
then
Error_Msg_NE
("?redudant attribute, & is its own base type", N, Typ);
end if;
Set_Etype (N, Base_Type (Entity (P)));
-- If we have an expression present, then really this is a conversion
-- and the tree must be reformed. Note that this is one of the cases
-- in which we do a replace rather than a rewrite, because the
-- original tree is junk.
if Present (E1) then
Replace (N,
Make_Type_Conversion (Loc,
Subtype_Mark =>
Make_Attribute_Reference (Loc,
Prefix => Prefix (N),
Attribute_Name => Name_Base),
Expression => Relocate_Node (E1)));
-- E1 may be overloaded, and its interpretations preserved
Save_Interps (E1, Expression (N));
Analyze (N);
-- For other cases, set the proper type as the entity of the
-- attribute reference, and then rewrite the node to be an
-- occurrence of the referenced base type. This way, no one
-- else in the compiler has to worry about the base attribute.
else
Set_Entity (N, Base_Type (Entity (P)));
Rewrite (N,
New_Reference_To (Entity (N), Loc));
Analyze (N);
end if;
end Base;
---------
-- Bit --
---------
when Attribute_Bit => Bit :
begin
Check_E0;
if not Is_Object_Reference (P) then
Error_Attr ("prefix for % attribute must be object", P);
-- What about the access object cases ???
else
null;
end if;
Set_Etype (N, Universal_Integer);
end Bit;
---------------
-- Bit_Order --
---------------
when Attribute_Bit_Order => Bit_Order :
begin
Check_E0;
Check_Type;
if not Is_Record_Type (P_Type) then
Error_Attr ("prefix of % attribute must be record type", P);
end if;
if Bytes_Big_Endian xor Reverse_Bit_Order (P_Type) then
Rewrite (N,
New_Occurrence_Of (RTE (RE_High_Order_First), Loc));
else
Rewrite (N,
New_Occurrence_Of (RTE (RE_Low_Order_First), Loc));
end if;
Set_Etype (N, RTE (RE_Bit_Order));
Resolve (N);
-- Reset incorrect indication of staticness
Set_Is_Static_Expression (N, False);
end Bit_Order;
------------------
-- Bit_Position --
------------------
-- Note: in generated code, we can have a Bit_Position attribute
-- applied to a (naked) record component (i.e. the prefix is an
-- identifier that references an E_Component or E_Discriminant
-- entity directly, and this is interpreted as expected by Gigi.
-- The following code will not tolerate such usage, but when the
-- expander creates this special case, it marks it as analyzed
-- immediately and sets an appropriate type.
when Attribute_Bit_Position =>
if Comes_From_Source (N) then
Check_Component;
end if;
Set_Etype (N, Universal_Integer);
------------------
-- Body_Version --
------------------
when Attribute_Body_Version =>
Check_E0;
Check_Program_Unit;
Set_Etype (N, RTE (RE_Version_String));
--------------
-- Callable --
--------------
when Attribute_Callable =>
Check_E0;
Set_Etype (N, Standard_Boolean);
Check_Task_Prefix;
------------
-- Caller --
------------
when Attribute_Caller => Caller : declare
Ent : Entity_Id;
S : Entity_Id;
begin
Check_E0;
if Nkind (P) = N_Identifier
or else Nkind (P) = N_Expanded_Name
then
Ent := Entity (P);
if not Is_Entry (Ent) then
Error_Attr ("invalid entry name", N);
end if;
else
Error_Attr ("invalid entry name", N);
return;
end if;
for J in reverse 0 .. Scope_Stack.Last loop
S := Scope_Stack.Table (J).Entity;
if S = Scope (Ent) then
Error_Attr ("Caller must appear in matching accept or body", N);
elsif S = Ent then
exit;
end if;
end loop;
Set_Etype (N, RTE (RO_AT_Task_Id));
end Caller;
-------------
-- Ceiling --
-------------
when Attribute_Ceiling =>
Check_Floating_Point_Type_1;
Set_Etype (N, P_Base_Type);
Resolve (E1, P_Base_Type);
-----------
-- Class --
-----------
when Attribute_Class => Class : declare
P : constant Entity_Id := Prefix (N);
begin
Check_Restriction (No_Dispatch, N);
Check_Either_E0_Or_E1;
-- If we have an expression present, then really this is a conversion
-- and the tree must be reformed into a proper conversion. This is a
-- Replace rather than a Rewrite, because the original tree is junk.
-- If expression is overloaded, propagate interpretations to new one.
if Present (E1) then
Replace (N,
Make_Type_Conversion (Loc,
Subtype_Mark =>
Make_Attribute_Reference (Loc,
Prefix => P,
Attribute_Name => Name_Class),
Expression => Relocate_Node (E1)));
Save_Interps (E1, Expression (N));
if not Is_Interface (Etype (P)) then
Analyze (N);
-- Ada 2005 (AI-251): In case of abstract interfaces we have to
-- analyze and resolve the type conversion to generate the code
-- that displaces the reference to the base of the object.
else
Analyze_And_Resolve (N, Etype (P));
end if;
-- Otherwise we just need to find the proper type
else
Find_Type (N);
end if;
end Class;
------------------
-- Code_Address --
------------------
when Attribute_Code_Address =>
Check_E0;
if Nkind (P) = N_Attribute_Reference
and then (Attribute_Name (P) = Name_Elab_Body
or else
Attribute_Name (P) = Name_Elab_Spec)
then
null;
elsif not Is_Entity_Name (P)
or else (Ekind (Entity (P)) /= E_Function
and then
Ekind (Entity (P)) /= E_Procedure)
then
Error_Attr ("invalid prefix for % attribute", P);
Set_Address_Taken (Entity (P));
end if;
Set_Etype (N, RTE (RE_Address));
--------------------
-- Component_Size --
--------------------
when Attribute_Component_Size =>
Check_E0;
Set_Etype (N, Universal_Integer);
-- Note: unlike other array attributes, unconstrained arrays are OK
if Is_Array_Type (P_Type) and then not Is_Constrained (P_Type) then
null;
else
Check_Array_Type;
end if;
-------------
-- Compose --
-------------
when Attribute_Compose =>
Check_Floating_Point_Type_2;
Set_Etype (N, P_Base_Type);
Resolve (E1, P_Base_Type);
Resolve (E2, Any_Integer);
-----------------
-- Constrained --
-----------------
when Attribute_Constrained =>
Check_E0;
Set_Etype (N, Standard_Boolean);
-- Case from RM J.4(2) of constrained applied to private type
if Is_Entity_Name (P) and then Is_Type (Entity (P)) then
Check_Restriction (No_Obsolescent_Features, N);
if Warn_On_Obsolescent_Feature then
Error_Msg_N
("constrained for private type is an " &
"obsolescent feature ('R'M 'J.4)?", N);
end if;
-- If we are within an instance, the attribute must be legal
-- because it was valid in the generic unit. Ditto if this is
-- an inlining of a function declared in an instance.
if In_Instance
or else In_Inlined_Body
then
return;
-- For sure OK if we have a real private type itself, but must
-- be completed, cannot apply Constrained to incomplete type.
elsif Is_Private_Type (Entity (P)) then
-- Note: this is one of the Annex J features that does not
-- generate a warning from -gnatwj, since in fact it seems
-- very useful, and is used in the GNAT runtime.
Check_Not_Incomplete_Type;
return;
end if;
-- Normal (non-obsolescent case) of application to object of
-- a discriminated type.
else
Check_Object_Reference (P);
-- If N does not come from source, then we allow the
-- the attribute prefix to be of a private type whose
-- full type has discriminants. This occurs in cases
-- involving expanded calls to stream attributes.
if not Comes_From_Source (N) then
P_Type := Underlying_Type (P_Type);
end if;
-- Must have discriminants or be an access type designating
-- a type with discriminants. If it is a classwide type is
-- has unknown discriminants.
if Has_Discriminants (P_Type)
or else Has_Unknown_Discriminants (P_Type)
or else
(Is_Access_Type (P_Type)
and then Has_Discriminants (Designated_Type (P_Type)))
then
return;
-- Also allow an object of a generic type if extensions allowed
-- and allow this for any type at all.
elsif (Is_Generic_Type (P_Type)
or else Is_Generic_Actual_Type (P_Type))
and then Extensions_Allowed
then
return;
end if;
end if;
-- Fall through if bad prefix
Error_Attr
("prefix of % attribute must be object of discriminated type", P);
---------------
-- Copy_Sign --
---------------
when Attribute_Copy_Sign =>
Check_Floating_Point_Type_2;
Set_Etype (N, P_Base_Type);
Resolve (E1, P_Base_Type);
Resolve (E2, P_Base_Type);
-----------
-- Count --
-----------
when Attribute_Count => Count :
declare
Ent : Entity_Id;
S : Entity_Id;
Tsk : Entity_Id;
begin
Check_E0;
if Nkind (P) = N_Identifier
or else Nkind (P) = N_Expanded_Name
then
Ent := Entity (P);
if Ekind (Ent) /= E_Entry then
Error_Attr ("invalid entry name", N);
end if;
elsif Nkind (P) = N_Indexed_Component then
if not Is_Entity_Name (Prefix (P))
or else No (Entity (Prefix (P)))
or else Ekind (Entity (Prefix (P))) /= E_Entry_Family
then
if Nkind (Prefix (P)) = N_Selected_Component
and then Present (Entity (Selector_Name (Prefix (P))))
and then Ekind (Entity (Selector_Name (Prefix (P)))) =
E_Entry_Family
then
Error_Attr
("attribute % must apply to entry of current task", P);
else
Error_Attr ("invalid entry family name", P);
end if;
return;
else
Ent := Entity (Prefix (P));
end if;
elsif Nkind (P) = N_Selected_Component
and then Present (Entity (Selector_Name (P)))
and then Ekind (Entity (Selector_Name (P))) = E_Entry
then
Error_Attr
("attribute % must apply to entry of current task", P);
else
Error_Attr ("invalid entry name", N);
return;
end if;
for J in reverse 0 .. Scope_Stack.Last loop
S := Scope_Stack.Table (J).Entity;
if S = Scope (Ent) then
if Nkind (P) = N_Expanded_Name then
Tsk := Entity (Prefix (P));
-- The prefix denotes either the task type, or else a
-- single task whose task type is being analyzed.
if (Is_Type (Tsk)
and then Tsk = S)
or else (not Is_Type (Tsk)
and then Etype (Tsk) = S
and then not (Comes_From_Source (S)))
then
null;
else
Error_Attr
("Attribute % must apply to entry of current task", N);
end if;
end if;
exit;
elsif Ekind (Scope (Ent)) in Task_Kind
and then Ekind (S) /= E_Loop
and then Ekind (S) /= E_Block
and then Ekind (S) /= E_Entry
and then Ekind (S) /= E_Entry_Family
then
Error_Attr ("Attribute % cannot appear in inner unit", N);
elsif Ekind (Scope (Ent)) = E_Protected_Type
and then not Has_Completion (Scope (Ent))
then
Error_Attr ("attribute % can only be used inside body", N);
end if;
end loop;
if Is_Overloaded (P) then
declare
Index : Interp_Index;
It : Interp;
begin
Get_First_Interp (P, Index, It);
while Present (It.Nam) loop
if It.Nam = Ent then
null;
-- Ada 2005 (AI-345): Do not consider primitive entry
-- wrappers generated for task or protected types.
elsif Ada_Version >= Ada_05
and then not Comes_From_Source (It.Nam)
then
null;
else
Error_Attr ("ambiguous entry name", N);
end if;
Get_Next_Interp (Index, It);
end loop;
end;
end if;
Set_Etype (N, Universal_Integer);
end Count;
-----------------------
-- Default_Bit_Order --
-----------------------
when Attribute_Default_Bit_Order => Default_Bit_Order :
begin
Check_Standard_Prefix;
Check_E0;
if Bytes_Big_Endian then
Rewrite (N,
Make_Integer_Literal (Loc, False_Value));
else
Rewrite (N,
Make_Integer_Literal (Loc, True_Value));
end if;
Set_Etype (N, Universal_Integer);
Set_Is_Static_Expression (N);
end Default_Bit_Order;
--------------
-- Definite --
--------------
when Attribute_Definite =>
Legal_Formal_Attribute;
-----------
-- Delta --
-----------
when Attribute_Delta =>
Check_Fixed_Point_Type_0;
Set_Etype (N, Universal_Real);
------------
-- Denorm --
------------
when Attribute_Denorm =>
Check_Floating_Point_Type_0;
Set_Etype (N, Standard_Boolean);
------------
-- Digits --
------------
when Attribute_Digits =>
Check_E0;
Check_Type;
if not Is_Floating_Point_Type (P_Type)
and then not Is_Decimal_Fixed_Point_Type (P_Type)
then
Error_Attr
("prefix of % attribute must be float or decimal type", P);
end if;
Set_Etype (N, Universal_Integer);
---------------
-- Elab_Body --
---------------
-- Also handles processing for Elab_Spec
when Attribute_Elab_Body | Attribute_Elab_Spec =>
Check_E0;
Check_Unit_Name (P);
Set_Etype (N, Standard_Void_Type);
-- We have to manually call the expander in this case to get
-- the necessary expansion (normally attributes that return
-- entities are not expanded).
Expand (N);
---------------
-- Elab_Spec --
---------------
-- Shares processing with Elab_Body
----------------
-- Elaborated --
----------------
when Attribute_Elaborated =>
Check_E0;
Check_Library_Unit;
Set_Etype (N, Standard_Boolean);
----------
-- Emax --
----------
when Attribute_Emax =>
Check_Floating_Point_Type_0;
Set_Etype (N, Universal_Integer);
--------------
-- Enum_Rep --
--------------
when Attribute_Enum_Rep => Enum_Rep : declare
begin
if Present (E1) then
Check_E1;
Check_Discrete_Type;
Resolve (E1, P_Base_Type);
else
if not Is_Entity_Name (P)
or else (not Is_Object (Entity (P))
and then
Ekind (Entity (P)) /= E_Enumeration_Literal)
then
Error_Attr
("prefix of %attribute must be " &
"discrete type/object or enum literal", P);
end if;
end if;
Set_Etype (N, Universal_Integer);
end Enum_Rep;
-------------
-- Epsilon --
-------------
when Attribute_Epsilon =>
Check_Floating_Point_Type_0;
Set_Etype (N, Universal_Real);
--------------
-- Exponent --
--------------
when Attribute_Exponent =>
Check_Floating_Point_Type_1;
Set_Etype (N, Universal_Integer);
Resolve (E1, P_Base_Type);
------------------
-- External_Tag --
------------------
when Attribute_External_Tag =>
Check_E0;
Check_Type;
Set_Etype (N, Standard_String);
if not Is_Tagged_Type (P_Type) then
Error_Attr ("prefix of % attribute must be tagged", P);
end if;
-----------
-- First --
-----------
when Attribute_First =>
Check_Array_Or_Scalar_Type;
---------------
-- First_Bit --
---------------
when Attribute_First_Bit =>
Check_Component;
Set_Etype (N, Universal_Integer);
-----------------
-- Fixed_Value --
-----------------
when Attribute_Fixed_Value =>
Check_E1;
Check_Fixed_Point_Type;
Resolve (E1, Any_Integer);
Set_Etype (N, P_Base_Type);
-----------
-- Floor --
-----------
when Attribute_Floor =>
Check_Floating_Point_Type_1;
Set_Etype (N, P_Base_Type);
Resolve (E1, P_Base_Type);
----------
-- Fore --
----------
when Attribute_Fore =>
Check_Fixed_Point_Type_0;
Set_Etype (N, Universal_Integer);
--------------
-- Fraction --
--------------
when Attribute_Fraction =>
Check_Floating_Point_Type_1;
Set_Etype (N, P_Base_Type);
Resolve (E1, P_Base_Type);
-----------------------
-- Has_Access_Values --
-----------------------
when Attribute_Has_Access_Values =>
Check_Type;
Check_E0;
Set_Etype (N, Standard_Boolean);
-----------------------
-- Has_Discriminants --
-----------------------
when Attribute_Has_Discriminants =>
Legal_Formal_Attribute;
--------------
-- Identity --
--------------
when Attribute_Identity =>
Check_E0;
Analyze (P);
if Etype (P) = Standard_Exception_Type then
Set_Etype (N, RTE (RE_Exception_Id));
-- Ada 2005 (AI-345): Attribute 'Identity may be applied to
-- task interface class-wide types.
elsif Is_Task_Type (Etype (P))
or else (Is_Access_Type (Etype (P))
and then Is_Task_Type (Designated_Type (Etype (P))))
or else (Ada_Version >= Ada_05
and then Ekind (Etype (P)) = E_Class_Wide_Type
and then Is_Interface (Etype (P))
and then Is_Task_Interface (Etype (P)))
then
Resolve (P);
Set_Etype (N, RTE (RO_AT_Task_Id));
else
if Ada_Version >= Ada_05 then
Error_Attr ("prefix of % attribute must be an exception, a "
& "task or a task interface class-wide object", P);
else
Error_Attr ("prefix of % attribute must be a task or an "
& "exception", P);
end if;
end if;
-----------
-- Image --
-----------
when Attribute_Image => Image :
begin
Set_Etype (N, Standard_String);
Check_Scalar_Type;
if Is_Real_Type (P_Type) then
if Ada_Version = Ada_83 and then Comes_From_Source (N) then
Error_Msg_Name_1 := Aname;
Error_Msg_N
("(Ada 83) % attribute not allowed for real types", N);
end if;
end if;
if Is_Enumeration_Type (P_Type) then
Check_Restriction (No_Enumeration_Maps, N);
end if;
Check_E1;
Resolve (E1, P_Base_Type);
Check_Enum_Image;
Validate_Non_Static_Attribute_Function_Call;
end Image;
---------
-- Img --
---------
when Attribute_Img => Img :
begin
Set_Etype (N, Standard_String);
if not Is_Scalar_Type (P_Type)
or else (Is_Entity_Name (P) and then Is_Type (Entity (P)))
then
Error_Attr
("prefix of % attribute must be scalar object name", N);
end if;
Check_Enum_Image;
end Img;
-----------
-- Input --
-----------
when Attribute_Input =>
Check_E1;
Check_Stream_Attribute (TSS_Stream_Input);
Set_Etype (N, P_Base_Type);
-------------------
-- Integer_Value --
-------------------
when Attribute_Integer_Value =>
Check_E1;
Check_Integer_Type;
Resolve (E1, Any_Fixed);
Set_Etype (N, P_Base_Type);
-----------
-- Large --
-----------
when Attribute_Large =>
Check_E0;
Check_Real_Type;
Set_Etype (N, Universal_Real);
----------
-- Last --
----------
when Attribute_Last =>
Check_Array_Or_Scalar_Type;
--------------
-- Last_Bit --
--------------
when Attribute_Last_Bit =>
Check_Component;
Set_Etype (N, Universal_Integer);
------------------
-- Leading_Part --
------------------
when Attribute_Leading_Part =>
Check_Floating_Point_Type_2;
Set_Etype (N, P_Base_Type);
Resolve (E1, P_Base_Type);
Resolve (E2, Any_Integer);
------------
-- Length --
------------
when Attribute_Length =>
Check_Array_Type;
Set_Etype (N, Universal_Integer);
-------------
-- Machine --
-------------
when Attribute_Machine =>
Check_Floating_Point_Type_1;
Set_Etype (N, P_Base_Type);
Resolve (E1, P_Base_Type);
------------------
-- Machine_Emax --
------------------
when Attribute_Machine_Emax =>
Check_Floating_Point_Type_0;
Set_Etype (N, Universal_Integer);
------------------
-- Machine_Emin --
------------------
when Attribute_Machine_Emin =>
Check_Floating_Point_Type_0;
Set_Etype (N, Universal_Integer);
----------------------
-- Machine_Mantissa --
----------------------
when Attribute_Machine_Mantissa =>
Check_Floating_Point_Type_0;
Set_Etype (N, Universal_Integer);
-----------------------
-- Machine_Overflows --
-----------------------
when Attribute_Machine_Overflows =>
Check_Real_Type;
Check_E0;
Set_Etype (N, Standard_Boolean);
-------------------
-- Machine_Radix --
-------------------
when Attribute_Machine_Radix =>
Check_Real_Type;
Check_E0;
Set_Etype (N, Universal_Integer);
----------------------
-- Machine_Rounding --
----------------------
when Attribute_Machine_Rounding =>
Check_Floating_Point_Type_1;
Set_Etype (N, P_Base_Type);
Resolve (E1, P_Base_Type);
--------------------
-- Machine_Rounds --
--------------------
when Attribute_Machine_Rounds =>
Check_Real_Type;
Check_E0;
Set_Etype (N, Standard_Boolean);
------------------
-- Machine_Size --
------------------
when Attribute_Machine_Size =>
Check_E0;
Check_Type;
Check_Not_Incomplete_Type;
Set_Etype (N, Universal_Integer);
--------------
-- Mantissa --
--------------
when Attribute_Mantissa =>
Check_E0;
Check_Real_Type;
Set_Etype (N, Universal_Integer);
---------
-- Max --
---------
when Attribute_Max =>
Check_E2;
Check_Scalar_Type;
Resolve (E1, P_Base_Type);
Resolve (E2, P_Base_Type);
Set_Etype (N, P_Base_Type);
----------------------------------
-- Max_Size_In_Storage_Elements --
----------------------------------
when Attribute_Max_Size_In_Storage_Elements =>
Check_E0;
Check_Type;
Check_Not_Incomplete_Type;
Set_Etype (N, Universal_Integer);
-----------------------
-- Maximum_Alignment --
-----------------------
when Attribute_Maximum_Alignment =>
Standard_Attribute (Ttypes.Maximum_Alignment);
--------------------
-- Mechanism_Code --
--------------------
when Attribute_Mechanism_Code =>
if not Is_Entity_Name (P)
or else not Is_Subprogram (Entity (P))
then
Error_Attr ("prefix of % attribute must be subprogram", P);
end if;
Check_Either_E0_Or_E1;
if Present (E1) then
Resolve (E1, Any_Integer);
Set_Etype (E1, Standard_Integer);
if not Is_Static_Expression (E1) then
Flag_Non_Static_Expr
("expression for parameter number must be static!", E1);
Error_Attr;
elsif UI_To_Int (Intval (E1)) > Number_Formals (Entity (P))
or else UI_To_Int (Intval (E1)) < 0
then
Error_Attr ("invalid parameter number for %attribute", E1);
end if;
end if;
Set_Etype (N, Universal_Integer);
---------
-- Min --
---------
when Attribute_Min =>
Check_E2;
Check_Scalar_Type;
Resolve (E1, P_Base_Type);
Resolve (E2, P_Base_Type);
Set_Etype (N, P_Base_Type);
---------
-- Mod --
---------
when Attribute_Mod =>
-- Note: this attribute is only allowed in Ada 2005 mode, but
-- we do not need to test that here, since Mod is only recognized
-- as an attribute name in Ada 2005 mode during the parse.
Check_E1;
Check_Modular_Integer_Type;
Resolve (E1, Any_Integer);
Set_Etype (N, P_Base_Type);
-----------
-- Model --
-----------
when Attribute_Model =>
Check_Floating_Point_Type_1;
Set_Etype (N, P_Base_Type);
Resolve (E1, P_Base_Type);
----------------
-- Model_Emin --
----------------
when Attribute_Model_Emin =>
Check_Floating_Point_Type_0;
Set_Etype (N, Universal_Integer);
-------------------
-- Model_Epsilon --
-------------------
when Attribute_Model_Epsilon =>
Check_Floating_Point_Type_0;
Set_Etype (N, Universal_Real);
--------------------
-- Model_Mantissa --
--------------------
when Attribute_Model_Mantissa =>
Check_Floating_Point_Type_0;
Set_Etype (N, Universal_Integer);
-----------------
-- Model_Small --
-----------------
when Attribute_Model_Small =>
Check_Floating_Point_Type_0;
Set_Etype (N, Universal_Real);
-------------
-- Modulus --
-------------
when Attribute_Modulus =>
Check_E0;
Check_Modular_Integer_Type;
Set_Etype (N, Universal_Integer);
--------------------
-- Null_Parameter --
--------------------
when Attribute_Null_Parameter => Null_Parameter : declare
Parnt : constant Node_Id := Parent (N);
GParnt : constant Node_Id := Parent (Parnt);
procedure Bad_Null_Parameter (Msg : String);
-- Used if bad Null parameter attribute node is found. Issues
-- given error message, and also sets the type to Any_Type to
-- avoid blowups later on from dealing with a junk node.
procedure Must_Be_Imported (Proc_Ent : Entity_Id);
-- Called to check that Proc_Ent is imported subprogram
------------------------
-- Bad_Null_Parameter --
------------------------
procedure Bad_Null_Parameter (Msg : String) is
begin
Error_Msg_N (Msg, N);
Set_Etype (N, Any_Type);
end Bad_Null_Parameter;
----------------------
-- Must_Be_Imported --
----------------------
procedure Must_Be_Imported (Proc_Ent : Entity_Id) is
Pent : Entity_Id := Proc_Ent;
begin
while Present (Alias (Pent)) loop
Pent := Alias (Pent);
end loop;
-- Ignore check if procedure not frozen yet (we will get
-- another chance when the default parameter is reanalyzed)
if not Is_Frozen (Pent) then
return;
elsif not Is_Imported (Pent) then
Bad_Null_Parameter
("Null_Parameter can only be used with imported subprogram");
else
return;
end if;
end Must_Be_Imported;
-- Start of processing for Null_Parameter
begin
Check_Type;
Check_E0;
Set_Etype (N, P_Type);
-- Case of attribute used as default expression
if Nkind (Parnt) = N_Parameter_Specification then
Must_Be_Imported (Defining_Entity (GParnt));
-- Case of attribute used as actual for subprogram (positional)
elsif (Nkind (Parnt) = N_Procedure_Call_Statement
or else
Nkind (Parnt) = N_Function_Call)
and then Is_Entity_Name (Name (Parnt))
then
Must_Be_Imported (Entity (Name (Parnt)));
-- Case of attribute used as actual for subprogram (named)
elsif Nkind (Parnt) = N_Parameter_Association
and then (Nkind (GParnt) = N_Procedure_Call_Statement
or else
Nkind (GParnt) = N_Function_Call)
and then Is_Entity_Name (Name (GParnt))
then
Must_Be_Imported (Entity (Name (GParnt)));
-- Not an allowed case
else
Bad_Null_Parameter
("Null_Parameter must be actual or default parameter");
end if;
end Null_Parameter;
-----------------
-- Object_Size --
-----------------
when Attribute_Object_Size =>
Check_E0;
Check_Type;
Check_Not_Incomplete_Type;
Set_Etype (N, Universal_Integer);
------------
-- Output --
------------
when Attribute_Output =>
Check_E2;
Check_Stream_Attribute (TSS_Stream_Output);
Set_Etype (N, Standard_Void_Type);
Resolve (N, Standard_Void_Type);
------------------
-- Partition_ID --
------------------
when Attribute_Partition_ID =>
Check_E0;
if P_Type /= Any_Type then
if not Is_Library_Level_Entity (Entity (P)) then
Error_Attr
("prefix of % attribute must be library-level entity", P);
-- The defining entity of prefix should not be declared inside
-- a Pure unit. RM E.1(8).
-- The Is_Pure flag has been set during declaration.
elsif Is_Entity_Name (P)
and then Is_Pure (Entity (P))
then
Error_Attr
("prefix of % attribute must not be declared pure", P);
end if;
end if;
Set_Etype (N, Universal_Integer);
-------------------------
-- Passed_By_Reference --
-------------------------
when Attribute_Passed_By_Reference =>
Check_E0;
Check_Type;
Set_Etype (N, Standard_Boolean);
------------------
-- Pool_Address --
------------------
when Attribute_Pool_Address =>
Check_E0;
Set_Etype (N, RTE (RE_Address));
---------
-- Pos --
---------
when Attribute_Pos =>
Check_Discrete_Type;
Check_E1;
Resolve (E1, P_Base_Type);
Set_Etype (N, Universal_Integer);
--------------
-- Position --
--------------
when Attribute_Position =>
Check_Component;
Set_Etype (N, Universal_Integer);
----------
-- Pred --
----------
when Attribute_Pred =>
Check_Scalar_Type;
Check_E1;
Resolve (E1, P_Base_Type);
Set_Etype (N, P_Base_Type);
-- Nothing to do for real type case
if Is_Real_Type (P_Type) then
null;
-- If not modular type, test for overflow check required
else
if not Is_Modular_Integer_Type (P_Type)
and then not Range_Checks_Suppressed (P_Base_Type)
then
Enable_Range_Check (E1);
end if;
end if;
-----------
-- Range --
-----------
when Attribute_Range =>
Check_Array_Or_Scalar_Type;
if Ada_Version = Ada_83
and then Is_Scalar_Type (P_Type)
and then Comes_From_Source (N)
then
Error_Attr
("(Ada 83) % attribute not allowed for scalar type", P);
end if;
------------------
-- Range_Length --
------------------
when Attribute_Range_Length =>
Check_Discrete_Type;
Set_Etype (N, Universal_Integer);
----------
-- Read --
----------
when Attribute_Read =>
Check_E2;
Check_Stream_Attribute (TSS_Stream_Read);
Set_Etype (N, Standard_Void_Type);
Resolve (N, Standard_Void_Type);
Note_Possible_Modification (E2);
---------------
-- Remainder --
---------------
when Attribute_Remainder =>
Check_Floating_Point_Type_2;
Set_Etype (N, P_Base_Type);
Resolve (E1, P_Base_Type);
Resolve (E2, P_Base_Type);
-----------
-- Round --
-----------
when Attribute_Round =>
Check_E1;
Check_Decimal_Fixed_Point_Type;
Set_Etype (N, P_Base_Type);
-- Because the context is universal_real (3.5.10(12)) it is a legal
-- context for a universal fixed expression. This is the only
-- attribute whose functional description involves U_R.
if Etype (E1) = Universal_Fixed then
declare
Conv : constant Node_Id := Make_Type_Conversion (Loc,
Subtype_Mark => New_Occurrence_Of (Universal_Real, Loc),
Expression => Relocate_Node (E1));
begin
Rewrite (E1, Conv);
Analyze (E1);
end;
end if;
Resolve (E1, Any_Real);
--------------
-- Rounding --
--------------
when Attribute_Rounding =>
Check_Floating_Point_Type_1;
Set_Etype (N, P_Base_Type);
Resolve (E1, P_Base_Type);
---------------
-- Safe_Emax --
---------------
when Attribute_Safe_Emax =>
Check_Floating_Point_Type_0;
Set_Etype (N, Universal_Integer);
----------------
-- Safe_First --
----------------
when Attribute_Safe_First =>
Check_Floating_Point_Type_0;
Set_Etype (N, Universal_Real);
----------------
-- Safe_Large --
----------------
when Attribute_Safe_Large =>
Check_E0;
Check_Real_Type;
Set_Etype (N, Universal_Real);
---------------
-- Safe_Last --
---------------
when Attribute_Safe_Last =>
Check_Floating_Point_Type_0;
Set_Etype (N, Universal_Real);
----------------
-- Safe_Small --
----------------
when Attribute_Safe_Small =>
Check_E0;
Check_Real_Type;
Set_Etype (N, Universal_Real);
-----------
-- Scale --
-----------
when Attribute_Scale =>
Check_E0;
Check_Decimal_Fixed_Point_Type;
Set_Etype (N, Universal_Integer);
-------------
-- Scaling --
-------------
when Attribute_Scaling =>
Check_Floating_Point_Type_2;
Set_Etype (N, P_Base_Type);
Resolve (E1, P_Base_Type);
------------------
-- Signed_Zeros --
------------------
when Attribute_Signed_Zeros =>
Check_Floating_Point_Type_0;
Set_Etype (N, Standard_Boolean);
----------
-- Size --
----------
when Attribute_Size | Attribute_VADS_Size =>
Check_E0;
-- If prefix is parameterless function call, rewrite and resolve
-- as such.
if Is_Entity_Name (P)
and then Ekind (Entity (P)) = E_Function
then
Resolve (P);
-- Similar processing for a protected function call
elsif Nkind (P) = N_Selected_Component
and then Ekind (Entity (Selector_Name (P))) = E_Function
then
Resolve (P);
end if;
if Is_Object_Reference (P) then
Check_Object_Reference (P);
elsif Is_Entity_Name (P)
and then (Is_Type (Entity (P))
or else Ekind (Entity (P)) = E_Enumeration_Literal)
then
null;
elsif Nkind (P) = N_Type_Conversion
and then not Comes_From_Source (P)
then
null;
else
Error_Attr ("invalid prefix for % attribute", P);
end if;
Check_Not_Incomplete_Type;
Set_Etype (N, Universal_Integer);
-----------
-- Small --
-----------
when Attribute_Small =>
Check_E0;
Check_Real_Type;
Set_Etype (N, Universal_Real);
------------------
-- Storage_Pool --
------------------
when Attribute_Storage_Pool =>
if Is_Access_Type (P_Type) then
Check_E0;
-- Set appropriate entity
if Present (Associated_Storage_Pool (Root_Type (P_Type))) then
Set_Entity (N, Associated_Storage_Pool (Root_Type (P_Type)));
else
Set_Entity (N, RTE (RE_Global_Pool_Object));
end if;
Set_Etype (N, Class_Wide_Type (RTE (RE_Root_Storage_Pool)));
-- Validate_Remote_Access_To_Class_Wide_Type for attribute
-- Storage_Pool since this attribute is not defined for such
-- types (RM E.2.3(22)).
Validate_Remote_Access_To_Class_Wide_Type (N);
else
Error_Attr ("prefix of % attribute must be access type", P);
end if;
------------------
-- Storage_Size --
------------------
when Attribute_Storage_Size =>
if Is_Task_Type (P_Type) then
Check_E0;
Set_Etype (N, Universal_Integer);
elsif Is_Access_Type (P_Type) then
if Is_Entity_Name (P)
and then Is_Type (Entity (P))
then
Check_E0;
Check_Type;
Set_Etype (N, Universal_Integer);
-- Validate_Remote_Access_To_Class_Wide_Type for attribute
-- Storage_Size since this attribute is not defined for
-- such types (RM E.2.3(22)).
Validate_Remote_Access_To_Class_Wide_Type (N);
-- The prefix is allowed to be an implicit dereference
-- of an access value designating a task.
else
Check_E0;
Check_Task_Prefix;
Set_Etype (N, Universal_Integer);
end if;
else
Error_Attr
("prefix of % attribute must be access or task type", P);
end if;
------------------
-- Storage_Unit --
------------------
when Attribute_Storage_Unit =>
Standard_Attribute (Ttypes.System_Storage_Unit);
-----------------
-- Stream_Size --
-----------------
when Attribute_Stream_Size =>
Check_E0;
Check_Type;
if Is_Entity_Name (P)
and then Is_Elementary_Type (Entity (P))
then
Set_Etype (N, Universal_Integer);
else
Error_Attr ("invalid prefix for % attribute", P);
end if;
----------
-- Succ --
----------
when Attribute_Succ =>
Check_Scalar_Type;
Check_E1;
Resolve (E1, P_Base_Type);
Set_Etype (N, P_Base_Type);
-- Nothing to do for real type case
if Is_Real_Type (P_Type) then
null;
-- If not modular type, test for overflow check required
else
if not Is_Modular_Integer_Type (P_Type)
and then not Range_Checks_Suppressed (P_Base_Type)
then
Enable_Range_Check (E1);
end if;
end if;
---------
-- Tag --
---------
when Attribute_Tag =>
Check_E0;
Check_Dereference;
if not Is_Tagged_Type (P_Type) then
Error_Attr ("prefix of % attribute must be tagged", P);
-- Next test does not apply to generated code
-- why not, and what does the illegal reference mean???
elsif Is_Object_Reference (P)
and then not Is_Class_Wide_Type (P_Type)
and then Comes_From_Source (N)
then
Error_Attr
("% attribute can only be applied to objects of class-wide type",
P);
end if;
Set_Etype (N, RTE (RE_Tag));
-----------------
-- Target_Name --
-----------------
when Attribute_Target_Name => Target_Name : declare
TN : constant String := Sdefault.Target_Name.all;
TL : Natural;
begin
Check_Standard_Prefix;
Check_E0;
TL := TN'Last;
if TN (TL) = '/' or else TN (TL) = '\' then
TL := TL - 1;
end if;
Rewrite (N,
Make_String_Literal (Loc,
Strval => TN (TN'First .. TL)));
Analyze_And_Resolve (N, Standard_String);
end Target_Name;
----------------
-- Terminated --
----------------
when Attribute_Terminated =>
Check_E0;
Set_Etype (N, Standard_Boolean);
Check_Task_Prefix;
----------------
-- To_Address --
----------------
when Attribute_To_Address =>
Check_E1;
Analyze (P);
if Nkind (P) /= N_Identifier
or else Chars (P) /= Name_System
then
Error_Attr ("prefix of %attribute must be System", P);
end if;
Generate_Reference (RTE (RE_Address), P);
Analyze_And_Resolve (E1, Any_Integer);
Set_Etype (N, RTE (RE_Address));
----------------
-- Truncation --
----------------
when Attribute_Truncation =>
Check_Floating_Point_Type_1;
Resolve (E1, P_Base_Type);
Set_Etype (N, P_Base_Type);
----------------
-- Type_Class --
----------------
when Attribute_Type_Class =>
Check_E0;
Check_Type;
Check_Not_Incomplete_Type;
Set_Etype (N, RTE (RE_Type_Class));
-----------------
-- UET_Address --
-----------------
when Attribute_UET_Address =>
Check_E0;
Check_Unit_Name (P);
Set_Etype (N, RTE (RE_Address));
-----------------------
-- Unbiased_Rounding --
-----------------------
when Attribute_Unbiased_Rounding =>
Check_Floating_Point_Type_1;
Set_Etype (N, P_Base_Type);
Resolve (E1, P_Base_Type);
----------------------
-- Unchecked_Access --
----------------------
when Attribute_Unchecked_Access =>
if Comes_From_Source (N) then
Check_Restriction (No_Unchecked_Access, N);
end if;
Analyze_Access_Attribute;
-------------------------
-- Unconstrained_Array --
-------------------------
when Attribute_Unconstrained_Array =>
Check_E0;
Check_Type;
Check_Not_Incomplete_Type;
Set_Etype (N, Standard_Boolean);
------------------------------
-- Universal_Literal_String --
------------------------------
-- This is a GNAT specific attribute whose prefix must be a named
-- number where the expression is either a single numeric literal,
-- or a numeric literal immediately preceded by a minus sign. The
-- result is equivalent to a string literal containing the text of
-- the literal as it appeared in the source program with a possible
-- leading minus sign.
when Attribute_Universal_Literal_String => Universal_Literal_String :
begin
Check_E0;
if not Is_Entity_Name (P)
or else Ekind (Entity (P)) not in Named_Kind
then
Error_Attr ("prefix for % attribute must be named number", P);
else
declare
Expr : Node_Id;
Negative : Boolean;
S : Source_Ptr;
Src : Source_Buffer_Ptr;
begin
Expr := Original_Node (Expression (Parent (Entity (P))));
if Nkind (Expr) = N_Op_Minus then
Negative := True;
Expr := Original_Node (Right_Opnd (Expr));
else
Negative := False;
end if;
if Nkind (Expr) /= N_Integer_Literal
and then Nkind (Expr) /= N_Real_Literal
then
Error_Attr
("named number for % attribute must be simple literal", N);
end if;
-- Build string literal corresponding to source literal text
Start_String;
if Negative then
Store_String_Char (Get_Char_Code ('-'));
end if;
S := Sloc (Expr);
Src := Source_Text (Get_Source_File_Index (S));
while Src (S) /= ';' and then Src (S) /= ' ' loop
Store_String_Char (Get_Char_Code (Src (S)));
S := S + 1;
end loop;
-- Now we rewrite the attribute with the string literal
Rewrite (N,
Make_String_Literal (Loc, End_String));
Analyze (N);
end;
end if;
end Universal_Literal_String;
-------------------------
-- Unrestricted_Access --
-------------------------
-- This is a GNAT specific attribute which is like Access except that
-- all scope checks and checks for aliased views are omitted.
when Attribute_Unrestricted_Access =>
if Comes_From_Source (N) then
Check_Restriction (No_Unchecked_Access, N);
end if;
if Is_Entity_Name (P) then
Set_Address_Taken (Entity (P));
end if;
Analyze_Access_Attribute;
---------
-- Val --
---------
when Attribute_Val => Val : declare
begin
Check_E1;
Check_Discrete_Type;
Resolve (E1, Any_Integer);
Set_Etype (N, P_Base_Type);
-- Note, we need a range check in general, but we wait for the
-- Resolve call to do this, since we want to let Eval_Attribute
-- have a chance to find an static illegality first!
end Val;
-----------
-- Valid --
-----------
when Attribute_Valid =>
Check_E0;
-- Ignore check for object if we have a 'Valid reference generated
-- by the expanded code, since in some cases valid checks can occur
-- on items that are names, but are not objects (e.g. attributes).
if Comes_From_Source (N) then
Check_Object_Reference (P);
end if;
if not Is_Scalar_Type (P_Type) then
Error_Attr ("object for % attribute must be of scalar type", P);
end if;
Set_Etype (N, Standard_Boolean);
-----------
-- Value --
-----------
when Attribute_Value => Value :
begin
Check_E1;
Check_Scalar_Type;
if Is_Enumeration_Type (P_Type) then
Check_Restriction (No_Enumeration_Maps, N);
end if;
-- Set Etype before resolving expression because expansion of
-- expression may require enclosing type. Note that the type
-- returned by 'Value is the base type of the prefix type.
Set_Etype (N, P_Base_Type);
Validate_Non_Static_Attribute_Function_Call;
end Value;
----------------
-- Value_Size --
----------------
when Attribute_Value_Size =>
Check_E0;
Check_Type;
Check_Not_Incomplete_Type;
Set_Etype (N, Universal_Integer);
-------------
-- Version --
-------------
when Attribute_Version =>
Check_E0;
Check_Program_Unit;
Set_Etype (N, RTE (RE_Version_String));
------------------
-- Wchar_T_Size --
------------------
when Attribute_Wchar_T_Size =>
Standard_Attribute (Interfaces_Wchar_T_Size);
----------------
-- Wide_Image --
----------------
when Attribute_Wide_Image => Wide_Image :
begin
Check_Scalar_Type;
Set_Etype (N, Standard_Wide_String);
Check_E1;
Resolve (E1, P_Base_Type);
Validate_Non_Static_Attribute_Function_Call;
end Wide_Image;
---------------------
-- Wide_Wide_Image --
---------------------
when Attribute_Wide_Wide_Image => Wide_Wide_Image :
begin
Check_Scalar_Type;
Set_Etype (N, Standard_Wide_Wide_String);
Check_E1;
Resolve (E1, P_Base_Type);
Validate_Non_Static_Attribute_Function_Call;
end Wide_Wide_Image;
----------------
-- Wide_Value --
----------------
when Attribute_Wide_Value => Wide_Value :
begin
Check_E1;
Check_Scalar_Type;
-- Set Etype before resolving expression because expansion
-- of expression may require enclosing type.
Set_Etype (N, P_Type);
Validate_Non_Static_Attribute_Function_Call;
end Wide_Value;
---------------------
-- Wide_Wide_Value --
---------------------
when Attribute_Wide_Wide_Value => Wide_Wide_Value :
begin
Check_E1;
Check_Scalar_Type;
-- Set Etype before resolving expression because expansion
-- of expression may require enclosing type.
Set_Etype (N, P_Type);
Validate_Non_Static_Attribute_Function_Call;
end Wide_Wide_Value;
---------------------
-- Wide_Wide_Width --
---------------------
when Attribute_Wide_Wide_Width =>
Check_E0;
Check_Scalar_Type;
Set_Etype (N, Universal_Integer);
----------------
-- Wide_Width --
----------------
when Attribute_Wide_Width =>
Check_E0;
Check_Scalar_Type;
Set_Etype (N, Universal_Integer);
-----------
-- Width --
-----------
when Attribute_Width =>
Check_E0;
Check_Scalar_Type;
Set_Etype (N, Universal_Integer);
---------------
-- Word_Size --
---------------
when Attribute_Word_Size =>
Standard_Attribute (System_Word_Size);
-----------
-- Write --
-----------
when Attribute_Write =>
Check_E2;
Check_Stream_Attribute (TSS_Stream_Write);
Set_Etype (N, Standard_Void_Type);
Resolve (N, Standard_Void_Type);
end case;
-- All errors raise Bad_Attribute, so that we get out before any further
-- damage occurs when an error is detected (for example, if we check for
-- one attribute expression, and the check succeeds, we want to be able
-- to proceed securely assuming that an expression is in fact present.
-- Note: we set the attribute analyzed in this case to prevent any
-- attempt at reanalysis which could generate spurious error msgs.
exception
when Bad_Attribute =>
Set_Analyzed (N);
Set_Etype (N, Any_Type);
return;
end Analyze_Attribute;
--------------------
-- Eval_Attribute --
--------------------
procedure Eval_Attribute (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Aname : constant Name_Id := Attribute_Name (N);
Id : constant Attribute_Id := Get_Attribute_Id (Aname);
P : constant Node_Id := Prefix (N);
C_Type : constant Entity_Id := Etype (N);
-- The type imposed by the context
E1 : Node_Id;
-- First expression, or Empty if none
E2 : Node_Id;
-- Second expression, or Empty if none
P_Entity : Entity_Id;
-- Entity denoted by prefix
P_Type : Entity_Id;
-- The type of the prefix
P_Base_Type : Entity_Id;
-- The base type of the prefix type
P_Root_Type : Entity_Id;
-- The root type of the prefix type
Static : Boolean;
-- True if the result is Static. This is set by the general processing
-- to true if the prefix is static, and all expressions are static. It
-- can be reset as processing continues for particular attributes
Lo_Bound, Hi_Bound : Node_Id;
-- Expressions for low and high bounds of type or array index referenced
-- by First, Last, or Length attribute for array, set by Set_Bounds.
CE_Node : Node_Id;
-- Constraint error node used if we have an attribute reference has
-- an argument that raises a constraint error. In this case we replace
-- the attribute with a raise constraint_error node. This is important
-- processing, since otherwise gigi might see an attribute which it is
-- unprepared to deal with.
function Aft_Value return Nat;
-- Computes Aft value for current attribute prefix (used by Aft itself
-- and also by Width for computing the Width of a fixed point type).
procedure Check_Expressions;
-- In case where the attribute is not foldable, the expressions, if
-- any, of the attribute, are in a non-static context. This procedure
-- performs the required additional checks.
function Compile_Time_Known_Bounds (Typ : Entity_Id) return Boolean;
-- Determines if the given type has compile time known bounds. Note
-- that we enter the case statement even in cases where the prefix
-- type does NOT have known bounds, so it is important to guard any
-- attempt to evaluate both bounds with a call to this function.
procedure Compile_Time_Known_Attribute (N : Node_Id; Val : Uint);
-- This procedure is called when the attribute N has a non-static
-- but compile time known value given by Val. It includes the
-- necessary checks for out of range values.
procedure Float_Attribute_Universal_Integer
(IEEES_Val : Int;
IEEEL_Val : Int;
IEEEX_Val : Int;
VAXFF_Val : Int;
VAXDF_Val : Int;
VAXGF_Val : Int;
AAMPS_Val : Int;
AAMPL_Val : Int);
-- This procedure evaluates a float attribute with no arguments that
-- returns a universal integer result. The parameters give the values
-- for the possible floating-point root types. See ttypef for details.
-- The prefix type is a float type (and is thus not a generic type).
procedure Float_Attribute_Universal_Real
(IEEES_Val : String;
IEEEL_Val : String;
IEEEX_Val : String;
VAXFF_Val : String;
VAXDF_Val : String;
VAXGF_Val : String;
AAMPS_Val : String;
AAMPL_Val : String);
-- This procedure evaluates a float attribute with no arguments that
-- returns a universal real result. The parameters give the values
-- required for the possible floating-point root types in string
-- format as real literals with a possible leading minus sign.
-- The prefix type is a float type (and is thus not a generic type).
function Fore_Value return Nat;
-- Computes the Fore value for the current attribute prefix, which is
-- known to be a static fixed-point type. Used by Fore and Width.
function Mantissa return Uint;
-- Returns the Mantissa value for the prefix type
procedure Set_Bounds;
-- Used for First, Last and Length attributes applied to an array or
-- array subtype. Sets the variables Lo_Bound and Hi_Bound to the low
-- and high bound expressions for the index referenced by the attribute
-- designator (i.e. the first index if no expression is present, and
-- the N'th index if the value N is present as an expression). Also
-- used for First and Last of scalar types. Static is reset to False
-- if the type or index type is not statically constrained.
function Statically_Denotes_Entity (N : Node_Id) return Boolean;
-- Verify that the prefix of a potentially static array attribute
-- satisfies the conditions of 4.9 (14).
---------------
-- Aft_Value --
---------------
function Aft_Value return Nat is
Result : Nat;
Delta_Val : Ureal;
begin
Result := 1;
Delta_Val := Delta_Value (P_Type);
while Delta_Val < Ureal_Tenth loop
Delta_Val := Delta_Val * Ureal_10;
Result := Result + 1;
end loop;
return Result;
end Aft_Value;
-----------------------
-- Check_Expressions --
-----------------------
procedure Check_Expressions is
E : Node_Id := E1;
begin
while Present (E) loop
Check_Non_Static_Context (E);
Next (E);
end loop;
end Check_Expressions;
----------------------------------
-- Compile_Time_Known_Attribute --
----------------------------------
procedure Compile_Time_Known_Attribute (N : Node_Id; Val : Uint) is
T : constant Entity_Id := Etype (N);
begin
Fold_Uint (N, Val, False);
-- Check that result is in bounds of the type if it is static
if Is_In_Range (N, T) then
null;
elsif Is_Out_Of_Range (N, T) then
Apply_Compile_Time_Constraint_Error
(N, "value not in range of}?", CE_Range_Check_Failed);
elsif not Range_Checks_Suppressed (T) then
Enable_Range_Check (N);
else
Set_Do_Range_Check (N, False);
end if;
end Compile_Time_Known_Attribute;
-------------------------------
-- Compile_Time_Known_Bounds --
-------------------------------
function Compile_Time_Known_Bounds (Typ : Entity_Id) return Boolean is
begin
return
Compile_Time_Known_Value (Type_Low_Bound (Typ))
and then
Compile_Time_Known_Value (Type_High_Bound (Typ));
end Compile_Time_Known_Bounds;
---------------------------------------
-- Float_Attribute_Universal_Integer --
---------------------------------------
procedure Float_Attribute_Universal_Integer
(IEEES_Val : Int;
IEEEL_Val : Int;
IEEEX_Val : Int;
VAXFF_Val : Int;
VAXDF_Val : Int;
VAXGF_Val : Int;
AAMPS_Val : Int;
AAMPL_Val : Int)
is
Val : Int;
Digs : constant Nat := UI_To_Int (Digits_Value (P_Base_Type));
begin
if Vax_Float (P_Base_Type) then
if Digs = VAXFF_Digits then
Val := VAXFF_Val;
elsif Digs = VAXDF_Digits then
Val := VAXDF_Val;
else pragma Assert (Digs = VAXGF_Digits);
Val := VAXGF_Val;
end if;
elsif Is_AAMP_Float (P_Base_Type) then
if Digs = AAMPS_Digits then
Val := AAMPS_Val;
else pragma Assert (Digs = AAMPL_Digits);
Val := AAMPL_Val;
end if;
else
if Digs = IEEES_Digits then
Val := IEEES_Val;
elsif Digs = IEEEL_Digits then
Val := IEEEL_Val;
else pragma Assert (Digs = IEEEX_Digits);
Val := IEEEX_Val;
end if;
end if;
Fold_Uint (N, UI_From_Int (Val), True);
end Float_Attribute_Universal_Integer;
------------------------------------
-- Float_Attribute_Universal_Real --
------------------------------------
procedure Float_Attribute_Universal_Real
(IEEES_Val : String;
IEEEL_Val : String;
IEEEX_Val : String;
VAXFF_Val : String;
VAXDF_Val : String;
VAXGF_Val : String;
AAMPS_Val : String;
AAMPL_Val : String)
is
Val : Node_Id;
Digs : constant Nat := UI_To_Int (Digits_Value (P_Base_Type));
begin
if Vax_Float (P_Base_Type) then
if Digs = VAXFF_Digits then
Val := Real_Convert (VAXFF_Val);
elsif Digs = VAXDF_Digits then
Val := Real_Convert (VAXDF_Val);
else pragma Assert (Digs = VAXGF_Digits);
Val := Real_Convert (VAXGF_Val);
end if;
elsif Is_AAMP_Float (P_Base_Type) then
if Digs = AAMPS_Digits then
Val := Real_Convert (AAMPS_Val);
else pragma Assert (Digs = AAMPL_Digits);
Val := Real_Convert (AAMPL_Val);
end if;
else
if Digs = IEEES_Digits then
Val := Real_Convert (IEEES_Val);
elsif Digs = IEEEL_Digits then
Val := Real_Convert (IEEEL_Val);
else pragma Assert (Digs = IEEEX_Digits);
Val := Real_Convert (IEEEX_Val);
end if;
end if;
Set_Sloc (Val, Loc);
Rewrite (N, Val);
Set_Is_Static_Expression (N, Static);
Analyze_And_Resolve (N, C_Type);
end Float_Attribute_Universal_Real;
----------------
-- Fore_Value --
----------------
-- Note that the Fore calculation is based on the actual values
-- of the bounds, and does not take into account possible rounding.
function Fore_Value return Nat is
Lo : constant Uint := Expr_Value (Type_Low_Bound (P_Type));
Hi : constant Uint := Expr_Value (Type_High_Bound (P_Type));
Small : constant Ureal := Small_Value (P_Type);
Lo_Real : constant Ureal := Lo * Small;
Hi_Real : constant Ureal := Hi * Small;
T : Ureal;
R : Nat;
begin
-- Bounds are given in terms of small units, so first compute
-- proper values as reals.
T := UR_Max (abs Lo_Real, abs Hi_Real);
R := 2;
-- Loop to compute proper value if more than one digit required
while T >= Ureal_10 loop
R := R + 1;
T := T / Ureal_10;
end loop;
return R;
end Fore_Value;
--------------
-- Mantissa --
--------------
-- Table of mantissa values accessed by function Computed using
-- the relation:
-- T'Mantissa = integer next above (D * log(10)/log(2)) + 1)
-- where D is T'Digits (RM83 3.5.7)
Mantissa_Value : constant array (Nat range 1 .. 40) of Nat := (
1 => 5,
2 => 8,
3 => 11,
4 => 15,
5 => 18,
6 => 21,
7 => 25,
8 => 28,
9 => 31,
10 => 35,
11 => 38,
12 => 41,
13 => 45,
14 => 48,
15 => 51,
16 => 55,
17 => 58,
18 => 61,
19 => 65,
20 => 68,
21 => 71,
22 => 75,
23 => 78,
24 => 81,
25 => 85,
26 => 88,
27 => 91,
28 => 95,
29 => 98,
30 => 101,
31 => 104,
32 => 108,
33 => 111,
34 => 114,
35 => 118,
36 => 121,
37 => 124,
38 => 128,
39 => 131,
40 => 134);
function Mantissa return Uint is
begin
return
UI_From_Int (Mantissa_Value (UI_To_Int (Digits_Value (P_Type))));
end Mantissa;
----------------
-- Set_Bounds --
----------------
procedure Set_Bounds is
Ndim : Nat;
Indx : Node_Id;
Ityp : Entity_Id;
begin
-- For a string literal subtype, we have to construct the bounds.
-- Valid Ada code never applies attributes to string literals, but
-- it is convenient to allow the expander to generate attribute
-- references of this type (e.g. First and Last applied to a string
-- literal).
-- Note that the whole point of the E_String_Literal_Subtype is to
-- avoid this construction of bounds, but the cases in which we
-- have to materialize them are rare enough that we don't worry!
-- The low bound is simply the low bound of the base type. The
-- high bound is computed from the length of the string and this
-- low bound.
if Ekind (P_Type) = E_String_Literal_Subtype then
Ityp := Etype (First_Index (Base_Type (P_Type)));
Lo_Bound := Type_Low_Bound (Ityp);
Hi_Bound :=
Make_Integer_Literal (Sloc (P),
Intval =>
Expr_Value (Lo_Bound) + String_Literal_Length (P_Type) - 1);
Set_Parent (Hi_Bound, P);
Analyze_And_Resolve (Hi_Bound, Etype (Lo_Bound));
return;
-- For non-array case, just get bounds of scalar type
elsif Is_Scalar_Type (P_Type) then
Ityp := P_Type;
-- For a fixed-point type, we must freeze to get the attributes
-- of the fixed-point type set now so we can reference them.
if Is_Fixed_Point_Type (P_Type)
and then not Is_Frozen (Base_Type (P_Type))
and then Compile_Time_Known_Value (Type_Low_Bound (P_Type))
and then Compile_Time_Known_Value (Type_High_Bound (P_Type))
then
Freeze_Fixed_Point_Type (Base_Type (P_Type));
end if;
-- For array case, get type of proper index
else
if No (E1) then
Ndim := 1;
else
Ndim := UI_To_Int (Expr_Value (E1));
end if;
Indx := First_Index (P_Type);
for J in 1 .. Ndim - 1 loop
Next_Index (Indx);
end loop;
-- If no index type, get out (some other error occurred, and
-- we don't have enough information to complete the job!)
if No (Indx) then
Lo_Bound := Error;
Hi_Bound := Error;
return;
end if;
Ityp := Etype (Indx);
end if;
-- A discrete range in an index constraint is allowed to be a
-- subtype indication. This is syntactically a pain, but should
-- not propagate to the entity for the corresponding index subtype.
-- After checking that the subtype indication is legal, the range
-- of the subtype indication should be transfered to the entity.
-- The attributes for the bounds should remain the simple retrievals
-- that they are now.
Lo_Bound := Type_Low_Bound (Ityp);
Hi_Bound := Type_High_Bound (Ityp);
if not Is_Static_Subtype (Ityp) then
Static := False;
end if;
end Set_Bounds;
-------------------------------
-- Statically_Denotes_Entity --
-------------------------------
function Statically_Denotes_Entity (N : Node_Id) return Boolean is
E : Entity_Id;
begin
if not Is_Entity_Name (N) then
return False;
else
E := Entity (N);
end if;
return
Nkind (Parent (E)) /= N_Object_Renaming_Declaration
or else Statically_Denotes_Entity (Renamed_Object (E));
end Statically_Denotes_Entity;
-- Start of processing for Eval_Attribute
begin
-- Acquire first two expressions (at the moment, no attributes
-- take more than two expressions in any case).
if Present (Expressions (N)) then
E1 := First (Expressions (N));
E2 := Next (E1);
else
E1 := Empty;
E2 := Empty;
end if;
-- Special processing for cases where the prefix is an object. For
-- this purpose, a string literal counts as an object (attributes
-- of string literals can only appear in generated code).
if Is_Object_Reference (P) or else Nkind (P) = N_String_Literal then
-- For Component_Size, the prefix is an array object, and we apply
-- the attribute to the type of the object. This is allowed for
-- both unconstrained and constrained arrays, since the bounds
-- have no influence on the value of this attribute.
if Id = Attribute_Component_Size then
P_Entity := Etype (P);
-- For First and Last, the prefix is an array object, and we apply
-- the attribute to the type of the array, but we need a constrained
-- type for this, so we use the actual subtype if available.
elsif Id = Attribute_First
or else
Id = Attribute_Last
or else
Id = Attribute_Length
then
declare
AS : constant Entity_Id := Get_Actual_Subtype_If_Available (P);
begin
if Present (AS) and then Is_Constrained (AS) then
P_Entity := AS;
-- If we have an unconstrained type, cannot fold
else
Check_Expressions;
return;
end if;
end;
-- For Size, give size of object if available, otherwise we
-- cannot fold Size.
elsif Id = Attribute_Size then
if Is_Entity_Name (P)
and then Known_Esize (Entity (P))
then
Compile_Time_Known_Attribute (N, Esize (Entity (P)));
return;
else
Check_Expressions;
return;
end if;
-- For Alignment, give size of object if available, otherwise we
-- cannot fold Alignment.
elsif Id = Attribute_Alignment then
if Is_Entity_Name (P)
and then Known_Alignment (Entity (P))
then
Fold_Uint (N, Alignment (Entity (P)), False);
return;
else
Check_Expressions;
return;
end if;
-- No other attributes for objects are folded
else
Check_Expressions;
return;
end if;
-- Cases where P is not an object. Cannot do anything if P is
-- not the name of an entity.
elsif not Is_Entity_Name (P) then
Check_Expressions;
return;
-- Otherwise get prefix entity
else
P_Entity := Entity (P);
end if;
-- At this stage P_Entity is the entity to which the attribute
-- is to be applied. This is usually simply the entity of the
-- prefix, except in some cases of attributes for objects, where
-- as described above, we apply the attribute to the object type.
-- First foldable possibility is a scalar or array type (RM 4.9(7))
-- that is not generic (generic types are eliminated by RM 4.9(25)).
-- Note we allow non-static non-generic types at this stage as further
-- described below.
if Is_Type (P_Entity)
and then (Is_Scalar_Type (P_Entity) or Is_Array_Type (P_Entity))
and then (not Is_Generic_Type (P_Entity))
then
P_Type := P_Entity;
-- Second foldable possibility is an array object (RM 4.9(8))
elsif (Ekind (P_Entity) = E_Variable
or else
Ekind (P_Entity) = E_Constant)
and then Is_Array_Type (Etype (P_Entity))
and then (not Is_Generic_Type (Etype (P_Entity)))
then
P_Type := Etype (P_Entity);
-- If the entity is an array constant with an unconstrained nominal
-- subtype then get the type from the initial value. If the value has
-- been expanded into assignments, there is no expression and the
-- attribute reference remains dynamic.
-- We could do better here and retrieve the type ???
if Ekind (P_Entity) = E_Constant
and then not Is_Constrained (P_Type)
then
if No (Constant_Value (P_Entity)) then
return;
else
P_Type := Etype (Constant_Value (P_Entity));
end if;
end if;
-- Definite must be folded if the prefix is not a generic type,
-- that is to say if we are within an instantiation. Same processing
-- applies to the GNAT attributes Has_Discriminants, Type_Class,
-- and Unconstrained_Array.
elsif (Id = Attribute_Definite
or else
Id = Attribute_Has_Access_Values
or else
Id = Attribute_Has_Discriminants
or else
Id = Attribute_Type_Class
or else
Id = Attribute_Unconstrained_Array)
and then not Is_Generic_Type (P_Entity)
then
P_Type := P_Entity;
-- We can fold 'Size applied to a type if the size is known
-- (as happens for a size from an attribute definition clause).
-- At this stage, this can happen only for types (e.g. record
-- types) for which the size is always non-static. We exclude
-- generic types from consideration (since they have bogus
-- sizes set within templates).
elsif Id = Attribute_Size
and then Is_Type (P_Entity)
and then (not Is_Generic_Type (P_Entity))
and then Known_Static_RM_Size (P_Entity)
then
Compile_Time_Known_Attribute (N, RM_Size (P_Entity));
return;
-- We can fold 'Alignment applied to a type if the alignment is known
-- (as happens for an alignment from an attribute definition clause).
-- At this stage, this can happen only for types (e.g. record
-- types) for which the size is always non-static. We exclude
-- generic types from consideration (since they have bogus
-- sizes set within templates).
elsif Id = Attribute_Alignment
and then Is_Type (P_Entity)
and then (not Is_Generic_Type (P_Entity))
and then Known_Alignment (P_Entity)
then
Compile_Time_Known_Attribute (N, Alignment (P_Entity));
return;
-- If this is an access attribute that is known to fail accessibility
-- check, rewrite accordingly.
elsif Attribute_Name (N) = Name_Access
and then Raises_Constraint_Error (N)
then
Rewrite (N,
Make_Raise_Program_Error (Loc,
Reason => PE_Accessibility_Check_Failed));
Set_Etype (N, C_Type);
return;
-- No other cases are foldable (they certainly aren't static, and at
-- the moment we don't try to fold any cases other than these three).
else
Check_Expressions;
return;
end if;
-- If either attribute or the prefix is Any_Type, then propagate
-- Any_Type to the result and don't do anything else at all.
if P_Type = Any_Type
or else (Present (E1) and then Etype (E1) = Any_Type)
or else (Present (E2) and then Etype (E2) = Any_Type)
then
Set_Etype (N, Any_Type);
return;
end if;
-- Scalar subtype case. We have not yet enforced the static requirement
-- of (RM 4.9(7)) and we don't intend to just yet, since there are cases
-- of non-static attribute references (e.g. S'Digits for a non-static
-- floating-point type, which we can compute at compile time).
-- Note: this folding of non-static attributes is not simply a case of
-- optimization. For many of the attributes affected, Gigi cannot handle
-- the attribute and depends on the front end having folded them away.
-- Note: although we don't require staticness at this stage, we do set
-- the Static variable to record the staticness, for easy reference by
-- those attributes where it matters (e.g. Succ and Pred), and also to
-- be used to ensure that non-static folded things are not marked as
-- being static (a check that is done right at the end).
P_Root_Type := Root_Type (P_Type);
P_Base_Type := Base_Type (P_Type);
-- If the root type or base type is generic, then we cannot fold. This
-- test is needed because subtypes of generic types are not always
-- marked as being generic themselves (which seems odd???)
if Is_Generic_Type (P_Root_Type)
or else Is_Generic_Type (P_Base_Type)
then
return;
end if;
if Is_Scalar_Type (P_Type) then
Static := Is_OK_Static_Subtype (P_Type);
-- Array case. We enforce the constrained requirement of (RM 4.9(7-8))
-- since we can't do anything with unconstrained arrays. In addition,
-- only the First, Last and Length attributes are possibly static.
-- Definite, Has_Access_Values, Has_Discriminants, Type_Class, and
-- Unconstrained_Array are again exceptions, because they apply as
-- well to unconstrained types.
-- In addition Component_Size is an exception since it is possibly
-- foldable, even though it is never static, and it does apply to
-- unconstrained arrays. Furthermore, it is essential to fold this
-- in the packed case, since otherwise the value will be incorrect.
elsif Id = Attribute_Definite
or else
Id = Attribute_Has_Access_Values
or else
Id = Attribute_Has_Discriminants
or else
Id = Attribute_Type_Class
or else
Id = Attribute_Unconstrained_Array
or else
Id = Attribute_Component_Size
then
Static := False;
else
if not Is_Constrained (P_Type)
or else (Id /= Attribute_First and then
Id /= Attribute_Last and then
Id /= Attribute_Length)
then
Check_Expressions;
return;
end if;
-- The rules in (RM 4.9(7,8)) require a static array, but as in the
-- scalar case, we hold off on enforcing staticness, since there are
-- cases which we can fold at compile time even though they are not
-- static (e.g. 'Length applied to a static index, even though other
-- non-static indexes make the array type non-static). This is only
-- an optimization, but it falls out essentially free, so why not.
-- Again we compute the variable Static for easy reference later
-- (note that no array attributes are static in Ada 83).
Static := Ada_Version >= Ada_95
and then Statically_Denotes_Entity (P);
declare
N : Node_Id;
begin
N := First_Index (P_Type);
while Present (N) loop
Static := Static and then Is_Static_Subtype (Etype (N));
-- If however the index type is generic, attributes cannot
-- be folded.
if Is_Generic_Type (Etype (N))
and then Id /= Attribute_Component_Size
then
return;
end if;
Next_Index (N);
end loop;
end;
end if;
-- Check any expressions that are present. Note that these expressions,
-- depending on the particular attribute type, are either part of the
-- attribute designator, or they are arguments in a case where the
-- attribute reference returns a function. In the latter case, the
-- rule in (RM 4.9(22)) applies and in particular requires the type
-- of the expressions to be scalar in order for the attribute to be
-- considered to be static.
declare
E : Node_Id;
begin
E := E1;
while Present (E) loop
-- If expression is not static, then the attribute reference
-- result certainly cannot be static.
if not Is_Static_Expression (E) then
Static := False;
end if;
-- If the result is not known at compile time, or is not of
-- a scalar type, then the result is definitely not static,
-- so we can quit now.
if not Compile_Time_Known_Value (E)
or else not Is_Scalar_Type (Etype (E))
then
-- An odd special case, if this is a Pos attribute, this
-- is where we need to apply a range check since it does
-- not get done anywhere else.
if Id = Attribute_Pos then
if Is_Integer_Type (Etype (E)) then
Apply_Range_Check (E, Etype (N));
end if;
end if;
Check_Expressions;
return;
-- If the expression raises a constraint error, then so does
-- the attribute reference. We keep going in this case because
-- we are still interested in whether the attribute reference
-- is static even if it is not static.
elsif Raises_Constraint_Error (E) then
Set_Raises_Constraint_Error (N);
end if;
Next (E);
end loop;
if Raises_Constraint_Error (Prefix (N)) then
return;
end if;
end;
-- Deal with the case of a static attribute reference that raises
-- constraint error. The Raises_Constraint_Error flag will already
-- have been set, and the Static flag shows whether the attribute
-- reference is static. In any case we certainly can't fold such an
-- attribute reference.
-- Note that the rewriting of the attribute node with the constraint
-- error node is essential in this case, because otherwise Gigi might
-- blow up on one of the attributes it never expects to see.
-- The constraint_error node must have the type imposed by the context,
-- to avoid spurious errors in the enclosing expression.
if Raises_Constraint_Error (N) then
CE_Node :=
Make_Raise_Constraint_Error (Sloc (N),
Reason => CE_Range_Check_Failed);
Set_Etype (CE_Node, Etype (N));
Set_Raises_Constraint_Error (CE_Node);
Check_Expressions;
Rewrite (N, Relocate_Node (CE_Node));
Set_Is_Static_Expression (N, Static);
return;
end if;
-- At this point we have a potentially foldable attribute reference.
-- If Static is set, then the attribute reference definitely obeys
-- the requirements in (RM 4.9(7,8,22)), and it definitely can be
-- folded. If Static is not set, then the attribute may or may not
-- be foldable, and the individual attribute processing routines
-- test Static as required in cases where it makes a difference.
-- In the case where Static is not set, we do know that all the
-- expressions present are at least known at compile time (we
-- assumed above that if this was not the case, then there was
-- no hope of static evaluation). However, we did not require
-- that the bounds of the prefix type be compile time known,
-- let alone static). That's because there are many attributes
-- that can be computed at compile time on non-static subtypes,
-- even though such references are not static expressions.
case Id is
--------------
-- Adjacent --
--------------
when Attribute_Adjacent =>
Fold_Ureal (N,
Eval_Fat.Adjacent
(P_Root_Type, Expr_Value_R (E1), Expr_Value_R (E2)), Static);
---------
-- Aft --
---------
when Attribute_Aft =>
Fold_Uint (N, UI_From_Int (Aft_Value), True);
---------------
-- Alignment --
---------------
when Attribute_Alignment => Alignment_Block : declare
P_TypeA : constant Entity_Id := Underlying_Type (P_Type);
begin
-- Fold if alignment is set and not otherwise
if Known_Alignment (P_TypeA) then
Fold_Uint (N, Alignment (P_TypeA), Is_Discrete_Type (P_TypeA));
end if;
end Alignment_Block;
---------------
-- AST_Entry --
---------------
-- Can only be folded in No_Ast_Handler case
when Attribute_AST_Entry =>
if not Is_AST_Entry (P_Entity) then
Rewrite (N,
New_Occurrence_Of (RTE (RE_No_AST_Handler), Loc));
else
null;
end if;
---------
-- Bit --
---------
-- Bit can never be folded
when Attribute_Bit =>
null;
------------------
-- Body_Version --
------------------
-- Body_version can never be static
when Attribute_Body_Version =>
null;
-------------
-- Ceiling --
-------------
when Attribute_Ceiling =>
Fold_Ureal (N,
Eval_Fat.Ceiling (P_Root_Type, Expr_Value_R (E1)), Static);
--------------------
-- Component_Size --
--------------------
when Attribute_Component_Size =>
if Known_Static_Component_Size (P_Type) then
Fold_Uint (N, Component_Size (P_Type), False);
end if;
-------------
-- Compose --
-------------
when Attribute_Compose =>
Fold_Ureal (N,
Eval_Fat.Compose
(P_Root_Type, Expr_Value_R (E1), Expr_Value (E2)),
Static);
-----------------
-- Constrained --
-----------------
-- Constrained is never folded for now, there may be cases that
-- could be handled at compile time. to be looked at later.
when Attribute_Constrained =>
null;
---------------
-- Copy_Sign --
---------------
when Attribute_Copy_Sign =>
Fold_Ureal (N,
Eval_Fat.Copy_Sign
(P_Root_Type, Expr_Value_R (E1), Expr_Value_R (E2)), Static);
-----------
-- Delta --
-----------
when Attribute_Delta =>
Fold_Ureal (N, Delta_Value (P_Type), True);
--------------
-- Definite --
--------------
when Attribute_Definite =>
Rewrite (N, New_Occurrence_Of (
Boolean_Literals (not Is_Indefinite_Subtype (P_Entity)), Loc));
Analyze_And_Resolve (N, Standard_Boolean);
------------
-- Denorm --
------------
when Attribute_Denorm =>
Fold_Uint
(N, UI_From_Int (Boolean'Pos (Denorm_On_Target)), True);
------------
-- Digits --
------------
when Attribute_Digits =>
Fold_Uint (N, Digits_Value (P_Type), True);
----------
-- Emax --
----------
when Attribute_Emax =>
-- Ada 83 attribute is defined as (RM83 3.5.8)
-- T'Emax = 4 * T'Mantissa
Fold_Uint (N, 4 * Mantissa, True);
--------------
-- Enum_Rep --
--------------
when Attribute_Enum_Rep =>
-- For an enumeration type with a non-standard representation use
-- the Enumeration_Rep field of the proper constant. Note that this
-- will not work for types Character/Wide_[Wide-]Character, since no
-- real entities are created for the enumeration literals, but that
-- does not matter since these two types do not have non-standard
-- representations anyway.
if Is_Enumeration_Type (P_Type)
and then Has_Non_Standard_Rep (P_Type)
then
Fold_Uint (N, Enumeration_Rep (Expr_Value_E (E1)), Static);
-- For enumeration types with standard representations and all
-- other cases (i.e. all integer and modular types), Enum_Rep
-- is equivalent to Pos.
else
Fold_Uint (N, Expr_Value (E1), Static);
end if;
-------------
-- Epsilon --
-------------
when Attribute_Epsilon =>
-- Ada 83 attribute is defined as (RM83 3.5.8)
-- T'Epsilon = 2.0**(1 - T'Mantissa)
Fold_Ureal (N, Ureal_2 ** (1 - Mantissa), True);
--------------
-- Exponent --
--------------
when Attribute_Exponent =>
Fold_Uint (N,
Eval_Fat.Exponent (P_Root_Type, Expr_Value_R (E1)), Static);
-----------
-- First --
-----------
when Attribute_First => First_Attr :
begin
Set_Bounds;
if Compile_Time_Known_Value (Lo_Bound) then
if Is_Real_Type (P_Type) then
Fold_Ureal (N, Expr_Value_R (Lo_Bound), Static);
else
Fold_Uint (N, Expr_Value (Lo_Bound), Static);
end if;
end if;
end First_Attr;
-----------------
-- Fixed_Value --
-----------------
when Attribute_Fixed_Value =>
null;
-----------
-- Floor --
-----------
when Attribute_Floor =>
Fold_Ureal (N,
Eval_Fat.Floor (P_Root_Type, Expr_Value_R (E1)), Static);
----------
-- Fore --
----------
when Attribute_Fore =>
if Compile_Time_Known_Bounds (P_Type) then
Fold_Uint (N, UI_From_Int (Fore_Value), Static);
end if;
--------------
-- Fraction --
--------------
when Attribute_Fraction =>
Fold_Ureal (N,
Eval_Fat.Fraction (P_Root_Type, Expr_Value_R (E1)), Static);
-----------------------
-- Has_Access_Values --
-----------------------
when Attribute_Has_Access_Values =>
Rewrite (N, New_Occurrence_Of
(Boolean_Literals (Has_Access_Values (P_Root_Type)), Loc));
Analyze_And_Resolve (N, Standard_Boolean);
-----------------------
-- Has_Discriminants --
-----------------------
when Attribute_Has_Discriminants =>
Rewrite (N, New_Occurrence_Of (
Boolean_Literals (Has_Discriminants (P_Entity)), Loc));
Analyze_And_Resolve (N, Standard_Boolean);
--------------
-- Identity --
--------------
when Attribute_Identity =>
null;
-----------
-- Image --
-----------
-- Image is a scalar attribute, but is never static, because it is
-- not a static function (having a non-scalar argument (RM 4.9(22))
when Attribute_Image =>
null;
---------
-- Img --
---------
-- Img is a scalar attribute, but is never static, because it is
-- not a static function (having a non-scalar argument (RM 4.9(22))
when Attribute_Img =>
null;
-------------------
-- Integer_Value --
-------------------
when Attribute_Integer_Value =>
null;
-----------
-- Large --
-----------
when Attribute_Large =>
-- For fixed-point, we use the identity:
-- T'Large = (2.0**T'Mantissa - 1.0) * T'Small
if Is_Fixed_Point_Type (P_Type) then
Rewrite (N,
Make_Op_Multiply (Loc,
Left_Opnd =>
Make_Op_Subtract (Loc,
Left_Opnd =>
Make_Op_Expon (Loc,
Left_Opnd =>
Make_Real_Literal (Loc, Ureal_2),
Right_Opnd =>
Make_Attribute_Reference (Loc,
Prefix => P,
Attribute_Name => Name_Mantissa)),
Right_Opnd => Make_Real_Literal (Loc, Ureal_1)),
Right_Opnd =>
Make_Real_Literal (Loc, Small_Value (Entity (P)))));
Analyze_And_Resolve (N, C_Type);
-- Floating-point (Ada 83 compatibility)
else
-- Ada 83 attribute is defined as (RM83 3.5.8)
-- T'Large = 2.0**T'Emax * (1.0 - 2.0**(-T'Mantissa))
-- where
-- T'Emax = 4 * T'Mantissa
Fold_Ureal (N,
Ureal_2 ** (4 * Mantissa) * (Ureal_1 - Ureal_2 ** (-Mantissa)),
True);
end if;
----------
-- Last --
----------
when Attribute_Last => Last :
begin
Set_Bounds;
if Compile_Time_Known_Value (Hi_Bound) then
if Is_Real_Type (P_Type) then
Fold_Ureal (N, Expr_Value_R (Hi_Bound), Static);
else
Fold_Uint (N, Expr_Value (Hi_Bound), Static);
end if;
end if;
end Last;
------------------
-- Leading_Part --
------------------
when Attribute_Leading_Part =>
Fold_Ureal (N,
Eval_Fat.Leading_Part
(P_Root_Type, Expr_Value_R (E1), Expr_Value (E2)), Static);
------------
-- Length --
------------
when Attribute_Length => Length : declare
Ind : Node_Id;
begin
-- In the case of a generic index type, the bounds may
-- appear static but the computation is not meaningful,
-- and may generate a spurious warning.
Ind := First_Index (P_Type);
while Present (Ind) loop
if Is_Generic_Type (Etype (Ind)) then
return;
end if;
Next_Index (Ind);
end loop;
Set_Bounds;
if Compile_Time_Known_Value (Lo_Bound)
and then Compile_Time_Known_Value (Hi_Bound)
then
Fold_Uint (N,
UI_Max (0, 1 + (Expr_Value (Hi_Bound) - Expr_Value (Lo_Bound))),
True);
end if;
end Length;
-------------
-- Machine --
-------------
when Attribute_Machine =>
Fold_Ureal (N,
Eval_Fat.Machine
(P_Root_Type, Expr_Value_R (E1), Eval_Fat.Round, N),
Static);
------------------
-- Machine_Emax --
------------------
when Attribute_Machine_Emax =>
Float_Attribute_Universal_Integer (
IEEES_Machine_Emax,
IEEEL_Machine_Emax,
IEEEX_Machine_Emax,
VAXFF_Machine_Emax,
VAXDF_Machine_Emax,
VAXGF_Machine_Emax,
AAMPS_Machine_Emax,
AAMPL_Machine_Emax);
------------------
-- Machine_Emin --
------------------
when Attribute_Machine_Emin =>
Float_Attribute_Universal_Integer (
IEEES_Machine_Emin,
IEEEL_Machine_Emin,
IEEEX_Machine_Emin,
VAXFF_Machine_Emin,
VAXDF_Machine_Emin,
VAXGF_Machine_Emin,
AAMPS_Machine_Emin,
AAMPL_Machine_Emin);
----------------------
-- Machine_Mantissa --
----------------------
when Attribute_Machine_Mantissa =>
Float_Attribute_Universal_Integer (
IEEES_Machine_Mantissa,
IEEEL_Machine_Mantissa,
IEEEX_Machine_Mantissa,
VAXFF_Machine_Mantissa,
VAXDF_Machine_Mantissa,
VAXGF_Machine_Mantissa,
AAMPS_Machine_Mantissa,
AAMPL_Machine_Mantissa);
-----------------------
-- Machine_Overflows --
-----------------------
when Attribute_Machine_Overflows =>
-- Always true for fixed-point
if Is_Fixed_Point_Type (P_Type) then
Fold_Uint (N, True_Value, True);
-- Floating point case
else
Fold_Uint (N,
UI_From_Int (Boolean'Pos (Machine_Overflows_On_Target)),
True);
end if;
-------------------
-- Machine_Radix --
-------------------
when Attribute_Machine_Radix =>
if Is_Fixed_Point_Type (P_Type) then
if Is_Decimal_Fixed_Point_Type (P_Type)
and then Machine_Radix_10 (P_Type)
then
Fold_Uint (N, Uint_10, True);
else
Fold_Uint (N, Uint_2, True);
end if;
-- All floating-point type always have radix 2
else
Fold_Uint (N, Uint_2, True);
end if;
----------------------
-- Machine_Rounding --
----------------------
-- Note: for the folding case, it is fine to treat Machine_Rounding
-- exactly the same way as Rounding, since this is one of the allowed
-- behaviors, and performance is not an issue here. It might be a bit
-- better to give the same result as it would give at run-time, even
-- though the non-determinism is certainly permitted.
when Attribute_Machine_Rounding =>
Fold_Ureal (N,
Eval_Fat.Rounding (P_Root_Type, Expr_Value_R (E1)), Static);
--------------------
-- Machine_Rounds --
--------------------
when Attribute_Machine_Rounds =>
-- Always False for fixed-point
if Is_Fixed_Point_Type (P_Type) then
Fold_Uint (N, False_Value, True);
-- Else yield proper floating-point result
else
Fold_Uint
(N, UI_From_Int (Boolean'Pos (Machine_Rounds_On_Target)), True);
end if;
------------------
-- Machine_Size --
------------------
-- Note: Machine_Size is identical to Object_Size
when Attribute_Machine_Size => Machine_Size : declare
P_TypeA : constant Entity_Id := Underlying_Type (P_Type);
begin
if Known_Esize (P_TypeA) then
Fold_Uint (N, Esize (P_TypeA), True);
end if;
end Machine_Size;
--------------
-- Mantissa --
--------------
when Attribute_Mantissa =>
-- Fixed-point mantissa
if Is_Fixed_Point_Type (P_Type) then
-- Compile time foldable case
if Compile_Time_Known_Value (Type_Low_Bound (P_Type))
and then
Compile_Time_Known_Value (Type_High_Bound (P_Type))
then
-- The calculation of the obsolete Ada 83 attribute Mantissa
-- is annoying, because of AI00143, quoted here:
-- !question 84-01-10
-- Consider the model numbers for F:
-- type F is delta 1.0 range -7.0 .. 8.0;
-- The wording requires that F'MANTISSA be the SMALLEST
-- integer number for which each bound of the specified
-- range is either a model number or lies at most small
-- distant from a model number. This means F'MANTISSA
-- is required to be 3 since the range -7.0 .. 7.0 fits
-- in 3 signed bits, and 8 is "at most" 1.0 from a model
-- number, namely, 7. Is this analysis correct? Note that
-- this implies the upper bound of the range is not
-- represented as a model number.
-- !response 84-03-17
-- The analysis is correct. The upper and lower bounds for
-- a fixed point type can lie outside the range of model
-- numbers.
declare
Siz : Uint;
LBound : Ureal;
UBound : Ureal;
Bound : Ureal;
Max_Man : Uint;
begin
LBound := Expr_Value_R (Type_Low_Bound (P_Type));
UBound := Expr_Value_R (Type_High_Bound (P_Type));
Bound := UR_Max (UR_Abs (LBound), UR_Abs (UBound));
Max_Man := UR_Trunc (Bound / Small_Value (P_Type));
-- If the Bound is exactly a model number, i.e. a multiple
-- of Small, then we back it off by one to get the integer
-- value that must be representable.
if Small_Value (P_Type) * Max_Man = Bound then
Max_Man := Max_Man - 1;
end if;
-- Now find corresponding size = Mantissa value
Siz := Uint_0;
while 2 ** Siz < Max_Man loop
Siz := Siz + 1;
end loop;
Fold_Uint (N, Siz, True);
end;
else
-- The case of dynamic bounds cannot be evaluated at compile
-- time. Instead we use a runtime routine (see Exp_Attr).
null;
end if;
-- Floating-point Mantissa
else
Fold_Uint (N, Mantissa, True);
end if;
---------
-- Max --
---------
when Attribute_Max => Max :
begin
if Is_Real_Type (P_Type) then
Fold_Ureal
(N, UR_Max (Expr_Value_R (E1), Expr_Value_R (E2)), Static);
else
Fold_Uint (N, UI_Max (Expr_Value (E1), Expr_Value (E2)), Static);
end if;
end Max;
----------------------------------
-- Max_Size_In_Storage_Elements --
----------------------------------
-- Max_Size_In_Storage_Elements is simply the Size rounded up to a
-- Storage_Unit boundary. We can fold any cases for which the size
-- is known by the front end.
when Attribute_Max_Size_In_Storage_Elements =>
if Known_Esize (P_Type) then
Fold_Uint (N,
(Esize (P_Type) + System_Storage_Unit - 1) /
System_Storage_Unit,
Static);
end if;
--------------------
-- Mechanism_Code --
--------------------
when Attribute_Mechanism_Code =>
declare
Val : Int;
Formal : Entity_Id;
Mech : Mechanism_Type;
begin
if No (E1) then
Mech := Mechanism (P_Entity);
else
Val := UI_To_Int (Expr_Value (E1));
Formal := First_Formal (P_Entity);
for J in 1 .. Val - 1 loop
Next_Formal (Formal);
end loop;
Mech := Mechanism (Formal);
end if;
if Mech < 0 then
Fold_Uint (N, UI_From_Int (Int (-Mech)), True);
end if;
end;
---------
-- Min --
---------
when Attribute_Min => Min :
begin
if Is_Real_Type (P_Type) then
Fold_Ureal
(N, UR_Min (Expr_Value_R (E1), Expr_Value_R (E2)), Static);
else
Fold_Uint
(N, UI_Min (Expr_Value (E1), Expr_Value (E2)), Static);
end if;
end Min;
---------
-- Mod --
---------
when Attribute_Mod =>
Fold_Uint
(N, UI_Mod (Expr_Value (E1), Modulus (P_Base_Type)), Static);
-----------
-- Model --
-----------
when Attribute_Model =>
Fold_Ureal (N,
Eval_Fat.Model (P_Root_Type, Expr_Value_R (E1)), Static);
----------------
-- Model_Emin --
----------------
when Attribute_Model_Emin =>
Float_Attribute_Universal_Integer (
IEEES_Model_Emin,
IEEEL_Model_Emin,
IEEEX_Model_Emin,
VAXFF_Model_Emin,
VAXDF_Model_Emin,
VAXGF_Model_Emin,
AAMPS_Model_Emin,
AAMPL_Model_Emin);
-------------------
-- Model_Epsilon --
-------------------
when Attribute_Model_Epsilon =>
Float_Attribute_Universal_Real (
IEEES_Model_Epsilon'Universal_Literal_String,
IEEEL_Model_Epsilon'Universal_Literal_String,
IEEEX_Model_Epsilon'Universal_Literal_String,
VAXFF_Model_Epsilon'Universal_Literal_String,
VAXDF_Model_Epsilon'Universal_Literal_String,
VAXGF_Model_Epsilon'Universal_Literal_String,
AAMPS_Model_Epsilon'Universal_Literal_String,
AAMPL_Model_Epsilon'Universal_Literal_String);
--------------------
-- Model_Mantissa --
--------------------
when Attribute_Model_Mantissa =>
Float_Attribute_Universal_Integer (
IEEES_Model_Mantissa,
IEEEL_Model_Mantissa,
IEEEX_Model_Mantissa,
VAXFF_Model_Mantissa,
VAXDF_Model_Mantissa,
VAXGF_Model_Mantissa,
AAMPS_Model_Mantissa,
AAMPL_Model_Mantissa);
-----------------
-- Model_Small --
-----------------
when Attribute_Model_Small =>
Float_Attribute_Universal_Real (
IEEES_Model_Small'Universal_Literal_String,
IEEEL_Model_Small'Universal_Literal_String,
IEEEX_Model_Small'Universal_Literal_String,
VAXFF_Model_Small'Universal_Literal_String,
VAXDF_Model_Small'Universal_Literal_String,
VAXGF_Model_Small'Universal_Literal_String,
AAMPS_Model_Small'Universal_Literal_String,
AAMPL_Model_Small'Universal_Literal_String);
-------------
-- Modulus --
-------------
when Attribute_Modulus =>
Fold_Uint (N, Modulus (P_Type), True);
--------------------
-- Null_Parameter --
--------------------
-- Cannot fold, we know the value sort of, but the whole point is
-- that there is no way to talk about this imaginary value except
-- by using the attribute, so we leave it the way it is.
when Attribute_Null_Parameter =>
null;
-----------------
-- Object_Size --
-----------------
-- The Object_Size attribute for a type returns the Esize of the
-- type and can be folded if this value is known.
when Attribute_Object_Size => Object_Size : declare
P_TypeA : constant Entity_Id := Underlying_Type (P_Type);
begin
if Known_Esize (P_TypeA) then
Fold_Uint (N, Esize (P_TypeA), True);
end if;
end Object_Size;
-------------------------
-- Passed_By_Reference --
-------------------------
-- Scalar types are never passed by reference
when Attribute_Passed_By_Reference =>
Fold_Uint (N, False_Value, True);
---------
-- Pos --
---------
when Attribute_Pos =>
Fold_Uint (N, Expr_Value (E1), True);
----------
-- Pred --
----------
when Attribute_Pred => Pred :
begin
-- Floating-point case
if Is_Floating_Point_Type (P_Type) then
Fold_Ureal (N,
Eval_Fat.Pred (P_Root_Type, Expr_Value_R (E1)), Static);
-- Fixed-point case
elsif Is_Fixed_Point_Type (P_Type) then
Fold_Ureal (N,
Expr_Value_R (E1) - Small_Value (P_Type), True);
-- Modular integer case (wraps)
elsif Is_Modular_Integer_Type (P_Type) then
Fold_Uint (N, (Expr_Value (E1) - 1) mod Modulus (P_Type), Static);
-- Other scalar cases
else
pragma Assert (Is_Scalar_Type (P_Type));
if Is_Enumeration_Type (P_Type)
and then Expr_Value (E1) =
Expr_Value (Type_Low_Bound (P_Base_Type))
then
Apply_Compile_Time_Constraint_Error
(N, "Pred of `&''First`",
CE_Overflow_Check_Failed,
Ent => P_Base_Type,
Warn => not Static);
Check_Expressions;
return;
end if;
Fold_Uint (N, Expr_Value (E1) - 1, Static);
end if;
end Pred;
-----------
-- Range --
-----------
-- No processing required, because by this stage, Range has been
-- replaced by First .. Last, so this branch can never be taken.
when Attribute_Range =>
raise Program_Error;
------------------
-- Range_Length --
------------------
when Attribute_Range_Length =>
Set_Bounds;
if Compile_Time_Known_Value (Hi_Bound)
and then Compile_Time_Known_Value (Lo_Bound)
then
Fold_Uint (N,
UI_Max
(0, Expr_Value (Hi_Bound) - Expr_Value (Lo_Bound) + 1),
Static);
end if;
---------------
-- Remainder --
---------------
when Attribute_Remainder => Remainder : declare
X : constant Ureal := Expr_Value_R (E1);
Y : constant Ureal := Expr_Value_R (E2);
begin
if UR_Is_Zero (Y) then
Apply_Compile_Time_Constraint_Error
(N, "division by zero in Remainder",
CE_Overflow_Check_Failed,
Warn => not Static);
Check_Expressions;
return;
end if;
Fold_Ureal (N, Eval_Fat.Remainder (P_Root_Type, X, Y), Static);
end Remainder;
-----------
-- Round --
-----------
when Attribute_Round => Round :
declare
Sr : Ureal;
Si : Uint;
begin
-- First we get the (exact result) in units of small
Sr := Expr_Value_R (E1) / Small_Value (C_Type);
-- Now round that exactly to an integer
Si := UR_To_Uint (Sr);
-- Finally the result is obtained by converting back to real
Fold_Ureal (N, Si * Small_Value (C_Type), Static);
end Round;
--------------
-- Rounding --
--------------
when Attribute_Rounding =>
Fold_Ureal (N,
Eval_Fat.Rounding (P_Root_Type, Expr_Value_R (E1)), Static);
---------------
-- Safe_Emax --
---------------
when Attribute_Safe_Emax =>
Float_Attribute_Universal_Integer (
IEEES_Safe_Emax,
IEEEL_Safe_Emax,
IEEEX_Safe_Emax,
VAXFF_Safe_Emax,
VAXDF_Safe_Emax,
VAXGF_Safe_Emax,
AAMPS_Safe_Emax,
AAMPL_Safe_Emax);
----------------
-- Safe_First --
----------------
when Attribute_Safe_First =>
Float_Attribute_Universal_Real (
IEEES_Safe_First'Universal_Literal_String,
IEEEL_Safe_First'Universal_Literal_String,
IEEEX_Safe_First'Universal_Literal_String,
VAXFF_Safe_First'Universal_Literal_String,
VAXDF_Safe_First'Universal_Literal_String,
VAXGF_Safe_First'Universal_Literal_String,
AAMPS_Safe_First'Universal_Literal_String,
AAMPL_Safe_First'Universal_Literal_String);
----------------
-- Safe_Large --
----------------
when Attribute_Safe_Large =>
if Is_Fixed_Point_Type (P_Type) then
Fold_Ureal
(N, Expr_Value_R (Type_High_Bound (P_Base_Type)), Static);
else
Float_Attribute_Universal_Real (
IEEES_Safe_Large'Universal_Literal_String,
IEEEL_Safe_Large'Universal_Literal_String,
IEEEX_Safe_Large'Universal_Literal_String,
VAXFF_Safe_Large'Universal_Literal_String,
VAXDF_Safe_Large'Universal_Literal_String,
VAXGF_Safe_Large'Universal_Literal_String,
AAMPS_Safe_Large'Universal_Literal_String,
AAMPL_Safe_Large'Universal_Literal_String);
end if;
---------------
-- Safe_Last --
---------------
when Attribute_Safe_Last =>
Float_Attribute_Universal_Real (
IEEES_Safe_Last'Universal_Literal_String,
IEEEL_Safe_Last'Universal_Literal_String,
IEEEX_Safe_Last'Universal_Literal_String,
VAXFF_Safe_Last'Universal_Literal_String,
VAXDF_Safe_Last'Universal_Literal_String,
VAXGF_Safe_Last'Universal_Literal_String,
AAMPS_Safe_Last'Universal_Literal_String,
AAMPL_Safe_Last'Universal_Literal_String);
----------------
-- Safe_Small --
----------------
when Attribute_Safe_Small =>
-- In Ada 95, the old Ada 83 attribute Safe_Small is redundant
-- for fixed-point, since is the same as Small, but we implement
-- it for backwards compatibility.
if Is_Fixed_Point_Type (P_Type) then
Fold_Ureal (N, Small_Value (P_Type), Static);
-- Ada 83 Safe_Small for floating-point cases
else
Float_Attribute_Universal_Real (
IEEES_Safe_Small'Universal_Literal_String,
IEEEL_Safe_Small'Universal_Literal_String,
IEEEX_Safe_Small'Universal_Literal_String,
VAXFF_Safe_Small'Universal_Literal_String,
VAXDF_Safe_Small'Universal_Literal_String,
VAXGF_Safe_Small'Universal_Literal_String,
AAMPS_Safe_Small'Universal_Literal_String,
AAMPL_Safe_Small'Universal_Literal_String);
end if;
-----------
-- Scale --
-----------
when Attribute_Scale =>
Fold_Uint (N, Scale_Value (P_Type), True);
-------------
-- Scaling --
-------------
when Attribute_Scaling =>
Fold_Ureal (N,
Eval_Fat.Scaling
(P_Root_Type, Expr_Value_R (E1), Expr_Value (E2)), Static);
------------------
-- Signed_Zeros --
------------------
when Attribute_Signed_Zeros =>
Fold_Uint
(N, UI_From_Int (Boolean'Pos (Signed_Zeros_On_Target)), Static);
----------
-- Size --
----------
-- Size attribute returns the RM size. All scalar types can be folded,
-- as well as any types for which the size is known by the front end,
-- including any type for which a size attribute is specified.
when Attribute_Size | Attribute_VADS_Size => Size : declare
P_TypeA : constant Entity_Id := Underlying_Type (P_Type);
begin
if RM_Size (P_TypeA) /= Uint_0 then
-- VADS_Size case
if Id = Attribute_VADS_Size or else Use_VADS_Size then
declare
S : constant Node_Id := Size_Clause (P_TypeA);
begin
-- If a size clause applies, then use the size from it.
-- This is one of the rare cases where we can use the
-- Size_Clause field for a subtype when Has_Size_Clause
-- is False. Consider:
-- type x is range 1 .. 64;
-- for x'size use 12;
-- subtype y is x range 0 .. 3;
-- Here y has a size clause inherited from x, but normally
-- it does not apply, and y'size is 2. However, y'VADS_Size
-- is indeed 12 and not 2.
if Present (S)
and then Is_OK_Static_Expression (Expression (S))
then
Fold_Uint (N, Expr_Value (Expression (S)), True);
-- If no size is specified, then we simply use the object
-- size in the VADS_Size case (e.g. Natural'Size is equal
-- to Integer'Size, not one less).
else
Fold_Uint (N, Esize (P_TypeA), True);
end if;
end;
-- Normal case (Size) in which case we want the RM_Size
else
Fold_Uint (N,
RM_Size (P_TypeA),
Static and then Is_Discrete_Type (P_TypeA));
end if;
end if;
end Size;
-----------
-- Small --
-----------
when Attribute_Small =>
-- The floating-point case is present only for Ada 83 compatability.
-- Note that strictly this is an illegal addition, since we are
-- extending an Ada 95 defined attribute, but we anticipate an
-- ARG ruling that will permit this.
if Is_Floating_Point_Type (P_Type) then
-- Ada 83 attribute is defined as (RM83 3.5.8)
-- T'Small = 2.0**(-T'Emax - 1)
-- where
-- T'Emax = 4 * T'Mantissa
Fold_Ureal (N, Ureal_2 ** ((-(4 * Mantissa)) - 1), Static);
-- Normal Ada 95 fixed-point case
else
Fold_Ureal (N, Small_Value (P_Type), True);
end if;
-----------------
-- Stream_Size --
-----------------
when Attribute_Stream_Size =>
null;
----------
-- Succ --
----------
when Attribute_Succ => Succ :
begin
-- Floating-point case
if Is_Floating_Point_Type (P_Type) then
Fold_Ureal (N,
Eval_Fat.Succ (P_Root_Type, Expr_Value_R (E1)), Static);
-- Fixed-point case
elsif Is_Fixed_Point_Type (P_Type) then
Fold_Ureal (N,
Expr_Value_R (E1) + Small_Value (P_Type), Static);
-- Modular integer case (wraps)
elsif Is_Modular_Integer_Type (P_Type) then
Fold_Uint (N, (Expr_Value (E1) + 1) mod Modulus (P_Type), Static);
-- Other scalar cases
else
pragma Assert (Is_Scalar_Type (P_Type));
if Is_Enumeration_Type (P_Type)
and then Expr_Value (E1) =
Expr_Value (Type_High_Bound (P_Base_Type))
then
Apply_Compile_Time_Constraint_Error
(N, "Succ of `&''Last`",
CE_Overflow_Check_Failed,
Ent => P_Base_Type,
Warn => not Static);
Check_Expressions;
return;
else
Fold_Uint (N, Expr_Value (E1) + 1, Static);
end if;
end if;
end Succ;
----------------
-- Truncation --
----------------
when Attribute_Truncation =>
Fold_Ureal (N,
Eval_Fat.Truncation (P_Root_Type, Expr_Value_R (E1)), Static);
----------------
-- Type_Class --
----------------
when Attribute_Type_Class => Type_Class : declare
Typ : constant Entity_Id := Underlying_Type (P_Base_Type);
Id : RE_Id;
begin
if Is_Descendent_Of_Address (Typ) then
Id := RE_Type_Class_Address;
elsif Is_Enumeration_Type (Typ) then
Id := RE_Type_Class_Enumeration;
elsif Is_Integer_Type (Typ) then
Id := RE_Type_Class_Integer;
elsif Is_Fixed_Point_Type (Typ) then
Id := RE_Type_Class_Fixed_Point;
elsif Is_Floating_Point_Type (Typ) then
Id := RE_Type_Class_Floating_Point;
elsif Is_Array_Type (Typ) then
Id := RE_Type_Class_Array;
elsif Is_Record_Type (Typ) then
Id := RE_Type_Class_Record;
elsif Is_Access_Type (Typ) then
Id := RE_Type_Class_Access;
elsif Is_Enumeration_Type (Typ) then
Id := RE_Type_Class_Enumeration;
elsif Is_Task_Type (Typ) then
Id := RE_Type_Class_Task;
-- We treat protected types like task types. It would make more
-- sense to have another enumeration value, but after all the
-- whole point of this feature is to be exactly DEC compatible,
-- and changing the type Type_Clas would not meet this requirement.
elsif Is_Protected_Type (Typ) then
Id := RE_Type_Class_Task;
-- Not clear if there are any other possibilities, but if there
-- are, then we will treat them as the address case.
else
Id := RE_Type_Class_Address;
end if;
Rewrite (N, New_Occurrence_Of (RTE (Id), Loc));
end Type_Class;
-----------------------
-- Unbiased_Rounding --
-----------------------
when Attribute_Unbiased_Rounding =>
Fold_Ureal (N,
Eval_Fat.Unbiased_Rounding (P_Root_Type, Expr_Value_R (E1)),
Static);
-------------------------
-- Unconstrained_Array --
-------------------------
when Attribute_Unconstrained_Array => Unconstrained_Array : declare
Typ : constant Entity_Id := Underlying_Type (P_Type);
begin
Rewrite (N, New_Occurrence_Of (
Boolean_Literals (
Is_Array_Type (P_Type)
and then not Is_Constrained (Typ)), Loc));
-- Analyze and resolve as boolean, note that this attribute is
-- a static attribute in GNAT.
Analyze_And_Resolve (N, Standard_Boolean);
Static := True;
end Unconstrained_Array;
---------------
-- VADS_Size --
---------------
-- Processing is shared with Size
---------
-- Val --
---------
when Attribute_Val => Val :
begin
if Expr_Value (E1) < Expr_Value (Type_Low_Bound (P_Base_Type))
or else
Expr_Value (E1) > Expr_Value (Type_High_Bound (P_Base_Type))
then
Apply_Compile_Time_Constraint_Error
(N, "Val expression out of range",
CE_Range_Check_Failed,
Warn => not Static);
Check_Expressions;
return;
else
Fold_Uint (N, Expr_Value (E1), Static);
end if;
end Val;
----------------
-- Value_Size --
----------------
-- The Value_Size attribute for a type returns the RM size of the
-- type. This an always be folded for scalar types, and can also
-- be folded for non-scalar types if the size is set.
when Attribute_Value_Size => Value_Size : declare
P_TypeA : constant Entity_Id := Underlying_Type (P_Type);
begin
if RM_Size (P_TypeA) /= Uint_0 then
Fold_Uint (N, RM_Size (P_TypeA), True);
end if;
end Value_Size;
-------------
-- Version --
-------------
-- Version can never be static
when Attribute_Version =>
null;
----------------
-- Wide_Image --
----------------
-- Wide_Image is a scalar attribute, but is never static, because it
-- is not a static function (having a non-scalar argument (RM 4.9(22))
when Attribute_Wide_Image =>
null;
---------------------
-- Wide_Wide_Image --
---------------------
-- Wide_Wide_Image is a scalar attribute but is never static, because it
-- is not a static function (having a non-scalar argument (RM 4.9(22)).
when Attribute_Wide_Wide_Image =>
null;
---------------------
-- Wide_Wide_Width --
---------------------
-- Processing for Wide_Wide_Width is combined with Width
----------------
-- Wide_Width --
----------------
-- Processing for Wide_Width is combined with Width
-----------
-- Width --
-----------
-- This processing also handles the case of Wide_[Wide_]Width
when Attribute_Width |
Attribute_Wide_Width |
Attribute_Wide_Wide_Width => Width :
begin
if Compile_Time_Known_Bounds (P_Type) then
-- Floating-point types
if Is_Floating_Point_Type (P_Type) then
-- Width is zero for a null range (RM 3.5 (38))
if Expr_Value_R (Type_High_Bound (P_Type)) <
Expr_Value_R (Type_Low_Bound (P_Type))
then
Fold_Uint (N, Uint_0, True);
else
-- For floating-point, we have +N.dddE+nnn where length
-- of ddd is determined by type'Digits - 1, but is one
-- if Digits is one (RM 3.5 (33)).
-- nnn is set to 2 for Short_Float and Float (32 bit
-- floats), and 3 for Long_Float and Long_Long_Float.
-- For machines where Long_Long_Float is the IEEE
-- extended precision type, the exponent takes 4 digits.
declare
Len : Int :=
Int'Max (2, UI_To_Int (Digits_Value (P_Type)));
begin
if Esize (P_Type) <= 32 then
Len := Len + 6;
elsif Esize (P_Type) = 64 then
Len := Len + 7;
else
Len := Len + 8;
end if;
Fold_Uint (N, UI_From_Int (Len), True);
end;
end if;
-- Fixed-point types
elsif Is_Fixed_Point_Type (P_Type) then
-- Width is zero for a null range (RM 3.5 (38))
if Expr_Value (Type_High_Bound (P_Type)) <
Expr_Value (Type_Low_Bound (P_Type))
then
Fold_Uint (N, Uint_0, True);
-- The non-null case depends on the specific real type
else
-- For fixed-point type width is Fore + 1 + Aft (RM 3.5(34))
Fold_Uint
(N, UI_From_Int (Fore_Value + 1 + Aft_Value), True);
end if;
-- Discrete types
else
declare
R : constant Entity_Id := Root_Type (P_Type);
Lo : constant Uint :=
Expr_Value (Type_Low_Bound (P_Type));
Hi : constant Uint :=
Expr_Value (Type_High_Bound (P_Type));
W : Nat;
Wt : Nat;
T : Uint;
L : Node_Id;
C : Character;
begin
-- Empty ranges
if Lo > Hi then
W := 0;
-- Width for types derived from Standard.Character
-- and Standard.Wide_[Wide_]Character.
elsif R = Standard_Character
or else R = Standard_Wide_Character
or else R = Standard_Wide_Wide_Character
then
W := 0;
-- Set W larger if needed
for J in UI_To_Int (Lo) .. UI_To_Int (Hi) loop
-- All wide characters look like Hex_hhhhhhhh
if J > 255 then
W := 12;
else
C := Character'Val (J);
-- Test for all cases where Character'Image
-- yields an image that is longer than three
-- characters. First the cases of Reserved_xxx
-- names (length = 12).
case C is
when Reserved_128 | Reserved_129 |
Reserved_132 | Reserved_153
=> Wt := 12;
when BS | HT | LF | VT | FF | CR |
SO | SI | EM | FS | GS | RS |
US | RI | MW | ST | PM
=> Wt := 2;
when NUL | SOH | STX | ETX | EOT |
ENQ | ACK | BEL | DLE | DC1 |
DC2 | DC3 | DC4 | NAK | SYN |
ETB | CAN | SUB | ESC | DEL |
BPH | NBH | NEL | SSA | ESA |
HTS | HTJ | VTS | PLD | PLU |
SS2 | SS3 | DCS | PU1 | PU2 |
STS | CCH | SPA | EPA | SOS |
SCI | CSI | OSC | APC
=> Wt := 3;
when Space .. Tilde |
No_Break_Space .. LC_Y_Diaeresis
=> Wt := 3;
end case;
W := Int'Max (W, Wt);
end if;
end loop;
-- Width for types derived from Standard.Boolean
elsif R = Standard_Boolean then
if Lo = 0 then
W := 5; -- FALSE
else
W := 4; -- TRUE
end if;
-- Width for integer types
elsif Is_Integer_Type (P_Type) then
T := UI_Max (abs Lo, abs Hi);
W := 2;
while T >= 10 loop
W := W + 1;
T := T / 10;
end loop;
-- Only remaining possibility is user declared enum type
else
pragma Assert (Is_Enumeration_Type (P_Type));
W := 0;
L := First_Literal (P_Type);
while Present (L) loop
-- Only pay attention to in range characters
if Lo <= Enumeration_Pos (L)
and then Enumeration_Pos (L) <= Hi
then
-- For Width case, use decoded name
if Id = Attribute_Width then
Get_Decoded_Name_String (Chars (L));
Wt := Nat (Name_Len);
-- For Wide_[Wide_]Width, use encoded name, and
-- then adjust for the encoding.
else
Get_Name_String (Chars (L));
-- Character literals are always of length 3
if Name_Buffer (1) = 'Q' then
Wt := 3;
-- Otherwise loop to adjust for upper/wide chars
else
Wt := Nat (Name_Len);
for J in 1 .. Name_Len loop
if Name_Buffer (J) = 'U' then
Wt := Wt - 2;
elsif Name_Buffer (J) = 'W' then
Wt := Wt - 4;
end if;
end loop;
end if;
end if;
W := Int'Max (W, Wt);
end if;
Next_Literal (L);
end loop;
end if;
Fold_Uint (N, UI_From_Int (W), True);
end;
end if;
end if;
end Width;
-- The following attributes can never be folded, and furthermore we
-- should not even have entered the case statement for any of these.
-- Note that in some cases, the values have already been folded as
-- a result of the processing in Analyze_Attribute.
when Attribute_Abort_Signal |
Attribute_Access |
Attribute_Address |
Attribute_Address_Size |
Attribute_Asm_Input |
Attribute_Asm_Output |
Attribute_Base |
Attribute_Bit_Order |
Attribute_Bit_Position |
Attribute_Callable |
Attribute_Caller |
Attribute_Class |
Attribute_Code_Address |
Attribute_Count |
Attribute_Default_Bit_Order |
Attribute_Elaborated |
Attribute_Elab_Body |
Attribute_Elab_Spec |
Attribute_External_Tag |
Attribute_First_Bit |
Attribute_Input |
Attribute_Last_Bit |
Attribute_Maximum_Alignment |
Attribute_Output |
Attribute_Partition_ID |
Attribute_Pool_Address |
Attribute_Position |
Attribute_Read |
Attribute_Storage_Pool |
Attribute_Storage_Size |
Attribute_Storage_Unit |
Attribute_Tag |
Attribute_Target_Name |
Attribute_Terminated |
Attribute_To_Address |
Attribute_UET_Address |
Attribute_Unchecked_Access |
Attribute_Universal_Literal_String |
Attribute_Unrestricted_Access |
Attribute_Valid |
Attribute_Value |
Attribute_Wchar_T_Size |
Attribute_Wide_Value |
Attribute_Wide_Wide_Value |
Attribute_Word_Size |
Attribute_Write =>
raise Program_Error;
end case;
-- At the end of the case, one more check. If we did a static evaluation
-- so that the result is now a literal, then set Is_Static_Expression
-- in the constant only if the prefix type is a static subtype. For
-- non-static subtypes, the folding is still OK, but not static.
-- An exception is the GNAT attribute Constrained_Array which is
-- defined to be a static attribute in all cases.
if Nkind (N) = N_Integer_Literal
or else Nkind (N) = N_Real_Literal
or else Nkind (N) = N_Character_Literal
or else Nkind (N) = N_String_Literal
or else (Is_Entity_Name (N)
and then Ekind (Entity (N)) = E_Enumeration_Literal)
then
Set_Is_Static_Expression (N, Static);
-- If this is still an attribute reference, then it has not been folded
-- and that means that its expressions are in a non-static context.
elsif Nkind (N) = N_Attribute_Reference then
Check_Expressions;
-- Note: the else case not covered here are odd cases where the
-- processing has transformed the attribute into something other
-- than a constant. Nothing more to do in such cases.
else
null;
end if;
end Eval_Attribute;
------------------------------
-- Is_Anonymous_Tagged_Base --
------------------------------
function Is_Anonymous_Tagged_Base
(Anon : Entity_Id;
Typ : Entity_Id)
return Boolean
is
begin
return
Anon = Current_Scope
and then Is_Itype (Anon)
and then Associated_Node_For_Itype (Anon) = Parent (Typ);
end Is_Anonymous_Tagged_Base;
-----------------------
-- Resolve_Attribute --
-----------------------
procedure Resolve_Attribute (N : Node_Id; Typ : Entity_Id) is
Loc : constant Source_Ptr := Sloc (N);
P : constant Node_Id := Prefix (N);
Aname : constant Name_Id := Attribute_Name (N);
Attr_Id : constant Attribute_Id := Get_Attribute_Id (Aname);
Btyp : constant Entity_Id := Base_Type (Typ);
Index : Interp_Index;
It : Interp;
Nom_Subt : Entity_Id;
procedure Accessibility_Message;
-- Error, or warning within an instance, if the static accessibility
-- rules of 3.10.2 are violated.
---------------------------
-- Accessibility_Message --
---------------------------
procedure Accessibility_Message is
Indic : Node_Id := Parent (Parent (N));
begin
-- In an instance, this is a runtime check, but one we
-- know will fail, so generate an appropriate warning.
if In_Instance_Body then
Error_Msg_N
("?non-local pointer cannot point to local object", P);
Error_Msg_N
("\?Program_Error will be raised at run time", P);
Rewrite (N,
Make_Raise_Program_Error (Loc,
Reason => PE_Accessibility_Check_Failed));
Set_Etype (N, Typ);
return;
else
Error_Msg_N
("non-local pointer cannot point to local object", P);
-- Check for case where we have a missing access definition
if Is_Record_Type (Current_Scope)
and then
(Nkind (Parent (N)) = N_Discriminant_Association
or else
Nkind (Parent (N)) = N_Index_Or_Discriminant_Constraint)
then
Indic := Parent (Parent (N));
while Present (Indic)
and then Nkind (Indic) /= N_Subtype_Indication
loop
Indic := Parent (Indic);
end loop;
if Present (Indic) then
Error_Msg_NE
("\use an access definition for" &
" the access discriminant of&", N,
Entity (Subtype_Mark (Indic)));
end if;
end if;
end if;
end Accessibility_Message;
-- Start of processing for Resolve_Attribute
begin
-- If error during analysis, no point in continuing, except for
-- array types, where we get better recovery by using unconstrained
-- indices than nothing at all (see Check_Array_Type).
if Error_Posted (N)
and then Attr_Id /= Attribute_First
and then Attr_Id /= Attribute_Last
and then Attr_Id /= Attribute_Length
and then Attr_Id /= Attribute_Range
then
return;
end if;
-- If attribute was universal type, reset to actual type
if Etype (N) = Universal_Integer
or else Etype (N) = Universal_Real
then
Set_Etype (N, Typ);
end if;
-- Remaining processing depends on attribute
case Attr_Id is
------------
-- Access --
------------
-- For access attributes, if the prefix denotes an entity, it is
-- interpreted as a name, never as a call. It may be overloaded,
-- in which case resolution uses the profile of the context type.
-- Otherwise prefix must be resolved.
when Attribute_Access
| Attribute_Unchecked_Access
| Attribute_Unrestricted_Access =>
if Is_Variable (P) then
Note_Possible_Modification (P);
end if;
if Is_Entity_Name (P) then
if Is_Overloaded (P) then
Get_First_Interp (P, Index, It);
while Present (It.Nam) loop
if Type_Conformant (Designated_Type (Typ), It.Nam) then
Set_Entity (P, It.Nam);
-- The prefix is definitely NOT overloaded anymore
-- at this point, so we reset the Is_Overloaded
-- flag to avoid any confusion when reanalyzing
-- the node.
Set_Is_Overloaded (P, False);
Generate_Reference (Entity (P), P);
exit;
end if;
Get_Next_Interp (Index, It);
end loop;
-- If it is a subprogram name or a type, there is nothing
-- to resolve.
elsif not Is_Overloadable (Entity (P))
and then not Is_Type (Entity (P))
then
Resolve (P);
end if;
Error_Msg_Name_1 := Aname;
if not Is_Entity_Name (P) then
null;
elsif Is_Abstract (Entity (P))
and then Is_Overloadable (Entity (P))
then
Error_Msg_N ("prefix of % attribute cannot be abstract", P);
Set_Etype (N, Any_Type);
elsif Convention (Entity (P)) = Convention_Intrinsic then
if Ekind (Entity (P)) = E_Enumeration_Literal then
Error_Msg_N
("prefix of % attribute cannot be enumeration literal",
P);
else
Error_Msg_N
("prefix of % attribute cannot be intrinsic", P);
end if;
Set_Etype (N, Any_Type);
elsif Is_Thread_Body (Entity (P)) then
Error_Msg_N
("prefix of % attribute cannot be a thread body", P);
end if;
-- Assignments, return statements, components of aggregates,
-- generic instantiations will require convention checks if
-- the type is an access to subprogram. Given that there will
-- also be accessibility checks on those, this is where the
-- checks can eventually be centralized ???
if Ekind (Btyp) = E_Access_Subprogram_Type
or else
Ekind (Btyp) = E_Anonymous_Access_Subprogram_Type
or else
Ekind (Btyp) = E_Anonymous_Access_Protected_Subprogram_Type
then
if Convention (Btyp) /= Convention (Entity (P)) then
Error_Msg_N
("subprogram has invalid convention for context", P);
else
Check_Subtype_Conformant
(New_Id => Entity (P),
Old_Id => Designated_Type (Btyp),
Err_Loc => P);
end if;
if Attr_Id = Attribute_Unchecked_Access then
Error_Msg_Name_1 := Aname;
Error_Msg_N
("attribute% cannot be applied to a subprogram", P);
elsif Aname = Name_Unrestricted_Access then
null; -- Nothing to check
-- Check the static accessibility rule of 3.10.2(32).
-- This rule also applies within the private part of an
-- instantiation. This rule does not apply to anonymous
-- access-to-subprogram types (Ada 2005).
elsif Attr_Id = Attribute_Access
and then not In_Instance_Body
and then Subprogram_Access_Level (Entity (P)) >
Type_Access_Level (Btyp)
and then Ekind (Btyp) /=
E_Anonymous_Access_Subprogram_Type
and then Ekind (Btyp) /=
E_Anonymous_Access_Protected_Subprogram_Type
then
Error_Msg_N
("subprogram must not be deeper than access type", P);
-- Check the restriction of 3.10.2(32) that disallows the
-- access attribute within a generic body when the ultimate
-- ancestor of the type of the attribute is declared outside
-- of the generic unit and the subprogram is declared within
-- that generic unit. This includes any such attribute that
-- occurs within the body of a generic unit that is a child
-- of the generic unit where the subprogram is declared.
-- The rule also prohibits applying the attibute when the
-- access type is a generic formal access type (since the
-- level of the actual type is not known). This restriction
-- does not apply when the attribute type is an anonymous
-- access-to-subprogram type. Note that this check was
-- revised by AI-229, because the originally Ada 95 rule
-- was too lax. The original rule only applied when the
-- subprogram was declared within the body of the generic,
-- which allowed the possibility of dangling references).
-- The rule was also too strict in some case, in that it
-- didn't permit the access to be declared in the generic
-- spec, whereas the revised rule does (as long as it's not
-- a formal type).
-- There are a couple of subtleties of the test for applying
-- the check that are worth noting. First, we only apply it
-- when the levels of the subprogram and access type are the
-- same (the case where the subprogram is statically deeper
-- was applied above, and the case where the type is deeper
-- is always safe). Second, we want the check to apply
-- within nested generic bodies and generic child unit
-- bodies, but not to apply to an attribute that appears in
-- the generic unit's specification. This is done by testing
-- that the attribute's innermost enclosing generic body is
-- not the same as the innermost generic body enclosing the
-- generic unit where the subprogram is declared (we don't
-- want the check to apply when the access attribute is in
-- the spec and there's some other generic body enclosing
-- generic). Finally, there's no point applying the check
-- when within an instance, because any violations will
-- have been caught by the compilation of the generic unit.
elsif Attr_Id = Attribute_Access
and then not In_Instance
and then Present (Enclosing_Generic_Unit (Entity (P)))
and then Present (Enclosing_Generic_Body (N))
and then Enclosing_Generic_Body (N) /=
Enclosing_Generic_Body
(Enclosing_Generic_Unit (Entity (P)))
and then Subprogram_Access_Level (Entity (P)) =
Type_Access_Level (Btyp)
and then Ekind (Btyp) /=
E_Anonymous_Access_Subprogram_Type
and then Ekind (Btyp) /=
E_Anonymous_Access_Protected_Subprogram_Type
then
-- The attribute type's ultimate ancestor must be
-- declared within the same generic unit as the
-- subprogram is declared. The error message is
-- specialized to say "ancestor" for the case where
-- the access type is not its own ancestor, since
-- saying simply "access type" would be very confusing.
if Enclosing_Generic_Unit (Entity (P)) /=
Enclosing_Generic_Unit (Root_Type (Btyp))
then
if Root_Type (Btyp) = Btyp then
Error_Msg_N
("access type must not be outside generic unit",
N);
else
Error_Msg_N
("ancestor access type must not be outside " &
"generic unit", N);
end if;
-- If the ultimate ancestor of the attribute's type is
-- a formal type, then the attribute is illegal because
-- the actual type might be declared at a higher level.
-- The error message is specialized to say "ancestor"
-- for the case where the access type is not its own
-- ancestor, since saying simply "access type" would be
-- very confusing.
elsif Is_Generic_Type (Root_Type (Btyp)) then
if Root_Type (Btyp) = Btyp then
Error_Msg_N
("access type must not be a generic formal type",
N);
else
Error_Msg_N
("ancestor access type must not be a generic " &
"formal type", N);
end if;
end if;
end if;
end if;
-- If this is a renaming, an inherited operation, or a
-- subprogram instance, use the original entity.
if Is_Entity_Name (P)
and then Is_Overloadable (Entity (P))
and then Present (Alias (Entity (P)))
then
Rewrite (P,
New_Occurrence_Of (Alias (Entity (P)), Sloc (P)));
end if;
elsif Nkind (P) = N_Selected_Component
and then Is_Overloadable (Entity (Selector_Name (P)))
then
-- Protected operation. If operation is overloaded, must
-- disambiguate. Prefix that denotes protected object itself
-- is resolved with its own type.
if Attr_Id = Attribute_Unchecked_Access then
Error_Msg_Name_1 := Aname;
Error_Msg_N
("attribute% cannot be applied to protected operation", P);
end if;
Resolve (Prefix (P));
Generate_Reference (Entity (Selector_Name (P)), P);
elsif Is_Overloaded (P) then
-- Use the designated type of the context to disambiguate
-- Note that this was not strictly conformant to Ada 95,
-- but was the implementation adopted by most Ada 95 compilers.
-- The use of the context type to resolve an Access attribute
-- reference is now mandated in AI-235 for Ada 2005.
declare
Index : Interp_Index;
It : Interp;
begin
Get_First_Interp (P, Index, It);
while Present (It.Typ) loop
if Covers (Designated_Type (Typ), It.Typ) then
Resolve (P, It.Typ);
exit;
end if;
Get_Next_Interp (Index, It);
end loop;
end;
else
Resolve (P);
end if;
-- X'Access is illegal if X denotes a constant and the access
-- type is access-to-variable. Same for 'Unchecked_Access.
-- The rule does not apply to 'Unrestricted_Access.
if not (Ekind (Btyp) = E_Access_Subprogram_Type
or else Ekind (Btyp) = E_Anonymous_Access_Subprogram_Type
or else (Is_Record_Type (Btyp) and then
Present (Corresponding_Remote_Type (Btyp)))
or else Ekind (Btyp) = E_Access_Protected_Subprogram_Type
or else Ekind (Btyp)
= E_Anonymous_Access_Protected_Subprogram_Type
or else Is_Access_Constant (Btyp)
or else Is_Variable (P)
or else Attr_Id = Attribute_Unrestricted_Access)
then
if Comes_From_Source (N) then
Error_Msg_N ("access-to-variable designates constant", P);
end if;
end if;
if (Attr_Id = Attribute_Access
or else
Attr_Id = Attribute_Unchecked_Access)
and then (Ekind (Btyp) = E_General_Access_Type
or else Ekind (Btyp) = E_Anonymous_Access_Type)
then
-- Ada 2005 (AI-230): Check the accessibility of anonymous
-- access types in record and array components. For a
-- component definition the level is the same of the
-- enclosing composite type.
if Ada_Version >= Ada_05
and then Is_Local_Anonymous_Access (Btyp)
and then Object_Access_Level (P) > Type_Access_Level (Btyp)
then
-- In an instance, this is a runtime check, but one we
-- know will fail, so generate an appropriate warning.
if In_Instance_Body then
Error_Msg_N
("?non-local pointer cannot point to local object", P);
Error_Msg_N
("\?Program_Error will be raised at run time", P);
Rewrite (N,
Make_Raise_Program_Error (Loc,
Reason => PE_Accessibility_Check_Failed));
Set_Etype (N, Typ);
else
Error_Msg_N
("non-local pointer cannot point to local object", P);
end if;
end if;
if Is_Dependent_Component_Of_Mutable_Object (P) then
Error_Msg_N
("illegal attribute for discriminant-dependent component",
P);
end if;
-- Check the static matching rule of 3.10.2(27). The
-- nominal subtype of the prefix must statically
-- match the designated type.
Nom_Subt := Etype (P);
if Is_Constr_Subt_For_U_Nominal (Nom_Subt) then
Nom_Subt := Etype (Nom_Subt);
end if;
if Is_Tagged_Type (Designated_Type (Typ)) then
-- If the attribute is in the context of an access
-- parameter, then the prefix is allowed to be of
-- the class-wide type (by AI-127).
if Ekind (Typ) = E_Anonymous_Access_Type then
if not Covers (Designated_Type (Typ), Nom_Subt)
and then not Covers (Nom_Subt, Designated_Type (Typ))
then
declare
Desig : Entity_Id;
begin
Desig := Designated_Type (Typ);
if Is_Class_Wide_Type (Desig) then
Desig := Etype (Desig);
end if;
if Is_Anonymous_Tagged_Base (Nom_Subt, Desig) then
null;
else
Error_Msg_NE
("type of prefix: & not compatible",
P, Nom_Subt);
Error_Msg_NE
("\with &, the expected designated type",
P, Designated_Type (Typ));
end if;
end;
end if;
elsif not Covers (Designated_Type (Typ), Nom_Subt)
or else
(not Is_Class_Wide_Type (Designated_Type (Typ))
and then Is_Class_Wide_Type (Nom_Subt))
then
Error_Msg_NE
("type of prefix: & is not covered", P, Nom_Subt);
Error_Msg_NE
("\by &, the expected designated type" &
" ('R'M 3.10.2 (27))", P, Designated_Type (Typ));
end if;
if Is_Class_Wide_Type (Designated_Type (Typ))
and then Has_Discriminants (Etype (Designated_Type (Typ)))
and then Is_Constrained (Etype (Designated_Type (Typ)))
and then Designated_Type (Typ) /= Nom_Subt
then
Apply_Discriminant_Check
(N, Etype (Designated_Type (Typ)));
end if;
elsif not Subtypes_Statically_Match
(Designated_Type (Base_Type (Typ)), Nom_Subt)
and then
not (Has_Discriminants (Designated_Type (Typ))
and then
not Is_Constrained
(Designated_Type (Base_Type (Typ))))
then
Error_Msg_N
("object subtype must statically match "
& "designated subtype", P);
if Is_Entity_Name (P)
and then Is_Array_Type (Designated_Type (Typ))
then
declare
D : constant Node_Id := Declaration_Node (Entity (P));
begin
Error_Msg_N ("aliased object has explicit bounds?",
D);
Error_Msg_N ("\declare without bounds"
& " (and with explicit initialization)?", D);
Error_Msg_N ("\for use with unconstrained access?", D);
end;
end if;
end if;
-- Check the static accessibility rule of 3.10.2(28).
-- Note that this check is not performed for the
-- case of an anonymous access type, since the access
-- attribute is always legal in such a context.
if Attr_Id /= Attribute_Unchecked_Access
and then Object_Access_Level (P) > Type_Access_Level (Btyp)
and then Ekind (Btyp) = E_General_Access_Type
then
Accessibility_Message;
return;
end if;
end if;
if Ekind (Btyp) = E_Access_Protected_Subprogram_Type
or else
Ekind (Btyp) = E_Anonymous_Access_Protected_Subprogram_Type
then
if Is_Entity_Name (P)
and then not Is_Protected_Type (Scope (Entity (P)))
then
Error_Msg_N ("context requires a protected subprogram", P);
-- Check accessibility of protected object against that
-- of the access type, but only on user code, because
-- the expander creates access references for handlers.
-- If the context is an anonymous_access_to_protected,
-- there are no accessibility checks either.
elsif Object_Access_Level (P) > Type_Access_Level (Btyp)
and then Comes_From_Source (N)
and then Ekind (Btyp) = E_Access_Protected_Subprogram_Type
and then No (Original_Access_Type (Typ))
then
Accessibility_Message;
return;
end if;
elsif (Ekind (Btyp) = E_Access_Subprogram_Type
or else
Ekind (Btyp) = E_Anonymous_Access_Subprogram_Type)
and then Ekind (Etype (N)) = E_Access_Protected_Subprogram_Type
then
Error_Msg_N ("context requires a non-protected subprogram", P);
end if;
-- The context cannot be a pool-specific type, but this is a
-- legality rule, not a resolution rule, so it must be checked
-- separately, after possibly disambiguation (see AI-245).
if Ekind (Btyp) = E_Access_Type
and then Attr_Id /= Attribute_Unrestricted_Access
then
Wrong_Type (N, Typ);
end if;
Set_Etype (N, Typ);
-- Check for incorrect atomic/volatile reference (RM C.6(12))
if Attr_Id /= Attribute_Unrestricted_Access then
if Is_Atomic_Object (P)
and then not Is_Atomic (Designated_Type (Typ))
then
Error_Msg_N
("access to atomic object cannot yield access-to-" &
"non-atomic type", P);
elsif Is_Volatile_Object (P)
and then not Is_Volatile (Designated_Type (Typ))
then
Error_Msg_N
("access to volatile object cannot yield access-to-" &
"non-volatile type", P);
end if;
end if;
-------------
-- Address --
-------------
-- Deal with resolving the type for Address attribute, overloading
-- is not permitted here, since there is no context to resolve it.
when Attribute_Address | Attribute_Code_Address =>
-- To be safe, assume that if the address of a variable is taken,
-- it may be modified via this address, so note modification.
if Is_Variable (P) then
Note_Possible_Modification (P);
end if;
if Nkind (P) in N_Subexpr
and then Is_Overloaded (P)
then
Get_First_Interp (P, Index, It);
Get_Next_Interp (Index, It);
if Present (It.Nam) then
Error_Msg_Name_1 := Aname;
Error_Msg_N
("prefix of % attribute cannot be overloaded", P);
return;
end if;
end if;
if not Is_Entity_Name (P)
or else not Is_Overloadable (Entity (P))
then
if not Is_Task_Type (Etype (P))
or else Nkind (P) = N_Explicit_Dereference
then
Resolve (P);
end if;
end if;
-- If this is the name of a derived subprogram, or that of a
-- generic actual, the address is that of the original entity.
if Is_Entity_Name (P)
and then Is_Overloadable (Entity (P))
and then Present (Alias (Entity (P)))
then
Rewrite (P,
New_Occurrence_Of (Alias (Entity (P)), Sloc (P)));
end if;
---------------
-- AST_Entry --
---------------
-- Prefix of the AST_Entry attribute is an entry name which must
-- not be resolved, since this is definitely not an entry call.
when Attribute_AST_Entry =>
null;
------------------
-- Body_Version --
------------------
-- Prefix of Body_Version attribute can be a subprogram name which
-- must not be resolved, since this is not a call.
when Attribute_Body_Version =>
null;
------------
-- Caller --
------------
-- Prefix of Caller attribute is an entry name which must not
-- be resolved, since this is definitely not an entry call.
when Attribute_Caller =>
null;
------------------
-- Code_Address --
------------------
-- Shares processing with Address attribute
-----------
-- Count --
-----------
-- If the prefix of the Count attribute is an entry name it must not
-- be resolved, since this is definitely not an entry call. However,
-- if it is an element of an entry family, the index itself may
-- have to be resolved because it can be a general expression.
when Attribute_Count =>
if Nkind (P) = N_Indexed_Component
and then Is_Entity_Name (Prefix (P))
then
declare
Indx : constant Node_Id := First (Expressions (P));
Fam : constant Entity_Id := Entity (Prefix (P));
begin
Resolve (Indx, Entry_Index_Type (Fam));
Apply_Range_Check (Indx, Entry_Index_Type (Fam));
end;
end if;
----------------
-- Elaborated --
----------------
-- Prefix of the Elaborated attribute is a subprogram name which
-- must not be resolved, since this is definitely not a call. Note
-- that it is a library unit, so it cannot be overloaded here.
when Attribute_Elaborated =>
null;
--------------------
-- Mechanism_Code --
--------------------
-- Prefix of the Mechanism_Code attribute is a function name
-- which must not be resolved. Should we check for overloaded ???
when Attribute_Mechanism_Code =>
null;
------------------
-- Partition_ID --
------------------
-- Most processing is done in sem_dist, after determining the
-- context type. Node is rewritten as a conversion to a runtime call.
when Attribute_Partition_ID =>
Process_Partition_Id (N);
return;
when Attribute_Pool_Address =>
Resolve (P);
-----------
-- Range --
-----------
-- We replace the Range attribute node with a range expression
-- whose bounds are the 'First and 'Last attributes applied to the
-- same prefix. The reason that we do this transformation here
-- instead of in the expander is that it simplifies other parts of
-- the semantic analysis which assume that the Range has been
-- replaced; thus it must be done even when in semantic-only mode
-- (note that the RM specifically mentions this equivalence, we
-- take care that the prefix is only evaluated once).
when Attribute_Range => Range_Attribute :
declare
LB : Node_Id;
HB : Node_Id;
function Check_Discriminated_Prival
(N : Node_Id)
return Node_Id;
-- The range of a private component constrained by a
-- discriminant is rewritten to make the discriminant
-- explicit. This solves some complex visibility problems
-- related to the use of privals.
--------------------------------
-- Check_Discriminated_Prival --
--------------------------------
function Check_Discriminated_Prival
(N : Node_Id)
return Node_Id
is
begin
if Is_Entity_Name (N)
and then Ekind (Entity (N)) = E_In_Parameter
and then not Within_Init_Proc
then
return Make_Identifier (Sloc (N), Chars (Entity (N)));
else
return Duplicate_Subexpr (N);
end if;
end Check_Discriminated_Prival;
-- Start of processing for Range_Attribute
begin
if not Is_Entity_Name (P)
or else not Is_Type (Entity (P))
then
Resolve (P);
end if;
-- Check whether prefix is (renaming of) private component
-- of protected type.
if Is_Entity_Name (P)
and then Comes_From_Source (N)
and then Is_Array_Type (Etype (P))
and then Number_Dimensions (Etype (P)) = 1
and then (Ekind (Scope (Entity (P))) = E_Protected_Type
or else
Ekind (Scope (Scope (Entity (P)))) =
E_Protected_Type)
then
LB :=
Check_Discriminated_Prival
(Type_Low_Bound (Etype (First_Index (Etype (P)))));
HB :=
Check_Discriminated_Prival
(Type_High_Bound (Etype (First_Index (Etype (P)))));
else
HB :=
Make_Attribute_Reference (Loc,
Prefix => Duplicate_Subexpr (P),
Attribute_Name => Name_Last,
Expressions => Expressions (N));
LB :=
Make_Attribute_Reference (Loc,
Prefix => P,
Attribute_Name => Name_First,
Expressions => Expressions (N));
end if;
-- If the original was marked as Must_Not_Freeze (see code
-- in Sem_Ch3.Make_Index), then make sure the rewriting
-- does not freeze either.
if Must_Not_Freeze (N) then
Set_Must_Not_Freeze (HB);
Set_Must_Not_Freeze (LB);
Set_Must_Not_Freeze (Prefix (HB));
Set_Must_Not_Freeze (Prefix (LB));
end if;
if Raises_Constraint_Error (Prefix (N)) then
-- Preserve Sloc of prefix in the new bounds, so that
-- the posted warning can be removed if we are within
-- unreachable code.
Set_Sloc (LB, Sloc (Prefix (N)));
Set_Sloc (HB, Sloc (Prefix (N)));
end if;
Rewrite (N, Make_Range (Loc, LB, HB));
Analyze_And_Resolve (N, Typ);
-- Normally after resolving attribute nodes, Eval_Attribute
-- is called to do any possible static evaluation of the node.
-- However, here since the Range attribute has just been
-- transformed into a range expression it is no longer an
-- attribute node and therefore the call needs to be avoided
-- and is accomplished by simply returning from the procedure.
return;
end Range_Attribute;
-----------------
-- UET_Address --
-----------------
-- Prefix must not be resolved in this case, since it is not a
-- real entity reference. No action of any kind is require!
when Attribute_UET_Address =>
return;
----------------------
-- Unchecked_Access --
----------------------
-- Processing is shared with Access
-------------------------
-- Unrestricted_Access --
-------------------------
-- Processing is shared with Access
---------
-- Val --
---------
-- Apply range check. Note that we did not do this during the
-- analysis phase, since we wanted Eval_Attribute to have a
-- chance at finding an illegal out of range value.
when Attribute_Val =>
-- Note that we do our own Eval_Attribute call here rather than
-- use the common one, because we need to do processing after
-- the call, as per above comment.
Eval_Attribute (N);
-- Eval_Attribute may replace the node with a raise CE, or
-- fold it to a constant. Obviously we only apply a scalar
-- range check if this did not happen!
if Nkind (N) = N_Attribute_Reference
and then Attribute_Name (N) = Name_Val
then
Apply_Scalar_Range_Check (First (Expressions (N)), Btyp);
end if;
return;
-------------
-- Version --
-------------
-- Prefix of Version attribute can be a subprogram name which
-- must not be resolved, since this is not a call.
when Attribute_Version =>
null;
----------------------
-- Other Attributes --
----------------------
-- For other attributes, resolve prefix unless it is a type. If
-- the attribute reference itself is a type name ('Base and 'Class)
-- then this is only legal within a task or protected record.
when others =>
if not Is_Entity_Name (P)
or else not Is_Type (Entity (P))
then
Resolve (P);
end if;
-- If the attribute reference itself is a type name ('Base,
-- 'Class) then this is only legal within a task or protected
-- record. What is this all about ???
if Is_Entity_Name (N)
and then Is_Type (Entity (N))
then
if Is_Concurrent_Type (Entity (N))
and then In_Open_Scopes (Entity (P))
then
null;
else
Error_Msg_N
("invalid use of subtype name in expression or call", N);
end if;
end if;
-- For attributes whose argument may be a string, complete
-- resolution of argument now. This avoids premature expansion
-- (and the creation of transient scopes) before the attribute
-- reference is resolved.
case Attr_Id is
when Attribute_Value =>
Resolve (First (Expressions (N)), Standard_String);
when Attribute_Wide_Value =>
Resolve (First (Expressions (N)), Standard_Wide_String);
when Attribute_Wide_Wide_Value =>
Resolve (First (Expressions (N)), Standard_Wide_Wide_String);
when others => null;
end case;
end case;
-- Normally the Freezing is done by Resolve but sometimes the Prefix
-- is not resolved, in which case the freezing must be done now.
Freeze_Expression (P);
-- Finally perform static evaluation on the attribute reference
Eval_Attribute (N);
end Resolve_Attribute;
--------------------------------
-- Stream_Attribute_Available --
--------------------------------
function Stream_Attribute_Available
(Typ : Entity_Id;
Nam : TSS_Name_Type;
Partial_View : Node_Id := Empty) return Boolean
is
Etyp : Entity_Id := Typ;
function Has_Specified_Stream_Attribute
(Typ : Entity_Id;
Nam : TSS_Name_Type) return Boolean;
-- True iff there is a visible attribute definition clause specifying
-- attribute Nam for Typ.
------------------------------------
-- Has_Specified_Stream_Attribute --
------------------------------------
function Has_Specified_Stream_Attribute
(Typ : Entity_Id;
Nam : TSS_Name_Type) return Boolean
is
begin
return False
or else
(Nam = TSS_Stream_Input
and then Has_Specified_Stream_Input (Typ))
or else
(Nam = TSS_Stream_Output
and then Has_Specified_Stream_Output (Typ))
or else
(Nam = TSS_Stream_Read
and then Has_Specified_Stream_Read (Typ))
or else
(Nam = TSS_Stream_Write
and then Has_Specified_Stream_Write (Typ));
end Has_Specified_Stream_Attribute;
-- Start of processing for Stream_Attribute_Available
begin
-- We need some comments in this body ???
if Has_Specified_Stream_Attribute (Typ, Nam) then
return True;
end if;
if Is_Class_Wide_Type (Typ) then
return not Is_Limited_Type (Typ)
or else Stream_Attribute_Available (Etype (Typ), Nam);
end if;
if Nam = TSS_Stream_Input
and then Is_Abstract (Typ)
and then not Is_Class_Wide_Type (Typ)
then
return False;
end if;
if not (Is_Limited_Type (Typ)
or else (Present (Partial_View)
and then Is_Limited_Type (Partial_View)))
then
return True;
end if;
-- In Ada 2005, Input can invoke Read, and Output can invoke Write
if Nam = TSS_Stream_Input
and then Ada_Version >= Ada_05
and then Stream_Attribute_Available (Etyp, TSS_Stream_Read)
then
return True;
elsif Nam = TSS_Stream_Output
and then Ada_Version >= Ada_05
and then Stream_Attribute_Available (Etyp, TSS_Stream_Write)
then
return True;
end if;
-- Case of Read and Write: check for attribute definition clause that
-- applies to an ancestor type.
while Etype (Etyp) /= Etyp loop
Etyp := Etype (Etyp);
if Has_Specified_Stream_Attribute (Etyp, Nam) then
return True;
end if;
end loop;
if Ada_Version < Ada_05 then
-- In Ada 95 mode, also consider a non-visible definition
declare
Btyp : constant Entity_Id := Implementation_Base_Type (Typ);
begin
return Btyp /= Typ
and then Stream_Attribute_Available
(Btyp, Nam, Partial_View => Typ);
end;
end if;
return False;
end Stream_Attribute_Available;
end Sem_Attr;
|
oeis/010/A010063.asm | neoneye/loda-programs | 11 | 164317 | <reponame>neoneye/loda-programs
; A010063: a(n+1) = a(n) + sum of digits in base 3 representation of a(n), with a(0) = 1.
; Submitted by <NAME>(s2)
; 1,2,4,6,8,12,14,18,20,24,28,30,32,36,38,42,46,50,56,60,64,68,74,80,88,92,96,100,104,110,114,118,122,128,134,142,148,154,160,168,172,176,182,188,196,202,208,214,222,228,234,240,248,252,254,258,262,266,272,276,280,284,290,296,304,310,316,322,330,334,338,344,350,358,364,370,376,384,390,396,402,410,416,422,430,438,444,450,456,464,472,480,488,492,496,500,506,512,520,526
mov $2,1
lpb $0
mov $3,$2
lpb $3
add $2,1
lpb $1,7
mul $3,2
dif $3,6
lpe
sub $3,1
lpe
sub $0,1
lpe
mov $0,$2
|
grammar/SV3_1aParser.g4 | bsp13/Surelog | 0 | 1897 | /*
Copyright 2019 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
parser grammar SV3_1aParser;
options { tokenVocab = SV3_1aLexer; }
top_level_rule : null_rule source_text EOF ; // SV files
top_level_library_rule : null_rule library_text EOF ; // .map files
library_text : ( library_descriptions )* ;
library_descriptions : library_declaration
| include_statement
| config_declaration
| SEMICOLUMN
;
library_declaration :
LIBRARY identifier file_path_spec ( COMMA file_path_spec )*
( INCDIR file_path_spec ( COMMA file_path_spec )* )? SEMICOLUMN ;
file_path_spec : (Simple_identifier | DIV | DOT | STAR | DOTSTAR | QMARK)+;
include_statement : INCLUDE file_path_spec SEMICOLUMN ;
source_text : ( timeunits_declaration )? ( description )* ;
null_rule : ; // Placeholder rule that create the "0" VObject, DO NOT REMOVE
description
: module_declaration
| udp_declaration
| interface_declaration
| program_declaration
| package_declaration
| surelog_macro_not_defined
| ( attribute_instance )* ( package_item
| bind_directive )
| config_declaration
| top_directives
;
module_nonansi_header : ( attribute_instance )* module_keyword ( lifetime )?
identifier ( package_import_declaration )* ( parameter_port_list )?
list_of_ports SEMICOLUMN ;
module_ansi_header : ( attribute_instance )* module_keyword ( lifetime )?
identifier ( package_import_declaration )* ( parameter_port_list )?
(list_of_port_declarations )? SEMICOLUMN ;
module_declaration
: module_nonansi_header ( timeunits_declaration )? ( module_item )*
ENDMODULE ( COLUMN identifier )?
| module_ansi_header ( timeunits_declaration )? ( non_port_module_item )*
ENDMODULE ( COLUMN identifier )?
| ( attribute_instance )* module_keyword ( lifetime )? identifier
OPEN_PARENS DOT STAR CLOSE_PARENS SEMICOLUMN
( timeunits_declaration )? ( module_item )* ENDMODULE
( COLUMN identifier )?
| EXTERN module_nonansi_header
| EXTERN module_ansi_header
;
module_keyword
: MODULE
| MACROMODULE
;
interface_nonansi_header :
( attribute_instance )* INTERFACE ( lifetime )? interface_identifier
( parameter_port_list )? list_of_ports SEMICOLUMN ;
interface_ansi_header :
( attribute_instance )* INTERFACE ( lifetime )? interface_identifier
( parameter_port_list )? ( list_of_port_declarations )? SEMICOLUMN ;
interface_declaration
: interface_nonansi_header ( timeunits_declaration )? ( interface_item )*
ENDINTERFACE ( COLUMN interface_identifier )?
| interface_ansi_header ( timeunits_declaration )? ( non_port_interface_item )*
ENDINTERFACE ( COLUMN interface_identifier )?
| ( attribute_instance )? INTERFACE interface_identifier
OPEN_PARENS DOT STAR CLOSE_PARENS SEMICOLUMN
( timeunits_declaration )? ( interface_item )*
ENDINTERFACE ( COLUMN interface_identifier )?
| EXTERN interface_nonansi_header
| EXTERN interface_ansi_header
;
program_nonansi_header :
( attribute_instance ) PROGRAM ( lifetime )? identifier
( parameter_port_list )? list_of_ports SEMICOLUMN ;
program_ansi_header :
( attribute_instance )* PROGRAM ( lifetime )? identifier
( parameter_port_list )? ( list_of_port_declarations )? SEMICOLUMN ;
checker_declaration :
CHECKER identifier ( OPEN_PARENS checker_port_list? CLOSE_PARENS )? SEMICOLUMN
( ( attribute_instance )* checker_or_generate_item )* ENDCHECKER ( COLUMN identifier )?
;
program_declaration
: program_nonansi_header ( timeunits_declaration )? ( program_item )*
ENDPROGRAM ( COLUMN identifier )?
| program_ansi_header ( timeunits_declaration )? ( non_port_program_item )*
ENDPROGRAM ( COLUMN identifier )?
| ( attribute_instance )* PROGRAM identifier
OPEN_PARENS DOT STAR CLOSE_PARENS SEMICOLUMN
( timeunits_declaration )? ( program_item )*
ENDPROGRAM ( COLUMN identifier )?
| EXTERN program_nonansi_header
| EXTERN program_ansi_header
;
class_declaration
: ( VIRTUAL )? CLASS ( lifetime )? identifier ( parameter_port_list )?
( EXTENDS class_type ( OPEN_PARENS list_of_arguments CLOSE_PARENS )? )?
( IMPLEMENTS interface_class_type ( COMMA interface_class_type )* )?
SEMICOLUMN
( class_item )*
ENDCLASS ( COLUMN identifier )?
;
interface_class_type :
ps_identifier ( parameter_value_assignment )? ;
interface_class_declaration :
INTERFACE CLASS identifier ( parameter_port_list )?
( EXTENDS interface_class_type ( COMMA interface_class_type )* )? SEMICOLUMN ( interface_class_item )*
ENDCLASS ( COLUMN identifier )?
;
interface_class_item : type_declaration
| ( attribute_instance )* interface_class_method SEMICOLUMN
| local_parameter_declaration SEMICOLUMN
| parameter_declaration SEMICOLUMN
| SEMICOLUMN
;
interface_class_method :
PURE VIRTUAL method_prototype ;
package_declaration
: ( attribute_instance )* PACKAGE identifier SEMICOLUMN
( timeunits_declaration )? ( ( attribute_instance )* package_item )*
ENDPACKAGE ( COLUMN identifier )?
;
timeunits_declaration
: TIMEUNIT time_literal DIV time_literal SEMICOLUMN # TimeUnitsDecl_TimeUnitDiv
| TIMEUNIT time_literal SEMICOLUMN # TimeUnitsDecl_TimeUnit
| TIMEPRECISION time_literal SEMICOLUMN # TimeUnitsDecl_TimePrecision
| TIMEUNIT time_literal SEMICOLUMN TIMEPRECISION
time_literal SEMICOLUMN # TimeUnitsDecl_TimeUnitTimePrecision
| TIMEPRECISION time_literal SEMICOLUMN TIMEUNIT
time_literal SEMICOLUMN # TimeUnitsDecl_TimePrecisionTimeUnit
;
parameter_port_list
: POUND OPEN_PARENS list_of_param_assignments
( COMMA parameter_port_declaration )* CLOSE_PARENS
| POUND OPEN_PARENS parameter_port_declaration
( COMMA parameter_port_declaration )* CLOSE_PARENS
| POUND OPEN_PARENS CLOSE_PARENS
;
parameter_port_declaration
: parameter_declaration
| local_parameter_declaration
| data_type list_of_param_assignments
| TYPE list_of_type_assignments
;
list_of_ports : OPEN_PARENS port ( COMMA port )* CLOSE_PARENS ;
list_of_port_declarations : OPEN_PARENS ( ( attribute_instance )*
ansi_port_declaration ( COMMA ( attribute_instance )*
ansi_port_declaration )* )? CLOSE_PARENS ;
port_declaration
: ( attribute_instance )* ( inout_declaration
| input_declaration
| output_declaration
| ref_declaration
| interface_port_declaration );
port
: (port_expression)?
| DOT identifier OPEN_PARENS (port_expression)? CLOSE_PARENS
;
port_expression :
port_reference
| OPEN_CURLY port_reference ( COMMA port_reference )* CLOSE_CURLY
;
port_reference : identifier constant_select ;
port_direction
: INPUT # PortDir_Inp
| OUTPUT # PortDir_Out
| INOUT # PortDir_Inout
| REF # PortDir_Ref
;
net_port_header : ( port_direction )? net_port_type ;
variable_port_header : ( port_direction )? variable_port_type ;
interface_port_header
: interface_identifier ( DOT identifier )?
| INTERFACE ( DOT identifier )?
;
ansi_port_declaration
: ( net_port_header | interface_port_header ) identifier
( unpacked_dimension )* ( ASSIGN_OP constant_expression )?
| ( variable_port_header )? identifier variable_dimension*
( ASSIGN_OP constant_expression )?
| ( net_port_header | variable_port_header) DOT identifier OPEN_PARENS
( expression )? CLOSE_PARENS
;
elaboration_system_task
: DOLLAR Simple_identifier ( ( OPEN_PARENS number ( COMMA list_of_arguments )? CLOSE_PARENS )? SEMICOLUMN
| ( OPEN_PARENS list_of_arguments CLOSE_PARENS )? SEMICOLUMN )
;
module_common_item
: module_or_generate_item_declaration
| interface_instantiation
| program_instantiation
| assertion_item
| bind_directive
| continuous_assign
| net_alias
| initial_construct
| final_construct
| always_construct
| loop_generate_construct
| conditional_generate_construct
| elaboration_system_task
| system_task
;
module_item
: port_declaration SEMICOLUMN
| non_port_module_item
;
module_or_generate_item
: ( attribute_instance )* ( parameter_override
| gate_instantiation
| udp_instantiation
| module_instantiation
| module_common_item
) ;
module_or_generate_item_declaration
: package_or_generate_item_declaration
| genvar_declaration
| clocking_declaration
| DEFAULT CLOCKING identifier SEMICOLUMN
| DEFAULT DISABLE IFF expression_or_dist SEMICOLUMN
;
non_port_module_item
: generated_module_instantiation
| module_or_generate_item
| specify_block
| ( attribute_instance )* specparam_declaration
| program_declaration
| module_declaration
| timeunits_declaration
| system_task
| surelog_macro_not_defined
| pragma_directive
;
parameter_override : DEFPARAM list_of_defparam_assignments SEMICOLUMN ;
bind_directive : BIND ( dollar_root_keyword )? identifier (( OPEN_BRACKET constant_expression CLOSE_BRACKET )* DOT identifier)* constant_select
bind_instantiation ;
bind_instantiation
: program_instantiation
| module_instantiation
| interface_instantiation
| checker_instantiation
;
interface_or_generate_item
: ( attribute_instance )* ( module_common_item
| MODPORT modport_item ( COMMA modport_item )* SEMICOLUMN
| extern_tf_declaration )
;
extern_tf_declaration
: EXTERN method_prototype SEMICOLUMN
| EXTERN FORKJOIN task_prototype SEMICOLUMN
;
interface_item
: port_declaration SEMICOLUMN
| non_port_interface_item
;
non_port_interface_item
: generated_interface_instantiation
| ( attribute_instance )* specparam_declaration
| interface_or_generate_item
| program_declaration
| interface_declaration
| timeunits_declaration
| surelog_macro_not_defined
;
program_item
: port_declaration SEMICOLUMN
| non_port_program_item
;
non_port_program_item
: ( attribute_instance )* ( continuous_assign
| module_or_generate_item_declaration
| specparam_declaration
| initial_construct
| final_construct
| concurrent_assertion_item )
| timeunits_declaration
| program_generate_item
| surelog_macro_not_defined
;
program_generate_item :
loop_generate_construct
| conditional_generate_construct
| generate_region
| elaboration_system_task
;
checker_port_list :
checker_port_item ( COMMA checker_port_item )? ;
checker_port_item :
attribute_instance* (INPUT | OUTPUT)? property_formal_type identifier
variable_dimension* ( ASSIGN_OP property_actual_arg )? ;
checker_or_generate_item
: checker_or_generate_item_declaration
| initial_construct
| always_construct
| final_construct
| assertion_item
| continuous_assign
| checker_generate_item
;
checker_or_generate_item_declaration
: RAND* data_declaration
| function_declaration
| checker_declaration
| assertion_item_declaration
| covergroup_declaration
| overload_declaration
| genvar_declaration
| clocking_declaration
| DEFAULT CLOCKING identifier SEMICOLUMN
| DEFAULT DISABLE IFF expression_or_dist SEMICOLUMN
| SEMICOLUMN
| surelog_macro_not_defined
;
checker_generate_item
: loop_generate_construct
| conditional_generate_construct
| generate_region
| elaboration_system_task
;
class_item
: ( attribute_instance )* ( class_property
| class_method
| class_constraint
| type_declaration
| class_declaration
| covergroup_declaration )
| local_parameter_declaration SEMICOLUMN
| parameter_declaration SEMICOLUMN
| surelog_macro_not_defined
| SEMICOLUMN
;
class_property
: ( const_type )? ( property_qualifier )* data_declaration
| const_type ( class_item_qualifier )* data_type identifier
( ASSIGN_OP constant_expression )? SEMICOLUMN
;
pure_virtual_qualifier : PURE VIRTUAL ;
extern_qualifier : EXTERN ;
class_method
: ( method_qualifier )* (task_declaration | function_declaration | class_constructor_declaration)
| pure_virtual_qualifier ( class_item_qualifier )* method_prototype SEMICOLUMN
| extern_qualifier ( method_qualifier )* ( method_prototype SEMICOLUMN | class_constructor_prototype )
;
class_constructor_prototype : FUNCTION NEW ( OPEN_PARENS ( tf_port_list )? CLOSE_PARENS )?;
class_constraint
: constraint_prototype
| constraint_declaration
;
class_item_qualifier
: STATIC # ClassItemQualifier_Static
| PROTECTED # ClassItemQualifier_Protected
| LOCAL # ClassItemQualifier_Local
;
property_qualifier
: RAND # PropQualifier_Rand
| RANDC # PropQualifier_Randc
| class_item_qualifier # PropQualifier_ClassItem
;
method_qualifier
: VIRTUAL # MethodQualifier_Virtual
| class_item_qualifier # MethodQualifier_ClassItem
;
method_prototype
: task_prototype
| function_prototype
;
super_dot_new : SUPER DOT NEW ;
class_constructor_declaration
: FUNCTION ( class_scope )? NEW ( OPEN_PARENS ( tf_port_list )? CLOSE_PARENS )? SEMICOLUMN
( block_item_declaration )*
( super_dot_new ( OPEN_PARENS list_of_arguments CLOSE_PARENS )? SEMICOLUMN )?
( function_statement_or_null )*
ENDFUNCTION ( COLUMN NEW )? ;
constraint_declaration : ( STATIC )? CONSTRAINT identifier constraint_block ;
constraint_block : OPEN_CURLY ( constraint_block_item )* CLOSE_CURLY ;
constraint_block_item
: SOLVE solve_before_list BEFORE solve_before_list SEMICOLUMN
| constraint_expression
;
solve_before_list :
constraint_primary ( COMMA constraint_primary )* ;
constraint_primary :
( implicit_class_handle DOT | class_scope )? ( dollar_root_keyword )? identifier (( OPEN_BRACKET constant_expression CLOSE_BRACKET )* DOT identifier)* select ;
constraint_expression
: SOFT? expression_or_dist SEMICOLUMN
| uniqueness_constraint SEMICOLUMN
| expression IMPLY constraint_set
| IF OPEN_PARENS expression CLOSE_PARENS constraint_set
( ELSE constraint_set )?
| FOREACH OPEN_PARENS ps_or_hierarchical_array_identifier OPEN_BRACKET loop_variables
CLOSE_BRACKET CLOSE_PARENS constraint_set
| DISABLE SOFT constraint_primary SEMICOLUMN
;
uniqueness_constraint :
UNIQUE OPEN_CURLY open_range_list CLOSE_CURLY ;
constraint_set
: constraint_expression
| OPEN_CURLY ( constraint_expression )* CLOSE_CURLY
;
dist_list : dist_item ( COMMA dist_item )* ;
dist_item : value_range ( dist_weight )? ;
/* Replaced by COLUMN DIV : ASSIGN_RANGE : ':/' ; */
dist_weight
: ASSIGN_VALUE expression # DistWeight_AssignValue
| COLUMN DIV expression # DistWeight_AssignRange
;
constraint_prototype : (extern_qualifier | pure_keyword )? ( STATIC )? CONSTRAINT identifier SEMICOLUMN ;
extern_constraint_declaration :
( STATIC )? CONSTRAINT class_scope identifier constraint_block ;
identifier_list : identifier ( COMMA identifier )* ;
package_item
: package_or_generate_item_declaration
| specparam_declaration
| anonymous_program
| package_export_declaration
| timeunits_declaration
;
package_or_generate_item_declaration
: net_declaration
| data_declaration
| task_declaration
| function_declaration
| checker_declaration
| dpi_import_export
| extern_constraint_declaration
| class_declaration
| interface_class_declaration
| class_constructor_declaration
| parameter_declaration SEMICOLUMN
| local_parameter_declaration SEMICOLUMN
| covergroup_declaration
| overload_declaration
| assertion_item_declaration
| SEMICOLUMN
;
anonymous_program : PROGRAM SEMICOLUMN ( anonymous_program_item )* ENDPROGRAM ;
anonymous_program_item
: task_declaration
| function_declaration
| class_declaration
| covergroup_declaration
| class_constructor_declaration
| SEMICOLUMN
| surelog_macro_not_defined
;
local_parameter_declaration
: LOCALPARAM ( data_type_or_implicit list_of_param_assignments
| TYPE list_of_param_assignments )
;
parameter_declaration
: PARAMETER ( data_type_or_implicit list_of_param_assignments
| TYPE list_of_type_assignments )
;
specparam_declaration :
SPECPARAM ( packed_dimension )? list_of_specparam_assignments SEMICOLUMN ;
inout_declaration : INOUT net_port_type list_of_port_identifiers ;
input_declaration
: INPUT ( net_port_type list_of_port_identifiers
| variable_port_type? list_of_variable_identifiers )
;
output_declaration
: OUTPUT ( net_port_type list_of_port_identifiers
| variable_port_type? list_of_variable_port_identifiers )
;
interface_port_declaration
: interface_identifier list_of_interface_identifiers
| interface_identifier DOT identifier
list_of_interface_identifiers
;
ref_declaration : REF variable_port_type list_of_variable_identifiers ;
data_declaration
: ( const_type )? ( var_type )? ( lifetime )? variable_declaration
| type_declaration
| package_import_declaration
| net_type_declaration
;
variable_declaration : ( data_type
| signing ( packed_dimension )*
| ( packed_dimension )+
)
list_of_variable_decl_assignments SEMICOLUMN ;
package_import_declaration :
IMPORT package_import_item ( COMMA package_import_item )* SEMICOLUMN ;
package_import_item
: identifier COLUMNCOLUMN ( identifier | STAR )
;
package_export_declaration
: EXPORT STARCOLUMNCOLUMNSTAR SEMICOLUMN
| EXPORT package_import_item ( COMMA package_import_item )? SEMICOLUMN
;
genvar_declaration : GENVAR identifier_list SEMICOLUMN ;
net_declaration
: net_type ( drive_strength | charge_strength )? ( VECTORED | SCALARED )?
data_type_or_implicit ( delay3 )? list_of_net_decl_assignments SEMICOLUMN
| identifier delay_control? list_of_net_decl_assignments SEMICOLUMN
| INTERCONNECT implicit_data_type ( pound_delay_value )? identifier unpacked_dimension*
( COMMA identifier unpacked_dimension* )? SEMICOLUMN
;
type_declaration
: TYPEDEF
(
( (data_type | net_type) identifier variable_dimension* )
| ( identifier constant_bit_select DOT identifier identifier )
| ( ( enum_keyword | struct_keyword | union_keyword | class_keyword | interface_class_keyword )? identifier )
)
SEMICOLUMN
;
enum_keyword : ENUM;
struct_keyword : STRUCT;
union_keyword : UNION;
class_keyword : CLASS;
interface_class_keyword : INTERFACE CLASS;
net_type_declaration
: NETTYPE
(
( data_type identifier ( WITH ( package_scope | class_scope )? identifier )? )
| ( ( package_scope | class_scope )? identifier identifier )
)
SEMICOLUMN
;
lifetime
: STATIC # Lifetime_Static
| AUTOMATIC # Lifetime_Automatic
;
casting_type
: simple_type
| primary_literal
// | ( package_scope | class_scope )? identifier constant_select ( OPEN_BRACKET constant_range_expression CLOSE_BRACKET )?
// | constant_concatenation ( OPEN_BRACKET constant_range_expression CLOSE_BRACKET )?
// | constant_multiple_concatenation ( OPEN_BRACKET constant_range_expression CLOSE_BRACKET )?
// | subroutine_call
// | OPEN_PARENS constant_mintypmax_expression CLOSE_PARENS
| OPEN_PARENS constant_expression CLOSE_PARENS
// | casting_type TICK ( OPEN_PARENS constant_expression CLOSE_PARENS | constant_concatenation | constant_multiple_concatenation )
// | constant_assignment_pattern_expression
// | type_reference
| signing
| string_type
| const_type
| system_task
;
data_type
: integer_vector_type ( signing )? ( packed_dimension )*
| integer_atom_type ( signing )?
| non_integer_type
| struct_union ( packed_keyword ( signing )? )? OPEN_CURLY struct_union_member ( struct_union_member )* CLOSE_CURLY ( packed_dimension )*
| ENUM ( enum_base_type )? OPEN_CURLY enum_name_declaration ( COMMA enum_name_declaration )* CLOSE_CURLY
| string_type
| chandle_type
| VIRTUAL ( INTERFACE )? interface_identifier ( parameter_value_assignment )? ( DOT identifier )?
| ( class_scope | package_scope )? identifier ( ( packed_dimension )+ | (( parameter_value_assignment )? ( COLUMNCOLUMN identifier ( parameter_value_assignment )? )*) )
| event_type
| type_reference
;
packed_keyword : PACKED;
string_type : STRING ;
string_value : String ;
chandle_type : CHANDLE ;
event_type : EVENT ;
const_type : CONST ;
var_type : VAR ;
data_type_or_implicit
: data_type
| ( signing )? ( packed_dimension )*
;
implicit_data_type :
signing? packed_dimension*;
enum_base_type
: integer_atom_type ( signing )?
| integer_vector_type ( signing )? ( packed_dimension )?
| identifier ( packed_dimension )?
;
enum_name_declaration
: identifier
( OPEN_BRACKET Integral_number ( COLUMN Integral_number )? CLOSE_BRACKET )?
( ASSIGN_OP constant_expression )?
;
class_scope : class_type COLUMNCOLUMN ;
// identifier was inlined to lexer tokens for parsing speed
class_type :
( Simple_identifier
| Escaped_identifier
| THIS
| RANDOMIZE
| SAMPLE
| DOLLAR_UNIT ) ( parameter_value_assignment )? ( COLUMNCOLUMN identifier ( parameter_value_assignment )? )*
;
integer_type
: integer_vector_type
| integer_atom_type
;
integer_atom_type
: BYTE # IntegerAtomType_Byte
| SHORTINT # IntegerAtomType_Shortint
| INT # IntegerAtomType_Int
| LONGINT # IntegerAtomType_LongInt
| INTEGER # IntegerAtomType_Int
| TIME # IntegerAtomType_Time
;
integer_vector_type
: BIT # IntVec_TypeBit
| LOGIC # IntVec_TypeLogic
| REG # IntVec_TypeReg
;
non_integer_type
: SHORTREAL # NonIntType_ShortReal
| REAL # NonIntType_Real
| REALTIME # NonIntType_RealTime
;
net_type
: SUPPLY0
| SUPPLY1
| TRI
| TRIAND
| TRIOR
| TRIREG
| TRI0
| TRI1
| UWIRE
| WIRE
| WAND
| WOR
;
net_port_type :
net_type? data_type_or_implicit
| identifier
| INTERCONNECT implicit_data_type ;
variable_port_type
: var_data_type
| OPEN_BRACKET constant_range CLOSE_BRACKET
;
var_data_type :
data_type
| var_type data_type_or_implicit ;
signing
: SIGNED # Signing_Signed
| UNSIGNED # Signing_Unsigned
;
simple_type
: integer_type
| non_integer_type
| ps_type_identifier
;
random_qualifier :
RAND # RandomQualifier_Rand
| RANDC # RandomQualifier_RandC
;
struct_union_member :
( attribute_instance )* ( random_qualifier )? data_type_or_void list_of_variable_decl_assignments SEMICOLUMN ;
data_type_or_void
: data_type
| VOID
;
struct_union
: struct_keyword
| union_keyword ( tagged_keyword )?
;
tagged_keyword : TAGGED;
type_reference :
TYPE OPEN_PARENS expression CLOSE_PARENS | TYPE OPEN_PARENS data_type CLOSE_PARENS ;
drive_strength
: OPEN_PARENS ( SUPPLY0 | STRONG0 | PULL0 | WEAK0 ) COMMA ( SUPPLY1 | STRONG1 | PULL1 | WEAK1 | HIGHZ1 ) CLOSE_PARENS
| OPEN_PARENS ( SUPPLY1 | STRONG1 | PULL1 | WEAK1 | HIGHZ1 ) COMMA ( SUPPLY0 | STRONG0 | PULL0 | WEAK0 | HIGHZ0 ) CLOSE_PARENS
| OPEN_PARENS HIGHZ0 COMMA ( SUPPLY1 | STRONG1 | PULL1 | WEAK1 ) CLOSE_PARENS
| OPEN_PARENS HIGHZ1 COMMA ( SUPPLY0 | STRONG0 | PULL0 | WEAK0 ) CLOSE_PARENS
;
strength0
: SUPPLY0
| STRONG0
| PULL0
| WEAK0
;
strength1
: SUPPLY1
| STRONG1
| PULL1
| WEAK1
;
charge_strength
: SMALL
| MEDIUM
| LARGE
;
delay3
: pound_delay_value
| POUND OPEN_PARENS mintypmax_expression ( COMMA mintypmax_expression
( COMMA mintypmax_expression )? )? CLOSE_PARENS
;
delay2
: pound_delay_value
| POUND OPEN_PARENS mintypmax_expression
( COMMA mintypmax_expression )? CLOSE_PARENS
;
pound_delay_value
: Pound_delay (time_unit)?
| POUND delay_value ;
delay_value
: Integral_number
| Real_number
| ps_identifier
| time_literal
| ONESTEP
| ps_or_hierarchical_identifier
//REMOVED | Decimal_number
;
list_of_defparam_assignments : defparam_assignment ( COMMA defparam_assignment )* ;
list_of_interface_identifiers : interface_identifier ( unpacked_dimension )*
( COMMA interface_identifier ( unpacked_dimension )* )* ;
list_of_net_decl_assignments : net_decl_assignment ( COMMA net_decl_assignment )* ;
list_of_param_assignments : param_assignment ( COMMA param_assignment )* ;
list_of_port_identifiers : identifier ( unpacked_dimension )*
( COMMA identifier ( unpacked_dimension )* )* ;
list_of_specparam_assignments : specparam_assignment ( COMMA specparam_assignment )* ;
list_of_tf_variable_identifiers : identifier variable_dimension* ( ASSIGN_OP expression )?
( COMMA identifier variable_dimension* ( ASSIGN_OP expression )? )* ;
list_of_type_assignments : (identifier (ASSIGN_OP data_type)? ) ( COMMA (identifier (ASSIGN_OP data_type)? ) )* ;
list_of_variable_decl_assignments : variable_decl_assignment ( COMMA variable_decl_assignment )* ;
list_of_variable_identifiers : identifier variable_dimension*
( COMMA identifier variable_dimension* )* ;
list_of_variable_port_identifiers : identifier variable_dimension* ( ASSIGN_OP constant_expression )?
( COMMA identifier variable_dimension* ( ASSIGN_OP constant_expression )? )* ;
list_of_virtual_interface_decl :
identifier ( ASSIGN_OP identifier )?
( COMMA identifier ( ASSIGN_OP identifier )? )* ;
defparam_assignment : hierarchical_identifier ASSIGN_OP constant_mintypmax_expression ;
net_decl_assignment : identifier ( unpacked_dimension )* ( ASSIGN_OP expression )? ;
param_assignment : identifier ( unpacked_dimension )* (ASSIGN_OP constant_param_expression)? ;
specparam_assignment
: identifier ASSIGN_OP constant_mintypmax_expression
| pulse_control_specparam
;
pulse_control_specparam
: PATHPULSE DOLLAR ASSIGN_OP OPEN_PARENS constant_mintypmax_expression
( COMMA constant_mintypmax_expression )? CLOSE_PARENS SEMICOLUMN
| PATHPULSE DOLLAR specify_input_terminal_descriptor
DOLLAR specify_output_terminal_descriptor ASSIGN_OP OPEN_PARENS
constant_mintypmax_expression ( COMMA constant_mintypmax_expression )? CLOSE_PARENS SEMICOLUMN
;
variable_decl_assignment
: identifier ( (ASSIGN_OP class_new )
| ( unsized_dimension variable_dimension* ( ASSIGN_OP dynamic_array_new )?)
| ( ASSIGN_OP NEW ( OPEN_PARENS list_of_arguments CLOSE_PARENS )?)
| (variable_dimension* ( ASSIGN_OP expression )?) )
// | ASSIGN_OP NEW ( OPEN_PARENS list_of_arguments CLOSE_PARENS )?
;
class_new : (class_scope)? NEW ( OPEN_PARENS list_of_arguments CLOSE_PARENS | expression )? ;
dynamic_array_new : NEW OPEN_BRACKET expression CLOSE_BRACKET ( OPEN_PARENS expression CLOSE_PARENS )? ;
unpacked_dimension
: OPEN_BRACKET constant_range CLOSE_BRACKET
| OPEN_BRACKET constant_expression CLOSE_BRACKET
| unsized_dimension
;
packed_dimension
: OPEN_BRACKET constant_range CLOSE_BRACKET
| unsized_dimension
;
associative_dimension
: OPEN_BRACKET data_type CLOSE_BRACKET
| ASSOCIATIVE_UNSPECIFIED
;
variable_dimension
: unsized_dimension
| unpacked_dimension
| associative_dimension
| queue_dimension
;
queue_dimension : OPEN_BRACKET DOLLAR ( COLUMN constant_expression )? CLOSE_BRACKET ;
unsized_dimension : OPEN_BRACKET CLOSE_BRACKET ;
function_data_type
: data_type
| VOID
;
function_data_type_or_implicit
: function_data_type
| ( signing )? ( packed_dimension )*
;
function_declaration : FUNCTION ( lifetime )? function_body_declaration ;
function_body_declaration
: function_data_type_or_implicit
( interface_identifier DOT | class_scope )? identifier SEMICOLUMN
( tf_item_declaration )*
( function_statement_or_null )*
ENDFUNCTION ( COLUMN identifier )?
| function_data_type_or_implicit
( interface_identifier DOT | class_scope )? identifier OPEN_PARENS
( tf_port_list )? CLOSE_PARENS SEMICOLUMN
( block_item_declaration )*
( function_statement_or_null )*
ENDFUNCTION ( COLUMN identifier )?
;
function_prototype : FUNCTION function_data_type_or_implicit identifier ( OPEN_PARENS ( tf_port_list )? CLOSE_PARENS )?;
dpi_import_export
: IMPORT string_value ( context_keyword | pure_keyword )? ( Simple_identifier ASSIGN_OP )? function_prototype SEMICOLUMN
| IMPORT string_value ( context_keyword )? ( Simple_identifier ASSIGN_OP )? task_prototype SEMICOLUMN
| EXPORT string_value ( Simple_identifier ASSIGN_OP )? (function_name_decl | task_name_decl) SEMICOLUMN
;
context_keyword : CONTEXT ;
function_name_decl : FUNCTION identifier;
task_name_decl : TASK identifier;
pure_keyword : PURE;
task_declaration : TASK ( lifetime )? task_body_declaration ;
task_body_declaration
: ( interface_identifier DOT | class_scope )? identifier SEMICOLUMN
( tf_item_declaration )*
( statement_or_null )*
ENDTASK ( COLUMN identifier )?
| ( interface_identifier DOT | class_scope )? identifier OPEN_PARENS (tf_port_list )? CLOSE_PARENS SEMICOLUMN
( block_item_declaration )*
( statement_or_null )*
ENDTASK ( COLUMN identifier )?
;
tf_item_declaration
: block_item_declaration
| tf_port_declaration
;
tf_port_list : tf_port_item ( COMMA tf_port_item )* ;
tf_port_item : ( attribute_instance )*
( tf_port_direction )? ( var_type )? data_type_or_implicit
identifier variable_dimension* ( ASSIGN_OP expression )? ;
tf_port_direction
: INPUT # TfPortDir_Inp
| OUTPUT # TfPortDir_Out
| INOUT # TfPortDir_Inout
| REF # TfPortDir_Ref
| CONST REF # TfPortDir_ConstRef
;
tf_port_declaration : ( attribute_instance )* tf_port_direction ( var_type )?
data_type_or_implicit list_of_tf_variable_identifiers SEMICOLUMN ;
task_prototype : TASK identifier ( OPEN_PARENS ( tf_port_list )? CLOSE_PARENS )?;
block_item_declaration
: ( attribute_instance )* ( data_declaration
| local_parameter_declaration
| parameter_declaration SEMICOLUMN
| overload_declaration )
;
overload_declaration : BIND overload_operator FUNCTION data_type identifier
OPEN_PARENS overload_proto_formals CLOSE_PARENS SEMICOLUMN ;
overload_operator
: PLUS # OverloadOp_Plus
| PLUSPLUS # OverloadOp_PlusPlus
| MINUS # OverloadOp_Minus
| MINUSMINUS # OverloadOp_MinusMinus
| STAR # OverloadOp_Mult
| STARSTAR # OverloadOp_StarStar
| DIV # OverloadOp_Div
| PERCENT # OverloadOp_Percent
| EQUIV # OverloadOp_Equiv
| NOTEQUAL # OverloadOp_NotEqual
| LESS # OverloadOp_Less
| LESS_EQUAL # OverloadOp_LessEqual
| GREATER # OverloadOp_Greater
| GREATER_EQUAL # OverloadOp_GreaterEqual
| ASSIGN_OP # OverloadOp_Equal
;
overload_proto_formals : data_type ( COMMA data_type)* ;
virtual_interface_declaration : VIRTUAL ( INTERFACE )? interface_identifier
list_of_virtual_interface_decl SEMICOLUMN ;
modport_item : identifier OPEN_PARENS modport_ports_declaration ( COMMA modport_ports_declaration )* CLOSE_PARENS ;
modport_ports_declaration
: ( attribute_instance )* ( modport_simple_ports_declaration
| modport_hierarchical_ports_declaration
| modport_tf_ports_declaration
| CLOCKING identifier )
;
modport_simple_ports_declaration : port_direction modport_simple_port
( COMMA modport_simple_port )* ;
modport_simple_port
: identifier
| DOT identifier OPEN_PARENS ( expression )*
CLOSE_PARENS
;
modport_hierarchical_ports_declaration : identifier
( OPEN_BRACKET constant_expression CLOSE_BRACKET )?
DOT identifier ;
modport_tf_ports_declaration : ( IMPORT | EXPORT ) modport_tf_port ( COMMA modport_tf_port )* ;
modport_tf_port
: method_prototype
| identifier
;
concurrent_assertion_item
: ( identifier COLUMN )? concurrent_assertion_statement
| checker_instantiation
;
concurrent_assertion_statement
: assert_property_statement
| assume_property_statement
| cover_property_statement
| cover_sequence_statement
| restrict_property_statement
;
assert_property_statement :
ASSERT PROPERTY OPEN_PARENS property_spec CLOSE_PARENS action_block ;
assume_property_statement :
ASSUME PROPERTY OPEN_PARENS property_spec CLOSE_PARENS action_block ;
cover_property_statement :
COVER PROPERTY OPEN_PARENS property_spec CLOSE_PARENS statement_or_null ;
expect_property_statement :
EXPECT OPEN_PARENS property_spec CLOSE_PARENS action_block ;
cover_sequence_statement :
COVER SEQUENCE OPEN_PARENS ( clocking_event )? ( DISABLE IFF OPEN_PARENS expression_or_dist CLOSE_PARENS )?
sequence_expr CLOSE_PARENS statement_or_null ;
restrict_property_statement :
RESTRICT PROPERTY OPEN_PARENS property_spec CLOSE_PARENS SEMICOLUMN ;
property_instance :
ps_or_hierarchical_sequence_identifier ( OPEN_PARENS ( actual_arg_list )? CLOSE_PARENS )? ;
property_actual_arg
: property_expr
| sequence_actual_arg
;
concurrent_assertion_item_declaration
: property_declaration
| sequence_declaration
;
assertion_item_declaration
: property_declaration
| sequence_declaration
| let_declaration
;
property_declaration :
PROPERTY identifier ( OPEN_PARENS ( property_port_list )? CLOSE_PARENS )? SEMICOLUMN
( assertion_variable_declaration )*
property_spec (SEMICOLUMN)?
ENDPROPERTY ( COLUMN identifier )? ;
property_port_list : property_port_item ( COMMA property_port_item )* ;
property_port_item :
( attribute_instance )* ( LOCAL ( property_lvar_port_direction )? )? property_formal_type
identifier ( variable_dimension )* ( ASSIGN_OP property_actual_arg )? ;
property_lvar_port_direction : INPUT ;
property_formal_type
: sequence_formal_type
| PROPERTY
;
property_spec :
( clocking_event )? ( DISABLE IFF OPEN_PARENS expression_or_dist CLOSE_PARENS )? property_expr ;
property_expr
: sequence_expr
| STRONG OPEN_PARENS sequence_expr CLOSE_PARENS
| WEAK OPEN_PARENS sequence_expr CLOSE_PARENS
| OPEN_PARENS property_expr CLOSE_PARENS
| NOT property_expr
| property_expr OR property_expr
| property_expr AND property_expr
| sequence_expr OVERLAP_IMPLY property_expr
| sequence_expr NON_OVERLAP_IMPLY property_expr
| IF OPEN_PARENS expression_or_dist CLOSE_PARENS property_expr
( ELSE property_expr )?
| CASE OPEN_PARENS expression_or_dist CLOSE_PARENS property_case_item property_case_item* ENDCASE
| sequence_expr OVERLAPPED property_expr
| sequence_expr NONOVERLAPPED property_expr
| NEXTTIME property_expr
| NEXTTIME OPEN_BRACKET constant_expression CLOSE_BRACKET property_expr
| S_NEXTTIME property_expr
| S_NEXTTIME OPEN_BRACKET constant_expression CLOSE_BRACKET property_expr
| ALWAYS property_expr
| ALWAYS OPEN_BRACKET cycle_delay_const_range_expression CLOSE_BRACKET property_expr
| S_ALWAYS OPEN_BRACKET constant_range CLOSE_BRACKET property_expr
| S_EVENTUALLY property_expr
| EVENTUALLY OPEN_BRACKET constant_range CLOSE_BRACKET property_expr
| S_EVENTUALLY OPEN_BRACKET cycle_delay_const_range_expression CLOSE_BRACKET property_expr
| property_expr UNTIL property_expr
| property_expr S_UNTIL property_expr
| property_expr UNTIL_WITH property_expr
| property_expr S_UNTIL_WITH property_expr
| property_expr IMPLIES property_expr
| property_expr IFF property_expr
| ACCEPT_ON OPEN_PARENS expression_or_dist CLOSE_PARENS property_expr
| REJECT_ON OPEN_PARENS expression_or_dist CLOSE_PARENS property_expr
| SYNC_ACCEPT_ON OPEN_PARENS expression_or_dist CLOSE_PARENS property_expr
| SYNC_REJECT_ON OPEN_PARENS expression_or_dist CLOSE_PARENS property_expr
| property_instance
| clocking_event property_expr
;
property_case_item
: expression_or_dist ( COMMA expression_or_dist )* COLUMN property_expr SEMICOLUMN?
| DEFAULT COLUMN? property_expr SEMICOLUMN?
;
sequence_declaration :
SEQUENCE identifier ( OPEN_PARENS ( sequence_port_list )? CLOSE_PARENS )? SEMICOLUMN
( assertion_variable_declaration )*
sequence_expr (SEMICOLUMN)?
ENDSEQUENCE ( COLUMN identifier )?
;
sequence_expr
: cycle_delay_range sequence_expr ( cycle_delay_range sequence_expr )*
| sequence_expr cycle_delay_range sequence_expr ( cycle_delay_range sequence_expr )*
| expression_or_dist ( boolean_abbrev )?
| OPEN_PARENS expression_or_dist ( COMMA sequence_match_item )* CLOSE_PARENS ( boolean_abbrev )?
| sequence_instance ( consecutive_repetition )?
| OPEN_PARENS sequence_expr ( COMMA sequence_match_item )* CLOSE_PARENS
( consecutive_repetition )?
| sequence_expr AND sequence_expr
| sequence_expr INTERSECT sequence_expr
| sequence_expr OR sequence_expr
| FIRST_MATCH OPEN_PARENS sequence_expr ( COMMA sequence_match_item )*
CLOSE_PARENS
| expression_or_dist THROUGHOUT sequence_expr
| sequence_expr WITHIN sequence_expr
| clocking_event sequence_expr
;
cycle_delay_range
: POUNDPOUND constant_primary
| POUNDPOUND OPEN_BRACKET cycle_delay_const_range_expression
CLOSE_BRACKET
| POUNDPOUND ASSOCIATIVE_UNSPECIFIED
| POUNDPOUND OPEN_BRACKET PLUS CLOSE_BRACKET
;
sequence_method_call : sequence_instance DOT identifier ;
sequence_match_item
: operator_assignment
| inc_or_dec_expression
| subroutine_call
;
sequence_port_list :
sequence_port_item ( COMMA sequence_port_item )* ;
sequence_port_item :
( attribute_instance )* ( LOCAL ( sequence_lvar_port_direction )? )? sequence_formal_type
identifier ( variable_dimension )* ( ASSIGN_OP sequence_actual_arg )? ;
sequence_lvar_port_direction
: INPUT # SeqLvarPortDir_Input
| INOUT # SeqLvarPortDir_Inout
| OUTPUT # SeqLvarPortDir_Output
;
sequence_formal_type
: data_type_or_implicit # SeqFormatType_Data
| SEQUENCE # SeqFormatType_Sequence
| UNTYPED # SeqFormatType_Untyped
;
sequence_instance :
ps_or_hierarchical_sequence_identifier ( OPEN_PARENS sequence_list_of_arguments CLOSE_PARENS )? ;
sequence_list_of_arguments
: sequence_actual_arg? ( COMMA sequence_actual_arg? )*
( COMMA DOT identifier OPEN_PARENS sequence_actual_arg? CLOSE_PARENS )*
| DOT identifier OPEN_PARENS sequence_actual_arg? CLOSE_PARENS
( COMMA DOT identifier OPEN_PARENS sequence_actual_arg? CLOSE_PARENS )*
;
sequence_actual_arg
: event_expression
| sequence_expr
;
actual_arg_list
: actual_arg_expr ( COMMA actual_arg_expr )*
| DOT identifier OPEN_PARENS actual_arg_expr CLOSE_PARENS
( COMMA DOT identifier OPEN_PARENS actual_arg_expr CLOSE_PARENS )*
;
actual_arg_expr
: event_expression
| dollar_keyword
;
boolean_abbrev
: consecutive_repetition
| non_consecutive_repetition
| goto_repetition
;
consecutive_repetition : CONSECUTIVE_REP const_or_range_expression CLOSE_BRACKET ;
non_consecutive_repetition : NON_CONSECUTIVE_REP const_or_range_expression CLOSE_BRACKET ;
goto_repetition : GOTO_REP const_or_range_expression CLOSE_BRACKET ;
const_or_range_expression
: constant_expression
| cycle_delay_const_range_expression
;
cycle_delay_const_range_expression
: constant_expression COLUMN constant_expression
| constant_expression COLUMN DOLLAR
;
expression_or_dist : expression ( DIST OPEN_CURLY dist_list CLOSE_CURLY )? ;
assertion_variable_declaration :
data_type list_of_variable_identifiers SEMICOLUMN ;
let_declaration :
LET identifier ( OPEN_PARENS ( let_port_list )? CLOSE_PARENS )? ASSIGN_OP expression SEMICOLUMN ;
let_port_list :
let_port_item ( COMMA let_port_item)* ;
let_port_item :
( attribute_instance )* let_formal_type identifier ( variable_dimension )* ( ASSIGN_OP expression )? ;
let_formal_type :
data_type_or_implicit
| UNTYPED ;
/*
let_expression :
( package_scope )? identifier ( OPEN_PARENS list_of_arguments CLOSE_PARENS )? ;
*/
covergroup_declaration :
COVERGROUP identifier ( OPEN_PARENS ( tf_port_list )? CLOSE_PARENS )? ( coverage_event )? SEMICOLUMN
( coverage_spec_or_option )*
ENDGROUP ( COLUMN identifier )? ;
coverage_spec_or_option
: ( attribute_instance )* ( coverage_spec
| coverage_option SEMICOLUMN )
;
coverage_option
: OPTION_DOT identifier ASSIGN_OP expression
| TYPE_OPTION_DOT identifier ASSIGN_OP expression
;
coverage_spec
: cover_point
| cover_cross
;
coverage_event
: clocking_event
| WITH FUNCTION SAMPLE OPEN_PARENS tf_port_list? CLOSE_PARENS
| ATAT OPEN_PARENS block_event_expression CLOSE_PARENS
;
block_event_expression
: block_event_expression OR block_event_expression
| BEGIN hierarchical_btf_identifier
| END hierarchical_btf_identifier
;
hierarchical_btf_identifier
: hierarchical_identifier
| ( dollar_root_keyword )? identifier (( OPEN_BRACKET constant_expression CLOSE_BRACKET )* DOT identifier)* ( class_scope )? identifier
;
cover_point : ( identifier COLUMN )? COVERPOINT expression ( IFF OPEN_PARENS expression CLOSE_PARENS )? bins_or_empty ;
bins_or_empty
: OPEN_CURLY ( attribute_instance )*
( bins_or_options SEMICOLUMN )* CLOSE_CURLY
| SEMICOLUMN
;
bins_or_options
: coverage_option
| ( WILDCARD )? bins_keyword identifier ( OPEN_BRACKET ( expression )? CLOSE_BRACKET )?
ASSIGN_OP OPEN_CURLY range_list CLOSE_CURLY ( WITH OPEN_PARENS expression CLOSE_PARENS )?
( IFF OPEN_PARENS expression CLOSE_PARENS )?
| ( WILDCARD )? bins_keyword identifier ( OPEN_BRACKET ( expression )? CLOSE_BRACKET )? ASSIGN_OP
identifier ( WITH OPEN_PARENS expression CLOSE_PARENS )?
( IFF OPEN_PARENS expression CLOSE_PARENS )?
| ( WILDCARD )? bins_keyword identifier ( OPEN_BRACKET ( expression )? CLOSE_BRACKET )? ASSIGN_OP
expression ( IFF OPEN_PARENS expression CLOSE_PARENS )?
| ( WILDCARD )? bins_keyword identifier ( unsized_dimension )?
ASSIGN_OP trans_list ( IFF OPEN_PARENS expression CLOSE_PARENS )?
| bins_keyword identifier ( OPEN_BRACKET ( expression )? CLOSE_BRACKET )?
ASSIGN_OP DEFAULT ( IFF OPEN_PARENS expression CLOSE_PARENS )?
| bins_keyword identifier ASSIGN_OP DEFAULT SEQUENCE
( IFF OPEN_PARENS expression CLOSE_PARENS )?
;
bins_keyword
: BINS # Bins_Bins
| ILLEGAL_BINS # Bins_Illegal
| IGNORE_BINS # Bins_Ignore
;
range_list : value_range ( COMMA value_range )* ;
trans_list : OPEN_PARENS trans_set CLOSE_PARENS ( COMMA OPEN_PARENS trans_set CLOSE_PARENS )* ;
trans_set : trans_range_list ( TRANSITION_OP trans_range_list )* ;
trans_range_list
: range_list
| range_list CONSECUTIVE_REP repeat_range CLOSE_BRACKET
| range_list GOTO_REP repeat_range CLOSE_BRACKET
| range_list NON_CONSECUTIVE_REP repeat_range CLOSE_BRACKET
;
repeat_range
: expression
| expression COLUMN expression
;
cover_cross : ( identifier COLUMN )? CROSS list_of_cross_items ( IFF OPEN_PARENS expression CLOSE_PARENS )? cross_body ;
list_of_cross_items : cross_item COMMA cross_item ( COMMA cross_item )* ;
cross_item
: identifier
| identifier
;
cross_body
: OPEN_CURLY ( cross_body_item SEMICOLUMN )? CLOSE_CURLY
| SEMICOLUMN
;
cross_body_item
: function_declaration
| bins_selection_or_option SEMICOLUMN
;
bins_selection_or_option
: ( attribute_instance )* ( coverage_option
| bins_selection )
;
bins_selection : bins_keyword identifier ASSIGN_OP select_expression ( IFF OPEN_PARENS expression CLOSE_PARENS )? ;
select_expression
: select_condition
| BANG select_condition
| select_expression ( binary_operator_prec10 | binary_operator_prec11 ) select_expression
| OPEN_PARENS select_expression CLOSE_PARENS
| select_expression WITH OPEN_PARENS expression CLOSE_PARENS ( matches expression )?
| identifier
| expression ( matches expression )?
;
select_condition : BINSOF OPEN_PARENS bins_expression CLOSE_PARENS ( INTERSECT OPEN_CURLY open_range_list CLOSE_CURLY )? ;
bins_expression
: identifier ( DOT identifier )?
;
open_range_list : value_range ( COMMA value_range )* ;
gate_instantiation
: cmos_switchtype ( delay3 )? cmos_switch_instance ( COMMA cmos_switch_instance )* SEMICOLUMN
| enable_gatetype ( drive_strength )? ( delay3 )? enable_gate_instance ( COMMA enable_gate_instance )* SEMICOLUMN
| mos_switchtype ( delay3 )? mos_switch_instance ( COMMA mos_switch_instance )* SEMICOLUMN
| n_input_gatetype ( drive_strength )? ( delay2 )? n_input_gate_instance ( COMMA n_input_gate_instance )* SEMICOLUMN
| n_output_gatetype ( drive_strength )? ( delay2 )? n_output_gate_instance
( COMMA n_output_gate_instance )* SEMICOLUMN
| pass_en_switchtype ( delay2 )? pass_enable_switch_instance ( COMMA pass_enable_switch_instance )* SEMICOLUMN
| pass_switchtype pass_switch_instance ( COMMA pass_switch_instance )* SEMICOLUMN
| PULLDOWN ( pulldown_strength )? pull_gate_instance ( COMMA pull_gate_instance )* SEMICOLUMN
| PULLUP ( pullup_strength )? pull_gate_instance ( COMMA pull_gate_instance )* SEMICOLUMN
;
cmos_switch_instance : ( name_of_instance )? OPEN_PARENS net_lvalue COMMA expression COMMA
expression COMMA expression CLOSE_PARENS ;
enable_gate_instance : ( name_of_instance )? OPEN_PARENS net_lvalue COMMA expression COMMA expression CLOSE_PARENS ;
mos_switch_instance : ( name_of_instance )? OPEN_PARENS net_lvalue COMMA expression COMMA expression CLOSE_PARENS ;
n_input_gate_instance : ( name_of_instance )? OPEN_PARENS net_lvalue COMMA expression ( COMMA expression )* CLOSE_PARENS ;
n_output_gate_instance : ( name_of_instance )? OPEN_PARENS net_lvalue ( COMMA net_lvalue )* COMMA
expression CLOSE_PARENS ;
pass_switch_instance : ( name_of_instance )? OPEN_PARENS net_lvalue COMMA net_lvalue CLOSE_PARENS ;
pass_enable_switch_instance : ( name_of_instance )? OPEN_PARENS net_lvalue COMMA net_lvalue COMMA
expression CLOSE_PARENS ;
pull_gate_instance : ( name_of_instance )? OPEN_PARENS net_lvalue CLOSE_PARENS ;
pulldown_strength
: OPEN_PARENS strength0 COMMA strength1 CLOSE_PARENS
| OPEN_PARENS strength1 COMMA strength0 CLOSE_PARENS
| OPEN_PARENS strength0 CLOSE_PARENS
;
pullup_strength
: OPEN_PARENS strength0 COMMA strength1 CLOSE_PARENS
| OPEN_PARENS strength1 COMMA strength0 CLOSE_PARENS
| OPEN_PARENS strength1 CLOSE_PARENS
;
cmos_switchtype
: CMOS # CmosSwitchType_Cmos
| RCMOS # CmosSwitchType_RCmos
;
enable_gatetype
: BUFIF0 # EnableGateType_Bufif0
| BUFIF1 # EnableGateType_Bufif1
| NOTIF0 # EnableGateType_Notif0
| NOTIF1 # EnableGateType_Notif1
;
mos_switchtype
: NMOS # MosSwitchType_NMos
| PMOS # MosSwitchType_PMos
| RNMOS # MosSwitchType_RNMos
| RPMOS # MosSwitchType_RPMos
;
n_input_gatetype
: AND # NInpGate_And
| NAND # NInpGate_Nand
| OR # NInpGate_Or
| NOR # NInpGate_Nor
| XOR # NInpGate_Xor
| XNOR # NInpGate_Xnor
;
n_output_gatetype
: BUF # NOutGate_Buf
| NOT # NOutGate_Not
;
pass_en_switchtype
: TRANIF0 # PassEnSwitch_Tranif0
| TRANIF1 # PassEnSwitch_Tranif1
| RTRANIF1 # PassEnSwitch_RTranif1
| RTRANIF0 # PassEnSwitch_RTranif0
;
pass_switchtype
: TRAN # PassSwitch_Tran
| RTRAN # PassSwitch_RTran
;
module_instantiation : identifier ( parameter_value_assignment )?
hierarchical_instance ( COMMA hierarchical_instance )* SEMICOLUMN ;
parameter_value_assignment : POUND (OPEN_PARENS list_of_parameter_assignments? CLOSE_PARENS)
| Pound_delay
| POUND Simple_identifier
;
list_of_parameter_assignments
: ordered_parameter_assignment ( COMMA ordered_parameter_assignment )*
| named_parameter_assignment ( COMMA named_parameter_assignment )*
;
ordered_parameter_assignment : param_expression ;
named_parameter_assignment : DOT identifier OPEN_PARENS ( param_expression )? CLOSE_PARENS ;
hierarchical_instance : name_of_instance OPEN_PARENS list_of_port_connections CLOSE_PARENS ;
name_of_instance : identifier ( unpacked_dimension )* ;
list_of_port_connections
: ordered_port_connection ( COMMA ordered_port_connection )*
| named_port_connection ( COMMA named_port_connection )*
;
ordered_port_connection : ( attribute_instance )* ( expression )? ;
named_port_connection
: ( attribute_instance )* ( DOT identifier ( OPEN_PARENS ( expression )? CLOSE_PARENS )?
| DOTSTAR )
;
interface_instantiation : interface_identifier ( parameter_value_assignment )?
hierarchical_instance ( COMMA hierarchical_instance )* SEMICOLUMN ;
program_instantiation : identifier ( parameter_value_assignment )?
hierarchical_instance ( COMMA hierarchical_instance )* SEMICOLUMN ;
checker_instantiation :
ps_identifier name_of_instance OPEN_PARENS list_of_checker_port_connections CLOSE_PARENS ;
list_of_checker_port_connections
: ordered_checker_port_connection ( COMMA ordered_checker_port_connection )?
| named_checker_port_connection ( COMMA named_checker_port_connection )?
;
ordered_checker_port_connection :
( attribute_instance )* property_actual_arg? ;
named_checker_port_connection
: ( attribute_instance )* ( DOT identifier ( OPEN_PARENS property_actual_arg? CLOSE_PARENS )?
| DOTSTAR )
;
generated_module_instantiation : GENERATE ( generate_module_item )* ENDGENERATE ;
generate_module_item
: generate_module_conditional_statement
| generate_module_case_statement
| generate_module_loop_statement
| ( identifier COLUMN )?
generate_module_block
| module_or_generate_item
;
generate_module_conditional_statement :
IF OPEN_PARENS constant_expression CLOSE_PARENS generate_module_item
( ELSE generate_module_item )? ;
generate_module_case_statement :
CASE OPEN_PARENS constant_expression CLOSE_PARENS genvar_module_case_item
( genvar_module_case_item )* ENDCASE ;
genvar_module_case_item
: constant_expression ( COMMA constant_expression )* COLUMN generate_module_item
| DEFAULT ( COLUMN )? generate_module_item
;
generate_module_loop_statement :
FOR OPEN_PARENS genvar_decl_assignment SEMICOLUMN constant_expression
SEMICOLUMN genvar_assignment CLOSE_PARENS
generate_module_named_block ;
genvar_assignment
: identifier assignment_operator constant_expression
| inc_or_dec_operator identifier
| identifier inc_or_dec_operator
;
genvar_decl_assignment :
( GENVAR )? identifier ASSIGN_OP constant_expression ;
generate_module_named_block
: BEGIN COLUMN identifier ( generate_module_item )*
END ( COLUMN identifier )?
| identifier COLUMN generate_module_block
;
generate_module_block :
BEGIN ( COLUMN identifier )? ( generate_module_item )* END ( COLUMN identifier )? ;
generated_interface_instantiation : GENERATE ( generate_interface_item )* ENDGENERATE ;
generate_interface_item
: generate_interface_conditional_statement
| generate_interface_case_statement
| generate_interface_loop_statement
| ( identifier COLUMN ) generate_interface_block
| interface_or_generate_item
;
generate_interface_conditional_statement :
IF OPEN_PARENS constant_expression CLOSE_PARENS generate_interface_item ( ELSE generate_interface_item )? ;
generate_interface_case_statement :
CASE OPEN_PARENS constant_expression CLOSE_PARENS
genvar_interface_case_item ( genvar_interface_case_item )* ENDCASE ;
genvar_interface_case_item
: constant_expression ( COMMA constant_expression )* COLUMN generate_interface_item
| DEFAULT ( COLUMN )? generate_interface_item
;
generate_interface_loop_statement :
FOR OPEN_PARENS genvar_decl_assignment SEMICOLUMN constant_expression
SEMICOLUMN genvar_assignment CLOSE_PARENS
generate_interface_named_block ;
generate_interface_named_block
: BEGIN COLUMN identifier ( generate_interface_item )*
END ( COLUMN identifier )?
| identifier COLUMN generate_interface_block
;
generate_interface_block :
BEGIN ( COLUMN identifier )?
( generate_interface_item )*
END ( COLUMN identifier )? ;
generate_region :
GENERATE generate_item* ENDGENERATE;
loop_generate_construct :
FOR OPEN_PARENS genvar_initialization SEMICOLUMN constant_expression SEMICOLUMN genvar_iteration CLOSE_PARENS generate_block ;
genvar_initialization :
GENVAR? identifier ASSIGN_OP constant_expression ;
genvar_iteration
: identifier assignment_operator constant_expression
| inc_or_dec_operator identifier
| identifier inc_or_dec_operator
;
conditional_generate_construct
: if_generate_construct
| case_generate_construct
;
if_generate_construct :
IF OPEN_PARENS constant_expression CLOSE_PARENS generate_block ( ELSE generate_block )? ;
case_generate_construct :
CASE OPEN_PARENS constant_expression CLOSE_PARENS case_generate_item case_generate_item* ENDCASE ;
case_generate_item
: constant_expression ( COMMA constant_expression )* COLUMN generate_block
| DEFAULT ( COLUMN )? generate_block
;
generate_block
: generate_item
| ( identifier COLUMN )? BEGIN ( COLUMN identifier )? generate_item* END
( COLUMN identifier )?
;
generate_item
: module_or_generate_item
| interface_or_generate_item
| checker_or_generate_item
;
udp_nonansi_declaration : ( attribute_instance )* PRIMITIVE identifier
OPEN_PARENS udp_port_list CLOSE_PARENS SEMICOLUMN ;
udp_ansi_declaration : ( attribute_instance )* PRIMITIVE identifier
OPEN_PARENS udp_declaration_port_list CLOSE_PARENS SEMICOLUMN ;
udp_declaration
: udp_nonansi_declaration udp_port_declaration ( udp_port_declaration )*
udp_body
ENDPRIMITIVE ( COLUMN identifier )?
| udp_ansi_declaration
udp_body
ENDPRIMITIVE ( COLUMN identifier )?
| EXTERN udp_nonansi_declaration
| EXTERN udp_ansi_declaration
| ( attribute_instance )* PRIMITIVE identifier OPEN_PARENS DOTSTAR
CLOSE_PARENS SEMICOLUMN
( udp_port_declaration )*
udp_body
ENDPRIMITIVE ( COLUMN identifier )?
;
udp_port_list : identifier COMMA identifier ( COMMA identifier )* ;
udp_declaration_port_list : udp_output_declaration COMMA
udp_input_declaration ( COMMA udp_input_declaration )* ;
udp_port_declaration
: udp_output_declaration SEMICOLUMN
| udp_input_declaration SEMICOLUMN
| udp_reg_declaration SEMICOLUMN
;
udp_output_declaration
: ( attribute_instance )* ( OUTPUT identifier
| OUTPUT REG identifier ( ASSIGN_OP constant_expression )?)
;
udp_input_declaration : ( attribute_instance )* INPUT identifier_list ;
udp_reg_declaration : ( attribute_instance )* REG identifier ;
udp_body
: combinational_body
| sequential_body
;
combinational_body : TABLE combinational_entry ( combinational_entry )* ENDTABLE ;
combinational_entry : level_input_list COLUMN output_symbol SEMICOLUMN ;
sequential_body : ( udp_initial_statement )? TABLE sequential_entry
( sequential_entry )* ENDTABLE ;
udp_initial_statement : INITIAL identifier ASSIGN_OP init_val SEMICOLUMN ;
init_val
: ONE_TICK_b0 # InitVal_1Tickb0
| ONE_TICK_b1 # InitVal_1Tickb1
| ONE_TICK_B0 # InitVal_1TickB0
| ONE_TICK_B1 # InitVal_1TickB1
| ONE_TICK_bx # InitVal_1Tickbx
| ONE_TICK_bX # InitVal_1TickbX
| ONE_TICK_Bx # InitVal_1TickBx
| ONE_TICK_BX # InitVal_1TickBX
| Integral_number # InitVal_Integral
;
sequential_entry : seq_input_list COLUMN level_symbol COLUMN next_state SEMICOLUMN ;
seq_input_list
: level_input_list
| edge_input_list
;
level_input_list : level_symbol ( level_symbol )* ;
edge_input_list : ( level_symbol )* edge_indicator ( level_symbol )* ;
edge_indicator
: OPEN_PARENS /* Will have to check post parse time that there are 2 items (10 becomes one int): */
level_symbol+ CLOSE_PARENS
| edge_symbol
;
next_state
: output_symbol
| MINUS
;
output_symbol : Integral_number | Simple_identifier ;
level_symbol : Integral_number | Simple_identifier | QMARK ;
edge_symbol : Simple_identifier | STAR ;
udp_instantiation : identifier ( drive_strength )? ( delay2 )?
udp_instance ( COMMA udp_instance )* SEMICOLUMN ;
udp_instance : ( name_of_instance )? OPEN_PARENS net_lvalue COMMA
expression ( COMMA expression )* CLOSE_PARENS ;
continuous_assign
: ASSIGN ( drive_strength )? ( delay3 )? list_of_net_assignments SEMICOLUMN
| ASSIGN_OP ( delay_control )? list_of_variable_assignments SEMICOLUMN
;
list_of_net_assignments : net_assignment ( COMMA net_assignment )* ;
list_of_variable_assignments : variable_assignment ( COMMA variable_assignment )* ;
net_alias : ALIAS net_lvalue (ASSIGN_OP net_lvalue)+ SEMICOLUMN ;
net_assignment : net_lvalue ASSIGN_OP expression ;
initial_construct : INITIAL statement_or_null ;
always_construct : always_keyword statement ;
always_keyword
: ALWAYS # AlwaysKeywd_Always
| ALWAYS_COMB # AlwaysKeywd_Comb
| ALWAYS_LATCH # AlwaysKeywd_Latch
| ALWAYS_FF # AlwaysKeywd_FF
;
blocking_assignment
: variable_lvalue ASSIGN_OP delay_or_event_control expression
| nonrange_variable_lvalue ASSIGN_OP dynamic_array_new
| ( implicit_class_handle DOT | class_scope | package_scope )? hierarchical_identifier
select ASSIGN_OP class_new
| operator_assignment
;
operator_assignment : variable_lvalue assignment_operator expression ;
assignment_operator
: ASSIGN_OP
| ADD_ASSIGN
| SUB_ASSIGN
| MULT_ASSIGN
| DIV_ASSIGN
| MODULO_ASSIGN
| BITW_AND_ASSIGN
| BITW_OR_ASSIGN
| BITW_XOR_ASSIGN
| BITW_LEFT_SHIFT_ASSIGN
| BITW_RIGHT_SHIFT_ASSIGN
| ARITH_SHIFT_LEFT_ASSIGN
| ARITH_SHIFT_RIGHT_ASSIGN
;
nonblocking_assignment : variable_lvalue LESS_EQUAL ( delay_or_event_control )? expression ;
procedural_continuous_assignment
: ASSIGN variable_assignment
| DEASSIGN variable_lvalue
| FORCE (variable_assignment | net_assignment)
| RELEASE (variable_lvalue | net_lvalue)
;
variable_assignment : variable_lvalue ASSIGN_OP expression ;
action_block
: statement_or_null
| ( statement )? ELSE statement_or_null
;
seq_block :
BEGIN ( COLUMN identifier )? ( block_item_declaration )* ( statement_or_null )*
END ( COLUMN identifier )? ;
par_block :
FORK ( COLUMN identifier )? ( block_item_declaration )* ( statement_or_null )*
(join_keyword | join_any_keyword | join_none_keyword ) ( COLUMN identifier )? ;
join_keyword : JOIN ;
join_any_keyword : JOIN_ANY ;
join_none_keyword : JOIN_NONE ;
statement_or_null
: statement
| ( attribute_instance )* SEMICOLUMN
;
statement : ( identifier COLUMN )? ( attribute_instance )* statement_item ;
statement_item
: blocking_assignment SEMICOLUMN
| nonblocking_assignment SEMICOLUMN
| procedural_continuous_assignment SEMICOLUMN
| case_statement
| conditional_statement
| inc_or_dec_expression SEMICOLUMN
| subroutine_call_statement
| disable_statement
| event_trigger
| loop_statement
| jump_statement
| par_block
| procedural_timing_control_statement
| seq_block
| wait_statement
| procedural_assertion_statement
| clocking_drive SEMICOLUMN
| randsequence_statement
| randcase_statement
| expect_property_statement
| system_task
| surelog_macro_not_defined
;
function_statement_or_null
: statement
| ( attribute_instance )* SEMICOLUMN
;
procedural_timing_control_statement :
procedural_timing_control statement_or_null ;
delay_or_event_control
: delay_control
| event_control
| REPEAT OPEN_PARENS expression CLOSE_PARENS
event_control
;
delay_control
: pound_delay_value
| POUND OPEN_PARENS mintypmax_expression CLOSE_PARENS
;
event_control
: AT hierarchical_identifier
| AT OPEN_PARENS event_expression CLOSE_PARENS
| ATSTAR
| AT_PARENS_STAR
| AT ps_or_hierarchical_sequence_identifier
;
event_expression
: ( edge_identifier )? expression ( IFF expression )?
| sequence_instance ( IFF expression )?
| event_expression (or_operator | comma_operator) event_expression
| OPEN_PARENS event_expression CLOSE_PARENS
;
or_operator : OR ;
comma_operator : COMMA ;
procedural_timing_control
: delay_control
| event_control
| cycle_delay
;
jump_statement
: RETURN ( expression )? SEMICOLUMN
| BREAK SEMICOLUMN
| CONTINUE SEMICOLUMN
;
final_construct : FINAL statement ;
wait_statement
: WAIT (( OPEN_PARENS expression CLOSE_PARENS statement_or_null ) | ( FORK SEMICOLUMN ))
| WAIT_ORDER OPEN_PARENS hierarchical_identifier (COMMA hierarchical_identifier )* CLOSE_PARENS action_block
;
event_trigger
: IMPLY hierarchical_identifier SEMICOLUMN
| NON_BLOCKING_TRIGGER_EVENT_OP ( delay_or_event_control )?
hierarchical_identifier SEMICOLUMN
;
disable_statement
: DISABLE ( hierarchical_identifier | FORK ) SEMICOLUMN
;
conditional_statement :
( unique_priority )? IF OPEN_PARENS cond_predicate CLOSE_PARENS statement_or_null
( ELSE IF OPEN_PARENS cond_predicate CLOSE_PARENS statement_or_null )*
( ELSE statement_or_null )* ;
unique_priority
: UNIQUE
| UNIQUE0
| PRIORITY ;
cond_predicate :
expression_or_cond_pattern ( COND_PRED_OP expression_or_cond_pattern )* ;
expression_or_cond_pattern
: expression (matches pattern)?
;
matches : MATCHES;
case_statement
: ( unique_priority )? case_keyword OPEN_PARENS expression CLOSE_PARENS
( ( case_item ( case_item )* )
| ( MATCHES case_pattern_item ( case_pattern_item )* )
| ( INSIDE case_inside_item ( case_inside_item )* ) )
ENDCASE
;
case_keyword
: CASE
| CASEZ
| CASEX
;
case_item
: expression ( COMMA expression )* COLUMN statement_or_null
| DEFAULT ( COLUMN )? statement_or_null
;
case_pattern_item
: pattern ( COND_PRED_OP expression )? COLUMN statement_or_null
| DEFAULT ( COLUMN )? statement_or_null
;
case_inside_item
: open_range_list COLUMN statement_or_null
| DEFAULT ( COLUMN )? statement_or_null
;
randcase_statement :
RANDCASE randcase_item ( randcase_item )* ENDCASE ;
randcase_item : expression COLUMN statement_or_null ;
pattern
: DOT identifier
| DOTSTAR
| constant_expression
| TAGGED identifier ( pattern )?
| TICK OPEN_CURLY pattern ( COMMA pattern )* CLOSE_CURLY
| TICK OPEN_CURLY identifier COLUMN pattern ( COMMA identifier COLUMN pattern )* CLOSE_CURLY
;
assignment_pattern :
TICK OPEN_CURLY expression ( COMMA expression )* CLOSE_CURLY
| TICK OPEN_CURLY structure_pattern_key COLUMN expression ( COMMA structure_pattern_key COLUMN expression )* CLOSE_CURLY
| TICK OPEN_CURLY array_pattern_key COLUMN expression ( COMMA array_pattern_key COLUMN expression )* CLOSE_CURLY
// | TICK OPEN_CURLY constant_expression OPEN_CURLY expression ( COMMA expression )* CLOSE_CURLY CLOSE_CURLY
| TICK OPEN_CURLY constant_expression OPEN_CURLY expression ( (CLOSE_CURLY ( COMMA expression )*) | (( COMMA expression )* CLOSE_CURLY)) CLOSE_CURLY
| TICK OPEN_CURLY CLOSE_CURLY
;
structure_pattern_key : identifier
| assignment_pattern_key
;
array_pattern_key
: constant_expression
| assignment_pattern_key
;
assignment_pattern_key
: simple_type
| DEFAULT
;
assignment_pattern_expression
: ( assignment_pattern_expression_type )? assignment_pattern;
assignment_pattern_expression_type
: ps_type_identifier
| ps_identifier
| integer_atom_type
| type_reference
;
constant_assignment_pattern_expression :
assignment_pattern_expression ;
assignment_pattern_net_lvalue :
TICK OPEN_CURLY net_lvalue ( COMMA net_lvalue )* CLOSE_CURLY;
assignment_pattern_variable_lvalue :
TICK OPEN_CURLY variable_lvalue ( COMMA variable_lvalue )* CLOSE_CURLY
;
loop_statement
: FOREVER statement_or_null
| (REPEAT | WHILE) OPEN_PARENS expression CLOSE_PARENS statement_or_null
| FOR OPEN_PARENS for_initialization? SEMICOLUMN expression? SEMICOLUMN
for_step? CLOSE_PARENS statement_or_null
| DO statement_or_null WHILE OPEN_PARENS expression CLOSE_PARENS SEMICOLUMN
| FOREACH OPEN_PARENS ps_or_hierarchical_array_identifier OPEN_BRACKET loop_variables
CLOSE_BRACKET CLOSE_PARENS statement
;
for_initialization
: list_of_variable_assignments
| for_variable_declaration ( COMMA for_variable_declaration )*
;
for_variable_declaration :
VAR? data_type identifier ASSIGN_OP expression ( COMMA identifier ASSIGN_OP expression )* ;
for_step : for_step_assignment ( COMMA for_step_assignment )* ;
for_step_assignment
: operator_assignment
| inc_or_dec_expression
| subroutine_call
;
loop_variables : ( identifier )? ( COMMA ( identifier )? )* ;
subroutine_call_statement
: subroutine_call SEMICOLUMN
| VOID TICK OPEN_PARENS subroutine_call CLOSE_PARENS SEMICOLUMN
;
assertion_item
: concurrent_assertion_item
| deferred_immediate_assertion_item
;
deferred_immediate_assertion_item :
( identifier COLUMN )? deferred_immediate_assertion_statement ;
procedural_assertion_statement
: concurrent_assertion_statement
| immediate_assertion_statement
| checker_instantiation
;
immediate_assertion_statement
: simple_immediate_assertion_statement
| deferred_immediate_assertion_statement
;
simple_immediate_assertion_statement
: simple_immediate_assert_statement
| simple_immediate_assume_statement
| simple_immediate_cover_statement
;
simple_immediate_assert_statement :
ASSERT OPEN_PARENS expression CLOSE_PARENS action_block ;
simple_immediate_assume_statement :
ASSUME OPEN_PARENS expression CLOSE_PARENS action_block ;
simple_immediate_cover_statement :
COVER OPEN_PARENS expression CLOSE_PARENS statement_or_null ;
deferred_immediate_assertion_statement
: deferred_immediate_assert_statement
| deferred_immediate_assume_statement
| deferred_immediate_cover_statement
;
deferred_immediate_assert_statement
: ASSERT Pound_delay OPEN_PARENS expression CLOSE_PARENS action_block
| ASSERT FINAL ( expression ) action_block
;
deferred_immediate_assume_statement
: ASSUME Pound_delay OPEN_PARENS expression CLOSE_PARENS action_block
| ASSUME FINAL OPEN_PARENS expression CLOSE_PARENS action_block
;
deferred_immediate_cover_statement
: COVER Pound_delay OPEN_PARENS expression CLOSE_PARENS statement_or_null
| COVER FINAL OPEN_PARENS expression CLOSE_PARENS statement_or_null
;
clocking_declaration : ( DEFAULT )? CLOCKING ( identifier )? clocking_event SEMICOLUMN
( clocking_item )* ENDCLOCKING ( COLUMN identifier )?
| GLOBAL CLOCKING identifier? clocking_event SEMICOLUMN ENDCLOCKING ( COLUMN identifier )?
;
clocking_event
: AT identifier
| AT OPEN_PARENS event_expression CLOSE_PARENS
;
clocking_item
: DEFAULT default_skew SEMICOLUMN
| clocking_direction list_of_clocking_decl_assign SEMICOLUMN
| ( attribute_instance )* concurrent_assertion_item_declaration
;
default_skew
: INPUT clocking_skew # DefaultSkew_Intput
| OUTPUT clocking_skew # DefaultSkew_Output
| INPUT clocking_skew OUTPUT clocking_skew # DefaultSkew_IntputOutput
;
clocking_direction
: INPUT ( clocking_skew )? # ClockingDir_Input
| OUTPUT ( clocking_skew )? # ClockingDir_Output
| INPUT ( clocking_skew )? OUTPUT ( clocking_skew )? # ClockingDir_InputOutput
| INOUT # ClockingDir_Inout
;
list_of_clocking_decl_assign : clocking_decl_assign ( COMMA clocking_decl_assign )* ;
clocking_decl_assign : identifier ( ASSIGN_OP ( dollar_root_keyword )? identifier (( OPEN_BRACKET constant_expression CLOSE_BRACKET )* DOT identifier)* )? ;
clocking_skew
: edge_identifier ( delay_control )?
| delay_control
;
edge_identifier :
POSEDGE # Edge_Posedge
| NEGEDGE # Edge_Negedge
| EDGE # Edge_Edge
;
clocking_drive
: clockvar_expression LESS_EQUAL ( cycle_delay )? expression
| cycle_delay clockvar_expression LESS_EQUAL expression
;
cycle_delay
: POUNDPOUND Integral_number
| POUNDPOUND identifier
| POUNDPOUND OPEN_PARENS expression CLOSE_PARENS
;
clockvar : ( dollar_root_keyword )? identifier (( OPEN_BRACKET constant_expression CLOSE_BRACKET )* DOT identifier)* ;
clockvar_expression : clockvar select ;
randsequence_statement : RANDSEQUENCE OPEN_PARENS ( identifier )? CLOSE_PARENS
production ( production )*
ENDSEQUENCE ;
production : ( function_data_type )? identifier ( OPEN_PARENS tf_port_list
CLOSE_PARENS )? COLUMN rs_rule ( BITW_OR rs_rule )* SEMICOLUMN ;
rs_rule : rs_production_list ( ASSIGN_VALUE expression ( rs_code_block )? )? ;
rs_production_list
: rs_prod ( rs_prod )*
| RAND JOIN ( OPEN_PARENS expression CLOSE_PARENS )? production_item
production_item ( production_item )*
;
rs_code_block : OPEN_CURLY ( data_declaration )* ( statement_or_null )*
CLOSE_CURLY ;
rs_prod
: production_item
| rs_code_block
| rs_if_else
| rs_repeat
| rs_case
;
production_item : identifier ( OPEN_PARENS list_of_arguments CLOSE_PARENS )? ;
rs_if_else : IF OPEN_PARENS expression CLOSE_PARENS production_item ( ELSE production_item )? ;
rs_repeat : REPEAT OPEN_PARENS expression CLOSE_PARENS production_item ;
rs_case : CASE OPEN_PARENS expression CLOSE_PARENS rs_case_item ( rs_case_item )* ENDCASE ;
rs_case_item
: expression ( COMMA expression )* COLUMN production_item
| DEFAULT ( COLUMN )? production_item
;
specify_block : SPECIFY ( specify_item )* ENDSPECIFY ;
specify_item
: specparam_declaration
| pulsestyle_declaration
| showcancelled_declaration
| path_declaration
| system_timing_check
;
pulsestyle_declaration
: PULSESTYLE_ONEVENT list_of_path_outputs SEMICOLUMN
| PULSESTYLE_ONDETECT list_of_path_outputs SEMICOLUMN
;
showcancelled_declaration
: SHOWCANCELLED list_of_path_outputs SEMICOLUMN
| NOSHOWCANCELLED list_of_path_outputs SEMICOLUMN
;
path_declaration
: simple_path_declaration SEMICOLUMN
| edge_sensitive_path_declaration SEMICOLUMN
| state_dependent_path_declaration SEMICOLUMN
;
simple_path_declaration
: parallel_path_description ASSIGN_OP path_delay_value
| full_path_description ASSIGN_OP path_delay_value
;
parallel_path_description :
OPEN_PARENS specify_input_terminal_descriptor ( PLUS | MINUS )? TRANSITION_OP
specify_output_terminal_descriptor CLOSE_PARENS ;
full_path_description :
OPEN_PARENS list_of_path_inputs ( PLUS | MINUS )? FULL_CONN_OP
list_of_path_outputs CLOSE_PARENS ;
list_of_path_inputs : specify_input_terminal_descriptor
( COMMA specify_input_terminal_descriptor )* ;
list_of_path_outputs : specify_output_terminal_descriptor
( COMMA specify_output_terminal_descriptor )* ;
specify_input_terminal_descriptor :
( identifier | interface_identifier DOT identifier ) ( OPEN_BRACKET constant_range_expression CLOSE_BRACKET )? ;
specify_output_terminal_descriptor :
( identifier | interface_identifier DOT identifier ) ( OPEN_BRACKET constant_range_expression CLOSE_BRACKET )? ;
path_delay_value
: list_of_path_delay_expressions
| OPEN_PARENS list_of_path_delay_expressions CLOSE_PARENS
;
list_of_path_delay_expressions
: t_path_delay_expression
| trise_path_delay_expression COMMA tfall_path_delay_expression
| trise_path_delay_expression COMMA tfall_path_delay_expression COMMA tz_path_delay_expression
| t01_path_delay_expression COMMA t10_path_delay_expression COMMA t0z_path_delay_expression COMMA
tz1_path_delay_expression COMMA t1z_path_delay_expression COMMA tz0_path_delay_expression
| t01_path_delay_expression COMMA t10_path_delay_expression COMMA t0z_path_delay_expression COMMA
tz1_path_delay_expression COMMA t1z_path_delay_expression COMMA tz0_path_delay_expression COMMA
t0x_path_delay_expression COMMA tx1_path_delay_expression COMMA t1x_path_delay_expression COMMA
tx0_path_delay_expression COMMA txz_path_delay_expression COMMA tzx_path_delay_expression
;
t_path_delay_expression : path_delay_expression ;
trise_path_delay_expression : path_delay_expression ;
tfall_path_delay_expression : path_delay_expression ;
tz_path_delay_expression : path_delay_expression ;
t01_path_delay_expression : path_delay_expression ;
t10_path_delay_expression : path_delay_expression ;
t0z_path_delay_expression : path_delay_expression ;
tz1_path_delay_expression : path_delay_expression ;
t1z_path_delay_expression : path_delay_expression ;
tz0_path_delay_expression : path_delay_expression ;
t0x_path_delay_expression : path_delay_expression ;
tx1_path_delay_expression : path_delay_expression ;
t1x_path_delay_expression : path_delay_expression ;
tx0_path_delay_expression : path_delay_expression ;
txz_path_delay_expression : path_delay_expression ;
tzx_path_delay_expression : path_delay_expression ;
path_delay_expression : constant_mintypmax_expression ;
edge_sensitive_path_declaration
: parallel_edge_sensitive_path_description ASSIGN_OP path_delay_value
| full_edge_sensitive_path_description ASSIGN_OP path_delay_value
;
parallel_edge_sensitive_path_description :
OPEN_PARENS ( edge_identifier )? specify_input_terminal_descriptor TRANSITION_OP
OPEN_PARENS specify_output_terminal_descriptor part_select_op_column
expression CLOSE_PARENS CLOSE_PARENS ;
full_edge_sensitive_path_description :
OPEN_PARENS ( edge_identifier )? list_of_path_inputs FULL_CONN_OP
OPEN_PARENS list_of_path_outputs part_select_op_column
expression CLOSE_PARENS CLOSE_PARENS ;
state_dependent_path_declaration
: IF OPEN_PARENS module_path_expression CLOSE_PARENS simple_path_declaration
| IF OPEN_PARENS module_path_expression CLOSE_PARENS edge_sensitive_path_declaration
| IFNONE simple_path_declaration
;
system_timing_check
: dollar_setup_timing_check
| dollar_hold_timing_check
| dollar_setuphold_timing_check
| dollar_recovery_timing_check
| dollar_removal_timing_check
| dollar_recrem_timing_check
| dollar_skew_timing_check
| dollar_timeskew_timing_check
| dollar_fullskew_timing_check
| dollar_period_timing_check
| dollar_width_timing_check
| dollar_nochange_timing_check
;
dollar_setup_timing_check :
DOLLAR Simple_identifier OPEN_PARENS timing_check_event COMMA reference_event COMMA
timing_check_limit ( COMMA ( notifier )? )? CLOSE_PARENS SEMICOLUMN ;
dollar_hold_timing_check :
DOLLAR Simple_identifier OPEN_PARENS reference_event COMMA timing_check_event COMMA
timing_check_limit ( COMMA ( notifier )? )? CLOSE_PARENS SEMICOLUMN ;
dollar_setuphold_timing_check :
DOLLAR Simple_identifier OPEN_PARENS reference_event COMMA timing_check_event COMMA timing_check_limit COMMA timing_check_limit
( COMMA ( notifier )? ( COMMA ( stamptime_condition )? ( COMMA ( mintypmax_expression )?
( COMMA ( delayed_reference )? ( COMMA ( delayed_data )? )? )? )? )? )? CLOSE_PARENS SEMICOLUMN ;
dollar_recovery_timing_check :
DOLLAR Simple_identifier OPEN_PARENS reference_event COMMA timing_check_event COMMA
timing_check_limit ( COMMA ( notifier )? )? CLOSE_PARENS SEMICOLUMN ;
dollar_removal_timing_check :
DOLLAR Simple_identifier OPEN_PARENS reference_event COMMA timing_check_event COMMA
timing_check_limit ( COMMA ( notifier )? )? CLOSE_PARENS SEMICOLUMN ;
dollar_recrem_timing_check :
DOLLAR Simple_identifier OPEN_PARENS reference_event COMMA timing_check_event COMMA timing_check_limit COMMA timing_check_limit
( COMMA ( notifier )? ( COMMA ( stamptime_condition )? ( COMMA ( mintypmax_expression )?
( COMMA ( delayed_reference )? ( COMMA ( delayed_data )? )? )? )? )? )? CLOSE_PARENS SEMICOLUMN ;
dollar_skew_timing_check :
DOLLAR Simple_identifier OPEN_PARENS reference_event COMMA timing_check_event COMMA
timing_check_limit ( COMMA ( notifier )? )? CLOSE_PARENS SEMICOLUMN ;
dollar_timeskew_timing_check :
DOLLAR Simple_identifier OPEN_PARENS reference_event COMMA timing_check_event COMMA timing_check_limit
( COMMA ( notifier )? ( COMMA ( event_based_flag )?
( COMMA ( remain_active_flag )? )? )? )? CLOSE_PARENS SEMICOLUMN ;
dollar_fullskew_timing_check :
DOLLAR Simple_identifier OPEN_PARENS reference_event COMMA timing_check_event
COMMA timing_check_limit COMMA timing_check_limit
( COMMA ( notifier )? ( COMMA ( event_based_flag )?
( COMMA ( remain_active_flag )? )? )? )? CLOSE_PARENS SEMICOLUMN ;
dollar_period_timing_check :
DOLLAR Simple_identifier OPEN_PARENS controlled_timing_check_event COMMA timing_check_limit
( COMMA ( notifier )? )? CLOSE_PARENS SEMICOLUMN ;
dollar_width_timing_check :
DOLLAR Simple_identifier OPEN_PARENS controlled_timing_check_event COMMA timing_check_limit
COMMA threshold ( COMMA ( notifier )? )? CLOSE_PARENS SEMICOLUMN ;
dollar_nochange_timing_check :
DOLLAR Simple_identifier OPEN_PARENS reference_event COMMA timing_check_event COMMA start_edge_offset COMMA
end_edge_offset ( COMMA ( notifier )? )? CLOSE_PARENS SEMICOLUMN ;
delayed_data
: identifier (OPEN_BRACKET constant_mintypmax_expression CLOSE_BRACKET )?
;
delayed_reference
: identifier ( OPEN_BRACKET constant_mintypmax_expression CLOSE_BRACKET ) ?
;
end_edge_offset : mintypmax_expression ;
event_based_flag : constant_expression ;
notifier : identifier ;
reference_event : timing_check_event ;
remain_active_flag : constant_mintypmax_expression ;
stamptime_condition : mintypmax_expression ;
start_edge_offset : mintypmax_expression ;
threshold : constant_expression ;
timing_check_limit : mintypmax_expression ;
timing_check_event :
(timing_check_event_control)? specify_terminal_descriptor ( COND_PRED_OP timing_check_condition )? ;
controlled_timing_check_event :
timing_check_event_control specify_terminal_descriptor ( COND_PRED_OP timing_check_condition )? ;
timing_check_event_control
: POSEDGE # TimingCheckEventControl_Posedge
| NEGEDGE # TimingCheckEventControl_Negedge
| edge_control_specifier # TimingCheckEventControl_Edge
;
specify_terminal_descriptor
: specify_input_terminal_descriptor
| specify_output_terminal_descriptor
;
edge_control_specifier : EDGE OPEN_BRACKET edge_descriptor ( COMMA edge_descriptor )* CLOSE_BRACKET ;
edge_descriptor
: Integral_number
| Simple_identifier Integral_number
| Integral_number Simple_identifier
// | Rising
// | Falling
// | Simple_identifier Zero_or_one
// | Zero_or_one Simple_identifier
;
timing_check_condition
: scalar_timing_check_condition
| OPEN_PARENS scalar_timing_check_condition CLOSE_PARENS
;
scalar_timing_check_condition
: expression
| TILDA expression
| expression EQUIV scalar_constant
| expression FOUR_STATE_LOGIC_EQUAL scalar_constant
| expression NOTEQUAL scalar_constant
| expression FOUR_STATE_LOGIC_NOTEQUAL scalar_constant
;
scalar_constant
: ONE_TICK_b0 # Scalar_1Tickb0
| ONE_TICK_b1 # Scalar_1Tickb1
| ONE_TICK_B0 # Scalar_1TickB0
| ONE_TICK_B1 # Scalar_1TickB1
| TICK_b0 # Scalar_Tickb0
| TICK_b1 # Scalar_Tickb1
| TICK_B0 # Scalar_TickB0
| TICK_B1 # Scalar_TickB1
| Integral_number # Scalar_Integral
;
concatenation
: OPEN_CURLY expression ( COMMA expression )* CLOSE_CURLY
| OPEN_CURLY array_member_label COLUMN expression
( COMMA array_member_label COLUMN expression )* CLOSE_CURLY
;
constant_concatenation
: OPEN_CURLY constant_expression ( COMMA constant_expression )* CLOSE_CURLY
| OPEN_CURLY array_member_label COLUMN constant_expression
( COMMA array_member_label COLUMN constant_expression )* CLOSE_CURLY
;
array_member_label
: DEFAULT
| identifier
| constant_expression
;
constant_multiple_concatenation : OPEN_CURLY constant_expression constant_concatenation CLOSE_CURLY ;
module_path_concatenation : OPEN_CURLY module_path_expression ( COMMA module_path_expression )* CLOSE_CURLY ;
module_path_multiple_concatenation : OPEN_CURLY constant_expression module_path_concatenation CLOSE_CURLY ;
multiple_concatenation : OPEN_CURLY expression concatenation CLOSE_CURLY ;
streaming_concatenation : OPEN_CURLY stream_operator ( slice_size )? stream_concatenation CLOSE_CURLY ;
stream_operator : SHIFT_RIGHT | SHIFT_LEFT ;
slice_size : simple_type | constant_expression ;
stream_concatenation : OPEN_CURLY stream_expression ( COMMA stream_expression )* CLOSE_CURLY ;
stream_expression : expression ( WITH OPEN_BRACKET array_range_expression CLOSE_BRACKET )? ;
array_range_expression
: expression
| expression part_select_op_column expression
;
empty_queue : OPEN_CURLY CLOSE_CURLY ;
/*
subroutine_call
: tf_call
| method_call
| randomize_call
;
*/
subroutine_call : ( implicit_class_handle DOT | class_scope | package_scope | dollar_keyword )?
( dollar_root_keyword )? identifier ( constant_bit_select DOT identifier )* ( attribute_instance )* ( ( OPEN_PARENS list_of_arguments CLOSE_PARENS ) | select) (DOT? method_call_body)?
| randomize_call;
list_of_arguments
: ( expression )? (COMMA ( expression )? )* ( COMMA DOT identifier OPEN_PARENS ( expression )? CLOSE_PARENS )*
| DOT identifier OPEN_PARENS ( expression )? CLOSE_PARENS ( COMMA DOT identifier OPEN_PARENS ( expression )? CLOSE_PARENS )*
;
method_call : method_call_root DOT method_call_body
| class_type COLUMNCOLUMN method_call_body
;
method_call_body
: identifier ( attribute_instance )*
( OPEN_PARENS list_of_arguments CLOSE_PARENS )?
| built_in_method_call
;
built_in_method_call
: array_manipulation_call
| randomize_call
;
array_manipulation_call : array_method_name ( attribute_instance )*
( OPEN_PARENS list_of_arguments CLOSE_PARENS )?
( WITH OPEN_PARENS expression CLOSE_PARENS )?
;
randomize_call :
RANDOMIZE ( attribute_instance )*
( OPEN_PARENS ( identifier_list | NULL_KEYWORD )? CLOSE_PARENS )?
( WITH ( OPEN_PARENS ( identifier_list )? CLOSE_PARENS )? constraint_block )? ;
method_call_root
: implicit_class_handle
| ( class_scope | package_scope )?
( dollar_root_keyword )? identifier (( OPEN_BRACKET constant_expression CLOSE_BRACKET )* DOT identifier)* select
;
array_method_name
: identifier
| unique_call
| and_call
| or_call
| xor_call
;
unique_call : UNIQUE ;
and_call : AND;
or_call : OR;
xor_call : XOR;
inc_or_dec_expression
: inc_or_dec_operator ( attribute_instance )* variable_lvalue
| variable_lvalue ( attribute_instance )* inc_or_dec_operator
;
constant_expression
: constant_primary
| ( PLUS | MINUS | BANG | TILDA | BITW_AND | BITW_OR | BITW_XOR | REDUCTION_NAND | REDUCTION_NOR | REDUCTION_XNOR1| REDUCTION_XNOR2 ) ( attribute_instance )* constant_primary
| constant_expression STARSTAR ( attribute_instance )* constant_expression
| constant_expression ( STAR | DIV | PERCENT ) ( attribute_instance )* constant_expression
| constant_expression ( PLUS | MINUS ) ( attribute_instance )* constant_expression
| constant_expression ( SHIFT_RIGHT | SHIFT_LEFT | ARITH_SHIFT_RIGHT | ARITH_SHIFT_LEFT ) ( attribute_instance )* constant_expression
| constant_expression ( LESS | LESS_EQUAL | GREATER | GREATER_EQUAL | INSIDE ) ( attribute_instance )* constant_expression
| constant_expression ( EQUIV | NOTEQUAL | BINARY_WILDCARD_EQUAL | BINARY_WILDCARD_NOTEQUAL | FOUR_STATE_LOGIC_EQUAL | FOUR_STATE_LOGIC_NOTEQUAL | WILD_EQUAL_OP | WILD_NOTEQUAL_OP ) ( attribute_instance )* constant_expression
| constant_expression BITW_AND ( attribute_instance )* constant_expression
| constant_expression ( REDUCTION_XNOR1 | REDUCTION_XNOR2 | REDUCTION_NAND | REDUCTION_NOR | BITW_XOR ) ( attribute_instance )* constant_expression
| constant_expression BITW_OR ( attribute_instance )* constant_expression
| constant_expression LOGICAL_AND ( attribute_instance )* constant_expression
| constant_expression LOGICAL_OR ( attribute_instance )* constant_expression
| constant_expression ( LOGICAL_AND expression )* conditional_operator ( attribute_instance )* expression COLUMN constant_expression
| constant_expression ( IMPLY | EQUIVALENCE ) ( attribute_instance )* constant_expression
| system_task
;
conditional_operator : QMARK ;
constant_mintypmax_expression
: constant_expression ( COLUMN constant_expression COLUMN constant_expression ) ?
;
constant_param_expression
: constant_mintypmax_expression
| data_type
| DOLLAR
;
param_expression
: mintypmax_expression
| data_type
| DOLLAR
;
constant_range_expression
: constant_expression
| constant_part_select_range
;
constant_part_select_range
: constant_range
| constant_indexed_range
;
constant_range : constant_expression COLUMN constant_expression ;
constant_indexed_range
: constant_expression part_select_op constant_expression
;
/*
Non left-recursive grammar is slower by far
expression : primary expression_prime
| OPEN_PARENS expression CLOSE_PARENS expression_prime
| ( PLUS | MINUS | BANG | TILDA | BITW_AND | BITW_OR | BITW_XOR | REDUCTION_NAND | REDUCTION_NOR | REDUCTION_XNOR1| REDUCTION_XNOR2 ) ( attribute_instance )* expression expression_prime
| ( PLUSPLUS | MINUSMINUS ) ( attribute_instance )* variable_lvalue expression_prime
| variable_lvalue ( attribute_instance )* ( PLUSPLUS | MINUSMINUS ) expression_prime
| OPEN_PARENS variable_lvalue (ASSIGN_OP | ADD_ASSIGN | SUB_ASSIGN | MULT_ASSIGN| DIV_ASSIGN | MODULO_ASSIGN | BITW_AND_ASSIGN | BITW_OR_ASSIGN | BITW_XOR_ASSIGN | BITW_LEFT_SHIFT_ASSIGN | BITW_RIGHT_SHIFT_ASSIGN | ARITH_SHIFT_LEFT_ASSIGN | ARITH_SHIFT_RIGHT_ASSIGN ) expression CLOSE_PARENS expression_prime
| OPEN_PARENS expression MATCHES pattern ( LOGICAL_AND expression )* CLOSE_PARENS QMARK ( attribute_instance )* expression COLUMN expression expression_prime
| TAGGED identifier ( expression )? expression_prime ;
expression_prime : STARSTAR ( attribute_instance )* expression expression_prime
| ( STAR | DIV | PERCENT ) ( attribute_instance )* expression expression_prime
| ( PLUS | MINUS ) ( attribute_instance )* expression expression_prime
| ( SHIFT_RIGHT | SHIFT_LEFT | ARITH_SHIFT_RIGHT | ARITH_SHIFT_LEFT ) ( attribute_instance )* expression expression_prime
| ( LESS | LESS_EQUAL | GREATER | GREATER_EQUAL | INSIDE ) ( attribute_instance )* expression expression_prime
| ( EQUIV | NOTEQUAL | BINARY_WILDCARD_EQUAL | BINARY_WILDCARD_NOTEQUAL | FOUR_STATE_LOGIC_EQUAL | FOUR_STATE_LOGIC_NOTEQUAL | WILD_EQUAL_OP | WILD_NOTEQUAL_OP ) ( attribute_instance )* expression expression_prime
| BITW_AND ( attribute_instance )* expression expression_prime
| ( REDUCTION_XNOR1 | REDUCTION_XNOR2 | REDUCTION_NAND | REDUCTION_NOR | BITW_XOR ) ( attribute_instance )* expression expression_prime
| BITW_OR ( attribute_instance )* expression expression_prime
| LOGICAL_AND ( attribute_instance )* expression expression_prime
| LOGICAL_OR ( attribute_instance )* expression expression_prime
| ( LOGICAL_AND expression )* QMARK ( attribute_instance )* expression COLUMN expression expression_prime
| ( IMPLY | EQUIVALENCE ) ( attribute_instance )* expression expression_prime
| MATCHES pattern ( LOGICAL_AND expression )* QMARK ( attribute_instance )* expression expression_prime
| INSIDE OPEN_CURLY open_range_list CLOSE_CURLY expression_prime
| ;
*/
expression
: primary
| OPEN_PARENS expression CLOSE_PARENS
| ( PLUS | MINUS | BANG | TILDA | BITW_AND | BITW_OR | BITW_XOR | REDUCTION_NAND | REDUCTION_NOR | REDUCTION_XNOR1| REDUCTION_XNOR2 ) ( attribute_instance )* expression
| ( PLUSPLUS | MINUSMINUS ) ( attribute_instance )* variable_lvalue
| variable_lvalue ( attribute_instance )* ( PLUSPLUS | MINUSMINUS )
| OPEN_PARENS variable_lvalue (ASSIGN_OP | ADD_ASSIGN | SUB_ASSIGN | MULT_ASSIGN| DIV_ASSIGN | MODULO_ASSIGN | BITW_AND_ASSIGN | BITW_OR_ASSIGN | BITW_XOR_ASSIGN | BITW_LEFT_SHIFT_ASSIGN | BITW_RIGHT_SHIFT_ASSIGN | ARITH_SHIFT_LEFT_ASSIGN | ARITH_SHIFT_RIGHT_ASSIGN ) expression CLOSE_PARENS
| OPEN_PARENS expression MATCHES pattern ( LOGICAL_AND expression )* CLOSE_PARENS QMARK ( attribute_instance )* expression COLUMN expression
| TAGGED identifier ( expression )?
| expression STARSTAR ( attribute_instance )* expression
| expression ( STAR | DIV | PERCENT ) ( attribute_instance )* expression
| expression ( PLUS | MINUS ) ( attribute_instance )* expression
| expression ( SHIFT_RIGHT | SHIFT_LEFT | ARITH_SHIFT_RIGHT | ARITH_SHIFT_LEFT ) ( attribute_instance )* expression
| expression ( LESS | LESS_EQUAL | GREATER | GREATER_EQUAL | INSIDE ) ( attribute_instance )* expression
| expression ( EQUIV | NOTEQUAL | BINARY_WILDCARD_EQUAL | BINARY_WILDCARD_NOTEQUAL | FOUR_STATE_LOGIC_EQUAL | FOUR_STATE_LOGIC_NOTEQUAL | WILD_EQUAL_OP | WILD_NOTEQUAL_OP ) ( attribute_instance )* expression
| expression BITW_AND ( attribute_instance )* expression
| expression ( REDUCTION_XNOR1 | REDUCTION_XNOR2 | REDUCTION_NAND | REDUCTION_NOR | BITW_XOR ) ( attribute_instance )* expression
| expression BITW_OR ( attribute_instance )* expression
| expression LOGICAL_AND ( attribute_instance )* expression
| expression LOGICAL_OR ( attribute_instance )* expression
| expression ( LOGICAL_AND expression )* QMARK ( attribute_instance )* expression COLUMN expression
| expression ( IMPLY | EQUIVALENCE ) ( attribute_instance )* expression
| expression MATCHES pattern ( LOGICAL_AND expression )* QMARK ( attribute_instance )* expression COLUMN expression
| expression INSIDE OPEN_CURLY open_range_list CLOSE_CURLY
;
value_range
: expression
| OPEN_BRACKET expression COLUMN expression CLOSE_BRACKET
;
mintypmax_expression
: expression ( COLUMN expression COLUMN expression )? ;
module_path_expression
: module_path_primary
| unary_module_path_operator ( attribute_instance )* module_path_primary
| module_path_expression binary_module_path_operator ( attribute_instance )*
module_path_expression
| module_path_expression conditional_operator ( attribute_instance )*
module_path_expression COLUMN module_path_expression
;
module_path_mintypmax_expression
: module_path_expression ( COLUMN module_path_expression COLUMN module_path_expression ) ?
;
range_expression
: expression
| part_select_range
;
part_select_range
: constant_range
| indexed_range
;
part_select_op
: INC_PART_SELECT_OP
| DEC_PART_SELECT_OP
;
part_select_op_column
: INC_PART_SELECT_OP
| DEC_PART_SELECT_OP
| COLUMN
;
indexed_range
: expression part_select_op constant_expression
;
constant_primary
: primary_literal
| ( package_scope | class_scope )? identifier constant_select ( OPEN_BRACKET constant_range_expression CLOSE_BRACKET )?
| constant_concatenation ( OPEN_BRACKET constant_range_expression CLOSE_BRACKET )?
| constant_multiple_concatenation ( OPEN_BRACKET constant_range_expression CLOSE_BRACKET )?
| subroutine_call
| constant_cast
| constant_assignment_pattern_expression
| type_reference
| dollar_keyword
| OPEN_PARENS constant_expression ( COLUMN constant_expression COLUMN constant_expression )? CLOSE_PARENS
;
module_path_primary
: number
| identifier
| module_path_concatenation
| module_path_multiple_concatenation
| subroutine_call
| OPEN_PARENS module_path_mintypmax_expression CLOSE_PARENS
;
/*
Replaces let_expression, tf_call, method_call
*/
complex_func_call : ( implicit_class_handle DOT | class_scope | package_scope | dollar_keyword | LOCAL COLUMNCOLUMN )?
( dollar_root_keyword )? identifier (( OPEN_BRACKET constant_expression CLOSE_BRACKET )* DOT identifier)* ( attribute_instance )* ( ( OPEN_PARENS (list_of_arguments) CLOSE_PARENS ) | select ) (DOT? method_call_body)? ;
primary
: primary_literal
| complex_func_call
| ( concatenation | multiple_concatenation ) ( OPEN_BRACKET range_expression CLOSE_BRACKET )?
// | OPEN_PARENS mintypmax_expression CLOSE_PARENS
| cast
| assignment_pattern_expression
| streaming_concatenation
| system_task
| class_type COLUMNCOLUMN method_call_body
| this_keyword
| dollar_keyword
| null_keyword
| empty_queue
| randomize_call
// mintypmax_expression moved here:
| OPEN_PARENS expression COLUMN expression COLUMN expression CLOSE_PARENS
;
this_keyword : THIS;
super_keyword : SUPER;
dollar_keyword : DOLLAR;
dollar_root_keyword : DOLLAR_ROOT DOT;
this_dot_super : THIS DOT SUPER;
null_keyword : NULL_KEYWORD;
time_literal
: Integral_number time_unit
| Real_number time_unit
//REMOVED | Unsigned_number time_unit
// | Fixed_point_number time_unit
;
time_unit
: Simple_identifier
;
implicit_class_handle
: this_keyword
| super_keyword
| this_dot_super
;
bit_select :
( OPEN_BRACKET expression CLOSE_BRACKET )* ;
select : ( ( DOT identifier bit_select )* DOT identifier )? bit_select ( OPEN_BRACKET part_select_range CLOSE_BRACKET )? ;
nonrange_select :
( ( DOT identifier bit_select )* DOT identifier )? bit_select ;
constant_bit_select :
( OPEN_BRACKET constant_expression CLOSE_BRACKET )* ;
constant_select :
( ( DOT identifier constant_bit_select )* DOT identifier )? constant_bit_select
( OPEN_BRACKET constant_part_select_range CLOSE_BRACKET )? ;
primary_literal
: number
| time_literal
| unbased_unsized_literal
| string_value
| identifier
;
constant_cast
: casting_type TICK ( OPEN_PARENS constant_expression CLOSE_PARENS | constant_concatenation | constant_multiple_concatenation )
;
cast
: casting_type TICK ( OPEN_PARENS expression CLOSE_PARENS | concatenation | multiple_concatenation)
;
net_lvalue
: ps_or_hierarchical_identifier constant_select
| OPEN_CURLY net_lvalue ( COMMA net_lvalue )* CLOSE_CURLY
| ( assignment_pattern_expression_type )? assignment_pattern_net_lvalue
;
variable_lvalue
: ( implicit_class_handle DOT | package_scope )?
hierarchical_identifier select
| OPEN_CURLY variable_lvalue ( COMMA variable_lvalue )* CLOSE_CURLY
| ( assignment_pattern_expression_type )? assignment_pattern_variable_lvalue
| streaming_concatenation
;
nonrange_variable_lvalue :
( implicit_class_handle DOT | package_scope )? hierarchical_identifier nonrange_select ;
unary_operator
: PLUS # Unary_Plus
| MINUS # Unary_Minus
| BANG # Unary_Not
| TILDA # Unary_Tilda
| BITW_AND # Unary_BitwAnd
| BITW_OR # Unary_BitwOr
| BITW_XOR # Unary_BitwXor
| REDUCTION_NAND # Unary_ReductNand
| REDUCTION_NOR # Unary_ReductNor
| REDUCTION_XNOR1 # Unary_ReductXnor1
| REDUCTION_XNOR2 # Unary_ReductXnor2
;
binary_operator_prec1
: STARSTAR # BinOp_MultMult
;
binary_operator_prec2
: STAR # BinOp_Mult
| DIV # BinOp_Div
| PERCENT # BinOp_Percent
;
binary_operator_prec3
: PLUS # BinOp_Plus
| MINUS # BinOp_Minus
;
binary_operator_prec4
: SHIFT_RIGHT # BinOp_ShiftRight
| SHIFT_LEFT # BinOp_ShiftLeft
| ARITH_SHIFT_RIGHT # BinOp_ArithShiftRight
| ARITH_SHIFT_LEFT # BinOp_ArithShiftLeft
;
binary_operator_prec5
: LESS # BinOp_Less
| LESS_EQUAL # BinOp_LessEqual
| GREATER # BinOp_Great
| GREATER_EQUAL # BinOp_GreatEqual
| INSIDE # InsideOp
;
binary_operator_prec6
: EQUIV # BinOp_Equiv
| NOTEQUAL # BinOp_Not
| BINARY_WILDCARD_EQUAL # BinOp_WildcardEqual
| BINARY_WILDCARD_NOTEQUAL # BinOp_WildcardNotEqual
| FOUR_STATE_LOGIC_EQUAL # BinOp_FourStateLogicEqual
| FOUR_STATE_LOGIC_NOTEQUAL # BinOp_FourStateLogicNotEqual
| WILD_EQUAL_OP # BinOp_WildEqual
| WILD_NOTEQUAL_OP # BinOp_WildNotEqual
;
binary_operator_prec7
: BITW_AND # BinOp_BitwAnd
;
binary_operator_prec8
: REDUCTION_XNOR1 # BinOp_ReductXnor1
| REDUCTION_XNOR2 # BinOp_ReductXnor2
| REDUCTION_NAND # BinOp_ReductNand
| REDUCTION_NOR # BinOp_ReductNor
| BITW_XOR # BinOp_BitwXor
;
binary_operator_prec9
: BITW_OR # BinOp_BitwOr
;
binary_operator_prec10
: LOGICAL_AND # BinOp_LogicAnd
;
binary_operator_prec11
: LOGICAL_OR # BinOp_LogicOr
;
binary_operator_prec12
: IMPLY # BinOp_Imply
| EQUIVALENCE # BinOp_Equivalence
;
inc_or_dec_operator
: PLUSPLUS
| MINUSMINUS
;
unary_module_path_operator
: BANG # UnaryModOp_Not
| TILDA # UnaryModOp_Tilda
| BITW_AND # UnaryModOp_BitwAnd
| REDUCTION_NAND # UnaryModOp_ReductNand
| BITW_OR # UnaryModOp_BitwOr
| REDUCTION_NOR # UnaryModOp_ReductNor
| BITW_XOR # UnaryModOp_BitwXor
| REDUCTION_XNOR1 # UnaryModOp_ReductXNor1
| REDUCTION_XNOR2 # UnaryModOp_ReductXnor2
;
binary_module_path_operator
: EQUIV # BinModOp_Equiv
| NOTEQUAL # BinModOp_NotEqual
| LOGICAL_AND # BinModOp_LogicAnd
| LOGICAL_OR # BinModOp_LogicOr
| BITW_AND # BinModOp_BitwAnd
| BITW_OR # BinModOp_BitwOr
| BITW_XOR # BinModOp_BitwXor
| REDUCTION_XNOR1 # BinModOp_ReductXnor1
| REDUCTION_XNOR2 # BinModOp_ReductXnor2
;
number
: Integral_number # Number_Integral
| Real_number # Number_Real
| ONE_TICK_b0 # Number_1Tickb0
| ONE_TICK_b1 # Number_1Tickb1
| ONE_TICK_B0 # Number_1TickB0
| ONE_TICK_B1 # Number_1TickB1
| TICK_b0 # Number_Tickb0
| TICK_b1 # Number_Tickb1
| TICK_B0 # Number_TickB0
| TICK_B1 # Number_TickB1
| TICK_0 # Number_Tick0
| TICK_1 # Number_Tick1
| ONE_TICK_bx # Number_1Tickbx
| ONE_TICK_bX # Number_1TickbX
| ONE_TICK_Bx # Number_1TickBx
| ONE_TICK_BX # Number_1TickBX
;
unbased_unsized_literal
: TICK_0
| TICK_1
| TICK Simple_identifier
;
attribute_instance : OPEN_PARENS_STAR attr_spec (COMMA attr_spec )* STAR_CLOSE_PARENS ;
attr_spec : attr_name ( ASSIGN_OP constant_expression )? ;
attr_name : identifier ;
hierarchical_identifier : ( dollar_root_keyword )? (
Simple_identifier
| Escaped_identifier
| THIS
| RANDOMIZE
| SAMPLE
) (( OPEN_BRACKET constant_expression CLOSE_BRACKET )* DOT (
Simple_identifier
| Escaped_identifier
| THIS
| RANDOMIZE
| SAMPLE
))* ;
identifier
: Simple_identifier
| Escaped_identifier
| THIS // System Verilog keyword
| RANDOMIZE // System Verilog keyword
| SAMPLE // System Verilog keyword
;
interface_identifier : ( dollar_root_keyword )? identifier (( OPEN_BRACKET constant_expression CLOSE_BRACKET )* DOT identifier)* ;
package_scope
: ( Simple_identifier
| Escaped_identifier
| THIS
| RANDOMIZE
| SAMPLE
| DOLLAR_UNIT ) COLUMNCOLUMN
;
ps_identifier : ( Simple_identifier
| Escaped_identifier
| THIS
| RANDOMIZE
| SAMPLE
| DOLLAR_UNIT ) (COLUMNCOLUMN (Simple_identifier
| Escaped_identifier
| THIS
| RANDOMIZE
| SAMPLE ))?;
ps_or_hierarchical_identifier : ( package_scope )? identifier | hierarchical_identifier ;
ps_or_hierarchical_array_identifier : ( implicit_class_handle DOT | class_scope | package_scope )? ( dollar_root_keyword )? identifier (( OPEN_BRACKET constant_expression CLOSE_BRACKET )* DOT identifier)* ;
ps_or_hierarchical_sequence_identifier : ( package_scope )? identifier | ( dollar_root_keyword )? identifier (( OPEN_BRACKET constant_expression CLOSE_BRACKET )* DOT identifier)* ;
ps_type_identifier : ( LOCAL COLUMNCOLUMN | package_scope )? identifier ;
system_task : system_task_names (OPEN_PARENS (list_of_arguments | data_type) CLOSE_PARENS)? SEMICOLUMN? ;
system_task_names : DOLLAR Simple_identifier (DOLLAR Simple_identifier)*
| DOLLAR TIME
| DOLLAR REALTIME
| DOLLAR SIGNED
| DOLLAR UNSIGNED
| DOLLAR ASSERT
;
top_directives : timescale_directive
| uselib_directive
| BACK_TICK Simple_identifier ( number | Simple_identifier | Real_number ) ?
| begin_keywords_directive
| end_keywords_directive
| unconnected_drive_directive
| nounconnected_drive_directive
| default_nettype_directive
| default_decay_time_directive
| default_trireg_strenght_directive
| delay_mode_distributed_directive
| delay_mode_path_directive
| delay_mode_unit_directive
| delay_mode_zero_directive
| protect_directive
| endprotect_directive
| protected_directive
| endprotected_directive
| expand_vectornets_directive
| noexpand_vectornets_directive
| autoexpand_vectornets_directive
| remove_gatename_directive
| noremove_gatenames_directive
| remove_netname_directive
| noremove_netnames_directive
| accelerate_directive
| noaccelerate_directive
| disable_portfaults_directive
| enable_portfaults_directive
| nosuppress_faults_directive
| suppress_faults_directive
| signed_directive
| unsigned_directive
| celldefine_directive
| endcelldefine_directive
| pragma_directive
;
pragma_directive : TICK_PRAGMA Simple_identifier (pragma_expression (COMMA pragma_expression)*)? ;
pragma_expression
: Simple_identifier
| Simple_identifier ASSIGN_OP pragma_value
| pragma_value
| BEGIN
| END
;
pragma_value
: OPEN_PARENS pragma_expression ( COMMA pragma_expression)* CLOSE_PARENS
| number
| string_value
| Simple_identifier
;
timescale_directive : TICK_TIMESCALE Integral_number Simple_identifier DIV Integral_number Simple_identifier ;
begin_keywords_directive : TICK_BEGIN_KEYWORDS String ;
end_keywords_directive : TICK_END_KEYWORDS ;
unconnected_drive_directive : TICK_UNCONNECTED_DRIVE ( Simple_identifier | PULL0 | PULL1) ;
nounconnected_drive_directive : TICK_NOUNCONNECTED_DRIVE;
default_nettype_directive : TICK_DEFAULT_NETTYPE ( Simple_identifier | net_type );
uselib_directive : TICK_USELIB ;
celldefine_directive : TICK_CELLDEFINE ;
endcelldefine_directive : TICK_ENDCELLDEFINE;
protect_directive : TICK_PROTECT;
endprotect_directive : TICK_ENDPROTECT;
protected_directive : TICK_PROTECTED;
endprotected_directive : TICK_ENDPROTECTED;
expand_vectornets_directive : TICK_EXPAND_VECTORNETS ;
noexpand_vectornets_directive : TICK_NOEXPAND_VECTORNETS;
autoexpand_vectornets_directive : TICK_AUTOEXPAND_VECTORNETS;
disable_portfaults_directive : TICK_DISABLE_PORTFAULTS;
enable_portfaults_directive : TICK_ENABLE_PORTFAULTS;
nosuppress_faults_directive : TICK_NOSUPPRESS_FAULTS;
suppress_faults_directive : TICK_SUPPRESS_FAULTS;
signed_directive : TICK_SIGNED;
unsigned_directive : TICK_UNSIGNED;
remove_gatename_directive : TICK_REMOVE_GATENAME;
noremove_gatenames_directive : TICK_NOREMOVE_GATENAMES;
remove_netname_directive : TICK_REMOVE_NETNAME;
noremove_netnames_directive : TICK_NOREMOVE_NETNAMES;
accelerate_directive : TICK_ACCELERATE;
noaccelerate_directive : TICK_NOACCELERATE;
default_trireg_strenght_directive : TICK_DEFAULT_TRIREG_STRENGTH number;
default_decay_time_directive : TICK_DEFAULT_DECAY_TIME ( number | Simple_identifier );
delay_mode_distributed_directive : TICK_DELAY_MODE_DISTRIBUTED;
delay_mode_path_directive : TICK_DELAY_MODE_PATH;
delay_mode_unit_directive : TICK_DELAY_MODE_UNIT;
delay_mode_zero_directive : TICK_DELAY_MODE_ZERO;
surelog_macro_not_defined : SURELOG_MACRO_NOT_DEFINED ;
slline : TICK_LINE Integral_number String Integral_number ;
config_declaration : CONFIG identifier SEMICOLUMN
( local_parameter_declaration SEMICOLUMN )*
design_statement
( config_rule_statement )*
ENDCONFIG ( COLUMN identifier )? ;
design_statement : DESIGN ( ( identifier DOT )? identifier )*
SEMICOLUMN ;
config_rule_statement
: default_clause liblist_clause SEMICOLUMN
| inst_clause liblist_clause SEMICOLUMN
| inst_clause use_clause_config SEMICOLUMN
| inst_clause use_clause SEMICOLUMN
| cell_clause liblist_clause SEMICOLUMN
| cell_clause use_clause_config SEMICOLUMN
| cell_clause use_clause SEMICOLUMN
;
default_clause : DEFAULT ;
inst_clause : INSTANCE inst_name ;
inst_name : identifier ( DOT identifier )* ;
cell_clause : CELL ( identifier DOT )? identifier ;
liblist_clause : LIBLIST ( identifier )* ;
use_clause_config : USE ( identifier DOT )? identifier COLUMN CONFIG
| USE named_parameter_assignment ( COMMA named_parameter_assignment )* COLUMN CONFIG
| USE ( identifier DOT )? identifier named_parameter_assignment
( COMMA named_parameter_assignment )* COLUMN CONFIG
;
use_clause : USE ( identifier DOT )? identifier
| USE named_parameter_assignment ( COMMA named_parameter_assignment )*
| USE ( identifier DOT )? identifier named_parameter_assignment
( COMMA named_parameter_assignment )*
| USE parameter_value_assignment
;
|
programs/oeis/152/A152135.asm | karttu/loda | 1 | 24487 | <gh_stars>1-10
; A152135: Maximal length of rook tour on an n X n+4 board.
; 12,36,74,134,216,328,470,650,868,1132,1442,1806,2224,2704,3246,3858,4540,5300,6138,7062,8072,9176,10374,11674,13076,14588,16210,17950,19808,21792,23902,26146,28524,31044,33706,36518,39480,42600,45878,49322,52932,56716,60674,64814,69136,73648,78350,83250,88348,93652,99162,104886,110824,116984,123366,129978,136820,143900,151218,158782,166592,174656,182974,191554,200396,209508,218890,228550,238488,248712,259222,270026,281124,292524,304226,316238,328560,341200,354158,367442,381052,394996,409274,423894,438856,454168,469830,485850,502228,518972,536082,553566,571424,589664,608286,627298,646700,666500,686698,707302,728312,749736,771574,793834,816516,839628,863170,887150,911568,936432,961742,987506,1013724,1040404,1067546,1095158,1123240,1151800,1180838,1210362,1240372,1270876,1301874,1333374,1365376,1397888,1430910,1464450,1498508,1533092,1568202,1603846,1640024,1676744,1714006,1751818,1790180,1829100,1868578,1908622,1949232,1990416,2032174,2074514,2117436,2160948,2205050,2249750,2295048,2340952,2387462,2434586,2482324,2530684,2579666,2629278,2679520,2730400,2781918,2834082,2886892,2940356,2994474,3049254,3104696,3160808,3217590,3275050,3333188,3392012,3451522,3511726,3572624,3634224,3696526,3759538,3823260,3887700,3952858,4018742,4085352,4152696,4220774,4289594,4359156,4429468,4500530,4572350,4644928,4718272,4792382,4867266,4942924,5019364,5096586,5174598,5253400,5333000,5413398,5494602,5576612,5659436,5743074,5827534,5912816,5998928,6085870,6173650,6262268,6351732,6442042,6533206,6625224,6718104,6811846,6906458,7001940,7098300,7195538,7293662,7392672,7492576,7593374,7695074,7797676,7901188,8005610,8110950,8217208,8324392,8432502,8541546,8651524,8762444,8874306,8987118,9100880,9215600,9331278,9447922,9565532,9684116,9803674,9924214,10045736,10168248,10291750,10416250,10541748,10668252
add $0,4
mov $2,2
sub $2,$0
bin $0,3
mul $0,2
div $2,2
add $0,$2
mov $1,$0
sub $1,1
mul $1,2
|
oeis/253/A253629.asm | neoneye/loda-programs | 11 | 90465 | ; A253629: Multiplicative function defined for prime powers by a(p^e) = p^(e-1)(p+1) if p > 2 and a(2^e) = 2^(e-1).
; Submitted by <NAME>
; 1,1,4,2,6,4,8,4,12,6,12,8,14,8,24,8,18,12,20,12,32,12,24,16,30,14,36,16,30,24,32,16,48,18,48,24,38,20,56,24,42,32,44,24,72,24,48,32,56,30,72,28,54,36,72,32,80,30,60,48,62,32,96,32,84,48,68,36,96,48,72,48,74,38,120,40,96,56,80,48,108,42,84,64,108,44,120,48,90,72,112,48,128,48,120,64,98,56,144,60
add $0,1
mov $1,1
mov $2,2
lpb $0
mov $3,$0
lpb $3
mov $4,$0
mov $6,$2
cmp $6,0
add $2,$6
mod $4,$2
cmp $4,0
cmp $4,0
mov $5,$2
add $2,1
cmp $5,1
max $4,$5
sub $3,$4
lpe
mov $5,1
lpb $0
dif $0,$2
mul $5,$2
lpe
dif $5,$2
mul $1,$5
add $2,1
lpb $2
mul $1,$2
mod $2,4
lpe
lpe
mov $0,$1
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2429.asm | ljhsiun2/medusa | 9 | 246233 | <filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2429.asm<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %rax
push %rbp
push %rcx
push %rdx
push %rsi
lea addresses_UC_ht+0x13f4f, %rax
and %r14, %r14
mov (%rax), %bp
xor %rsi, %rsi
lea addresses_D_ht+0x18d13, %rsi
nop
nop
nop
nop
inc %rdx
movl $0x61626364, (%rsi)
nop
dec %rax
lea addresses_WT_ht+0x17efb, %r12
nop
nop
nop
nop
nop
sub %r14, %r14
movups (%r12), %xmm0
vpextrq $1, %xmm0, %rsi
xor $29943, %r14
lea addresses_A_ht+0x111df, %rbp
nop
nop
nop
nop
add %rcx, %rcx
mov (%rbp), %r14d
nop
nop
nop
nop
nop
and $46610, %r12
lea addresses_A_ht+0x195f7, %rax
nop
nop
sub %rsi, %rsi
movb (%rax), %dl
nop
xor $58553, %rbp
pop %rsi
pop %rdx
pop %rcx
pop %rbp
pop %rax
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r15
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
// REPMOV
lea addresses_A+0x11c4f, %rsi
lea addresses_WT+0x12f5f, %rdi
nop
nop
nop
and $3179, %r11
mov $38, %rcx
rep movsl
nop
nop
add $13636, %r8
// Load
mov $0x1b9, %r15
nop
nop
inc %rdi
mov (%r15), %r8d
nop
nop
nop
add %rsi, %rsi
// Faulty Load
lea addresses_D+0xd4f, %rsi
nop
nop
sub $6831, %rdi
mov (%rsi), %r15w
lea oracles, %r8
and $0xff, %r15
shlq $12, %r15
mov (%r8,%r15,1), %r15
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_D', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WT', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_P', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_D', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'same': True, 'size': 2, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 4, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'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
*/
|
libsrc/_DEVELOPMENT/arch/sms/SMSlib/c/sccz80/SMS_loadSpritePaletteHalfBrightness.asm | jpoikela/z88dk | 640 | 101565 | ; void SMS_loadSpritePaletteHalfBrightness(void *palette)
SECTION code_clib
SECTION code_SMSlib
PUBLIC SMS_loadSpritePaletteHalfBrightness
EXTERN asm_SMSlib_loadSpritePaletteHalfBrightness
defc SMS_loadSpritePaletteHalfBrightness = asm_SMSlib_loadSpritePaletteHalfBrightness
|
libsrc/graphics/__gfx_coords4.asm | jpoikela/z88dk | 38 | 245837 | <gh_stars>10-100
SECTION bss_graphics
PUBLIC __gfx_coords
__gfx_coords: defw 0
defw 0
|
src/Numeric/Nat/Modulo.agda | t-more/agda-prelude | 111 | 16012 | <gh_stars>100-1000
-- Integers modulo N
module Numeric.Nat.Modulo where
open import Prelude
open import Numeric.Nat.DivMod
open import Tactic.Nat
data IntMod (n : Nat) : Set where
modn : ∀ k → k < n → IntMod n
{-# DISPLAY modn k (LessNat.diff _ refl) = k #-}
negIntMod : ∀ {n} → IntMod n → IntMod n
negIntMod (modn 0 lt) = modn 0 lt
negIntMod (modn (suc k) (diff j eq)) = modn (suc j) (by (sym eq))
{-# DISPLAY negIntMod a = negate a #-}
instance
NumberIntMod : ∀ {n} → Number (IntMod (suc n))
Number.Constraint NumberIntMod _ = ⊤
fromNat {{NumberIntMod {n}}} k with k divmod suc n
... | qr _ r lt _ = modn r lt
NegativeIntMod : ∀ {n} → Negative (IntMod (suc n))
Negative.Constraint NegativeIntMod _ = ⊤
fromNeg {{NegativeIntMod}} k = negIntMod (fromNat k)
addIntMod : ∀ {n} → IntMod (suc n) → IntMod (suc n) → IntMod (suc n)
addIntMod {n} (modn a _) (modn b _) = force (a + b) λ a+b → fromNat a+b ofType IntMod (suc n)
mulIntMod : ∀ {n} → IntMod (suc n) → IntMod (suc n) → IntMod (suc n)
mulIntMod {n} (modn a _) (modn b _) = force (a * b) λ a*b → fromNat a*b ofType IntMod (suc n)
subIntMod : ∀ {n} → IntMod (suc n) → IntMod (suc n) → IntMod (suc n)
subIntMod a b = addIntMod a (negIntMod b)
{-# DISPLAY addIntMod a b = a + b #-}
{-# DISPLAY mulIntMod a b = a * b #-}
{-# DISPLAY subIntMod a b = a - b #-}
instance
SemiringIntMod : ∀ {n} → Semiring (IntMod (suc n))
zro {{SemiringIntMod}} = 0
one {{SemiringIntMod}} = 1
_+_ {{SemiringIntMod}} = addIntMod
_*_ {{SemiringIntMod}} = mulIntMod
SubtractiveIntMod : ∀ {n} → Subtractive (IntMod (suc n))
_-_ {{SubtractiveIntMod}} = subIntMod
negate {{SubtractiveIntMod}} = negIntMod
|
itunes-playlist.applescript | marcw/itunes | 1 | 1196 | (* Creates smart playlists of media added by dates. *)
(* Works with iTunes 11 *)
on createSmartPlaylist(start_y, start_m)
set end_m to 1 + start_m
set end_y to start_y
if (end_m = 13) then
set end_m to 1
set end_y to end_y + 1
end if
tell application "iTunes" to activate
tell application "System Events"
key code 53
delay 3
keystroke "n" using {command down, option down}
delay 3
keystroke tab
click
delay 3
keystroke "d"
delay 3
keystroke tab
keystroke "is in the range"
delay 3
keystroke tab
keystroke (start_y as string)
keystroke tab
keystroke (start_m as string)
keystroke tab
keystroke "01"
keystroke tab
keystroke (end_y as string)
keystroke tab
keystroke (end_m as string)
keystroke tab
keystroke "01"
keystroke tab
delay 3
keystroke return
delay 3
keystroke ((start_y as string) & "/" & start_m as string)
delay 3
keystroke return
end tell
end createSmartPlaylist
repeat with y from 2005 to 2012
repeat with m from 1 to 12
createSmartPlaylist(y, m)
end repeat
end repeat |
Transynther/x86/_processed/NONE/_st_/i9-9900K_12_0xa0.log_21829_385.asm | ljhsiun2/medusa | 9 | 91533 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x1b1cd, %rsi
lea addresses_A_ht+0x73f5, %rdi
xor %rdx, %rdx
mov $70, %rcx
rep movsw
nop
xor %r14, %r14
lea addresses_D_ht+0x938d, %rax
nop
nop
and %r13, %r13
mov (%rax), %cx
nop
nop
nop
and %rdx, %rdx
lea addresses_D_ht+0x160d, %rcx
nop
nop
nop
nop
xor %rsi, %rsi
mov $0x6162636465666768, %r13
movq %r13, (%rcx)
nop
nop
nop
nop
sub %r14, %r14
lea addresses_D_ht+0xd58d, %rcx
nop
nop
nop
nop
xor $53498, %r14
mov $0x6162636465666768, %rax
movq %rax, %xmm3
movups %xmm3, (%rcx)
sub %r14, %r14
lea addresses_normal_ht+0x648d, %r13
nop
nop
inc %rdi
vmovups (%r13), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %rdx
nop
nop
nop
nop
sub $36102, %r13
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r8
push %r9
push %rbp
push %rcx
push %rdi
// Load
lea addresses_UC+0x948d, %r10
clflush (%r10)
nop
nop
inc %rdi
vmovups (%r10), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %rbp
nop
nop
nop
nop
nop
cmp $42200, %r8
// Store
lea addresses_PSE+0x15651, %r10
nop
nop
nop
and %r11, %r11
movl $0x51525354, (%r10)
nop
nop
nop
xor %rbp, %rbp
// Store
lea addresses_A+0x10b8d, %rcx
sub %r9, %r9
movb $0x51, (%rcx)
nop
nop
nop
add $40625, %r11
// Store
lea addresses_UC+0xf5f1, %rdi
nop
and %r10, %r10
mov $0x5152535455565758, %r9
movq %r9, (%rdi)
nop
nop
nop
xor $50328, %r11
// Store
lea addresses_A+0x1d38d, %r10
nop
nop
nop
nop
cmp $2262, %r9
movl $0x51525354, (%r10)
nop
nop
nop
xor %rbp, %rbp
// Faulty Load
lea addresses_UC+0x38d, %r11
nop
xor %rdi, %rdi
mov (%r11), %r10d
lea oracles, %r8
and $0xff, %r10
shlq $12, %r10
mov (%r8,%r10,1), %r10
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_UC', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 9, 'type': 'addresses_A', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_UC', 'AVXalign': True, 'size': 8}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 11, 'type': 'addresses_A', 'AVXalign': False, 'size': 4}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 6, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}}
{'src': {'NT': False, 'same': True, 'congruent': 10, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16}}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'54': 21829}
54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54
*/
|
Driver/IFS/DOS/Common/dosFormat.asm | steakknife/pcgeos | 504 | 24571 | <gh_stars>100-1000
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: DOS Common IFS Code
MODULE: Disk Formatting
FILE: dosFormat.asm
AUTHOR: <NAME>, Oct 31, 1991
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Adam 10/31/91 Initial revision
DESCRIPTION:
Implementation of disk formatting.
$Id: dosFormat.asm,v 1.1 97/04/10 11:55:12 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DiskFormatCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskFormat
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Format the disk currently in the passed drive to the passed
format. NOTE: the FSInfoResource should *not* be locked for
the duration of the format, as this will prevent disks in
other drives from being registered. If the FSInfoResource must
be consulted, lock it, get your data, and unlock it.
CALLED BY: DR_FS_DISK_FORMAT
PASS: ss:bx = FSFormatArgs
RETURN: carry set on failure:
ax = error code
carry clear on success:
ax:di = bytes in good clusters
dx:cx = bytes in bad clusters
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 3/12/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskFormat proc far
uses ds, es, bx, si
.enter
;
; Allocate and initialize our workspace
;
call DOSFormatInit
jc done
;
; Perform initial callback.
;
call DOSFormatCallCallback
jc cleanUp
;
; Try and perform a quick-format, if the caller and the media allow.
;
call DOSFormatCheckAndPerformQuick
jnc setName
;
; Format enough to initialize the FAT et al.
;
mov bp, ds:[DFD_lastRootDirTrack]
sub bp, ds:[DFD_startTrack]
inc bp ; startTrack is 1-origin, but
; lastRootDirTrack is 0-origin
call DOSFormatTracks
jc cleanUp
call DOSFormatWriteAdminStuff
jc cleanUp
;
; Format the remainder of the tracks.
;
call DOSFormatFilesArea
jc cleanUp
;
; Name the new disk properly.
;
setName:
call DOSFormatSetName
jc cleanUp
;
; Return the amount of usable and unusable disk space.
;
call DOSFormatReturnRegs
cleanUp:
;
; Clean up.
;
call DOSFormatCleanUp
done:
.leave
ret
DOSDiskFormat endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: DOSFormatCallCallback
DESCRIPTION: Calls the callback routine if one was supplied.
CALLED BY: INTERNAL
PASS: ds = DiskFormatData
RETURN: carry clear to proceed
carry set to abort
ax = FMT_ABORTED
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 7/89 Initial version
ardeb 3/15/92 Brought into IFS driver
-------------------------------------------------------------------------------@
DOSFormatCallCallback proc near
uses cx, dx
.enter
;
; If neither callback type requested, no callback required.
;
test ds:[DFD_formatArgs].FSFA_flags,
mask DFF_CALLBACK_PCT_DONE or \
mask DFF_CALLBACK_CYL_HEAD
jz done
;
; Assume calling with cylinder and head...
;
mov ax, ds:[DFD_curCylinder]
mov bx, ds:[DFD_curHead]
test ds:[DFD_formatArgs].FSFA_flags,
mask DFF_CALLBACK_PCT_DONE
jz doCall
;
; Wrong. Figure how far along we are.
;
mul ds:[DFD_bpb].BPB_numHeads ;dx:ax <- num tracks
; into the disk
mov dx, 100
mul dx
div ds:[DFD_numTracks] ; ax <- percent
doCall:
;
; Pass ax & bx as they are now and call the callback routine,
; which may be in either fixed or movable memory.
;
mov ss:[TPD_dataAX], ax
mov ss:[TPD_dataBX], bx
mov ax, ds:[DFD_formatArgs].FSFA_callback.offset
mov bx, ds:[DFD_formatArgs].FSFA_callback.segment
push ds
mov ds, ds:[DFD_formatArgs].FSFA_ds
call ProcCallFixedOrMovable
pop ds
mov ax, FMT_ABORTED
jc done
clr ax
done:
.leave
ret
DOSFormatCallCallback endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: DOSFormatTracks
DESCRIPTION: Formats tracks from the current cylinder and head.
CALLED BY: INTERNAL (DOSDiskFormat)
PASS: ds, es - DiskFormatData
ds:[DFD_curCylinder] - starting cylinder
ds:[DFD_curHead] - starting head
bp - number of tracks
RETURN: carry set on error
ax - error code
ds:[DFD_curCylinder], ds:[DFD_curHead] - updated
DESTROYED: ax, bx, cx, dx, bp
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 7/89 Initial version
ardeb 3/15/92 Brought into IFS driver
-------------------------------------------------------------------------------@
DOSFormatTracks proc near
mov cx, ds:[DFD_curCylinder]
mov dx, ds:[DFD_curHead]
FT_loop:
call DOSFormatTrack
jc FT_exit
inc dx ;next head
cmp dx, ds:[DFD_bpb].BPB_numHeads ;valid head number?
jb FT_checkDone ;branch if so
clr dx ;else reset head to 0
inc cx
mov ds:[DFD_curCylinder], cx ;next cylinder
FT_checkDone:
mov ds:[DFD_curHead], dx
dec bp
jne FT_loop
clr ax
FT_exit:
ret
DOSFormatTracks endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSFormatWriteAdminStuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Write the administrative information for the disk: the boot
sector, the FAT(s), and the (empty) root directory.
CALLED BY: (INTERNAL) DOSDiskFormat
PASS: ds, es = DiskFormatData
RETURN: carry set on error
DESTROYED: anything but ds & es
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 3/15/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSFormatWriteAdminStuff proc near
uses ds, es
.enter
if PZ_PCGEOS
;
; save and set DisketteParams for Pizza's 1.232M 3.5"
;
cmp ds:[DFD_formatArgs].FSFA_media, MEDIA_1M232
jne noSet1232M
call SysLockBIOS
call SaveAndSet1M232
mov ah, 0 ;reset
call DOSFormatInt13
noSet1232M:
endif
call DOSFormatWriteBootAndReserved
jc done
if _REDMS4
;
; Force DOS to do all the wacky things it does when looking at
; a disk for the first time.
;
push ax, bx, cx, dx, ds
call DOSPreventCriticalErr
mov ah, MSDOS_GET_DISK_GEOMETRY
mov dl, 2
call DOSUtilInt21
call DOSAllowCriticalErr
pop ax, bx, cx, dx, ds
endif
call DOSFormatZeroFAT
jc done
call DOSFormatWriteRootDirectory
jc done
call DOSFormatVerifyKeyTracks
done:
if PZ_PCGEOS
;
; restore DisketteParams for Pizza's 1.232M 3.5"
;
pushf
cmp ds:[DFD_formatArgs].FSFA_media, MEDIA_1M232
jne noUnset1232M
call Unset1M232
mov ah, 0
call DOSFormatInt13
call SysUnlockBIOS
noUnset1232M:
popf
endif
.leave
ret
DOSFormatWriteAdminStuff endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SaveAndSet1M232
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set 1M232 mode.
CALLED BY: format code.
PASS: ds - DiskFormatData
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 4/15/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if PZ_PCGEOS
SaveAndSet1M232 proc near
uses ds, si, es, di, cx
.enter
;
; save and set DisketteParams for Pizza's 1.232M 3.5"
;
segmov es, ds ; es:di = save DP
mov di, offset DFD_methodData.DFMD_bios.DFBD_saveParams
clr si
mov ds, si
; ds:si = DisketteParams
lds si, ds:[BIOS_DISK_PARAMS_VECTOR * (size dword)]
mov cx, size DisketteParams
push si
rep movsb ; save current DisketteParams
pop si
mov ds:[si].DP_bytesPerSector, BBPS_1024
mov ds:[si].DP_sectorsPerTrack, 8
mov ds:[si].DP_gapLength, 35h
mov ds:[si].DP_formatGapLength, 54h
.leave
ret
SaveAndSet1M232 endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Unset1M232
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Unset 1M232 mode.
CALLED BY: format code.
PASS: ds - DiskFormatData
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 4/15/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if PZ_PCGEOS
Unset1M232 proc near
uses si, es, di, cx
.enter
;
; restore DisketteParams for Pizza's 1.232M 3.5"
;
; ds:si = saved DP
mov si, offset DFD_methodData.DFMD_bios.DFBD_saveParams
clr di
mov es, di
; es:di = DisketteParams
les di, es:[BIOS_DISK_PARAMS_VECTOR * (size dword)]
mov cx, size DisketteParams
rep movsb ; restore saved DisketteParams
.leave
ret
Unset1M232 endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NonSysBootstrap
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Bootstrap code copied into a new boot sector to tell the
user s/he's tried to boot a non-system disk.
CALLED BY: boot code.
PASS: nothing
RETURN: nothing
DESTROYED: everything
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 7/25/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
NonSysBootstrap proc far
call 10$
10$:
pop si
add si, noBootee-10$
ploop:
lodsb
tst al
jz done
mov ah, 0xe
int 0x10
jmp ploop
done:
jmp done
noBootee label char
NonSysBootstrap endp
BOOTSTRAP_LENGTH equ $-NonSysBootstrap
COMMENT @-----------------------------------------------------------------------
FUNCTION: DOSFormatWriteBootAndReserved
DESCRIPTION: Initialize the Reserved Area on the disk.
CALLED BY: (INTERNAL) DOSFormatWriteAdminStuff
PASS: ds - DiskFormatData
RETURN: carry set on error
ax - 0 if successful, FMT_ERR_WRITING_BOOT if not
DESTROYED: ax, cx, dx, di, si, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
copy bpb
init other fields
zero bootable signature
write sector out
for a map of the boot sector, see Duncan, pg 180
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 7/89 Initial version
ardeb 3/15/92 Brought over to IFS driver
-------------------------------------------------------------------------------@
oemName char 'GEOWORKS'
char length BS_oemNameAndVersion - length oemName dup (' ')
DOSFormatWriteBootAndReserved proc near
call DOSFormatZeroSectorWorkArea ; es <- sector area
;
; copy partial Bios Param Block into work area.
;
mov si, offset DFD_bpb ;si <- start off to BPB
mov di, offset BS_bpbSectorSize ; = BS_bpbSectorSize
mov cx, offset BS_physicalDriveNumber - \
offset BS_bpbSectorSize
rep movsb
;
; Certain execrable device drivers refuse to look at the geometry
; information we so kindly place in the boot sector unless there's
; a jump at the start (or an IMUL -- God only knows why), so we can't
; 0-initialize the jumpInstr and must, therefore, have real bootstrap
; code there, even if it does nothing.
;
mov {word}es:[BS_jumpInstr],
((BS_bootstrap - 2) shl 8) or 0xeb
mov es:[BS_jumpInstr+2], 0x90
mov es:[BS_bootableSig], 0xaa55
;
; Copy in non-system-disk bootstrap code & non-bootable string.
;
push ds
segmov ds, cs
mov si, offset NonSysBootstrap
mov di, offset BS_bootstrap
mov cx, BOOTSTRAP_LENGTH
rep movsb
segmov ds, Strings, si
mov si, ds:[noBooteeString]
ChunkSizePtr ds, si, cx ; cx <- length w/null
rep movsb
pop ds
;
;***** init disk ID *****
;
mov dl, ds:[DFD_formatArgs].FSFA_drive
mov es:[BS_physicalDriveNumber], dl
mov es:[BS_extendedBootSig], EXTENDED_BOOT_SIGNATURE
mov di, offset BS_oemNameAndVersion
mov si, offset oemName
rept length BS_oemNameAndVersion / 2
movsw cs:
endm
;
; Init volume id in the boot sector. disk handle will be taken care
; of when disk name is set.
;
call DOSGetTimeStamp
mov es:[BS_volumeID].high, cx
mov ds:[DFD_diskID].high, cx
mov es:[BS_volumeID].low, dx
mov ds:[DFD_diskID].low, dx
;
; Init volume label
;
push ds
mov di, BS_volumeLabel
CheckHack <size BS_volumeLabel ge size FCB_name>
lds si, ds:[DFD_formatArgs].FSFA_volumeName
call DOSDiskCopyAndMapVolumeName
pop ds
;
; Set BS_fsType appropriately (FAT16 or FAT12).
;
mov {word}es:[BS_fsType][0], 'F' or ('A' shl 8)
mov {word}es:[BS_fsType][2], 'T' or ('1' shl 8)
push bx ; just in case...
call DOSFormatGetNumClusters
pop bx
cmp ax, FAT_16_BIT_THRESHOLD
mov ax, '6' or (' ' shl 8)
jae finishFSType
mov al, '2'
finishFSType:
mov {word}es:[BS_fsType][4], ax
mov {word}es:[BS_fsType][6], ' ' or (' ' shl 8)
;
; Write the whole boot sector out now.
;
mov cx, ds:[DFD_startBoot] ;specify sector 1
call DOSFormatWriteWorkArea
mov ax, FMT_ERR_WRITING_BOOT
jc done
clr ax
done:
.leave
ret
DOSFormatWriteBootAndReserved endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: DOSFormatZeroFAT
DESCRIPTION: Writes the initial version of the FAT. The FAT will be modified
by DOSFormatFilesArea if it encounters bad sectors.
CALLED BY: INTERNAL (DOSFormatWriteAdminStuff)
PASS: ds - DiskFormatData
RETURN: carry set on error
ax - 0 if successful, FMT_ERR_WRITING_FAT if not
DESTROYED: bx, bp, cx, dx
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 6/90 Initial version
ardeb 4/92 Brought to IFS driver
-------------------------------------------------------------------------------@
DOSFormatZeroFAT proc near
mov al, ds:[DFD_bpb].BPB_numFATs
clr ah
mul ds:[DFD_bpb].BPB_sectorsPerFAT
mov_tr bp, ax
mov cx, ds:[DFD_startFAT]
call DOSFormatZeroSectorWorkArea
initLoop:
call DOSFormatWriteWorkArea
mov ax, FMT_ERR_WRITING_FAT
jc done
inc cx ;next logical sector
dec bp ;dec count
jnz initLoop
clr ax
done:
ret
DOSFormatZeroFAT endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: DOSFormatWriteRootDirectory
DESCRIPTION: Initialize the Root Directory portion of the disk.
CALLED BY: INTERNAL (DOSFormatWriteAdminStuff)
PASS: ds - DiskFormatData
RETURN: carry set on error
ax - 0 if successful, FMT_ERR_WRITING_ROOT_DIR if not
DESTROYED: bx, bp, cx
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
for number of sectors in root dir do
write zeroed sector out to next sector
end for
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 7/89 Initial version
ardeb 4.9.92 IFS version
-------------------------------------------------------------------------------@
DOSFormatWriteRootDirectory proc near
mov bp, ds:[DFD_rootDirSize]
mov cx, ds:[DFD_startRoot]
call DOSFormatZeroSectorWorkArea
initLoop:
call DOSFormatWriteWorkArea
mov ax, FMT_ERR_WRITING_ROOT_DIR
jc done
inc cx ;next logical sector
dec bp ;dec count
jnz initLoop
clr ax
done:
ret
DOSFormatWriteRootDirectory endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: DOSFormatVerifyKeyTracks
DESCRIPTION: Verify the integrity of the important tracks on the disk.
CALLED BY: (INTERNAL) DOSFormatWriteAdminStuff
PASS: ds - DiskFormatData
RETURN: carry set on error
ax - 0 if successful,
else one of:
FMT_ERR_WRITING_BOOT
FMT_ERR_WRITING_ROOT_DIR
FMT_ERR_WRITING_FAT
DESTROYED: bx,cx,dx,bp,di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 6/90 Initial version
-------------------------------------------------------------------------------@
DOSFormatVerifyKeyTracks proc near
uses ds, es
.enter
;
; Point DS to the sector buffer for the duration.
;
mov ax, ds:[DFD_sectorBuffer]
mov bx, ds
mov es, bx
mov ds, ax
call SysLockBIOS
;
; Flush any sectors out of the cache, so we can be reasonably
; certain the thing's going to the disk.
;
mov ah, MSDOS_RESET_DISK
call DOSUtilInt21
;
; Now read all the sectors that make up the administrative part of
; the disk, i.e. up to the first data sector.
;
clr dx ;logical sector 0
if PZ_PCGEOS
;seems like this would be the right thing for a DOS call
mov al, es:[DFD_formatArgs].FSFA_drive
else
mov al, es:[DFD_biosDrive]
endif
mov cx, 1 ;specify 1 sector
verifyLoop:
;
; Read this sector.
;
clr bx ;ds:bx <- buffer for read
push ax,cx,dx
int 25h
inc sp ; throw away flags from int
inc sp
mov_tr bx, ax
pop ax,cx,dx
jc error
;
; Advance to next sector.
;
inc dx
cmp dx, es:[DFD_startFiles] ;done all sectors?
jne verifyLoop ; no
clr ax ;ax <- 0, clear C
jmp done
error:
;
; Cope with attempting 16-bit read on 32-bit device when drive
; managed by some driver other than us. We should get back
; ERROR_UNKNOWN_MEDIA, suitably massaged, according to Drew @
; Datalight, in which case we'll try a 32-bit read.
;
cmp bl, CE_UNKNOWN_MEDIA
je verify32Bit ; go do entire verification with 32-bit
; stuff
returnError:
;
; Figure in what part of the administrative data the error lies and
; return the appropriate error code.
;
mov ax, FMT_ERR_WRITING_BOOT
cmp dx, es:[DFD_startFAT]
jb doneError
mov ax, FMT_ERR_WRITING_FAT
cmp dx, es:[DFD_startRoot]
jb doneError
mov ax, FMT_ERR_WRITING_ROOT_DIR
doneError:
stc
done:
call SysUnlockBIOS
.leave
ret
verify32Bit:
;
; Read this sector.
;
clr bx
pushdw dsbx ; address of buffer
inc bx ; (1-byte inst)
push bx ; # sectors
dec bx ; (1-byte inst)
pushdw bxdx ; starting sector
segmov ds, ss ; ds:bx <- parameter block
mov bx, sp
mov di, es:[DFD_startFiles]
verify32BitLoop:
push ax ; save drive # across call
mov cx, -1 ; Indicate read on huge
int 25h
inc sp ; throw away flags from int
inc sp
pop ax
mov bx, sp ; re-establish BX for loop and
; sector increment
jc return32BitError
inc {word}ds:[bx] ; advance to next sector
cmp di, ds:[bx] ; done?
jne verify32BitLoop ; no...
lea sp, [bx+8] ; yes, clear all but saved DS off
; the stack
pop ds
clr ax ; ax <- 0, clear carry
jmp done
return32BitError:
pop dx ; dx <- erroneous sector
lea sp, [bx+8]
pop ds
jmp returnError
DOSFormatVerifyKeyTracks endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSFormatGetNumClusters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Figure the number of clusters on the disk.
CALLED BY: (INTERNAL) DOSFormatAllocFATBuffer,
DOSFormatQFreeAllGoodClusters
PASS: ds = DiskFormatData
RETURN: ax = # clusters
DESTROYED: bx, dx
SIDE EFFECTS: none
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSFormatGetNumClusters proc near
.enter
call DOSFormatInitGetNumSectors ; dxax <- #
sub ax, ds:[DFD_startFiles] ;ax <- num sectors in
; files area
sbb ax, 0
mov bl, ds:[DFD_bpb].BPB_clusterSize
clr bh
div bx ;ax <- num clusters
inc ax ; must include the 2 reserved
inc ax ; clusters, else FAT will be the
; wrong size...
.leave
ret
DOSFormatGetNumClusters endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSFormatAllocFATBuffer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Allocate a buffer to hold an entire copy of the FAT as a
bitmap.
CALLED BY: (INTERNAL) DOSFormatFilesArea, DOSFormatCheckAndPerformQuick
PASS: ds = DiskFormatData
RETURN: carry set if couldn't allocate buffer:
ax = FMT_ERR_WRITING_FAT
bx = destroyed
carry clear if buffer allocated:
ax, es = segment of locked buffer
bx = handle of buffer
ds:[DFD_fat] = handle of buffer
bp = 0 if 12-bit FAT, non-zero if 16-bit
DESTROYED: cx, dx
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSFormatAllocFATBuffer proc near
.enter
;-----------------------------------------------------------------------
;make ax contain num clusters
;
;num clusters = (num sectors - start files area) DIV cluster size
call DOSFormatGetNumClusters
;-----------------------------------------------------------------------
;make bp contain 12/16 bit FAT format indicator
clr bp ;assume 12 bit format
cmp ax, FAT_16_BIT_THRESHOLD ;16 bit format required?
jb calcFATSize ;branch if not
dec bp ;else modify value
calcFATSize:
;-----------------------------------------------------------------------
;allocate space for FAT in mem
;ax = num clusters
add ax, 7
rcr ax ; can only carry out one bit
shr ax ; so only have to shift one
shr ax ; into the low word
;allocate the block
mov cx, (mask HAF_ZERO_INIT shl 8) or ALLOC_DYNAMIC_LOCK
call MemAlloc ;ax <- func(ax,ch),
; destroys cx
jnc haveFATBuffer
mov ax, FMT_ERR_WRITING_FAT
jmp exit
haveFATBuffer:
mov ds:[DFD_fat], bx
mov es, ax
exit:
.leave
ret
DOSFormatAllocFATBuffer endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: DOSFormatFilesArea
DESCRIPTION: Formats the Files Area portion of the disk and builds
the FAT at the same time. The FATs are written out when
formatting is done.
CALLED BY: INTERNAL (DOSDiskFormat)
PASS: ds - DiskFormatData
RETURN: carry set on error
ax - 0 if successful, FMT_ERR_? if not
DESTROYED: bx, cx, dx, bp, es, di, si
REGISTER/STACK USAGE:
ax - general purpose
bx - current FAT sector
cl - current sector
dl - drive
bp - 12/16 bit increment value (0 or 1)
di - offset into sector work area to current FAT entry
si - track count
PSEUDO CODE/STRATEGY:
process Files Area sectors in last root dir track
for all subsequent tracks
format and verify track
if ok then
zero out FAT entries
else
verify clusters in track individually
endif
make note of unprocessed sectors
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 7/89 Initial version
-------------------------------------------------------------------------------@
DOSFormatFilesArea proc near
uses ds
.enter
;
; Figure the number of data sectors that lie at the end of the final
; root-directory track, storing that value in DFD_unprocessedDataSectors
; so we take care of their clusters properly (they're all good or we
; wouldn't be here).
;
mov ax, ds:[DFD_startFiles] ;get logical sector number
clr dx
mov si, ds:[DFD_bpb].BPB_sectorsPerTrack
div si ;dx <- ax mod sectors per track
sub si, dx ;calc num unprocessed sectors
mov ds:[DFD_unprocessedDataSectors], si
;
; Now allocate a buffer for the FAT.
;
call DOSFormatAllocFATBuffer
jc exit
;-----------------------------------------------------------------------
;reserve the first 2 FAT entries, as expected
;mark them BAD, though. FAT write-out code will take care
;of setting them properly.
;
mov ds:[DFD_fatMask], 1 shl 2
clr di ;init FAT entry offset
mov ds:[DFD_fatOffset], di
mov {byte}es:[0], 00000011b
call MemUnlock ;release the FAT
;-----------------------------------------------------------------------
;ds = DiskFormatData
;bp = FAT format flag (TRUE if 16-bit)
EC< mov ax, ds:[DFD_bpb].BPB_sectorsPerTrack >
EC< cmp ax, ds:[DFD_unprocessedDataSectors] >
EC< ERROR_B FORMAT_ASSERTION_FAILED ; more unprocessed sectors>
EC < ; than fit on a track >
;
; Process clusters left over from the root directory track.
;
call DOSFormatProcessClusters
mov si, ds:[DFD_numTracks]
sub si, ds:[DFD_lastRootDirTrack] ;si <- num tracks to
; process
formatLoop:
;
; Format the next track on the disk.
;
push cx, dx
mov cx, ds:[DFD_curCylinder] ;init param table
mov dx, ds:[DFD_curHead]
call DOSFormatTrack
pop cx, dx ;ch <- cylinder,
; dh <- head
jnc trackOK
;
; Error formatting the track. If format aborted by user, then stop
; in our tracks.
;
cmp ax, FMT_ABORTED
stc
je exit
;
; format/verify track failed, verify clusters individually
;
call DOSFormatProcessBadTrack
jmp nextTrack
trackOK:
;
; Mark this track's sectors as unprocessed for DOSFormatProcessClusters
;
mov ax, ds:[DFD_bpb].BPB_sectorsPerTrack
add ds:[DFD_unprocessedDataSectors], ax
call DOSFormatProcessClusters ;func(ds,bp), destroys
; ax
nextTrack:
mov ax, ds:[DFD_curHead]
inc ax ;next head
cmp ax, ds:[DFD_bpb].BPB_numHeads ;valid head number?
jb storeHead ;branch if so
clr ax ;else reset head to 0
inc ds:[DFD_curCylinder] ;next cylinder
storeHead:
mov ds:[DFD_curHead], ax
dec si ; another track down
jne formatLoop
call DOSFormatProcessClusters ;process remaining
; sectors
;
; Write however many copies of the FAT are required by the format.
;
call DOSFormatWriteFATs
exit:
.leave
ret
DOSFormatFilesArea endp
if ERROR_CHECK
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DFAssertBPNotTrashed
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Make sure bp hasn't been munged, but is still either 0
(12-bit FAT) or -1 (16-bit FAT)
CALLED BY: INTERNAL
PASS: bp
RETURN: only if BP ok
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 4/ 9/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DFAssertBPNotTrashed proc near
.enter
tst bp
je done
cmp bp, -1
ERROR_NZ FORMAT_ASSERTION_FAILED
done:
.leave
ret
DFAssertBPNotTrashed endp
endif ; ERROR_CHECK
COMMENT @-----------------------------------------------------------------------
FUNCTION: DOSFormatProcessClusters
DESCRIPTION: Track was formatted and verified successfully. Update the
appropriate number of FAT entries.
CALLED BY: INTERNAL (DOSFormatFilesArea)
PASS: ds - DiskFormatData
bp - FAT format flag (TRUE if 16-bit)
di - offset to first cluster entry for the just-formatted
track
RETURN: di - offset to next cluster entry
ds:[DFD_unprocessedDataSectors] = number of sectors from
this track that weren't marked as part of a good cluster,
owing to the cluster size and the number of sectors per
track.
DESTROYED: ax
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
Since all the sectors were good and the FAT buffer was
allocated zero-initialized, we have only to count the
number of clusters the sectors were, adding that to
DFD_goodClusters, and advance the cluster pointer (di)
appropriately, along with setting the DFD_fatToggle correctly,
if the FAT is using 12-bit entries.
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 7/89 Initial version
ardeb 4.9.92 IFS version
-------------------------------------------------------------------------------@
DOSFormatProcessClusters proc near
uses cx, dx
.enter
EC < call DFAssertBPNotTrashed
;
; Compute the number of clusters in the track just successfully
; formatted.
;
mov ax, ds:[DFD_unprocessedDataSectors]
tst ax
jz done ; => no sectors were actually
; formatted...?
mov cl, ds:[DFD_bpb].BPB_clusterSize
cmp cl, 1 ;cluster size = 1?
je trivial ;branch if so
clr dx ; zero-extend both # sectors
mov ch, dh ; and cluster size
div cx ;ax <- complete clusters present
mov ds:[DFD_unprocessedDataSectors], dx ;save remainder
; for next track
jmp clustersComputed
trivial:
;
; Trivial case of above computation: no sectors will be left b/c each
; sector is a cluster.
;
mov ds:[DFD_unprocessedDataSectors], 0
clustersComputed:
;
; Add all the clusters from this track into the number of good clusters
; on the disk so far.
;
add ds:[DFD_goodClusters], ax
mov cx, ax ;cx <- num clusters
;
; First skip over the clusters in the current byte that haven't
; been processed.
;
mov al, ds:[DFD_fatMask]
skipBeginLoop: ; could be done with
; binary search, but...
shl al
loopnz skipBeginLoop
jnz clustersSkipped ; ran out of clusters in the
; loop -- leave al set to the
; mask for next time, and
; DFD_fatOffset remains as
; it was
inc di
;
; Now skip the whole bytes that represent clusters that are in this
; range.
;
mov ax, cx
andnf ax, 0x7 ; al <- left-over clusters
shr cx ; convert middle clusters to
shr cx ; # of bytes to skip
shr cx
add di, cx ; skip that many
;
; Finally, set DFD_fatMask to the mask for the first cluster yet
; unprocessed in the now-current byte.
;
mov_tr cx, ax
mov al, 1
shl al, cl
clustersSkipped:
mov ds:[DFD_fatMask], al
done:
.leave
ret
DOSFormatProcessClusters endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: DOSFormatProcessBadTrack
DESCRIPTION: When FormatTrack fails, the clusters corresponding to
the sectors on the track are marked as bad.
The original approach was to go through and verify each sector
to recover as much space as possible but int 13h function 4
turned out to be very unreliable since it often returns OK
with sectors that turn out to be bad. (This must be because
all it does is verify the sector address mark).
This 'verification' approach can be pursued and an actual
write, read, verify can be done for each sector but for
simplicity, it is not. The original code has been commented
out rather than deleted for any future endeavors in this regard.
DOS seems to take the approach we do, which is to mark all
corresponding clusters as bad. This conclusion is drawn
from status comparisons at the end of our format and DOS's
format on the same disk.
CALLED BY: (INTERNAL) DOSFormatFilesArea
PASS: bp - FAT format flag (TRUE if 16-bit)
ds - DiskFormatData
di - offset to current cluster entry
ds:[DFD_fatToggle] (for 12-bit FAT)
ds:[DFD_curCylinder]
ds:[DFD_curHead]
ds:[DFD_unprocessedDataSectors] = sectors from previous track
that go into the first bad cluster of this track. if
negative, it's the number of sectors in this track
that have already been included as the last bad cluster
of the previous track.
RETURN: di - offset to next cluster entry
ds:[DFD_fatToggle] = 1 or 0 (for 12-bit FAT)
ds:[DFD_unprocessedDataSectors] = -(number of sectors used from
next track as part of the last bad cluster on this track)
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
format/verify track failed for some reason
if (unprocessedSectors != 0) {
add to sectors/track and use sum to figure # clusters
this also takes care of unprocessedSectors < 0
}
divide # sectors by cluster size.
if any remainder {
unprocessSectors = remainder - cluster size
#clusters += 1
} else {
unprocessedSectors = 0
}
add # bad clusters to DFD_badClusters
lock FAT buffer
foreach bad cluster
set FAT entry to FAT_CLUSTER_BAD
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
if bios verify track is used, take care of upper 2 bits of 10-bit
cylinder number in cl
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 7/89 Initial version
ardeb 4.9.92 IFS version
-------------------------------------------------------------------------------@
DOSFormatProcessBadTrack proc near
uses ax, cx, dx
.enter
EC < call DFAssertBPNotTrashed >
mov ax, ds:[DFD_bpb].BPB_sectorsPerTrack
mov cx, ds:[DFD_unprocessedDataSectors]
jcxz computeNumberOfClusters
add ax, cx ; ax <- # sectors involved.
; increases if sectors from
; previous track involved;
; decreases if some of this
; track's sectors were stolen
; by previous bad track
computeNumberOfClusters:
; ax = # sectors to mark bad
mov cl, ds:[DFD_bpb].BPB_clusterSize
clr dx ; zero-extend # sectors
mov ch, dl ; and cluster size
div cx ; ax <- # clusters,
; dx <- remainder
tst dx
jz storeNumberUnprocessed
sub dx, cx ; dx <- -(number stolen from
; next track). we steal enough
; to make up a complete
; final cluster, of course.
inc ax ; 1 more cluster to mark bad
storeNumberUnprocessed:
mov ds:[DFD_unprocessedDataSectors], dx
add ds:[DFD_badClusters], ax
mov_tr cx, ax ; cx <- # clusters to mark bad
;
; Lock down the FAT buffer so we can actually mark things.
;
mov bx, ds:[DFD_fat]
call MemLock
mov es, ax
;
; Now mark them. (could be done "more efficiently" perhaps by computing
; beginning and ending masks and storing 0xff in the intermediate bytes,
; but this is a rare occurrence and it's not that bad to or in the bytes
; so that's what we do, for the sake of simplicity)
;
mov al, ds:[DFD_fatMask]
markLoop:
ornf es:[di], al
shl al
loopnz markLoop
jnz markDone ; => ran out of clusters, so
; don't advance DI or reset AL
inc di ; ran out of byte, so advance
mov al, 1 ; to next and reset mask
tst cx
jnz markLoop
markDone:
mov ds:[DFD_fatMask], al
;
; Marking is complete. DI and ds:[DFD_fatMask] point properly to
; indicate the next cluster to mark one way or the other, so unlock the
; FAT buffer until we need it again.
;
call MemUnlock
.leave
ret
DOSFormatProcessBadTrack endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: DOSFormatWriteFATs
DESCRIPTION: Write out however many copies of the FAT are required.
CALLED BY: (INTERNAL) DOSFormatFilesArea
PASS: ds - DiskFormatData
ds:[DFD_fat] = handle of unlocked buffer holding FAT
to write.
bp - FAT format flag (TRUE if 16-bit)
RETURN: carry set on error
ax - 0 if successful, FMT_ERR_WRITING_FAT if not
DESTROYED: bx, cx, dx, bp, di, si, es
PSEUDO CODE/STRATEGY:
You would think we could do something reasonable like find the
number of sectors in a FAT, point to the FAT buffer we've allocated
and call DOSWriteSectors to write them all out. You'd be wrong.
The problem lies in the DMA system of the PC, which can't DMA things
across a 64K linear boundary, which our buffer, in all its glory,
could well cross.
So we copy the FAT into our sector-buffer work area sector by sector
and write each one out.
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
One possible optimization is to use each filled-in sector buffer to
write the appropriate sector in each copy of the FAT before moving
on to the next sector in the FAT. I don't know what an impact that
would have on the process, as far as seek time etc. are concerned
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 7/89 Initial version
ardeb 10/8/92 Ported to IFS driver
-------------------------------------------------------------------------------@
DOSFormatWriteFATs proc near
mov al, ds:[DFD_bpb].BPB_numFATs
clr ah
mov di, ax
;
; Loop through building each sector in our work area and writing it out
; to each FAT.
;
mov dx, ds:[DFD_startFAT]
mov cx, ds:[DFD_bpb].BPB_sectorsPerFAT
clr si
mov ax, 1 ; al <- cluster mask bit,
; ah <- byte left over from previous
; sector (nothing)
mov ds:[DFD_fatToggle], 0 ; doing even cluster, if 12-bit
clr di ; start storing at beginning of sector
sectorLoop:
call DOSFormatCreateFATSector
call DOSFormatWriteFATSector ; write to all FATs
jc fatWriteError
inc dx ; advance to next sector
loop sectorLoop
done:
ret
fatWriteError:
mov ax, FMT_ERR_WRITING_FAT
jmp done
DOSFormatWriteFATs endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSFormatCreateFATSector
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create one sector of the FAT in the work area based on the
bitmask for the current range of clusters
CALLED BY: (INTERNAL) DOSFormatWriteFATs
PASS: ds = DiskFormatData
si = byte offset within FAT bitmap
al = bit mask of first cluster to store in sector
di = offset within sector at which to start storing
(0 or 1)
ah = byte to store as the first of the sector (carry-
over from previous sector)
bp = non-zero if 16-bit FAT
RETURN: di, ah, si, al = updated
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/18/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSFormatCreateFATSector proc near
fatSize local word \
push bp
workArea local sptr.DiskFormatData \
push ds
fatToggle local byte
uses bx, cx, dx, ds, es
.enter
;
; Initialize the sector buffer to all 0's so we just have to OR
; things in if the cluster is bad...
;
call DOSFormatZeroSectorWorkArea ; es <- work area
;
; Fetch various things out of our DiskFormatData before we lock down
; the FAT bitmask.
;
mov bx, ds:[DFD_fat]
mov cx, ds:[DFD_bpb].BPB_sectorSize
sub cx, di ; adjust by # bytes being
; used by carry-over from
; previous sector
push ax
mov al, ds:[DFD_fatToggle]
mov ss:[fatToggle], al
call MemLock
mov ds, ax
pop ax
mov es:[0], ah ; store carry-over byte
mov ah, al ; ah <- bit to check
;
; New stuff: in case byte offset is 0 (AH==1), we don't need to care
; about bits for clusters left over from last byte of previous sector
; -simon (11/10/94)
;
cmp ah, 1
je haveBitsForFirstCluster ; nothing left from previous
; byte
mov al, ds:[si-1] ; al <- bits for clusters
; left over from last byte
; of previous sector
haveBitsForFirstCluster:
tst ss:[fatSize]
jnz create16Bit
;
; Create a 12-bit sector. Much more fun.
;
call DOSFormatCreate12BitFATSector
markDone:
mov ds, ss:[workArea]
mov bx, ds:[DFD_fat]
call MemUnlock
mov bl, ss:[fatToggle]
mov ds:[DFD_fatToggle], bl
.leave
ret
create16Bit:
call DOSFormatCreate16BitFATSector
jmp markDone
DOSFormatCreateFATSector endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSFormatCreate12BitFATSector
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create a FAT sector for a 12-bit FAT
CALLED BY: (INTERNAL) DOSFormatCreateFATSector
PASS: ds:si = next byte within the FAT bitmap to process
ah = mask of current bit to check
al = byte within which to look for it
es:di = place within sector work area into which to
merge the bad cluster mark for the next cluster
cx = number of bytes left in the sector work area
RETURN: ah = carry-over byte for the next sector
di = offset at which to start storing in the next
sector
al = mask for first cluster in next sector
ds:si = thing to pass for next sector (points to next
byte in bitmask to process)
DESTROYED: bx, cx, dx
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
During the loop, bx holds the value to OR in if this cluster
is bad, while dx holds the value to OR in if the next cluster
is bad. They hold the "bad cluster" mark either left-justified
or shifted left 4 bits, depending on whether the current
cluster is "even" (starts on a byte boundary in the FAT)
or "odd" (starts with the high nibble of the current byte)
;Pretty Diagrams:
; 0 1 2 3 4 5
; +---+---+---+---+---+---+
; | c1 | c2 | c3 | c4 |
; +---+---+---+---+---+---+
;
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/18/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSFormatCreate12BitFATSector proc near
.enter inherit DOSFormatCreateFATSector
;
; Set bx/dx appropriately, depending on whether the first cluster
; of this sector is even or odd.
;
mov bx, FAT_CLUSTER_BAD and 0xfff
mov dx, (FAT_CLUSTER_BAD and 0xfff) shl 4
tst ss:[fatToggle]
jz markLoop
xchg bx, dx
markLoop:
;
; If we're back to the first bit of the next byte, load the next
; byte into AL, advancing SI
;
cmp ah, 1
jne checkCluster
lodsb
checkCluster:
;
; If we're only going to get 8 or 4 bits (even or odd cluster, resp.)
; of this cluster into this sector, handle it specially
;
cmp cx, 1
je handlePartialCluster
;
; Entire cluster will fit within this sector. If the cluster isn't
; bad, we need do nothing, as the thing is already 0 (free).
;
test al, ah
jz nextCluster
;
; If the cluster is in the first byte, it may be one of the two
; reserved ones that require special treatment.
;
cmp si, 1
je maybeStoreMedia
markBad:
ornf es:[di], bx
nextCluster:
;
; Advance to the next cluster.
;
xchg bx, dx ; swap bad-cluster values
rol ah ; rotate the cluster bit
; mask to the next bit. If
; it comes back to 1, we'll
; reload AL at the top of
; the loop.
inc di ; always need to advance by 1
; at least
dec cx ; which consumes a byte...can't
; be 0 as we checked for cx==1
; earlier
xor ss:[fatToggle], 1
jnz markLoop ; now odd, so advance only
; one byte
inc di ; now even, so skip high
dec cx ; byte of odd cluster
jnz markLoop ; loop if more bytes in the
; sector
;
; Sector is complete.
;
clr dx, di ; don't alter first byte of
; next sector, but start
; storing things there...
done:
mov al, ah
mov ah, dh ; first byte of next sector
; should be set to high byte
; of bad cluster for prev
; cluster type, since we
; always swap them and prev
; cluster type is the one
; that's incomplete
.leave
ret
handlePartialCluster:
;
; There's only one byte left in this sector, so we need to set it
; as we think appropriate and set things up so the first byte/nibble
; of the next sector is also set properly.
;
test al, ah ; cluster bad?
jnz markPartialBad ; => yes
clr bx ; no -- make sure first byte of
; next sector is left 0
partialDone:
xchg bx, dx ; swap bad-cluster values
clr di ; assume now even, so want to
; start in 0th byte
xor ss:[fatToggle], 1
jnz done ; was odd, so DI is right
inc di ; start w/byte 1 (high byte
; of odd cluster takes up
; entire byte 0)
jmp done
markPartialBad:
ornf es:[di], bl
jmp partialDone
;--------------------
maybeStoreMedia:
;
; Cluster in first byte of bitmask is bad, so we may have to store
; the media descriptor or 0xfff for the cluster.
;
cmp ah, 1 shl 2
jae markBad ; => not reserved
push bx, ds
mov ds, ss:[workArea]
mov bl, ds:[DFD_bpb].BPB_mediaDescriptor
mov bh, 0x0f
cmp ah, 1 shl 0
je setReservedCluster
mov bx, 0xfff shl 4
setReservedCluster:
ornf es:[di], bx
pop bx, ds
jmp nextCluster
DOSFormatCreate12BitFATSector endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSFormatCreate16BitFATSector
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create a FAT sector for a 16-bit FAT
CALLED BY: (INTERNAL) DOSFormatCreateFATSector
PASS: ds:si = next byte within the FAT bitmap to process
ah = mask of current bit to check
al = byte within which to look for it
es:di = place within sector work area into which to
merge the bad cluster mark for the next cluster
cx = number of bytes left in the sector work area
RETURN: ah = carry-over byte for the next sector
di = offset at which to start storing in the next
sector
al = mask for first cluster in next sector
ds:si = thing to pass for next sector (points to next
byte in bitmask to process)
DESTROYED:
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
This is pretty straight-forward, since we're dealing with
words, which won't cross sector boundaries.
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/18/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSFormatCreate16BitFATSector proc near
.enter inherit DOSFormatCreateFATSector
markLoop:
;
; If we're back to the first bit of the next byte, load the next
; byte into AL, advancing SI
;
cmp ah, 1
jne checkCluster
lodsb
checkCluster:
;
; If the cluster isn't bad, we need do nothing, as the thing is already
; 0 (free).
;
test al, ah
jz nextCluster
;
; If the cluster is in the first byte, it may be one of the two
; reserved ones that require special treatment.
;
cmp si, 1
je maybeStoreMedia
markBad:
mov es:[di], FAT_CLUSTER_BAD
nextCluster:
;
; Advance to the next cluster.
;
rol ah ; rotate the cluster bit
; mask to the next bit. If
; it comes back to 1, we'll
; reload AL at the top of
; the loop.
inc di
inc di
dec cx
loop markLoop
;
; Sector is complete.
;
clr di ; start storing at first
; byte of next sector
mov al, ah ; al <- mask for first cluster
; in next sector
clr ah ; first byte of next sector
; should be left alone
.leave
ret
maybeStoreMedia:
;
; Cluster in first byte of bitmask is bad, so we may have to store
; the media descriptor or 0xfff for the cluster.
;
cmp ah, 1 shl 2
jae markBad ; => not reserved
push bx, ds
mov ds, ss:[workArea]
mov bl, ds:[DFD_bpb].BPB_mediaDescriptor
mov bh, 0xff
cmp ah, 1 shl 0
je setReservedCluster
mov bx, 0xffff
setReservedCluster:
mov es:[di], bx
pop bx, ds
jmp nextCluster
DOSFormatCreate16BitFATSector endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSFormatWriteFATSector
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Write the sector generated in the sector work area out to
all the FATs for the disk.
CALLED BY: (INTERNAL) DOSFormatWriteFATs
PASS: dx = sector within first FAT
ds = DiskFormatData
RETURN: carry set on error
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/18/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSFormatWriteFATSector proc near
uses ax, bx, cx, dx, si, di, ds, es
.enter
;
; Fast case: use DOSWriteSectors to write the entire FAT at one fell
; swoop.
;
mov si, ds:[DFD_formatArgs].FSFA_dse
mov cl, ds:[DFD_bpb].BPB_numFATs
clr ch
mov bx, ds:[DFD_bpb].BPB_sectorsPerFAT
call FSDLockInfoShared
mov es, ax ; es:si <- DriveStatusEntry
if PZ_PCGEOS
mov al, ds:[DFD_formatArgs].FSFA_media
endif
mov ds, ds:[DFD_sectorBuffer]
clr di ; ds:di <- buffer to write
fatLoop:
push bx, cx
clr bx ; bxdx = sector to write
mov cx, 1 ; 1 sector at a time, please
if PZ_PCGEOS
;
; for Pizza's 1.232M 3.5", we use 1024 byte sectors
;
cmp al, MEDIA_1M232
jne not1M232
shl cx, 1 ; #sectors*2
shldw bxdx ; start sector*2
not1M232:
endif
call DOSWriteSectors
pop bx, cx
jc done
add dx, bx ; advance to next FAT
EC < ERROR_C GASP_CHOKE_WHEEZE >
loop fatLoop
clc
done:
call FSDUnlockInfoShared
.leave
ret
DOSFormatWriteFATSector endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: DOSFormatZeroSectorWorkArea
DESCRIPTION: Zero out the sector work area.
CALLED BY: INTERNAL
PASS: ds - DiskFormatData
RETURN: es = sector buffer, initialized to 0
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 7/89 Initial version
ardeb 4.9.92 IFS version
-------------------------------------------------------------------------------@
DOSFormatZeroSectorWorkArea proc near
uses ax, cx, di
.enter
mov es, ds:[DFD_sectorBuffer]
clr ax
mov di, ax
if PZ_PCGEOS
mov cx, ds:[DFD_bpb].BPB_sectorSize
shr cx, 1
else
mov cx, MSDOS_STD_SECTOR_SIZE / 2
endif
cld
rep stosw
.leave
ret
DOSFormatZeroSectorWorkArea endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: DOSFormatWriteWorkArea
DESCRIPTION: Writes the sector work area out to disk.
CALLED BY: INTERNAL
PASS: es - seg addr of sector work area
cx - logical sector number
ds - DiskFormatData
RETURN: ax - error code
carry set on error
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 7/89 Initial version
-------------------------------------------------------------------------------@
DOSFormatWriteWorkArea proc near
uses bx, cx, dx, si, ds, es
.enter
call FSDLockInfoShared
push es
mov es, ax
mov si, ds:[DFD_formatArgs].FSFA_dse ;specify drive
if PZ_PCGEOS
mov al, ds:[DFD_formatArgs].FSFA_media
mov ah, ds:[DFD_biosDrive]
endif
pop ds
clr di ;ds:di <- buffer
clr bx
mov dx, cx ;bx:dx <- sector number
mov cx, 1 ;specify num sectors
if PZ_PCGEOS
;
; force BIOS usage for track 0
;
push {word} es:[si].DSE_number
cmp al, MEDIA_1M232
jne 10$
shl cx, 1 ;number of sectors*2
shldw bxdx ;start sector*2
cmp es:[si].DSE_number, 2
jb 10$
cmp dx, MAX_NON_CACHE
jae 10$
mov es:[si].DSE_number, ah
10$:
endif
call DOSWriteSectors
if PZ_PCGEOS
;
; undo hack
;
pop cx
mov es:[si].DSE_number, cl
pushf
push ax
mov ah, 0 ; reset
mov dl, ds:[DFD_biosDrive]
call DOSFormatInt13
pop ax
popf
endif
call FSDUnlockInfoShared
.leave
ret
DOSFormatWriteWorkArea endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSFormatSetName
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the volume name for the disk.
CALLED BY: (INTERNAL) DOSDiskFormat
PASS: ds = DiskFormatData
RETURN: carry set on error:
ax = error code
carry clear if successful
DESTROYED: ax, bx, es, si, di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/ 6/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSFormatSetName proc near
volFCB local FCB ; FCB to create new volume label (there
; is no other, since we biffed the
; root directory)
dta local RenameFCB ; DTA for DOS to use during volume
; location (needs an unopened
; extended FCB).
.enter
tst ds:[DFD_formatArgs].FSFA_volumeName.segment
jz noVolumeName
;
; Perform bullshit call to locate a volume label, as appears to be
; required by DR DOS 6.0
;
mov dl, ds:[DFD_formatArgs].FSFA_drive
lea di, ss:[volFCB]
lea bx, ss:[dta]
push ds
call DOSDiskLocateVolumeLow
pop ds
EC < tst al >
EC < ERROR_Z HOW_IN_THE_HELL_DID_THIS_DISK_GET_A_VOLUME_LABEL?>
;
; Store the new name in the FCB.
;
segmov es, ss
lea di, ss:[volFCB].FCB_name
push ds
lds si, ds:[DFD_formatArgs].FSFA_volumeName
call DOSDiskCopyAndMapVolumeName
pop ds
;
; Tell DOS to create the thing.
;
mov ah, MSDOS_FCB_CREATE
push ds
segmov ds, ss
lea dx, ss:[volFCB]
call DOSUtilInt21
pop ds
tst al
jnz createFailed
;
; Now see if there's a DiskDesc whose name we need to change.
;
mov si, ds:[DFD_formatArgs].FSFA_disk
tst si
jz done
;
; Indeed there is. Lock down the FSIR shared (XXX: perhaps excl so
; someone getting info about this disk doesn't get nailed?)
;
call FSDLockInfoShared
mov es, ax
;
; Copy the mapped name from the FCB using our standard routine.
;
push ds
segmov ds, ss
add dx, offset FCB_name
call DOSDiskCopyVolumeNameToDiskDesc
pop ds
;
; Make sure it's not marked nameless.
;
andnf es:[si].DD_flags, not mask DF_NAMELESS
setDiskID:
;
; Now copy the new ID from our data into the disk descriptor.
;
mov ax, ds:[DFD_diskID].low
mov es:[si].DD_id.low, ax
mov ax, ds:[DFD_diskID].high
mov es:[si].DD_id.high, ax
;
; Unlock the FSIR and signal our happiness
;
call FSDUnlockInfoShared
clc
done:
.leave
ret
noVolumeName:
;
; No volume name, so see if there's a DiskDesc we need to update.
;
mov si, ds:[DFD_formatArgs].FSFA_disk
tst si
jz done
;
; There is. First generate a nameless name for the thing.
;
call FSDLockInfoShared
mov es, ax
test es:[si].DD_flags, mask DF_NAMELESS
jnz setDiskID ; keep old name if was nameless
mov ah, FNA_ANNOUNCE ; let user know new identifier
call FSDGenNameless ; when we created it
jmp setDiskID
createFailed:
mov ax, FMT_SET_VOLUME_NAME_ERR
stc
jmp done
DOSFormatSetName endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSFormatReturnRegs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set up registers for return of appropriate info to caller.
CALLED BY: (INTERNAL) DOSDiskFormat
PASS: ds = DiskFormatData
RETURN: ax:di = bytes in good clusters
dx:cx = bytes in bad clusters
DESTROYED: bx, si
SIDE EFFECTS: none
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/ 6/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSFormatReturnRegs proc near
.enter
mov al, ds:[DFD_bpb].BPB_clusterSize
clr ah
mul ds:[DFD_bpb].BPB_sectorSize ; ax <- bytes in a
; cluster (must be
; < 64K...)
;
; Figure bytes in good clusters first, since we return something else
; in DX
;
push ax
mul ds:[DFD_goodClusters] ; dx:ax <- bytes in good
; clusters
movdw cxdi, dxax
;
; Now figure bytes in bad clusters.
;
pop ax
mul ds:[DFD_badClusters] ; dx:ax <- bytes in bad clusters
; cxdi = good bytes
; dxax = bad bytes
;
; need axdi = good, dxcx = bad, so ax <-> cx
xchg ax, cx ; axdi <- good bytes
; dxcx <- bad bytes
clc
.leave
ret
DOSFormatReturnRegs endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSFormatCleanUp
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Clean up after ourselves, freeing whatever buffers we
allocated, etc.
CALLED BY: (INTERNAL) DOSDiskFormat
PASS: ds = DiskFormatData
RETURN: nothing
DESTROYED: ds (flags preserved)
SIDE EFFECTS: all memory allocated during the course of the format is
freed, including the DiskFormatData block.
if formatting via IOCTL, previous BPB is restored.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/ 6/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSFormatCleanUp proc near
uses ax, bx
.enter
pushf
if DOS_FORMAT_RESTORE_BPB
cmp ds:[DFD_method], DFM_IOCTL
jne freeCommon
call DOSFormatInitRestoreBPB
freeCommon:
endif
mov bx, ds:[DFD_fat]
call freeMe
mov bx, ds:[DFD_sectorBufferHandle]
call freeMe
mov bx, ds:[DFD_blockHandle]
call MemFree
popf
.leave
ret
;--------------------
;internal routine to free a block of memory if it was allocated
;Pass:
; bx = handle (possibly zero)
;Return:
; nothing
;Destroyed:
; bx
freeMe:
tst bx
jz freeDone
call MemFree
freeDone:
retn
DOSFormatCleanUp endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: DOSFormatIoctl
DESCRIPTION: Performs call to the generic I/O control interrupt for block
devices in DOS.
CALLED BY: INTERNAL
PASS: cl - DosGenBlockDevFunc to call
ds - DiskFormatData
ds:dx - addr of parameter block
RETURN: carry set on error:
ax = error code
carry clear on success
ax = preserved
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 7/89 Initial version
ardeb 10/6/92 Initial IFS version.
-------------------------------------------------------------------------------@
DOSFormatIoctl proc near
push bx, cx, ax
mov ax, MSDOS_IOCTL_GEN_BLOCK_DEV
mov bl, ds:[DFD_biosDrive]
inc bl ;specify drive code (1-origin)
mov ch, 08h ;specify category (disk drive)
call DOSUtilInt21
jnc done
pop bx
push ax
done:
pop bx, cx, ax
ret
DOSFormatIoctl endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSFormatInt13
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Call int 13h services within BIOS, obeying all rules of
the road.
CALLED BY: (INTERNAL)
PASS: ah = BiosInt13Func
RETURN: whatever is appropriate
DESTROYED: whatever is nuked by the function
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/ 6/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSFormatInt13 proc near
.enter
call SysLockBIOS
int 13h
call SysUnlockBIOS
.leave
ret
DOSFormatInt13 endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: DOSFormatTrack
DESCRIPTION: Formats a disk track regardless of DOS version.
CALLED BY: (INTERNAL) DOSFormatTracks, DOSFormatFilesArea
PASS: ds - DiskFormatData
cx - cylinder
dx - head
ds:[DFD_biosDrive]
ds:[DFD_bpb] (BPB_sectorsPerTrack, BPB_sectorSize)
RETURN: carry clear if successful
carry set on error
ax = error code
DESTROYED: nothing
REGISTER/STACK USAGE:
ds - idata seg
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 1/90 Initial version
-------------------------------------------------------------------------------@
DOSFormatTrack proc near
uses cx, dx
.enter
cmp ds:[DFD_method], DFM_IOCTL
jne useBIOS
;-----------------------------------------------------------------------
;Ioctl present
;stuff Ioctl Format Track Param Block
mov ds:[DFD_methodData].DFMD_ioctl.DFID_fmtTrackParams.FVP_cylinder, cx
mov ds:[DFD_methodData].DFMD_ioctl.DFID_fmtTrackParams.FVP_head, dx
mov cl, DGBDF_FORMAT_AND_VERIFY_TRACK
mov dx, offset ds:[DFD_methodData].DFMD_ioctl.DFID_fmtTrackParams
call DOSFormatIoctl
jnc done
;
; Translate DOS error to FormatError.
;
mov cx, FMT_ERR_WRITE_PROTECTED
cmp ax, ERROR_WRITE_PROTECTED
je setError
mov cx, FMT_DRIVE_NOT_READY
cmp ax, ERROR_DRIVE_NOT_READY
je setError
mov cx, FMT_ERR_CANNOT_FORMAT_TRACK
setError:
mov_tr ax, cx ; ax <- code to return
stc
jmp done
useBIOS:
;-----------------------------------------------------------------------
;Ioctl absent
call DOSFormatTrackBIOS
done:
pushf
push ax
call DOSFormatCallCallback
jc aborted ; aborted, C=1, ax=FMT_ABORTED
pop ax
popf
exit:
.leave
ret
aborted:
pop cx
pop cx
jmp exit
DOSFormatTrack endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: DOSFormatTrackBIOS
DESCRIPTION: Formats a track on a floppy disk with no recourse to
the IOCTL functions.
CALLED BY: (INTERNAL) DOSFormatTrack
PASS: ds - DiskFormatData
cx - cylinder number
dx - head number
RETURN: carry clear if successful
carry set otherwise:
ax = error code
DESTROYED: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
for num sectors do
create address field list
call int 13h, function 5 (format track)
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 1/90 Initial version
ardeb 10/6/92 Initial IFS version
-------------------------------------------------------------------------------@
DOSFormatTrackBIOS proc near
if PZ_PCGEOS
uses bx,cx,bp,es, di, si
else
uses bx,cx,bp,es, di
endif
.enter
;This is overhead and the price the user pays for running on DOS < 3.2.
;Want:
; ch - cylinder number
; cl, bits 7,6 - ms 2 bits of cylinder number
; dh - head
; dl - drive
clr ah
mov al, ch ;ah <- ms 2 bits in bits 1,0
mov ch, cl ;ch <- cylinder number
mov cl, 6
shl ax, cl
mov cl, al
or cx, 1
mov dh, dl ;dh <- head
mov dl, ds:[DFD_biosDrive]
segmov es, ds ;es:bx <- buffer
mov bx, offset [DFD_methodData].DFMD_bios.DFBD_fmtTrackParams
;-----------------------------------------------------------------------
;al <- sector size code
mov ax, ds:[DFD_bpb].BPB_sectorSize
mov al, ah ;ax <- sector size / 256
test al, 4
je codeOK
dec al ;al <- 3 if sector size = 1024
codeOK:
;-----------------------------------------------------------------------
;loop to initialize address field list
mov bp, ds:[DFD_bpb].BPB_sectorsPerTrack
mov ah, 1
push bx
createLoop:
;-----------------------------------------------------------------------
;init address field list entry
mov es:[bx][AFE_cylinderNum], ch
mov es:[bx][AFE_headNum], dh
mov es:[bx][AFE_sectorNum], ah
mov es:[bx][AFE_sectorSize], al ;store sector size code
add bx, size AddrFieldEntry
inc ah ;next sector number
dec bp ;dec count
jne createLoop ;loop while not done
pop bx ;make bx point back to buf start
;
; Store the parameters we were given in vector 1eh so BIOS knows what
; to do.
;
push bx, cx
call SysLockBIOS
movdw bxcx, ds:[DFD_methodData].DFMD_bios.DFBD_params
mov di, offset DFD_methodData.DFMD_bios.DFBD_oldParams
mov ax, BIOS_DISK_PARAMS_VECTOR
call SysCatchInterrupt
if PZ_PCGEOS
;
; save and set DisketteParams for Pizza's 1.232M 3.5"
;
cmp ds:[DFD_formatArgs].FSFA_media, MEDIA_1M232
jne noSet1232M
call SaveAndSet1M232
;not needed
; mov ah, 0 ;reset
; call DOSFormatInt13
noSet1232M:
endif
pop bx, cx
;-----------------------------------------------------------------------
;ch - cylinder
;dh - head
;dl - drive number
;es:bx - buffer addr
mov ds:[DFD_methodData].DFMD_bios.DFBD_tryCount, B13F_FORMAT_RETRIES
clr di ; no error yet.
doFormat:
;-----------------------------------------------------------------------
;stuff disk base table entry with correct number of sectors
;some way around this?
mov ah, B13F_FORMAT_TRACK ;BIOS format track
mov al, ds:[DFD_bpb].BPB_sectorsPerTrack.low
if PZ_PCGEOS
;
; for some reason, this is what they do
;
cmp ds:[DFD_formatArgs].FSFA_media, MEDIA_1M232
jne noFakeCount
mov al, 1
noFakeCount:
endif
call DOSFormatInt13
jc tryAgain
mov ah, B13F_VERIFY_SECTORS
mov al, ds:[DFD_bpb].BPB_sectorsPerTrack.low
mov cl, 1 ; starting sector
call DOSFormatInt13
jc tryAgain
jmp short done
tryAgain:
mov al, ah
clr ah
mov di, ax ; save error code
CheckHack <B13F_RESET_DISK_SYSTEM eq 0>
call DOSFormatInt13
dec ds:[DFD_methodData].DFMD_bios.DFBD_tryCount
jne doFormat
;
; Map BIOS error to FormatError.
;
mov ax, FMT_DRIVE_NOT_READY
cmp di, B13E_DRIVE_NOT_READY
je setError
mov ax, FMT_ERR_WRITE_PROTECTED
cmp di, B13E_WRITE_PROTECTED
je setError
mov ax, FMT_ERR_CANNOT_FORMAT_TRACK
setError:
stc
done:
;
; Restore the old diskette parameters.
;
pushf
push ax
if PZ_PCGEOS
;
; restore DisketteParams for Pizza's 1.232M 3.5"
;
cmp ds:[DFD_formatArgs].FSFA_media, MEDIA_1M232
jne noUnset1232M
call Unset1M232
noUnset1232M:
endif
mov di, offset DFD_methodData.DFMD_bios.DFBD_oldParams
mov ax, BIOS_DISK_PARAMS_VECTOR
call SysResetInterrupt
if PZ_PCGEOS
;not needed
; mov ah, 0
; call DOSFormatInt13
endif
call SysUnlockBIOS
pop ax
popf
.leave
ret
DOSFormatTrackBIOS endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSFormatQReadFAT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Read the current FAT into the allocated buffer.
CALLED BY: DOSFormatCheckAndPerformQuick
PASS: ds = DiskFormatData
es = segment of buffer of FAT bitmask
bp = non-zero if 16-bit FAT
RETURN: carry set if couldn't read FAT
carry clear if FAT read ok.
DESTROYED: ax, bx, cx, dx, si, di
SIDE EFFECTS: ds:[DFD_badClusters], ds:[DFD_goodClusters] set
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSFormatQReadFAT proc near
fatSize local word push bp
badClusters local word
numClusters local word
goodClusters local word
processRoutine local nptr.near
uses ds
.enter
clr ss:[badClusters]
call DOSFormatGetNumClusters
mov ss:[numClusters], ax
mov ss:[goodClusters], ax
;
; Fill in the vector for processing a single sector.
;
mov ax, offset DOSFormatQCondense16BitFATSector
tst ss:[fatSize]
jnz haveCondenseRoutine
mov ax, offset DOSFormatQCondense12BitFATSector
haveCondenseRoutine:
mov ss:[processRoutine], ax
;
; Mark first two clusters "bad" as they're reserved for the media
; descriptor and whatnot.
;
mov {byte}es:[0], 00000011b
;
; Must condense the FAT into a bitmask, so read it a sector at a time
; into our aligned buffer and condense it.
;
; For the main loop:
; dx = sector number being processed
; cx = number of FAT sectors left to process
; bx = size of a sector
; es:di = byte in FAT buffer that holds bit for current
; cluster
; al = bit for current cluster
;
mov dx, ds:[DFD_startFAT]
mov cx, ds:[DFD_bpb].BPB_sectorsPerFAT
mov bx, ds:[DFD_bpb].BPB_sectorSize
clr di, si
mov al, 1 ; clusters 0 & 1 won't be marked "bad",
; so no need to skip them and thereby
; mangle this already twisted logic
mov ds:[DFD_fatToggle], 0
readLoop:
;
; Have: dx = sector number
; ds = DiskFormatData
; need: es:si = drive
; bx:dx = sector #
; cx = # sectors to read (1)
; ds:di = buffer to which to read things
;
push ds, bx, cx, di, si, ax, es
clr bx
mov cx, 1
if PZ_PCGEOS
;
; handle for Pizza's 1.232M 3.5"
;
cmp ds:[DFD_formatArgs].FSFA_media, MEDIA_1M232
jne not1M232
shl cx, 1 ; #sectors*2
shldw bxdx ; start sector*2
not1M232:
endif
mov si, ds:[DFD_formatArgs].FSFA_dse
call FSDLockInfoShared
mov es, ax
mov ds, ds:[DFD_sectorBuffer]
clr di
call DOSReadSectors
call FSDUnlockInfoShared
pop ds, bx, cx, di, si, ax, es
jc error
;
; Mangle that sector with the proper routine.
;
call ss:[processRoutine]
inc dx ; advance to next sector
loop readLoop
;
; Set the number of clusters in the DiskFormatData.
; XXX: reduce by # of reserved clusters?
;
mov ax, ss:[goodClusters]
mov bx, ss:[badClusters]
sub ax, bx
mov ds:[DFD_goodClusters], ax
mov ds:[DFD_badClusters], bx
clc
error:
.leave
ret
DOSFormatQReadFAT endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSFormatQCondense16BitFATSector
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Condense a 16-bit FAT sector into a bitmask in the FAT
buffer for the disk.
CALLED BY: (INTERNAL) DOSFormatQReadFAT
PASS: ds = DiskFormatData
dx = sector number being processed
cx = number of FAT sectors left to process
bx = size of a sector
es:di = byte in FAT buffer that holds bit for current cluster
al = bit for current cluster
RETURN: es:di = byte to use at start of next sector
al = bit to use for first cluster in next sector
DESTROYED: si, ah
SIDE EFFECTS: ss:[numClusters] is reduced
ss:[badClusters] may increase
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/18/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSFormatQCondense16BitFATSector proc near
uses cx, ds, dx
.enter inherit DOSFormatQReadFAT
clr si
mov ds, ds:[DFD_sectorBuffer]
mov dh, es:[di] ; dh <- current bitmask byte
mov dl, al ; dl <- bit to manipulate for first
; cluster in FAT sector
mov cx, bx ; cx <- sector size
shr cx ; convert to clusters
sub ss:[numClusters], cx
jae processLoop
add cx, ss:[numClusters]
processLoop:
lodsw
cmp ax, FAT_CLUSTER_BAD
jne maybeStore
ornf dh, dl
inc ss:[badClusters]
maybeStore:
rol dl
cmp dl, 1 ; used up a byte?
jne nextCluster ; no
mov es:[di], dh ; store it in the bitmask
clr dh ; and set up for the next
inc di ; byte in the mask
nextCluster:
loop processLoop
cmp dl, 1 ; any partial byte to store?
je done ; => no
mov es:[di], dh
done:
mov al, dl
.leave
ret
DOSFormatQCondense16BitFATSector endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSFormatQCondense12BitFATSector
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Condense a 12-bit FAT sector into a bitmask in the FAT
buffer for the disk.
CALLED BY: (INTERNAL) DOSFormatQReadFAT
PASS: ds = DiskFormatData
dx = sector number being processed
cx = number of FAT sectors left to process
bx = size of a sector
es:di = byte in FAT buffer that holds bit for current cluster
al = bit for current cluster
si = offset within sector at which to start processing
(0 or -1)
ah = last byte of previous sector, if si is -1
ds:[DFD_fatToggle] = set for first cluster in the sector
RETURN: es:di = byte to use at start of next sector
al = bit to use for first cluster in next sector
si = 0 or -1
ah = last byte of sector, if si is -1
DESTROYED: nothing
SIDE EFFECTS: ss:[numClusters] is reduced
ss:[badClusters] may increase
ds:[DFD_fatToggle] updated
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/18/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSFormatQCondense12BitFATSector proc near
uses bx, cx, dx
.enter inherit DOSFormatQReadFAT
push ds
mov dh, es:[di] ; dh <- current byte
mov dl, al ; dl <- mask for current cluster
mov cx, bx ; cx <- # bytes left
mov bl, ds:[DFD_fatToggle]
mov ds, ds:[DFD_sectorBuffer]
cmp si, -1
jne processLoop
;
; Last cluster in previous sector wasn't completely described. Form
; the word we would have gotten had the two sectors been concatenated.
;
inc cx
mov al, ah
mov ah, ds:[0]
jmp haveWord
processLoop:
mov ax, ds:[si]
haveWord:
tst bl ; is cluster even?
jz checkEven ; yes -- go handle it
;
; Cluster is odd, so it resides in high 12 bits of the word.
;
andnf ax, 0xfff0
cmp ax, (FAT_CLUSTER_BAD and 0xfff) shl 4
jne maybeStore
markBad:
ornf dh, dl
inc ss:[badClusters]
maybeStore:
rol dl
cmp dl, 1 ; used up a byte?
jne nextCluster ; no
mov es:[di], dh ; store it in the bitmask
clr dh ; and set up for the next
inc di ; byte in the mask
nextCluster:
inc si ; always skip at least one byte
dec cx ; which consumes it, of course
xor bl, 1 ; toggle even/odd flag
jnz checkLastByte ; => now odd, so just needed single inc
inc si ; skip high byte of previous odd
dec cx ; cluster
checkLastByte:
dec ss:[numClusters]
jz finish ; if out of clusters, stop now so we
; don't compute bad clusters from
; garbage
;
; If there's only one byte left in the sector, we have to save the byte
; for the next sector.
;
cmp cx, 1
ja processLoop
je handlePartialCluster
;
; Consumed all bytes in the sector, so set SI = 0 for next time.
;
clr si
finish:
cmp dl, 1 ; partial byte to store?
je done ; => no
mov es:[di], dh
done:
mov al, dl ; al <- mask for first cluster of next
; sector
;
; Store the even/odd flag for next time.
;
pop ds
mov ds:[DFD_fatToggle], bl
.leave
ret
handlePartialCluster:
;
; Only one byte left in the sector. Return it in AH and set SI to -1
; to indicate this for the next call.
;
mov ah, ds:[si]
mov si, -1
jmp finish
checkEven:
andnf ax, 0xfff
cmp ax, FAT_CLUSTER_BAD and 0xfff
je markBad
jmp maybeStore
DOSFormatQCondense12BitFATSector endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSFormatCheckAndPerformQuick
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Try and perform a quick format if the caller and the media
allow it.
CALLED BY: (INTERNAL) DOSDiskFormat
PASS: ds = DiskFormatData
RETURN: carry clear if format complete
carry set if quick format not possible.
DESTROYED: ax, bx, cx, dx, si, di, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
See if DFF_FORCE_ERASE, if set then no go
See if disk handle given, if not, current disk is unformatted,
so no go
Try and read the last sector of the disk, if can't, then
disk not completely formatted, so no go.
Allocate a buffer for the FAT and read the current one in.
Run through the FAT zeroing out every cluster not marked as
bad, counting the bad ones as we go along
Set # good clusters = total - # bad
Write new FAT out
Zero root directory
return happiness
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSFormatCheckAndPerformQuick proc near uses es
.enter
;
; Caller wants to forcibly erase the disk?
;
test ds:[DFD_formatArgs].FSFA_flags, mask DFF_FORCE_ERASE
jnz fail ; yes
;
; Disk in drive registered (i.e. at least formatted enough to have
; a boot sector)?
;
mov si, ds:[DFD_formatArgs].FSFA_disk
tst si
jz fail
;
; See if MediaType matches the one we're formatting to
;
call FSDLockInfoShared
mov es, ax
mov al, es:[si].DD_media
cmp al, ds:[DFD_formatArgs].FSFA_media
jne failUnlockFSIR
;
; Use #sectors in DFD_bpb to get number of last sector to read and
; try and read it.
;
mov si, ds:[DFD_formatArgs].FSFA_dse; es:si <- DSE
push ax
call DOSFormatInitGetNumSectors ; dxax <- #sectors
subdw dxax, 1 ; sector (0-origin)
mov bx, dx
mov_tr dx, ax
pop ax
push ds
;
; Increment the dosPreventCritical flag so any critical error
; generated by this call is immediately failed w/o user
; intervention.
;
push ds:[DFD_sectorBuffer]
call DOSPreventCriticalErr
clr di ; ds:di <- buffer
mov cx, 1 ; cx <- # to read
if PZ_PCGEOS
;
; handle for Pizza's 1.232M 3.5"
;
cmp ds:[DFD_formatArgs].FSFA_media, MEDIA_1M232
jne not1M232
shl cx, 1 ; #sectors*2
shldw bxdx ; start sector*2
not1M232:
endif
pop ds
call DOSReadSectors
;
; Reset the dosPreventCritical
;
call DOSAllowCriticalErr
pop ds
jnc quickFormatMeBaby ; => formatted all the
; way through
failUnlockFSIR:
call FSDUnlockInfoShared
fail:
stc
jmp done
quickFormatMeBaby:
call FSDUnlockInfoShared
;
; Allocate a buffer into which we can read the FAT
;
call DOSFormatAllocFATBuffer
jc done
;
; Now read it, silly.
;
call DOSFormatQReadFAT
jc failFreeFAT
;
; Write out the FAT again.
;
call DOSFormatWriteFATs
jc failFreeFAT
;
; Zero the root directory.
;
call DOSFormatWriteRootDirectory
jc failFreeFAT
;
; Fetch the ID for the disk from the DiskDesc and store it in our
; data so DOSFormatSetName doesn't mangle it.
;
call FSDLockInfoShared
mov es, ax
mov si, ds:[DFD_formatArgs].FSFA_disk
mov ax, es:[si].DD_id.low
mov ds:[DFD_diskID].low, ax
mov ax, es:[si].DD_id.high
mov ds:[DFD_diskID].high, ax
call FSDUnlockInfoShared
;
; Perform gratuitous callback so user sees 100% display before the
; feedback box vanishes.
;
mov ax, ds:[DFD_numTracks]
clr dx
mov cx, ds:[DFD_bpb].BPB_numHeads
div cx ; ax <- # cylinders
dec ax
dec cx
mov ds:[DFD_curCylinder], ax
mov ds:[DFD_curHead], cx
call DOSFormatCallCallback
clc ; don't care if format aborted:
; this puppy is done.
;
; No need to free the FAT on success, as DOSFormatCleanUp will do it
; for us...
;
done:
.leave
ret
failFreeFAT:
clr bx
xchg bx, ds:[DFD_fat]
call MemFree
stc
jmp done
DOSFormatCheckAndPerformQuick endp
DiskFormatCode ends
|
KMP.asm | chenxiaoquan233/KMP-on-x86-ASM | 0 | 104098 | <reponame>chenxiaoquan233/KMP-on-x86-ASM
;#########################################################;
; ;
; @description : KMP inplementation, find str_a in str_b ;
; @author : XQChen ;
; @email : <EMAIL> ;
; ;
;#########################################################;
ASSUME DS:DATA,SS:STACK,CS:CODE
DATA SEGMENT
STRING STRUC
MAX DB 255 ; the max length of the string
LEN DB 0 ; the actual length inputed
STR DB 254 DUP ('$') ; the string buffer
STRING ENDS
STRA STRING <>
STRB STRING <>
HINT DB 'PLEASE INPUT A STRING:$'
FOUND DB 'FOUND','$'
NFOUND DB 'NOT FOUND','$'
NEWLINE DB 0DH,0AH,'$' ; end of line: '\r','\n'
NEXT DB 256 DUP(0) ; next array in KMP
DATA ENDS
STACK SEGMENT STACK
DB 64 DUP (0)
STACK ENDS
CODE SEGMENT
START: MOV AX,DATA
MOV DS,AX
MOV ES,AX
MOV AX,STACK
MOV SS,AX
MOV SP,40H
CALL PH
LEA DX,STRB
CALL INPUT
CALL ENDL
CALL PH
LEA DX,STRA
CALL INPUT
CALL ENDL
MOV AH,STRA.LEN
MOV AL,STRB.LEN
CMP AL,AH
JB NF
CMP AH,0
JE F
CMP AL,0
JE NF
CALL GETN
MOV DX,0 ; use DX to store the postion
CALL KMP
CMP DX,0FFFFH
JE NF
F: LEA DX,FOUND
CALL PRINT
JMP ENDPRO
NF: LEA DX,NFOUND
CALL PRINT
JMP ENDPRO
ENDPRO: MOV AX,4C00H
INT 21H
;################################################;
; @ input function ;
; description: read a string ended with enter ;
;################################################;
INPUT: PUSH AX
MOV AH,0AH
INT 21H
POP AX
RET
;##########################################################################;
; @ print function ;
; description: print the string from the pointed buffer(begin at DS:DX) ;
;##########################################################################;
PRINT: PUSH AX
PUSH BX
XOR BX,BX
MOV AH,09H
INT 21H
POP BX
POP AX
RET
;#################################;
; @ end of line functin ;
; description: print '\r','\n' ;
;#################################;
ENDL: PUSH DX
MOV DX,OFFSET NEWLINE
CALL PRINT
POP DX
RET
;################################################;
; @ print hint function ;
; description: print "PLEASE INPUT A STRING:" ;
;################################################;
PH: PUSH DX
MOV DX,OFFSET HINT
CALL PRINT
POP DX
RET
;#################################################;
; @ get next function ;
; description: calculate the next array in KMP ;
;#################################################;
GETN: PUSH AX
PUSH BX
PUSH CX
MOV NEXT[0],0FFH
XOR BX,BX
XOR CX,CX
MOV DI,0FFFFH
XOR SI,SI
LOOPN: MOV BL,STRA.LEN
CMP SI,BX
JNB ENDGN
CMP DI,0FFFFH
JE EN
MOV AH,STRA.STR[SI]
MOV AL,STRA.STR[DI]
CMP AH,AL
JE EN
NEN: MOV BL,NEXT[DI]
MOV DI,BX
MOV AX,DI
XOR AX,0FFH ; DI is a 16-bit register, but next[DI] is a 8-bit memory unit
JNZ LOOPN ; so if DI get 0xFF from next[DI]
MOV DI,0FFFFH ; DI should be set to 0xFFFF
EN: MOV AX,DI
MOV NEXT[SI],AL
INC DI
INC SI
JMP LOOPN
ENDGN: POP CX
POP BX
POP AX
RET
;#####################################;
; @ KMP function ;
; description: find str_a in str_b ;
;#####################################;
KMP: PUSH AX
PUSH BX
PUSH CX
XOR BX,BX
XOR SI,SI
XOR DI,DI
FIND: MOV BL,STRA.LEN
CMP DI,BX
JGE KMPCMP
MOV BL,STRB.LEN
CMP SI,BX
JNB KMPCMP
CMP DI,0FFFFH
JE KMPIF
MOV AH,STRA.STR[SI]
MOV AL,STRB.STR[DI]
CMP AH,AL
JE KMPIF
MOV BL,NEXT[DI]
MOV DI,BX
MOV AX,DI
XOR AX,0FFH
JNZ KMPNZ
MOV DI,0FFFFH
KMPNZ: JMP FIND
KMPIF: INC SI
INC DI
JMP FIND
KMPCMP: MOV BL,STRA.LEN
CMP SI,BX
JGE KMPE
MOV DX,0FFFFH
JMP KMPEND
KMPE: MOV BL,STRA.LEN
SUB SI,BX
MOV DX,SI
KMPEND: POP CX
POP BX
POP AX
RET
CODE ENDS
END START
|
alloy4fun_models/trashltl/models/4/jQdxXrYh4cS4NW2cn.als | Kaixi26/org.alloytools.alloy | 0 | 4051 | open main
pred idjQdxXrYh4cS4NW2cn_prop5 {
no File & Trash and eventually some File & Trash
}
pred __repair { idjQdxXrYh4cS4NW2cn_prop5 }
check __repair { idjQdxXrYh4cS4NW2cn_prop5 <=> prop5o } |
programs/oeis/011/A011888.asm | jmorken/loda | 1 | 26646 | <gh_stars>1-10
; A011888: Partial sums of A011863.
; 0,1,6,22,61,142,292,548,958,1583,2498,3794,5579,7980,11144,15240,20460,27021,35166,45166,57321,71962,89452,110188,134602,163163,196378,234794,278999,329624,387344,452880
mov $2,$0
lpb $0
lpb $0
add $3,$0
sub $0,1
lpe
sub $2,1
lpb $3
add $1,$3
sub $3,1
lpe
trn $2,1
mov $0,$2
lpe
|
programs/oeis/047/A047618.asm | karttu/loda | 1 | 92413 | ; A047618: Numbers that are congruent to {0, 2, 5} mod 8.
; 0,2,5,8,10,13,16,18,21,24,26,29,32,34,37,40,42,45,48,50,53,56,58,61,64,66,69,72,74,77,80,82,85,88,90,93,96,98,101,104,106,109,112,114,117,120,122,125,128,130,133,136,138,141,144,146,149,152,154,157,160,162,165,168,170,173,176,178,181,184,186,189,192,194,197,200,202,205,208,210,213,216,218,221,224,226,229,232,234,237,240,242,245,248,250,253,256,258,261,264,266,269,272,274,277,280,282,285,288,290,293,296,298,301,304,306,309,312,314,317,320,322,325,328,330,333,336,338,341,344,346,349,352,354,357,360,362,365,368,370,373,376,378,381,384,386,389,392,394,397,400,402,405,408,410,413,416,418,421,424,426,429,432,434,437,440,442,445,448,450,453,456,458,461,464,466,469,472,474,477,480,482,485,488,490,493,496,498,501,504,506,509,512,514,517,520,522,525,528,530,533,536,538,541,544,546,549,552,554,557,560,562,565,568,570,573,576,578,581,584,586,589,592,594,597,600,602,605,608,610,613,616,618,621,624,626,629,632,634,637,640,642,645,648,650,653,656,658,661,664
mul $0,8
mov $1,$0
div $1,3
|
src/Experiments/StrongMonad.agda | metaborg/mj.agda | 10 | 373 | {-# OPTIONS --allow-unsolved-metas #-}
open import Level
open import Relation.Unary using (Pred)
open import Data.Product hiding (swap; curry)
open import Data.List
open import Data.List.Relation.Unary.All as All
open import Data.List.Relation.Unary.Any
open import Data.List.Membership.Propositional
open import Data.List.Prefix
open import Function as Fun using (case_of_)
open import Relation.Binary.PropositionalEquality
open ≡-Reasoning
import Experiments.Category as Cat
module Experiments.StrongMonad
(Type : Set)
(Val : Type → Cat.MP₀ (⊑-preorder {A = Type}))
(funext : ∀ {a b} → Extensionality a b) where
open import Relation.Binary.PropositionalEquality.Extensionality funext
open Cat (⊑-preorder {A = Type})
open Product
World = List Type
Store : World → Set
Store Σ = All (λ a → Val a · Σ) Σ
import Relation.Binary.HeterogeneousEquality as H
module HR = H.≅-Reasoning
mcong : ∀ {Σₛ Σ Σ' ℓ}{P : MP ℓ}
{μ : Store Σ}{μ' : Store Σ'}{p : Σ ⊒ Σₛ}{p' : Σ' ⊒ Σₛ}{q : P · Σ}{q' : P · Σ'} →
Σ ≡ Σ' → p H.≅ p' → μ H.≅ μ' → q H.≅ q' → (Σ , p , μ , q) ≡ (Σ' , p' , μ' , q')
mcong refl H.refl H.refl H.refl = refl
-- The monad takes monotone predicates over worlds
-- to monotone functions over stores in these worlds.
M : ∀ {ℓ} → MP ℓ → MP ℓ
M P = mp (λ Σ → ∀ Σ₁ → (ext : Σ ⊑ Σ₁) → (μ : Store Σ₁) → ∃ λ Σ₂ → Σ₂ ⊒ Σ₁ × Store Σ₂ × P · Σ₂)
record {
monotone = λ w₀ f Σ w₁ μ → f Σ (⊑-trans w₀ w₁) μ ;
monotone-refl = λ f → funext³ (λ Σ₁ _ μ → cong (λ u → f Σ₁ u μ) ⊑-trans-refl) ;
monotone-trans = λ f w₀ w₁ → funext³ (λ Σ₁ w₂ μ → cong (λ u → f Σ₁ u μ) (sym ⊑-trans-assoc))
}
-- η is the natural transformation between the identity functor and the functor M
η : ∀ {p}(P : MP p) → P ⇒ M P
η P =
mk⇒
(λ p Σ ext μ → Σ , ⊑-refl , μ , MP.monotone P ext p)
(λ c~c' {p} → begin
(λ z ext μ → z , ⊑-refl , μ , MP.monotone P ext (MP.monotone P c~c' p))
≡⟨ funext³ (λ z ext μ → cong (λ u → z , ⊑-refl , μ , u) (sym (MP.monotone-trans P p c~c' ext))) ⟩
(λ z ext μ → z , ⊑-refl , μ , MP.monotone P (⊑-trans c~c' ext) p)
≡⟨ refl ⟩
MP.monotone (M P) c~c' (λ z ext μ → z , ⊑-refl , μ , MP.monotone P ext p)
∎)
μ : ∀ {p}(P : MP p) → M (M P) ⇒ M P
μ P = mk⇒
(λ pc Σ₁ ext μ →
case pc Σ₁ ext μ of λ{
(Σ₂ , ext₁ , μ₁ , f) →
case f Σ₂ ⊑-refl μ₁ of λ{
(Σ₃ , ext₂ , μ₂ , v) → Σ₃ , ⊑-trans ext₁ ext₂ , μ₂ , v
}
})
(λ c~c' → refl)
fmap : ∀ {p q}{P : MP p}{Q : MP q} → (P ⇒ Q) → M P ⇒ M Q
fmap F = mk⇒
(λ x Σ₁ ext μ → case x Σ₁ ext μ of λ{
(Σ₂ , ext₁ , μ₁ , v) → Σ₂ , ext₁ , μ₁ , apply F v
})
(λ c~c' → refl)
bind : ∀ {p q}{P : MP p}(Q : MP q) → (P ⇒ M Q) → M P ⇒ M Q
bind Q F = μ Q ∘ fmap F
open Exponential (sym ⊑-trans-assoc) ⊑-trans-refl ⊑-trans-refl'
module Coherence where
-- We prove that η is the component of a natural transformation between the functors
-- 𝕀 and M where 𝕀 is the identity functor.
η-natural : ∀ {p q}(P : MP p)(Q : MP q)(F : P ⇒ Q) → η Q ∘ F ⇒≡ (fmap F) ∘ η P
η-natural P Q F p =
begin
apply (η Q ∘ F) p
≡⟨ refl ⟩
apply (η Q) (apply F p)
≡⟨ refl ⟩
(λ Σ ext μ → Σ , ⊑-refl , μ , MP.monotone Q ext (apply F p))
≡⟨ funext³ (λ Σ ext μ → cong (λ u → Σ , ⊑-refl , μ , u) (sym (monotone-comm F ext))) ⟩
(λ Σ ext μ → Σ , ⊑-refl , μ , apply F (MP.monotone P ext p))
≡⟨ refl ⟩
apply (fmap F) (λ Σ ext μ → Σ , ⊑-refl , μ , MP.monotone P ext p)
≡⟨ refl ⟩
apply (fmap F) (apply (η P) p)
≡⟨ refl ⟩
apply (fmap F ∘ η P) p
∎
-- We prove that μ is the component of a natural transformation between
-- the functors M² and M.
μ-natural : ∀ {p q}(P : MP p)(Q : MP q)(F : P ⇒ Q) → μ Q ∘ (fmap (fmap F)) ⇒≡ (fmap F) ∘ μ P
μ-natural P Q F = λ p → refl
-- from these facts we can prove the monad laws
left-id : ∀ {p}{P : MP p} → μ P ∘ fmap (η P) ⇒≡ id (M P)
left-id {P = P} p = funext³
λ Σ₁ ext μ₁ → mcong {P = P} refl (lem refl) H.refl (H.≡-to-≅ (MP.monotone-refl P _))
where
lem : ∀ {Σ Σ' Σ'' : World}{xs : Σ'' ⊒ Σ'}{ys : Σ'' ⊒ Σ} → Σ ≡ Σ' → ⊑-trans xs ⊑-refl H.≅ ys
lem {xs = xs}{ys} refl with ⊑-unique xs ys
... | refl = H.≡-to-≅ ⊑-trans-refl'
right-id : ∀ {p}{P : MP p} → μ P ∘ (η (M P)) ⇒≡ id (M P)
right-id {P = P} p = funext³ λ Σ₁ ext μ₁ →
let f = (λ{(Σ₃ , ext₂ , μ₂ , v) → Σ₃ , ⊑-trans ⊑-refl ext₂ , μ₂ , v}) in
trans
(cong f (cong (λ u → p Σ₁ u μ₁) ⊑-trans-refl'))
(mcong {P = P} refl (H.≡-to-≅ ⊑-trans-refl) H.refl H.refl )
-- if we have a (M³ P) then it doesn't matter if we join
-- the outer or inner ones first.
assoc : ∀ {p}{P : MP p} → μ P ∘ (fmap (μ P)) ⇒≡ μ P ∘ μ (M P)
assoc {P = P} p = funext³ λ Σ₁ ext μ → mcong {P = P} refl (H.≡-to-≅ ⊑-trans-assoc) H.refl H.refl
-- fmap makes M a functor
fmap-id : ∀ {ℓ}{P : MP ℓ} → fmap (id P) ⇒≡ id (M P)
fmap-id = λ p → refl
fmap-∘ : ∀ {ℓ₁ ℓ₂ ℓ₃}{P : MP ℓ₁}{Q : MP ℓ₂}{R : MP ℓ₃}(F : P ⇒ Q)(G : Q ⇒ R) →
fmap (G ∘ F) ⇒≡ fmap G ∘ fmap F
fmap-∘ F G = λ p → refl
module Strong where
-- tensorial strength
ts : ∀ {p q}(P : MP p)(Q : MP q) → P ⊗ M Q ⇒ M (P ⊗ Q)
ts P Q = mk⇒
(λ x Σ₁ ext μ →
case (proj₂ x) Σ₁ ext μ of λ{
(_ , ext₁ , μ₁ , v ) → _ , ext₁ , μ₁ , (MP.monotone P (⊑-trans ext ext₁) (proj₁ x)) , v
}
)
(λ c~c' →
funext³ λ Σ₁ ext μ₁ →
mcong {P = (P ⊗ Q)} refl H.refl H.refl (
H.cong₂ {A = P · _}{B = λ _ → Q · _} (λ u v → u , v)
(H.≡-to-≅ (begin
MP.monotone P (⊑-trans ext _) _
≡⟨ (MP.monotone-trans P _ _ _) ⟩
MP.monotone P _ (MP.monotone P ext (MP.monotone P c~c' _))
≡⟨ cong (λ x → MP.monotone P _ x) (sym ((MP.monotone-trans P _ _ _))) ⟩
MP.monotone P _ (MP.monotone P (⊑-trans c~c' ext) _)
≡⟨ sym ((MP.monotone-trans P _ _ _)) ⟩
MP.monotone P (⊑-trans (⊑-trans c~c' ext) _) _
∎))
H.refl
))
ts' : ∀ {p q}(P : MP p)(Q : MP q) → M P ⊗ Q ⇒ M (P ⊗ Q)
ts' P Q = fmap (swap Q P) ∘ ts Q P ∘ swap _ _
diagram₁ : ∀ {ℓ}{P : MP ℓ} → fmap {P = ⊤ ⊗ P} (π₂ {P = ⊤}) ∘ ts ⊤ P ⇒≡ π₂ {P = ⊤}
diagram₁ = λ p → refl
diagram₂ : ∀ {ℓ₁ ℓ₂ ℓ₃}{A : MP ℓ₁}{B : MP ℓ₂}{C : MP ℓ₃} →
fmap (comm A B C) ∘ ts (A ⊗ B) C ⇒≡ ts A (B ⊗ C) ∘ xmap (id A) (ts B C) ∘ comm A B (M C)
diagram₂ = λ p → refl
diagram₃ : ∀ {ℓ₁ ℓ₂}(A : MP ℓ₁)(B : MP ℓ₂) →
η (A ⊗ B) ⇒≡ ts A B ∘ xmap (id A) (η B)
diagram₃ A B (a , b) = funext³ λ Σ ext r → mcong {P = A ⊗ B} refl H.refl H.refl
(H.≡-to-≅
(cong₂ _,_
(cong₂
(λ ext a → MP.monotone A ext a)
(trans (sym ⊑-trans-refl') (cong (λ r → ⊑-trans ext r) refl))
refl
)
(cong (λ x → x) refl)))
diagram₄ : ∀ {ℓ₁ ℓ₂}{A : MP ℓ₁}{B : MP ℓ₂} →
ts A B ∘ xmap (id A) (μ B) ⇒≡ μ (A ⊗ B) ∘ fmap (ts A B) ∘ ts A (M B)
diagram₄ {A = A}{B} p@(l , r) =
funext³ λ Σ₁ ext μ' →
mcong {P = A ⊗ B} refl H.refl H.refl (
H.cong (Fun.flip _,_ _)
(H.≡-to-≅ (
trans
(cong (λ u → MP.monotone A u l) ⊑-trans-assoc)
(trans
(MP.monotone-trans A l (⊑-trans ext _) _)
(cong
(λ u → MP.monotone A u (MP.monotone A (⊑-trans _ _) l))
(sym ⊑-trans-refl))))))
-- internal fmap
fmap' : ∀ {p q}{P : MP p}{Q : MP q} → (Q ^ P) ⇒ (M Q) ^ (M P)
fmap' {P = P}{Q} = curry (fmap ε ∘ ts (Q ^ P) P)
-- internal bind
bind' : ∀ {p q}{P : MP p}(Q : MP q) → (M P ⊗ (M Q ^ P)) ⇒ M Q
bind' {P = P} Q =
μ Q
∘ fmap (ε ∘ swap P (M Q ^ P))
∘ ts' P (M Q ^ P)
|
day30/apilib/alloca.asm | itiB/hariboteOS_30days | 1 | 3319 | <filename>day30/apilib/alloca.asm
[CPU 486]
[BITS 32]
GLOBAL __alloca
section .text
__alloca:
ADD EAX, -4
SUB ESP, EAX
JMP DWORD [ESP + EAX] ; RETの代わり
|
src/glfw/v2/glfw-events-keys.adb | Roldak/OpenGLAda | 0 | 2432 | <gh_stars>0
-- part of OpenGLAda, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "COPYING"
with Glfw.API;
with Glfw.Enums;
package body Glfw.Events.Keys is
function Name (Query : Key) return String is
begin
case Query is
when 32 .. 256 => return (1 => Character'Val (Query));
when Esc => return "Esc";
when F1 => return "F1";
when F2 => return "F2";
when F3 => return "F3";
when F4 => return "F4";
when F5 => return "F5";
when F6 => return "F6";
when F7 => return "F7";
when F8 => return "F8";
when F9 => return "F9";
when F10 => return "F10";
when F11 => return "F11";
when F12 => return "F12";
when F13 => return "F13";
when F14 => return "F14";
when F15 => return "F15";
when F16 => return "F16";
when F17 => return "F17";
when F18 => return "F18";
when F19 => return "F19";
when F20 => return "F20";
when F21 => return "F21";
when F22 => return "F22";
when F23 => return "F23";
when F24 => return "F24";
when F25 => return "F25";
when Up => return "Up";
when Down => return "Down";
when Left => return "Left";
when Right => return "Right";
when L_Shift => return "Left Shift";
when R_Shift => return "Right Shift";
when L_Ctrl => return "Left Ctrl";
when R_Ctrl => return "Right Ctrl";
when L_Alt => return "Left Alt";
when R_Alt => return "Right Alt";
when Tab => return "Tab";
when Enter => return "Enter";
when Backspace => return "Backspace";
when Insert => return "Insert";
when Del => return "Delete";
when Page_Up => return "Page Up";
when Page_Down => return "Page Down";
when Home => return "Home";
when End_Key => return "End";
when KP_0 => return "0 (Numpad)";
when KP_1 => return "1 (Numpad)";
when KP_2 => return "2 (Numpad)";
when KP_3 => return "3 (Numpad)";
when KP_4 => return "4 (Numpad)";
when KP_5 => return "5 (Numpad)";
when KP_6 => return "6 (Numpad)";
when KP_7 => return "7 (Numpad)";
when KP_8 => return "8 (Numpad)";
when KP_9 => return "9 (Numpad)";
when KP_Divide => return "/ (Numpad)";
when KP_Multiply => return "* (Numpad)";
when KP_Substract => return "- (Numpad)";
when KP_Add => return "+ (Numpad)";
when KP_Decimal => return ". (Numpad)";
when KP_Equal => return "= (Numpad)";
when KP_Enter => return "Enter (Numpad)";
when KP_Num_Lock => return "Numlock";
when Caps_Lock => return "Caps Lock";
when Scroll_Lock => return "Scroll Lock";
when Pause => return "Pause";
when L_Super => return "Left Super";
when R_Super => return "Right Super";
when Menu => return "Menu";
end case;
end Name;
function Pressed (Query : Key) return Boolean is
begin
return API.Get_Key (Query) = Press;
end Pressed;
procedure Raw_Key_Callback (Subject : Key; Action : Button_State);
procedure Raw_Character_Callback (Unicode_Char : Unicode_Character;
Action : Glfw.Events.Button_State);
pragma Convention (C, Raw_Key_Callback);
pragma Convention (C, Raw_Character_Callback);
User_Key_Callback : Key_Callback := null;
User_Character_Callback : Character_Callback := null;
procedure Raw_Key_Callback (Subject : Key; Action : Button_State) is
begin
if User_Key_Callback /= null then
User_Key_Callback (Subject, Action);
end if;
end Raw_Key_Callback;
procedure Raw_Character_Callback (Unicode_Char : Unicode_Character;
Action : Glfw.Events.Button_State) is
begin
if User_Character_Callback /= null then
User_Character_Callback (Unicode_Char, Action);
end if;
end Raw_Character_Callback;
procedure Set_Key_Callback (Callback : Key_Callback) is
begin
User_Key_Callback := Callback;
if Callback /= null then
API.Set_Key_Callback (Raw_Key_Callback'Access);
else
API.Set_Key_Callback (null);
end if;
end Set_Key_Callback;
procedure Set_Character_Callback (Callback : Character_Callback) is
begin
User_Character_Callback := Callback;
if Callback /= null then
API.Set_Char_Callback (Raw_Character_Callback'Access);
else
API.Set_Char_Callback (null);
end if;
end Set_Character_Callback;
procedure Toggle_Key_Repeat (Enable : Boolean) is
begin
if Enable then
API.Enable (Enums.Key_Repeat);
else
API.Disable (Enums.Key_Repeat);
end if;
end Toggle_Key_Repeat;
procedure Toggle_Sticky_Keys (Enable : Boolean) is
begin
if Enable then
API.Enable (Enums.Sticky_Keys);
else
API.Disable (Enums.Sticky_Keys);
end if;
end Toggle_Sticky_Keys;
procedure Toggle_System_Keys (Enable : Boolean) is
begin
if Enable then
API.Enable (Enums.System_Keys);
else
API.Disable (Enums.System_Keys);
end if;
end Toggle_System_Keys;
end Glfw.Events.Keys;
|
test/Fail/PatternSynonymNoParse.agda | shlevy/agda | 1,989 | 8380 | <reponame>shlevy/agda
module PatternSynonymNoParse where
pattern f x = a b
|
projects/batfish/src/main/antlr4/org/batfish/vendor/a10/grammar/A10_ip_access_list.g4 | ton31337/batfish | 1 | 1967 | parser grammar A10_ip_access_list;
import A10_common;
options {
tokenVocab = A10Lexer;
}
si_access_list: ACCESS_LIST access_list_name NEWLINE sial_rule_definition*;
sial_rule_definition
:
sialr_action sialr_protocol
source = access_list_address
destination = access_list_address (dest_range = access_list_port_range)?
NEWLINE
;
sialr_action: PERMIT | DENY;
sialr_protocol: ICMP | IP | TCP | UDP;
access_list_address: access_list_address_any | access_list_address_host;
access_list_address_any: ANY;
access_list_address_host: HOST address = ip_address;
access_list_port_range: RANGE from = acl_port_number to = acl_port_number;
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_1818.asm | ljhsiun2/medusa | 9 | 98328 | .global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r8
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x3bb, %r9
nop
nop
nop
sub %rbx, %rbx
mov $0x6162636465666768, %rax
movq %rax, %xmm0
vmovups %ymm0, (%r9)
nop
cmp %rdx, %rdx
lea addresses_A_ht+0x110bb, %rsi
nop
nop
nop
nop
and $50751, %r8
mov (%rsi), %r14d
xor $28094, %r9
lea addresses_WT_ht+0x10bd, %r9
nop
nop
nop
cmp $48695, %rsi
movb $0x61, (%r9)
nop
nop
nop
nop
nop
and $35982, %r14
lea addresses_WC_ht+0xbf5b, %rsi
nop
nop
nop
cmp $56406, %r14
movups (%rsi), %xmm6
vpextrq $1, %xmm6, %rdx
nop
xor $6372, %r14
lea addresses_A_ht+0x1a83b, %rsi
lea addresses_D_ht+0x1afbb, %rdi
nop
nop
nop
sub $52273, %r8
mov $44, %rcx
rep movsb
add %rdx, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r9
push %rbp
push %rdi
push %rdx
// Store
lea addresses_WC+0x1c889, %rdx
sub $54344, %r9
movl $0x51525354, (%rdx)
nop
nop
nop
and %rdx, %rdx
// Store
lea addresses_UC+0x10403, %r12
nop
nop
nop
nop
nop
and %rbp, %rbp
mov $0x5152535455565758, %rdx
movq %rdx, %xmm1
movups %xmm1, (%r12)
nop
nop
nop
nop
xor %r12, %r12
// Store
lea addresses_RW+0x10abb, %rdx
nop
nop
xor $42316, %r12
movw $0x5152, (%rdx)
nop
nop
nop
nop
nop
sub %r11, %r11
// Faulty Load
lea addresses_D+0x3bb, %rdi
nop
nop
add $58158, %rdx
mov (%rdi), %r12d
lea oracles, %rbp
and $0xff, %r12
shlq $12, %r12
mov (%rbp,%r12,1), %r12
pop %rdx
pop %rdi
pop %rbp
pop %r9
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': True, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': True, 'congruent': 8}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_D', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': True, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 6}, 'dst': {'same': True, 'type': 'addresses_D_ht', 'congruent': 10}}
{'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
*/
|
libsrc/_DEVELOPMENT/arch/zx/misc/c/sdcc_ix/zx_scroll_wc_up_attr_callee.asm | jpoikela/z88dk | 640 | 85350 | <reponame>jpoikela/z88dk
; void zx_scroll_wc_up_attr_callee(struct r_Rect8 *r, uchar rows, uchar attr)
SECTION code_clib
SECTION code_arch
PUBLIC _zx_scroll_wc_up_attr_callee, l0_zx_scroll_wc_up_attr_callee
EXTERN asm0_zx_scroll_wc_up_attr
_zx_scroll_wc_up_attr_callee:
pop hl
pop bc
ex (sp),hl
l0_zx_scroll_wc_up_attr_callee:
ld e,l
ld d,0
ld l,h
push bc
ex (sp),ix
call asm0_zx_scroll_wc_up_attr
pop ix
ret
|
oeis/262/A262543.asm | neoneye/loda-programs | 11 | 19294 | <gh_stars>10-100
; A262543: Number of rooted asymmetrical polyenoids of type U_n* having n edges.
; 0,2,4,10,28,84,264,858,2860,9724,33592,117572,416024,1485800,5348880,19389690,70715340,259289580,955277400,3534526380,13128240840,48932534040,182965127280,686119227300,2579808294648,9723892802904,36734706144304,139067101832008,527495903500720,2004484433302736,7629973004184608,29089272078453818,111068129754096396,424672260824486220,1625888084299461528,6232570989814602524,23919596771720906984,91901608649243484728,353467725574013402800,1360850743459951600780,5244254084552984217640
mov $1,$0
mul $1,2
bin $1,$0
trn $0,1
add $0,2
div $1,$0
mov $0,$1
mul $0,2
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca.log_21829_657.asm | ljhsiun2/medusa | 9 | 20198 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x97a3, %rbx
nop
nop
nop
nop
and %rsi, %rsi
mov $0x6162636465666768, %r10
movq %r10, %xmm5
movups %xmm5, (%rbx)
nop
nop
and %r10, %r10
lea addresses_A_ht+0x3267, %rsi
lea addresses_UC_ht+0x11167, %rdi
nop
nop
nop
add %r12, %r12
mov $71, %rcx
rep movsw
nop
nop
nop
dec %rdi
lea addresses_D_ht+0x4aaf, %rsi
lea addresses_WC_ht+0x1e157, %rdi
nop
nop
nop
nop
xor %rbp, %rbp
mov $64, %rcx
rep movsq
nop
nop
nop
nop
nop
add %rdi, %rdi
lea addresses_WC_ht+0xa1bb, %rsi
lea addresses_normal_ht+0xae47, %rdi
and $43853, %rbx
mov $46, %rcx
rep movsl
nop
nop
nop
nop
nop
sub $40951, %rdi
lea addresses_D_ht+0x1aa67, %rsi
lea addresses_WC_ht+0x12467, %rdi
nop
nop
nop
nop
dec %rdx
mov $8, %rcx
rep movsl
nop
nop
nop
nop
add $57476, %r10
lea addresses_normal_ht+0xe207, %r12
nop
nop
nop
sub %rsi, %rsi
vmovups (%r12), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %rdx
nop
inc %rdx
lea addresses_D_ht+0x1bd87, %r12
nop
nop
nop
nop
nop
and $19651, %r10
mov (%r12), %bx
nop
nop
nop
sub $20351, %rsi
lea addresses_normal_ht+0x1d987, %rbp
nop
nop
add %rbx, %rbx
mov (%rbp), %esi
nop
nop
add %rsi, %rsi
lea addresses_UC_ht+0x17e67, %rbp
clflush (%rbp)
nop
nop
xor %r12, %r12
mov $0x6162636465666768, %rdi
movq %rdi, %xmm6
movups %xmm6, (%rbp)
nop
nop
and $31776, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r9
push %rax
push %rbp
push %rcx
push %rdx
push %rsi
// Store
lea addresses_UC+0x7867, %rdx
nop
nop
nop
nop
nop
cmp $20429, %r14
mov $0x5152535455565758, %rsi
movq %rsi, %xmm1
vmovups %ymm1, (%rdx)
xor %rbp, %rbp
// Store
lea addresses_WT+0x1e27, %rsi
nop
sub %rcx, %rcx
movb $0x51, (%rsi)
nop
nop
nop
nop
nop
add %rsi, %rsi
// Faulty Load
lea addresses_D+0x19267, %rdx
nop
nop
nop
sub $39660, %r14
vmovups (%rdx), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %r9
lea oracles, %rax
and $0xff, %r9
shlq $12, %r9
mov (%rax,%r9,1), %r9
pop %rsi
pop %rdx
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_D', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 11}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 8}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 4}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 11}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 9}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': True, 'congruent': 3}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': True, 'AVXalign': False, 'congruent': 9}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
src/lang/stemmer-serbian.adb | stcarrez/ada-stemmer | 3 | 30221 | <reponame>stcarrez/ada-stemmer
-- Generated by Snowball 2.2.0 - https://snowballstem.org/
package body Stemmer.Serbian is
pragma Style_Checks ("-mr");
pragma Warnings (Off, "*variable*is never read and never assigned*");
pragma Warnings (Off, "*mode could be*instead of*");
pragma Warnings (Off, "*formal parameter.*is not modified*");
pragma Warnings (Off, "*this line is too long*");
pragma Warnings (Off, "*is not referenced*");
procedure R_Step_3 (Z : in out Context_Type; Result : out Boolean);
procedure R_Step_2 (Z : in out Context_Type; Result : out Boolean);
procedure R_Step_1 (Z : in out Context_Type; Result : out Boolean);
procedure R_R1 (Z : in out Context_Type; Result : out Boolean);
procedure R_Mark_regions (Z : in out Context_Type; Result : out Boolean);
procedure R_Prelude (Z : in out Context_Type; Result : out Boolean);
procedure R_Cyr_to_lat (Z : in out Context_Type; Result : out Boolean);
G_V : constant Grouping_Array (0 .. 23) := (
True, False, False, False, True, False, False, False,
True, False, False, False, False, False, True, False,
False, False, False, False, True, False, False, False
);
G_Sa : constant Grouping_Array (0 .. 119) := (
True, False, False, False, False, False, True, False,
False, False, True, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, True, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, True
);
G_Ca : constant Grouping_Array (0 .. 287) := (
True, True, True, False, True, True, True, False,
True, True, True, True, True, False, True, False,
True, True, True, False, True, False, False, False,
True, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, True, False, False,
False, False, False, True, False, False, False, True,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, True,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,
False, False, False, False, True, False, False, False
);
G_Rg : constant Grouping_Array (0 .. 7) := (
True, False, False, False, False, False, False, False
);
Among_String : constant String := "а" & "б" & "в" & "г" & "д" & "е"
& "ж" & "з" & "и" & "к" & "л" & "м" & "н" & "о" & "п" & "р" & "с"
& "т" & "у" & "ф" & "х" & "ц" & "ч" & "ш" & "ђ" & "ј" & "љ" & "њ"
& "ћ" & "џ" & "daba" & "ajaca" & "ejaca" & "ljaca" & "njaca" & "ojaca"
& "alaca" & "elaca" & "olaca" & "maca" & "naca" & "raca" & "saca" & "vaca"
& "šaca" & "aoca" & "acaka" & "ajaka" & "ojaka" & "anaka" & "ataka" & "etaka"
& "itaka" & "otaka" & "utaka" & "ačaka" & "esama" & "izama" & "jacima"
& "nicima" & "ticima" & "teticima" & "zicima" & "atcima" & "utcima" & "čcima"
& "pesima" & "inzima" & "lozima" & "metara" & "centara" & "istara" & "ekata"
& "anata" & "nstava" & "kustava" & "ajac" & "ejac" & "ljac" & "njac" & "anjac"
& "ojac" & "alac" & "elac" & "olac" & "mac" & "nac" & "rac" & "sac" & "vac"
& "šac" & "jebe" & "olce" & "kuse" & "rave" & "save" & "šave" & "baci" & "jaci"
& "tvenici" & "snici" & "tetici" & "bojci" & "vojci" & "ojsci" & "atci" & "itci"
& "utci" & "čci" & "pesi" & "inzi" & "lozi" & "acak" & "usak" & "atak" & "etak"
& "itak" & "otak" & "utak" & "ačak" & "ušak" & "izam" & "tican" & "cajan"
& "čajan" & "voljan" & "eskan" & "alan" & "bilan" & "gilan" & "nilan" & "rilan"
& "silan" & "tilan" & "avilan" & "laran" & "eran" & "asan" & "esan" & "dusan"
& "kusan" & "atan" & "pletan" & "tetan" & "antan" & "pravan" & "stavan" & "sivan"
& "tivan" & "ozan" & "tičan" & "ašan" & "dušan" & "metar" & "centar" & "istar"
& "ekat" & "enat" & "oscu" & "ošću" & "aca" & "eca" & "uca" & "ga" & "acega"
& "ecega" & "ucega" & "anjijega" & "enjijega" & "snjijega" & "šnjijega"
& "kijega" & "skijega" & "škijega" & "elijega" & "nijega" & "osijega"
& "atijega" & "evitijega" & "ovitijega" & "astijega" & "avijega" & "evijega"
& "ivijega" & "ovijega" & "ošijega" & "anjega" & "enjega" & "snjega" & "šnjega"
& "kega" & "skega" & "škega" & "elega" & "nega" & "anega" & "enega" & "snega"
& "šnega" & "osega" & "atega" & "evitega" & "ovitega" & "astega" & "avega"
& "evega" & "ivega" & "ovega" & "aćega" & "ećega" & "ućega" & "ošega"
& "acoga" & "ecoga" & "ucoga" & "anjoga" & "enjoga" & "snjoga" & "šnjoga"
& "koga" & "skoga" & "škoga" & "loga" & "eloga" & "noga" & "cinoga" & "činoga"
& "osoga" & "atoga" & "evitoga" & "ovitoga" & "astoga" & "avoga" & "evoga"
& "ivoga" & "ovoga" & "aćoga" & "ećoga" & "ućoga" & "ošoga" & "uga" & "aja"
& "caja" & "laja" & "raja" & "ćaja" & "čaja" & "đaja" & "bija" & "cija"
& "dija" & "fija" & "gija" & "anjija" & "enjija" & "snjija" & "šnjija" & "kija"
& "skija" & "škija" & "lija" & "elija" & "mija" & "nija" & "ganija" & "manija"
& "panija" & "ranija" & "tanija" & "pija" & "rija" & "rarija" & "sija" & "osija"
& "tija" & "atija" & "evitija" & "ovitija" & "otija" & "astija" & "avija"
& "evija" & "ivija" & "ovija" & "zija" & "ošija" & "žija" & "anja" & "enja"
& "snja" & "šnja" & "ka" & "ska" & "ška" & "ala" & "acala" & "astajala"
& "istajala" & "ostajala" & "ijala" & "injala" & "nala" & "irala" & "urala"
& "tala" & "astala" & "istala" & "ostala" & "avala" & "evala" & "ivala" & "ovala"
& "uvala" & "ačala" & "ela" & "ila" & "acila" & "lucila" & "nila" & "astanila"
& "istanila" & "ostanila" & "rosila" & "jetila" & "ozila" & "ačila" & "lučila"
& "rošila" & "ola" & "asla" & "nula" & "gama" & "logama" & "ugama" & "ajama"
& "cajama" & "lajama" & "rajama" & "ćajama" & "čajama" & "đajama" & "bijama"
& "cijama" & "dijama" & "fijama" & "gijama" & "lijama" & "mijama" & "nijama"
& "ganijama" & "manijama" & "panijama" & "ranijama" & "tanijama" & "pijama"
& "rijama" & "sijama" & "tijama" & "zijama" & "žijama" & "alama" & "ijalama"
& "nalama" & "elama" & "ilama" & "ramama" & "lemama" & "inama" & "cinama"
& "činama" & "rama" & "arama" & "drama" & "erama" & "orama" & "basama"
& "gasama" & "jasama" & "kasama" & "nasama" & "tasama" & "vasama" & "esama"
& "isama" & "etama" & "estama" & "istama" & "kstama" & "ostama" & "avama"
& "evama" & "ivama" & "bašama" & "gašama" & "jašama" & "kašama" & "našama"
& "tašama" & "vašama" & "ešama" & "išama" & "lema" & "acima" & "ecima"
& "ucima" & "ajima" & "cajima" & "lajima" & "rajima" & "ćajima" & "čajima"
& "đajima" & "bijima" & "cijima" & "dijima" & "fijima" & "gijima" & "anjijima"
& "enjijima" & "snjijima" & "šnjijima" & "kijima" & "skijima" & "škijima"
& "lijima" & "elijima" & "mijima" & "nijima" & "ganijima" & "manijima"
& "panijima" & "ranijima" & "tanijima" & "pijima" & "rijima" & "sijima"
& "osijima" & "tijima" & "atijima" & "evitijima" & "ovitijima" & "astijima"
& "avijima" & "evijima" & "ivijima" & "ovijima" & "zijima" & "ošijima"
& "žijima" & "anjima" & "enjima" & "snjima" & "šnjima" & "kima" & "skima"
& "škima" & "alima" & "ijalima" & "nalima" & "elima" & "ilima" & "ozilima"
& "olima" & "lemima" & "nima" & "anima" & "inima" & "cinima" & "činima"
& "onima" & "arima" & "drima" & "erima" & "orima" & "basima" & "gasima"
& "jasima" & "kasima" & "nasima" & "tasima" & "vasima" & "esima" & "isima"
& "osima" & "atima" & "ikatima" & "latima" & "etima" & "evitima" & "ovitima"
& "astima" & "estima" & "istima" & "kstima" & "ostima" & "ištima" & "avima"
& "evima" & "ajevima" & "cajevima" & "lajevima" & "rajevima" & "ćajevima"
& "čajevima" & "đajevima" & "ivima" & "ovima" & "govima" & "ugovima" & "lovima"
& "olovima" & "movima" & "onovima" & "stvima" & "štvima" & "aćima" & "ećima"
& "ućima" & "bašima" & "gašima" & "jašima" & "kašima" & "našima"
& "tašima" & "vašima" & "ešima" & "išima" & "ošima" & "na" & "ana" & "acana"
& "urana" & "tana" & "avana" & "evana" & "ivana" & "uvana" & "ačana" & "acena"
& "lucena" & "ačena" & "lučena" & "ina" & "cina" & "anina" & "čina" & "ona"
& "ara" & "dra" & "era" & "ora" & "basa" & "gasa" & "jasa" & "kasa" & "nasa"
& "tasa" & "vasa" & "esa" & "isa" & "osa" & "ata" & "ikata" & "lata" & "eta"
& "evita" & "ovita" & "asta" & "esta" & "ista" & "ksta" & "osta" & "nuta"
& "išta" & "ava" & "eva" & "ajeva" & "cajeva" & "lajeva" & "rajeva" & "ćajeva"
& "čajeva" & "đajeva" & "iva" & "ova" & "gova" & "ugova" & "lova" & "olova"
& "mova" & "onova" & "stva" & "štva" & "aća" & "eća" & "uća" & "baša"
& "gaša" & "jaša" & "kaša" & "naša" & "taša" & "vaša" & "eša" & "iša"
& "oša" & "ace" & "ece" & "uce" & "luce" & "astade" & "istade" & "ostade" & "ge"
& "loge" & "uge" & "aje" & "caje" & "laje" & "raje" & "astaje" & "istaje"
& "ostaje" & "ćaje" & "čaje" & "đaje" & "ije" & "bije" & "cije" & "dije"
& "fije" & "gije" & "anjije" & "enjije" & "snjije" & "šnjije" & "kije" & "skije"
& "škije" & "lije" & "elije" & "mije" & "nije" & "ganije" & "manije" & "panije"
& "ranije" & "tanije" & "pije" & "rije" & "sije" & "osije" & "tije" & "atije"
& "evitije" & "ovitije" & "astije" & "avije" & "evije" & "ivije" & "ovije"
& "zije" & "ošije" & "žije" & "anje" & "enje" & "snje" & "šnje" & "uje"
& "lucuje" & "iruje" & "lučuje" & "ke" & "ske" & "ške" & "ale" & "acale"
& "astajale" & "istajale" & "ostajale" & "ijale" & "injale" & "nale" & "irale"
& "urale" & "tale" & "astale" & "istale" & "ostale" & "avale" & "evale" & "ivale"
& "ovale" & "uvale" & "ačale" & "ele" & "ile" & "acile" & "lucile" & "nile"
& "rosile" & "jetile" & "ozile" & "ačile" & "lučile" & "rošile" & "ole"
& "asle" & "nule" & "rame" & "leme" & "acome" & "ecome" & "ucome" & "anjome"
& "enjome" & "snjome" & "šnjome" & "kome" & "skome" & "škome" & "elome"
& "nome" & "cinome" & "činome" & "osome" & "atome" & "evitome" & "ovitome"
& "astome" & "avome" & "evome" & "ivome" & "ovome" & "aćome" & "ećome"
& "ućome" & "ošome" & "ne" & "ane" & "acane" & "urane" & "tane" & "astane"
& "istane" & "ostane" & "avane" & "evane" & "ivane" & "uvane" & "ačane"
& "acene" & "lucene" & "ačene" & "lučene" & "ine" & "cine" & "anine" & "čine"
& "one" & "are" & "dre" & "ere" & "ore" & "ase" & "base" & "acase" & "gase"
& "jase" & "astajase" & "istajase" & "ostajase" & "injase" & "kase" & "nase"
& "irase" & "urase" & "tase" & "vase" & "avase" & "evase" & "ivase" & "ovase"
& "uvase" & "ese" & "ise" & "acise" & "lucise" & "rosise" & "jetise" & "ose"
& "astadose" & "istadose" & "ostadose" & "ate" & "acate" & "ikate" & "late"
& "irate" & "urate" & "tate" & "avate" & "evate" & "ivate" & "uvate" & "ačate"
& "ete" & "astadete" & "istadete" & "ostadete" & "astajete" & "istajete"
& "ostajete" & "ijete" & "injete" & "ujete" & "lucujete" & "irujete"
& "lučujete" & "nete" & "astanete" & "istanete" & "ostanete" & "astete" & "ite"
& "acite" & "lucite" & "nite" & "astanite" & "istanite" & "ostanite" & "rosite"
& "jetite" & "astite" & "evite" & "ovite" & "ačite" & "lučite" & "rošite"
& "ajte" & "urajte" & "tajte" & "astajte" & "istajte" & "ostajte" & "avajte"
& "evajte" & "ivajte" & "uvajte" & "ijte" & "lucujte" & "irujte" & "lučujte"
& "aste" & "acaste" & "astajaste" & "istajaste" & "ostajaste" & "injaste"
& "iraste" & "uraste" & "taste" & "avaste" & "evaste" & "ivaste" & "ovaste"
& "uvaste" & "ačaste" & "este" & "iste" & "aciste" & "luciste" & "niste"
& "rosiste" & "jetiste" & "ačiste" & "lučiste" & "rošiste" & "kste" & "oste"
& "astadoste" & "istadoste" & "ostadoste" & "nuste" & "ište" & "ave" & "eve"
& "ajeve" & "cajeve" & "lajeve" & "rajeve" & "ćajeve" & "čajeve" & "đajeve"
& "ive" & "ove" & "gove" & "ugove" & "love" & "olove" & "move" & "onove" & "aće"
& "eće" & "uće" & "ače" & "luče" & "aše" & "baše" & "gaše" & "jaše"
& "astajaše" & "istajaše" & "ostajaše" & "injaše" & "kaše" & "naše"
& "iraše" & "uraše" & "taše" & "vaše" & "avaše" & "evaše" & "ivaše"
& "ovaše" & "uvaše" & "ačaše" & "eše" & "iše" & "jetiše" & "ačiše"
& "lučiše" & "rošiše" & "oše" & "astadoše" & "istadoše" & "ostadoše"
& "aceg" & "eceg" & "uceg" & "anjijeg" & "enjijeg" & "snjijeg" & "šnjijeg"
& "kijeg" & "skijeg" & "škijeg" & "elijeg" & "nijeg" & "osijeg" & "atijeg"
& "evitijeg" & "ovitijeg" & "astijeg" & "avijeg" & "evijeg" & "ivijeg" & "ovijeg"
& "ošijeg" & "anjeg" & "enjeg" & "snjeg" & "šnjeg" & "keg" & "eleg" & "neg"
& "aneg" & "eneg" & "sneg" & "šneg" & "oseg" & "ateg" & "aveg" & "eveg" & "iveg"
& "oveg" & "aćeg" & "ećeg" & "ućeg" & "ošeg" & "acog" & "ecog" & "ucog"
& "anjog" & "enjog" & "snjog" & "šnjog" & "kog" & "skog" & "škog" & "elog"
& "nog" & "cinog" & "činog" & "osog" & "atog" & "evitog" & "ovitog" & "astog"
& "avog" & "evog" & "ivog" & "ovog" & "aćog" & "ećog" & "ućog" & "ošog"
& "ah" & "acah" & "astajah" & "istajah" & "ostajah" & "injah" & "irah" & "urah"
& "tah" & "avah" & "evah" & "ivah" & "ovah" & "uvah" & "ačah" & "ih" & "acih"
& "ecih" & "ucih" & "lucih" & "anjijih" & "enjijih" & "snjijih" & "šnjijih"
& "kijih" & "skijih" & "škijih" & "elijih" & "nijih" & "osijih" & "atijih"
& "evitijih" & "ovitijih" & "astijih" & "avijih" & "evijih" & "ivijih" & "ovijih"
& "ošijih" & "anjih" & "enjih" & "snjih" & "šnjih" & "kih" & "skih" & "ških"
& "elih" & "nih" & "cinih" & "činih" & "osih" & "rosih" & "atih" & "jetih"
& "evitih" & "ovitih" & "astih" & "avih" & "evih" & "ivih" & "ovih" & "aćih"
& "ećih" & "ućih" & "ačih" & "lučih" & "oših" & "roših" & "astadoh"
& "istadoh" & "ostadoh" & "acuh" & "ecuh" & "ucuh" & "aćuh" & "ećuh" & "ućuh"
& "aci" & "aceci" & "ieci" & "ajuci" & "irajuci" & "urajuci" & "astajuci"
& "istajuci" & "ostajuci" & "avajuci" & "evajuci" & "ivajuci" & "uvajuci"
& "ujuci" & "lucujuci" & "irujuci" & "luci" & "nuci" & "etuci" & "astuci" & "gi"
& "ugi" & "aji" & "caji" & "laji" & "raji" & "ćaji" & "čaji" & "đaji" & "biji"
& "ciji" & "diji" & "fiji" & "giji" & "anjiji" & "enjiji" & "snjiji" & "šnjiji"
& "kiji" & "skiji" & "škiji" & "liji" & "eliji" & "miji" & "niji" & "ganiji"
& "maniji" & "paniji" & "raniji" & "taniji" & "piji" & "riji" & "siji" & "osiji"
& "tiji" & "atiji" & "evitiji" & "ovitiji" & "astiji" & "aviji" & "eviji"
& "iviji" & "oviji" & "ziji" & "ošiji" & "žiji" & "anji" & "enji" & "snji"
& "šnji" & "ki" & "ski" & "ški" & "ali" & "acali" & "astajali" & "istajali"
& "ostajali" & "ijali" & "injali" & "nali" & "irali" & "urali" & "tali"
& "astali" & "istali" & "ostali" & "avali" & "evali" & "ivali" & "ovali"
& "uvali" & "ačali" & "eli" & "ili" & "acili" & "lucili" & "nili" & "rosili"
& "jetili" & "ozili" & "ačili" & "lučili" & "rošili" & "oli" & "asli" & "nuli"
& "rami" & "lemi" & "ni" & "ani" & "acani" & "urani" & "tani" & "avani" & "evani"
& "ivani" & "uvani" & "ačani" & "aceni" & "luceni" & "ačeni" & "lučeni"
& "ini" & "cini" & "čini" & "oni" & "ari" & "dri" & "eri" & "ori" & "basi"
& "gasi" & "jasi" & "kasi" & "nasi" & "tasi" & "vasi" & "esi" & "isi" & "osi"
& "avsi" & "acavsi" & "iravsi" & "tavsi" & "etavsi" & "astavsi" & "istavsi"
& "ostavsi" & "ivsi" & "nivsi" & "rosivsi" & "nuvsi" & "ati" & "acati"
& "astajati" & "istajati" & "ostajati" & "injati" & "ikati" & "lati" & "irati"
& "urati" & "tati" & "astati" & "istati" & "ostati" & "avati" & "evati" & "ivati"
& "ovati" & "uvati" & "ačati" & "eti" & "iti" & "aciti" & "luciti" & "niti"
& "rositi" & "jetiti" & "eviti" & "oviti" & "ačiti" & "lučiti" & "rošiti"
& "asti" & "esti" & "isti" & "ksti" & "osti" & "nuti" & "avi" & "evi" & "ajevi"
& "cajevi" & "lajevi" & "rajevi" & "ćajevi" & "čajevi" & "đajevi" & "ivi"
& "ovi" & "govi" & "ugovi" & "lovi" & "olovi" & "movi" & "onovi" & "ieći"
& "ačeći" & "ajući" & "irajući" & "urajući" & "astajući" & "istajući"
& "ostajući" & "avajući" & "evajući" & "ivajući" & "uvajući" & "ujući"
& "irujući" & "lučujući" & "nući" & "etući" & "astući" & "ači" & "luči"
& "baši" & "gaši" & "jaši" & "kaši" & "naši" & "taši" & "vaši" & "eši"
& "iši" & "oši" & "avši" & "iravši" & "tavši" & "etavši" & "astavši"
& "istavši" & "ostavši" & "ačavši" & "ivši" & "nivši" & "rošivši"
& "nuvši" & "aj" & "uraj" & "taj" & "avaj" & "evaj" & "ivaj" & "uvaj" & "ij"
& "acoj" & "ecoj" & "ucoj" & "anjijoj" & "enjijoj" & "snjijoj" & "šnjijoj"
& "kijoj" & "skijoj" & "škijoj" & "elijoj" & "nijoj" & "osijoj" & "evitijoj"
& "ovitijoj" & "astijoj" & "avijoj" & "evijoj" & "ivijoj" & "ovijoj" & "ošijoj"
& "anjoj" & "enjoj" & "snjoj" & "šnjoj" & "koj" & "skoj" & "škoj" & "aloj"
& "eloj" & "noj" & "cinoj" & "činoj" & "osoj" & "atoj" & "evitoj" & "ovitoj"
& "astoj" & "avoj" & "evoj" & "ivoj" & "ovoj" & "aćoj" & "ećoj" & "ućoj"
& "ošoj" & "lucuj" & "iruj" & "lučuj" & "al" & "iral" & "ural" & "el" & "il"
& "am" & "acam" & "iram" & "uram" & "tam" & "avam" & "evam" & "ivam" & "uvam"
& "ačam" & "em" & "acem" & "ecem" & "ucem" & "astadem" & "istadem" & "ostadem"
& "ajem" & "cajem" & "lajem" & "rajem" & "astajem" & "istajem" & "ostajem"
& "ćajem" & "čajem" & "đajem" & "ijem" & "anjijem" & "enjijem" & "snjijem"
& "šnjijem" & "kijem" & "skijem" & "škijem" & "lijem" & "elijem" & "nijem"
& "rarijem" & "sijem" & "osijem" & "atijem" & "evitijem" & "ovitijem" & "otijem"
& "astijem" & "avijem" & "evijem" & "ivijem" & "ovijem" & "ošijem" & "anjem"
& "enjem" & "injem" & "snjem" & "šnjem" & "ujem" & "lucujem" & "irujem"
& "lučujem" & "kem" & "skem" & "škem" & "elem" & "nem" & "anem" & "astanem"
& "istanem" & "ostanem" & "enem" & "snem" & "šnem" & "basem" & "gasem" & "jasem"
& "kasem" & "nasem" & "tasem" & "vasem" & "esem" & "isem" & "osem" & "atem"
& "etem" & "evitem" & "ovitem" & "astem" & "istem" & "ištem" & "avem" & "evem"
& "ivem" & "aćem" & "ećem" & "ućem" & "bašem" & "gašem" & "jašem"
& "kašem" & "našem" & "tašem" & "vašem" & "ešem" & "išem" & "ošem" & "im"
& "acim" & "ecim" & "ucim" & "lucim" & "anjijim" & "enjijim" & "snjijim"
& "šnjijim" & "kijim" & "skijim" & "škijim" & "elijim" & "nijim" & "osijim"
& "atijim" & "evitijim" & "ovitijim" & "astijim" & "avijim" & "evijim" & "ivijim"
& "ovijim" & "ošijim" & "anjim" & "enjim" & "snjim" & "šnjim" & "kim" & "skim"
& "škim" & "elim" & "nim" & "cinim" & "činim" & "osim" & "rosim" & "atim"
& "jetim" & "evitim" & "ovitim" & "astim" & "avim" & "evim" & "ivim" & "ovim"
& "aćim" & "ećim" & "ućim" & "ačim" & "lučim" & "ošim" & "rošim" & "acom"
& "ecom" & "ucom" & "gom" & "logom" & "ugom" & "bijom" & "cijom" & "dijom"
& "fijom" & "gijom" & "lijom" & "mijom" & "nijom" & "ganijom" & "manijom"
& "panijom" & "ranijom" & "tanijom" & "pijom" & "rijom" & "sijom" & "tijom"
& "zijom" & "žijom" & "anjom" & "enjom" & "snjom" & "šnjom" & "kom" & "skom"
& "škom" & "alom" & "ijalom" & "nalom" & "elom" & "ilom" & "ozilom" & "olom"
& "ramom" & "lemom" & "nom" & "anom" & "inom" & "cinom" & "aninom" & "činom"
& "onom" & "arom" & "drom" & "erom" & "orom" & "basom" & "gasom" & "jasom"
& "kasom" & "nasom" & "tasom" & "vasom" & "esom" & "isom" & "osom" & "atom"
& "ikatom" & "latom" & "etom" & "evitom" & "ovitom" & "astom" & "estom" & "istom"
& "kstom" & "ostom" & "avom" & "evom" & "ivom" & "ovom" & "lovom" & "movom"
& "stvom" & "štvom" & "aćom" & "ećom" & "ućom" & "bašom" & "gašom"
& "jašom" & "kašom" & "našom" & "tašom" & "vašom" & "ešom" & "išom"
& "ošom" & "an" & "acan" & "iran" & "uran" & "tan" & "avan" & "evan" & "ivan"
& "uvan" & "ačan" & "acen" & "lucen" & "ačen" & "lučen" & "anin" & "ao"
& "acao" & "astajao" & "istajao" & "ostajao" & "injao" & "irao" & "urao" & "tao"
& "astao" & "istao" & "ostao" & "avao" & "evao" & "ivao" & "ovao" & "uvao"
& "ačao" & "go" & "ugo" & "io" & "acio" & "lucio" & "lio" & "nio" & "rario"
& "sio" & "rosio" & "jetio" & "otio" & "ačio" & "lučio" & "rošio" & "bijo"
& "cijo" & "dijo" & "fijo" & "gijo" & "lijo" & "mijo" & "nijo" & "pijo" & "rijo"
& "sijo" & "tijo" & "zijo" & "žijo" & "anjo" & "enjo" & "snjo" & "šnjo" & "ko"
& "sko" & "ško" & "alo" & "acalo" & "astajalo" & "istajalo" & "ostajalo"
& "ijalo" & "injalo" & "nalo" & "iralo" & "uralo" & "talo" & "astalo" & "istalo"
& "ostalo" & "avalo" & "evalo" & "ivalo" & "ovalo" & "uvalo" & "ačalo" & "elo"
& "ilo" & "acilo" & "lucilo" & "nilo" & "rosilo" & "jetilo" & "ačilo"
& "lučilo" & "rošilo" & "aslo" & "nulo" & "amo" & "acamo" & "ramo" & "iramo"
& "uramo" & "tamo" & "avamo" & "evamo" & "ivamo" & "uvamo" & "ačamo" & "emo"
& "astademo" & "istademo" & "ostademo" & "astajemo" & "istajemo" & "ostajemo"
& "ijemo" & "injemo" & "ujemo" & "lucujemo" & "irujemo" & "lučujemo" & "lemo"
& "nemo" & "astanemo" & "istanemo" & "ostanemo" & "etemo" & "astemo" & "imo"
& "acimo" & "lucimo" & "nimo" & "astanimo" & "istanimo" & "ostanimo" & "rosimo"
& "etimo" & "jetimo" & "astimo" & "ačimo" & "lučimo" & "rošimo" & "ajmo"
& "urajmo" & "tajmo" & "astajmo" & "istajmo" & "ostajmo" & "avajmo" & "evajmo"
& "ivajmo" & "uvajmo" & "ijmo" & "ujmo" & "lucujmo" & "irujmo" & "lučujmo"
& "asmo" & "acasmo" & "astajasmo" & "istajasmo" & "ostajasmo" & "injasmo"
& "irasmo" & "urasmo" & "tasmo" & "avasmo" & "evasmo" & "ivasmo" & "ovasmo"
& "uvasmo" & "ačasmo" & "ismo" & "acismo" & "lucismo" & "nismo" & "rosismo"
& "jetismo" & "ačismo" & "lučismo" & "rošismo" & "astadosmo" & "istadosmo"
& "ostadosmo" & "nusmo" & "no" & "ano" & "acano" & "urano" & "tano" & "avano"
& "evano" & "ivano" & "uvano" & "ačano" & "aceno" & "luceno" & "ačeno"
& "lučeno" & "ino" & "cino" & "čino" & "ato" & "ikato" & "lato" & "eto"
& "evito" & "ovito" & "asto" & "esto" & "isto" & "ksto" & "osto" & "nuto" & "nuo"
& "avo" & "evo" & "ivo" & "ovo" & "stvo" & "štvo" & "as" & "acas" & "iras"
& "uras" & "tas" & "avas" & "evas" & "ivas" & "uvas" & "es" & "astades"
& "istades" & "ostades" & "astajes" & "istajes" & "ostajes" & "ijes" & "injes"
& "ujes" & "lucujes" & "irujes" & "nes" & "astanes" & "istanes" & "ostanes"
& "etes" & "astes" & "is" & "acis" & "lucis" & "nis" & "rosis" & "jetis" & "at"
& "acat" & "astajat" & "istajat" & "ostajat" & "injat" & "irat" & "urat" & "tat"
& "astat" & "istat" & "ostat" & "avat" & "evat" & "ivat" & "irivat" & "ovat"
& "uvat" & "ačat" & "it" & "acit" & "lucit" & "rosit" & "jetit" & "ačit"
& "lučit" & "rošit" & "nut" & "astadu" & "istadu" & "ostadu" & "gu" & "logu"
& "ugu" & "ahu" & "acahu" & "astajahu" & "istajahu" & "ostajahu" & "injahu"
& "irahu" & "urahu" & "avahu" & "evahu" & "ivahu" & "ovahu" & "uvahu" & "ačahu"
& "aju" & "caju" & "acaju" & "laju" & "raju" & "iraju" & "uraju" & "taju"
& "astaju" & "istaju" & "ostaju" & "avaju" & "evaju" & "ivaju" & "uvaju"
& "ćaju" & "čaju" & "ačaju" & "đaju" & "iju" & "biju" & "ciju" & "diju"
& "fiju" & "giju" & "anjiju" & "enjiju" & "snjiju" & "šnjiju" & "kiju" & "liju"
& "eliju" & "miju" & "niju" & "ganiju" & "maniju" & "paniju" & "raniju"
& "taniju" & "piju" & "riju" & "rariju" & "siju" & "osiju" & "tiju" & "atiju"
& "otiju" & "aviju" & "eviju" & "iviju" & "oviju" & "ziju" & "ošiju" & "žiju"
& "anju" & "enju" & "snju" & "šnju" & "uju" & "lucuju" & "iruju" & "lučuju"
& "ku" & "sku" & "šku" & "alu" & "ijalu" & "nalu" & "elu" & "ilu" & "ozilu"
& "olu" & "ramu" & "acemu" & "ecemu" & "ucemu" & "anjijemu" & "enjijemu"
& "snjijemu" & "šnjijemu" & "kijemu" & "skijemu" & "škijemu" & "elijemu"
& "nijemu" & "osijemu" & "atijemu" & "evitijemu" & "ovitijemu" & "astijemu"
& "avijemu" & "evijemu" & "ivijemu" & "ovijemu" & "ošijemu" & "anjemu"
& "enjemu" & "snjemu" & "šnjemu" & "kemu" & "skemu" & "škemu" & "lemu"
& "elemu" & "nemu" & "anemu" & "enemu" & "snemu" & "šnemu" & "osemu" & "atemu"
& "evitemu" & "ovitemu" & "astemu" & "avemu" & "evemu" & "ivemu" & "ovemu"
& "aćemu" & "ećemu" & "ućemu" & "ošemu" & "acomu" & "ecomu" & "ucomu"
& "anjomu" & "enjomu" & "snjomu" & "šnjomu" & "komu" & "skomu" & "škomu"
& "elomu" & "nomu" & "cinomu" & "činomu" & "osomu" & "atomu" & "evitomu"
& "ovitomu" & "astomu" & "avomu" & "evomu" & "ivomu" & "ovomu" & "aćomu"
& "ećomu" & "ućomu" & "ošomu" & "nu" & "anu" & "astanu" & "istanu" & "ostanu"
& "inu" & "cinu" & "aninu" & "činu" & "onu" & "aru" & "dru" & "eru" & "oru"
& "basu" & "gasu" & "jasu" & "kasu" & "nasu" & "tasu" & "vasu" & "esu" & "isu"
& "osu" & "atu" & "ikatu" & "latu" & "etu" & "evitu" & "ovitu" & "astu" & "estu"
& "istu" & "kstu" & "ostu" & "ištu" & "avu" & "evu" & "ivu" & "ovu" & "lovu"
& "movu" & "stvu" & "štvu" & "bašu" & "gašu" & "jašu" & "kašu" & "našu"
& "tašu" & "vašu" & "ešu" & "išu" & "ošu" & "avav" & "evav" & "ivav"
& "uvav" & "kov" & "aš" & "iraš" & "uraš" & "taš" & "avaš" & "evaš"
& "ivaš" & "uvaš" & "ačaš" & "eš" & "astadeš" & "istadeš" & "ostadeš"
& "astaješ" & "istaješ" & "ostaješ" & "iješ" & "inješ" & "uješ" & "iruješ"
& "lučuješ" & "neš" & "astaneš" & "istaneš" & "ostaneš" & "eteš"
& "asteš" & "iš" & "niš" & "jetiš" & "ačiš" & "lučiš" & "rošiš" & "a"
& "oga" & "ama" & "ima" & "ena" & "e" & "og" & "anog" & "enog" & "anih" & "enih"
& "i" & "ani" & "eni" & "anoj" & "enoj" & "anim" & "enim" & "om" & "enom" & "o"
& "ano" & "eno" & "ost" & "u" & "enu";
A_0 : constant Among_Array_Type (0 .. 29) := (
(1, 2, -1, 1, 0),
(3, 4, -1, 2, 0),
(5, 6, -1, 3, 0),
(7, 8, -1, 4, 0),
(9, 10, -1, 5, 0),
(11, 12, -1, 7, 0),
(13, 14, -1, 8, 0),
(15, 16, -1, 9, 0),
(17, 18, -1, 10, 0),
(19, 20, -1, 12, 0),
(21, 22, -1, 13, 0),
(23, 24, -1, 15, 0),
(25, 26, -1, 16, 0),
(27, 28, -1, 18, 0),
(29, 30, -1, 19, 0),
(31, 32, -1, 20, 0),
(33, 34, -1, 21, 0),
(35, 36, -1, 22, 0),
(37, 38, -1, 24, 0),
(39, 40, -1, 25, 0),
(41, 42, -1, 26, 0),
(43, 44, -1, 27, 0),
(45, 46, -1, 28, 0),
(47, 48, -1, 30, 0),
(49, 50, -1, 6, 0),
(51, 52, -1, 11, 0),
(53, 54, -1, 14, 0),
(55, 56, -1, 17, 0),
(57, 58, -1, 23, 0),
(59, 60, -1, 29, 0));
A_1 : constant Among_Array_Type (0 .. 129) := (
(61, 64, -1, 73, 0),
(65, 69, -1, 12, 0),
(70, 74, -1, 14, 0),
(75, 79, -1, 13, 0),
(80, 84, -1, 85, 0),
(85, 89, -1, 15, 0),
(90, 94, -1, 82, 0),
(95, 99, -1, 83, 0),
(100, 104, -1, 84, 0),
(105, 108, -1, 75, 0),
(109, 112, -1, 76, 0),
(113, 116, -1, 81, 0),
(117, 120, -1, 80, 0),
(121, 124, -1, 79, 0),
(125, 129, -1, 18, 0),
(130, 133, -1, 82, 0),
(134, 138, -1, 55, 0),
(139, 143, -1, 16, 0),
(144, 148, -1, 17, 0),
(149, 153, -1, 78, 0),
(154, 158, -1, 58, 0),
(159, 163, -1, 59, 0),
(164, 168, -1, 60, 0),
(169, 173, -1, 61, 0),
(174, 178, -1, 62, 0),
(179, 184, -1, 54, 0),
(185, 189, -1, 67, 0),
(190, 194, -1, 87, 0),
(195, 200, -1, 5, 0),
(201, 206, -1, 23, 0),
(207, 212, -1, 24, 0),
(213, 220, 30, 21, 0),
(221, 226, -1, 25, 0),
(227, 232, -1, 58, 0),
(233, 238, -1, 62, 0),
(239, 244, -1, 74, 0),
(245, 250, -1, 2, 0),
(251, 256, -1, 19, 0),
(257, 262, -1, 1, 0),
(263, 268, -1, 68, 0),
(269, 275, -1, 69, 0),
(276, 281, -1, 70, 0),
(282, 286, -1, 86, 0),
(287, 291, -1, 53, 0),
(292, 297, -1, 22, 0),
(298, 304, -1, 29, 0),
(305, 308, -1, 12, 0),
(309, 312, -1, 14, 0),
(313, 316, -1, 13, 0),
(317, 320, -1, 85, 0),
(321, 325, 49, 11, 0),
(326, 329, -1, 15, 0),
(330, 333, -1, 82, 0),
(334, 337, -1, 83, 0),
(338, 341, -1, 84, 0),
(342, 344, -1, 75, 0),
(345, 347, -1, 76, 0),
(348, 350, -1, 81, 0),
(351, 353, -1, 80, 0),
(354, 356, -1, 79, 0),
(357, 360, -1, 18, 0),
(361, 364, -1, 88, 0),
(365, 368, -1, 84, 0),
(369, 372, -1, 27, 0),
(373, 376, -1, 42, 0),
(377, 380, -1, 52, 0),
(381, 385, -1, 51, 0),
(386, 389, -1, 89, 0),
(390, 393, -1, 5, 0),
(394, 400, -1, 20, 0),
(401, 405, -1, 26, 0),
(406, 411, -1, 21, 0),
(412, 416, -1, 4, 0),
(417, 421, -1, 3, 0),
(422, 426, -1, 66, 0),
(427, 430, -1, 58, 0),
(431, 434, -1, 60, 0),
(435, 438, -1, 62, 0),
(439, 442, -1, 74, 0),
(443, 446, -1, 2, 0),
(447, 450, -1, 19, 0),
(451, 454, -1, 1, 0),
(455, 458, -1, 55, 0),
(459, 462, -1, 57, 0),
(463, 466, -1, 58, 0),
(467, 470, -1, 59, 0),
(471, 474, -1, 60, 0),
(475, 478, -1, 61, 0),
(479, 482, -1, 62, 0),
(483, 487, -1, 54, 0),
(488, 492, -1, 56, 0),
(493, 496, -1, 87, 0),
(497, 501, -1, 65, 0),
(502, 506, -1, 7, 0),
(507, 512, -1, 6, 0),
(513, 518, -1, 77, 0),
(519, 523, -1, 63, 0),
(524, 527, -1, 40, 0),
(528, 532, -1, 33, 0),
(533, 537, -1, 37, 0),
(538, 542, -1, 39, 0),
(543, 547, -1, 38, 0),
(548, 552, -1, 36, 0),
(553, 557, -1, 34, 0),
(558, 563, -1, 35, 0),
(564, 568, -1, 9, 0),
(569, 572, -1, 8, 0),
(573, 576, -1, 91, 0),
(577, 580, -1, 10, 0),
(581, 585, -1, 31, 0),
(586, 590, -1, 28, 0),
(591, 594, -1, 47, 0),
(595, 600, -1, 50, 0),
(601, 605, -1, 49, 0),
(606, 610, -1, 32, 0),
(611, 616, -1, 44, 0),
(617, 622, -1, 43, 0),
(623, 627, -1, 46, 0),
(628, 632, -1, 45, 0),
(633, 636, -1, 41, 0),
(637, 642, -1, 64, 0),
(643, 647, -1, 90, 0),
(648, 653, -1, 30, 0),
(654, 658, -1, 68, 0),
(659, 664, -1, 69, 0),
(665, 669, -1, 70, 0),
(670, 673, -1, 86, 0),
(674, 677, -1, 48, 0),
(678, 681, -1, 72, 0),
(682, 687, -1, 71, 0));
A_2 : constant Among_Array_Type (0 .. 2034) := (
(688, 690, -1, 124, 0),
(691, 693, -1, 125, 0),
(694, 696, -1, 126, 0),
(697, 698, -1, 20, 0),
(699, 703, 3, 124, 0),
(704, 708, 3, 125, 0),
(709, 713, 3, 126, 0),
(714, 721, 3, 84, 0),
(722, 729, 3, 85, 0),
(730, 737, 3, 122, 0),
(738, 746, 3, 86, 0),
(747, 752, 3, 95, 0),
(753, 759, 11, 1, 0),
(760, 767, 11, 2, 0),
(768, 774, 3, 83, 0),
(775, 780, 3, 13, 0),
(781, 787, 3, 123, 0),
(788, 794, 3, 120, 0),
(795, 803, 3, 92, 0),
(804, 812, 3, 93, 0),
(813, 820, 3, 94, 0),
(821, 827, 3, 77, 0),
(828, 834, 3, 78, 0),
(835, 841, 3, 79, 0),
(842, 848, 3, 80, 0),
(849, 856, 3, 91, 0),
(857, 862, 3, 84, 0),
(863, 868, 3, 85, 0),
(869, 874, 3, 122, 0),
(875, 881, 3, 86, 0),
(882, 885, 3, 95, 0),
(886, 890, 30, 1, 0),
(891, 896, 30, 2, 0),
(897, 901, 3, 83, 0),
(902, 905, 3, 13, 0),
(906, 910, 34, 10, 0),
(911, 915, 34, 87, 0),
(916, 920, 34, 159, 0),
(921, 926, 34, 88, 0),
(927, 931, 3, 123, 0),
(932, 936, 3, 120, 0),
(937, 943, 3, 92, 0),
(944, 950, 3, 93, 0),
(951, 956, 3, 94, 0),
(957, 961, 3, 77, 0),
(962, 966, 3, 78, 0),
(967, 971, 3, 79, 0),
(972, 976, 3, 80, 0),
(977, 982, 3, 14, 0),
(983, 988, 3, 15, 0),
(989, 994, 3, 16, 0),
(995, 1000, 3, 91, 0),
(1001, 1005, 3, 124, 0),
(1006, 1010, 3, 125, 0),
(1011, 1015, 3, 126, 0),
(1016, 1021, 3, 84, 0),
(1022, 1027, 3, 85, 0),
(1028, 1033, 3, 122, 0),
(1034, 1040, 3, 86, 0),
(1041, 1044, 3, 95, 0),
(1045, 1049, 59, 1, 0),
(1050, 1055, 59, 2, 0),
(1056, 1059, 3, 19, 0),
(1060, 1064, 62, 83, 0),
(1065, 1068, 3, 13, 0),
(1069, 1074, 64, 137, 0),
(1075, 1081, 64, 89, 0),
(1082, 1086, 3, 123, 0),
(1087, 1091, 3, 120, 0),
(1092, 1098, 3, 92, 0),
(1099, 1105, 3, 93, 0),
(1106, 1111, 3, 94, 0),
(1112, 1116, 3, 77, 0),
(1117, 1121, 3, 78, 0),
(1122, 1126, 3, 79, 0),
(1127, 1131, 3, 80, 0),
(1132, 1137, 3, 14, 0),
(1138, 1143, 3, 15, 0),
(1144, 1149, 3, 16, 0),
(1150, 1155, 3, 91, 0),
(1156, 1158, 3, 18, 0),
(1159, 1161, -1, 109, 0),
(1162, 1165, 81, 26, 0),
(1166, 1169, 81, 30, 0),
(1170, 1173, 81, 31, 0),
(1174, 1178, 81, 28, 0),
(1179, 1183, 81, 27, 0),
(1184, 1188, 81, 29, 0),
(1189, 1192, -1, 32, 0),
(1193, 1196, -1, 33, 0),
(1197, 1200, -1, 34, 0),
(1201, 1204, -1, 40, 0),
(1205, 1208, -1, 39, 0),
(1209, 1214, -1, 84, 0),
(1215, 1220, -1, 85, 0),
(1221, 1226, -1, 122, 0),
(1227, 1233, -1, 86, 0),
(1234, 1237, -1, 95, 0),
(1238, 1242, 97, 1, 0),
(1243, 1248, 97, 2, 0),
(1249, 1252, -1, 24, 0),
(1253, 1257, 100, 83, 0),
(1258, 1261, -1, 37, 0),
(1262, 1265, -1, 13, 0),
(1266, 1271, 103, 9, 0),
(1272, 1277, 103, 6, 0),
(1278, 1283, 103, 7, 0),
(1284, 1289, 103, 8, 0),
(1290, 1295, 103, 5, 0),
(1296, 1299, -1, 41, 0),
(1300, 1303, -1, 42, 0),
(1304, 1309, 110, 21, 0),
(1310, 1313, -1, 23, 0),
(1314, 1318, 112, 123, 0),
(1319, 1322, -1, 44, 0),
(1323, 1327, 114, 120, 0),
(1328, 1334, 114, 92, 0),
(1335, 1341, 114, 93, 0),
(1342, 1346, 114, 22, 0),
(1347, 1352, 114, 94, 0),
(1353, 1357, -1, 77, 0),
(1358, 1362, -1, 78, 0),
(1363, 1367, -1, 79, 0),
(1368, 1372, -1, 80, 0),
(1373, 1376, -1, 45, 0),
(1377, 1382, -1, 91, 0),
(1383, 1387, -1, 38, 0),
(1388, 1391, -1, 84, 0),
(1392, 1395, -1, 85, 0),
(1396, 1399, -1, 122, 0),
(1400, 1404, -1, 86, 0),
(1405, 1406, -1, 95, 0),
(1407, 1409, 131, 1, 0),
(1410, 1413, 131, 2, 0),
(1414, 1416, -1, 104, 0),
(1417, 1421, 134, 128, 0),
(1422, 1429, 134, 106, 0),
(1430, 1437, 134, 107, 0),
(1438, 1445, 134, 108, 0),
(1446, 1450, 134, 47, 0),
(1451, 1456, 134, 114, 0),
(1457, 1460, 134, 46, 0),
(1461, 1465, 134, 100, 0),
(1466, 1470, 134, 105, 0),
(1471, 1474, 134, 113, 0),
(1475, 1480, 144, 110, 0),
(1481, 1486, 144, 111, 0),
(1487, 1492, 144, 112, 0),
(1493, 1497, 134, 97, 0),
(1498, 1502, 134, 96, 0),
(1503, 1507, 134, 98, 0),
(1508, 1512, 134, 76, 0),
(1513, 1517, 134, 99, 0),
(1518, 1523, 134, 102, 0),
(1524, 1526, -1, 83, 0),
(1527, 1529, -1, 116, 0),
(1530, 1534, 155, 124, 0),
(1535, 1540, 155, 121, 0),
(1541, 1544, 155, 103, 0),
(1545, 1552, 158, 110, 0),
(1553, 1560, 158, 111, 0),
(1561, 1568, 158, 112, 0),
(1569, 1574, 155, 127, 0),
(1575, 1580, 155, 118, 0),
(1581, 1585, 155, 48, 0),
(1586, 1591, 155, 101, 0),
(1592, 1598, 155, 117, 0),
(1599, 1605, 155, 90, 0),
(1606, 1608, -1, 50, 0),
(1609, 1612, -1, 115, 0),
(1613, 1616, -1, 13, 0),
(1617, 1620, -1, 20, 0),
(1621, 1626, 171, 19, 0),
(1627, 1631, 171, 18, 0),
(1632, 1636, -1, 109, 0),
(1637, 1642, 174, 26, 0),
(1643, 1648, 174, 30, 0),
(1649, 1654, 174, 31, 0),
(1655, 1661, 174, 28, 0),
(1662, 1668, 174, 27, 0),
(1669, 1675, 174, 29, 0),
(1676, 1681, -1, 32, 0),
(1682, 1687, -1, 33, 0),
(1688, 1693, -1, 34, 0),
(1694, 1699, -1, 40, 0),
(1700, 1705, -1, 39, 0),
(1706, 1711, -1, 35, 0),
(1712, 1717, -1, 37, 0),
(1718, 1723, -1, 36, 0),
(1724, 1731, 188, 9, 0),
(1732, 1739, 188, 6, 0),
(1740, 1747, 188, 7, 0),
(1748, 1755, 188, 8, 0),
(1756, 1763, 188, 5, 0),
(1764, 1769, -1, 41, 0),
(1770, 1775, -1, 42, 0),
(1776, 1781, -1, 43, 0),
(1782, 1787, -1, 44, 0),
(1788, 1793, -1, 45, 0),
(1794, 1800, -1, 38, 0),
(1801, 1805, -1, 104, 0),
(1806, 1812, 200, 47, 0),
(1813, 1818, 200, 46, 0),
(1819, 1823, -1, 119, 0),
(1824, 1828, -1, 116, 0),
(1829, 1834, -1, 52, 0),
(1835, 1840, -1, 51, 0),
(1841, 1845, -1, 11, 0),
(1846, 1851, 207, 137, 0),
(1852, 1858, 207, 89, 0),
(1859, 1862, -1, 52, 0),
(1863, 1867, 210, 53, 0),
(1868, 1872, 210, 54, 0),
(1873, 1877, 210, 55, 0),
(1878, 1882, 210, 56, 0),
(1883, 1888, -1, 135, 0),
(1889, 1894, -1, 131, 0),
(1895, 1900, -1, 129, 0),
(1901, 1906, -1, 133, 0),
(1907, 1912, -1, 132, 0),
(1913, 1918, -1, 130, 0),
(1919, 1924, -1, 134, 0),
(1925, 1929, -1, 152, 0),
(1930, 1934, -1, 154, 0),
(1935, 1939, -1, 70, 0),
(1940, 1945, -1, 71, 0),
(1946, 1951, -1, 72, 0),
(1952, 1957, -1, 73, 0),
(1958, 1963, -1, 74, 0),
(1964, 1968, -1, 77, 0),
(1969, 1973, -1, 78, 0),
(1974, 1978, -1, 79, 0),
(1979, 1985, -1, 63, 0),
(1986, 1992, -1, 64, 0),
(1993, 1999, -1, 61, 0),
(2000, 2006, -1, 62, 0),
(2007, 2013, -1, 60, 0),
(2014, 2020, -1, 59, 0),
(2021, 2027, -1, 65, 0),
(2028, 2033, -1, 66, 0),
(2034, 2039, -1, 67, 0),
(2040, 2043, -1, 51, 0),
(2044, 2048, -1, 124, 0),
(2049, 2053, -1, 125, 0),
(2054, 2058, -1, 126, 0),
(2059, 2063, -1, 109, 0),
(2064, 2069, 245, 26, 0),
(2070, 2075, 245, 30, 0),
(2076, 2081, 245, 31, 0),
(2082, 2088, 245, 28, 0),
(2089, 2095, 245, 27, 0),
(2096, 2102, 245, 29, 0),
(2103, 2108, -1, 32, 0),
(2109, 2114, -1, 33, 0),
(2115, 2120, -1, 34, 0),
(2121, 2126, -1, 40, 0),
(2127, 2132, -1, 39, 0),
(2133, 2140, -1, 84, 0),
(2141, 2148, -1, 85, 0),
(2149, 2156, -1, 122, 0),
(2157, 2165, -1, 86, 0),
(2166, 2171, -1, 95, 0),
(2172, 2178, 261, 1, 0),
(2179, 2186, 261, 2, 0),
(2187, 2192, -1, 35, 0),
(2193, 2199, 264, 83, 0),
(2200, 2205, -1, 37, 0),
(2206, 2211, -1, 13, 0),
(2212, 2219, 267, 9, 0),
(2220, 2227, 267, 6, 0),
(2228, 2235, 267, 7, 0),
(2236, 2243, 267, 8, 0),
(2244, 2251, 267, 5, 0),
(2252, 2257, -1, 41, 0),
(2258, 2263, -1, 42, 0),
(2264, 2269, -1, 43, 0),
(2270, 2276, 275, 123, 0),
(2277, 2282, -1, 44, 0),
(2283, 2289, 277, 120, 0),
(2290, 2298, 277, 92, 0),
(2299, 2307, 277, 93, 0),
(2308, 2315, 277, 94, 0),
(2316, 2322, -1, 77, 0),
(2323, 2329, -1, 78, 0),
(2330, 2336, -1, 79, 0),
(2337, 2343, -1, 80, 0),
(2344, 2349, -1, 45, 0),
(2350, 2357, -1, 91, 0),
(2358, 2364, -1, 38, 0),
(2365, 2370, -1, 84, 0),
(2371, 2376, -1, 85, 0),
(2377, 2382, -1, 122, 0),
(2383, 2389, -1, 86, 0),
(2390, 2393, -1, 95, 0),
(2394, 2398, 293, 1, 0),
(2399, 2404, 293, 2, 0),
(2405, 2409, -1, 104, 0),
(2410, 2416, 296, 47, 0),
(2417, 2422, 296, 46, 0),
(2423, 2427, -1, 83, 0),
(2428, 2432, -1, 116, 0),
(2433, 2439, 300, 48, 0),
(2440, 2444, -1, 50, 0),
(2445, 2450, -1, 51, 0),
(2451, 2454, -1, 13, 0),
(2455, 2459, 304, 10, 0),
(2460, 2464, 304, 11, 0),
(2465, 2470, 306, 137, 0),
(2471, 2477, 306, 89, 0),
(2478, 2482, 304, 12, 0),
(2483, 2487, -1, 53, 0),
(2488, 2492, -1, 54, 0),
(2493, 2497, -1, 55, 0),
(2498, 2502, -1, 56, 0),
(2503, 2508, -1, 135, 0),
(2509, 2514, -1, 131, 0),
(2515, 2520, -1, 129, 0),
(2521, 2526, -1, 133, 0),
(2527, 2532, -1, 132, 0),
(2533, 2538, -1, 130, 0),
(2539, 2544, -1, 134, 0),
(2545, 2549, -1, 57, 0),
(2550, 2554, -1, 58, 0),
(2555, 2559, -1, 123, 0),
(2560, 2564, -1, 120, 0),
(2565, 2571, 324, 68, 0),
(2572, 2577, 324, 69, 0),
(2578, 2582, -1, 70, 0),
(2583, 2589, -1, 92, 0),
(2590, 2596, -1, 93, 0),
(2597, 2602, -1, 94, 0),
(2603, 2608, -1, 71, 0),
(2609, 2614, -1, 72, 0),
(2615, 2620, -1, 73, 0),
(2621, 2626, -1, 74, 0),
(2627, 2633, -1, 75, 0),
(2634, 2638, -1, 77, 0),
(2639, 2643, -1, 78, 0),
(2644, 2650, 337, 109, 0),
(2651, 2658, 338, 26, 0),
(2659, 2666, 338, 30, 0),
(2667, 2674, 338, 31, 0),
(2675, 2683, 338, 28, 0),
(2684, 2692, 338, 27, 0),
(2693, 2701, 338, 29, 0),
(2702, 2706, -1, 79, 0),
(2707, 2711, -1, 80, 0),
(2712, 2717, 346, 20, 0),
(2718, 2724, 347, 17, 0),
(2725, 2730, 346, 82, 0),
(2731, 2737, 349, 49, 0),
(2738, 2743, 346, 81, 0),
(2744, 2750, 346, 12, 0),
(2751, 2756, -1, 3, 0),
(2757, 2763, -1, 4, 0),
(2764, 2769, -1, 14, 0),
(2770, 2775, -1, 15, 0),
(2776, 2781, -1, 16, 0),
(2782, 2788, -1, 63, 0),
(2789, 2795, -1, 64, 0),
(2796, 2802, -1, 61, 0),
(2803, 2809, -1, 62, 0),
(2810, 2816, -1, 60, 0),
(2817, 2823, -1, 59, 0),
(2824, 2830, -1, 65, 0),
(2831, 2836, -1, 66, 0),
(2837, 2842, -1, 67, 0),
(2843, 2848, -1, 91, 0),
(2849, 2850, -1, 13, 0),
(2851, 2853, 368, 10, 0),
(2854, 2858, 369, 128, 0),
(2859, 2863, 369, 105, 0),
(2864, 2867, 369, 113, 0),
(2868, 2872, 369, 97, 0),
(2873, 2877, 369, 96, 0),
(2878, 2882, 369, 98, 0),
(2883, 2887, 369, 99, 0),
(2888, 2893, 369, 102, 0),
(2894, 2898, 368, 124, 0),
(2899, 2904, 368, 121, 0),
(2905, 2910, 368, 101, 0),
(2911, 2917, 368, 117, 0),
(2918, 2920, 368, 11, 0),
(2921, 2924, 382, 137, 0),
(2925, 2929, 382, 10, 0),
(2930, 2934, 382, 89, 0),
(2935, 2937, 368, 12, 0),
(2938, 2940, -1, 53, 0),
(2941, 2943, -1, 54, 0),
(2944, 2946, -1, 55, 0),
(2947, 2949, -1, 56, 0),
(2950, 2953, -1, 135, 0),
(2954, 2957, -1, 131, 0),
(2958, 2961, -1, 129, 0),
(2962, 2965, -1, 133, 0),
(2966, 2969, -1, 132, 0),
(2970, 2973, -1, 130, 0),
(2974, 2977, -1, 134, 0),
(2978, 2980, -1, 57, 0),
(2981, 2983, -1, 58, 0),
(2984, 2986, -1, 123, 0),
(2987, 2989, -1, 120, 0),
(2990, 2994, 401, 68, 0),
(2995, 2998, 401, 69, 0),
(2999, 3001, -1, 70, 0),
(3002, 3006, -1, 92, 0),
(3007, 3011, -1, 93, 0),
(3012, 3015, -1, 94, 0),
(3016, 3019, -1, 71, 0),
(3020, 3023, -1, 72, 0),
(3024, 3027, -1, 73, 0),
(3028, 3031, -1, 74, 0),
(3032, 3035, -1, 13, 0),
(3036, 3040, -1, 75, 0),
(3041, 3043, -1, 77, 0),
(3044, 3046, -1, 78, 0),
(3047, 3051, 415, 109, 0),
(3052, 3057, 416, 26, 0),
(3058, 3063, 416, 30, 0),
(3064, 3069, 416, 31, 0),
(3070, 3076, 416, 28, 0),
(3077, 3083, 416, 27, 0),
(3084, 3090, 416, 29, 0),
(3091, 3093, -1, 79, 0),
(3094, 3096, -1, 80, 0),
(3097, 3100, 424, 20, 0),
(3101, 3105, 425, 17, 0),
(3106, 3109, 424, 82, 0),
(3110, 3114, 427, 49, 0),
(3115, 3118, 424, 81, 0),
(3119, 3123, 424, 12, 0),
(3124, 3127, -1, 3, 0),
(3128, 3132, -1, 4, 0),
(3133, 3136, -1, 14, 0),
(3137, 3140, -1, 15, 0),
(3141, 3144, -1, 16, 0),
(3145, 3149, -1, 63, 0),
(3150, 3154, -1, 64, 0),
(3155, 3159, -1, 61, 0),
(3160, 3164, -1, 62, 0),
(3165, 3169, -1, 60, 0),
(3170, 3174, -1, 59, 0),
(3175, 3179, -1, 65, 0),
(3180, 3183, -1, 66, 0),
(3184, 3187, -1, 67, 0),
(3188, 3191, -1, 91, 0),
(3192, 3194, -1, 124, 0),
(3195, 3197, -1, 125, 0),
(3198, 3200, -1, 126, 0),
(3201, 3204, 448, 121, 0),
(3205, 3210, -1, 110, 0),
(3211, 3216, -1, 111, 0),
(3217, 3222, -1, 112, 0),
(3223, 3224, -1, 20, 0),
(3225, 3228, 453, 19, 0),
(3229, 3231, 453, 18, 0),
(3232, 3234, -1, 104, 0),
(3235, 3238, 456, 26, 0),
(3239, 3242, 456, 30, 0),
(3243, 3246, 456, 31, 0),
(3247, 3252, 456, 106, 0),
(3253, 3258, 456, 107, 0),
(3259, 3264, 456, 108, 0),
(3265, 3269, 456, 28, 0),
(3270, 3274, 456, 27, 0),
(3275, 3279, 456, 29, 0),
(3280, 3282, -1, 116, 0),
(3283, 3286, 466, 32, 0),
(3287, 3290, 466, 33, 0),
(3291, 3294, 466, 34, 0),
(3295, 3298, 466, 40, 0),
(3299, 3302, 466, 39, 0),
(3303, 3308, 466, 84, 0),
(3309, 3314, 466, 85, 0),
(3315, 3320, 466, 122, 0),
(3321, 3327, 466, 86, 0),
(3328, 3331, 466, 95, 0),
(3332, 3336, 476, 1, 0),
(3337, 3342, 476, 2, 0),
(3343, 3346, 466, 35, 0),
(3347, 3351, 479, 83, 0),
(3352, 3355, 466, 37, 0),
(3356, 3359, 466, 13, 0),
(3360, 3365, 482, 9, 0),
(3366, 3371, 482, 6, 0),
(3372, 3377, 482, 7, 0),
(3378, 3383, 482, 8, 0),
(3384, 3389, 482, 5, 0),
(3390, 3393, 466, 41, 0),
(3394, 3397, 466, 42, 0),
(3398, 3401, 466, 43, 0),
(3402, 3406, 490, 123, 0),
(3407, 3410, 466, 44, 0),
(3411, 3415, 492, 120, 0),
(3416, 3422, 492, 92, 0),
(3423, 3429, 492, 93, 0),
(3430, 3435, 492, 94, 0),
(3436, 3440, 466, 77, 0),
(3441, 3445, 466, 78, 0),
(3446, 3450, 466, 79, 0),
(3451, 3455, 466, 80, 0),
(3456, 3459, 466, 45, 0),
(3460, 3465, 466, 91, 0),
(3466, 3470, 466, 38, 0),
(3471, 3474, -1, 84, 0),
(3475, 3478, -1, 85, 0),
(3479, 3482, -1, 122, 0),
(3483, 3487, -1, 86, 0),
(3488, 3490, -1, 25, 0),
(3491, 3496, 508, 121, 0),
(3497, 3501, 508, 100, 0),
(3502, 3508, 508, 117, 0),
(3509, 3510, -1, 95, 0),
(3511, 3513, 512, 1, 0),
(3514, 3517, 512, 2, 0),
(3518, 3520, -1, 104, 0),
(3521, 3525, 515, 128, 0),
(3526, 3533, 515, 106, 0),
(3534, 3541, 515, 107, 0),
(3542, 3549, 515, 108, 0),
(3550, 3554, 515, 47, 0),
(3555, 3560, 515, 114, 0),
(3561, 3564, 515, 46, 0),
(3565, 3569, 515, 100, 0),
(3570, 3574, 515, 105, 0),
(3575, 3578, 515, 113, 0),
(3579, 3584, 525, 110, 0),
(3585, 3590, 525, 111, 0),
(3591, 3596, 525, 112, 0),
(3597, 3601, 515, 97, 0),
(3602, 3606, 515, 96, 0),
(3607, 3611, 515, 98, 0),
(3612, 3616, 515, 76, 0),
(3617, 3621, 515, 99, 0),
(3622, 3627, 515, 102, 0),
(3628, 3630, -1, 83, 0),
(3631, 3633, -1, 116, 0),
(3634, 3638, 536, 124, 0),
(3639, 3644, 536, 121, 0),
(3645, 3648, 536, 103, 0),
(3649, 3654, 536, 127, 0),
(3655, 3660, 536, 118, 0),
(3661, 3665, 536, 48, 0),
(3666, 3671, 536, 101, 0),
(3672, 3678, 536, 117, 0),
(3679, 3685, 536, 90, 0),
(3686, 3688, -1, 50, 0),
(3689, 3692, -1, 115, 0),
(3693, 3696, -1, 13, 0),
(3697, 3700, -1, 52, 0),
(3701, 3704, -1, 51, 0),
(3705, 3709, -1, 124, 0),
(3710, 3714, -1, 125, 0),
(3715, 3719, -1, 126, 0),
(3720, 3725, -1, 84, 0),
(3726, 3731, -1, 85, 0),
(3732, 3737, -1, 122, 0),
(3738, 3744, -1, 86, 0),
(3745, 3748, -1, 95, 0),
(3749, 3753, 558, 1, 0),
(3754, 3759, 558, 2, 0),
(3760, 3764, -1, 83, 0),
(3765, 3768, -1, 13, 0),
(3769, 3774, 562, 137, 0),
(3775, 3781, 562, 89, 0),
(3782, 3786, -1, 123, 0),
(3787, 3791, -1, 120, 0),
(3792, 3798, -1, 92, 0),
(3799, 3805, -1, 93, 0),
(3806, 3811, -1, 94, 0),
(3812, 3816, -1, 77, 0),
(3817, 3821, -1, 78, 0),
(3822, 3826, -1, 79, 0),
(3827, 3831, -1, 80, 0),
(3832, 3837, -1, 14, 0),
(3838, 3843, -1, 15, 0),
(3844, 3849, -1, 16, 0),
(3850, 3855, -1, 91, 0),
(3856, 3857, -1, 13, 0),
(3858, 3860, 578, 10, 0),
(3861, 3865, 579, 128, 0),
(3866, 3870, 579, 105, 0),
(3871, 3874, 579, 113, 0),
(3875, 3880, 582, 110, 0),
(3881, 3886, 582, 111, 0),
(3887, 3892, 582, 112, 0),
(3893, 3897, 579, 97, 0),
(3898, 3902, 579, 96, 0),
(3903, 3907, 579, 98, 0),
(3908, 3912, 579, 99, 0),
(3913, 3918, 579, 102, 0),
(3919, 3923, 578, 124, 0),
(3924, 3929, 578, 121, 0),
(3930, 3935, 578, 101, 0),
(3936, 3942, 578, 117, 0),
(3943, 3945, 578, 11, 0),
(3946, 3949, 595, 137, 0),
(3950, 3954, 595, 10, 0),
(3955, 3959, 595, 89, 0),
(3960, 3962, 578, 12, 0),
(3963, 3965, -1, 53, 0),
(3966, 3968, -1, 54, 0),
(3969, 3971, -1, 55, 0),
(3972, 3974, -1, 56, 0),
(3975, 3977, -1, 161, 0),
(3978, 3981, 604, 135, 0),
(3982, 3986, 604, 128, 0),
(3987, 3990, 604, 131, 0),
(3991, 3994, 604, 129, 0),
(3995, 4002, 608, 138, 0),
(4003, 4010, 608, 139, 0),
(4011, 4018, 608, 140, 0),
(4019, 4024, 608, 150, 0),
(4025, 4028, 604, 133, 0),
(4029, 4032, 604, 132, 0),
(4033, 4037, 604, 155, 0),
(4038, 4042, 604, 156, 0),
(4043, 4046, 604, 130, 0),
(4047, 4050, 604, 134, 0),
(4051, 4055, 618, 144, 0),
(4056, 4060, 618, 145, 0),
(4061, 4065, 618, 146, 0),
(4066, 4070, 618, 148, 0),
(4071, 4075, 618, 147, 0),
(4076, 4078, -1, 57, 0),
(4079, 4081, -1, 58, 0),
(4082, 4086, 625, 124, 0),
(4087, 4092, 625, 121, 0),
(4093, 4098, 625, 127, 0),
(4099, 4104, 625, 149, 0),
(4105, 4107, -1, 123, 0),
(4108, 4115, 630, 141, 0),
(4116, 4123, 630, 142, 0),
(4124, 4131, 630, 143, 0),
(4132, 4134, -1, 104, 0),
(4135, 4139, 634, 128, 0),
(4140, 4144, 634, 68, 0),
(4145, 4148, 634, 69, 0),
(4149, 4153, 634, 100, 0),
(4154, 4158, 634, 105, 0),
(4159, 4162, 634, 113, 0),
(4163, 4167, 634, 97, 0),
(4168, 4172, 634, 96, 0),
(4173, 4177, 634, 98, 0),
(4178, 4182, 634, 99, 0),
(4183, 4188, 634, 102, 0),
(4189, 4191, -1, 70, 0),
(4192, 4199, 646, 110, 0),
(4200, 4207, 646, 111, 0),
(4208, 4215, 646, 112, 0),
(4216, 4223, 646, 106, 0),
(4224, 4231, 646, 107, 0),
(4232, 4239, 646, 108, 0),
(4240, 4244, 646, 116, 0),
(4245, 4250, 646, 114, 0),
(4251, 4255, 646, 25, 0),
(4256, 4263, 655, 121, 0),
(4264, 4270, 655, 100, 0),
(4271, 4279, 655, 117, 0),
(4280, 4283, 646, 13, 0),
(4284, 4291, 659, 110, 0),
(4292, 4299, 659, 111, 0),
(4300, 4307, 659, 112, 0),
(4308, 4313, 646, 115, 0),
(4314, 4316, -1, 116, 0),
(4317, 4321, 664, 124, 0),
(4322, 4327, 664, 121, 0),
(4328, 4331, 664, 13, 0),
(4332, 4339, 667, 110, 0),
(4340, 4347, 667, 111, 0),
(4348, 4355, 667, 112, 0),
(4356, 4361, 664, 127, 0),
(4362, 4367, 664, 118, 0),
(4368, 4373, 664, 115, 0),
(4374, 4378, 664, 92, 0),
(4379, 4383, 664, 93, 0),
(4384, 4389, 664, 101, 0),
(4390, 4396, 664, 117, 0),
(4397, 4403, 664, 90, 0),
(4404, 4407, -1, 104, 0),
(4408, 4413, 679, 105, 0),
(4414, 4418, 679, 113, 0),
(4419, 4425, 681, 106, 0),
(4426, 4432, 681, 107, 0),
(4433, 4439, 681, 108, 0),
(4440, 4445, 679, 97, 0),
(4446, 4451, 679, 96, 0),
(4452, 4457, 679, 98, 0),
(4458, 4463, 679, 99, 0),
(4464, 4467, -1, 116, 0),
(4468, 4474, -1, 121, 0),
(4475, 4480, -1, 100, 0),
(4481, 4488, -1, 117, 0),
(4489, 4492, -1, 94, 0),
(4493, 4498, 693, 128, 0),
(4499, 4507, 693, 106, 0),
(4508, 4516, 693, 107, 0),
(4517, 4525, 693, 108, 0),
(4526, 4532, 693, 114, 0),
(4533, 4538, 693, 100, 0),
(4539, 4544, 693, 105, 0),
(4545, 4549, 693, 113, 0),
(4550, 4555, 693, 97, 0),
(4556, 4561, 693, 96, 0),
(4562, 4567, 693, 98, 0),
(4568, 4573, 693, 76, 0),
(4574, 4579, 693, 99, 0),
(4580, 4586, 693, 102, 0),
(4587, 4590, -1, 71, 0),
(4591, 4594, -1, 72, 0),
(4595, 4600, 709, 124, 0),
(4601, 4607, 709, 121, 0),
(4608, 4612, 709, 103, 0),
(4613, 4619, 709, 127, 0),
(4620, 4626, 709, 118, 0),
(4627, 4633, 709, 101, 0),
(4634, 4641, 709, 117, 0),
(4642, 4649, 709, 90, 0),
(4650, 4653, -1, 73, 0),
(4654, 4657, -1, 74, 0),
(4658, 4666, 719, 110, 0),
(4667, 4675, 719, 111, 0),
(4676, 4684, 719, 112, 0),
(4685, 4689, -1, 13, 0),
(4690, 4694, -1, 75, 0),
(4695, 4697, -1, 77, 0),
(4698, 4700, -1, 78, 0),
(4701, 4705, 726, 109, 0),
(4706, 4711, 727, 26, 0),
(4712, 4717, 727, 30, 0),
(4718, 4723, 727, 31, 0),
(4724, 4730, 727, 28, 0),
(4731, 4737, 727, 27, 0),
(4738, 4744, 727, 29, 0),
(4745, 4747, -1, 79, 0),
(4748, 4750, -1, 80, 0),
(4751, 4754, 735, 20, 0),
(4755, 4759, 736, 17, 0),
(4760, 4763, 735, 82, 0),
(4764, 4768, 738, 49, 0),
(4769, 4772, 735, 81, 0),
(4773, 4777, 735, 12, 0),
(4778, 4781, -1, 14, 0),
(4782, 4785, -1, 15, 0),
(4786, 4789, -1, 16, 0),
(4790, 4793, -1, 101, 0),
(4794, 4798, -1, 117, 0),
(4799, 4802, -1, 104, 0),
(4803, 4807, 747, 63, 0),
(4808, 4812, 747, 64, 0),
(4813, 4817, 747, 61, 0),
(4818, 4826, 750, 106, 0),
(4827, 4835, 750, 107, 0),
(4836, 4844, 750, 108, 0),
(4845, 4851, 750, 114, 0),
(4852, 4856, 747, 62, 0),
(4857, 4861, 747, 60, 0),
(4862, 4867, 747, 100, 0),
(4868, 4873, 747, 105, 0),
(4874, 4878, 747, 59, 0),
(4879, 4883, 747, 65, 0),
(4884, 4889, 760, 97, 0),
(4890, 4895, 760, 96, 0),
(4896, 4901, 760, 98, 0),
(4902, 4907, 760, 76, 0),
(4908, 4913, 760, 99, 0),
(4914, 4920, 747, 102, 0),
(4921, 4924, -1, 66, 0),
(4925, 4928, -1, 67, 0),
(4929, 4935, 768, 118, 0),
(4936, 4942, 768, 101, 0),
(4943, 4950, 768, 117, 0),
(4951, 4958, 768, 90, 0),
(4959, 4962, -1, 91, 0),
(4963, 4971, 773, 110, 0),
(4972, 4980, 773, 111, 0),
(4981, 4989, 773, 112, 0),
(4990, 4993, -1, 124, 0),
(4994, 4997, -1, 125, 0),
(4998, 5001, -1, 126, 0),
(5002, 5008, -1, 84, 0),
(5009, 5015, -1, 85, 0),
(5016, 5022, -1, 122, 0),
(5023, 5030, -1, 86, 0),
(5031, 5035, -1, 95, 0),
(5036, 5041, 784, 1, 0),
(5042, 5048, 784, 2, 0),
(5049, 5054, -1, 83, 0),
(5055, 5059, -1, 13, 0),
(5060, 5065, -1, 123, 0),
(5066, 5071, -1, 120, 0),
(5072, 5079, -1, 92, 0),
(5080, 5087, -1, 93, 0),
(5088, 5094, -1, 94, 0),
(5095, 5100, -1, 77, 0),
(5101, 5106, -1, 78, 0),
(5107, 5112, -1, 79, 0),
(5113, 5118, -1, 80, 0),
(5119, 5125, -1, 91, 0),
(5126, 5130, -1, 84, 0),
(5131, 5135, -1, 85, 0),
(5136, 5140, -1, 122, 0),
(5141, 5146, -1, 86, 0),
(5147, 5149, -1, 95, 0),
(5150, 5153, -1, 83, 0),
(5154, 5156, -1, 13, 0),
(5157, 5160, 805, 10, 0),
(5161, 5164, 805, 87, 0),
(5165, 5168, 805, 159, 0),
(5169, 5173, 805, 88, 0),
(5174, 5177, -1, 123, 0),
(5178, 5181, -1, 120, 0),
(5182, 5185, -1, 77, 0),
(5186, 5189, -1, 78, 0),
(5190, 5193, -1, 79, 0),
(5194, 5197, -1, 80, 0),
(5198, 5202, -1, 14, 0),
(5203, 5207, -1, 15, 0),
(5208, 5212, -1, 16, 0),
(5213, 5217, -1, 91, 0),
(5218, 5221, -1, 124, 0),
(5222, 5225, -1, 125, 0),
(5226, 5229, -1, 126, 0),
(5230, 5234, -1, 84, 0),
(5235, 5239, -1, 85, 0),
(5240, 5244, -1, 122, 0),
(5245, 5250, -1, 86, 0),
(5251, 5253, -1, 95, 0),
(5254, 5257, 827, 1, 0),
(5258, 5262, 827, 2, 0),
(5263, 5266, -1, 83, 0),
(5267, 5269, -1, 13, 0),
(5270, 5274, 831, 137, 0),
(5275, 5280, 831, 89, 0),
(5281, 5284, -1, 123, 0),
(5285, 5288, -1, 120, 0),
(5289, 5294, -1, 92, 0),
(5295, 5300, -1, 93, 0),
(5301, 5305, -1, 94, 0),
(5306, 5309, -1, 77, 0),
(5310, 5313, -1, 78, 0),
(5314, 5317, -1, 79, 0),
(5318, 5321, -1, 80, 0),
(5322, 5326, -1, 14, 0),
(5327, 5331, -1, 15, 0),
(5332, 5336, -1, 16, 0),
(5337, 5341, -1, 91, 0),
(5342, 5343, -1, 104, 0),
(5344, 5347, 847, 128, 0),
(5348, 5354, 847, 106, 0),
(5355, 5361, 847, 107, 0),
(5362, 5368, 847, 108, 0),
(5369, 5373, 847, 114, 0),
(5374, 5377, 847, 100, 0),
(5378, 5381, 847, 105, 0),
(5382, 5384, 847, 113, 0),
(5385, 5388, 847, 97, 0),
(5389, 5392, 847, 96, 0),
(5393, 5396, 847, 98, 0),
(5397, 5400, 847, 76, 0),
(5401, 5404, 847, 99, 0),
(5405, 5409, 847, 102, 0),
(5410, 5411, -1, 116, 0),
(5412, 5415, 862, 124, 0),
(5416, 5419, 862, 125, 0),
(5420, 5423, 862, 126, 0),
(5424, 5428, 865, 121, 0),
(5429, 5435, 862, 84, 0),
(5436, 5442, 862, 85, 0),
(5443, 5449, 862, 122, 0),
(5450, 5457, 862, 86, 0),
(5458, 5462, 862, 95, 0),
(5463, 5468, 871, 1, 0),
(5469, 5475, 871, 2, 0),
(5476, 5481, 862, 83, 0),
(5482, 5486, 862, 13, 0),
(5487, 5492, 862, 123, 0),
(5493, 5498, 862, 120, 0),
(5499, 5506, 862, 92, 0),
(5507, 5514, 862, 93, 0),
(5515, 5521, 862, 94, 0),
(5522, 5527, 862, 77, 0),
(5528, 5533, 862, 78, 0),
(5534, 5539, 862, 79, 0),
(5540, 5545, 862, 80, 0),
(5546, 5552, 862, 91, 0),
(5553, 5557, 862, 84, 0),
(5558, 5562, 862, 85, 0),
(5563, 5567, 862, 122, 0),
(5568, 5573, 862, 86, 0),
(5574, 5576, 862, 95, 0),
(5577, 5580, 890, 1, 0),
(5581, 5585, 890, 2, 0),
(5586, 5589, 862, 83, 0),
(5590, 5592, 862, 13, 0),
(5593, 5597, 894, 137, 0),
(5598, 5603, 894, 89, 0),
(5604, 5607, 862, 123, 0),
(5608, 5612, 897, 127, 0),
(5613, 5616, 862, 120, 0),
(5617, 5621, 862, 118, 0),
(5622, 5627, 862, 92, 0),
(5628, 5633, 862, 93, 0),
(5634, 5638, 862, 94, 0),
(5639, 5642, 862, 77, 0),
(5643, 5646, 862, 78, 0),
(5647, 5650, 862, 79, 0),
(5651, 5654, 862, 80, 0),
(5655, 5659, 862, 14, 0),
(5660, 5664, 862, 15, 0),
(5665, 5669, 862, 16, 0),
(5670, 5674, 862, 101, 0),
(5675, 5680, 862, 117, 0),
(5681, 5685, 862, 91, 0),
(5686, 5691, 913, 90, 0),
(5692, 5698, -1, 110, 0),
(5699, 5705, -1, 111, 0),
(5706, 5712, -1, 112, 0),
(5713, 5716, -1, 124, 0),
(5717, 5720, -1, 125, 0),
(5721, 5724, -1, 126, 0),
(5725, 5729, -1, 14, 0),
(5730, 5734, -1, 15, 0),
(5735, 5739, -1, 16, 0),
(5740, 5742, -1, 124, 0),
(5743, 5747, -1, 124, 0),
(5748, 5751, -1, 162, 0),
(5752, 5756, -1, 161, 0),
(5757, 5763, 927, 155, 0),
(5764, 5770, 927, 156, 0),
(5771, 5778, 927, 138, 0),
(5779, 5786, 927, 139, 0),
(5787, 5794, 927, 140, 0),
(5795, 5801, 927, 144, 0),
(5802, 5808, 927, 145, 0),
(5809, 5815, 927, 146, 0),
(5816, 5822, 927, 147, 0),
(5823, 5827, -1, 157, 0),
(5828, 5835, 937, 121, 0),
(5836, 5842, 937, 155, 0),
(5843, 5846, -1, 121, 0),
(5847, 5850, -1, 164, 0),
(5851, 5855, -1, 153, 0),
(5856, 5861, -1, 136, 0),
(5862, 5863, -1, 20, 0),
(5864, 5866, 944, 18, 0),
(5867, 5869, -1, 109, 0),
(5870, 5873, 946, 26, 0),
(5874, 5877, 946, 30, 0),
(5878, 5881, 946, 31, 0),
(5882, 5886, 946, 28, 0),
(5887, 5891, 946, 27, 0),
(5892, 5896, 946, 29, 0),
(5897, 5900, -1, 32, 0),
(5901, 5904, -1, 33, 0),
(5905, 5908, -1, 34, 0),
(5909, 5912, -1, 40, 0),
(5913, 5916, -1, 39, 0),
(5917, 5922, -1, 84, 0),
(5923, 5928, -1, 85, 0),
(5929, 5934, -1, 122, 0),
(5935, 5941, -1, 86, 0),
(5942, 5945, -1, 95, 0),
(5946, 5950, 962, 1, 0),
(5951, 5956, 962, 2, 0),
(5957, 5960, -1, 35, 0),
(5961, 5965, 965, 83, 0),
(5966, 5969, -1, 37, 0),
(5970, 5973, -1, 13, 0),
(5974, 5979, 968, 9, 0),
(5980, 5985, 968, 6, 0),
(5986, 5991, 968, 7, 0),
(5992, 5997, 968, 8, 0),
(5998, 6003, 968, 5, 0),
(6004, 6007, -1, 41, 0),
(6008, 6011, -1, 42, 0),
(6012, 6015, -1, 43, 0),
(6016, 6020, 976, 123, 0),
(6021, 6024, -1, 44, 0),
(6025, 6029, 978, 120, 0),
(6030, 6036, 978, 92, 0),
(6037, 6043, 978, 93, 0),
(6044, 6049, 978, 94, 0),
(6050, 6054, -1, 77, 0),
(6055, 6059, -1, 78, 0),
(6060, 6064, -1, 79, 0),
(6065, 6069, -1, 80, 0),
(6070, 6073, -1, 45, 0),
(6074, 6079, -1, 91, 0),
(6080, 6084, -1, 38, 0),
(6085, 6088, -1, 84, 0),
(6089, 6092, -1, 85, 0),
(6093, 6096, -1, 122, 0),
(6097, 6101, -1, 86, 0),
(6102, 6103, -1, 95, 0),
(6104, 6106, 994, 1, 0),
(6107, 6110, 994, 2, 0),
(6111, 6113, -1, 104, 0),
(6114, 6118, 997, 128, 0),
(6119, 6126, 997, 106, 0),
(6127, 6134, 997, 107, 0),
(6135, 6142, 997, 108, 0),
(6143, 6147, 997, 47, 0),
(6148, 6153, 997, 114, 0),
(6154, 6157, 997, 46, 0),
(6158, 6162, 997, 100, 0),
(6163, 6167, 997, 105, 0),
(6168, 6171, 997, 113, 0),
(6172, 6177, 1007, 110, 0),
(6178, 6183, 1007, 111, 0),
(6184, 6189, 1007, 112, 0),
(6190, 6194, 997, 97, 0),
(6195, 6199, 997, 96, 0),
(6200, 6204, 997, 98, 0),
(6205, 6209, 997, 76, 0),
(6210, 6214, 997, 99, 0),
(6215, 6220, 997, 102, 0),
(6221, 6223, -1, 83, 0),
(6224, 6226, -1, 116, 0),
(6227, 6231, 1018, 124, 0),
(6232, 6237, 1018, 121, 0),
(6238, 6241, 1018, 103, 0),
(6242, 6247, 1018, 127, 0),
(6248, 6253, 1018, 118, 0),
(6254, 6258, 1018, 48, 0),
(6259, 6264, 1018, 101, 0),
(6265, 6271, 1018, 117, 0),
(6272, 6278, 1018, 90, 0),
(6279, 6281, -1, 50, 0),
(6282, 6285, -1, 115, 0),
(6286, 6289, -1, 13, 0),
(6290, 6293, -1, 52, 0),
(6294, 6297, -1, 51, 0),
(6298, 6299, -1, 13, 0),
(6300, 6302, 1033, 10, 0),
(6303, 6307, 1034, 128, 0),
(6308, 6312, 1034, 105, 0),
(6313, 6316, 1034, 113, 0),
(6317, 6321, 1034, 97, 0),
(6322, 6326, 1034, 96, 0),
(6327, 6331, 1034, 98, 0),
(6332, 6336, 1034, 99, 0),
(6337, 6342, 1034, 102, 0),
(6343, 6347, 1033, 124, 0),
(6348, 6353, 1033, 121, 0),
(6354, 6359, 1033, 101, 0),
(6360, 6366, 1033, 117, 0),
(6367, 6369, 1033, 11, 0),
(6370, 6373, 1047, 137, 0),
(6374, 6378, 1047, 89, 0),
(6379, 6381, 1033, 12, 0),
(6382, 6384, -1, 53, 0),
(6385, 6387, -1, 54, 0),
(6388, 6390, -1, 55, 0),
(6391, 6393, -1, 56, 0),
(6394, 6397, -1, 135, 0),
(6398, 6401, -1, 131, 0),
(6402, 6405, -1, 129, 0),
(6406, 6409, -1, 133, 0),
(6410, 6413, -1, 132, 0),
(6414, 6417, -1, 130, 0),
(6418, 6421, -1, 134, 0),
(6422, 6424, -1, 152, 0),
(6425, 6427, -1, 154, 0),
(6428, 6430, -1, 123, 0),
(6431, 6434, -1, 161, 0),
(6435, 6440, 1065, 128, 0),
(6441, 6446, 1065, 155, 0),
(6447, 6451, 1065, 160, 0),
(6452, 6457, 1068, 153, 0),
(6458, 6464, 1068, 141, 0),
(6465, 6471, 1068, 142, 0),
(6472, 6478, 1068, 143, 0),
(6479, 6482, -1, 162, 0),
(6483, 6487, 1073, 158, 0),
(6488, 6494, 1073, 127, 0),
(6495, 6499, -1, 164, 0),
(6500, 6502, -1, 104, 0),
(6503, 6507, 1077, 128, 0),
(6508, 6515, 1077, 106, 0),
(6516, 6523, 1077, 107, 0),
(6524, 6531, 1077, 108, 0),
(6532, 6537, 1077, 114, 0),
(6538, 6542, 1077, 68, 0),
(6543, 6546, 1077, 69, 0),
(6547, 6551, 1077, 100, 0),
(6552, 6556, 1077, 105, 0),
(6557, 6560, 1077, 113, 0),
(6561, 6566, 1087, 110, 0),
(6567, 6572, 1087, 111, 0),
(6573, 6578, 1087, 112, 0),
(6579, 6583, 1077, 97, 0),
(6584, 6588, 1077, 96, 0),
(6589, 6593, 1077, 98, 0),
(6594, 6598, 1077, 76, 0),
(6599, 6603, 1077, 99, 0),
(6604, 6609, 1077, 102, 0),
(6610, 6612, -1, 70, 0),
(6613, 6615, -1, 116, 0),
(6616, 6620, 1098, 124, 0),
(6621, 6626, 1098, 121, 0),
(6627, 6630, 1098, 103, 0),
(6631, 6636, 1098, 127, 0),
(6637, 6642, 1098, 118, 0),
(6643, 6647, 1098, 92, 0),
(6648, 6652, 1098, 93, 0),
(6653, 6658, 1098, 101, 0),
(6659, 6665, 1098, 117, 0),
(6666, 6672, 1098, 90, 0),
(6673, 6676, -1, 94, 0),
(6677, 6680, -1, 71, 0),
(6681, 6684, -1, 72, 0),
(6685, 6688, -1, 73, 0),
(6689, 6692, -1, 74, 0),
(6693, 6696, -1, 13, 0),
(6697, 6699, -1, 77, 0),
(6700, 6702, -1, 78, 0),
(6703, 6707, 1116, 109, 0),
(6708, 6713, 1117, 26, 0),
(6714, 6719, 1117, 30, 0),
(6720, 6725, 1117, 31, 0),
(6726, 6732, 1117, 28, 0),
(6733, 6739, 1117, 27, 0),
(6740, 6746, 1117, 29, 0),
(6747, 6749, -1, 79, 0),
(6750, 6752, -1, 80, 0),
(6753, 6756, 1125, 20, 0),
(6757, 6761, 1126, 17, 0),
(6762, 6765, 1125, 82, 0),
(6766, 6770, 1128, 49, 0),
(6771, 6774, 1125, 81, 0),
(6775, 6779, 1125, 12, 0),
(6780, 6784, -1, 116, 0),
(6785, 6791, -1, 101, 0),
(6792, 6797, -1, 104, 0),
(6798, 6805, 1134, 100, 0),
(6806, 6813, 1134, 105, 0),
(6814, 6822, 1134, 106, 0),
(6823, 6831, 1134, 107, 0),
(6832, 6840, 1134, 108, 0),
(6841, 6848, 1134, 97, 0),
(6849, 6856, 1134, 96, 0),
(6857, 6864, 1134, 98, 0),
(6865, 6872, 1134, 99, 0),
(6873, 6878, -1, 25, 0),
(6879, 6886, 1144, 100, 0),
(6887, 6896, 1144, 117, 0),
(6897, 6901, -1, 13, 0),
(6902, 6907, -1, 70, 0),
(6908, 6914, -1, 115, 0),
(6915, 6918, -1, 101, 0),
(6919, 6923, -1, 117, 0),
(6924, 6928, -1, 63, 0),
(6929, 6933, -1, 64, 0),
(6934, 6938, -1, 61, 0),
(6939, 6943, -1, 62, 0),
(6944, 6948, -1, 60, 0),
(6949, 6953, -1, 59, 0),
(6954, 6958, -1, 65, 0),
(6959, 6962, -1, 66, 0),
(6963, 6966, -1, 67, 0),
(6967, 6970, -1, 91, 0),
(6971, 6975, -1, 104, 0),
(6976, 6982, 1162, 100, 0),
(6983, 6988, 1162, 113, 0),
(6989, 6995, 1164, 70, 0),
(6996, 7003, 1164, 110, 0),
(7004, 7011, 1164, 111, 0),
(7012, 7019, 1164, 112, 0),
(7020, 7027, 1162, 102, 0),
(7028, 7032, -1, 116, 0),
(7033, 7038, 1170, 103, 0),
(7039, 7047, 1170, 90, 0),
(7048, 7053, -1, 13, 0),
(7054, 7055, -1, 104, 0),
(7056, 7059, 1174, 105, 0),
(7060, 7062, 1174, 113, 0),
(7063, 7066, 1174, 97, 0),
(7067, 7070, 1174, 96, 0),
(7071, 7074, 1174, 98, 0),
(7075, 7078, 1174, 99, 0),
(7079, 7080, -1, 116, 0),
(7081, 7084, -1, 124, 0),
(7085, 7088, -1, 125, 0),
(7089, 7092, -1, 126, 0),
(7093, 7099, -1, 84, 0),
(7100, 7106, -1, 85, 0),
(7107, 7113, -1, 122, 0),
(7114, 7121, -1, 86, 0),
(7122, 7126, -1, 95, 0),
(7127, 7132, 1189, 1, 0),
(7133, 7139, 1189, 2, 0),
(7140, 7145, -1, 83, 0),
(7146, 7150, -1, 13, 0),
(7151, 7156, -1, 123, 0),
(7157, 7164, -1, 92, 0),
(7165, 7172, -1, 93, 0),
(7173, 7179, -1, 94, 0),
(7180, 7185, -1, 77, 0),
(7186, 7191, -1, 78, 0),
(7192, 7197, -1, 79, 0),
(7198, 7203, -1, 80, 0),
(7204, 7210, -1, 91, 0),
(7211, 7215, -1, 84, 0),
(7216, 7220, -1, 85, 0),
(7221, 7225, -1, 122, 0),
(7226, 7231, -1, 86, 0),
(7232, 7234, -1, 95, 0),
(7235, 7238, 1207, 1, 0),
(7239, 7243, 1207, 2, 0),
(7244, 7247, -1, 104, 0),
(7248, 7251, -1, 83, 0),
(7252, 7254, -1, 13, 0),
(7255, 7259, 1212, 137, 0),
(7260, 7265, 1212, 89, 0),
(7266, 7269, -1, 123, 0),
(7270, 7273, -1, 120, 0),
(7274, 7279, -1, 92, 0),
(7280, 7285, -1, 93, 0),
(7286, 7290, -1, 94, 0),
(7291, 7294, -1, 77, 0),
(7295, 7298, -1, 78, 0),
(7299, 7302, -1, 79, 0),
(7303, 7306, -1, 80, 0),
(7307, 7311, -1, 14, 0),
(7312, 7316, -1, 15, 0),
(7317, 7321, -1, 16, 0),
(7322, 7326, -1, 91, 0),
(7327, 7331, -1, 121, 0),
(7332, 7335, -1, 100, 0),
(7336, 7341, -1, 117, 0),
(7342, 7343, -1, 104, 0),
(7344, 7347, 1231, 100, 0),
(7348, 7351, 1231, 105, 0),
(7352, 7353, -1, 119, 0),
(7354, 7355, -1, 116, 0),
(7356, 7357, -1, 104, 0),
(7358, 7361, 1236, 128, 0),
(7362, 7365, 1236, 100, 0),
(7366, 7369, 1236, 105, 0),
(7370, 7372, 1236, 113, 0),
(7373, 7376, 1236, 97, 0),
(7377, 7380, 1236, 96, 0),
(7381, 7384, 1236, 98, 0),
(7385, 7388, 1236, 99, 0),
(7389, 7393, 1236, 102, 0),
(7394, 7395, -1, 119, 0),
(7396, 7399, 1246, 124, 0),
(7400, 7403, 1246, 125, 0),
(7404, 7407, 1246, 126, 0),
(7408, 7414, 1246, 110, 0),
(7415, 7421, 1246, 111, 0),
(7422, 7428, 1246, 112, 0),
(7429, 7432, 1246, 104, 0),
(7433, 7437, 1253, 26, 0),
(7438, 7442, 1253, 30, 0),
(7443, 7447, 1253, 31, 0),
(7448, 7454, 1253, 106, 0),
(7455, 7461, 1253, 107, 0),
(7462, 7468, 1253, 108, 0),
(7469, 7474, 1253, 28, 0),
(7475, 7480, 1253, 27, 0),
(7481, 7486, 1253, 29, 0),
(7487, 7490, 1246, 116, 0),
(7491, 7497, 1263, 84, 0),
(7498, 7504, 1263, 85, 0),
(7505, 7511, 1263, 123, 0),
(7512, 7519, 1263, 86, 0),
(7520, 7524, 1263, 95, 0),
(7525, 7530, 1268, 1, 0),
(7531, 7537, 1268, 2, 0),
(7538, 7542, 1263, 24, 0),
(7543, 7548, 1271, 83, 0),
(7549, 7553, 1263, 13, 0),
(7554, 7560, 1263, 21, 0),
(7561, 7565, 1263, 23, 0),
(7566, 7571, 1275, 123, 0),
(7572, 7577, 1263, 120, 0),
(7578, 7585, 1263, 92, 0),
(7586, 7593, 1263, 93, 0),
(7594, 7599, 1263, 22, 0),
(7600, 7606, 1263, 94, 0),
(7607, 7612, 1263, 77, 0),
(7613, 7618, 1263, 78, 0),
(7619, 7624, 1263, 79, 0),
(7625, 7630, 1263, 80, 0),
(7631, 7637, 1263, 91, 0),
(7638, 7642, 1246, 84, 0),
(7643, 7647, 1246, 85, 0),
(7648, 7652, 1246, 114, 0),
(7653, 7657, 1246, 122, 0),
(7658, 7663, 1246, 86, 0),
(7664, 7667, 1246, 25, 0),
(7668, 7674, 1292, 121, 0),
(7675, 7680, 1292, 100, 0),
(7681, 7688, 1292, 117, 0),
(7689, 7691, 1246, 95, 0),
(7692, 7695, 1296, 1, 0),
(7696, 7700, 1296, 2, 0),
(7701, 7704, 1246, 83, 0),
(7705, 7707, 1246, 13, 0),
(7708, 7711, 1300, 10, 0),
(7712, 7718, 1301, 110, 0),
(7719, 7725, 1301, 111, 0),
(7726, 7732, 1301, 112, 0),
(7733, 7736, 1300, 87, 0),
(7737, 7740, 1300, 159, 0),
(7741, 7745, 1300, 88, 0),
(7746, 7750, 1246, 135, 0),
(7751, 7755, 1246, 131, 0),
(7756, 7760, 1246, 129, 0),
(7761, 7765, 1246, 133, 0),
(7766, 7770, 1246, 132, 0),
(7771, 7775, 1246, 130, 0),
(7776, 7780, 1246, 134, 0),
(7781, 7784, 1246, 152, 0),
(7785, 7788, 1246, 154, 0),
(7789, 7792, 1246, 123, 0),
(7793, 7796, 1246, 120, 0),
(7797, 7800, 1246, 70, 0),
(7801, 7806, 1246, 92, 0),
(7807, 7812, 1246, 93, 0),
(7813, 7817, 1246, 94, 0),
(7818, 7822, 1246, 151, 0),
(7823, 7828, 1246, 75, 0),
(7829, 7832, 1246, 77, 0),
(7833, 7836, 1246, 78, 0),
(7837, 7840, 1246, 79, 0),
(7841, 7845, 1246, 14, 0),
(7846, 7850, 1246, 15, 0),
(7851, 7855, 1246, 16, 0),
(7856, 7861, 1246, 63, 0),
(7862, 7867, 1246, 64, 0),
(7868, 7873, 1246, 61, 0),
(7874, 7879, 1246, 62, 0),
(7880, 7885, 1246, 60, 0),
(7886, 7891, 1246, 59, 0),
(7892, 7897, 1246, 65, 0),
(7898, 7902, 1246, 66, 0),
(7903, 7907, 1246, 67, 0),
(7908, 7912, 1246, 91, 0),
(7913, 7914, -1, 116, 0),
(7915, 7918, 1341, 124, 0),
(7919, 7922, 1341, 125, 0),
(7923, 7926, 1341, 126, 0),
(7927, 7931, 1344, 121, 0),
(7932, 7938, 1341, 84, 0),
(7939, 7945, 1341, 85, 0),
(7946, 7952, 1341, 122, 0),
(7953, 7960, 1341, 86, 0),
(7961, 7965, 1341, 95, 0),
(7966, 7971, 1350, 1, 0),
(7972, 7978, 1350, 2, 0),
(7979, 7984, 1341, 83, 0),
(7985, 7989, 1341, 13, 0),
(7990, 7995, 1341, 123, 0),
(7996, 8001, 1341, 120, 0),
(8002, 8009, 1341, 92, 0),
(8010, 8017, 1341, 93, 0),
(8018, 8024, 1341, 94, 0),
(8025, 8030, 1341, 77, 0),
(8031, 8036, 1341, 78, 0),
(8037, 8042, 1341, 79, 0),
(8043, 8048, 1341, 80, 0),
(8049, 8055, 1341, 91, 0),
(8056, 8060, 1341, 84, 0),
(8061, 8065, 1341, 85, 0),
(8066, 8070, 1341, 122, 0),
(8071, 8076, 1341, 86, 0),
(8077, 8079, 1341, 95, 0),
(8080, 8083, 1369, 1, 0),
(8084, 8088, 1369, 2, 0),
(8089, 8092, 1341, 83, 0),
(8093, 8095, 1341, 13, 0),
(8096, 8100, 1373, 137, 0),
(8101, 8106, 1373, 89, 0),
(8107, 8110, 1341, 123, 0),
(8111, 8115, 1376, 127, 0),
(8116, 8119, 1341, 120, 0),
(8120, 8124, 1341, 118, 0),
(8125, 8130, 1341, 92, 0),
(8131, 8136, 1341, 93, 0),
(8137, 8141, 1341, 94, 0),
(8142, 8145, 1341, 77, 0),
(8146, 8149, 1341, 78, 0),
(8150, 8153, 1341, 79, 0),
(8154, 8157, 1341, 80, 0),
(8158, 8162, 1341, 14, 0),
(8163, 8167, 1341, 15, 0),
(8168, 8172, 1341, 16, 0),
(8173, 8177, 1341, 101, 0),
(8178, 8183, 1341, 117, 0),
(8184, 8188, 1341, 91, 0),
(8189, 8194, 1392, 90, 0),
(8195, 8198, -1, 124, 0),
(8199, 8202, -1, 125, 0),
(8203, 8206, -1, 126, 0),
(8207, 8209, -1, 20, 0),
(8210, 8214, 1397, 19, 0),
(8215, 8218, 1397, 18, 0),
(8219, 8223, -1, 32, 0),
(8224, 8228, -1, 33, 0),
(8229, 8233, -1, 34, 0),
(8234, 8238, -1, 40, 0),
(8239, 8243, -1, 39, 0),
(8244, 8248, -1, 35, 0),
(8249, 8253, -1, 37, 0),
(8254, 8258, -1, 36, 0),
(8259, 8265, 1407, 9, 0),
(8266, 8272, 1407, 6, 0),
(8273, 8279, 1407, 7, 0),
(8280, 8286, 1407, 8, 0),
(8287, 8293, 1407, 5, 0),
(8294, 8298, -1, 41, 0),
(8299, 8303, -1, 42, 0),
(8304, 8308, -1, 43, 0),
(8309, 8313, -1, 44, 0),
(8314, 8318, -1, 45, 0),
(8319, 8324, -1, 38, 0),
(8325, 8329, -1, 84, 0),
(8330, 8334, -1, 85, 0),
(8335, 8339, -1, 122, 0),
(8340, 8345, -1, 86, 0),
(8346, 8348, -1, 95, 0),
(8349, 8352, 1423, 1, 0),
(8353, 8357, 1423, 2, 0),
(8358, 8361, -1, 104, 0),
(8362, 8367, 1426, 47, 0),
(8368, 8372, 1426, 46, 0),
(8373, 8376, -1, 83, 0),
(8377, 8380, -1, 116, 0),
(8381, 8386, 1430, 48, 0),
(8387, 8390, -1, 50, 0),
(8391, 8395, -1, 52, 0),
(8396, 8400, -1, 51, 0),
(8401, 8403, -1, 13, 0),
(8404, 8407, 1435, 10, 0),
(8408, 8411, 1435, 11, 0),
(8412, 8416, 1437, 137, 0),
(8417, 8422, 1437, 10, 0),
(8423, 8428, 1437, 89, 0),
(8429, 8432, 1435, 12, 0),
(8433, 8436, -1, 53, 0),
(8437, 8440, -1, 54, 0),
(8441, 8444, -1, 55, 0),
(8445, 8448, -1, 56, 0),
(8449, 8453, -1, 135, 0),
(8454, 8458, -1, 131, 0),
(8459, 8463, -1, 129, 0),
(8464, 8468, -1, 133, 0),
(8469, 8473, -1, 132, 0),
(8474, 8478, -1, 130, 0),
(8479, 8483, -1, 134, 0),
(8484, 8487, -1, 57, 0),
(8488, 8491, -1, 58, 0),
(8492, 8495, -1, 123, 0),
(8496, 8499, -1, 120, 0),
(8500, 8505, 1456, 68, 0),
(8506, 8510, 1456, 69, 0),
(8511, 8514, -1, 70, 0),
(8515, 8520, -1, 92, 0),
(8521, 8526, -1, 93, 0),
(8527, 8531, -1, 94, 0),
(8532, 8536, -1, 71, 0),
(8537, 8541, -1, 72, 0),
(8542, 8546, -1, 73, 0),
(8547, 8551, -1, 74, 0),
(8552, 8555, -1, 77, 0),
(8556, 8559, -1, 78, 0),
(8560, 8563, -1, 79, 0),
(8564, 8567, -1, 80, 0),
(8568, 8572, 1470, 82, 0),
(8573, 8577, 1470, 81, 0),
(8578, 8582, -1, 3, 0),
(8583, 8588, -1, 4, 0),
(8589, 8593, -1, 14, 0),
(8594, 8598, -1, 15, 0),
(8599, 8603, -1, 16, 0),
(8604, 8609, -1, 63, 0),
(8610, 8615, -1, 64, 0),
(8616, 8621, -1, 61, 0),
(8622, 8627, -1, 62, 0),
(8628, 8633, -1, 60, 0),
(8634, 8639, -1, 59, 0),
(8640, 8645, -1, 65, 0),
(8646, 8650, -1, 66, 0),
(8651, 8655, -1, 67, 0),
(8656, 8660, -1, 91, 0),
(8661, 8662, -1, 104, 0),
(8663, 8666, 1488, 128, 0),
(8667, 8670, 1488, 100, 0),
(8671, 8674, 1488, 105, 0),
(8675, 8677, 1488, 113, 0),
(8678, 8681, 1488, 97, 0),
(8682, 8685, 1488, 96, 0),
(8686, 8689, 1488, 98, 0),
(8690, 8693, 1488, 99, 0),
(8694, 8698, 1488, 102, 0),
(8699, 8702, -1, 124, 0),
(8703, 8707, -1, 121, 0),
(8708, 8712, -1, 101, 0),
(8713, 8718, -1, 117, 0),
(8719, 8722, -1, 10, 0),
(8723, 8724, -1, 104, 0),
(8725, 8728, 1503, 128, 0),
(8729, 8735, 1503, 106, 0),
(8736, 8742, 1503, 107, 0),
(8743, 8749, 1503, 108, 0),
(8750, 8754, 1503, 114, 0),
(8755, 8758, 1503, 100, 0),
(8759, 8762, 1503, 105, 0),
(8763, 8765, 1503, 113, 0),
(8766, 8770, 1511, 110, 0),
(8771, 8775, 1511, 111, 0),
(8776, 8780, 1511, 112, 0),
(8781, 8784, 1503, 97, 0),
(8785, 8788, 1503, 96, 0),
(8789, 8792, 1503, 98, 0),
(8793, 8796, 1503, 76, 0),
(8797, 8800, 1503, 99, 0),
(8801, 8805, 1503, 102, 0),
(8806, 8807, -1, 20, 0),
(8808, 8810, 1521, 18, 0),
(8811, 8812, -1, 116, 0),
(8813, 8816, 1523, 124, 0),
(8817, 8821, 1523, 121, 0),
(8822, 8824, 1523, 24, 0),
(8825, 8827, 1523, 103, 0),
(8828, 8832, 1523, 21, 0),
(8833, 8835, 1523, 23, 0),
(8836, 8840, 1529, 127, 0),
(8841, 8845, 1523, 118, 0),
(8846, 8849, 1523, 22, 0),
(8850, 8854, 1523, 101, 0),
(8855, 8860, 1523, 117, 0),
(8861, 8866, 1523, 90, 0),
(8867, 8870, -1, 32, 0),
(8871, 8874, -1, 33, 0),
(8875, 8878, -1, 34, 0),
(8879, 8882, -1, 40, 0),
(8883, 8886, -1, 39, 0),
(8887, 8890, -1, 35, 0),
(8891, 8894, -1, 37, 0),
(8895, 8898, -1, 36, 0),
(8899, 8902, -1, 41, 0),
(8903, 8906, -1, 42, 0),
(8907, 8910, -1, 43, 0),
(8911, 8914, -1, 44, 0),
(8915, 8918, -1, 45, 0),
(8919, 8923, -1, 38, 0),
(8924, 8927, -1, 84, 0),
(8928, 8931, -1, 85, 0),
(8932, 8935, -1, 122, 0),
(8936, 8940, -1, 86, 0),
(8941, 8942, -1, 95, 0),
(8943, 8945, 1554, 1, 0),
(8946, 8949, 1554, 2, 0),
(8950, 8952, -1, 104, 0),
(8953, 8957, 1557, 128, 0),
(8958, 8965, 1557, 106, 0),
(8966, 8973, 1557, 107, 0),
(8974, 8981, 1557, 108, 0),
(8982, 8986, 1557, 47, 0),
(8987, 8992, 1557, 114, 0),
(8993, 8996, 1557, 46, 0),
(8997, 9001, 1557, 100, 0),
(9002, 9006, 1557, 105, 0),
(9007, 9010, 1557, 113, 0),
(9011, 9016, 1567, 110, 0),
(9017, 9022, 1567, 111, 0),
(9023, 9028, 1567, 112, 0),
(9029, 9033, 1557, 97, 0),
(9034, 9038, 1557, 96, 0),
(9039, 9043, 1557, 98, 0),
(9044, 9048, 1557, 76, 0),
(9049, 9053, 1557, 99, 0),
(9054, 9059, 1557, 102, 0),
(9060, 9062, -1, 83, 0),
(9063, 9065, -1, 116, 0),
(9066, 9070, 1578, 124, 0),
(9071, 9076, 1578, 121, 0),
(9077, 9080, 1578, 103, 0),
(9081, 9086, 1578, 127, 0),
(9087, 9092, 1578, 118, 0),
(9093, 9098, 1578, 101, 0),
(9099, 9105, 1578, 117, 0),
(9106, 9112, 1578, 90, 0),
(9113, 9116, -1, 115, 0),
(9117, 9120, -1, 13, 0),
(9121, 9123, -1, 104, 0),
(9124, 9128, 1589, 128, 0),
(9129, 9132, 1589, 52, 0),
(9133, 9137, 1591, 100, 0),
(9138, 9142, 1591, 105, 0),
(9143, 9146, 1589, 113, 0),
(9147, 9151, 1589, 97, 0),
(9152, 9156, 1589, 96, 0),
(9157, 9161, 1589, 98, 0),
(9162, 9166, 1589, 99, 0),
(9167, 9172, 1589, 102, 0),
(9173, 9175, -1, 119, 0),
(9176, 9183, 1600, 110, 0),
(9184, 9191, 1600, 111, 0),
(9192, 9199, 1600, 112, 0),
(9200, 9207, 1600, 106, 0),
(9208, 9215, 1600, 107, 0),
(9216, 9223, 1600, 108, 0),
(9224, 9228, 1600, 116, 0),
(9229, 9234, 1600, 114, 0),
(9235, 9239, 1600, 25, 0),
(9240, 9247, 1609, 121, 0),
(9248, 9254, 1609, 100, 0),
(9255, 9263, 1609, 117, 0),
(9264, 9267, 1600, 51, 0),
(9268, 9271, 1600, 13, 0),
(9272, 9279, 1614, 110, 0),
(9280, 9287, 1614, 111, 0),
(9288, 9295, 1614, 112, 0),
(9296, 9300, 1600, 70, 0),
(9301, 9306, 1600, 115, 0),
(9307, 9309, -1, 116, 0),
(9310, 9314, 1620, 124, 0),
(9315, 9320, 1620, 121, 0),
(9321, 9324, 1620, 13, 0),
(9325, 9332, 1623, 110, 0),
(9333, 9340, 1623, 111, 0),
(9341, 9348, 1623, 112, 0),
(9349, 9354, 1620, 127, 0),
(9355, 9359, 1620, 70, 0),
(9360, 9365, 1628, 118, 0),
(9366, 9371, 1620, 115, 0),
(9372, 9377, 1620, 101, 0),
(9378, 9384, 1620, 117, 0),
(9385, 9391, 1620, 90, 0),
(9392, 9395, -1, 104, 0),
(9396, 9401, 1634, 105, 0),
(9402, 9406, 1634, 113, 0),
(9407, 9413, 1636, 106, 0),
(9414, 9420, 1636, 107, 0),
(9421, 9427, 1636, 108, 0),
(9428, 9433, 1634, 97, 0),
(9434, 9439, 1634, 96, 0),
(9440, 9445, 1634, 98, 0),
(9446, 9451, 1634, 99, 0),
(9452, 9455, -1, 116, 0),
(9456, 9459, -1, 25, 0),
(9460, 9466, 1645, 121, 0),
(9467, 9472, 1645, 100, 0),
(9473, 9480, 1645, 117, 0),
(9481, 9484, -1, 104, 0),
(9485, 9490, 1649, 128, 0),
(9491, 9499, 1649, 106, 0),
(9500, 9508, 1649, 107, 0),
(9509, 9517, 1649, 108, 0),
(9518, 9524, 1649, 114, 0),
(9525, 9530, 1649, 100, 0),
(9531, 9536, 1649, 105, 0),
(9537, 9541, 1649, 113, 0),
(9542, 9547, 1649, 97, 0),
(9548, 9553, 1649, 96, 0),
(9554, 9559, 1649, 98, 0),
(9560, 9565, 1649, 76, 0),
(9566, 9571, 1649, 99, 0),
(9572, 9578, 1649, 102, 0),
(9579, 9582, -1, 116, 0),
(9583, 9588, 1664, 124, 0),
(9589, 9595, 1664, 121, 0),
(9596, 9600, 1664, 103, 0),
(9601, 9607, 1664, 127, 0),
(9608, 9614, 1664, 118, 0),
(9615, 9621, 1664, 101, 0),
(9622, 9629, 1664, 117, 0),
(9630, 9637, 1664, 90, 0),
(9638, 9646, -1, 110, 0),
(9647, 9655, -1, 111, 0),
(9656, 9664, -1, 112, 0),
(9665, 9669, -1, 13, 0),
(9670, 9671, -1, 13, 0),
(9672, 9674, 1677, 104, 0),
(9675, 9679, 1678, 128, 0),
(9680, 9684, 1678, 105, 0),
(9685, 9688, 1678, 113, 0),
(9689, 9693, 1678, 97, 0),
(9694, 9698, 1678, 96, 0),
(9699, 9703, 1678, 98, 0),
(9704, 9708, 1678, 99, 0),
(9709, 9714, 1678, 102, 0),
(9715, 9719, 1677, 124, 0),
(9720, 9725, 1677, 121, 0),
(9726, 9731, 1677, 101, 0),
(9732, 9738, 1677, 117, 0),
(9739, 9741, 1677, 11, 0),
(9742, 9745, 1691, 137, 0),
(9746, 9750, 1691, 89, 0),
(9751, 9753, -1, 120, 0),
(9754, 9758, 1694, 68, 0),
(9759, 9762, 1694, 69, 0),
(9763, 9765, -1, 70, 0),
(9766, 9770, -1, 92, 0),
(9771, 9775, -1, 93, 0),
(9776, 9779, -1, 94, 0),
(9780, 9783, -1, 71, 0),
(9784, 9787, -1, 72, 0),
(9788, 9791, -1, 73, 0),
(9792, 9795, -1, 74, 0),
(9796, 9799, -1, 13, 0),
(9800, 9802, -1, 13, 0),
(9803, 9805, -1, 77, 0),
(9806, 9808, -1, 78, 0),
(9809, 9811, -1, 79, 0),
(9812, 9814, -1, 80, 0),
(9815, 9818, -1, 3, 0),
(9819, 9823, -1, 4, 0),
(9824, 9825, -1, 161, 0),
(9826, 9829, 1713, 128, 0),
(9830, 9833, 1713, 155, 0),
(9834, 9837, 1713, 156, 0),
(9838, 9840, 1713, 160, 0),
(9841, 9844, 1713, 144, 0),
(9845, 9848, 1713, 145, 0),
(9849, 9852, 1713, 146, 0),
(9853, 9856, 1713, 147, 0),
(9857, 9858, -1, 163, 0),
(9859, 9865, 1722, 141, 0),
(9866, 9872, 1722, 142, 0),
(9873, 9879, 1722, 143, 0),
(9880, 9886, 1722, 138, 0),
(9887, 9893, 1722, 139, 0),
(9894, 9900, 1722, 140, 0),
(9901, 9904, 1722, 162, 0),
(9905, 9909, 1722, 150, 0),
(9910, 9913, 1722, 157, 0),
(9914, 9920, 1731, 121, 0),
(9921, 9926, 1731, 155, 0),
(9927, 9929, 1722, 164, 0),
(9930, 9936, 1734, 141, 0),
(9937, 9943, 1734, 142, 0),
(9944, 9950, 1734, 143, 0),
(9951, 9954, 1722, 153, 0),
(9955, 9959, 1722, 136, 0),
(9960, 9961, -1, 162, 0),
(9962, 9965, 1740, 124, 0),
(9966, 9970, 1740, 121, 0),
(9971, 9973, 1740, 158, 0),
(9974, 9978, 1740, 127, 0),
(9979, 9983, 1740, 149, 0),
(9984, 9985, -1, 104, 0),
(9986, 9989, 1746, 128, 0),
(9990, 9996, 1746, 106, 0),
(9997, 10003, 1746, 107, 0),
(10004, 10010, 1746, 108, 0),
(10011, 10015, 1746, 114, 0),
(10016, 10019, 1746, 100, 0),
(10020, 10023, 1746, 105, 0),
(10024, 10026, 1746, 113, 0),
(10027, 10031, 1754, 110, 0),
(10032, 10036, 1754, 111, 0),
(10037, 10041, 1754, 112, 0),
(10042, 10045, 1746, 97, 0),
(10046, 10049, 1746, 96, 0),
(10050, 10053, 1746, 98, 0),
(10054, 10059, 1760, 100, 0),
(10060, 10063, 1746, 76, 0),
(10064, 10067, 1746, 99, 0),
(10068, 10072, 1746, 102, 0),
(10073, 10074, -1, 116, 0),
(10075, 10078, 1765, 124, 0),
(10079, 10083, 1765, 121, 0),
(10084, 10088, 1765, 127, 0),
(10089, 10093, 1765, 118, 0),
(10094, 10098, 1765, 101, 0),
(10099, 10104, 1765, 117, 0),
(10105, 10110, 1765, 90, 0),
(10111, 10113, -1, 13, 0),
(10114, 10119, -1, 110, 0),
(10120, 10125, -1, 111, 0),
(10126, 10131, -1, 112, 0),
(10132, 10133, -1, 20, 0),
(10134, 10137, 1777, 19, 0),
(10138, 10140, 1777, 18, 0),
(10141, 10143, -1, 104, 0),
(10144, 10148, 1780, 128, 0),
(10149, 10156, 1780, 106, 0),
(10157, 10164, 1780, 107, 0),
(10165, 10172, 1780, 108, 0),
(10173, 10178, 1780, 114, 0),
(10179, 10183, 1780, 100, 0),
(10184, 10188, 1780, 105, 0),
(10189, 10193, 1780, 97, 0),
(10194, 10198, 1780, 96, 0),
(10199, 10203, 1780, 98, 0),
(10204, 10208, 1780, 76, 0),
(10209, 10213, 1780, 99, 0),
(10214, 10219, 1780, 102, 0),
(10220, 10222, -1, 104, 0),
(10223, 10226, 1794, 26, 0),
(10227, 10231, 1795, 128, 0),
(10232, 10235, 1794, 30, 0),
(10236, 10239, 1794, 31, 0),
(10240, 10244, 1798, 100, 0),
(10245, 10249, 1798, 105, 0),
(10250, 10253, 1794, 113, 0),
(10254, 10259, 1801, 106, 0),
(10260, 10265, 1801, 107, 0),
(10266, 10271, 1801, 108, 0),
(10272, 10276, 1794, 97, 0),
(10277, 10281, 1794, 96, 0),
(10282, 10286, 1794, 98, 0),
(10287, 10291, 1794, 99, 0),
(10292, 10296, 1794, 28, 0),
(10297, 10301, 1794, 27, 0),
(10302, 10307, 1810, 102, 0),
(10308, 10312, 1794, 29, 0),
(10313, 10315, -1, 116, 0),
(10316, 10319, 1813, 32, 0),
(10320, 10323, 1813, 33, 0),
(10324, 10327, 1813, 34, 0),
(10328, 10331, 1813, 40, 0),
(10332, 10335, 1813, 39, 0),
(10336, 10341, 1813, 84, 0),
(10342, 10347, 1813, 85, 0),
(10348, 10353, 1813, 122, 0),
(10354, 10360, 1813, 86, 0),
(10361, 10364, 1813, 95, 0),
(10365, 10368, 1813, 24, 0),
(10369, 10373, 1824, 83, 0),
(10374, 10377, 1813, 37, 0),
(10378, 10381, 1813, 13, 0),
(10382, 10387, 1827, 9, 0),
(10388, 10393, 1827, 6, 0),
(10394, 10399, 1827, 7, 0),
(10400, 10405, 1827, 8, 0),
(10406, 10411, 1827, 5, 0),
(10412, 10415, 1813, 41, 0),
(10416, 10419, 1813, 42, 0),
(10420, 10425, 1834, 21, 0),
(10426, 10429, 1813, 23, 0),
(10430, 10434, 1836, 123, 0),
(10435, 10438, 1813, 44, 0),
(10439, 10443, 1838, 120, 0),
(10444, 10448, 1838, 22, 0),
(10449, 10453, 1813, 77, 0),
(10454, 10458, 1813, 78, 0),
(10459, 10463, 1813, 79, 0),
(10464, 10468, 1813, 80, 0),
(10469, 10472, 1813, 45, 0),
(10473, 10478, 1813, 91, 0),
(10479, 10483, 1813, 38, 0),
(10484, 10487, -1, 84, 0),
(10488, 10491, -1, 85, 0),
(10492, 10495, -1, 122, 0),
(10496, 10500, -1, 86, 0),
(10501, 10503, -1, 25, 0),
(10504, 10509, 1852, 121, 0),
(10510, 10514, 1852, 100, 0),
(10515, 10521, 1852, 117, 0),
(10522, 10523, -1, 95, 0),
(10524, 10526, 1856, 1, 0),
(10527, 10530, 1856, 2, 0),
(10531, 10533, -1, 104, 0),
(10534, 10538, 1859, 47, 0),
(10539, 10542, 1859, 46, 0),
(10543, 10545, -1, 83, 0),
(10546, 10548, -1, 116, 0),
(10549, 10553, 1863, 48, 0),
(10554, 10556, -1, 50, 0),
(10557, 10560, -1, 52, 0),
(10561, 10565, -1, 124, 0),
(10566, 10570, -1, 125, 0),
(10571, 10575, -1, 126, 0),
(10576, 10583, -1, 84, 0),
(10584, 10591, -1, 85, 0),
(10592, 10599, -1, 122, 0),
(10600, 10608, -1, 86, 0),
(10609, 10614, -1, 95, 0),
(10615, 10621, 1874, 1, 0),
(10622, 10629, 1874, 2, 0),
(10630, 10636, -1, 83, 0),
(10637, 10642, -1, 13, 0),
(10643, 10649, -1, 123, 0),
(10650, 10656, -1, 120, 0),
(10657, 10665, -1, 92, 0),
(10666, 10674, -1, 93, 0),
(10675, 10682, -1, 94, 0),
(10683, 10689, -1, 77, 0),
(10690, 10696, -1, 78, 0),
(10697, 10703, -1, 79, 0),
(10704, 10710, -1, 80, 0),
(10711, 10718, -1, 91, 0),
(10719, 10724, -1, 84, 0),
(10725, 10730, -1, 85, 0),
(10731, 10736, -1, 122, 0),
(10737, 10743, -1, 86, 0),
(10744, 10747, -1, 95, 0),
(10748, 10752, 1893, 1, 0),
(10753, 10758, 1893, 2, 0),
(10759, 10762, -1, 51, 0),
(10763, 10767, 1896, 83, 0),
(10768, 10771, -1, 13, 0),
(10772, 10776, 1898, 10, 0),
(10777, 10781, 1898, 87, 0),
(10782, 10786, 1898, 159, 0),
(10787, 10792, 1898, 88, 0),
(10793, 10797, -1, 123, 0),
(10798, 10802, -1, 120, 0),
(10803, 10809, -1, 92, 0),
(10810, 10816, -1, 93, 0),
(10817, 10822, -1, 94, 0),
(10823, 10827, -1, 77, 0),
(10828, 10832, -1, 78, 0),
(10833, 10837, -1, 79, 0),
(10838, 10842, -1, 80, 0),
(10843, 10848, -1, 14, 0),
(10849, 10854, -1, 15, 0),
(10855, 10860, -1, 16, 0),
(10861, 10866, -1, 91, 0),
(10867, 10871, -1, 124, 0),
(10872, 10876, -1, 125, 0),
(10877, 10881, -1, 126, 0),
(10882, 10887, -1, 84, 0),
(10888, 10893, -1, 85, 0),
(10894, 10899, -1, 122, 0),
(10900, 10906, -1, 86, 0),
(10907, 10910, -1, 95, 0),
(10911, 10915, 1923, 1, 0),
(10916, 10921, 1923, 2, 0),
(10922, 10926, -1, 83, 0),
(10927, 10930, -1, 13, 0),
(10931, 10936, 1927, 137, 0),
(10937, 10943, 1927, 89, 0),
(10944, 10948, -1, 123, 0),
(10949, 10953, -1, 120, 0),
(10954, 10960, -1, 92, 0),
(10961, 10967, -1, 93, 0),
(10968, 10973, -1, 94, 0),
(10974, 10978, -1, 77, 0),
(10979, 10983, -1, 78, 0),
(10984, 10988, -1, 79, 0),
(10989, 10993, -1, 80, 0),
(10994, 10999, -1, 14, 0),
(11000, 11005, -1, 15, 0),
(11006, 11011, -1, 16, 0),
(11012, 11017, -1, 91, 0),
(11018, 11019, -1, 13, 0),
(11020, 11022, 1943, 10, 0),
(11023, 11028, 1944, 110, 0),
(11029, 11034, 1944, 111, 0),
(11035, 11040, 1944, 112, 0),
(11041, 11043, 1943, 11, 0),
(11044, 11047, 1948, 137, 0),
(11048, 11052, 1948, 10, 0),
(11053, 11057, 1948, 89, 0),
(11058, 11060, 1943, 12, 0),
(11061, 11063, -1, 53, 0),
(11064, 11066, -1, 54, 0),
(11067, 11069, -1, 55, 0),
(11070, 11072, -1, 56, 0),
(11073, 11076, -1, 135, 0),
(11077, 11080, -1, 131, 0),
(11081, 11084, -1, 129, 0),
(11085, 11088, -1, 133, 0),
(11089, 11092, -1, 132, 0),
(11093, 11096, -1, 130, 0),
(11097, 11100, -1, 134, 0),
(11101, 11103, -1, 57, 0),
(11104, 11106, -1, 58, 0),
(11107, 11109, -1, 123, 0),
(11110, 11112, -1, 120, 0),
(11113, 11117, 1967, 68, 0),
(11118, 11121, 1967, 69, 0),
(11122, 11124, -1, 70, 0),
(11125, 11129, -1, 92, 0),
(11130, 11134, -1, 93, 0),
(11135, 11138, -1, 94, 0),
(11139, 11142, -1, 71, 0),
(11143, 11146, -1, 72, 0),
(11147, 11150, -1, 73, 0),
(11151, 11154, -1, 74, 0),
(11155, 11159, -1, 75, 0),
(11160, 11162, -1, 77, 0),
(11163, 11165, -1, 78, 0),
(11166, 11168, -1, 79, 0),
(11169, 11171, -1, 80, 0),
(11172, 11175, 1982, 82, 0),
(11176, 11179, 1982, 81, 0),
(11180, 11183, -1, 3, 0),
(11184, 11188, -1, 4, 0),
(11189, 11193, -1, 63, 0),
(11194, 11198, -1, 64, 0),
(11199, 11203, -1, 61, 0),
(11204, 11208, -1, 62, 0),
(11209, 11213, -1, 60, 0),
(11214, 11218, -1, 59, 0),
(11219, 11223, -1, 65, 0),
(11224, 11227, -1, 66, 0),
(11228, 11231, -1, 67, 0),
(11232, 11235, -1, 91, 0),
(11236, 11239, -1, 97, 0),
(11240, 11243, -1, 96, 0),
(11244, 11247, -1, 98, 0),
(11248, 11251, -1, 99, 0),
(11252, 11254, -1, 95, 0),
(11255, 11257, -1, 104, 0),
(11258, 11262, 2002, 100, 0),
(11263, 11267, 2002, 105, 0),
(11268, 11271, 2002, 113, 0),
(11272, 11276, 2002, 97, 0),
(11277, 11281, 2002, 96, 0),
(11282, 11286, 2002, 98, 0),
(11287, 11291, 2002, 99, 0),
(11292, 11297, 2002, 102, 0),
(11298, 11300, -1, 119, 0),
(11301, 11308, 2011, 110, 0),
(11309, 11316, 2011, 111, 0),
(11317, 11324, 2011, 112, 0),
(11325, 11332, 2011, 106, 0),
(11333, 11340, 2011, 107, 0),
(11341, 11348, 2011, 108, 0),
(11349, 11353, 2011, 116, 0),
(11354, 11359, 2011, 114, 0),
(11360, 11364, 2011, 25, 0),
(11365, 11371, 2020, 100, 0),
(11372, 11380, 2020, 117, 0),
(11381, 11384, 2011, 13, 0),
(11385, 11392, 2023, 110, 0),
(11393, 11400, 2023, 111, 0),
(11401, 11408, 2023, 112, 0),
(11409, 11413, 2011, 70, 0),
(11414, 11419, 2011, 115, 0),
(11420, 11422, -1, 116, 0),
(11423, 11426, 2029, 103, 0),
(11427, 11432, 2029, 118, 0),
(11433, 11438, 2029, 101, 0),
(11439, 11445, 2029, 117, 0),
(11446, 11452, 2029, 90, 0));
A_3 : constant Among_Array_Type (0 .. 25) := (
(11453, 11453, -1, 1, 0),
(11454, 11456, 0, 1, 0),
(11457, 11459, 0, 1, 0),
(11460, 11462, 0, 1, 0),
(11463, 11465, 0, 1, 0),
(11466, 11466, -1, 1, 0),
(11467, 11468, -1, 1, 0),
(11469, 11472, 6, 1, 0),
(11473, 11476, 6, 1, 0),
(11477, 11480, -1, 1, 0),
(11481, 11484, -1, 1, 0),
(11485, 11485, -1, 1, 0),
(11486, 11488, 11, 1, 0),
(11489, 11491, 11, 1, 0),
(11492, 11495, -1, 1, 0),
(11496, 11499, -1, 1, 0),
(11500, 11503, -1, 1, 0),
(11504, 11507, -1, 1, 0),
(11508, 11509, -1, 1, 0),
(11510, 11513, 18, 1, 0),
(11514, 11514, -1, 1, 0),
(11515, 11517, 20, 1, 0),
(11518, 11520, 20, 1, 0),
(11521, 11523, -1, 1, 0),
(11524, 11524, -1, 1, 0),
(11525, 11527, 24, 1, 0));
procedure R_Cyr_to_lat (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Char_Index;
v_3 : Char_Index;
begin
-- do, line 82
v_1 := Z.C;
-- repeat, line 82
<<lab1>>
loop
v_2 := Z.C;
-- goto, line 82
loop
v_3 := Z.C;
-- (, line 82
Z.Bra := Z.C; -- [, line 83
-- substring, line 83
Find_Among (Z, A_0, Among_String, null, A);
if A = 0 then
goto lab4;
end if;
Z.Ket := Z.C; -- ], line 83
-- among, line 83
case A is
when 1 =>
-- (, line 84
-- <-, line 84
Slice_From (Z, "a");
when 2 =>
-- (, line 85
-- <-, line 85
Slice_From (Z, "b");
when 3 =>
-- (, line 86
-- <-, line 86
Slice_From (Z, "v");
when 4 =>
-- (, line 87
-- <-, line 87
Slice_From (Z, "g");
when 5 =>
-- (, line 88
-- <-, line 88
Slice_From (Z, "d");
when 6 =>
-- (, line 89
-- <-, line 89
Slice_From (Z, "đ");
when 7 =>
-- (, line 90
-- <-, line 90
Slice_From (Z, "e");
when 8 =>
-- (, line 91
-- <-, line 91
Slice_From (Z, "ž");
when 9 =>
-- (, line 92
-- <-, line 92
Slice_From (Z, "z");
when 10 =>
-- (, line 93
-- <-, line 93
Slice_From (Z, "i");
when 11 =>
-- (, line 94
-- <-, line 94
Slice_From (Z, "j");
when 12 =>
-- (, line 95
-- <-, line 95
Slice_From (Z, "k");
when 13 =>
-- (, line 96
-- <-, line 96
Slice_From (Z, "l");
when 14 =>
-- (, line 97
-- <-, line 97
Slice_From (Z, "lj");
when 15 =>
-- (, line 98
-- <-, line 98
Slice_From (Z, "m");
when 16 =>
-- (, line 99
-- <-, line 99
Slice_From (Z, "n");
when 17 =>
-- (, line 100
-- <-, line 100
Slice_From (Z, "nj");
when 18 =>
-- (, line 101
-- <-, line 101
Slice_From (Z, "o");
when 19 =>
-- (, line 102
-- <-, line 102
Slice_From (Z, "p");
when 20 =>
-- (, line 103
-- <-, line 103
Slice_From (Z, "r");
when 21 =>
-- (, line 104
-- <-, line 104
Slice_From (Z, "s");
when 22 =>
-- (, line 105
-- <-, line 105
Slice_From (Z, "t");
when 23 =>
-- (, line 106
-- <-, line 106
Slice_From (Z, "ć");
when 24 =>
-- (, line 107
-- <-, line 107
Slice_From (Z, "u");
when 25 =>
-- (, line 108
-- <-, line 108
Slice_From (Z, "f");
when 26 =>
-- (, line 109
-- <-, line 109
Slice_From (Z, "h");
when 27 =>
-- (, line 110
-- <-, line 110
Slice_From (Z, "c");
when 28 =>
-- (, line 111
-- <-, line 111
Slice_From (Z, "č");
when 29 =>
-- (, line 112
-- <-, line 112
Slice_From (Z, "dž");
when 30 =>
-- (, line 113
-- <-, line 113
Slice_From (Z, "š");
when others =>
null;
end case;
Z.C := v_3;
exit;
<<lab4>>
Z.C := v_3;
if Z.C >= Z.L then
goto lab2;
end if;
-- goto, line 82
C := Skip_Utf8 (Z);
if C < 0 then
goto lab2;
end if;
Z.C := C;
end loop;
goto lab1;
<<lab2>>
Z.C := v_2;
exit;
end loop;
<<lab0>>
Z.C := v_1;
Result := True;
end R_Cyr_to_lat;
procedure R_Prelude (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Char_Index;
v_3 : Char_Index;
v_4 : Char_Index;
v_5 : Char_Index;
v_6 : Char_Index;
v_7 : Char_Index;
v_8 : Char_Index;
v_9 : Char_Index;
begin
-- (, line 119
-- do, line 121
v_1 := Z.C;
-- repeat, line 121
<<lab1>>
loop
v_2 := Z.C;
-- goto, line 121
loop
v_3 := Z.C;
-- (, line 121
In_Grouping (Z, G_Ca, 98, 382, False, C);
if C /= 0 then
goto lab4;
end if;
Z.Bra := Z.C; -- [, line 122
-- literal, line 122
C := Eq_S (Z, "ije");
if C = 0 then
goto lab4;
end if;
Z.C := Z.C + C;
Z.Ket := Z.C; -- ], line 122
In_Grouping (Z, G_Ca, 98, 382, False, C);
if C /= 0 then
goto lab4;
end if;
-- <-, line 122
Slice_From (Z, "e");
Z.C := v_3;
exit;
<<lab4>>
Z.C := v_3;
if Z.C >= Z.L then
goto lab2;
end if;
-- goto, line 121
C := Skip_Utf8 (Z);
if C < 0 then
goto lab2;
end if;
Z.C := C;
end loop;
goto lab1;
<<lab2>>
Z.C := v_2;
exit;
end loop;
<<lab0>>
Z.C := v_1;
-- do, line 125
v_4 := Z.C;
-- repeat, line 125
<<lab6>>
loop
v_5 := Z.C;
-- goto, line 125
loop
v_6 := Z.C;
-- (, line 125
In_Grouping (Z, G_Ca, 98, 382, False, C);
if C /= 0 then
goto lab9;
end if;
Z.Bra := Z.C; -- [, line 126
-- literal, line 126
C := Eq_S (Z, "je");
if C = 0 then
goto lab9;
end if;
Z.C := Z.C + C;
Z.Ket := Z.C; -- ], line 126
In_Grouping (Z, G_Ca, 98, 382, False, C);
if C /= 0 then
goto lab9;
end if;
-- <-, line 126
Slice_From (Z, "e");
Z.C := v_6;
exit;
<<lab9>>
Z.C := v_6;
if Z.C >= Z.L then
goto lab7;
end if;
-- goto, line 125
C := Skip_Utf8 (Z);
if C < 0 then
goto lab7;
end if;
Z.C := C;
end loop;
goto lab6;
<<lab7>>
Z.C := v_5;
exit;
end loop;
<<lab5>>
Z.C := v_4;
-- do, line 129
v_7 := Z.C;
-- repeat, line 129
<<lab11>>
loop
v_8 := Z.C;
-- goto, line 129
loop
v_9 := Z.C;
-- (, line 129
Z.Bra := Z.C; -- [, line 130
-- literal, line 130
C := Eq_S (Z, "dj");
if C = 0 then
goto lab14;
end if;
Z.C := Z.C + C;
Z.Ket := Z.C; -- ], line 130
-- <-, line 130
Slice_From (Z, "đ");
Z.C := v_9;
exit;
<<lab14>>
Z.C := v_9;
if Z.C >= Z.L then
goto lab12;
end if;
-- goto, line 129
C := Skip_Utf8 (Z);
if C < 0 then
goto lab12;
end if;
Z.C := C;
end loop;
goto lab11;
<<lab12>>
Z.C := v_8;
exit;
end loop;
<<lab10>>
Z.C := v_7;
Result := True;
end R_Prelude;
procedure R_Mark_regions (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_1 : Char_Index;
v_2 : Char_Index;
v_3 : Char_Index;
v_4 : Char_Index;
begin
-- (, line 135
-- set no_diacritics, line 137
Z.B_No_diacritics := True;
-- do, line 139
v_1 := Z.C;
-- (, line 139
-- gopast, line 140
-- grouping sa, line 140
Out_Grouping (Z, G_Sa, 263, 382, True, C);
if C < 0 then
goto lab0;
end if;
Z.C := Z.C + C;
-- unset no_diacritics, line 140
Z.B_No_diacritics := False;
<<lab0>>
Z.C := v_1;
Z.I_P1 := Z.L;
-- do, line 145
v_2 := Z.C;
-- (, line 145
-- gopast, line 146
-- grouping v, line 146
Out_Grouping (Z, G_V, 97, 117, True, C);
if C < 0 then
goto lab2;
end if;
Z.C := Z.C + C;
-- setmark p1, line 146
Z.I_P1 := Z.C;
if not (Z.I_P1 < 2) then
goto lab2;
end if;
-- (, line 147
-- gopast, line 148
-- non v, line 148
In_Grouping (Z, G_V, 97, 117, True, C);
if C < 0 then
goto lab2;
end if;
Z.C := Z.C + C;
-- setmark p1, line 149
Z.I_P1 := Z.C;
<<lab2>>
Z.C := v_2;
-- do, line 152
v_3 := Z.C;
-- (, line 152
-- gopast, line 153
loop
-- literal, line 153
C := Eq_S (Z, "r");
if C = 0 then
goto lab7;
end if;
Z.C := Z.C + C;
exit;
<<lab7>>
if Z.C >= Z.L then
goto lab5;
end if;
-- gopast, line 153
C := Skip_Utf8 (Z);
if C < 0 then
goto lab5;
end if;
Z.C := C;
end loop;
-- or, line 154
v_4 := Z.C;
if not (Z.C >= 2) then
goto lab9;
end if;
goto lab8;
<<lab9>>
Z.C := v_4;
-- gopast, line 154
-- non rg, line 154
In_Grouping (Z, G_Rg, 114, 114, True, C);
if C < 0 then
goto lab5;
end if;
Z.C := Z.C + C;
<<lab8>>
if not ((Z.I_P1 - Z.C) > 1) then
goto lab5;
end if;
-- setmark p1, line 155
Z.I_P1 := Z.C;
<<lab5>>
Z.C := v_3;
Result := True;
end R_Mark_regions;
procedure R_R1 (Z : in out Context_Type; Result : out Boolean) is
begin
Result := (Z.I_P1 <= Z.C);
end R_R1;
procedure R_Step_1 (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 164
Z.Ket := Z.C; -- [, line 165
-- substring, line 165
if Z.C - 2 <= Z.Lb or else Check_Among (Z, Z.C - 1, 3, 16#346a2a#) then
Result := False;
return;
-- substring, line 165
end if;
Find_Among_Backward (Z, A_1, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Z.Bra := Z.C; -- ], line 165
-- among, line 165
case A is
when 1 =>
-- (, line 167
-- <-, line 167
Slice_From (Z, "loga");
when 2 =>
-- (, line 169
-- <-, line 169
Slice_From (Z, "peh");
when 3 =>
-- (, line 170
-- <-, line 170
Slice_From (Z, "vojka");
when 4 =>
-- (, line 171
-- <-, line 171
Slice_From (Z, "bojka");
when 5 =>
-- (, line 173
-- <-, line 173
Slice_From (Z, "jak");
when 6 =>
-- (, line 174
-- <-, line 174
Slice_From (Z, "čajni");
when 7 =>
-- (, line 175
-- Boolean test no_diacritics, line 175
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 175
Slice_From (Z, "cajni");
when 8 =>
-- (, line 176
-- <-, line 176
Slice_From (Z, "erni");
when 9 =>
-- (, line 177
-- <-, line 177
Slice_From (Z, "larni");
when 10 =>
-- (, line 178
-- <-, line 178
Slice_From (Z, "esni");
when 11 =>
-- (, line 179
-- <-, line 179
Slice_From (Z, "anjca");
when 12 =>
-- (, line 181
-- <-, line 181
Slice_From (Z, "ajca");
when 13 =>
-- (, line 183
-- <-, line 183
Slice_From (Z, "ljca");
when 14 =>
-- (, line 185
-- <-, line 185
Slice_From (Z, "ejca");
when 15 =>
-- (, line 187
-- <-, line 187
Slice_From (Z, "ojca");
when 16 =>
-- (, line 188
-- <-, line 188
Slice_From (Z, "ajka");
when 17 =>
-- (, line 189
-- <-, line 189
Slice_From (Z, "ojka");
when 18 =>
-- (, line 191
-- <-, line 191
Slice_From (Z, "šca");
when 19 =>
-- (, line 193
-- <-, line 193
Slice_From (Z, "ing");
when 20 =>
-- (, line 194
-- <-, line 194
Slice_From (Z, "tvenik");
when 21 =>
-- (, line 196
-- <-, line 196
Slice_From (Z, "tetika");
when 22 =>
-- (, line 197
-- <-, line 197
Slice_From (Z, "nstva");
when 23 =>
-- (, line 198
-- <-, line 198
Slice_From (Z, "nik");
when 24 =>
-- (, line 199
-- <-, line 199
Slice_From (Z, "tik");
when 25 =>
-- (, line 200
-- <-, line 200
Slice_From (Z, "zik");
when 26 =>
-- (, line 201
-- <-, line 201
Slice_From (Z, "snik");
when 27 =>
-- (, line 202
-- <-, line 202
Slice_From (Z, "kusi");
when 28 =>
-- (, line 203
-- <-, line 203
Slice_From (Z, "kusni");
when 29 =>
-- (, line 204
-- <-, line 204
Slice_From (Z, "kustva");
when 30 =>
-- (, line 205
-- <-, line 205
Slice_From (Z, "dušni");
when 31 =>
-- (, line 206
-- Boolean test no_diacritics, line 206
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 206
Slice_From (Z, "dusni");
when 32 =>
-- (, line 207
-- <-, line 207
Slice_From (Z, "antni");
when 33 =>
-- (, line 208
-- <-, line 208
Slice_From (Z, "bilni");
when 34 =>
-- (, line 209
-- <-, line 209
Slice_From (Z, "tilni");
when 35 =>
-- (, line 210
-- <-, line 210
Slice_From (Z, "avilni");
when 36 =>
-- (, line 211
-- <-, line 211
Slice_From (Z, "silni");
when 37 =>
-- (, line 212
-- <-, line 212
Slice_From (Z, "gilni");
when 38 =>
-- (, line 213
-- <-, line 213
Slice_From (Z, "rilni");
when 39 =>
-- (, line 214
-- <-, line 214
Slice_From (Z, "nilni");
when 40 =>
-- (, line 215
-- <-, line 215
Slice_From (Z, "alni");
when 41 =>
-- (, line 216
-- <-, line 216
Slice_From (Z, "ozni");
when 42 =>
-- (, line 217
-- <-, line 217
Slice_From (Z, "ravi");
when 43 =>
-- (, line 218
-- <-, line 218
Slice_From (Z, "stavni");
when 44 =>
-- (, line 219
-- <-, line 219
Slice_From (Z, "pravni");
when 45 =>
-- (, line 220
-- <-, line 220
Slice_From (Z, "tivni");
when 46 =>
-- (, line 221
-- <-, line 221
Slice_From (Z, "sivni");
when 47 =>
-- (, line 222
-- <-, line 222
Slice_From (Z, "atni");
when 48 =>
-- (, line 223
-- <-, line 223
Slice_From (Z, "enta");
when 49 =>
-- (, line 224
-- <-, line 224
Slice_From (Z, "tetni");
when 50 =>
-- (, line 225
-- <-, line 225
Slice_From (Z, "pletni");
when 51 =>
-- (, line 226
-- <-, line 226
Slice_From (Z, "šavi");
when 52 =>
-- (, line 227
-- Boolean test no_diacritics, line 227
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 227
Slice_From (Z, "savi");
when 53 =>
-- (, line 228
-- <-, line 228
Slice_From (Z, "anta");
when 54 =>
-- (, line 230
-- <-, line 230
Slice_From (Z, "ačka");
when 55 =>
-- (, line 232
-- Boolean test no_diacritics, line 232
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 232
Slice_From (Z, "acka");
when 56 =>
-- (, line 233
-- <-, line 233
Slice_From (Z, "uška");
when 57 =>
-- (, line 234
-- Boolean test no_diacritics, line 234
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 234
Slice_From (Z, "uska");
when 58 =>
-- (, line 238
-- <-, line 238
Slice_From (Z, "atka");
when 59 =>
-- (, line 240
-- <-, line 240
Slice_From (Z, "etka");
when 60 =>
-- (, line 243
-- <-, line 243
Slice_From (Z, "itka");
when 61 =>
-- (, line 245
-- <-, line 245
Slice_From (Z, "otka");
when 62 =>
-- (, line 249
-- <-, line 249
Slice_From (Z, "utka");
when 63 =>
-- (, line 250
-- <-, line 250
Slice_From (Z, "eskna");
when 64 =>
-- (, line 251
-- <-, line 251
Slice_From (Z, "tični");
when 65 =>
-- (, line 252
-- Boolean test no_diacritics, line 252
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 252
Slice_From (Z, "ticni");
when 66 =>
-- (, line 253
-- <-, line 253
Slice_From (Z, "ojska");
when 67 =>
-- (, line 254
-- <-, line 254
Slice_From (Z, "esma");
when 68 =>
-- (, line 256
-- <-, line 256
Slice_From (Z, "metra");
when 69 =>
-- (, line 258
-- <-, line 258
Slice_From (Z, "centra");
when 70 =>
-- (, line 260
-- <-, line 260
Slice_From (Z, "istra");
when 71 =>
-- (, line 261
-- <-, line 261
Slice_From (Z, "osti");
when 72 =>
-- (, line 262
-- Boolean test no_diacritics, line 262
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 262
Slice_From (Z, "osti");
when 73 =>
-- (, line 263
-- <-, line 263
Slice_From (Z, "dba");
when 74 =>
-- (, line 265
-- <-, line 265
Slice_From (Z, "čka");
when 75 =>
-- (, line 267
-- <-, line 267
Slice_From (Z, "mca");
when 76 =>
-- (, line 269
-- <-, line 269
Slice_From (Z, "nca");
when 77 =>
-- (, line 270
-- <-, line 270
Slice_From (Z, "voljni");
when 78 =>
-- (, line 271
-- <-, line 271
Slice_From (Z, "anki");
when 79 =>
-- (, line 273
-- <-, line 273
Slice_From (Z, "vca");
when 80 =>
-- (, line 275
-- <-, line 275
Slice_From (Z, "sca");
when 81 =>
-- (, line 277
-- <-, line 277
Slice_From (Z, "rca");
when 82 =>
-- (, line 280
-- <-, line 280
Slice_From (Z, "alca");
when 83 =>
-- (, line 282
-- <-, line 282
Slice_From (Z, "elca");
when 84 =>
-- (, line 285
-- <-, line 285
Slice_From (Z, "olca");
when 85 =>
-- (, line 287
-- <-, line 287
Slice_From (Z, "njca");
when 86 =>
-- (, line 289
-- <-, line 289
Slice_From (Z, "ekta");
when 87 =>
-- (, line 291
-- <-, line 291
Slice_From (Z, "izma");
when 88 =>
-- (, line 292
-- <-, line 292
Slice_From (Z, "jebi");
when 89 =>
-- (, line 293
-- <-, line 293
Slice_From (Z, "baci");
when 90 =>
-- (, line 294
-- <-, line 294
Slice_From (Z, "ašni");
when 91 =>
-- (, line 295
-- Boolean test no_diacritics, line 295
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 295
Slice_From (Z, "asni");
when others =>
null;
end case;
Result := True;
end R_Step_1;
procedure R_Step_2 (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 299
Z.Ket := Z.C; -- [, line 300
-- substring, line 300
Find_Among_Backward (Z, A_2, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Z.Bra := Z.C; -- ], line 300
-- call R1, line 300
R_R1 (Z, Result);
if not Result then
Result := False;
return;
end if;
-- among, line 300
case A is
when 1 =>
-- (, line 328
-- <-, line 328
Slice_From (Z, "sk");
when 2 =>
-- (, line 356
-- <-, line 356
Slice_From (Z, "šk");
when 3 =>
-- (, line 361
-- <-, line 361
Slice_From (Z, "stv");
when 4 =>
-- (, line 366
-- <-, line 366
Slice_From (Z, "štv");
when 5 =>
-- (, line 373
-- <-, line 373
Slice_From (Z, "tanij");
when 6 =>
-- (, line 380
-- <-, line 380
Slice_From (Z, "manij");
when 7 =>
-- (, line 387
-- <-, line 387
Slice_From (Z, "panij");
when 8 =>
-- (, line 394
-- <-, line 394
Slice_From (Z, "ranij");
when 9 =>
-- (, line 401
-- <-, line 401
Slice_From (Z, "ganij");
when 10 =>
-- (, line 412
-- <-, line 412
Slice_From (Z, "an");
when 11 =>
-- (, line 420
-- <-, line 420
Slice_From (Z, "in");
when 12 =>
-- (, line 430
-- <-, line 430
Slice_From (Z, "on");
when 13 =>
-- (, line 460
-- <-, line 460
Slice_From (Z, "n");
when 14 =>
-- (, line 476
-- <-, line 476
Slice_From (Z, "ać");
when 15 =>
-- (, line 492
-- <-, line 492
Slice_From (Z, "eć");
when 16 =>
-- (, line 508
-- <-, line 508
Slice_From (Z, "uć");
when 17 =>
-- (, line 512
-- <-, line 512
Slice_From (Z, "ugov");
when 18 =>
-- (, line 519
-- <-, line 519
Slice_From (Z, "ug");
when 19 =>
-- (, line 524
-- <-, line 524
Slice_From (Z, "log");
when 20 =>
-- (, line 535
-- <-, line 535
Slice_From (Z, "g");
when 21 =>
-- (, line 539
-- <-, line 539
Slice_From (Z, "rari");
when 22 =>
-- (, line 543
-- <-, line 543
Slice_From (Z, "oti");
when 23 =>
-- (, line 547
-- <-, line 547
Slice_From (Z, "si");
when 24 =>
-- (, line 551
-- <-, line 551
Slice_From (Z, "li");
when 25 =>
-- (, line 559
-- <-, line 559
Slice_From (Z, "uj");
when 26 =>
-- (, line 570
-- <-, line 570
Slice_From (Z, "caj");
when 27 =>
-- (, line 581
-- <-, line 581
Slice_From (Z, "čaj");
when 28 =>
-- (, line 592
-- <-, line 592
Slice_From (Z, "ćaj");
when 29 =>
-- (, line 603
-- <-, line 603
Slice_From (Z, "đaj");
when 30 =>
-- (, line 614
-- <-, line 614
Slice_From (Z, "laj");
when 31 =>
-- (, line 625
-- <-, line 625
Slice_From (Z, "raj");
when 32 =>
-- (, line 633
-- <-, line 633
Slice_From (Z, "bij");
when 33 =>
-- (, line 641
-- <-, line 641
Slice_From (Z, "cij");
when 34 =>
-- (, line 649
-- <-, line 649
Slice_From (Z, "dij");
when 35 =>
-- (, line 655
-- <-, line 655
Slice_From (Z, "lij");
when 36 =>
-- (, line 658
-- <-, line 658
Slice_From (Z, "nij");
when 37 =>
-- (, line 666
-- <-, line 666
Slice_From (Z, "mij");
when 38 =>
-- (, line 674
-- <-, line 674
Slice_From (Z, "žij");
when 39 =>
-- (, line 682
-- <-, line 682
Slice_From (Z, "gij");
when 40 =>
-- (, line 690
-- <-, line 690
Slice_From (Z, "fij");
when 41 =>
-- (, line 698
-- <-, line 698
Slice_From (Z, "pij");
when 42 =>
-- (, line 706
-- <-, line 706
Slice_From (Z, "rij");
when 43 =>
-- (, line 712
-- <-, line 712
Slice_From (Z, "sij");
when 44 =>
-- (, line 720
-- <-, line 720
Slice_From (Z, "tij");
when 45 =>
-- (, line 728
-- <-, line 728
Slice_From (Z, "zij");
when 46 =>
-- (, line 736
-- <-, line 736
Slice_From (Z, "nal");
when 47 =>
-- (, line 744
-- <-, line 744
Slice_From (Z, "ijal");
when 48 =>
-- (, line 750
-- <-, line 750
Slice_From (Z, "ozil");
when 49 =>
-- (, line 754
-- <-, line 754
Slice_From (Z, "olov");
when 50 =>
-- (, line 760
-- <-, line 760
Slice_From (Z, "ol");
when 51 =>
-- (, line 768
-- <-, line 768
Slice_From (Z, "lem");
when 52 =>
-- (, line 775
-- <-, line 775
Slice_From (Z, "ram");
when 53 =>
-- (, line 782
-- <-, line 782
Slice_From (Z, "ar");
when 54 =>
-- (, line 789
-- <-, line 789
Slice_From (Z, "dr");
when 55 =>
-- (, line 796
-- <-, line 796
Slice_From (Z, "er");
when 56 =>
-- (, line 803
-- <-, line 803
Slice_From (Z, "or");
when 57 =>
-- (, line 808
-- <-, line 808
Slice_From (Z, "es");
when 58 =>
-- (, line 813
-- <-, line 813
Slice_From (Z, "is");
when 59 =>
-- (, line 821
-- <-, line 821
Slice_From (Z, "taš");
when 60 =>
-- (, line 829
-- <-, line 829
Slice_From (Z, "naš");
when 61 =>
-- (, line 837
-- <-, line 837
Slice_From (Z, "jaš");
when 62 =>
-- (, line 845
-- <-, line 845
Slice_From (Z, "kaš");
when 63 =>
-- (, line 853
-- <-, line 853
Slice_From (Z, "baš");
when 64 =>
-- (, line 861
-- <-, line 861
Slice_From (Z, "gaš");
when 65 =>
-- (, line 869
-- <-, line 869
Slice_From (Z, "vaš");
when 66 =>
-- (, line 877
-- <-, line 877
Slice_From (Z, "eš");
when 67 =>
-- (, line 885
-- <-, line 885
Slice_From (Z, "iš");
when 68 =>
-- (, line 892
-- <-, line 892
Slice_From (Z, "ikat");
when 69 =>
-- (, line 899
-- <-, line 899
Slice_From (Z, "lat");
when 70 =>
-- (, line 907
-- <-, line 907
Slice_From (Z, "et");
when 71 =>
-- (, line 915
-- <-, line 915
Slice_From (Z, "est");
when 72 =>
-- (, line 923
-- <-, line 923
Slice_From (Z, "ist");
when 73 =>
-- (, line 931
-- <-, line 931
Slice_From (Z, "kst");
when 74 =>
-- (, line 939
-- <-, line 939
Slice_From (Z, "ost");
when 75 =>
-- (, line 944
-- <-, line 944
Slice_From (Z, "išt");
when 76 =>
-- (, line 956
-- <-, line 956
Slice_From (Z, "ova");
when 77 =>
-- (, line 987
-- <-, line 987
Slice_From (Z, "av");
when 78 =>
-- (, line 1018
-- <-, line 1018
Slice_From (Z, "ev");
when 79 =>
-- (, line 1049
-- <-, line 1049
Slice_From (Z, "iv");
when 80 =>
-- (, line 1078
-- <-, line 1078
Slice_From (Z, "ov");
when 81 =>
-- (, line 1084
-- <-, line 1084
Slice_From (Z, "mov");
when 82 =>
-- (, line 1090
-- <-, line 1090
Slice_From (Z, "lov");
when 83 =>
-- (, line 1120
-- <-, line 1120
Slice_From (Z, "el");
when 84 =>
-- (, line 1150
-- <-, line 1150
Slice_From (Z, "anj");
when 85 =>
-- (, line 1180
-- <-, line 1180
Slice_From (Z, "enj");
when 86 =>
-- (, line 1210
-- <-, line 1210
Slice_From (Z, "šnj");
when 87 =>
-- (, line 1218
-- <-, line 1218
Slice_From (Z, "en");
when 88 =>
-- (, line 1222
-- <-, line 1222
Slice_From (Z, "šn");
when 89 =>
-- (, line 1237
-- <-, line 1237
Slice_From (Z, "čin");
when 90 =>
-- (, line 1253
-- <-, line 1253
Slice_From (Z, "roši");
when 91 =>
-- (, line 1282
-- <-, line 1282
Slice_From (Z, "oš");
when 92 =>
-- (, line 1310
-- <-, line 1310
Slice_From (Z, "evit");
when 93 =>
-- (, line 1338
-- <-, line 1338
Slice_From (Z, "ovit");
when 94 =>
-- (, line 1366
-- <-, line 1366
Slice_From (Z, "ast");
when 95 =>
-- (, line 1397
-- <-, line 1397
Slice_From (Z, "k");
when 96 =>
-- (, line 1424
-- <-, line 1424
Slice_From (Z, "eva");
when 97 =>
-- (, line 1451
-- <-, line 1451
Slice_From (Z, "ava");
when 98 =>
-- (, line 1478
-- <-, line 1478
Slice_From (Z, "iva");
when 99 =>
-- (, line 1505
-- <-, line 1505
Slice_From (Z, "uva");
when 100 =>
-- (, line 1537
-- <-, line 1537
Slice_From (Z, "ir");
when 101 =>
-- (, line 1560
-- <-, line 1560
Slice_From (Z, "ač");
when 102 =>
-- (, line 1583
-- <-, line 1583
Slice_From (Z, "ača");
when 103 =>
-- (, line 1611
-- <-, line 1611
Slice_From (Z, "ni");
when 104 =>
-- (, line 1637
-- <-, line 1637
Slice_From (Z, "a");
when 105 =>
-- (, line 1664
-- <-, line 1664
Slice_From (Z, "ur");
when 106 =>
-- (, line 1685
-- <-, line 1685
Slice_From (Z, "astaj");
when 107 =>
-- (, line 1706
-- <-, line 1706
Slice_From (Z, "istaj");
when 108 =>
-- (, line 1727
-- <-, line 1727
Slice_From (Z, "ostaj");
when 109 =>
-- (, line 1740
-- <-, line 1740
Slice_From (Z, "aj");
when 110 =>
-- (, line 1767
-- <-, line 1767
Slice_From (Z, "asta");
when 111 =>
-- (, line 1794
-- <-, line 1794
Slice_From (Z, "ista");
when 112 =>
-- (, line 1821
-- <-, line 1821
Slice_From (Z, "osta");
when 113 =>
-- (, line 1845
-- <-, line 1845
Slice_From (Z, "ta");
when 114 =>
-- (, line 1861
-- <-, line 1861
Slice_From (Z, "inj");
when 115 =>
-- (, line 1871
-- <-, line 1871
Slice_From (Z, "as");
when 116 =>
-- (, line 1886
-- <-, line 1886
Slice_From (Z, "i");
when 117 =>
-- (, line 1928
-- <-, line 1928
Slice_From (Z, "luč");
when 118 =>
-- (, line 1943
-- <-, line 1943
Slice_From (Z, "jeti");
when 119 =>
-- (, line 1948
-- <-, line 1948
Slice_From (Z, "e");
when 120 =>
-- (, line 1979
-- <-, line 1979
Slice_From (Z, "at");
when 121 =>
-- (, line 2017
-- Boolean test no_diacritics, line 2017
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2017
Slice_From (Z, "luc");
when 122 =>
-- (, line 2046
-- Boolean test no_diacritics, line 2046
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2046
Slice_From (Z, "snj");
when 123 =>
-- (, line 2076
-- Boolean test no_diacritics, line 2076
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2076
Slice_From (Z, "os");
when 124 =>
-- (, line 2112
-- Boolean test no_diacritics, line 2112
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2112
Slice_From (Z, "ac");
when 125 =>
-- (, line 2128
-- Boolean test no_diacritics, line 2128
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2128
Slice_From (Z, "ec");
when 126 =>
-- (, line 2144
-- Boolean test no_diacritics, line 2144
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2144
Slice_From (Z, "uc");
when 127 =>
-- (, line 2160
-- Boolean test no_diacritics, line 2160
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2160
Slice_From (Z, "rosi");
when 128 =>
-- (, line 2183
-- Boolean test no_diacritics, line 2183
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2183
Slice_From (Z, "aca");
when 129 =>
-- (, line 2191
-- Boolean test no_diacritics, line 2191
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2191
Slice_From (Z, "jas");
when 130 =>
-- (, line 2199
-- Boolean test no_diacritics, line 2199
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2199
Slice_From (Z, "tas");
when 131 =>
-- (, line 2207
-- Boolean test no_diacritics, line 2207
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2207
Slice_From (Z, "gas");
when 132 =>
-- (, line 2215
-- Boolean test no_diacritics, line 2215
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2215
Slice_From (Z, "nas");
when 133 =>
-- (, line 2223
-- Boolean test no_diacritics, line 2223
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2223
Slice_From (Z, "kas");
when 134 =>
-- (, line 2231
-- Boolean test no_diacritics, line 2231
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2231
Slice_From (Z, "vas");
when 135 =>
-- (, line 2239
-- Boolean test no_diacritics, line 2239
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2239
Slice_From (Z, "bas");
when 136 =>
-- (, line 2241
-- Boolean test no_diacritics, line 2241
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2241
Slice_From (Z, "as");
when 137 =>
-- (, line 2256
-- Boolean test no_diacritics, line 2256
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2256
Slice_From (Z, "cin");
when 138 =>
-- (, line 2259
-- Boolean test no_diacritics, line 2259
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2259
Slice_From (Z, "astaj");
when 139 =>
-- (, line 2262
-- Boolean test no_diacritics, line 2262
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2262
Slice_From (Z, "istaj");
when 140 =>
-- (, line 2265
-- Boolean test no_diacritics, line 2265
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2265
Slice_From (Z, "ostaj");
when 141 =>
-- (, line 2269
-- Boolean test no_diacritics, line 2269
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2269
Slice_From (Z, "asta");
when 142 =>
-- (, line 2273
-- Boolean test no_diacritics, line 2273
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2273
Slice_From (Z, "ista");
when 143 =>
-- (, line 2277
-- Boolean test no_diacritics, line 2277
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2277
Slice_From (Z, "osta");
when 144 =>
-- (, line 2280
-- Boolean test no_diacritics, line 2280
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2280
Slice_From (Z, "ava");
when 145 =>
-- (, line 2283
-- Boolean test no_diacritics, line 2283
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2283
Slice_From (Z, "eva");
when 146 =>
-- (, line 2286
-- Boolean test no_diacritics, line 2286
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2286
Slice_From (Z, "iva");
when 147 =>
-- (, line 2289
-- Boolean test no_diacritics, line 2289
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2289
Slice_From (Z, "uva");
when 148 =>
-- (, line 2290
-- Boolean test no_diacritics, line 2290
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2290
Slice_From (Z, "ova");
when 149 =>
-- (, line 2292
-- Boolean test no_diacritics, line 2292
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2292
Slice_From (Z, "jeti");
when 150 =>
-- (, line 2294
-- Boolean test no_diacritics, line 2294
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2294
Slice_From (Z, "inj");
when 151 =>
-- (, line 2295
-- Boolean test no_diacritics, line 2295
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2295
Slice_From (Z, "ist");
when 152 =>
-- (, line 2298
-- Boolean test no_diacritics, line 2298
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2298
Slice_From (Z, "es");
when 153 =>
-- (, line 2301
-- Boolean test no_diacritics, line 2301
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2301
Slice_From (Z, "et");
when 154 =>
-- (, line 2304
-- Boolean test no_diacritics, line 2304
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2304
Slice_From (Z, "is");
when 155 =>
-- (, line 2310
-- Boolean test no_diacritics, line 2310
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2310
Slice_From (Z, "ir");
when 156 =>
-- (, line 2313
-- Boolean test no_diacritics, line 2313
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2313
Slice_From (Z, "ur");
when 157 =>
-- (, line 2315
-- Boolean test no_diacritics, line 2315
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2315
Slice_From (Z, "uj");
when 158 =>
-- (, line 2317
-- Boolean test no_diacritics, line 2317
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2317
Slice_From (Z, "ni");
when 159 =>
-- (, line 2321
-- Boolean test no_diacritics, line 2321
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2321
Slice_From (Z, "sn");
when 160 =>
-- (, line 2323
-- Boolean test no_diacritics, line 2323
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2323
Slice_From (Z, "ta");
when 161 =>
-- (, line 2327
-- Boolean test no_diacritics, line 2327
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2327
Slice_From (Z, "a");
when 162 =>
-- (, line 2331
-- Boolean test no_diacritics, line 2331
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2331
Slice_From (Z, "i");
when 163 =>
-- (, line 2332
-- Boolean test no_diacritics, line 2332
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2332
Slice_From (Z, "e");
when 164 =>
-- (, line 2335
-- Boolean test no_diacritics, line 2335
if not Z.B_No_diacritics then
Result := False;
return;
end if;
-- <-, line 2335
Slice_From (Z, "n");
when others =>
null;
end case;
Result := True;
end R_Step_2;
procedure R_Step_3 (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
begin
-- (, line 2339
Z.Ket := Z.C; -- [, line 2340
-- substring, line 2340
if Z.C <= Z.Lb or else Check_Among (Z, Z.C - 1, 3, 16#30a7a2#) then
Result := False;
return;
-- substring, line 2340
end if;
Find_Among_Backward (Z, A_3, Among_String, null, A);
if A = 0 then
Result := False;
return;
end if;
Z.Bra := Z.C; -- ], line 2340
-- call R1, line 2340
R_R1 (Z, Result);
if not Result then
Result := False;
return;
end if;
-- (, line 2366
-- <-, line 2366
Slice_From (Z, "");
Result := True;
end R_Step_3;
procedure Stem (Z : in out Context_Type; Result : out Boolean) is
C : Result_Index;
A : Integer;
v_4 : Char_Index;
v_5 : Char_Index;
v_6 : Char_Index;
begin
-- (, line 2371
-- do, line 2372
-- call cyr_to_lat, line 2372
R_Cyr_to_lat (Z, Result);
-- do, line 2373
-- call prelude, line 2373
R_Prelude (Z, Result);
-- do, line 2374
-- call mark_regions, line 2374
R_Mark_regions (Z, Result);
Z.Lb := Z.C; Z.C := Z.L; -- backwards, line 2375
-- (, line 2375
-- do, line 2376
v_4 := Z.L - Z.C;
-- call Step_1, line 2376
R_Step_1 (Z, Result);
Z.C := Z.L - v_4;
-- do, line 2377
v_5 := Z.L - Z.C;
-- or, line 2377
v_6 := Z.L - Z.C;
-- call Step_2, line 2377
R_Step_2 (Z, Result);
if not Result then
goto lab2;
end if;
goto lab1;
<<lab2>>
Z.C := Z.L - v_6;
-- call Step_3, line 2377
R_Step_3 (Z, Result);
if not Result then
goto lab0;
end if;
<<lab1>>
<<lab0>>
Z.C := Z.L - v_5;
Z.C := Z.Lb;
Result := True;
end Stem;
end Stemmer.Serbian;
|
src/link_to_cpp/LinkToCpp.asm | AaronWharton/custom-process | 0 | 245870 | ; assembly process (LinkToCpp.asm)
.586
.model flat,stdcall ; .model flat,C is also OK.
; C++ functions
displayMessage PROTO C
displayResult PROTO C, value:DWORD
LOOP_TIME = 10 ; loop time
.data
intVal DWORD ? ; get the value and save the result
.code
;--------------------------------------------------------------------------
SendMessage PROC C
;
; Input a number and display a multiplication table.
;--------------------------------------------------------------------------
INVOKE displayMessage
mov intVal,eax
mov ecx,LOOP_TIME
L1: push ecx
shl intVal,1 ; shift operation,equals *2
INVOKE displayResult,intVal
pop ecx
loop L1
ret
SendMessage ENDP
END |
programs/oeis/072/A072674.asm | neoneye/loda | 22 | 88233 | ; A072674: 3^n+2*2^n-3.
; 0,4,14,40,110,304,854,2440,7070,20704,61094,181240,539630,1610704,4815734,14414440,43177790,129402304,387944774,1163310040,3488881550,10464547504,31389448214,94159956040,282463090910,847355718304
mov $2,$0
add $0,1
mov $1,3
pow $1,$2
mov $3,2
pow $3,$0
add $1,$3
sub $1,3
mov $0,$1
|
spotify_util/toggle_repeat.applescript | n04ln/AYUNiS.nvim | 1 | 3449 | <filename>spotify_util/toggle_repeat.applescript
#!/usr/bin/osascript
tell application "Spotify"
if repeating then
set repeating to false
else
set repeating to true
end if
end tell
|
oeis/016/A016276.asm | neoneye/loda-programs | 11 | 17053 | ; A016276: Expansion of 1/((1-2x)(1-3x)(1-7x)).
; Submitted by <NAME>
; 1,12,103,786,5713,40656,286651,2012862,14109205,98822460,691932319,4844053578,33909961177,237374494824,1661635779907,11631493440534,81420583092829,569944468808148,3989612443394215
mov $1,1
mov $2,1
mov $3,2
lpb $0
sub $0,1
mul $1,7
mul $3,3
add $3,2
add $1,$3
mul $2,2
add $2,1
sub $1,$2
lpe
mov $0,$1
|
Week_10/14 - loope.asm | iamruveyda/KBU-Mikro | 1 | 166691 | .model small
.data
.code
.STARTUP
main proc
MOV AX,1000H ;
MOV DS,AX ;set data segment register
MOV [1686H],55H ;set memory related data
MOV [1684H],55H ;set memory related data
MOV [1682H],55H ;set memory related data
MOV [1680H],55H ;set memory related data
mov cx,200 ;set up the counter
mov si,1680H ;set up the pointer
back: mov ax,[si]
;pointed at by si
inc si ;increment the pointer
inc si ;increment the pointer
cmp ax,55H ;compare the 55h with mem location
loope back ;continue the process until cx=0 or
;zf=0. in other words exit if one
;location does not have 55h
endp
end main
.EXIT
END |
cards/bn5/ItemCards/136-E001 Mom's Allowance.asm | RockmanEXEZone/MMBN-Mod-Card-Kit | 10 | 176528 | .include "defaults_item.asm"
table_file_jp equ "exe5-utf8.tbl"
table_file_en equ "bn5-utf8.tbl"
game_code_len equ 3
game_code equ 0x4252424A // BRBJ
game_code_2 equ 0x42524245 // BRBE
game_code_3 equ 0x42524250 // BRBP
card_type equ 0
card_id equ 1
card_no equ "001"
card_sub equ "Item Card 001"
card_sub_x equ 62
card_desc_len equ 1
card_desc_1 equ "Mom's Allowance"
card_desc_2 equ ""
card_desc_3 equ ""
card_name_jp_full equ "ママからのおこづかい"
card_name_jp_game equ "ママからのおこづかい"
card_name_en_full equ "Mom's Allowance"
card_name_en_game equ "Mom's Allowance"
card_game_desc_jp_len equ 2
card_game_desc_jp_1 equ "ママからのおこづかい!"
card_game_desc_jp_2 equ "1000Zを手に入れた!"
card_game_desc_jp_3 equ ""
card_game_desc_en_len equ 2
card_game_desc_en_1 equ "Mom's allowance!"
card_game_desc_en_2 equ "Got 1000 Zennys!"
card_game_desc_en_3 equ "" |
RegoAntlr/RegoLexer.g4 | loicmiller/policy-verification | 0 | 7161 | lexer grammar RegoLexer;
/*
* Lexer Rules
*/
// Fragments for keywords
fragment A : ('A'|'a') ;
fragment S : ('S'|'s') ;
fragment D : ('D'|'d') ;
fragment E : ('E'|'e') ;
fragment F : ('F'|'f') ;
fragment U : ('U'|'u') ;
fragment L : ('L'|'l') ;
fragment T : ('T'|'t') ;
fragment I : ('I'|'i') ;
fragment M : ('M'|'m') ;
fragment P : ('P'|'p') ;
fragment O : ('O'|'o') ;
fragment R : ('R'|'r') ;
fragment C : ('C'|'c') ;
fragment K : ('K'|'k') ;
fragment G : ('G'|'g') ;
fragment N : ('N'|'n') ;
fragment W : ('W'|'w') ;
fragment H : ('H'|'h') ;
fragment CR : '\r' ;
fragment LF : '\n' ;
fragment ALPHA : ([a-zA-Z]) ;
fragment DIGIT : [0-9] ;
// Tokenize new line in this mode
LBRACE : '{' -> pushMode(PARSENEWLINE) ;
// Explicit tokens for non-combined grammar
LPAR : '(' ;
RPAR : ')' ;
LBRACK : '[' ;
RBRACK : ']' ;
ASSIGN : ':=' ;
UNIFY : '=' ;
COMMA : ',' ;
SEMICOLON : ';' ;
DOT : '.' ;
PIPE : '|' ;
EQUALS : '==' ;
DIFFERENT : '!=' ;
INF : '<' ;
SUP : '>' ;
INF_EQ : '<=' ;
SUP_EQ : '>=' ;
PLUS : '+' ;
MINUS : '-' ;
TIMES : '*' ;
SLASH : '/' ;
AMPERSAND : '&' ;
UNDERSCORE : '_' ;
BACKTICK : '`' ;
COLON : ':' ;
SET_OPEN : 'set(' ;
RAW_STR : '-`' ;
// Tokens
AS : A S ;
DEFAULT : D E F A U L T ;
ELSE : E L S E ;
IMPORT : I M P O R T ;
PACKAGE : P A C K A G E ;
NOT : N O T ;
WITH : W I T H ;
SOME : S O M E ;
TRUE : T R U E ;
FALSE : F A L S E ;
NULL : N U L L ;
NEWLINE : (CR? LF | CR)+ -> skip ;
COMMENT : '#' .*? CR? LF -> skip ;
STRING : '"' ~["]* '"' ;
NUMBER : '-'?('0'|[1-9][0-9]*)('.'[0-9]+)?([eE][+-]?[0-9]+)? ;
VARIABLE : ( ALPHA | UNDERSCORE ) ( ALPHA | DIGIT | UNDERSCORE )* ; // Added from var grammar rule
WHITESPACE : (' ' | '\t')+ -> skip ;
CHAR : [\u0000-\u007F] ;
ANY : . ; // This should not be matched
// Mode to parse newlines
mode PARSENEWLINE;
RBRACE : '}' -> popMode ;
// Explicit tokens for non-combined grammar
P_LBRACE : '{' -> type(LBRACE), pushMode(PARSENEWLINE) ; // Added for braces inside braces
P_LPAR : '(' -> type(LPAR) ;
P_RPAR : ')' -> type(RPAR) ;
P_LBRACK : '[' -> type(LBRACK) ;
P_RBRACK : ']' -> type(RBRACK) ;
P_ASSIGN : ':=' -> type(ASSIGN) ;
P_UNIFY : '=' -> type(UNIFY) ;
P_COMMA : ',' -> type(COMMA) ;
P_SEMICOLON : ';' -> type(SEMICOLON) ;
P_DOT : '.' -> type(DOT) ;
P_PIPE : '|' -> type(PIPE) ;
P_EQUALS : '==' -> type(EQUALS) ;
P_DIFFERENT : '!=' -> type(DIFFERENT) ;
P_INF : '<' -> type(INF) ;
P_SUP : '>' -> type(SUP) ;
P_INF_EQ : '<=' -> type(INF_EQ) ;
P_SUP_EQ : '>=' -> type(SUP_EQ) ;
P_PLUS : '+' -> type(PLUS) ;
P_MINUS : '-' -> type(MINUS) ;
P_TIMES : '*' -> type(TIMES) ;
P_SLASH : '/' -> type(SLASH) ;
P_AMPERSAND : '&' -> type(AMPERSAND) ;
P_UNDERSCORE : '_' -> type(UNDERSCORE) ;
P_BACKTICK : '`' -> type(BACKTICK) ;
P_COLON : ':' -> type(COLON) ;
P_SET_OPEN : 'set(' -> type(SET_OPEN) ;
P_RAW_STR : '-`' -> type(RAW_STR) ;
// Tokens
P_AS : A S -> type(AS) ;
P_DEFAULT : D E F A U L T -> type(DEFAULT) ;
P_ELSE : E L S E -> type(ELSE) ;
P_IMPORT : I M P O R T -> type(IMPORT) ;
P_PACKAGE : P A C K A G E -> type(PACKAGE) ;
P_NOT : N O T -> type(NOT) ;
P_WITH : W I T H -> type(WITH) ;
P_SOME : S O M E -> type(SOME) ;
P_TRUE : T R U E -> type(TRUE) ;
P_FALSE : F A L S E -> type(FALSE) ;
P_NULL : N U L L -> type(NULL) ;
P_NEWLINE : (CR? LF | CR)+ -> type(NEWLINE) ;
P_COMMENT : '#' .*? CR? LF -> skip ;
P_STRING : '"' ~["]* '"' -> type(STRING) ;
P_NUMBER : '-'?('0'|[1-9][0-9]*)('.'[0-9]+)?([eE][+-]?[0-9]+)? -> type(NUMBER) ;
P_VARIABLE : ( ALPHA | UNDERSCORE ) ( ALPHA | DIGIT | UNDERSCORE )* -> type(VARIABLE) ; // Added from var grammar rule
P_WHITESPACE : (' ' | '\t')+ -> skip ;
P_CHAR : [\u0000-\u007F] -> type(CHAR) ;
P_ANY : . -> type(ANY) ; // This should not be matched
|
src/FRP/LTL/ISet/Empty.agda | agda/agda-frp-ltl | 21 | 16507 | <filename>src/FRP/LTL/ISet/Empty.agda
open import Data.Product using ( _,_ )
open import Data.Empty using ( ⊥ )
open import FRP.LTL.ISet.Core using ( ISet ; [_] ; _,_ )
module FRP.LTL.ISet.Empty where
F : ISet
F = [ (λ i → ⊥) , (λ i j i~j → λ ()) , (λ i j i⊑j → λ ()) ]
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0x48.log_21829_1255.asm | ljhsiun2/medusa | 9 | 163027 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r8
push %rax
push %rdx
lea addresses_WC_ht+0x1e243, %r11
clflush (%r11)
add %rax, %rax
mov $0x6162636465666768, %rdx
movq %rdx, %xmm7
vmovups %ymm7, (%r11)
inc %r8
pop %rdx
pop %rax
pop %r8
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r8
push %rcx
push %rdi
// Faulty Load
lea addresses_US+0x15f43, %rcx
clflush (%rcx)
nop
nop
nop
nop
nop
cmp %r14, %r14
mov (%rcx), %r11d
lea oracles, %r14
and $0xff, %r11
shlq $12, %r11
mov (%r14,%r11,1), %r11
pop %rdi
pop %rcx
pop %r8
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 7, 'size': 32, 'same': False, 'NT': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
libsrc/_DEVELOPMENT/temp/sp1/zx/c/sdcc_ix/sp1_GetUpdateStruct_callee.asm | teknoplop/z88dk | 8 | 9319 | <filename>libsrc/_DEVELOPMENT/temp/sp1/zx/c/sdcc_ix/sp1_GetUpdateStruct_callee.asm
; struct sp1_update *sp1_GetUpdateStruct(uchar row, uchar col)
SECTION code_clib
SECTION code_temp_sp1
PUBLIC _sp1_GetUpdateStruct_callee
EXTERN asm_sp1_GetUpdateStruct
_sp1_GetUpdateStruct:
pop af
pop hl
pop de
push af
ld d,l
jp asm_sp1_GetUpdateStruct
|
library/fmGUI_ManageSecurity/fmGUI_ManageSecurity_AccessRecord_GetFieldPriv.applescript | NYHTC/applescript-fm-helper | 1 | 3787 | -- fmGUI_ManageSecurity_AccessRecord_GetFieldPriv({})
-- <NAME>, NYHTC
-- get the field-level access for the currently opened table of manage security
(*
HISTORY:
1.0 - 2017-07-06 ( eshagdar ):created
REQUIRES:
fmGUI_AppFrontMost
*)
on run
fmGUI_ManageSecurity_AccessRecord_GetFieldPriv({})
end run
--------------------
-- START OF CODE
--------------------
on fmGUI_ManageSecurity_AccessRecord_GetFieldPriv(prefs)
-- version 1.0
set defaultPrefs to {}
set prefs to prefs & defaultPrefs
try
fmGUI_AppFrontMost()
windowWaitUntil_FrontIS({windowName:"Custom Field Privileges"})
-- get lists of the name and privilege
tell application "System Events"
tell process "FileMaker Pro Advanced"
set nameList to name of static text 1 of every row of table 1 of scroll area 1 of window 1
set privList to name of static text 2 of every row of table 1 of scroll area 1 of window 1
end tell
end tell
-- now make a list of records
set fieldPrivList to {}
repeat with i from 1 to count of nameList
copy {fieldName:item i of nameList, fieldPriv:item i of privList} to end of fieldPrivList
end repeat
return fieldPrivList
on error errMsg number errNum
error "unable to fmGUI_ManageSecurity_AccessRecord_GetFieldPriv - " & errMsg number errNum
end try
end fmGUI_ManageSecurity_AccessRecord_GetFieldPriv
--------------------
-- END OF CODE
--------------------
on fmGUI_AppFrontMost()
tell application "htcLib" to fmGUI_AppFrontMost()
end fmGUI_AppFrontMost
on windowWaitUntil_FrontIS(prefs)
tell application "htcLib" to windowWaitUntil_FrontIS(prefs)
end windowWaitUntil_FrontIS
|
src/fot/LTC-PCF/Loop.agda | asr/fotc | 11 | 16529 | <filename>src/fot/LTC-PCF/Loop.agda
------------------------------------------------------------------------------
-- A looping (error) combinator
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module LTC-PCF.Loop where
open import LTC-PCF.Base
------------------------------------------------------------------------------
error : D
error = fix (λ f → f)
|
oeis/277/A277614.asm | neoneye/loda-programs | 11 | 92776 | <gh_stars>10-100
; A277614: a(n) is the coefficient of x^n/n! in exp(x + n*x^2/2).
; Submitted by <NAME>(s2)
; 1,1,3,10,73,426,4951,41308,658785,7149628,144963451,1937124696,47660873833,756536698360,21888570052623,402400189738576,13384439813823361,279666289640774928,10512823691028429235,246061359639756047008,10314843348672697017801,267328220273408530004896,12363686002049118477390343,351473836594567725961268160,17776996370247936310502612833,550002942283550733215994429376
mov $2,$0
mov $3,1
lpb $0
mul $4,$0
sub $0,1
mov $1,$3
mul $4,$2
add $3,$4
mov $4,$1
lpe
mov $0,$3
|
oeis/291/A291463.asm | neoneye/loda-programs | 11 | 6491 | <filename>oeis/291/A291463.asm
; A291463: a(n) is the product of n-th prime number with the distance to the next prime.
; Submitted by <NAME>
; 2,6,10,28,22,52,34,76,138,58,186,148,82,172,282,318,118,366,268,142,438,316,498,712,388,202,412,214,436,1582,508,786,274,1390,298,906,942,652,1002,1038,358,1810,382,772,394,2388,2532,892,454,916,1398,478,2410
mov $2,$0
add $0,1
seq $0,40 ; The prime numbers.
seq $2,40 ; The prime numbers.
sub $0,$2
mul $0,$2
|
ada/src/avtas/lmcp/avtas-lmcp-types.ads | joffreyhuguet/LmcpGen | 0 | 9904 | <reponame>joffreyhuguet/LmcpGen<gh_stars>0
with Interfaces; use Interfaces;
package avtas.lmcp.types is
-- C/C++ compatible integer types
type UInt16_t is new Interfaces.Unsigned_16;
type UInt32_t is new Interfaces.Unsigned_32;
type Int16_t is new Interfaces.Integer_16;
type Int32_t is new Interfaces.Integer_32;
type Int64_t is new Interfaces.Integer_64;
type Float_t is new Interfaces.IEEE_Float_32;
type Double_t is new Interfaces.IEEE_Float_64;
end avtas.lmcp.types;
|
agda/List/Permutation/Alternative.agda | bgbianchi/sorting | 6 | 14442 | <reponame>bgbianchi/sorting
module List.Permutation.Alternative (A : Set) where
open import Data.List
data _∼_ : List A → List A → Set where
∼refl : {xs : List A}
→ xs ∼ xs
∼trans : {xs ys zs : List A}
→ xs ∼ ys
→ ys ∼ zs
→ xs ∼ zs
∼head : {xs ys : List A}(x : A)
→ xs ∼ ys
→ (x ∷ xs) ∼ (x ∷ ys)
∼swap : {xs ys : List A}{x y : A}
→ (x ∷ y ∷ xs) ∼ ys
→ (y ∷ x ∷ xs) ∼ ys
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/varsize3_pkg1.ads | best08618/asylo | 7 | 20514 | <gh_stars>1-10
with Varsize3_Pkg2;
with Varsize3_Pkg3;
package Varsize3_Pkg1 is
type Arr is array (Positive range 1 .. Varsize3_Pkg2.Last_Index) of Boolean;
package My_G is new Varsize3_Pkg3 (Arr);
type Object is new My_G.Object;
end Varsize3_Pkg1;
|
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/polygon.lzh/polygon/sample1/Mrotmat.asm | prismotizm/gigaleak | 0 | 165321 | Name: Mrotmat.asm
Type: file
Size: 7793
Last-Modified: '1992-09-24T02:23:51Z'
SHA-1: D913F1DE189433C08D61CED79DAA6BE4E0E6F476
Description: null
|
src/fot/GroupTheory/PropertiesATP.agda | asr/fotc | 11 | 10616 | ------------------------------------------------------------------------------
-- Group theory properties
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module GroupTheory.PropertiesATP where
open import GroupTheory.Base
------------------------------------------------------------------------------
postulate leftCancellation : ∀ {a b c} → a · b ≡ a · c → b ≡ c
{-# ATP prove leftCancellation #-}
postulate rightIdentity : ∀ a → a · ε ≡ a
{-# ATP prove rightIdentity #-}
postulate rightInverse : ∀ a → a · a ⁻¹ ≡ ε
{-# ATP prove rightInverse #-}
postulate rightCancellation : ∀ {a b c} → b · a ≡ c · a → b ≡ c
{-# ATP prove rightCancellation #-}
postulate y≡x⁻¹[xy] : ∀ a b → b ≡ a ⁻¹ · (a · b)
{-# ATP prove y≡x⁻¹[xy] #-}
postulate x≡[xy]y⁻¹ : ∀ a b → a ≡ (a · b) · b ⁻¹
{-# ATP prove x≡[xy]y⁻¹ #-}
postulate rightIdentityUnique : ∀ r → (∀ a → a · r ≡ a) → r ≡ ε
{-# ATP prove rightIdentityUnique #-}
-- A more appropiate version to be used in the proofs.
postulate rightIdentityUnique' : ∀ a r → a · r ≡ a → r ≡ ε
{-# ATP prove rightIdentityUnique' #-}
postulate leftIdentityUnique : ∀ l → (∀ a → l · a ≡ a) → l ≡ ε
{-# ATP prove leftIdentityUnique #-}
-- A more appropiate version to be used in the proofs.
postulate leftIdentityUnique' : ∀ a l → l · a ≡ a → l ≡ ε
{-# ATP prove leftIdentityUnique' #-}
postulate
rightInverseUnique : ∀ {a} → ∃[ r ] (a · r ≡ ε) ∧ (∀ r' → a · r' ≡ ε → r ≡ r')
{-# ATP prove rightInverseUnique #-}
-- A more appropiate version to be used in the proofs.
postulate rightInverseUnique' : ∀ {a r} → a · r ≡ ε → a ⁻¹ ≡ r
{-# ATP prove rightInverseUnique' #-}
postulate
leftInverseUnique : ∀ {a} → ∃[ l ] (l · a ≡ ε) ∧ (∀ l' → l' · a ≡ ε → l ≡ l')
{-# ATP prove leftInverseUnique #-}
-- A more appropiate version to be used in the proofs.
postulate leftInverseUnique' : ∀ {a l} → l · a ≡ ε → a ⁻¹ ≡ l
{-# ATP prove leftInverseUnique' #-}
postulate ⁻¹-involutive : ∀ a → a ⁻¹ ⁻¹ ≡ a
{-# ATP prove ⁻¹-involutive #-}
postulate identityInverse : ε ⁻¹ ≡ ε
{-# ATP prove identityInverse #-}
postulate inverseDistributive : ∀ a b → (a · b) ⁻¹ ≡ b ⁻¹ · a ⁻¹
{-# ATP prove inverseDistributive #-}
-- The equation xa = b has an unique solution.
postulate
xa≡b-uniqueSolution : ∀ a b → ∃[ x ] (x · a ≡ b) ∧ (∀ x' → x' · a ≡ b → x ≡ x')
{-# ATP prove xa≡b-uniqueSolution #-}
-- The equation ax = b has an unique solution.
postulate
ax≡b-uniqueSolution : ∀ a b → ∃[ x ] (a · x ≡ b) ∧ (∀ x' → a · x' ≡ b → x ≡ x')
{-# ATP prove ax≡b-uniqueSolution #-}
-- If the square of every element is the identity, the system is
-- commutative. From: TPTP 6.4.0 problem GRP/GRP001-2.p.
postulate x²≡ε→comm : (∀ a → a · a ≡ ε) → ∀ {b c d} → b · c ≡ d → c · b ≡ d
{-# ATP prove x²≡ε→comm #-}
|
agda-stdlib-0.9/src/Relation/Binary/PropositionalEquality.agda | qwe2/try-agda | 1 | 16140 | <gh_stars>1-10
------------------------------------------------------------------------
-- The Agda standard library
--
-- Propositional (intensional) equality
------------------------------------------------------------------------
module Relation.Binary.PropositionalEquality where
open import Function
open import Function.Equality using (Π; _⟶_; ≡-setoid)
open import Data.Product
open import Data.Unit.Core
open import Level
open import Relation.Binary
import Relation.Binary.Indexed as I
open import Relation.Binary.Consequences
open import Relation.Binary.HeterogeneousEquality.Core as H using (_≅_)
-- Some of the definitions can be found in the following modules:
open import Relation.Binary.Core public using (_≡_; refl; _≢_)
open import Relation.Binary.PropositionalEquality.Core public
------------------------------------------------------------------------
-- Some properties
subst₂ : ∀ {a b p} {A : Set a} {B : Set b} (P : A → B → Set p)
{x₁ x₂ y₁ y₂} → x₁ ≡ x₂ → y₁ ≡ y₂ → P x₁ y₁ → P x₂ y₂
subst₂ P refl refl p = p
cong : ∀ {a b} {A : Set a} {B : Set b}
(f : A → B) {x y} → x ≡ y → f x ≡ f y
cong f refl = refl
cong-app : ∀ {a b} {A : Set a} {B : A → Set b} {f g : (x : A) → B x} →
f ≡ g → (x : A) → f x ≡ g x
cong-app refl x = refl
cong₂ : ∀ {a b c} {A : Set a} {B : Set b} {C : Set c}
(f : A → B → C) {x y u v} → x ≡ y → u ≡ v → f x u ≡ f y v
cong₂ f refl refl = refl
proof-irrelevance : ∀ {a} {A : Set a} {x y : A} (p q : x ≡ y) → p ≡ q
proof-irrelevance refl refl = refl
setoid : ∀ {a} → Set a → Setoid _ _
setoid A = record
{ Carrier = A
; _≈_ = _≡_
; isEquivalence = isEquivalence
}
decSetoid : ∀ {a} {A : Set a} → Decidable (_≡_ {A = A}) → DecSetoid _ _
decSetoid dec = record
{ _≈_ = _≡_
; isDecEquivalence = record
{ isEquivalence = isEquivalence
; _≟_ = dec
}
}
isPreorder : ∀ {a} {A : Set a} → IsPreorder {A = A} _≡_ _≡_
isPreorder = record
{ isEquivalence = isEquivalence
; reflexive = id
; trans = trans
}
preorder : ∀ {a} → Set a → Preorder _ _ _
preorder A = record
{ Carrier = A
; _≈_ = _≡_
; _∼_ = _≡_
; isPreorder = isPreorder
}
------------------------------------------------------------------------
-- Pointwise equality
infix 4 _≗_
_→-setoid_ : ∀ {a b} (A : Set a) (B : Set b) → Setoid _ _
A →-setoid B = ≡-setoid A (Setoid.indexedSetoid (setoid B))
_≗_ : ∀ {a b} {A : Set a} {B : Set b} (f g : A → B) → Set _
_≗_ {A = A} {B} = Setoid._≈_ (A →-setoid B)
:→-to-Π : ∀ {a b₁ b₂} {A : Set a} {B : I.Setoid _ b₁ b₂} →
((x : A) → I.Setoid.Carrier B x) → Π (setoid A) B
:→-to-Π {B = B} f = record { _⟨$⟩_ = f; cong = cong′ }
where
open I.Setoid B using (_≈_)
cong′ : ∀ {x y} → x ≡ y → f x ≈ f y
cong′ refl = I.Setoid.refl B
→-to-⟶ : ∀ {a b₁ b₂} {A : Set a} {B : Setoid b₁ b₂} →
(A → Setoid.Carrier B) → setoid A ⟶ B
→-to-⟶ = :→-to-Π
------------------------------------------------------------------------
-- The old inspect idiom
-- The old inspect idiom has been deprecated, and may be removed in
-- the future. Use inspect on steroids instead.
module Deprecated-inspect where
-- The inspect idiom can be used when you want to pattern match on
-- the result r of some expression e, and you also need to
-- "remember" that r ≡ e.
-- The inspect idiom has a problem: sometimes you can only pattern
-- match on the p part of p with-≡ eq if you also pattern match on
-- the eq part, and then you no longer have access to the equality.
-- Inspect on steroids solves this problem.
data Inspect {a} {A : Set a} (x : A) : Set a where
_with-≡_ : (y : A) (eq : x ≡ y) → Inspect x
inspect : ∀ {a} {A : Set a} (x : A) → Inspect x
inspect x = x with-≡ refl
-- Example usage:
-- f x y with inspect (g x)
-- f x y | c z with-≡ eq = ...
------------------------------------------------------------------------
-- Inspect on steroids
-- Inspect on steroids can be used when you want to pattern match on
-- the result r of some expression e, and you also need to "remember"
-- that r ≡ e.
data Reveal_is_ {a} {A : Set a} (x : Hidden A) (y : A) : Set a where
[_] : (eq : reveal x ≡ y) → Reveal x is y
inspect : ∀ {a b} {A : Set a} {B : A → Set b}
(f : (x : A) → B x) (x : A) → Reveal (hide f x) is (f x)
inspect f x = [ refl ]
-- Example usage:
-- f x y with g x | inspect g x
-- f x y | c z | [ eq ] = ...
------------------------------------------------------------------------
-- Convenient syntax for equational reasoning
import Relation.Binary.EqReasoning as EqR
-- Relation.Binary.EqReasoning is more convenient to use with _≡_ if
-- the combinators take the type argument (a) as a hidden argument,
-- instead of being locked to a fixed type at module instantiation
-- time.
module ≡-Reasoning where
module _ {a} {A : Set a} where
open EqR (setoid A) public
hiding (_≡⟨_⟩_) renaming (_≈⟨_⟩_ to _≡⟨_⟩_)
infixr 2 _≅⟨_⟩_
_≅⟨_⟩_ : ∀ {a} {A : Set a} (x : A) {y z : A} →
x ≅ y → y IsRelatedTo z → x IsRelatedTo z
_ ≅⟨ x≅y ⟩ y≡z = _ ≡⟨ H.≅-to-≡ x≅y ⟩ y≡z
------------------------------------------------------------------------
-- Functional extensionality
-- If _≡_ were extensional, then the following statement could be
-- proved.
Extensionality : (a b : Level) → Set _
Extensionality a b =
{A : Set a} {B : A → Set b} {f g : (x : A) → B x} →
(∀ x → f x ≡ g x) → f ≡ g
-- If extensionality holds for a given universe level, then it also
-- holds for lower ones.
extensionality-for-lower-levels :
∀ {a₁ b₁} a₂ b₂ →
Extensionality (a₁ ⊔ a₂) (b₁ ⊔ b₂) → Extensionality a₁ b₁
extensionality-for-lower-levels a₂ b₂ ext f≡g =
cong (λ h → lower ∘ h ∘ lift) $
ext (cong (lift {ℓ = b₂}) ∘ f≡g ∘ lower {ℓ = a₂})
-- Functional extensionality implies a form of extensionality for
-- Π-types.
∀-extensionality :
∀ {a b} →
Extensionality a (suc b) →
{A : Set a} (B₁ B₂ : A → Set b) →
(∀ x → B₁ x ≡ B₂ x) → (∀ x → B₁ x) ≡ (∀ x → B₂ x)
∀-extensionality ext B₁ B₂ B₁≡B₂ with ext B₁≡B₂
∀-extensionality ext B .B B₁≡B₂ | refl = refl
|
src/geste-maths.adb | Fabien-Chouteau/GESTE | 13 | 1475 | ------------------------------------------------------------------------------
-- --
-- GESTE --
-- --
-- Copyright (C) 2018 <NAME> --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Interfaces; use Interfaces;
with GESTE.Maths_Tables; use GESTE.Maths_Tables;
package body GESTE.Maths is
---------
-- Sin --
---------
function Sin
(A : Value)
return Value
is
begin
return Sine_Table (Unsigned_32 (Integer (A * Sine_Alpha) mod (2**30)) and (Sine_Table_Size - 1));
end Sin;
---------
-- Cos --
---------
function Cos
(A : Value)
return Value
is
begin
return Cos_Table (Unsigned_32 (Integer (A * Cos_Alpha) mod (2**30)) and (Cos_Table_Size - 1));
end Cos;
----------------
-- To_Degrees --
----------------
function To_Degrees (A : Value) return Value
is (Value (Value (A * 360.0) / Value (Pi * 2.0)));
---------
-- To_ --
---------
function To_Rad (A : Value) return Value
is (Value (A * Value (Pi * 2.0)) / Value (360.0));
---------
-- "-" --
---------
function "-" (V : Vect) return Vect
is (-V.X, -V.Y);
---------
-- "*" --
---------
function "*" (V : Vect; F : Value) return Vect
is (V.X * F, V.Y * F);
---------
-- "*" --
---------
function "*" (F : Value; V : Vect) return Vect
is (V.X * F, V.Y * F);
---------
-- "+" --
---------
function "+" (V : Vect; F : Value) return Vect
is (V.X + F, V.Y + F);
---------
-- "+" --
---------
function "+" (F : Value; V : Vect) return Vect
is (V.X + F, V.Y + F);
---------
-- "+" --
---------
function "+" (V1, V2 : Vect) return Vect
is ((V1.X + V2.X, V1.Y + V2.Y));
----------
-- Sqrt --
----------
function Sqrt (V : Value) return Value is
A : Value;
begin
if V <= 0.0 then
return -1.0;
elsif V = 1.0 then
return 1.0;
end if;
A := V / 2;
for K in 1 .. Fractional_Bits loop
if A = 0.0 then
return 0.0;
end if;
A := (A + V / A) / 2.0;
end loop;
return A;
end Sqrt;
---------------
-- Magnitude --
---------------
function Magnitude (V : Vect) return Value
is (Sqrt (V.X * V.X + V.Y * V.Y));
end GESTE.Maths;
|
Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca_notsx.log_9_3.asm | ljhsiun2/medusa | 9 | 171911 | <filename>Transynther/x86/_processed/US/_zr_/i7-7700_9_0xca_notsx.log_9_3.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r15
push %r8
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x229e, %rsi
lea addresses_normal_ht+0x2baa, %rdi
nop
nop
nop
nop
and %rax, %rax
mov $60, %rcx
rep movsw
nop
nop
nop
sub $50888, %r15
lea addresses_UC_ht+0x1c06e, %rax
nop
and $3144, %rdx
mov (%rax), %ecx
nop
nop
nop
cmp $54768, %rsi
lea addresses_normal_ht+0x1161e, %rsi
lea addresses_WT_ht+0xa6de, %rdi
nop
nop
nop
and %r10, %r10
mov $63, %rcx
rep movsq
nop
nop
nop
nop
nop
sub $19041, %rdx
lea addresses_A_ht+0x1d15e, %rsi
lea addresses_D_ht+0xf61e, %rdi
nop
nop
xor $64825, %r8
mov $38, %rcx
rep movsb
nop
nop
nop
xor $55073, %r8
lea addresses_WT_ht+0x19a1e, %r10
nop
nop
inc %rsi
mov (%r10), %di
inc %rdi
lea addresses_UC_ht+0xd90e, %rsi
lea addresses_WC_ht+0x17e87, %rdi
nop
nop
nop
nop
nop
xor $42579, %r10
mov $6, %rcx
rep movsw
nop
nop
dec %r8
lea addresses_WC_ht+0x15a70, %rsi
lea addresses_A_ht+0x173de, %rdi
nop
add $28120, %r8
mov $66, %rcx
rep movsw
nop
nop
cmp %rsi, %rsi
lea addresses_UC_ht+0x451e, %rsi
cmp %r10, %r10
movups (%rsi), %xmm2
vpextrq $1, %xmm2, %r8
nop
dec %r8
lea addresses_normal_ht+0x7ea8, %rsi
lea addresses_normal_ht+0x1da1e, %rdi
nop
nop
nop
sub $32863, %r15
mov $25, %rcx
rep movsl
nop
and %rsi, %rsi
lea addresses_A_ht+0xeb9e, %r8
inc %r10
mov $0x6162636465666768, %rcx
movq %rcx, (%r8)
nop
nop
nop
sub $44433, %rcx
lea addresses_WC_ht+0x1ae1e, %rsi
lea addresses_normal_ht+0x3d1e, %rdi
nop
nop
nop
nop
nop
add $14487, %rdx
mov $70, %rcx
rep movsl
nop
nop
nop
nop
xor $53771, %rax
lea addresses_normal_ht+0x1da1e, %rdx
nop
nop
nop
xor $20205, %r8
movups (%rdx), %xmm3
vpextrq $0, %xmm3, %r15
nop
nop
nop
nop
sub %r15, %r15
lea addresses_normal_ht+0x1e5e, %rcx
nop
and %rdi, %rdi
movb (%rcx), %r8b
nop
nop
nop
nop
add $33853, %rsi
lea addresses_UC_ht+0x19c96, %rsi
lea addresses_WT_ht+0x3e1e, %rdi
and %rdx, %rdx
mov $101, %rcx
rep movsl
nop
nop
dec %r8
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r15
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r8
push %r9
push %rbp
push %rbx
push %rdx
// Store
lea addresses_D+0x18a1e, %rbx
nop
nop
nop
nop
nop
xor $53692, %rbp
movb $0x51, (%rbx)
inc %rbp
// Faulty Load
lea addresses_US+0x17e1e, %rbp
nop
nop
nop
inc %r8
mov (%rbp), %dx
lea oracles, %r10
and $0xff, %rdx
shlq $12, %rdx
mov (%r10,%rdx,1), %rdx
pop %rdx
pop %rbx
pop %rbp
pop %r9
pop %r8
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 10, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_US'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 0, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3, 'same': True, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 10, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 0, 'same': True, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 0, 'same': True, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 5, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 7, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'00': 9}
00 00 00 00 00 00 00 00 00
*/
|
Transynther/x86/_processed/US/_ht_/i9-9900K_12_0xca_notsx.log_4_1578.asm | ljhsiun2/medusa | 9 | 16238 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x1df36, %rsi
lea addresses_D_ht+0x15d16, %rdi
nop
nop
and %rdx, %rdx
mov $20, %rcx
rep movsb
nop
nop
inc %r12
lea addresses_A_ht+0x8d7a, %r9
cmp $42967, %r12
mov $0x6162636465666768, %rdx
movq %rdx, %xmm2
vmovups %ymm2, (%r9)
nop
nop
inc %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %rbx
push %rcx
push %rdi
// Faulty Load
lea addresses_US+0x162b6, %r13
nop
nop
nop
dec %r10
vmovups (%r13), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %rbx
lea oracles, %rcx
and $0xff, %rbx
shlq $12, %rbx
mov (%rcx,%rbx,1), %rbx
pop %rdi
pop %rcx
pop %rbx
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2}}
{'46': 4}
46 46 46 46
*/
|
dictionary_package.adb | ddugovic/words | 4 | 22940 | <filename>dictionary_package.adb<gh_stars>1-10
with STRINGS_PACKAGE; use STRINGS_PACKAGE;
with INFLECTIONS_PACKAGE; use INFLECTIONS_PACKAGE;
pragma ELABORATE(INFLECTIONS_PACKAGE);
package body DICTIONARY_PACKAGE is
use STEM_KEY_TYPE_IO;
use TEXT_IO;
MNPC_IO_DEFAULT_WIDTH : constant NATURAL := 6;
NUMERAL_VALUE_TYPE_IO_DEFAULT_WIDTH : constant NATURAL := 5;
KIND_ENTRY_IO_DEFAULT_WIDTH : constant NATURAL := VERB_KIND_TYPE_IO.DEFAULT_WIDTH;
--PART_WIDTH : NATURAL;
function NUMBER_OF_STEMS(P : PART_OF_SPEECH_TYPE) return STEM_KEY_TYPE is
begin
case P is
when N => return 2;
when PRON => return 2;
when PACK => return 2;
when ADJ => return 4;
when NUM => return 4;
when ADV => return 3;
when V => return 4;
when VPAR => return 0;
when SUPINE => return 0;
when PREP => return 1;
when CONJ => return 1;
when INTERJ => return 1;
when others => return 0;
end case;
end NUMBER_OF_STEMS;
package body PARSE_RECORD_IO is
use TEXT_IO;
use INFLECTION_RECORD_IO;
use DICTIONARY_KIND_IO;
use MNPC_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in TEXT_IO.FILE_TYPE; PR: out PARSE_RECORD) is
begin
GET(F, PR.STEM);
GET(F, SPACER);
GET(F, PR.IR);
GET(F, SPACER);
GET(F, PR.D_K);
GET(F, SPACER);
GET(F, PR.MNPC);
end GET;
procedure GET(PR : out PARSE_RECORD) is
begin
GET(PR.STEM);
GET(SPACER);
GET(PR.IR);
GET(SPACER);
GET(PR.D_K);
GET(SPACER);
GET(PR.MNPC);
end GET;
procedure PUT(F : in TEXT_IO.FILE_TYPE; PR : in PARSE_RECORD) is
begin
PUT(F, PR.STEM);
PUT(F, ' ');
PUT(F, PR.IR);
PUT(F, ' ');
PUT(F, PR.D_K);
PUT(F, ' ');
PUT(F, PR.MNPC);
end PUT;
procedure PUT(PR : in PARSE_RECORD) is
begin
TEXT_IO.PUT(PR.STEM);
TEXT_IO.PUT(' ');
INFLECTION_RECORD_IO.PUT(PR.IR);
TEXT_IO.PUT(' ');
DICTIONARY_KIND_IO.PUT(PR.D_K);
TEXT_IO.PUT(' ');
MNPC_IO.PUT(PR.MNPC);
end PUT;
procedure GET(S : in STRING; PR : out PARSE_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
STEM_TYPE_IO.GET(S, PR.STEM, L);
L := L + 1;
GET(S(L+1..S'LAST), PR.IR, L);
L := L + 1;
GET(S(L+1..S'LAST), PR.D_K, L);
L := L + 1;
GET(S(L+1..S'LAST), PR.MNPC, LAST);
end GET;
procedure PUT(S : out STRING; PR : in PARSE_RECORD) is
L : INTEGER := 0;
M : INTEGER := 0;
begin
M := L + MAX_STEM_SIZE;
S(L+1..M) := PR.STEM;
L := M + 1;
S(L) := ' ';
M := L + INFLECTION_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), PR.IR);
L := M + 1;
S(L) := ' ';
M := L + DICTIONARY_KIND_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), PR.D_K);
L := M + 1;
S(L) := ' ';
M := L + MNPC_IO_DEFAULT_WIDTH;
PUT(S(L+1..M), PR.MNPC);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end PARSE_RECORD_IO;
package body NOUN_ENTRY_IO is
use DECN_RECORD_IO;
use GENDER_TYPE_IO;
use NOUN_KIND_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; N : out NOUN_ENTRY) is
begin
GET(F, N.DECL);
GET(F, SPACER);
GET(F, N.GENDER);
GET(F, SPACER);
GET(F, N.KIND);
end GET;
procedure GET(N : out NOUN_ENTRY) is
begin
GET(N.DECL);
GET(SPACER);
GET(N.GENDER);
GET(SPACER);
GET(N.KIND);
end GET;
procedure PUT(F : in FILE_TYPE; N : in NOUN_ENTRY) is
begin
PUT(F, N.DECL);
PUT(F, ' ');
PUT(F, N.GENDER);
PUT(F, ' ');
PUT(F, N.KIND);
end PUT;
procedure PUT(N : in NOUN_ENTRY) is
begin
PUT(N.DECL);
PUT(' ');
PUT(N.GENDER);
PUT(' ');
PUT(N.KIND);
end PUT;
procedure GET(S : in STRING; N : out NOUN_ENTRY; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), N.DECL, L);
L := L + 1;
GET(S(L+1..S'LAST), N.GENDER, L);
L := L + 1;
GET(S(L+1..S'LAST), N.KIND, LAST);
end GET;
procedure PUT(S : out STRING; N : in NOUN_ENTRY) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + DECN_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), N.DECL);
L := M + 1;
S(L) := ' ';
M := L + GENDER_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), N.GENDER);
L := M + 1;
S(L) := ' ';
M := L + NOUN_KIND_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), N.KIND);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end NOUN_ENTRY_IO;
package body PRONOUN_ENTRY_IO is
use DECN_RECORD_IO;
use PRONOUN_KIND_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; P : out PRONOUN_ENTRY) is
begin
GET(F, P.DECL);
GET(F, SPACER);
GET(F, P.KIND);
end GET;
procedure GET(P : out PRONOUN_ENTRY) is
begin
GET(P.DECL);
GET(SPACER);
GET(P.KIND);
end GET;
procedure PUT(F : in FILE_TYPE; P : in PRONOUN_ENTRY) is
begin
PUT(F, P.DECL);
PUT(F, ' ');
PUT(F, P.KIND);
end PUT;
procedure PUT(P : in PRONOUN_ENTRY) is
begin
PUT(P.DECL);
PUT(' ');
PUT(P.KIND);
end PUT;
procedure GET(S : in STRING; P : out PRONOUN_ENTRY; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), P.DECL, L);
L := L + 1;
GET(S(L+1..S'LAST), P.KIND, LAST);
end GET;
procedure PUT(S : out STRING; P : in PRONOUN_ENTRY) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + DECN_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.DECL);
L := M + 1;
S(L) := ' ';
M := L + PRONOUN_KIND_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.KIND);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end PRONOUN_ENTRY_IO;
package body PROPACK_ENTRY_IO is
use DECN_RECORD_IO;
use PRONOUN_KIND_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; P : out PROPACK_ENTRY) is
begin
GET(F, P.DECL);
GET(F, SPACER);
GET(F, P.KIND);
end GET;
procedure GET(P : out PROPACK_ENTRY) is
begin
GET(P.DECL);
GET(SPACER);
GET(P.KIND);
end GET;
procedure PUT(F : in FILE_TYPE; P : in PROPACK_ENTRY) is
begin
PUT(F, P.DECL);
PUT(F, ' ');
PUT(F, P.KIND);
end PUT;
procedure PUT(P : in PROPACK_ENTRY) is
begin
PUT(P.DECL);
PUT(' ');
PUT(P.KIND);
end PUT;
procedure GET(S : in STRING; P : out PROPACK_ENTRY; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), P.DECL, L);
L := L + 1;
GET(S(L+1..S'LAST), P.KIND, LAST);
end GET;
procedure PUT(S : out STRING; P : in PROPACK_ENTRY) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + DECN_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.DECL);
L := M + 1;
S(L) := ' ';
M := L + PRONOUN_KIND_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.KIND);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end PROPACK_ENTRY_IO;
package body ADJECTIVE_ENTRY_IO is
use DECN_RECORD_IO;
use GENDER_TYPE_IO;
use CASE_TYPE_IO;
use NUMBER_TYPE_IO;
use COMPARISON_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; A : out ADJECTIVE_ENTRY) is
begin
GET(F, A.DECL);
GET(F, SPACER);
GET(F, A.CO);
end GET;
procedure GET(A : out ADJECTIVE_ENTRY) is
begin
GET(A.DECL);
GET(SPACER);
GET(A.CO);
end GET;
procedure PUT(F : in FILE_TYPE; A : in ADJECTIVE_ENTRY) is
begin
PUT(F, A.DECL);
PUT(F, ' ');
PUT(F, A.CO);
end PUT;
procedure PUT(A : in ADJECTIVE_ENTRY) is
begin
PUT(A.DECL);
PUT(' ');
PUT(A.CO);
end PUT;
procedure GET(S : in STRING; A : out ADJECTIVE_ENTRY; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), A.DECL, L);
L := L + 1;
GET(S(L+1..S'LAST), A.CO, LAST);
end GET;
procedure PUT(S : out STRING; A : in ADJECTIVE_ENTRY) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + DECN_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), A.DECL);
L := M + 1;
S(L) := ' ';
M := L + COMPARISON_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), A.CO);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end ADJECTIVE_ENTRY_IO;
package body NUMERAL_ENTRY_IO is
use DECN_RECORD_IO;
use NUMERAL_SORT_TYPE_IO;
use INFLECTIONS_PACKAGE.INTEGER_IO;
SPACER : CHARACTER := ' ';
NUM_OUT_SIZE : constant := 5; -- Set in spec !!!!!!!!!!!!!!!!!!!!!!!!!
procedure GET(F : in FILE_TYPE; NUM : out NUMERAL_ENTRY) is
begin
GET(F, NUM.DECL);
GET(F, SPACER);
GET(F, NUM.SORT);
GET(F, SPACER);
GET(F, NUM.VALUE);
end GET;
procedure GET(NUM : out NUMERAL_ENTRY) is
begin
GET(NUM.DECL);
GET(SPACER);
GET(NUM.SORT);
GET(SPACER);
GET(NUM.VALUE);
end GET;
procedure PUT(F : in FILE_TYPE; NUM : in NUMERAL_ENTRY) is
begin
PUT(F, NUM.DECL);
PUT(F, ' ');
PUT(F, NUM.SORT);
PUT(F, ' ');
PUT(F, NUM.VALUE, NUM_OUT_SIZE);
end PUT;
procedure PUT(NUM : in NUMERAL_ENTRY) is
begin
PUT(NUM.DECL);
PUT(' ');
PUT(NUM.SORT);
PUT(' ');
PUT(NUM.VALUE, NUM_OUT_SIZE);
end PUT;
procedure GET(S : in STRING; NUM : out NUMERAL_ENTRY; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
--TEXT_IO.PUT("+1");
GET(S(L+1..S'LAST), NUM.DECL, L);
--TEXT_IO.PUT("+2");
L := L + 1;
GET(S(L+1..S'LAST), NUM.SORT, L);
--TEXT_IO.PUT("+3");
L := L + 1;
GET(S(L+1..S'LAST), NUM.VALUE, LAST);
--TEXT_IO.PUT("+4");
end GET;
procedure PUT(S : out STRING; NUM : in NUMERAL_ENTRY) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + DECN_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), NUM.DECL);
L := M + 1;
S(L) := ' ';
M := L + NUMERAL_SORT_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), NUM.SORT);
L := M + 1;
S(L) := ' ';
--M := L + NUMERAL_VALUE_TYPE_IO.DEFAULT_WIDTH;
M := L + NUM_OUT_SIZE;
PUT(S(L+1..M), NUM.VALUE);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end NUMERAL_ENTRY_IO;
package body ADVERB_ENTRY_IO is
use COMPARISON_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; A : out ADVERB_ENTRY) is
begin
GET(F, A.CO);
end GET;
procedure GET(A : out ADVERB_ENTRY) is
begin
GET(A.CO);
end GET;
procedure PUT(F : in FILE_TYPE; A : in ADVERB_ENTRY) is
begin
PUT(F, A.CO);
end PUT;
procedure PUT(A : in ADVERB_ENTRY) is
begin
PUT(A.CO);
end PUT;
procedure GET(S : in STRING; A : out ADVERB_ENTRY; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), A.CO, LAST);
end GET;
procedure PUT(S : out STRING; A : in ADVERB_ENTRY) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + COMPARISON_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), A.CO);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end ADVERB_ENTRY_IO;
package body VERB_ENTRY_IO is
use DECN_RECORD_IO;
use VERB_KIND_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; V : out VERB_ENTRY) is
begin
GET(F, V.CON);
GET(F, SPACER);
GET(F, V.KIND);
end GET;
procedure GET(V : out VERB_ENTRY) is
begin
GET(V.CON);
GET(SPACER);
GET(V.KIND);
end GET;
procedure PUT(F : in FILE_TYPE; V : in VERB_ENTRY) is
begin
PUT(F, V.CON);
PUT(F, ' ');
PUT(F, V.KIND);
end PUT;
procedure PUT(V : in VERB_ENTRY) is
begin
PUT(V.CON);
PUT(' ');
PUT(V.KIND);
end PUT;
procedure GET(S : in STRING; V : out VERB_ENTRY; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), V.CON, L);
L := L + 1;
GET(S(L+1..S'LAST), V.KIND, LAST);
end GET;
procedure PUT(S : out STRING; V : in VERB_ENTRY) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + DECN_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), V.CON);
L := M + 1;
S(L) := ' ';
M := L + VERB_KIND_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), V.KIND);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end VERB_ENTRY_IO;
package body PREPOSITION_ENTRY_IO is
use CASE_TYPE_IO;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; P : out PREPOSITION_ENTRY) is
begin
GET(F, P.OBJ);
end GET;
procedure GET(P : out PREPOSITION_ENTRY) is
begin
GET(P.OBJ);
end GET;
procedure PUT(F : in FILE_TYPE; P : in PREPOSITION_ENTRY) is
begin
PUT(F, P.OBJ);
end PUT;
procedure PUT(P : in PREPOSITION_ENTRY) is
begin
PUT(P.OBJ);
end PUT;
procedure GET(S : in STRING; P : out PREPOSITION_ENTRY; LAST : out INTEGER) is
begin
GET(S, P.OBJ, LAST);
end GET;
procedure PUT(S : out STRING; P : in PREPOSITION_ENTRY) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + CASE_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.OBJ);
S(M+1..S'LAST) := (others => ' ');
end PUT;
end PREPOSITION_ENTRY_IO;
package body CONJUNCTION_ENTRY_IO is
NULL_CONJUNCTION_ENTRY : CONJUNCTION_ENTRY;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; C : out CONJUNCTION_ENTRY) is
begin
C := NULL_CONJUNCTION_ENTRY;
end GET;
procedure GET(C : out CONJUNCTION_ENTRY) is
begin
C := NULL_CONJUNCTION_ENTRY;
end GET;
procedure PUT(F : in FILE_TYPE; C : in CONJUNCTION_ENTRY) is
begin
null;
end PUT;
procedure PUT(C : in CONJUNCTION_ENTRY) is
begin
null;
end PUT;
procedure GET(S : in STRING; C : out CONJUNCTION_ENTRY; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
C := NULL_CONJUNCTION_ENTRY;
LAST := L;
end GET;
procedure PUT(S : out STRING; C : in CONJUNCTION_ENTRY) is
begin
S(S'FIRST..S'LAST) := (others => ' ');
end PUT;
end CONJUNCTION_ENTRY_IO;
package body INTERJECTION_ENTRY_IO is
NULL_INTERJECTION_ENTRY : INTERJECTION_ENTRY;
SPACER : CHARACTER := ' ';
procedure GET(F : in FILE_TYPE; I : out INTERJECTION_ENTRY) is
begin
I := NULL_INTERJECTION_ENTRY;
end GET;
procedure GET(I : out INTERJECTION_ENTRY) is
begin
I := NULL_INTERJECTION_ENTRY;
end GET;
procedure PUT(F : in FILE_TYPE; I : in INTERJECTION_ENTRY) is
begin
null;
end PUT;
procedure PUT(I : in INTERJECTION_ENTRY) is
begin
null;
end PUT;
procedure GET(S : in STRING; I : out INTERJECTION_ENTRY; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
I := NULL_INTERJECTION_ENTRY;
LAST := L;
end GET;
procedure PUT(S : out STRING; I : in INTERJECTION_ENTRY) is
begin
S(S'FIRST..S'LAST) := (others => ' ');
end PUT;
end INTERJECTION_ENTRY_IO;
function "<" (LEFT, RIGHT : PART_ENTRY) return BOOLEAN is
begin
if LEFT.POFS = RIGHT.POFS then
case LEFT.POFS is
when N =>
if LEFT.N.DECL < RIGHT.N.DECL or else
(LEFT.N.DECL = RIGHT.N.DECL and then
LEFT.N.GENDER < RIGHT.N.GENDER) or else
((LEFT.N.DECL = RIGHT.N.DECL and
LEFT.N.GENDER = RIGHT.N.GENDER) and then
LEFT.N.KIND < RIGHT.N.KIND) then
return TRUE;
end if;
when PRON =>
if LEFT.PRON.DECL < RIGHT.PRON.DECL or else
(LEFT.PRON.DECL = RIGHT.PRON.DECL and then
LEFT.PRON.KIND < RIGHT.PRON.KIND) then
return TRUE;
end if;
when PACK =>
if LEFT.PACK.DECL < RIGHT.PACK.DECL or else
(LEFT.PACK.DECL = RIGHT.PACK.DECL and then
LEFT.PACK.KIND < RIGHT.PACK.KIND) then
return TRUE;
end if;
when ADJ =>
if LEFT.ADJ.DECL < RIGHT.ADJ.DECL or else
(LEFT.ADJ.DECL = RIGHT.ADJ.DECL and then
LEFT.ADJ.CO < RIGHT.ADJ.CO) then
return TRUE;
end if;
when NUM =>
if LEFT.NUM.DECL < RIGHT.NUM.DECL or else
(LEFT.NUM.DECL = RIGHT.NUM.DECL and then
LEFT.NUM.SORT < RIGHT.NUM.SORT) or else
((LEFT.NUM.DECL = RIGHT.NUM.DECL) and then
(LEFT.NUM.SORT = RIGHT.NUM.SORT) and then
LEFT.NUM.VALUE < RIGHT.NUM.VALUE) then
return TRUE;
end if;when ADV =>
return LEFT.ADV.CO < RIGHT.ADV.CO;
when V =>
if (LEFT.V.CON < RIGHT.V.CON) or else
(LEFT.V.CON = RIGHT.V.CON and then
LEFT.V.KIND < RIGHT.V.KIND) then
return TRUE;
end if;
when PREP =>
return LEFT.PREP.OBJ < RIGHT.PREP.OBJ;
when others =>
null;
end case;
else
return LEFT.POFS < RIGHT.POFS;
end if;
return FALSE;
exception
when CONSTRAINT_ERROR =>
return LEFT.POFS < RIGHT.POFS;
end "<";
package body PART_ENTRY_IO is
use PART_OF_SPEECH_TYPE_IO;
use NOUN_ENTRY_IO;
use PRONOUN_ENTRY_IO;
use PROPACK_ENTRY_IO;
use ADJECTIVE_ENTRY_IO;
use NUMERAL_ENTRY_IO;
use ADVERB_ENTRY_IO;
use VERB_ENTRY_IO;
use PREPOSITION_ENTRY_IO;
use CONJUNCTION_ENTRY_IO;
use INTERJECTION_ENTRY_IO;
SPACER : CHARACTER := ' ';
NOUN : NOUN_ENTRY;
PRONOUN : PRONOUN_ENTRY;
PROPACK : PROPACK_ENTRY;
ADJECTIVE : ADJECTIVE_ENTRY;
NUMERAL : NUMERAL_ENTRY;
ADVERB : ADVERB_ENTRY;
VERB : VERB_ENTRY;
PREPOSITION : PREPOSITION_ENTRY;
CONJUNCTION : CONJUNCTION_ENTRY;
INTERJECTION : INTERJECTION_ENTRY;
PR : PART_ENTRY;
procedure GET(F : in FILE_TYPE; P : out PART_ENTRY) is
PS : PART_OF_SPEECH_TYPE := X;
C : POSITIVE_COUNT := COL(F);
begin
GET(F, PS);
GET(F, SPACER);
case PS is
when N =>
GET(F, NOUN);
P := (N, NOUN);
when PRON =>
GET(F, PRONOUN);
P := (PRON, PRONOUN);
when PACK =>
GET(F, PROPACK);
P := (PACK, PROPACK);
when ADJ =>
GET(F, ADJECTIVE);
P := (ADJ, ADJECTIVE);
when NUM =>
GET(F, NUMERAL);
P := (NUM, NUMERAL);
when ADV =>
GET(F, ADVERB);
P := (ADV, ADVERB);
when V =>
GET(F, VERB);
P := (V, VERB);
when VPAR =>
null; -- No VAPR entry
when SUPINE =>
null; -- No SUPINE entry
when PREP =>
GET(F, PREPOSITION);
P := (PREP, PREPOSITION);
when CONJ =>
GET(F, CONJUNCTION);
P := (CONJ, CONJUNCTION);
when INTERJ =>
GET(F, INTERJECTION);
P := (INTERJ, INTERJECTION);
when PREFIX =>
P := (POFS => PREFIX);
when SUFFIX =>
P := (POFS => SUFFIX);
when TACKON =>
P := (POFS => TACKON);
when X =>
P := (POFS => X);
end case;
SET_COL(F, POSITIVE_COUNT(PART_ENTRY_IO.DEFAULT_WIDTH)+C);
return;
end GET;
procedure GET(P : out PART_ENTRY) is
PS : PART_OF_SPEECH_TYPE := X;
begin
GET(PS);
GET(SPACER);
case PS is
when N =>
GET(NOUN);
P := (N, NOUN);
when PRON =>
GET(PRONOUN);
P := (PRON, PRONOUN);
when PACK =>
GET(PROPACK);
P := (PACK, PROPACK);
when ADJ =>
GET(ADJECTIVE);
P := (ADJ, ADJECTIVE);
when NUM =>
GET(NUMERAL);
P := (NUM, NUMERAL);
when ADV =>
GET(ADVERB);
P := (ADV, ADVERB);
when V =>
GET(VERB);
P := (V, VERB);
when VPAR =>
null; -- No VAPR entry
when SUPINE =>
null; -- No SUPINE entry
when PREP =>
GET(PREPOSITION);
P := (PREP, PREPOSITION);
when CONJ =>
GET(CONJUNCTION);
P := (CONJ, CONJUNCTION);
when INTERJ =>
GET(INTERJECTION);
P := (INTERJ, INTERJECTION);
when PREFIX =>
P := (POFS => PREFIX);
when SUFFIX =>
P := (POFS => SUFFIX);
when TACKON =>
P := (POFS => TACKON);
when X =>
P := (POFS => X);
end case;
return;
end GET;
procedure PUT(F : in FILE_TYPE; P : in PART_ENTRY) is
C : POSITIVE := POSITIVE(COL(F));
begin
PUT(F, P.POFS);
PUT(F, ' ');
case P.POFS is
when N =>
PUT(F, P.N);
when PRON =>
PUT(F, P.PRON);
when PACK =>
PUT(F, P.PACK);
when ADJ =>
PUT(F, P.ADJ);
when NUM =>
PUT(F, P.NUM);
when ADV =>
PUT(F, P.ADV);
when V =>
PUT(F, P.V);
when VPAR =>
null; -- No VAPR entry
when SUPINE =>
null; -- No SUPINE entry
when PREP =>
PUT(F, P.PREP);
when CONJ =>
PUT(F, P.CONJ);
when INTERJ =>
PUT(F, P.INTERJ);
when others =>
null;
end case;
--PUT(F, STRING'((INTEGER(COL(F))..PART_ENTRY_IO.DEFAULT_WIDTH+C-1 => ' ')));
return;
end PUT;
procedure PUT(P : in PART_ENTRY) is
C : POSITIVE := POSITIVE(COL);
begin
PUT(P.POFS);
PUT(' ');
case P.POFS is
when N =>
PUT(P.N);
when PRON =>
PUT(P.PRON);
when PACK =>
PUT(P.PACK);
when ADJ =>
PUT(P.ADJ);
when NUM =>
PUT(P.NUM);
when ADV =>
PUT(P.ADV);
when V =>
PUT(P.V);
when VPAR =>
null; -- No VAPR entry
when SUPINE =>
null; -- No SUPINE entry
when PREP =>
PUT(P.PREP);
when CONJ =>
PUT(P.CONJ);
when INTERJ =>
PUT(P.INTERJ);
when others =>
null;
end case;
--PUT(STRING'((INTEGER(COL)..PART_ENTRY_IO.DEFAULT_WIDTH+C-1 => ' ')));
return;
end PUT;
procedure GET(S : in STRING; P : out PART_ENTRY; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
PS : PART_OF_SPEECH_TYPE := X;
begin
LAST := L; -- In case it is not set later
GET(S, PS, L);
L := L + 1;
case PS is
when N =>
GET(S(L+1..S'LAST), NOUN, LAST);
P := (N, NOUN);
when PRON =>
GET(S(L+1..S'LAST), PRONOUN, LAST);
P := (PRON, PRONOUN);
when PACK =>
GET(S(L+1..S'LAST), PROPACK, LAST);
P := (PACK, PROPACK);
when ADJ =>
GET(S(L+1..S'LAST), ADJECTIVE, LAST);
P := (ADJ, ADJECTIVE);
when NUM =>
GET(S(L+1..S'LAST), NUMERAL, LAST);
P := (NUM, NUMERAL);
when ADV =>
GET(S(L+1..S'LAST), ADVERB, LAST);
P := (ADV, ADVERB);
when V =>
GET(S(L+1..S'LAST), VERB, LAST);
P := (V, VERB);
when VPAR =>
null; -- No VAPR entry
when SUPINE =>
null; -- No SUPINE entry
when PREP =>
GET(S(L+1..S'LAST), PREPOSITION, LAST);
P := (PREP, PREPOSITION);
when CONJ =>
GET(S(L+1..S'LAST), CONJUNCTION, LAST);
P := (CONJ, CONJUNCTION);
when INTERJ =>
GET(S(L+1..S'LAST), INTERJECTION, LAST);
P := (INTERJ, INTERJECTION);
when PREFIX =>
P := (POFS => PREFIX);
when SUFFIX =>
P := (POFS => SUFFIX);
when TACKON =>
P := (POFS => TACKON);
when X =>
P := (POFS => X);
end case;
end GET;
procedure PUT(S : out STRING; P : in PART_ENTRY) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
M := L + PART_OF_SPEECH_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.POFS);
L := M + 1;
S(L) := ' ';
case P.POFS is
when N =>
M := L + NOUN_ENTRY_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.N);
when PRON =>
M := L + PRONOUN_ENTRY_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.PRON);
when PACK =>
M := L + PROPACK_ENTRY_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.PACK);
when ADJ =>
M := L + ADJECTIVE_ENTRY_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.ADJ);
when NUM =>
M := L + NUMERAL_ENTRY_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.NUM);
when ADV =>
M := L + ADVERB_ENTRY_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.ADV);
when V =>
M := L + VERB_ENTRY_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.V);
when VPAR =>
null; -- No VAPR entryR
when SUPINE =>
null; -- No SUPINE entry
when PREP =>
M := L + PREPOSITION_ENTRY_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.PREP);
when CONJ =>
M := L + CONJUNCTION_ENTRY_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.CONJ);
when INTERJ =>
M := L + INTERJECTION_ENTRY_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.INTERJ);
when others =>
null;
end case;
--S(M+1..S'LAST) := (others => ' ');
end PUT;
end PART_ENTRY_IO;
package body KIND_ENTRY_IO is
use NOUN_KIND_TYPE_IO;
use PRONOUN_KIND_TYPE_IO;
use INFLECTIONS_PACKAGE.INTEGER_IO;
use VERB_KIND_TYPE_IO;
SPACER : CHARACTER := ' ';
NOUN_KIND : NOUN_KIND_TYPE;
PRONOUN_KIND : PRONOUN_KIND_TYPE;
PROPACK_KIND : PRONOUN_KIND_TYPE;
VERB_KIND : VERB_KIND_TYPE;
VPAR_KIND : VERB_KIND_TYPE;
SUPINE_KIND : VERB_KIND_TYPE;
NUMERAL_VALUE : NUMERAL_VALUE_TYPE;
procedure GET(F : in FILE_TYPE;
PS : in PART_OF_SPEECH_TYPE; P : out KIND_ENTRY) is
begin
case PS is
when N =>
GET(F, NOUN_KIND);
P := (N, NOUN_KIND);
when PRON =>
GET(F, PRONOUN_KIND);
P := (PRON, PRONOUN_KIND);
when PACK =>
GET(F, PROPACK_KIND);
P := (PACK, PROPACK_KIND);
when ADJ =>
SET_COL(F, COL(F) + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => ADJ);
when NUM =>
GET(F, NUMERAL_VALUE);
P := (NUM, NUMERAL_VALUE);
when ADV =>
SET_COL(F, COL(F) + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => ADV);
when V =>
GET(F, VERB_KIND);
P := (V, VERB_KIND);
when VPAR =>
GET(F, VPAR_KIND);
P := (VPAR, VPAR_KIND);
when SUPINE =>
GET(F, SUPINE_KIND);
P := (SUPINE, SUPINE_KIND);
when PREP =>
SET_COL(F, COL(F) + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => PREP);
when CONJ =>
SET_COL(F, COL(F) + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => CONJ);
when INTERJ =>
SET_COL(F, COL(F) + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => INTERJ);
when TACKON =>
SET_COL(F, COL(F) + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => TACKON);
when PREFIX =>
SET_COL(F, COL(F) + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => PREFIX);
when SUFFIX =>
SET_COL(F, COL(F) + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => SUFFIX);
when X =>
SET_COL(F, COL(F) + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => X);
end case;
return;
end GET;
procedure GET(PS : in PART_OF_SPEECH_TYPE; P : out KIND_ENTRY) is
begin
case PS is
when N =>
GET(NOUN_KIND);
P := (N, NOUN_KIND);
when PRON =>
GET(PRONOUN_KIND);
P := (PRON, PRONOUN_KIND);
when PACK =>
GET(PROPACK_KIND);
P := (PACK, PROPACK_KIND);
when ADJ =>
SET_COL(COL + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => ADJ);
when NUM =>
GET(NUMERAL_VALUE);
P := (NUM, NUMERAL_VALUE);
when ADV =>
SET_COL(COL + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => ADV);
when V =>
GET(VERB_KIND);
P := (V, VERB_KIND);
when VPAR =>
GET(VPAR_KIND);
P := (VPAR, VPAR_KIND);
when SUPINE =>
GET(SUPINE_KIND);
P := (SUPINE, SUPINE_KIND);
when PREP =>
SET_COL(COL + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => PREP);
when CONJ =>
SET_COL(COL + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => CONJ);
when INTERJ =>
SET_COL(COL + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => INTERJ);
when TACKON =>
SET_COL(COL + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => TACKON);
when PREFIX =>
SET_COL(COL + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => PREFIX);
when SUFFIX =>
SET_COL(COL + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => SUFFIX);
when X =>
SET_COL(COL + POSITIVE_COUNT(KIND_ENTRY_IO.DEFAULT_WIDTH));
P := (POFS => X);
end case;
return;
end GET;
procedure PUT(F : in FILE_TYPE;
PS : in PART_OF_SPEECH_TYPE; P : in KIND_ENTRY) is
C : POSITIVE := POSITIVE(COL(F));
begin
case P.POFS is
when N =>
PUT(F, P.N_KIND);
when PRON =>
PUT(F, P.PRON_KIND);
when PACK =>
PUT(F, P.PACK_KIND);
when NUM =>
PUT(F, P.NUM_VALUE, NUMERAL_VALUE_TYPE_IO_DEFAULT_WIDTH);
when V =>
PUT(F, P.V_KIND);
when VPAR =>
PUT(F, P.VPAR_KIND);
when SUPINE =>
PUT(F, P.SUPINE_KIND);
when others =>
null;
end case;
PUT(F, STRING'((INTEGER(COL(F))..KIND_ENTRY_IO.DEFAULT_WIDTH+C-1 => ' ')));
return;
end PUT;
procedure PUT(PS : in PART_OF_SPEECH_TYPE; P : in KIND_ENTRY) is
C : POSITIVE := POSITIVE(COL);
begin
case P.POFS is
when N =>
PUT(P.N_KIND);
when PRON =>
PUT(P.PRON_KIND);
when PACK =>
PUT(P.PACK_KIND);
when NUM =>
PUT(P.NUM_VALUE, NUMERAL_VALUE_TYPE_IO_DEFAULT_WIDTH);
when V =>
PUT(P.V_KIND);
when VPAR =>
PUT(P.VPAR_KIND);
when SUPINE =>
PUT(P.SUPINE_KIND);
when others =>
null;
end case;
PUT(STRING'((INTEGER(COL)..KIND_ENTRY_IO.DEFAULT_WIDTH+C-1 => ' ')));
return;
end PUT;
procedure GET(S : in STRING; PS : in PART_OF_SPEECH_TYPE;
P : out KIND_ENTRY; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
LAST := L; -- In case it is not set later
case PS is
when N =>
GET(S(L+1..S'LAST), NOUN_KIND, LAST);
P := (N, NOUN_KIND);
when PRON =>
GET(S(L+1..S'LAST), PRONOUN_KIND, LAST);
P := (PRON, PRONOUN_KIND);
when PACK =>
GET(S(L+1..S'LAST), PROPACK_KIND, LAST);
P := (PACK, PROPACK_KIND);
when ADJ =>
P := (POFS => ADJ);
when NUM =>
GET(S(L+1..S'LAST), NUMERAL_VALUE, LAST);
P := (NUM, NUMERAL_VALUE);
when ADV =>
P := (POFS => ADV);
when V =>
GET(S(L+1..S'LAST), VERB_KIND, LAST);
P := (V, VERB_KIND);
when VPAR =>
GET(S(L+1..S'LAST), VPAR_KIND, LAST);
P := (VPAR, VPAR_KIND);
when SUPINE =>
GET(S(L+1..S'LAST), SUPINE_KIND, LAST);
P := (SUPINE, SUPINE_KIND);
when PREP =>
P := (POFS => PREP);
when CONJ =>
P := (POFS => CONJ);
when INTERJ =>
P := (POFS => INTERJ);
when TACKON =>
P := (POFS => TACKON);
when PREFIX =>
P := (POFS => PREFIX);
when SUFFIX =>
P := (POFS => SUFFIX);
when X =>
P := (POFS => X);
end case;
return;
end GET;
procedure PUT(S : out STRING;
PS : in PART_OF_SPEECH_TYPE; P : in KIND_ENTRY) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
case P.POFS is
when N =>
M := L + NOUN_KIND_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.N_KIND);
when PRON =>
M := L + PRONOUN_KIND_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.PRON_KIND);
when PACK =>
M := L + PRONOUN_KIND_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.PACK_KIND);
when NUM =>
M := L + NUMERAL_VALUE_TYPE_IO_DEFAULT_WIDTH;
PUT(S(L+1..M), P.NUM_VALUE);
when V =>
M := L + VERB_KIND_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.V_KIND);
when VPAR =>
M := L + VERB_KIND_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.VPAR_KIND);
when SUPINE =>
M := L + VERB_KIND_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), P.SUPINE_KIND);
when others =>
null;
end case;
S(M+1..S'LAST) := (others => ' ');
end PUT;
end KIND_ENTRY_IO;
package body TRANSLATION_RECORD_IO is
use TEXT_IO;
use AGE_TYPE_IO;
use AREA_TYPE_IO;
use GEO_TYPE_IO;
use FREQUENCY_TYPE_IO;
use SOURCE_TYPE_IO;
SPACER : CHARACTER := ' ';
--LINE : STRING(1..250);
LAST : INTEGER := 0;
procedure GET(F : in TEXT_IO.FILE_TYPE; TR: out TRANSLATION_RECORD) is
begin
GET(F, TR.AGE);
GET(F, SPACER);
GET(F, TR.AREA);
GET(F, SPACER);
GET(F, TR.GEO);
GET(F, SPACER);
GET(F, TR.FREQ);
GET(F, SPACER);
GET(F, TR.SOURCE);
--GET(F, SPACER);
--GET_LINE(F, LINE, LAST);
--TR.MEAN := HEAD(LINE(1..LAST), MAX_MEANING_SIZE);
end GET;
procedure GET(TR : out TRANSLATION_RECORD) is
begin
GET(TR.AGE);
GET(SPACER);
GET(TR.AREA);
GET(SPACER);
GET(TR.GEO);
GET(SPACER);
GET(TR.FREQ);
GET(SPACER);
GET(TR.SOURCE);
--GET(SPACER);
--GET_LINE(LINE, LAST);
--TR.MEAN := HEAD(LINE(1..LAST), MAX_MEANING_SIZE);
end GET;
procedure PUT(F : in TEXT_IO.FILE_TYPE; TR : in TRANSLATION_RECORD) is
begin
PUT(F, TR.AGE);
PUT(F, ' ');
PUT(F, TR.AREA);
PUT(F, ' ');
PUT(F, TR.GEO);
PUT(F, ' ');
PUT(F, TR.FREQ);
PUT(F, ' ');
PUT(F, TR.SOURCE);
--PUT(F, ' ');
--PUT(F, TR.MEAN);
end PUT;
procedure PUT(TR : in TRANSLATION_RECORD) is
begin
AGE_TYPE_IO.PUT(TR.AGE);
TEXT_IO.PUT(' ');
AREA_TYPE_IO.PUT(TR.AREA);
TEXT_IO.PUT(' ');
GEO_TYPE_IO.PUT(TR.GEO);
TEXT_IO.PUT(' ');
FREQUENCY_TYPE_IO.PUT(TR.FREQ);
TEXT_IO.PUT(' ');
SOURCE_TYPE_IO.PUT(TR.SOURCE);
--TEXT_IO.PUT(' ');
--TEXT_IO.PUT(TR.MEAN);
end PUT;
procedure GET(S : in STRING; TR : out TRANSLATION_RECORD; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
begin
GET(S(L+1..S'LAST), TR.AGE, L);
--PUT(TR.AGE); TEXT_IO.PUT('-');
L := L + 1;
GET(S(L+1..S'LAST), TR.AREA, L);
--PUT(TR.AREA); TEXT_IO.PUT('-');
L := L + 1;
GET(S(L+1..S'LAST), TR.GEO, L);
--PUT(TR.GEO); TEXT_IO.PUT('-');
L := L + 1;
GET(S(L+1..S'LAST), TR.FREQ, L);
--PUT(TR.FREQ); TEXT_IO.PUT('-');
L := L + 1;
GET(S(L+1..S'LAST), TR.SOURCE, LAST);
--PUT(TR.SOURCE); TEXT_IO.PUT('-');
--L := M + 1;
--M := L + MAX_MEANING_SIZE;
--TR.MEAN := HEAD(S(L+1..S'LAST), MAX_MEANING_SIZE);
--LAST := M;
end GET;
procedure PUT(S : out STRING; TR : in TRANSLATION_RECORD) is
L : INTEGER := 0;
M : INTEGER := 0;
begin
M := L + AGE_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), TR.AGE);
L := M + 1;
S(L) := ' ';
M := L + AREA_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), TR.AREA);
L := M + 1;
S(L) := ' ';
M := L + GEO_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), TR.GEO);
L := M + 1;
S(L) := ' ';
M := L + FREQUENCY_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), TR.FREQ);
L := M + 1;
S(L) := ' ';
M := L + SOURCE_TYPE_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), TR.SOURCE);
--L := M + 1;
--S(L) := ' ';
--M := L + MAX_MEANING_SIZE;
--S(L+1..M) := TR.MEAN;
S(M+1..S'LAST) := (others => ' ');
end PUT;
end TRANSLATION_RECORD_IO;
package body DICTIONARY_ENTRY_IO is
use PART_ENTRY_IO;
use TRANSLATION_RECORD_IO;
--use KIND_ENTRY_IO;
SPACER : CHARACTER := ' ';
PART_COL : NATURAL := 0;
DE : DICTIONARY_ENTRY;
procedure GET(F : in FILE_TYPE; D : out DICTIONARY_ENTRY) is
begin
for I in STEM_KEY_TYPE range 1..4 loop
GET(F, D.STEMS(I));
GET(F, SPACER);
end loop;
GET(F, D.PART);
-- GET(F, SPACER);
-- GET(F, D.PART.POFS, D.KIND);
GET(F, SPACER);
GET(F, D.TRAN);
GET(F, SPACER);
GET(F, D.MEAN);
end GET;
procedure GET(D : out DICTIONARY_ENTRY) is
begin
for I in STEM_KEY_TYPE range 1..4 loop
GET(D.STEMS(I));
GET(SPACER);
end loop;
GET(D.PART);
-- GET(SPACER);
-- GET(D.PART.POFS, D.KIND);
GET(SPACER);
GET(D.TRAN);
GET(SPACER);
GET(D.MEAN);
end GET;
procedure PUT(F : in FILE_TYPE; D : in DICTIONARY_ENTRY) is
begin
for I in STEM_KEY_TYPE range 1..4 loop
PUT(F, D.STEMS(I));
PUT(F, ' ');
end loop;
PART_COL := NATURAL(COL(F));
PUT(F, D.PART);
-- PUT(F, ' ');
-- PUT(F, D.PART.POFS, D.KIND);
SET_COL(F, COUNT(PART_COL + PART_ENTRY_IO.DEFAULT_WIDTH + 1));
PUT(F, D.TRAN);
PUT(F, ' ');
PUT(F, D.MEAN);
end PUT;
procedure PUT(D : in DICTIONARY_ENTRY) is
begin
for I in STEM_KEY_TYPE range 1..4 loop
PUT(D.STEMS(I));
PUT(' ');
end loop;
PART_COL := NATURAL(COL);
PUT(D.PART);
-- PUT(' ');
-- PUT(D.PART.POFS, D.KIND);
SET_COL(COUNT(PART_COL + PART_ENTRY_IO.DEFAULT_WIDTH + 1));
PUT(D.TRAN);
PUT(' ');
PUT(D.MEAN);
end PUT;
procedure GET(S : in STRING; D : out DICTIONARY_ENTRY; LAST : out INTEGER) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
I : INTEGER := 0;
begin
for I in STEM_KEY_TYPE range 1..4 loop
STEM_TYPE_IO.GET(S(L+1..S'LAST), D.STEMS(I), L);
end loop;
GET(S(L+1..S'LAST), D.PART, L);
-- L := L + 1;
-- GET(S(L+1..S'LAST), D.PART.POFS, D.KIND, L);
L := L + 1;
GET(S(L+1..S'LAST), D.TRAN, L);
L := L + 1;
D.MEAN := HEAD(S(L+1..S'LAST), MAX_MEANING_SIZE);
I := L+1;
while S(I) = ' ' loop
I := I + 1;
end loop;
while (S(I) not in 'A'..'Z') and
(S(I) not in 'a'..'z') loop
LAST := I;
I := I + 1;
exit;
end loop;
end GET;
procedure PUT(S : out STRING; D : in DICTIONARY_ENTRY) is
L : INTEGER := S'FIRST - 1;
M : INTEGER := 0;
begin
for I in STEM_KEY_TYPE range 1..4 loop
M := L + MAX_STEM_SIZE;
S(L+1..M) := D.STEMS(I);
L := M + 1;
S(L) := ' ';
end loop;
PART_COL := L + 1;
M := L + PART_ENTRY_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), D.PART);
-- L := M + 1;
-- S(L) := ' ';
-- M := L + KIND_ENTRY_IO_DEFAULT_WIDTH;
-- PUT(S(L+1..M), D.PART.POFS, D.KIND);
L := PART_COL + PART_ENTRY_IO.DEFAULT_WIDTH + 1;
M := L + TRANSLATION_RECORD_IO.DEFAULT_WIDTH;
PUT(S(L+1..M), D.TRAN);
L := M + 1;
S(L) := ' ';
M := M + MAX_MEANING_SIZE;
S(L+1..M) := D.MEAN;
S(M+1..S'LAST) := (others => ' ');
end PUT;
end DICTIONARY_ENTRY_IO;
function "<=" (LEFT, RIGHT : AREA_TYPE) return BOOLEAN is
begin
if RIGHT = LEFT or else
RIGHT = X then
return TRUE;
else
return FALSE;
end if;
end "<=";
begin -- initialization of body of DICTIONARY_PACKAGE
--TEXT_IO.PUT_LINE("Initializing DICTIONARY_PACKAGE");
DICTIONARY_KIND_IO.DEFAULT_WIDTH := DICTIONARY_KIND'WIDTH;
--NUMERAL_VALUE_TYPE_IO.DEFAULT_WIDTH := 5;
AREA_TYPE_IO.DEFAULT_WIDTH := AREA_TYPE'WIDTH;
GEO_TYPE_IO.DEFAULT_WIDTH := GEO_TYPE'WIDTH;
FREQUENCY_TYPE_IO.DEFAULT_WIDTH := FREQUENCY_TYPE'WIDTH;
SOURCE_TYPE_IO.DEFAULT_WIDTH := SOURCE_TYPE'WIDTH;
PARSE_RECORD_IO.DEFAULT_WIDTH :=
STEM_TYPE_IO.DEFAULT_WIDTH + 1 +
INFLECTION_RECORD_IO.DEFAULT_WIDTH + 1 +
DICTIONARY_KIND_IO.DEFAULT_WIDTH + 1 +
MNPC_IO_DEFAULT_WIDTH;
NOUN_ENTRY_IO.DEFAULT_WIDTH :=
DECN_RECORD_IO.DEFAULT_WIDTH + 1 +
GENDER_TYPE_IO.DEFAULT_WIDTH + 1 +
NOUN_KIND_TYPE_IO.DEFAULT_WIDTH;
PRONOUN_ENTRY_IO.DEFAULT_WIDTH :=
DECN_RECORD_IO.DEFAULT_WIDTH + 1 +
PRONOUN_KIND_TYPE_IO.DEFAULT_WIDTH;
PROPACK_ENTRY_IO.DEFAULT_WIDTH :=
DECN_RECORD_IO.DEFAULT_WIDTH + 1 +
PRONOUN_KIND_TYPE_IO.DEFAULT_WIDTH;
ADJECTIVE_ENTRY_IO.DEFAULT_WIDTH :=
DECN_RECORD_IO.DEFAULT_WIDTH + 1 +
COMPARISON_TYPE_IO.DEFAULT_WIDTH;
ADVERB_ENTRY_IO.DEFAULT_WIDTH :=
COMPARISON_TYPE_IO.DEFAULT_WIDTH;
VERB_ENTRY_IO.DEFAULT_WIDTH :=
DECN_RECORD_IO.DEFAULT_WIDTH + 1 +
VERB_KIND_TYPE_IO.DEFAULT_WIDTH;
PREPOSITION_ENTRY_IO.DEFAULT_WIDTH := 0;
CONJUNCTION_ENTRY_IO.DEFAULT_WIDTH := 0;
INTERJECTION_ENTRY_IO.DEFAULT_WIDTH := 0;
NUMERAL_ENTRY_IO.DEFAULT_WIDTH :=
DECN_RECORD_IO.DEFAULT_WIDTH + 1 +
NUMERAL_SORT_TYPE_IO.DEFAULT_WIDTH + 1 +
NUMERAL_VALUE_TYPE_IO_DEFAULT_WIDTH;
PART_ENTRY_IO.DEFAULT_WIDTH := PART_OF_SPEECH_TYPE_IO.DEFAULT_WIDTH + 1 +
NUMERAL_ENTRY_IO.DEFAULT_WIDTH; -- Largest
-- Should make up a MAX of PART_ENTRY + KIND_ENTRY (same POFS) WIDTHS
TRANSLATION_RECORD_IO.DEFAULT_WIDTH :=
AGE_TYPE_IO.DEFAULT_WIDTH + 1 +
AREA_TYPE_IO.DEFAULT_WIDTH + 1 +
GEO_TYPE_IO.DEFAULT_WIDTH + 1 +
FREQUENCY_TYPE_IO.DEFAULT_WIDTH + 1 +
SOURCE_TYPE_IO.DEFAULT_WIDTH;
DICTIONARY_ENTRY_IO.DEFAULT_WIDTH := 4 * (MAX_STEM_SIZE + 1) +
PART_ENTRY_IO.DEFAULT_WIDTH + 1 +
TRANSLATION_RECORD_IO.DEFAULT_WIDTH + 1 +
MAX_MEANING_SIZE;
--TEXT_IO.PUT_LINE("Initialized DICTIONARY_PACKAGE");
end DICTIONARY_PACKAGE;
|
List 04/ex 2e (print array).asm | LeonardoSanBenitez/Assembly-exercises | 0 | 12899 | <filename>List 04/ex 2e (print array).asm
.data
Sseparator: .asciiz ", "
SlineBreak: .asciiz "\n"
.text
main:
## debug init
addi $t0, $zero, 8
addi $t1, $zero, 5
addi $t2, $zero, 1
addi $t3, $zero, 3
addi $t4, $zero, 2
addi $t5, $zero, 20
addi $t6, $zero, 7
addi $t7, $zero, 666
sw $t0, 0 ($gp)
sw $t1, 4 ($gp)
sw $t2, 8 ($gp)
sw $t3, 12 ($gp)
sw $t4, 16 ($gp)
sw $t5, 20 ($gp)
sw $t6, 24 ($gp)
sw $t7, 28 ($gp)
## debug end
addi $a0, $gp, 0
addi $a1, $zero, 7
jal printArray
li $v0, 17
syscall
#------------------------------#
# void printArray (int* v, int size)
printArray:
move $t1, $a0
printArrayWhile:
ble $a1, $zero, printArrayEnd # while (size>0)
addi $a1, $a1, -1 # size--
lw $a0, 0 ($t1) # print_int (* v ++)
addi $t1, $t1, 4
li $v0, 1
syscall
la $a0, Sseparator
li $v0, 4
syscall
j printArrayWhile
printArrayEnd:
la $a0, SlineBreak
li $v0, 4
syscall
jr $ra |
snapgear_linux/lib/libgmp/mpn/x86/k7/mul_1.asm | impedimentToProgress/UCI-BlueChip | 0 | 99204 | <filename>snapgear_linux/lib/libgmp/mpn/x86/k7/mul_1.asm
# AMD K7 mpn_mul_1 -- mpn by limb multiply.
#
# K7: 3.4 cycles/limb (at 16 limbs/loop).
# Copyright (C) 1999, 2000 Free Software Foundation, Inc.
#
# This file is part of the GNU MP Library.
#
# The GNU MP Library is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# The GNU MP Library 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 Library General Public
# License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
include(`../config.m4')
dnl K7: UNROLL_COUNT cycles/limb
dnl 8 3.9
dnl 16 3.4
dnl 32 3.4
dnl 64 3.35
dnl Maximum possible with the current code is 64.
deflit(UNROLL_COUNT, 16)
# mp_limb_t mpn_mul_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
# mp_limb_t multiplier);
# mp_limb_t mpn_mul_1c (mp_ptr dst, mp_srcptr src, mp_size_t size,
# mp_limb_t multiplier, mp_limb_t carry);
#
# Multiply src,size by mult and store the result in dst,size.
# Return the carry limb from the top of the result.
#
# mpn_mul_1c() accepts an initial carry for the calculation, it's added into
# the low limb of the destination.
#
# Variations on the unrolled loop have been tried, with the current
# registers or with the counter on the stack to free up ecx. The current
# code is the fastest found.
#
# An interesting effect is that removing the stores "movl %ebx, disp0(%edi)"
# from the unrolled loop actually slows it down to 5.0 cycles/limb. Code
# with this change can be tested on sizes of the form UNROLL_COUNT*n+1
# without having to change the computed jump. There's obviously something
# fishy going on, perhaps with what execution units the mul needs.
defframe(PARAM_CARRY, 20)
defframe(PARAM_MULTIPLIER,16)
defframe(PARAM_SIZE, 12)
defframe(PARAM_SRC, 8)
defframe(PARAM_DST, 4)
defframe(SAVE_EBP, -4)
defframe(SAVE_EDI, -8)
defframe(SAVE_ESI, -12)
defframe(SAVE_EBX, -16)
deflit(STACK_SPACE, 16)
dnl Must have UNROLL_THRESHOLD >= 2, since the unrolled loop can't handle 1.
ifdef(`PIC',`
deflit(UNROLL_THRESHOLD, 7)
',`
deflit(UNROLL_THRESHOLD, 5)
')
.text
ALIGN(32)
PROLOGUE(mpn_mul_1c)
deflit(`FRAME',0)
movl PARAM_CARRY, %edx
jmp LF(mpn_mul_1,start_nc)
EPILOGUE()
PROLOGUE(mpn_mul_1)
deflit(`FRAME',0)
xorl %edx, %edx # initial carry
L(start_nc):
movl PARAM_SIZE, %ecx
subl $STACK_SPACE, %esp
deflit(`FRAME', STACK_SPACE)
movl %edi, SAVE_EDI
movl %ebx, SAVE_EBX
movl %edx, %ebx
movl %esi, SAVE_ESI
movl PARAM_SRC, %esi
cmpl $UNROLL_THRESHOLD, %ecx
movl PARAM_DST, %edi
movl %ebp, SAVE_EBP
jae L(unroll)
leal (%esi,%ecx,4), %esi
leal (%edi,%ecx,4), %edi
negl %ecx
movl PARAM_MULTIPLIER, %ebp
L(simple):
# eax scratch
# ebx carry
# ecx counter (negative)
# edx scratch
# esi src
# edi dst
# ebp multiplier
movl (%esi,%ecx,4), %eax
mull %ebp
addl %ebx, %eax
movl %eax, (%edi,%ecx,4)
movl $0, %ebx
adcl %edx, %ebx
incl %ecx
jnz L(simple)
movl %ebx, %eax
movl SAVE_EBX, %ebx
movl SAVE_ESI, %esi
movl SAVE_EDI, %edi
movl SAVE_EBP, %ebp
addl $STACK_SPACE, %esp
ret
# -----------------------------------------------------------------------------
# The mov to load the next source limb is done well ahead of the mul, this
# is necessary for full speed. It leads to one limb handled separately
# after the loop.
#
# When unrolling to 32 or more, an offset of +4 is used on the src pointer,
# to avoid having an 0x80 displacement in the code for the last limb in the
# unrolled loop. This is for a fair comparison between 16 and 32 unrolling.
ifelse(eval(UNROLL_COUNT >= 32),1,`
deflit(SRC_OFFSET,4)
',`
deflit(SRC_OFFSET,)
')
# this is offset 0x62, so close enough to aligned
L(unroll):
# eax
# ebx initial carry
# ecx size
# edx
# esi src
# edi dst
# ebp
deflit(`FRAME', STACK_SPACE)
leal -1(%ecx), %edx # one limb handled at end
leal -2(%ecx), %ecx # and ecx is one less than edx
movl %ebp, SAVE_EBP
negl %edx
shrl $UNROLL_LOG2, %ecx # unrolled loop counter
movl (%esi), %eax # src low limb
andl $UNROLL_MASK, %edx
movl PARAM_DST, %edi
movl %edx, %ebp
shll $4, %edx
# 17 code bytes per limb
ifdef(`PIC',`
call L(add_eip_to_edx)
L(here):
',`
leal L(entry) (%edx,%ebp), %edx
')
negl %ebp
leal ifelse(UNROLL_BYTES,256,128+) SRC_OFFSET(%esi,%ebp,4), %esi
leal ifelse(UNROLL_BYTES,256,128) (%edi,%ebp,4), %edi
movl PARAM_MULTIPLIER, %ebp
jmp *%edx
ifdef(`PIC',`
L(add_eip_to_edx):
# See README.family about old gas bugs
leal (%edx,%ebp), %edx
addl $L(entry)-L(here), %edx
addl (%esp), %edx
ret
')
# ----------------------------------------------------------------------------
ALIGN(32)
L(top):
# eax next src limb
# ebx carry
# ecx counter
# edx scratch
# esi src+4
# edi dst
# ebp multiplier
#
# 17 code bytes per limb processed
L(entry):
forloop(i, 0, UNROLL_COUNT-1, `
deflit(`disp_dst', eval(i*4 ifelse(UNROLL_BYTES,256,-128)))
deflit(`disp_src', eval(disp_dst + 4-(SRC_OFFSET-0)))
mull %ebp
addl %eax, %ebx
Zdisp( movl, disp_src,(%esi), %eax)
Zdisp( movl, %ebx, disp_dst,(%edi))
movl $0, %ebx
adcl %edx, %ebx
')
decl %ecx
leal UNROLL_BYTES(%esi), %esi
leal UNROLL_BYTES(%edi), %edi
jns L(top)
deflit(`disp0', ifelse(UNROLL_BYTES,256,-128))
mull %ebp
addl %eax, %ebx
movl $0, %eax
movl SAVE_ESI, %esi
movl %ebx, disp0(%edi)
movl SAVE_EBX, %ebx
movl SAVE_EDI, %edi
adcl %edx, %eax
movl SAVE_EBP, %ebp
addl $STACK_SPACE, %esp
ret
EPILOGUE()
|
src/drivers/sercom_u2201/sam-sercom-i2c.ads | Fabien-Chouteau/samd51-hal | 1 | 30152 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2020, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with HAL.I2C; use HAL.I2C;
with HAL; use HAL;
package SAM.SERCOM.I2C is
type I2C_Device
is new SERCOM_Device and HAL.I2C.I2C_Port
with private;
procedure Configure (This : in out I2C_Device;
Baud : UInt8)
with Pre => not This.Enabled and then not This.Configured,
Post => not This.Enabled and then This.Configured;
-- Configure SERCOM in I2C Master mode.
-- DMA --
function Data_Address (This : I2C_Device) return System.Address;
-- return the address of the data register for DMA transfer configuration
-------------
-- HAL.I2C --
-------------
overriding
procedure Master_Transmit
(This : in out I2C_Device;
Addr : I2C_Address;
Data : I2C_Data;
Status : out I2C_Status;
Timeout : Natural := 1000);
overriding
procedure Master_Receive
(This : in out I2C_Device;
Addr : I2C_Address;
Data : out I2C_Data;
Status : out I2C_Status;
Timeout : Natural := 1000);
overriding
procedure Mem_Write
(This : in out I2C_Device;
Addr : I2C_Address;
Mem_Addr : UInt16;
Mem_Addr_Size : I2C_Memory_Address_Size;
Data : I2C_Data;
Status : out I2C_Status;
Timeout : Natural := 1000);
overriding
procedure Mem_Read
(This : in out I2C_Device;
Addr : I2C_Address;
Mem_Addr : UInt16;
Mem_Addr_Size : I2C_Memory_Address_Size;
Data : out I2C_Data;
Status : out I2C_Status;
Timeout : Natural := 1000);
private
type I2C_Device
is new SERCOM_Device and HAL.I2C.I2C_Port
with record
Do_Stop_Sequence : Boolean := True;
end record;
procedure Wait_Sync (This : in out I2C_Device);
procedure Wait_Bus (This : in out I2C_Device);
function Send_Addr (This : in out I2C_Device;
Addr : UInt11)
return I2C_Status;
procedure Cmd_Stop (This : in out I2C_Device);
procedure Cmd_Read (This : in out I2C_Device);
procedure Cmd_Nack (This : in out I2C_Device);
function Bus_Status (This : I2C_Device) return I2C_Status;
end SAM.SERCOM.I2C;
|
vendor/stdlib/src/Data/Product/Record.agda | isabella232/Lemmachine | 56 | 655 | ------------------------------------------------------------------------
-- Products implemented using records
------------------------------------------------------------------------
-- It it ever becomes convenient to pattern match on records I might
-- make this the default implementation of products.
module Data.Product.Record where
open import Data.Function
infixr 4 _,_
infixr 2 _×_ _-×-_ _-,-_
------------------------------------------------------------------------
-- Definition
record Σ (a : Set) (b : a → Set) : Set where
field
proj₁ : a
proj₂ : b proj₁
open Σ public
_×_ : (a b : Set) → Set
a × b = Σ a (λ _ → b)
------------------------------------------------------------------------
-- Functions
_,_ : ∀ {a b} → (x : a) → b x → Σ a b
(x , y) = record {proj₁ = x; proj₂ = y}
<_,_> : ∀ {A} {B : A → Set} {C : ∀ {x} → B x → Set}
(f : (x : A) → B x) → ((x : A) → C (f x)) →
((x : A) → Σ (B x) C)
< f , g > x = (f x , g x)
map : ∀ {A B P Q} →
(f : A → B) → (∀ {x} → P x → Q (f x)) →
Σ A P → Σ B Q
map f g = < f ∘ proj₁ , g ∘ proj₂ >
swap : ∀ {a b} → a × b → b × a
swap = < proj₂ , proj₁ >
_-×-_ : ∀ {a b} → (a → b → Set) → (a → b → Set) → (a → b → Set)
f -×- g = f -[ _×_ ]₁- g
_-,-_ : ∀ {a b c d} → (a → b → c) → (a → b → d) → (a → b → c × d)
f -,- g = f -[ _,_ ]- g
curry : {a : Set} {b : a → Set} {c : Σ a b → Set} →
((p : Σ a b) → c p) →
((x : a) → (y : b x) → c (x , y))
curry f x y = f (x , y)
uncurry : {a : Set} {b : a → Set} {c : Σ a b → Set} →
((x : a) → (y : b x) → c (x , y)) →
((p : Σ a b) → c p)
uncurry f p = f (proj₁ p) (proj₂ p)
|
test/Succeed/Issue1944-poly-record.agda | pthariensflame/agda | 3 | 13084 | -- Parameter arguments of overloaded projection applications
-- should not be skipped!
record R A : Set where
field f : A → A
open R
record S A : Set where
field f : A → A
open S
r : ∀{A} → R A
f r x = x
test : ∀{A : Set} → A → A
test a = f r a
|
tools-src/gnu/gcc/gcc/ada/i-os2thr.ads | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 21167 | <filename>tools-src/gnu/gcc/gcc/ada/i-os2thr.ads<gh_stars>10-100
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- I N T E R F A C E S . O S 2 L I B . T H R E A D S --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1993-1997 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Interfaces.C;
package Interfaces.OS2Lib.Threads is
pragma Preelaborate (Threads);
package IC renames Interfaces.C;
type PID is new IC.unsigned_long;
type PPID is access all PID;
-- Process ID, and pointer to process ID
type TID is new IC.unsigned_long;
type PTID is access all TID;
-- Thread ID, and pointer to thread ID
-------------------------------------------------------------
-- Thread Creation, Activation, Suspension And Termination --
-------------------------------------------------------------
-- Note: <bsedos.h> defines the "Informations" and "param" parameter below
-- as a ULONG, but everyone knows that in general an address will be passed
-- to it. We declared it here with type PVOID (which it should have had)
-- because Ada is a bit more sensitive to mixing integers and addresses.
type PFNTHREAD is access procedure (Informations : System.Address);
-- TBSL should use PVOID instead of Address as per above node ???
function DosCreateThread
(F_ptid : PTID;
pfn : PFNTHREAD;
param : PVOID;
flag : ULONG;
cbStack : ULONG)
return APIRET;
pragma Import (C, DosCreateThread, "DosCreateThread");
Block_Child : constant := 1;
No_Block_Child : constant := 0;
Commit_Stack : constant := 2;
No_Commit_Stack : constant := 0;
-- Values for "flag" parameter in DosCreateThread call
procedure DosExit (Action : ULONG; Result : ULONG);
pragma Import (C, DosExit, "DosExit");
EXIT_THREAD : constant := 0;
EXIT_PROCESS : constant := 1;
-- Values for "Action" parameter in Dos_Exit call
function DosResumeThread (Id : TID) return APIRET;
pragma Import (C, DosResumeThread, "DosResumeThread");
function DosSuspendThread (Id : TID) return APIRET;
pragma Import (C, DosSuspendThread, "DosSuspendThread");
procedure DosWaitThread (Thread_Ptr : PTID; Option : ULONG);
pragma Import (C, DosWaitThread, "DosWaitThread");
function DosKillThread (Id : TID) return APIRET;
pragma Import (C, DosKillThread, "DosKillThread");
DCWW_WAIT : constant := 0;
DCWW_NOWAIT : constant := 1;
-- Values for "Option" parameter in DosWaitThread call
---------------------------------------------------
-- Accessing properties of Threads and Processes --
---------------------------------------------------
-- Structures translated from BSETIB.H
-- Thread Information Block (TIB)
-- Need documentation clarifying distinction between TIB, TIB2 ???
-- GB970409: Changed TIB2 structure, because the tib2_ulprio field
-- is not the actual priority but contains two byte fields
-- that hold the priority class and rank respectively.
-- A proper Ada style record with explicit representation
-- avoids this kind of errors.
type TIB2 is record
Thread_ID : TID;
Prio_Rank : UCHAR;
Prio_Class : UCHAR;
Version : ULONG; -- Version number for this structure
Must_Complete_Count : USHORT; -- Must Complete count
Must_Complete_Force : USHORT; -- Must Complete force flag
end record;
type PTIB2 is access all TIB2;
-- Thread Information Block (TIB)
type TIB is record
tib_pexchain : PVOID; -- Head of exception handler chain
tib_pstack : PVOID; -- Pointer to base of stack
tib_pstacklimit : PVOID; -- Pointer to end of stack
System : PTIB2; -- Pointer to system specific TIB
tib_version : ULONG; -- Version number for this TIB structure
tib_ordinal : ULONG; -- Thread ordinal number
end record;
type PTIB is access all TIB;
-- Process Information Block (PIB)
type PIB is record
pib_ulpid : ULONG; -- Process I.D.
pib_ulppid : ULONG; -- Parent process I.D.
pib_hmte : ULONG; -- Program (.EXE) module handle
pib_pchcmd : PCHAR; -- Command line pointer
pib_pchenv : PCHAR; -- Environment pointer
pib_flstatus : ULONG; -- Process' status bits
pib_ultype : ULONG; -- Process' type code
end record;
type PPIB is access all PIB;
function DosGetInfoBlocks
(Pptib : access PTIB;
Pppib : access PPIB)
return APIRET;
pragma Import (C, DosGetInfoBlocks, "DosGetInfoBlocks");
-- Thread local memory
-- This function allocates a block of memory that is unique, or local, to
-- a thread.
function DosAllocThreadLocalMemory
(cb : ULONG; -- Number of 4-byte DWORDs to allocate
p : access PVOID) -- Address of the memory block
return
APIRET; -- Return Code (rc)
pragma Import
(Convention => C,
Entity => DosAllocThreadLocalMemory,
Link_Name => "_DosAllocThreadLocalMemory");
-----------------
-- Priorities --
-----------------
function DosSetPriority
(Scope : ULONG;
Class : ULONG;
Delta_P : IC.long;
PorTid : TID)
return APIRET;
pragma Import (C, DosSetPriority, "DosSetPriority");
PRTYS_PROCESS : constant := 0;
PRTYS_PROCESSTREE : constant := 1;
PRTYS_THREAD : constant := 2;
-- Values for "Scope" parameter in DosSetPriority call
PRTYC_NOCHANGE : constant := 0;
PRTYC_IDLETIME : constant := 1;
PRTYC_REGULAR : constant := 2;
PRTYC_TIMECRITICAL : constant := 3;
PRTYC_FOREGROUNDSERVER : constant := 4;
-- Values for "class" parameter in DosSetPriority call
end Interfaces.OS2Lib.Threads;
|
Task/Handle-a-signal/Ada/handle-a-signal-1.ada | LaudateCorpus1/RosettaCodeData | 1 | 1902 | with Ada.Interrupts; use Ada.Interrupts;
with Ada.Interrupts.Names; use Ada.Interrupts.Names;
package Sigint_Handler is
protected Handler is
entry Wait;
procedure Handle;
pragma Interrupt_Handler(Handle);
pragma Attach_Handler(Handle, Sigint);
private
Call_Count : Natural := 0;
end Handler;
end Sigint_Handler;
|
src/tcg-maps.adb | Fabien-Chouteau/tiled-code-gen | 1 | 26767 | <reponame>Fabien-Chouteau/tiled-code-gen
------------------------------------------------------------------------------
-- --
-- tiled-code-gen --
-- --
-- Copyright (C) 2018 <NAME> --
-- --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Directories; use Ada.Directories;
with GNAT.OS_Lib;
with DOM.Core; use DOM.Core;
with TCG.Utils; use TCG.Utils;
with TCG.Tile_Layers; use TCG.Tile_Layers;
with TCG.Object_Groups; use TCG.Object_Groups;
with Input_Sources.File; use Input_Sources.File;
with Sax.Readers; use Sax.Readers;
with DOM.Readers; use DOM.Readers;
with DOM.Core.Documents; use DOM.Core.Documents;
with DOM.Core.Nodes; use DOM.Core.Nodes;
package body TCG.Maps is
function Create (N : Node; Name : String) return Map;
function Load_Tileset (N : Node; Base_Dir : String) return Map_Tileset;
------------
-- Create --
------------
function Create (N : Node; Name : String) return Map is
Tile_Width : constant Natural := Item_As_Natural (N, "tilewidth");
Tile_Height : constant Natural := Item_As_Natural (N, "tileheight");
Width : constant Natural := Item_As_Natural (N, "width");
Height : constant Natural := Item_As_Natural (N, "height");
M : constant Map := new Map_Data;
begin
M.Width := Width;
M.Height := Height;
M.Tile_Width := Tile_Width;
M.Tile_Height := Tile_Height;
M.Name := new String'(Name);
return M;
end Create;
------------------
-- Load_Tileset --
------------------
function Load_Tileset (N : Node;
Base_Dir : String)
return Map_Tileset
is
Source : constant String :=
GNAT.OS_Lib.Normalize_Pathname (Item_As_String (N, "source"),
Base_Dir);
First_Tile : constant Natural := Item_As_Natural (N, "firstgid");
begin
return (Tilesets.Load (Source), Tilesets.Map_Tile_Id (First_Tile));
end Load_Tileset;
----------
-- Load --
----------
function Load (Path : String; Name : String) return Map is
Dir : constant String := Containing_Directory (Path);
Input : File_Input;
Reader : Tree_Reader;
Doc : Document;
List : Node_List;
N : Node;
M : Map;
begin
Set_Public_Id (Input, "Map file");
Open (Path, Input);
Set_Feature (Reader, Validation_Feature, False);
Set_Feature (Reader, Namespace_Feature, False);
Parse (Reader, Input);
Close (Input);
Doc := Get_Tree (Reader);
List := Get_Elements_By_Tag_Name (Doc, "map");
if Length (List) > 1 then
raise Program_Error with "Too many map elements";
end if;
M := Create (Item (List, 0), Name);
Free (List);
List := Get_Elements_By_Tag_Name (Doc, "objectgroup");
for Index in 1 .. Length (List) loop
N := Item (List, Index - 1);
M.Obj_Group_List.Append (Object_Groups.Load (N));
end loop;
Free (List);
List := Get_Elements_By_Tag_Name (Doc, "tileset");
for Index in 1 .. Length (List) loop
N := Item (List, Index - 1);
M.Tileset_List.Append (Load_Tileset (N, Dir));
end loop;
Free (List);
List := Get_Elements_By_Tag_Name (Doc, "layer");
for Index in 1 .. Length (List) loop
N := Item (List, Index - 1);
M.Layer_List.Append (Tile_Layers.Load (N));
end loop;
Free (List);
Free (Reader);
return M;
end Load;
----------
-- Name --
----------
function Name (This : Map) return String
is (This.Name.all);
-----------
-- Width --
-----------
function Width (This : Map) return Natural
is (This.Width);
------------
-- Height --
------------
function Height (This : Map) return Natural
is (This.Height);
----------------
-- Tile_Width --
----------------
function Tile_Width (This : Map) return Natural
is (This.Tile_Width);
-----------------
-- Tile_Height --
-----------------
function Tile_Height (This : Map) return Natural
is (This.Tile_Height);
---------
-- Put --
---------
procedure Put
(This : Map)
is
begin
Put_Line ("Map " & This.Name.all & ":");
for TS of This.Tileset_List loop
Put_Line ("Tileset " & Tilesets.Name (TS.Id));
end loop;
for L of This.Layer_List loop
Tile_Layers.Put (L);
end loop;
end Put;
----------------------
-- Number_Of_Layers --
----------------------
function Number_Of_Layers (This : Map) return Natural
is (Natural (Layer_Vect.Length (This.Layer_List)));
-----------------
-- First_Index --
-----------------
function First_Layer (This : Map) return Natural
is (Natural (Layer_Vect.First_Index (This.Layer_List)));
----------------
-- Last_Index --
----------------
function Last_Layer (This : Map) return Natural
is (Natural (Layer_Vect.Last_Index (This.Layer_List)));
-----------
-- Layer --
-----------
function Layer (This : Map; Index : Natural) return Tile_Layers.Tile_Layer
is (This.Layer_List.Element (Index));
-----------------
-- Master_Tile --
-----------------
function Master_Tile (M : Map;
Id : Tilesets.Map_Tile_Id)
return Tilesets.Master_Tile_Id
is
use Tilesets;
First_Id : Map_Tile_Id := 0;
TS_Id : Tileset_Id := Invalid_Tileset;
begin
if Id = 0 then
return No_Tile;
end if;
for TS of M.Tileset_List loop
if TS.First_Tile > Id then
exit;
else
TS_Id := TS.Id;
First_Id := TS.First_Tile;
end if;
end loop;
return Convert (TS_Id, Local_Tile_Id (Id - First_Id));
end Master_Tile;
------------------------
-- First_Object_Group --
------------------------
function First_Object_Group (This : Map) return Natural
is (This.Obj_Group_List.First_Index);
-----------------------
-- Last_Object_Group --
-----------------------
function Last_Object_Group (This : Map) return Natural
is (This.Obj_Group_List.Last_Index);
------------------
-- Object_Group --
------------------
function Object_Group (This : Map; Index : Natural)
return Object_Groups.Object_Group
is (This.Obj_Group_List.Element (Index));
---------------------------
-- Generate_GESTE_Source --
---------------------------
procedure Generate_GESTE_Source (M : Map;
Package_Name : String;
Filepath : String)
is
Output : File_Type;
Indent : Natural := 0;
procedure P (Str : String);
procedure PL (Str : String);
procedure NL;
procedure Put_Object (M : Map;
Obj : Object_Groups.Object);
-------
-- P --
-------
procedure P (Str : String) is
begin
Put (Output, Str);
end P;
--------
-- PL --
--------
procedure PL (Str : String) is
begin
for X in 1 .. Indent loop
Put (Output, " ");
end loop;
Put_Line (Output, Str);
end PL;
--------
-- NL --
--------
procedure NL is
begin
New_Line (Output);
end NL;
----------------
-- Put_Object --
----------------
procedure Put_Object (M : Map;
Obj : Object_Groups.Object)
is
begin
PL ("Kind => " & Obj.Kind'Img & ",");
PL ("Id => " & Obj.Id'Img & ",");
if Obj.Name /= null then
PL ("Name => new String'(""" & Obj.Name.all & """),");
else
PL ("Name => null,");
end if;
PL ("X => " & Obj.Pt.X'Img & ",");
PL ("Y => " & Obj.Pt.Y'Img & ",");
PL ("Width => " & Obj.Width'Img & ",");
PL ("Height => " & Obj.Height'Img & ",");
PL ("Flip_Vertical => " & Obj.Flip_Vertical'Img & ",");
PL ("Flip_Horizontal => " & Obj.Flip_Horizontal'Img & ",");
PL ("Tile_Id => " & Master_Tile (M, Obj.Tile_Id)'Img & ",");
if Obj.Str /= null then
PL ("Str => new String'(""" & Obj.Str.all & """)");
else
PL ("Str => null");
end if;
end Put_Object;
begin
Create (Output, Out_File, Filepath);
PL ("with GESTE;");
PL ("with GESTE.Grid;");
PL ("pragma Style_Checks (Off);");
PL ("package " & Package_Name & " is");
NL;
Indent := Indent + 3;
PL ("-- " & M.Name.all);
PL ("Width : constant :=" & M.Width'Img & ";");
PL ("Height : constant :=" & M.Height'Img & ";");
PL ("Tile_Width : constant :=" & M.Tile_Width'Img & ";");
PL ("Tile_Height : constant :=" & M.Tile_Height'Img & ";");
NL;
for L of M.Layer_List loop
declare
Layer_Ada_Id : constant String := To_Ada_Identifier (Name (L));
begin
PL ("-- " & Name (L));
PL ("package " & Layer_Ada_Id & " is");
Indent := Indent + 3;
PL ("Width : constant := " & Width (L)'Img & ";");
PL ("Height : constant := " & Width (L)'Img & ";");
PL ("Data : aliased GESTE.Grid.Grid_Data :=");
P (" (");
for X in 1 .. Width (L) loop
if X /= 1 then
P (" ");
end if;
P ("(");
for Y in 1 .. Height (L) loop
P (Master_Tile (M, Tile (L, X, Y))'Img);
if Y /= Height (L) then
P (",");
end if;
end loop;
P (")");
if X /= Width (L) then
P (",");
NL;
else
P (")");
end if;
end loop;
PL (";");
Indent := Indent - 3;
PL ("end " & Layer_Ada_Id & ";");
NL;
end;
end loop;
for G of M.Obj_Group_List loop
declare
Group_Ada_Id : constant String := To_Ada_Identifier (Name (G));
begin
PL ("package " & Group_Ada_Id & " is");
Indent := Indent + 3;
if Length (G) /= 0 then
-- Objects as array
PL ("Objects : Object_Array :=");
Indent := Indent + 2;
PL ("(");
Indent := Indent + 2;
for Index in First_Index (G) .. Last_Index (G) loop
declare
Obj : constant Object_Groups.Object :=
Get_Object (G, Index);
begin
PL (Index'Img & " => (");
Indent := Indent + 2;
Put_Object (M, Obj);
Indent := Indent - 2;
if Index = Last_Index (G) then
PL (")");
else
PL ("),");
end if;
end;
end loop;
Indent := Indent - 2;
PL (");");
Indent := Indent - 2;
end if;
if Length (G) /= 0 then
-- Object as indivial declaration
for Index in First_Index (G) .. Last_Index (G) loop
declare
Obj : constant Object_Groups.Object :=
Get_Object (G, Index);
begin
if Obj.Name /= null then
PL (TCG.Utils.To_Ada_Identifier (Obj.Name.all) &
" : aliased constant Object := (");
Indent := Indent + 2;
Put_Object (M, Obj);
PL (");");
Indent := Indent - 2;
end if;
end;
end loop;
end if;
Indent := Indent - 3;
PL ("end " & Group_Ada_Id & ";");
end;
end loop;
Indent := Indent - 3;
PL ("end " & Package_Name & ";");
Close (Output);
end Generate_GESTE_Source;
----------------------------
-- Generate_LibGBA_Source --
----------------------------
procedure Generate_LibGBA_Source (M : Map;
Package_Name : String;
Filepath : String)
is
Output : File_Type;
Indent : Natural := 0;
procedure P (Str : String);
procedure PL (Str : String);
procedure NL;
procedure Put_Object (M : Map;
Obj : Object_Groups.Object);
-------
-- P --
-------
procedure P (Str : String) is
begin
Put (Output, Str);
end P;
--------
-- PL --
--------
procedure PL (Str : String) is
begin
for X in 1 .. Indent loop
Put (Output, " ");
end loop;
Put_Line (Output, Str);
end PL;
--------
-- NL --
--------
procedure NL is
begin
New_Line (Output);
end NL;
----------------
-- Put_Object --
----------------
procedure Put_Object (M : Map;
Obj : Object_Groups.Object)
is
begin
PL ("Kind => " & Obj.Kind'Img & ",");
PL ("Id => " & Obj.Id'Img & ",");
if Obj.Name /= null then
-- PL ("Name => new String'(""" & Obj.Name.all & """),");
PL ("Name => null,");
else
PL ("Name => null,");
end if;
PL ("X => " & Obj.Pt.X'Img & ",");
PL ("Y => " & Obj.Pt.Y'Img & ",");
PL ("Width => " & Obj.Width'Img & ",");
PL ("Height => " & Obj.Height'Img & ",");
PL ("Flip_Vertical => " & Obj.Flip_Vertical'Img & ",");
PL ("Flip_Horizontal => " & Obj.Flip_Horizontal'Img & ",");
PL ("Tile_Id => " & Master_Tile (M, Obj.Tile_Id)'Img & ",");
if Obj.Str /= null then
-- PL ("Str => new String'(""" & Obj.Str.all & """)");
PL ("Str => null");
else
PL ("Str => null");
end if;
end Put_Object;
begin
pragma Style_Checks ("M200");
Create (Output, Out_File, Filepath);
PL ("with GBA.Graphics.Background.Viewport;");
PL ("pragma Style_Checks (Off);");
PL ("package " & Package_Name & " is");
NL;
Indent := Indent + 3;
PL ("-- " & M.Name.all);
PL ("Width : constant :=" & M.Width'Img & ";");
PL ("Height : constant :=" & M.Height'Img & ";");
PL ("Tile_Width : constant :=" & M.Tile_Width'Img & ";");
PL ("Tile_Height : constant :=" & M.Tile_Height'Img & ";");
NL;
for L of M.Layer_List loop
declare
Layer_Ada_Id : constant String := To_Ada_Identifier (Name (L));
begin
PL ("-- " & Name (L));
PL ("package " & Layer_Ada_Id & " is");
Indent := Indent + 3;
PL ("Width : constant := " & Width (L)'Img & ";");
PL ("Height : constant := " & Height (L)'Img & ";");
PL ("Data : aliased GBA.Graphics.Background.Viewport.Raw_Screenblock :=");
P (" (");
for Y in 1 .. Height (L) loop
if Y /= 1 then
P (" ");
end if;
for X in 1 .. Width (L) loop
P (Master_Tile (M, Tile (L, X, Y))'Img);
if X /= Width (L) then
P (",");
end if;
end loop;
if Y /= Height (L) then
P (",");
NL;
else
P (")");
end if;
end loop;
PL (";");
PL ("Info : constant GBA.Graphics.Background.Viewport.Map_Info := (Data'Access, Width, Height);");
Indent := Indent - 3;
PL ("end " & Layer_Ada_Id & ";");
NL;
end;
end loop;
for G of M.Obj_Group_List loop
declare
Group_Ada_Id : constant String := To_Ada_Identifier (Name (G));
begin
PL ("package " & Group_Ada_Id & " is");
Indent := Indent + 3;
if Length (G) /= 0 then
-- Objects as array
PL ("Objects : Object_Array :=");
Indent := Indent + 2;
PL ("(");
Indent := Indent + 2;
for Index in First_Index (G) .. Last_Index (G) loop
declare
Obj : constant Object_Groups.Object :=
Get_Object (G, Index);
begin
PL (Index'Img & " => (");
Indent := Indent + 2;
Put_Object (M, Obj);
Indent := Indent - 2;
if Index = Last_Index (G) then
PL (")");
else
PL ("),");
end if;
end;
end loop;
Indent := Indent - 2;
PL (");");
Indent := Indent - 2;
end if;
if Length (G) /= 0 then
-- Object as indivial declaration
for Index in First_Index (G) .. Last_Index (G) loop
declare
Obj : constant Object_Groups.Object :=
Get_Object (G, Index);
begin
if Obj.Name /= null then
PL (TCG.Utils.To_Ada_Identifier (Obj.Name.all) &
" : aliased constant Object := (");
Indent := Indent + 2;
Put_Object (M, Obj);
PL (");");
Indent := Indent - 2;
end if;
end;
end loop;
end if;
Indent := Indent - 3;
PL ("end " & Group_Ada_Id & ";");
end;
end loop;
Indent := Indent - 3;
PL ("end " & Package_Name & ";");
Close (Output);
end Generate_LibGBA_Source;
--------------------------
-- Generate_RSTE_Source --
--------------------------
procedure Generate_RSTE_Source (M : Map;
Filepath : String)
is
Output : File_Type;
Indent : Natural := 0;
procedure P (Str : String);
procedure PL (Str : String);
procedure NL;
procedure Put_Object (M : Map;
Obj : Object_Groups.Object);
function Rust_Boolean (B : Boolean) return String;
function Rust_Object_Kind (O : Object_Kind) return String;
------------------
-- Rust_Boolean --
------------------
function Rust_Boolean (B : Boolean) return String
is (if B then "true" else "false");
----------------------
-- Rust_Object_Kind --
----------------------
function Rust_Object_Kind (O : Object_Kind) return String
is (case O is
when Point_Obj => "super::super::ObjectKind::Point",
when Rectangle_Obj => "super::super::ObjectKind::Rectangle",
when Ellipse_Obj => "super::super::ObjectKind::Ellipse",
when Polygon_Obj => "super::super::ObjectKind::Polygon",
when Tile_Obj => "super::super::ObjectKind::Tile",
when Text_Obj => "super::super::ObjectKind::Text");
-------
-- P --
-------
procedure P (Str : String) is
begin
Put (Output, Str);
end P;
--------
-- PL --
--------
procedure PL (Str : String) is
begin
for X in 1 .. Indent loop
Put (Output, " ");
end loop;
Put_Line (Output, Str);
end PL;
--------
-- NL --
--------
procedure NL is
begin
New_Line (Output);
end NL;
----------------
-- Put_Object --
----------------
procedure Put_Object (M : Map;
Obj : Object_Groups.Object)
is
begin
PL ("kind : " & Rust_Object_Kind (Obj.Kind) & ",");
PL ("id : " & Obj.Id'Img & ",");
if Obj.Name /= null then
PL ("name :""" & Obj.Name.all & """,");
else
PL ("name : """",");
end if;
PL ("x : " & Obj.Pt.X'Img & ",");
PL ("y : " & Obj.Pt.Y'Img & ",");
PL ("width : " & Obj.Width'Img & ",");
PL ("height : " & Obj.Height'Img & ",");
PL ("flip_vertical : " & Rust_Boolean (Obj.Flip_Vertical) & ",");
PL ("flip_horizontal : " & Rust_Boolean (Obj.Flip_Horizontal) & ",");
PL ("tile_id : " & Master_Tile (M, Obj.Tile_Id)'Img & ",");
if Obj.Str /= null then
PL ("str : """ & Obj.Str.all & """,");
else
PL ("str : """",");
end if;
end Put_Object;
begin
Create (Output, Out_File, Filepath);
PL ("// " & M.Name.all);
PL ("#[allow(unused_imports)]");
NL;
PL ("const WIDTH : usize =" & M.Width'Img & ";");
PL ("const HEIGHT : usize =" & M.Height'Img & ";");
PL ("const TILE_WIDTH : usize =" & M.Tile_Width'Img & ";");
PL ("const TILE_HEIGHT : usize =" & M.Tile_Height'Img & ";");
NL;
for L of M.Layer_List loop
PL ("pub mod " & To_Rust_Identifier (Name (L)) & " {");
Indent := Indent + 4;
PL ("use sprite_and_tile::*;");
PL ("pub const WIDTH : usize = " & Width (L)'Img & ";");
PL ("pub const HEIGHT : usize = " & Height (L)'Img & ";");
PL ("pub static TILE_MAP_DATA : [usize;" &
Integer'Image (Width (L) * Height (L)) & "] =");
P (" [");
for Y in 1 .. Height (L) loop
if Y /= 1 then
P (" ");
end if;
for X in 1 .. Width (L) loop
P (Master_Tile (M, Tile (L, X, Y))'Img);
P (",");
end loop;
if Y /= Height (L) then
NL;
end if;
end loop;
PL ("];");
PL ("static TILE_MAP : TileMap =");
PL (" TileMap {width : WIDTH,");
PL (" height : HEIGHT,");
PL (" map : & TILE_MAP_DATA}; ");
Indent := Indent - 4;
PL ("}");
NL;
end loop;
for G of M.Obj_Group_List loop
PL ("pub mod " & To_Rust_Identifier (Name (G)) & " {");
Indent := Indent + 3;
if Length (G) /= 0 then
-- Objects as array
PL ("pub static OBJECTS : [super::super::Object;" &
Length (G)'Img & "] =");
Indent := Indent + 2;
PL ("[");
Indent := Indent + 2;
for Index in First_Index (G) .. Last_Index (G) loop
declare
Obj : constant Object_Groups.Object :=
Get_Object (G, Index);
begin
PL ("super::super::Object {");
Indent := Indent + 2;
Put_Object (M, Obj);
Indent := Indent - 2;
PL ("},");
end;
end loop;
Indent := Indent - 2;
PL ("];");
Indent := Indent - 2;
end if;
if Length (G) /= 0 then
-- Object as indivial declaration
for Index in First_Index (G) .. Last_Index (G) loop
declare
Obj : constant Object_Groups.Object :=
Get_Object (G, Index);
begin
if Obj.Name /= null then
PL ("pub static " &
TCG.Utils.To_Rust_Static_Identifier (Obj.Name.all) &
" : super::super::Object = " &
"super::super::Object {");
Indent := Indent + 2;
Put_Object (M, Obj);
PL ("};");
Indent := Indent - 2;
end if;
end;
end loop;
end if;
Indent := Indent - 3;
PL ("}");
end loop;
Close (Output);
end Generate_RSTE_Source;
-------------------------
-- Fill_Master_Tileset --
-------------------------
procedure Fill_Master_Tileset (M : Map) is
Unused : Tilesets.Master_Tile_Id;
begin
-- For all layers...
for L of M.Layer_List loop
-- For all tiles...
for X in 1 .. Width (L) loop
for Y in 1 .. Height (L) loop
-- Convert to a Master_Tile_ID to make sure the tile is
-- added to the master tile set.
Unused := Master_Tile (M, Tile (L, X, Y));
end loop;
end loop;
-- For all groups...
for G of M.Obj_Group_List loop
if Length (G) /= 0 then
-- For all objects...
for Index in First_Index (G) .. Last_Index (G) loop
declare
Obj : constant Object_Groups.Object :=
Get_Object (G, Index);
begin
-- Convert the tile to a Master_Tile_ID to make sure the
-- tile is added to the master tile set.
Unused := Master_Tile (M, Obj.Tile_Id);
end;
end loop;
end if;
end loop;
end loop;
end Fill_Master_Tileset;
end TCG.Maps;
|
src/main/antlr/org/zavodnikov/antlr4/brackets/Brackets.g4 | dzavodnikov/ANTLR4 | 3 | 7103 | grammar Brackets;
@header {
package org.zavodnikov.antlr4.brackets;
}
r : e+
;
e : e e
| '(' e ')'
| '[' e ']'
| '()'
| '[]'
;
WS : [ \t\r\n]+ -> skip
;
|
src/asis/a4g-stand.adb | My-Colaborations/dynamo | 15 | 4852 | <reponame>My-Colaborations/dynamo
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . S T A N D --
-- --
-- B o d y --
-- --
-- Copyright (c) 1999-2003, Free Software Foundation, Inc. --
-- --
-- ASIS-for-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 --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY 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 ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 59 Temple Place --
-- - Suite 330, Boston, MA 02111-1307, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by Ada Core Technologies Inc --
-- (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
with Asis.Set_Get; use Asis.Set_Get;
with A4G.A_Types; use A4G.A_Types;
with A4G.Contt; use A4G.Contt;
with Stand; use Stand;
with Atree; use Atree;
with Sinfo; use Sinfo;
package body A4G.Stand is
--------------------------------
-- Get_Numeric_Error_Renaming --
--------------------------------
function Get_Numeric_Error_Renaming return Asis.Element is
Result : Asis.Element := Numeric_Error_Template;
begin
Set_Encl_Tree (Result, Get_Current_Tree);
Set_Enclosing_Context (Result, Get_Current_Cont);
Set_Obtained (Result, A_OS_Time);
return Result;
end Get_Numeric_Error_Renaming;
---------------------------
-- Is_Standard_Char_Type --
---------------------------
function Is_Standard_Char_Type (N : Node_Id) return Boolean is
Result : Boolean := False;
Type_Ent : Entity_Id;
begin
if Sloc (N) = Standard_Location and then
Nkind (N) = N_Enumeration_Type_Definition
then
Type_Ent := Defining_Identifier (Parent (N));
if Type_Ent in Standard_Character .. Standard_Wide_Character then
Result := True;
end if;
end if;
return Result;
end Is_Standard_Char_Type;
-------------------------
-- Standard_Char_Decls --
-------------------------
function Standard_Char_Decls
(Type_Definition : Asis.Type_Definition;
Implicit : Boolean := False)
return Asis.Element_List
is
Arg_Node : constant Node_Id := Node (Type_Definition);
Rel_Len : Asis.ASIS_Positive;
Type_Ent : Entity_Id;
Tmp_Template : Element := Char_Literal_Spec_Template;
begin
-- Adjusting the template for the artificial character literal
-- specification:
Set_Encl_Unit_Id (Tmp_Template, Encl_Unit_Id (Type_Definition));
Set_Encl_Tree (Tmp_Template, Encl_Tree (Type_Definition));
Set_Node (Tmp_Template, Arg_Node);
Set_R_Node (Tmp_Template, Arg_Node);
Set_Enclosing_Context (Tmp_Template, Encl_Cont_Id (Type_Definition));
Set_Obtained (Tmp_Template, A_OS_Time);
Set_From_Instance (Tmp_Template, Is_From_Instance (Type_Definition));
Set_From_Implicit (Tmp_Template, Implicit);
Set_From_Inherited (Tmp_Template, Implicit);
if Implicit then
Set_Special_Case (Tmp_Template, Not_A_Special_Case);
Set_Node_Field_1 (Tmp_Template, Parent (Arg_Node));
end if;
Type_Ent := Defining_Identifier (Parent (Arg_Node));
while Type_Ent /= Etype (Type_Ent) loop
Type_Ent := Etype (Type_Ent);
end loop;
if Type_Ent = Standard_Character then
Rel_Len := 256;
else
Rel_Len := 65536;
end if;
declare
Result : Asis.Element_List (1 .. Rel_Len) := (others => Tmp_Template);
begin
for J in 1 .. Rel_Len loop
Set_Character_Code (Result (J), Char_Code (J - 1));
end loop;
return Result;
end;
end Standard_Char_Decls;
----------------------
-- Stand_Char_Image --
----------------------
function Stand_Char_Image (Code : Char_Code) return Wide_String is
function Hex_Digits (J : Natural) return Wide_String;
-- converts J into Hex digits string
function Hex_Digits (J : Natural) return Wide_String is
Hexd : constant Wide_String := "0123456789abcdef";
begin
if J > 16#FF# then
return Hex_Digits (J / 256) & Hex_Digits (J mod 256);
else
return Hexd (J / 16 + 1) & Hexd (J mod 16 + 1);
end if;
end Hex_Digits;
begin
if Code in 16#20# .. 16#7E# then
return ''' & Wide_Character'Val (Code) & ''';
else
return "'[""" & Hex_Digits (Natural (Code)) & """]'";
end if;
end Stand_Char_Image;
end A4G.Stand;
|
qsort_demo.adb | M1nified/Ada-Samples | 0 | 17781 | -- przykłady: pakiet, select w zasdaniu, access do zadania jako parametr wywołania
with Qsort;
with Ada.Text_Io;
use Qsort,Ada.Text_Io;
procedure Qsort_demo is
Arr1 : vector := (1,6,2,67,3);
Arr1_ptr : vector_ptr;
begin
Arr1_ptr := new vector(Arr1'range);
Put_Line(Integer'Image(Arr1'Length));
Put_Line(Integer'Image(Arr1'Length));
Put_Line(Integer'Image(Arr1_ptr'Length));
for i in Arr1'range loop
Arr1_ptr(i) := Arr1(i);
end loop;
Qsort.Sort(Arr1_ptr);
null;
end Qsort_demo;
|
programs/oeis/105/A105955.asm | neoneye/loda | 22 | 161787 | ; A105955: a(n) = Fibonacci(n) mod 11.
; 0,1,1,2,3,5,8,2,10,1,0,1,1,2,3,5,8,2,10,1,0,1,1,2,3,5,8,2,10,1,0,1,1,2,3,5,8,2,10,1,0,1,1,2,3,5,8,2,10,1,0,1,1,2,3,5,8,2,10,1,0,1,1,2,3,5,8,2,10,1,0,1,1,2,3,5,8,2,10,1,0,1,1,2,3,5,8,2,10,1,0,1,1,2,3,5,8,2,10,1
mod $0,10
seq $0,45 ; Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
mod $0,11
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/stack_usage1_pkg.ads | best08618/asylo | 7 | 18112 | <reponame>best08618/asylo<gh_stars>1-10
package Stack_Usage1_Pkg is
function Ident_Int (X : Integer) return Integer;
type R is
record
C0, C1, C2, C3, C4, C5, C6, C7, C8, C9 : Integer;
end record;
procedure My_Proc (X : R);
end Stack_Usage1_Pkg;
|
programs/oeis/039/A039112.asm | neoneye/loda | 22 | 101963 | ; A039112: Numbers whose base-10 representation has the same number of 0's and 1's.
; 2,3,4,5,6,7,8,9,10,22,23,24,25,26,27,28,29,32,33,34,35,36,37,38,39,42,43,44,45,46,47,48,49,52,53,54,55,56,57,58,59,62,63,64,65,66,67,68,69,72,73,74,75,76,77,78,79,82,83,84,85,86,87,88,89,92,93,94,95,96
mov $1,$0
mov $2,$0
lpb $2
add $1,$0
add $1,2
add $3,1
lpb $3
add $0,9
sub $1,1
sub $1,$0
trn $3,3
lpe
lpb $1
add $0,2
trn $1,8
mov $2,1
lpe
lpe
add $0,2
|
libsrc/_DEVELOPMENT/adt/b_array/c/sccz80/b_array_push_back.asm | jpoikela/z88dk | 640 | 28992 |
; size_t b_array_push_back(b_array_t *a, int c)
SECTION code_clib
SECTION code_adt_b_array
PUBLIC b_array_push_back
EXTERN b_array_append
defc b_array_push_back = b_array_append
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _b_array_push_back
defc _b_array_push_back = b_array_push_back
ENDIF
|
fluidcore/main.asm | bushy555/ZX-Spectrum-1-Bit-Routines | 59 | 177573 | <reponame>bushy555/ZX-Spectrum-1-Bit-Routines<gh_stars>10-100
;fluidcore
;4 channel wavetable player for the zx spectrum beeper
;by utz 03'2016
NMOS EQU 1
CMOS EQU 2
IF Z80=NMOS ;values for NMOS Z80
pon equ #18fe
poff equ 0
seta equ #af ;xor a
ENDIF
IF Z80=CMOS ;values for CMOS Z80
pon equ #00fe
poff equ #18
seta equ #79 ;ld c,a
ENDIF
;org #8065
org origin ;org address is defined externally by compile script
init
ei ;detect kempston
halt
in a,(#1f)
inc a
jr nz,_skip
ld (maskKempston),a
_skip
di
exx
push hl ;preserve HL' for return to BASIC
ld (oldSP),sp
ld hl,musicdata
ld (seqpntr),hl
ld ixl,0
;******************************************************************
rdseq
seqpntr equ $+1
ld sp,0
xor a
pop de ;pattern pointer to DE
or d
ld (seqpntr),sp
jr nz,rdptn0
;jp exit ;uncomment to disable looping
ld sp,loop ;get loop point - comment out when disabling looping
jr rdseq+3
exit
oldSP equ $+1
ld sp,0
pop hl
exx
ei
ret
;************************************************************************************************
updateTimer
db #ed,#71
updateTimerND
ld a,i
dec a
jr z,rdptn
ld i,a
ld a,#ff
ex af,af'
jp (ix)
updateTimerOD
ld a,i
dec a
jr z,rdptn
ld i,a
ld a,#ff
ex af,af'
jp core16
;************************************************************************************************
rdptn0
ld (patpntr),de
rdptn
in a,(#1f) ;read joystick
maskKempston equ $+1
and #1f
ld d,a
in a,(#fe) ;read kbd
cpl
or d
and #1f
jp nz,exit
patpntr equ $+1 ;fetch pointer to pattern data
ld sp,0
pop af
jr z,rdseq
ld i,a
pop hl ;10 ;freq.ch1
ld (buffer),hl ;16
pop hl ;10 ;freq.ch2
ld (buffer+4),hl ;16
pop de ;10 ;sample.ch1/2
ld a,d ;4
ld (buffer+3),a ;13
ld a,e ;4
ld (buffer+7),a ;13
pop hl ;10 ;freq.ch3
ld (buffer+8),hl ;16
pop hl ;10 ;freq.ch4
ld (buffer+12),hl ;20
pop de ;10 ;sample.ch3/4
ld a,d ;4
ld (buffer+11),a ;13
ld a,e ;4
ld (buffer+15),a ;13
ld (patpntr),sp ;20
;212
xor a
IF Z80=NMOS
out (#fe),a
ENDIF
ld h,a
ld l,a
ld d,a
ld e,a
exx
ld h,a
ld l,a
ld d,a
ld e,a
ex af,af'
ld a,#fe ;set timer lo-byte
IF Z80=CMOS
out (#fe),a
ENDIF
ex af,af'
;ld bc,pon
jp pEntry
;jp core0
;************************************************************************************************
core0 ;volume 0
IF (LOW($))!=0
org 256*(1+(HIGH($)))
ENDIF
basec equ HIGH($)
_frame1
db #ed,#71 ;12___12
ex af,af' ;4
dec a ;4
jp z,updateTimerND ;10
ex af,af' ;4
pEntry
ld sp,buffer ;10
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyh,a ;8
ld bc,pon ;10
ds 9 ;48 ;9x nop
ex af,af'
dec a
ex af,af'
;152
_frame2
db #ed,#71 ;12___12
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyl,a ;8
ex de,hl ;4
exx ;4
ld bc,pon ;10
ds 17 ;68 ;14x nop
;152
_frame3
db #ed,#71 ;12___12
nop ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,iyh ;8
add a,iyl ;8
ld iyh,a ;8
ld bc,pon ;10
ds 15 ;60 ;12x nop
;152
_frame4
db #ed,#71 ;12___12
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ex de,hl ;4
add a,iyh ;8
exx ;4
add a,basec ;7
ld ixh,a ;8
ld bc,pon ;10
ds 7 ;28
cp maxc ;7
jp nc,overdrive ;10
jp (ix) ;8
;152
;************************************************************************************************
buffer
ds 16 ;4x base freq, 4x base sample pointer
;************************************************************************************************
core1 org 256*(1+(HIGH($))) ;volume 1 ... 12 t-states
_frame1
out (c),b ;12___
db #ed,#71 ;12___12
ex af,af' ;4
dec a ;4
jp z,updateTimerND ;10
ex af,af' ;4
ld sp,buffer ;10
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyh,a ;8
ld bc,pon ;10
ds 6 ;36 ;9x nop
ex af,af'
dec a
ex af,af'
;152
_frame2
out (c),b ;12
db #ed,#71 ;12___12
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyl,a ;8
ex de,hl ;4
exx ;4
ld bc,pon ;10
ds 14 ;56 ;14x nop
;152
_frame3
out (c),b ;12
db #ed,#71 ;12___12
nop ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,iyh ;8
add a,iyl ;8
ld iyh,a ;8
ld bc,pon ;10
ds 12 ;48 ;12x nop
;152
_frame4
out (c),b ;12___
db #ed,#71 ;12___12
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ex de,hl ;4
add a,iyh ;8
exx ;4
add a,basec ;7
ld ixh,a ;8
ld bc,pon ;10
ds 4 ;16
cp maxc ;7
jp nc,overdrive ;10
jp (ix) ;8
;152
;************************************************************************************************
core2 org 256*(1+(HIGH($))) ;volume 2 ... 16 t-states
_frame1
out (c),b ;12___
ex af,af' ;4
db #ed,#71 ;12___16
dec a ;4
jp z,updateTimerND ;10
ex af,af' ;4
ld sp,buffer ;10
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyh,a ;8
ld bc,pon ;10
ds 6 ;36 ;9x nop
ex af,af'
dec a
ex af,af'
;152
_frame2
out (c),b ;12
ex de,hl ;4
db #ed,#71 ;12___16
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyl,a ;8
ex de,hl ;4
exx ;4
ld bc,pon ;10
ds 14 ;56 ;14x nop
;152
_frame3
out (c),b ;12
nop ;4
db #ed,#71 ;12___16
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,iyh ;8
add a,iyl ;8
ld iyh,a ;8
ld bc,pon ;10
ds 12 ;48 ;12x nop
;152
_frame4
out (c),b ;12___
ex de,hl ;4
db #ed,#71 ;12___16
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ex de,hl ;4
add a,iyh ;8
exx ;4
add a,basec ;7
ld ixh,a ;8
ld bc,pon ;10
ds 4 ;16
cp maxc ;10
jp nc,overdrive ;7
jp (ix) ;8
;152
;************************************************************************************************
core3 org 256*(1+(HIGH($))) ;volume 3 ... 24 t-states
_frame1
out (c),b ;12___
ex af,af' ;4
dec a ;4
nop ;4
db #ed,#71 ;12___24
jp z,updateTimerND ;10
ex af,af' ;4
ld sp,buffer ;10
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyh,a ;8
ld bc,pon ;10
ds 5 ;32
ex af,af'
dec a
ex af,af'
;152
_frame2
out (c),b ;12
ex de,hl ;4
ds 2 ;8
db #ed,#71 ;12___24
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyl,a ;8
ex de,hl ;4
exx ;4
ld bc,pon ;10
ds 12 ;48 ;14x nop
;152
_frame3
out (c),b ;12
nop ;4
nop ;4
nop ;4
db #ed,#71 ;12___24
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,iyh ;8
add a,iyl ;8
ld iyh,a ;8
ld bc,pon ;10
ds 10 ;40 ;10x nop
;152
_frame4
out (c),b ;12___
ex de,hl ;4
nop ;4
nop ;4
db #ed,#71 ;12___24
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ex de,hl ;4
add a,iyh ;8
exx ;4
add a,basec ;7
ld ixh,a ;8
ld bc,pon ;10
ds 2 ;8
cp maxc ;7
jp nc,overdrive ;10
jp (ix) ;8
;152
;************************************************************************************************
core4 org 256*(1+(HIGH($))) ;volume 4 ... 32 t-states
_frame1
out (c),b ;12___
ex af,af' ;4
dec a ;4
ds 3 ;12
db #ed,#71 ;12___32
jp z,updateTimerND ;10
ex af,af' ;4
ld sp,buffer ;10
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyh,a ;8
ld bc,pon ;10
ds 3 ;24
ex af,af'
dec a
ex af,af'
;152
_frame2
out (c),b ;12
ex de,hl ;4
ds 4 ;16
db #ed,#71 ;12___32
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyl,a ;8
ex de,hl ;4
exx ;4
ld bc,pon ;10
ds 10 ;40
;152
_frame3
out (c),b ;12
nop ;4
nop ;4
nop ;4
nop ;4
nop ;4
db #ed,#71 ;12___32
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,iyh ;8
add a,iyl ;8
ld iyh,a ;8
ld bc,pon ;10
ds 8 ;32 ;12x nop
;152
_frame4
out (c),b ;12___
ex de,hl ;4
pop bc ;10
ld a,poff ;7
out (#fe),a ;11___32
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ex de,hl ;4
add a,iyh ;8
exx ;4
add a,basec ;7
ld ixh,a ;8
ld bc,pon ;10
ld bc,pon ;10 ;timing
cp maxc ;7
jp nc,overdrive ;10
jp (ix) ;8
;152
;************************************************************************************************
core5 org 256*(1+(HIGH($))) ;volume 5 ... 40 t-states
_frame1
out (c),b ;12___
ex af,af' ;4
dec a ;4
jp z,updateTimer ;10
ld sp,buffer ;10
db #ed,#71 ;12___40
ex af,af' ;4
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyh,a ;8
ld bc,pon ;10
ds 6 ;36
ex af,af'
dec a
ex af,af'
;152
_frame2
out (c),b ;12
ex de,hl ;4
ds 6 ;24
db #ed,#71 ;12___40
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyl,a ;8
ex de,hl ;4
exx ;4
ld bc,pon ;10
ds 8 ;32
;152
_frame3
out (c),b ;12
ds 7 ;28
db #ed,#71 ;12___40
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,iyh ;8
add a,iyl ;8
ld iyh,a ;8
ld bc,pon ;10
ds 6 ;24
;152
_frame4
out (c),b ;12___
;xor a ;4
db seta
ex de,hl ;4
pop bc ;10
add hl,bc ;11
out (#fe),a ;11___40
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ex de,hl ;4
add a,iyh ;8
exx ;4
add a,basec ;7
ld ixh,a ;8
ld bc,pon ;10
ld (#0000),a ;13 ;timing
cp maxc ;7
jp nc,overdrive ;10
jp (ix) ;8
;152
;************************************************************************************************
core6 org 256*(1+(HIGH($))) ;volume 6 ... 48 t-states
_frame1
out (c),b ;12___
ex af,af' ;4
dec a ;4
jp z,updateTimer ;10
ex af,af' ;4
ld sp,buffer ;10
nop ;4
db #ed,#71 ;12___48
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyh,a ;8
ld bc,pon ;10
ds 5 ;32
ex af,af'
dec a
ex af,af'
;152
_frame2
out (c),b ;12
ex de,hl ;4
ds 8 ;32
db #ed,#71 ;12___48
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyl,a ;8
ex de,hl ;4
exx ;4
ld bc,pon ;10
ds 6 ;24
;152
_frame3
out (c),b ;12
ds 9 ;36
db #ed,#71 ;12___48
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,iyh ;8
add a,iyl ;8
ld iyh,a ;8
ld bc,pon ;10
ds 4 ;16 ;12x nop
;152
_frame4
out (c),b ;12___
;xor a ;4
db seta
ex de,hl ;4
pop bc ;10
add hl,bc ;11
ds 2 ;8
out (#fe),a ;11___48
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ex de,hl ;4
add a,iyh ;8
exx ;4
add a,basec ;7
ld ixh,a ;8
ld bc,pon ;10
ret z ;5 ;timing - safe while using reasonable values (total vol <#7f)
cp maxc ;7
jp nc,overdrive ;10
jp (ix) ;8
;152
;************************************************************************************************
core7 org 256*(1+(HIGH($))) ;volume 7 ... 56 t-states
_frame1
out (c),b ;12___
ex af,af' ;4
dec a ;4
jp z,updateTimer ;10
ex af,af' ;4
ld sp,buffer ;10
ds 3 ;12
db #ed,#71 ;12___56
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyh,a ;8
ld bc,pon ;10
ds 3 ;24
ex af,af'
dec a
ex af,af'
;152
_frame2
out (c),b ;12
ex de,hl ;4
ds 10 ;40
db #ed,#71 ;12___56
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyl,a ;8
ex de,hl ;4
exx ;4
ld bc,pon ;10
ds 4 ;16
;152
_frame3
out (c),b ;12
ds 11 ;44
db #ed,#71 ;12___56
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,iyh ;8
add a,iyl ;8
ld iyh,a ;8
ld bc,pon ;10
ds 2 ;8 ;12x nop
;152
_frame4
out (c),b ;12___
;xor a ;4
db seta
ex de,hl ;4
pop bc ;10
add hl,bc ;11
dec bc ;6 ;timing
pop bc ;10
out (#fe),a ;11___56
ld c,h ;4
ld a,(bc) ;7
ex de,hl ;4
add a,iyh ;8
exx ;4
add a,basec ;7
ld ixh,a ;8
ld bc,pon ;10
cp maxc ;7
jp nc,overdrive0 ;10
ld a,0 ;7 ;timing
jp (ix) ;8
;152
;************************************************************************************************
core8 org 256*(1+(HIGH($))) ;volume 8 ... 64 t-states
_frame1
out (c),b ;12___
ex af,af' ;4
dec a ;4
jp z,updateTimer ;10
ex af,af' ;4
ld sp,buffer ;10
ds 5 ;20
db #ed,#71 ;12___64
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyh,a ;8
ld bc,pon ;10
nop ;16
ex af,af'
dec a
ex af,af'
;152
_frame2
out (c),b ;12
ex de,hl ;4
ds 12 ;48
db #ed,#71 ;12___64
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyl,a ;8
ex de,hl ;4
exx ;4
ld bc,pon ;10
ds 2 ;8
;152
_frame3
out (c),b ;12
ds 13 ;52
db #ed,#71 ;12___64
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,iyh ;8
add a,iyl ;8
ld iyh,a ;8
ld bc,pon ;10
;152
_frame4
out (c),b ;12___
;xor a ;4
db seta
ex de,hl ;4
pop bc ;10
add hl,bc ;11
dec bc ;6 ;timing
pop bc ;10
ld c,h ;4
ex de,hl ;4
out (#fe),a ;11___64
ld a,(bc) ;7
add a,iyh ;8
exx ;4
add a,basec ;7
ld ixh,a ;8
ld bc,pon ;10
cp maxc ;7
jp nc,overdrive0 ;10
ld a,0 ;7
jp (ix) ;8
;152
;************************************************************************************************
core9 org 256*(1+(HIGH($))) ;volume 9 ... 72 t-states
_frame1
out (c),b ;12___
ex af,af' ;4
dec a ;4
jp z,updateTimer ;10
ex af,af' ;4
ld sp,buffer ;10
ds 4 ;28
ex af,af'
dec a
ex af,af'
db #ed,#71 ;12___72
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyh,a ;8
ld bc,pon ;10
ds 2 ;8
;152
_frame2
out (c),b ;12
ex de,hl ;4
ds 14 ;56
db #ed,#71 ;12___72
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyl,a ;8
ex de,hl ;4
exx ;4
ld bc,pon ;10
;152
_frame3
out (c),b ;12
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld bc,pon ;10
add a,iyh ;8
db #ed,#71 ;12___72
add a,iyl ;8
ld iyh,a ;8
ds 13 ;52
;152
_frame4
out (c),b ;12___
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,basec ;7
ld c,#fe ;7
db #ed,#71 ;12___72
ex de,hl ;4
add a,iyh ;8
exx ;4
ld ixh,a ;8
ld bc,pon ;10
ld r,a ;9
cp maxc ;7
jp nc,overdrive ;10
jp (ix) ;8
;152
;************************************************************************************************
core10 org 256*(1+(HIGH($))) ;volume 10 ... 80 t-states
_frame1
out (c),b ;12___
ex af,af' ;4
dec a ;4
jp z,updateTimer ;10
ex af,af' ;4
ld sp,buffer ;10
ds 6 ;36
ex af,af'
dec a
ex af,af'
db #ed,#71 ;12___80
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld iyh,a ;8
ld bc,pon ;10
;152
_frame2
out (c),b ;12
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ex de,hl ;4
exx ;4
nop ;4
ld bc,pon ;10
db #ed,#71 ;12___80
ld iyl,a ;8
ds 13 ;52
;152
_frame3
out (c),b ;12
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld bc,pon ;10
add a,iyh ;8
add a,iyl ;8
db #ed,#71 ;12___80
ld iyh,a ;8
ds 13 ;52
;152
_frame4
out (c),b ;12___
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,basec ;7
ex de,hl ;4
exx ;4
ld c,#fe ;7
db #ed,#71 ;12___80
add a,iyh ;8
ld ixh,a ;8
ld bc,pon ;10 ;ld b,#18 will be enough
ld r,a ;9
cp maxc ;7
jp nc,overdrive ;10
jp (ix) ;8
;152
;************************************************************************************************
core11 org 256*(1+(HIGH($))) ;volume 11 ... 88 t-states
_frame1
out (c),b ;12___
ex af,af' ;4
dec a ;4
jp z,updateTimer ;10
ex af,af' ;4
ld sp,buffer ;10
pop bc ;10 ;base freq 1
add hl,bc ;11
ld c,#fe ;7
nop ;16
ex af,af'
dec a
ex af,af'
db #ed,#71 ;12___88
pop bc ;10
ld c,h ;4
ld (#0000),a ;13 ;timing
ld a,(bc) ;7
ld iyh,a ;8
ld bc,pon ;10
;152
_frame2
out (c),b ;12
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ex de,hl ;4
exx ;4
nop ;4
ld bc,pon ;10
ld iyl,a ;8
db #ed,#71 ;12___88
ds 13 ;52
;152
_frame3
out (c),b ;12
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld bc,pon ;10
add a,iyh ;8
add a,iyl ;8
ld iyh,a ;8
db #ed,#71 ;12___88
ds 13 ;52
;152
_frame4
out (c),b ;12___
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,basec ;7
add a,iyh ;8
ex de,hl ;4
exx ;4
ld c,#fe ;7
db #ed,#71 ;12___88
ld ixh,a ;8
ld bc,pon ;10
ld r,a ;9
cp maxc ;7
jp nc,overdrive ;10
jp (ix) ;8
;152
;************************************************************************************************
core12 org 256*(1+(HIGH($))) ;volume 12 ... 96 t-states
_frame1
out (c),b ;12___
ex af,af' ;4
dec a ;4
jp z,updateTimer ;10
ex af,af' ;4
ld sp,buffer ;10
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld bc,pon ;10
db #ed,#71 ;12___96
ld iyh,a ;8
ds 6 ;36
ex af,af'
dec a
ex af,af'
;152
_frame2
out (c),b ;12
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ex de,hl ;4
exx ;4
ld bc,pon ;10
ld iyl,a ;8
ds 3 ;12
db #ed,#71 ;12___96
ds 11 ;44
;152
_frame3
out (c),b ;12
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld bc,pon ;10
add a,iyh ;8
add a,iyl ;8
ld iyh,a ;8
ds 2 ;8
db #ed,#71 ;12___96
ds 11 ;44
;152
_frame4
out (c),b ;12___
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,iyh ;8
ex de,hl ;4
add a,basec ;7
ld ixh,a ;8
exx ;4
ld c,#fe ;7
db #ed,#71 ;12___96
ld bc,pon ;10 ;ld b,#18 will do
ld r,a ;9
cp maxc ;7
jp nc,overdrive ;10
jp (ix) ;8
;152
;************************************************************************************************
core13 org 256*(1+(HIGH($))) ;volume 13 ... 104 t-states
_frame1
out (c),b ;12___
ex af,af' ;4
dec a ;4
jp z,updateTimer ;10
ex af,af' ;4
ld sp,buffer ;10
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld bc,pon ;10
ld iyh,a ;8
db #ed,#71 ;12___104
ds 6 ;36
ex af,af'
dec a
ex af,af'
;152
_frame2
out (c),b ;12
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ex de,hl ;4
exx ;4
ld bc,pon ;10
ld iyl,a ;8
ds 5 ;20
db #ed,#71 ;12___104
ds 9 ;36
;152
_frame3
out (c),b ;12
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld bc,pon ;10
add a,iyh ;8
add a,iyl ;8
ld iyh,a ;8
ds 4 ;16
db #ed,#71 ;12___104
ds 9 ;36
;152
_frame4
out (c),b ;12___
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,iyh ;8
ex de,hl ;4
add a,basec ;7
ld ixh,a ;8
exx ;4
ld bc,pon ;10
ret z ;5 ;timing - Z is never set when using reasonable values (total vol <#7f)
db #ed,#71 ;12___104
nop ;4
cp maxc ;7
jp nc,overdrive0 ;10
ld a,0 ;7
jp (ix) ;8
;152
;************************************************************************************************
core14 org 256*(1+(HIGH($))) ;volume 14 ... 112 t-states
_frame1
out (c),b ;12___
ex af,af' ;4
dec a ;4
jp z,updateTimer ;10
ex af,af' ;4
ld sp,buffer ;10
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld bc,pon ;10
ld iyh,a ;8
ds 2 ;8
db #ed,#71 ;12___112
ds 4 ;28
ex af,af'
dec a
ex af,af'
;152
_frame2
out (c),b ;12
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ex de,hl ;4
exx ;4
ld bc,pon ;10
ld iyl,a ;8
ds 7 ;28
db #ed,#71 ;12___112
ds 7 ;28
;152
_frame3
out (c),b ;12
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld bc,pon ;10
add a,iyh ;8
add a,iyl ;8
ld iyh,a ;8
ds 6 ;24
db #ed,#71 ;12___112
ds 7 ;28
;152
_frame4
out (c),b ;12___
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,iyh ;8
ex de,hl ;4
add a,basec ;7
ld ixh,a ;8
exx ;4
dec bc ;6 ;timing
ld bc,pon ;10
cp maxc ;7
db #ed,#71 ;12___112
ld bc,pon ;10
jp nc,overdrive ;10
jp (ix) ;8
;152
;************************************************************************************************
core15 org 256*(1+(HIGH($))) ;volume 15 ... 120 t-states
_frame1
out (c),b ;12___
ex af,af' ;4
dec a ;4
jp z,updateTimer ;10
ex af,af' ;4
ld sp,buffer ;10
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld bc,pon ;10
ld iyh,a ;8
ds 4 ;16
db #ed,#71 ;12___120
ds 2 ;20
ex af,af'
dec a
ex af,af'
;152
_frame2
out (c),b ;12
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ex de,hl ;4
exx ;4
ld bc,pon ;10
ld iyl,a ;8
ds 9 ;36
db #ed,#71 ;12___120
ds 5 ;20
;152
_frame3
out (c),b ;12
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld bc,pon ;10
add a,iyh ;8
add a,iyl ;8
ld iyh,a ;8
ds 8 ;32
db #ed,#71 ;12___120
ds 5 ;20
;152
_frame4
out (c),b ;12___
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,iyh ;8
ex de,hl ;4
add a,basec ;7
ld ixh,a ;8
exx ;4
nop ;4
ld bc,pon ;10
cp maxc ;7
jp nc,overdrivey ;10
db #ed,#71 ;12___120
ds 3 ;12
jp (ix) ;8
;152
;************************************************************************************************
core16 org 256*(1+(HIGH($))) ;volume 16 ... 128 t-states
_frame1
out (c),b ;12___
ex af,af' ;4
dec a ;4
jp z,updateTimer ;10
ex af,af' ;4
ld sp,buffer ;10
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld bc,pon ;10
ld iyh,a ;8
ds 6 ;24
db #ed,#71 ;12___128
;ds 3 ;12
ex af,af'
dec a
ex af,af'
;152
_frame2
out (c),b ;12
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ex de,hl ;4
exx ;4
ld bc,pon ;10
ld iyl,a ;8
ds 11 ;44
db #ed,#71 ;12___128
ds 3 ;12
;152
_frame3
out (c),b ;12
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld bc,pon ;10
add a,iyh ;8
add a,iyl ;8
ld iyh,a ;8
ds 10 ;40
db #ed,#71 ;12___128
ds 3 ;12
;152
_frame4
out (c),b ;12___
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,iyh ;8
ex de,hl ;4
add a,basec ;7
ld ixh,a ;8
exx ;4
ld bc,pon ;7
cp maxc ;7
ld a,0 ;7
nop ;4
nop ;4
jp nc,overdrivex ;10
db #ed,#71 ;12___128
nop ;4
jp (ix) ;8
;152
;************************************************************************************************
;org #90f8 ;handling frames with overdriven volume
org (256*(1+(HIGH($))) - 12)
overdrivey
db #ed,#71
jr overdrive
overdrivex
db #ed,#71
jr core17
overdrive0
ld a,0
overdrive
nop
nop
core17 ;org 256*(1+(HIGH($))) ;volume 17 ... 152 t-states
maxc equ (1 + (HIGH($)))
_frame1
out (c),b ;12___
ex af,af' ;4
dec a ;4
jp z,updateTimerOD ;10
ex af,af' ;4
ld sp,buffer ;10
pop bc ;10 ;base freq 1
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld bc,pon ;10
ld iyh,a ;8
ds 9 ;48
ex af,af'
dec a
ex af,af'
;152
_frame2
out (c),b ;12
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ex de,hl ;4
exx ;4
ld bc,pon ;10
ld iyl,a ;8
ds 17 ;68
;152
_frame3
out (c),b ;12
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
ld bc,pon ;10
add a,iyh ;8
add a,iyl ;8
ld iyh,a ;8
ds 16 ;64
;152
_frame4
out (c),b ;12___
ex de,hl ;4
pop bc ;10
add hl,bc ;11
pop bc ;10
ld c,h ;4
ld a,(bc) ;7
add a,iyh ;8
ex de,hl ;4
add a,basec ;7
ld ixh,a ;8
exx ;4
ld bc,pon ;7
ds 6 ;24
cp maxc ;7
ld a,0 ;7
jp nc,overdrive ;10
jp (ix) ;8
;152
samples
include "samples.asm"
musicdata
include "music.asm"
|
awa/plugins/awa-sysadmin/src/awa-sysadmin-filters.ads | twdroeger/ada-awa | 81 | 13866 | -----------------------------------------------------------------------
-- awa-users-filters -- Specific filters for authentication and key verification
-- Copyright (C) 2011, 2012, 2015, 2019 <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.Strings.Unbounded;
with Servlet.Requests;
with Servlet.Responses;
with Servlet.Filters;
with Servlet.Core;
with AWA.Applications;
package AWA.Sysadmin.Filters is
ADMIN_AUTH_BEAN : constant String := "sysadminAuth";
-- ------------------------------
-- Authentication verification filter
-- ------------------------------
-- The <b>Auth_Filter</b> verifies that the user has the permission to access
-- a given page. If the user is not logged, it tries to login automatically
-- by using some persistent cookie. When this fails, it redirects the
-- user to a login page (configured by AUTH_FILTER_REDIRECT_PARAM property).
type Auth_Filter is new Servlet.Filters.Filter with private;
-- Initialize the filter and configure the redirection URIs.
overriding
procedure Initialize (Filter : in out Auth_Filter;
Config : in Servlet.Core.Filter_Config);
-- Display or redirects the user to the login page. This procedure is called when
-- the user is not authenticated.
procedure Do_Login (Filter : in Auth_Filter;
Request : in out Servlet.Requests.Request'Class;
Response : in out Servlet.Responses.Response'Class);
-- Filter a request which contains an access key and verify that the
-- key is valid and identifies a user. Once the user is known, create
-- a session and setup the user principal.
--
-- If the access key is missing or invalid, redirect to the
-- <b>Invalid_Key_URI</b> associated with the filter.
overriding
procedure Do_Filter (Filter : in Auth_Filter;
Request : in out Servlet.Requests.Request'Class;
Response : in out Servlet.Responses.Response'Class;
Chain : in out Servlet.Core.Filter_Chain);
private
use Ada.Strings.Unbounded;
type Auth_Filter is new Servlet.Filters.Filter with record
Login_URI : Unbounded_String;
Application : AWA.Applications.Application_Access;
end record;
end AWA.Sysadmin.Filters;
|
Asteroids/AsteroidsASM/main.asm | ragibson/FPGA-Asteroids | 5 | 161208 | .include "constants.asm"
.data DATA_START
x: .word FP_HALF_XRES
y: .word FP_HALF_YRES
degrees: .word 0
vx: .word 0
vy: .word 0
w_press: .word 0
s_held: .word 0
sound_timeout: .word 0
# Eight {x, y, degrees, vx, vy, vd, size} structs
asteroids:
.word FP_100, FP_100, 0, 0, 0, 0, 2,
FP_400, FP_300, 0, 0, 0, 0, 2,
FP_600, FP_200, 0, 0, 0, 0, 2,
FP_300, FP_50, 0, 0, 0, 0, 2,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
# Five {x, y, vx, vy, timeout} structs
shots:
.word 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0
.macro swap_args
xor $a0, $a0, $a2
xor $a2, $a0, $a2
xor $a0, $a0, $a2 # swap(x1, x2)
xor $a1, $a1, $a3
xor $a3, $a1, $a3
xor $a1, $a1, $a3 # swap(y1, y2)
.end_macro
.macro save_registers
addi $sp, $sp, -36
sw $s0, 32($sp)
sw $s1, 28($sp)
sw $s2, 24($sp)
sw $s3, 20($sp)
sw $s4, 16($sp)
sw $s5, 12($sp)
sw $s6, 8($sp)
sw $s7, 4($sp)
sw $ra, 0($sp)
.end_macro
.macro restore_registers
lw $s0, 32($sp)
lw $s1, 28($sp)
lw $s2, 24($sp)
lw $s3, 20($sp)
lw $s4, 16($sp)
lw $s5, 12($sp)
lw $s6, 8($sp)
lw $s7, 4($sp)
lw $ra, 0($sp)
addi $sp, $sp, 36
.end_macro
.text TEXT_START
main:
jal load_data
li $sp, DATA_END # Initialize stack pointer to the 512th location above start of data
addi $fp, $sp, -4 # Set $fp to the start of main's stack frame
jal clear_screen
game_loop_while:
li $a0, GRAY
jal draw_asteroids # draw_asteroids(GRAY)
lw $a0, x($0)
lw $a1, y($0)
lw $a2, degrees($0)
li $a3, WHITE
jal draw_ship # draw_ship(x, y, degrees, WHITE)
li $a0, WHITE
jal draw_shots # draw_shots(WHITE)
lw $t0, w_press($0) # if (w_press)
bne $t0, 1, skip_draw_flame
lw $a0, x($0)
lw $a1, y($0)
lw $a2, degrees($0)
li $a3, ORANGE
jal draw_flame # draw_flame(x, y, degrees, ORANGE)
skip_draw_flame:
wait_for_vsync:
lw $s1, vsync_addr($0) # wait_for_vsync()
beq $s1, $0, wait_for_vsync
# redraw objects in black to "clear" the screen
li $a0, BLACK
jal draw_asteroids # draw_asteroids(BLACK)
lw $a0, x($0)
lw $a1, y($0)
lw $a2, degrees($0)
li $a3, BLACK
jal draw_ship # draw_ship(x, y, degrees, BLACK)
li $a0, BLACK
jal draw_shots # draw_shots(BLACK);
lw $t0, w_press($0) # if (w_press)
bne $t0, 1, skip_erase_flame
lw $a0, x($0)
lw $a1, y($0)
lw $a2, degrees($0)
li $a3, BLACK
jal draw_flame # draw_flame(x, y, degrees, BLACK)
li $t0, 0
sw $t0, w_press($0) # w_press = 0
skip_erase_flame:
lw $t0, sound_timeout($0)
beq $t0, $0, skip_sound_decrement # if (sound_timeout)
subi $t0, $t0, 1
sw $t0, sound_timeout($0) # sound_timeout--
beq $0, $0, end_sound_update
skip_sound_decrement: # else
sw $0, sound_addr($0) # sound_period = 0
end_sound_update:
jal update_objects # update_objects()
lw $t0, keyboard_addr($0) # c = read_keyboard()
lw $t1, s_held($0)
bne $t1, $0, skip_s_pressed
beq $t0, S_PRESSED, s_pressed
skip_s_pressed:
beq $t0, S_PRESSED, skip_s_held_reset # if (c != 's')
sw $0, s_held($0) # s_held = 0
skip_s_held_reset:
beq $t0, W_PRESSED, w_pressed
beq $t0, A_PRESSED, a_pressed
beq $t0, D_PRESSED, d_pressed
beq $0, $0, end_keyboard_input
w_pressed: # if (c == 'w')
lw $a0, degrees($0)
jal fpsin # fpsin(degrees)
move $a0, $v0
li $a1, W_SPEED
jal fpmult # fpmult(W_SPEED, fpsin(degrees))
lw $t0, vx($0)
add $t0, $t0, $v0
sw $t0, vx($0) # vx += fpmult(W_SPEED, fpsin(degrees))
lw $a0, degrees($0)
jal fpcos # fpcos(degrees)
move $a0, $v0
li $a1, W_SPEED
jal fpmult # fpmult(W_SPEED, fpcos(degrees))
lw $t0, vy($0)
sub $t0, $t0, $v0
sw $t0, vy($0) # vx -= fpmult(W_SPEED, fpcos(degrees))
li $t0, 1
sw $t0, w_press($0) # w_press = 1
# for one frame, play 125 Hz
li $t0, W_SOUND
sw $t0, sound_addr($0) # sound_period = W_SOUND
li $t0, W_SOUNDLEN
sw $t0, sound_timeout($0) # sound_timeout = W_SOUNDLEN
beq $0, $0, end_keyboard_input
a_pressed: # else if (c == 'a')
lw $s0, degrees($0)
addi $s0, $s0, FP_N5 # degrees -= FP_5
sw $s0, degrees($0)
beq $0, $0, end_keyboard_input
d_pressed: # else if (c == 'd')
lw $s0, degrees($0)
addi $s0, $s0, FP_5 # degrees += FP_5
sw $s0, degrees($0)
beq $0, $0, end_keyboard_input
s_pressed: # else if (!s_held && c == 's')
li $t0, 1
sw $t0, s_held($0)
li $a0, FP_0
li $a1, FP_N10
lw $a2, degrees($0)
jal rotate # rotate(FP_0, FP_N10, degrees, &front_x, &front_y)
lw $t0, x($0)
add $s0, $v0, $t0 # front_x += x
lw $t0, y($0)
add $s1, $v1, $t0 # front_y += y
li $s2, 0 # first_free = 0
first_free_loop: # for (first_free = 0; first_free < MAX_SHOTS; first_free++)
addi $t0, $s2, POINT_TIMEOUT
lw $t0, shots($t0)
beq $t0, $0, end_first_free_loop # if (shots[first_free].timeout == 0)
addi $s2, $s2, POINT_BYTES
bne $s2, SHOT_BYTES, first_free_loop # break
end_first_free_loop:
beq $s2, SHOT_BYTES, skip_add_shot # if (first_free < MAX_SHOTS)
addi $t0, $s2, POINT_X
sw $s0, shots($t0) # shots[first_free].x = front_x
addi $t0, $s2, POINT_Y
sw $s1, shots($t0) # shots[first_free].y = front_y
lw $a0, degrees($0)
jal fpsin # fpsin(degrees)
move $a1, $v0
li $a0, SHOT_SPEED
jal fpmult # fpmult(FP_3, fpsin(degrees))
addi $t0, $s2, POINT_VX
lw $t1, vx($0)
add $t1, $t1, $v0
sw $t1, shots($t0) # shots[i].vx = vx + fpmult(FP_3, fpsin(degrees))
lw $a0, degrees($0)
jal fpcos # fpcos(degrees)
move $a1, $v0
li $a0, SHOT_SPEED
jal fpmult # fpmult(FP_3, fpcos(degrees))
addi $t0, $s2, POINT_VY
lw $t1, vy($0)
sub $t1, $t1, $v0
sw $t1, shots($t0) # shots[i].vy = vy - fpmult(FP_3, fpsin(degrees))
addi $t0, $s2, POINT_TIMEOUT
li $t1, TWO_SECONDS
sw $t1, shots($t0) # shots[i].timeout = TWO_SECONDS
# for six frames, play 440 Hz
li $t0, S_SOUND
sw $t0, sound_addr($0) # sound_period = S_SOUND
li $t0, S_SOUNDLEN
sw $t0, sound_timeout($0) # sound_timeout = S_SOUNDLEN
skip_add_shot:
end_keyboard_input:
lw $a0, degrees($0)
li $a1, FP_360
jal mod
move $s0, $v0
sw $s0, degrees($0) # degrees = mod(degrees, FP_360)
lw $t0, vx($0)
lw $t1, x($0)
add $a0, $t0, $t1
li $a1, FP_XRES
jal mod
sw $v0, x($0) # x = mod(x + vx, FP_XRES)
lw $t0, vy($0)
lw $t1, y($0)
add $a0, $t0, $t1
li $a1, FP_YRES
jal mod
sw $v0, y($0) # y = mod(y + vy, FP_XRES)
# slow ship velocity slightly every frame
# in fp16_t, SLOWDOWN is ~1.02
lw $a0, vx($0)
li $a1, SLOWDOWN
jal fpdiv
sw $v0, vx($0) # vx = fpdiv(vx, SLOWDOWN)
lw $a0, vy($0)
li $a1, SLOWDOWN
jal fpdiv
sw $v0, vy($0) # vy = fpdiv(vy, SLOWDOWN)
j game_loop_while
# Draws ($a0, $a1) -- ($a2, $a3) with color $t0, checks for collision with color $t1
# Returns whether or not it drew over color $t1 (if not BLACK)
draw_line:
save_registers
addi $sp, $sp, -12
sw $0 8($sp) # store collision_occurred on stack
sw $t1, 4($sp) # save check_collision on stack
sw $t0, 0($sp) # save c on stack
bne $a2, $a0, skip_x2_increment # naively avoid division by zero
addi $a2, $a2, 1
skip_x2_increment:
bne $a3, $a1, skip_y2_increment
addi $a3, $a3, 1
skip_y2_increment:
addi $sp, $sp, -4
sw $a0, 0($sp) # save x1
sub $a0, $a2, $a0
jal abs
move $s6, $v0 # $s6 = abs(x2 - x1)
sub $a0, $a3, $a1
jal abs
move $s7, $v0 # $s7 = abs(y2 - y1)
lw $a0, 0($sp)
addi $sp, $sp, 4 # restore $a0 = x1
# determine direction to iterate based on which dimension
# requires more pixels to be drawn (avoids "skipped pixels")
slt $t0, $s6, $s7
bne $t0, $0, draw_line_if_false # if (abs(x2 - x1) >= abs(y2 - y1))
draw_line_if_true:
slt $t1, $a2, $a0
beq $t1, $0, skip_draw_swap1 # if (x1 >= x2)
# ensure iteration proceeds as x1 -> x2
swap_args
skip_draw_swap1:
move $s0, $a0 # x = x1
move $s1, $a1 # y = y1
move $s2, $a2 # save x2
move $s3, $a3 # save y2
sub $a0, $s3, $s1
sub $a1, $s2, $s0
jal fpdiv
move $s4, $v0 # slope = (y2 - y1)/(x2 - x1)
start_draw_loop1:
slt $t0, $s2, $s0
bne $t0, $0, end_draw_loop1 # for (x = x1; x <= x2; x += INT_TO_FP(1))
move $a0, $s0
jal round_fp_to_int
move $a0, $v0
li $a1, XRES
jal mod
move $s5, $v0 # draw_x = round_fp_to_int(x) % XRES
move $a0, $s1
jal round_fp_to_int
move $a0, $v0
li $a1, YRES
jal mod
move $s6, $v0 # draw_y = round_fp_to_int(y) % YRES
lw $t1, 4($sp) # read check_collision from stack
beq $t1, $0, skip_collision1
# collisions are calculated on the framebuffer itself
move $a0, $s5
move $a1, $s6 # if (check_collision &&
jal read_pixel # read_pixel(draw_x, draw_y)
lw $t1, 4($sp) # == check_collision)
bne $v0, $t1, skip_collision1
li $t0, 1
sw $t0, 8($sp) # collision_occurred = 1
skip_collision1:
move $a0, $s5
move $a1, $s6
lw $a2, 0($sp) # read c from stack
jal write_pixel # write_pixel(draw_x, draw_y, c)
add $s1, $s1, $s4 # y += slope
addi $s0, $s0, FP_1 # x += INT_TO_FP(1)
beq $0, $0, start_draw_loop1
end_draw_loop1:
beq $0, $0, draw_line_return
draw_line_if_false:
slt $t1, $a3, $a1
beq $t1, $0, skip_draw_swap2 # if (y1 >= y2)
# ensure iteration proceeds as y1 -> y2
swap_args
skip_draw_swap2:
move $s0, $a0 # x = x1
move $s1, $a1 # y = y1
move $s2, $a2 # save x2
move $s3, $a3 # save y2
sub $a0, $s2, $s0
sub $a1, $s3, $s1
jal fpdiv
move $s4, $v0 # slope = (x2 - x1)/(y2 - y1)
start_draw_loop2:
slt $t0, $s3, $s1
bne $t0, $0, end_draw_loop2 # for (y = y1; y <= y2; x += INT_TO_FP(1))
move $a0, $s0
jal round_fp_to_int
move $a0, $v0
li $a1, XRES
jal mod
move $s5, $v0 # draw_x = round_fp_to_int(x) % XRES
move $a0, $s1
jal round_fp_to_int
move $a0, $v0
li $a1, YRES
jal mod
move $s6, $v0 # draw_y = round_fp_to_int(y) % YRES
lw $t1, 4($sp) # read check_collision from stack
beq $t1, $0, skip_collision2
# collisions are calculated on the framebuffer itself
move $a0, $s5
move $a1, $s6 # if (check_collision &&
jal read_pixel # read_pixel(draw_x, draw_y)
lw $t1, 4($sp) # == check_collision)
bne $v0, $t1, skip_collision2
li $t0, 1
sw $t0, 8($sp) # collision_occurred = 1
skip_collision2:
move $a0, $s5
move $a1, $s6
lw $a2, 0($sp) # read c from stack
jal write_pixel # write_pixel(draw_x, draw_y, c)
add $s0, $s0, $s4 # x += slope
addi $s1, $s1, FP_1 # y += INT_TO_FP(1)
beq $0, $0, start_draw_loop2
end_draw_loop2:
draw_line_return:
lw $v0, 8($sp) # return collision_occurred
addi $sp, $sp, 12 # pop c and check_collision off stack
restore_registers
jr $ra
# rotates ($a0, $a1) about (0, 0) by $a2 degrees (in fp16_t)
rotate:
save_registers
move $s0, $a0 # x
move $s1, $a1 # y
move $s2, $a2 # degrees
move $a0, $s2
jal fpcos
move $s3, $v0 # cos_d = fpcos(degrees)
move $a0, $s2
jal fpsin
move $s4, $v0 # sin_d = fpsin(degrees)
move $a0, $s3
move $a1, $s0
jal fpmult
move $s5, $v0 # fpmult(cos_d, x)
sub $a0, $0, $s4
move $a1, $s1
jal fpmult # fpmult(-sin_d, y)
add $s5, $s5, $v0 # rx = fpmult(cos_d, x) + fpmult(-sin_d, y)
move $a0, $s4
move $a1, $s0
jal fpmult
move $s6, $v0 # fpmult(sin_d, x)
move $a0, $s3
move $a1, $s1
jal fpmult # fpmult(cos_d, y)
add $s6, $s6, $v0 # ry = fpmult(sin_d, x) + fpmult(cos_d, y)
move $v0, $s5
move $v1, $s6 # return rx, ry
restore_registers
jr $ra
# Draws ship at ($a0, $a1) rotated by $a2 degrees (in fp16_t) with color $a3
draw_ship:
addi $sp, $sp, -20
sw $a0, 16($sp) # x
sw $a1, 12($sp) # y
sw $a2, 8($sp) # degrees
sw $a3, 4($sp) # c
sw $ra, 0($sp)
move $s0, $a2 # degrees
li $a0, FP_0
li $a1, FP_N10
move $a2, $s0
jal rotate # rotate(FP_0, FP_N10, degrees, ax, ay)
move $s1, $v0 # ax
move $s2, $v1 # ay
li $a0, FP_7
li $a1, FP_10
move $a2, $s0
jal rotate # rotate(FP_7, FP_10, degrees, bx, by
move $s3, $v0 # bx
move $s4, $v1 # by
li $a0, FP_N7
li $a1, FP_10
move $a2, $s0
jal rotate # rotate(FP_N7, FP_10, degrees, cx, cy)
move $s5, $v0 # cx
move $s6, $v1 # cy
lw $a0, 16($sp)
lw $a1, 12($sp)
lw $a2, 16($sp)
lw $a3, 12($sp)
add $a0, $a0, $s1 # x + ax
add $a1, $a1, $s2 # y + ay
add $a2, $a2, $s3 # x + bx
add $a3, $a3, $s4 # y + by
lw $t0, 4($sp)
li $t1, GRAY
jal draw_line # draw_line(x+ax, y+ay, x+bx, y+by, GRAY, c)
beq $v0, 1, main # reset if collision occurred
lw $a0, 16($sp)
lw $a1, 12($sp)
lw $a2, 16($sp)
lw $a3, 12($sp)
add $a0, $a0, $s1 # x + ax
add $a1, $a1, $s2 # y + ay
add $a2, $a2, $s5 # x + cx
add $a3, $a3, $s6 # y + cy
lw $t0, 4($sp)
li $t1, GRAY
jal draw_line # draw_line(x+ax, y+ay, x+cx, y+cy, GRAY, c)
beq $v0, 1, main # reset if collision occurred
li $a0, FP_N5
li $a1, FP_6
move $a2, $s0
jal rotate # rotate(FP_N5, FP_6, degrees, dx, dy)
move $s1, $v0 # dx
move $s2, $v1 # dy
li $a0, FP_5
li $a1, FP_6
move $a2, $s0
jal rotate # rotate(FP_N5, FP_6, degrees, ex, ey)
move $s3, $v0 # ex
move $s4, $v1 # ey
lw $a0, 16($sp)
lw $a1, 12($sp)
lw $a2, 16($sp)
lw $a3, 12($sp)
add $a0, $a0, $s1 # x + dx
add $a1, $a1, $s2 # y + dy
add $a2, $a2, $s3 # x + ex
add $a3, $a3, $s4 # y + ey
lw $t0, 4($sp)
li $t1, GRAY
jal draw_line # draw_line(x+dx, y+dy, x+ex, y+ey, GRAY, c)
beq $v0, 1, main # reset if collision occurred
lw $ra, 0($sp)
addi $sp, $sp, 20
jr $ra
# Draws flame on ship (at ($a0, $a1) rotated by $a2 degrees) with color $a3
draw_flame:
addi $sp, $sp, -20
sw $a0, 16($sp) # x
sw $a1, 12($sp) # y
sw $a2, 8($sp) # degrees
sw $a3, 4($sp) # c
sw $ra, 0($sp)
move $s0, $a2 # degrees
li $a0, FP_N4
li $a1, FP_6
move $a2, $s0
jal rotate # rotate(FP_N4, FP_6, degrees, ax, ay)
move $s1, $v0 # ax
move $s2, $v1 # ay
li $a0, FP_0
li $a1, FP_12
move $a2, $s0
jal rotate # rotate(FP_0, FP_12, degrees, bx, by)
move $s3, $v0 # bx
move $s4, $v1 # by
li $a0, FP_4
li $a1, FP_6
move $a2, $s0
jal rotate # rotate(FP_4, FP_6, degrees, cx, cy)
move $s5, $v0 # cx
move $s6, $v1 # cy
lw $a0, 16($sp)
lw $a1, 12($sp)
lw $a2, 16($sp)
lw $a3, 12($sp)
add $a0, $a0, $s1 # x + ax
add $a1, $a1, $s2 # y + ay
add $a2, $a2, $s3 # x + bx
add $a3, $a3, $s4 # y + by
lw $t0, 4($sp)
li $t1, 0
jal draw_line # draw_line(x+ax, y+ay, x+bx, y+by, 0, c)
lw $a0, 16($sp)
lw $a1, 12($sp)
lw $a2, 16($sp)
lw $a3, 12($sp)
add $a0, $a0, $s3 # x + bx
add $a1, $a1, $s4 # y + by
add $a2, $a2, $s5 # x + cx
add $a3, $a3, $s6 # y + cy
lw $t0, 4($sp)
li $t1, 0
jal draw_line # draw_line(x+bx, y+by, x+cx, y+cy, 0, c)
lw $ra, 0($sp)
addi $sp, $sp, 20
jr $ra
# Draws asteroids that have positive size with color $a0
draw_asteroids:
save_registers
addi $sp, $sp, -4
sw $a0, 0($sp) # save c on stack
li $s0, 0
draw_asteroid_loop: # for (i = 0; i < MAX_ASTEROIDS; i++)
beq $s0, ASTEROID_BYTES, end_draw_asteroid_loop
li $s3, 0 # collision = 0
li $s4, FP_AST_WIDTH # positive asteroid width
li $s5, FP_NAST_WIDTH # negative asteroid width
addi $t0, $s0, OBJECT_SIZE # if (asteroids[i].size)
lw $t0, asteroids($t0)
bne $t0, 2, skip_size_doubling
sll $s4, $s4, 1 # width = FP_AST_WIDTH * asteroids[i].size
sll $s5, $s5, 1 # uses shifts since 0 <= size <= 2
skip_size_doubling:
beq $t0, $0, skip_asteroid_iteration
# Exploit symmetry of the square to only compute one rotation
move $a0, $s4
move $a1, $s5
addi $t0, $s0, OBJECT_DEGREES
lw $a2, asteroids($t0)
jal rotate
move $s4, $v0 # rx
move $s5, $v1 # ry
addi $t0, $s0, OBJECT_X
lw $s1, asteroids($t0) # x = asteroids[i].x
addi $t0, $s0, OBJECT_Y
lw $s2, asteroids($t0) # y = asteroids[i].y
add $a0, $s1, $s4 # x + rx
add $a1, $s2, $s5 # y + ry
sub $a2, $s1, $s5 # x - ry
add $a3, $s2, $s4 # y + rx
lw $t0, 0($sp) # c
li $t1, WHITE
jal draw_line # draw_line(x+rx, y+ry, x-ry, y+rx, WHITE, c)
or $s3, $s3, $v0 # collision |= draw_line(...)
add $a0, $s1, $s4 # x + rx
add $a1, $s2, $s5 # y + ry
add $a2, $s1, $s5 # x + ry
sub $a3, $s2, $s4 # y - rx
lw $t0, 0($sp) # c
li $t1, WHITE
jal draw_line # draw_line(x+rx, y+ry, x+ry, y-rx, WHITE, c)
or $s3, $s3, $v0 # collision |= draw_line(...)
sub $a0, $s1, $s4 # x - rx
sub $a1, $s2, $s5 # y - ry
sub $a2, $s1, $s5 # x - ry
add $a3, $s2, $s4 # y + rx
lw $t0, 0($sp) # c
li $t1, WHITE
jal draw_line # draw_line(x-rx, y-ry, x-ry, y+rx, WHITE, c)
or $s3, $s3, $v0 # collision |= draw_line(...)
sub $a0, $s1, $s4 # x - rx
sub $a1, $s2, $s5 # y - ry
add $a2, $s1, $s5 # x + ry
sub $a3, $s2, $s4 # y - rx
lw $t0, 0($sp) # c
li $t1, WHITE
jal draw_line # draw_line(x-rx, y-ry, x+ry, y-rx, WHITE, c)
or $s3, $s3, $v0 # collision |= draw_line(...)
bne $s3, 1, skip_remove_ast # if (collision)
addi $t0, $s0, OBJECT_SIZE
lw $t1, asteroids($t0)
subi $t1, $t1, 1
sw $t1, asteroids($t0) # asteroids[i].size--
beq $t1, $0, skip_spawn_asteroids # if (asteroids[i].size)
# split asteroid into two with random velocities
jal rng
addi $t0, $s0, OBJECT_VX
sw $v0, asteroids($t0) # asteroids[i].vx = rng()
jal rng
addi $t0, $s0, OBJECT_VY
sw $v0, asteroids($t0) # asteroids[i].vy = rng()
jal rng
addi $t0, $s0, OBJECT_VD
sw $v0, asteroids($t0) # asteroids[i].vd = rng()
li $t1, OBJECT_BYTES
sll $t1, $t1, 2
add $t1, $s0, $t1 # index for asteroids[i+4]
addi $t0, $t1, OBJECT_X
sw $s1, asteroids($t0) # asteroids[i+4].x = asteroids[i].x
addi $t0, $t1, OBJECT_Y
sw $s2, asteroids($t0) # asteroids[i+4].y = asteroids[i].y
jal rng
addi $t0, $t1, OBJECT_VX
sw $v0, asteroids($t0) # asteroids[i+4].vx = rng()
jal rng
addi $t0, $t1, OBJECT_VY
sw $v0, asteroids($t0) # asteroids[i+4].vy = rng()
jal rng
addi $t0, $t1, OBJECT_VD
sw $v0, asteroids($t0) # asteroids[i+4].vd = rng()
addi $t0, $t1, OBJECT_SIZE
li $t1, 1
sw $t1, asteroids($t0) # asteroids[i+4].size = 1
skip_spawn_asteroids:
# for six frames, play 220 Hz
li $t0, DEST_SOUND
sw $t0, sound_addr($0)
li $t0, DEST_SOUNDLEN
sw $t0, sound_timeout($0)
skip_remove_ast:
skip_asteroid_iteration:
addi $s0, $s0, OBJECT_BYTES # proceed to next struct
beq $0, $0, draw_asteroid_loop
end_draw_asteroid_loop:
addi $sp, $sp, 4 # pop c off stack
restore_registers
jr $ra
# Draws shots that have positive timeout with color $a0
draw_shots:
save_registers
addi $sp, $sp, -4
sw $a0, 0($sp) # save c on stack
li $s0, 0
draw_shot_loop: # for (i = 0; i < MAX_SHOTS; i++)
beq $s0, SHOT_BYTES, end_draw_shot_loop
li $s3, 0 # collision = 0
addi $t0, $s0, POINT_TIMEOUT # if (shots[i].timeout > 0)
lw $t0, shots($t0)
slt $t0, $0, $t0
beq $t0, $0, skip_draw_shot_iteration
addi $t0, $s0, POINT_X
lw $s1, shots($t0) # x = shots[i].x
addi $t0, $s0, POINT_Y
lw $s2, shots($t0) # y = shots[i].y
move $a0, $s1 # x
subi $a1, $s2, FP_2 # y - FP_2
move $a2, $s1 # x
addi $a3, $s2, FP_2 # y + FP_2
lw $t0, 0($sp) # c
li $t1, GRAY
jal draw_line # draw_line(x, y-FP_2, x, y+FP_2, GRAY, c)
or $s3, $s3, $v0 # collision |= draw_line(...)
subi $a0, $s1, FP_2 # x - FP_2
move $a1, $s2 # y
addi $a2, $s1, FP_2 # x + FP_2
move $a3, $s2 # y
lw $t0, 0($sp) # c
li $t1, GRAY
jal draw_line # draw_line(x-FP_2, y, x+FP_2, y, GRAY, c)
or $s3, $s3, $v0 # collision |= draw_line(...)
bne $s3, 1, skip_remove_shot # if (collision)
addi $t0, $s0, POINT_TIMEOUT
# shot will disappear next frame
li $t1, 1
sw $t1, shots($t0) # shots[i].timeout = 1
skip_remove_shot:
skip_draw_shot_iteration:
addi $s0, $s0, POINT_BYTES # proceed to next struct
beq $0, $0, draw_shot_loop
end_draw_shot_loop:
addi $sp, $sp, 4 # pop c off stack
restore_registers
jr $ra
# update shot and asteroid positions
update_objects:
save_registers
li $s0, 0
update_shot_loop: # for (i = 0; i < MAX_SHOTS; i++)
beq $s0, SHOT_BYTES, end_update_shot_loop
addi $t0, $s0, POINT_TIMEOUT # if (shots[i].timeout > 0)
lw $t0, shots($t0)
slt $t0, $0, $t0
beq $t0, $0, skip_shot_iteration
addi $t0, $s0, POINT_X
lw $s1, shots($t0) # shots[i].x
addi $t0, $s0, POINT_VX
lw $s2, shots($t0) # shots[i].vx
add $a0, $s1, $s2
li $a1, FP_XRES
jal mod # mod(shots[i].x+shots[i].vx, FP_XRES)
addi $t0, $s0, POINT_X
sw $v0, shots($t0) # shots[i].x = mod(shots[i].x+shots[i].vx, FP_XRES)
addi $t0, $s0, POINT_Y
lw $s1, shots($t0) # shots[i].y
addi $t0, $s0, POINT_VY
lw $s2, shots($t0) # shots[i].vy
add $a0, $s1, $s2
li $a1, FP_YRES
jal mod # mod(shots[i].y+shots[i].vy, FP_YRES)
addi $t0, $s0, POINT_Y
sw $v0, shots($t0) # shots[i].y = mod(shots[i].y+shots[i].vy, FP_YRES)
addi $t0, $s0, POINT_TIMEOUT
lw $t1, shots($t0)
subi $t1, $t1, 1
sw $t1, shots($t0) # shots[i].timeout--
skip_shot_iteration:
addi $s0, $s0, POINT_BYTES # proceed to next struct
beq $0, $0, update_shot_loop
end_update_shot_loop:
li $s0, 0
update_ast_loop: # for (i = 0; i < MAX_ASTEROID; i++)
beq $s0, ASTEROID_BYTES, end_update_ast_loop
addi $t0, $s0, OBJECT_SIZE # if (asteroids[i].size)
lw $t0, asteroids($t0)
slt $t0, $0, $t0
beq $t0, $0, skip_ast_iteration
addi $t0, $s0, OBJECT_X
lw $s1, asteroids($t0) # asteroids[i].x
addi $t0, $s0, OBJECT_VX
lw $s2, asteroids($t0) # asteroids[i].vx
add $a0, $s1, $s2
li $a1, FP_XRES
jal mod # mod(asteroids[i].x+asteroids[i].vx, FP_XRES)
addi $t0, $s0, OBJECT_X
sw $v0, asteroids($t0) # asteroids[i].x = mod(...)
addi $t0, $s0, OBJECT_Y
lw $s1, asteroids($t0) # asteroids[i].y
addi $t0, $s0, OBJECT_VY
lw $s2, asteroids($t0) # asteroids[i].vy
add $a0, $s1, $s2
li $a1, FP_YRES
jal mod # mod(asteroids[i].y+asteroids[i].vy, FP_YRES)
addi $t0, $s0, OBJECT_Y
sw $v0, asteroids($t0) # asteroids[i].y = mod(...)
addi $t0, $s0, OBJECT_DEGREES
lw $s1, asteroids($t0) # asteroids[i].degrees
addi $t0, $s0, OBJECT_VD
lw $s2, asteroids($t0) # asteroids[i].vd
add $a0, $s1, $s2
li $a1, FP_360
jal mod # mod(asteroids[i].degrees+asteroids[i].vd, FP_360)
addi $t0, $s0, OBJECT_DEGREES
sw $v0, asteroids($t0) # asteroids[i].degrees = mod(...)
skip_ast_iteration:
addi $s0, $s0, OBJECT_BYTES # proceed to next struct
beq $0, $0, update_ast_loop
end_update_ast_loop:
restore_registers
jr $ra
end:
j end
.include "display.asm"
.include "dataloader.asm"
.include "softmath.asm"
.include "rng.asm"
|
src/STLC/Kovacs/Completeness.agda | mietek/coquand-kovacs | 0 | 16207 | <gh_stars>0
module STLC.Kovacs.Completeness where
open import STLC.Kovacs.Normalisation public
open import STLC.Kovacs.Convertibility public
--------------------------------------------------------------------------------
-- (_≈_)
infix 3 _≫_
_≫_ : ∀ {A Γ} → Γ ⊢ A → Γ ⊩ A → Set
_≫_ {⎵} {Γ} M N = M ∼ embⁿᶠ N
_≫_ {A ⇒ B} {Γ} M f = ∀ {Γ′} → (η : Γ′ ⊇ Γ) {N : Γ′ ⊢ A} {a : Γ′ ⊩ A}
(p : N ≫ a)
→ ren η M ∙ N ≫ f η a
-- (_≈ᶜ_)
infix 3 _≫⋆_
data _≫⋆_ : ∀ {Γ Ξ} → Γ ⊢⋆ Ξ → Γ ⊩⋆ Ξ → Set
where
∅ : ∀ {Γ} → ∅ {Γ = Γ} ≫⋆ ∅
_,_ : ∀ {Γ Ξ A} → {σ : Γ ⊢⋆ Ξ} {ρ : Γ ⊩⋆ Ξ} {M : Γ ⊢ A} {a : Γ ⊩ A}
→ (χ : σ ≫⋆ ρ) (p : M ≫ a)
→ σ , M ≫⋆ ρ , a
--------------------------------------------------------------------------------
-- (_∼◾≈_)
coe≫ : ∀ {A Γ} → {M₁ M₂ : Γ ⊢ A} {a : Γ ⊩ A}
→ M₁ ∼ M₂ → M₁ ≫ a
→ M₂ ≫ a
coe≫ {⎵} p q = p ⁻¹ ⦙ q
coe≫ {A ⇒ B} p f = λ η q →
coe≫ (ren∼ η p ∙∼ refl∼)
(f η q)
--------------------------------------------------------------------------------
-- (≈ₑ)
acc≫ : ∀ {A Γ Γ′} → (η : Γ′ ⊇ Γ)
→ {M : Γ ⊢ A} {a : Γ ⊩ A}
→ M ≫ a
→ ren η M ≫ acc η a
acc≫ {⎵} η {M} {N} p = coe ((λ N′ → ren η M ∼ N′) & (natembⁿᶠ η N ⁻¹))
(ren∼ η p)
acc≫ {A ⇒ B} η {M} {f} g η′
rewrite ren○ η′ η M ⁻¹
= g (η ○ η′)
-- (≈ᶜₑ)
-- NOTE: _⬖≫_ = ∂acc≫⋆
_⬖≫_ : ∀ {Γ Γ′ Ξ} → {σ : Γ ⊢⋆ Ξ} {ρ : Γ ⊩⋆ Ξ}
→ (χ : σ ≫⋆ ρ) (η : Γ′ ⊇ Γ)
→ σ ◐ η ≫⋆ ρ ⬖ η
∅ ⬖≫ η = ∅
(χ , p) ⬖≫ η = χ ⬖≫ η , acc≫ η p
--------------------------------------------------------------------------------
-- (∈≈)
get≫ : ∀ {Γ Ξ A} → {σ : Γ ⊢⋆ Ξ} {ρ : Γ ⊩⋆ Ξ}
→ σ ≫⋆ ρ → (i : Ξ ∋ A)
→ getₛ σ i ≫ getᵥ ρ i
get≫ (χ , p) zero = p
get≫ (χ , p) (suc i) = get≫ χ i
-- (Tm≈)
eval≫ : ∀ {Γ Ξ A} → {σ : Γ ⊢⋆ Ξ} {ρ : Γ ⊩⋆ Ξ}
→ σ ≫⋆ ρ → (M : Ξ ⊢ A)
→ sub σ M ≫ eval ρ M
eval≫ χ (𝓋 i)
= get≫ χ i
eval≫ {σ = σ} χ (ƛ M) η {N} q
= coe≫ (coe (((ƛ (ren (liftₑ η) (sub (liftₛ σ) M)) ∙ N) ∼_)
& ( sub◑ (idₛ , N) (liftₑ η) (sub (liftₛ σ) M) ⁻¹
⦙ sub● (liftₑ η ◑ (idₛ , N)) (liftₛ σ) M ⁻¹
⦙ (λ σ′ → sub (σ′ , N) M)
& ( comp●◑ (η ◑ idₛ , N) (wkₑ idₑ) σ
⦙ (σ ●_) & lid◑ (η ◑ idₛ)
⦙ comp●◑ idₛ η σ ⁻¹
⦙ rid● (σ ◐ η)
)
))
(red⇒ (ren (liftₑ η) (sub (liftₛ σ) M)) N) ⁻¹)
(eval≫ (χ ⬖≫ η , q) M)
eval≫ {σ = σ} χ (M ∙ N)
rewrite idren (sub σ M) ⁻¹
= eval≫ χ M idₑ (eval≫ χ N)
--------------------------------------------------------------------------------
mutual
-- (q≈)
reify≫ : ∀ {A Γ} → {M : Γ ⊢ A} {a : Γ ⊩ A}
→ (p : M ≫ a)
→ M ∼ embⁿᶠ (reify a)
reify≫ {⎵} {M = M} p = p
reify≫ {A ⇒ B} {M = M} f = exp⇒ M
⦙ ƛ∼ (reify≫ (f (wkₑ idₑ) (reflect≫ 0)))
-- (u≈)
reflect≫ : ∀ {A Γ} → (M : Γ ⊢ⁿᵉ A)
→ embⁿᵉ M ≫ reflect M
reflect≫ {⎵} M = refl∼
reflect≫ {A ⇒ B} M η {N} {a} p
rewrite natembⁿᵉ η M ⁻¹
= coe≫ (refl∼ ∙∼ reify≫ p ⁻¹)
(reflect≫ (renⁿᵉ η M ∙ reify a))
-- (uᶜ≈)
id≫⋆ : ∀ {Γ} → idₛ {Γ} ≫⋆ idᵥ
id≫⋆ {∅} = ∅
id≫⋆ {Γ , A} = id≫⋆ ⬖≫ wkₑ idₑ , reflect≫ 0
complete : ∀ {Γ A} → (M : Γ ⊢ A)
→ M ∼ embⁿᶠ (nf M)
complete M = coe ((_∼ embⁿᶠ (reify (eval idᵥ M))) & idsub M)
(reify≫ (eval≫ id≫⋆ M))
--------------------------------------------------------------------------------
|
programs/oeis/188/A188510.asm | jmorken/loda | 1 | 178990 | ; A188510: Expansion of x*(1 + x^2)/(1 + x^4) in powers of x.
; 0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1,0,1,0,-1,0,-1,0,1
lpb $0
sub $0,8
lpe
mod $0,2
mov $1,$0
|
Automator Run.applescript | p2made/P2-RIP | 0 | 199 | <reponame>p2made/P2-RIP
on run {input, parameters}
(* Your script goes here *)
return input
end run |
programs/oeis/168/A168376.asm | neoneye/loda | 22 | 99435 | ; A168376: a(n) = (14*n - 7*(-1)^n - 9)/4.
; 3,3,10,10,17,17,24,24,31,31,38,38,45,45,52,52,59,59,66,66,73,73,80,80,87,87,94,94,101,101,108,108,115,115,122,122,129,129,136,136,143,143,150,150,157,157,164,164,171,171,178,178,185,185,192,192,199,199,206,206,213,213,220,220,227,227,234,234,241,241,248,248,255,255,262,262,269,269,276,276,283,283,290,290,297,297,304,304,311,311,318,318,325,325,332,332,339,339,346,346
div $0,2
mul $0,7
add $0,3
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/case_optimization2.adb | best08618/asylo | 7 | 18819 | -- PR ada/43106
-- Testcase by <NAME> <<EMAIL>>
-- { dg-do run }
-- { dg-options "-O" }
with Case_Optimization_Pkg2; use Case_Optimization_Pkg2;
procedure Case_Optimization2 is
Radar : Radar_T;
begin
Radar.Sensor_Type := radcmb;
Initialize (Radar);
end;
|
alloy4fun_models/trainstlt/models/8/e5wbNykhnxyzBZmFi.als | Kaixi26/org.alloytools.alloy | 0 | 4059 | <gh_stars>0
open main
pred ide5wbNykhnxyzBZmFi_prop9 {
all t:Train | eventually ( some t.pos & Entry) and before no t.pos
}
pred __repair { ide5wbNykhnxyzBZmFi_prop9 }
check __repair { ide5wbNykhnxyzBZmFi_prop9 <=> prop9o } |
test/succeed/PartiallyAppliedConstructorInIndex.agda | larrytheliquid/agda | 0 | 10162 | <filename>test/succeed/PartiallyAppliedConstructorInIndex.agda
module PartiallyAppliedConstructorInIndex where
data Nat : Set where
zero : Nat
suc : Nat -> Nat
plus : Nat -> Nat -> Nat
data D : (Nat -> Nat) -> Set where
c : D suc
d : (x : Nat) -> D (plus x)
e : D (\ x -> suc x)
f : D suc -> Nat
f c = zero
f e = suc zero
|
programs/oeis/063/A063482.asm | neoneye/loda | 22 | 81623 | <gh_stars>10-100
; A063482: p(n) * last digit of p(n) where p(n) is n-th prime.
; 4,9,25,49,11,39,119,171,69,261,31,259,41,129,329,159,531,61,469,71,219,711,249,801,679,101,309,749,981,339,889,131,959,1251,1341,151,1099,489,1169,519,1611,181,191,579,1379,1791,211,669,1589,2061,699,2151,241,251,1799,789,2421,271,1939,281,849,879,2149,311,939,2219,331,2359,2429,3141,1059,3231,2569,1119,3411,1149,3501,2779,401,3681,3771,421,431,1299,3951,1329,4041,3199,461,1389,3269,4311,3409,491,4491,1509,4581,521,1569,541
seq $0,40 ; The prime numbers.
mov $1,$0
mod $1,10
mul $0,$1
|
memsim-master/src/benchmark-tree.ads | strenkml/EE368 | 0 | 8102 |
package Benchmark.Tree is
type Tree_Type is new Benchmark_Type with private;
function Create_Tree return Benchmark_Pointer;
overriding
procedure Set_Argument(benchmark : in out Tree_Type;
arg : in String);
overriding
procedure Run(benchmark : in Tree_Type);
private
type Tree_Type is new Benchmark_Type with record
size : Positive := 1024;
iterations : Positive := 10000;
end record;
end Benchmark.Tree;
|
gcc-gcc-7_3_0-release/gcc/ada/a-rbtgbk.adb | best08618/asylo | 7 | 13691 | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.CONTAINERS.RED_BLACK_TREES.GENERIC_BOUNDED_KEYS --
-- --
-- B o d y --
-- --
-- Copyright (C) 2004-2015, 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>. --
------------------------------------------------------------------------------
package body Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys is
package Ops renames Tree_Operations;
-------------
-- Ceiling --
-------------
-- AKA Lower_Bound
function Ceiling
(Tree : Tree_Type'Class;
Key : Key_Type) return Count_Type
is
Y : Count_Type;
X : Count_Type;
N : Nodes_Type renames Tree.Nodes;
begin
Y := 0;
X := Tree.Root;
while X /= 0 loop
if Is_Greater_Key_Node (Key, N (X)) then
X := Ops.Right (N (X));
else
Y := X;
X := Ops.Left (N (X));
end if;
end loop;
return Y;
end Ceiling;
----------
-- Find --
----------
function Find
(Tree : Tree_Type'Class;
Key : Key_Type) return Count_Type
is
Y : Count_Type;
X : Count_Type;
N : Nodes_Type renames Tree.Nodes;
begin
Y := 0;
X := Tree.Root;
while X /= 0 loop
if Is_Greater_Key_Node (Key, N (X)) then
X := Ops.Right (N (X));
else
Y := X;
X := Ops.Left (N (X));
end if;
end loop;
if Y = 0 then
return 0;
end if;
if Is_Less_Key_Node (Key, N (Y)) then
return 0;
end if;
return Y;
end Find;
-----------
-- Floor --
-----------
function Floor
(Tree : Tree_Type'Class;
Key : Key_Type) return Count_Type
is
Y : Count_Type;
X : Count_Type;
N : Nodes_Type renames Tree.Nodes;
begin
Y := 0;
X := Tree.Root;
while X /= 0 loop
if Is_Less_Key_Node (Key, N (X)) then
X := Ops.Left (N (X));
else
Y := X;
X := Ops.Right (N (X));
end if;
end loop;
return Y;
end Floor;
--------------------------------
-- Generic_Conditional_Insert --
--------------------------------
procedure Generic_Conditional_Insert
(Tree : in out Tree_Type'Class;
Key : Key_Type;
Node : out Count_Type;
Inserted : out Boolean)
is
Y : Count_Type;
X : Count_Type;
N : Nodes_Type renames Tree.Nodes;
begin
-- This is a "conditional" insertion, meaning that the insertion request
-- can "fail" in the sense that no new node is created. If the Key is
-- equivalent to an existing node, then we return the existing node and
-- Inserted is set to False. Otherwise, we allocate a new node (via
-- Insert_Post) and Inserted is set to True.
-- Note that we are testing for equivalence here, not equality. Key must
-- be strictly less than its next neighbor, and strictly greater than
-- its previous neighbor, in order for the conditional insertion to
-- succeed.
-- We search the tree to find the nearest neighbor of Key, which is
-- either the smallest node greater than Key (Inserted is True), or the
-- largest node less or equivalent to Key (Inserted is False).
Y := 0;
X := Tree.Root;
Inserted := True;
while X /= 0 loop
Y := X;
Inserted := Is_Less_Key_Node (Key, N (X));
X := (if Inserted then Ops.Left (N (X)) else Ops.Right (N (X)));
end loop;
if Inserted then
-- Either Tree is empty, or Key is less than Y. If Y is the first
-- node in the tree, then there are no other nodes that we need to
-- search for, and we insert a new node into the tree.
if Y = Tree.First then
Insert_Post (Tree, Y, True, Node);
return;
end if;
-- Y is the next nearest-neighbor of Key. We know that Key is not
-- equivalent to Y (because Key is strictly less than Y), so we move
-- to the previous node, the nearest-neighbor just smaller or
-- equivalent to Key.
Node := Ops.Previous (Tree, Y);
else
-- Y is the previous nearest-neighbor of Key. We know that Key is not
-- less than Y, which means either that Key is equivalent to Y, or
-- greater than Y.
Node := Y;
end if;
-- Key is equivalent to or greater than Node. We must resolve which is
-- the case, to determine whether the conditional insertion succeeds.
if Is_Greater_Key_Node (Key, N (Node)) then
-- Key is strictly greater than Node, which means that Key is not
-- equivalent to Node. In this case, the insertion succeeds, and we
-- insert a new node into the tree.
Insert_Post (Tree, Y, Inserted, Node);
Inserted := True;
return;
end if;
-- Key is equivalent to Node. This is a conditional insertion, so we do
-- not insert a new node in this case. We return the existing node and
-- report that no insertion has occurred.
Inserted := False;
end Generic_Conditional_Insert;
------------------------------------------
-- Generic_Conditional_Insert_With_Hint --
------------------------------------------
procedure Generic_Conditional_Insert_With_Hint
(Tree : in out Tree_Type'Class;
Position : Count_Type;
Key : Key_Type;
Node : out Count_Type;
Inserted : out Boolean)
is
N : Nodes_Type renames Tree.Nodes;
begin
-- The purpose of a hint is to avoid a search from the root of
-- tree. If we have it hint it means we only need to traverse the
-- subtree rooted at the hint to find the nearest neighbor. Note
-- that finding the neighbor means merely walking the tree; this
-- is not a search and the only comparisons that occur are with
-- the hint and its neighbor.
-- If Position is 0, this is interpreted to mean that Key is
-- large relative to the nodes in the tree. If the tree is empty,
-- or Key is greater than the last node in the tree, then we're
-- done; otherwise the hint was "wrong" and we must search.
if Position = 0 then -- largest
if Tree.Last = 0
or else Is_Greater_Key_Node (Key, N (Tree.Last))
then
Insert_Post (Tree, Tree.Last, False, Node);
Inserted := True;
else
Conditional_Insert_Sans_Hint (Tree, Key, Node, Inserted);
end if;
return;
end if;
pragma Assert (Tree.Length > 0);
-- A hint can either name the node that immediately follows Key,
-- or immediately precedes Key. We first test whether Key is
-- less than the hint, and if so we compare Key to the node that
-- precedes the hint. If Key is both less than the hint and
-- greater than the hint's preceding neighbor, then we're done;
-- otherwise we must search.
-- Note also that a hint can either be an anterior node or a leaf
-- node. A new node is always inserted at the bottom of the tree
-- (at least prior to rebalancing), becoming the new left or
-- right child of leaf node (which prior to the insertion must
-- necessarily be null, since this is a leaf). If the hint names
-- an anterior node then its neighbor must be a leaf, and so
-- (here) we insert after the neighbor. If the hint names a leaf
-- then its neighbor must be anterior and so we insert before the
-- hint.
if Is_Less_Key_Node (Key, N (Position)) then
declare
Before : constant Count_Type := Ops.Previous (Tree, Position);
begin
if Before = 0 then
Insert_Post (Tree, Tree.First, True, Node);
Inserted := True;
elsif Is_Greater_Key_Node (Key, N (Before)) then
if Ops.Right (N (Before)) = 0 then
Insert_Post (Tree, Before, False, Node);
else
Insert_Post (Tree, Position, True, Node);
end if;
Inserted := True;
else
Conditional_Insert_Sans_Hint (Tree, Key, Node, Inserted);
end if;
end;
return;
end if;
-- We know that Key isn't less than the hint so we try again,
-- this time to see if it's greater than the hint. If so we
-- compare Key to the node that follows the hint. If Key is both
-- greater than the hint and less than the hint's next neighbor,
-- then we're done; otherwise we must search.
if Is_Greater_Key_Node (Key, N (Position)) then
declare
After : constant Count_Type := Ops.Next (Tree, Position);
begin
if After = 0 then
Insert_Post (Tree, Tree.Last, False, Node);
Inserted := True;
elsif Is_Less_Key_Node (Key, N (After)) then
if Ops.Right (N (Position)) = 0 then
Insert_Post (Tree, Position, False, Node);
else
Insert_Post (Tree, After, True, Node);
end if;
Inserted := True;
else
Conditional_Insert_Sans_Hint (Tree, Key, Node, Inserted);
end if;
end;
return;
end if;
-- We know that Key is neither less than the hint nor greater
-- than the hint, and that's the definition of equivalence.
-- There's nothing else we need to do, since a search would just
-- reach the same conclusion.
Node := Position;
Inserted := False;
end Generic_Conditional_Insert_With_Hint;
-------------------------
-- Generic_Insert_Post --
-------------------------
procedure Generic_Insert_Post
(Tree : in out Tree_Type'Class;
Y : Count_Type;
Before : Boolean;
Z : out Count_Type)
is
N : Nodes_Type renames Tree.Nodes;
begin
TC_Check (Tree.TC);
if Checks and then Tree.Length >= Tree.Capacity then
raise Capacity_Error with "not enough capacity to insert new item";
end if;
Z := New_Node;
pragma Assert (Z /= 0);
if Y = 0 then
pragma Assert (Tree.Length = 0);
pragma Assert (Tree.Root = 0);
pragma Assert (Tree.First = 0);
pragma Assert (Tree.Last = 0);
Tree.Root := Z;
Tree.First := Z;
Tree.Last := Z;
elsif Before then
pragma Assert (Ops.Left (N (Y)) = 0);
Ops.Set_Left (N (Y), Z);
if Y = Tree.First then
Tree.First := Z;
end if;
else
pragma Assert (Ops.Right (N (Y)) = 0);
Ops.Set_Right (N (Y), Z);
if Y = Tree.Last then
Tree.Last := Z;
end if;
end if;
Ops.Set_Color (N (Z), Red);
Ops.Set_Parent (N (Z), Y);
Ops.Rebalance_For_Insert (Tree, Z);
Tree.Length := Tree.Length + 1;
end Generic_Insert_Post;
-----------------------
-- Generic_Iteration --
-----------------------
procedure Generic_Iteration
(Tree : Tree_Type'Class;
Key : Key_Type)
is
procedure Iterate (Index : Count_Type);
-------------
-- Iterate --
-------------
procedure Iterate (Index : Count_Type) is
J : Count_Type;
N : Nodes_Type renames Tree.Nodes;
begin
J := Index;
while J /= 0 loop
if Is_Less_Key_Node (Key, N (J)) then
J := Ops.Left (N (J));
elsif Is_Greater_Key_Node (Key, N (J)) then
J := Ops.Right (N (J));
else
Iterate (Ops.Left (N (J)));
Process (J);
J := Ops.Right (N (J));
end if;
end loop;
end Iterate;
-- Start of processing for Generic_Iteration
begin
Iterate (Tree.Root);
end Generic_Iteration;
-------------------------------
-- Generic_Reverse_Iteration --
-------------------------------
procedure Generic_Reverse_Iteration
(Tree : Tree_Type'Class;
Key : Key_Type)
is
procedure Iterate (Index : Count_Type);
-------------
-- Iterate --
-------------
procedure Iterate (Index : Count_Type) is
J : Count_Type;
N : Nodes_Type renames Tree.Nodes;
begin
J := Index;
while J /= 0 loop
if Is_Less_Key_Node (Key, N (J)) then
J := Ops.Left (N (J));
elsif Is_Greater_Key_Node (Key, N (J)) then
J := Ops.Right (N (J));
else
Iterate (Ops.Right (N (J)));
Process (J);
J := Ops.Left (N (J));
end if;
end loop;
end Iterate;
-- Start of processing for Generic_Reverse_Iteration
begin
Iterate (Tree.Root);
end Generic_Reverse_Iteration;
----------------------------------
-- Generic_Unconditional_Insert --
----------------------------------
procedure Generic_Unconditional_Insert
(Tree : in out Tree_Type'Class;
Key : Key_Type;
Node : out Count_Type)
is
Y : Count_Type;
X : Count_Type;
N : Nodes_Type renames Tree.Nodes;
Before : Boolean;
begin
Y := 0;
Before := False;
X := Tree.Root;
while X /= 0 loop
Y := X;
Before := Is_Less_Key_Node (Key, N (X));
X := (if Before then Ops.Left (N (X)) else Ops.Right (N (X)));
end loop;
Insert_Post (Tree, Y, Before, Node);
end Generic_Unconditional_Insert;
--------------------------------------------
-- Generic_Unconditional_Insert_With_Hint --
--------------------------------------------
procedure Generic_Unconditional_Insert_With_Hint
(Tree : in out Tree_Type'Class;
Hint : Count_Type;
Key : Key_Type;
Node : out Count_Type)
is
N : Nodes_Type renames Tree.Nodes;
begin
-- There are fewer constraints for an unconditional insertion
-- than for a conditional insertion, since we allow duplicate
-- keys. So instead of having to check (say) whether Key is
-- (strictly) greater than the hint's previous neighbor, here we
-- allow Key to be equal to or greater than the previous node.
-- There is the issue of what to do if Key is equivalent to the
-- hint. Does the new node get inserted before or after the hint?
-- We decide that it gets inserted after the hint, reasoning that
-- this is consistent with behavior for non-hint insertion, which
-- inserts a new node after existing nodes with equivalent keys.
-- First we check whether the hint is null, which is interpreted
-- to mean that Key is large relative to existing nodes.
-- Following our rule above, if Key is equal to or greater than
-- the last node, then we insert the new node immediately after
-- last. (We don't have an operation for testing whether a key is
-- "equal to or greater than" a node, so we must say instead "not
-- less than", which is equivalent.)
if Hint = 0 then -- largest
if Tree.Last = 0 then
Insert_Post (Tree, 0, False, Node);
elsif Is_Less_Key_Node (Key, N (Tree.Last)) then
Unconditional_Insert_Sans_Hint (Tree, Key, Node);
else
Insert_Post (Tree, Tree.Last, False, Node);
end if;
return;
end if;
pragma Assert (Tree.Length > 0);
-- We decide here whether to insert the new node prior to the
-- hint. Key could be equivalent to the hint, so in theory we
-- could write the following test as "not greater than" (same as
-- "less than or equal to"). If Key were equivalent to the hint,
-- that would mean that the new node gets inserted before an
-- equivalent node. That wouldn't break any container invariants,
-- but our rule above says that new nodes always get inserted
-- after equivalent nodes. So here we test whether Key is both
-- less than the hint and equal to or greater than the hint's
-- previous neighbor, and if so insert it before the hint.
if Is_Less_Key_Node (Key, N (Hint)) then
declare
Before : constant Count_Type := Ops.Previous (Tree, Hint);
begin
if Before = 0 then
Insert_Post (Tree, Hint, True, Node);
elsif Is_Less_Key_Node (Key, N (Before)) then
Unconditional_Insert_Sans_Hint (Tree, Key, Node);
elsif Ops.Right (N (Before)) = 0 then
Insert_Post (Tree, Before, False, Node);
else
Insert_Post (Tree, Hint, True, Node);
end if;
end;
return;
end if;
-- We know that Key isn't less than the hint, so it must be equal
-- or greater. So we just test whether Key is less than or equal
-- to (same as "not greater than") the hint's next neighbor, and
-- if so insert it after the hint.
declare
After : constant Count_Type := Ops.Next (Tree, Hint);
begin
if After = 0 then
Insert_Post (Tree, Hint, False, Node);
elsif Is_Greater_Key_Node (Key, N (After)) then
Unconditional_Insert_Sans_Hint (Tree, Key, Node);
elsif Ops.Right (N (Hint)) = 0 then
Insert_Post (Tree, Hint, False, Node);
else
Insert_Post (Tree, After, True, Node);
end if;
end;
end Generic_Unconditional_Insert_With_Hint;
-----------------
-- Upper_Bound --
-----------------
function Upper_Bound
(Tree : Tree_Type'Class;
Key : Key_Type) return Count_Type
is
Y : Count_Type;
X : Count_Type;
N : Nodes_Type renames Tree.Nodes;
begin
Y := 0;
X := Tree.Root;
while X /= 0 loop
if Is_Less_Key_Node (Key, N (X)) then
Y := X;
X := Ops.Left (N (X));
else
X := Ops.Right (N (X));
end if;
end loop;
return Y;
end Upper_Bound;
end Ada.Containers.Red_Black_Trees.Generic_Bounded_Keys;
|
src/condor_tests/cmd_status-af_orig_first_test.ads | sridish123/htcondor | 217 | 14644 | AcceptedWhileDraining = false
Activity = "Idle"
AddressV1 = "{[ p=\"primary\"; a=\"10.0.0.3\"; port=36347; n=\"Internet\"; alias=\"gthain.localdomain\"; spid=\"startd_888024_2e07\"; noUDP=true; ], [ p=\"IPv4\"; a=\"10.0.0.3\"; port=36347; n=\"Internet\"; alias=\"gthain.localdomain\"; spid=\"startd_888024_2e07\"; noUDP=true; ]}"
Arch = "X86_64"
AuthenticatedIdentity = "<EMAIL>"
AuthenticationMethod = "FAMILY"
CanHibernate = true
ClockDay = 0
ClockMin = 980
COLLECTOR_HOST_STRING = "gthain.localdomain:0"
CondorLoadAvg = 0.0
CondorPlatform = "$CondorPlatform: X86_64-Fedora_33 $"
CondorVersion = "$CondorVersion: 8.9.12 Mar 14 2021 BuildID: UW_development RC $"
ConsoleIdle = 0
CpuBusy = ((LoadAvg - CondorLoadAvg) >= 0.5)
CpuBusyTime = 0
CpuCacheSize = 8192
CpuFamily = 6
CpuIsBusy = true
CpuModelNumber = 142
Cpus = 1
CurrentRank = 0.0
DaemonCoreDutyCycle = 0.0
DaemonLastReconfigTime = 1615756825
DaemonShutdown = time() - DaemonStartTime > 1500
DaemonStartTime = 1615756825
DetectedCpus = 8
DetectedMemory = 15661
Disk = 16190387
EnteredCurrentActivity = 1615756825
EnteredCurrentState = 1615756825
ExpectedMachineGracefulDrainingBadput = 0
ExpectedMachineGracefulDrainingCompletion = 1615756825
ExpectedMachineQuickDrainingBadput = 0
ExpectedMachineQuickDrainingCompletion = 1615756825
FileSystemDomain = "gthain.localdomain"
has_avx = true
has_avx2 = true
has_sse4_1 = true
has_sse4_2 = true
has_ssse3 = true
HasFileTransfer = true
HasIOProxy = true
HasJICLocalConfig = true
HasJICLocalStdin = true
HasJobDeferral = true
HasJobTransferPlugins = true
HasMPI = true
HasPerFileEncryption = true
HasReconnect = true
HasSelfCheckpointTransfers = true
HasSingularity = true
HasTDP = true
HasTransferInputRemaps = true
HasUserNamespaces = true
HasVM = false
HibernationLevel = 0
HibernationState = "NONE"
HibernationSupportedStates = "S3,S4,S5"
IsLocalStartd = false
IsWakeAble = false
IsWakeOnLanEnabled = false
IsWakeOnLanSupported = false
JobPreemptions = 0
JobRankPreemptions = 0
JobStarts = 0
JobUserPrioPreemptions = 0
KeyboardIdle = 0
LastBenchmark = 0
LastFetchWorkCompleted = 0
LastFetchWorkSpawned = 0
LastHeardFrom = 1615756825
LoadAvg = 0.59
Machine = "gthain.localdomain"
MachineMaxVacateTime = 10 * 60
MachineResources = "Cpus Memory Disk Swap"
MaxJobRetirementTime = 0
Memory = 1957
MonitorSelfAge = 1
MonitorSelfCPUUsage = 1.0
MonitorSelfImageSize = 26716
MonitorSelfRegisteredSocketCount = 0
MonitorSelfResidentSetSize = 12836
MonitorSelfSecuritySessions = 10
MonitorSelfTime = 1615756825
MyAddress = "<10.0.0.3:36347?addrs=10.0.0.3-36347&alias=gthain.localdomain&noUDP&sock=startd_888024_2e07>"
MyCurrentTime = 1615756825
MyType = "Machine"
Name = "<EMAIL>"
NextFetchWorkDelay = -1
NumPids = 0
OpSys = "LINUX"
OpSysAndVer = "Fedora33"
OpSysLegacy = "LINUX"
OpSysLongName = "Fedora release 33 (Thirty Three)"
OpSysMajorVer = 33
OpSysName = "Fedora"
OpSysShortName = "Fedora"
OpSysVer = 3300
Rank = 0.0
RecentDaemonCoreDutyCycle = 0.0
RecentJobPreemptions = 0
RecentJobRankPreemptions = 0
RecentJobStarts = 0
RecentJobUserPrioPreemptions = 0
Requirements = START
RetirementTimeRemaining = 0
SingularityVersion = "singularity version 3.7.1-1.fc33"
SlotID = 1
SlotType = "Static"
SlotTypeID = 0
SlotWeight = Cpus
Start = true
StartdIpAddr = "<10.0.0.3:36347?addrs=10.0.0.3-36347&alias=gthain.localdomain&noUDP&sock=startd_888024_2e07>"
StarterAbilityList = "HasVM,HasMPI,HasFileTransfer,HasJobDeferral,HasSingularity,HasJobTransferPlugins,HasPerFileEncryption,HasReconnect,HasTDP,HasJICLocalStdin,HasTransferInputRemaps,HasSelfCheckpointTransfers,HasJICLocalConfig"
State = "Unclaimed"
SubnetMask = "255.255.255.0"
TargetType = "Job"
TimeToLive = 2147483647
TotalCondorLoadAvg = 0.0
TotalCpus = 8.0
TotalDisk = 129523096
TotalLoadAvg = 0.59
TotalMemory = 15661
TotalSlotCpus = 1
TotalSlotDisk = 16190387.0
TotalSlotMemory = 1957
TotalSlots = 8
TotalVirtualMemory = 28313600
UidDomain = "gthain.localdomain"
Unhibernate = MY.MachineLastMatchTime =!= undefined
UpdateSequenceNumber = 1
UpdatesHistory = "00000000000000000000000000000000"
UpdatesLost = 0
UpdatesSequenced = 0
UpdatesTotal = 1
UtsnameMachine = "x86_64"
UtsnameNodename = "gthain.localdomain"
UtsnameRelease = "5.10.21-200.fc33.x86_64"
UtsnameSysname = "Linux"
UtsnameVersion = "#1 SMP Mon Mar 8 00:24:40 UTC 2021"
VirtualMemory = 3539200
WakeOnLanEnabledFlags = "NONE"
WakeOnLanSupportedFlags = "NONE"
AcceptedWhileDraining = false
Activity = "Idle"
AddressV1 = "{[ p=\"primary\"; a=\"10.0.0.3\"; port=36347; n=\"Internet\"; alias=\"gthain.localdomain\"; spid=\"startd_888024_2e07\"; noUDP=true; ], [ p=\"IPv4\"; a=\"10.0.0.3\"; port=36347; n=\"Internet\"; alias=\"gthain.localdomain\"; spid=\"startd_888024_2e07\"; noUDP=true; ]}"
Arch = "X86_64"
AuthenticatedIdentity = "condor@family"
AuthenticationMethod = "FAMILY"
CanHibernate = true
ClockDay = 0
ClockMin = 980
COLLECTOR_HOST_STRING = "gthain.localdomain:0"
CondorLoadAvg = 0.0
CondorPlatform = "$CondorPlatform: X86_64-Fedora_33 $"
CondorVersion = "$CondorVersion: 8.9.12 Mar 14 2021 BuildID: UW_development RC $"
ConsoleIdle = 0
CpuBusy = ((LoadAvg - CondorLoadAvg) >= 0.5)
CpuBusyTime = 0
CpuCacheSize = 8192
CpuFamily = 6
CpuIsBusy = false
CpuModelNumber = 142
Cpus = 1
CurrentRank = 0.0
DaemonCoreDutyCycle = 0.0
DaemonLastReconfigTime = 1615756825
DaemonShutdown = time() - DaemonStartTime > 1500
DaemonStartTime = 1615756825
DetectedCpus = 8
DetectedMemory = 15661
Disk = 16190387
EnteredCurrentActivity = 1615756825
EnteredCurrentState = 1615756825
ExpectedMachineGracefulDrainingBadput = 0
ExpectedMachineGracefulDrainingCompletion = 1615756825
ExpectedMachineQuickDrainingBadput = 0
ExpectedMachineQuickDrainingCompletion = 1615756825
FileSystemDomain = "gthain.localdomain"
HardwareAddress = "40:ec:99:82:52:b2"
has_avx = true
has_avx2 = true
has_sse4_1 = true
has_sse4_2 = true
has_ssse3 = true
HasFileTransfer = true
HasIOProxy = true
HasJICLocalConfig = true
HasJICLocalStdin = true
HasJobDeferral = true
HasJobTransferPlugins = true
HasMPI = true
HasPerFileEncryption = true
HasReconnect = true
HasSelfCheckpointTransfers = true
HasSingularity = true
HasTDP = true
HasTransferInputRemaps = true
HasUserNamespaces = true
HasVM = false
HibernationLevel = 0
HibernationState = "NONE"
HibernationSupportedStates = "S3,S4,S5"
IsLocalStartd = false
IsWakeAble = false
IsWakeOnLanEnabled = false
IsWakeOnLanSupported = false
JobPreemptions = 0
JobRankPreemptions = 0
JobStarts = 0
JobUserPrioPreemptions = 0
KeyboardIdle = 0
LastBenchmark = 0
LastFetchWorkCompleted = 0
LastFetchWorkSpawned = 0
LastHeardFrom = 1615756825
LoadAvg = 0.0
Machine = "gthain.localdomain"
MachineMaxVacateTime = 10 * 60
MachineResources = "Cpus Memory Disk Swap"
MaxJobRetirementTime = 0
Memory = 1957
MonitorSelfAge = 1
MonitorSelfCPUUsage = 1.0
MonitorSelfImageSize = 26716
MonitorSelfRegisteredSocketCount = 0
MonitorSelfResidentSetSize = 12836
MonitorSelfSecuritySessions = 10
MonitorSelfTime = 1615756825
MyAddress = "<10.0.0.3:36347?addrs=10.0.0.3-36347&alias=gthain.localdomain&noUDP&sock=startd_888024_2e07>"
MyCurrentTime = 1615756825
MyType = "Machine"
Name = "<EMAIL>"
NextFetchWorkDelay = -1
NumPids = 0
OpSys = "LINUX"
OpSysAndVer = "Fedora33"
OpSysLegacy = "LINUX"
OpSysLongName = "Fedora release 33 (Thirty Three)"
OpSysMajorVer = 33
OpSysName = "Fedora"
OpSysShortName = "Fedora"
OpSysVer = 3300
Rank = 0.0
RecentDaemonCoreDutyCycle = 0.0
RecentJobPreemptions = 0
RecentJobRankPreemptions = 0
RecentJobStarts = 0
RecentJobUserPrioPreemptions = 0
Requirements = START
RetirementTimeRemaining = 0
SingularityVersion = "singularity version 3.7.1-1.fc33"
SlotID = 2
SlotType = "Static"
SlotTypeID = 0
SlotWeight = Cpus
Start = true
StartdIpAddr = "<10.0.0.3:36347?addrs=10.0.0.3-36347&alias=gthain.localdomain&noUDP&sock=startd_888024_2e07>"
StarterAbilityList = "HasVM,HasMPI,HasFileTransfer,HasJobDeferral,HasSingularity,HasJobTransferPlugins,HasPerFileEncryption,HasReconnect,HasTDP,HasJICLocalStdin,HasTransferInputRemaps,HasSelfCheckpointTransfers,HasJICLocalConfig"
State = "Unclaimed"
SubnetMask = "255.255.255.0"
TargetType = "Job"
TimeToLive = 2147483647
TotalCondorLoadAvg = 0.0
TotalCpus = 8.0
TotalDisk = 129523096
TotalLoadAvg = 0.59
TotalMemory = 15661
TotalSlotCpus = 1
TotalSlotDisk = 16190387.0
TotalSlotMemory = 1957
TotalSlots = 8
TotalVirtualMemory = 28313600
UidDomain = "gthain.localdomain"
Unhibernate = MY.MachineLastMatchTime =!= undefined
UpdateSequenceNumber = 1
UpdatesHistory = "00000000000000000000000000000000"
UpdatesLost = 0
UpdatesSequenced = 0
UpdatesTotal = 1
UtsnameMachine = "x86_64"
UtsnameNodename = "gthain.localdomain"
UtsnameRelease = "5.10.21-200.fc33.x86_64"
UtsnameSysname = "Linux"
UtsnameVersion = "#1 SMP Mon Mar 8 00:24:40 UTC 2021"
VirtualMemory = 3539200
WakeOnLanEnabledFlags = "NONE"
WakeOnLanSupportedFlags = "NONE"
AcceptedWhileDraining = false
Activity = "Idle"
AddressV1 = "{[ p=\"primary\"; a=\"10.0.0.3\"; port=36347; n=\"Internet\"; alias=\"gthain.localdomain\"; spid=\"startd_888024_2e07\"; noUDP=true; ], [ p=\"IPv4\"; a=\"10.0.0.3\"; port=36347; n=\"Internet\"; alias=\"gthain.localdomain\"; spid=\"startd_888024_2e07\"; noUDP=true; ]}"
Arch = "X86_64"
AuthenticatedIdentity = "<EMAIL>"
AuthenticationMethod = "FAMILY"
CanHibernate = true
ClockDay = 0
ClockMin = 980
COLLECTOR_HOST_STRING = "gthain.localdomain:0"
CondorLoadAvg = 0.0
CondorPlatform = "$CondorPlatform: X86_64-Fedora_33 $"
CondorVersion = "$CondorVersion: 8.9.12 Mar 14 2021 BuildID: UW_development RC $"
ConsoleIdle = 0
CpuBusy = ((LoadAvg - CondorLoadAvg) >= 0.5)
CpuBusyTime = 0
CpuCacheSize = 8192
CpuFamily = 6
CpuIsBusy = false
CpuModelNumber = 142
Cpus = 1
CurrentRank = 0.0
DaemonCoreDutyCycle = 0.0
DaemonLastReconfigTime = 1615756825
DaemonShutdown = time() - DaemonStartTime > 1500
DaemonStartTime = 1615756825
DetectedCpus = 8
DetectedMemory = 15661
Disk = 16190387
EnteredCurrentActivity = 1615756825
EnteredCurrentState = 1615756825
ExpectedMachineGracefulDrainingBadput = 0
ExpectedMachineGracefulDrainingCompletion = 1615756825
ExpectedMachineQuickDrainingBadput = 0
ExpectedMachineQuickDrainingCompletion = 1615756825
FileSystemDomain = "gthain.localdomain"
HardwareAddress = "40:ec:99:82:52:b2"
has_avx = true
has_avx2 = true
has_sse4_1 = true
has_sse4_2 = true
has_ssse3 = true
HasFileTransfer = true
HasIOProxy = true
HasJICLocalConfig = true
HasJICLocalStdin = true
HasJobDeferral = true
HasJobTransferPlugins = true
HasMPI = true
HasPerFileEncryption = true
HasReconnect = true
HasSelfCheckpointTransfers = true
HasSingularity = true
HasTDP = true
HasTransferInputRemaps = true
HasUserNamespaces = true
HasVM = false
HibernationLevel = 0
HibernationState = "NONE"
HibernationSupportedStates = "S3,S4,S5"
IsLocalStartd = false
IsWakeAble = false
IsWakeOnLanEnabled = false
IsWakeOnLanSupported = false
JobPreemptions = 0
JobRankPreemptions = 0
JobStarts = 0
JobUserPrioPreemptions = 0
KeyboardIdle = 0
LastBenchmark = 0
LastFetchWorkCompleted = 0
LastFetchWorkSpawned = 0
LastHeardFrom = 1615756825
LoadAvg = 0.0
Machine = "gthain.localdomain"
MachineMaxVacateTime = 10 * 60
MachineResources = "Cpus Memory Disk Swap"
MaxJobRetirementTime = 0
Memory = 1957
MonitorSelfAge = 1
MonitorSelfCPUUsage = 1.0
MonitorSelfImageSize = 26716
MonitorSelfRegisteredSocketCount = 0
MonitorSelfResidentSetSize = 12836
MonitorSelfSecuritySessions = 10
MonitorSelfTime = 1615756825
MyAddress = "<10.0.0.3:36347?addrs=10.0.0.3-36347&alias=gthain.localdomain&noUDP&sock=startd_888024_2e07>"
MyCurrentTime = 1615756825
MyType = "Machine"
Name = "<EMAIL>"
NextFetchWorkDelay = -1
NumPids = 0
OpSys = "LINUX"
OpSysAndVer = "Fedora33"
OpSysLegacy = "LINUX"
OpSysLongName = "Fedora release 33 (Thirty Three)"
OpSysMajorVer = 33
OpSysName = "Fedora"
OpSysShortName = "Fedora"
OpSysVer = 3300
Rank = 0.0
RecentDaemonCoreDutyCycle = 0.0
RecentJobPreemptions = 0
RecentJobRankPreemptions = 0
RecentJobStarts = 0
RecentJobUserPrioPreemptions = 0
Requirements = START
RetirementTimeRemaining = 0
SingularityVersion = "singularity version 3.7.1-1.fc33"
SlotID = 3
SlotType = "Static"
SlotTypeID = 0
SlotWeight = Cpus
Start = true
StartdIpAddr = "<10.0.0.3:36347?addrs=10.0.0.3-36347&alias=gthain.localdomain&noUDP&sock=startd_888024_2e07>"
StarterAbilityList = "HasVM,HasMPI,HasFileTransfer,HasJobDeferral,HasSingularity,HasJobTransferPlugins,HasPerFileEncryption,HasReconnect,HasTDP,HasJICLocalStdin,HasTransferInputRemaps,HasSelfCheckpointTransfers,HasJICLocalConfig"
State = "Unclaimed"
SubnetMask = "255.255.255.0"
TargetType = "Job"
TimeToLive = 2147483647
TotalCondorLoadAvg = 0.0
TotalCpus = 8.0
TotalDisk = 129523096
TotalLoadAvg = 0.59
TotalMemory = 15661
TotalSlotCpus = 1
TotalSlotDisk = 16190387.0
TotalSlotMemory = 1957
TotalSlots = 8
TotalVirtualMemory = 28313600
UidDomain = "gthain.localdomain"
Unhibernate = MY.MachineLastMatchTime =!= undefined
UpdateSequenceNumber = 1
UpdatesHistory = "00000000000000000000000000000000"
UpdatesLost = 0
UpdatesSequenced = 0
UpdatesTotal = 1
UtsnameMachine = "x86_64"
UtsnameNodename = "gthain.localdomain"
UtsnameRelease = "5.10.21-200.fc33.x86_64"
UtsnameSysname = "Linux"
UtsnameVersion = "#1 SMP Mon Mar 8 00:24:40 UTC 2021"
VirtualMemory = 3539200
WakeOnLanEnabledFlags = "NONE"
WakeOnLanSupportedFlags = "NONE"
AcceptedWhileDraining = false
Activity = "Idle"
AddressV1 = "{[ p=\"primary\"; a=\"10.0.0.3\"; port=36347; n=\"Internet\"; alias=\"gthain.localdomain\"; spid=\"startd_888024_2e07\"; noUDP=true; ], [ p=\"IPv4\"; a=\"10.0.0.3\"; port=36347; n=\"Internet\"; alias=\"gthain.localdomain\"; spid=\"startd_888024_2e07\"; noUDP=true; ]}"
Arch = "X86_64"
AuthenticatedIdentity = "condor@family"
AuthenticationMethod = "FAMILY"
CanHibernate = true
ClockDay = 0
ClockMin = 980
COLLECTOR_HOST_STRING = "gthain.localdomain:0"
CondorLoadAvg = 0.0
CondorPlatform = "$CondorPlatform: X86_64-Fedora_33 $"
CondorVersion = "$CondorVersion: 8.9.12 Mar 14 2021 BuildID: UW_development RC $"
ConsoleIdle = 0
CpuBusy = ((LoadAvg - CondorLoadAvg) >= 0.5)
CpuBusyTime = 0
CpuCacheSize = 8192
CpuFamily = 6
CpuIsBusy = false
CpuModelNumber = 142
Cpus = 1
CurrentRank = 0.0
DaemonCoreDutyCycle = 0.0
DaemonLastReconfigTime = 1615756825
DaemonShutdown = time() - DaemonStartTime > 1500
DaemonStartTime = 1615756825
DetectedCpus = 8
DetectedMemory = 15661
Disk = 16190387
EnteredCurrentActivity = 1615756825
EnteredCurrentState = 1615756825
ExpectedMachineGracefulDrainingBadput = 0
ExpectedMachineGracefulDrainingCompletion = 1615756825
ExpectedMachineQuickDrainingBadput = 0
ExpectedMachineQuickDrainingCompletion = 1615756825
FileSystemDomain = "gthain.localdomain"
HardwareAddress = "40:ec:99:82:52:b2"
has_avx = true
has_avx2 = true
has_sse4_1 = true
has_sse4_2 = true
has_ssse3 = true
HasFileTransfer = true
HasIOProxy = true
HasJICLocalConfig = true
HasJICLocalStdin = true
HasJobDeferral = true
HasJobTransferPlugins = true
HasMPI = true
HasPerFileEncryption = true
HasReconnect = true
HasSelfCheckpointTransfers = true
HasSingularity = true
HasTDP = true
HasTransferInputRemaps = true
HasUserNamespaces = true
HasVM = false
HibernationLevel = 0
HibernationState = "NONE"
HibernationSupportedStates = "S3,S4,S5"
IsLocalStartd = false
IsWakeAble = false
IsWakeOnLanEnabled = false
IsWakeOnLanSupported = false
JobPreemptions = 0
JobRankPreemptions = 0
JobStarts = 0
JobUserPrioPreemptions = 0
KeyboardIdle = 0
LastBenchmark = 0
LastFetchWorkCompleted = 0
LastFetchWorkSpawned = 0
LastHeardFrom = 1615756825
LoadAvg = 0.0
Machine = "gthain.localdomain"
MachineMaxVacateTime = 10 * 60
MachineResources = "Cpus Memory Disk Swap"
MaxJobRetirementTime = 0
Memory = 1957
MonitorSelfAge = 1
MonitorSelfCPUUsage = 1.0
MonitorSelfImageSize = 26716
MonitorSelfRegisteredSocketCount = 0
MonitorSelfResidentSetSize = 12836
MonitorSelfSecuritySessions = 10
MonitorSelfTime = 1615756825
MyAddress = "<10.0.0.3:36347?addrs=10.0.0.3-36347&alias=gthain.localdomain&noUDP&sock=startd_888024_2e07>"
MyCurrentTime = 1615756825
MyType = "Machine"
Name = "<EMAIL>"
NextFetchWorkDelay = -1
NumPids = 0
OpSys = "LINUX"
OpSysAndVer = "Fedora33"
OpSysLegacy = "LINUX"
OpSysLongName = "Fedora release 33 (Thirty Three)"
OpSysMajorVer = 33
OpSysName = "Fedora"
OpSysShortName = "Fedora"
OpSysVer = 3300
Rank = 0.0
RecentDaemonCoreDutyCycle = 0.0
RecentJobPreemptions = 0
RecentJobRankPreemptions = 0
RecentJobStarts = 0
RecentJobUserPrioPreemptions = 0
Requirements = START
RetirementTimeRemaining = 0
SingularityVersion = "singularity version 3.7.1-1.fc33"
SlotID = 4
SlotType = "Static"
SlotTypeID = 0
SlotWeight = Cpus
Start = true
StartdIpAddr = "<10.0.0.3:36347?addrs=10.0.0.3-36347&alias=gthain.localdomain&noUDP&sock=startd_888024_2e07>"
StarterAbilityList = "HasVM,HasMPI,HasFileTransfer,HasJobDeferral,HasSingularity,HasJobTransferPlugins,HasPerFileEncryption,HasReconnect,HasTDP,HasJICLocalStdin,HasTransferInputRemaps,HasSelfCheckpointTransfers,HasJICLocalConfig"
State = "Unclaimed"
SubnetMask = "255.255.255.0"
TargetType = "Job"
TimeToLive = 2147483647
TotalCondorLoadAvg = 0.0
TotalCpus = 8.0
TotalDisk = 129523096
TotalLoadAvg = 0.59
TotalMemory = 15661
TotalSlotCpus = 1
TotalSlotDisk = 16190387.0
TotalSlotMemory = 1957
TotalSlots = 8
TotalVirtualMemory = 28313600
UidDomain = "gthain.localdomain"
Unhibernate = MY.MachineLastMatchTime =!= undefined
UpdateSequenceNumber = 1
UpdatesHistory = "00000000000000000000000000000000"
UpdatesLost = 0
UpdatesSequenced = 0
UpdatesTotal = 1
UtsnameMachine = "x86_64"
UtsnameNodename = "gthain.localdomain"
UtsnameRelease = "5.10.21-200.fc33.x86_64"
UtsnameSysname = "Linux"
UtsnameVersion = "#1 SMP Mon Mar 8 00:24:40 UTC 2021"
VirtualMemory = 3539200
WakeOnLanEnabledFlags = "NONE"
WakeOnLanSupportedFlags = "NONE"
AcceptedWhileDraining = false
Activity = "Idle"
AddressV1 = "{[ p=\"primary\"; a=\"10.0.0.3\"; port=36347; n=\"Internet\"; alias=\"gthain.localdomain\"; spid=\"startd_888024_2e07\"; noUDP=true; ], [ p=\"IPv4\"; a=\"10.0.0.3\"; port=36347; n=\"Internet\"; alias=\"gthain.localdomain\"; spid=\"startd_888024_2e07\"; noUDP=true; ]}"
Arch = "X86_64"
AuthenticatedIdentity = "condor@family"
AuthenticationMethod = "FAMILY"
CanHibernate = true
ClockDay = 0
ClockMin = 980
COLLECTOR_HOST_STRING = "gthain.localdomain:0"
CondorLoadAvg = 0.0
CondorPlatform = "$CondorPlatform: X86_64-Fedora_33 $"
CondorVersion = "$CondorVersion: 8.9.12 Mar 14 2021 BuildID: UW_development RC $"
ConsoleIdle = 0
CpuBusy = ((LoadAvg - CondorLoadAvg) >= 0.5)
CpuBusyTime = 0
CpuCacheSize = 8192
CpuFamily = 6
CpuIsBusy = false
CpuModelNumber = 142
Cpus = 1
CurrentRank = 0.0
DaemonCoreDutyCycle = 0.0
DaemonLastReconfigTime = 1615756825
DaemonShutdown = time() - DaemonStartTime > 1500
DaemonStartTime = 1615756825
DetectedCpus = 8
DetectedMemory = 15661
Disk = 16190387
EnteredCurrentActivity = 1615756825
EnteredCurrentState = 1615756825
ExpectedMachineGracefulDrainingBadput = 0
ExpectedMachineGracefulDrainingCompletion = 1615756825
ExpectedMachineQuickDrainingBadput = 0
ExpectedMachineQuickDrainingCompletion = 1615756825
FileSystemDomain = "gthain.localdomain"
HardwareAddress = "40:ec:99:82:52:b2"
has_avx = true
has_avx2 = true
has_sse4_1 = true
has_sse4_2 = true
has_ssse3 = true
HasFileTransfer = true
HasIOProxy = true
HasJICLocalConfig = true
HasJICLocalStdin = true
HasJobDeferral = true
HasJobTransferPlugins = true
HasMPI = true
HasPerFileEncryption = true
HasReconnect = true
HasSelfCheckpointTransfers = true
HasSingularity = true
HasTDP = true
HasTransferInputRemaps = true
HasUserNamespaces = true
HasVM = false
HibernationLevel = 0
HibernationState = "NONE"
HibernationSupportedStates = "S3,S4,S5"
IsLocalStartd = false
IsWakeAble = false
IsWakeOnLanEnabled = false
IsWakeOnLanSupported = false
JobPreemptions = 0
JobRankPreemptions = 0
JobStarts = 0
JobUserPrioPreemptions = 0
KeyboardIdle = 0
LastBenchmark = 0
LastFetchWorkCompleted = 0
LastFetchWorkSpawned = 0
LastHeardFrom = 1615756825
LoadAvg = 0.0
Machine = "gthain.localdomain"
MachineMaxVacateTime = 10 * 60
MachineResources = "Cpus Memory Disk Swap"
MaxJobRetirementTime = 0
Memory = 1957
MonitorSelfAge = 1
MonitorSelfCPUUsage = 1.0
MonitorSelfImageSize = 26716
MonitorSelfRegisteredSocketCount = 0
MonitorSelfResidentSetSize = 12836
MonitorSelfSecuritySessions = 10
MonitorSelfTime = 1615756825
MyAddress = "<10.0.0.3:36347?addrs=10.0.0.3-36347&alias=gthain.localdomain&noUDP&sock=startd_888024_2e07>"
MyCurrentTime = 1615756825
MyType = "Machine"
Name = "<EMAIL>.<EMAIL>"
NextFetchWorkDelay = -1
NumPids = 0
OpSys = "LINUX"
OpSysAndVer = "Fedora33"
OpSysLegacy = "LINUX"
OpSysLongName = "Fedora release 33 (Thirty Three)"
OpSysMajorVer = 33
OpSysName = "Fedora"
OpSysShortName = "Fedora"
OpSysVer = 3300
Rank = 0.0
RecentDaemonCoreDutyCycle = 0.0
RecentJobPreemptions = 0
RecentJobRankPreemptions = 0
RecentJobStarts = 0
RecentJobUserPrioPreemptions = 0
Requirements = START
RetirementTimeRemaining = 0
SingularityVersion = "singularity version 3.7.1-1.fc33"
SlotID = 5
SlotType = "Static"
SlotTypeID = 0
SlotWeight = Cpus
Start = true
StartdIpAddr = "<10.0.0.3:36347?addrs=10.0.0.3-36347&alias=gthain.localdomain&noUDP&sock=startd_888024_2e07>"
StarterAbilityList = "HasVM,HasMPI,HasFileTransfer,HasJobDeferral,HasSingularity,HasJobTransferPlugins,HasPerFileEncryption,HasReconnect,HasTDP,HasJICLocalStdin,HasTransferInputRemaps,HasSelfCheckpointTransfers,HasJICLocalConfig"
State = "Unclaimed"
SubnetMask = "255.255.255.0"
TargetType = "Job"
TimeToLive = 2147483647
TotalCondorLoadAvg = 0.0
TotalCpus = 8.0
TotalDisk = 129523096
TotalLoadAvg = 0.59
TotalMemory = 15661
TotalSlotCpus = 1
TotalSlotDisk = 16190387.0
TotalSlotMemory = 1957
TotalSlots = 8
TotalVirtualMemory = 28313600
UidDomain = "gthain.localdomain"
Unhibernate = MY.MachineLastMatchTime =!= undefined
UpdateSequenceNumber = 1
UpdatesHistory = "00000000000000000000000000000000"
UpdatesLost = 0
UpdatesSequenced = 0
UpdatesTotal = 1
UtsnameMachine = "x86_64"
UtsnameNodename = "gthain.localdomain"
UtsnameRelease = "5.10.21-200.fc33.x86_64"
UtsnameSysname = "Linux"
UtsnameVersion = "#1 SMP Mon Mar 8 00:24:40 UTC 2021"
VirtualMemory = 3539200
WakeOnLanEnabledFlags = "NONE"
WakeOnLanSupportedFlags = "NONE"
AcceptedWhileDraining = false
Activity = "Idle"
AddressV1 = "{[ p=\"primary\"; a=\"10.0.0.3\"; port=36347; n=\"Internet\"; alias=\"gthain.localdomain\"; spid=\"startd_888024_2e07\"; noUDP=true; ], [ p=\"IPv4\"; a=\"10.0.0.3\"; port=36347; n=\"Internet\"; alias=\"gthain.localdomain\"; spid=\"startd_888024_2e07\"; noUDP=true; ]}"
Arch = "X86_64"
AuthenticatedIdentity = "condor@family"
AuthenticationMethod = "FAMILY"
CanHibernate = true
ClockDay = 0
ClockMin = 980
COLLECTOR_HOST_STRING = "gthain.localdomain:0"
CondorLoadAvg = 0.0
CondorPlatform = "$CondorPlatform: X86_64-Fedora_33 $"
CondorVersion = "$CondorVersion: 8.9.12 Mar 14 2021 BuildID: UW_development RC $"
ConsoleIdle = 0
CpuBusy = ((LoadAvg - CondorLoadAvg) >= 0.5)
CpuBusyTime = 0
CpuCacheSize = 8192
CpuFamily = 6
CpuIsBusy = false
CpuModelNumber = 142
Cpus = 1
CurrentRank = 0.0
DaemonCoreDutyCycle = 0.0
DaemonLastReconfigTime = 1615756825
DaemonShutdown = time() - DaemonStartTime > 1500
DaemonStartTime = 1615756825
DetectedCpus = 8
DetectedMemory = 15661
Disk = 16190387
EnteredCurrentActivity = 1615756825
EnteredCurrentState = 1615756825
ExpectedMachineGracefulDrainingBadput = 0
ExpectedMachineGracefulDrainingCompletion = 1615756825
ExpectedMachineQuickDrainingBadput = 0
ExpectedMachineQuickDrainingCompletion = 1615756825
FileSystemDomain = "gthain.localdomain"
HardwareAddress = "40:ec:99:82:52:b2"
has_avx = true
has_avx2 = true
has_sse4_1 = true
has_sse4_2 = true
has_ssse3 = true
HasFileTransfer = true
HasIOProxy = true
HasJICLocalConfig = true
HasJICLocalStdin = true
HasJobDeferral = true
HasJobTransferPlugins = true
HasMPI = true
HasPerFileEncryption = true
HasReconnect = true
HasSelfCheckpointTransfers = true
HasSingularity = true
HasTDP = true
HasTransferInputRemaps = true
HasUserNamespaces = true
HasVM = false
HibernationLevel = 0
HibernationState = "NONE"
HibernationSupportedStates = "S3,S4,S5"
IsLocalStartd = false
IsWakeAble = false
IsWakeOnLanEnabled = false
IsWakeOnLanSupported = false
JobPreemptions = 0
JobRankPreemptions = 0
JobStarts = 0
JobUserPrioPreemptions = 0
KeyboardIdle = 0
LastBenchmark = 0
LastFetchWorkCompleted = 0
LastFetchWorkSpawned = 0
LastHeardFrom = 1615756825
LoadAvg = 0.0
Machine = "gthain.localdomain"
MachineMaxVacateTime = 10 * 60
MachineResources = "Cpus Memory Disk Swap"
MaxJobRetirementTime = 0
Memory = 1957
MonitorSelfAge = 1
MonitorSelfCPUUsage = 1.0
MonitorSelfImageSize = 26716
MonitorSelfRegisteredSocketCount = 0
MonitorSelfResidentSetSize = 12836
MonitorSelfSecuritySessions = 10
MonitorSelfTime = 1615756825
MyAddress = "<10.0.0.3:36347?addrs=10.0.0.3-36347&alias=gthain.localdomain&noUDP&sock=startd_888024_2e07>"
MyCurrentTime = 1615756825
MyType = "Machine"
Name = "<EMAIL>"
NextFetchWorkDelay = -1
NumPids = 0
OpSys = "LINUX"
OpSysAndVer = "Fedora33"
OpSysLegacy = "LINUX"
OpSysLongName = "Fedora release 33 (Thirty Three)"
OpSysMajorVer = 33
OpSysName = "Fedora"
OpSysShortName = "Fedora"
OpSysVer = 3300
Rank = 0.0
RecentDaemonCoreDutyCycle = 0.0
RecentJobPreemptions = 0
RecentJobRankPreemptions = 0
RecentJobStarts = 0
RecentJobUserPrioPreemptions = 0
Requirements = START
RetirementTimeRemaining = 0
SingularityVersion = "singularity version 3.7.1-1.fc33"
SlotID = 6
SlotType = "Static"
SlotTypeID = 0
SlotWeight = Cpus
Start = true
StartdIpAddr = "<10.0.0.3:36347?addrs=10.0.0.3-36347&alias=gthain.localdomain&noUDP&sock=startd_888024_2e07>"
StarterAbilityList = "HasVM,HasMPI,HasFileTransfer,HasJobDeferral,HasSingularity,HasJobTransferPlugins,HasPerFileEncryption,HasReconnect,HasTDP,HasJICLocalStdin,HasTransferInputRemaps,HasSelfCheckpointTransfers,HasJICLocalConfig"
State = "Unclaimed"
SubnetMask = "255.255.255.0"
TargetType = "Job"
TimeToLive = 2147483647
TotalCondorLoadAvg = 0.0
TotalCpus = 8.0
TotalDisk = 129523096
TotalLoadAvg = 0.59
TotalMemory = 15661
TotalSlotCpus = 1
TotalSlotDisk = 16190387.0
TotalSlotMemory = 1957
TotalSlots = 8
TotalVirtualMemory = 28313600
UidDomain = "gthain.localdomain"
Unhibernate = MY.MachineLastMatchTime =!= undefined
UpdateSequenceNumber = 1
UpdatesHistory = "00000000000000000000000000000000"
UpdatesLost = 0
UpdatesSequenced = 0
UpdatesTotal = 1
UtsnameMachine = "x86_64"
UtsnameNodename = "gthain.localdomain"
UtsnameRelease = "5.10.21-200.fc33.x86_64"
UtsnameSysname = "Linux"
UtsnameVersion = "#1 SMP Mon Mar 8 00:24:40 UTC 2021"
VirtualMemory = 3539200
WakeOnLanEnabledFlags = "NONE"
WakeOnLanSupportedFlags = "NONE"
AcceptedWhileDraining = false
Activity = "Idle"
AddressV1 = "{[ p=\"primary\"; a=\"10.0.0.3\"; port=36347; n=\"Internet\"; alias=\"gthain.localdomain\"; spid=\"startd_888024_2e07\"; noUDP=true; ], [ p=\"IPv4\"; a=\"10.0.0.3\"; port=36347; n=\"Internet\"; alias=\"gthain.localdomain\"; spid=\"startd_888024_2e07\"; noUDP=true; ]}"
Arch = "X86_64"
AuthenticatedIdentity = "condor@family"
AuthenticationMethod = "FAMILY"
CanHibernate = true
ClockDay = 0
ClockMin = 980
COLLECTOR_HOST_STRING = "gthain.localdomain:0"
CondorLoadAvg = 0.0
CondorPlatform = "$CondorPlatform: X86_64-Fedora_33 $"
CondorVersion = "$CondorVersion: 8.9.12 Mar 14 2021 BuildID: UW_development RC $"
ConsoleIdle = 0
CpuBusy = ((LoadAvg - CondorLoadAvg) >= 0.5)
CpuBusyTime = 0
CpuCacheSize = 8192
CpuFamily = 6
CpuIsBusy = false
CpuModelNumber = 142
Cpus = 1
CurrentRank = 0.0
DaemonCoreDutyCycle = 0.0
DaemonLastReconfigTime = 1615756825
DaemonShutdown = time() - DaemonStartTime > 1500
DaemonStartTime = 1615756825
DetectedCpus = 8
DetectedMemory = 15661
Disk = 16190387
EnteredCurrentActivity = 1615756825
EnteredCurrentState = 1615756825
ExpectedMachineGracefulDrainingBadput = 0
ExpectedMachineGracefulDrainingCompletion = 1615756825
ExpectedMachineQuickDrainingBadput = 0
ExpectedMachineQuickDrainingCompletion = 1615756825
FileSystemDomain = "gthain.localdomain"
HardwareAddress = "40:ec:99:82:52:b2"
has_avx = true
has_avx2 = true
has_sse4_1 = true
has_sse4_2 = true
has_ssse3 = true
HasFileTransfer = true
HasIOProxy = true
HasJICLocalConfig = true
HasJICLocalStdin = true
HasJobDeferral = true
HasJobTransferPlugins = true
HasMPI = true
HasPerFileEncryption = true
HasReconnect = true
HasSelfCheckpointTransfers = true
HasSingularity = true
HasTDP = true
HasTransferInputRemaps = true
HasUserNamespaces = true
HasVM = false
HibernationLevel = 0
HibernationState = "NONE"
HibernationSupportedStates = "S3,S4,S5"
IsLocalStartd = false
IsWakeAble = false
IsWakeOnLanEnabled = false
IsWakeOnLanSupported = false
JobPreemptions = 0
JobRankPreemptions = 0
JobStarts = 0
JobUserPrioPreemptions = 0
KeyboardIdle = 0
LastBenchmark = 0
LastFetchWorkCompleted = 0
LastFetchWorkSpawned = 0
LastHeardFrom = 1615756825
LoadAvg = 0.0
Machine = "gthain.localdomain"
MachineMaxVacateTime = 10 * 60
MachineResources = "Cpus Memory Disk Swap"
MaxJobRetirementTime = 0
Memory = 1957
MonitorSelfAge = 1
MonitorSelfCPUUsage = 1.0
MonitorSelfImageSize = 26716
MonitorSelfRegisteredSocketCount = 0
MonitorSelfResidentSetSize = 12836
MonitorSelfSecuritySessions = 10
MonitorSelfTime = 1615756825
MyAddress = "<10.0.0.3:36347?addrs=10.0.0.3-36347&alias=gthain.localdomain&noUDP&sock=startd_888024_2e07>"
MyCurrentTime = 1615756825
MyType = "Machine"
Name = "<EMAIL>"
NextFetchWorkDelay = -1
NumPids = 0
OpSys = "LINUX"
OpSysAndVer = "Fedora33"
OpSysLegacy = "LINUX"
OpSysLongName = "Fedora release 33 (Thirty Three)"
OpSysMajorVer = 33
OpSysName = "Fedora"
OpSysShortName = "Fedora"
OpSysVer = 3300
Rank = 0.0
RecentDaemonCoreDutyCycle = 0.0
RecentJobPreemptions = 0
RecentJobRankPreemptions = 0
RecentJobStarts = 0
RecentJobUserPrioPreemptions = 0
Requirements = START
RetirementTimeRemaining = 0
SingularityVersion = "singularity version 3.7.1-1.fc33"
SlotID = 7
SlotType = "Static"
SlotTypeID = 0
SlotWeight = Cpus
Start = true
StartdIpAddr = "<10.0.0.3:36347?addrs=10.0.0.3-36347&alias=gthain.localdomain&noUDP&sock=startd_888024_2e07>"
StarterAbilityList = "HasVM,HasMPI,HasFileTransfer,HasJobDeferral,HasSingularity,HasJobTransferPlugins,HasPerFileEncryption,HasReconnect,HasTDP,HasJICLocalStdin,HasTransferInputRemaps,HasSelfCheckpointTransfers,HasJICLocalConfig"
State = "Unclaimed"
SubnetMask = "255.255.255.0"
TargetType = "Job"
TimeToLive = 2147483647
TotalCondorLoadAvg = 0.0
TotalCpus = 8.0
TotalDisk = 129523096
TotalLoadAvg = 0.59
TotalMemory = 15661
TotalSlotCpus = 1
TotalSlotDisk = 16190387.0
TotalSlotMemory = 1957
TotalSlots = 8
TotalVirtualMemory = 28313600
UidDomain = "gthain.localdomain"
Unhibernate = MY.MachineLastMatchTime =!= undefined
UpdateSequenceNumber = 1
UpdatesHistory = "00000000000000000000000000000000"
UpdatesLost = 0
UpdatesSequenced = 0
UpdatesTotal = 1
UtsnameMachine = "x86_64"
UtsnameNodename = "gthain.localdomain"
UtsnameRelease = "5.10.21-200.fc33.x86_64"
UtsnameSysname = "Linux"
UtsnameVersion = "#1 SMP Mon Mar 8 00:24:40 UTC 2021"
VirtualMemory = 3539200
WakeOnLanEnabledFlags = "NONE"
WakeOnLanSupportedFlags = "NONE"
AcceptedWhileDraining = false
Activity = "Idle"
AddressV1 = "{[ p=\"primary\"; a=\"10.0.0.3\"; port=36347; n=\"Internet\"; alias=\"gthain.localdomain\"; spid=\"startd_888024_2e07\"; noUDP=true; ], [ p=\"IPv4\"; a=\"10.0.0.3\"; port=36347; n=\"Internet\"; alias=\"gthain.localdomain\"; spid=\"startd_888024_2e07\"; noUDP=true; ]}"
Arch = "X86_64"
AuthenticatedIdentity = "<EMAIL>"
AuthenticationMethod = "FAMILY"
CanHibernate = true
ClockDay = 0
ClockMin = 980
COLLECTOR_HOST_STRING = "gthain.localdomain:0"
CondorLoadAvg = 0.0
CondorPlatform = "$CondorPlatform: X86_64-Fedora_33 $"
CondorVersion = "$CondorVersion: 8.9.12 Mar 14 2021 BuildID: UW_development RC $"
ConsoleIdle = 0
CpuBusy = ((LoadAvg - CondorLoadAvg) >= 0.5)
CpuBusyTime = 0
CpuCacheSize = 8192
CpuFamily = 6
CpuIsBusy = false
CpuModelNumber = 142
Cpus = 1
CurrentRank = 0.0
DaemonCoreDutyCycle = 0.0
DaemonLastReconfigTime = 1615756825
DaemonShutdown = time() - DaemonStartTime > 1500
DaemonStartTime = 1615756825
DetectedCpus = 8
DetectedMemory = 15661
Disk = 16190387
EnteredCurrentActivity = 1615756825
EnteredCurrentState = 1615756825
ExpectedMachineGracefulDrainingBadput = 0
ExpectedMachineGracefulDrainingCompletion = 1615756825
ExpectedMachineQuickDrainingBadput = 0
ExpectedMachineQuickDrainingCompletion = 1615756825
FileSystemDomain = "gthain.localdomain"
HardwareAddress = "40:ec:99:82:52:b2"
has_avx = true
has_avx2 = true
has_sse4_1 = true
has_sse4_2 = true
has_ssse3 = true
HasFileTransfer = true
HasIOProxy = true
HasJICLocalConfig = true
HasJICLocalStdin = true
HasJobDeferral = true
HasJobTransferPlugins = true
HasMPI = true
HasPerFileEncryption = true
HasReconnect = true
HasSelfCheckpointTransfers = true
HasSingularity = true
HasTDP = true
HasTransferInputRemaps = true
HasUserNamespaces = true
HasVM = false
HibernationLevel = 0
HibernationState = "NONE"
HibernationSupportedStates = "S3,S4,S5"
IsLocalStartd = false
IsWakeAble = false
IsWakeOnLanEnabled = false
IsWakeOnLanSupported = false
JobPreemptions = 0
JobRankPreemptions = 0
JobStarts = 0
JobUserPrioPreemptions = 0
KeyboardIdle = 0
LastBenchmark = 0
LastFetchWorkCompleted = 0
LastFetchWorkSpawned = 0
LastHeardFrom = 1615756825
LoadAvg = 0.0
Machine = "gthain.localdomain"
MachineMaxVacateTime = 10 * 60
MachineResources = "Cpus Memory Disk Swap"
MaxJobRetirementTime = 0
Memory = 1957
MonitorSelfAge = 1
MonitorSelfCPUUsage = 1.0
MonitorSelfImageSize = 26716
MonitorSelfRegisteredSocketCount = 0
MonitorSelfResidentSetSize = 12836
MonitorSelfSecuritySessions = 10
MonitorSelfTime = 1615756825
MyAddress = "<10.0.0.3:36347?addrs=10.0.0.3-36347&alias=gthain.localdomain&noUDP&sock=startd_888024_2e07>"
MyCurrentTime = 1615756825
MyType = "Machine"
Name = "<EMAIL>"
NextFetchWorkDelay = -1
NumPids = 0
OpSys = "LINUX"
OpSysAndVer = "Fedora33"
OpSysLegacy = "LINUX"
OpSysLongName = "Fedora release 33 (Thirty Three)"
OpSysMajorVer = 33
OpSysName = "Fedora"
OpSysShortName = "Fedora"
OpSysVer = 3300
Rank = 0.0
RecentDaemonCoreDutyCycle = 0.0
RecentJobPreemptions = 0
RecentJobRankPreemptions = 0
RecentJobStarts = 0
RecentJobUserPrioPreemptions = 0
Requirements = START
RetirementTimeRemaining = 0
SingularityVersion = "singularity version 3.7.1-1.fc33"
SlotID = 8
SlotType = "Static"
SlotTypeID = 0
SlotWeight = Cpus
Start = true
StartdIpAddr = "<10.0.0.3:36347?addrs=10.0.0.3-36347&alias=gthain.localdomain&noUDP&sock=startd_888024_2e07>"
StarterAbilityList = "HasVM,HasMPI,HasFileTransfer,HasJobDeferral,HasSingularity,HasJobTransferPlugins,HasPerFileEncryption,HasReconnect,HasTDP,HasJICLocalStdin,HasTransferInputRemaps,HasSelfCheckpointTransfers,HasJICLocalConfig"
State = "Unclaimed"
SubnetMask = "255.255.255.0"
TargetType = "Job"
TimeToLive = 2147483647
TotalCondorLoadAvg = 0.0
TotalCpus = 8.0
TotalDisk = 129523096
TotalLoadAvg = 0.59
TotalMemory = 15661
TotalSlotCpus = 1
TotalSlotDisk = 16190387.0
TotalSlotMemory = 1957
TotalSlots = 8
TotalVirtualMemory = 28313600
UidDomain = "gthain.localdomain"
Unhibernate = MY.MachineLastMatchTime =!= undefined
UpdateSequenceNumber = 1
UpdatesHistory = "00000000000000000000000000000000"
UpdatesLost = 0
UpdatesSequenced = 0
UpdatesTotal = 1
UtsnameMachine = "x86_64"
UtsnameNodename = "gthain.localdomain"
UtsnameRelease = "5.10.21-200.fc33.x86_64"
UtsnameSysname = "Linux"
UtsnameVersion = "#1 SMP Mon Mar 8 00:24:40 UTC 2021"
VirtualMemory = 3539200
WakeOnLanEnabledFlags = "NONE"
WakeOnLanSupportedFlags = "NONE"
|
src/setupscreen.asm | hackneyc/CastleEscape | 2 | 95604 | extern _cls
extern _coinTables
extern _currentTileMap
extern _scrollReset
extern _setCurrentTileMap
extern currentCoinTable
extern currentEggTable
extern currentHeartTable
extern currentSpiderTable
extern display2BCD
extern display4BCD
extern displayBanner
extern displayEggCount
extern displayItems
extern displayTileMap
extern eggTables
extern heartCount
extern heartTables
extern playerSprite
extern score
extern setCurrentItemTable
extern spiderTables
extern startSprite
extern xyPos
extern xyStartPos
public _setupScreen
include "defs.inc"
section CODE_5
;
; Display the current level and any uncollected items.
;
_setupScreen:
pushall
ld l, INK_WHITE|PAPER_BLACK
call _cls
;
; Set the item tables for this level
;
ld hl, currentCoinTable
ld de, _coinTables
call setCurrentItemTable
ld hl, currentEggTable
ld de, eggTables
call setCurrentItemTable
ld hl, currentHeartTable
ld de, heartTables
call setCurrentItemTable
ld hl, currentSpiderTable
ld de, spiderTables
call setCurrentItemTable
call _setCurrentTileMap
ld hl, (_currentTileMap)
call displayTileMap
call displayBanner
ld a, ID_COIN
ld hl, (currentCoinTable)
call displayItems
ld a, ID_EGG
ld hl, (currentEggTable)
call displayItems
ld a, ID_HEART
ld hl, (currentHeartTable)
call displayItems
call displayEggCount
ld bc, 0x011d ; y,x screen location
ld hl, heartCount ; Point to 10's/1's
call display2BCD
ld bc, 0x0103 ; Y/X screen location
ld hl, score
call display4BCD
call _scrollReset
; Save the location (and direction) where the player entered
; the level. This is used as the starting
; location when they die.
ld hl, (xyPos)
ld (xyStartPos), hl
ld hl, (playerSprite)
ld (startSprite), hl
popall
ret
|
Hoare.agda | iwilare/imp-semantics | 6 | 6096 | open import Data.Nat using ()
open import Data.Bool using (true; false)
open import Data.Product using (_×_; _,_)
open import Data.String using (String; _≟_)
open import Data.Empty using ()
open import Level using (suc; _⊔_)
open import Relation.Nullary using (yes; no)
open import Relation.Nullary.Decidable using (⌊_⌋)
open import Relation.Binary.PropositionalEquality using (_≡_; refl; sym)
open import IMP
open import OperationalSemantics
assn : ∀{l} → Set (suc l)
assn {a} = state → Set a
data ⊢[_]_[_] {l} : assn {l} → com → assn {l} → Set (suc l) where
Skip : ∀{P}
→ ⊢[ P ] SKIP [ P ]
Loc : ∀{Q a x}
→ ⊢[ (λ s → Q (s [ x ::= aval a s ])) ] (x ::= a) [ Q ]
Comp : ∀{P Q R c₁ c₂}
→ ⊢[ P ] c₁ [ Q ]
→ ⊢[ Q ] c₂ [ R ]
→ ⊢[ P ] c₁ :: c₂ [ R ]
If : ∀{P b c₁ Q c₂}
→ ⊢[ (λ s → P s × bval b s ≡ true) ] c₁ [ Q ]
→ ⊢[ (λ s → P s × bval b s ≡ false) ] c₂ [ Q ]
→ ⊢[ P ] (IF b THEN c₁ ELSE c₂) [ Q ]
While : ∀{P b c}
→ ⊢[ (λ s → P s × bval b s ≡ true) ] c [ P ]
→ ⊢[ P ] (WHILE b DO c) [ (λ s → P s × bval b s ≡ false) ]
Conseq : ∀{P Q P′ Q′ : assn} {c}
→ (∀ s → P′ s → P s)
→ ⊢[ P ] c [ Q ]
→ (∀ s → Q s → Q′ s)
→ ⊢[ P′ ] c [ Q′ ]
⊨[_]_[_] : assn → com → assn → Set
⊨[ P ] c [ Q ] = ∀{s t} → P s → ⦅ c , s ⦆⇒ t → Q t
|
code/Forec/t5.asm | KongoHuster/assembly-exercise | 1 | 9167 | ;; last edit date: 2016/10/24
;; author: Forec
;; LICENSE
;; Copyright (c) 2015-2017, Forec <<EMAIL>>
;; Permission to use, copy, modify, and/or distribute this code 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.
title forec_t5
.model small
.data
lname db 30 dup(?)
address db 30 dup(?)
city db 15 dup(?)
code_list db 1, 7, 8, 3, 2
code_length equ $ - code_list ;; (3)
.stack 100h
.code
start:
mov ax, @data
mov ds, ax
mov ax, offset lname ;; (1)
mov si, word ptr code_list ;; (2)
mov bx, code_length
mov ah, 4ch
int 21h
end start |
projects/batfish/src/main/antlr4/org/batfish/vendor/a10/grammar/A10Lexer.g4 | Ashlippers/batfish | 0 | 2279 | lexer grammar A10Lexer;
options {
superClass = 'A10BaseLexer';
}
tokens {
QUOTED_TEXT,
RBA_LINE,
RBA_TAIL,
WORD,
WORD_SEPARATOR
}
// A10 keywords
ACTIVE: 'active';
ADDRESS: 'address';
DISABLE: 'disable';
DESCRIPTION: 'description' -> pushMode(M_Word);
DO_AUTO_RECOVERY: 'do-auto-recovery';
ENABLE: 'enable';
ETHERNET: 'ethernet';
HOSTNAME: 'hostname' -> pushMode(M_Word);
IP: 'ip';
INTERFACE: 'interface';
LACP: 'lacp';
LACP_TRUNK: 'lacp-trunk';
LACP_UDLD: 'lacp-udld';
LONG: 'long';
LOOPBACK: 'loopback';
MODE: 'mode';
MTU: 'mtu';
NAME: 'name' -> pushMode(M_Word);
NO: 'no';
PASSIVE: 'passive';
PORTS_THRESHOLD: 'ports-threshold';
RBA: 'rba' -> pushMode(M_Rba);
ROLE: 'role';
ROUTE: 'route';
ROUTER_INTERFACE: 'router-interface';
STATIC: 'static';
SHORT: 'short';
TAGGED: 'tagged';
TIMEOUT: 'timeout';
TIMER: 'timer';
TO: 'to';
TRUNK: 'trunk';
TRUNK_GROUP: 'trunk-group';
UNTAGGED: 'untagged';
USER_TAG: 'user-tag' -> pushMode(M_Word);
VE: 've';
VLAN: 'vlan';
// Complex tokens
COMMENT_LINE
:
F_Whitespace* '!'
{lastTokenType() == NEWLINE || lastTokenType() == -1}?
F_NonNewlineChar* (F_Newline | EOF) -> skip
;
DOUBLE_QUOTE
:
'"' -> pushMode ( M_DoubleQuote )
;
SINGLE_QUOTE
:
['] -> pushMode ( M_SingleQuote )
;
SUBNET_MASK: F_SubnetMask;
IP_ADDRESS: F_IpAddress;
IP_SLASH_PREFIX: F_IpSlashPrefix;
NEWLINE: F_Newline;
UINT8: F_Uint8;
UINT16: F_Uint16;
UINT32: F_Uint32;
WS: F_Whitespace+ -> skip;
// Fragments
fragment
F_DecByte
:
F_Digit
| F_PositiveDigit F_Digit
| '1' F_Digit F_Digit
| '2' [0-4] F_Digit
| '25' [0-5]
;
fragment
F_Digit: [0-9];
fragment
F_IpAddress: F_DecByte '.' F_DecByte '.' F_DecByte '.' F_DecByte;
fragment
F_IpSlashPrefix: '/' F_IpPrefixLength;
fragment
F_IpPrefixLength
:
F_Digit
| [12] F_Digit
| [3] [012]
;
// Any number of newlines, allowing whitespace in between
fragment
F_Newline
:
F_NewlineChar (F_Whitespace* F_NewlineChar+)*
;
// A single newline character [sequence - allowing \r, \r\n, or \n]
fragment
F_NewlineChar
:
'\r' '\n'?
| '\n'
;
fragment
F_NonNewlineChar
:
~[\r\n] // carriage return or line feed
;
fragment
F_PositiveDigit: [1-9];
fragment
F_SubnetMask
:
F_SubnetMaskOctet '.0.0.0'
| '255.' F_SubnetMaskOctet '.0.0'
| '255.255.' F_SubnetMaskOctet '.0'
| '255.255.255.' F_SubnetMaskOctet
;
fragment
F_SubnetMaskOctet
:
'0'
| '128'
| '192'
| '224'
| '240'
| '248'
| '252'
| '254'
| '255'
;
fragment
F_Uint8
:
F_Digit
| F_PositiveDigit F_Digit
| '1' F_Digit F_Digit
| '2' [0-4] F_Digit
| '25' [0-5]
;
fragment
F_Uint16
:
F_Digit
| F_PositiveDigit F_Digit F_Digit? F_Digit?
| [1-5] F_Digit F_Digit F_Digit F_Digit
| '6' [0-4] F_Digit F_Digit F_Digit
| '65' [0-4] F_Digit F_Digit
| '655' [0-2] F_Digit
| '6553' [0-5]
;
fragment
F_Uint32
:
// 0-4294967295
F_Digit
| F_PositiveDigit F_Digit F_Digit? F_Digit? F_Digit? F_Digit? F_Digit?
F_Digit? F_Digit?
| [1-3] F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit
F_Digit
| '4' [0-1] F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit
| '42' [0-8] F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit
| '429' [0-3] F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit
| '4294' [0-8] F_Digit F_Digit F_Digit F_Digit F_Digit
| '42949' [0-5] F_Digit F_Digit F_Digit F_Digit
| '429496' [0-6] F_Digit F_Digit F_Digit
| '4294967' [0-1] F_Digit F_Digit
| '42949672' [0-8] F_Digit
| '429496729' [0-5]
;
fragment
F_Whitespace
:
[ \t\u000C] // tab or space or unicode 0x000C
;
fragment
F_NonWhitespace
:
~[ \t\u000C\u00A0\n\r]
;
fragment
F_Word: F_WordChar+;
fragment
F_WordChar
:
[0-9A-Za-z!@#$%^&*()_=+.;:{}/]
| '-'
;
fragment
F_StrChar: ~( [ \t\u000C\u00A0\n\r(),!$'"*#] | '[' | ']' );
fragment
F_Str: F_StrChar+;
fragment
F_EscapedDoubleQuote: '\\"';
fragment
F_EscapedSingleQuote: '\\' ['];
// Modes
mode M_DoubleQuote;
M_DoubleQuote_DOUBLE_QUOTE: '"' -> type(DOUBLE_QUOTE), popMode;
M_DoubleQuote_QUOTED_TEXT: (F_EscapedDoubleQuote | ~'"')+ -> type(QUOTED_TEXT);
mode M_SingleQuote;
M_SingleQuote_SINGLE_QUOTE: ['] -> type(SINGLE_QUOTE), popMode;
M_SingleQuote_QUOTED_TEXT: (F_EscapedSingleQuote | ~['])+ -> type(QUOTED_TEXT);
mode M_Word;
M_Word_WS: F_Whitespace+ -> type(WORD_SEPARATOR), mode(M_WordValue);
M_Word_NEWLINE: F_Newline -> type(NEWLINE), popMode;
mode M_WordValue;
M_WordValue_DOUBLE_QUOTE: '"' -> type(DOUBLE_QUOTE), pushMode(M_DoubleQuote);
M_WordValue_SINGLE_QUOTE: ['] -> type(SINGLE_QUOTE), pushMode(M_SingleQuote);
M_WordValue_WORD: F_Word -> type(WORD);
M_WordValue_WS: F_Whitespace+ -> skip, popMode;
M_WordValue_NEWLINE: F_Newline -> type(NEWLINE), popMode;
mode M_Rba;
M_Rba_WS: F_Whitespace+ -> skip;
M_Rba_ROLE: ROLE -> type(ROLE), mode(M_RbaRoleName);
M_Rba_NEWLINE: F_Newline -> type(NEWLINE), mode(M_RbaLine);
mode M_RbaRoleName;
M_RbaRoleName_WS: F_Whitespace+ -> type(WORD_SEPARATOR), mode(M_RbaRoleNameValue);
M_RbaRoleName_NEWLINE: F_Newline -> type(NEWLINE), popMode;
mode M_RbaRoleNameValue;
M_RbaRoleNameValue_DOUBLE_QUOTE: '"' -> type(DOUBLE_QUOTE), pushMode(M_DoubleQuote);
M_RbaRoleNameValue_SINGLE_QUOTE: ['] -> type(SINGLE_QUOTE), pushMode(M_SingleQuote);
M_RbaRoleNameValue_WORD: F_Word -> type(WORD);
M_RbaRoleNameValue_WS: F_Whitespace+ -> skip, mode(M_RbaTail);
M_RbaRoleNameValue_NEWLINE: F_Newline -> type(NEWLINE), mode(M_RbaLine);
mode M_RbaTail;
M_RbaTail_RBA_TAIL: F_NonNewlineChar+ -> type(RBA_TAIL);
M_RbaTail_NEWLINE: F_Newline -> type(NEWLINE), mode(M_RbaLine);
mode M_RbaLine;
M_RbaLine_WS: F_Whitespace+ -> skip;
M_RbaLine_RBA_LINE: F_Word F_Whitespace+ ('no-access'|'read'|'partition-only'|'oper'|'write') -> type(RBA_LINE);
M_RbaLine_NEWLINE: F_Newline -> type(NEWLINE);
M_RbaLine_COMMENT_LINE: F_Whitespace* '!' {lastTokenType() == NEWLINE}? F_NonNewlineChar* (F_Newline | EOF) -> skip;
M_RbaLine_END: F_NonWhitespace+ {less();} -> popMode;
|
libsrc/_DEVELOPMENT/math/float/math16/c/sdcc/cm16_sdcc_ceil.asm | Frodevan/z88dk | 640 | 88701 | <filename>libsrc/_DEVELOPMENT/math/float/math16/c/sdcc/cm16_sdcc_ceil.asm
SECTION code_fp_math16
PUBLIC cm16_sdcc_ceil
EXTERN cm16_sdcc_read1
EXTERN asm_f16_ceil
.cm16_sdcc_ceil
call cm16_sdcc_read1
jp asm_f16_ceil
|
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-traceb.adb | orb-zhuchen/Orb | 0 | 17457 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . T R A C E B A C K --
-- --
-- B o d y --
-- --
-- Copyright (C) 1999-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/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This is the default version of this package
-- Note: this unit must be compiled using -fno-optimize-sibling-calls.
-- See comment below in body of Call_Chain for details on the reason.
pragma Compiler_Unit_Warning;
package body System.Traceback is
procedure Call_Chain
(Traceback : System.Address;
Max_Len : Natural;
Len : out Natural;
Exclude_Min : System.Address := System.Null_Address;
Exclude_Max : System.Address := System.Null_Address;
Skip_Frames : Natural := 1);
-- Same as the exported version, but takes Traceback as an Address
------------------
-- C_Call_Chain --
------------------
function C_Call_Chain
(Traceback : System.Address;
Max_Len : Natural) return Natural
is
Val : Natural;
begin
Call_Chain (Traceback, Max_Len, Val);
return Val;
end C_Call_Chain;
----------------
-- Call_Chain --
----------------
function Backtrace
(Traceback : System.Address;
Len : Integer;
Exclude_Min : System.Address;
Exclude_Max : System.Address;
Skip_Frames : Integer)
return Integer;
pragma Import (C, Backtrace, "__gnat_backtrace");
procedure Call_Chain
(Traceback : System.Address;
Max_Len : Natural;
Len : out Natural;
Exclude_Min : System.Address := System.Null_Address;
Exclude_Max : System.Address := System.Null_Address;
Skip_Frames : Natural := 1)
is
begin
-- Note: Backtrace relies on the following call actually creating a
-- stack frame. To ensure that this is the case, it is essential to
-- compile this unit without sibling call optimization.
-- We want the underlying engine to skip its own frame plus the
-- ones we have been requested to skip ourselves.
Len := Backtrace (Traceback => Traceback,
Len => Max_Len,
Exclude_Min => Exclude_Min,
Exclude_Max => Exclude_Max,
Skip_Frames => Skip_Frames + 1);
end Call_Chain;
procedure Call_Chain
(Traceback : in out System.Traceback_Entries.Tracebacks_Array;
Max_Len : Natural;
Len : out Natural;
Exclude_Min : System.Address := System.Null_Address;
Exclude_Max : System.Address := System.Null_Address;
Skip_Frames : Natural := 1)
is
begin
Call_Chain
(Traceback'Address, Max_Len, Len,
Exclude_Min, Exclude_Max,
-- Skip one extra frame to skip the other Call_Chain entry as well
Skip_Frames => Skip_Frames + 1);
end Call_Chain;
end System.Traceback;
|
boot/32b.asm | DriesCode/bootloaders | 6 | 164641 | <gh_stars>1-10
load_kernel: ; Routine to load 32 bit mode kernel
mov bx, 0x7fff
mov ah, 02h
mov al, 0x1
mov ch, 0x0
mov cl, 0x4
mov dh, 0x0
mov dl, [0x7C24]
int 13h
jc dsk_error
cmp al, 0x1
jne dsk_error
xor ax, ax ; Reset driver
int 13h
cli ; Clear BIOS interrupts
lgdt [gdt_descriptor] ; Load GDT
; Turn up first bit of CR0 register
mov eax, cr0
or eax, 0x1
mov cr0, eax
;; ===============================
;;
;; JUMP TO 32-BIT PROTECTED MODE
;;
;; ===============================
jmp CODE_SEG:init_protected_mode
BITS 32
init_protected_mode:
mov edx, 0xb8000
mov al, 'X'
mov ah, 0x0f
mov [edx], ax
jmp bx
hlt ; if error -> halt
; GDT ( 2 segments : 1 code / 1 data )
; Intel's flat model
gdt_start: ; Start of GDT
gdt_null:
times 2 dd 0x0 ; Null reference
gdt_code: ; Code segment setup
; Base: 0x0 / Limit: 0xfffff
dw 0xffff ; Limit (bits 0-15)
dw 0x0 ; Base (bits 0-15) 2 bytes 16 bits
db 0x0 ; Base (bits 16-23) 1 byte 8 bits
; First flags: Present = 1 ; Privilege = 00 ; Descriptor type = 1 ----> 1001b
; Type flags: Code = 1 ; Conforming = 0 ; Readable = 1 ; Accesed = 0 ----> 1010b
db 10011010b ; First flags + Type flags
; Second flags: Granularity = 1 ; 32b default = 1 ; 64b segment = 0 ; AVL = 0 ----> 1100b
db 11001111b ; Second flags + Limit (16 - 19)
db 0x0 ; Base (bits 24 - 31)
gdt_data: ; Data segment setup
; Same as code segment except for the type flags
; Type flags: Code = 0 ; Expand down = 0 ; Writable = 1 ; Accessed = 0 ----> 0010b
dw 0xffff ; Limit (bits 0 - 15)
dw 0x0 ; Base (bits 0 - 15)
db 0x0 ; Base (bits 16 - 23)
db 10010010b ; First flags (same as code) + Type flags (new)
db 11001111b ; Second flags (same as code) + Limit (16 - 23bits) (same as code)
db 0x0 ; Base (bits 24 - 31)
gdt_end: ; End of GDT
gdt_descriptor: ; GDT descriptor
dw gdt_end - gdt_start - 1 ; Size of GDT (always 1 less than true size)
dd gdt_start ; Start address of GDT
CODE_SEG equ gdt_code - gdt_start ; 0x8
DATA_SEG equ gdt_data - gdt_start ; 0x10
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.