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
src/Human/Humanity.agda
MaisaMilena/JuiceMaker
6
14789
module Human.Humanity where -- Use agda-prelude instead of agda-stdlib? open import Human.JS public open import Human.Unit public open import Human.Nat public open import Human.List public open import Human.Bool public open import Human.String public open import Human.IO public open import Human.Float public open import Human.Int public Lazy : ∀ (A : Set) → Set Lazy A = Unit → A then:_ : ∀ {A : Set} → A → Lazy A then: a = λ x → a else:_ : ∀ {A : Set} → A → Lazy A else: a = λ x → a if : ∀ {A : Set} → Bool → Lazy A → Lazy A → A if true t f = t unit if false t f = f unit init-to : ∀ {A : Set} → Nat → A → (Nat → A → A) → A init-to zero x fn = x init-to (suc i) x fn = init-to i (fn zero x) (λ i → fn (suc i)) {-# COMPILE JS init-to = A => n => x => fn => { for (var i = 0, l = n.toJSValue(); i < l; ++i) x = fn(agdaRTS.primIntegerFromString(String(i)))(x); return x; } #-} syntax init-to m x (λ i → b) = init x for i to m do: b init-from-to : ∀ {A : Set} → Nat → A → Nat → (Nat → A → A) → A init-from-to n x m f = init-to (m - n) x (λ i x → f (n + i) x) syntax init-from-to n x m (λ i → b) = init x for i from n to m do: b for-to : Nat → (Nat → IO Unit) → IO Unit for-to zero act = return unit for-to (suc n) act = act zero >> for-to n (λ i → act (suc i)) syntax for-from-to n m (λ i → b) = for i from n to m do: b for-from-to : Nat → Nat → (Nat → IO Unit) → IO Unit for-from-to n m f = for-to (m - n) (λ i → f (n + i)) syntax for-to m (λ i → b) = for i to m do: b _++_ : String → String → String _++_ = primStringAppend show : Nat → String show zero = "Z" show (suc n) = "S" ++ show n Program : Set Program = Lazy (IO Unit) _f+_ : Float → Float → Float _f+_ = primFloatPlus
src/bitmap-file_io.adb
ellamosi/Ada_BMP_Library
0
22765
------------------------------------------------------------------------------ -- -- -- Copyright (C) 2017, 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 Interfaces; use Interfaces; with Bitmap.Memory_Mapped; use Bitmap.Memory_Mapped; with System; package body Bitmap.File_IO is type Header (As_Array : Boolean := True) is record case As_Array is when True => Arr : UInt8_Array (1 .. 14); when False => Signature : Integer_16; Size : Integer_32; -- File size Reserved1 : Integer_16; Reserved2 : Integer_16; Offset : Integer_32; -- Data offset end case; end record with Unchecked_Union, Pack, Size => 14 * 8; type Info (As_Array : Boolean := True) is record case As_Array is when True => Arr : UInt8_Array (1 .. 40); when False => Struct_Size : Integer_32; Width : Integer_32; -- Image width in pixels Height : Integer_32; -- Image hieght in pixels Planes : Integer_16; Pixel_Size : Integer_16; -- Bits per pixel Compression : Integer_32; -- Zero means no compression Image_Size : Integer_32; -- Size of the image data in UInt8s PPMX : Integer_32; -- Pixels per meter in x led PPMY : Integer_32; -- Pixels per meter in y led Palette_Size : Integer_32; -- Number of colors Important : Integer_32; end case; end record with Unchecked_Union, Pack, Size => 40 * 8; ------------------- -- Read_BMP_File -- ------------------- function Read_BMP_File (File : File_Type) return not null Any_Bitmap_Buffer is function Allocate_Pixel_Data return System.Address; procedure Read_Pixel_Data; Input_Stream : Ada.Streams.Stream_IO.Stream_Access; Hdr : Header; Inf : Info; Width : Integer; Height : Integer; BM : constant Any_Memory_Mapped_Bitmap_Buffer := new Memory_Mapped_Bitmap_Buffer; RGB_Pix : Bitmap_Color; Pix_In : UInt8_Array (1 .. 3); ------------------------- -- Allocate_Pixel_Data -- ------------------------- function Allocate_Pixel_Data return System.Address is type Pixel_Data is new Bitmap.UInt16_Array (1 .. Width * Height) with Pack; type Pixel_Data_Access is access Pixel_Data; Data : constant Pixel_Data_Access := new Pixel_Data; begin return Data.all'Address; end Allocate_Pixel_Data; --------------------- -- Read_Pixel_Data -- --------------------- procedure Read_Pixel_Data is Row_Size : constant Integer_32 := Integer_32 (Width * 24); Row_Padding : constant Integer_32 := (32 - (Row_Size mod 32)) mod 32 / 8; Padding : UInt8_Array (1 .. Integer (Row_Padding)); begin for Y in reverse 0 .. Height - 1 loop for X in 0 .. Width - 1 loop UInt8_Array'Read (Input_Stream, Pix_In); RGB_Pix.Blue := Pix_In (1); RGB_Pix.Green := Pix_In (2); RGB_Pix.Red := Pix_In (3); BM.Set_Pixel ((X, Y), RGB_Pix); end loop; UInt8_Array'Read (Input_Stream, Padding); end loop; end Read_Pixel_Data; begin Input_Stream := Ada.Streams.Stream_IO.Stream (File); UInt8_Array'Read (Input_Stream, Hdr.Arr); UInt8_Array'Read (Input_Stream, Inf.Arr); Width := Integer (Inf.Width); Height := Integer (Inf.Height); BM.Actual_Width := Width; BM.Actual_Height := Height; BM.Actual_Color_Mode := RGB_565; BM.Currently_Swapped := False; BM.Addr := Allocate_Pixel_Data; Set_Index (File, Positive_Count (Hdr.Offset + 1)); Read_Pixel_Data; return Any_Bitmap_Buffer (BM); end Read_BMP_File; -------------------- -- Write_BMP_File -- -------------------- procedure Write_BMP_File (File : File_Type; Bitmap : Bitmap_Buffer'Class) is Hdr : Header; Inf : Info; Row_Size : constant Integer_32 := Integer_32 (Bitmap.Width * 24); Row_Padding : constant Integer_32 := (32 - (Row_Size mod 32)) mod 32 / 8; Data_Size : constant Integer_32 := (Row_Size + Row_Padding) * Integer_32 (Bitmap.Height); RGB_Pix : Bitmap_Color; Pix_Out : UInt8_Array (1 .. 3); Padding : constant UInt8_Array (1 .. Integer (Row_Padding)) := (others => 0); Output_Stream : Ada.Streams.Stream_IO.Stream_Access; begin Hdr.Signature := 16#4D42#; Hdr.Size := (Data_Size + 54) / 4; Hdr.Reserved1 := 0; Hdr.Reserved2 := 0; Hdr.Offset := 54; Inf.Struct_Size := 40; Inf.Width := Integer_32 (Bitmap.Width); Inf.Height := Integer_32 (Bitmap.Height); Inf.Planes := 1; Inf.Pixel_Size := 24; Inf.Compression := 0; Inf.Image_Size := Data_Size / 4; Inf.PPMX := 2835; Inf.PPMY := 2835; Inf.Palette_Size := 0; Inf.Important := 0; Output_Stream := Ada.Streams.Stream_IO.Stream (File); UInt8_Array'Write (Output_Stream, Hdr.Arr); UInt8_Array'Write (Output_Stream, Inf.Arr); for Y in reverse 0 .. Bitmap.Height - 1 loop for X in 0 .. Bitmap.Width - 1 loop RGB_Pix := Bitmap.Pixel ((X, Y)); Pix_Out (1) := RGB_Pix.Blue; Pix_Out (2) := RGB_Pix.Green; Pix_Out (3) := RGB_Pix.Red; UInt8_Array'Write (Output_Stream, Pix_Out); end loop; UInt8_Array'Write (Output_Stream, Padding); end loop; end Write_BMP_File; end Bitmap.File_IO;
Maths/asm_add.asm
TinfoilAsteroid/EliteNext
9
98490
<filename>Maths/asm_add.asm ;; calcs HLB + DEC where B and C are signs ;; result HL with A as sign ;; special handling if result is zero forcign sign bit to be zero AHLEquBHLaddCDE: ld a,b xor c and SignOnly8Bit JumpIfNegative .OppositeSigns .SameSigns: ld ixh,b ; ixh = b ClearSignBit b ; b = ABS b add hl,de ; hl = hl + de ld a,b ; a = b + c + carry adc c ; ld b,a ; ld a,ixh ; SignBitOnlyA ; or b ; ret ; .OppositeSigns: ld ixh,b ld ixl,c ClearSignBit c ; c = ABS C ld a,b ClearSignBitA sbc c JumpIfNegative .OppositeCDEgtBHL sbc hl,de JumpIfNegative .OppositeCDEgtBHL ld b,a ld a,ixh SignBitOnlyA ; or b ; ret ; .OppositeCDEgtBHL: ex de,hl ld a,b ld b,c ld c,a jp .OppositeSigns ADDHLDESignBC: ld a,b and SignOnly8Bit xor c ;if b sign and c sign were different then bit 7 of a will be 1 which means JumpIfNegative ADDHLDEsBCOppSGN ;Signs are opposite there fore we can subtract to get difference ADDHLDEsBCSameSigns: ld a,b or c JumpIfNegative ADDHLDEsBCSameNeg ; optimisation so we can just do simple add if both positive add hl,de ; both positive so a will already be zero ret ADDHLDEsBCSameNeg: add hl,de ld a,b or c ; now set bit for negative value, we won't bother with overflow for now TODO ret ADDHLDEsBCOppSGN: ClearCarryFlag sbc hl,de jr c,ADDHLDEsBCOppInvert ADDHLDEsBCOppSGNNoCarry: ld a,b ; we got here so hl > de therefore we can just take hl's previous sign bit ret ADDHLDEsBCOppInvert: NegHL ; if result was zero then set sign to zero (which doing h or l will give us for free) ld a,b xor SignOnly8Bit ; flip sign bit ret addhldesigned: bit 7,h jr nz,.noneghl call negate16hl .noneghl: bit 7,d jr nz,.nonegde call negate16de .nonegde: add hl,de ; do 2'd c add xor a ; assume positive bit 7,h ret z ; if not set then can exit early call negate16hl ld a,$FF ret ; HL(2sc) = HL (signed) + A (unsigned), uses HL, DE, A HL2cEquHLSgnPlusAusgn: ld d,0 ld e,a ; set up DE = A ld a,h and SignMask8Bit jr z,.HLPositive ; if HL is negative then do HL - A .HLNegative: ld h,a ; hl = ABS (HL) NegHL ; hl = - hl .HLPositive: ClearCarryFlag ; now do adc hl,de adc hl,de ; aftert his hl will be 2's c ret HLEquHLSgnPlusAusgn: ld e,a ld a,h and SignMask8Bit jr nz,.HLNegative ; if HL is negative then do HL - A .HLPositive: ld a,e ; else its HL + A add hl,a ret .HLNegative: ClearSignBit h ; Clear sign of HL NegHL ; and convert to 2's C ld d,0 ClearCarryFlag sbc hl,de ; now add a to -ve HL , add does not do 2's c jp m,.FlipResult ; if it was negative then its really positive SetSignBit h ret .FlipResult: NegHL ; so if -hl + A => HL - A => HL - DE is negative then the actual result is +ve ret ; HL = HL (signed) + A (unsigned), uses HL, DE, A AddAusngToHLsng: ld d,a ld e,h ld a,h and SignMask8Bit ld h,a ld a,d add hl,a ld a,e and SignOnly8Bit or h ret ; HL = A (unsigned) - HL (signed), uses HL, DE, BC, A HLEequAusngMinusHLsng: ld b,h ld c,a ld a,b and SignOnly8Bit jr nz,.DoAdd .DoSubtract: ex de,hl ; move hl into de ld h,0 ; hl = a ld l,c ClearCarryFlag sbc hl,de ; hl = a - hl ret .DoAdd: ld a,c add hl,a ret ;tested mathstestsun2 ; DEL = DEL + BCH signed, uses BC, DE, HL, IY, A AddBCHtoDELsigned: ld a,b ; Are the values both the same sign? xor d ; . and SignOnly8Bit ; . jr nz,.SignDifferent ; . .SignSame: ld a,b ; if they are then we only need 1 signe and SignOnly8Bit ; so store it in iyh ld iyh,a ; ld a,b ; bch = abs bch and SignMask8Bit ; . ld b,a ; . ld a,d ; del = abs del and SignMask8Bit ; . ld d,a ; . ld a,h ; l = h + l add l ; . ld l,a ; . ld a,c ; e = e + c + carry adc e ; . ld e,a ; . ld a,b ; d = b + d + carry (signed) adc d ; or iyh ; d = or back in sign bit ld d,a ; ret ; done .SignDifferent: ld a,b ; bch = abs bch ld iyh,a ; iyh = b sign and SignMask8Bit ; . ld b,a ; . ld a,d ; del = abs del ld iyl,a ; iyl = d sign and SignMask8Bit ; . ld d,a ; . push hl ; save hl ld hl,bc ; hl = bc - de, if bc < de then there is a carry sbc hl,de ; pop hl ; jr c,.BCHltDEL jr nz,.DELltBCH ; if the result was not zero then DEL > BCH .BCeqDE: ld a,h ; if the result was zero then check lowest bits JumpIfALTNusng l,.BCHltDEL jr nz,.DELltBCH ; The same so its just zero .BCHeqDEL: xor a ; its just zero ld d,a ; . ld e,a ; . ld l,a ; . ret ; . ;BCH is less than DEL so its DEL - BCH the sort out sign .BCHltDEL: ld a,l ; l = l - h ; ex sub h ; . ; 01D70F DEL ld l,a ; . ; -000028 BCH ld a,e ; e = e - c - carry ;1. sbc c ; . ; ld e,a ; . ; ld a,d ; d = d - b - carry ; sbc b ; . ; ld d,a ; . ; ld a,iyl ; as d was larger, take d sign and SignOnly8Bit ; or d ; ld d,a ; ret .DELltBCH: ld a,h ; l = h - l sub l ; ld l,a ; ld a,c ; e = c - e - carry sbc e ; ld e,a ; ld a,b ; d = b - d - carry sbc d ; ld d,a ; ld a,iyh ; as b was larger, take b sign into d and SignOnly8Bit ; or d ; ld d,a ; ret ;BHL = AHL + DE where AHL = 16 bit + A sign and DE = 15 bit signed AddAHLtoDEsigned: ld b,a ; B = A , C = D (save sign bytes) ld c,d ; . xor c ; A = A xor C res 7,d ; clear sign bit of D jr nz, .OppositeSigns ; if A xor C is opposite signs job to A0A1 add hl,de ; HL = HL + DE ret ; return .OppositeSigns: sbc hl,de ; HL = HL -DE ret nc ; if no carry return add hl,de ; else HL = HL + DE ex de,hl ; swap HL and DE and a ; reset carry sbc hl,de ; HL = DE - HL (as they were swapped) ld b,c ; B = sign of C ret ; ret ; a = value to add ; b = offset (equivalent to regX) ; returns INWK [x] set to new value addINWKbasigned: ld hl,UBnKxlo ; hl = INWK 0 ld c,a ; preserve a ld a,b add hl,a ; hl = INWK[x] ld a,c ; get back a value and $80 ; get sign bit from a ld b,a ; now b = sign bit of a ld a,c ; a = original value and SignMask8Bit ; a = unsigned version of original value ; hl = unsigned version of INWK0[b] ; a = value to add, also in c which will optimise later code ; b = sign bit of a ( in old code was varT) addhlcsigned: ld e,(hl) ; de = INKK value inc hl ld d,(hl) inc hl ; now pointing a sign ld a,(hl) ; a = sign bit ex de,hl ; hl = value now and de = pointer to sign xor b ; a = resultant sign bit 7,a ; is it negative? jr z,.postivecalc .negativecalc: ld a,h and SignMask8Bit ld h,a ; strip high bit ld ixl,b ; save sign bit from b into d ld b,0 ; c = value to subtract so now bc = value to subtract sbc hl,bc ld b,ixl ; get sign back ex de,hl ; de = value hl = pointer to sign ld a,(hl) ; and SignMask8Bit sbc a,0 ; subtract carry which could flip sign bit or $80 ; set bit 0 xor b ; flip bit on sign (var T) ld (hl),a dec hl ld (hl),d dec hl ld (hl),e ; write out DE to INKW[x]0,1 ex de,hl ; hl = value de = pointer to start if INKW[x] ret c ; if carry was set then we can exit now .nocarry: NegHL ; get hl back to positive, a is still inkw+2 or b ; b is still varT ex de,hl ; de = value hl = pointer to start if INKW[x] ld (hl),e inc hl ld (hl),d inc hl ld (hl),a ; set sign bit in INKK[x]+2 ex de,hl ; hl = value de = pointer to sign ret .postivecalc: ld ixl,b ld b,0 add hl,de ex de,hl or ixl ; we don;t need to recover b here ld (hl),a ; push sign into INWK[x] dec hl ld (hl),d dec hl ld (hl),e ret ;a = a AND 80 (i.e. bit 7) =>carry so value is - ;MVT1 ; S = bits 6 to 0 of A ; A = sign bit => T ; xor sign bit with ink[x] Sign ; if negative thn its not an add ; ; and h, 7F ; b = 0 ; c = varS ; subtract INW[X]hilo, bc ; retain carry ; get INKW[x]Sign ; and 7F ; subtract carry (so will go negtive if negative) ; xor bit 7 of h with T to flip bit ; write to INKW[x]Sign ; ; else ;MV10. ; add INWK[x]hi,lo, varS ; or sign bit
examples/test6.asm
takenobu-hs/processor-creative-kit
5
88820
<filename>examples/test6.asm /* * example6: instruction examples */ /* no-operation instruction */ nop # no-operation /* move instructions */ mov r1, 0x403 # r1 = 0x403 mov r2, 0x101 mov r3, 0 mov r4, 2 mov r5, 27 mov r0, r1 # r0 = r1 mov r0, pc # r0 = pc /* arithmetic operation instructions */ add r0, r1, r2 # r0 = r1 + r2 sub r0, r1, r2 # r0 = r1 - r2 cmp r0, r1 # flag = compare(r0, r1) abs r0, r1 # r0 = abs(r1) ash r0, r2, r4 # r0 = r2 << r4 // arithmetic mul r0, r1, r4 # r0 = r1 * r4 div r0, r1, r4 # r0 = r1 / r4 /* logical operation instructions */ and r0, r1, r2 # r0 = r1 & r2 or r0, r1, r2 # r0 = r1 | r2 not r0, r1 # r0 = ~r1 xor r0, r1, r2 # r0 = r1 ^ r2 lsh r0, r2, r4 # r0 = r2 << r4 // logical /* memory access instructions */ st m(r3), r1 # *r3 = r1 ld r0, m(r3) # r0 = *r3 /* control flow instructions */ b eq, 1 # if (flag == eq) goto pc+1 jmp 1 # goto pc+1 jmp r5 # goto r5 call r1 # goto r1; r0 = pc ret # goto r0 /* machine halt instruction */ halt # halt cpu
ecdsa128/src/aRC4_src/RC4_TestSuite/src/RC4_test.asm
FloydZ/Crypto-Hash
11
92265
.686p .mmx .model flat,stdcall option casemap:none include g:\masm32\include\windows.inc include g:\masm32\include\user32.inc include g:\masm32\include\kernel32.inc include g:\masm32\include\oleaut32.inc include g:\masm32\include\comctl32.inc include g:\masm32\include\advapi32.inc includelib g:\masm32\lib\user32.lib includelib g:\masm32\lib\kernel32.lib includelib g:\masm32\lib\oleaut32.lib includelib g:\masm32\lib\comctl32.lib includelib g:\masm32\lib\advapi32.lib include ..\lib\rc4.inc include ..\lib\utils.inc printSeparator PROTO printSet PROTO :DWORD, :DWORD, :DWORD, :DWORD printLine PROTO :DWORD printBytes PROTO :DWORD, :DWORD .data szK1 db 05ah,0a5h,012h,034h,056h,099h,088h,077h szK2 db 0c0h,0c1h,0c2h,0c3h,0c4h,0c5h,0c6h,0c7h db 0c8h,0c9h,0cah,0cbh,0cch,0cdh,0ceh,0cfh szK3 db 05bh,07bh,0a0h,0d7h,09ah,0eeh,0c2h,02eh db 00dh,0d1h,0a9h,014h,0bdh,0b8h,042h,030h szK4 db 001h,023h,045h,067h,089h,0abh,0cdh,0efh szK5 db 001h,023h,045h,067h,089h,0abh,0cdh,0efh szK6 db 000h,000h,000h,000h,000h,000h,000h,000h szK7 db 0efh,001h,023h,045h szK8 db 001h,023h,045h,067h,089h,0abh,0cdh,0efh szK9 db 061h,08ah,063h,0d2h,0fbh szK10 db 029h,004h,019h,072h,0fbh,042h,0bah,05fh db 0c7h,012h,077h,012h,0f1h,038h,029h,0c9h szP1 db 008h,001h,002h,001h,000h,006h,025h,0a7h db 0c4h,036h,000h,002h,02dh,049h,097h,0b4h db 000h,006h,025h,0a7h,0c4h,036h,0e0h,000h db 0aah,0aah,003h,000h,000h,000h,088h,08eh db 001h,001h,000h,000h,000h,000h,000h,000h db 000h szP2 db 008h,003h,012h,034h,0ffh,0ffh,0ffh,0ffh db 0ffh,0ffh,000h,040h,096h,045h,007h,0f1h db 008h,000h,046h,017h,062h,03eh,050h,067h db 0aah,0aah,003h,000h,000h,000h,008h,000h db 045h,000h,000h,04eh,066h,01ah,000h,000h db 080h,011h,0beh,064h,00ah,000h,001h,022h db 00ah,0ffh,0ffh,0ffh,000h,089h,000h,089h db 000h,03ah,000h,000h,080h,0a6h,001h,010h db 000h,001h,000h,000h,000h,000h,000h,000h db 020h,045h,043h,045h,04ah,045h,048h,045h db 043h,046h,043h,045h,050h,046h,045h,045h db 049h,045h,046h,046h,043h,043h,041h,043h db 041h,043h,041h,043h,041h,043h,041h,041h db 041h,000h,000h,020h,000h,001h szP3 db 0aah,0aah,003h,000h,000h,000h,008h,000h db 045h,000h,000h,04eh,066h,01ah,000h,000h db 080h,011h,0beh,064h,00ah,000h,001h,022h db 00ah,0ffh,0ffh,0ffh,000h,089h,000h,089h db 000h,03ah,000h,000h,080h,0a6h,001h,010h db 000h,001h,000h,000h,000h,000h,000h,099h db 022h,05fh,04eh szP4 db 001h,023h,045h,067h,089h,0abh,0cdh,0efh szP5 db 000h,000h,000h,000h,000h,000h,000h,000h szP6 db 000h,000h,000h,000h,000h,000h,000h,000h szP7 db 000h,000h,000h,000h,000h,000h,000h,000h db 000h,000h szP8 db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h db 001h,001h,001h,001h,001h,001h,001h,001h szP9 db 0dch,0eeh,04ch,0f9h,02ch szP10 db 052h,075h,069h,073h,06ch,069h,06eh,06eh db 075h,06eh,020h,06ch,061h,075h,06ch,075h db 020h,06bh,06fh,072h,076h,069h,073h,073h db 073h,061h,06eh,069h,02ch,020h,074h,0e4h db 068h,06bh,0e4h,070h,0e4h,069h,064h,065h db 06eh,020h,070h,0e4h,0e4h,06ch,06ch,0e4h db 020h,074h,0e4h,079h,073h,069h,06bh,075h db 075h,02eh,020h,04bh,065h,073h,0e4h,079h db 0f6h,06eh,020h,06fh,06eh,020h,06fh,06eh db 06eh,069h,020h,06fh,06dh,061h,06eh,061h db 06eh,069h,02ch,020h,06bh,061h,073h,06bh db 069h,073h,061h,076h,075h,075h,06eh,020h db 06ch,061h,061h,06bh,073h,06fh,074h,020h db 076h,065h,072h,068h,06fh,075h,075h,02eh db 020h,045h,06eh,020h,06dh,061h,020h,069h db 06ch,06fh,069h,074h,073h,065h,02ch,020h db 073h,075h,072h,065h,020h,068h,075h,06fh db 06bh,061h,061h,02ch,020h,06dh,075h,074h db 074h,061h,020h,06dh,065h,074h,073h,0e4h db 06eh,020h,074h,075h,06dh,06dh,075h,075h db 073h,020h,06dh,075h,06ch,06ch,065h,020h db 074h,075h,06fh,06bh,061h,061h,02eh,020h db 050h,075h,075h,06eh,074h,06fh,020h,070h db 069h,06ch,076h,065h,06eh,02ch,020h,06dh db 069h,020h,068h,075h,06bh,06bh,075h,075h db 02ch,020h,073h,069h,069h,06eh,074h,06fh db 020h,076h,061h,072h,061h,06eh,020h,074h db 075h,075h,06ch,069h,073h,065h,06eh,02ch db 020h,06dh,069h,020h,06eh,075h,06bh,06bh db 075h,075h,02eh,020h,054h,075h,06fh,06bh db 073h,075h,074h,020h,076h,061h,06eh,061h db 06dh,06fh,06eh,020h,06ah,061h,020h,076h db 061h,072h,06ah,06fh,074h,020h,076h,065h db 065h,06eh,02ch,020h,06eh,069h,069h,073h db 074h,0e4h,020h,073h,079h,064h,0e4h,06dh db 065h,06eh,069h,020h,06ch,061h,075h,06ch db 075h,06eh,020h,074h,065h,065h,06eh,02eh db 020h,02dh,020h,045h,069h,06eh,06fh,020h db 04ch,065h,069h,06eh,06fh szKey db "Key :",0 szPT db "PlainText :",0 szCT db "CipherText:",0 .code start: pushad invoke printSet, offset szK1, 8, offset szP1, 41 invoke printSet, offset szK2, 16, offset szP2, 110 invoke printSet, offset szK3, 16, offset szP3, 51 invoke printSet, offset szK4, 8, offset szP4, 8 invoke printSet, offset szK5, 8, offset szP5, 8 invoke printSet, offset szK6, 8, offset szP6, 8 invoke printSet, offset szK7, 4, offset szP7, 10 invoke printSet, offset szK8, 8, offset szP8, 512 invoke printSet, offset szK9, 5, offset szP9, 5 invoke printSet, offset szK10, 16, offset szP10, 309 popad ret printSet proc ptrKey:DWORD, lenKey:DWORD, ptrData:DWORD, lenData:DWORD invoke printLine, offset szKey invoke printBytes, ptrKey, lenKey invoke printLine, offset szPT invoke printBytes, ptrData, lenData invoke rc4_setkey, ptrKey, lenKey invoke rc4_crypt, ptrData, lenData invoke printLine, offset szCT invoke printBytes, ptrData, lenData invoke printSeparator ret printSet endp printLine proc ptrString:DWORD LOCAL _Temp : DWORD pushad lea esi, _Temp and dword ptr [esi], 0 invoke GetStdHandle, STD_OUTPUT_HANDLE mov ebx, eax invoke getstringlen, ptrString push 0 push esi push eax push ptrString push ebx call WriteConsoleA invoke printSeparator popad ret printLine endp printBytes proc ptrData:DWORD, lenData:DWORD LOCAL _Temp : DWORD LOCAL _HStd : DWORD LOCAL _Buffer[60]:BYTE pushad invoke GetStdHandle, STD_OUTPUT_HANDLE mov _HStd, eax mov ebx, lenData test ebx, ebx jz @done mov esi, ptrData cld @nextLoop: lea edi, _Buffer xor edx, edx xor ecx, ecx @loop: lodsb mov ah, al and ax, 0FF0h shr al, 4 cmp al, 0Ah jb @F add al, 27h @@: add al, 30h stosb shr ax, 8 cmp al, 0Ah jb @F add al, 27h @@: add al, 30h stosb mov al, 20h stosb add edx, 3 dec ebx jz @show inc ecx and ecx, 0Fh jnz @loop mov eax, edx push 0 lea edx, _Temp and dword ptr [edx], 0 push edx push eax lea edx, _Buffer push edx push _HStd call WriteConsoleA invoke printSeparator jmp @nextLoop @show: mov eax, edx push 0 lea edx, _Temp and dword ptr [edx], 0 push edx push eax lea edx, _Buffer push edx push _HStd call WriteConsoleA invoke printSeparator @done: popad ret printBytes endp printSeparator proc LOCAL _Temp : DWORD LOCAL _EOL : DWORD pushad lea esi, _Temp lea edi, _EOL and dword ptr [esi], 0 mov dword ptr [edi], 0A0Dh invoke GetStdHandle, STD_OUTPUT_HANDLE mov ebx, eax push 0 push esi push 2 push edi push ebx call WriteConsoleA popad ret printSeparator endp end start
src/regex-syntax_trees.adb
skordal/ada-regex
2
3134
-- Ada regular expression library -- (c) <NAME> 2020-2021 <<EMAIL>> -- Report bugs and issues on <https://github.com/skordal/ada-regex> with Ada.Unchecked_Deallocation; package body Regex.Syntax_Trees is function "<" (Left, Right : in Syntax_Tree_Node_Access) return Boolean is begin return Left.Id < Right.Id; end "<"; function Create_Node (Node_Type : in Syntax_Tree_Node_Type; Id : in Natural; Left_Child, Right_Child : in Syntax_Tree_Node_Access := null; Char : in Character := Character'Val (0)) return Syntax_Tree_Node_Access is Retval : constant Syntax_Tree_Node_Access := new Syntax_Tree_Node (Node_Type => Node_Type); begin Retval.Id := Id; Retval.Left_Child := Left_Child; Retval.Right_Child := Right_Child; if Node_Type = Single_Character then Retval.Char := Char; end if; return Retval; end Create_Node; function Clone_Tree (Root : in Syntax_Tree_Node_Access; Next_Id : in out Natural) return Syntax_Tree_Node_Access is Retval : constant Syntax_Tree_Node_Access := Create_Node (Root.Node_Type, Next_Id); begin Next_Id := Next_Id + 1; case Retval.Node_Type is when Single_Character => Retval.Char := Root.Char; when Acceptance => Retval.Acceptance_Id := Root.Acceptance_Id; when others => null; end case; if Root.Left_Child /= null then Retval.Left_Child := Clone_Tree (Root.Left_Child, Next_Id); end if; if Root.Right_Child /= null then Retval.Right_Child := Clone_Tree (Root.Right_Child, Next_Id); end if; return Retval; end Clone_Tree; function Clone_Tree (Root : in Syntax_Tree_Node_Access) return Syntax_Tree_Node_Access is Next_Id : Natural := 1; begin return Clone_Tree (Root, Next_Id); end Clone_Tree; function Get_Acceptance_Node (Root : in Syntax_Tree_Node_Access) return Syntax_Tree_Node_Access is Retval : Syntax_Tree_Node_Access := null; begin if Root.Node_Type = Acceptance then return Root; else if Root.Right_Child /= null then Retval := Get_Acceptance_Node (Root.Right_Child); if Retval /= null then return Retval; end if; end if; if Root.Left_Child /= null then Retval := Get_Acceptance_Node (Root.Left_Child); if Retval /= null then return Retval; end if; end if; return null; end if; end Get_Acceptance_Node; procedure Free_Recursively (Root_Node : in out Syntax_Tree_Node_Access) is procedure Free is new Ada.Unchecked_Deallocation (Syntax_Tree_Node, Syntax_Tree_Node_Access); begin if Root_Node.Left_Child /= null then Free_Recursively (Root_Node.Left_Child); end if; if Root_Node.Right_Child /= null then Free_Recursively (Root_Node.Right_Child); end if; Free (Syntax_Tree_Node_Access (Root_Node)); end Free_Recursively; function Nullable (Node : in Syntax_Tree_Node_Access) return Boolean is begin pragma Assert (Node /= null); case Node.Node_Type is when Kleene_Star | Empty_Node => return True; when Single_Character | Any_Character | Acceptance => return False; when Alternation => return Nullable (Node.Left_Child) or Nullable (Node.Right_Child); when Concatenation => return Nullable (Node.Left_Child) and Nullable (Node.Right_Child); end case; end Nullable; function Firstpos (Node : in Syntax_Tree_Node_Access) return Syntax_Tree_Node_Sets.Sorted_Set is use Syntax_Tree_Node_Sets; Retval : Sorted_Set := Empty_Set; begin pragma Assert (Node /= null); case Node.Node_Type is when Empty_Node => null; -- Returns Empty_Set when Kleene_Star => Retval := Firstpos (Node.Left_Child); when Concatenation => if Nullable (Node.Left_Child) then Retval := Firstpos (Node.Left_Child) & Firstpos (Node.Right_Child); else Retval := Firstpos (Node.Left_Child); end if; when Alternation => Retval := Firstpos (Node.Left_Child) & Firstpos (Node.Right_Child); when Single_Character | Any_Character | Acceptance => Retval := To_Set (Node); end case; return Retval; end Firstpos; function Lastpos (Node : in Syntax_Tree_Node_Access) return Syntax_Tree_Node_Sets.Sorted_Set is use Syntax_Tree_Node_Sets; Retval : Sorted_Set := Empty_Set; begin pragma Assert (Node /= null); case Node.Node_Type is when Empty_Node => null; -- Returns Empty_Set when Kleene_Star => Retval := Lastpos (Node.Left_Child); when Single_Character | Any_Character | Acceptance => Retval := To_Set (Node); when Concatenation => if Nullable (Node.Right_Child) then Retval := Lastpos (Node.Right_Child) & Lastpos (Node.Left_Child); else Retval := Lastpos (Node.Right_Child); end if; when Alternation => Retval := Lastpos (Node.Left_Child) & Lastpos (Node.Right_Child); end case; return Retval; end Lastpos; procedure Calculate_Followpos (Tree : in Syntax_Tree_Node_Access) is use Syntax_Tree_Node_Sets; begin pragma Assert (Tree /= null); if Tree.Node_Type = Concatenation then for Node of Lastpos (Tree.Left_Child) loop Node.Followpos := Node.Followpos & Firstpos (Tree.Right_Child); end loop; elsif Tree.Node_Type = Kleene_Star then for Node of Lastpos (Tree) loop Node.Followpos := Node.Followpos & Firstpos (Tree); end loop; end if; -- Continue down the tree: if Tree.Left_Child /= null then Calculate_Followpos (Tree.Left_Child); end if; if Tree.Right_Child /= null then Calculate_Followpos (Tree.Right_Child); end if; end Calculate_Followpos; end Regex.Syntax_Trees;
oeis/078/A078052.asm
neoneye/loda-programs
11
6693
; A078052: Expansion of (1-x)/(1+x+2*x^2+2*x^3). ; Submitted by <NAME> ; 1,-2,0,2,2,-6,-2,10,6,-22,-10,42,22,-86,-42,170,86,-342,-170,682,342,-1366,-682,2730,1366,-5462,-2730,10922,5462,-21846,-10922,43690,21846,-87382,-43690,174762,87382,-349526,-174762,699050,349526,-1398102,-699050,2796202,1398102,-5592406,-2796202,11184810,5592406,-22369622,-11184810,44739242,22369622,-89478486,-44739242,178956970,89478486,-357913942,-178956970,715827882,357913942,-1431655766,-715827882,2863311530,1431655766,-5726623062,-2863311530,11453246122,5726623062,-22906492246 mov $1,1 mov $2,1 lpb $0 sub $0,1 add $2,$1 mul $3,2 sub $3,$1 add $1,$3 dif $2,-1 add $1,$2 sub $2,$1 add $3,$2 lpe mov $0,$1
programs/oeis/202/A202068.asm
neoneye/loda
22
171751
<filename>programs/oeis/202/A202068.asm ; A202068: Denominator of mass of oriented maximal Wicks forms of genus n. ; 6,6,3,6,3,1,1,2,3,3,3,3,3,3,1,2,1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,6,1,1,1,3,3,3,3,3,3,1,1,1,1,1,1,1,1,1 seq $0,108 ; Catalan numbers: C(n) = binomial(2n,n)/(n+1) = (2n)!/(n!(n+1)!). lpb $0 mod $0,6 lpe add $0,2 pow $0,2 sub $0,3 mod $0,10
oeis/099/A099376.asm
neoneye/loda-programs
11
10768
<reponame>neoneye/loda-programs<filename>oeis/099/A099376.asm ; A099376: An inverse Chebyshev transform of x^3. ; 0,1,4,14,48,165,572,2002,7072,25194,90440,326876,1188640,4345965,15967980,58929450,218349120,811985790,3029594040,11338026180,42550029600,160094486370,603784920024,2282138106804,8643460269248,32798844771700,124680849918352,474746313150648,1810502068789568,6914663035042301,26444792798594380,101268000658146714,388271781325244544,1490397410607839734,5727227396045850968,22031207552900835380,84832254137763216672,326957646155962397590,1261276298816540508040,4869664507084913916380 add $0,1 mov $1,$0 mov $2,$0 mul $0,2 sub $2,2 bin $0,$2 mul $0,2 div $0,$1
Division-by-repeated-subtraction.asm
DuttaAbhigyan/x85-Simple-Arithmetic-Programs
0
169627
;Program to calculate rounded off division of 2 8bit ;numbers ;Loading register with dividednd stored at 0x0000 ;and divisor at 0x0001 LDA 0x0001 MOV B,A LDA 0x0000 MVI C,0000 ;Finding quotient AGAIN: CMP B JC ROUND INR C SUB B JMP AGAIN ;ROunding off the answer ROUND: ADD A CMP B JC STORE INR C ;Storing result in 0x0002 STORE: MOV A,C STA 0x0002 HLT
test/Succeed/Issue2108.agda
cruhland/agda
1,989
3329
<filename>test/Succeed/Issue2108.agda -- Andreas, 2016-07-25, issue #2108 -- test case and report by Jesper {-# OPTIONS --allow-unsolved-metas #-} -- {-# OPTIONS -v tc.pos.occ:70 #-} open import Agda.Primitive open import Agda.Builtin.Equality lone = lsuc lzero record Level-zero-or-one : Set where field level : Level is-lower : (level ⊔ lone) ≡ lone open Level-zero-or-one public Coerce : ∀ {a} → a ≡ lone → Set₁ Coerce refl = Set data Test : Set₁ where test : Coerce (is-lower _) → Test -- WAS: -- Meta variable here triggers internal error. -- Should succeed with unsolved metas.
random_ideas/alloy/pm6.als
asimihsan/asim_ihsan_io
0
4580
<gh_stars>0 sig Package { name : one Name, version : one Version, requires : set Package, } var sig InstalledPackage in Package {} sig Name {} sig Version {} fact "only one package version in dependency graph for package" { all p1 : Package, disj p2, p3 : p1.*requires | p2.name != p3.name } fact "package doesn't require itself at any version" { all p : Package | p.name not in (p.requires).name } fact { no InstalledPackage } pred install[p : Package] { // guard p not in InstalledPackage // effects // This enforces only one package with same name installed at any given time InstalledPackage' = p.*requires + {p2 : InstalledPackage | p2.name not in (p.*requires).name} // no frame conditions } pred stutter { // no guard // no effects InstalledPackage' = InstalledPackage // frame condition } fact { always ( stutter or one p : Package - InstalledPackage | install[p] ) } run example { // At least 3 Packages #(Package.name) >= 3 // At least two requirements #(Package.requires) >= 2 } for 5
src/AssocFree/STLambdaC/Eval.agda
agda/agda-assoc-free
3
3988
<reponame>agda/agda-assoc-free open import Relation.Binary.PropositionalEquality using ( _≡_ ; refl ; sym ; trans ; subst ; subst₂ ; cong ; cong₂ ) open import AssocFree.Util using ( δsubst₂ ) import AssocFree.STLambdaC.Typ import AssocFree.STLambdaC.Exp import AssocFree.STLambdaC.NF import AssocFree.STLambdaC.Redn module AssocFree.STLambdaC.Eval (TConst : Set) (Const : AssocFree.STLambdaC.Typ.Typ TConst → Set) where open Relation.Binary.PropositionalEquality.≡-Reasoning using ( begin_ ; _≡⟨_⟩_ ; _∎ ) open module Typ = AssocFree.STLambdaC.Typ TConst using ( Typ ; Ctxt ; const ; _⇝_ ; [_] ; [] ; _∷_ ; _++_ ; _∈_ ; uniq ; Case ; case ; inj₁ ; inj₂ ; case-≫ ; _≪_ ; _≫_ ) open module Exp = AssocFree.STLambdaC.Exp TConst Const using ( Exp ; exp ; const ; abs ; app ; var ; var₀ ; Substn ; substn+ ; substn* ; xsubstn+ ; weaken+ ; weaken* ; weakens* ; ⟨_⟩ ; choose ; _◁_ ; id ; weaken*-[] ; weaken*-++ ; substn*-◁ ; substn*-id ) open module NF = AssocFree.STLambdaC.NF TConst Const using ( Atom ; NF ; var ; const ; app ; abs ; atom ; atom₀ ; aweaken* ) open module Redn = AssocFree.STLambdaC.Redn TConst Const using ( _⇒_ ; _⇓ ; _⇓′ ; eta ; beta ; lhs ; atom ; nf ; redn ; tgt ; ⇓abs ; ⇓app ; rweaken* ) -- Values data cVal {Γ C} : Exp Γ (const C) → Set where atom : ∀ {M} → Atom M → cVal M redn : ∀ {M N} → (M ⇒ N) → cVal N → cVal M data fVal {Γ T U} (F : ∀ {Γ} → Exp Γ T → Set) (G : ∀ {Γ} → Exp Γ U → Set) : Exp Γ (T ⇝ U) → Set where fun : ∀ {M} → (∀ Δ → {N : Exp (Δ ++ Γ) T} → F N → G (app (weaken* Δ {Γ} M) N)) → fVal F G M redn : ∀ {M N} → (M ⇒ N) → fVal F G N → fVal F G M Val : ∀ {Γ T} → Exp Γ T → Set Val {Γ} {const C} M = cVal M Val {Γ} {T ⇝ U} M = fVal Val Val M -- Values are closed under reduction and application vredn : ∀ {Γ T} {M N : Exp Γ T} → (M ⇒ N) → Val N → Val M vredn {Γ} {const C} = redn vredn {Γ} {T ⇝ U} = redn vapp : ∀ {Γ T U} {M : Exp Γ (T ⇝ U)} {N : Exp Γ T} → Val M → Val N → Val (app M N) vapp {Γ} {T} {U} {M} {N} (fun f) W = subst (λ X → Val (app X N)) (weaken*-[] M) (f [] W) vapp (redn M⇒N V) W = vredn (lhs M⇒N) (vapp V W) -- Reification and reflection mutual reify : ∀ {Γ T} {M : Exp Γ T} → Val M → (M ⇓) reify {Γ} {const C} (atom N) = nf (atom N) reify {Γ} {const C} (redn M⇒N V) = redn M⇒N (reify V) reify {Γ} {T ⇝ U} {M} (fun f) = redn (eta M) (⇓abs {Γ} T (reify (f [ T ] (reflect (atom (atom₀ {Γ})))))) reify {Γ} {T ⇝ U} (redn M⇒N V) = redn M⇒N (reify V) reflect : ∀ {Γ T} {M : Exp Γ T} → (M ⇓′) → Val M reflect {Γ} {const C} (atom M) = atom M reflect {Γ} {T ⇝ U} (atom M) = fun (λ Δ V → reflect (⇓app (atom (aweaken* Δ M)) (reify V))) reflect (redn M⇒N N⇓) = vredn M⇒N (reflect N⇓) -- Value substitutions Vals : ∀ {Γ Δ} → Substn (exp var) Γ Δ → Set Vals {Γ} {Δ} σ = ∀ {T} (x : T ∈ Δ) → Val (σ x) ⟪_⟫ : ∀ {Γ T} {N : Exp Γ T} → Val N → Vals ⟨ N ⟩ ⟪ V ⟫ x = δsubst₂ (λ X Y → Val {T = X} Y) (uniq x) refl V vchoose : ∀ {Γ Δ E} {σ : Substn (exp var) Γ Δ} {τ : Substn (exp var) Γ E} → Vals σ → Vals τ → ∀ {T} (x : Case T Δ E) → Val (choose σ τ x) vchoose Vs Ws (inj₁ x) = Vs x vchoose Vs Ws (inj₂ x) = Ws x _◂_ : ∀ {Γ Δ T} {N : Exp Γ T} {σ : Substn (exp var) Γ Δ} → Val N → Vals σ → Vals (N ◁ σ) _◂_ {Γ} {Δ} {T} V Vs x = vchoose ⟪ V ⟫ Vs (case [ T ] Δ x) -- Weakening vweaken* : ∀ {Γ} Δ {U} {M : Exp Γ U} → Val M → Val (weaken* Δ M) vweaken* Δ {const C} (atom N) = atom (aweaken* Δ N) vweaken* Δ {const C} (redn M⇒N V) = redn (rweaken* Δ M⇒N) (vweaken* Δ V) vweaken* Δ {T ⇝ U} {M} (fun f) = fun (λ Φ {N} V → subst (λ X → Val (app X N)) (sym (weaken*-++ Φ Δ _ M)) (f (Φ ++ Δ) V)) vweaken* Δ {T ⇝ U} (redn M⇒N V) = redn (rweaken* Δ M⇒N) (vweaken* Δ V) vweakens* : ∀ {Γ Δ} E {σ : Substn (exp var) Γ Δ} → Vals σ → Vals (weakens* E σ) vweakens* E {σ} Vs x = vweaken* E (Vs x) -- Evaluation eval : ∀ {Γ Δ T} (M : Exp Γ T) → {σ : Substn (exp var) Δ Γ} → Vals σ → Val (substn* σ M) eval (const {T} c) Vs = reflect (atom (const c)) eval {Γ} {Δ} (var x) {σ} Vs = subst Val (begin σ x ≡⟨ sym (weaken*-[] (σ x)) ⟩ weaken* [] (σ x) ≡⟨ cong (xsubstn+ [] Δ Γ σ) (sym (case-≫ [] x)) ⟩ substn* σ (var x) ∎) (Vs x) eval {Γ} {Δ} (abs T M) {σ} Vs = fun (λ E {N} V → vredn (beta {E ++ Δ} (weaken+ [ T ] E Δ (substn+ [ T ] Δ Γ σ M)) N) (subst Val (substn*-◁ Γ Δ E M N σ) (eval M (V ◂ vweakens* E {σ} Vs)))) eval (app M N) Vs = vapp (eval M Vs) (eval N Vs) vid : ∀ Γ → Vals (id Γ) vid Γ x = reflect (atom (var x)) normalize : ∀ {Γ T} → (M : Exp Γ T) → (M ⇓) normalize {Γ} M = reify (subst Val (substn*-id M) (eval M (vid Γ))) normal : ∀ {Γ T} → Exp Γ T → Exp Γ T normal M = tgt (normalize M)
include/sf-system-thread.ads
danva994/ASFML-1.6
1
9582
<reponame>danva994/ASFML-1.6<gh_stars>1-10 -- //////////////////////////////////////////////////////////// -- // -- // SFML - Simple and Fast Multimedia Library -- // Copyright (C) 2007-2009 <NAME> (<EMAIL>) -- // -- // This software is provided 'as-is', without any express or implied warranty. -- // In no event will the authors be held liable for any damages arising from the use of this software. -- // -- // Permission is granted to anyone to use this software for any purpose, -- // including commercial applications, and to alter it and redistribute it freely, -- // subject to the following restrictions: -- // -- // 1. The origin of this software must not be misrepresented; -- // you must not claim that you wrote the original software. -- // If you use this software in a product, an acknowledgment -- // in the product documentation would be appreciated but is not required. -- // -- // 2. Altered source versions must be plainly marked as such, -- // and must not be misrepresented as being the original software. -- // -- // 3. This notice may not be removed or altered from any source distribution. -- // -- //////////////////////////////////////////////////////////// -- //////////////////////////////////////////////////////////// -- // Headers -- //////////////////////////////////////////////////////////// with Sf.Config; with Sf.System.Types; package Sf.System.Thread is use Sf.Config; use Sf.System.Types; pragma Warnings (Off); type sfThreadFunc_Ptr is access procedure (arg : sfVoid_Ptr); -- //////////////////////////////////////////////////////////// -- /// Construct a new thread from a function pointer -- /// -- /// \param Function : Entry point of the thread -- /// \param UserData : Data to pass to the thread function -- /// -- //////////////////////////////////////////////////////////// function sfThread_Create (Func : sfThreadFunc_Ptr; UserData : sfVoid_Ptr) return sfThread_Ptr; -- //////////////////////////////////////////////////////////// -- /// Destroy an existing thread -- /// -- /// \param Thread : Thread to delete -- /// -- //////////////////////////////////////////////////////////// procedure sfThread_Destroy (Thread : sfThread_Ptr); -- //////////////////////////////////////////////////////////// -- /// Run a thread -- /// -- /// \param Thread : Thread to launch -- /// -- //////////////////////////////////////////////////////////// procedure sfThread_Launch (Thread : sfThread_Ptr); -- //////////////////////////////////////////////////////////// -- /// Wait until a thread finishes -- /// -- /// \param Thread : Thread to wait for -- /// -- //////////////////////////////////////////////////////////// procedure sfThread_Wait (Thread : sfThread_Ptr); -- //////////////////////////////////////////////////////////// -- /// Terminate a thread -- /// Terminating a thread with this function is not safe, -- /// you should rather try to make the thread function -- /// terminate by itself -- /// -- /// \param Thread : Thread to terminate -- /// -- //////////////////////////////////////////////////////////// procedure sfThread_Terminate (Thread : sfThread_Ptr); private pragma Warnings (On); pragma Import (C, sfThread_Create, "sfThread_Create"); pragma Import (C, sfThread_Destroy, "sfThread_Destroy"); pragma Import (C, sfThread_Launch, "sfThread_Launch"); pragma Import (C, sfThread_Wait, "sfThread_Wait"); pragma Import (C, sfThread_Terminate, "sfThread_Terminate"); end Sf.System.Thread;
libsrc/_DEVELOPMENT/adt/p_forward_list_alt/c/sccz80/p_forward_list_alt_remove_after.asm
jpoikela/z88dk
640
102153
<gh_stars>100-1000 ; void *p_forward_list_alt_remove_after(p_forward_list_alt_t *list, void *list_item) SECTION code_clib SECTION code_adt_p_forward_list_alt PUBLIC p_forward_list_alt_remove_after EXTERN asm_p_forward_list_alt_remove_after p_forward_list_alt_remove_after: pop af pop hl pop bc push bc push hl push af jp asm_p_forward_list_alt_remove_after ; SDCC bridge for Classic IF __CLASSIC PUBLIC _p_forward_list_alt_remove_after defc _p_forward_list_alt_remove_after = p_forward_list_alt_remove_after ENDIF
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/debug6.adb
best08618/asylo
7
6829
-- { dg-do compile } -- { dg-options "-g" } with Debug6_Pkg; use Debug6_Pkg; procedure Debug6 is V : Value := (Kind => Undefined); begin Process (V); end Debug6;
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48_notsx.log_21829_1476.asm
ljhsiun2/medusa
9
28473
<reponame>ljhsiun2/medusa<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r15 push %rbp push %rsi lea addresses_WC_ht+0x19d89, %r15 and %r13, %r13 movb $0x61, (%r15) nop nop nop nop nop dec %r11 lea addresses_WT_ht+0x1af89, %rbp nop nop nop inc %r15 vmovups (%rbp), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $0, %xmm3, %r11 nop nop and $59133, %r11 pop %rsi pop %rbp pop %r15 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r14 push %r8 push %rax push %rbx push %rdi // Store mov $0x4221cd0000000189, %r13 nop nop nop add $33166, %rax movl $0x51525354, (%r13) nop nop sub %rax, %rax // Faulty Load mov $0x7ad5a70000000989, %r10 nop nop nop nop cmp $4054, %r8 movb (%r10), %r13b lea oracles, %rbx and $0xff, %r13 shlq $12, %r13 mov (%rbx,%r13,1), %r13 pop %rdi pop %rbx pop %rax pop %r8 pop %r14 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_NC', 'congruent': 0}} {'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 4, 'type': 'addresses_NC', 'congruent': 9}, 'OP': 'STOR'} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_NC', 'congruent': 0}} <gen_prepare_buffer> {'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 1, 'type': 'addresses_WC_ht', 'congruent': 8}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT_ht', 'congruent': 8}} {'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 */
roms/test/apu/test_apu_timers/triangle_pitch.asm
drewying/Nintendoish
15
103016
; NES APU Triangle Pitch Test ; Tests triangle's frequency timer. A tone of unchanging timbre ; should play; if it continually shifts, check timer period ; handling, then CPU instruction timing. ; <NAME> <<EMAIL>> main: sei ldx #0 ; wait for hardware hw_delay: dey bne hw_delay dex bne hw_delay lda #0 ; disable nmi sta $2000 lda #$04 ; enable triangle sta $4015 lda #$ff ; linear counter suspended sta $4008 lda #$91 ; period = $49 sta $400a lda #$00 sta $400b lda #0 tone_loop: sta 0 pha pla ldx #193 tone_delay_loop: pha pla dex bne tone_delay_loop sta $4011 eor #20 jmp tone_loop irq: nmi: rti .org $fffa .word nmi .word main .word irq
src/css-core-styles.adb
stcarrez/ada-css
3
3555
<reponame>stcarrez/ada-css ----------------------------------------------------------------------- -- css-core-styles -- Core CSS API definition -- Copyright (C) 2017, 2020 <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. ----------------------------------------------------------------------- package body CSS.Core.Styles is -- ------------------------------ -- Get the type that identifies the rule. -- ------------------------------ overriding function Get_Type (Rule : in CSSStyleRule) return CSSRule_Type is pragma Unreferenced (Rule); begin return STYLE_RULE; end Get_Type; -- ------------------------------ -- If the reference is valid and represents a style rule, return it. -- Otherwise returns null. -- ------------------------------ function Value (Ref : in CSS.Core.Refs.Ref) return CSSStyleRule_Access is begin if Ref.Is_Null then return null; else declare V : constant CSS.Core.Refs.Element_Accessor := Ref.Value; begin if V in CSSStyleRule'Class then return CSSStyleRule'Class (V.Element.all)'Unchecked_Access; else return null; end if; end; end if; end Value; -- ------------------------------ -- If the cursor is valid and represents a style rule, return it. -- Otherwise returns null. -- ------------------------------ function Element (Pos : in CSS.Core.Vectors.Cursor) return CSSStyleRule_Access is begin return Value (CSS.Core.Vectors.Element (Pos)); end Element; -- ------------------------------ -- Get the type that identifies the rule. -- ------------------------------ overriding function Get_Type (Rule : in CSSPageRule) return CSSRule_Type is pragma Unreferenced (Rule); begin return PAGE_RULE; end Get_Type; -- ------------------------------ -- Get the type that identifies the rule. -- ------------------------------ overriding function Get_Type (Rule : in CSSFontfaceRule) return CSSRule_Type is pragma Unreferenced (Rule); begin return FONT_FACE_RULE; end Get_Type; end CSS.Core.Styles;
Darky/DarkMode Switcher/SupportingFiles/darkmodeParam.scpt
ptrkstr/Darky
83
4203
<filename>Darky/DarkMode Switcher/SupportingFiles/darkmodeParam.scpt tell application "System Events" tell appearance preferences return dark mode end tell end tell
AVR/Fibonacci.asm
StxGuy/EmbeddedSystems
0
170930
<reponame>StxGuy/EmbeddedSystems .device ATmega328 .org 0x00 ; Program starts at 0x00 rjmp INICIO ; Generate Fibonacci sequence INICIO: nop ldi R19,0x05 clr R16 ldi R17,0x01 LOOP: mov R18,R17 add R18,R16 mov R16,R17 mov R17,R18 dec R19 breq FIM rjmp LOOP FIM: jmp FIM
libsrc/stdio/ansi/ace/f_ansi_cls.asm
jpoikela/z88dk
640
10809
; ; ANSI Video handling for the Jupiter ACE ; ; CLS - Clear the screen ; ; ; <NAME> - Feb. 2001 ; ; ; $Id: f_ansi_cls.asm,v 1.4 2016-04-04 18:31:22 dom Exp $ ; SECTION code_clib PUBLIC ansi_cls .ansi_cls ld hl,$2400 ld (hl),32 ;' ' ld d,h ld e,l inc de ld bc,32*24 ldir ;;; ;;; The ROM cls call: ;;; call 457 ;;; ret
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c36180a.ada
best08618/asylo
7
7939
-- C36180A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT AN INDEX CONSTRAINT CAN HAVE THE FORM A'RANGE, -- WHERE A IS A PREVIOUSLY DECLARED ARRAY OBJECT OR CONSTRAINED -- ARRAY SUBTYPE. -- HISTORY: -- BCB 01/21/88 CREATED ORIGINAL TEST. WITH REPORT; USE REPORT; PROCEDURE C36180A IS TYPE J IS ARRAY (INTEGER RANGE <>) OF INTEGER; TYPE K IS ARRAY (1..10) OF INTEGER; SUBTYPE A IS J (0 .. 50); SUBTYPE W IS J (A'RANGE); SUBTYPE X IS J (K'RANGE); TYPE Y IS ACCESS J; TYPE Z IS ACCESS J; TYPE F IS NEW J (A'RANGE); TYPE G IS NEW J (K'RANGE); B : ARRAY (A'RANGE) OF INTEGER; C : ARRAY (K'RANGE) OF INTEGER; D : ARRAY (1 .. 10) OF INTEGER; E : ARRAY (D'RANGE) OF INTEGER; H : J (A'RANGE); I : J (K'RANGE); L : J (D'RANGE); V1 : W; V2 : X; V3 : Y := NEW J (A'RANGE); V4 : Z := NEW J (K'RANGE); V5 : F; V6 : G; BEGIN TEST ("C36180A", "CHECK THAT AN INDEX CONSTRAINT CAN HAVE THE " & "FORM A'RANGE, WHERE A IS A PREVIOUSLY " & "DECLARED ARRAY OBJECT OR CONSTRAINED ARRAY " & "SUBTYPE"); IF B'FIRST /= IDENT_INT (0) OR B'LAST /= IDENT_INT (50) THEN FAILED ("IMPROPER VALUE FOR B'FIRST OR B'LAST"); END IF; IF C'FIRST /= IDENT_INT (1) OR C'LAST /= IDENT_INT (10) THEN FAILED ("IMPROPER VALUE FOR C'FIRST OR C'LAST"); END IF; IF E'FIRST /= IDENT_INT (1) OR E'LAST /= IDENT_INT (10) THEN FAILED ("IMPROPER VALUE FOR E'FIRST OR E'LAST"); END IF; IF H'FIRST /= IDENT_INT (0) OR H'LAST /= IDENT_INT (50) THEN FAILED ("IMPROPER VALUE FOR H'FIRST OR H'LAST"); END IF; IF I'FIRST /= IDENT_INT (1) OR I'LAST /= IDENT_INT (10) THEN FAILED ("IMPROPER VALUE FOR I'FIRST OR I'LAST"); END IF; IF L'FIRST /= IDENT_INT (1) OR L'LAST /= IDENT_INT (10) THEN FAILED ("IMPROPER VALUE FOR L'FIRST OR L'LAST"); END IF; IF V1'FIRST /= IDENT_INT (0) OR V1'LAST /= IDENT_INT (50) THEN FAILED ("IMPROPER VALUE FOR V1'FIRST OR V1'LAST"); END IF; IF V2'FIRST /= IDENT_INT (1) OR V2'LAST /= IDENT_INT (10) THEN FAILED ("IMPROPER VALUE FOR V2'FIRST OR V2'LAST"); END IF; IF V3.ALL'FIRST /= IDENT_INT (0) OR V3.ALL'LAST /= IDENT_INT (50) THEN FAILED ("IMPROPER VALUE FOR V3'FIRST OR V3'LAST"); END IF; IF V4.ALL'FIRST /= IDENT_INT (1) OR V4.ALL'LAST /= IDENT_INT (10) THEN FAILED ("IMPROPER VALUE FOR V4'FIRST OR V4'LAST"); END IF; IF V5'FIRST /= IDENT_INT (0) OR V5'LAST /= IDENT_INT (50) THEN FAILED ("IMPROPER VALUE FOR V5'FIRST OR V5'LAST"); END IF; IF V6'FIRST /= IDENT_INT (1) OR V6'LAST /= IDENT_INT (10) THEN FAILED ("IMPROPER VALUE FOR V6'FIRST OR V6'LAST"); END IF; RESULT; END C36180A;
study/loop.asm
caio-vinicius/libasm
0
162257
<gh_stars>0 section .text global loop loop: mov eax, 0 mov ecx, 2 start: add eax, 10 sub ecx, 1 cmp ecx, 0 jg start ret
data/pokemon/base_stats/chinchou.asm
genterz/pokecross
28
11210
db CHINCHOU ; 170 db 75, 38, 38, 67, 56, 56 ; hp atk def spd sat sdf db WATER, ELECTRIC ; type db 190 ; catch rate db 90 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_F50 ; gender ratio db 100 ; unknown 1 db 20 ; step cycles to hatch db 5 ; unknown 2 INCBIN "gfx/pokemon/chinchou/front.dimensions" db 0, 0, 0, 0 ; padding db GROWTH_SLOW ; growth rate dn EGG_WATER_2, EGG_WATER_2 ; egg groups ; tm/hm learnset tmhm CURSE, TOXIC, ZAP_CANNON, HIDDEN_POWER, SNORE, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, THUNDER, RETURN, DOUBLE_TEAM, SWAGGER, SLEEP_TALK, REST, ATTRACT, SURF, FLASH, WHIRLPOOL, WATERFALL, THUNDERBOLT, ICE_BEAM ; end
programs/oeis/138/A138431.asm
neoneye/loda
22
160698
; A138431: a(n) = ((n-th prime)^5-(n-th prime)^2)/2. ; 14,117,1550,8379,80465,185562,709784,1237869,3217907,10255154,14314095,34671294,57927260,73503297,114671399,209096342,357460409,422296290,675060309,902112155,1036533132,1538525079,1969516877,2792025764 seq $0,40 ; The prime numbers. mov $2,$0 pow $0,4 sub $0,$2 mul $0,$2 div $0,2
programs/oeis/185/A185294.asm
neoneye/loda
22
23072
; A185294: Number of disconnected 9-regular simple graphs on 2n vertices with girth at least 4. ; 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,15 div $0,2 sub $0,3 pow $0,2 div $0,8 bin $0,4
GraphQL.g4
hazzik/GraphQL-Grammar
0
2564
/* The MIT License (MIT) Copyright (c) 2019 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ grammar GraphQL; document : definition+ ; definition : executableDefinition | typeSystemDefinition | typeSystemExtension ; executableDefinition : operationDefinition | fragmentDefinition ; operationDefinition : operationType NAME? variableDefinitions? directives? selectionSet | selectionSet ; operationType : 'query' | 'mutation' | 'subscription' ; selectionSet : '{' selection+ '}' ; selection : field | fragmentSpread | inlineFragment ; field : alias? NAME arguments? directives? selectionSet? ; alias : NAME ':' ; arguments : '(' argument+ ')' ; argument : NAME ':' value ; fragmentSpread : '...' fragmentName directives? ; inlineFragment : '...' typeCondition? directives? selectionSet ; fragmentDefinition : 'fragment' fragmentName typeCondition directives? selectionSet ; fragmentName : NAME ; typeCondition : 'on' namedType ; value : variable | intValue | floatValue | stringValue | booleanValue | nullValue | enumValue | listValue | objectValue ; intValue : INT ; floatValue : FLOAT ; stringValue : STRING ; booleanValue : 'true' | 'false' ; nullValue : 'null' ; enumValue : NAME ; listValue : '[' value+ ']' ; objectValue : '{' value+ '}' ; objectField : NAME ':' value ; variableDefinitions : '(' variableDefinition+ ')' ; variableDefinition : variable ':' type defaultValue? ; variable : '$' NAME ; defaultValue : '=' value ; type : namedType | listType | nonNullType ; namedType : NAME ; listType : '[' type ']' ; nonNullType : namedType '!' | listType '!' ; directives : directive+ ; directive : '@' NAME ':' arguments? ; typeSystemDefinition : schemaDefinition | typeDefinition | directiveDefinition ; typeSystemExtension : schemaExtension | typeExtension ; schemaDefinition : 'schema' directives? '{' operationTypeDefinition+ '}' ; schemaExtension : 'extend schema' directives? '{' operationTypeDefinition+ '}' | 'extend schema' directives ; operationTypeDefinition : operationType ':' NAME ; description : stringValue ; typeDefinition : scalarTypeDefinition | objectTypeDefinition | interfaceTypeDefinition | unionTypeDefinition | enumTypeDefinition | inputObjectTypeDefinition ; typeExtension : scalarTypeExtension | objectTypeExtension | interfaceTypeExtension | unionTypeExtension | enumTypeExtension | inputObjectTypeExtension ; scalarTypeDefinition : description? 'scalar' NAME directives? ; scalarTypeExtension : 'extend scalar' NAME directives? ; objectTypeDefinition : description? 'type' NAME implementsInterfaces? directives? fieldsDefinition? ; objectTypeExtension : 'extend type' NAME implementsInterfaces? directives? fieldsDefinition | 'extend type' NAME implementsInterfaces? directives | 'extend type' NAME implementsInterfaces ; implementsInterfaces : 'implements' '&'? namedType | implementsInterfaces '&' namedType ; fieldsDefinition : '{' fieldDefinition+ '}' ; fieldDefinition : description? NAME argumentsDefinition? ':' type directives? ; argumentsDefinition : '(' inputValueDefinition+ ')' ; inputValueDefinition : description? NAME ':' type defaultValue? directives? ; interfaceTypeDefinition : description? 'interface' NAME directives? fieldsDefinition? ; interfaceTypeExtension : 'extend interface' NAME directives? fieldsDefinition | 'extend interface' NAME directives? ; unionTypeDefinition : description? 'union' NAME directives? unionMemberTypes? ; unionMemberTypes : '=' '|'? namedType | unionMemberTypes '|' namedType ; unionTypeExtension : 'extend union' NAME directives? unionMemberTypes | 'extend union' NAME directives ; enumTypeDefinition : description? 'enum' NAME directives? enumValuesDefinition? ; enumValuesDefinition : '{' enumValueDefinition+ '}' ; enumValueDefinition : description? enumValue directives? ; enumTypeExtension : 'extend enum' NAME directives? enumValuesDefinition | 'extend enum' NAME directives ; inputObjectTypeDefinition : description? 'input' NAME directives? inputFieldsDefinition? ; inputFieldsDefinition : '{' inputValueDefinition+ '}' ; inputObjectTypeExtension : 'extend input' NAME directives? inputFieldsDefinition | 'extend input' NAME directives ; directiveDefinition : description? 'directive @' NAME argumentsDefinition? 'on' directiveLocations ; directiveLocations : directiveLocation ( '|' directiveLocation )* ; directiveLocation : executableDirectiveLocation | typeSystemDirectiveLocation ; executableDirectiveLocation : 'QUERY' | 'MUTATION' | 'SUBSCRIPTION' | 'FIELD' | 'FRAGMENT_DEFINITION' | 'FRAGMENT_SPREAD' | 'INLINE_FRAGMENT' ; typeSystemDirectiveLocation : 'SCHEMA' | 'SCALAR' | 'OBJECT' | 'FIELD_DEFINITION' | 'ARGUMENT_DEFINITION' | 'INTERFACE' | 'UNION' | 'ENUM' | 'ENUM_VALUE' | 'INPUT_OBJECT' | 'INPUT_FIELD_DEFINITION' ; STRING : '"' ( ESC | ~ ["\\] )* '"' ; NAME : [_A-Za-z] [_0-9A-Za-z]* ; fragment ESC : '\\' ( ["\\/bfnrt] | UNICODE ) ; fragment UNICODE : 'u' HEX HEX HEX HEX ; fragment HEX : [0-9a-fA-F] ; INT : '-'? '0' | '-'? [1-9] [0-9]* ; FLOAT : INT '.' [0-9]+ EXP? | INT EXP | INT ; fragment EXP : [Ee] [+\-]? INT ; COMMENT : '#' ~[\r\n]* '\r'? '\n' -> skip ; COMMA : ',' -> skip ; WS : [ \t\n\r]+ -> skip ;
test/Compiler/simple/Issue1126.agda
xekoukou/agda-ocaml
7
7661
<filename>test/Compiler/simple/Issue1126.agda<gh_stars>1-10 -- Andreas, 2017-07-28, issue #1126 reported by Saizan is fixed data ℕ : Set where zero : ℕ suc : (n : ℕ) → ℕ {-# BUILTIN NATURAL ℕ #-} data Unit : Set where unit : Unit slow : ℕ → Unit slow zero = unit slow (suc n) = slow n postulate IO : Set → Set {-# COMPILE GHC IO = type IO #-} {-# BUILTIN IO IO #-} postulate return : ∀ {A} → A → IO A {-# COMPILE GHC return = (\ _ -> return) #-} {-# COMPILE JS return = function(u0) { return function(u1) { return function(x) { return function(cb) { cb(x); }; }; }; } #-} {-# FOREIGN OCaml let return _ x world = Lwt.return x #-} {-# COMPILE OCaml return = return #-} force : Unit → IO Unit force unit = return unit n = 3000000000 main : IO Unit main = force (slow n) -- Should terminate instantaneously.
HoTT/Equivalence/Transport.agda
michaelforney/hott
0
14319
<filename>HoTT/Equivalence/Transport.agda {-# OPTIONS --without-K #-} open import HoTT.Base open import HoTT.Equivalence module HoTT.Equivalence.Transport where open variables transport-equiv : {x y : A} → x == y → P x ≃ P y transport-equiv {A = A} {P = P} p = f , qinv→isequiv (g , η p , ε p) where f = transport P p g = transport P (p ⁻¹) variable x y : A η : (p : x == y) → transport P (p ⁻¹) ∘ transport P p ~ id η refl _ = refl ε : (p : x == y) → transport P p ∘ transport P (p ⁻¹) ~ id ε refl _ = refl
runtime/src/exc_engine/x64/capture.asm
Shtan7/KTL
38
175214
; Licensed under the MIT License <http://opensource.org/licenses/MIT>. ; Copyright (c) 2019-2021 <NAME> (avakar) extern __cxx_dispatch_exception: proc extern __cxx_destroy_exception: proc extern __cxx_seh_frame_handler: proc extern __cxx_call_catch_frame_handler: proc ; The stack frame of `__CxxThrowException` always contains ; the catch info structure defined below. During the unwind, ; the referenced exception object may be destroyed, or reused ; in case of a rethrow. Furthermore, the `primary_frame_ptr` and ; `unwind_context` are captured and can be used by the next C++ frame handler. catch_info_t struct cont_addr_0 qword ? cont_addr_1 qword ? primary_frame_ptr qword ? exception_object_or_link qword ? throw_info_if_owner qword ? unwind_context qword ? catch_info_t ends ; The __CxxThrowException allocates `throw_fr` as its frame. This is ; a fairly large structure containing the non-volatile context of the calling ; function. `rip` and `rsp` are layed out in a machine frame format, so that ; they can be applied by the `iretq` instruction. ; ; The context starts out marked by `.allocstack`. However, once the context is ; unwound, the execution falls through to different funclet, in which the same ; frame structure is marked with `.pushframe` and a bunch of `.pushreg`s. ; At that point, it is safe to modify non-volatile registers -- this is the ; point at which the context is applied, save the machine frame. ; ; After that, through another fallthrough, the frame is transformed into ; a `catch_fr`, which is significantly smaller. `catch_info` and the machine ; frame stay in the same place. The exception object's copy constructor and ; then the catch handler funclet are called on top of this smaller stack. ; ; The stack looks like this. ; ; /---------------------------\ ; | catch funclet | ; +---------------------------+ ; | __cxx_call_catch_handler | ; | | ; | catch_fr: | ; | 0x00: red zone | ; | 0x20: machine frame | ; | 0x48: catch info | ; | 0x68: contents of the | ; | unwound frames, | ; | including the live | ; | exception object | ; +---------------------------+ ; | some other funclet | ; +---------------------------+ ; | | ; ; The catch funclet returns the address at which the execution should continue ; in the lower frame. We therefore update the `rip` in the machine frame ; and then `iretq`. This leaves the stack in the following state. ; ; /---------------------------\ ; | some other funclet | ; +---------------------------+ ; | | throw_fr struct p1 qword ? p2 qword ? p3 qword ? p4 qword ? $xmm6 oword ? ; 0x40 $xmm7 oword ? ; 0x50 $xmm8 oword ? ; 0x60 $xmm9 oword ? ; 0x70 $xmm10 oword ? ; 0x80 $xmm11 oword ? ; 0x90 $xmm12 oword ? ; 0xa0 $xmm13 oword ? ; 0xb0 $xmm14 oword ? ; 0xc0 $padding1 qword ? ; 0xd0 $dummy_rsp qword ? ; 0xd8, used in _CONTEXT: 0x98 $xmm15 oword ? ; 0xf0 $rbx qword ? ; 0x00 $rbp qword ? ; 0x08 $rsi qword ? ; 0x10 $rdi qword ? ; 0x18 $r12 qword ? ; 0x20 $r13 qword ? ; 0x28 $r14 qword ? ; 0x30 $r15 qword ? ; 0x38 $padding2 qword ? ; 0x40 $dummy_rip qword ? ; 0x48, used in _CONTEXT: 0xf8 $rip qword ? $cs qword ? eflags qword ? $rsp qword ? $ss qword ? catch_info catch_info_t <> throw_fr ends catch_fr struct p1 qword ? p2 qword ? p3 qword ? p4 qword ? $rip qword ? $cs qword ? eflags qword ? $rsp qword ? $ss qword ? catch_info catch_info_t <> catch_fr ends .code __NLG_Return2 proc public ret __NLG_Return2 endp __NLG_Dispatch2 proc public ret __NLG_Dispatch2 endp _CxxThrowException proc public frame: __cxx_seh_frame_handler ; We receive two arguments, the pointer to the exception object ; and a const pointer to `cxx_throw_info`. In case of a rethrow, ; both of these are null. ; ; We need to ; ; * walk the stack in the search of a catch handler, ; * unwind the frames along the way, ; * construct the catch variable for the handler (if any), ; * call the handler, and ; * destroy the exception object, unless another frame owns it. ; ; Most of the work is done by `__cxx_dispatch_exception`, which unwinds ; the stack and fills in a catch info structure containing ; everything we need to construct the catch var, call the handler, ; and destroy the exception object. ; ; We must capture our caller's non-volatile context, then reapply it ; after it is modified by the dispatcher. ; ; The layout of `throw_fr` is purpusfully made to contain a machine context ; so that we can `iretq` to free the stack while keeping the .pdata-based ; callstack valid at every point during the exception handling. mov r10, [rsp] lea r11, [rsp + 8] sub rsp, (sizeof throw_fr) - throw_fr.catch_info .allocstack (sizeof throw_fr) - throw_fr.catch_info ; We'll be filling the frame gradually to keep rsp offsets small ; and thus to keep the opcodes small. mov eax, ss push rax .allocstack 8 push r11 .allocstack 8 pushfq .allocstack 8 mov eax, cs push rax .allocstack 8 push r10 .allocstack 8 sub rsp, 16 ; Skipping dummy_rip and padding2 .allocstack 16 push r15 .allocstack 8 push r14 .allocstack 8 push r13 .allocstack 8 push r12 .allocstack 8 push rdi .allocstack 8 push rsi .allocstack 8 push rbp .allocstack 8 push rbx .allocstack 8 sub rsp, throw_fr.$rbx .allocstack throw_fr.$rbx .endprolog ; We index via `rax`, which points into the middle of the xmm context. ; This makes the offset fit in a signed byte, making the opcodes shorter. base = throw_fr.$xmm11 lea rax, [rsp + base] movdqa [rax - base + throw_fr.$xmm6], xmm6 movdqa [rax - base + throw_fr.$xmm7], xmm7 movdqa [rax - base + throw_fr.$xmm8], xmm8 movdqa [rax - base + throw_fr.$xmm9], xmm9 movdqa [rax - base + throw_fr.$xmm10], xmm10 movdqa [rax - base + throw_fr.$xmm11], xmm11 movdqa [rax - base + throw_fr.$xmm12], xmm12 movdqa [rax - base + throw_fr.$xmm13], xmm13 movdqa [rax - base + throw_fr.$xmm14], xmm14 movdqa [rax - base + throw_fr.$xmm15], xmm15 ; The dispatcher walks the function frames on the stack and looks for ; the C++ catch handler. During the walk it unwinds the frames. ; If the handler is not found, the dispatcher MUST never return, ; it should assert or bugcheck or whatever. ; ; Once the target frame is found and potentially partially unwound, ; the dispatcher will construct the catch variable, if any. ; ; The function should be marked `noexcept` to make sure that a throw ; in one of the destructors causes `std::terminate`, instead of ; unwinding already unwound frames. ; ; The dispatcher receives as arguments ; ; * the pointer to the exception object to throw, ; * the pointer to read-only `cxx_throw_info` structure, ; * the pointer to the throw frame object we just partially filled in. ; ; Note that nothing except for the captured context is initialized. ; ; Here, `rcx` and `rdx` are already filled by our caller. lea r8, [rsp] call __cxx_dispatch_exception ; Here, `rax` contains the address of the catch handler funclet we'll be ; calling later. We eventually need to move it to `rcx` for NLG notification ; and it makes sense to do it here, since we need at least one more ; instruction in this .pdata context. mov rcx, rax ; Now that the dispatcher returned, the non-volatile context should be ; modified to that of the catcher's frame and all the fields should be ; filled in. We can now reclain some stack space, but we must keep ; the exception object, which lives in the thrower's frame, alive. ; Since the thrower is right below us, the best we can do is make our own ; stack smaller. ; ; As such, we now immediately apply the non-volatile context and ; free it from the stack, except for the machine frame. Given our .pdata ; context, we mustn't modify non-volatile registers here. Instead, we fall ; through to another funclet with a different .pdata setup. _CxxThrowException endp __cxx_eh_apply_context proc private frame: __cxx_seh_frame_handler ; This function expects its frame to have already been allocated and that ; essentially means that it shouldn't really be called. ; ; The .pdata for this function is setup so that the non-volatile context ; filled in by the previous funclet is considered when walking the stack. ; Through `.pushframe`, all stack frames above the catcher's become ; part of our frame. All exceptions thrown from now on will not ; unwind any unwound frames again. Futhermore, we can write ; into the non-volatile registers without it affecting the callstack. .pushframe .pushreg r15 .pushreg r14 .pushreg r13 .pushreg r12 .pushreg rdi .pushreg rsi .pushreg rbp .pushreg rbx .allocstack throw_fr.$rbx .savexmm128 xmm6, throw_fr.$xmm6 .savexmm128 xmm7, throw_fr.$xmm7 .savexmm128 xmm8, throw_fr.$xmm8 .savexmm128 xmm9, throw_fr.$xmm9 .savexmm128 xmm10, throw_fr.$xmm10 .savexmm128 xmm11, throw_fr.$xmm11 .savexmm128 xmm12, throw_fr.$xmm12 .savexmm128 xmm13, throw_fr.$xmm13 .savexmm128 xmm14, throw_fr.$xmm14 .savexmm128 xmm15, throw_fr.$xmm15 .endprolog base = throw_fr.$xmm11 lea rax, [rsp + base] movdqa xmm6, [rax - base + throw_fr.$xmm6] movdqa xmm7, [rax - base + throw_fr.$xmm7] movdqa xmm8, [rax - base + throw_fr.$xmm8] movdqa xmm9, [rax - base + throw_fr.$xmm9] movdqa xmm10, [rax - base + throw_fr.$xmm10] movdqa xmm11, [rax - base + throw_fr.$xmm11] movdqa xmm12, [rax - base + throw_fr.$xmm12] movdqa xmm13, [rax - base + throw_fr.$xmm13] movdqa xmm14, [rax - base + throw_fr.$xmm14] movdqa xmm15, [rax - base + throw_fr.$xmm15] base = throw_fr.$rdi lea rax, [rax + base - throw_fr.$xmm11] mov rbx, [rax - base + throw_fr.$rbx] mov rbp, [rax - base + throw_fr.$rbp] mov rsi, [rax - base + throw_fr.$rsi] mov rdi, [rax - base + throw_fr.$rdi] mov r12, [rax - base + throw_fr.$r12] mov r13, [rax - base + throw_fr.$r13] mov r14, [rax - base + throw_fr.$r14] mov r15, [rax - base + throw_fr.$r15] ; The following instruction will turn `throw_fr` into `catch_fr`, ; essentially removing the non-volatile context, which has already been ; applied, from the stack. Since we're moving the frame pointer, we must ; change .pdata again. lea rsp, [rax - base + (sizeof throw_fr) - (sizeof catch_fr)] __cxx_eh_apply_context endp __cxx_call_catch_handler proc public frame: __cxx_call_catch_frame_handler .pushframe .allocstack catch_fr.$rip .endprolog ; We now have a small frame, so we can call the handler. Everything can ; throw now and our frame handler must be ready to free the exception ; object if it happens. ; ; It's unclear why the handler expects the frame pointer in `rdx` rather ; than `rcx`. The Microsoft's implementation leave the handler's function ; pointer in `rcx`, so we're going to follow suit, just to be sure. mov rdx, [rsp + catch_fr.catch_info.primary_frame_ptr] mov r8, 1 call __NLG_Dispatch2 call rcx call __NLG_Return2 ; The handler returns the continuation address. Apply it to the machine ; frame; this changes the callstack. cmp rax, 1 ja _direct_continuation_address mov rax, [rsp + catch_fr.catch_info.cont_addr_0 + 8*rax] _direct_continuation_address: mov [rsp + catch_fr.$rip], rax mov rcx, rax mov rdx, [rsp + catch_fr.catch_info.primary_frame_ptr] mov r8, 2 call __NLG_Dispatch2 ; One more change of the current .pdata entry. Although ; `__cxx_destroy_exception` is noexcept, we don't want any rethrow ; probes to look at our frame while the exception object is being ; destroyed. __cxx_call_catch_handler endp __cxx_call_exception_destructor proc private frame: __cxx_seh_frame_handler .pushframe .allocstack catch_fr.$rip .endprolog ; Now destroy the exception object. lea rcx, [rsp + catch_fr.catch_info] call __cxx_destroy_exception ; We'd love to iretq here, but as usual, the deallocation of our frame ; moves `rsp` and `iretq` can't be in the function's epilog. ; One last switch of the .pdata context is necessary. add rsp, catch_fr.$rip __cxx_call_exception_destructor endp __cxx_continue_after_exception proc frame: __cxx_seh_frame_handler .pushframe .endprolog iretq __cxx_continue_after_exception endp end
Data/ships/Boa.asm
TinfoilAsteroid/EliteNext
9
5325
<reponame>TinfoilAsteroid/EliteNext<gh_stars>1-10 Boa: DB $05 DW $1324 DW BoaEdges DB BoaEdgesSize DB $00, $26 DB BoaVertSize /6 DB BoaVertSize DB BoaEdgesCnt DB $00, $00 DB BoaNormalsSize DB $28, $FA, $18 DW BoaNormals DB $00, $1C DW BoaVertices DB 0,0 ; Type and Tactics DB ShipCanAnger BoaVertices: DB $00, $00, $5D, $1F, $FF, $FF ; 01 DB $00, $28, $57, $38, $02, $33 ; 02 DB $26, $19, $63, $78, $01, $44 ; 03 DB $26, $19, $63, $F8, $12, $55 ; 04 DB $26, $28, $3B, $BF, $23, $69 ; 05 DB $26, $28, $3B, $3F, $03, $6B ; 06 DB $3E, $00, $43, $3F, $04, $8B ; 07 DB $18, $41, $4F, $7F, $14, $8A ; 08 DB $18, $41, $4F, $FF, $15, $7A ; 09 DB $3E, $00, $43, $BF, $25, $79 ; 10 DB $00, $07, $6B, $36, $02, $AA ; 11 DB $0D, $09, $6B, $76, $01, $AA ; 12 DB $0D, $09, $6B, $F6, $12, $CC ; 13 BoaVertSize: equ $ - BoaVertices BoaEdges: DB $1F, $6B, $00, $14 DB $1F, $8A, $00, $1C DB $1F, $79, $00, $24 DB $1D, $69, $00, $10 DB $1D, $8B, $00, $18 DB $1D, $7A, $00, $20 DB $1F, $36, $10, $14 DB $1F, $0B, $14, $18 DB $1F, $48, $18, $1C DB $1F, $1A, $1C, $20 DB $1F, $57, $20, $24 DB $1F, $29, $10, $24 DB $18, $23, $04, $10 DB $18, $03, $04, $14 DB $18, $25, $0C, $24 DB $18, $15, $0C, $20 DB $18, $04, $08, $18 DB $18, $14, $08, $1C DB $16, $02, $04, $28 DB $16, $01, $08, $2C DB $16, $12, $0C, $30 DB $0E, $0C, $28, $2C DB $0E, $1C, $2C, $30 DB $0E, $2C, $30, $28 BoaEdgesSize: equ $ - BoaEdges BoaEdgesCnt: equ BoaEdgesSize/4 BoaNormals: DB $3F, $2B, $25, $3C DB $7F, $00, $2D, $59 DB $BF, $2B, $25, $3C DB $1F, $00, $28, $00 DB $7F, $3E, $20, $14 DB $FF, $3E, $20, $14 DB $1F, $00, $17, $06 DB $DF, $17, $0F, $09 DB $5F, $17, $0F, $09 DB $9F, $1A, $0D, $0A DB $5F, $00, $1F, $0C DB $1F, $1A, $0D, $0A BoaNormalsSize: equ $ - BoaNormals BoaLen: equ $ - Boa
test/Succeed/CoinductiveAfterEvaluation.agda
alhassy/agda
3
4501
<gh_stars>1-10 module CoinductiveAfterEvaluation where open import Common.Coinduction data Functor : Set where Id : Functor _·_ : Functor → Set → Set Id · A = A data ν (F : Functor) : Set where inn : ∞ (F · ν F) → ν F -- Evaluation is required to see that Id · ν Id is a coinductive type. foo : ∀ F → F · ν F foo Id = inn (♯ foo Id)
Transynther/x86/_processed/AVXALIGN/_ht_/i9-9900K_12_0xca.log_21829_21.asm
ljhsiun2/medusa
9
163638
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r12 push %r14 push %r15 push %r8 push %r9 push %rcx push %rdi push %rsi lea addresses_D_ht+0x1d4a7, %r15 dec %rdi movw $0x6162, (%r15) nop nop nop and %r9, %r9 lea addresses_A_ht+0xd4a7, %rsi nop nop nop nop nop cmp %r8, %r8 mov (%rsi), %r14 xor $32179, %r15 lea addresses_WT_ht+0x3ca7, %r8 nop nop nop nop add %r12, %r12 mov $0x6162636465666768, %r14 movq %r14, %xmm6 movups %xmm6, (%r8) add %r8, %r8 lea addresses_normal_ht+0x1777, %rdi nop nop nop dec %r9 mov $0x6162636465666768, %r14 movq %r14, %xmm7 movups %xmm7, (%rdi) nop nop nop nop nop and $63864, %r9 lea addresses_A_ht+0x92a7, %rsi lea addresses_normal_ht+0x175f7, %rdi nop nop nop sub %r12, %r12 mov $103, %rcx rep movsw nop nop nop nop sub $55452, %r9 lea addresses_D_ht+0x6e27, %r8 nop nop xor %rcx, %rcx movl $0x61626364, (%r8) nop nop nop nop nop dec %r8 lea addresses_UC_ht+0x1d0e7, %r15 nop nop nop nop add %r8, %r8 mov $0x6162636465666768, %r12 movq %r12, %xmm1 movups %xmm1, (%r15) nop nop nop and %r8, %r8 lea addresses_A_ht+0x4ca7, %rsi nop nop nop nop xor %r8, %r8 mov (%rsi), %r12 nop nop nop nop nop add $48428, %r15 lea addresses_normal_ht+0x110a7, %rsi lea addresses_WT_ht+0x24a7, %rdi inc %r14 mov $117, %rcx rep movsb nop nop add %r15, %r15 lea addresses_WC_ht+0xb5d7, %rdi nop nop nop cmp %r12, %r12 movb (%rdi), %r15b nop nop nop nop dec %r12 lea addresses_WC_ht+0xa8a7, %r14 nop nop nop dec %r15 movw $0x6162, (%r14) nop nop nop nop nop sub %r8, %r8 lea addresses_normal_ht+0x3b07, %r9 nop nop nop nop nop and $57099, %r14 movb $0x61, (%r9) nop nop and $60378, %r14 pop %rsi pop %rdi pop %rcx pop %r9 pop %r8 pop %r15 pop %r14 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r8 push %rax push %rbx // Faulty Load mov $0x4a7, %r10 nop nop nop nop add $11944, %r11 vmovntdqa (%r10), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $1, %xmm2, %rbx lea oracles, %r11 and $0xff, %rbx shlq $12, %rbx mov (%r11,%rbx,1), %rbx pop %rbx pop %rax pop %r8 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_P', 'same': False, 'AVXalign': False, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 32, 'NT': True, 'type': 'addresses_P', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 2, 'NT': True, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 4}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 6}} {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 9}, 'dst': {'same': True, 'type': 'addresses_WT_ht', 'congruent': 10}} {'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 9}} {'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 5}} {'44': 21829} 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 */
Transynther/x86/_processed/AVXALIGN/_ht_zr_/i9-9900K_12_0xca.log_13046_809.asm
ljhsiun2/medusa
9
87978
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x18ee8, %rdx sub $24792, %rbp mov $0x6162636465666768, %r14 movq %r14, %xmm2 movups %xmm2, (%rdx) nop nop nop nop nop dec %r13 lea addresses_D_ht+0x12268, %rsi nop nop nop sub $9695, %r14 mov (%rsi), %ax nop cmp %rax, %rax lea addresses_A_ht+0xa8e8, %rsi nop nop nop nop nop xor %rax, %rax vmovups (%rsi), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %r13 nop nop nop nop sub $21616, %rsi lea addresses_A_ht+0x5868, %rsi lea addresses_UC_ht+0x193b8, %rdi nop nop nop nop nop sub %r13, %r13 mov $117, %rcx rep movsb nop inc %r13 lea addresses_UC_ht+0x16528, %rsi lea addresses_normal_ht+0x1c5c8, %rdi clflush (%rdi) nop nop add $14361, %rax mov $78, %rcx rep movsl nop nop nop nop inc %rax lea addresses_WC_ht+0x10b68, %rax nop dec %rdx movw $0x6162, (%rax) nop sub %r13, %r13 lea addresses_A_ht+0x15aa8, %rsi lea addresses_D_ht+0x1c968, %rdi nop cmp $57095, %rax mov $5, %rcx rep movsq nop nop nop xor $32209, %r14 lea addresses_normal_ht+0x8068, %rsi lea addresses_A_ht+0x189c8, %rdi nop nop nop nop xor $12295, %rbp mov $82, %rcx rep movsl nop nop nop sub %rcx, %rcx lea addresses_A_ht+0x18f28, %rsi lea addresses_WT_ht+0x1a2e8, %rdi nop cmp %r13, %r13 mov $32, %rcx rep movsq xor $28800, %r13 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r9 push %rbp push %rbx push %rdx // Store lea addresses_UC+0x1d7e8, %rdx nop nop nop inc %r9 mov $0x5152535455565758, %rbp movq %rbp, (%rdx) nop nop nop nop nop inc %rdx // Store lea addresses_US+0x6728, %r10 nop nop nop and $33281, %rdx movl $0x51525354, (%r10) nop nop nop nop nop add %r9, %r9 // Store lea addresses_WT+0x17d68, %r10 nop nop nop nop add $32336, %r14 mov $0x5152535455565758, %rbp movq %rbp, %xmm1 movups %xmm1, (%r10) nop add $45444, %rbx // Store mov $0x1313510000000848, %rbp nop nop and $20296, %rdx movl $0x51525354, (%rbp) nop nop nop nop inc %r10 // Store lea addresses_A+0x14028, %r9 cmp %r10, %r10 movw $0x5152, (%r9) nop nop nop and %r9, %r9 // Faulty Load mov $0x218b3000000008e8, %rdx nop nop nop inc %rbx vmovntdqa (%rdx), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $0, %xmm7, %r14 lea oracles, %rbx and $0xff, %r14 shlq $12, %r14 mov (%rbx,%r14,1), %r14 pop %rdx pop %rbx pop %rbp pop %r9 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_UC', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 6}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 4}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': True, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 6}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 32, 'NT': True, 'type': 'addresses_NC', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 7}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': True, 'AVXalign': False, 'congruent': 8}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 7}, 'dst': {'same': True, 'type': 'addresses_UC_ht', 'congruent': 2}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 6}, 'dst': {'same': True, 'type': 'addresses_normal_ht', 'congruent': 5}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 3}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 5}, 'dst': {'same': True, 'type': 'addresses_D_ht', 'congruent': 7}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 5}} {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 9}} {'44': 2127, '45': 9204, '00': 1715} 00 00 00 45 45 45 45 45 45 45 00 45 44 45 00 45 45 44 00 45 45 44 45 00 45 00 45 45 00 45 45 45 44 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 44 45 00 44 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 00 45 00 45 45 45 00 45 45 44 45 45 45 00 45 44 00 44 45 45 00 45 00 44 00 45 45 44 45 45 45 45 44 45 44 45 45 44 45 44 45 00 45 45 44 45 44 00 45 45 45 44 45 45 45 44 45 45 45 44 45 44 45 44 45 45 45 44 45 45 45 45 45 45 45 45 45 44 44 44 45 45 45 44 45 00 44 45 45 45 45 45 45 00 45 00 44 45 45 00 00 44 45 45 00 45 00 45 45 44 45 00 45 45 45 45 45 45 00 45 00 44 45 44 00 45 00 45 45 45 45 45 44 45 45 00 44 45 45 45 45 00 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 44 45 45 45 44 45 45 45 45 45 45 45 44 45 45 00 45 45 44 45 44 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 44 45 44 44 44 45 45 44 45 00 45 45 45 44 45 45 45 45 44 00 45 45 44 45 44 00 45 45 45 45 00 45 45 45 45 00 45 45 45 00 45 45 45 45 45 45 45 44 44 45 45 00 45 45 00 00 45 45 45 45 45 00 45 44 45 45 45 45 45 00 45 45 45 45 45 45 45 00 45 44 45 45 00 45 45 00 45 45 45 00 45 45 45 45 45 44 00 45 44 45 45 44 45 44 00 45 00 45 45 45 45 45 45 45 45 45 45 00 45 44 45 45 45 45 44 45 45 45 45 45 45 44 44 45 45 44 45 45 00 45 45 44 45 45 00 45 45 45 45 45 44 45 45 00 44 45 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 45 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 44 00 45 45 45 45 45 00 45 45 45 45 45 45 45 45 44 45 45 44 00 45 44 44 45 44 45 45 45 45 45 45 45 45 45 45 45 45 45 45 44 00 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 44 45 44 00 45 45 00 45 45 00 45 45 45 44 45 44 45 45 45 45 44 45 00 45 45 00 44 44 45 00 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 44 45 44 00 44 45 00 45 44 45 45 44 45 45 00 45 45 45 45 45 45 45 45 45 45 44 45 45 45 44 45 45 45 45 45 00 45 45 45 45 45 00 45 45 45 00 45 45 44 45 45 45 45 45 45 44 00 45 45 45 44 45 45 45 00 45 45 45 45 45 45 45 00 45 45 45 45 45 45 44 45 00 45 45 45 45 00 44 45 45 00 45 45 45 45 45 45 45 00 45 45 45 44 45 45 45 45 44 45 45 45 44 00 45 45 45 44 00 00 44 44 45 00 00 00 45 45 45 45 45 44 45 44 00 45 00 44 45 45 44 44 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 44 45 00 44 45 00 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 44 45 45 45 45 44 45 45 45 45 45 45 45 44 45 00 45 44 45 45 45 45 45 45 45 45 00 44 45 45 45 45 45 45 45 45 45 44 00 00 45 45 45 00 45 45 45 44 44 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 44 45 44 44 45 45 45 45 45 45 45 45 45 45 45 44 45 45 00 45 45 45 45 44 45 44 44 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 44 45 45 00 45 45 45 45 00 45 45 45 44 45 45 45 45 44 45 00 45 45 45 45 45 45 45 45 45 45 44 45 45 44 45 00 45 00 45 44 00 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 00 00 45 45 45 45 00 00 45 45 45 00 45 00 45 45 44 45 45 45 45 45 45 45 45 44 45 45 44 45 00 45 00 45 45 45 45 45 45 00 45 45 45 45 */
libsrc/interrupts/common/tick_count_isr.asm
Frodevan/z88dk
640
84995
<reponame>Frodevan/z88dk ; Simple tick timer, designed to be called from the interrupt SECTION code_clib PUBLIC tick_count_isr PUBLIC _tick_count_isr PUBLIC tick_count PUBLIC _tick_count ; Increments a tick on each call ; Uses: hl, a tick_count_isr: _tick_count_isr: ld hl,tick_count inc (hl) ret nz inc hl inc (hl) ret nz inc hl inc (hl) ret nz inc hl inc (hl) ret SECTION bss_clib _tick_count: tick_count: defs 4
src/L/Base/Sigma/Properties.agda
borszag/smallib
0
15227
module L.Base.Sigma.Properties where open import L.Base.Sigma.Core choice : ∀{a b c} {A : Set a} {B : Set b} → {C : A → B → Set c} → ((x : A) → Σ B (λ y → C x y)) → Σ (A → B) (λ f → (a : A) → C a (f a)) choice = λ F → ((λ x → fst (F x)) , λ a → snd (F a))
src/config.adb
thindil/steamsky
80
14786
-- Copyright 2016-2021 <NAME> -- -- This file is part of Steam Sky. -- -- Steam Sky is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- Steam Sky is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>. with Ada.Directories; with Ada.Text_IO; use Ada.Text_IO; with Game; use Game; package body Config is procedure Load_Config is Config_File: File_Type; Raw_Data, Field_Name, Value: Unbounded_String := Null_Unbounded_String; Equal_Index: Natural := 0; function Load_Boolean return Boolean is begin if Value = To_Unbounded_String(Source => "Yes") then return True; end if; return False; end Load_Boolean; begin New_Game_Settings := Default_New_Game_Settings; Game_Settings := Default_Game_Settings; Open (File => Config_File, Mode => In_File, Name => To_String(Source => Save_Directory) & "game.cfg"); Read_Config_File_Loop : while not End_Of_File(File => Config_File) loop Raw_Data := To_Unbounded_String(Source => Get_Line(File => Config_File)); if Length(Source => Raw_Data) = 0 then goto End_Of_Loop; end if; Equal_Index := Index(Source => Raw_Data, Pattern => "="); Field_Name := Head(Source => Raw_Data, Count => Equal_Index - 2); Value := Tail (Source => Raw_Data, Count => Length(Source => Raw_Data) - Equal_Index - 1); if Field_Name = To_Unbounded_String(Source => "PlayerName") then New_Game_Settings.Player_Name := Value; elsif Field_Name = To_Unbounded_String(Source => "PlayerGender") then New_Game_Settings.Player_Gender := Element(Source => Value, Index => 1); elsif Field_Name = To_Unbounded_String(Source => "ShipName") then New_Game_Settings.Ship_Name := Value; elsif Field_Name = To_Unbounded_String(Source => "PlayerFaction") then New_Game_Settings.Player_Faction := Value; elsif Field_Name = To_Unbounded_String(Source => "PlayerCareer") then New_Game_Settings.Player_Career := Value; elsif Field_Name = To_Unbounded_String(Source => "StartingBase") then New_Game_Settings.Starting_Base := Value; elsif Field_Name = To_Unbounded_String(Source => "EnemyDamageBonus") then New_Game_Settings.Enemy_Damage_Bonus := Bonus_Type'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "PlayerDamageBonus") then New_Game_Settings.Player_Damage_Bonus := Bonus_Type'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "EnemyMeleeDamageBonus") then New_Game_Settings.Enemy_Melee_Damage_Bonus := Bonus_Type'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "PlayerMeleeDamageBonus") then New_Game_Settings.Player_Melee_Damage_Bonus := Bonus_Type'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "ExperienceBonus") then New_Game_Settings.Experience_Bonus := Bonus_Type'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "ReputationBonus") then New_Game_Settings.Reputation_Bonus := Bonus_Type'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "UpgradeCostBonus") then New_Game_Settings.Upgrade_Cost_Bonus := Bonus_Type'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "PricesBonus") then New_Game_Settings.Prices_Bonus := Bonus_Type'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "DifficultyLevel") then if To_String(Source => Value) in "VERY_EASY" | "EASY" | "NORMAL" | "HARD" | "VERY_HARD" | "CUSTOM" then New_Game_Settings.Difficulty_Level := Difficulty_Type'Value(To_String(Source => Value)); else New_Game_Settings.Difficulty_Level := Default_Difficulty_Type; end if; elsif Field_Name = To_Unbounded_String(Source => "AutoRest") then Game_Settings.Auto_Rest := Load_Boolean; elsif Field_Name = To_Unbounded_String(Source => "UndockSpeed") then Game_Settings.Undock_Speed := Ship_Speed'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "AutoCenter") then Game_Settings.Auto_Center := Load_Boolean; elsif Field_Name = To_Unbounded_String(Source => "AutoReturn") then Game_Settings.Auto_Return := Load_Boolean; elsif Field_Name = To_Unbounded_String(Source => "AutoFinish") then Game_Settings.Auto_Finish := Load_Boolean; elsif Field_Name = To_Unbounded_String(Source => "LowFuel") then Game_Settings.Low_Fuel := Positive'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "LowDrinks") then Game_Settings.Low_Drinks := Positive'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "LowFood") then Game_Settings.Low_Food := Positive'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "AutoMoveStop") then Game_Settings.Auto_Move_Stop := Auto_Move_Break'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "WindowWidth") then Game_Settings.Window_Width := Positive'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "WindowHeight") then Game_Settings.Window_Height := Positive'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "MessagesLimit") then Game_Settings.Messages_Limit := Positive'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "SavedMessages") then Game_Settings.Saved_Messages := Positive'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "HelpFontSize") then Game_Settings.Help_Font_Size := Positive'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "MapFontSize") then Game_Settings.Map_Font_Size := Positive'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "InterfaceFontSize") then Game_Settings.Interface_Font_Size := Positive'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "InterfaceTheme") then Game_Settings.Interface_Theme := Value; elsif Field_Name = To_Unbounded_String(Source => "MessagesOrder") then Game_Settings.Messages_Order := Messages_Order_Type'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "AutoAskForBases") then Game_Settings.Auto_Ask_For_Bases := Load_Boolean; elsif Field_Name = To_Unbounded_String(Source => "AutoAskForEvents") then Game_Settings.Auto_Ask_For_Events := Load_Boolean; elsif Field_Name = To_Unbounded_String(Source => "ShowTooltips") then Game_Settings.Show_Tooltips := Load_Boolean; elsif Field_Name = To_Unbounded_String(Source => "ShowLastMessages") then Game_Settings.Show_Last_Messages := Load_Boolean; elsif Field_Name = To_Unbounded_String(Source => "MessagesPosition") then Game_Settings.Messages_Position := Natural'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "FullScreen") then Game_Settings.Full_Screen := Load_Boolean; elsif Field_Name = To_Unbounded_String(Source => "AutoCloseMessagesTime") then Game_Settings.Auto_Close_Messages_Time := Positive'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "AutoSave") then Game_Settings.Auto_Save := Auto_Save_Type'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "TopicsPosition") then Game_Settings.Topics_Position := Natural'Value(To_String(Source => Value)); elsif Field_Name = To_Unbounded_String(Source => "ShowNumbers") then Game_Settings.Show_Numbers := Load_Boolean; elsif Field_Name = To_Unbounded_String(Source => "RightButton") then Game_Settings.Right_Button := Load_Boolean; elsif Field_Name = To_Unbounded_String(Source => "ListsLimit") then Game_Settings.Lists_Limit := Positive'Value(To_String(Source => Value)); end if; <<End_Of_Loop>> end loop Read_Config_File_Loop; Close(File => Config_File); exception when Ada.Directories.Name_Error => null; end Load_Config; procedure Save_Config is Config_File: File_Type; procedure Save_Boolean(Value: Boolean; Name: String) is begin if Value then Put_Line(File => Config_File, Item => Name & " = Yes"); else Put_Line(File => Config_File, Item => Name & " = No"); end if; end Save_Boolean; begin Create (File => Config_File, Mode => Append_File, Name => To_String(Source => Save_Directory) & "game.cfg"); Put_Line (File => Config_File, Item => "PlayerName = " & To_String(Source => New_Game_Settings.Player_Name)); Put_Line (File => Config_File, Item => "PlayerGender = " & New_Game_Settings.Player_Gender); Put_Line (File => Config_File, Item => "ShipName = " & To_String(Source => New_Game_Settings.Ship_Name)); Put_Line (File => Config_File, Item => "PlayerFaction = " & To_String(Source => New_Game_Settings.Player_Faction)); Put_Line (File => Config_File, Item => "PlayerCareer = " & To_String(Source => New_Game_Settings.Player_Career)); Put_Line (File => Config_File, Item => "StartingBase = " & To_String(Source => New_Game_Settings.Starting_Base)); Put_Line (File => Config_File, Item => "EnemyDamageBonus =" & Bonus_Type'Image(New_Game_Settings.Enemy_Damage_Bonus)); Put_Line (File => Config_File, Item => "PlayerDamageBonus =" & Bonus_Type'Image(New_Game_Settings.Player_Damage_Bonus)); Put_Line (File => Config_File, Item => "EnemyMeleeDamageBonus =" & Bonus_Type'Image(New_Game_Settings.Enemy_Melee_Damage_Bonus)); Put_Line (File => Config_File, Item => "PlayerMeleeDamageBonus =" & Bonus_Type'Image(New_Game_Settings.Player_Melee_Damage_Bonus)); Put_Line (File => Config_File, Item => "ExperienceBonus =" & Bonus_Type'Image(New_Game_Settings.Experience_Bonus)); Put_Line (File => Config_File, Item => "ReputationBonus =" & Bonus_Type'Image(New_Game_Settings.Reputation_Bonus)); Put_Line (File => Config_File, Item => "UpgradeCostBonus =" & Bonus_Type'Image(New_Game_Settings.Upgrade_Cost_Bonus)); Put_Line (File => Config_File, Item => "PricesBonus =" & Bonus_Type'Image(New_Game_Settings.Prices_Bonus)); Put_Line (File => Config_File, Item => "DifficultyLevel = " & Difficulty_Type'Image(New_Game_Settings.Difficulty_Level)); Save_Boolean(Value => Game_Settings.Auto_Rest, Name => "AutoRest"); Put_Line (File => Config_File, Item => "UndockSpeed = " & Ship_Speed'Image(Game_Settings.Undock_Speed)); Save_Boolean(Value => Game_Settings.Auto_Center, Name => "AutoCenter"); Save_Boolean(Value => Game_Settings.Auto_Return, Name => "AutoReturn"); Save_Boolean(Value => Game_Settings.Auto_Finish, Name => "AutoFinish"); Put_Line (File => Config_File, Item => "LowFuel =" & Positive'Image(Game_Settings.Low_Fuel)); Put_Line (File => Config_File, Item => "LowDrinks =" & Positive'Image(Game_Settings.Low_Drinks)); Put_Line (File => Config_File, Item => "LowFood =" & Positive'Image(Game_Settings.Low_Food)); Put_Line (File => Config_File, Item => "AutoMoveStop = " & Auto_Move_Break'Image(Game_Settings.Auto_Move_Stop)); Put_Line (File => Config_File, Item => "WindowWidth =" & Positive'Image(Game_Settings.Window_Width)); Put_Line (File => Config_File, Item => "WindowHeight =" & Positive'Image(Game_Settings.Window_Height)); Put_Line (File => Config_File, Item => "MessagesLimit =" & Positive'Image(Game_Settings.Messages_Limit)); Put_Line (File => Config_File, Item => "SavedMessages =" & Positive'Image(Game_Settings.Saved_Messages)); Put_Line (File => Config_File, Item => "HelpFontSize =" & Positive'Image(Game_Settings.Help_Font_Size)); Put_Line (File => Config_File, Item => "MapFontSize =" & Positive'Image(Game_Settings.Map_Font_Size)); Put_Line (File => Config_File, Item => "InterfaceFontSize =" & Positive'Image(Game_Settings.Interface_Font_Size)); Put_Line (File => Config_File, Item => "InterfaceTheme = " & To_String(Source => Game_Settings.Interface_Theme)); Put_Line (File => Config_File, Item => "MessagesOrder = " & Messages_Order_Type'Image(Game_Settings.Messages_Order)); Save_Boolean (Value => Game_Settings.Auto_Ask_For_Bases, Name => "AutoAskForBases"); Save_Boolean (Value => Game_Settings.Auto_Ask_For_Events, Name => "AutoAskForEvents"); Save_Boolean (Value => Game_Settings.Show_Tooltips, Name => "ShowTooltips"); Save_Boolean (Value => Game_Settings.Show_Last_Messages, Name => "ShowLastMessages"); Put_Line (File => Config_File, Item => "MessagesPosition =" & Natural'Image(Game_Settings.Messages_Position)); Save_Boolean(Value => Game_Settings.Full_Screen, Name => "FullScreen"); Put_Line (File => Config_File, Item => "AutoCloseMessagesTime =" & Positive'Image(Game_Settings.Auto_Close_Messages_Time)); Put_Line (File => Config_File, Item => "AutoSave = " & Auto_Save_Type'Image(Game_Settings.Auto_Save)); Put_Line (File => Config_File, Item => "TopicsPosition =" & Natural'Image(Game_Settings.Topics_Position)); Save_Boolean(Value => Game_Settings.Show_Numbers, Name => "ShowNumbers"); Save_Boolean(Value => Game_Settings.Right_Button, Name => "RightButton"); Put_Line (File => Config_File, Item => "ListsLimit =" & Positive'Image(Game_Settings.Lists_Limit)); Close(File => Config_File); end Save_Config; end Config;
resources/scripts/api/fullhunt.ads
Elon143/Amass
1,823
5921
<reponame>Elon143/Amass -- Copyright 2017-2021 <NAME>. All rights reserved. -- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. local json = require("json") name = "FullHunt" type = "api" function start() set_rate_limit(1) end function vertical(ctx, domain) local resp, err = request(ctx, {['url']=build_url(domain)}) if (err ~= nil and err ~= "") then log(ctx, "vertical request to service failed: " .. err) return end local j = json.decode(resp) if (j == nil or j.hosts == nil or #(j.hosts) == 0) then return end for _, h in pairs(j.hosts) do if (h.domain ~= nil and h.domain == domain and h.host ~= nil and h.host ~= "") then new_name(ctx, h.host) if (h.ip_address ~= nil and h.ip_address ~= "") then new_addr(ctx, h.ip_address, domain) end if (h.dns ~= nil) then if (h.dns.cname ~= nil and #(h.dns.cname) > 0) then names_from_table(ctx, domain, h.dns.cname) end if (h.dns.ptr ~= nil and #(h.dns.ptr) > 0) then names_from_table(ctx, domain, h.dns.ptr) end if (h.dns.a ~= nil and #(h.dns.a) > 0) then addrs_from_table(ctx, domain, h.dns.a) end if (h.dns.aaaa ~= nil and #(h.dns.aaaa) > 0) then addrs_from_table(ctx, domain, h.dns.aaaa) end end end end end function names_from_table(ctx, domain, t) if t == nil then return end for _, name in pairs(t) do if in_scope(ctx, name) then new_name(ctx, name) end end end function addrs_from_table(ctx, domain, t) if t == nil then return end for _, addr in pairs(t) do new_addr(ctx, addr, domain) end end function build_url(domain) return "https://fullhunt.io/api/v1/domain/" .. domain .. "/details" end
src/backends/dummy_platform/output_backend.adb
kqr/qweyboard
33
9227
with Ada.Wide_Wide_Text_IO; package body Output_Backend is package IO renames Ada.Wide_Wide_Text_IO; task body Output is begin accept Ready_Wait; loop select accept Enter (Text : Wide_Wide_String; Continues_Word : Boolean) do IO.Put (if Continues_Word then "" else " "); IO.Put (Text); end Enter; or accept Erase (Amount : Positive) do for I in 1 .. Amount loop IO.Put ("^H"); end loop; end Erase; or accept Shut_Down; exit; end select; end loop; end Output; end Output_Backend;
programs/oeis/267/A267034.asm
karttu/loda
0
18852
<filename>programs/oeis/267/A267034.asm ; A267034: Triangle read by rows giving successive states of cellular automaton generated by "Rule 85" initiated with a single ON (black) cell. ; 1,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 lpb $0,1 add $0,1 mov $2,3 sub $2,$1 mov $1,$2 add $3,2 trn $0,$3 lpe add $0,1 mov $1,$0 trn $1,$2
src/ada/src/comms/uxas-comms-transport-zeromq_socket_configurations.ads
VVCAS-Sean/OpenUxAS
88
7877
<reponame>VVCAS-Sean/OpenUxAS<gh_stars>10-100 with UxAS.Comms.Transport.Socket_Configurations; use UxAS.Comms.Transport.Socket_Configurations; with ZMQ.Sockets; package UxAS.Comms.Transport.ZeroMQ_Socket_Configurations is type ZeroMq_Socket_Configuration is new Socket_Configuration with record Zmq_Socket_Type : ZMQ.Sockets.Socket_Type; Is_Server_Bind : Boolean; Receive_High_Water_Mark : Int32; Send_High_Water_Mark : Int32; Number_Of_IO_Threads : Positive; end record; function Make -- a convenience routine (Network_Name : String; Socket_Address : String; Is_Receive : Boolean; Zmq_Socket_Type : ZMQ.Sockets.Socket_Type; Number_Of_IO_Threads : Positive; Is_Server_Bind : Boolean; Receive_High_Water_Mark : Int32; Send_High_Water_Mark : Int32) return ZeroMq_Socket_Configuration with Pre'Class => Network_Name'Length in 1 .. Max_Network_Name_Length and then Socket_Address'Length in 1 .. Max_Socket_Address_Length; end UxAS.Comms.Transport.ZeroMQ_Socket_Configurations;
programs/oeis/100/A100691.asm
neoneye/loda
22
168
<filename>programs/oeis/100/A100691.asm<gh_stars>10-100 ; A100691: Number of self-avoiding paths with n steps on a triangular lattice in the strip Z x {0,1}. ; 1,4,12,30,70,158,352,780,1724,3806,8398,18526,40864,90132,198796,438462,967062,2132926,4704320,10375708,22884348,50473022,111321758,245527870,541528768,1194379300,2634286476,5810101726,12814582758 seq $0,77852 ; Expansion of (1-x)^(-1)/(1-2*x-x^3). mov $1,$0 add $2,$0 bin $2,$0 mul $2,2 trn $0,$2 add $1,$2 add $0,$1 sub $0,2
Transynther/x86/_processed/NC/_ht_zr_/i7-7700_9_0xca.log_21829_1808.asm
ljhsiun2/medusa
9
8041
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %rax push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0xe48f, %rbp nop nop nop sub %rax, %rax mov (%rbp), %rdi nop nop nop nop sub $25332, %r11 lea addresses_WC_ht+0x134ff, %r10 nop inc %rsi movw $0x6162, (%r10) nop add $30307, %rsi lea addresses_UC_ht+0x1348f, %rax nop nop add %rsi, %rsi movb $0x61, (%rax) cmp $22652, %rsi lea addresses_WC_ht+0x38af, %rsi lea addresses_normal_ht+0x19c93, %rdi nop nop nop add %rbp, %rbp mov $38, %rcx rep movsq nop nop nop nop sub $39237, %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r15 push %r8 push %rbp push %rdx push %rsi // Load lea addresses_WC+0xf0a7, %rsi nop nop nop and %r8, %r8 vmovups (%rsi), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $1, %xmm1, %r15 nop nop nop nop nop inc %r15 // Store lea addresses_UC+0xa6ef, %r13 nop nop sub %r14, %r14 mov $0x5152535455565758, %rdx movq %rdx, %xmm4 vmovups %ymm4, (%r13) nop nop add $26219, %r14 // Store lea addresses_D+0x508f, %rbp nop nop add $27330, %r14 mov $0x5152535455565758, %rsi movq %rsi, %xmm0 vmovups %ymm0, (%rbp) nop nop xor %rbp, %rbp // Faulty Load mov $0x1c0aff0000000c8f, %rdx nop and $45127, %rbp vmovups (%rdx), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $1, %xmm2, %rsi lea oracles, %r13 and $0xff, %rsi shlq $12, %rsi mov (%r13,%rsi,1), %rsi pop %rsi pop %rdx pop %rbp pop %r8 pop %r15 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} {'src': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WC'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_UC'}} {'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_D'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': True, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 4, 'same': True, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}} {'48': 14408, '00': 7421} 00 48 00 00 00 00 00 00 00 48 48 00 48 48 48 48 00 48 48 00 48 48 48 00 48 00 00 48 48 00 48 48 00 00 48 48 48 48 48 48 00 00 48 48 48 00 00 48 00 48 48 48 48 48 48 00 48 48 00 00 48 48 48 00 48 48 00 48 00 48 48 48 48 48 48 00 48 48 00 00 00 48 00 48 48 48 48 00 00 48 48 00 00 48 48 00 48 48 00 48 48 48 48 48 48 48 48 48 00 48 48 48 00 00 48 48 00 00 48 00 48 48 48 00 48 00 00 00 48 48 00 00 48 00 48 00 48 48 00 00 48 48 48 00 48 48 48 00 48 48 48 48 00 48 48 48 48 48 48 48 48 48 48 48 48 48 00 00 48 00 48 00 00 00 00 00 48 00 48 48 00 48 48 48 00 00 00 00 00 00 48 48 00 48 00 48 00 48 48 48 48 00 00 00 00 48 48 48 48 48 48 00 48 00 48 48 00 48 00 48 00 48 48 48 48 48 48 00 48 48 00 48 00 48 48 48 00 00 00 48 48 00 48 48 48 00 48 00 48 48 48 48 48 48 00 48 00 48 00 48 48 48 48 00 00 48 48 00 48 48 00 48 48 48 48 00 48 48 00 48 48 48 48 48 48 00 48 48 00 48 00 48 48 48 00 48 00 48 00 00 00 48 00 48 00 48 48 48 48 48 48 48 48 48 48 00 48 48 48 00 48 00 48 48 48 48 48 48 00 48 48 00 00 48 48 00 48 48 48 00 48 48 48 00 00 00 48 48 48 00 48 48 48 48 48 48 00 00 48 00 48 00 48 48 48 48 48 00 48 48 48 48 48 00 00 00 48 48 48 00 48 00 00 48 00 48 48 48 00 48 00 48 48 48 00 48 48 48 48 00 48 48 48 00 48 00 48 48 00 48 00 00 48 48 00 00 48 48 48 48 00 48 48 48 00 00 00 00 00 48 00 00 48 48 00 00 48 00 48 48 48 48 48 00 48 48 00 48 48 00 00 48 48 48 48 48 00 48 00 48 48 48 00 00 48 48 00 00 48 48 48 00 48 00 48 48 00 48 48 48 48 00 00 00 48 48 48 48 48 00 48 48 00 48 48 48 48 48 48 48 48 48 48 48 48 48 00 48 48 48 00 00 48 48 48 00 48 48 48 48 48 48 00 48 48 48 48 00 48 48 48 48 48 00 48 48 00 48 00 48 48 00 00 48 48 00 00 48 48 48 48 48 00 48 48 48 00 48 48 00 48 48 48 00 48 48 48 48 00 48 48 00 00 48 48 48 48 48 00 00 48 48 00 48 48 00 00 00 00 48 00 48 48 48 00 48 48 48 48 00 48 48 48 48 48 48 48 00 00 48 00 00 48 00 48 48 48 00 48 00 48 48 00 48 48 48 48 00 00 00 00 00 48 00 48 00 00 00 00 00 48 48 48 48 00 00 48 48 00 00 48 00 00 00 48 48 48 00 48 48 00 00 48 48 48 48 48 00 48 48 48 00 48 48 00 48 48 48 48 00 48 48 48 48 48 48 48 00 48 00 00 48 48 00 00 48 48 48 48 00 00 00 00 48 48 00 00 48 00 48 48 48 48 00 48 48 48 48 00 48 48 48 48 00 00 48 48 00 48 00 48 48 48 00 48 48 00 48 00 48 48 00 48 48 48 48 48 48 48 48 48 00 48 48 48 48 48 00 48 00 00 00 00 00 00 00 48 48 00 00 00 48 00 00 48 48 00 48 00 00 48 48 48 48 00 48 00 00 48 48 48 48 48 48 48 48 00 48 00 48 48 48 48 48 48 48 48 00 00 48 00 00 48 48 48 48 48 48 48 48 48 48 48 00 48 00 48 00 48 48 48 48 48 00 48 48 48 48 00 00 00 48 48 00 48 00 00 00 00 48 00 48 48 48 48 48 00 48 00 00 48 00 00 48 00 00 00 48 00 48 00 00 48 48 48 48 48 48 48 00 00 48 48 48 00 00 00 48 48 48 00 48 48 48 48 00 48 48 00 48 00 48 00 48 48 00 00 48 48 48 00 48 48 48 48 48 48 00 00 00 48 00 48 00 00 00 00 48 00 48 48 00 48 48 48 00 48 48 48 48 48 00 48 48 48 48 00 00 48 00 00 48 48 48 48 00 48 48 48 48 00 48 00 48 48 00 00 48 48 48 48 00 00 00 48 48 48 48 48 48 48 48 48 00 00 48 48 48 00 48 48 00 48 48 48 48 48 00 48 48 */
examples/AIM6/Path/MapTm.agda
shlevy/agda
1,989
10552
<filename>examples/AIM6/Path/MapTm.agda module MapTm where open import Prelude open import Star open import Modal open import Examples open import Lambda open Term eq⟶ : {ty : Set}(T : TyAlg ty){σ₁ σ₂ τ₁ τ₂ : ty} -> σ₁ == σ₂ -> τ₁ == τ₂ -> TyAlg._⟶_ T σ₁ τ₁ == TyAlg._⟶_ T σ₂ τ₂ eq⟶ T refl refl = refl mapTm : {ty₁ ty₂ : Set}{T₁ : TyAlg ty₁}{T₂ : TyAlg ty₂} {Γ : List ty₁}{τ : ty₁}(F : T₁ =Ty=> T₂) -> Tm T₁ Γ τ -> Tm T₂ (map _ (TyArrow.apply F) Γ) (TyArrow.apply F τ) mapTm {T₁ = T₁}{T₂}{Γ} F (var x) = var (mapAny (cong (TyArrow.apply F)) x) mapTm {T₁ = T₁}{T₂}{Γ} F zz = subst (\τ -> Tm T₂ (map _ (TyArrow.apply F) Γ) τ) (TyArrow.respNat F) zz mapTm {T₁ = T₁}{T₂}{Γ} F ss = subst Tm₂ (trans (TyArrow.resp⟶ F) (TyArrow.respNat F -eq⟶ TyArrow.respNat F)) ss where _-eq⟶_ = eq⟶ T₂ Tm₂ = Tm T₂ (map _ (TyArrow.apply F) Γ) mapTm {T₂ = T₂}{Γ} F (ƛ t) = subst Tm₂ (TyArrow.resp⟶ F) (ƛ (mapTm F t)) where Tm₂ = Tm T₂ (map _ (TyArrow.apply F) Γ) mapTm {T₂ = T₂}{Γ} F (s $ t) = subst Tm₂ (sym (TyArrow.resp⟶ F)) (mapTm F s) $ mapTm F t where Tm₂ = Tm T₂ (map _ (TyArrow.apply F) Γ)
2021-04-03-smallest-possible-container/asm/constants.asm
huutuanit/dockercomposeexample
181
104849
<gh_stars>100-1000 ;asmttpd - Web server for Linux written in amd64 assembly. ;Copyright (C) 2014 nemasu <<EMAIL>> ; ;This file is part of asmttpd. ; ;asmttpd is free software: you can redistribute it and/or modify ;it under the terms of the GNU General Public License as published by ;the Free Software Foundation, either version 2 of the License, or ;(at your option) any later version. ; ;asmttpd is distributed in the hope that it will be useful, ;but WITHOUT ANY WARRANTY; without even the implied warranty of ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;GNU General Public License for more details. ; ;You should have received a copy of the GNU General Public License ;along with asmttpd. If not, see <http://www.gnu.org/licenses/>. ;Constants %define FD_STDOUT 0x1 %define THREAD_STACK_SIZE 16384 %define SIGCHILD 0x11 ;SIGCHILD signal constant %define SIGHUP 1 ;Hangup (POSIX). %define SIGINT 2 ;Interrupt (ANSI). %define SIGQUIT 3 ;Quit (POSIX). %define SIGPIPE 13;broken pipe %define SIGTERM 15; Default kill signal %define SIGIGN 1;Ignore signal %define SA_RESTORER 0x04000000 ;Required for x86_64 sigaction %define QUEUE_SIZE 40960 ; in bytes, 40960 is about 5120 fds. %define THREAD_BUFFER_SIZE 8192 ; 8KB recv buffer %define URL_LENGTH_LIMIT 2000 %define DIRECTORY_LENGTH_LIMIT 100 ;Request Types %define REQ_UNK 0 %define REQ_GET 1 %define REQ_HEAD 2 ;Flags %define MMAP_PROT_READ 0x1 %define MMAP_PROT_WRITE 0x2 %define MMAP_MAP_PRIVATE 0x2 %define MMAP_MAP_ANON 0x20 %define MMAP_MAP_GROWSDOWN 0x100 %define CLONE_VM 0x100 ;Same memory space %define CLONE_FS 0x200 ;Same file system information %define CLONE_FILES 0x400 ;Share file descriptors %define CLONE_SIGHAND 0x800 ;Share signal handlers %define CLONE_THREAD 0x10000 ;Same thread group ( same process ) %define OPEN_RDONLY 00 %define OPEN_DIRECTORY 0x10000 ; Open will fail if path is not a directory %define AF_INET 2 %define SOCK_STREAM 1 %define PROTO_TCP 6 %define LSEEK_SET 0 ; seek to offset bytes %define LSEEK_END 2 ; seek to end plus offset %define LEVEL_SOL_TCP 1 %define LEVEL_IPPROTO_TCP 6 %define SOCKOPT_TCP_REUSEADDR 2 %define SOCKOPT_TCP_CORK 3 ;Internal Constants %define CONTENT_TYPE_HTML 0 %define CONTENT_TYPE_OCTET_STREAM 1 %define CONTENT_TYPE_CSS 2 %define CONTENT_TYPE_JAVASCRIPT 3 %define CONTENT_TYPE_XHTML 4 %define CONTENT_TYPE_XML 5 %define CONTENT_TYPE_GIF 6 %define CONTENT_TYPE_PNG 7 %define CONTENT_TYPE_JPEG 8 %define CONTENT_TYPE_SVG 9 ;System Call Values %define SYS_WRITE 1 ;int fd, const void *buf, size_t count %define SYS_LSEEK 8 ;int fd, off_t offset, int whence %define SYS_MMAP 9 ;void *addr, size_t length, int prot, int flags, int fd, off_t offset %define SYS_CLONE 56 ;unsigned long clone_flags, unsigned long newsp, void ___user *parent_tid, void __user *child_tid, struct pt_regs *regs %define SYS_EXIT 60 ;int status %define SYS_EXIT_GROUP 231 ;int status %define SYS_NANOSLEEP 35 ;const struct timespec *req, struct timespec *rem %define SYS_RT_SIGACTION 13 ;int sig,const struct sigaction __user * act,struct sigaction __user * oact,size_t sigsetsize %define SYS_SOCKET 41 ;int domain, int type, int protocol %define SYS_ACCEPT 43 ;int sockfd, struct sockaddr *addr, socklen_t *addrlen %define SYS_SENDTO 44 ;int sockfd, const void *buf, size_t len, int flags, ... %define SYS_RECVFROM 45 ;int sockfd, void *buf, size_t len, int flags %define SYS_BIND 49 ;int sockfd, const struct sockaddr *addr, socklen_t addrlen %define SYS_LISTEN 50 ;int sockfd, int backlog %define SYS_SELECT 23 ;int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout %define SYS_GETDENTS 78 ;unsigned int fd, struct linux_dirent *dirp, unsigned int count %define SYS_OPEN 2 ;const char *pathname, int flags, mode_t mode %define SYS_CLOSE 3 ;unsigned int fd %define SYS_SENDFILE 40 ;int out_fd, int in_fd, off_t *offset, size_t count %define SYS_SETSOCKOPT 54; int sockfd, int level, int optname,const void *optval, socklen_t optlen
PIM/TP3_Sous_Programmes/comprendre_mode_parametre.adb
Hathoute/ENSEEIHT
1
29286
<reponame>Hathoute/ENSEEIHT with Ada.Text_IO; use Ada.Text_IO; -- Dans ce programme, les commentaires de spécification -- ont **volontairement** été omis ! procedure Comprendre_Mode_Parametre is function Double (N : in Integer) return Integer is begin return 2 * N; end Double; procedure Incrementer (N : in out Integer) is begin N := N + 1; end Incrementer; procedure Mettre_A_Zero (N : out Integer) is begin N := 0; end Mettre_A_Zero; procedure Comprendre_Les_Contraintes_Sur_L_Appelant is A, B, R : Integer; begin A := 5; -- Indiquer pour chacune des instructions suivantes si elles sont -- acceptées par le compilateur. Si elles sont refusées, expliquer -- pourquoi dans un commentaire sur la ligne. R := Double (A); -- Accepté: Double est une fonction qui admet un 'in integer' et retourne un integer R := Double (10); -- De même, même si 10 est une valeur mais le 'in' autorise ça R := Double (10 * A); -- De même R := Double (B); -- Accepté même si B n'est pas initialisé, B prend la valeur des bits déja presents dans son emplacement dans la memoire. Incrementer (A); -- Accepté: A est une variable Integer et la fonction demande un parametre Integer --Incrementer (10); -- Refusé: Le out de 'Incrementer' refuse qu'une valeur soit passée. --Incrementer (10 * A); -- De même refusé: 10*A est une valeur non pas variable. Incrementer (B); -- Accepté: Même si B n'est pas initialisée mais elle a une valeur aléatoire des bits déja présents dans son emplacement. Mettre_A_Zero (A); -- Accepté: A variable de type Integer et la fonction demande un Integer --Mettre_A_Zero (10); -- Refusé: 10 n'est pas une variable. --Mettre_A_Zero (10 * A); -- Refusé: 10*A n'est pas une variable. Mettre_A_Zero (B); -- Accepté: B variable de type Integer et la fonction demande un Integer end Comprendre_Les_Contraintes_Sur_L_Appelant; procedure Comprendre_Les_Contrainte_Dans_Le_Corps ( A : in Integer; B1, B2 : in out Integer; C1, C2 : out Integer) is L: Integer; begin -- pour chaque affectation suivante indiquer si elle est autorisée L := A; -- Autorisé --A := 1; -- Non autorisé (A en mode in) B1 := 5; -- Autorisé (B1 en mode in out) L := B2; -- Autorisé B2 := B2 + 1; -- Autorisé (mode in ET out) C1 := L; -- Autorisé L := C2; -- Autorisé à partir d'une certaine version de ADA C2 := A; -- Autorisé car C2 en 'out' C2 := C2 + 1; -- Autorisé à partir d'une certaine version de ADA (la lecture de C2 pose ce problème) end Comprendre_Les_Contrainte_Dans_Le_Corps; begin --Comprendre_Mode_Parametre; Comprendre_Les_Contraintes_Sur_L_Appelant; --Put_Line ("Fin"); end Comprendre_Mode_Parametre;
programs/oeis/136/A136315.asm
karttu/loda
1
93334
<filename>programs/oeis/136/A136315.asm ; A136315: Period 10: repeat 1, 2, 3, 6, 5, 0, 7, 4, 9, 8 . ; 1,2,3,6,5,0,7,4,9,8,1,2,3,6,5,0,7,4,9,8,1,2,3,6,5,0,7,4,9,8,1,2,3,6,5,0,7,4,9,8,1,2,3,6,5,0,7,4,9,8,1,2,3,6,5,0,7,4,9,8,1,2,3,6,5,0,7,4,9,8,1,2,3,6,5,0,7,4,9,8 mov $2,$0 add $0,1 mul $0,2 mov $1,$2 mov $3,$2 gcd $3,$0 div $1,$3 mod $1,5 mul $1,2 add $1,$3 sub $1,1
enduser/netmeeting/av/codecs/intel/h261/i386/dx5frmcp.asm
npocmaka/Windows-Server-2003
17
88576
;* ************************************************************************* ;* INTEL Corporation Proprietary Information ;* ;* This listing is supplied under the terms of a license ;* agreement with INTEL Corporation and may not be copied ;* nor disclosed except in accordance with the terms of ;* that agreement. ;* ;* Copyright (c) 1995 Intel Corporation. ;* All Rights Reserved. ;* ;* ************************************************************************* ;// ;// ;// $Header: S:\h26x\src\dec\dx5frmcp.asv ;// ;// $Log: S:\h26x\src\dec\dx5frmcp.asv $ ;// ;// Rev 1.1 20 Dec 1995 15:55:42 RMCKENZX ;// Added FrameMirror function to file to support mirror imaging ;// ;// Rev 1.0 25 Oct 1995 18:11:36 BNICKERS ;// Initial revision. ;// ;//////////////////////////////////////////////////////////////////////////// ; ; File: ; dx5frmcp ; ; Functions: ; FrameCopy ; This function copies a frame from one frame buffer to another. ; It is tuned for best performance on the Pentium(r) Microprocessor. ; ; It is assumed that the frames have the same height, width, and ; pitch, and that, if width is NOT a multiple of 8, it is okay ; to copy up to the next multiple of 8. ; ; FrameMirror ; This function mirror images a frame from one frame buffer to ; another. It is tuned for best performance on the Pentium. ; ; It is assumed that the frames have the same height, width, and ; pitch. The width may be any (non-negative) value. OPTION PROLOGUE:None OPTION EPILOGUE:ReturnAndRelieveEpilogueMacro include locals.inc IFNDEF DSEGNAME IFNDEF WIN32 DSEGNAME TEXTEQU <Data_FrameCopy> ENDIF ENDIF IFDEF WIN32 .xlist include memmodel.inc .list .DATA ELSE DSEGNAME SEGMENT WORD PUBLIC 'DATA' ENDIF ; any data would go here IFNDEF WIN32 DSEGNAME ENDS .xlist include memmodel.inc .list ENDIF IFNDEF SEGNAME IFNDEF WIN32 SEGNAME TEXTEQU <_CODE32> ENDIF ENDIF ifdef WIN32 .CODE else SEGNAME SEGMENT PARA PUBLIC USE32 'CODE' endif ifdef WIN32 ASSUME cs : FLAT ASSUME ds : FLAT ASSUME es : FLAT ASSUME fs : FLAT ASSUME gs : FLAT ASSUME ss : FLAT else ASSUME CS : SEGNAME ASSUME DS : Nothing ASSUME ES : Nothing ASSUME FS : Nothing ASSUME GS : Nothing endif ; void FAR ASM_CALLTYPE FrameCopy (U8 FAR * InputBase, ; X32 InputPlane, ; U8 FAR * OutputBase, ; X32 OutputPlane, ; UN FrameHeight, ; UN FrameWidth, ; UN Pitch) PUBLIC FrameCopy ; due to the need for the ebp reg, these parameter declarations aren't used, ; they are here so the assembler knows how many bytes to relieve from the stack FrameCopy proc DIST LANG AInputPlane: DWORD, AOutputPlane: DWORD, AFrameHeight: DWORD, AFrameWidth: DWORD, APitch: DWORD IFDEF WIN32 RegisterStorageSize = 16 ; Arguments: InputPlane = RegisterStorageSize + 4 OutputPlane = RegisterStorageSize + 8 FrameHeight = RegisterStorageSize + 12 FrameWidth = RegisterStorageSize + 16 Pitch = RegisterStorageSize + 20 EndOfArgList = RegisterStorageSize + 24 ELSE ; Arguments: RegisterStorageSize = 24 ; Put local variables on stack. InputPlane = RegisterStorageSize + 4 InputPlane_SegNum = RegisterStorageSize + 6 OutputPlane = RegisterStorageSize + 8 OutputPlane_SegNum = RegisterStorageSize + 10 OutputPlane = RegisterStorageSize + 12 FrameHeight = RegisterStorageSize + 16 FrameWidth = RegisterStorageSize + 18 Pitch = RegisterStorageSize + 20 EndOfArgList = RegisterStorageSize + 22 ENDIF push esi push edi push ebp push ebx IFDEF WIN32 mov esi,PD [esp+InputPlane] mov edi,PD [esp+OutputPlane] mov ebp,PD [esp+Pitch] mov edx,PD [esp+FrameWidth] mov ecx,PD [esp+FrameHeight] ELSE mov ax,ds mov bx,es push eax push ebx mov ax,PW [esp+InputBase_SegNum] movzx esi,PW [esp+InputPlane] mov bx,PW [esp+OutputBase_SegNum] movzx edi,PW [esp+OutputPlane] mov ds,ebx mov es,eax movzx ebp,PW [esp+Pitch] movzx edx,PW [esp+FrameWidth] movzx ecx,PW [esp+FrameHeight] ENDIF add edx,7 and edx,0FFFFFFF8H sub ebp,edx sub edi,esi push edx CopyLineLoop: mov eax,Ze PD [esi] mov ebx,PD [esi+edi] ; Load output cache line mov ebx,Ze PD [esi+4] mov PD [esi+edi],eax mov PD [esi+edi+4],ebx add esi,8 sub edx,8 jg CopyLineLoop add esi,ebp dec ecx ; Reduce count of lines. mov edx,PD [esp] ; Reload frame width. jg CopyLineLoop pop edx IFDEF WIN32 ELSE pop ebx mov es,ebx pop ebx mov ds,ebx ENDIF pop ebx pop ebp pop edi pop esi rturn FrameCopy endp PUBLIC FrameMirror ; due to the need for the ebp reg, these parameter declarations aren't used, ; they are here so the assembler knows how many bytes to relieve from the stack FrameMirror proc DIST LANG BInputPlane: DWORD, BOutputPlane: DWORD, BFrameHeight: DWORD, BFrameWidth: DWORD, BPitch: DWORD ; save registers push esi push edi push ebp push ebx ; setup and get parameters IFDEF WIN32 mov esi, PD [esp+InputPlane] mov edi, PD [esp+OutputPlane] mov ebp, PD [esp+Pitch] mov edx, PD [esp+FrameWidth] mov ecx, PD [esp+FrameHeight] ELSE mov ax, ds mov bx, es push eax push ebx mov ax, PW [esp+InputBase_SegNum] movzx esi, PW [esp+InputPlane] mov bx, PW [esp+OutputBase_SegNum] movzx edi, PW [esp+OutputPlane] mov ds, ebx mov es, eax movzx ebp, PW [esp+Pitch] movzx edx, PW [esp+FrameWidth] movzx ecx, PW [esp+FrameHeight] ENDIF ; start processing ; prepare for the loop push edx ; save width per_line_loop: test edx, 7 ; check for short count je skip_short_count ; skip when no short count short_count_loop: mov al, [esi+edx-1] dec edx mov [edi], al inc edi test edx, 7 jne short_count_loop skip_short_count: test edx, edx je skip_inner_loop ; inner loop is unrolled to do 8 bytes per iteration inner_loop: mov al, [edi] ; heat cache add edi, 8 mov al, [esi+edx-1] mov bl, [esi+edx-5] mov [edi-8], al mov [edi-4], bl mov al, [esi+edx-2] mov bl, [esi+edx-6] mov [edi-7], al mov [edi-3], bl mov al, [esi+edx-3] mov bl, [esi+edx-7] mov [edi-6], al mov [edi-2], bl mov al, [esi+edx-4] mov bl, [esi+edx-8] mov [edi-5], al mov [edi-1], bl sub edx, 8 jne inner_loop ; now move down to the next line skip_inner_loop: mov edx, [esp] ; restore width add edi, ebp ; increment destination add esi, ebp ; increment source sub edi, edx ; correct destination by width dec ecx jne per_line_loop ; restore stack pointer pop eax IFDEF WIN32 ELSE pop ebx pop eax mov es, bx mov ds, ax ENDIF ; restore registers and return pop ebx pop ebp pop edi pop esi rturn FrameMirror endp IFNDEF WIN32 SEGNAME ENDS ENDIF END
alloy4fun_models/trashltl/models/7/ShP6Decsv4wLnQuiS.als
Kaixi26/org.alloytools.alloy
0
2661
open main pred idShP6Decsv4wLnQuiS_prop8 { all l : File.link | eventually l in Trash } pred __repair { idShP6Decsv4wLnQuiS_prop8 } check __repair { idShP6Decsv4wLnQuiS_prop8 <=> prop8o }
archs/exec_H.als
graymalkin/memalloy
0
4070
module exec_H[E] open exec[E] sig Exec_H extends Exec { atom : E -> E // atomicity relation }{ // the atom relation relates a consecutively-sequenced read/write pair atom in (R->W) & sb & sloc // there are no single-event RMWs no (R&W) // there are no such things as "atomic" and "non-atomic" locations no NAL // control dependencies are defined differently in assembly cd.sb in cd } fun atom[e:PTag->E, X:Exec_H] : E->E { (univ - e[rm_EV]) <: X.atom :> (univ - e[rm_EV]) }
src/main/resources/project-templates/microbit_example/src/display.adb
WinterAlexander/Ada-IntelliJ
17
28974
------------------------------------------------------------------------------ -- Copyright (C) 2018, AdaCore -- -- -- -- This 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. This software is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- -- TABILITY 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 this software; see file -- -- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy -- -- of the license. -- ------------------------------------------------------------------------------ with Ada.Real_Time; use Ada.Real_Time; with HAL; use HAL; with NRF51_SVD.GPIO; use NRF51_SVD.GPIO; with Font5x5; use Font5x5; with Generic_Timers; package body Display is procedure Display_Update; -- Callback for the LED matrix scan package Display_Update_Timer is new Generic_Timers (One_Shot => False, Timer_Name => "Display update", Period => Ada.Real_Time.Microseconds (900), Action => Display_Update); -- This timing event will call the procedure Display_Update every -- 900 microseconds. subtype Width is Natural range LED_Column_Coord'First .. LED_Column_Coord'First + LED_Column_Coord'Range_Length * 2; -- The bitmap width is 2 time the display size so we can instert hidden -- characters to the right of the screen and scroll them in with the -- Shift_Left procedure. Bitmap : array (Width, LED_Row_Coord) of Boolean := (others => (others => False)); Current_X : LED_Column_Coord := 0; Current_Y : LED_Row_Coord := 0; -- Coordinate of the current LED begin lit procedure Clear (Pin : GPIO_Pin_Index); -- Set the GPIO to a low state procedure Set (Pin : GPIO_Pin_Index); -- Set the GPIO to a High state procedure Initialize; -- Initialize GPIOs and timers for the LED matrix procedure Shift_Left; -- Shift all pixels of the bitmap buffer to the left procedure Put_Char (X_Org : Width; C : Character); -- Print a charater to the bitmap buffer procedure Scroll_Character (Char : Character); -- Print a character to the hidden part of the bitmap buffer and scroll it -- to the visible part. -------------------- -- Display_Update -- -------------------- procedure Display_Update is begin -- Turn Off the current LED Clear (Row_Points (Map (Current_X, Current_Y).Row_Id)); Set (Column_Points (Map (Current_X, Current_Y).Column_Id)); -- Compute the coordinate of the next LED to be lit if Current_X = LED_Column_Coord'Last then Current_X := LED_Column_Coord'First; if Current_Y = LED_Row_Coord'Last then Current_Y := LED_Row_Coord'First; else Current_Y := Current_Y + 1; end if; else Current_X := Current_X + 1; end if; -- Turn on the new LED? if Bitmap (Current_X, Current_Y) then -- Row source current Set (Row_Points (Map (Current_X, Current_Y).Row_Id)); -- Column sink current Clear (Column_Points (Map (Current_X, Current_Y).Column_Id)); end if; end Display_Update; ----------- -- Clear -- ----------- procedure Clear (Pin : GPIO_Pin_Index) is begin GPIO_Periph.OUT_k.Arr (Pin) := Low; end Clear; --------- -- Set -- --------- procedure Set (Pin : GPIO_Pin_Index) is begin GPIO_Periph.OUT_k.Arr (Pin) := High; end Set; ---------------- -- Initialize -- ---------------- procedure Initialize is procedure Configure_GPIO (Pin : GPIO_Pin_Index); -------------------- -- Configure_GPIO -- -------------------- procedure Configure_GPIO (Pin : GPIO_Pin_Index) is CNF : PIN_CNF_Register renames GPIO_Periph.PIN_CNF (Pin); begin CNF.DIR := Output; CNF.INPUT := Disconnect; CNF.PULL := Pullup; CNF.DRIVE := S0S1; CNF.SENSE := Disabled; end Configure_GPIO; begin -- Initialize LED maxtrix GPIO for Pin of Row_Points loop Configure_GPIO (Pin); Clear (Pin); end loop; for Pin of Column_Points loop Configure_GPIO (Pin); Set (Pin); end loop; -- Start the LED scan timer Display_Update_Timer.Start; end Initialize; ---------------- -- Shift_Left -- ---------------- procedure Shift_Left is begin -- Shift pixel columns to the left, erasing the left most one for X in Bitmap'First (1) .. Bitmap'Last (1) - 1 loop for Y in Bitmap'Range (2) loop Bitmap (X, Y) := Bitmap (X + 1, Y); end loop; end loop; -- Insert black pixels to the right most column for Y in Bitmap'Range (2) loop Bitmap (Bitmap'Last (1), Y) := False; end loop; end Shift_Left; -------------- -- Put_Char -- -------------- procedure Put_Char (X_Org : Width; C : Character) is C_Index : constant Integer := Character'Pos (C) - Character'Pos ('!'); begin if C_Index not in Font'Range then -- C is not a printable character return; end if; -- Copy the glyph into the bitmap buffer for X in LED_Column_Coord loop for Y in LED_Row_Coord loop if X_Org + X in Width then if (Font (C_Index) (Y) and 2**X) /= 0 then Bitmap (X_Org + X, Y) := True; end if; end if; end loop; end loop; end Put_Char; ---------------------- -- Scroll_Character -- ---------------------- procedure Scroll_Character (Char : Character) is begin -- Insert glyph in the hidden part of the buffer Put_Char (5, Char); -- Shift the buffer 6 times with a 150 milliseconds delay between each -- shifts. for Shifts in 1 .. 6 loop Shift_Left; delay until Ada.Real_Time.Clock + Ada.Real_Time.Milliseconds (150); end loop; end Scroll_Character; ----------------- -- Scroll_Text -- ----------------- procedure Scroll_Text (Str : String) is begin -- Scroll each character of the string for Char of Str loop Scroll_Character (Char); end loop; end Scroll_Text; begin Initialize; end Display;
oeis/152/A152775.asm
neoneye/loda-programs
11
90432
; A152775: Numbers with 3n binary digits where every run length is 3, written in binary. ; Submitted by <NAME>(s3) ; 111,111000,111000111,111000111000,111000111000111,111000111000111000,111000111000111000111,111000111000111000111000,111000111000111000111000111,111000111000111000111000111000,111000111000111000111000111000111,111000111000111000111000111000111000,111000111000111000111000111000111000111,111000111000111000111000111000111000111000,111000111000111000111000111000111000111000111,111000111000111000111000111000111000111000111000,111000111000111000111000111000111000111000111000111 add $0,2 mov $1,1000 pow $1,$0 div $1,12987 mov $0,$1 mul $0,660000 div $0,50820000 mul $0,111
oeis/044/A044682.asm
neoneye/loda-programs
11
6775
<gh_stars>10-100 ; A044682: Numbers n such that string 5,5 occurs in the base 9 representation of n but not of n+1. ; Submitted by <NAME>(s2) ; 50,131,212,293,374,458,536,617,698,779,860,941,1022,1103,1187,1265,1346,1427,1508,1589,1670,1751,1832,1916,1994,2075,2156,2237,2318,2399,2480,2561,2645,2723,2804,2885,2966,3047,3128 mov $1,$0 add $0,12 mod $0,9 div $0,8 add $0,70 mul $0,3 mov $2,$1 mul $2,81 add $0,$2 sub $0,160
ColdFire/Generic/CW_For_Microcontrollers/cpu_a.asm
nykytenko/uC-CPU
0
161265
/* ;******************************************************************************************************** ; uC/CPU ; CPU CONFIGURATION & PORT LAYER ; ; Copyright 2004-2020 Silicon Laboratories Inc. www.silabs.com ; ; SPDX-License-Identifier: APACHE-2.0 ; ; This software is subject to an open source license and is distributed by ; Silicon Laboratories Inc. pursuant to the terms of the Apache License, ; Version 2.0 available at www.apache.org/licenses/LICENSE-2.0. ; ;******************************************************************************************************** */ /* ;******************************************************************************************************** ; ; CPU PORT FILE ; ; ColdFire ; CW for Microcontrollers ; ; Filename : cpu_a.asm ; Version : v1.32.00 ;******************************************************************************************************** */ /* ;******************************************************************************************************** ; PUBLIC DECLARATIONS ;******************************************************************************************************** */ .global _CPU_VectInit .global _CPU_SR_Save .global _CPU_SR_Restore /* ;******************************************************************************************************** ; EXTERNAL DECLARATIONS ;******************************************************************************************************** */ .extern _CPU_VBR_Ptr .text /* ;******************************************************************************************************** ; VECTOR BASE REGISTER INITIALIZATION ; ; Description : This function is called to set the Vector Base Register to the value specified in ; the function argument. ; ; Argument(s) : VBR Desired vector base address. ; ; Return(s) : none. ; ; Note(s) : 'CPU_VBR_Ptr' keeps the current vector base address. ;******************************************************************************************************** */ _CPU_VectInit: MOVE.L D0,-(A7) /* Save D0 */ MOVE.L 8(A7),D0 /* Retrieve 'vbr' parameter from stack */ MOVE.L D0,_CPU_VBR_Ptr /* Save 'vbr' into CPU_VBR_Ptr */ MOVEC D0,VBR MOVE.L (A7)+,D0 /* Restore D0 */ RTS /* ;******************************************************************************************************** ; CPU_SR_Save() for OS_CRITICAL_METHOD #3 ; ; Description : This functions implements the OS_CRITICAL_METHOD #3 function to preserve the state of the ; interrupt disable flag in order to be able to restore it later. ; ; Argument(s) : none. ; ; Return(s) : It is assumed that the return value is placed in the D0 register as expected by the ; compiler. ; ; Note(s) : none. ;******************************************************************************************************** */ _CPU_SR_Save: MOVE.W SR,D0 /* Copy SR into D0 */ MOVE.L D0,-(A7) /* Save D0 */ ORI.L #0x0700,D0 /* Disable interrupts */ MOVE.W D0,SR /* Restore SR state with interrupts disabled */ MOVE.L (A7)+,D0 /* Restore D0 */ RTS /* ;******************************************************************************************************** ; CPU_SR_Restore() for OS_CRITICAL_METHOD #3 ; ; Description : This functions implements the OS_CRITICAL_METHOD #function to restore the state of the ; interrupt flag. ; ; Argument(s) : cpu_sr Contents of the SR to restore. It is assumed that 'cpu_sr' is passed in the stack. ; ; Return(s) : none. ; ; Note(s) : none. ;******************************************************************************************************** */ _CPU_SR_Restore: MOVE.L D0,-(A7) /* Save D0 */ MOVE.W 10(A7),D0 /* Retrieve cpu_sr parameter from stack */ MOVE.W D0,SR /* Restore SR previous state */ MOVE.L (A7)+,D0 /* Restore D0 */ RTS /* ;******************************************************************************************************** ; CPU ASSEMBLY PORT FILE END ;******************************************************************************************************** */ .end
programs/oeis/024/A024032.asm
neoneye/loda
22
12331
; A024032: a(n) = 3^n - n^9. ; 1,2,-503,-19656,-262063,-1952882,-10076967,-40351420,-134211167,-387400806,-999940951,-2357770544,-5159248911,-10602905050,-20656263815,-38429010468,-68676430015,-118458736334,-197971869879,-321525436312,-508513215599,-783819693378,-1175888158183,-1707009482636,-2359378003743,-2967408656182,-2887637850647,0,12298336501553,54123231389014,186208132094649,591233774123276,1817835816763009,5512649082153570,16616464706900105,49952729460327832,149993075340330705,450153944151202286,1350686501571729241,4052346424657817508,12157403315056928801,36472668995236392442,109418582460128509737,328256464801925140784,984770284061771723377,2954311949870191120518,8862937197462338426873,26588813239827030185020,79766441724267049268673,239299327602203931679634,717897985738727588770249,2153693960741392593220296,6461081886446767415296529,19383245664380256304994590,58149736999135753778076825,174449211004514812487186132,523347633021944367765366625,1570042899075730149685150506,4710128697238817176181958761,14130386091730071508946156128,42391158275206125818294433201,127173474825636916396790465462,381520424476932294542103635257,1144561273430821861071792842604,3433683820292494470259339607297,10301051460877516742060709377218,30903154382632588599240628003593,92709463147897809879227529115640,278128389443693480170185479802193,834385168331080498319769493119054,2503155504993241560961964986085849,7509466514979724758098215239808516,22528399544939174359841450060543649,67585198634817523176648856916050010,202755595904452569640020920097874345,608266787713357709044599306339564432 mov $1,3 pow $1,$0 pow $0,9 sub $1,$0 mov $0,$1
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/discr18_pkg.ads
best08618/asylo
7
28338
<gh_stars>1-10 package Discr18_Pkg is subtype Length is Natural range 0..256; type Multiple_Discriminants (A, B : Length) is tagged record S1 : String (1..A); S2 : String (1..B); end record; procedure Do_Something (Rec : in out Multiple_Discriminants); type Multiple_Discriminant_Extension (C : Length) is new Multiple_Discriminants (A => C, B => C) with record S3 : String (1..C); end record; end Discr18_Pkg;
oeis/244/A244763.asm
neoneye/loda-programs
11
164595
<reponame>neoneye/loda-programs ; A244763: Prime numbers ending in the prime number 13. ; Submitted by <NAME> ; 13,113,313,613,1013,1213,1613,1913,2113,2213,2713,3313,3413,3613,4013,4513,4813,5113,5413,5813,6113,7013,7213,8513,8713,9013,9413,9613,10313,10513,10613,11113,11213,11813,12113,12413,12613,12713,13313,13513,13613,13913,14713,14813,15013,15313,15413,15913,17713,18013,18313,18413,18713,18913,19013,19213,19813,19913,20113,21013,21313,21613,21713,22013,22613,23813,24113,24413,25013,25913,26113,26513,26713,26813,28513,28813,30013,30113,30313,30713,31013,31513,32213,32413,32713,33013,33113,33413 mov $2,$0 pow $2,2 mov $4,12 lpb $2 mov $3,$4 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 mov $1,$0 max $1,0 cmp $1,$0 mul $2,$1 sub $2,1 add $4,100 lpe mov $0,$4 add $0,1
programs/oeis/021/A021510.asm
neoneye/loda
22
92152
<gh_stars>10-100 ; A021510: Decimal expansion of 1/506. ; 0,0,1,9,7,6,2,8,4,5,8,4,9,8,0,2,3,7,1,5,4,1,5,0,1,9,7,6,2,8,4,5,8,4,9,8,0,2,3,7,1,5,4,1,5,0,1,9,7,6,2,8,4,5,8,4,9,8,0,2,3,7,1,5,4,1,5,0,1,9,7,6,2,8,4,5,8,4,9,8,0,2,3,7,1,5,4,1,5,0,1,9,7,6,2,8,4,5,8 add $0,1 mov $1,10 pow $1,$0 mul $1,6 div $1,3036 mod $1,10 mov $0,$1
alloy4fun_models/trashltl/models/9/daBC7mMgZ6Wqa6Yki.als
Kaixi26/org.alloytools.alloy
0
4980
<filename>alloy4fun_models/trashltl/models/9/daBC7mMgZ6Wqa6Yki.als open main pred iddaBC7mMgZ6Wqa6Yki_prop10 { eventually all f: Protected | once f in Protected implies always f in Protected } pred __repair { iddaBC7mMgZ6Wqa6Yki_prop10 } check __repair { iddaBC7mMgZ6Wqa6Yki_prop10 <=> prop10o }
Driver/Video/Dumb/VidMem/Main/mainManager.asm
steakknife/pcgeos
504
170994
COMMENT }%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Berkeley Softworks 1989 -- All Rights Reserved PROJECT: PC GEOS MODULE: Memory video driver FILE: mainManager.asm AUTHOR: <NAME>, 25 August 1989 REVISION HISTORY: Name Date Description ---- ---- ----------- Jim 8/89 initial version DESCRIPTION: This file contains the source for the main module of the memory video driver. $Id: mainManager.asm,v 1.1 97/04/18 11:42:43 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%} ;-------------------------------------- ; Declare what module this is ;-------------------------------------- _Main = 1 ;-------------------------------------- ; Include files ;-------------------------------------- include vidmemInclude.def ;------------------------------------------------------------------------------ ; Driver Info Table ;------------------------------------------------------------------------------ idata segment ;MODULE_FIXED DriverTable DriverInfoStruct <Main:DriverStrategy, <0,0,0>, DRIVER_TYPE_VIDEO > ForceRef DriverTable maskInfoSem Semaphore <> ; to protect the following shared vars maskType BMType ; type used for following maskWidth word ; width used for following maskMaskSize word ; size of mask part maskScanSize word ; calculated scan size idata ends ;------------------------------------------------------------------------------ ; Code ;------------------------------------------------------------------------------ Main segment resource ; FIXED include mainMain.asm ; entry point, misc bookeeping routines include mainTables.asm ; jump table for some video driver calls include mainVariable.def ; local buffer space include vidcomEscape.asm ; support for some escape codes Main ends end
source/amf/uml/amf-uml-named_elements.ads
svn2github/matreshka
24
12930
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- A named element supports using a string expression to specify its name. -- This allows names of model elements to involve template parameters. The -- actual name is evaluated from the string expression only when it is -- sensible to do so (e.g., when a template is bound). -- -- A named element is an element in a model that may have a name. ------------------------------------------------------------------------------ limited with AMF.UML.Dependencies.Collections; with AMF.UML.Elements; limited with AMF.UML.Namespaces.Collections; limited with AMF.UML.Packages.Collections; limited with AMF.UML.String_Expressions; with League.Strings; package AMF.UML.Named_Elements is pragma Preelaborate; type UML_Named_Element is limited interface and AMF.UML.Elements.UML_Element; type UML_Named_Element_Access is access all UML_Named_Element'Class; for UML_Named_Element_Access'Storage_Size use 0; not overriding function Get_Client_Dependency (Self : not null access constant UML_Named_Element) return AMF.UML.Dependencies.Collections.Set_Of_UML_Dependency is abstract; -- Getter of NamedElement::clientDependency. -- -- Indicates the dependencies that reference the client. not overriding function Get_Name (Self : not null access constant UML_Named_Element) return AMF.Optional_String is abstract; -- Getter of NamedElement::name. -- -- The name of the NamedElement. not overriding procedure Set_Name (Self : not null access UML_Named_Element; To : AMF.Optional_String) is abstract; -- Setter of NamedElement::name. -- -- The name of the NamedElement. not overriding function Get_Name_Expression (Self : not null access constant UML_Named_Element) return AMF.UML.String_Expressions.UML_String_Expression_Access is abstract; -- Getter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. not overriding procedure Set_Name_Expression (Self : not null access UML_Named_Element; To : AMF.UML.String_Expressions.UML_String_Expression_Access) is abstract; -- Setter of NamedElement::nameExpression. -- -- The string expression used to define the name of this named element. not overriding function Get_Namespace (Self : not null access constant UML_Named_Element) return AMF.UML.Namespaces.UML_Namespace_Access is abstract; -- Getter of NamedElement::namespace. -- -- Specifies the namespace that owns the NamedElement. not overriding function Get_Qualified_Name (Self : not null access constant UML_Named_Element) return AMF.Optional_String is abstract; -- Getter of NamedElement::qualifiedName. -- -- A name which allows the NamedElement to be identified within a -- hierarchy of nested Namespaces. It is constructed from the names of the -- containing namespaces starting at the root of the hierarchy and ending -- with the name of the NamedElement itself. not overriding function Get_Visibility (Self : not null access constant UML_Named_Element) return AMF.UML.Optional_UML_Visibility_Kind is abstract; -- Getter of NamedElement::visibility. -- -- Determines where the NamedElement appears within different Namespaces -- within the overall model, and its accessibility. not overriding procedure Set_Visibility (Self : not null access UML_Named_Element; To : AMF.UML.Optional_UML_Visibility_Kind) is abstract; -- Setter of NamedElement::visibility. -- -- Determines where the NamedElement appears within different Namespaces -- within the overall model, and its accessibility. not overriding function All_Namespaces (Self : not null access constant UML_Named_Element) return AMF.UML.Namespaces.Collections.Ordered_Set_Of_UML_Namespace is abstract; -- Operation NamedElement::allNamespaces. -- -- The query allNamespaces() gives the sequence of namespaces in which the -- NamedElement is nested, working outwards. not overriding function All_Owning_Packages (Self : not null access constant UML_Named_Element) return AMF.UML.Packages.Collections.Set_Of_UML_Package is abstract; -- Operation NamedElement::allOwningPackages. -- -- The query allOwningPackages() returns all the directly or indirectly -- owning packages. not overriding function Is_Distinguishable_From (Self : not null access constant UML_Named_Element; N : AMF.UML.Named_Elements.UML_Named_Element_Access; Ns : AMF.UML.Namespaces.UML_Namespace_Access) return Boolean is abstract; -- Operation NamedElement::isDistinguishableFrom. -- -- The query isDistinguishableFrom() determines whether two NamedElements -- may logically co-exist within a Namespace. By default, two named -- elements are distinguishable if (a) they have unrelated types or (b) -- they have related types but different names. not overriding function Namespace (Self : not null access constant UML_Named_Element) return AMF.UML.Namespaces.UML_Namespace_Access is abstract; -- Operation NamedElement::namespace. -- -- Missing derivation for NamedElement::/namespace : Namespace not overriding function Qualified_Name (Self : not null access constant UML_Named_Element) return League.Strings.Universal_String is abstract; -- Operation NamedElement::qualifiedName. -- -- When there is a name, and all of the containing namespaces have a name, -- the qualified name is constructed from the names of the containing -- namespaces. not overriding function Separator (Self : not null access constant UML_Named_Element) return League.Strings.Universal_String is abstract; -- Operation NamedElement::separator. -- -- The query separator() gives the string that is used to separate names -- when constructing a qualified name. end AMF.UML.Named_Elements;
src/ships-repairs.adb
thindil/steamsky
80
19938
-- Copyright 2017-2021 <NAME> -- -- This file is part of Steam Sky. -- -- Steam Sky is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- Steam Sky is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>. with Messages; use Messages; with ShipModules; use ShipModules; with Ships.Cargo; use Ships.Cargo; with Ships.Crew; use Ships.Crew; with Crew.Inventory; use Crew.Inventory; package body Ships.Repairs is procedure RepairShip(Minutes: Positive) is OrderTime, CurrentMinutes, RepairPoints: Integer; RepairNeeded, RepairStopped: Boolean := False; CrewRepairPoints: Natural_Container.Vector; procedure RepairModule(ModuleIndex: Positive) is PointsIndex, PointsBonus, RepairValue: Natural; RepairMaterial, ToolsIndex: Inventory_Container.Extended_Index; begin PointsIndex := 0; RepairNeeded := True; RepairStopped := False; Repair_Module_Loop : for J in Player_Ship.Crew.Iterate loop if Player_Ship.Crew(J).Order /= Repair then goto End_Of_Loop; end if; PointsIndex := PointsIndex + 1; if CrewRepairPoints(PointsIndex) > 0 then PointsBonus := (GetSkillLevel (Player_Ship.Crew(J), Modules_List(Player_Ship.Modules(ModuleIndex).Proto_Index) .RepairSkill) / 10) * CrewRepairPoints(PointsIndex); RepairPoints := CrewRepairPoints(PointsIndex) + PointsBonus; ToolsIndex := FindTools(Crew_Container.To_Index(J), Repair_Tools, Repair); if ToolsIndex = 0 then if PointsIndex = 1 then AddMessage ("You don't have the proper repair tools to continue repairs of " & To_String(Player_Ship.Modules(ModuleIndex).Name) & ".", OrderMessage, RED); else AddMessage (To_String(Player_Ship.Crew(J).Name) & " can't continue repairs due to a lack of repair tools.", OrderMessage, RED); end if; RepairStopped := True; return; end if; RepairMaterial := FindItem (Inventory => Player_Ship.Cargo, ItemType => Modules_List (Player_Ship.Modules(ModuleIndex).Proto_Index) .RepairMaterial); if RepairMaterial > 0 and then Player_Ship.Cargo(RepairMaterial).Amount < RepairPoints then RepairPoints := Player_Ship.Cargo(RepairMaterial).Amount; end if; if RepairMaterial = 0 then AddMessage ("You don't have the proper repair materials to continue repairs of " & To_String(Player_Ship.Modules(ModuleIndex).Name) & ".", OrderMessage, RED); RepairStopped := True; return; end if; -- Repair module if Player_Ship.Modules(ModuleIndex).Durability + RepairPoints >= Player_Ship.Modules(ModuleIndex).Max_Durability then RepairValue := Player_Ship.Modules(ModuleIndex).Max_Durability - Player_Ship.Modules(ModuleIndex).Durability; RepairNeeded := False; else RepairValue := RepairPoints; end if; if RepairValue = Player_Ship.Cargo(RepairMaterial).Amount and ToolsIndex > RepairMaterial then ToolsIndex := ToolsIndex - 1; end if; UpdateCargo (Ship => Player_Ship, CargoIndex => RepairMaterial, Amount => (0 - RepairValue)); Player_Ship.Modules(ModuleIndex).Durability := Player_Ship.Modules(ModuleIndex).Durability + RepairValue; if RepairValue > CrewRepairPoints(PointsIndex) then RepairValue := CrewRepairPoints(PointsIndex); RepairPoints := 0; else RepairPoints := CrewRepairPoints(PointsIndex) - RepairValue; end if; GainExp (RepairValue, Modules_List(Player_Ship.Modules(ModuleIndex).Proto_Index) .RepairSkill, Crew_Container.To_Index(J)); CrewRepairPoints(PointsIndex) := RepairPoints; DamageItem (Player_Ship.Crew(J).Inventory, ToolsIndex, GetSkillLevel (Player_Ship.Crew(J), Modules_List(Player_Ship.Modules(ModuleIndex).Proto_Index) .RepairSkill), Crew_Container.To_Index(J)); exit Repair_Module_Loop when not RepairNeeded; end if; <<End_Of_Loop>> end loop Repair_Module_Loop; end RepairModule; begin Count_Repair_Workers_Loop : for Member of Player_Ship.Crew loop if Member.Order = Repair then CurrentMinutes := Minutes; OrderTime := Member.OrderTime; RepairPoints := 0; Count_Repair_Points_Loop : while CurrentMinutes > 0 loop if CurrentMinutes >= OrderTime then CurrentMinutes := CurrentMinutes - OrderTime; RepairPoints := RepairPoints + 1; OrderTime := 15; else OrderTime := OrderTime - CurrentMinutes; CurrentMinutes := 0; end if; end loop Count_Repair_Points_Loop; CrewRepairPoints.Append(New_Item => RepairPoints); Member.OrderTime := OrderTime; end if; end loop Count_Repair_Workers_Loop; if CrewRepairPoints.Length = 0 then return; end if; if Player_Ship.Repair_Module > 0 and then Player_Ship.Modules(Player_Ship.Repair_Module).Durability < Player_Ship.Modules(Player_Ship.Repair_Module).Max_Durability then RepairModule(Player_Ship.Repair_Module); end if; Repair_Loop : for I in Player_Ship.Modules.Iterate loop if Player_Ship.Modules(I).Durability < Player_Ship.Modules(I).Max_Durability then RepairModule(Modules_Container.To_Index(I)); end if; end loop Repair_Loop; -- Send repair team on break if all is ok if not RepairNeeded or RepairStopped then if not RepairNeeded then AddMessage("All repairs have been finished.", OrderMessage, GREEN); end if; Give_Orders_Loop : for I in Player_Ship.Crew.Iterate loop if Player_Ship.Crew(I).Order = Repair then GiveOrders(Player_Ship, Crew_Container.To_Index(I), Rest); end if; end loop Give_Orders_Loop; end if; end RepairShip; end Ships.Repairs;
onnxruntime/core/mlas/lib/arm64/SymQgemmS8KernelNeon.asm
lchang20/onnxruntime
669
165264
<gh_stars>100-1000 /*++ Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. Module Name: SymQgemmS8KernelNeon.asm Abstract: This module implements the kernels for the quantized integer matrix/matrix multiply operation (QGEMM), where the right hand side is symmetrically quantized, i.e. zero point being zero. This kernel only requires prepacking of the right hand side, which is usually constant. When the packed right hand side is cached, we achieves higher performance by avoid packing all together. --*/ #include "kxarm64.h" // // Stack frame layout for the S8S8 kernel. // #define SQGemmS8Frame_SavedNeonRegisters (8 * 8) #define SQGemmS8Frame_SavedRegisters SQGemmS8Frame_SavedNeonRegisters #define SQGemmS8Frame_ColumnSumBuffer 0 + SQGemmS8Frame_SavedRegisters TEXTAREA /*++ Routine Description: This routine is an inner kernel to compute matrix multiplication for a set of rows. Arguments: A (x0) - Supplies the address of matrix A. B (x1) - Supplies the address of matrix B. The matrix data has been packed using MlasGemmQuantCopyPackB<MLAS_GEMM_X8S8_KERNEL_NEON>. C (x2) - Supplies the address of matrix C. PackedCountK (x3) - Supplies the number of packed columns from matrix A and the number of packed rows from matrix B to iterate over. CountM (x4) - Supplies the maximum number of rows that can be processed for matrix A and matrix C. The actual number of rows handled for this invocation depends on the kernel implementation. CountN (x5) - Supplies the number of columns from matrix B and matrix C to iterate over. ldc (x6) - Supplies the first dimension of matrix C. lda (x7) - Supplies the first dimension of matrix A. ColumnSumBuffer - Supplies the sum of each column from matrix B multiplied by the zero point offset of matrix A. These values are accumulated into every column of matrix C. Return Value: Returns the number of rows handled. --*/ NESTED_ENTRY MlasSymQgemmS8KernelNeon PROLOG_SAVE_REG_PAIR d8,d9,#-SQGemmS8Frame_SavedRegisters! PROLOG_SAVE_REG_PAIR d10,d11,#16 PROLOG_SAVE_REG_PAIR d12,d13,#32 PROLOG_SAVE_REG_PAIR d14,d15,#48 ldr x13,[sp,#SQGemmS8Frame_ColumnSumBuffer] mov x14,x0 mov x15,x3 cmp x4,#1 // CountM == 1? beq M1_ProcessLoop cmp x4,#4 // CountM < 4? blo M2_ProcessLoop // // Process 4 rows of the matrices. // B 16x4 // ---------------------------------------- // |v4.b[0] v5.b[0] v6.b[0] v7.b[0] | // | ... ... ... ... | // |v4.b[7] v5.b[7] v6.b[7] v7.b[7] | // |v8.b[0] v9.b[0] v10.b[0] v11.b[0]| // | ... ... ... ... | // |v8.b[7] v9.b[7] v10.b[7] v11.b[7]| // A 4x16 ---------------------------------------- // ----------------------------------- ---------------------------------------- // |v0.b[0]..v0.b[7] v2.b[0]..v2.b[7]| |v16.4s v17.4s v18.4s v19.4s | // |v1.b[0]..v1.b[7] v3.b[0]..v3.b[7]| |v20.4s v21.4s v22.4s v23.4s | // |v0.b[0]..v0.b[7] v2.b[0]..v2.b[7]| |v24.4s v25.4s v26.4s v27.4s | // |v1.b[0]..v1.b[7] v3.b[0]..v3.b[7]| |v28.4s v29.4s v30.4s v31.4s | // ----------------------------------- ---------------------------------------- // // Accumulators are horizontally aggregated to the left most register // for each row. e.g. (v16.s[0], v16.s[1], v16.s[2], v16.s[3]) <- (v16, v17, v18, v19) // M4_ProcessNextColumnLoop mov x0,x14 // reload matrix A0 mov x3,x15 // reload PackedCountK ldr d0,[x0],#8 // Load A0 add x9,x14,x7 // A1 ldr d2,[x0],#8 // Load A0 movi v16.4s,#0 movi v17.4s,#0 ldp d4,d8,[x1],#64 // B movi v18.4s,#0 movi v19.4s,#0 ldp d5,d9,[x1,#-48] movi v20.4s,#0 movi v21.4s,#0 ldp d6,d10,[x1,#-32] movi v22.4s,#0 movi v23.4s,#0 ldp d7,d11,[x1,#-16] movi v24.4s,#0 movi v25.4s,#0 add x10,x9,x7 // A2 ldp d1,d3,[x9],#16 // Load A1 movi v26.4s,#0 movi v27.4s,#0 movi v28.4s,#0 movi v29.4s,#0 movi v30.4s,#0 movi v31.4s,#0 add x11,x10,x7 // A3 M4_ComputeBlockLoop smull v12.8h,v0.8b,v4.8b smull v13.8h,v0.8b,v5.8b smull v14.8h,v0.8b,v6.8b smull v15.8h,v0.8b,v7.8b smlal v12.8h,v2.8b,v8.8b smlal v13.8h,v2.8b,v9.8b smlal v14.8h,v2.8b,v10.8b smlal v15.8h,v2.8b,v11.8b ldp d0,d2,[x10],#16 // Load A2 sadalp v16.4s,v12.8h sadalp v17.4s,v13.8h sadalp v18.4s,v14.8h sadalp v19.4s,v15.8h sub x3,x3,#1 smull v12.8h,v1.8b,v4.8b smull v13.8h,v1.8b,v5.8b smull v14.8h,v1.8b,v6.8b smull v15.8h,v1.8b,v7.8b smlal v12.8h,v3.8b,v8.8b smlal v13.8h,v3.8b,v9.8b smlal v14.8h,v3.8b,v10.8b smlal v15.8h,v3.8b,v11.8b ldp d1,d3,[x11],#16 // Load A3 sadalp v20.4s,v12.8h sadalp v21.4s,v13.8h sadalp v22.4s,v14.8h sadalp v23.4s,v15.8h cbz x3,M4_ComputeBlockLoopFinish smull v12.8h,v0.8b,v4.8b smull v13.8h,v0.8b,v5.8b smull v14.8h,v0.8b,v6.8b smull v15.8h,v0.8b,v7.8b smlal v12.8h,v2.8b,v8.8b smlal v13.8h,v2.8b,v9.8b smlal v14.8h,v2.8b,v10.8b smlal v15.8h,v2.8b,v11.8b ldp d0,d2,[x0],#16 // Load A0 next iter sadalp v24.4s,v12.8h sadalp v25.4s,v13.8h sadalp v26.4s,v14.8h sadalp v27.4s,v15.8h smull v12.8h,v1.8b,v4.8b smull v13.8h,v1.8b,v5.8b smull v14.8h,v1.8b,v6.8b smull v15.8h,v1.8b,v7.8b smlal v12.8h,v3.8b,v8.8b ldp d4,d8,[x1],#64 // B smlal v13.8h,v3.8b,v9.8b ldp d5,d9,[x1,#-48] smlal v14.8h,v3.8b,v10.8b ldp d6,d10,[x1,#-32] smlal v15.8h,v3.8b,v11.8b ldp d7,d11,[x1,#-16] sadalp v28.4s,v12.8h ldp d1,d3,[x9],#16 // Load A1 next iter sadalp v29.4s,v13.8h sadalp v30.4s,v14.8h sadalp v31.4s,v15.8h b M4_ComputeBlockLoop M4_ComputeBlockLoopFinish smull v12.8h,v0.8b,v4.8b smull v13.8h,v0.8b,v5.8b smull v14.8h,v0.8b,v6.8b smull v15.8h,v0.8b,v7.8b smlal v12.8h,v2.8b,v8.8b smlal v13.8h,v2.8b,v9.8b smlal v14.8h,v2.8b,v10.8b smlal v15.8h,v2.8b,v11.8b ld1 {v2.4s},[x13],#16 // load ColumnSumBuffer[0] sadalp v24.4s,v12.8h sadalp v25.4s,v13.8h sadalp v26.4s,v14.8h sadalp v27.4s,v15.8h smull v12.8h,v1.8b,v4.8b smull v13.8h,v1.8b,v5.8b smull v14.8h,v1.8b,v6.8b smull v15.8h,v1.8b,v7.8b smlal v12.8h,v3.8b,v8.8b smlal v13.8h,v3.8b,v9.8b smlal v14.8h,v3.8b,v10.8b smlal v15.8h,v3.8b,v11.8b sadalp v28.4s,v12.8h sadalp v29.4s,v13.8h sadalp v30.4s,v14.8h sadalp v31.4s,v15.8h addp v16.4s,v16.4s,v17.4s addp v18.4s,v18.4s,v19.4s addp v20.4s,v20.4s,v21.4s addp v22.4s,v22.4s,v23.4s addp v24.4s,v24.4s,v25.4s addp v26.4s,v26.4s,v27.4s addp v28.4s,v28.4s,v29.4s addp v30.4s,v30.4s,v31.4s addp v16.4s,v16.4s,v18.4s addp v20.4s,v20.4s,v22.4s addp v24.4s,v24.4s,v26.4s addp v28.4s,v28.4s,v30.4s // accumulator += column sum B add v16.4s,v16.4s,v2.4s add v20.4s,v20.4s,v2.4s add v24.4s,v24.4s,v2.4s add v28.4s,v28.4s,v2.4s M4_StoreOutput add x10,x2,x6,lsl #2 add x11,x10,x6,lsl #2 add x12,x11,x6,lsl #2 subs x5,x5,#4 // adjust CountN remaining blo M4_StoreOutputPartial st1 {v16.4s},[x2],#16 st1 {v20.4s},[x10] st1 {v24.4s},[x11] st1 {v28.4s},[x12] cbnz x5,M4_ProcessNextColumnLoop M4_ExitKernel mov x0,#4 // return number of rows handled EPILOG_RESTORE_REG_PAIR d14,d15,#48 EPILOG_RESTORE_REG_PAIR d12,d13,#32 EPILOG_RESTORE_REG_PAIR d10,d11,#16 EPILOG_RESTORE_REG_PAIR d8,d9,#64! EPILOG_RETURN M4_StoreOutputPartial M4_StoreOutputPartial_ZeroMode tbz x5,#1,M4_StoreOutputPartial1_ZeroMode st1 {v16.2s},[x2],#8 dup v16.4s,v16.s[2] // shift remaining elements down st1 {v20.2s},[x10],#8 dup v20.4s,v20.s[2] st1 {v24.2s},[x11],#8 dup v24.4s,v24.s[2] st1 {v28.2s},[x12],#8 dup v28.4s,v28.s[2] M4_StoreOutputPartial1_ZeroMode tbz x5,#0,M4_ExitKernel st1 {v16.s}[0],[x2] st1 {v20.s}[0],[x10] st1 {v24.s}[0],[x11] st1 {v28.s}[0],[x12] b M4_ExitKernel // // Process 2 rows of the matrices. // // Column Sum v2.s[0] v2.s[4] // Each row sum replicated to all 4 elements of a vector register // v30 v31 // B 16x4 // ---------------------------------------- // |v4.b[0] v5.b[0] v6.b[0] v7.b[0] | // | ... ... ... ... | // |v4.b[7] v5.b[7] v6.b[7] v7.b[7] | // |v24.b[0] v25.b[0] v26.b[0] v27.b[0]| // | ... ... ... ... | // |v24.b[7] v25.b[7] v26.b[7] v27.b[7]| // A 2x16 ---------------------------------------- // ----------------------------------- ---------------------------------------- // |v0.b[0]..v0.b[7] v2.b[0]..v2.b[7]| |v16.4s v17.4s v18.4s v19.4s | // |v1.b[0]..v1.b[7] v3.b[0]..v3.b[7]| |v20.4s v21.4s v22.4s v23.4s | // ----------------------------------- ---------------------------------------- // // Accumulators are horizontally aggregated to the left most register // for each row. e.g. (v16.s[0], v16.s[1], v16.s[2], v16.s[3]) <- (v16, v17, v18, v19) M2_ProcessLoop M2_ProcessNextColumnLoop ldp d4,d24,[x1],#16 // B mov x0,x14 // reload matrix A mov x3,x15 // reload PackedCountK ldp d0,d2,[x0],#16 // Load A0 add x9,x14,x7 // A1 movi v16.4s,#0 movi v17.4s,#0 ldp d5,d25,[x1],#16 movi v18.4s,#0 movi v19.4s,#0 ldp d6,d26,[x1],#16 movi v20.4s,#0 movi v21.4s,#0 ldp d7,d27,[x1],#16 movi v22.4s,#0 movi v23.4s,#0 ldp d1,d3,[x9],#16 // Load A1 M2_ComputeBlockLoop sub x3,x3,#1 smull v28.8h,v0.8b,v4.8b smull v29.8h,v0.8b,v5.8b smull v30.8h,v0.8b,v6.8b smull v31.8h,v0.8b,v7.8b cbz x3,M2_ComputeBlockLoopFinish smlal v28.8h,v2.8b,v24.8b smlal v29.8h,v2.8b,v25.8b smlal v30.8h,v2.8b,v26.8b smlal v31.8h,v2.8b,v27.8b ldp d0,d2,[x0],#16 // Load A0 sadalp v16.4s,v28.8h sadalp v17.4s,v29.8h sadalp v18.4s,v30.8h sadalp v19.4s,v31.8h smull v28.8h,v1.8b,v4.8b smull v29.8h,v1.8b,v5.8b smull v30.8h,v1.8b,v6.8b smull v31.8h,v1.8b,v7.8b smlal v28.8h,v3.8b,v24.8b ldp d4,d24,[x1],#16 // B smlal v29.8h,v3.8b,v25.8b ldp d5,d25,[x1],#16 smlal v30.8h,v3.8b,v26.8b ldp d6,d26,[x1],#16 smlal v31.8h,v3.8b,v27.8b ldp d7,d27,[x1],#16 sadalp v20.4s,v28.8h ldp d1,d3,[x9],#16 // Load A1 sadalp v21.4s,v29.8h sadalp v22.4s,v30.8h sadalp v23.4s,v31.8h b M2_ComputeBlockLoop M2_ComputeBlockLoopFinish ld1 {v0.4s},[x13],#16 // load ColumnSumBuffer[0] smlal v28.8h,v2.8b,v24.8b smlal v29.8h,v2.8b,v25.8b smlal v30.8h,v2.8b,v26.8b smlal v31.8h,v2.8b,v27.8b sadalp v16.4s,v28.8h sadalp v17.4s,v29.8h sadalp v18.4s,v30.8h sadalp v19.4s,v31.8h smull v28.8h,v1.8b,v4.8b smull v29.8h,v1.8b,v5.8b smull v30.8h,v1.8b,v6.8b smull v31.8h,v1.8b,v7.8b smlal v28.8h,v3.8b,v24.8b smlal v29.8h,v3.8b,v25.8b smlal v30.8h,v3.8b,v26.8b smlal v31.8h,v3.8b,v27.8b sadalp v20.4s,v28.8h sadalp v21.4s,v29.8h sadalp v22.4s,v30.8h sadalp v23.4s,v31.8h addp v16.4s,v16.4s,v17.4s addp v18.4s,v18.4s,v19.4s addp v20.4s,v20.4s,v21.4s addp v22.4s,v22.4s,v23.4s addp v16.4s,v16.4s,v18.4s addp v20.4s,v20.4s,v22.4s // accumulator = column sum B add v16.4s,v16.4s,v0.4s add v20.4s,v20.4s,v0.4s M2_StoreOutput add x10,x2,x6,lsl #2 subs x5,x5,#4 // adjust CountN remaining blo M2_StoreOutputPartial st1 {v16.4s},[x2],#16 st1 {v20.4s},[x10] cbnz x5,M2_ProcessNextColumnLoop M2_ExitKernel mov x0,#2 // return number of rows handled EPILOG_RESTORE_REG_PAIR d14,d15,#48 EPILOG_RESTORE_REG_PAIR d12,d13,#32 EPILOG_RESTORE_REG_PAIR d10,d11,#16 EPILOG_RESTORE_REG_PAIR d8,d9,#64! EPILOG_RETURN M2_StoreOutputPartial M2_StoreOutputPartial_ZeroMode tbz x5,#1,M2_StoreOutputPartial1_ZeroMode st1 {v16.2s},[x2],#8 dup v16.4s,v16.s[2] // shift remaining elements down st1 {v20.2s},[x10],#8 dup v20.4s,v20.s[2] M2_StoreOutputPartial1_ZeroMode tbz x5,#0,M2_ExitKernel st1 {v16.s}[0],[x2] st1 {v20.s}[0],[x10] b M2_ExitKernel // // Process 1 row of the matrices. // // Column Sum v2.s[0] v2.s[4] // row sum replicated to all 4 elements of a vector register // v31 // B 16x4 // ---------------------------------------- // |v4.b[0] v5.b[0] v6.b[0] v7.b[0] | // | ... ... ... ... | // |v4.b[7] v5.b[7] v6.b[7] v7.b[7] | // |v24.b[0] v25.b[0] v26.b[0] v27.b[0]| // | ... ... ... ... | // |v24.b[7] v25.b[7] v26.b[7] v27.b[7]| // A 1x16 ---------------------------------------- // ----------------------------------- ---------------------------------------- // |v0.b[0]..v0.b[7] v2.b[0]..v2.b[7]| |v16.4s v17.4s v18.4s v19.4s | // ----------------------------------- ---------------------------------------- // // Accumulators are horizontally aggregated to the left most register // for each row. e.g. (v16.s[0], v16.s[1], v16.s[2], v16.s[3]) <- (v16, v17, v18, v19) // M1_ProcessLoop M1_ProcessNextColumnLoop ldp d4,d24,[x1],#16 // B ldp d5,d25,[x1],#16 ldp d6,d26,[x1],#16 ldp d7,d27,[x1],#16 mov x0,x14 // reload matrix A mov x3,x15 // reload PackedCountK ldp d0,d2,[x0],#16 // A0 movi v16.4s,#0 movi v17.4s,#0 movi v18.4s,#0 movi v19.4s,#0 M1_ComputeBlockLoop sub x3,x3,#1 smull v20.8h,v0.8b,v4.8b smull v21.8h,v0.8b,v5.8b cbz x3,M1_ComputeBlockLoopFinish smull v22.8h,v0.8b,v6.8b smull v23.8h,v0.8b,v7.8b smlal v20.8h,v2.8b,v24.8b ldp d4,d24,[x1],#16 // B smlal v21.8h,v2.8b,v25.8b ldp d5,d25,[x1],#16 smlal v22.8h,v2.8b,v26.8b ldp d6,d26,[x1],#16 smlal v23.8h,v2.8b,v27.8b ldp d0,d2,[x0],#16 // A0 sadalp v16.4s,v20.8h sadalp v17.4s,v21.8h ldp d7,d27,[x1],#16 sadalp v18.4s,v22.8h sadalp v19.4s,v23.8h b M1_ComputeBlockLoop M1_ComputeBlockLoopFinish ld1 {v4.4s},[x13],#16 // load ColumnSumBuffer[0] smull v22.8h,v0.8b,v6.8b smull v23.8h,v0.8b,v7.8b smlal v20.8h,v2.8b,v24.8b smlal v21.8h,v2.8b,v25.8b smlal v22.8h,v2.8b,v26.8b smlal v23.8h,v2.8b,v27.8b sadalp v16.4s,v20.8h sadalp v17.4s,v21.8h sadalp v18.4s,v22.8h sadalp v19.4s,v23.8h addp v16.4s,v16.4s,v17.4s addp v18.4s,v18.4s,v19.4s addp v16.4s,v16.4s,v18.4s // accumulator += column sum B add v16.4s,v16.4s,v4.4s M1_StoreOutput subs x5,x5,#4 // adjust CountN remaining blo M1_StoreOutputPartial st1 {v16.4s},[x2],#16 cbnz x5,M1_ProcessNextColumnLoop M1_ExitKernel mov x0,#1 // return number of rows handled EPILOG_RESTORE_REG_PAIR d14,d15,#48 EPILOG_RESTORE_REG_PAIR d12,d13,#32 EPILOG_RESTORE_REG_PAIR d10,d11,#16 EPILOG_RESTORE_REG_PAIR d8,d9,#64! EPILOG_RETURN M1_StoreOutputPartial M1_StoreOutputPartial_ZeroMode tbz x5,#1,M1_StoreOutputPartial1_ZeroMode st1 {v16.2s},[x2],#8 dup v16.4s,v16.s[2] // shift remaining elements down M1_StoreOutputPartial1_ZeroMode tbz x5,#0,M1_ExitKernel st1 {v16.s}[0],[x2] b M1_ExitKernel NESTED_END MlasSymQgemmS8KernelNeon END
src/templates.ads
zenharris/ada-bbs
2
6167
with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; with GNAT.Regpat; use GNAT.Regpat; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Text_IO.Unbounded_IO; with Ada.Strings.Fixed; with Ada.Containers; use Ada.Containers; with Ada.Containers.Vectors; with Ada.Containers.Indefinite_Ordered_Maps; with gnatcoll.SQL.Postgres; use gnatcoll.SQL.Postgres; with gnatcoll.SQL.Exec; use gnatcoll.SQL.Exec; with Ada.Calendar; use Ada.Calendar; with Ada.Calendar.Formatting; use Ada.Calendar.Formatting; with Dbase; with Texaco; with Process_Menu; with Formatter; -- with Dbase.DrackSpace; with Ada.Numerics.Generic_Elementary_Functions; with Ada.Numerics.discrete_Random; with Ada.Containers.Synchronized_Queue_Interfaces; with Ada.Containers.Unbounded_Synchronized_Queues; generic package Templates is package SU renames Ada.Strings.Unbounded; package SUIO renames Ada.Text_IO.Unbounded_IO; package SF renames Ada.Strings.Fixed; package Screen_Vector is new Ada.Containers.Vectors (Natural, Unbounded_String); use Screen_Vector; type Edit_Fields_Record is record Name : Unbounded_String; Row : Line_Position; Col : Column_Position; Length : Integer; Edited : Boolean := False; NoEdit : Boolean := False; end record; package Edit_Fields_Vector is new Ada.Containers.Vectors (Natural, Edit_Fields_Record); use Edit_Fields_Vector; package Current_Record_Maps is new Ada.Containers.Indefinite_Ordered_Maps (Key_Type => Unbounded_String, Element_Type => Unbounded_String); use Current_Record_Maps; Current_Record : Map; Current_Record_Updated : Boolean := False; ScreenList : Screen_Vector.Vector; FieldsList : Screen_Vector.Vector; EditFieldsList : Edit_Fields_Vector.Vector; Display_Window : Window; SaveTableName : Unbounded_String; DebugMode : Boolean := False; type Days_of_Week is (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday); package Ada_Format is new Formatter (Enumerated => Days_of_Week); use Ada_Format; -- Direct visibility of F conversion functions subtype Value_Type is Long_Long_Float; package Value_Functions is new Ada.Numerics.Generic_Elementary_Functions ( Value_Type); use Value_Functions; type Work_Item is record Ship_ID :Unbounded_String; -- new Integer; --range 1 .. 100; end record; package Work_Item_Queue_Interfaces is new Ada.Containers.Synchronized_Queue_Interfaces (Element_Type => Unbounded_String); package Work_Item_Queues is new Ada.Containers.Unbounded_Synchronized_Queues (Queue_Interfaces => Work_Item_Queue_Interfaces); Firing_Queue : Work_Item_Queues.Queue; Torpedo_Firing_Queue : Work_Item_Queues.Queue; Torpedo_Tube2_Firing_Queue : Work_Item_Queues.Queue; procedure Redraw_Page ; procedure Edit_Page ; procedure Command_Screen; procedure Set_Default (Fldnme : String; Default : String); procedure Close_Page; -- function Initialise (CI :Direct_Cursor; TableName : String) return Boolean; function Initialise (CI :Direct_Cursor; TableName : String; NewRecord : Boolean := False; NoWindow : Boolean := False ) return Boolean; procedure Inflict_Damage (ShipID : Unbounded_String; DamageX : Integer := 1; WeaponRange : Long_Long_Float := 200.0; Win : Window); procedure Fire_Lasers (Ship_ID : Unbounded_String); procedure Fire_Torpedo (Ship_ID : Unbounded_String); procedure Fire_Tube2_Torpedo (Ship_ID : Unbounded_String); procedure Torpedo_Control (ShipID : Unbounded_String; Win : Window); end Templates;
oeis/251/A251670.asm
neoneye/loda-programs
11
93966
<gh_stars>10-100 ; A251670: E.g.f.: exp(10*x*G(x)^9) / G(x) where G(x) = 1 + x*G(x)^10 is the g.f. of A059968. ; Submitted by <NAME> ; 1,9,242,11824,856824,82986080,10097121280,1481787433920,254874712419200,50305519571800960,11209381628379724800,2783746998856794752000,762476362390276346060800,228363072063685762536960000,74247696727054926125971251200,26044746725090717967744412672000 lpb $0 sub $0,1 add $3,1 mov $1,$3 mul $1,8 add $2,$1 add $1,$3 add $3,$1 mul $1,$0 add $2,$1 add $4,1 mul $3,$4 add $3,$2 lpe mov $0,$2 add $0,1
programs/oeis/039/A039824.asm
neoneye/loda
22
104302
<gh_stars>10-100 ; A039824: Number of different coefficient values in expansion of Product (1+q^1+q^3...+q^(2i-1)), i=1 to n. ; 1,2,4,11,20,31,46,61,78,97,118,141,166,193,222,253,286,321,358,397,438,481,526,573,622,673,726,781,838,897,958,1021,1086,1153,1222,1293,1366,1441,1518,1597,1678,1761,1846,1933,2022,2113,2206,2301,2398,2497,2598,2701,2806,2913,3022,3133,3246,3361,3478,3597,3718,3841,3966,4093,4222,4353,4486,4621,4758,4897,5038,5181,5326,5473,5622,5773,5926,6081,6238,6397,6558,6721,6886,7053,7222,7393,7566,7741,7918,8097,8278,8461,8646,8833,9022,9213,9406,9601,9798,9997 mov $2,$0 mov $4,5 mov $6,$0 lpb $4 add $5,$0 lpb $0 sub $0,1 add $1,$5 trn $3,$1 add $3,1 trn $4,$3 lpe trn $1,$4 lpb $5 add $1,$2 sub $1,3 mov $5,5 lpe lpe lpb $6 add $1,1 sub $6,1 lpe add $1,1 mov $0,$1
programs/oeis/114/A114284.asm
jmorken/loda
1
247627
<gh_stars>1-10 ; A114284: Riordan array ((1-3*x)/(1-x), x). ; 1,-2,1,-2,-2,1,-2,-2,-2,1,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2 mov $1,2 lpb $0 sub $0,$1 add $1,1 lpe lpb $0 clr $0,12 sub $3,1 lpe mov $1,$3 mul $1,3 add $1,1
FormalAnalyzer/models/meta/cap_momentary.als
Mohannadcse/IoTCOM_BehavioralRuleExtractor
0
4447
// filename: cap_momentary.als module cap_momentary open IoTBottomUp one sig cap_momentary extends Capability {} { attributes = cap_momentary_attr } abstract sig cap_momentary_attr extends Attribute {}
orka_transforms/src/orka-transforms-simd_vectors.adb
onox/orka
52
28585
-- SPDX-License-Identifier: Apache-2.0 -- -- Copyright (c) 2017 onox <<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.Numerics.Generic_Elementary_Functions; package body Orka.Transforms.SIMD_Vectors is function "-" (Elements : Point) return Point is Result : Vector4 := -Vector4 (Elements); begin Result (W) := Elements (W); return Point (Result); end "-"; function "-" (Left, Right : Direction) return Direction is (Direction (Vector4 (Left) - Vector4 (Right))); function "+" (Left, Right : Direction) return Direction is (Direction (Vector4 (Left) + Vector4 (Right))); function "+" (Left : Point; Right : Direction) return Point is (Point (Vector4 (Left) + Vector4 (Right))); function "+" (Left : Direction; Right : Point) return Point is (Point (Vector4 (Left) + Vector4 (Right))); function "-" (Left, Right : Point) return Direction is (Direction (Vector4 (Left) - Vector4 (Right))); ---------------------------------------------------------------------------- package EF is new Ada.Numerics.Generic_Elementary_Functions (Element_Type); function Magnitude2 (Elements : Vector_Type) return Element_Type is (Sum (Elements * Elements)); function "*" (Factor : Element_Type; Elements : Vector_Type) return Vector_Type is begin return (Factor, Factor, Factor, Factor) * Elements; end "*"; function "*" (Elements : Vector_Type; Factor : Element_Type) return Vector_Type is (Factor * Elements); function "*" (Factor : Element_Type; Elements : Direction) return Direction is (Direction (Factor * Vector4 (Elements))); function "*" (Elements : Direction; Factor : Element_Type) return Direction is (Factor * Elements); function Magnitude (Elements : Vector_Type) return Element_Type is begin return EF.Sqrt (Magnitude2 (Elements)); end Magnitude; function Normalize (Elements : Vector_Type) return Vector_Type is Length : constant Element_Type := Magnitude (Elements); begin return Divide_Or_Zero (Elements, (Length, Length, Length, Length)); end Normalize; function Normalized (Elements : Vector_Type) return Boolean is function Is_Equivalent (Expected, Result : Element_Type) return Boolean is -- Because the square root is not computed, the bounds need -- to be increased to +/- 2 * Epsilon + Epsilon ** 2. Since -- Epsilon < 1, we can simply take +/- 3 * Epsilon Epsilon : constant Element_Type := 3.0 * Element_Type'Model_Epsilon; begin return abs (Result - Expected) <= Epsilon; end Is_Equivalent; begin return Is_Equivalent (1.0, Magnitude2 (Elements)); end Normalized; function Distance (Left, Right : Point) return Element_Type is (Magnitude (Vector_Type (Left - Right))); function Projection (Elements, Direction : Vector_Type) return Vector_Type is Unit_Direction : constant Vector_Type := Normalize (Direction); begin -- The dot product gives the magnitude of the projected vector: -- |A_b| = |A| * cos(theta) = A . U_b return Dot (Elements, Unit_Direction) * Unit_Direction; end Projection; function Perpendicular (Elements, Direction : Vector_Type) return Vector_Type is (Elements - Projection (Elements, Direction)); function Angle (Left, Right : Vector_Type) return Element_Type is begin return EF.Arccos (Dot (Left, Right) / (Magnitude (Left) * Magnitude (Right))); end Angle; function Dot (Left, Right : Vector_Type) return Element_Type is (Sum (Left * Right)); function Slerp (Left, Right : Vector_Type; Weight : Element_Type) return Vector_Type is Cos_Angle : constant Element_Type := Dot (Left, Right); Angle : constant Element_Type := EF.Arccos (Cos_Angle); SA : constant Element_Type := EF.Sin (Angle); SL : constant Element_Type := EF.Sin ((1.0 - Weight) * Angle); SR : constant Element_Type := EF.Sin (Weight * Angle); begin return (SL / SA) * Left + (SR / SA) * Right; end Slerp; end Orka.Transforms.SIMD_Vectors;
Cats/End.agda
alessio-b-zak/cats
0
8323
<reponame>alessio-b-zak/cats module Cats.End where open import Level using (_⊔_) open import Cats.Category open import Cats.Category.Wedges using (Wedge ; Wedges) open import Cats.Profunctor module _ {lo la l≈ lo′ la′ l≈′} {C : Category lo la l≈} {D : Category lo′ la′ l≈′} where IsEnd : {F : Profunctor C C D} → Wedge F → Set (lo ⊔ la ⊔ lo′ ⊔ la′ ⊔ l≈′) IsEnd {F} = Wdg.IsTerminal where module Wdg = Category (Wedges F) record End (F : Profunctor C C D) : Set (lo ⊔ la ⊔ lo′ ⊔ la′ ⊔ l≈′) where field wedge : Wedge F isEnd : IsEnd wedge
courses/spark_for_ada_programmers/labs/source/030_spark_language_and_tools/atest.adb
AdaCore/training_material
15
15149
with Aliasing; procedure ATest is begin Aliasing.Test; end ATest;
oeis/070/A070779.asm
neoneye/loda-programs
11
98398
; A070779: Expansion of e.g.f.: (exp(x/(1-x))*(2-x)-1+x)/(1-x)^3. ; Submitted by <NAME> ; 1,5,28,185,1426,12607,125882,1401409,17209234,231033431,3365440882,52855452817,890097287834,15996379554079,305519496498106,6178746162639617,131885301216119842,2962568890205560999,69853182607494217154,1724761580035969997521,44501146220521229674282,1197481667849243046201647,33546725951060682570603274,976800895375402076924925889,29517751069360883925018168626,924438007207182997008850087927,29966055957761050910801206756882,1004194715250032864537576632286609,34750210501961853942971800079227834 mov $2,1 mov $3,$0 add $3,1 mov $4,1 lpb $3 mul $2,$3 div $2,$4 sub $3,1 max $3,1 mov $5,$4 add $4,1 add $5,1 add $6,$2 mul $6,$5 lpe mov $0,$6 add $0,1
Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0xca_notsx.log_21829_593.asm
ljhsiun2/medusa
9
85873
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r9 push %rax push %rbx push %rdx push %rsi lea addresses_WC_ht+0x1e0d7, %r12 inc %rbx mov $0x6162636465666768, %r9 movq %r9, (%r12) nop nop nop nop nop add %r9, %r9 lea addresses_D_ht+0x4ad7, %rsi add $60435, %r13 mov (%rsi), %dx nop nop cmp %r13, %r13 lea addresses_A_ht+0x5546, %rdx nop nop dec %rax movb $0x61, (%rdx) nop nop inc %r12 lea addresses_UC_ht+0x1a0d7, %rbx nop nop and %rsi, %rsi mov (%rbx), %rdx nop nop nop nop dec %r12 lea addresses_UC_ht+0x12e51, %r13 clflush (%r13) nop nop nop nop nop add $589, %rax mov (%r13), %si nop cmp %r9, %r9 lea addresses_UC_ht+0x180d7, %rdx nop nop nop nop nop dec %rbx mov $0x6162636465666768, %r12 movq %r12, %xmm6 vmovups %ymm6, (%rdx) nop nop nop inc %r12 lea addresses_normal_ht+0x1e0d7, %rdx dec %r9 movl $0x61626364, (%rdx) nop nop xor %rbx, %rbx pop %rsi pop %rdx pop %rbx pop %rax pop %r9 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r13 push %r15 push %r8 push %rax push %rbp push %rbx push %rsi // Store lea addresses_A+0x180d7, %r8 nop nop nop nop dec %r15 movw $0x5152, (%r8) nop nop nop nop nop and $35208, %r13 // Store lea addresses_A+0x84c9, %rbp and $24612, %rax mov $0x5152535455565758, %r15 movq %r15, %xmm1 vmovups %ymm1, (%rbp) nop nop nop xor %r13, %r13 // Faulty Load lea addresses_A+0x180d7, %r15 nop sub $43728, %rsi mov (%r15), %bp lea oracles, %r8 and $0xff, %rbp shlq $12, %rbp mov (%r8,%rbp,1), %rbp pop %rsi pop %rbx pop %rbp pop %rax pop %r8 pop %r15 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': False, 'type': 'addresses_A'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_A'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_A'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 8, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 11, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 11, 'same': True, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'} {'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'} {'52': 21829} 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 */
src/nl/tvandijk/aoc/year2021/day5/Lines.g4
trolando/aoc2020
1
855
<filename>src/nl/tvandijk/aoc/year2021/day5/Lines.g4<gh_stars>1-10 grammar Lines; root : line+; line : NUMBER ',' NUMBER '->' NUMBER ',' NUMBER; fragment DIGIT : [0-9]; //ARROW : [->]; NUMBER : DIGIT+; WS : [ \t\r\n]+ -> skip;
cohomology/Wedge.agda
UlrikBuchholtz/HoTT-Agda
1
16155
{-# OPTIONS --without-K #-} open import HoTT open import cohomology.CofiberSequence open import cohomology.Exactness open import cohomology.FunctionOver open import cohomology.Theory open import cohomology.ProductRepr open import cohomology.WedgeCofiber {- Finite additivity is provable (and in a stronger form) without using - the additivity axiom. We have Cⁿ(X ∨ Y) == Cⁿ(X) × Cⁿ(Y) - and over this path - ∙ Cⁿ(winl) corresponds to fst : Cⁿ(X) × Cⁿ(Y) → Cⁿ(X), - ∙ Cⁿ(winr) corresponds to snd : Cⁿ(X) × Cⁿ(Y) → Cⁿ(Y), - ∙ Cⁿ(Wedge-rec winl* winr* wglue*) : Cⁿ(Z) → Cⁿ(X ∨ Y) corresponds to Cⁿ(winl*) × Cⁿ(winr*). - ∙ Cⁿ(f) : Cⁿ(X ∨ Y) → Cⁿ(Z) corresponds to Cⁿ(projl ∘ f) + Cⁿ(projr ∘ f) : Cⁿ(X) × Cⁿ(Y) → Cⁿ(Z) -} module cohomology.Wedge {i} (CT : CohomologyTheory i) where module CWedge (n : ℤ) (X Y : Ptd i) where open WedgeCofiber X Y open CohomologyTheory CT open import cohomology.Functor CT private βl : CF-hom n ⊙winl ∘ᴳ CF-hom n (⊙projl X Y) == idhom _ βl = ! (CF-comp n (⊙projl X Y) ⊙winl) ∙ CF-ident n βr : CF-hom n ⊙winr ∘ᴳ CF-hom n (⊙projr X Y) == idhom _ βr = ! (CF-comp n (⊙projr X Y) ⊙winr) ∙ ap (CF-hom n) ⊙projr-winr ∙ CF-ident n where ⊙projr-winr : ⊙projr X Y ⊙∘ ⊙winr == ⊙idf _ ⊙projr-winr = ⊙λ= (λ _ → idp) $ ∙-unit-r _ ∙ ap-! (projr X Y) wglue ∙ ap ! (Projr.glue-β X Y) open ProductRepr (CF-hom n (⊙projl X Y)) (CF-hom n (⊙projr X Y)) (CF-hom n ⊙winl) (CF-hom n ⊙winr) (app= (ap GroupHom.f βl)) (app= (ap GroupHom.f βr)) (transport (λ {(_ , g) → is-exact (CF-hom n g) (CF-hom n ⊙winr)}) (pair= CofWinr.⊙path CofWinr.cfcod-over) (C-exact n ⊙winr)) (transport (λ {(_ , g) → is-exact (CF-hom n g) (CF-hom n ⊙winl)}) (pair= CofWinl.⊙path CofWinl.cfcod-over) (C-exact n ⊙winl)) public ⊙wedge-rec-over : {Z : Ptd i} (winl* : fst (X ⊙→ Z)) (winr* : fst (Y ⊙→ Z)) → CF-hom n (⊙wedge-rec winl* winr*) == ×ᴳ-hom-in (CF-hom n winl*) (CF-hom n (winr*)) [ (λ K → C n Z →ᴳ K) ↓ path ] ⊙wedge-rec-over winl* winr* = codomain-over-iso $ codomain-over-equiv (CF n R.⊙f) _ ▹ ap2 (λ f g z → (f z , g z)) (ap GroupHom.f $ ! (CF-comp n R.⊙f ⊙winl) ∙ ap (CF-hom n) R.⊙winl-β) (ap GroupHom.f $ ! (CF-comp n R.⊙f ⊙winr) ∙ ap (CF-hom n) R.⊙winr-β) where module R = ⊙WedgeRec winl* winr* wedge-hom-η : {Z : Ptd i} (φ : C n (⊙Wedge X Y) →ᴳ C n Z) → φ == ×ᴳ-sum-hom (C-abelian n _) (φ ∘ᴳ CF-hom n (⊙projl X Y)) (φ ∘ᴳ CF-hom n (⊙projr X Y)) [ (λ G → G →ᴳ C n Z) ↓ path ] wedge-hom-η φ = lemma (C-abelian n _) (C-abelian n _) inl-over inr-over where lemma : {G H K L : Group i} (aG : is-abelian G) (aL : is-abelian L) {p : G == H ×ᴳ K} {φ : H →ᴳ G} {ψ : K →ᴳ G} {χ : G →ᴳ L} → φ == ×ᴳ-inl [ (λ J → H →ᴳ J) ↓ p ] → ψ == ×ᴳ-inr {G = H} [ (λ J → K →ᴳ J) ↓ p ] → χ == ×ᴳ-sum-hom aL (χ ∘ᴳ φ) (χ ∘ᴳ ψ) [ (λ J → J →ᴳ L) ↓ p ] lemma {H = H} {K = K} aG aL {p = idp} {χ = χ} idp idp = ap (λ α → χ ∘ᴳ α) (×ᴳ-sum-hom-η H K aG) ∙ ! (∘-×ᴳ-sum-hom aG aL χ (×ᴳ-inl {G = H}) (×ᴳ-inr {G = H})) wedge-in-over : {Z : Ptd i} (f : fst (Z ⊙→ ⊙Wedge X Y)) → CF-hom n f == ×ᴳ-sum-hom (C-abelian n _) (CF-hom n (⊙projl X Y ⊙∘ f)) (CF-hom n (⊙projr X Y ⊙∘ f)) [ (λ G → G →ᴳ C n Z) ↓ path ] wedge-in-over f = wedge-hom-η (CF-hom n f) ▹ ap2 (×ᴳ-sum-hom (C-abelian n _)) (! (CF-comp n (⊙projl X Y) f)) (! (CF-comp n (⊙projr X Y) f))
src/j2i/AExpr.g4
ComputationWithBoundedResources/grumpy
1
5941
grammar AExpr; @header{ package j2i; import j2i.AExpr; } eval returns [AExpr value] : exp=add EOF {$value = $exp.value;} ; add returns [AExpr value] : e1=mul {$value = $e1.value;} ( '+' e2=mul {$value = new Add($e1.value, $e2.value);} | '-' e2=mul {$value = new Sub($e1.value, $e2.value);} )* ; mul returns [AExpr value] : e1=uexpr {$value = $e1.value;} ( '*' e2=uexpr {$value = new Mul($e1.value, $e2.value);} )* ; uexpr returns [AExpr value] : '-' a=atom {$value = new Neg($a.value);} | a=atom {$value = $a.value;} ; atom returns [AExpr value] : n=Number {$value = new Val(Long.parseLong($n.text));} | i=Identifier {$value = new Var($i.text);} | '(' e=add ')' {$value = $e.value;} ; Number : ('0'..'9')+ ('.' ('0'..'9')+)? ; Identifier : ('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '_' | '0'..'9')* ; WS : [ \t\r\n] -> skip;
extra/extra/DecidableFixed.agda
manikdv/plfa.github.io
1,003
5238
import Relation.Binary.PropositionalEquality as Eq open Eq using (_≡_; refl) open import Data.Nat using (ℕ; zero; suc) open import Relation.Nullary using (¬_; Dec; yes; no) data _≤_ : ℕ → ℕ → Set where z≤n : ∀ {n : ℕ} → zero ≤ n s≤s : ∀ {m n : ℕ} → m ≤ n → suc m ≤ suc n ¬s≤z : ∀ {m : ℕ} → ¬ (suc m ≤ zero) ¬s≤z () ¬s≤s : ∀ {m n : ℕ} → ¬ (m ≤ n) → ¬ (suc m ≤ suc n) ¬s≤s ¬m≤n (s≤s m≤n) = ¬m≤n m≤n _≤?_ : ∀ (m n : ℕ) → Dec (m ≤ n) zero ≤? n = yes z≤n suc m ≤? zero = no ¬s≤z suc m ≤? suc n with m ≤? n ... | yes m≤n = yes (s≤s m≤n) ... | no ¬m≤n = no (¬s≤s ¬m≤n) _ : 2 ≤? 4 ≡ yes (s≤s (s≤s z≤n)) _ = refl _ : 4 ≤? 2 ≡ no (¬s≤s (¬s≤s ¬s≤z)) _ = refl
Transynther/x86/_processed/US/_ht_/i7-8650U_0xd2_notsx.log_1_311.asm
ljhsiun2/medusa
9
646
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r8 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_WC_ht+0x15135, %rsi lea addresses_A_ht+0x13e4d, %rdi nop add $17296, %r9 mov $62, %rcx rep movsw nop nop xor %r12, %r12 lea addresses_WT_ht+0x9735, %r12 nop nop xor %r8, %r8 mov $0x6162636465666768, %r9 movq %r9, %xmm2 and $0xffffffffffffffc0, %r12 movaps %xmm2, (%r12) nop nop nop nop cmp $40369, %rdi lea addresses_WT_ht+0x13bf5, %r9 clflush (%r9) nop nop nop nop add $60395, %rsi movl $0x61626364, (%r9) nop nop nop and %r8, %r8 lea addresses_WT_ht+0x1ebeb, %rsi lea addresses_WC_ht+0x1e523, %rdi nop nop nop sub $57272, %r13 mov $60, %rcx rep movsw nop nop inc %rdi lea addresses_WC_ht+0x18735, %rdi clflush (%rdi) nop nop nop inc %rsi vmovups (%rdi), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $0, %xmm5, %r12 nop nop nop nop nop sub %rcx, %rcx lea addresses_UC_ht+0x16935, %rdi nop nop nop and $58727, %rcx mov $0x6162636465666768, %r13 movq %r13, %xmm4 movups %xmm4, (%rdi) cmp $41418, %r12 lea addresses_normal_ht+0x5135, %rsi lea addresses_normal_ht+0x15e93, %rdi nop nop nop nop nop and $25557, %rax mov $120, %rcx rep movsl nop nop nop nop nop add %rdi, %rdi lea addresses_WC_ht+0x12eb5, %rsi lea addresses_WC_ht+0xfb35, %rdi nop nop sub $36523, %r12 mov $54, %rcx rep movsl nop nop nop nop cmp %rsi, %rsi lea addresses_A_ht+0x1c24b, %rax nop nop nop nop add %r12, %r12 mov (%rax), %r13w nop nop dec %rcx lea addresses_A_ht+0x2af5, %r8 nop nop xor %r9, %r9 vmovups (%r8), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $0, %xmm5, %r12 nop xor $32557, %r13 lea addresses_normal_ht+0x12535, %rcx nop nop and $52329, %rdi mov $0x6162636465666768, %r13 movq %r13, %xmm0 movups %xmm0, (%rcx) nop nop nop inc %r8 lea addresses_A_ht+0x1a735, %rax sub $63198, %rcx vmovups (%rax), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $0, %xmm0, %rdi xor %rax, %rax lea addresses_UC_ht+0x15735, %r12 nop nop xor %r9, %r9 vmovups (%r12), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %rax nop nop nop add $34201, %rcx lea addresses_WT_ht+0x7e9a, %rsi nop nop nop nop nop sub %r13, %r13 movb $0x61, (%rsi) sub $45970, %r12 pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r8 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r8 push %rbp push %rbx push %rcx push %rdi push %rsi // Store lea addresses_A+0xed35, %r12 nop nop nop inc %rbx mov $0x5152535455565758, %r8 movq %r8, %xmm2 vmovups %ymm2, (%r12) nop nop nop add %r13, %r13 // REPMOV lea addresses_PSE+0x15931, %rsi lea addresses_PSE+0xb75, %rdi nop xor %r12, %r12 mov $4, %rcx rep movsq nop nop dec %r12 // Store lea addresses_WC+0x9bf2, %r8 nop nop nop add %rdi, %rdi movb $0x51, (%r8) xor %r12, %r12 // Faulty Load lea addresses_US+0x1135, %rbx cmp %rcx, %rcx movups (%rbx), %xmm3 vpextrq $1, %xmm3, %r8 lea oracles, %rdi and $0xff, %r8 shlq $12, %r8 mov (%rdi,%r8,1), %r8 pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r8 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_PSE', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_PSE', 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} {'48': 1} 48 */
solutions/41 - Image Decrypter/size-8_speed-32.asm
behrmann/7billionhumans
45
89375
-- 7 Billion Humans (2053) -- -- 41: Image Decrypter -- -- Author: ansvonwa -- Size: 8 -- Speed: 32 pickup w a: step w if myitem > mem1: mem1 = calc mem1 + 1 jump a endif drop b: step s jump b
programs/oeis/288/A288918.asm
karttu/loda
0
13588
; A288918: Number of 4-cycles in the n X n king graph. ; 0,3,29,79,153,251,373,519,689,883,1101,1343,1609,1899,2213,2551,2913,3299,3709,4143,4601,5083,5589,6119,6673,7251,7853,8479,9129,9803,10501,11223,11969,12739,13533,14351,15193,16059,16949,17863 mov $2,$0 mul $2,2 lpb $2,1 add $3,1 add $1,$3 trn $1,3 sub $2,1 add $3,5 lpe trn $1,1
GrammarAnalyzer/EBNFLexer.g4
kostasandri/raccoon
0
5652
<gh_stars>0 lexer grammar EBNFLexer; @lexer::header {using System;} @lexer::members { public static bool grammar_flag_TNT=true; public static int nestinglevel = 0; public static bool externalCodeFlag=false; public static bool externCodeSwitch = false; } PARSER : 'parser'; LEXER : 'lexer'; PREDICATE : '{' ~[}]* '}' '?' ; OPT : 'options'; TOKENS : 'tokens' { int x=1; while(_input.La(x)== ' '){ x++; } if ( _input.La(x) != '{' ){ Type = NON_TERMINAL;} }; ACTION : '@parser::header' { externalCodeFlag = true;} | '@lexer::header' { externalCodeFlag = true;} | '@parser::members' { externalCodeFlag = true;} | '@lexer::members' { externalCodeFlag = true;} | '@header' { externalCodeFlag = true;} | '@members' { externalCodeFlag = true;} ; FRAGMENT : 'fragment'; GRAMMAR : 'grammar' {grammar_flag_TNT = true;}; RANGE : '[' .*? ']'; QUOTE : ['] | ["]; LBRACE : '{' { nestinglevel++; if ( externalCodeFlag ){ externCodeSwitch=true; Mode(EXTERNALCODE); } } ; RBRACE : '}' {nestinglevel--; if ( nestinglevel == 0 && externalCodeFlag ){ externalCodeFlag = false; externCodeSwitch = false; Mode(EBNFLexer.DefaultMode); } }; LAGKIL : '['; RAGKIL : ']'; LPAREN : '('; RPAREN : ')' ; QMARK : '?' ; ASTERISK : '*' ; OR : '|' ; PLUS : '+' ; PLUSEQUAL : '+=' ; SUBTRACT : '-'; COMMA : ','; //{grammar_flag_TNT= true; } ; NOT : '~'; COLON : ':' ; LABRACKET : '<'; RABRACKET : '>'; Override : 'Override'; DOT : '.'; DOTS : '..'; SEMICOLON : ';' ; ARROW : '->' {grammar_flag_TNT= true; } ; EQUAL : '='; HASH : '#' {grammar_flag_TNT= true; }; IMPLICIT_TERMINAL : '\'' .*? '\''; CHAR_LITERAL : '\'' LITERAL_CHAR '\''; fragment LITERAL_CHAR : .?[\\][\']; ASSOCIATIVITY: '<' 'assoc=' ('left'|'right') '>'; NONGREEDYCLOSURE : '.*?'; TERMINAL: {!grammar_flag_TNT}? [A-Z][A-Za-z0-9_]* {int x=1; //Console.WriteLine("###1: "+Text); //Console.WriteLine("###1.1: " + (char) _input.La(x)); while(_input.La(x)== ' ' || _input.La(x)== '\t' ){ x++; } if ( _input.La(x) == '=' || (_input.La(x) == '+' && _input.La(x + 1) == '=')) { Type = ID;} }; NON_TERMINAL : {!grammar_flag_TNT}? [a-z][A-Za-z0-9_]* { int x=1; //Console.WriteLine("####2: " + Text); //Console.WriteLine("####2.1: " + (char) _input.La(x)); while(_input.La(x)== ' ' || _input.La(x)== '\t' ){ x++; } if ( _input.La(x) == '=' || (_input.La(x) == '+' && _input.La(x + 1) == '=')) { Type = ID;} }; ID : [a-zA-Z_][A-Za-z0-9_]* { grammar_flag_TNT = false; }; NUMBER : [+-]?[0-9]+ ; AT : '@' ; BlockComment: '/*' .*? '*/'-> skip ; LineComment:'//' ~[\r\n]* -> skip; WS : [ \r\n\t]+ -> skip; mode EXTERNALCODE; LBR : '{' { nestinglevel++; if ( externalCodeFlag ){ externCodeSwitch=true; Mode(EXTERNALCODE); } Type=EBNFLexer.LBRACE; } ; RBR : '}' {nestinglevel--; if ( nestinglevel == 0 && externalCodeFlag ){ externalCodeFlag = false; externCodeSwitch = false; Mode(EBNFLexer.DefaultMode); } Type=EBNFLexer.RBRACE; }; EXTERNCODE : ~[{}]*;
source/rascal-os.adb
bracke/Meaning
0
25381
<filename>source/rascal-os.adb<gh_stars>0 -------------------------------------------------------------------------------- -- -- -- Copyright (C) 2004, RISC OS Ada Library (RASCAL) developers. -- -- -- -- This library is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU Lesser General Public -- -- License as published by the Free Software Foundation; either -- -- version 2.1 of the License, or (at your option) any later version. -- -- -- -- This 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 -- -- Lesser General Public License for more details. -- -- -- -- You should have received a copy of the GNU Lesser General Public -- -- License along with this library; if not, write to the Free Software -- -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- -- -- -------------------------------------------------------------------------------- -- $Author$ -- $Date$ -- $Revision$ with Interfaces.C; use Interfaces.C; with Ada.Exceptions; use Ada.Exceptions; with RASCAL.Utility; package body RASCAL.OS is -- procedure Raise_Error (Error : OSError_Access) is Nr : Integer := Utility."And"(Integer(Error.ErrNum),16#FF#); Message : String := To_Ada(Error.ErrMess); begin case Nr is when Error_Escape => Raise_Exception (Exception_Escape'Identity , Message); when Error_Bad_mode => Raise_Exception (Exception_Bad_mode'Identity , Message); when Error_Is_adir => Raise_Exception (Exception_Is_adir'Identity , Message); when Error_Types_dont_match => Raise_Exception (Exception_Types_dont_match'Identity , Message); when Error_Bad_rename => Raise_Exception (Exception_Bad_rename'Identity , Message); when Error_Bad_copy => Raise_Exception (Exception_Bad_copy'Identity , Message); when Error_Outside_file => Raise_Exception (Exception_Outside_file'Identity , Message); when Error_Access_violation => Raise_Exception (Exception_Access_violation'Identity , Message); when Error_Too_many_open_files => Raise_Exception (Exception_Too_many_open_files'Identity , Message); when Error_Not_open_for_update => Raise_Exception (Exception_Not_open_for_update'Identity , Message); when Error_File_open => Raise_Exception (Exception_File_open'Identity , Message); when Error_Object_locked => Raise_Exception (Exception_Object_locked'Identity , Message); when Error_Already_exists => Raise_Exception (Exception_Already_exists'Identity , Message); when Error_Bad_file_name => Raise_Exception (Exception_Bad_file_name'Identity , Message); when Error_File_not_found => Raise_Exception (Exception_File_not_found'Identity , Message); when Error_Syntax => Raise_Exception (Exception_Syntax'Identity , Message); when Error_Channel => Raise_Exception (Exception_Channel'Identity , Message); when Error_End_of_file => Raise_Exception (Exception_End_of_file'Identity , Message); when Error_Buffer_Overflow => Raise_Exception (Exception_Buffer_Overflow'Identity , Message); when Error_Bad_filing_system_name => Raise_Exception (Exception_Bad_filing_system_name'Identity , Message); when Error_Bad_key => Raise_Exception (Exception_Bad_key'Identity , Message); when Error_Bad_address => Raise_Exception (Exception_Bad_address'Identity , Message); when Error_Bad_string => Raise_Exception (Exception_Bad_string'Identity , Message); when Error_Bad_command => Raise_Exception (Exception_Bad_command'Identity , Message); when Error_Bad_mac_val => Raise_Exception (Exception_Bad_mac_val'Identity , Message); when Error_Bad_var_nam => Raise_Exception (Exception_Bad_var_nam'Identity , Message); when Error_Bad_var_type => Raise_Exception (Exception_Bad_var_type'Identity , Message); when Error_Var_no_room => Raise_Exception (Exception_Var_no_room'Identity , Message); when Error_Var_cant_find => Raise_Exception (Exception_Var_cant_find'Identity , Message); when Error_Var_too_long => Raise_Exception (Exception_Var_too_long'Identity , Message); when Error_Redirect_fail => Raise_Exception (Exception_Redirect_fail'Identity , Message); when Error_Stack_full => Raise_Exception (Exception_Stack_full'Identity , Message); when Error_Bad_hex => Raise_Exception (Exception_Bad_hex'Identity , Message); when Error_Bad_expr => Raise_Exception (Exception_Bad_expr'Identity , Message); when Error_Bad_bra => Raise_Exception (Exception_Bad_bra'Identity , Message); when Error_Stk_oflo => Raise_Exception (Exception_Stk_oflo'Identity , Message); when Error_Miss_opn => Raise_Exception (Exception_Miss_opn'Identity , Message); when Error_Miss_opr => Raise_Exception (Exception_Miss_opr'Identity , Message); when Error_Bad_bits => Raise_Exception (Exception_Bad_bits'Identity , Message); when Error_Str_oflo => Raise_Exception (Exception_Str_oflo'Identity , Message); when Error_Bad_itm => Raise_Exception (Exception_Bad_itm'Identity , Message); when Error_Div_zero => Raise_Exception (Exception_Div_zero'Identity , Message); when Error_Bad_base => Raise_Exception (Exception_Bad_base'Identity , Message); when Error_Bad_numb => Raise_Exception (Exception_Bad_numb'Identity , Message); when Error_Numb_too_big => Raise_Exception (Exception_Numb_too_big'Identity , Message); when Error_Bad_claim_num => Raise_Exception (Exception_Bad_claim_num'Identity , Message); when Error_Bad_release => Raise_Exception (Exception_Bad_release'Identity , Message); when Error_Bad_dev_no => Raise_Exception (Exception_Bad_dev_no'Identity , Message); when Error_Bad_dev_vec_rel => Raise_Exception (Exception_Bad_dev_vec_rel'Identity , Message); when Error_Bad_env_number => Raise_Exception (Exception_Bad_env_number'Identity , Message); when Error_Cant_cancel_quit => Raise_Exception (Exception_Cant_cancel_quit'Identity , Message); when Error_Ch_dynam_cao => Raise_Exception (Exception_Ch_dynam_cao'Identity , Message); when Error_Ch_dynam_not_all_moved => Raise_Exception (Exception_Ch_dynam_not_all_moved'Identity , Message); when Error_Apl_wspace_in_use => Raise_Exception (Exception_Apl_wspace_in_use'Identity , Message); when Error_Ram_fs_unchangeable => Raise_Exception (Exception_Ram_fs_unchangeable'Identity , Message); when Error_Oscli_long_line => Raise_Exception (Exception_Oscli_long_line'Identity , Message); when Error_Oscli_too_hard => Raise_Exception (Exception_Oscli_too_hard'Identity , Message); when Error_Rc_exc => Raise_Exception (Exception_Rc_exc'Identity , Message); when Error_Sys_heap_full => Raise_Exception (Exception_Sys_heap_full'Identity , Message); when Error_Buff_overflow => Raise_Exception (Exception_Buff_overflow'Identity , Message); when Error_Bad_time => Raise_Exception (Exception_Bad_time'Identity , Message); when Error_No_such_swi => Raise_Exception (Exception_No_such_swi'Identity , Message); when Error_Unimplemented => Raise_Exception (Exception_Unimplemented'Identity , Message); when Error_Out_of_range => Raise_Exception (Exception_Out_of_range'Identity , Message); when Error_No_oscli_specials => Raise_Exception (Exception_No_oscli_specials'Identity , Message); when Error_Bad_parameters => Raise_Exception (Exception_Bad_parameters'Identity , Message); when Error_Arg_repeated => Raise_Exception (Exception_Arg_repeated'Identity , Message); when Error_Bad_read_sys_info => Raise_Exception (Exception_Bad_read_sys_info'Identity , Message); when Error_Cdat_stack_overflow => Raise_Exception (Exception_Cdat_stack_overflow'Identity , Message); when Error_Cdat_buffer_overflow => Raise_Exception (Exception_Cdat_buffer_overflow'Identity , Message); when Error_Cdat_bad_field => Raise_Exception (Exception_Cdat_bad_field'Identity , Message); when Error_Cant_start_application => Raise_Exception (Exception_Cant_start_application'Identity , Message); when Error_Tool_Action_Out_of_Memory => Raise_Exception (Exception_Tool_Action_Out_of_Memory'Identity , Message); when Error_Tool_Action_Cant_Create_Icon => Raise_Exception (Exception_Tool_Action_Cant_Create_Icon'Identity , Message); when Error_Tool_Action_Cant_Create_Object => Raise_Exception (Exception_Tool_Action_Cant_Create_Object'Identity , Message); when others => Raise_Exception(Exception_Unknown_Error'Identity,"Error: " & Utility.intstr(Nr) & " - " & Message); end case; end Raise_Error; -- end RASCAL.OS;
examples/fill/fill.pre.asm
enoua5/IOTA-C0
0
172361
<reponame>enoua5/IOTA-C0<filename>examples/fill/fill.pre.asm #uses only draft 1 SET 0x0200 0x0F0F ADR 0x0108 MOV 0x01FF *0x0046 INC *0x0001 0x0001 QJP 0x01FF
src/asis/asis-definitions.adb
My-Colaborations/dynamo
15
29679
<filename>src/asis/asis-definitions.adb ------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A S I S . D E F I N I T I O N S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1995-2011, 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, 51 Franklin -- -- Street, Fifth Floor, Boston, MA 02110-1301, 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 AdaCore -- -- (http://www.adacore.com). -- -- -- ------------------------------------------------------------------------------ with Asis.Declarations; use Asis.Declarations; with Asis.Elements; use Asis.Elements; with Asis.Errors; use Asis.Errors; with Asis.Exceptions; use Asis.Exceptions; with Asis.Extensions; use Asis.Extensions; with Asis.Set_Get; use Asis.Set_Get; with A4G.A_Sem; use A4G.A_Sem; with A4G.Asis_Tables; use A4G.Asis_Tables; with A4G.Contt.UT; use A4G.Contt.UT; with A4G.Mapping; use A4G.Mapping; with A4G.Norm; use A4G.Norm; with A4G.Stand; use A4G.Stand; with A4G.Vcheck; use A4G.Vcheck; with Atree; use Atree; with Einfo; use Einfo; with Namet; use Namet; with Nlists; use Nlists; with Sinfo; use Sinfo; package body Asis.Definitions is Package_Name : constant String := "Asis.Definitions."; ------------------------------------------------------------------------------ --------------------------- -- ASIS 2005 Draft stuff -- --------------------------- --------------------------------------------- -- Anonymous_Access_To_Object_Subtype_Mark -- --------------------------------------------- function Anonymous_Access_To_Object_Subtype_Mark (Definition : Asis.Definition) return Asis.Expression is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Definition); Arg_Node : Node_Id; begin Check_Validity (Definition, Package_Name & "Anonymous_Access_To_Object_Subtype_Mark"); if not (Arg_Kind = An_Anonymous_Access_To_Variable or else Arg_Kind = An_Anonymous_Access_To_Constant) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Anonymous_Access_To_Object_Subtype_Mark", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Definition); return Node_To_Element_New (Node => Subtype_Mark (Arg_Node), Starting_Element => Definition); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Definition, Outer_Call => Package_Name & "Anonymous_Access_To_Object_Subtype_Mark"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Anonymous_Access_To_Object_Subtype_Mark", Ex => Ex, Arg_Element => Definition); end Anonymous_Access_To_Object_Subtype_Mark; ------------------------------- -- Component_Definition_View -- ------------------------------- function Component_Definition_View (Component_Definition : Asis.Component_Definition) return Asis.Definition is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Component_Definition); Res_Node : Node_Id; Result_Kind : Internal_Element_Kinds := Not_An_Element; begin Check_Validity (Component_Definition, Package_Name & "Component_Definition_View"); if not (Arg_Kind = A_Component_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Component_Definition_View", Wrong_Kind => Arg_Kind); end if; Res_Node := R_Node (Component_Definition); if Is_Rewrite_Substitution (Res_Node) or else Present (Access_Definition (Res_Node)) then Res_Node := Access_Definition (Original_Node (Res_Node)); else Result_Kind := A_Subtype_Indication; Res_Node := Sinfo.Subtype_Indication (Res_Node); end if; return Node_To_Element_New (Node => Res_Node, Starting_Element => Component_Definition, Internal_Kind => Result_Kind); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Component_Definition, Outer_Call => Package_Name & "Component_Definition_View"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Component_Definition_View", Ex => Ex, Arg_Element => Component_Definition); end Component_Definition_View; ------------------------------- -- Definition_Interface_List -- ------------------------------- function Definition_Interface_List (Type_Definition : Asis.Definition) return Asis.Expression_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Arg_Node : Node_Id; First_I : Node_Id; I_Kind : Internal_Element_Kinds; begin Check_Validity (Type_Definition, Package_Name & "Definition_Interface_List"); if not (Arg_Kind = A_Derived_Record_Extension_Definition or else Arg_Kind = A_Private_Extension_Definition or else Arg_Kind in Internal_Interface_Kinds or else Arg_Kind = A_Formal_Derived_Type_Definition or else Arg_Kind in Internal_Formal_Interface_Kinds) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Definition_Interface_List", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Type_Definition); if Nkind (Arg_Node) = N_Record_Definition and then not Interface_Present (Arg_Node) then return Nil_Element_List; elsif Nkind (Arg_Node) = N_Derived_Type_Definition and then Interface_Present (Arg_Node) then -- The first interface name in the list is represented as -- Subtype_Indication field in N_Derived_Type_Definition node First_I := Sinfo.Subtype_Indication (Arg_Node); if Nkind (First_I) = N_Identifier then I_Kind := An_Identifier; else I_Kind := A_Selected_Component; end if; return Node_To_Element_New (Node => First_I, Starting_Element => Type_Definition, Internal_Kind => I_Kind) & N_To_E_List_New (List => Interface_List (Arg_Node), Starting_Element => Type_Definition); else return N_To_E_List_New (List => Interface_List (Arg_Node), Starting_Element => Type_Definition); end if; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Definition_Interface_List"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Definition_Interface_List", Ex => Ex, Arg_Element => Type_Definition); end Definition_Interface_List; --------------------------- -- ASIS 2012 Draft stuff -- --------------------------- ----------------------- -- Aspect_Definition -- ----------------------- function Aspect_Definition (Aspect_Specification : Asis.Element) return Asis.Element is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Aspect_Specification); begin Check_Validity (Aspect_Specification, Package_Name & "Aspect_Definition"); if Arg_Kind /= An_Aspect_Specification then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Aspect_Definition", Wrong_Kind => Arg_Kind); end if; return Node_To_Element_New (Node => Sinfo.Expression (Node (Aspect_Specification)), Starting_Element => Aspect_Specification); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Aspect_Specification, Outer_Call => Package_Name & "Aspect_Definition"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Aspect_Definition", Ex => Ex, Arg_Element => Aspect_Specification); end Aspect_Definition; ----------------- -- Aspect_Mark -- ----------------- function Aspect_Mark (Aspect_Specification : Asis.Element) return Asis.Element is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Aspect_Specification); Res_Node : Node_Id; Res_Kind : Internal_Element_Kinds := An_Identifier; begin Check_Validity (Aspect_Specification, Package_Name & "Aspect_Mark"); if Arg_Kind /= An_Aspect_Specification then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Aspect_Mark", Wrong_Kind => Arg_Kind); end if; Res_Node := Node (Aspect_Specification); if Class_Present (Res_Node) then Res_Kind := A_Class_Attribute; end if; Res_Node := Sinfo.Identifier (Res_Node); return Node_To_Element_New (Node => Res_Node, Starting_Element => Aspect_Specification, Internal_Kind => Res_Kind); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Aspect_Specification, Outer_Call => Package_Name & "Aspect_Mark"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Aspect_Mark", Ex => Ex, Arg_Element => Aspect_Specification); end Aspect_Mark; ------------------------------------------------------------------------------ -- NOT IMPLEMENTED -- The query is implemented with the following ramification of its -- definition: -- -- 1. The list of appropriate kinds is: -- -- Appropriate Definition_Kinds: -- A_Type_Definition -- A_Formal_Type_Declaration -- A_Private_Type_Definition -- A_Tagged_Private_Type_Definition -- A_Private_Extension_Definition -- A_Task_Definition -- A_Protected_Definition -- -- 2. The query returns only primitive operators of the type, except if the -- argument is A_Formal_Type_Declaration. In the latter case the result -- contains inherited user-defined operators and all the formal -- operators defined for this type -- -- 3. Any operator that satisfy conditions given in (2) and that has a -- parameter or returns the result of the argument type is returned. -- -- 4. In case of a private type and private extension, the query returns -- the same results when applied to the private and to the full view. -- -- 5. Implicit declarations of predefined operators are not supported. So -- they are not included in the result of the query function Corresponding_Type_Operators (Type_Definition : Asis.Type_Definition) return Asis.Declaration_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); begin Check_Validity (Type_Definition, Package_Name & "Corresponding_Type_Operators"); if not (Arg_Kind in Internal_Type_Kinds or else Arg_Kind in Internal_Formal_Type_Kinds or else Arg_Kind in A_Private_Type_Definition .. A_Protected_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Corresponding_Type_Operators", Wrong_Kind => Arg_Kind); end if; return Inherited_Type_Operators (Type_Definition) & Explicit_Type_Operators (Type_Definition); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Corresponding_Type_Operators"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Corresponding_Type_Operators", Ex => Ex, Arg_Element => Type_Definition); end Corresponding_Type_Operators; ----------------------------------------------------------------------------- function Parent_Subtype_Indication (Type_Definition : Asis.Type_Definition) return Asis.Subtype_Indication is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Arg_Node : Node_Id; begin Check_Validity (Type_Definition, Package_Name & "Parent_Subtype_Indication"); if not (Arg_Kind = A_Derived_Type_Definition or else Arg_Kind = A_Derived_Record_Extension_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Parent_Subtype_Indication", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Type_Definition); return Node_To_Element_New (Node => Sinfo.Subtype_Indication (Arg_Node), Starting_Element => Type_Definition, Internal_Kind => A_Subtype_Indication); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Parent_Subtype_Indication"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Parent_Subtype_Indication", Ex => Ex, Arg_Element => Type_Definition); end Parent_Subtype_Indication; ----------------------------------------------------------------------------- function Record_Definition (Type_Definition : Asis.Type_Definition) return Asis.Record_Definition is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Arg_Node : Node_Id; Result_Kind : Internal_Element_Kinds; Result_Node : Node_Id; begin Check_Validity (Type_Definition, Package_Name & "Record_Definition"); if not (Arg_Kind = A_Derived_Record_Extension_Definition or else Arg_Kind = A_Record_Type_Definition or else Arg_Kind = A_Tagged_Record_Type_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Record_Definition", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Type_Definition); if Arg_Kind = A_Derived_Record_Extension_Definition then Result_Node := Record_Extension_Part (Arg_Node); else Result_Node := Arg_Node; end if; if Null_Present (Result_Node) then Result_Kind := A_Null_Record_Definition; else Result_Kind := A_Record_Definition; end if; return Node_To_Element_New (Node => Result_Node, Starting_Element => Type_Definition, Internal_Kind => Result_Kind); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Record_Definition"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Record_Definition", Ex => Ex, Arg_Element => Type_Definition); end Record_Definition; ------------------------------------------------------------------------------ -- NOT IMPLEMENTED??? function Implicit_Inherited_Declarations (Definition : Asis.Definition) return Asis.Declaration_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Definition); Type_Entity_Node : Node_Id; Type_Decl_Node : Node_Id; Inherit_Discrims : Boolean := True; begin Check_Validity (Definition, Package_Name & "Implicit_Inherited_Declarations"); if not (Arg_Kind = A_Private_Extension_Definition or else Arg_Kind = A_Derived_Type_Definition or else Arg_Kind = A_Derived_Record_Extension_Definition or else Arg_Kind = A_Formal_Derived_Type_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Implicit_Inherited_Declarations", Wrong_Kind => Arg_Kind); end if; Type_Entity_Node := Defining_Identifier (Parent (R_Node (Definition))); if not (Is_Record_Type (Type_Entity_Node) or else Is_Enumeration_Type (Type_Entity_Node) or else Is_Task_Type (Type_Entity_Node) or else Is_Protected_Type (Type_Entity_Node)) then return Nil_Element_List; end if; Type_Decl_Node := Parent (R_Node (Definition)); if Present (Discriminant_Specifications (Original_Node (Type_Decl_Node))) then Inherit_Discrims := False; end if; if Is_Record_Type (Type_Entity_Node) then Set_Inherited_Components (Definition, Inherit_Discrims); elsif Is_Concurrent_Type (Type_Entity_Node) then Set_Concurrent_Inherited_Components (Definition, Inherit_Discrims); elsif Is_Enumeration_Type (Type_Entity_Node) then if Present (First_Literal (Type_Entity_Node)) then Set_Inherited_Literals (Definition); else -- Type derived (directly or indirectly) from Standard.Character -- or Standard.Wide_Character return Standard_Char_Decls (Type_Definition => Definition, Implicit => True); end if; else Not_Implemented_Yet (Diagnosis => Package_Name & "Implicit_Inherited_Declarations"); end if; for J in 1 .. Asis_Element_Table.Last loop Set_From_Implicit (Asis_Element_Table.Table (J), True); Set_From_Inherited (Asis_Element_Table.Table (J), True); Set_Node_Field_1 (Asis_Element_Table.Table (J), Type_Decl_Node); end loop; return Asis.Declaration_List (Asis_Element_Table.Table (1 .. Asis_Element_Table.Last)); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Definition, Outer_Call => Package_Name & "Implicit_Inherited_Declarations"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Implicit_Inherited_Declarations", Ex => Ex, Arg_Element => Definition); end Implicit_Inherited_Declarations; ------------------------------------------------------------------------------ function Implicit_Inherited_Subprograms (Definition : Asis.Definition) return Asis.Declaration_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Definition); Type_Entity_Node : Node_Id; Next_Subpr_Node : Node_Id; Next_Expl_Subpr : Node_Id; Expl_Subpr_Name : Node_Id; Next_Subpr_Kind : Internal_Element_Kinds; Next_Subpr_Element : Element; Result_Unit : Compilation_Unit; begin Check_Validity (Definition, Package_Name & "Implicit_Inherited_Subprograms"); if not (Arg_Kind = A_Private_Extension_Definition or else Arg_Kind = A_Derived_Type_Definition or else Arg_Kind = A_Derived_Record_Extension_Definition or else Arg_Kind = A_Formal_Derived_Type_Definition or else Arg_Kind in Internal_Interface_Kinds or else Arg_Kind in Internal_Formal_Interface_Kinds) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Implicit_Inherited_Subprograms", Wrong_Kind => Arg_Kind); end if; Type_Entity_Node := R_Node (Definition); if Nkind (Type_Entity_Node) /= N_Private_Extension_Declaration then Type_Entity_Node := Parent (Type_Entity_Node); end if; Type_Entity_Node := Defining_Identifier (Type_Entity_Node); Result_Unit := Encl_Unit (Definition); Asis_Element_Table.Init; Next_Subpr_Node := Next_Entity (Type_Entity_Node); -- All the inherited subprograms can be *after* the type entity only Type_Entity_Node := Parent (Type_Entity_Node); -- now Type_Entity_Node points to the type declaration of the type -- which inherits the result subprograms while Present (Next_Subpr_Node) loop if (Ekind (Next_Subpr_Node) = E_Procedure or else Ekind (Next_Subpr_Node) = E_Function) and then Parent (Next_Subpr_Node) = Type_Entity_Node and then not (Is_Hidden (Next_Subpr_Node) and then Present (Interface_Alias (Next_Subpr_Node))) then -- This entity node represents the user-defined inherited -- subprogram for Type_Entity_Node Next_Expl_Subpr := Explicit_Parent_Subprogram (Next_Subpr_Node); Expl_Subpr_Name := Next_Expl_Subpr; if Is_Generic_Instance (Expl_Subpr_Name) then -- Go to the instantiation entity node, because for the -- expanded subprogram the front-end creates an artificial -- name: while Nkind (Expl_Subpr_Name) /= N_Package_Declaration loop Expl_Subpr_Name := Parent (Expl_Subpr_Name); end loop; while Nkind (Expl_Subpr_Name) not in N_Generic_Instantiation loop Expl_Subpr_Name := Next (Expl_Subpr_Name); end loop; Expl_Subpr_Name := Defining_Unit_Name (Expl_Subpr_Name); end if; if Chars (Next_Subpr_Node) = Chars (Expl_Subpr_Name) then -- For this condition, see the discussion in 8215-007 Next_Expl_Subpr := Parent (Next_Expl_Subpr); if Ekind (Next_Subpr_Node) = E_Function then Next_Subpr_Kind := A_Function_Declaration; elsif Null_Present (Next_Expl_Subpr) then Next_Subpr_Kind := A_Null_Procedure_Declaration; else Next_Subpr_Kind := A_Procedure_Declaration; end if; Next_Expl_Subpr := Parent (Next_Expl_Subpr); Next_Subpr_Element := Node_To_Element_New (Node => Next_Expl_Subpr, Node_Field_1 => Next_Subpr_Node, Internal_Kind => Next_Subpr_Kind, Inherited => True, In_Unit => Result_Unit); -- See the comment in the body of -- A4G.A_Sem.Get_Corr_Called_Entity if Is_From_Instance (Next_Subpr_Node) then Set_From_Instance (Next_Subpr_Element, True); else Set_From_Instance (Next_Subpr_Element, False); end if; Asis_Element_Table.Append (Next_Subpr_Element); end if; end if; Next_Subpr_Node := Next_Entity (Next_Subpr_Node); end loop; return Asis.Declaration_List (Asis_Element_Table.Table (1 .. Asis_Element_Table.Last)); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Definition, Outer_Call => Package_Name & "Implicit_Inherited_Subprograms"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Implicit_Inherited_Subprograms", Ex => Ex, Arg_Element => Definition); end Implicit_Inherited_Subprograms; ----------------------------------------------------------------------------- function Corresponding_Parent_Subtype (Type_Definition : Asis.Type_Definition) return Asis.Declaration is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Type_Mark_Node : Node_Id; Result_Node : Node_Id; Result_Unit : Asis.Compilation_Unit; Result : Asis.Element := Nil_Element; begin Check_Validity (Type_Definition, Package_Name & "Corresponding_Parent_Subtype"); if not (Arg_Kind = A_Derived_Type_Definition or else Arg_Kind = A_Derived_Record_Extension_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Corresponding_Parent_Subtype", Wrong_Kind => Arg_Kind); end if; Type_Mark_Node := Sinfo.Subtype_Indication (Node (Type_Definition)); if Nkind (Type_Mark_Node) = N_Subtype_Indication then Type_Mark_Node := Sinfo.Subtype_Mark (Type_Mark_Node); end if; if Nkind (Original_Node (Type_Mark_Node)) /= N_Attribute_Reference then Result_Node := Entity (Type_Mark_Node); Result_Node := Parent (Result_Node); Result_Unit := Enclosing_Unit (Encl_Cont_Id (Type_Definition), Result_Node); Result := Node_To_Element_New (Node => Result_Node, In_Unit => Result_Unit); end if; return Result; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Corresponding_Parent_Subtype"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Corresponding_Parent_Subtype", Ex => Ex, Arg_Element => Type_Definition); end Corresponding_Parent_Subtype; ----------------------------------------------------------------------------- function Corresponding_Root_Type (Type_Definition : Asis.Type_Definition) return Asis.Declaration is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Result_El : Asis.Declaration; Result_Kind : Internal_Element_Kinds; Def_El : Asis.Type_Definition; Def_Kind : Internal_Element_Kinds; begin Check_Validity (Type_Definition, Package_Name & "Corresponding_Root_Type"); if not (Arg_Kind = A_Derived_Type_Definition or else Arg_Kind = A_Derived_Record_Extension_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Corresponding_Root_Type", Wrong_Kind => Arg_Kind); end if; Result_El := Corresponding_Parent_Subtype_Unwind_Base (Type_Definition); loop Result_Kind := Int_Kind (Result_El); if Result_Kind = A_Subtype_Declaration then Result_El := Corresponding_First_Subtype (Result_El); else -- Result_El can be of An_Ordinary_Type_Declaration, -- A_Task_Type_Declaration, A_Protected_Type_Declaration, -- A_Private_Type_Declaration, A_Private_Extension_Declaration -- or A_Formal_Type_Declaration only if Result_Kind = An_Ordinary_Type_Declaration or else Result_Kind = A_Formal_Type_Declaration then Def_El := Type_Declaration_View (Result_El); Def_Kind := Int_Kind (Def_El); if Def_Kind = A_Derived_Type_Definition or else Def_Kind = A_Derived_Record_Extension_Definition then Result_El := Corresponding_Parent_Subtype_Unwind_Base (Def_El); else exit; end if; else exit; end if; end if; end loop; return Result_El; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Corresponding_Root_Type"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Corresponding_Root_Type", Ex => Ex, Arg_Element => Type_Definition); end Corresponding_Root_Type; ------------------------------------------------------------------------------ function Corresponding_Type_Structure (Type_Definition : Asis.Type_Definition) return Asis.Declaration is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Result_El : Asis.Element; Type_Def_El : Asis.Element; Res_Entity_Node : Node_Id; Tmp_Node : Node_Id; begin Check_Validity (Type_Definition, Package_Name & "Corresponding_Type_Structure"); if not (Arg_Kind = A_Derived_Type_Definition or else Arg_Kind = A_Derived_Record_Extension_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Corresponding_Type_Structure", Wrong_Kind => Arg_Kind); end if; -- The implementation approach: -- 1. We are considering, that the following things change the -- type structure (type representation): -- (1) adding the new component to a tagged record type; -- (2) applying any representation pragma or representation -- clause to a type in the derivation chain -- ??? What about adding a new primitive operation in case of a -- ??? tagged type? It changes the representation of the tag. -- -- 2. The implementation is based on other semantic queries from -- this package. The idea is to make the implementation more -- stable and to isolate the code which depends on processing of -- implicit types in the tree Result_El := Enclosing_Element (Type_Definition); Res_Entity_Node := Defining_Identifier (Node (Result_El)); Derivation_Chain : loop -- In this loop we are iterating through the derivation chain. -- There are three reasons to exit the loop: -- 1. Result_El has representation items; -- 2. Result_El is not a derived type -- 3. Result_El defines a new component Tmp_Node := First_Rep_Item (Res_Entity_Node); while Present (Tmp_Node) loop if not Is_Derived_Rep_Item (Res_Entity_Node, Tmp_Node) then exit Derivation_Chain; end if; Tmp_Node := Next_Rep_Item (Tmp_Node); end loop; Type_Def_El := Type_Declaration_View (Result_El); case Int_Kind (Type_Def_El) is when A_Derived_Type_Definition | A_Formal_Derived_Type_Definition => null; when A_Derived_Record_Extension_Definition => -- Here we are iterating through the list of the components -- checking if there is a new, non-inherited component: Tmp_Node := First_Entity (Res_Entity_Node); while Present (Tmp_Node) loop if (Ekind (Tmp_Node) = E_Component or else Ekind (Tmp_Node) = E_Discriminant) and then Original_Record_Component (Tmp_Node) = Tmp_Node then -- Note that we can have implicit (sub)types in the chain exit Derivation_Chain; end if; Tmp_Node := Next_Entity (Tmp_Node); end loop; when others => exit Derivation_Chain; end case; Result_El := Type_Declaration_View (Result_El); Result_El := Corresponding_Parent_Subtype (Result_El); if Int_Kind (Result_El) = A_Subtype_Declaration then Result_El := Corresponding_First_Subtype (Result_El); end if; Res_Entity_Node := Defining_Identifier (Node (Result_El)); end loop Derivation_Chain; return Result_El; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Corresponding_Type_Structure"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Corresponding_Type_Structure", Ex => Ex, Arg_Element => Type_Definition); end Corresponding_Type_Structure; ------------------------------------------------------------------------------ function Enumeration_Literal_Declarations (Type_Definition : Asis.Type_Definition) return Asis.Declaration_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Arg_Node : Node_Id; begin Check_Validity (Type_Definition, Package_Name & "Enumeration_Literal_Declarations"); if not (Arg_Kind = An_Enumeration_Type_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Enumeration_Literal_Declarations", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Type_Definition); if Is_Standard_Char_Type (Arg_Node) then -- There is no Literals list for standard char types, so a special -- processing is needed return Standard_Char_Decls (Type_Definition); else return N_To_E_List_New (List => Literals (Arg_Node), Starting_Element => Type_Definition, Internal_Kind => An_Enumeration_Literal_Specification); end if; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Enumeration_Literal_Declarations"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Enumeration_Literal_Declarations", Ex => Ex, Arg_Element => Type_Definition); end Enumeration_Literal_Declarations; ------------------------------------------------------------------------------ -- OPEN PROBLEMS: -- -- 1. Standard.Character and Standard.Whide_Character types have -- to be processed specifically (See Sinfo.ads item for -- N_Enumeration_Type_Definition Node. This is not implemented yet. ------------------------------------------------------------------------------ function Integer_Constraint (Type_Definition : Asis.Type_Definition) return Asis.Range_Constraint is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Arg_Node : Node_Id; begin Check_Validity (Type_Definition, Package_Name & "Integer_Constraint"); if not (Arg_Kind = A_Signed_Integer_Type_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Integer_Constraint", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Type_Definition); return Node_To_Element_New (Node => Arg_Node, Starting_Element => Type_Definition, Internal_Kind => A_Simple_Expression_Range); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Integer_Constraint"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Integer_Constraint", Ex => Ex, Arg_Element => Type_Definition); end Integer_Constraint; ----------------------------------------------------------------------------- function Mod_Static_Expression (Type_Definition : Asis.Type_Definition) return Asis.Expression is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Arg_Node : Node_Id; begin Check_Validity (Type_Definition, Package_Name & "Mod_Static_Expression"); if not (Arg_Kind = A_Modular_Type_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Mod_Static_Expression", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Type_Definition); return Node_To_Element_New (Node => Sinfo.Expression (Arg_Node), Starting_Element => Type_Definition); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Mod_Static_Expression"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Mod_Static_Expression", Ex => Ex, Arg_Element => Type_Definition); end Mod_Static_Expression; ----------------------------------------------------------------------------- function Digits_Expression (Definition : Asis.Definition) return Asis.Expression is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Definition); Arg_Node : Node_Id; begin Check_Validity (Definition, Package_Name & "Digits_Expression"); if not (Arg_Kind = A_Floating_Point_Definition or else Arg_Kind = A_Decimal_Fixed_Point_Definition or else Arg_Kind = A_Digits_Constraint) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Digits_Expression", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Definition); return Node_To_Element_New (Node => Digits_Expression (Arg_Node), Starting_Element => Definition); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Definition, Outer_Call => Package_Name & "Digits_Expression"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Digits_Expression", Ex => Ex, Arg_Element => Definition); end Digits_Expression; ----------------------------------------------------------------------------- function Delta_Expression (Definition : Asis.Definition) return Asis.Expression is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Definition); Arg_Node : Node_Id; begin Check_Validity (Definition, Package_Name & "Delta_Expression"); if not (Arg_Kind = An_Ordinary_Fixed_Point_Definition or else Arg_Kind = A_Decimal_Fixed_Point_Definition or else Arg_Kind = A_Delta_Constraint) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Delta_Expression", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Definition); return Node_To_Element_New (Node => Delta_Expression (Arg_Node), Starting_Element => Definition); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Definition, Outer_Call => Package_Name & "Delta_Expression"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Delta_Expression", Ex => Ex, Arg_Element => Definition); end Delta_Expression; ----------------------------------------------------------------------------- function Real_Range_Constraint (Definition : Asis.Definition) return Asis.Range_Constraint is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Definition); Arg_Node : Node_Id; Result_Node : Node_Id; begin Check_Validity (Definition, Package_Name & "Real_Range_Constraint"); if not (Arg_Kind = A_Floating_Point_Definition or else Arg_Kind = An_Ordinary_Fixed_Point_Definition or else Arg_Kind = A_Decimal_Fixed_Point_Definition or else Arg_Kind = A_Digits_Constraint or else Arg_Kind = A_Delta_Constraint) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Real_Range_Constraint", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Definition); if Arg_Kind = A_Floating_Point_Definition or else Arg_Kind = An_Ordinary_Fixed_Point_Definition or else Arg_Kind = A_Decimal_Fixed_Point_Definition then Result_Node := Real_Range_Specification (Arg_Node); else -- Arg_Kind = A_Digits_Constraint or Arg_Kind = A_Delta_Constraint Result_Node := Sinfo.Range_Constraint (Arg_Node); end if; if No (Result_Node) then return Nil_Element; else return Node_To_Element_New (Node => Result_Node, Starting_Element => Definition, Internal_Kind => A_Simple_Expression_Range); end if; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information ( Argument => Definition, Outer_Call => Package_Name & "Real_Range_Constraint"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Real_Range_Constraint", Ex => Ex, Arg_Element => Definition); end Real_Range_Constraint; ----------------------------------------------------------------------------- function Index_Subtype_Definitions (Type_Definition : Asis.Type_Definition) return Asis.Expression_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Arg_Node : Node_Id; begin Check_Validity (Type_Definition, Package_Name & "Index_Subtype_Definitions"); if not (Arg_Kind = An_Unconstrained_Array_Definition or else Arg_Kind = A_Formal_Unconstrained_Array_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Index_Subtype_Definitions", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Type_Definition); return N_To_E_List_New (List => Subtype_Marks (Arg_Node), Starting_Element => Type_Definition); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information ( Argument => Type_Definition, Outer_Call => Package_Name & "Index_Subtype_Definitions"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Index_Subtype_Definitions", Ex => Ex, Arg_Element => Type_Definition); end Index_Subtype_Definitions; ----------------------------------------------------------------------------- function Discrete_Subtype_Definitions (Type_Definition : Asis.Type_Definition) return Asis.Definition_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Arg_Node : Node_Id; begin Check_Validity (Type_Definition, Package_Name & "Discrete_Subtype_Definitions"); if not (Arg_Kind = A_Constrained_Array_Definition or else Arg_Kind = A_Formal_Constrained_Array_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Discrete_Subtype_Definitions", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Type_Definition); return N_To_E_List_New ( List => Discrete_Subtype_Definitions (Arg_Node), Starting_Element => Type_Definition); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Discrete_Subtype_Definitions"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Discrete_Subtype_Definitions", Ex => Ex, Arg_Element => Type_Definition); end Discrete_Subtype_Definitions; -------------------------------- -- Array_Component_Definition -- -------------------------------- function Array_Component_Definition (Type_Definition : Asis.Type_Definition) return Asis.Component_Definition is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Arg_Node : Node_Id; begin Check_Validity (Type_Definition, Package_Name & "Array_Component_Definition"); if not (Arg_Kind = An_Unconstrained_Array_Definition or else Arg_Kind = A_Constrained_Array_Definition or else Arg_Kind = A_Formal_Unconstrained_Array_Definition or else Arg_Kind = A_Formal_Constrained_Array_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Array_Component_Definition", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Type_Definition); return Node_To_Element_New (Node => Sinfo.Component_Definition (Arg_Node), Starting_Element => Type_Definition, Internal_Kind => A_Component_Definition); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Array_Component_Definition"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Array_Component_Definition", Ex => Ex, Arg_Element => Type_Definition); end Array_Component_Definition; ----------------------------------------------------------------------------- function Access_To_Object_Definition (Type_Definition : Asis.Type_Definition) return Asis.Subtype_Indication is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Arg_Node : Node_Id; begin Check_Validity (Type_Definition, Package_Name & "Access_To_Object_Definition"); if not (Arg_Kind = A_Pool_Specific_Access_To_Variable or else Arg_Kind = An_Access_To_Variable or else Arg_Kind = An_Access_To_Constant or else Arg_Kind = A_Formal_Pool_Specific_Access_To_Variable or else Arg_Kind = A_Formal_Access_To_Variable or else Arg_Kind = A_Formal_Access_To_Constant) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Access_To_Object_Definition", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Type_Definition); return Node_To_Element_New (Node => Sinfo.Subtype_Indication (Arg_Node), Starting_Element => Type_Definition, Internal_Kind => A_Subtype_Indication); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Access_To_Object_Definition"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Access_To_Object_Definition", Ex => Ex, Arg_Element => Type_Definition); end Access_To_Object_Definition; ----------------------------------------------------------------------------- function Access_To_Subprogram_Parameter_Profile (Type_Definition : Asis.Type_Definition) return Asis.Parameter_Specification_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Arg_Node : Node_Id; Result_List : List_Id; begin Check_Validity (Type_Definition, Package_Name & "Access_To_Subprogram_Parameter_Profile"); if not (Arg_Kind = An_Access_To_Procedure or else Arg_Kind = An_Access_To_Protected_Procedure or else Arg_Kind = An_Access_To_Function or else Arg_Kind = An_Access_To_Protected_Function or else Arg_Kind = A_Formal_Access_To_Procedure or else Arg_Kind = A_Formal_Access_To_Protected_Procedure or else Arg_Kind = A_Formal_Access_To_Function or else Arg_Kind = A_Formal_Access_To_Protected_Function or else -- --|A2005 start Arg_Kind = An_Anonymous_Access_To_Procedure or else Arg_Kind = An_Anonymous_Access_To_Protected_Procedure or else Arg_Kind = An_Anonymous_Access_To_Function or else Arg_Kind = An_Anonymous_Access_To_Protected_Function) -- --|A2005 end then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Access_To_Subprogram_Parameter_Profile", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Type_Definition); -- --|A2005 start if Nkind (Arg_Node) = N_Access_Definition then Arg_Node := Sinfo.Access_To_Subprogram_Definition (Arg_Node); end if; -- --|A2005 end Result_List := Parameter_Specifications (Arg_Node); if No (Result_List) then return Nil_Element_List; else return N_To_E_List_New (List => Result_List, Starting_Element => Type_Definition, Internal_Kind => A_Parameter_Specification); end if; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Access_To_Subprogram_Parameter_Profile"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Access_To_Subprogram_Parameter_Profile", Ex => Ex, Arg_Element => Type_Definition); end Access_To_Subprogram_Parameter_Profile; ----------------------------------------------------------------------------- function Access_To_Function_Result_Profile (Type_Definition : Asis.Type_Definition) return Asis.Expression is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Type_Definition); Arg_Node : Node_Id; begin Check_Validity (Type_Definition, Package_Name & "Access_To_Function_Result_Profile"); if not (Arg_Kind = An_Access_To_Function or else Arg_Kind = An_Access_To_Protected_Function or else Arg_Kind = A_Formal_Access_To_Function or else Arg_Kind = A_Formal_Access_To_Protected_Function or else -- --|A2005 start Arg_Kind = An_Anonymous_Access_To_Function or else Arg_Kind = An_Anonymous_Access_To_Protected_Function) -- --|A2005 end then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Access_To_Function_Result_Profile", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Type_Definition); -- --|A2005 start if Nkind (Arg_Node) = N_Access_Definition then Arg_Node := Sinfo.Access_To_Subprogram_Definition (Arg_Node); end if; -- --|A2005 end return Node_To_Element_New (Node => Sinfo.Result_Definition (Arg_Node), Starting_Element => Type_Definition); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Type_Definition, Outer_Call => Package_Name & "Access_To_Function_Result_Profile"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Access_To_Function_Result_Profile", Ex => Ex, Arg_Element => Type_Definition); end Access_To_Function_Result_Profile; ----------------------------------------------------------------------------- function Subtype_Mark (Definition : Asis.Definition) return Asis.Expression is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Definition); Arg_Node : Node_Id; Result_Node : Node_Id; Result_Kind : Internal_Element_Kinds := Not_An_Element; begin Check_Validity (Definition, Package_Name & "Subtype_Mark"); if not (Arg_Kind = A_Subtype_Indication or else Arg_Kind = A_Discrete_Subtype_Indication or else Arg_Kind = A_Formal_Derived_Type_Definition or else Arg_Kind = A_Discrete_Subtype_Indication_As_Subtype_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Subtype_Mark", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Definition); if Nkind (Arg_Node) = N_Subtype_Indication or else Nkind (Arg_Node) = N_Formal_Derived_Type_Definition then Result_Node := Sinfo.Subtype_Mark (Arg_Node); else Result_Node := R_Node (Definition); end if; if Nkind (Original_Node (Result_Node)) = N_Identifier and then not Is_Rewrite_Substitution (Result_Node) then if Is_Part_Of_Instance (Definition) then if Represents_Class_Wide_Type_In_Instance (Result_Node) then Result_Kind := A_Class_Attribute; elsif Represents_Base_Type_In_Instance (Result_Node) then Result_Kind := A_Base_Attribute; else Result_Kind := An_Identifier; end if; else Result_Kind := An_Identifier; end if; elsif Nkind (Original_Node (Result_Node)) = N_Expanded_Name then Result_Kind := A_Selected_Component; end if; return Node_To_Element_New (Node => Result_Node, Starting_Element => Definition, Internal_Kind => Result_Kind); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Definition, Outer_Call => Package_Name & "Subtype_Mark"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Subtype_Mark", Ex => Ex, Arg_Element => Definition); end Subtype_Mark; ----------------------------------------------------------------------------- function Subtype_Constraint (Definition : Asis.Definition) return Asis.Constraint is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Definition); Arg_Node : Node_Id; Result_Node : Node_Id := Empty; Result_Kind : Internal_Element_Kinds := Not_An_Element; begin Check_Validity (Definition, Package_Name & "Subtype_Constraint"); if not (Arg_Kind = A_Subtype_Indication or else Arg_Kind = A_Discrete_Subtype_Indication or else Arg_Kind = A_Discrete_Subtype_Indication_As_Subtype_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Subtype_Constraint", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Definition); if Nkind (Arg_Node) = N_Subtype_Indication then Result_Node := Sinfo.Constraint (Arg_Node); elsif Sloc (Arg_Node) <= Standard_Location and then Nkind (Parent (Arg_Node)) = N_Subtype_Declaration then -- This is either Standard.Positive or Standard.Natural, -- they have the constraint information not in -- N_Subtype_Declaration node, but in N_Defining_Identifier node Result_Node := Scalar_Range (Defining_Identifier (Parent (Arg_Node))); Result_Kind := A_Simple_Expression_Range; end if; return Node_To_Element_New (Node => Result_Node, Starting_Element => Definition, Internal_Kind => Result_Kind); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Definition, Outer_Call => Package_Name & "Subtype_Constraint"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Subtype_Constraint", Ex => Ex, Arg_Element => Definition); end Subtype_Constraint; ----------------------------------------------------------------------------- function Lower_Bound (Constraint : Asis.Range_Constraint) return Asis.Expression is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Constraint); Arg_Node : Node_Id; Result_Node : Node_Id; begin Check_Validity (Constraint, Package_Name & "Lower_Bound"); if not (Arg_Kind = A_Simple_Expression_Range or else Arg_Kind = A_Discrete_Simple_Expression_Range or else Arg_Kind = A_Discrete_Simple_Expression_Range_As_Subtype_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Lower_Bound", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Constraint); if Nkind (Arg_Node) = N_Range_Constraint then Result_Node := Low_Bound (Range_Expression (Arg_Node)); elsif Nkind (Arg_Node) = N_Component_Clause then Result_Node := First_Bit (Arg_Node); else -- Nkind (Arg_Node) = N_Range or else -- Nkind (Arg_Node) = N_Real_Range_Specification Result_Node := Low_Bound (Arg_Node); end if; return Node_To_Element_New (Node => Result_Node, Starting_Element => Constraint); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Constraint, Outer_Call => Package_Name & "Lower_Bound"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Lower_Bound", Ex => Ex, Arg_Element => Constraint); end Lower_Bound; ----------------------------------------------------------------------------- function Upper_Bound (Constraint : Asis.Range_Constraint) return Asis.Expression is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Constraint); Arg_Node : Node_Id; Result_Node : Node_Id; begin Check_Validity (Constraint, Package_Name & "Upper_Bound"); if not (Arg_Kind = A_Simple_Expression_Range or else Arg_Kind = A_Discrete_Simple_Expression_Range or else Arg_Kind = A_Discrete_Simple_Expression_Range_As_Subtype_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Upper_Bound", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Constraint); if Nkind (Arg_Node) = N_Range_Constraint then Result_Node := High_Bound (Range_Expression (Arg_Node)); elsif Nkind (Arg_Node) = N_Component_Clause then Result_Node := Last_Bit (Arg_Node); else Result_Node := High_Bound (Arg_Node); end if; return Node_To_Element_New (Node => Result_Node, Starting_Element => Constraint); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Constraint, Outer_Call => Package_Name & "Upper_Bound"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Upper_Bound", Ex => Ex, Arg_Element => Constraint); end Upper_Bound; ----------------------------------------------------------------------------- function Range_Attribute (Constraint : Asis.Range_Constraint) return Asis.Expression is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Constraint); Arg_Node : constant Node_Id := Node (Constraint); Result_Node : Node_Id; begin Check_Validity (Constraint, Package_Name & "Range_Attribute"); if not (Arg_Kind = A_Range_Attribute_Reference or else Arg_Kind = A_Discrete_Range_Attribute_Reference or else Arg_Kind = A_Discrete_Range_Attribute_Reference_As_Subtype_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Range_Attribute", Wrong_Kind => Arg_Kind); end if; if Nkind (Arg_Node) = N_Range_Constraint then -- one step down to N_Attruibute_Reference node Result_Node := Range_Expression (Arg_Node); else Result_Node := R_Node (Constraint); end if; return Node_To_Element_New (Starting_Element => Constraint, Node => Result_Node, Internal_Kind => A_Range_Attribute); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Constraint, Outer_Call => Package_Name & "Range_Attribute"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Range_Attribute", Ex => Ex, Arg_Element => Constraint); end Range_Attribute; ------------------------------------------------------------------------- function Discrete_Ranges (Constraint : Asis.Constraint) return Asis.Discrete_Range_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Constraint); Arg_Node : Node_Id; begin Check_Validity (Constraint, Package_Name & "Discrete_Ranges"); if not (Arg_Kind = An_Index_Constraint) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Discrete_Ranges", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Constraint); return N_To_E_List_New (List => Constraints (Arg_Node), Starting_Element => Constraint); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Constraint, Outer_Call => Package_Name & "Discrete_Ranges"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Discrete_Ranges", Ex => Ex, Arg_Element => Constraint); end Discrete_Ranges; ------------------------------------------------------------------------------ -- ??? PARTIALLY IMPLEMENTED, CANNOT PROCESS THE CASE WHEN -- ??? NORMALIZED = TRUE function Discriminant_Associations (Constraint : Asis.Constraint; Normalized : Boolean := False) return Asis.Discriminant_Association_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Constraint); Arg_Node : Node_Id; begin Check_Validity (Constraint, Package_Name & "Discriminant_Associations"); if not (Arg_Kind = A_Discriminant_Constraint) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Discriminant_Associations", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Constraint); if Normalized then return Normalized_Discriminant_Associations ( Constr_Elem => Constraint, Constr_Node => Arg_Node); else return N_To_E_List_New (List => Constraints (Arg_Node), Internal_Kind => A_Discriminant_Association, Starting_Element => Constraint); end if; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Constraint, Bool_Par => Normalized, Outer_Call => Package_Name & "Discriminant_Associations"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Discriminant_Associations", Ex => Ex, Arg_Element => Constraint, Bool_Par_ON => Normalized); end Discriminant_Associations; ----------------------------------------------------------------------------- function Component_Subtype_Indication (Component_Definition : Asis.Definition) return Asis.Definition is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Component_Definition); Arg_Node : Node_Id; begin Check_Validity (Component_Definition, Package_Name & "Component_Subtype_Indication"); if not (Arg_Kind = A_Component_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Component_Subtype_Indication", Wrong_Kind => Arg_Kind); end if; Arg_Node := Sinfo.Subtype_Indication (R_Node (Component_Definition)); return Node_To_Element_New (Node => Arg_Node, Starting_Element => Component_Definition, Internal_Kind => A_Subtype_Indication); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Component_Definition, Outer_Call => Package_Name & "Component_Subtype_Indication"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Component_Subtype_Indication", Ex => Ex, Arg_Element => Component_Definition); end Component_Subtype_Indication; ----------------------------------------------------------------------------- function Discriminants (Definition : Asis.Definition) return Asis.Discriminant_Specification_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Definition); Arg_Node : Node_Id; begin Check_Validity (Definition, Package_Name & "Discriminations"); if not (Arg_Kind = A_Known_Discriminant_Part) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Discriminations", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Definition); return N_To_E_List_New (List => Discriminant_Specifications (Arg_Node), Starting_Element => Definition, Internal_Kind => A_Discriminant_Specification); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Definition, Outer_Call => Package_Name & "Discriminations"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Discriminations", Ex => Ex, Arg_Element => Definition); end Discriminants; ----------------------------------------------------------------------------- function Record_Components (Definition : Asis.Record_Definition; Include_Pragmas : Boolean := False) return Asis.Record_Component_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Definition); Arg_Node : Node_Id; Component_List_Node : Node_Id; Result_List : List_Id; -- All nodes except the Variant Node Variant_Part_Node : Node_Id; begin Check_Validity (Definition, Package_Name & "Record_Components"); if not (Arg_Kind = A_Record_Definition or else Arg_Kind = A_Variant) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Record_Components", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Definition); Component_List_Node := Component_List (Arg_Node); -- first, we should check the null record case: if Null_Present (Component_List_Node) then return Element_List'(1 => Node_To_Element_New (Node => Arg_Node, Starting_Element => Definition, Internal_Kind => A_Null_Component)); end if; Result_List := Component_Items (Component_List_Node); Variant_Part_Node := Variant_Part (Component_List_Node); if No (Variant_Part_Node) then return N_To_E_List_New (List => Result_List, Include_Pragmas => Include_Pragmas, Starting_Element => Definition); else return ( N_To_E_List_New (List => Result_List, Include_Pragmas => Include_Pragmas, Starting_Element => Definition) & Element_List'(1 => Node_To_Element_New (Node => Variant_Part_Node, Starting_Element => Definition, Internal_Kind => A_Variant_Part)) ); end if; exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Definition, Bool_Par => Include_Pragmas, Outer_Call => Package_Name & "Record_Components"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Record_Components", Ex => Ex, Arg_Element => Definition, Bool_Par_ON => Include_Pragmas); end Record_Components; ------------------------------------------------------------------------------ -- NOT IMPLEMENTED function Implicit_Components (Definition : Asis.Record_Definition) return Asis.Record_Component_List is begin Check_Validity (Definition, Package_Name & "Implicit_Components"); Not_Implemented_Yet (Diagnosis => Package_Name & "Implicit_Components"); -- ASIS_Failed is raised, Not_Implemented_Error status is set return Nil_Element_List; -- to make the code syntactically correct exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Definition, Outer_Call => Package_Name & "Implicit_Components"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Implicit_Components", Ex => Ex, Arg_Element => Definition); end Implicit_Components; ----------------------------------------------------------------------------- function Discriminant_Direct_Name (Variant_Part : Asis.Record_Component) return Asis.Name is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Variant_Part); Arg_Node : Node_Id; begin Check_Validity (Variant_Part, Package_Name & "Discriminant_Direct_Name"); if not (Arg_Kind = A_Variant_Part) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Discriminant_Direct_Name", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Variant_Part); return Node_To_Element_New (Node => Sinfo.Name (Arg_Node), Starting_Element => Variant_Part, Internal_Kind => An_Identifier); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Variant_Part, Outer_Call => Package_Name & "Discriminant_Direct_Name"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Discriminant_Direct_Name", Ex => Ex, Arg_Element => Variant_Part); end Discriminant_Direct_Name; ----------------------------------------------------------------------------- function Variants (Variant_Part : Asis.Record_Component; Include_Pragmas : Boolean := False) return Asis.Variant_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Variant_Part); Arg_Node : Node_Id; begin Check_Validity (Variant_Part, Package_Name & "Variants"); if not (Arg_Kind = A_Variant_Part) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Variants", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Variant_Part); return N_To_E_List_New (List => Variants (Arg_Node), Include_Pragmas => Include_Pragmas, Starting_Element => Variant_Part); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Variant_Part, Bool_Par => Include_Pragmas, Outer_Call => Package_Name & "Variants"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Variants", Ex => Ex, Arg_Element => Variant_Part, Bool_Par_ON => Include_Pragmas); end Variants; ----------------------------------------------------------------------------- function Variant_Choices (Variant : Asis.Variant) return Asis.Element_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Variant); Arg_Node : Node_Id; begin Check_Validity (Variant, Package_Name & "Variant_Choices"); if not (Arg_Kind = A_Variant) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Variant_Choices", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Variant); return Discrete_Choice_Node_To_Element_List (Choice_List => Discrete_Choices (Arg_Node), Starting_Element => Variant); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Variant, Outer_Call => Package_Name & "Variant_Choices"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Variant_Choices", Ex => Ex, Arg_Element => Variant); end Variant_Choices; ------------------------------------------------------------------------------ -- OPEN PROBLEMS: -- -- 1. Is using of the special list construction function -- Discrete_Choice_Node_To_Element_List really necessary here? We should -- try to replace it by non-special (trivial) constructor (all -- necessary local mapping items for Nodes in the Node List have -- already been defined - ???). -- -- IT SEEMS TO BE NOT ONLY OK, BUT REALLY NECESSARY HERE (03.11.95) ------------------------------------------------------------------------------ function Ancestor_Subtype_Indication (Definition : Asis.Definition) return Asis.Definition is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Definition); Arg_Node : Node_Id; begin Check_Validity (Definition, Package_Name & "Ancestor_Subtype_Indication"); if not (Arg_Kind = A_Private_Extension_Definition) then Raise_ASIS_Inappropriate_Element (Diagnosis => Package_Name & "Ancestor_Subtype_Indication", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Definition); return Node_To_Element_New (Node => Sinfo.Subtype_Indication (Arg_Node), Starting_Element => Definition, Internal_Kind => A_Subtype_Indication); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Definition, Outer_Call => Package_Name & "Ancestor_Subtype_Indication"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Ancestor_Subtype_Indication", Ex => Ex, Arg_Element => Definition); end Ancestor_Subtype_Indication; ----------------------------------------------------------------------------- function Visible_Part_Items (Definition : Asis.Definition; Include_Pragmas : Boolean := False) return Asis.Definition_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Definition); Arg_Node : Node_Id; begin Check_Validity (Definition, Package_Name & "Visible_Part_Items"); if not (Arg_Kind = A_Task_Definition or else Arg_Kind = A_Protected_Definition) then Raise_ASIS_Inappropriate_Element (Package_Name & "Visible_Part_Items", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Definition); return N_To_E_List_New (List => Visible_Declarations (Arg_Node), Include_Pragmas => Include_Pragmas, Starting_Element => Definition); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Definition, Bool_Par => Include_Pragmas, Outer_Call => Package_Name & "Visible_Part_Items"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Visible_Part_Items", Ex => Ex, Arg_Element => Definition, Bool_Par_ON => Include_Pragmas); end Visible_Part_Items; ----------------------------------------------------------------------------- function Private_Part_Items (Definition : Asis.Definition; Include_Pragmas : Boolean := False) return Asis.Definition_List is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Definition); Arg_Node : Node_Id; begin Check_Validity (Definition, Package_Name & "Private_Part_Items"); if not (Arg_Kind = A_Task_Definition or else Arg_Kind = A_Protected_Definition) then Raise_ASIS_Inappropriate_Element (Package_Name & "Private_Part_Items", Wrong_Kind => Arg_Kind); end if; Arg_Node := Node (Definition); return N_To_E_List_New (List => Private_Declarations (Arg_Node), Include_Pragmas => Include_Pragmas, Starting_Element => Definition); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Definition, Bool_Par => Include_Pragmas, Outer_Call => Package_Name & "Private_Part_Items"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Private_Part_Items", Ex => Ex, Arg_Element => Definition, Bool_Par_ON => Include_Pragmas); end Private_Part_Items; ----------------------------------------------------------------------------- function Is_Private_Present (Definition : Asis.Definition) return Boolean is Arg_Kind : constant Internal_Element_Kinds := Int_Kind (Definition); Arg_Node : Node_Id; begin Check_Validity (Definition, Package_Name & "Is_Private_Present"); if not (Arg_Kind = A_Task_Definition or else Arg_Kind = A_Protected_Definition) then -- unexpected element return False; end if; Arg_Node := Node (Definition); return Present (Private_Declarations (Arg_Node)); exception when ASIS_Inappropriate_Element => raise; when ASIS_Failed => if Status_Indicator = Unhandled_Exception_Error then Add_Call_Information (Argument => Definition, Outer_Call => Package_Name & "Is_Private_Present"); end if; raise; when Ex : others => Report_ASIS_Bug (Query_Name => Package_Name & "Is_Private_Present", Ex => Ex, Arg_Element => Definition); end Is_Private_Present; ----------------------------------------------------------------------------- end Asis.Definitions;
05_Optimized_Surface/05_Optimized_Surface.asm
DebugBSD/SDLExamples
3
102005
<reponame>DebugBSD/SDLExamples<filename>05_Optimized_Surface/05_Optimized_Surface.asm ; Windows externdef ExitProcess:PROTO ; SDL include inc/SDL.inc ; Prototypes of my Program Init PROTO LoadMedia PROTO Close PROTO LoadSurface PROTO .CONST SCREEN_WIDTH = 640 SCREEN_HEIGHT = 480 WINDOW_TITLE BYTE "SDL Tutorial",0 FILE_ATTRS BYTE "rb" IMAGE_PRESS BYTE "Res/stretch.bmp",0 .DATA quit BYTE 0 stretchedRect SDL_Rect<> .DATA? pWindow QWORD ? pScreenSurface QWORD ? eventHandler SDL_Event <> gStretchedSurface QWORD ? .CODE main PROC sub rsp, 40 ; Reserve memory for shadow space ; Init SDL and other stuff call Init cmp rax, 0 je SDLERROR ; Load data call LoadMedia cmp rax, 0 je SDLERROR L1: cmp quit, 1 je EXIT_LOOP L2: mov rcx, offset eventHandler call SDL_PollEvent cmp rax, 0 je L1 cmp eventHandler.type_, SDL_QUIT jne L3 mov quit, 1 jmp L4 L3: mov stretchedRect.x,0 mov stretchedRect.y, 0 mov stretchedRect.w, SCREEN_WIDTH mov stretchedRect.h, SCREEN_HEIGHT ; Apply the image mov r9, OFFSET stretchedRect mov r8, pScreenSurface mov rdx, 0 mov rcx, gStretchedSurface call SDL_BlitScaled ; Update the surface mov rcx, pWindow call SDL_UpdateWindowSurface L4: jmp L1 EXIT_LOOP: ; Destroy the window mov rcx, pWindow call SDL_DestroyWindow SDLERROR: ; Quit the subsystem call Close EXIT: mov rax, 0 add rsp, 40 call ExitProcess main endp arg4 EQU<DWORD PTR[rsp+32]> arg5 EQU<DWORD PTR[rsp+40]> Init PROC sub rsp, 8 sub rsp, 32 sub rsp, 8 ; reserve space for argument 4 sub rsp, 8 ; reserve space for argument 5 mov rcx, SDL_INIT_VIDEO call SDL_Init cmp rax, 0 jb EXIT ; We create the Window mov arg5, SDL_WINDOW_SHOWN ; 6xt argument - (4) mov arg4, SCREEN_HEIGHT ; 5th argument - (480) 000001e0H mov r9, SCREEN_WIDTH ; 4th argument - (640) 00000280H mov r8, SDL_WINDOWPOS_UNDEFINED ; 3rd argument - 1fff0000H mov rdx, r8 ; 2nd argument - 1fff0000H lea rcx, OFFSET WINDOW_TITLE ; 1st argument - Window title call SDL_CreateWindow cmp rax, 0 je ERROR mov pWindow, rax ; Save the handle ; Get Window surface mov rcx, rax call SDL_GetWindowSurface mov pScreenSurface, rax jmp EXIT ERROR: mov rax, 0 EXIT: add rsp, 56 ; We clean all stack ret Init endp Close PROC sub rsp, 40 mov rcx, gStretchedSurface call SDL_FreeSurface mov rcx, pWindow call SDL_DestroyWindow call SDL_Quit add rsp, 40 ret Close endp LoadMedia PROC sub rsp, 40 mov rcx, OFFSET IMAGE_PRESS call LoadSurface cmp rax, 0 je ERROR mov gStretchedSurface, rax ERROR: add rsp, 40 ret LoadMedia endp LoadSurface PROC sub rsp, 40 mov rdx, OFFSET FILE_ATTRS call SDL_RWFromFile mov rcx, rax mov rdx, 1 call SDL_LoadBMP_RW cmp rax, 0 je ERROR mov r10, rax mov rbx, pScreenSurface mov r8, 0 mov rdx, (SDL_Surface PTR [rbx]).format mov rcx, rax call SDL_ConvertSurface cmp rax, 0 je ERROR mov rcx, r10 call SDL_FreeSurface ERROR: add rsp, 40 ret LoadSurface endp END
release/src/router/gmp/source/mpn/pa32/hppa1_1/sqr_diagonal.asm
zhoutao0712/rtn11pb1
184
179574
<reponame>zhoutao0712/rtn11pb1 dnl HP-PA 1.1 32-bit mpn_sqr_diagonal. dnl Copyright 2001, 2002 Free Software Foundation, Inc. dnl This file is part of the GNU MP Library. dnl The GNU MP Library is free software; you can redistribute it and/or modify dnl it under the terms of the GNU Lesser General Public License as published dnl by the Free Software Foundation; either version 3 of the License, or (at dnl your option) any later version. dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public dnl License for more details. dnl You should have received a copy of the GNU Lesser General Public License dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. include(`../config.m4') C This code runs at 6 cycles/limb on the PA7100 and 2.5 cycles/limb on PA8x00. C 2-way unrolling wouldn't help the PA7100; it could however bring times down C to 2.0 cycles/limb for the PA8x00. C INPUT PARAMETERS define(`rp',`%r26') define(`up',`%r25') define(`n',`%r24') ASM_START() PROLOGUE(mpn_sqr_diagonal) ldo 4(rp),rp fldws,ma 4(up),%fr4r addib,= -1,n,L(exit) xmpyu %fr4r,%fr4r,%fr5 LDEF(loop) fldws,ma 4(up),%fr4r fstws %fr5r,-4(rp) fstws,ma %fr5l,8(rp) addib,<> -1,n,L(loop) xmpyu %fr4r,%fr4r,%fr5 LDEF(exit) fstws %fr5r,-4(rp) bv 0(%r2) fstws %fr5l,0(rp) EPILOGUE(mpn_sqr_diagonal)
SNesoid/sneslib_comp/i386/zsnesc4.asm
Pretz/SNesoid
17
6132
; Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. ; ; Super FX assembler emulator code ; (c) Copyright 1998, 1999 zsKnight and _Demo_. ; ; Permission to use, copy, modify and distribute Snes9x in both binary and ; source form, for non-commercial purposes, is hereby granted without fee, ; providing that this license information and copyright notice appear with ; all copies and any derived work. ; ; This software is provided 'as-is', without any express or implied ; warranty. In no event shall the authors be held liable for any damages ; arising from the use of this software. ; ; Snes9x is freeware for PERSONAL USE only. Commercial users should ; seek permission of the copyright holders first. Commercial use includes ; charging money for Snes9x or software derived from Snes9x. ; ; The copyright holders request that bug fixes and improvements to the code ; should be forwarded to them so everyone can benefit from the modifications ; in future versions. ; ; Super NES and Super Nintendo Entertainment System are trademarks of ; Nintendo Co., Limited and its subsidiary companies. ; ; ZSNES SuperFX emulation code and wrappers ; (C) Copyright 1997-8 zsKnight and _Demo_ ; Used with the kind permission of the copyright holders. ; %include "i386/macros.mac" EXTSYM InitC4, C4RegFunction, C4ReadReg, C4WriteReg EXTSYM romdata [BITS 32] SECTION .data NEWSYM C4Ram, dd 0 NEWSYM C4RamR, dd 0 NEWSYM C4RamW, dd 0 NEWSYM pressed, dd 0 ; used by C4Edit (unused function) NEWSYM vidbuffer,dd 0 ; used by C4Edit NEWSYM oamram, times 544 db 0 ; Sprite PPU data used by C4 routines ; ; Snes9x wrapper functions for the zsnes C4 code ; (C) Copyright 2000 <NAME> SECTION .data %ifdef __DJGPP__ %define ROM _ROM %define RegRAM _RegRAM %define S9xInitC4 _S9xInitC4 %define S9xSetC4 _S9xSetC4 %define S9xSetC4RAM _S9xSetC4RAM %define S9xGetC4 _S9xGetC4 %define S9xGetC4RAM _S9xGetC4RAM %endif EXTERN ROM EXTERN RegRAM SECTION .text NEWSYM S9xInitC4 pushad mov eax,dword[ROM] mov dword[romdata],eax call InitC4 ; mov eax,dword[RegRAM] ; add eax,06000h ; mov dword[C4Ram],eax popad ret NEWSYM S9xSetC4 NEWSYM S9xSetC4RAM mov ecx, dword[esp+8] mov eax, dword[esp+4] and ecx, 0ffffh push ebx push esi push edi push ebp sub ecx, 6000h call C4RegFunction pop ebp pop edi pop esi pop ebx ret NEWSYM S9xGetC4 NEWSYM S9xGetC4RAM mov ecx, dword[esp+4] xor eax, eax and ecx, 0ffffh sub ecx, 06000h jmp C4ReadReg
test/Succeed/Issue2193.agda
cruhland/agda
1,989
7971
{-# OPTIONS --allow-unsolved-metas #-} case_of_ : {A B : Set} → A → (A → B) → B case x of f = f x data D : Set where c : D → D postulate d : D A : Set P : A → Set record R : Set where no-eta-equality field f : A -- R : Set -- Rf : R → A data Box : Set where box : R → Box postulate f : D → Box -- pat-lam : Box → A -- pat-lam (box y) = R.f y g : D → A g x = case f x of λ { (box y) → R.f y } postulate B : Set p : P (g (c d)) p with B p | z = {!!}
Task/Arrays/AppleScript/arrays-1.applescript
LaudateCorpus1/RosettaCodeData
1
457
<gh_stars>1-10 set empty to {} set ints to {1, 2, 3}
oeis/051/A051597.asm
neoneye/loda-programs
11
82493
; A051597: Rows of triangle formed using Pascal's rule except begin and end n-th row with n+1. ; Submitted by <NAME> ; 1,2,2,3,4,3,4,7,7,4,5,11,14,11,5,6,16,25,25,16,6,7,22,41,50,41,22,7,8,29,63,91,91,63,29,8,9,37,92,154,182,154,92,37,9,10,46,129,246,336,336,246,129,46,10,11,56,175,375,582,672,582,375,175,56,11,12,67,231,550,957,1254,1254,957,550,231,67,12,13,79,298,781,1507,2211,2508,2211,1507,781,298,79,13,14,92,377,1079,2288,3718,4719,4719,3718 mov $1,1 lpb $0 add $2,1 sub $0,$2 add $1,1 lpe bin $1,$0 add $0,1 bin $2,$0 add $2,$1 mov $0,$2
src/main/antlr4/PatternLanguage.g4
qhhan/flink-cep-dsl
1
6637
// Define a grammar called Hello grammar PatternLanguage; @header { package at.datasciencelabs.pattern.generated; } startPatternExpressionRule : patternExpression EOF; patternExpression : orExpression (followedByOrNextRepeat)*; orExpression : andExpression (o=OR_EXPR andExpression)*; followedByOrNextRepeat : followedByRepeat | followedByAnyRepeat | orExpression; followedByRepeat: f=FOLLOWED_BY orExpression; followedByAnyRepeat: f=FOLLOWED_BY_ANY orExpression; andExpression : matchUntilExpression (a=AND_EXPR matchUntilExpression)*; matchUntilExpression : qualifyExpression; qualifyExpression : (e=EVERY_EXPR | n=NOT_EXPR)? guardPostFix; guardPostFix : patternFilterExpression | l=LPAREN patternExpression RPAREN; patternFilterExpression : patternFilterExpressionOptional | patternFilterExpressionMandatory; patternFilterExpressionMandatory : (i=IDENT EQUALS)? classIdentifier quantifier? (LPAREN expressionList? RPAREN)?; patternFilterExpressionOptional : (i=IDENT EQUALS)? classIdentifier quantifier? (LPAREN expressionList? RPAREN)? QUESTION; quantifier: plus_quantifier | star_quantifier | number_quantifier | number_quantifier_greedy; number_quantifier_greedy: s=LCURLY numberconstant upper_bound? t=RCURLY QUESTION; number_quantifier: s=LCURLY numberconstant upper_bound? t=RCURLY; star_quantifier: r=STAR; plus_quantifier: q=PLUS; upper_bound: z=COMMA (upper_bound_unlimited | upper_bound_limited); upper_bound_limited: numberconstant; upper_bound_unlimited: k=PLUS; classIdentifier : i1=escapableStr (DOT i2=escapableStr)*; escapableStr : i1=IDENT | i2=EVENTS | i3=TICKED_STRING_LITERAL; expressionList : expression; expression : evalOrExpression; evalOrExpression : evalAndExpression (op=OR_EXPR evalAndExpression)*; evalAndExpression : negatedExpression (op=AND_EXPR negatedExpression)*; negatedExpression : evalEqualsExpression | NOT_EXPR evalEqualsExpression; evalEqualsExpression : evalRelationalExpression ( (eq=EQUALS | is=IS | isnot=IS NOT_EXPR | sqlne=SQL_NE | ne=NOT_EQUAL ) ( evalRelationalExpression | (a=ANY | a=SOME | a=ALL) ( (LPAREN expressionList? RPAREN)) ) )*; evalRelationalExpression : concatenationExpr ( ( ( (r=LT|r=GT|r=LE|r=GE) ( concatenationExpr | (g=ANY | g=SOME | g=ALL) ( (LPAREN expressionList? RPAREN)) ) )* ) | (n=NOT_EXPR)? ( // Represent the greedy NOT prefix using the token type by // testing 'n' and setting the token type accordingly. (in=IN_SET (l=LPAREN | l=LBRACK) expression // brackets are for inclusive/exclusive ( ( col=COLON (expression) ) // range | ( (COMMA expression)* ) // list of values ) (r=RPAREN | r=RBRACK) ) ) ); concatenationExpr : additiveExpression ( c=LOR additiveExpression ( LOR additiveExpression)* )?; additiveExpression : multiplyExpression ( (PLUS|MINUS) multiplyExpression )*; multiplyExpression : unaryExpression ( (STAR|DIV|MOD) unaryExpression )*; unaryExpression : MINUS eventProperty | constant | eventProperty; eventProperty : eventPropertyAtomic (DOT eventPropertyAtomic)*; eventPropertyAtomic : eventPropertyIdent ( lb=LBRACK ni=number RBRACK (q=QUESTION)? | lp=LPAREN (s=STRING_LITERAL | s=QUOTED_STRING_LITERAL) RPAREN (q=QUESTION)? | q1=QUESTION )?; eventPropertyIdent : ipi=keywordAllowedIdent (ESCAPECHAR DOT ipi2=keywordAllowedIdent?)*; constant : numberconstant | stringconstant | t=BOOLEAN_TRUE | f=BOOLEAN_FALSE | nu=VALUE_NULL; numberconstant : (m=MINUS | p=PLUS)? number; stringconstant : sl=STRING_LITERAL | qsl=QUOTED_STRING_LITERAL; keywordAllowedIdent : i1=IDENT | i2=TICKED_STRING_LITERAL | AT | COUNT | ESCAPE | EVERY_EXPR | SCHEMA | SUM | AVG | MAX | MIN | COALESCE | MEDIAN | STDDEV | AVEDEV | EVENTS | FIRST | LAST | WHILE | MERGE | MATCHED | UNIDIRECTIONAL | RETAINUNION | RETAININTERSECTION | UNTIL | PATTERN | SQL | METADATASQL | PREVIOUS | PREVIOUSTAIL | PRIOR | WEEKDAY | LW | INSTANCEOF | TYPEOF | CAST | SNAPSHOT | VARIABLE | TABLE | INDEX | WINDOW | LEFT | RIGHT | OUTER | FULL | JOIN | DEFINE | PARTITION | MATCHES | CONTEXT | FOR | USING; number : IntegerLiteral | FloatingPointLiteral; // Tokens CREATE:'create'; WINDOW:'window'; IN_SET:'in'; BETWEEN:'between'; LIKE:'like'; REGEXP:'regexp'; ESCAPE:'escape'; OR_EXPR:'or'; AND_EXPR:'and'; NOT_EXPR:'not'; EVERY_EXPR:'every'; EVERY_DISTINCT_EXPR:'every-distinct'; WHERE:'where'; AS:'as'; SUM:'sum'; AVG:'avg'; MAX:'max'; MIN:'min'; COALESCE:'coalesce'; MEDIAN:'median'; STDDEV:'stddev'; AVEDEV:'avedev'; COUNT:'count'; SELECT:'select'; CASE:'case'; ELSE:'else'; WHEN:'when'; THEN:'then'; END:'end'; FROM:'from'; OUTER:'outer'; INNER:'inner'; JOIN:'join'; LEFT:'left'; RIGHT:'right'; FULL:'full'; ON:'on'; IS:'is'; BY:'by'; GROUP:'group'; HAVING:'having'; DISTINCT:'distinct'; ALL:'all'; ANY:'any'; SOME:'some'; OUTPUT:'output'; EVENTS:'events'; FIRST:'first'; LAST:'last'; INSERT:'insert'; INTO:'into'; VALUES:'values'; ORDER:'order'; ASC:'asc'; DESC:'desc'; RSTREAM:'rstream'; ISTREAM:'istream'; IRSTREAM:'irstream'; SCHEMA:'schema'; UNIDIRECTIONAL:'unidirectional'; RETAINUNION:'retain-union'; RETAININTERSECTION:'retain-intersection'; PATTERN:'pattern'; SQL:'sql'; METADATASQL:'metadatasql'; PREVIOUS:'prev'; PREVIOUSTAIL:'prevtail'; PREVIOUSCOUNT:'prevcount'; PREVIOUSWINDOW:'prevwindow'; PRIOR:'prior'; EXISTS:'exists'; WEEKDAY:'weekday'; LW:'lastweekday'; INSTANCEOF:'instanceof'; TYPEOF:'typeof'; CAST:'cast'; CURRENT_TIMESTAMP:'current_timestamp'; DELETE:'delete'; SNAPSHOT:'snapshot'; SET:'set'; VARIABLE:'variable'; TABLE:'table'; UNTIL:'until'; AT:'at'; INDEX:'index'; TIMEPERIOD_YEAR:'year'; TIMEPERIOD_YEARS:'years'; TIMEPERIOD_MONTH:'month'; TIMEPERIOD_MONTHS:'months'; TIMEPERIOD_WEEK:'week'; TIMEPERIOD_WEEKS:'weeks'; TIMEPERIOD_DAY:'day'; TIMEPERIOD_DAYS:'days'; TIMEPERIOD_HOUR:'hour'; TIMEPERIOD_HOURS:'hours'; TIMEPERIOD_MINUTE:'minute'; TIMEPERIOD_MINUTES:'minutes'; TIMEPERIOD_SEC:'sec'; TIMEPERIOD_SECOND:'second'; TIMEPERIOD_SECONDS:'seconds'; TIMEPERIOD_MILLISEC:'msec'; TIMEPERIOD_MILLISECOND:'millisecond'; TIMEPERIOD_MILLISECONDS:'milliseconds'; TIMEPERIOD_MICROSEC:'usec'; TIMEPERIOD_MICROSECOND:'microsecond'; TIMEPERIOD_MICROSECONDS:'microseconds'; BOOLEAN_TRUE:'true'; BOOLEAN_FALSE:'false'; VALUE_NULL:'null'; ROW_LIMIT_EXPR:'limit'; OFFSET:'offset'; UPDATE:'update'; MATCH_RECOGNIZE:'match_recognize'; MATCH_RECOGNIZE_PERMUTE:'match_recognize_permute'; MEASURES:'measures'; DEFINE:'define'; PARTITION:'partition'; MATCHES:'matches'; AFTER:'after'; FOR:'for'; WHILE:'while'; USING:'using'; MERGE:'merge'; MATCHED:'matched'; EXPRESSIONDECL:'expression'; NEWKW:'new'; START:'start'; CONTEXT:'context'; INITIATED:'initiated'; TERMINATED:'terminated'; DATAFLOW:'dataflow'; CUBE:'cube'; ROLLUP:'rollup'; GROUPING:'grouping'; GROUPING_ID:'grouping_id'; SETS:'sets'; // Operators FOLLOWMAX_BEGIN : '-['; FOLLOWMAX_END : ']>'; FOLLOWED_BY : '->'; FOLLOWED_BY_ANY : '->>'; GOES : '=>'; EQUALS : '='; SQL_NE : '<>'; QUESTION : '?'; LPAREN : '('; RPAREN : ')'; LBRACK : '['; RBRACK : ']'; LCURLY : '{'; RCURLY : '}'; COLON : ':'; COMMA : ','; EQUAL : '=='; LNOT : '!'; BNOT : '~'; NOT_EQUAL : '!='; DIV : '/'; DIV_ASSIGN : '/='; PLUS : '+'; PLUS_ASSIGN : '+='; INC : '++'; MINUS : '-'; MINUS_ASSIGN : '-='; DEC : '--'; STAR : '*'; STAR_ASSIGN : '*='; MOD : '%'; MOD_ASSIGN : '%='; GE : '>='; GT : '>'; LE : '<='; LT : '<'; BXOR : '^'; BXOR_ASSIGN : '^='; BOR : '|'; BOR_ASSIGN : '|='; LOR : '||'; BAND : '&'; BAND_ASSIGN : '&='; LAND : '&&'; SEMI : ';'; DOT : '.'; NUM_LONG : '\u18FF'; // assign bogus unicode characters so the token exists NUM_DOUBLE : '\u18FE'; NUM_FLOAT : '\u18FD'; ESCAPECHAR : '\\'; ESCAPEBACKTICK : '`'; ATCHAR : '@'; HASHCHAR : '#'; // Whitespace -- ignored WS : ( ' ' | '\t' | '\f' // handle newlines | ( '\r' // Macintosh | '\n' // Unix (the right way) ) )+ -> channel(HIDDEN) ; // Single-line comments SL_COMMENT : '//' (~('\n'|'\r'))* ('\n'|'\r'('\n')?)? -> channel(HIDDEN) ; // multiple-line comments ML_COMMENT : '/*' (.)*? '*/' -> channel(HIDDEN) ; TICKED_STRING_LITERAL : '`' ( EscapeSequence | ~('`'|'\\') )* '`' ; QUOTED_STRING_LITERAL : '\'' ( EscapeSequence | ~('\''|'\\') )* '\'' ; STRING_LITERAL : '"' ( EscapeSequence | ~('\\'|'"') )* '"' ; fragment EscapeSequence : '\\' ( 'n' | 'r' | 't' | 'b' | 'f' | '"' | '\'' | '\\' | UnicodeEscape | OctalEscape | . // unknown, leave as it is ) ; // an identifier. Note that testLiterals is set to true! This means // that after we match the rule, we look in the literals table to see // if it's a literal or really an identifer IDENT : ('a'..'z'|'_'|'$') ('a'..'z'|'_'|'0'..'9'|'$')* ; IntegerLiteral : DecimalIntegerLiteral | HexIntegerLiteral | OctalIntegerLiteral | BinaryIntegerLiteral ; FloatingPointLiteral : DecimalFloatingPointLiteral | HexadecimalFloatingPointLiteral ; fragment OctalEscape : '\\' ('0'..'3') ('0'..'7') ('0'..'7') | '\\' ('0'..'7') ('0'..'7') | '\\' ('0'..'7') ; fragment UnicodeEscape : '\\' 'u' HexDigit HexDigit HexDigit HexDigit ; fragment DecimalIntegerLiteral : DecimalNumeral IntegerTypeSuffix? ; fragment HexIntegerLiteral : HexNumeral IntegerTypeSuffix? ; fragment OctalIntegerLiteral : OctalNumeral IntegerTypeSuffix? ; fragment BinaryIntegerLiteral : BinaryNumeral IntegerTypeSuffix? ; fragment IntegerTypeSuffix : [lL] ; fragment DecimalNumeral : '0' | ('0')* NonZeroDigit (Digits? | Underscores Digits) ; fragment Digits : Digit (DigitOrUnderscore* Digit)? ; fragment Digit : '0' | NonZeroDigit ; fragment NonZeroDigit : [1-9] ; fragment DigitOrUnderscore : Digit | '_' ; fragment Underscores : '_'+ ; fragment HexNumeral : '0' [xX] HexDigits ; fragment HexDigits : HexDigit (HexDigitOrUnderscore* HexDigit)? ; fragment HexDigit : [0-9a-fA-F] ; fragment HexDigitOrUnderscore : HexDigit | '_' ; fragment OctalNumeral : '0' Underscores? OctalDigits ; fragment OctalDigits : OctalDigit (OctalDigitOrUnderscore* OctalDigit)? ; fragment OctalDigit : [0-7] ; fragment OctalDigitOrUnderscore : OctalDigit | '_' ; fragment BinaryNumeral : '0' [bB] BinaryDigits ; fragment BinaryDigits : BinaryDigit (BinaryDigitOrUnderscore* BinaryDigit)? ; fragment BinaryDigit : [01] ; fragment BinaryDigitOrUnderscore : BinaryDigit | '_' ; fragment DecimalFloatingPointLiteral : Digits '.' Digits? ExponentPart? FloatTypeSuffix? | '.' Digits ExponentPart? FloatTypeSuffix? | Digits ExponentPart FloatTypeSuffix? | Digits FloatTypeSuffix ; fragment ExponentPart : ExponentIndicator SignedInteger ; fragment ExponentIndicator : [eE] ; fragment SignedInteger : Sign? Digits ; fragment Sign : [+-] ; fragment FloatTypeSuffix : [fFdD] ; fragment HexadecimalFloatingPointLiteral : HexSignificand BinaryExponent FloatTypeSuffix? ; fragment HexSignificand : HexNumeral '.'? | '0' [xX] HexDigits? '.' HexDigits ; fragment BinaryExponent : BinaryExponentIndicator SignedInteger ; fragment BinaryExponentIndicator : [pP] ;
Transynther/x86/_processed/AVXALIGN/_zr_un_/i3-7100_9_0x84_notsx.log_460_1959.asm
ljhsiun2/medusa
9
9816
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r14 push %r15 push %r9 push %rax push %rsi lea addresses_normal_ht+0x19bb7, %r15 nop nop nop sub $13188, %r11 movb (%r15), %r13b nop nop cmp %r14, %r14 lea addresses_WC_ht+0x19ad6, %r9 and $62952, %rax mov $0x6162636465666768, %r11 movq %r11, %xmm5 movups %xmm5, (%r9) nop add %rsi, %rsi pop %rsi pop %rax pop %r9 pop %r15 pop %r14 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r14 push %rbx push %rcx push %rdi // Store lea addresses_RW+0x1a2e1, %r11 xor %rbx, %rbx mov $0x5152535455565758, %r10 movq %r10, %xmm4 movups %xmm4, (%r11) nop nop nop nop nop xor $31245, %r14 // Store lea addresses_US+0x1be61, %r10 nop nop xor $12565, %rcx mov $0x5152535455565758, %r14 movq %r14, (%r10) nop nop nop nop nop and %r10, %r10 // Faulty Load lea addresses_WC+0x18a61, %rdi nop nop add $40526, %r10 vmovaps (%rdi), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $1, %xmm1, %rcx lea oracles, %r14 and $0xff, %rcx shlq $12, %rcx mov (%r14,%rcx,1), %rcx pop %rdi pop %rcx pop %rbx pop %r14 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_WC', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_RW', 'same': False, 'size': 16, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_US', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_WC', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WC_ht', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'b0': 2, '0a': 1, '00': 442, 'f9': 2, '08': 13} 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 f9 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 08 08 00 08 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 08 00 b0 b0 */
src/test/ref/gfxbank.asm
jbrandwood/kickc
2
160912
<reponame>jbrandwood/kickc // Test minimization of constants // Commodore 64 PRG executable file .file [name="gfxbank.prg", type="prg", segments="Program"] .segmentdef Program [segments="Basic, Code, Data"] .segmentdef Basic [start=$0801] .segmentdef Code [start=$80d] .segmentdef Data [startAfter="Code"] .segment Basic :BasicUpstart(main) .const OFFSET_STRUCT_MOS6526_CIA_PORT_A_DDR = 2 /// The CIA#2: Serial bus, RS-232, VIC memory bank .label CIA2 = $dd00 .segment Code main: { .const vicSelectGfxBank1_toDd001_return = 3 // CIA2->PORT_A_DDR = %00000011 lda #3 sta CIA2+OFFSET_STRUCT_MOS6526_CIA_PORT_A_DDR // CIA2->PORT_A = toDd00(gfx) lda #vicSelectGfxBank1_toDd001_return sta CIA2 // } rts }
maps/SandgemPokemonCenter1F.asm
AtmaBuster/pokecrystal16-493-plus
1
26880
object_const_def ; object_event constants const SANDGEM_POKEMON_CENTER_1F_NURSE SandgemPokemonCenter1F_MapScripts: db 0 ; scene scripts db 0 ; callbacks SandgemPokemonCenter1FNurseScript: jumpstd pokecenternurse SandgemPokemonCenter1F_MapEvents: db 0, 0 ; filler db 3 ; warp events warp_event 3, 7, SANDGEM_TOWN, 5 warp_event 4, 7, SANDGEM_TOWN, 5 warp_event 0, 7, POKECENTER_2F, 1 db 0 ; coord events db 0 ; bg events db 1 ; object events object_event 3, 1, SPRITE_NURSE, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, SandgemPokemonCenter1FNurseScript, -1
tests/utils-test_data-tests.ads
thindil/steamsky
80
7835
<gh_stars>10-100 -- This package has been generated automatically by GNATtest. -- Do not edit any part of it, see GNATtest documentation for more details. -- begin read only with Gnattest_Generated; package Utils.Test_Data.Tests is type Test is new GNATtest_Generated.GNATtest_Standard.Utils.Test_Data .Test with null record; procedure Test_Get_Random_254206_4c55ca(Gnattest_T: in out Test); -- utils.ads:42:4:Get_Random:Test_GetRandom procedure Test_Days_Difference_3eb9cd_fd50f2(Gnattest_T: in out Test); -- utils.ads:58:4:Days_Difference:Test_DaysDifference procedure Test_Generate_Robotic_Name_eb65d6_cad966(Gnattest_T: in out Test); -- utils.ads:73:4:Generate_Robotic_Name:Test_GenerateRoboticName end Utils.Test_Data.Tests; -- end read only
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/decl_ctx_use.adb
best08618/asylo
7
23010
-- { dg-do compile } -- { dg-options "-O1" } with DECL_CTX_Def; use DECL_CTX_Def; package body DECL_CTX_Use is procedure Check_1 is begin raise X; end; procedure Check_2 is begin raise X; end; end;
src/8088/include/screen.asm
vossi1/cbm2-pc-emulator-v9958
0
163598
<reponame>vossi1/cbm2-pc-emulator-v9958 ; -------------------------------------------------------------------------------------- ; Check if the screen conversion memory is installed. ; -------------------------------------------------------------------------------------- Screen_Init: call IPC_Video_Init cmp al, 0FFh jnz Screen_Init_0 push ds push ax mov ax, Screen_Segment mov ds, ax mov [0FFEh], dx xor ax, ax mov ds, ax mov [0040h], word Screen_INT mov ax, cs mov [0042h], ax call Screen_INT_00 pop ax pop ds Screen_Init_0: ret ; -------------------------------------------------------------------------------------- ; Display information about screen memory emulation. ; -------------------------------------------------------------------------------------- Screen_ShowInfo: push ds push ax push dx xor ax, ax mov ds, ax cmp [0040h], word Screen_INT jne Screen_ShowInfo_0 mov ax, Screen_Segment mov ds, ax mov dx, [0FFEh] push cs pop ds mov si, Screen_Banner1 call Output_String mov al, dl and al, 0Fh call Screen_Hex mov al, dh shr al, 1 shr al, 1 shr al, 1 shr al, 1 call Screen_Hex push cs pop ds mov si, Screen_Banner2 call Output_String Screen_ShowInfo_0: pop dx pop ax pop ds ret Screen_Banner1: db "Video memory buffer at $", 0 Screen_Banner2: db "000", 13, 10, 0 Screen_Hex: add al, 30h cmp al, 39h jbe Screen_Hex1 add al, 7 Screen_Hex1: jmp Screen_INT_0E ; ----------------------------------------------------------------- ; INT 10 - screen functions. ; ----------------------------------------------------------------- Screen_INT: cmp ah, 0Fh ja Screen_INT_Ret push bp push es mov bp, Data_Segment mov es, bp mov bp, Screen_INT_Functions push ds call INT_Dispatch pop ds pop es pop bp Screen_INT_Ret: iret Screen_INT_Functions: dw Screen_INT_00 dw INT_Unimplemented dw Screen_INT_02 dw Screen_INT_03 dw INT_Unimplemented dw INT_Unimplemented dw Screen_INT_06 dw Screen_INT_07 dw INT_Unimplemented dw Screen_INT_09 dw Screen_INT_0A dw INT_Unimplemented dw INT_Unimplemented dw INT_Unimplemented dw Screen_INT_0E dw Screen_INT_0F ; ----------------------------------------------------------------- ; Check whether the video memory needs refreshing. ; ----------------------------------------------------------------- Screen_Interrupt: push ds push ax mov ax, Data_Segment mov ds, ax inc byte [Data_Refresh] cmp byte [Data_Refresh], 50 jb Screen_interrupt_NoRefresh call Screen_Refresh Screen_interrupt_NoRefresh: pop ax pop ds ret ; ----------------------------------------------------------------- ; Refresh the screen by copying it from the RAM to video memory. ; ----------------------------------------------------------------- Screen_Refresh: push dx mov byte [Data_Refresh], 00h mov dx, [Data_CursorVirtual] call IPC_Video_Convert pop dx ret ; ----------------------------------------------------------------- ; INT 10 function 00 - set video mode. ; Clears the screen and re-positions the cursor. ; ----------------------------------------------------------------- Screen_INT_00: push ax call Screen_Segments xor ax, ax mov [Data_CursorVirtual], ax mov [Data_CursorPhysical], ax call Screen_Clear pop ax ret ; ----------------------------------------------------------------- ; INT 10 function 02 - set cursor position ; ----------------------------------------------------------------- Screen_INT_02: push ax mov ax, Data_Segment mov ds, ax ; MS BASIC Compiler runtime calls this function with DX=FFFF ? test dx, 8080h jnz Screen_INT_02_Ret ; Check if row and column are within allowed bounds cmp dh, 24 jl Screen_INT_02_RowOK mov dh, 23 Screen_INT_02_RowOK: cmp dl, 80 jl Screen_INT_02_ColumnOK mov dl, 79 Screen_INT_02_ColumnOK: mov [Data_CursorVirtual], dx call Screen_CursorCalc Screen_INT_02_Ret: pop ax ret ; ----------------------------------------------------------------- ; INT 10 function 03 - get cursor position ; ----------------------------------------------------------------- Screen_INT_03: mov dx, Data_Segment mov ds, dx mov dx, [Data_CursorVirtual] ret ; ----------------------------------------------------------------- ; INT 10 function 06 - scroll screen up ; ----------------------------------------------------------------- Screen_INT_06: ; db 0CCh call Screen_ScrollCalc call Screen_ScrollPerform ret Screen_ScrollCalc: mov bx, dx ; BL - number of columns in the window sub bl, cl inc bl ; BH - number of rows in the window sub bh, ch inc bh ; DH - number of rows to shift test al, al jz Screen_ScrollCalc_1 cmp al, bh jb Screen_ScrollCalc_2 Screen_ScrollCalc_1: mov al, bh Screen_ScrollCalc_2: mov dh, al ; DL - number of bytes to skip in each line mov dl, 160 sub dl, bl sub dl, bl ; DI - destination address mov al, ch xor ah, ah mov ch, 160 mul ch add al, cl adc ah, 0 add al, cl adc ah, 0 mov di, ax ; SI - source address mov si, di mov al, dh xor ah, ah mul ch add si, ax ; DS, ES - screen segment mov cx, Screen_Segment mov es, cx mov ds, cx xor cx, cx ret Screen_ScrollPerform: cmp dh, bh jae Screen_ScrollClear mov cl, bl rep movsw mov cl, dl add si, cx add di, cx dec bh jmp Screen_ScrollPerform Screen_ScrollClear: mov cl, bl mov ax, 0020h rep stosw mov cl, dl add di, cx dec bh jnz Screen_ScrollClear ret ; ----------------------------------------------------------------- ; INT 10 function 07 - scroll screen down ; ----------------------------------------------------------------- Screen_INT_07: push ax call Screen_Segments pop ax test al, al jz Screen_INT_07_Clear ret Screen_INT_07_Clear: jmp Screen_Clear ; ----------------------------------------------------------------- ; INT 10 function 09 - write character and attribute. ; ----------------------------------------------------------------- Screen_INT_09: push di push ax call Screen_Segments mov di, [Data_CursorPhysical] pop ax stosw pop di ret ; ----------------------------------------------------------------- ; INT 10 function 0A - write character only. ; ----------------------------------------------------------------- Screen_INT_0A: push di push ax call Screen_Segments mov di, [Data_CursorPhysical] pop ax stosb pop di ret ; ----------------------------------------------------------------- ; INT 10 function 0E - teletype output. ; ----------------------------------------------------------------- Screen_INT_0E: call INT_ClearDot push di push ax call Screen_Segments mov di, [Data_CursorPhysical] pop ax push ax cmp al, 20h jl Screen_INT_0E_Control Screen_INT_0E_Output: stosb xor al, al stosb mov [Data_CursorPhysical], di mov al, [Data_CursorVirtual] inc al cmp al, 80 jnz Screen_INT_0E_End xor al, al inc byte [Data_CursorVirtual+1] Screen_INT_0E_End: mov [Data_CursorVirtual], al call Screen_CursorCheck Screen_INT_0E_Finish: pop ax pop di ret ; Translate common control codes Screen_INT_0E_Control: cmp al, 7 ; Bell jne Screen_INT_0E_Not07 call IPC_ScreenOut jmp Screen_INT_0E_Finish ret Screen_INT_0E_Not07: cmp al, 8 ; BackSpace jne Screen_INT_0E_Not08 mov ax, [Data_CursorVirtual] dec al test al, 80h jz Screen_INT_0E_BkSp xor al, al dec ah test ah, 80h jz Screen_INT_0E_BkSp xor ah, ah Screen_INT_0E_BkSp: mov [Data_CursorVirtual], ax call Screen_CursorCalc mov di, [Data_CursorPhysical] mov [es:di], word 0020h jmp Screen_INT_0E_Finish Screen_INT_0E_Not08: cmp al, 13 ; CR jne Screen_INT_0E_Not0D mov byte [Data_CursorVirtual], 0 call Screen_CursorCalc call Screen_Refresh jmp Screen_INT_0E_Finish Screen_INT_0E_Not0D: cmp al, 10 ; LF jne Screen_INT_0E_Not0A inc byte [Data_CursorVirtual+1] call Screen_CursorCheck call Screen_CursorCalc jmp Screen_INT_0E_Finish Screen_INT_0E_Not0A: jmp Screen_INT_0E_Output ; ----------------------------------------------------------------- ; INT 10 function 0F - get video mode. ; ----------------------------------------------------------------- Screen_INT_0F: ; MDA text mode mov al, 07h mov ah, 80 mov bh, 0 ret ; ----------------------------------------------------------------- ; Load DS and ES with appropriate segment values. ; ----------------------------------------------------------------- Screen_Segments: mov ax, Data_Segment mov ds, ax mov ax, Screen_Segment mov es, ax ret ; ----------------------------------------------------------------- ; Recalculate physical cursor position from virtual position. ; ----------------------------------------------------------------- Screen_CursorCalc: push cx push ax mov al, [Data_CursorVirtual+1] xor ah, ah mov cl, 80 mul cl add al, [Data_CursorVirtual] adc ah, 0 shl ax, 1 mov [Data_CursorPhysical], ax pop ax pop cx ret ; ----------------------------------------------------------------- ; Clear the entire screen. ; ----------------------------------------------------------------- Screen_Clear: push di push cx push ax xor ax, ax mov di, ax mov al, 20h mov cx, 2000 rep stosw pop ax pop cx pop di ret ; ----------------------------------------------------------------- ; Check if the cursor has moved to the 26th line. ; If this is the case, scroll the screen up 1 line. ; ----------------------------------------------------------------- Screen_CursorCheck: cmp byte [Data_CursorVirtual+1], 25 jb Screen_CursorCheck_End mov byte [Data_CursorVirtual+1], 24 push ds push ax push cx push si push di mov cx, es mov ds, cx mov si, 160 mov di, 0 mov cx, 1920 rep movsw mov ax, 0020h mov cx, 80 rep stosw pop di pop si pop cx pop ax pop ds call Screen_Refresh Screen_CursorCheck_End: ret
Microprocessor_Interfacing_CSE_2006/Applications_Lab_10/comparator.asm
aadhityasw/VIT-Labs
2
96715
<reponame>aadhityasw/VIT-Labs ASSUME CS:CODE, DS:DATA DATA SEGMENT var DW 1234H DATA ENDS CODE SEGMENT START: mov ax,DATA mov ds,ax mov ax,var cmp ah,al je case1 cmp ah,al jl case2 mov cl,01H jmp final case1: mov cl,00H jmp final case2: mov cl,10H final: hlt CODE ENDS END START
oeis/022/A022777.asm
neoneye/loda-programs
11
16461
; A022777: Place where n-th 1 occurs in A007337. ; Submitted by <NAME> ; 1,3,7,13,20,29,40,53,67,83,101,121,142,165,190,216,244,274,306,339,374,411,450,490,532,576,622,669,718,769,821,875,931,989,1048,1109,1172,1237,1303,1371,1441,1513,1586,1661,1738,1816,1896,1978,2062 mov $2,$0 add $2,1 mov $4,$0 lpb $2 mov $0,$4 sub $2,1 sub $0,$2 mul $0,4 seq $0,308358 ; Beatty sequence for sqrt(3)/4. add $0,1 add $3,$0 lpe mov $0,$3