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/pimoroni_led_dot_matrix.ads
hgrodriguez/embedded-dashboard-console
0
4157
<reponame>hgrodriguez/embedded-dashboard-console -- -- Copyright 2021 (C) <NAME> -- -- SPDX-License-Identifier: BSD-3-Clause -- -- This is a driver for the Pimoroni PIM526 LED Dot Matrix Breakout using an -- IS31FL3730 I2C LED matrix driver to control two LTP-305 5x7 matrices. -- https://shop.pimoroni.com/products/led-dot-matrix-breakout -- -- The breakout board includes pullups on the SDA and SCL pins, internal -- pullups are unnecessary. -- with Ada.Unchecked_Conversion; with Interfaces; with HAL.I2C; generic Matrix_I2CPort : HAL.I2C.Any_I2C_Port; Matrix_Address : HAL.I2C.I2C_Address; package Pimoroni_LED_Dot_Matrix is Default_Address : constant HAL.I2C.I2C_Address := 16#61#; subtype Display_Column is Integer range 0 .. 4; subtype Display_Row is Integer range 0 .. 6; type Display_Matrix is array (Display_Column, Display_Row) of Boolean; type Matrix_Bits is new Interfaces.Unsigned_64; subtype Matrix_Array is HAL.UInt8_Array (1 .. 8); type Command is (Mode, Matrix_R, Update, Options, Matrix_L, Brightness, Reset) with Size => 8; for Command use ( Mode => 16#00#, Matrix_R => 16#01#, Update => 16#0C#, Options => 16#0D#, Matrix_L => 16#0E#, Brightness => 16#19#, Reset => 16#FF# ); type Outputs is (Matrix_1, Matrix_2, Both) with Size => 2; for Outputs use (Matrix_1 => 2#00#, Matrix_2 => 2#01#, Both => 2#11#); type Matrix_Modes is (Matrix_8x8, Matrix_7x9, Matrix_6x10, Matrix_5x11) with Size => 2; for Matrix_Modes use (Matrix_8x8 => 2#00#, Matrix_7x9 => 2#01#, Matrix_6x10 => 2#10#, Matrix_5x11 => 2#11#); type Config_Register is record Shutdown : Boolean := False; Reserved : Boolean := False; Output : Outputs := Both; Audio_In : Boolean := False; Matrix_Mode : Matrix_Modes := Matrix_8x8; end record with Size => 8; for Config_Register use record Shutdown at 0 range 7 .. 7; Reserved at 0 range 5 .. 6; Output at 0 range 3 .. 4; Audio_In at 0 range 2 .. 2; Matrix_Mode at 0 range 0 .. 1; end record; procedure Initialize; function Convert is new Ada.Unchecked_Conversion (Source => Matrix_Bits, Target => Matrix_Array); function Convert is new Ada.Unchecked_Conversion (Source => Config_Register, Target => HAL.UInt8); procedure Write_Byte_Data (Cmd : Command; B : HAL.UInt8); procedure Write_Block_Data (Cmd : Command; Data : HAL.UInt8_Array); function To_Left_Matrix (DM : Display_Matrix; DP : Boolean := False) return Matrix_Array; function To_Right_Matrix (DM : Display_Matrix; DP : Boolean := False) return Matrix_Array; end Pimoroni_LED_Dot_Matrix;
programs/oeis/099/A099895.asm
neoneye/loda
22
247128
; A099895: XOR BINOMIAL transform of A000069 (Odious numbers). ; 1,3,5,0,9,0,0,0,17,0,0,0,0,0,0,0,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,65,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,0,0,129 add $0,1 mul $0,2 mov $1,2 sub $1,$0 sub $2,$1 add $0,$2 bin $1,$2 mod $1,$0 mov $0,$1
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-imgwch.adb
orb-zhuchen/Orb
0
3445
<filename>support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-imgwch.adb<gh_stars>0 ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- S Y S T E M . I M G _ W C H A R -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2019, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Interfaces; use Interfaces; with System.Img_Char; use System.Img_Char; package body System.Img_WChar is -------------------------- -- Image_Wide_Character -- -------------------------- procedure Image_Wide_Character (V : Wide_Character; S : in out String; P : out Natural; Ada_2005 : Boolean) is pragma Assert (S'First = 1); begin -- Annoying Ada 95 incompatibility with FFFE/FFFF if V >= Wide_Character'Val (16#FFFE#) and then not Ada_2005 then if V = Wide_Character'Val (16#FFFE#) then S (1 .. 4) := "FFFE"; else S (1 .. 4) := "FFFF"; end if; P := 4; -- Deal with annoying Ada 95 incompatibility with soft hyphen elsif V = Wide_Character'Val (16#00AD#) and then not Ada_2005 then P := 3; S (1) := '''; S (2) := Character'Val (16#00AD#); S (3) := '''; -- Normal case, same as Wide_Wide_Character else Image_Wide_Wide_Character (Wide_Wide_Character'Val (Wide_Character'Pos (V)), S, P); end if; end Image_Wide_Character; ------------------------------- -- Image_Wide_Wide_Character -- ------------------------------- procedure Image_Wide_Wide_Character (V : Wide_Wide_Character; S : in out String; P : out Natural) is pragma Assert (S'First = 1); Val : Unsigned_32 := Wide_Wide_Character'Pos (V); begin -- If in range of standard Character, use Character routine. Use the -- Ada 2005 version, since either we are called directly in Ada 2005 -- mode for Wide_Wide_Character, or this is the Wide_Character case -- which already took care of the Soft_Hyphen glitch. if Val <= 16#FF# then Image_Character_05 (Character'Val (Wide_Wide_Character'Pos (V)), S, P); -- Otherwise value returned is Hex_hhhhhhhh else declare Hex : constant array (Unsigned_32 range 0 .. 15) of Character := "0123456789ABCDEF"; begin S (1 .. 4) := "Hex_"; for J in reverse 5 .. 12 loop S (J) := Hex (Val mod 16); Val := Val / 16; end loop; P := 12; end; end if; end Image_Wide_Wide_Character; end System.Img_WChar;
oeis/116/A116522.asm
neoneye/loda-programs
11
17129
; A116522: a(0)=1, a(1)=1, a(n)=7*a(n/2) for n=2,4,6,..., a(n)=6*a((n-1)/2)+a((n+1)/2) for n=3,5,7,.... ; 0,1,7,13,49,55,91,127,343,349,385,421,637,673,889,1105,2401,2407,2443,2479,2695,2731,2947,3163,4459,4495,4711,4927,6223,6439,7735,9031,16807,16813,16849,16885,17101,17137,17353,17569,18865,18901,19117,19333,20629,20845,22141,23437,31213,31249,31465,31681,32977,33193,34489,35785,43561,43777,45073,46369,54145,55441,63217,70993,117649,117655,117691,117727,117943,117979,118195,118411,119707,119743,119959,120175,121471,121687,122983,124279,132055,132091,132307,132523,133819,134035,135331,136627 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 sub $2,1 sub $0,$2 sub $0,1 seq $0,256136 ; a(n) = 6^A000120(n). add $1,$0 lpe mov $0,$1
programs/oeis/171/A171508.asm
neoneye/loda
22
2904
; A171508: Numbers that are not the sum of the k-th noncomposite number and k for any k >= 1. ; 1,3,5,7,8,10,11,13,14,15,16,18,19,21,22,23,24,26,27,29,30,31,32,34,35,36,37,38,39,41,42,44,45,46,47,48,49,51,52,53,54,56,57,59,60,61,62,64,65,66 seq $0,64427 ; (Number of primes <= n - 1) + n. mov $2,1 mod $2,$0 add $0,$2
samples/Motorola 68K Assembly/rom_testbench.asm
digosuoza/linguist
2
24143
<gh_stars>1-10 ; Copyright 2011-2018 <NAME> ; ; Non regression tests for 68000 (1500+ cases) org 0 vectors: dc.l $00006000 ; 0 : Initial SSP dc.l start ; 1 : Initial PC dc.l 0 ; 2 dc.l trap_addr ; 3 : Address error dc.l trap_ill ; 4 : Illegal instruction dc.l 0 ; 5 dc.l trap_chk ; 6 : CHK instruction dc.l trap_v ; 7 : TRAPV instruction blk.l 24,0 ; 8 - 31 dc.l trap_0 ; 32 dc.l trap_1 ; 33 dc.l trap_2 ; 34 dc.l trap_3 ; 35 dc.l trap_4 ; 36 dc.l trap_5 ; 37 dc.l trap_6 ; 38 dc.l trap_7 ; 39 dc.l trap_8 ; 40 dc.l trap_9 ; 41 dc.l trap_A ; 42 dc.l trap_B ; 43 dc.l trap_C ; 44 dc.l trap_D ; 45 dc.l trap_E ; 46 dc.l trap_F ; 47 trap_addr: move.w (SP),D0 move.l 2(SP),A0 move.w 6(SP),D1 move.l 10(SP),D2 bclr #0,D2 move.l D2,10(SP) addq.l #8,SP rte trap_ill: addq.l #2,2(SP) rte trap_chk: rte trap_v: rte trap_0: rte trap_1: rte trap_2: rte trap_3: rte trap_4: rte trap_5: rte trap_6: rte trap_7: rte trap_8: rte trap_9: rte trap_A: rte trap_B: rte trap_C: rte trap_D: rte trap_E: rte trap_F: rte start: ; Exceptions tests illegal trap #0 trap #15 move #%00010,CCR trapv bsr.w movep_test pea return(pc) jmp bcd_test return: jsr sub_b_test jsr sub_w_test jsr sub_l_test bsr.w add_b_test bsr.w add_w_test bsr.w add_l_test bsr neg_test moveq #0,D0 tas D0 moveq #5,D0 moveq #3,D1 chk.w D1,D0 moveq #-1,D0 chk.w D1,D0 jsr movem_test lea $12345678,A5 link A5,#-12 unlk A5 move.l A7,USP move.l USP,A0 exg A0,A5 exg A5,D0 exg D0,D1 move.w #$0080,D0 ext.w D0 move.w #$FF00,D0 ext.w D0 move.l #$00008000,D0 ext.l D0 move.w #$0000,D0 ext.l D0 jsr cmpa_w_test jsr cmpa_l_test jsr cmp_b_test jsr cmp_w_test jsr cmp_l_test jsr cmpi_b_test jsr cmpi_w_test jsr cmpi_l_test jsr scc_test jsr bcc_test jsr dbcc_test jsr div_test jsr mult_test jsr biti_test jsr bitr_test jsr clr_tst_test jsr not_test jsr neg_test jsr addq_test jsr subq_test jsr adda_w_test jsr adda_l_test jsr suba_w_test jsr suba_l_test jsr move_l_test_0 jsr move_l_test_1 jsr move_l_test_2 jsr move_l_test_3 jsr move_l_test_4 jsr move_l_test_5 jsr move_l_test_6 jsr move_l_test_7 jsr move_l_test_8 jsr move_w_test_0 jsr move_w_test_1 jsr move_w_test_2 jsr move_w_test_3 jsr move_w_test_4 jsr move_w_test_5 jsr move_w_test_6 jsr move_w_test_7 jsr move_w_test_8 jsr move_b_test_0 jsr move_b_test_2 jsr move_b_test_3 jsr move_b_test_4 jsr move_b_test_5 jsr move_b_test_6 jsr move_b_test_7 jsr move_b_test_8 jsr shifti_test jsr shiftr_test jsr shiftm_test jsr addi_b_test jsr addi_w_test jsr addi_l_test jsr subi_b_test jsr subi_w_test jsr subi_l_test bsr.w log_b_test bsr.w log_w_test bsr.w log_l_test bsr.w logi_b_test bsr.w logi_w_test bsr.w logi_l_test bra.w start ; MOVEP tests ;------------ movep_test: lea $8000.l,A0 move.l #$01234567,(A0) move.l #$89ABCDEF,4(A0) moveq #0,D0 movep.w 0(A0),D0 movep.w 1(A0),D0 movep.l 0(A0),D0 movep.l 1(A0),D0 move.l #$00001122,D0 move.l #$00003344,D1 movep.w D0,0(A0) movep.w D1,1(A0) move.l (A0),D0 move.l #$11223344,D0 move.l #$55667788,D1 movep.l D0,0(A0) movep.l D1,1(A0) move.l (A0)+,D0 move.l (A0),D1 rts ; ABCD, SBCD, NBCD tests ;----------------------- bcd_test: lea $8000.l,A0 move #%10000,CCR move.b #$99,D0 move.b #$01,D1 abcd D0,D1 move.l #$01990099,(A0)+ move.l A0,A1 move.l #$09010101,(A1)+ abcd -(A0),-(A1) abcd -(A0),-(A1) abcd -(A0),-(A1) abcd -(A0),-(A1) move.l (A0),D0 move.l (A1),D1 addq.l #4,A0 addq.l #4,A1 move.b #$99,D0 move.b #$00,D1 move #%10000,CCR sbcd D0,D1 sbcd -(A0),-(A1) sbcd -(A0),-(A1) sbcd -(A0),-(A1) sbcd -(A0),-(A1) move.l (A0),D0 move.l (A1),D1 moveq #1,D1 nbcd D0 nbcd (A0) move.b (A0),D0 nbcd (A0)+ move.b -1(A0),D0 nbcd 1(A0) move.b 1(A0),D0 nbcd -(A0) move.b (A0),D0 nbcd 0(A0,D1.w) move.b 0(A0,d1.w),D0 nbcd $8000 move.b $8000,D0 rts ; BTST, BCHG, BCLR, BSET tests ;----------------------------- biti_test: lea $8000.l,A0 move.l #$55555555,D0 move.l D0,(A0) move.l D0,-$1000(A0) moveq #1,D1 btst #0,D0 btst #7,D0 btst #8,D0 btst #15,D0 btst #16,D0 btst #23,D0 btst #24,D0 btst #31,D0 btst #0,(A0) btst #7,(A0)+ btst #0,-1(A0) btst #7,-(A0) btst #0,1(A0,D1.w) btst #7,$7000.w btst #0,$8000.l bchg #0,D0 bchg #7,D0 bchg #8,D0 bchg #15,D0 bchg #16,D0 bchg #23,D0 bchg #24,D0 bchg #31,D0 bchg #0,(A0) bchg #7,(A0)+ bchg #0,-1(A0) bchg #7,-(A0) bchg #0,1(A0,D1.w) bchg #7,$7000.w bchg #0,$8000.l bclr #0,D0 bclr #7,D0 bclr #8,D0 bclr #15,D0 bclr #16,D0 bclr #23,D0 bclr #24,D0 bclr #31,D0 bclr #0,(A0) bclr #7,(A0)+ bclr #0,-1(A0) bclr #7,-(A0) bclr #0,1(A0,D1.w) bclr #7,$7000.w bclr #0,$8000.l bset #0,D0 bset #7,D0 bset #8,D0 bset #15,D0 bset #16,D0 bset #23,D0 bset #24,D0 bset #31,D0 bset #0,(A0) bset #7,(A0)+ bset #0,-1(A0) bset #7,-(A0) bset #0,1(A0,D1.w) bset #7,$7000.w bset #0,$8000.l rts bitr_test: lea $8000.l,A0 move.l #$55555555,D0 move.l D0,(A0) move.l D0,-$1000(A0) moveq #1,D1 moveq #0,D2 btst D2,D0 addq.l #7,D2 btst D2,D0 addq.l #1,D2 btst D2,D0 addq.l #7,D2 btst D2,D0 addq.l #1,D2 btst D2,D0 addq.l #7,D2 btst D2,D0 addq.l #1,D2 btst D2,D0 addq.l #7,D2 btst D2,D0 moveq #0,D2 moveq #7,D3 btst D2,(A0) btst D3,(A0)+ btst D2,-1(A0) btst D3,-(A0) btst D2,1(A0,D1.w) btst D3,$7000.w btst D2,$8000.l moveq #0,D2 bchg D2,D0 addq.l #7,D2 bchg D2,D0 addq.l #1,D2 bchg D2,D0 addq.l #7,D2 bchg D2,D0 addq.l #1,D2 bchg D2,D0 addq.l #7,D2 bchg D2,D0 addq.l #1,D2 bchg D2,D0 addq.l #7,D2 bchg D2,D0 moveq #0,D2 moveq #7,D3 bchg D2,(A0) bchg D3,(A0)+ bchg D2,-1(A0) bchg D3,-(A0) bchg D2,1(A0,D1.w) bchg D3,$7000.w bchg D2,$8000.l moveq #0,D2 bclr D2,D0 addq.l #7,D2 bclr D2,D0 addq.l #1,D2 bclr D2,D0 addq.l #7,D2 bclr D2,D0 addq.l #1,D2 bclr D2,D0 addq.l #7,D2 bclr D2,D0 addq.l #1,D2 bclr D2,D0 addq.l #7,D2 bclr D2,D0 moveq #0,D2 moveq #7,D3 bclr D2,(A0) bclr D3,(A0)+ bclr D2,-1(A0) bclr D3,-(A0) bclr D2,1(A0,D1.w) bclr D3,$7000.w bclr D2,$8000.l moveq #0,D2 bset D2,D0 addq.l #7,D2 bset D2,D0 addq.l #1,D2 bset D2,D0 addq.l #7,D2 bset D2,D0 addq.l #1,D2 bset D2,D0 addq.l #7,D2 bset D2,D0 addq.l #1,D2 bset D2,D0 addq.l #7,D2 bset D2,D0 moveq #0,D2 moveq #7,D3 bset D2,(A0) bset D3,(A0)+ bset D2,-1(A0) bset D3,-(A0) bset D2,1(A0,D1.w) bset D3,$7000.w bset D2,$8000.l rts ; AND.B, EOR.B, OR.B tests ;------------------------- log_b_test: lea $8000.l,A0 move.w #$55AA,(A0)+ move.w #$1234,(A0)+ move.w #$5678,(A0)+ moveq #0,D0 moveq #4,D1 move.b #$FF,D0 and.b log_b_test+1(PC),D0 or.b log_b_test+1(PC),D0 and.b log_b_test-1(PC,D1.w),D0 or.b log_b_test-1(PC,D1.l),D0 move.b #$FF,D0 eor.b D0,(A0)+ and.b (A0)+,D0 or.b D0,(A0)+ or.b (A0)+,D0 and.b D0,(A0)+ eor.b D0,(A0) and.b (A0),D0 or.b D0,(A0) or.b (A0),D0 and.b D0,(A0) move.b #$FF,D0 eor.b D0,-(A0) and.b -(A0),D0 or.b D0,-(A0) or.b -(A0),D0 and.b D0,-(A0) eor.b D0,1(A0) and.b 2(A0),D0 or.b D0,2(A0) or.b 3(A0),D0 and.b D0,3(A0) move.b #$FF,D0 eor.b D0,-1(A0,D1.w) and.b -2(A0,D1.l),D0 or.b D0,-2(A0,D1.l) or.b -3(A0,D1.w),D0 and.b D0,-3(A0,D1.w) eor.b D1,D0 and.b D1,D0 or.b D1,D0 rts ; AND.W, EOR.W, OR.W tests ;------------------------- log_w_test: lea $8000.l,A0 move.w #$5555,(A0)+ move.w #$AAAA,(A0)+ move.w #$1234,(A0)+ move.w #$5678,(A0)+ moveq #8,D1 move.w #$FFFF,D0 and.w log_w_test+2(PC),D0 or.w log_w_test+2(PC),D0 and.w log_w_test(PC,D1.w),D0 or.w log_w_test(PC,D1.l),D0 move.w #$FFFF,D0 eor.w D0,(A0)+ and.w (A0)+,D0 or.w D0,(A0)+ or.w (A0)+,D0 and.w D0,(A0)+ eor.w D0,(A0) and.w (A0),D0 or.w D0,(A0) or.w (A0),D0 and.w D0,(A0) move.w #$FFFF,D0 eor.w D0,-(A0) and.w -(A0),D0 or.w D0,-(A0) or.w -(A0),D0 and.w D0,-(A0) eor.w D0,2(A0) and.w 4(A0),D0 or.w D0,4(A0) or.w 6(A0),D0 and.w D0,6(A0) move.w #$FFFF,D0 eor.w D0,-2(A0,D1.w) and.w -4(A0,D1.l),D0 or.w D0,-4(A0,D1.l) or.w -6(A0,D1.w),D0 and.w D0,-6(A0,D1.w) eor.w D1,D0 and.w D1,D0 or.w D1,D0 rts ; AND.L, EOR.L, OR.L tests ;------------------------- log_l_test: lea $8000.l,A0 move.l #$55555555,(A0)+ move.l #$AAAAAAAA,(A0)+ move.l #$12345678,(A0)+ move.l #$9ABCDEF0,(A0)+ move.l #$FFFFFFFF,(A0)+ moveq #16,D1 move.l #$FFFFFFFF,D0 and.l log_l_test+2(PC),D0 or.l log_l_test+2(PC),D0 and.l log_l_test(PC,D1.w),D0 or.l log_l_test(PC,D1.l),D0 move.l #$FFFFFFFF,D0 eor.l D0,(A0)+ and.l (A0)+,D0 or.l D0,(A0)+ or.l (A0)+,D0 and.l D0,(A0)+ eor.l D0,(A0) and.l (A0),D0 or.l D0,(A0) or.l (A0),D0 and.l D0,(A0) move.l #$FFFFFFFF,D0 eor.l D0,-(A0) and.l -(A0),D0 or.l D0,-(A0) or.l -(A0),D0 and.l D0,-(A0) eor.l D0,4(A0) and.l 8(A0),D0 or.l D0,8(A0) or.l 12(A0),D0 and.l D0,12(A0) move.l #$FFFFFFFF,D0 eor.l D0,-4(A0,D1.w) and.l -8(A0,D1.l),D0 or.l D0,-8(A0,D1.l) or.l -12(A0,D1.w),D0 and.l D0,-12(A0,D1.w) eor.l D1,D0 and.l D1,D0 or.l D1,D0 rts ; ANDI, EORI, ORI tests ;---------------------- logi_b_test: lea $8000.l,A0 move.w #$55AA,(A0)+ move.w #$1234,(A0)+ move.w #$5678,(A0)+ moveq #0,D0 moveq #4,D1 move.b #$FF,D0 andi.b #$12,D0 eori.b #$34,D0 ori.b #$56,D0 andi.b #$12,(A0)+ eori.b #$34,(A0)+ ori.b #$56,(A0)+ andi.b #$78,(A0) eori.b #$9A,(A0) ori.b #$BC,(A0) andi.b #$12,-(A0) eori.b #$34,-(A0) ori.b #$56,-(A0) andi.b #$78,1(A0) eori.b #$9A,2(A0) ori.b #$BC,3(A0) andi.b #$12,-1(A0,D1.w) eori.b #$34,-2(A0,D1.l) ori.b #$56,-3(A0,D1.w) andi.b #$12,$7000.w eori.b #$34,$7000.w ori.b #$56,$7000.w andi.b #$78,$8000.l eori.b #$9A,$8000.l ori.b #$BC,$8000.l rts ; ANDI.W, EORI.W, ORI.W tests ;---------------------------- logi_w_test: lea $8000.l,A0 move.w #$5555,(A0)+ move.w #$AAAA,(A0)+ move.w #$1234,(A0)+ move.w #$5678,(A0)+ moveq #0,D0 moveq #8,D1 move.w #$FFFF,D0 andi.w #$1212,D0 eori.w #$3434,D0 ori.w #$5656,D0 andi.w #$1212,(A0)+ eori.w #$3434,(A0)+ ori.w #$5656,(A0)+ andi.w #$7878,(A0) eori.w #$9A9A,(A0) ori.w #$BCBC,(A0) andi.w #$1212,-(A0) eori.w #$3434,-(A0) ori.w #$5656,-(A0) andi.w #$7878,2(A0) eori.w #$9A9A,4(A0) ori.w #$BCBC,6(A0) andi.w #$1212,-2(A0,D1.w) eori.w #$3434,-4(A0,D1.l) ori.w #$5656,-6(A0,D1.w) andi.w #$1212,$7000.w eori.w #$3434,$7000.w ori.w #$5656,$7000.w andi.w #$7878,$8000.l eori.w #$9A9A,$8000.l ori.w #$BCBC,$8000.l rts ; ANDI.L, EORI.L, ORI.L tests ;---------------------------- logi_l_test: lea $8000.l,A0 move.l #$55555555,(A0)+ move.l #$AAAAAAAA,(A0)+ move.l #$12345678,(A0)+ move.l #$9ABCDEF0,(A0)+ move.l #$FFFFFFFF,(A0)+ moveq #16,D1 move.l #$FFFFFFFF,D0 andi.l #$12121212,D0 eori.l #$34343434,D0 ori.l #$56565656,D0 andi.l #$12121212,(A0)+ eori.l #$34343434,(A0)+ ori.l #$56565656,(A0)+ andi.l #$78787878,(A0) eori.l #$9A9A9A9A,(A0) ori.l #$BCBCBCBC,(A0) andi.l #$12121212,-(A0) eori.l #$34343434,-(A0) ori.l #$56565656,-(A0) andi.l #$78787878,4(A0) eori.l #$9A9A9A9A,8(A0) ori.l #$BCBCBCBC,12(A0) andi.l #$12121212,-4(A0,D1.w) eori.l #$34343434,-8(A0,D1.l) ori.l #$56565656,-12(A0,D1.w) andi.l #$12121212,$7000.w eori.l #$34343434,$7000.w ori.l #$56565656,$7000.w andi.l #$78787878,$8000.l eori.l #$9A9A9A9A,$8000.l ori.l #$BCBCBCBC,$8000.l rts ; ADD tests ;---------- add_b_test: lea $8000.l,A0 move.l #$12345678,(A0) move.l #$9ABCDEF0,4(A0) moveq #$7F,D0 moveq #2,D1 add.b (A0)+,D0 add.b D0,(A0)+ add.b (A0),D0 add.b D0,(A0) add.b -(A0),D0 add.b D0,-(A0) add.b 1(A0),D0 add.b D0,1(A0) add.b 3(A0,D1.w),D0 add.b D0,3(A0,D1.w) add.b D1,D0 add.b $7000.w,D0 add.b $8000.l,D0 add.b add_b_test+1(PC),D0 add.b add_b_test-1(PC,D1),D0 add.b #$12,D0 rts add_w_test: lea $8000.l,A0 move.l #$12345678,(A0) move.l #$9ABCDEF0,4(A0) move.w #$7FFF,D0 moveq #2,D1 add.w (A0)+,D0 add.w D0,(A0)+ add.w (A0),D0 add.w D0,(A0) add.w -(A0),D0 add.w D0,-(A0) add.w 2(A0),D0 add.w D0,2(A0) add.w 2(A0,D1.w),D0 add.w D0,4(A0,D1.w) add.w D1,D0 add.w A0,D0 add.w $7000.w,D0 add.w $8000.l,D0 add.w add_w_test+2(PC),D0 add.w add_w_test(PC,D1),D0 add.w #$1234,D0 rts add_l_test: lea $8000.l,A0 move.l #$12345678,(A0) move.l #$9ABCDEF0,4(A0) move.l #$12345678,8(A0) move.l #$7FFFFFFF,D0 moveq #2,D1 add.l (A0)+,D0 add.l D0,(A0)+ add.l (A0),D0 add.l D0,(A0) add.l -(A0),D0 add.l D0,-(A0) add.l 4(A0),D0 add.l D0,4(A0) add.l 6(A0,D1.w),D0 add.l D0,2(A0,D1.w) add.l D1,D0 add.l A0,D0 add.l $7000.w,D0 add.l $8000.l,D0 add.l add_l_test+2(PC),D0 add.l add_l_test(PC,D1),D0 add.l #$12345678,D0 rts ; ADDQ tests ;----------- addq_test: lea $7000.w,A0 lea $8000.l,A1 suba.l A2,A2 moveq #0,D0 moveq #2,D1 clr.b (A0) clr.b (A1) addq.b #8,D0 addq.b #1,(A0) addq.b #7,(A1)+ addq.b #8,-1(A1) addq.b #8,-3(A1,D1.w) addq.b #8,-(A1) addq.b #1,$7000.w addq.b #1,$8000.l move.b (A0),D0 move.b (A1),D0 clr.w (A0) move.w (A0),D0 clr.w (A1) addq.w #8,D0 addq.w #8,A2 addq.w #1,(A0) move.w (A0),D0 addq.w #7,(A1)+ addq.w #8,-2(A1) addq.w #8,-4(A1,D1.w) addq.w #8,-(A1) addq.w #1,$7000.w addq.w #1,$8000.l move.w (A0),D0 move.w (A1),D0 clr.l (A0) clr.l (A1) addq.l #8,D0 addq.l #8,A2 addq.l #1,(A0) addq.l #7,(A1)+ addq.l #8,-4(A1) addq.l #8,-6(A1,D1.w) addq.l #8,-(A1) addq.l #1,$7000.w addq.l #1,$8000.l move.l (A0),D0 move.l (A1),D0 rts ; ADDA.W tests ;------------- adda_w_test: lea $7FF0.w,A0 lea $7FF0.w,A1 lea $8000.l,A2 move.l #$12345678,(A2) moveq #2,D1 adda.w A1,A0 adda.w D1,A0 adda.w (A2)+,A0 adda.w (A2),A0 adda.w -(A2),A0 adda.w 2(A2),A0 adda.w 6(A2,D1.w),A0 adda.w $7000.w,A0 adda.w $8000.l,A0 adda.w adda_w_test+2(PC),A0 adda.w adda_w_test(PC,D1.l),A0 adda.w #$1234,A0 rts ; ADDA.L tests ;------------- adda_l_test: lea $7FFFFFF0.l,A0 lea $7FFFFFF0.l,A1 lea $8000.l,A2 move.l #$12345678,(A2) move.l #$9ABCDEF0,4(A2) moveq #2,D1 adda.l A1,A0 adda.l #32,A0 adda.l D1,A0 adda.l (A2)+,A0 adda.l (A2),A0 adda.l -(A2),A0 adda.l 4(A2),A0 adda.l 6(A2,D1.w),A0 adda.l $7000.w,A0 adda.l $8000.l,A0 adda.l adda_l_test+2(PC),A0 adda.l adda_l_test(PC,D1.l),A0 adda.l #$12345678,A0 rts ; ADDI.B tests ;------------- addi_b_test: lea $8000.l,A0 move.w #$55AA,(A0)+ move.w #$1234,(A0)+ move.w #$5678,(A0) subq.l #4,A0 moveq #0,D0 move.b #$7F,D0 addi.b #$7F,D0 addq.b #2,D0 move.b #$7F,D1 moveq #0,D2 addx.b D2,D1 moveq #4,D1 addi.b #$12,(A0)+ addi.b #$23,(A0) addi.b #$45,-(A0) addi.b #$56,1(A0) addi.b #$78,-3(A0,D1.w) addi.b #$9A,$7000.w addi.b #$BC,$8000.l rts ; ADDI.W tests ;------------- addi_w_test: lea $8000.l,A0 move.w #$5555,(A0)+ move.w #$AAAA,(A0)+ move.w #$1234,(A0)+ move.w #$5678,(A0) subq.l #6,A0 moveq #0,D0 move.w #$7FFF,D0 addi.w #$7FFF,D0 addq.w #2,D0 move.w #$7FFF,D1 moveq #0,D2 addx.w D2,D1 moveq #8,D1 addi.w #$1212,(A0)+ addi.w #$2323,(A0) addi.w #$4545,-(A0) addi.w #$5656,2(A0) addi.w #$7878,-6(A0,D1.w) addi.w #$9A9A,$7000.w addi.w #$BCBC,$8000.l rts ; ADDI.L tests ;------------- addi_l_test: lea $8000.l,A0 move.l #$55555555,(A0)+ move.l #$AAAAAAAA,(A0)+ move.l #$12345678,(A0)+ move.l #$9ABCDEF0,(A0)+ move.l #$FFFFFFFF,(A0) lea -16(A0),A0 move.l #$7FFFFFFF,D0 addi.l #$7FFFFFFF,D0 addq.l #2,D0 move.l #$7FFFFFFF,D1 moveq #0,D2 addx.l D2,D1 moveq #16,D1 addi.l #$12121212,(A0)+ addi.l #$23232323,(A0) addi.l #$45454545,-(A0) addi.l #$56565656,4(A0) addi.l #$78787878,-12(A0,D1.w) addi.l #$9A9A9A9A,$7000.w addi.l #$BCBCBCBC,$8000.l rts ; SUB tests ;---------- sub_b_test: lea $8000.l,A0 moveq #$7F,D0 moveq #2,D1 sub.b (A0)+,D0 sub.b (A0),D0 sub.b -(A0),D0 sub.b 1(A0),D0 sub.b 6(A0,D1.w),D0 sub.b D1,D0 sub.b $7000.w,D0 sub.b $8000.l,D0 sub.b sub_b_test+1(PC),D0 sub.b sub_b_test-1(PC,D1),D0 sub.b #$12,D0 rts sub_w_test: lea $8000.l,A0 move.w #$7FFF,D0 moveq #2,D1 sub.w (A0)+,D0 sub.w (A0),D0 sub.w -(A0),D0 sub.w 2(A0),D0 sub.w 6(A0,D1.w),D0 sub.w D1,D0 sub.w A0,D0 sub.w $7000.w,D0 sub.w $8000.l,D0 sub.w sub_w_test+2(PC),D0 sub.w sub_w_test(PC,D1),D0 sub.w #$1234,D0 rts sub_l_test: lea $8000.l,A0 move.l #$7FFFFFFF,D0 moveq #2,D1 sub.l (A0)+,D0 sub.l (A0),D0 sub.l -(A0),D0 sub.l 4(A0),D0 sub.l 6(A0,D1.w),D0 sub.l D1,D0 sub.l A0,D0 sub.l $7000.w,D0 sub.l $8000.l,D0 sub.l sub_l_test+2(PC),D0 sub.l sub_l_test(PC,D1),D0 sub.l #$12345678,D0 rts ; CMP tests ;---------- cmp_b_test: lea $8000.l,A0 move.l #$7F7F7F7F,(A0) moveq #$7F,D0 moveq #1,D1 cmp.b (A0)+,D0 cmp.b (A0),D0 cmp.b -(A0),D0 cmp.b 1(A0),D0 cmp.b 6(A0,D1.w),D0 cmp.b D1,D0 cmp.b $7000.w,D0 cmp.b $8000.l,D0 cmp.b cmp_b_test+1(PC),D0 cmp.b cmp_b_test-1(PC,D1),D0 cmp.b #$12,D0 rts cmp_w_test: lea $8000.l,A0 move.l #$7FFF7FFF,(A0) move.w #$7FFF,D0 moveq #2,D1 cmp.w (A0)+,D0 cmp.w (A0),D0 cmp.w -(A0),D0 cmp.w 2(A0),D0 cmp.w 6(A0,D1.w),D0 cmp.w D1,D0 cmp.w A0,D0 cmp.w $7000.w,D0 cmp.w $8000.l,D0 cmp.w cmp_w_test+2(PC),D0 cmp.w cmp_w_test(PC,D1),D0 cmp.w #$1234,D0 rts cmp_l_test: lea $8000.l,A0 move.l #$7FFFFFFF,(A0) move.l #$7FFFFFFF,D0 moveq #2,D1 cmp.l (A0)+,D0 cmp.l (A0),D0 cmp.l -(A0),D0 cmp.l 4(A0),D0 cmp.l 6(A0,D1.w),D0 cmp.l D1,D0 cmp.l A0,D0 cmp.l $7000.w,D0 cmp.l $8000.l,D0 cmp.l cmp_l_test+2(PC),D0 cmp.l cmp_l_test(PC,D1),D0 cmp.l #$12345678,D0 rts ; CMPA.W tests ;------------- cmpa_w_test: lea $7FFF.w,A0 lea $7FFF.w,A1 lea $8000.l,A2 move.l #12345678,(A2) moveq #2,D1 cmpa.w A1,A0 cmpa.w D1,A0 cmpa.w (A2)+,A0 cmpa.w (A2),A0 cmpa.w -(A2),A0 cmpa.w 2(A2),A0 cmpa.w 6(A2,D1.w),A0 cmpa.w $7000.w,A0 cmpa.w $8000.l,A0 cmpa.w cmpa_w_test+2(PC),A0 cmpa.w cmpa_w_test(PC,D1.l),A0 cmpa.w #$1234,A0 rts ; CMPA.L tests ;------------- cmpa_l_test: lea $7FFFFFFF.l,A0 lea $7FFFFFFF.l,A1 lea $8000.l,A2 move.l #$12345678,(A2) move.l #$9ABCDEF0,4(A2) moveq #2,D1 cmpa.l A1,A0 cmpa.l D1,A0 cmpa.l (A2)+,A0 cmpa.l (A2),A0 cmpa.l -(A2),A0 cmpa.l 4(A2),A0 cmpa.l 6(A2,D1.w),A0 cmpa.l $7000.w,A0 cmpa.l $8000.l,A0 cmpa.l cmpa_l_test+2(PC),A0 cmpa.l cmpa_l_test(PC,D1.l),A0 cmpa.l #$12345678,A0 move.w #$FFFF,-(SP) rtr ; SUBQ tests ;----------- subq_test: lea $7000.w,A0 lea $8000.l,A1 suba.l A2,A2 moveq #0,D0 moveq #2,D1 clr.b (A0) clr.b (A1) subq.b #8,D0 subq.b #1,(A0) subq.b #7,(A1)+ subq.b #8,-1(A1) subq.b #8,-3(A1,D1.w) subq.b #8,-(A1) subq.b #1,$7000.w subq.b #1,$8000.l move.b (A0),D0 move.b (A1),D0 clr.w (A0) move.w (A0),D0 clr.w (A1) subq.w #8,D0 subq.w #8,A2 subq.w #1,(A0) move.w (A0),D0 subq.w #7,(A1)+ subq.w #8,-2(A1) subq.w #8,-4(A1,D1.w) subq.w #8,-(A1) subq.w #1,$7000.w subq.w #1,$8000.l move.w (A0),D0 move.w (A1),D0 clr.l (A0) clr.l (A1) subq.l #8,D0 subq.l #8,A2 subq.l #1,(A0) subq.l #7,(A1)+ subq.l #8,-4(A1) subq.l #8,-6(A1,D1.w) subq.l #8,-(A1) subq.l #1,$7000.w subq.l #1,$8000.l move.l (A0),D0 move.l (A1),D0 rts ; SUBA.W tests ;------------- suba_w_test: lea $7FFF.w,A0 lea $7FFF.w,A1 lea $8000.l,A2 move.l #$12345678,(A2) moveq #2,D1 suba.w A1,A0 suba.w D1,A0 suba.w (A2)+,A0 suba.w (A2),A0 suba.w -(A2),A0 suba.w 2(A2),A0 suba.w 6(A2,D1.w),A0 suba.w $7000.w,A0 suba.w $8000.l,A0 suba.w suba_w_test+2(PC),A0 suba.w suba_w_test(PC,D1.l),A0 suba.w #$1234,A0 rts ; SUBA.L tests ;------------- suba_l_test: lea $7FFFFFFF.l,A0 lea $7FFFFFFF.l,A1 lea $8000.l,A2 move.l #$12345678,(A2) move.l #$9ABCDEF0,4(A2) moveq #2,D1 suba.l A1,A0 suba.l D1,A0 suba.l (A2)+,A0 suba.l (A2),A0 suba.l -(A2),A0 suba.l 4(A2),A0 suba.l 6(A2,D1.w),A0 suba.l $7000.w,A0 suba.l $8000.l,A0 suba.l suba_l_test+2(PC),A0 suba.l suba_l_test(PC,D1.l),A0 suba.l #$12345678,A0 rts ; SUBI.B tests ;------------- subi_b_test: lea $8000.l,A0 move.w #$55AA,(A0)+ move.w #$1234,(A0)+ move.w #$5678,(A0) subq.l #4,A0 moveq #0,D0 moveq #4,D1 move.b #$7F,D0 subi.b #$7F,D0 subq.b #1,D0 move.b #$7F,D1 moveq #0,D2 subx.b D2,D1 subi.b #$12,(A0)+ subi.b #$23,(A0) subi.b #$45,-(A0) subi.b #$56,1(A0) subi.b #$78,-3(A0,D1.w) subi.b #$9A,$7000.w subi.b #$BC,$8000.l rts ; SUBI.W tests ;------------- subi_w_test: lea $8000.l,A0 move.w #$5555,(A0)+ move.w #$AAAA,(A0)+ move.w #$1234,(A0)+ move.w #$5678,(A0) subq.l #6,A0 moveq #0,D0 moveq #8,D1 move.w #$7FFF,D0 subi.w #$7FFF,D0 subq.w #1,D0 move.w #$7FFF,D1 moveq #0,D2 subx.w D2,D1 subi.w #$1212,(A0)+ subi.w #$2323,(A0) subi.w #$4545,-(A0) subi.w #$5656,2(A0) subi.w #$7878,-6(A0,D1.w) subi.w #$9A9A,$7000.w subi.w #$BCBC,$8000.l rts ; SUBI.L tests ;------------- subi_l_test: lea $8000.l,A0 move.l #$55555555,(A0)+ move.l #$AAAAAAAA,(A0)+ move.l #$12345678,(A0)+ move.l #$9ABCDEF0,(A0)+ move.l #$FFFFFFFF,(A0) lea -16(A0),A0 moveq #16,D1 move.l #$7FFFFFFF,D0 subi.l #$7FFFFFFF,D0 subq.l #1,D0 move.l #$7FFFFFFF,D1 moveq #0,D2 subx.l D2,D1 subi.l #$12121212,(A0)+ subi.l #$23232323,(A0) subi.l #$45454545,-(A0) subi.l #$56565656,4(A0) subi.l #$78787878,-12(A0,D1.w) subi.l #$9A9A9A9A,$7000.w subi.l #$BCBCBCBC,$8000.l rts ; CMPI.B tests ;------------- cmpi_b_test: lea $8000.l,A0 move.w #$55AA,(A0)+ move.w #$1234,(A0)+ move.w #$5678,(A0) subq.l #4,A0 moveq #0,D0 moveq #4,D1 move.b #$7F,D0 cmpi.b #$7F,D0 cmpi.b #$12,(A0)+ cmpi.b #$23,(A0) cmpi.b #$45,-(A0) cmpi.b #$56,1(A0) cmpi.b #$78,-3(A0,D1.w) cmpi.b #$9A,$7000.w cmpi.b #$BC,$8000.l rts ; CMPI.W tests ;------------- cmpi_w_test: lea $8000.l,A0 move.w #$5555,(A0)+ move.w #$AAAA,(A0)+ move.w #$1234,(A0)+ move.w #$5678,(A0) subq.l #6,A0 moveq #0,D0 moveq #8,D1 move.w #$7FFF,D0 cmpi.w #$7FFF,D0 cmpi.w #$1212,(A0)+ cmpi.w #$2323,(A0) cmpi.w #$4545,-(A0) cmpi.w #$5656,2(A0) cmpi.w #$7878,-6(A0,D1.w) cmpi.w #$9A9A,$7000.w cmpi.w #$BCBC,$8000.l rts ; CMPI.L tests ;------------- cmpi_l_test: lea $8000.l,A0 move.l #$55555555,(A0)+ move.l #$AAAAAAAA,(A0)+ move.l #$12345678,(A0)+ move.l #$9ABCDEF0,(A0)+ move.l #$FFFFFFFF,(A0) lea -16(A0),A0 moveq #16,D1 move.l #$7FFFFFFF,D0 cmpi.l #$7FFFFFFF,D0 cmpi.l #$12121212,(A0)+ cmpi.l #$23232323,(A0) cmpi.l #$45454545,-(A0) cmpi.l #$56565656,4(A0) cmpi.l #$78787878,-12(A0,D1.w) cmpi.l #$9A9A9A9A,$7000.w cmpi.l #$BCBCBCBC,$8000.l rts ; CLR and TST tests ;------------------ clr_tst_test: lea $8000.l,A0 moveq #1,D1 move.b #$55,D0 clr.b D0 tst.b D0 move.b #$55,(A0) clr.b (A0) tst.b (A0) move.b #$55,(A0) clr.b (A0)+ tst.b -(A0) move.b #$55,(A0)+ clr.b -(A0) tst.b (A0)+ move.b #$55,1(A0) clr.b 1(A0) tst.b 1(A0) move.b #$55,1(A0,D1.w) clr.b 1(A0,D1.w) tst.b 1(A0,D1.w) move.b #$55,$7000.w clr.b $7000.w tst.b $7000.w move.b #$55,$8000.l clr.b $8000.l tst.b $8000.l lea $8000.l,A0 moveq #2,D1 move.w #$5555,D0 clr.w D0 tst.w D0 move.w #$5555,(A0) clr.w (A0) tst.w (A0) move.w #$5555,(A0) clr.w (A0)+ tst.w -(A0) move.w #$5555,(A0)+ clr.w -(A0) tst.w (A0)+ move.w #$5555,2(A0) clr.w 2(A0) tst.w 2(A0) move.w #$5555,2(A0,D1.w) clr.w 2(A0,D1.w) tst.w 2(A0,D1.w) move.w #$55,$7000.w clr.w $7000.w tst.w $7000.w move.w #$5555,$8000.l clr.w $8000.l tst.w $8000.l lea $8000.l,A0 moveq #4,D1 move.l #$55555555,D0 clr.l D0 tst.l D0 move.l #$55555555,(A0) clr.l (A0) tst.l (A0) move.l #$55555555,(A0) clr.l (A0)+ tst.l -(A0) move.l #$55555555,(A0)+ clr.l -(A0) tst.l (A0)+ move.l #$55555555,4(A0) clr.l 4(A0) tst.l 4(A0) move.l #$55555555,4(A0,D1.w) clr.l 4(A0,D1.w) tst.l 4(A0,D1.w) move.l #$55555555,$7000.w clr.l $7000.w tst.l $7000.w move.l #$55555555,$8000.l clr.l $8000.l tst.l $8000.l rts ; NEG and NEGX tests ;------------------- neg_test: lea $8000.l,A0 move.l #$12345678,(A0) move.b #$89,-$1000(A0) moveq #-128,D0 moveq #127,D1 moveq #0,D2 moveq #1,D3 neg.b D0 negx.b D1 negx.b D2 neg.b (A0) move.b (A0),D0 negx.b 1(A0) move.b 1(A0),D0 neg.b (A0)+ move.b (A0),D0 negx.b (A0)+ move.b (A0),D0 neg.b -2(A0) move.b -2(A0),D0 negx.b -1(A0) move.b -1(A0),D0 neg.b -(A0) move.b (A0),D0 negx.b -(A0) move.b (A0),D0 neg.b 1(A0,D3) move.b 1(A0,D3),D0 negx.b 2(A0,D3) move.b 2(A0,D3),D0 neg.b $7000.w move.b $7000.w,D0 negx.b $7001.w move.b $7001.w,D0 neg.b $8000.l move.b $8000.l,D0 negx.b $8001.l move.b $8001.l,D0 move.l #$12345678,(A0) move.l #$9ABCDEF0,4(A0) move.w #$89AB,-$1000(A0) move.w #$8000,D0 move.w #$7FFF,D1 moveq #0,D2 moveq #2,D3 neg.w D0 negx.w D1 negx.w D2 neg.w (A0) move.w (A0),D0 negx.w 2(A0) move.w 2(A0),D0 neg.w (A0)+ move.w (A0),D0 negx.w (A0)+ move.w (A0),D0 neg.w -4(A0) move.w -4(A0),D0 negx.w -2(A0) move.w -2(A0),D0 neg.w -(A0) move.w (A0),D0 negx.w -(A0) move.w (A0),D0 neg.w 2(A0,D3) move.w 2(A0,D3),D0 negx.w 4(A0,D3) move.w 4(A0,D3),D0 neg.w $7000.w move.w $7000.w,D0 negx.w $7002.w move.w $7002.w,D0 neg.w $8000.l move.w $8000.l,D0 negx.w $8002.l move.w $8002.l,D0 move.l #$12345678,(A0) move.l #$9ABCDEF0,4(A0) move.l #$12345678,8(A0) move.l #$9ABCDEF0,12(A0) move.l #$01234567,-$1000(A0) move.l #$89ABCDEF,-$0FFC(A0) move.l #$80000000,D0 move.l #$7FFFFFFF,D1 moveq #0,D2 moveq #4,D3 neg.l D0 negx.l D1 negx.l D2 neg.l (A0) move.l (A0),D0 negx.l 4(A0) move.l 4(A0),D0 neg.l (A0)+ move.l (A0),D0 negx.l (A0)+ move.l (A0),D0 neg.l -8(A0) move.l -8(A0),D0 negx.l -4(A0) move.l -4(A0),D0 neg.l -(A0) move.l (A0),D0 negx.l -(A0) move.l (A0),D0 neg.l 0(A0,D3) move.l 0(A0,D3),D0 negx.l 4(A0,D3) move.l 4(A0,D3),D0 neg.l $7000.w move.l $7000.w,D0 negx.l $7004.w move.l $7004.w,D0 neg.l $8000.l move.l $8000.l,D0 negx.l $8004.l move.l $8004.l,D0 rts ; NOT tests ;---------- not_test: lea $8000.l,A0 move.l #$12345678,(A0) move.b #$89,-$1000(A0) moveq #-128,D0 moveq #127,D1 moveq #0,D2 moveq #1,D3 not.b D0 not.b D1 not.b D2 not.b (A0) move.b (A0),D0 not.b (A0)+ move.b (A0),D0 not.b -1(A0) move.b -1(A0),D0 not.b -(A0) move.b (A0),D0 not.b 1(A0,D3) move.b 1(A0,D3),D0 not.b $7000.w move.b $7000.w,D0 not.b $8000.l move.b $8000.l,D0 move.l #$12345678,(A0) move.l #$9ABCDEF0,4(A0) move.w #$89AB,-$1000(A0) move.w #$8000,D0 move.w #$7FFF,D1 moveq #0,D2 moveq #2,D3 not.w D0 not.w D1 not.w D2 not.w (A0) move.w (A0),D0 not.w (A0)+ move.w (A0),D0 not.w -2(A0) move.w -2(A0),D0 not.w -(A0) move.w (A0),D0 not.w 2(A0,D3) move.w 2(A0,D3),D0 not.w $7000.w move.w $7000.w,D0 not.w $8000.l move.w $8000.l,D0 move.l #$12345678,(A0) move.l #$9ABCDEF0,8(A0) move.l #$89ABCDEF,-$1000(A0) move.l #$80000000,D0 move.l #$7FFFFFFF,D1 moveq #0,D2 moveq #4,D3 not.l D0 not.l D1 not.l D2 not.l (A0) move.l (A0),D0 not.l (A0)+ move.l (A0),D0 not.l -4(A0) move.l -4(A0),D0 not.l -(A0) move.l (A0),D0 not.l 4(A0,D3) move.l 4(A0,D3),D0 not.l $7000.w move.l $7000.w,D0 not.l $8000.l move.l $8000.l,D0 rts ; MULU, MULS tests ;----------------- mult_test: move.w #$5555,D0 move.w #$AAAA,D1 lea $8000.l,A0 moveq #2,D2 move.w D0,(A0) move.w D1,4(A0) move.w D1,-$1000(A0) mulu.w D1,D0 mulu.w (A0),D0 mulu.w (A0)+,D0 mulu.w -2(A0),D0 mulu.w -(A0),D0 mulu.w 2(A0,D2.w),D0 mulu.w $7000.w,D0 mulu.w $8000.l,D0 mulu.w mult_test+2(PC),D0 mulu.w mult_test+4(PC,D2.w),D0 mulu.w #$1234,D0 muls.w D1,D0 muls.w (A0),D0 muls.w (A0)+,D0 muls.w -2(A0),D0 muls.w -(A0),D0 muls.w 2(A0,D2.w),D0 muls.w $7000.w,D0 muls.w $8000.l,D0 muls.w mult_test+2(PC),D0 muls.w mult_test+4(PC,D2.w),D0 muls.w #$1234,D0 rts ; DIVU, DIVS tests ;----------------- div_test: move.l D0,D0 move.w #$AAAA,D1 move.l #$12345678,D2 lea $8000.l,A0 moveq #2,D3 move.w D1,(A0) move.w D2,4(A0) move.w D1,-$1000(A0) move.l D2,D0 divu div_test+2(PC),D0 move.l D2,D0 divu div_test+4(PC,D3.w),D0 move.l D2,D0 divs div_test+2(PC),D0 move.l D2,D0 divs div_test+4(PC,D3.w),D0 move.l D2,D0 divu D1,D0 move.l D2,D0 divu (A0),D0 move.l D2,D0 divu (A0)+,D0 move.l D2,D0 divu -2(A0),D0 move.l D2,D0 divu -(A0),D0 move.l D2,D0 divu 2(A0,D3.w),D0 move.l D2,D0 divu $7000.w,D0 move.l D2,D0 divu $8000.l,D0 move.l D2,D0 divu #$1234,D0 move.l D2,D0 divs D1,D0 move.l D2,D0 divs (A0),D0 move.l D2,D0 divs (A0)+,D0 move.l D2,D0 divs -2(A0),D0 move.l D2,D0 divs -(A0),D0 move.l D2,D0 divs 2(A0,D3.w),D0 move.l D2,D0 divs $7000.w,D0 move.l D2,D0 divs $8000.l,D0 move.l D2,D0 divs #$1234,D0 move.l #$12345678,D0 divu #$1234,D0 move.l #$55555555,D0 divu #$AAAA,D0 move.l #$AAAAAAAA,D0 divu #$5555,D0 move.l #$2AAAAAAA,D0 divu #$5555,D0 move.l #$12345678,D0 divs #$1235,D0 move.l #$12345678,D0 divs #$1234,D0 move.l #$55555555,D0 divs #$AAAA,D0 move.l #$AAAAAAAA,D0 divs #$5555,D0 move.l #$2AAAAAAA,D0 divs #$5555,D0 rts ; MOVE.B tests ;------------- move_b_test_0: lea $8000.l,A0 moveq #0,D0 moveq #-128,D1 moveq #2,D2 move.b D0,D3 move.b D1,D3 move.b (A0),D3 move.b (A0)+,D3 move.b -(A0),D3 move.b 1(A0),D3 move.b -3(A0,D2.w),D3 move.b $7000.w,D3 move.b $8000.l,D3 move.b move_b_test_0(PC),D3 move.b move_b_test_0(PC,D2.w),D3 move.b #$12,D3 rts move_b_test_2: lea $8000.l,A0 move.l A0,A1 moveq #0,D0 moveq #-128,D1 moveq #2,D2 move.b D0,(A1) move.b D1,(A1) move.b (A0),(A1) move.b (A0)+,(A1) move.b -(A0),(A1) move.b 1(A0),(A1) move.b -3(A0,D2.w),(A1) move.b $7000.w,(A1) move.b $8000.l,(A1) move.b move_b_test_2(PC),(A1) move.b move_b_test_2(PC,D2.w),(A1) move.b #$12,(A1) rts move_b_test_3: lea $8000.l,A0 move.l A0,A1 moveq #0,D0 moveq #-128,D1 moveq #2,D2 move.b D0,(A1)+ move.b D1,(A1)+ move.b (A0),(A1)+ move.b (A0)+,(A1)+ move.b -(A0),(A1)+ move.b 1(A0),(A1)+ move.b -3(A0,D2.w),(A1)+ move.b $7000.w,(A1)+ move.b $8000.l,(A1)+ move.b move_b_test_3(PC),(A1)+ move.b move_b_test_3(PC,D2.w),(A1)+ move.b #$12,(A1)+ rts move_b_test_4: lea $8000.l,A0 lea 12(A0),A1 moveq #0,D0 moveq #-128,D1 moveq #2,D2 move.b D0,-(A1) move.b D1,-(A1) move.b (A0),-(A1) move.b (A0)+,-(A1) move.b -(A0),-(A1) move.b 1(A0),-(A1) move.b -3(A0,D2.w),-(A1) move.b $7000.w,-(A1) move.b $8000.l,-(A1) move.b move_b_test_4(PC),-(A1) move.b move_b_test_4(PC,D2.w),-(A1) move.b #$12,-(A1) rts move_b_test_5: lea $8000.l,A0 move.l A0,A1 moveq #0,D0 moveq #-128,D1 moveq #2,D2 move.b D0,1(A1) move.b D1,2(A1) move.b (A0),3(A1) move.b (A0)+,4(A1) move.b -(A0),5(A1) move.b 1(A0),6(A1) move.b -3(A0,D2.w),7(A1) move.b $7000.w,8(A1) move.b $8000.l,9(A1) move.b move_b_test_5(PC),10(A1) move.b move_b_test_5(PC,D2.w),11(A1) move.b #$12,12(A1) rts move_b_test_6: lea $8000.l,A0 move.l A0,A1 moveq #0,D0 moveq #-128,D1 moveq #2,D2 move.b D0,1(A1,D2.w) move.b D1,2(A1,D2.w) move.b (A0),3(A1,D2.w) move.b (A0)+,4(A1,D2.w) move.b -(A0),5(A1,D2.w) move.b 1(A0),6(A1,D2.w) move.b -3(A0,D2.w),7(A1,D2.w) move.b $7000.w,8(A1,D2.w) move.b $8000.l,9(A1,D2.w) move.b move_b_test_6(PC),10(A1,D2.w) move.b move_b_test_6(PC,D2.w),11(A1,D2.w) move.b #$12,12(A1,D2.w) rts move_b_test_7: lea $8000.l,A0 move.l A0,A1 moveq #0,D0 moveq #-128,D1 moveq #2,D2 move.b D0,$7001.w move.b D1,$7002.w move.b (A0),$7003.w move.b (A0)+,$7004.w move.b -(A0),$7005.w move.b 1(A0),$7006.w move.b -3(A0,D2.w),$7007.w move.b $7000.w,$7008.w move.b $8000.l,$7009.w move.b move_b_test_7(PC),$700A.w move.b move_b_test_7(PC,D2.w),$700B.w move.b #$12,$700C.w rts move_b_test_8: lea $8000.l,A0 move.l A0,A1 moveq #0,D0 moveq #-128,D1 moveq #2,D2 move.b D0,$8001.l move.b D1,$8002.l move.b (A0),$8003.l move.b (A0)+,$8004.l move.b -(A0),$8005.l move.b 1(A0),$8006.l move.b -3(A0,D2.w),$8007.l move.b $7000.w,$8008.l move.b $8000.l,$8009.l move.b move_b_test_8(PC),$800A.l move.b move_b_test_8(PC,D2.w),$800B.l move.b #$12,$800C.l rts ; MOVE.W tests ;------------- move_w_test_0: lea $8000.l,A0 moveq #0,D0 moveq #-128,D1 moveq #6,D2 move.w D0,D3 move.w D1,D3 move.w A0,D3 move.w (A0),D3 move.w (A0)+,D3 move.w -(A0),D3 move.w 2(A0),D3 move.w -4(A0,D2.w),D3 move.w $7000.w,D3 move.w $8000.l,D3 move.w move_w_test_0(PC),D3 move.w move_w_test_0(PC,D2.w),D3 move.w #$1234,D3 rts move_w_test_1: lea $8000.l,A0 moveq #0,D0 moveq #-128,D1 moveq #6,D2 movea.w D0,A3 movea.w D1,A3 movea.w A0,A3 movea.w (A0),A3 movea.w (A0)+,A3 movea.w -(A0),A3 movea.w 2(A0),A3 movea.w -4(A0,D2.w),A3 movea.w $7000.w,A3 movea.w $8000.l,A3 movea.w move_w_test_0(PC),A3 movea.w move_w_test_0(PC,D2.w),A3 movea.w #$1234,A3 rts move_w_test_2: lea $8000.l,A0 move.l A0,A1 moveq #0,D0 moveq #-128,D1 moveq #6,D2 move.w D0,(A1) move.w D1,(A1) move.w A0,(A1) move.w (A0),(A1) move.w (A0)+,(A1) move.w -(A0),(A1) move.w 2(A0),(A1) move.w -4(A0,D2.w),(A1) move.w $7000.w,(A1) move.w $8000.l,(A1) move.w move_w_test_2(PC),(A1) move.w move_w_test_2(PC,D2.w),(A1) move.w #$1234,(A1) rts move_w_test_3: lea $8000.l,A0 move.l A0,A1 moveq #0,D0 moveq #-128,D1 moveq #6,D2 move.w D0,(A1)+ move.w D1,(A1)+ move.w A0,(A1)+ move.w (A0),(A1)+ move.w (A0)+,(A1)+ move.w -(A0),(A1)+ move.w 2(A0),(A1)+ move.w -4(A0,D2.w),(A1)+ move.w $7000.w,(A1)+ move.w $8000.l,(A1)+ move.w move_w_test_3(PC),(A1)+ move.w move_w_test_3(PC,D2.w),(A1)+ move.w #$1234,(A1)+ rts move_w_test_4: lea $8000.l,A0 lea 26(A0),A1 moveq #0,D0 moveq #-128,D1 moveq #6,D2 move.w D0,-(A1) move.w D1,-(A1) move.w A0,-(A1) move.w (A0),-(A1) move.w (A0)+,-(A1) move.w -(A0),-(A1) move.w 2(A0),-(A1) move.w -4(A0,D2.w),-(A1) move.w $7000.w,-(A1) move.w $8000.l,-(A1) move.w move_w_test_4(PC),-(A1) move.w move_w_test_4(PC,D2.w),-(A1) move.w #$1234,-(A1) rts move_w_test_5: lea $8000.l,A0 move.l A0,A1 moveq #0,D0 moveq #-128,D1 moveq #6,D2 move.w D0,2(A1) move.w D1,4(A1) move.w A0,6(A1) move.w (A0),8(A1) move.w (A0)+,10(A1) move.w -(A0),12(A1) move.w 2(A0),14(A1) move.w -4(A0,D2.w),16(A1) move.w $7000.w,18(A1) move.w $8000.l,20(A1) move.w move_w_test_5(PC),22(A1) move.w move_w_test_5(PC,D2.w),24(A1) move.w #$1234,26(A1) rts move_w_test_6: lea $8000.l,A0 move.l A0,A1 moveq #0,D0 moveq #-128,D1 moveq #6,D2 move.w D0,2(A1,D2.w) move.w D1,4(A1,D2.w) move.w A0,6(A1,D2.w) move.w (A0),8(A1,D2.w) move.w (A0)+,10(A1,D2.w) move.w -(A0),12(A1,D2.w) move.w 2(A0),14(A1,D2.w) move.w -4(A0,D2.w),16(A1,D2.w) move.w $7000.w,18(A1,D2.w) move.w $8000.l,20(A1,D2.w) move.w move_w_test_6(PC),22(A1,D2.w) move.w move_w_test_6(PC,D2.w),24(A1,D2.w) move.w #$1234,26(A1,D2.w) rts move_w_test_7: lea $8000.l,A0 moveq #0,D0 moveq #-128,D1 moveq #6,D2 move.w D0,$7002.w move.w D1,$7004.w move.w A0,$7006.w move.w (A0),$7008.w move.w (A0)+,$700A.w move.w -(A0),$700C.w move.w 2(A0),$700E.w move.w -4(A0,D2.w),$7010.w move.w $7000.w,$7012.w move.w $8000.l,$7014.w move.w move_w_test_7(PC),$7016.w move.w move_w_test_7(PC,D2.w),$7018.w move.w #$1234,$701A.w rts move_w_test_8: lea $8000.l,A0 moveq #0,D0 moveq #-128,D1 moveq #6,D2 move.w D0,$8002.l move.w D1,$8004.l move.w A0,$8006.l move.w (A0),$8008.l move.w (A0)+,$800A.l move.w -(A0),$800C.l move.w 2(A0),$800E.l move.w -4(A0,D2.w),$8010.l move.w $7000.w,$8012.l move.w $8000.l,$8014.l move.w move_w_test_8(PC),$8016.l move.w move_w_test_8(PC,D2.w),$8018.l move.w #$1234,$801A.l rts ; MOVE.L tests ;------------- move_l_test_0: lea $8000.l,A0 moveq #0,D0 moveq #-128,D1 moveq #8,D2 move.l D0,D3 move.l D1,D3 move.l A0,D3 move.l (A0),D3 move.l (A0)+,D3 move.l -(A0),D3 move.l 4(A0),D3 move.l -6(A0,D2.w),D3 move.l $7000.w,D3 move.l $8000.l,D3 move.l move_l_test_0(PC),D3 move.l move_l_test_0(PC,D2.w),D3 move.l #$12345678,D3 rts move_l_test_1: lea $8000.l,A0 moveq #0,D0 moveq #-128,D1 moveq #8,D2 movea.l D0,A3 movea.l D1,A3 movea.l A0,A3 movea.l (A0),A3 movea.l (A0)+,A3 movea.l -(A0),A3 movea.l 4(A0),A3 movea.l -6(A0,D2.w),A3 movea.l $7000.w,A3 movea.l $8000.l,A3 movea.l move_l_test_0(PC),A3 movea.l move_l_test_0(PC,D2.w),A3 movea.l #$12345678,A3 rts move_l_test_2: lea $8000.l,A0 move.l A0,A1 moveq #0,D0 moveq #-128,D1 moveq #8,D2 move.l D0,(A1) move.l D1,(A1) move.l A0,(A1) move.l (A0),(A1) move.l (A0)+,(A1) move.l -(A0),(A1) move.l 4(A0),(A1) move.l -6(A0,D2.w),(A1) move.l $7000.w,(A1) move.l $8000.l,(A1) move.l move_l_test_2(PC),(A1) move.l move_l_test_2(PC,D2.w),(A1) move.l #$12345678,(A1) rts move_l_test_3: lea $8000.l,A0 move.l A0,A1 moveq #0,D0 moveq #-128,D1 moveq #8,D2 move.l D0,(A1)+ move.l D1,(A1)+ move.l A0,(A1)+ move.l (A0),(A1)+ move.l (A0)+,(A1)+ move.l -(A0),(A1)+ move.l 4(A0),(A1)+ move.l -6(A0,D2.w),(A1)+ move.l $7000.w,(A1)+ move.l $8000.l,(A1)+ move.l move_l_test_3(PC),(A1)+ move.l move_l_test_3(PC,D2.w),(A1)+ move.l #$12345678,(A1)+ rts move_l_test_4: lea $8000.l,A0 lea 52(A0),A1 moveq #0,D0 moveq #-128,D1 moveq #8,D2 move.l D0,-(A1) move.l D1,-(A1) move.l A0,-(A1) move.l (A0),-(A1) move.l (A0)+,-(A1) move.l -(A0),-(A1) move.l 4(A0),-(A1) move.l -6(A0,D2.w),-(A1) move.l $7000.w,-(A1) move.l $8000.l,-(A1) move.l move_l_test_4(PC),-(A1) move.l move_l_test_4(PC,D2.w),-(A1) move.l #$12345678,-(A1) rts move_l_test_5: lea $8000.l,A0 move.l A0,A1 moveq #0,D0 moveq #-128,D1 moveq #8,D2 move.l D0,4(A1) move.l D1,8(A1) move.l A0,12(A1) move.l (A0),16(A1) move.l (A0)+,20(A1) move.l -(A0),24(A1) move.l 4(A0),28(A1) move.l -6(A0,D2.w),32(A1) move.l $7000.w,36(A1) move.l $8000.l,40(A1) move.l move_l_test_5(PC),44(A1) move.l move_l_test_5(PC,D2.w),48(A1) move.l #$12345678,52(A1) rts move_l_test_6: lea $8000.l,A0 move.l A0,A1 moveq #0,D0 moveq #-128,D1 moveq #8,D2 move.l D0,4(A1,D2.w) move.l D1,8(A1,D2.w) move.l A0,12(A1,D2.w) move.l (A0),16(A1,D2.w) move.l (A0)+,20(A1,D2.w) move.l -(A0),24(A1,D2.w) move.l 4(A0),28(A1,D2.w) move.l -6(A0,D2.w),32(A1,D2.w) move.l $7000.w,36(A1,D2.w) move.l $8000.l,40(A1,D2.w) move.l move_l_test_6(PC),44(A1,D2.w) move.l move_l_test_6(PC,D2.w),48(A1,D2.w) move.l #$12345678,52(A1,D2.w) rts move_l_test_7: lea $8000.l,A0 moveq #0,D0 moveq #-128,D1 moveq #8,D2 move.l D0,$7002.w move.l D1,$7004.w move.l A0,$7006.w move.l (A0),$7008.w move.l (A0)+,$700A.w move.l -(A0),$700C.w move.l 4(A0),$700E.w move.l -6(A0,D2.w),$7010.w move.l $7000.w,$7012.w move.l $8000.l,$7014.w move.l move_l_test_7(PC),$7016.w move.l move_l_test_7(PC,D2.w),$7018.w move.l #$12345678,$701A.w rts move_l_test_8: lea $8000.l,A0 moveq #0,D0 moveq #-128,D1 moveq #8,D2 move.l D0,$8002.l move.l D1,$8004.l move.l A0,$8006.l move.l (A0),$8008.l move.l (A0)+,$800A.l move.l -(A0),$800C.l move.l 4(A0),$800E.l move.l -6(A0,D2.w),$8010.l move.l $7000.w,$8012.l move.l $8000.l,$8014.l move.l move_l_test_8(PC),$8016.l move.l move_l_test_8(PC,D2.w),$8018.l move.l #$12345678,$801A.l rts movem_test: moveq #-1,D0 moveq #-2,D1 moveq #-3,D2 moveq #-4,D3 moveq #0,D4 moveq #1,D5 moveq #2,D6 moveq #3,D7 movem.l D0-D7,-(SP) movem.l 16(SP),A0-A3 movem.l D0-D7,(SP) movem.l (SP),A0-A3 movem.l 16(SP),A0-A3 movem.l D4-D7,16(SP) movem.l 16(SP),A0-A3 movem.l D0-D3,16(SP,D4) movem.l 16(SP),A0-A3 movem.l (SP)+,D0-D7 moveq #-1,D0 moveq #-2,D1 moveq #-3,D2 moveq #-4,D3 moveq #0,D4 moveq #1,D5 moveq #2,D6 moveq #3,D7 movem.w D0-D7,-(SP) movem.w 8(SP),A0-A3 movem.w D0-D7,(SP) movem.w (SP),A0-A3 movem.w 8(SP),A0-A3 movem.w D4-D7,8(SP) movem.w 8(SP),A0-A3 movem.w D0-D3,8(SP,D4) movem.w 8(SP),A0-A3 movem.w (SP)+,D0-D7 rts ; Shifts immediate tests ;----------------------- shifti_test: moveq #$55,D0 asr.b #3,D0 moveq #-1,D0 lsr.b #3,D0 moveq #-10,D0 ror.b #8,D0 moveq #-128,D0 roxr.b #3,D0 moveq #$55,D0 asr.w #3,D0 moveq #-1,D0 lsr.w #3,D0 moveq #-10,D0 ror.w #8,D0 moveq #-128,D0 roxr.w #3,D0 moveq #$55,D0 asr.l #3,D0 moveq #-1,D0 lsr.l #3,D0 moveq #-10,D0 ror.l #8,D0 moveq #-128,D0 roxr.l #3,D0 moveq #$55,D0 asl.b #3,D0 moveq #-1,D0 lsl.b #3,D0 moveq #-10,D0 rol.b #8,D0 moveq #-128,D0 roxl.b #3,D0 moveq #$55,D0 asl.w #3,D0 moveq #-1,D0 lsl.w #3,D0 moveq #-10,D0 rol.w #8,D0 moveq #-128,D0 roxl.w #3,D0 moveq #$55,D0 asl.l #3,D0 moveq #-1,D0 lsl.l #3,D0 moveq #-10,D0 rol.l #8,D0 moveq #-128,D0 roxl.l #3,D0 rts ; Shifts register tests ;---------------------- shiftr_test: moveq #$55,D0 moveq #1,D1 asr.b D1,D0 moveq #-1,D0 moveq #3,D1 lsr.b D1,D0 moveq #-10,D0 moveq #5,D1 ror.b D1,D0 moveq #-128,D0 moveq #7,D1 roxr.b D1,D0 moveq #$55,D0 moveq #9,D1 asr.w D1,D0 moveq #-1,D0 moveq #11,D1 lsr.w D1,D0 moveq #-10,D0 moveq #13,D1 ror.w D1,D0 moveq #-128,D0 moveq #15,D1 roxr.w D1,D0 moveq #$55,D0 moveq #17,D1 asr.l D1,D0 moveq #-1,D0 moveq #19,D1 lsr.l D1,D0 moveq #-10,D0 moveq #21,D1 ror.l D1,D0 moveq #-128,D0 moveq #23,D1 roxr.l D1,D0 moveq #$55,D0 moveq #1,D1 asl.b D1,D0 moveq #-1,D0 moveq #3,D1 lsl.b D1,D0 moveq #-10,D0 moveq #5,D1 rol.b D1,D0 moveq #-128,D0 moveq #7,D1 roxl.b D1,D0 moveq #$55,D0 moveq #9,D1 asl.w D1,D0 moveq #-1,D0 moveq #11,D1 lsl.w D1,D0 moveq #-10,D0 moveq #13,D1 rol.w D1,D0 moveq #-128,D0 moveq #15,D1 roxl.w D1,D0 moveq #$55,D0 moveq #17,D1 asl.l D1,D0 moveq #-1,D0 moveq #19,D1 lsl.l D1,D0 moveq #-10,D0 moveq #21,D1 rol.l D1,D0 moveq #-128,D0 moveq #23,D1 roxl.l D1,D0 rts ; Shifts memory tests ;-------------------- shiftm_test: lea $8000.l,A0 moveq #8,D1 move.l #$5555AAAA,(A0) asr (A0)+ asr (A0) asr -(A0) asr 2(A0) asr -6(A0,D1.w) asr $7000.w asr $8000.l move.l #$5555AAAA,(A0) lsr (A0)+ lsr (A0) lsr -(A0) lsr 2(A0) lsr -6(A0,D1.w) lsr $7000.w lsr $8000.l move.l #$5555AAAA,(A0) ror (A0)+ ror (A0) ror -(A0) ror 2(A0) ror -6(A0,D1.w) ror $7000.w ror $8000.l move.l #$5555AAAA,(A0) roxr (A0)+ roxr (A0) roxr -(A0) roxr 2(A0) roxr -6(A0,D1.w) roxr $7000.w roxr $8000.l move.l #$5555AAAA,(A0) asl (A0)+ asl (A0) asl -(A0) asl 2(A0) asl -6(A0,D1.w) asl $7000.w asl $8000.l move.l #$5555AAAA,(A0) lsl (A0)+ lsl (A0) lsl -(A0) lsl 2(A0) lsl -6(A0,D1.w) lsl $7000.w lsl $8000.l move.l #$5555AAAA,(A0) rol (A0)+ rol (A0) rol -(A0) rol 2(A0) rol -6(A0,D1.w) rol $7000.w rol $8000.l move.l #$5555AAAA,(A0) roxl (A0)+ roxl (A0) roxl -(A0) roxl 2(A0) roxl -6(A0,D1.w) roxl $7000.w roxl $8000.l rts ; DBcc tests ;----------- dbcc_test: moveq #3,d0 .loop1 dbra d0,.loop1 moveq #3,d0 .loop2 move #%0101,CCR dbhi d0,.loop2 moveq #3,d0 .loop3 move #%0000,CCR dbhi d0,.loop3 moveq #3,d0 .loop4 move #%0101,CCR dbls d0,.loop4 moveq #3,d0 .loop5 move #%0000,CCR dbls d0,.loop5 moveq #3,d0 .loop6 move #%0001,CCR dbcc d0,.loop6 moveq #3,d0 .loop7 move #%0000,CCR dbcc d0,.loop7 moveq #3,d0 .loop8 move #%0001,CCR dbcs d0,.loop8 moveq #3,d0 .loop9 move #%0000,CCR dbcs d0,.loop9 moveq #3,d0 .loop10 move #%0100,CCR dbne d0,.loop10 moveq #3,d0 .loop11 move #%0000,CCR dbne d0,.loop11 moveq #3,d0 .loop12 move #%0100,CCR dbeq d0,.loop12 moveq #3,d0 .loop13 move #%0000,CCR dbeq d0,.loop13 moveq #3,d0 .loop14 move #%0001,CCR dbvc d0,.loop14 moveq #3,d0 .loop15 move #%0000,CCR dbvc d0,.loop15 moveq #3,d0 .loop16 move #%0001,CCR dbvs d0,.loop16 moveq #3,d0 .loop17 move #%0000,CCR dbvs d0,.loop17 moveq #3,d0 .loop18 move #%1000,CCR dbpl d0,.loop18 moveq #3,d0 .loop19 move #%0000,CCR dbpl d0,.loop19 moveq #3,d0 .loop20 move #%1000,CCR dbmi d0,.loop20 moveq #3,d0 .loop21 move #%0000,CCR dbmi d0,.loop21 moveq #3,d0 .loop22 move #%1010,CCR dbge d0,.loop22 moveq #3,d0 .loop23 move #%0000,CCR dbge d0,.loop23 moveq #3,d0 .loop24 move #%1000,CCR dblt d0,.loop24 moveq #3,d0 .loop25 move #%0000,CCR dblt d0,.loop25 moveq #3,d0 .loop26 move #%1010,CCR dbgt d0,.loop26 moveq #3,d0 .loop27 move #%0000,CCR dbgt d0,.loop27 moveq #3,d0 .loop28 move #%0100,CCR dble d0,.loop28 moveq #3,d0 .loop29 move #%0000,CCR dble d0,.loop29 rts ; Bcc tests ;----------- bcc_test: move #%0000,CCR bhi .next0 rts .next0 move #%0001,CCR bls .next1 rts .next1 move #%0000,CCR bcc .next2 rts .next2 move #%0001,CCR bcs .next3 rts .next3 move #%0000,CCR bne .next4 rts .next4 move #%0100,CCR beq .next5 rts .next5 move #%0000,CCR bvc .next6 rts .next6 move #%0010,CCR bvs .next7 rts .next7 move #%0000,CCR bpl .next8 rts .next8 move #%1000,CCR bmi .next9 rts .next9 move #%1010,CCR bge .next10 rts .next10 move #%1000,CCR blt .next11 rts .next11 move #%1010,CCR bgt .next12 rts .next12 move #%0100,CCR ble .next13 rts .next13 rts ; Scc tests ;----------- scc_test: lea $8000.l,A0 moveq #1,D1 st d0 move #%0101,CCR shi (a0) move.b (a0),d0 andi #%1010,CCR ;%0000 shi (a0)+ move.b -1(a0),d0 ori #%0101,CCR ;%0101 sls -1(a0) move.b -1(a0),d0 eori #%0101,CCR ;%0000 sls -(a0) move.b (a0),d0 move #%0001,CCR scc 1(a0,d1.w) andi #%1110,CCR ;%0000 scc $8000.l ori #%0001,CCR ;%0001 scs d0 eori #%0001,CCR ;%0000 scs d0 move #%0100,CCR sne d0 move #%0000,CCR sne d0 move #%0100,CCR seq d0 move #%0000,CCR seq d0 move #%0001,CCR svc d0 move #%0000,CCR svc d0 move #%0001,CCR svs d0 move #%0000,CCR svs d0 move #%1000,CCR spl d0 move #%0000,CCR spl d0 move #%1000,CCR smi d0 move #%0000,CCR smi d0 move #%1010,CCR sge d0 move #%0000,CCR sge d0 move #%1000,CCR slt d0 move #%0000,CCR slt d0 move #%1010,CCR sgt d0 move #%0000,CCR sgt d0 move #%0100,CCR sle d0 move #%0000,CCR sle d0 rts
game/data/characters/characters-common-animations/characters-common-animations.asm
sgadrat/super-tilt-bro
91
11105
#include "game/data/characters/characters-common-animations/invisible.asm" #include "game/data/characters/characters-common-animations/out_of_screen_bubble.asm"
StackTray/browse.scpt
bufferapp/stacktray
4
1546
open location "http://%@/"
oeis/033/A033146.asm
neoneye/loda-programs
11
29979
; A033146: Decimal expansion of a(n) is given by the first n terms of the periodic sequence with initial period 1,0,0. ; 1,10,100,1001,10010,100100,1001001,10010010,100100100,1001001001,10010010010,100100100100,1001001001001,10010010010010,100100100100100,1001001001001001,10010010010010010,100100100100100100,1001001001001001001,10010010010010010010 seq $0,33138 ; a(n) = floor(2^(n+2)/7). seq $0,7088 ; The binary numbers (or binary words, or binary vectors, or binary expansion of n): numbers written in base 2.
SOAS/Syntax/Signature.agda
JoeyEremondi/agda-soas
39
5312
<gh_stars>10-100 -- Binding signatures module SOAS.Syntax.Signature (T : Set) where open import SOAS.Syntax.Arguments {T} open import SOAS.Common open import SOAS.Context open import SOAS.Variable open import SOAS.Families.Core {T} open import SOAS.Families.BCCC {T} using (⊤ₘ) open import SOAS.Coalgebraic.Strength open import SOAS.Coalgebraic.Lift open import SOAS.Coalgebraic.Map open import SOAS.Abstract.Hom open import SOAS.Abstract.ExpStrength import SOAS.Abstract.Coalgebra as →□ open →□.Sorted open →□.Unsorted renaming (Coalg to UCoalg ; Coalg⇒ to UCoalg⇒) open import Data.List.Base using ([] ; _∷_ ; List) private variable Γ Δ Θ : Ctx α τ : T -- Binding signature for a second-order syntax, consisting of a set of operators -- O and an arity assignment ∣_∣ record Signature (O : Set) : Set₁ where constructor sig field ∣_∣ : O → List (Ctx × T) × T -- Sort and arity of an operator Sort : O → T Sort o = proj₂ ∣ o ∣ Arity : O → List (Ctx × T) Arity o = proj₁ ∣ o ∣ -- Signature endofunctor ⅀F : Functor 𝔽amiliesₛ 𝔽amiliesₛ ⅀F = record { F₀ = λ 𝒳 α Γ → Σ[ o ∈ O ] (α ≡ Sort o × Arg (Arity o) 𝒳 Γ) ; F₁ = λ{ f (o , e , ar) → o , e , (F₁ o f ar)} ; identity = λ{ {x = o , e , ar} → cong (λ - → o , e , -) (identity o) } ; homomorphism = λ{ {x = o , e , ar} → cong (λ - → o , e , -) (homomorphism o) } ; F-resp-≈ = λ{ p {x = o , e , ar} → cong (λ - → o , e , -) (F-resp-≈ o p) } } where open module AF o = Functor (ArgF (Arity o)) pattern _⋮_ o ar = (o , refl , ar) infix 1 _⋮_ open import SOAS.Metatheory.Algebra {T} ⅀F public -- Coalgebraic and exponential strength for signature endofunctor private str : {𝒫 : Familyₛ}(𝒫ᴮ : Coalgₚ 𝒫)(𝒳 : Familyₛ) (as : List (Ctx × T))(σ : Γ ~[ 𝒫 ]↝ Δ) → Arg as 〖 𝒫 , 𝒳 〗 Γ → Arg as 𝒳 Δ str 𝒫ᴮ 𝒳 [] σ x = tt str 𝒫ᴮ 𝒳 ((Θ , τ) ∷ []) σ h = h (lift 𝒫ᴮ Θ σ) str 𝒫ᴮ 𝒳 ((Θ , τ) ∷ a ∷ as) σ (h , at) = h (lift 𝒫ᴮ Θ σ) , str 𝒫ᴮ 𝒳 (a ∷ as) σ at str-nat₁ : {𝒫 𝒬 𝒳 : Familyₛ} {𝒫ᴮ : Coalgₚ 𝒫} {𝒬ᴮ : Coalgₚ 𝒬} → {f : 𝒬 ⇾̣ 𝒫} (fᴮ⇒ : Coalgₚ⇒ 𝒬ᴮ 𝒫ᴮ f) → (as : List (Ctx × T)) → (h : Arg as 〖 𝒫 , 𝒳 〗 Γ) (σ : Γ ~[ 𝒬 ]↝ Δ) → str 𝒫ᴮ 𝒳 as (λ x → f (σ x)) h ≡ str 𝒬ᴮ 𝒳 as σ (Arg₁ as (λ{ h′ ς → h′ (λ v → f (ς v))}) h) str-nat₁ fᴮ⇒ [] h σ = refl str-nat₁ {𝒳 = 𝒳} fᴮ⇒ ((Θ , τ) ∷ []) h σ = lift-comp 𝒳 Θ fᴮ⇒ h σ str-nat₁ {𝒳 = 𝒳} fᴮ⇒ ((Θ , τ) ∷ a ∷ as) (h , ap) σ = cong₂ _,_ (lift-comp 𝒳 Θ fᴮ⇒ h σ) (str-nat₁ fᴮ⇒ (a ∷ as) ap σ) str-nat₂ : {𝒫 𝒳 𝒴 : Familyₛ} {𝒫ᴮ : Coalgₚ 𝒫} → (f : 𝒳 ⇾̣ 𝒴) → (as : List (Ctx × T)) → (h : Arg as 〖 𝒫 , 𝒳 〗 Γ) (σ : Γ ~[ 𝒫 ]↝ Δ) → str 𝒫ᴮ 𝒴 as σ (Arg₁ as (λ{ h′ ς → f (h′ ς)}) h) ≡ Arg₁ as f (str 𝒫ᴮ 𝒳 as σ h) str-nat₂ f [] h σ = refl str-nat₂ f ((Θ , τ) ∷ []) h σ = refl str-nat₂ f ((Θ , τ) ∷ a ∷ as) (h , ap) σ = cong (_ ,_) (str-nat₂ f (a ∷ as) ap σ) str-unit : (𝒳 : Familyₛ) → (as : List (Ctx × T)) → (h : Arg as 〖 ℐ , 𝒳 〗 Γ) → str ℐᴮ 𝒳 as id h ≡ Arg₁ as (λ b → b id) h str-unit 𝒳 [] h = refl str-unit 𝒳 ((Θ , τ) ∷ []) h = rlift-id 𝒳 Θ h str-unit 𝒳 ((Θ , τ) ∷ a ∷ as) (h , ap) = cong₂ _,_ (rlift-id 𝒳 Θ h) (str-unit 𝒳 (a ∷ as) ap) str-assoc : (𝒳 : Familyₛ) {𝒫 𝒬 ℛ : Familyₛ} {𝒫ᴮ : Coalgₚ 𝒫} {𝒬ᴮ : Coalgₚ 𝒬} {ℛᴮ : Coalgₚ ℛ} → {f : 𝒫 ⇾̣ 〖 𝒬 , ℛ 〗} (fᶜ : Coalgebraic 𝒫ᴮ 𝒬ᴮ ℛᴮ f) → (open Coalgebraic fᶜ) → (as : List (Ctx × T)) → (h : Arg as 〖 ℛ , 𝒳 〗 Γ) (σ : Γ ~[ 𝒫 ]↝ Δ) (ς : Δ ~[ 𝒬 ]↝ Θ) → str ℛᴮ 𝒳 as (λ v → f (σ v) ς) h ≡ str 𝒬ᴮ 𝒳 as ς (str 〖𝒫,𝒴〗ᴮ 〖 𝒬 , 𝒳 〗 as (f ∘ σ) (Arg₁ as (λ{ h ς σ → h (λ v → ς v σ)}) h)) str-assoc 𝒳 fᶜ [] h σ ς = refl str-assoc 𝒳 fᶜ ((Ξ , τ) ∷ []) h σ ς = lift-assoc 𝒳 Ξ fᶜ h σ ς str-assoc 𝒳 fᶜ ((Ξ , τ) ∷ a ∷ as) (h , ap) σ ς = cong₂ _,_ (lift-assoc 𝒳 Ξ fᶜ h σ ς) (str-assoc 𝒳 fᶜ (a ∷ as) ap σ ς) estr : {X : Family}(Xᵇ : UCoalg X)(𝒴 : Familyₛ) (as : List (Ctx × T)) → Arg as (X ⇨ 𝒴) Γ → (x : X Γ) → Arg as 𝒴 Γ estr Xᵇ 𝒴 [] at x = tt estr Xᵇ 𝒴 ((Θ , τ) ∷ []) e x = e (UCoalg.wkr Xᵇ Θ x) estr Xᵇ 𝒴 ((Θ , τ) ∷ a ∷ as) (e , at) x = (e (UCoalg.wkr Xᵇ Θ x)) , estr Xᵇ 𝒴 (a ∷ as) at x estr-nat₁ : {X X′ : Family} {Xᵇ : UCoalg X} {X′ᵇ : UCoalg X′} {𝒴 : Familyₛ} {f : X′ ⇾ X} → UCoalg⇒ X′ᵇ Xᵇ f → (as : List (Ctx × T)) (h : Arg as (X ⇨ 𝒴) Γ)(x : X′ Γ) → estr Xᵇ 𝒴 as h (f x) ≡ estr X′ᵇ 𝒴 as (Arg₁ as (λ e x₁ → e (f x₁)) h) x estr-nat₁ fᵇ⇒ [] h x = refl estr-nat₁ fᵇ⇒ ((Θ , τ) ∷ []) h x = cong h (sym (UCoalg⇒.⟨r⟩ fᵇ⇒)) estr-nat₁ fᵇ⇒ ((Θ , τ) ∷ a ∷ as) (h , at) x = cong₂ _,_ (cong h (sym (UCoalg⇒.⟨r⟩ fᵇ⇒))) (estr-nat₁ fᵇ⇒ (a ∷ as) at x) estr-nat₂ : {X : Family} {Xᵇ : UCoalg X} {𝒴 𝒴′ : Familyₛ} (g : 𝒴 ⇾̣ 𝒴′) (as : List (Ctx × T))(at : Arg as (X ⇨ 𝒴) Γ) (x : X Γ) → estr Xᵇ 𝒴′ as (Arg₁ as (λ e x → g (e x)) at) x ≡ Arg₁ as g (estr Xᵇ 𝒴 as at x) estr-nat₂ g [] at x = refl estr-nat₂ g ((Θ , τ) ∷ []) h x = refl estr-nat₂ g ((Θ , τ) ∷ a ∷ as) (h , at) x = cong (_ ,_) (estr-nat₂ g (a ∷ as) at x) estr-unit : {𝒴 : Familyₛ} (as : List (Ctx × T)) {at : Arg as (⊤ₘ ⇨ 𝒴) Γ} → estr ⊤ᵇ 𝒴 as at tt ≡ Arg₁ as (λ e′ → e′ tt) at estr-unit [] = refl estr-unit ((Θ , τ) ∷ []) = refl estr-unit ((Θ , τ) ∷ a ∷ as) = cong (_ ,_) (estr-unit (a ∷ as)) -- Compatible strengths for the signature endofunctor ⅀:CompatStr : CompatStrengths ⅀F ⅀:CompatStr = record { CoalgStr = record { str = λ{ 𝒫ᴮ 𝒳 (o , e , ap) σ → o , (e , str 𝒫ᴮ 𝒳 (Arity o) σ ap) } ; str-nat₁ = λ{ fᴮ⇒ (o , e , ap) σ → cong (λ - → o , e , -) (str-nat₁ fᴮ⇒ (Arity o) ap σ)} ; str-nat₂ = λ{ f (o , e , ap) σ → cong (λ - → o , e , -) (str-nat₂ f (Arity o) ap σ)} ; str-unit = λ{ 𝒳 (o , e , ap) → cong (λ - → o , e , -) (str-unit 𝒳 (Arity o) ap)} ; str-assoc = λ{ 𝒳 fᶜ (o , e , ap) σ ς → cong (λ - → o , e , -) (str-assoc 𝒳 fᶜ (Arity o) ap σ ς)} } ; ExpStr = record { estr = λ{ Xᵇ 𝒴 (o , refl , at) x → o , refl , estr Xᵇ 𝒴 (Arity o) at x } ; estr-nat₁ = λ{ fᵇ⇒ (o , refl , at) x → cong (λ - → o , refl , -) (estr-nat₁ fᵇ⇒ (Arity o) at x)} ; estr-nat₂ = λ{ g (o , refl , at) x → cong (λ - → o , refl , -) (estr-nat₂ g (Arity o) at x) } ; estr-unit = λ{ {e = (o , refl , at)} → cong (λ - → o , refl , -) (estr-unit (Arity o)) } } }
src/memcpy.asm
JamsKs/LIBC-ASM-Functions
0
95803
global memcpy section .text memcpy: xor rcx, rcx loop: cmp rdx, rcx jle dec mov r8b, byte [rsi + rcx] mov [rdi], r8b inc rdi inc rcx jmp loop dec: cmp rcx, 0 je return dec rdi dec rcx jmp dec return: mov rax, rdi ret
oeis/348/A348149.asm
neoneye/loda-programs
11
170626
<gh_stars>10-100 ; A348149: Variation of the Barnyard sequence A347581: a(n) is the minimum number of unit length line segments required to enclose areas of 1 through n on a square grid when the number of segments is minimized as each area of incrementing size, starting at 1, is added. ; Submitted by <NAME>(s2) ; 4,9,14,20,26,33,40,48,55,64 mov $1,$0 mov $0,3 add $1,1 mul $0,$1 add $1,20 mul $0,$1 div $0,14
programs/oeis/168/A168282.asm
neoneye/loda
22
29080
; A168282: (10*n + 5*(-1)^n - 1)/4. ; 1,6,6,11,11,16,16,21,21,26,26,31,31,36,36,41,41,46,46,51,51,56,56,61,61,66,66,71,71,76,76,81,81,86,86,91,91,96,96,101,101,106,106,111,111,116,116,121,121,126,126,131,131,136,136,141,141,146,146,151,151,156,156,161,161,166,166,171,171,176,176,181,181,186,186,191,191,196,196,201,201,206,206,211,211,216,216,221,221,226,226,231,231,236,236,241,241,246,246,251 mov $1,1 add $1,$0 div $1,2 mul $1,5 add $1,1 mov $0,$1
benchmark/benchmark_graph_2.adb
skill-lang/skillAdaTestSuite
1
6742
<reponame>skill-lang/skillAdaTestSuite with Ada.Numerics.Discrete_Random; with Ada.Text_IO; with Ada.Unchecked_Deallocation; with Hashing; with Graph_2.Api; package body Benchmark_Graph_2 is package Skill renames Graph_2.Api; use Graph_2; use Skill; type State_Type is access Skill_State; State : State_Type; String_Black : String_Access; String_Red : String_Access; procedure Create (N : Integer; File_Name : String) is function Hash is new Hashing.Discrete_Hash (Integer); type Objects_Type is array (0 .. N-1) of Node_Type_Access; type Objects_Type_Access is access Objects_Type; Objects : Objects_Type_Access := new Objects_Type; procedure Free is new Ada.Unchecked_Deallocation (Objects_Type, Objects_Type_Access); begin String_Black := new String'("black"); String_Red := new String'("red"); State := new Skill_State; Skill.Create (State); for I in 0 .. N-1 loop declare Name : String_Access := String_Black; Edges : Node_Edges_Set.Set; begin if 0 = I mod 2 then Name := String_Red; end if; Objects (I) := New_Node (State, Name, Edges); end; end loop; for I in 0 .. N-1 loop declare X : Node_Type_Access := Objects (I); Edges : Node_Edges_Set.Set := X.Get_Edges; J : Integer := 0; begin while (50 >= N and then N > Integer (Edges.Length)) or else (50 < N and then 50 > Integer (Edges.Length)) loop J := J + 1; declare A : Integer := Integer (Hash (N + I + J, 13371)) mod N; begin -- Ada.Text_IO.Put_Line (A'Img); -- Ada.Text_IO.Put_Line (Node_Edges_Set.Has_Element (Edges.Find (Objects (A)))'Img); --Edges.Insert (Objects (A)); if not Edges.Contains (Objects (A)) then Edges.Insert (Objects (A)); -- Ada.Text_IO.Put_Line (A'Img); end if; end; end loop; -- Ada.Text_IO.Put_Line ("l: " & Edges.Length'Img); X.Set_Edges (Edges); end; end loop; Free (Objects); end Create; procedure Write (N : Integer; File_Name : String) is begin Skill.Write (State, File_Name); end Write; procedure Read (N : Integer; File_Name : String) is begin State := new Skill_State; Skill.Read (State, File_Name); end Read; procedure Create_More (N : Integer; File_Name : String) is function Hash is new Hashing.Discrete_Hash (Integer); type Objects_Type is array (0 .. N-1) of Node_Type_Access; type Objects_Type_Access is access Objects_Type; Objects : Objects_Type_Access := new Objects_Type; procedure Free is new Ada.Unchecked_Deallocation (Objects_Type, Objects_Type_Access); begin String_Black := new String'("black"); String_Red := new String'("red"); for I in 0 .. N-1 loop declare Name : String_Access := String_Black; Edges : Node_Edges_Set.Set; begin if 0 = I mod 2 then Name := String_Red; end if; Objects (I) := New_Node (State, Name, Edges); end; end loop; for I in 0 .. N-1 loop declare X : Node_Type_Access := Objects (I); Edges : Node_Edges_Set.Set := X.Get_Edges; J : Integer := 0; begin while (50 >= N and then N > Integer (Edges.Length)) or else (50 < N and then 50 > Integer (Edges.Length)) loop J := J + 1; declare A : Integer := Integer (Hash (N + I + J, 13372)) mod N; begin -- Ada.Text_IO.Put_Line (A'Img); if not Edges.Contains (Objects (A)) then Edges.Insert (Objects (A)); end if; end; end loop; X.Set_Edges (Edges); end; end loop; Free (Objects); end Create_More; procedure Append (N : Integer; File_Name : String) is begin Skill.Append (State); end Append; procedure Reset (N : Integer; File_Name : String) is procedure Free is new Ada.Unchecked_Deallocation (Skill_State, State_Type); procedure Free is new Ada.Unchecked_Deallocation (String, String_Access); begin Skill.Close (State); Free (String_Black); Free (String_Red); Free (State); end Reset; end Benchmark_Graph_2;
libsrc/_DEVELOPMENT/string/c/sccz80/strrcspn_callee.asm
Frodevan/z88dk
640
17658
<filename>libsrc/_DEVELOPMENT/string/c/sccz80/strrcspn_callee.asm ; size_t strrcspn(const char *str, const char *cset) SECTION code_clib SECTION code_string PUBLIC strrcspn_callee EXTERN asm_strrcspn strrcspn_callee: IF __CPU_GBZ80__ pop bc pop de pop hl push bc call asm_strrcspn ld d,h ld e,l ret ELSE pop hl pop de ex (sp),hl jp asm_strrcspn ENDIF ; SDCC bridge for Classic IF __CLASSIC PUBLIC _strrcspn_callee defc _strrcspn_callee = strrcspn_callee ENDIF
Inductive/Examples/List.agda
mr-ohman/general-induction
0
8411
module Inductive.Examples.List where open import Inductive open import Tuple hiding (_++_) open import Data.Fin open import Data.Product hiding (map) open import Data.List hiding (List; map; foldr; _++_) open import Data.Vec hiding (map; foldr; _++_) List : Set → Set List A = Inductive (([] , []) ∷ (((A ∷ []) , ([] ∷ [])) ∷ [])) nil : {A : Set} → List A nil = construct zero [] [] cons : {A : Set} → A → List A → List A cons x xs = construct (suc zero) (x ∷ []) ((λ _ → xs) ∷ []) map : {A B : Set} → (A → B) → List A → List B map f = rec (nil ∷ ((λ a as ras → cons (f a) ras) ∷ [])) foldr : {A B : Set} → (A → B → B) → B → List A → B foldr f b = rec (b ∷ (λ a as ras → f a ras) ∷ []) _++_ : {A : Set} → List A → List A → List A xs ++ ys = rec (ys ∷ (λ a as ras → cons a ras) ∷ []) xs
src/Generics/Desc.agda
flupe/generics
11
16248
<reponame>flupe/generics<gh_stars>10-100 {-# OPTIONS --safe --without-K #-} module Generics.Desc where open import Data.String using (String) open import Generics.Prelude hiding (lookup) open import Generics.Telescope private variable P : Telescope ⊤ V I : ExTele P p : ⟦ P ⟧tel tt ℓ : Level n : ℕ data ConDesc (P : Telescope ⊤) (V I : ExTele P) : Setω where var : (((p , v) : ⟦ P , V ⟧xtel) → ⟦ I ⟧tel p) → ConDesc P V I π : (ai : String × ArgInfo) (S : ⟦ P , V ⟧xtel → Set ℓ) (C : ConDesc P (V ⊢< ai > S) I) → ConDesc P V I _⊗_ : (A B : ConDesc P V I) → ConDesc P V I data DataDesc P (I : ExTele P) : ℕ → Setω where [] : DataDesc P I 0 _∷_ : ∀ {n} (C : ConDesc P ε I) (D : DataDesc P I n) → DataDesc P I (suc n) lookupCon : DataDesc P I n → Fin n → ConDesc P ε I lookupCon (C ∷ D) (zero ) = C lookupCon (C ∷ D) (suc k) = lookupCon D k levelIndArg : ConDesc P V I → Level → Level levelIndArg (var _) c = c levelIndArg (π {ℓ} _ _ C) c = ℓ ⊔ levelIndArg C c levelIndArg (A ⊗ B) c = levelIndArg A c ⊔ levelIndArg B c ⟦_⟧IndArg : (C : ConDesc P V I) → (⟦ P , I ⟧xtel → Set ℓ) → (⟦ P , V ⟧xtel → Set (levelIndArg C ℓ)) ⟦ var f ⟧IndArg X (p , v) = X (p , f (p , v)) ⟦ π ai S C ⟧IndArg X (p , v) = Π< ai > (S (p , v)) (λ s → ⟦ C ⟧IndArg X (p , v , s)) ⟦ A ⊗ B ⟧IndArg X pv = ⟦ A ⟧IndArg X pv × ⟦ B ⟧IndArg X pv levelCon : ConDesc P V I → Level → Level levelCon {I = I} (var _) c = levelOfTel I levelCon (π {ℓ} _ _ C) c = ℓ ⊔ levelCon C c levelCon (A ⊗ B) c = levelIndArg A c ⊔ levelCon B c ⟦_⟧Con : (C : ConDesc P V I) → (⟦ P , I ⟧xtel → Set ℓ) → (⟦ P , V & I ⟧xtel → Set (levelCon C ℓ)) ⟦ var f ⟧Con X (p , v , i) = i ≡ f (p , v) ⟦ π (n , ai) S C ⟧Con X (p , v , i) = Σ[ s ∈ < relevance ai > S (p , v) ] ⟦ C ⟧Con X (p , ((v , s) , i)) ⟦ A ⊗ B ⟧Con X pvi@(p , v , i) = ⟦ A ⟧IndArg X (p , v) × ⟦ B ⟧Con X pvi record Σℓω {a} (A : Set a) {ℓB : A → Level} (B : ∀ x → Set (ℓB x)) : Setω where constructor _,_ field proj₁ : A proj₂ : B proj₁ ⟦_⟧Data : DataDesc P I n → (⟦ P , I ⟧xtel → Set ℓ) → ⟦ P , I ⟧xtel → Setω ⟦_⟧Data {n = n} D X (p , i) = Σℓω (Fin n) (λ k → ⟦ lookupCon D k ⟧Con X (p , tt , i))
src/Categories/Category/Instance/Groupoids.agda
Trebor-Huang/agda-categories
279
8376
{-# OPTIONS --without-K --safe #-} module Categories.Category.Instance.Groupoids where -- The category of groupoids. -- -- This category should maybe be called "Ho(Groupoids)" or "Ho(Gpd)" -- instead. The "homsets" are not the "usual" ones consisting of -- functors, but consist instead of equivalence classes of functors up -- to natural isomorphism. This is because homsets here are really -- hom-setoids and we pick natural isomorphism as the equivalence -- relation for these setoids. -- -- See https://ncatlab.org/nlab/show/Ho%28Cat%29 open import Level open import Categories.Category open import Categories.Category.Groupoid open import Categories.Functor as Fctr using (Functor; _∘F_) open import Categories.Functor.Properties using ([_]-resp-Iso) import Categories.Morphism.IsoEquiv as IsoEquiv open import Categories.NaturalTransformation.NaturalIsomorphism using (NaturalIsomorphism; associator; unitorˡ; unitorʳ; unitor²; isEquivalence; _ⓘₕ_; sym) private variable o ℓ e : Level open Groupoid using (category) -- The category of groupoids. Groupoids : ∀ o ℓ e → Category (suc (o ⊔ ℓ ⊔ e)) (o ⊔ ℓ ⊔ e) (o ⊔ ℓ ⊔ e) Groupoids o ℓ e = record { Obj = Groupoid o ℓ e ; _⇒_ = λ G H → Functor (category G) (category H) ; _≈_ = NaturalIsomorphism ; id = Fctr.id ; _∘_ = _∘F_ ; assoc = λ {_ _ _ _ F G H} → associator F G H ; sym-assoc = λ {_ _ _ _ F G H} → sym (associator F G H) ; identityˡ = unitorˡ ; identityʳ = unitorʳ ; identity² = unitor² ; equiv = isEquivalence ; ∘-resp-≈ = _ⓘₕ_ } module _ {o ℓ e o′ ℓ′ e′} {G : Groupoid o ℓ e} {H : Groupoid o′ ℓ′ e′} (F : Functor (category G) (category H)) where private module G = Groupoid G module H = Groupoid H open Functor F open IsoEquiv (category H) using (to-unique) -- Functors preserve inverses F-resp-⁻¹ : ∀ {A B} (f : A G.⇒ B) → F₁ (f G.⁻¹) H.≈ (F₁ f) H.⁻¹ F-resp-⁻¹ f = to-unique ([ F ]-resp-Iso G.iso) H.iso H.Equiv.refl
models/tests/test18.als
transclosure/Amalgam
4
1782
<reponame>transclosure/Amalgam module tests/test // Bugpost by <NAME> (Jan.van.Eijck AT cwi.nl) sig Object { b: set Object } one sig Root, A, B, C, D extends Object {} fact OneRoot { all x: Object | x = Root <=> no b.x } fact SingleParent { all x,y,z: Object | z in x.b and z in y.b => x=y } fact b_acyclic { no ^b & iden } fact { C in B.b and D in C.b } pred show () {} run show for 5 expect 1
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_gstxml_h.ads
persan/A-gst
1
16761
<filename>src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_gstxml_h.ads pragma Ada_2005; pragma Style_Checks (Off); pragma Warnings (Off); with Interfaces.C; use Interfaces.C; with glib; with glib.Values; with System; with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h; -- limited with GStreamer.GST_Low_Level.glib_2_0_glib_glist_h; -- with GStreamer.GST_Low_Level.libxml2_libxml_tree_h; with glib; limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h; with Interfaces.C_Streams; package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstxml_h is -- unsupported macro: GST_TYPE_XML (gst_xml_get_type ()) -- arg-macro: function GST_XML (obj) -- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_XML, GstXML); -- arg-macro: function GST_IS_XML (obj) -- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_XML); -- arg-macro: function GST_XML_CLASS (klass) -- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_XML, GstXMLClass); -- arg-macro: function GST_IS_XML_CLASS (klass) -- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_XML); -- arg-macro: function GST_XML_GET_CLASS (obj) -- return G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_XML, GstXMLClass); -- GStreamer -- * Copyright (C) 1999,2000 <NAME> <<EMAIL>> -- * 2000 <NAME> <<EMAIL>> -- * -- * gstxml.h: Header for XML save/restore operations of pipelines -- * -- * This library is free software; you can redistribute it and/or -- * modify it under the terms of the GNU Library General Public -- * License as published by the Free Software Foundation; either -- * version 2 of the License, or (at your option) any later version. -- * -- * 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 -- * Library General Public License for more details. -- * -- * You should have received a copy of the GNU Library 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. -- type GstXML; type u_GstXML_u_gst_reserved_array is array (0 .. 3) of System.Address; --subtype GstXML is u_GstXML; -- gst/gstxml.h:42 type GstXMLClass; type u_GstXMLClass_u_gst_reserved_array is array (0 .. 3) of System.Address; --subtype GstXMLClass is u_GstXMLClass; -- gst/gstxml.h:43 --* -- * GstXML: -- * @topelements: list of element nodes -- * @ns: name space -- * -- * XML parser object -- type GstXML is record object : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; -- gst/gstxml.h:53 topelements : access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/gstxml.h:56 ns : GStreamer.GST_Low_Level.libxml2_libxml_tree_h.xmlNsPtr; -- gst/gstxml.h:58 u_gst_reserved : u_GstXML_u_gst_reserved_array; -- gst/gstxml.h:61 end record; pragma Convention (C_Pass_By_Copy, GstXML); -- gst/gstxml.h:52 --< public > --< private > type GstXMLClass is record parent_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObjectClass; -- gst/gstxml.h:65 object_loaded : access procedure (arg1 : access GstXML; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; arg3 : GStreamer.GST_Low_Level.libxml2_libxml_tree_h.xmlNodePtr); -- gst/gstxml.h:68 object_saved : access procedure (arg1 : access GstXML; arg2 : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; arg3 : GStreamer.GST_Low_Level.libxml2_libxml_tree_h.xmlNodePtr); -- gst/gstxml.h:69 u_gst_reserved : u_GstXMLClass_u_gst_reserved_array; -- gst/gstxml.h:71 end record; pragma Convention (C_Pass_By_Copy, GstXMLClass); -- gst/gstxml.h:64 -- signal callbacks function gst_xml_get_type return GLIB.GType; -- gst/gstxml.h:74 pragma Import (C, gst_xml_get_type, "gst_xml_get_type"); -- create an XML document out of a pipeline function gst_xml_write (element : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement) return GStreamer.GST_Low_Level.libxml2_libxml_tree_h.xmlDocPtr; -- gst/gstxml.h:78 pragma Import (C, gst_xml_write, "gst_xml_write"); -- write a formatted representation of a pipeline to an open file function gst_xml_write_file (element : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; c_out : Interfaces.C_Streams.FILEs) return GLIB.gint; -- gst/gstxml.h:81 pragma Import (C, gst_xml_write_file, "gst_xml_write_file"); function gst_xml_new return access GstXML; -- gst/gstxml.h:83 pragma Import (C, gst_xml_new, "gst_xml_new"); function gst_xml_parse_doc (xml : access GstXML; doc : GStreamer.GST_Low_Level.libxml2_libxml_tree_h.xmlDocPtr; root : access GLIB.guchar) return GLIB.gboolean; -- gst/gstxml.h:85 pragma Import (C, gst_xml_parse_doc, "gst_xml_parse_doc"); function gst_xml_parse_file (xml : access GstXML; fname : access GLIB.guchar; root : access GLIB.guchar) return GLIB.gboolean; -- gst/gstxml.h:86 pragma Import (C, gst_xml_parse_file, "gst_xml_parse_file"); function gst_xml_parse_memory (xml : access GstXML; buffer : access GLIB.guchar; size : GLIB.guint; root : access GLIB.gchar) return GLIB.gboolean; -- gst/gstxml.h:87 pragma Import (C, gst_xml_parse_memory, "gst_xml_parse_memory"); function gst_xml_get_element (xml : access GstXML; name : access GLIB.guchar) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; -- gst/gstxml.h:90 pragma Import (C, gst_xml_get_element, "gst_xml_get_element"); function gst_xml_get_topelements (xml : access GstXML) return access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/gstxml.h:91 pragma Import (C, gst_xml_get_topelements, "gst_xml_get_topelements"); function gst_xml_make_element (cur : GStreamer.GST_Low_Level.libxml2_libxml_tree_h.xmlNodePtr; parent : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement; -- gst/gstxml.h:93 pragma Import (C, gst_xml_make_element, "gst_xml_make_element"); end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstxml_h;
Src/mini_expect.adb
SMerrony/dashera
23
1662
-- Copyright ©2022 <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. with Ada.Strings; use Ada.Strings; with Ada.Strings.Fixed; use Ada.Strings.Fixed; with Dasher_Codes; use Dasher_Codes; with Logging; use Logging; with Redirector; package body Mini_Expect is -- protected body Runner is procedure Prepare (Filename : in String) is begin if Expecting then raise Already_Expecting with "Cannot run mini-Expect script while another is still active"; end if; Open (File => Expect_File, Mode => In_File, Name => Filename); Log (TRACE, "mini-Expect script opened: " & Filename); Runner_Task := new Runner_T; end Prepare; function Convert_Line (Script_Line : in String) return String is -- Remove leading and trailing double-quotes, convert \n to Dasher NL Src_Start : constant Positive := Index (Script_Line, """", Forward) + 1; Src_End : constant Positive := Index (Script_Line, """", Backward); Result : String (1 .. Src_End-Src_Start); In_Ix : Positive := Src_Start; Out_Ix : Positive := 1; Changed : Boolean := False; begin Log (TRACE, "Convert_Line called with: " & Script_Line); Log (TRACE, "... Src_Start set to" & Src_Start'Image & ", Src_End set to" & Src_End'Image); Log (TRACE, "... Max result length set to" & Result'Length'Image); while In_Ix < Src_End loop Changed := False; if In_Ix < Src_End then if Script_Line(In_Ix) = '\' then if Script_Line(In_Ix + 1) = 'n' then Result(Out_Ix) := Dasher_NL; In_Ix := In_Ix + 2; -- skip over a character Out_Ix := Out_Ix + 1; Changed := True; end if; end if; end if; if not Changed then Result(Out_Ix) := Script_Line(In_Ix); In_Ix := In_Ix + 1; Out_Ix := Out_Ix + 1; end if; end loop; Log (TRACE, "Convert_Line returning: " & Result(1 .. Out_Ix-1)); return Result(1 .. Out_Ix-1); end Convert_Line; procedure Handle_Char (Ch : in Character; Done : out Boolean) is begin if Ch = Dasher_NL or Ch = Dasher_CR then -- Reset the search on every new line Host_Str := Null_Unbounded_String; else Host_Str := Host_Str & Ch; Log (TRACE, "... so far we have: " & To_String (Host_Str)); if Length (Host_Str) >= Length (Search_Str) then Log (TRACE, "... Handle_Char comparing '" & To_String (Tail(Host_Str, Length (Search_Str))) & "' with '" & To_String (Search_Str)); if Tail(Host_Str, Length (Search_Str)) = Search_Str then Expecting := False; Log (TRACE, "... MATCHED!"); end if; end if; end if; Done := not Expecting; end Handle_Char; task body Runner_T is Expect_Line : String(1..132); Expect_Line_Length : Natural; begin Expecting := False; while not End_Of_File (Expect_File) loop Get_Line (Expect_File, Expect_Line, Expect_Line_Length); Log (TRACE, "Expect script line: " & Expect_Line (1 .. Expect_Line_Length)); if Expect_Line_Length = 0 then -- empty line Log (TRACE, "... Skipping empty line"); elsif Expect_Line(1) = '#' then -- comment line Log (TRACE, "... Skipping comment line"); elsif Expect_Line(1..6) = "expect" then -- expect string from host command, no timeout Expecting := True; Log (TRACE, "... Processing 'expect' command"); -- delay 0.2; Search_Str := To_Unbounded_String (Convert_Line (Expect_Line(8..Expect_Line_Length))); Log (TRACE, "... the search sting is '" & To_String (Search_Str) & "'"); Host_Str := Null_Unbounded_String; while Expecting loop Log (TRACE, "Mini_Expect waiting for match"); delay 0.1; end loop; Log (TRACE, "... found Expect string: " & To_String (Search_Str)); delay 0.2; elsif Expect_Line(1..4) = "send" then -- send line to host command Log (TRACE, "... Processing 'send' command"); declare Converted : constant String := Convert_Line (Expect_Line(6..Expect_Line_Length)); begin Redirector.Router.Send_Data (Converted); end; elsif Expect_Line(1..4) = "exit" then -- exit script command exit; else Log (WARNING, "Cannot parse mini-Expect command - aborting script"); exit; end if; end loop; Close (Expect_File); Log (TRACE, "Mini-Expect script ***completed***"); end Runner_T; end Mini_Expect;
dot_matrix.asm
nasim-aust/operating-system-lab
0
94564
<gh_stars>0 MOV AL,80H OUT 1EH,AL MOV AL,0FFH OUT 1AH, AL RESTART: MOV BL,0FEH MOV DL,01H MOV CX,08H LOOP1: MOV AL,BL OUT 18H,AL MOV AL,DL OUT 1CH,AL CALL DELAY SHL BL,01H SHL DL,01H OR DL,01H LOOP LOOP1 MOV BL,80H MOV DL,07FH MOV CX,08H LOOP2: MOV AL,BL OUT 18H,AL MOV AL,DL OUT 1CH,AL CALL DELAY SHR DL,01H SHR BL,01H OR BL,80H LOOP LOOP2 JMP RESTART DELAY: PUSH CX MOV CX,0FF00H LOOP3: NOP LOOP LOOP3 POP CX RET
src/Gaip.Net.Core/Grammar/Filter.g4
CK-Yong/gaip-net
1
7377
grammar Filter; /** Filter, possibly empty **/ filter : expression* EOF ; /** Expressions may either be a conjunction (AND) of sequences or a simple sequence. Note, the AND is case-sensitive. Example: `a b AND c AND d` The expression `(a b) AND c AND d` is equivalent to the example. **/ expression : sequence (AND sequence)* ; /** Sequence is composed of one or more whitespace (WS) separated factors. A sequence expresses a logical relationship between 'factors' where the ranking of a filter result may be scored according to the number factors that match and other such criteria as the proximity of factors to each other within a document. When filters are used with exact match semantics rather than fuzzy match semantics, a sequence is equivalent to AND. Example: `New York Giants OR Yankees` The expression `New York (Giants OR Yankees)` is equivalent to the example. **/ sequence : factor (factor)* ; /** Factors may either be a disjunction (OR) of terms or a simple term. Note, the OR is case-sensitive. Example: `a < 10 OR a >= 100` **/ factor : term (OR term)* ; /** Terms may either be unary or simple expressions. Unary expressions negate the simple expression, either mathematically `-` or logically `NOT`. The negation styles may be used interchangeably. Note, the `NOT` is case-sensitive and must be followed by at least one whitespace (WS). Examples: * logical not : `NOT (a OR b)` * alternative not : `-file:".java"` * negation : `-30` **/ term : (NOT | MINUS)? simple ; /** Simple expressions may either be a restriction or a nested (composite) expression. **/ simple : restriction | composite ; /** Restrictions express a relationship between a comparable value and a single argument. When the restriction only specifies a comparable without an operator, this is a global restriction. Note, restrictions are not whitespace sensitive. Examples: * equality : `package=com.google` * inequality : `msg != 'hello'` * greater than : `1 > 0` * greater or equal : `2.5 >= 2.4` * less than : `yesterday < request.time` * less or equal : `experiment.rollout <= cohort(request.user)` * has : `map:key` * global : `prod` In addition to the global, equality, and ordering operators, filters also support the has (`:`) operator. The has operator is unique in that it can test for presence or value based on the proto3 type of the `comparable` value. The has operator is useful for validating the structure and contents of complex values. **/ restriction : comparable (comparator arg)? ; /** Comparable may either be a member or function. **/ comparable : illegal // Added for extra error checking | function | member ; /** Matches things like foo.0.bar and foo[0].bar. See also https://google.aip.dev/160#has-operator **/ illegal : value (LBRACKET (field) RBRACKET)+ (DOT field)* | value (DOT INTEGER)+ (DOT field)* ; /** Member expressions are either value or DOT qualified field references. Example: `expr.type_map.1.type` **/ member : value (DOT field)* ; /** Function calls may use simple or qualified names with zero or more arguments. All functions declared within the list filter, apart from the special `arguments` function must be provided by the host service. Examples: * `regex(m.key, '^.*prod.*$')` * `math.mem('30mb')` Antipattern: simple and qualified function names may include keywords: NOT, AND, OR. It is not recommended that any of these names be used within functions exposed by a service that supports list filters. **/ function : name (DOT name)* LPAREN argList? RPAREN ; /** Comparators supported by list filters. **/ comparator : LESS_EQUALS // <= | LESS_THAN // < | GREATER_EQUALS // >= | GREATER_THAN // > | NOT_EQUALS // != | EQUALS // = | HAS // : ; /** Composite is a parenthesized expression, commonly used to group terms or clarify operator precedence. Example: `(msg.endsWith('world') AND retries < 10)` **/ composite : LPAREN expression RPAREN ; /** Value may either be a TEXT or STRING. TEXT is a free-form set of characters without whitespace (WS) or . (DOT) within it. The text may represent a variable, string, number, boolean, or alternative literal value and must be handled in a manner consistent with the service's intention. STRING is a quoted string which may or may not contain a special wildcard `*` character at the beginning or end of the string to indicate a prefix or suffix-based search within a restriction. **/ value // Higher priority custom values for easier type conversion. : INTEGER | FLOAT | BOOLEAN | ASTERISK | DURATION | DATETIME // Standard values. | STRING | TEXT ; /** Fields may be either a value or a keyword. **/ field : value | keyword ; /** Names may either be TEXT or a keyword. **/ name : TEXT | keyword ; argList : arg (',' arg)* ; arg : comparable | composite ; keyword : NOT | AND | OR ; /** Lexer Rules **/ WS : (' ' | '\t') -> skip; AND: 'AND'; OR: 'OR'; NOT: 'NOT'; MINUS: '-'; DOT: '.'; LESS_EQUALS: '<='; LESS_THAN: '<'; GREATER_EQUALS: '>='; GREATER_THAN: '>'; NOT_EQUALS: '!='; EQUALS: '='; HAS: ':'; LPAREN: '('; RPAREN: ')'; ASTERISK: '*'; COMMA: ','; fragment DIGIT: '0'..'9'; INTEGER: DIGIT+; FLOAT: DIGIT+ ('.' DIGIT+)?; BOOLEAN: ('true' | 'false'); DURATION: DIGIT+ ('.' DIGIT+)? 's'; LBRACKET: '['; RBRACKET: ']'; fragment T: ('T'|'t'); fragment Z: ('Z'|'z'); fragment PLUSMINUS: ('+'|'-'); DATETIME: QUOTE? DIGIT DIGIT DIGIT DIGIT '-' DIGIT DIGIT '-' DIGIT DIGIT T DIGIT DIGIT ':' DIGIT DIGIT ':' DIGIT DIGIT ('.' DIGIT+)? (Z | PLUSMINUS DIGIT DIGIT ':' DIGIT DIGIT)? QUOTE?; QUOTE: ('\'' | '"'); STRING: QUOTE ASTERISK? ~('\r' | '\n' | '"' )* ASTERISK? QUOTE; TEXT: ('a'..'z'| 'A'..'Z' | DIGIT | '_' )+;
vpx_dsp/x86/intrapred_sse2.asm
VTCSecureLLC/linphone-libvpx
8
28791
; ; Copyright (c) 2010 The WebM project authors. All Rights Reserved. ; ; Use of this source code is governed by a BSD-style license ; that can be found in the LICENSE file in the root of the source ; tree. An additional intellectual property rights grant can be found ; in the file PATENTS. All contributing project authors may ; be found in the AUTHORS file in the root of the source tree. ; %include "third_party/x86inc/x86inc.asm" SECTION_RODATA pw_4: times 8 dw 4 pw_8: times 8 dw 8 pw_16: times 8 dw 16 pw_32: times 8 dw 32 dc_128: times 16 db 128 pw2_4: times 8 dw 2 pw2_8: times 8 dw 4 pw2_16: times 8 dw 8 pw2_32: times 8 dw 16 SECTION .text INIT_MMX sse cglobal dc_predictor_4x4, 4, 5, 2, dst, stride, above, left, goffset GET_GOT goffsetq pxor m1, m1 movd m0, [aboveq] punpckldq m0, [leftq] psadbw m0, m1 paddw m0, [GLOBAL(pw_4)] psraw m0, 3 pshufw m0, m0, 0x0 packuswb m0, m0 movd [dstq ], m0 movd [dstq+strideq], m0 lea dstq, [dstq+strideq*2] movd [dstq ], m0 movd [dstq+strideq], m0 RESTORE_GOT RET INIT_MMX sse cglobal dc_left_predictor_4x4, 4, 5, 2, dst, stride, above, left, goffset GET_GOT goffsetq pxor m1, m1 movd m0, [leftq] psadbw m0, m1 paddw m0, [GLOBAL(pw2_4)] psraw m0, 2 pshufw m0, m0, 0x0 packuswb m0, m0 movd [dstq ], m0 movd [dstq+strideq], m0 lea dstq, [dstq+strideq*2] movd [dstq ], m0 movd [dstq+strideq], m0 RESTORE_GOT RET INIT_MMX sse cglobal dc_top_predictor_4x4, 4, 5, 2, dst, stride, above, left, goffset GET_GOT goffsetq pxor m1, m1 movd m0, [aboveq] psadbw m0, m1 paddw m0, [GLOBAL(pw2_4)] psraw m0, 2 pshufw m0, m0, 0x0 packuswb m0, m0 movd [dstq ], m0 movd [dstq+strideq], m0 lea dstq, [dstq+strideq*2] movd [dstq ], m0 movd [dstq+strideq], m0 RESTORE_GOT RET INIT_MMX sse cglobal dc_predictor_8x8, 4, 5, 3, dst, stride, above, left, goffset GET_GOT goffsetq pxor m1, m1 movq m0, [aboveq] movq m2, [leftq] DEFINE_ARGS dst, stride, stride3 lea stride3q, [strideq*3] psadbw m0, m1 psadbw m2, m1 paddw m0, m2 paddw m0, [GLOBAL(pw_8)] psraw m0, 4 pshufw m0, m0, 0x0 packuswb m0, m0 movq [dstq ], m0 movq [dstq+strideq ], m0 movq [dstq+strideq*2], m0 movq [dstq+stride3q ], m0 lea dstq, [dstq+strideq*4] movq [dstq ], m0 movq [dstq+strideq ], m0 movq [dstq+strideq*2], m0 movq [dstq+stride3q ], m0 RESTORE_GOT RET INIT_MMX sse cglobal dc_top_predictor_8x8, 4, 5, 3, dst, stride, above, left, goffset GET_GOT goffsetq pxor m1, m1 movq m0, [aboveq] DEFINE_ARGS dst, stride, stride3 lea stride3q, [strideq*3] psadbw m0, m1 paddw m0, [GLOBAL(pw2_8)] psraw m0, 3 pshufw m0, m0, 0x0 packuswb m0, m0 movq [dstq ], m0 movq [dstq+strideq ], m0 movq [dstq+strideq*2], m0 movq [dstq+stride3q ], m0 lea dstq, [dstq+strideq*4] movq [dstq ], m0 movq [dstq+strideq ], m0 movq [dstq+strideq*2], m0 movq [dstq+stride3q ], m0 RESTORE_GOT RET INIT_MMX sse cglobal dc_left_predictor_8x8, 4, 5, 3, dst, stride, above, left, goffset GET_GOT goffsetq pxor m1, m1 movq m0, [leftq] DEFINE_ARGS dst, stride, stride3 lea stride3q, [strideq*3] psadbw m0, m1 paddw m0, [GLOBAL(pw2_8)] psraw m0, 3 pshufw m0, m0, 0x0 packuswb m0, m0 movq [dstq ], m0 movq [dstq+strideq ], m0 movq [dstq+strideq*2], m0 movq [dstq+stride3q ], m0 lea dstq, [dstq+strideq*4] movq [dstq ], m0 movq [dstq+strideq ], m0 movq [dstq+strideq*2], m0 movq [dstq+stride3q ], m0 RESTORE_GOT RET INIT_MMX sse cglobal dc_128_predictor_4x4, 4, 5, 3, dst, stride, above, left, goffset GET_GOT goffsetq DEFINE_ARGS dst, stride, stride3 lea stride3q, [strideq*3] movd m0, [GLOBAL(dc_128)] movd [dstq ], m0 movd [dstq+strideq ], m0 movd [dstq+strideq*2], m0 movd [dstq+stride3q ], m0 RESTORE_GOT RET INIT_MMX sse cglobal dc_128_predictor_8x8, 4, 5, 3, dst, stride, above, left, goffset GET_GOT goffsetq DEFINE_ARGS dst, stride, stride3 lea stride3q, [strideq*3] movq m0, [GLOBAL(dc_128)] movq [dstq ], m0 movq [dstq+strideq ], m0 movq [dstq+strideq*2], m0 movq [dstq+stride3q ], m0 lea dstq, [dstq+strideq*4] movq [dstq ], m0 movq [dstq+strideq ], m0 movq [dstq+strideq*2], m0 movq [dstq+stride3q ], m0 RESTORE_GOT RET INIT_XMM sse2 cglobal dc_predictor_16x16, 4, 5, 3, dst, stride, above, left, goffset GET_GOT goffsetq pxor m1, m1 mova m0, [aboveq] mova m2, [leftq] DEFINE_ARGS dst, stride, stride3, lines4 lea stride3q, [strideq*3] mov lines4d, 4 psadbw m0, m1 psadbw m2, m1 paddw m0, m2 movhlps m2, m0 paddw m0, m2 paddw m0, [GLOBAL(pw_16)] psraw m0, 5 pshuflw m0, m0, 0x0 punpcklqdq m0, m0 packuswb m0, m0 .loop: mova [dstq ], m0 mova [dstq+strideq ], m0 mova [dstq+strideq*2], m0 mova [dstq+stride3q ], m0 lea dstq, [dstq+strideq*4] dec lines4d jnz .loop RESTORE_GOT REP_RET INIT_XMM sse2 cglobal dc_top_predictor_16x16, 4, 5, 3, dst, stride, above, left, goffset GET_GOT goffsetq pxor m1, m1 pxor m2, m2 mova m0, [aboveq] DEFINE_ARGS dst, stride, stride3, lines4 lea stride3q, [strideq*3] mov lines4d, 4 psadbw m0, m1 psadbw m2, m1 paddw m0, m2 movhlps m2, m0 paddw m0, m2 paddw m0, [GLOBAL(pw2_16)] psraw m0, 4 pshuflw m0, m0, 0x0 punpcklqdq m0, m0 packuswb m0, m0 .loop: mova [dstq ], m0 mova [dstq+strideq ], m0 mova [dstq+strideq*2], m0 mova [dstq+stride3q ], m0 lea dstq, [dstq+strideq*4] dec lines4d jnz .loop RESTORE_GOT REP_RET INIT_XMM sse2 cglobal dc_left_predictor_16x16, 4, 5, 3, dst, stride, above, left, goffset GET_GOT goffsetq pxor m1, m1 pxor m2, m2 mova m0, [leftq] DEFINE_ARGS dst, stride, stride3, lines4 lea stride3q, [strideq*3] mov lines4d, 4 psadbw m0, m1 psadbw m2, m1 paddw m0, m2 movhlps m2, m0 paddw m0, m2 paddw m0, [GLOBAL(pw2_16)] psraw m0, 4 pshuflw m0, m0, 0x0 punpcklqdq m0, m0 packuswb m0, m0 .loop: mova [dstq ], m0 mova [dstq+strideq ], m0 mova [dstq+strideq*2], m0 mova [dstq+stride3q ], m0 lea dstq, [dstq+strideq*4] dec lines4d jnz .loop RESTORE_GOT REP_RET INIT_XMM sse2 cglobal dc_128_predictor_16x16, 4, 5, 3, dst, stride, above, left, goffset GET_GOT goffsetq DEFINE_ARGS dst, stride, stride3, lines4 lea stride3q, [strideq*3] mov lines4d, 4 mova m0, [GLOBAL(dc_128)] .loop: mova [dstq ], m0 mova [dstq+strideq ], m0 mova [dstq+strideq*2], m0 mova [dstq+stride3q ], m0 lea dstq, [dstq+strideq*4] dec lines4d jnz .loop RESTORE_GOT RET INIT_XMM sse2 cglobal dc_predictor_32x32, 4, 5, 5, dst, stride, above, left, goffset GET_GOT goffsetq pxor m1, m1 mova m0, [aboveq] mova m2, [aboveq+16] mova m3, [leftq] mova m4, [leftq+16] DEFINE_ARGS dst, stride, stride3, lines4 lea stride3q, [strideq*3] mov lines4d, 8 psadbw m0, m1 psadbw m2, m1 psadbw m3, m1 psadbw m4, m1 paddw m0, m2 paddw m0, m3 paddw m0, m4 movhlps m2, m0 paddw m0, m2 paddw m0, [GLOBAL(pw_32)] psraw m0, 6 pshuflw m0, m0, 0x0 punpcklqdq m0, m0 packuswb m0, m0 .loop: mova [dstq ], m0 mova [dstq +16], m0 mova [dstq+strideq ], m0 mova [dstq+strideq +16], m0 mova [dstq+strideq*2 ], m0 mova [dstq+strideq*2+16], m0 mova [dstq+stride3q ], m0 mova [dstq+stride3q +16], m0 lea dstq, [dstq+strideq*4] dec lines4d jnz .loop RESTORE_GOT REP_RET INIT_XMM sse2 cglobal dc_top_predictor_32x32, 4, 5, 5, dst, stride, above, left, goffset GET_GOT goffsetq pxor m1, m1 mova m0, [aboveq] mova m2, [aboveq+16] DEFINE_ARGS dst, stride, stride3, lines4 lea stride3q, [strideq*3] mov lines4d, 8 psadbw m0, m1 psadbw m2, m1 paddw m0, m2 movhlps m2, m0 paddw m0, m2 paddw m0, [GLOBAL(pw2_32)] psraw m0, 5 pshuflw m0, m0, 0x0 punpcklqdq m0, m0 packuswb m0, m0 .loop: mova [dstq ], m0 mova [dstq +16], m0 mova [dstq+strideq ], m0 mova [dstq+strideq +16], m0 mova [dstq+strideq*2 ], m0 mova [dstq+strideq*2+16], m0 mova [dstq+stride3q ], m0 mova [dstq+stride3q +16], m0 lea dstq, [dstq+strideq*4] dec lines4d jnz .loop RESTORE_GOT REP_RET INIT_XMM sse2 cglobal dc_left_predictor_32x32, 4, 5, 5, dst, stride, above, left, goffset GET_GOT goffsetq pxor m1, m1 mova m0, [leftq] mova m2, [leftq+16] DEFINE_ARGS dst, stride, stride3, lines4 lea stride3q, [strideq*3] mov lines4d, 8 psadbw m0, m1 psadbw m2, m1 paddw m0, m2 movhlps m2, m0 paddw m0, m2 paddw m0, [GLOBAL(pw2_32)] psraw m0, 5 pshuflw m0, m0, 0x0 punpcklqdq m0, m0 packuswb m0, m0 .loop: mova [dstq ], m0 mova [dstq +16], m0 mova [dstq+strideq ], m0 mova [dstq+strideq +16], m0 mova [dstq+strideq*2 ], m0 mova [dstq+strideq*2+16], m0 mova [dstq+stride3q ], m0 mova [dstq+stride3q +16], m0 lea dstq, [dstq+strideq*4] dec lines4d jnz .loop RESTORE_GOT REP_RET INIT_XMM sse2 cglobal dc_128_predictor_32x32, 4, 5, 3, dst, stride, above, left, goffset GET_GOT goffsetq DEFINE_ARGS dst, stride, stride3, lines4 lea stride3q, [strideq*3] mov lines4d, 8 mova m0, [GLOBAL(dc_128)] .loop: mova [dstq ], m0 mova [dstq +16], m0 mova [dstq+strideq ], m0 mova [dstq+strideq +16], m0 mova [dstq+strideq*2 ], m0 mova [dstq+strideq*2+16], m0 mova [dstq+stride3q ], m0 mova [dstq+stride3q +16], m0 lea dstq, [dstq+strideq*4] dec lines4d jnz .loop RESTORE_GOT RET INIT_MMX sse cglobal v_predictor_4x4, 3, 3, 1, dst, stride, above movd m0, [aboveq] movd [dstq ], m0 movd [dstq+strideq], m0 lea dstq, [dstq+strideq*2] movd [dstq ], m0 movd [dstq+strideq], m0 RET INIT_MMX sse cglobal v_predictor_8x8, 3, 3, 1, dst, stride, above movq m0, [aboveq] DEFINE_ARGS dst, stride, stride3 lea stride3q, [strideq*3] movq [dstq ], m0 movq [dstq+strideq ], m0 movq [dstq+strideq*2], m0 movq [dstq+stride3q ], m0 lea dstq, [dstq+strideq*4] movq [dstq ], m0 movq [dstq+strideq ], m0 movq [dstq+strideq*2], m0 movq [dstq+stride3q ], m0 RET INIT_XMM sse2 cglobal v_predictor_16x16, 3, 4, 1, dst, stride, above mova m0, [aboveq] DEFINE_ARGS dst, stride, stride3, nlines4 lea stride3q, [strideq*3] mov nlines4d, 4 .loop: mova [dstq ], m0 mova [dstq+strideq ], m0 mova [dstq+strideq*2], m0 mova [dstq+stride3q ], m0 lea dstq, [dstq+strideq*4] dec nlines4d jnz .loop REP_RET INIT_XMM sse2 cglobal v_predictor_32x32, 3, 4, 2, dst, stride, above mova m0, [aboveq] mova m1, [aboveq+16] DEFINE_ARGS dst, stride, stride3, nlines4 lea stride3q, [strideq*3] mov nlines4d, 8 .loop: mova [dstq ], m0 mova [dstq +16], m1 mova [dstq+strideq ], m0 mova [dstq+strideq +16], m1 mova [dstq+strideq*2 ], m0 mova [dstq+strideq*2+16], m1 mova [dstq+stride3q ], m0 mova [dstq+stride3q +16], m1 lea dstq, [dstq+strideq*4] dec nlines4d jnz .loop REP_RET INIT_MMX sse cglobal tm_predictor_4x4, 4, 4, 4, dst, stride, above, left pxor m1, m1 movd m2, [aboveq-1] movd m0, [aboveq] punpcklbw m2, m1 punpcklbw m0, m1 pshufw m2, m2, 0x0 DEFINE_ARGS dst, stride, line, left mov lineq, -2 add leftq, 4 psubw m0, m2 .loop: movd m2, [leftq+lineq*2] movd m3, [leftq+lineq*2+1] punpcklbw m2, m1 punpcklbw m3, m1 pshufw m2, m2, 0x0 pshufw m3, m3, 0x0 paddw m2, m0 paddw m3, m0 packuswb m2, m2 packuswb m3, m3 movd [dstq ], m2 movd [dstq+strideq], m3 lea dstq, [dstq+strideq*2] inc lineq jnz .loop REP_RET INIT_XMM sse2 cglobal tm_predictor_8x8, 4, 4, 4, dst, stride, above, left pxor m1, m1 movd m2, [aboveq-1] movq m0, [aboveq] punpcklbw m2, m1 punpcklbw m0, m1 pshuflw m2, m2, 0x0 DEFINE_ARGS dst, stride, line, left mov lineq, -4 punpcklqdq m2, m2 add leftq, 8 psubw m0, m2 .loop: movd m2, [leftq+lineq*2] movd m3, [leftq+lineq*2+1] punpcklbw m2, m1 punpcklbw m3, m1 pshuflw m2, m2, 0x0 pshuflw m3, m3, 0x0 punpcklqdq m2, m2 punpcklqdq m3, m3 paddw m2, m0 paddw m3, m0 packuswb m2, m3 movq [dstq ], m2 movhps [dstq+strideq], m2 lea dstq, [dstq+strideq*2] inc lineq jnz .loop REP_RET INIT_XMM sse2 cglobal tm_predictor_16x16, 4, 4, 7, dst, stride, above, left pxor m1, m1 movd m2, [aboveq-1] mova m0, [aboveq] punpcklbw m2, m1 punpckhbw m4, m0, m1 punpcklbw m0, m1 pshuflw m2, m2, 0x0 DEFINE_ARGS dst, stride, line, left mov lineq, -8 punpcklqdq m2, m2 add leftq, 16 psubw m0, m2 psubw m4, m2 .loop: movd m2, [leftq+lineq*2] movd m3, [leftq+lineq*2+1] punpcklbw m2, m1 punpcklbw m3, m1 pshuflw m2, m2, 0x0 pshuflw m3, m3, 0x0 punpcklqdq m2, m2 punpcklqdq m3, m3 paddw m5, m2, m0 paddw m6, m3, m0 paddw m2, m4 paddw m3, m4 packuswb m5, m2 packuswb m6, m3 mova [dstq ], m5 mova [dstq+strideq], m6 lea dstq, [dstq+strideq*2] inc lineq jnz .loop REP_RET %if ARCH_X86_64 INIT_XMM sse2 cglobal tm_predictor_32x32, 4, 4, 10, dst, stride, above, left pxor m1, m1 movd m2, [aboveq-1] mova m0, [aboveq] mova m4, [aboveq+16] punpcklbw m2, m1 punpckhbw m3, m0, m1 punpckhbw m5, m4, m1 punpcklbw m0, m1 punpcklbw m4, m1 pshuflw m2, m2, 0x0 DEFINE_ARGS dst, stride, line, left mov lineq, -16 punpcklqdq m2, m2 add leftq, 32 psubw m0, m2 psubw m3, m2 psubw m4, m2 psubw m5, m2 .loop: movd m2, [leftq+lineq*2] movd m6, [leftq+lineq*2+1] punpcklbw m2, m1 punpcklbw m6, m1 pshuflw m2, m2, 0x0 pshuflw m6, m6, 0x0 punpcklqdq m2, m2 punpcklqdq m6, m6 paddw m7, m2, m0 paddw m8, m2, m3 paddw m9, m2, m4 paddw m2, m5 packuswb m7, m8 packuswb m9, m2 paddw m2, m6, m0 paddw m8, m6, m3 mova [dstq ], m7 paddw m7, m6, m4 paddw m6, m5 mova [dstq +16], m9 packuswb m2, m8 packuswb m7, m6 mova [dstq+strideq ], m2 mova [dstq+strideq+16], m7 lea dstq, [dstq+strideq*2] inc lineq jnz .loop REP_RET %endif
models/amalgam/paper/digraph.als
transclosure/Amalgam
4
3558
<gh_stars>1-10 /* JUST a digraph of up to 4 nodes */ sig Node {edges: set Node} pred test {some Node} run test for 4 Node
kernel/asm/vesa.asm
pwoolcoc/redox
0
3034
%include "asm/vesa.inc" SECTION .text USE16 vesa: .getcardinfo: mov ax, 0x4F00 mov di, VBECardInfo int 0x10 cmp ax, 0x4F je .edid mov eax, 1 ret .edid: cmp dword [.required], 0 ;if both required x and required y are set, forget this jne near .findmode mov ax, 0x4F15 mov bx, 1 xor cx, cx xor dx, dx mov di, VBEEDID int 0x10 cmp ax, 0x4F jne near .noedid xor di, di .lp: xor cx, cx mov cl, [di+VBEEDID.standardtiming] shl cx, 3 add cx, 248 push ecx call decshowrm mov al, 'x' call charrm pop ecx mov bx, cx inc di mov al, [di+VBEEDID.standardtiming] and al, 11000000b cmp al, VBEEDID.aspect.4.3 jne .not43 mov ax, 3 mul cx mov cx, ax shr cx, 2 jmp .gotres .not43: cmp al, VBEEDID.aspect.5.4 jne .not54 shl cx, 2 mov ax, cx mov cx, 5 xor dx, dx div cx mov cx, ax jmp .gotres .not54: cmp al, VBEEDID.aspect.16.10 jne .not1610 mov ax, 10 mul cx mov cx, ax shr cx, 4 jmp .gotres .not1610: mov ax, 9 mul cx mov cx, ax shr cx, 4 .gotres: call decshowrm mov si, .edidmsg call printrm inc di cmp di, 8 jb .lp jmp .findmode .noedid: mov si, .noedidmsg call printrm jmp .findmode .resetlist: ;if needed, reset mins/maxes/stuff xor cx, cx mov [.minx], cx mov [.miny], cx mov [.requiredx], cx mov [.requiredy], cx mov [.requiredmode], cx .findmode: mov si, [VBECardInfo.videomodeptr] mov ax, [VBECardInfo.videomodeptr+2] mov fs, ax sub si, 2 mov cx, [.requiredmode] test cx, cx jnz .getmodeinfo .searchmodes: add si, 2 mov cx, [fs:si] cmp cx, 0xFFFF jne .getmodeinfo cmp word [.goodmode], 0 je .resetlist jmp .findmode .getmodeinfo: push esi mov [.currentmode], cx mov ax, 0x4F01 mov di, VBEModeInfo int 0x10 pop esi cmp ax, 0x4F je .foundmode mov eax, 1 ret .foundmode: ;check minimum values, really not minimums from an OS perspective but ugly for users cmp byte [VBEModeInfo.bitsperpixel], 32 jb .searchmodes .testx: mov cx, [VBEModeInfo.xresolution] cmp word [.requiredx], 0 je .notrequiredx cmp cx, [.requiredx] je .testy jmp .searchmodes .notrequiredx: cmp cx, [.minx] jb .searchmodes .testy: mov cx, [VBEModeInfo.yresolution] cmp word [.requiredy], 0 je .notrequiredy cmp cx, [.requiredy] jne .searchmodes ;as if there weren't enough warnings, USE WITH CAUTION cmp word [.requiredx], 0 jnz .setmode jmp .testgood .notrequiredy: cmp cx, [.miny] jb .searchmodes .testgood: mov cx, [.currentmode] mov [.goodmode], cx push esi call decshowrm mov al, ':' call charrm mov cx, [VBEModeInfo.xresolution] call decshowrm mov al, 'x' call charrm mov cx, [VBEModeInfo.yresolution] call decshowrm mov al, '@' call charrm xor ch, ch mov cl, [VBEModeInfo.bitsperpixel] call decshowrm mov si, .modeok call printrm xor ax, ax int 0x16 pop esi cmp al, 'y' jne .searchmodes .setmode: mov bx, [.currentmode] cmp bx, 0 je .nomode or bx, 0x4000 mov ax, 0x4F02 int 0x10 .nomode: cmp ax, 0x4F je .returngood mov eax, 1 ret .returngood: xor eax, eax ret .minx dw 640 .miny dw 480 .required: .requiredx dw 0 ;1024 ;USE THESE WITH CAUTION .requiredy dw 0 ;768 .requiredmode dw 0 .noedidmsg db "EDID not supported.",10,13,0 .edidmsg db " is supported.",10,13,0 .modeok db 10,13,"Is this OK?(y/n)",10,13,0 .goodmode dw 0 .currentmode dw 0 ;useful functions decshowrm: mov si, .number .clear: mov al, "0" mov [si], al inc si cmp si, .numberend jb .clear dec si call convertrm mov si, .number .lp: lodsb cmp si, .numberend jae .end cmp al, "0" jbe .lp .end: dec si call printrm ret .number times 7 db 0 .numberend db 0 convertrm: dec si mov bx, si ;place to convert into must be in si, number to convert must be in cx .cnvrt: mov si, bx sub si, 4 .ten4: inc si cmp cx, 10000 jb .ten3 sub cx, 10000 inc byte [si] jmp .cnvrt .ten3: inc si cmp cx, 1000 jb .ten2 sub cx, 1000 inc byte [si] jmp .cnvrt .ten2: inc si cmp cx, 100 jb .ten1 sub cx, 100 inc byte [si] jmp .cnvrt .ten1: inc si cmp cx, 10 jb .ten0 sub cx, 10 inc byte [si] jmp .cnvrt .ten0: inc si cmp cx, 1 jb .return sub cx, 1 inc byte [si] jmp .cnvrt .return: ret printrm: mov al, [si] test al, al jz .return call charrm inc si jmp printrm .return: ret charrm: ;char must be in al mov bx, 7 mov ah, 0xE int 10h ret ; .bestmode: ;preference is width > height > color ; mov bx, [VBEModeInfo.xresolution] ; cmp bx, [.width] ; ja .switchmode ; jb .searchmodes ; mov bx, [VBEModeInfo.yresolution] ; cmp bx, [.height] ; ja .switchmode ; jb .searchmodes ; mov bl, [VBEModeInfo.bitsperpixel] ; cmp bl, [.color] ; jb .searchmodes ; .switchmode: ; mov cx, [.currentmode] ; mov [.mode], cx ; mov bx, [VBEModeInfo.xresolution] ; mov [.width], bx ; mov bx, [VBEModeInfo.yresolution] ; mov [.height], bx ; mov bl, [VBEModeInfo.bitsperpixel] ; mov [.color], bl ; jmp .searchmodes ; .mode dw 0 ; .color db 0 ; .height dw 0 ; .width dw 0
oeis/005/A005043.asm
neoneye/loda-programs
11
13406
; A005043: Riordan numbers: a(n) = (n-1)*(2*a(n-1) + 3*a(n-2))/(n+1). ; Submitted by <NAME> ; 1,0,1,1,3,6,15,36,91,232,603,1585,4213,11298,30537,83097,227475,625992,1730787,4805595,13393689,37458330,105089229,295673994,834086421,2358641376,6684761125,18985057351,54022715451,154000562758,439742222071,1257643249140,3602118427251,10331450919456,29671013856627,85317692667643,245613376802185,707854577312178,2042162142208813,5897493615536452,17047255430494497,49320944483427000,142816973618414817,413887836110423787,1200394300050487935,3484084625456932134,10119592485062548155 add $0,1 mov $1,1 mov $3,$0 mov $4,1 lpb $3 sub $3,1 div $4,-1 mul $4,$3 add $5,$1 add $1,1 mod $1,2 div $4,$5 add $2,$4 lpe mov $0,$2 add $0,1
fracGC/PiFracMemSem.agda
JacquesCarette/pi-dual
14
16324
<filename>fracGC/PiFracMemSem.agda {-# OPTIONS --without-K --safe #-} module PiFracMemSem where open import Relation.Binary.Core open import Data.Empty open import Function open import Data.Nat open import Data.Nat.Properties open import Data.Fin as Fin using (Fin; zero; suc) open import Data.Vec open import Data.Vec.Relation.Unary.Any.Properties open import Data.Vec.Any hiding (map) open import Data.Empty using (⊥) open import Data.Unit using (⊤; tt) open import Data.Sum using (_⊎_; inj₁; inj₂) open import Data.Product using (_×_; _,_; proj₁; proj₂; Σ-syntax) open import Relation.Nullary open import Relation.Binary.PropositionalEquality renaming ([_] to R[_]) open import PiFracDyn infix 80 ∣_∣ ∣_∣ : (A : 𝕌) → ℕ ∣ 𝟘 ∣ = 0 ∣ 𝟙 ∣ = 1 ∣ A₁ +ᵤ A₂ ∣ = ∣ A₁ ∣ + ∣ A₂ ∣ ∣ A₁ ×ᵤ A₂ ∣ = ∣ A₁ ∣ * ∣ A₂ ∣ ∣ 𝟙/ A ∣ = 1 Vec× : ∀ {n m} {A B : Set} → Vec A n → Vec B m → Vec (A × B) (n * m) Vec× va vb = concat (map (λ a₁ → map (a₁ ,_) vb) va) ∈map : ∀ {ℓ₁ ℓ₂} {n} {A : Set ℓ₁} {B : Set ℓ₂} {v : Vec A n} → (f : A → B) → (a : A) → Any (a ≡_) v → Any (f a ≡_) (map f v) ∈map f a (here refl) = here refl ∈map f a (there a∈v) = there (∈map f a a∈v) inVec× : ∀ {n m} {A B : Set} → (va : Vec A n) → (vb : Vec B m) → (a : A) (b : B) → Any (a ≡_) va → Any (b ≡_) vb → Any ((a , b) ≡_) (Vec× va vb) inVec× (a ∷ va) vb .a b (here refl) b∈vb = ++⁺ˡ {xs = map (a ,_) vb} (∈map _ _ b∈vb) inVec× (x ∷ va) vb a b (there a∈va) b∈vb = ++⁺ʳ (map (x ,_) vb) (inVec× va vb a b a∈va b∈vb) any≡← : ∀ {ℓ} {A : Set ℓ} {n} {a} → (v : Vec A n) → (i : Fin n) → a ≡ lookup v i → Any (a ≡_) v any≡← (_ ∷ _) Fin.0F refl = here refl any≡← (_ ∷ v) (suc i) refl = there (any≡← v i refl) Enum : (A : 𝕌) → Vec ⟦ A ⟧ ∣ A ∣ Enum 𝟘 = [] Enum 𝟙 = tt ∷ [] Enum (A₁ +ᵤ A₂) = map inj₁ (Enum A₁) ++ map inj₂ (Enum A₂) Enum (A₁ ×ᵤ A₂) = Vec× (Enum A₁) (Enum A₂) Enum (𝟙/ A) = ○ ∷ [] Find : {A : 𝕌} (x : ⟦ A ⟧) → Σ[ i ∈ Fin ∣ A ∣ ] (x ≡ lookup (Enum A) i) Find {𝟘} () Find {𝟙} tt = index tt∈𝟙 , lookup-index tt∈𝟙 where tt∈𝟙 : Any (tt ≡_) (Enum 𝟙) tt∈𝟙 = here refl Find {A₁ +ᵤ A₂} (inj₁ x) = let i , p₁ = Find x in let x∈A₁ : Any ((inj₁ x) ≡_) (Enum (A₁ +ᵤ A₂)) x∈A₁ = ++⁺ˡ {xs = map inj₁ (Enum A₁)} (∈map inj₁ x (any≡← _ i p₁)) in index x∈A₁ , lookup-index x∈A₁ Find {A₁ +ᵤ A₂} (inj₂ y) = let j , p₂ = Find y in let y∈A₂ : Any ((inj₂ y) ≡_) (Enum (A₁ +ᵤ A₂)) y∈A₂ = ++⁺ʳ (map inj₁ (Enum A₁)) (∈map inj₂ y (any≡← _ j p₂)) in index y∈A₂ , lookup-index y∈A₂ Find {A₁ ×ᵤ A₂} (x , y) = let i , p₁ = Find x j , p₂ = Find y in let xy∈A₁×A₂ : Any ((x , y) ≡_) (Enum (A₁ ×ᵤ A₂)) xy∈A₁×A₂ = inVec× (Enum A₁) (Enum A₂) x y (any≡← (Enum A₁) i p₁) (any≡← (Enum A₂) j p₂) in index xy∈A₁×A₂ , lookup-index xy∈A₁×A₂ Find {𝟙/ A} ○ = index ○∈𝟙/A , lookup-index ○∈𝟙/A where ○∈𝟙/A : Any (○ ≡_) (Enum (𝟙/ A)) ○∈𝟙/A = here refl Find' : {A : 𝕌} (x : ⟦ A ⟧) → Fin ∣ A ∣ Find' = proj₁ ∘ Find data State (A : 𝕌) : Set where ⟪_[_]⟫ : Vec ⟦ A ⟧ ∣ A ∣ → Fin ∣ A ∣ → State A resolve : {A : 𝕌} → State A → ⟦ A ⟧ resolve ⟪ v [ i ]⟫ = lookup v i st : {A B : 𝕌} → ⟦ A ⟧ → (c : A ↔ B) → Σ[ C ∈ 𝕌 ] (C ↔ B × State C) st (inj₂ y) (unite₊l {t}) = _ , id↔ , ⟪ Enum t [ Find' y ]⟫ st a (uniti₊l {t}) = _ , id↔ , ⟪ (Enum (𝟘 +ᵤ t)) [ Find' a ]⟫ st (inj₁ x) (unite₊r {t}) = _ , id↔ , ⟪ Enum t [ Find' x ]⟫ st a (uniti₊r {t}) = _ , id↔ , ⟪ (Enum (t +ᵤ 𝟘)) [ Find' {t +ᵤ 𝟘} (inj₁ a) ]⟫ st (inj₁ x) (swap₊ {t₁} {t₂}) = _ , id↔ , ⟪ Enum _ [ Find' {t₂ +ᵤ t₁} (inj₂ x) ]⟫ st (inj₂ y) (swap₊ {t₁} {t₂}) = _ , id↔ , ⟪ Enum _ [ Find' {t₂ +ᵤ t₁} (inj₁ y) ]⟫ st (inj₁ x) (assocl₊ {t₁} {t₂} {t₃}) = _ , id↔ , ⟪ Enum _ [ Find' {(t₁ +ᵤ t₂) +ᵤ t₃} (inj₁ (inj₁ x)) ]⟫ st (inj₂ (inj₁ x)) (assocl₊ {t₁} {t₂} {t₃}) = _ , id↔ , ⟪ Enum _ [ Find' {(t₁ +ᵤ t₂) +ᵤ t₃} (inj₁ (inj₂ x)) ]⟫ st (inj₂ (inj₂ y)) (assocl₊ {t₁} {t₂} {t₃}) = _ , id↔ , ⟪ Enum _ [ Find' {(t₁ +ᵤ t₂) +ᵤ t₃} (inj₂ y) ]⟫ st (inj₁ (inj₁ x)) (assocr₊ {t₁} {t₂} {t₃}) = _ , id↔ , ⟪ Enum _ [ Find' {t₁ +ᵤ t₂ +ᵤ t₃} (inj₁ x) ]⟫ st (inj₁ (inj₂ y)) (assocr₊ {t₁} {t₂} {t₃}) = _ , id↔ , ⟪ Enum _ [ Find' {t₁ +ᵤ t₂ +ᵤ t₃} (inj₂ (inj₁ y)) ]⟫ st (inj₂ y) (assocr₊ {t₁} {t₂} {t₃}) = _ , id↔ , ⟪ Enum _ [ Find' {t₁ +ᵤ t₂ +ᵤ t₃} (inj₂ (inj₂ y)) ]⟫ st (tt , y) unite⋆l = _ , id↔ , ⟪ Enum _ [ Find' y ]⟫ st a uniti⋆l = _ , id↔ , ⟪ Enum _ [ Find' (tt , a) ]⟫ st (x , tt) unite⋆r = _ , id↔ , ⟪ Enum _ [ Find' x ]⟫ st a uniti⋆r = _ , id↔ , ⟪ Enum _ [ Find' (a , tt) ]⟫ st (x , y) swap⋆ = _ , id↔ , ⟪ Enum _ [ Find' (y , x) ]⟫ st (x , y , z) assocl⋆ = _ , id↔ , ⟪ Enum _ [ Find' ((x , y) , z) ]⟫ st ((x , y) , z) assocr⋆ = _ , id↔ , ⟪ Enum _ [ Find' (x , y , z) ]⟫ st (inj₁ x , y) (dist {t₁} {t₂} {t₃}) = _ , id↔ , ⟪ Enum _ [ Find' {t₁ ×ᵤ t₃ +ᵤ t₂ ×ᵤ t₃} (inj₁ (x , y)) ]⟫ st (inj₂ x , y) (dist {t₁} {t₂} {t₃}) = _ , id↔ , ⟪ Enum _ [ Find' {t₁ ×ᵤ t₃ +ᵤ t₂ ×ᵤ t₃} (inj₂ (x , y)) ]⟫ st (inj₁ (x , y)) (factor {t₁} {t₂} {t₃}) = _ , id↔ , ⟪ Enum _ [ Find' {(t₁ +ᵤ t₂) ×ᵤ t₃} (inj₁ x , y) ]⟫ st (inj₂ (y , z)) (factor {t₁} {t₂} {t₃}) = _ , id↔ , ⟪ Enum _ [ Find' {(t₁ +ᵤ t₂) ×ᵤ t₃} (inj₂ y , z) ]⟫ st (x , inj₁ y) (distl {t₁} {t₂} {t₃}) = _ , id↔ , ⟪ Enum _ [ Find' {(t₁ ×ᵤ t₂) +ᵤ (t₁ ×ᵤ t₃)} (inj₁ (x , y)) ]⟫ st (x , inj₂ y) (distl {t₁} {t₂} {t₃}) = _ , id↔ , ⟪ Enum _ [ Find' {(t₁ ×ᵤ t₂) +ᵤ (t₁ ×ᵤ t₃)} (inj₂ (x , y)) ]⟫ st (inj₁ (x , y)) (factorl {t₁} {t₂} {t₃}) = _ , id↔ , ⟪ Enum _ [ Find' {t₁ ×ᵤ (t₂ +ᵤ t₃)} (x , inj₁ y) ]⟫ st (inj₂ (x , z)) (factorl {t₁} {t₂} {t₃}) = _ , id↔ , ⟪ Enum _ [ Find' {t₁ ×ᵤ (t₂ +ᵤ t₃)} (x , inj₂ z) ]⟫ st tt (η {t} v) = _ , id↔ , ⟪ Enum (t ×ᵤ (𝟙/ v)) [ Find' {t ×ᵤ (𝟙/ v)} (v , ○) ]⟫ st (x , ○) (ε {t} v) with 𝕌dec t v x st (x , ○) (ε {t} v) | yes _ = _ , id↔ , ⟪ Enum _ [ Find' tt ]⟫ st (x , ○) (ε {t} v) | no _ = _ , (ε {t} v) , ⟪ Enum (t ×ᵤ (𝟙/ v)) [ Find' {t ×ᵤ (𝟙/ v)} (x , ○) ]⟫ st a id↔ = _ , id↔ , ⟪ Enum _ [ Find' a ]⟫ st a (id↔ ⊚ c) = _ , c , ⟪ Enum _ [ Find' a ]⟫ st a (c₁ ⊚ c₂) = let _ , c , st' = st a c₁ in _ , c ⊚ c₂ , st' st (inj₁ x) (_⊕_ {t₁} {t₂} {_} {t₄} id↔ c₂) = _ , id↔ , ⟪ Enum _ [ Find' {_ +ᵤ t₄} (inj₁ x) ]⟫ st (inj₁ x) (_⊕_ {t₁} {t₂} c₁ c₂) = let _ , c , st' = st x c₁ in _ , c ⊕ c₂ , ⟪ Enum _ [ Find' {_ +ᵤ t₂} (inj₁ $ resolve st') ]⟫ st (inj₂ y) (_⊕_ {t₁} {t₂} {t₃} {_} c₁ id↔) = _ , id↔ , ⟪ Enum _ [ Find' {t₃ +ᵤ _} (inj₂ y) ]⟫ st (inj₂ y) (_⊕_ {t₁} c₁ c₂) = let _ , c , st' = st y c₂ in _ , c₁ ⊕ c , ⟪ Enum _ [ Find' {t₁ +ᵤ _} (inj₂ $ resolve st') ]⟫ st (x , y) (id↔ ⊗ id↔) = _ , id↔ , ⟪ Enum _ [ Find' (x , y) ]⟫ st (x , y) (id↔ ⊗ c₂) = let _ , c , st' = st y c₂ in _ , id↔ ⊗ c , ⟪ Enum _ [ Find' (x , resolve st') ]⟫ st (x , y) (c₁ ⊗ c₂) = let _ , c , st' = st x c₁ in _ , c ⊗ c₂ , ⟪ Enum _ [ Find' (resolve st' , y) ]⟫ step : {A B : 𝕌} (c : A ↔ B) → State A → Σ[ C ∈ 𝕌 ] (C ↔ B × State C) step c ⟪ v [ i ]⟫ = st (lookup v i) c data State' : Set where ⟪_∥_[_]⟫ : {A B : 𝕌} → A ↔ B → Vec ⟦ A ⟧ ∣ A ∣ → Fin ∣ A ∣ → State' step' : State' → State' step' ⟪ c ∥ v [ i ]⟫ with step c ⟪ v [ i ]⟫ step' ⟪ c ∥ v [ i ]⟫ | _ , c' , ⟪ v' [ i' ]⟫ = ⟪ c' ∥ v' [ i' ]⟫ run : (n : ℕ) → State' → Vec State' (suc n) run 0 st = [ st ] run (suc n) st with run n st ... | sts with last sts ... | ⟪ cx ∥ vx [ ix ]⟫ rewrite +-comm 1 (suc n) = sts ++ [ step' ⟪ cx ∥ vx [ ix ]⟫ ] ex₁ : Vec State' 33 ex₁ = run 32 ⟪ id' ∥ Enum 𝟚 [ Fin.fromℕ 1 ]⟫
programs/oeis/299/A299017.asm
neoneye/loda
22
172449
<reponame>neoneye/loda ; A299017: Intersection of A264041 and A000217. ; 1,3,6,10,21,36,55,78,105,136,171,210,253,300,351 mov $2,$0 add $0,2 sub $2,1 trn $2,2 add $0,$2 bin $0,2
oeis/192/A192386.asm
neoneye/loda-programs
11
240750
<reponame>neoneye/loda-programs<filename>oeis/192/A192386.asm ; A192386: Constant term of the reduction by x^2->x+1 of the polynomial p(n,x) defined below in Comments. ; Submitted by <NAME> ; 1,0,8,8,96,224,1408,4608,22784,86016,386048,1548288,6676480,27467776,116490240,484409344,2040135680,8521777152,35786063872,149761818624,628140015616,2630784909312,11028578435072,46205266558976,193656954814464 mov $2,$0 seq $0,192232 ; Constant term of the reduction of n-th Fibonacci polynomial by x^2 -> x+1. (See Comments.) lpb $2 mul $0,2 sub $2,1 lpe
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_726.asm
ljhsiun2/medusa
9
29902
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r15 push %r8 push %rbp push %rcx push %rdi push %rsi lea addresses_WT_ht+0xacdc, %rsi lea addresses_UC_ht+0xf60c, %rdi clflush (%rsi) nop xor $6678, %r14 mov $127, %rcx rep movsb nop dec %r10 lea addresses_A_ht+0x18ddc, %rsi lea addresses_WT_ht+0x6ddc, %rdi clflush (%rsi) nop nop nop xor $36545, %r8 mov $19, %rcx rep movsl add %rcx, %rcx lea addresses_WT_ht+0x18968, %rcx nop nop nop nop nop cmp $33025, %rbp mov $0x6162636465666768, %r8 movq %r8, %xmm5 movups %xmm5, (%rcx) inc %rdi lea addresses_D_ht+0x11cef, %rcx nop nop nop nop nop dec %r8 mov (%rcx), %r10w sub $34158, %rdi lea addresses_normal_ht+0x1365c, %rbp nop nop add $15485, %r14 mov (%rbp), %r8w add %r14, %r14 lea addresses_D_ht+0x1c3dc, %rsi lea addresses_A_ht+0x38dc, %rdi nop nop nop nop nop inc %r15 mov $76, %rcx rep movsl xor $49359, %r15 lea addresses_A_ht+0x9ddc, %rsi lea addresses_A_ht+0x10288, %rdi nop nop nop nop nop sub %r8, %r8 mov $51, %rcx rep movsl nop nop cmp $52997, %r15 lea addresses_UC_ht+0x89dc, %r10 nop add $7, %rsi mov (%r10), %r14 nop nop mfence lea addresses_D_ht+0x4ddc, %rdi clflush (%rdi) nop nop nop nop sub $24983, %rbp movb $0x61, (%rdi) nop nop inc %rbp lea addresses_UC_ht+0x5fdc, %r14 cmp %r10, %r10 mov (%r14), %rcx and $4074, %rbp lea addresses_D_ht+0x6b2c, %r14 nop nop nop nop nop cmp %rcx, %rcx movw $0x6162, (%r14) nop inc %r8 lea addresses_UC_ht+0x7ddc, %r10 cmp $27930, %r15 vmovups (%r10), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $0, %xmm7, %r8 nop cmp %r8, %r8 pop %rsi pop %rdi pop %rcx pop %rbp pop %r8 pop %r15 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r15 push %r8 push %r9 push %rcx push %rdi // Load lea addresses_normal+0x17ea3, %rcx nop add $5028, %r13 movaps (%rcx), %xmm7 vpextrq $1, %xmm7, %r9 add %r13, %r13 // Store lea addresses_WT+0x204c, %r12 nop nop nop nop nop and $34626, %r15 mov $0x5152535455565758, %r9 movq %r9, %xmm3 movups %xmm3, (%r12) xor $681, %r15 // Store lea addresses_normal+0x85dc, %rcx nop nop add $10009, %r8 movw $0x5152, (%rcx) nop nop nop xor $12238, %rdi // Faulty Load lea addresses_RW+0x1d5dc, %r13 nop nop nop and $21157, %r12 movb (%r13), %r15b lea oracles, %rcx and $0xff, %r15 shlq $12, %r15 mov (%rcx,%r15,1), %r15 pop %rdi pop %rcx pop %r9 pop %r8 pop %r15 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': True, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 7, 'size': 2, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 1, 'size': 16, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': True, 'congruent': 7, 'size': 2, 'same': True, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 7, 'size': 32, 'same': False, 'NT': False}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
oeis/293/A293329.asm
neoneye/loda-programs
11
80236
<gh_stars>10-100 ; A293329: The integer k that minimizes |k/2^n - sqrt(1/3))|. ; Submitted by <NAME> ; 1,1,2,5,9,18,37,74,148,296,591,1182,2365,4730,9459,18919,37837,75674,151349,302698,605396,1210791,2421583,4843165,9686330,19372660,38745321,77490641,154981283,309962566,619925131,1239850262,2479700525,4959401049,9918802098,19837604196,39675208392,79350416784,158700833568,317401667137,634803334274,1269606668547,2539213337094,5078426674189,10156853348378,20313706696755,40627413393510,81254826787020,162509653574041,325019307148082,650038614296164,1300077228592327,2600154457184654,5200308914369308 add $0,1 seq $0,293328 ; Least integer k such that k/2^n > sqrt(1/3). add $0,2 div $0,2 sub $0,1
Kernel/asm/iHandler.asm
nicodonof/SoundblasterOS
0
101168
GLOBAL timerHandler GLOBAL keyboardHandler GLOBAL syscallHandlerA GLOBAL picMasterMask GLOBAL picSlaveMask GLOBAL _sti GLOBAL _cli GLOBAL _EOI GLOBAL _iretq extern write_key extern keyboarddddd extern syscallHandler extern schedulerToKernel extern schedulerToUser extern processNext extern getQuantum extern decQuantum %macro pusha 0 push rax push rbx push rcx push rdx push rbp push rdi push rsi push r8 push r9 push r10 push r11 push r12 push r13 push r14 push r15 push fs push gs %endmacro %macro popa 0 pop gs pop fs pop r15 pop r14 pop r13 pop r12 pop r11 pop r10 pop r9 pop r8 pop rsi pop rdi pop rbp pop rdx pop rcx pop rbx pop rax %endmacro timerHandler: pusha call keyboarddddd call getQuantum cmp rax, 0 jne _leave_current mov rdi, rsp call schedulerToKernel mov rsp, rax call processNext call schedulerToUser mov rsp, rax call _EOI popa iretq _leave_current: call decQuantum call _EOI popa iretq keyboardHandler: pusha mov rax, 0 in al,60h mov rdi, rax call _EOI call write_key popa iretq syscallHandlerA: pusha call syscallHandler popa iretq picMasterMask: push rbp mov rbp, rsp mov ax, di out 21h,al pop rbp ret picSlaveMask: push rbp mov rbp, rsp mov ax, di ; ax = mascara de 16 bits out 0A1h,al pop rbp ret _sti: sti ret _cli: cli ret _EOI: mov rax, 0 mov al, 0x20 out 0x20, al ret
src/fltk-widgets-groups-scrolls.adb
micahwelf/FLTK-Ada
1
20321
with Interfaces.C, System; use type System.Address; package body FLTK.Widgets.Groups.Scrolls is procedure scroll_set_draw_hook (S, D : in System.Address); pragma Import (C, scroll_set_draw_hook, "scroll_set_draw_hook"); pragma Inline (scroll_set_draw_hook); procedure scroll_set_handle_hook (S, H : in System.Address); pragma Import (C, scroll_set_handle_hook, "scroll_set_handle_hook"); pragma Inline (scroll_set_handle_hook); function new_fl_scroll (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_scroll, "new_fl_scroll"); pragma Inline (new_fl_scroll); procedure free_fl_scroll (S : in System.Address); pragma Import (C, free_fl_scroll, "free_fl_scroll"); pragma Inline (free_fl_scroll); procedure fl_scroll_clear (S : in System.Address); pragma Import (C, fl_scroll_clear, "fl_scroll_clear"); pragma Inline (fl_scroll_clear); procedure fl_scroll_to (S : in System.Address; X, Y : in Interfaces.C.int); pragma Import (C, fl_scroll_to, "fl_scroll_to"); pragma Inline (fl_scroll_to); procedure fl_scroll_set_type (S : in System.Address; T : in Interfaces.C.int); pragma Import (C, fl_scroll_set_type, "fl_scroll_set_type"); pragma Inline (fl_scroll_set_type); function fl_scroll_get_size (S : in System.Address) return Interfaces.C.int; pragma Import (C, fl_scroll_get_size, "fl_scroll_get_size"); pragma Inline (fl_scroll_get_size); procedure fl_scroll_set_size (S : in System.Address; T : in Interfaces.C.int); pragma Import (C, fl_scroll_set_size, "fl_scroll_set_size"); pragma Inline (fl_scroll_set_size); function fl_scroll_xposition (S : in System.Address) return Interfaces.C.int; pragma Import (C, fl_scroll_xposition, "fl_scroll_xposition"); pragma Inline (fl_scroll_xposition); function fl_scroll_yposition (S : in System.Address) return Interfaces.C.int; pragma Import (C, fl_scroll_yposition, "fl_scroll_yposition"); pragma Inline (fl_scroll_yposition); procedure fl_scroll_draw (S : in System.Address); pragma Import (C, fl_scroll_draw, "fl_scroll_draw"); pragma Inline (fl_scroll_draw); function fl_scroll_handle (S : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_scroll_handle, "fl_scroll_handle"); pragma Inline (fl_scroll_handle); procedure Finalize (This : in out Scroll) is begin if This.Void_Ptr /= System.Null_Address and then This in Scroll'Class then This.Clear; free_fl_scroll (This.Void_Ptr); This.Void_Ptr := System.Null_Address; end if; Finalize (Group (This)); end Finalize; package body Forge is function Create (X, Y, W, H : in Integer; Text : in String) return Scroll is begin return This : Scroll do This.Void_Ptr := new_fl_scroll (Interfaces.C.int (X), Interfaces.C.int (Y), Interfaces.C.int (W), Interfaces.C.int (H), Interfaces.C.To_C (Text)); fl_group_end (This.Void_Ptr); fl_widget_set_user_data (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); scroll_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); scroll_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; end Forge; procedure Clear (This : in out Scroll) is begin fl_scroll_clear (This.Void_Ptr); end Clear; procedure Scroll_To (This : in out Scroll; X, Y : in Integer) is begin fl_scroll_to (This.Void_Ptr, Interfaces.C.int (X), Interfaces.C.int (Y)); end Scroll_To; procedure Set_Type (This : in out Scroll; Mode : in Scroll_Kind) is begin fl_scroll_set_type (This.Void_Ptr, Scroll_Kind'Pos (Mode)); end Set_Type; function Get_Scrollbar_Size (This : in Scroll) return Integer is begin return Integer (fl_scroll_get_size (This.Void_Ptr)); end Get_Scrollbar_Size; procedure Set_Scrollbar_Size (This : in out Scroll; To : in Integer) is begin fl_scroll_set_size (This.Void_Ptr, Interfaces.C.int (To)); end Set_Scrollbar_Size; function Get_Scroll_X (This : in Scroll) return Integer is begin return Integer (fl_scroll_xposition (This.Void_Ptr)); end Get_Scroll_X; function Get_Scroll_Y (This : in Scroll) return Integer is begin return Integer (fl_scroll_yposition (This.Void_Ptr)); end Get_Scroll_Y; procedure Draw (This : in out Scroll) is begin fl_scroll_draw (This.Void_Ptr); end Draw; function Handle (This : in out Scroll; Event : in Event_Kind) return Event_Outcome is begin return Event_Outcome'Val (fl_scroll_handle (This.Void_Ptr, Event_Kind'Pos (Event))); end Handle; end FLTK.Widgets.Groups.Scrolls;
src/Categories/Category/Instance/Quivers.agda
Trebor-Huang/agda-categories
279
13141
{-# OPTIONS --without-K --safe #-} module Categories.Category.Instance.Quivers where -- The Category of Quivers open import Level using (Level; suc; _⊔_) open import Relation.Binary.PropositionalEquality.Core using (refl) open import Data.Quiver using (Quiver) open import Data.Quiver.Morphism using (Morphism; id; _∘_; _≃_; ≃-Equivalence; ≃-resp-∘) open import Categories.Category.Core using (Category) private variable o ℓ e o′ ℓ′ e′ : Level Quivers : ∀ o ℓ e → Category (suc (o ⊔ ℓ ⊔ e)) (o ⊔ ℓ ⊔ e) (o ⊔ ℓ ⊔ e) Quivers o ℓ e = record { Obj = Quiver o ℓ e ; _⇒_ = Morphism ; _≈_ = _≃_ ; id = id ; _∘_ = _∘_ ; assoc = λ {_ _ _ G} → record { F₀≡ = refl ; F₁≡ = Equiv.refl G } ; sym-assoc = λ {_ _ _ G} → record { F₀≡ = refl ; F₁≡ = Equiv.refl G } ; identityˡ = λ {_ G} → record { F₀≡ = refl ; F₁≡ = Equiv.refl G } ; identityʳ = λ {_ G} → record { F₀≡ = refl ; F₁≡ = Equiv.refl G } ; identity² = λ {G} → record { F₀≡ = refl ; F₁≡ = Equiv.refl G } ; equiv = ≃-Equivalence ; ∘-resp-≈ = ≃-resp-∘ } where open Quiver using (module Equiv)
T4P1/Branch/GregAsm.asm
cggewehr/Projeto-De-Processadores
0
8540
.org #0000h ; Code start .code ; ----------------------- INICIALIZAÇÕES DAS PORTAS E ENDEREÇOS ------------------- boot: ldh r0, #03h ldl r0, #52h ; ldsp r0 ; SP <= 01AEh xor r0, r0, r0 ; r0 <= 0 xor r7, r7, r7 ; retorno para as funções ; PortA addresses ldh r1, #80h ldl r1, #00h ; PortDataA_ADDR ldh r2, #80h ldl r2, #01h ; PortConfigA_ADDR ldh r3, #80h ldl r3, #02h ; PortEnableA_ADDR ; PortB addresses ldh r4, #90h ldl r4, #00h ; PortDataB_ADDR ldh r5, #90h ldl r5, #01h ; PortConfigB_ADDR ldh r6, #90h ldl r6, #02h ; PortEnableB_ADDR ldh r7, #90h ldl r7, #03h ; IRQ_ENABLE_ADDR ldh r15, #address_PortData_A ldl r15, #address_PortData_A st r1, r15, r0 ; address_PortData_A ldh r15, #address_PortData_B ldl r15, #address_PortData_B st r4, r15, r0 ; address_PortData_B ldh r15, #address_PortConfig_A ldl r15, #address_PortConfig_A st r2, r15, r0 ; address_PortData_A ldh r15, #address_PortConfig_B ldl r15, #address_PortConfig_B st r5, r15, r0 ; address_PortData_B ldh r15, #44h ldl r15, #FFh ; PortConfig <= 0100 0100 1111 1111 st r15, r2, r0 ; PortConfigA <= 0111 0100 1111 1111 ldh r15, #74h ldl r15, #FFh ; PortConfig <= 0111 0100 1111 1111 st r15, r5, r0 ; PortConfigB <= 0111 0100 1111 1111 st r0, r1, r0 ; PortData_A <= 0000h st r0, r4, r0 ; PortData_B <= 0000h ldh r15, #30h ; 00110000 ldl r15, #00h ; st r15, r7, r0 ; irqEnable_PortB ; enable PortA and PortB ldh r15, #CCh ldl r15, #FFh st r15, r3, r0 ; PortEnable_A <= 1100 1100 11111111 ldh r15, #FCh st r15, r6, r0 ; PortEnable_B <= 1111 1100 11111111 ; RANDOM NUMBER INICIALIZATION ldh r15, #random_number ldl r15, #random_number xor r3, r3, r3 ; r3 <= 0 ; random number st r3, r15, r0 ; random_number ; INTERRUPT MASK INICIALIZATION ldh r15, #A0h ldl r15, #02h ldh r14, #00h ldl r14, #30h st r14, r15, r0 ; MASK_INTERRUPT <= 0011 0000 ; ISR INICIALIZATION ldh r15, #00h ldl r15, #3Ch ldisra r15 jmpd #BubbleSort InterruptionServiceRoutine: ; salvamento de contexto push r0 push r1 push r2 push r3 push r4 push r5 push r6 push r7 push r8 push r9 push r10 push r11 push r12 push r13 push r14 push r15 pushf ; identificação da origem da interrupcao xor r0, r0, r0 ldh r1, #A0h ldl r1, #00h ; endereco PIC IRQ_ID_ADDR ld r1, r1, r0 ; interrupcao codificada ldh r3, #interrupt_vector ldl r3, #interrupt_vector ld r2, r3, r1 ; r2 <= endereco do handler jsr r2 xor r0, r0, r0 ldh r1, #A0h ldl r1, #00h ; endereco PIC IRQ_ID_ADDR ld r1, r1, r0 ; interrupcao codificada ldh r2, #A0h ldl r2, #01h ; r2 <= INT_ACK_ADDR st r1, r2, r0 ; INT_ACK_ADDR <= r1 (instrucao codificada) ; recuperacao de contexto recupera_contexto: popf pop r15 pop r14 pop r13 pop r12 pop r11 pop r10 pop r9 pop r8 pop r7 pop r6 pop r5 pop r4 pop r3 pop r2 pop r1 pop r0 rti ; ---------------------------------------- INICIO CRYPTO1 --------------------------------------------- Crypto1_handler: ; carregar endereços dos regs jsrd #bitmask_init ldh r1, #address_PortData_A ldl r1, #address_PortData_A ld r1, r1, r0 ; r1 <= address_PortData_A ldh r2, #address_PortConfig_A ldl r2, #address_PortConfig_A ld r2, r2, r0 ; r2 <= address_PortConfig_A ldh r3, #random_number ldl r3, #random_number ld r3, r3, r0 ; r3 <= random_number jsrd #testa_crypto jsrd #calcula_chave ; chave em r7 ou em #chave xor r6, r6, r6 ; r6 <= contador de caracteres le_caractere_crypto1: ldl r4, #buffer_caract ldh r4, #buffer_caract st r0, r4, r0 ; zera o buffer_caract jsrd #le_caractere_crypto ; le o caractere 1 jsrd #verifica_fim_mensagem jmpzd #move_data_up_crypto1 jmpd #guarda_caractere_crypto1 move_data_up_crypto1: jsrd #move_data_up_crypto jsrd #le_caractere_crypto ; le o caractere2 guarda_caractere_crypto1: ldh r5, #msg_c1 ; ldl r5, #msg_c1 ; r5 <= ponteiro para a variavel ldh r4, #buffer_caract ldl r4, #buffer_caract ld r8, r4, r0 ; r8 <= buffer_caract st r8, r5, r6 ; grava na memória addi r6, #1 ; r6++ jsrd #verifica_fim_mensagem jmpzd #le_caractere_crypto1 fim_mensagem_crypto_1: rts ; ------------------------------------- FIM CRYPTO1 ------------------------------------------------- ; ------------------------------------- INICIO CRYPTO2 ---------------------------------------------- Crypto2_handler: ; carregar endereços dos regs jsrd #bitmask_init ldh r1, #address_PortData_B ldl r1, #address_PortData_B ld r1, r1, r0 ; r1 <= address_PortData_B ldh r2, #address_PortConfig_B ldl r2, #address_PortConfig_B ld r2, r2, r0 ; r2 <= address_PortConfig_B ldh r3, #random_number ldl r3, #random_number ld r3, r3, r0 ; r3 <= random_number jsrd #testa_crypto jsrd #calcula_chave ; chave em r7 ou em #chave xor r6, r6, r6 ; r6 <= contador de caracteres le_caractere_crypto2: ldl r4, #buffer_caract ldh r4, #buffer_caract st r0, r4, r0 ; zera o buffer_caract jsrd #le_caractere_crypto ; le o caractere 1 jsrd #verifica_fim_mensagem jmpzd #move_data_up_crypto2 jmpd #guarda_caractere_crypto2 move_data_up_crypto2: jsrd #move_data_up_crypto jsrd #le_caractere_crypto ; le o caractere2 guarda_caractere_crypto2: ldh r5, #msg_c2 ; ldl r5, #msg_c2 ; r5 <= ponteiro para a variavel ldh r4, #buffer_caract ldl r4, #buffer_caract ld r8, r4, r0 ; r8 <= buffer_caract st r8, r5, r6 ; grava na memória addi r6, #1 ; r6++ jsrd #verifica_fim_mensagem jmpzd #le_caractere_crypto2 fim_mensagem_crypto_2: rts ; ---------------------------------- FUNÇÕES GERAIS DA APLICAÇÃO ---------------------------------- ; finds a^b mod q ; receives r6 as "a" ; receives r3 as "b" ; receives r5 as "q" ; returns the answer in "r7" register exp_mod: push r1 ldh r4, #00h ldl r4, #80h ; bitmask para testes ldh r7, #00h ldl r7, #01h ; resposta <= 1 addi r4, #00h loop: jmpzd #fim_find_key mul r7, r7 mfl r7 ; r7 <= r7^2 div r7, r5 mfh r7 ; r7 <= r7^2 mod q and r1, r4, r3 jmpzd #continue_loop multiplica: mul r7, r6 mfl r7 ; r7 <= r7 * a div r7, r5 mfh r7 ; r7 <= r7 * a mod q continue_loop: SR0 r4, r4 jmpd #loop fim_find_key: ;resposta em r7 pop r1 rts ; r8 is the in and out ; move the lower bits to the higher part move_high: push r6 ldl r6, #08h ldh r6, #00h addi r6, #0 shift: ; shift left de 8 bits jmpzd #continue_move sl0 r8, r8 subi r6, #1 jmpd #shift continue_move: pop r6 rts ; verifica o numero aleatorio e garante que ele é menor que 251 ; r3 in/out verifica_num_alet: push r5 ldh r5, #00h ldl r5, #FBh sub r5, r3, r5 jmpzd #reinicia_numero pop r5 rts reinicia_numero: ldh r3, #00h ldl r3, #00h pop r5 rts bitmask_init: ldh r10, #00h ldl r10, #FFh ; r10 <= bitmask para data_in(crypto) -- LOW BYTE MASK ldh r11, #FFh ldl r11, #00h ; r11 <= HIGH BYTE MASK ldh r12, #80h ldl r12, #00h ; r12 <= bitmask para ack ldh r13, #08h ldl r13, #00h ; r13 <= bitmask para in/out ldh r14, #40h ldl r14, #00h ; r14 <= bitmask para data_av ldh r15, #04h ldl r15, #00h ; r15 <= bitmask para eom 0000 0100 0000 0000 rts ; magicNumber retornado em r7 e guardado em magicNumberFromProcessor calcula_magic_number: ; prepara para a chamada de exp_mod (parametros) ldh r3, #random_number ldl r3, #random_number ld r3, r3, r0 ; r3 <= random_number ldh r5, #00h ldl r5, #FBh ; q <= 251 ldh r6, #00h ldl r6, #06h ; a <= 6 jsrd #verifica_num_alet addi r3, #1 ; incrementa o numero aleatorio ldh r4, #random_number ldl r4, #random_number st r3, r4, r0 ; guarda o novo valor de random_number jsrd #exp_mod ; resposta retornada em r7 => magicNumberFromProcessor ldh r4, #magicNumberFromProcessor ldl r4, #magicNumberFromProcessor st r7, r4, r0 ; magicNumberFromProcessor <= r7 ; magicNumber do processador em r7 ld r4, r1, r0 or r4, r4, r13 ; seta o bit para o tristate st r4, r1, r0 ld r4, r2, r0 ; r4 <= PortConfig and r4, r4, r11 ; r4 <= Porta vira saida st r4, r2, r0 ; PortA(7:0) => saida or r5, r7, r13 ; seta o magicNumber e o bit do tristate or r5, r5, r12 ; seta ack st r5, r1, r0 ; PortData <= MagicNumber + ack + tristate_signal xor r5, r5, r12 ; desativa o ack st r5, r1, r0 ; desativa o ack ld r4, r2, r0 ; r4 <= PortConfig or r4, r10, r4 ; st r4, r2, r0 ; Port(7:0) => entrada xor r4, r4, r4 ; st r4, r1, r0 ; desativa o tristate rts ; pega o magicNumber do crypto e calcula o magicNumber do processador testa_crypto: ld r8, r1, r0 ; r8 <= PortData and r8, r8, r10 ; BITS do magic number do Crypto ldh r4, #magicNumberFromCrypto ldl r4, #magicNumberFromCrypto st r8, r4, r0 ; magicNumberFromCrypto <= magicNumberFromCrypto ; calcula_magic_number jsrd #calcula_magic_number rts calcula_chave: ldh r3, #random_number ldl r3, #random_number ld r3, r3, r0 ; r3 <= random_number ldh r4, #magicNumberFromCrypto ldl r4, #magicNumberFromCrypto ld r6, r4, r0 ; r6 <= MagicNumber do crypto A ldh r5, #00h ldl r5, #FBh ; r5 <= q (251) jsrd #exp_mod ; chave em r7 ldh r4, #chave ldl r4, #chave st r7, r4, r0 rts le_caractere_crypto: ld r4, r1, r0 ; r4 <= PortData_A and r5, r14, r4 JMPZD #le_caractere_crypto ; pooling enquanto o caractere nao esta pronto ldh r5, #buffer_leitura ldl r5, #buffer_leitura st r4, r5, r0 ; buffer_leitura <= r4 or r5, r4, r12 ; st r5, r1, r0 ; pulso em ack xor r5, r5, r12 ; st r5, r1, r0 ; limpa o ack and r8, r4, r10 ; limpa a parte alta de PortDataA xor r8, r7, r8 ; descriptografa a mensagem ldh r5, #buffer_caract ldl r5, #buffer_caract ld r4, r5, r0 ; r4 <= buffer_caract or r8, r4, r8 ; r8 <= r4 or r8 st r8, r5, r0 ; buffer <= mensagem descriptografada rts move_data_up_crypto: ldh r5, #buffer_caract ldl r5, #buffer_caract ld r8, r5, r0 ; r8 <= buffer_caract jsrd #move_high ; r8 <= caractere (parte alta) st r8, r5, r0 ; buffer_caract <= r8 << 8 rts verifica_fim_mensagem: ldh r5, #buffer_leitura ldl r5, #buffer_leitura ld r4, r5, r0 ; r4 <= buffer_leitura and r4, r15, r4 ; verifica fim da mensagem rts ; ----------------------------- BUBBLESORT --------------------------------------------------------- BubbleSort: ; Initialization code xor r0, r0, r0 ; r0 <- 0 ldh r1, #array ; ldl r1, #array ; r1 <- &array ldh r2, #size ; ldl r2, #size ; r2 <- &size ld r2, r2, r0 ; r2 <- size add r3, r2, r1 ; r3 points the end of array (right after the last element) ldl r4, #0 ; ldh r4, #1 ; r4 <- 1 ; Main code scan: addi r4, #0 ; Verifies if there was element swaping jmpzd #end ; If r4 = 0 then no element swaping xor r4, r4, r4 ; r4 <- 0 before each pass add r5, r1, r0 ; r5 points the first arrar element add r6, r1, r0 ; addi r6, #1 ; r6 points the second array element ; Read two consecutive elements and compares them loop_bubble: ld r7, r5, r0 ; r7 <- array[r5] ld r8, r6, r0 ; r8 <- array[r6] sub r2, r8, r7 ; If r8 > r7, negative flag is set jmpnd #swap ; (if array[r5] > array[r6] jump) ; Increments the index registers and verifies is the pass is concluded continue: addi r5, #1 ; r5++ addi r6, #1 ; r6++ sub r2, r6, r3 ; Verifies if the end of array was reached (r6 = r3) jmpzd #scan ; If r6 = r3 jump jmpd #loop_bubble ; else, the next two elements are compared ; Swaps two array elements (memory) swap: st r7, r6, r0 ; array[r6] <- r7 st r8, r5, r0 ; array[r5] <- r8 ldl r4, #1 ; Set the element swaping (r4 <- 1) jmpd #continue end: halt ; Suspend the execution .endcode ; Data area (variables) .data address_PortData_A: db #00h address_PortData_B: db #00h address_PortConfig_A: db #00h address_PortConfig_B: db #00h buffer_caract: db #00h buffer_leitura: db #00h random_number: db #00h chave: db #00h magicNumberFromProcessor: db #00h magicNumberFromCrypto: db #00h msg_c1: db #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h msg_c2: db #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h, #00h array: db #50h, #49h, #48h, #47h, #46h, #45h, #44h, #43h, #42h, #41h, #40h, #39h, #38h, #37h, #36h, #35h, #34h, #33h, #32h, #31h, #30h, #29h, #28h, #27h, #26h, #25h, #24h, #23h, #22h, #21h, #20h, #19h, #18h, #17h, #16h, #15h, #14h, #13h, #12h, #11h, #10h, #9h, #8h, #7h, #6h, #5h, #4h, #3h, #2h, #1h size: db #32h ; 'array' size interrupt_vector: db #0, #0, #0, #0, #Crypto1_handler, #Crypto2_handler, #0, #0 .enddata
prototyping/Properties/TypeSaturation.agda
Libertus-Lab/luau
1
5723
{-# OPTIONS --rewriting #-} module Properties.TypeSaturation where open import Agda.Builtin.Equality using (_≡_; refl) open import FFI.Data.Either using (Either; Left; Right) open import Luau.Subtyping using (Tree; Language; ¬Language; _<:_; _≮:_; witness; scalar; function; function-err; function-ok; function-ok₁; function-ok₂; scalar-function; _,_; never) open import Luau.Type using (Type; _⇒_; _∩_; _∪_; never; unknown) open import Luau.TypeNormalization using (_∩ⁿ_; _∪ⁿ_) open import Luau.TypeSaturation using (_⋓_; _⋒_; _∩ᵘ_; _∩ⁱ_; ∪-saturate; ∩-saturate; saturate) open import Properties.Subtyping using (dec-language; language-comp; <:-impl-⊇; <:-refl; <:-trans; <:-trans-≮:; <:-impl-¬≮: ; <:-never; <:-unknown; <:-function; <:-union; <:-∪-symm; <:-∪-left; <:-∪-right; <:-∪-lub; <:-∪-assocl; <:-∪-assocr; <:-intersect; <:-∩-symm; <:-∩-left; <:-∩-right; <:-∩-glb; ≮:-function-left; ≮:-function-right; <:-function-∩-∪; <:-function-∩-∩; <:-∩-assocl; <:-∩-assocr; ∩-<:-∪; <:-∩-distl-∪; ∩-distl-∪-<:; <:-∩-distr-∪; ∩-distr-∪-<:) open import Properties.TypeNormalization using (Normal; FunType; _⇒_; _∩_; _∪_; never; unknown; normal-∪ⁿ; normal-∩ⁿ; ∪ⁿ-<:-∪; ∪-<:-∪ⁿ; ∩ⁿ-<:-∩; ∩-<:-∩ⁿ) open import Properties.Contradiction using (CONTRADICTION) open import Properties.Functions using (_∘_) -- Saturation preserves normalization normal-⋒ : ∀ {F G} → FunType F → FunType G → FunType (F ⋒ G) normal-⋒ (R ⇒ S) (T ⇒ U) = (normal-∩ⁿ R T) ⇒ (normal-∩ⁿ S U) normal-⋒ (R ⇒ S) (G ∩ H) = normal-⋒ (R ⇒ S) G ∩ normal-⋒ (R ⇒ S) H normal-⋒ (E ∩ F) G = normal-⋒ E G ∩ normal-⋒ F G normal-⋓ : ∀ {F G} → FunType F → FunType G → FunType (F ⋓ G) normal-⋓ (R ⇒ S) (T ⇒ U) = (normal-∪ⁿ R T) ⇒ (normal-∪ⁿ S U) normal-⋓ (R ⇒ S) (G ∩ H) = normal-⋓ (R ⇒ S) G ∩ normal-⋓ (R ⇒ S) H normal-⋓ (E ∩ F) G = normal-⋓ E G ∩ normal-⋓ F G normal-∩-saturate : ∀ {F} → FunType F → FunType (∩-saturate F) normal-∩-saturate (S ⇒ T) = S ⇒ T normal-∩-saturate (F ∩ G) = (normal-∩-saturate F ∩ normal-∩-saturate G) ∩ normal-⋒ (normal-∩-saturate F) (normal-∩-saturate G) normal-∪-saturate : ∀ {F} → FunType F → FunType (∪-saturate F) normal-∪-saturate (S ⇒ T) = S ⇒ T normal-∪-saturate (F ∩ G) = (normal-∪-saturate F ∩ normal-∪-saturate G) ∩ normal-⋓ (normal-∪-saturate F) (normal-∪-saturate G) normal-saturate : ∀ {F} → FunType F → FunType (saturate F) normal-saturate F = normal-∪-saturate (normal-∩-saturate F) -- Saturation resects subtyping ∪-saturate-<: : ∀ {F} → FunType F → ∪-saturate F <: F ∪-saturate-<: (S ⇒ T) = <:-refl ∪-saturate-<: (F ∩ G) = <:-trans <:-∩-left (<:-intersect (∪-saturate-<: F) (∪-saturate-<: G)) ∩-saturate-<: : ∀ {F} → FunType F → ∩-saturate F <: F ∩-saturate-<: (S ⇒ T) = <:-refl ∩-saturate-<: (F ∩ G) = <:-trans <:-∩-left (<:-intersect (∩-saturate-<: F) (∩-saturate-<: G)) saturate-<: : ∀ {F} → FunType F → saturate F <: F saturate-<: F = <:-trans (∪-saturate-<: (normal-∩-saturate F)) (∩-saturate-<: F) ∩-<:-⋓ : ∀ {F G} → FunType F → FunType G → (F ∩ G) <: (F ⋓ G) ∩-<:-⋓ (R ⇒ S) (T ⇒ U) = <:-trans <:-function-∩-∪ (<:-function (∪ⁿ-<:-∪ R T) (∪-<:-∪ⁿ S U)) ∩-<:-⋓ (R ⇒ S) (G ∩ H) = <:-trans (<:-∩-glb (<:-intersect <:-refl <:-∩-left) (<:-intersect <:-refl <:-∩-right)) (<:-intersect (∩-<:-⋓ (R ⇒ S) G) (∩-<:-⋓ (R ⇒ S) H)) ∩-<:-⋓ (E ∩ F) G = <:-trans (<:-∩-glb (<:-intersect <:-∩-left <:-refl) (<:-intersect <:-∩-right <:-refl)) (<:-intersect (∩-<:-⋓ E G) (∩-<:-⋓ F G)) ∩-<:-⋒ : ∀ {F G} → FunType F → FunType G → (F ∩ G) <: (F ⋒ G) ∩-<:-⋒ (R ⇒ S) (T ⇒ U) = <:-trans <:-function-∩-∩ (<:-function (∩ⁿ-<:-∩ R T) (∩-<:-∩ⁿ S U)) ∩-<:-⋒ (R ⇒ S) (G ∩ H) = <:-trans (<:-∩-glb (<:-intersect <:-refl <:-∩-left) (<:-intersect <:-refl <:-∩-right)) (<:-intersect (∩-<:-⋒ (R ⇒ S) G) (∩-<:-⋒ (R ⇒ S) H)) ∩-<:-⋒ (E ∩ F) G = <:-trans (<:-∩-glb (<:-intersect <:-∩-left <:-refl) (<:-intersect <:-∩-right <:-refl)) (<:-intersect (∩-<:-⋒ E G) (∩-<:-⋒ F G)) <:-∪-saturate : ∀ {F} → FunType F → F <: ∪-saturate F <:-∪-saturate (S ⇒ T) = <:-refl <:-∪-saturate (F ∩ G) = <:-∩-glb (<:-intersect (<:-∪-saturate F) (<:-∪-saturate G)) (<:-trans (<:-intersect (<:-∪-saturate F) (<:-∪-saturate G)) (∩-<:-⋓ (normal-∪-saturate F) (normal-∪-saturate G))) <:-∩-saturate : ∀ {F} → FunType F → F <: ∩-saturate F <:-∩-saturate (S ⇒ T) = <:-refl <:-∩-saturate (F ∩ G) = <:-∩-glb (<:-intersect (<:-∩-saturate F) (<:-∩-saturate G)) (<:-trans (<:-intersect (<:-∩-saturate F) (<:-∩-saturate G)) (∩-<:-⋒ (normal-∩-saturate F) (normal-∩-saturate G))) <:-saturate : ∀ {F} → FunType F → F <: saturate F <:-saturate F = <:-trans (<:-∩-saturate F) (<:-∪-saturate (normal-∩-saturate F)) -- Overloads F is the set of overloads of F data Overloads : Type → Type → Set where here : ∀ {S T} → Overloads (S ⇒ T) (S ⇒ T) left : ∀ {S T F G} → Overloads F (S ⇒ T) → Overloads (F ∩ G) (S ⇒ T) right : ∀ {S T F G} → Overloads G (S ⇒ T) → Overloads (F ∩ G) (S ⇒ T) normal-overload-src : ∀ {F S T} → FunType F → Overloads F (S ⇒ T) → Normal S normal-overload-src (S ⇒ T) here = S normal-overload-src (F ∩ G) (left o) = normal-overload-src F o normal-overload-src (F ∩ G) (right o) = normal-overload-src G o normal-overload-tgt : ∀ {F S T} → FunType F → Overloads F (S ⇒ T) → Normal T normal-overload-tgt (S ⇒ T) here = T normal-overload-tgt (F ∩ G) (left o) = normal-overload-tgt F o normal-overload-tgt (F ∩ G) (right o) = normal-overload-tgt G o -- An inductive presentation of the overloads of F ⋓ G data ∪-Lift (P Q : Type → Set) : Type → Set where union : ∀ {R S T U} → P (R ⇒ S) → Q (T ⇒ U) → -------------------- ∪-Lift P Q ((R ∪ T) ⇒ (S ∪ U)) -- An inductive presentation of the overloads of F ⋒ G data ∩-Lift (P Q : Type → Set) : Type → Set where intersect : ∀ {R S T U} → P (R ⇒ S) → Q (T ⇒ U) → -------------------- ∩-Lift P Q ((R ∩ T) ⇒ (S ∩ U)) -- An inductive presentation of the overloads of ∪-saturate F data ∪-Saturate (P : Type → Set) : Type → Set where base : ∀ {S T} → P (S ⇒ T) → -------------------- ∪-Saturate P (S ⇒ T) union : ∀ {R S T U} → ∪-Saturate P (R ⇒ S) → ∪-Saturate P (T ⇒ U) → -------------------- ∪-Saturate P ((R ∪ T) ⇒ (S ∪ U)) -- An inductive presentation of the overloads of ∩-saturate F data ∩-Saturate (P : Type → Set) : Type → Set where base : ∀ {S T} → P (S ⇒ T) → -------------------- ∩-Saturate P (S ⇒ T) intersect : ∀ {R S T U} → ∩-Saturate P (R ⇒ S) → ∩-Saturate P (T ⇒ U) → -------------------- ∩-Saturate P ((R ∩ T) ⇒ (S ∩ U)) -- The <:-up-closure of a set of function types data <:-Close (P : Type → Set) : Type → Set where defn : ∀ {R S T U} → P (S ⇒ T) → R <: S → T <: U → ------------------ <:-Close P (R ⇒ U) -- F ⊆ᵒ G whenever every overload of F is an overload of G _⊆ᵒ_ : Type → Type → Set F ⊆ᵒ G = ∀ {S T} → Overloads F (S ⇒ T) → Overloads G (S ⇒ T) -- F <:ᵒ G when every overload of G is a supertype of an overload of F _<:ᵒ_ : Type → Type → Set _<:ᵒ_ F G = ∀ {S T} → Overloads G (S ⇒ T) → <:-Close (Overloads F) (S ⇒ T) -- P ⊂: Q when any type in P is a subtype of some type in Q _⊂:_ : (Type → Set) → (Type → Set) → Set P ⊂: Q = ∀ {S T} → P (S ⇒ T) → <:-Close Q (S ⇒ T) -- <:-Close is a monad just : ∀ {P S T} → P (S ⇒ T) → <:-Close P (S ⇒ T) just p = defn p <:-refl <:-refl infixl 5 _>>=_ _>>=ˡ_ _>>=ʳ_ _>>=_ : ∀ {P Q S T} → <:-Close P (S ⇒ T) → (P ⊂: Q) → <:-Close Q (S ⇒ T) (defn p p₁ p₂) >>= P⊂Q with P⊂Q p (defn p p₁ p₂) >>= P⊂Q | defn q q₁ q₂ = defn q (<:-trans p₁ q₁) (<:-trans q₂ p₂) _>>=ˡ_ : ∀ {P R S T} → <:-Close P (S ⇒ T) → (R <: S) → <:-Close P (R ⇒ T) (defn p p₁ p₂) >>=ˡ q = defn p (<:-trans q p₁) p₂ _>>=ʳ_ : ∀ {P S T U} → <:-Close P (S ⇒ T) → (T <: U) → <:-Close P (S ⇒ U) (defn p p₁ p₂) >>=ʳ q = defn p p₁ (<:-trans p₂ q) -- Properties of ⊂: ⊂:-refl : ∀ {P} → P ⊂: P ⊂:-refl p = just p _[∪]_ : ∀ {P Q R S T U} → <:-Close P (R ⇒ S) → <:-Close Q (T ⇒ U) → <:-Close (∪-Lift P Q) ((R ∪ T) ⇒ (S ∪ U)) (defn p p₁ p₂) [∪] (defn q q₁ q₂) = defn (union p q) (<:-union p₁ q₁) (<:-union p₂ q₂) _[∩]_ : ∀ {P Q R S T U} → <:-Close P (R ⇒ S) → <:-Close Q (T ⇒ U) → <:-Close (∩-Lift P Q) ((R ∩ T) ⇒ (S ∩ U)) (defn p p₁ p₂) [∩] (defn q q₁ q₂) = defn (intersect p q) (<:-intersect p₁ q₁) (<:-intersect p₂ q₂) ⊂:-∩-saturate-inj : ∀ {P} → P ⊂: ∩-Saturate P ⊂:-∩-saturate-inj p = defn (base p) <:-refl <:-refl ⊂:-∪-saturate-inj : ∀ {P} → P ⊂: ∪-Saturate P ⊂:-∪-saturate-inj p = just (base p) ⊂:-∩-lift-saturate : ∀ {P} → ∩-Lift (∩-Saturate P) (∩-Saturate P) ⊂: ∩-Saturate P ⊂:-∩-lift-saturate (intersect p q) = just (intersect p q) ⊂:-∪-lift-saturate : ∀ {P} → ∪-Lift (∪-Saturate P) (∪-Saturate P) ⊂: ∪-Saturate P ⊂:-∪-lift-saturate (union p q) = just (union p q) ⊂:-∩-lift : ∀ {P Q R S} → (P ⊂: Q) → (R ⊂: S) → (∩-Lift P R ⊂: ∩-Lift Q S) ⊂:-∩-lift P⊂Q R⊂S (intersect n o) = P⊂Q n [∩] R⊂S o ⊂:-∪-lift : ∀ {P Q R S} → (P ⊂: Q) → (R ⊂: S) → (∪-Lift P R ⊂: ∪-Lift Q S) ⊂:-∪-lift P⊂Q R⊂S (union n o) = P⊂Q n [∪] R⊂S o ⊂:-∩-saturate : ∀ {P Q} → (P ⊂: Q) → (∩-Saturate P ⊂: ∩-Saturate Q) ⊂:-∩-saturate P⊂Q (base p) = P⊂Q p >>= ⊂:-∩-saturate-inj ⊂:-∩-saturate P⊂Q (intersect p q) = (⊂:-∩-saturate P⊂Q p [∩] ⊂:-∩-saturate P⊂Q q) >>= ⊂:-∩-lift-saturate ⊂:-∪-saturate : ∀ {P Q} → (P ⊂: Q) → (∪-Saturate P ⊂: ∪-Saturate Q) ⊂:-∪-saturate P⊂Q (base p) = P⊂Q p >>= ⊂:-∪-saturate-inj ⊂:-∪-saturate P⊂Q (union p q) = (⊂:-∪-saturate P⊂Q p [∪] ⊂:-∪-saturate P⊂Q q) >>= ⊂:-∪-lift-saturate ⊂:-∩-saturate-indn : ∀ {P Q} → (P ⊂: Q) → (∩-Lift Q Q ⊂: Q) → (∩-Saturate P ⊂: Q) ⊂:-∩-saturate-indn P⊂Q QQ⊂Q (base p) = P⊂Q p ⊂:-∩-saturate-indn P⊂Q QQ⊂Q (intersect p q) = (⊂:-∩-saturate-indn P⊂Q QQ⊂Q p [∩] ⊂:-∩-saturate-indn P⊂Q QQ⊂Q q) >>= QQ⊂Q ⊂:-∪-saturate-indn : ∀ {P Q} → (P ⊂: Q) → (∪-Lift Q Q ⊂: Q) → (∪-Saturate P ⊂: Q) ⊂:-∪-saturate-indn P⊂Q QQ⊂Q (base p) = P⊂Q p ⊂:-∪-saturate-indn P⊂Q QQ⊂Q (union p q) = (⊂:-∪-saturate-indn P⊂Q QQ⊂Q p [∪] ⊂:-∪-saturate-indn P⊂Q QQ⊂Q q) >>= QQ⊂Q ∪-saturate-resp-∩-saturation : ∀ {P} → (∩-Lift P P ⊂: P) → (∩-Lift (∪-Saturate P) (∪-Saturate P) ⊂: ∪-Saturate P) ∪-saturate-resp-∩-saturation ∩P⊂P (intersect (base p) (base q)) = ∩P⊂P (intersect p q) >>= ⊂:-∪-saturate-inj ∪-saturate-resp-∩-saturation ∩P⊂P (intersect p (union q q₁)) = (∪-saturate-resp-∩-saturation ∩P⊂P (intersect p q) [∪] ∪-saturate-resp-∩-saturation ∩P⊂P (intersect p q₁)) >>= ⊂:-∪-lift-saturate >>=ˡ <:-∩-distl-∪ >>=ʳ ∩-distl-∪-<: ∪-saturate-resp-∩-saturation ∩P⊂P (intersect (union p p₁) q) = (∪-saturate-resp-∩-saturation ∩P⊂P (intersect p q) [∪] ∪-saturate-resp-∩-saturation ∩P⊂P (intersect p₁ q)) >>= ⊂:-∪-lift-saturate >>=ˡ <:-∩-distr-∪ >>=ʳ ∩-distr-∪-<: ov-language : ∀ {F t} → FunType F → (∀ {S T} → Overloads F (S ⇒ T) → Language (S ⇒ T) t) → Language F t ov-language (S ⇒ T) p = p here ov-language (F ∩ G) p = (ov-language F (p ∘ left) , ov-language G (p ∘ right)) ov-<: : ∀ {F R S T U} → FunType F → Overloads F (R ⇒ S) → ((R ⇒ S) <: (T ⇒ U)) → F <: (T ⇒ U) ov-<: F here p = p ov-<: (F ∩ G) (left o) p = <:-trans <:-∩-left (ov-<: F o p) ov-<: (F ∩ G) (right o) p = <:-trans <:-∩-right (ov-<: G o p) <:ᵒ-impl-<: : ∀ {F G} → FunType F → FunType G → (F <:ᵒ G) → (F <: G) <:ᵒ-impl-<: F (T ⇒ U) F<G with F<G here <:ᵒ-impl-<: F (T ⇒ U) F<G | defn o o₁ o₂ = ov-<: F o (<:-function o₁ o₂) <:ᵒ-impl-<: F (G ∩ H) F<G = <:-∩-glb (<:ᵒ-impl-<: F G (F<G ∘ left)) (<:ᵒ-impl-<: F H (F<G ∘ right)) ⊂:-overloads-left : ∀ {F G} → Overloads F ⊂: Overloads (F ∩ G) ⊂:-overloads-left p = just (left p) ⊂:-overloads-right : ∀ {F G} → Overloads G ⊂: Overloads (F ∩ G) ⊂:-overloads-right p = just (right p) ⊂:-overloads-⋒ : ∀ {F G} → FunType F → FunType G → ∩-Lift (Overloads F) (Overloads G) ⊂: Overloads (F ⋒ G) ⊂:-overloads-⋒ (R ⇒ S) (T ⇒ U) (intersect here here) = defn here (∩-<:-∩ⁿ R T) (∩ⁿ-<:-∩ S U) ⊂:-overloads-⋒ (R ⇒ S) (G ∩ H) (intersect here (left o)) = ⊂:-overloads-⋒ (R ⇒ S) G (intersect here o) >>= ⊂:-overloads-left ⊂:-overloads-⋒ (R ⇒ S) (G ∩ H) (intersect here (right o)) = ⊂:-overloads-⋒ (R ⇒ S) H (intersect here o) >>= ⊂:-overloads-right ⊂:-overloads-⋒ (E ∩ F) G (intersect (left n) o) = ⊂:-overloads-⋒ E G (intersect n o) >>= ⊂:-overloads-left ⊂:-overloads-⋒ (E ∩ F) G (intersect (right n) o) = ⊂:-overloads-⋒ F G (intersect n o) >>= ⊂:-overloads-right ⊂:-⋒-overloads : ∀ {F G} → FunType F → FunType G → Overloads (F ⋒ G) ⊂: ∩-Lift (Overloads F) (Overloads G) ⊂:-⋒-overloads (R ⇒ S) (T ⇒ U) here = defn (intersect here here) (∩ⁿ-<:-∩ R T) (∩-<:-∩ⁿ S U) ⊂:-⋒-overloads (R ⇒ S) (G ∩ H) (left o) = ⊂:-⋒-overloads (R ⇒ S) G o >>= ⊂:-∩-lift ⊂:-refl ⊂:-overloads-left ⊂:-⋒-overloads (R ⇒ S) (G ∩ H) (right o) = ⊂:-⋒-overloads (R ⇒ S) H o >>= ⊂:-∩-lift ⊂:-refl ⊂:-overloads-right ⊂:-⋒-overloads (E ∩ F) G (left o) = ⊂:-⋒-overloads E G o >>= ⊂:-∩-lift ⊂:-overloads-left ⊂:-refl ⊂:-⋒-overloads (E ∩ F) G (right o) = ⊂:-⋒-overloads F G o >>= ⊂:-∩-lift ⊂:-overloads-right ⊂:-refl ⊂:-overloads-⋓ : ∀ {F G} → FunType F → FunType G → ∪-Lift (Overloads F) (Overloads G) ⊂: Overloads (F ⋓ G) ⊂:-overloads-⋓ (R ⇒ S) (T ⇒ U) (union here here) = defn here (∪-<:-∪ⁿ R T) (∪ⁿ-<:-∪ S U) ⊂:-overloads-⋓ (R ⇒ S) (G ∩ H) (union here (left o)) = ⊂:-overloads-⋓ (R ⇒ S) G (union here o) >>= ⊂:-overloads-left ⊂:-overloads-⋓ (R ⇒ S) (G ∩ H) (union here (right o)) = ⊂:-overloads-⋓ (R ⇒ S) H (union here o) >>= ⊂:-overloads-right ⊂:-overloads-⋓ (E ∩ F) G (union (left n) o) = ⊂:-overloads-⋓ E G (union n o) >>= ⊂:-overloads-left ⊂:-overloads-⋓ (E ∩ F) G (union (right n) o) = ⊂:-overloads-⋓ F G (union n o) >>= ⊂:-overloads-right ⊂:-⋓-overloads : ∀ {F G} → FunType F → FunType G → Overloads (F ⋓ G) ⊂: ∪-Lift (Overloads F) (Overloads G) ⊂:-⋓-overloads (R ⇒ S) (T ⇒ U) here = defn (union here here) (∪ⁿ-<:-∪ R T) (∪-<:-∪ⁿ S U) ⊂:-⋓-overloads (R ⇒ S) (G ∩ H) (left o) = ⊂:-⋓-overloads (R ⇒ S) G o >>= ⊂:-∪-lift ⊂:-refl ⊂:-overloads-left ⊂:-⋓-overloads (R ⇒ S) (G ∩ H) (right o) = ⊂:-⋓-overloads (R ⇒ S) H o >>= ⊂:-∪-lift ⊂:-refl ⊂:-overloads-right ⊂:-⋓-overloads (E ∩ F) G (left o) = ⊂:-⋓-overloads E G o >>= ⊂:-∪-lift ⊂:-overloads-left ⊂:-refl ⊂:-⋓-overloads (E ∩ F) G (right o) = ⊂:-⋓-overloads F G o >>= ⊂:-∪-lift ⊂:-overloads-right ⊂:-refl ∪-saturate-overloads : ∀ {F} → FunType F → Overloads (∪-saturate F) ⊂: ∪-Saturate (Overloads F) ∪-saturate-overloads (S ⇒ T) here = just (base here) ∪-saturate-overloads (F ∩ G) (left (left o)) = ∪-saturate-overloads F o >>= ⊂:-∪-saturate ⊂:-overloads-left ∪-saturate-overloads (F ∩ G) (left (right o)) = ∪-saturate-overloads G o >>= ⊂:-∪-saturate ⊂:-overloads-right ∪-saturate-overloads (F ∩ G) (right o) = ⊂:-⋓-overloads (normal-∪-saturate F) (normal-∪-saturate G) o >>= ⊂:-∪-lift (∪-saturate-overloads F) (∪-saturate-overloads G) >>= ⊂:-∪-lift (⊂:-∪-saturate ⊂:-overloads-left) (⊂:-∪-saturate ⊂:-overloads-right) >>= ⊂:-∪-lift-saturate overloads-∪-saturate : ∀ {F} → FunType F → ∪-Saturate (Overloads F) ⊂: Overloads (∪-saturate F) overloads-∪-saturate F = ⊂:-∪-saturate-indn (inj F) (step F) where inj : ∀ {F} → FunType F → Overloads F ⊂: Overloads (∪-saturate F) inj (S ⇒ T) here = just here inj (F ∩ G) (left p) = inj F p >>= ⊂:-overloads-left >>= ⊂:-overloads-left inj (F ∩ G) (right p) = inj G p >>= ⊂:-overloads-right >>= ⊂:-overloads-left step : ∀ {F} → FunType F → ∪-Lift (Overloads (∪-saturate F)) (Overloads (∪-saturate F)) ⊂: Overloads (∪-saturate F) step (S ⇒ T) (union here here) = defn here (<:-∪-lub <:-refl <:-refl) <:-∪-left step (F ∩ G) (union (left (left p)) (left (left q))) = step F (union p q) >>= ⊂:-overloads-left >>= ⊂:-overloads-left step (F ∩ G) (union (left (left p)) (left (right q))) = ⊂:-overloads-⋓ (normal-∪-saturate F) (normal-∪-saturate G) (union p q) >>= ⊂:-overloads-right step (F ∩ G) (union (left (right p)) (left (left q))) = ⊂:-overloads-⋓ (normal-∪-saturate F) (normal-∪-saturate G) (union q p) >>= ⊂:-overloads-right >>=ˡ <:-∪-symm >>=ʳ <:-∪-symm step (F ∩ G) (union (left (right p)) (left (right q))) = step G (union p q) >>= ⊂:-overloads-right >>= ⊂:-overloads-left step (F ∩ G) (union p (right q)) with ⊂:-⋓-overloads (normal-∪-saturate F) (normal-∪-saturate G) q step (F ∩ G) (union (left (left p)) (right q)) | defn (union q₁ q₂) q₃ q₄ = (step F (union p q₁) [∪] just q₂) >>= ⊂:-overloads-⋓ (normal-∪-saturate F) (normal-∪-saturate G) >>= ⊂:-overloads-right >>=ˡ <:-trans (<:-union <:-refl q₃) <:-∪-assocl >>=ʳ <:-trans <:-∪-assocr (<:-union <:-refl q₄) step (F ∩ G) (union (left (right p)) (right q)) | defn (union q₁ q₂) q₃ q₄ = (just q₁ [∪] step G (union p q₂)) >>= ⊂:-overloads-⋓ (normal-∪-saturate F) (normal-∪-saturate G) >>= ⊂:-overloads-right >>=ˡ <:-trans (<:-union <:-refl q₃) (<:-∪-lub (<:-trans <:-∪-left <:-∪-right) (<:-∪-lub <:-∪-left (<:-trans <:-∪-right <:-∪-right))) >>=ʳ <:-trans (<:-∪-lub (<:-trans <:-∪-left <:-∪-right) (<:-∪-lub <:-∪-left (<:-trans <:-∪-right <:-∪-right))) (<:-union <:-refl q₄) step (F ∩ G) (union (right p) (right q)) | defn (union q₁ q₂) q₃ q₄ with ⊂:-⋓-overloads (normal-∪-saturate F) (normal-∪-saturate G) p step (F ∩ G) (union (right p) (right q)) | defn (union q₁ q₂) q₃ q₄ | defn (union p₁ p₂) p₃ p₄ = (step F (union p₁ q₁) [∪] step G (union p₂ q₂)) >>= ⊂:-overloads-⋓ (normal-∪-saturate F) (normal-∪-saturate G) >>= ⊂:-overloads-right >>=ˡ <:-trans (<:-union p₃ q₃) (<:-∪-lub (<:-union <:-∪-left <:-∪-left) (<:-union <:-∪-right <:-∪-right)) >>=ʳ <:-trans (<:-∪-lub (<:-union <:-∪-left <:-∪-left) (<:-union <:-∪-right <:-∪-right)) (<:-union p₄ q₄) step (F ∩ G) (union (right p) q) with ⊂:-⋓-overloads (normal-∪-saturate F) (normal-∪-saturate G) p step (F ∩ G) (union (right p) (left (left q))) | defn (union p₁ p₂) p₃ p₄ = (step F (union p₁ q) [∪] just p₂) >>= ⊂:-overloads-⋓ (normal-∪-saturate F) (normal-∪-saturate G) >>= ⊂:-overloads-right >>=ˡ <:-trans (<:-union p₃ <:-refl) (<:-∪-lub (<:-union <:-∪-left <:-refl) (<:-trans <:-∪-right <:-∪-left)) >>=ʳ <:-trans (<:-∪-lub (<:-union <:-∪-left <:-refl) (<:-trans <:-∪-right <:-∪-left)) (<:-union p₄ <:-refl) step (F ∩ G) (union (right p) (left (right q))) | defn (union p₁ p₂) p₃ p₄ = (just p₁ [∪] step G (union p₂ q)) >>= ⊂:-overloads-⋓ (normal-∪-saturate F) (normal-∪-saturate G) >>= ⊂:-overloads-right >>=ˡ <:-trans (<:-union p₃ <:-refl) <:-∪-assocr >>=ʳ <:-trans <:-∪-assocl (<:-union p₄ <:-refl) step (F ∩ G) (union (right p) (right q)) | defn (union p₁ p₂) p₃ p₄ with ⊂:-⋓-overloads (normal-∪-saturate F) (normal-∪-saturate G) q step (F ∩ G) (union (right p) (right q)) | defn (union p₁ p₂) p₃ p₄ | defn (union q₁ q₂) q₃ q₄ = (step F (union p₁ q₁) [∪] step G (union p₂ q₂)) >>= ⊂:-overloads-⋓ (normal-∪-saturate F) (normal-∪-saturate G) >>= ⊂:-overloads-right >>=ˡ <:-trans (<:-union p₃ q₃) (<:-∪-lub (<:-union <:-∪-left <:-∪-left) (<:-union <:-∪-right <:-∪-right)) >>=ʳ <:-trans (<:-∪-lub (<:-union <:-∪-left <:-∪-left) (<:-union <:-∪-right <:-∪-right)) (<:-union p₄ q₄) ∪-saturated : ∀ {F} → FunType F → ∪-Lift (Overloads (∪-saturate F)) (Overloads (∪-saturate F)) ⊂: Overloads (∪-saturate F) ∪-saturated F o = ⊂:-∪-lift (∪-saturate-overloads F) (∪-saturate-overloads F) o >>= ⊂:-∪-lift-saturate >>= overloads-∪-saturate F ∩-saturate-overloads : ∀ {F} → FunType F → Overloads (∩-saturate F) ⊂: ∩-Saturate (Overloads F) ∩-saturate-overloads (S ⇒ T) here = just (base here) ∩-saturate-overloads (F ∩ G) (left (left o)) = ∩-saturate-overloads F o >>= ⊂:-∩-saturate ⊂:-overloads-left ∩-saturate-overloads (F ∩ G) (left (right o)) = ∩-saturate-overloads G o >>= ⊂:-∩-saturate ⊂:-overloads-right ∩-saturate-overloads (F ∩ G) (right o) = ⊂:-⋒-overloads (normal-∩-saturate F) (normal-∩-saturate G) o >>= ⊂:-∩-lift (∩-saturate-overloads F) (∩-saturate-overloads G) >>= ⊂:-∩-lift (⊂:-∩-saturate ⊂:-overloads-left) (⊂:-∩-saturate ⊂:-overloads-right) >>= ⊂:-∩-lift-saturate overloads-∩-saturate : ∀ {F} → FunType F → ∩-Saturate (Overloads F) ⊂: Overloads (∩-saturate F) overloads-∩-saturate F = ⊂:-∩-saturate-indn (inj F) (step F) where inj : ∀ {F} → FunType F → Overloads F ⊂: Overloads (∩-saturate F) inj (S ⇒ T) here = just here inj (F ∩ G) (left p) = inj F p >>= ⊂:-overloads-left >>= ⊂:-overloads-left inj (F ∩ G) (right p) = inj G p >>= ⊂:-overloads-right >>= ⊂:-overloads-left step : ∀ {F} → FunType F → ∩-Lift (Overloads (∩-saturate F)) (Overloads (∩-saturate F)) ⊂: Overloads (∩-saturate F) step (S ⇒ T) (intersect here here) = defn here <:-∩-left (<:-∩-glb <:-refl <:-refl) step (F ∩ G) (intersect (left (left p)) (left (left q))) = step F (intersect p q) >>= ⊂:-overloads-left >>= ⊂:-overloads-left step (F ∩ G) (intersect (left (left p)) (left (right q))) = ⊂:-overloads-⋒ (normal-∩-saturate F) (normal-∩-saturate G) (intersect p q) >>= ⊂:-overloads-right step (F ∩ G) (intersect (left (right p)) (left (left q))) = ⊂:-overloads-⋒ (normal-∩-saturate F) (normal-∩-saturate G) (intersect q p) >>= ⊂:-overloads-right >>=ˡ <:-∩-symm >>=ʳ <:-∩-symm step (F ∩ G) (intersect (left (right p)) (left (right q))) = step G (intersect p q) >>= ⊂:-overloads-right >>= ⊂:-overloads-left step (F ∩ G) (intersect (right p) q) with ⊂:-⋒-overloads (normal-∩-saturate F) (normal-∩-saturate G) p step (F ∩ G) (intersect (right p) (left (left q))) | defn (intersect p₁ p₂) p₃ p₄ = (step F (intersect p₁ q) [∩] just p₂) >>= ⊂:-overloads-⋒ (normal-∩-saturate F) (normal-∩-saturate G) >>= ⊂:-overloads-right >>=ˡ <:-trans (<:-intersect p₃ <:-refl) (<:-∩-glb (<:-intersect <:-∩-left <:-refl) (<:-trans <:-∩-left <:-∩-right)) >>=ʳ <:-trans (<:-∩-glb (<:-intersect <:-∩-left <:-refl) (<:-trans <:-∩-left <:-∩-right)) (<:-intersect p₄ <:-refl) step (F ∩ G) (intersect (right p) (left (right q))) | defn (intersect p₁ p₂) p₃ p₄ = (just p₁ [∩] step G (intersect p₂ q)) >>= ⊂:-overloads-⋒ (normal-∩-saturate F) (normal-∩-saturate G) >>= ⊂:-overloads-right >>=ˡ <:-trans (<:-intersect p₃ <:-refl) <:-∩-assocr >>=ʳ <:-trans <:-∩-assocl (<:-intersect p₄ <:-refl) step (F ∩ G) (intersect (right p) (right q)) | defn (intersect p₁ p₂) p₃ p₄ with ⊂:-⋒-overloads (normal-∩-saturate F) (normal-∩-saturate G) q step (F ∩ G) (intersect (right p) (right q)) | defn (intersect p₁ p₂) p₃ p₄ | defn (intersect q₁ q₂) q₃ q₄ = (step F (intersect p₁ q₁) [∩] step G (intersect p₂ q₂)) >>= ⊂:-overloads-⋒ (normal-∩-saturate F) (normal-∩-saturate G) >>= ⊂:-overloads-right >>=ˡ <:-trans (<:-intersect p₃ q₃) (<:-∩-glb (<:-intersect <:-∩-left <:-∩-left) (<:-intersect <:-∩-right <:-∩-right)) >>=ʳ <:-trans (<:-∩-glb (<:-intersect <:-∩-left <:-∩-left) (<:-intersect <:-∩-right <:-∩-right)) (<:-intersect p₄ q₄) step (F ∩ G) (intersect p (right q)) with ⊂:-⋒-overloads (normal-∩-saturate F) (normal-∩-saturate G) q step (F ∩ G) (intersect (left (left p)) (right q)) | defn (intersect q₁ q₂) q₃ q₄ = (step F (intersect p q₁) [∩] just q₂) >>= ⊂:-overloads-⋒ (normal-∩-saturate F) (normal-∩-saturate G) >>= ⊂:-overloads-right >>=ˡ <:-trans (<:-intersect <:-refl q₃) <:-∩-assocl >>=ʳ <:-trans <:-∩-assocr (<:-intersect <:-refl q₄) step (F ∩ G) (intersect (left (right p)) (right q)) | defn (intersect q₁ q₂) q₃ q₄ = (just q₁ [∩] step G (intersect p q₂) ) >>= ⊂:-overloads-⋒ (normal-∩-saturate F) (normal-∩-saturate G) >>= ⊂:-overloads-right >>=ˡ <:-trans (<:-intersect <:-refl q₃) (<:-∩-glb (<:-trans <:-∩-right <:-∩-left) (<:-∩-glb <:-∩-left (<:-trans <:-∩-right <:-∩-right))) >>=ʳ <:-∩-glb (<:-trans <:-∩-right <:-∩-left) (<:-trans (<:-∩-glb <:-∩-left (<:-trans <:-∩-right <:-∩-right)) q₄) step (F ∩ G) (intersect (right p) (right q)) | defn (intersect q₁ q₂) q₃ q₄ with ⊂:-⋒-overloads (normal-∩-saturate F) (normal-∩-saturate G) p step (F ∩ G) (intersect (right p) (right q)) | defn (intersect q₁ q₂) q₃ q₄ | defn (intersect p₁ p₂) p₃ p₄ = (step F (intersect p₁ q₁) [∩] step G (intersect p₂ q₂)) >>= ⊂:-overloads-⋒ (normal-∩-saturate F) (normal-∩-saturate G) >>= ⊂:-overloads-right >>=ˡ <:-trans (<:-intersect p₃ q₃) (<:-∩-glb (<:-intersect <:-∩-left <:-∩-left) (<:-intersect <:-∩-right <:-∩-right)) >>=ʳ <:-trans (<:-∩-glb (<:-intersect <:-∩-left <:-∩-left) (<:-intersect <:-∩-right <:-∩-right)) (<:-intersect p₄ q₄) saturate-overloads : ∀ {F} → FunType F → Overloads (saturate F) ⊂: ∪-Saturate (∩-Saturate (Overloads F)) saturate-overloads F o = ∪-saturate-overloads (normal-∩-saturate F) o >>= (⊂:-∪-saturate (∩-saturate-overloads F)) overloads-saturate : ∀ {F} → FunType F → ∪-Saturate (∩-Saturate (Overloads F)) ⊂: Overloads (saturate F) overloads-saturate F o = ⊂:-∪-saturate (overloads-∩-saturate F) o >>= overloads-∪-saturate (normal-∩-saturate F) -- Saturated F whenever -- * if F has overloads (R ⇒ S) and (T ⇒ U) then F has an overload which is a subtype of ((R ∩ T) ⇒ (S ∩ U)) -- * ditto union data Saturated (F : Type) : Set where defn : (∀ {R S T U} → Overloads F (R ⇒ S) → Overloads F (T ⇒ U) → <:-Close (Overloads F) ((R ∩ T) ⇒ (S ∩ U))) → (∀ {R S T U} → Overloads F (R ⇒ S) → Overloads F (T ⇒ U) → <:-Close (Overloads F) ((R ∪ T) ⇒ (S ∪ U))) → ----------- Saturated F -- saturated F is saturated! saturated : ∀ {F} → FunType F → Saturated (saturate F) saturated F = defn (λ n o → (saturate-overloads F n [∩] saturate-overloads F o) >>= ∪-saturate-resp-∩-saturation ⊂:-∩-lift-saturate >>= overloads-saturate F) (λ n o → ∪-saturated (normal-∩-saturate F) (union n o))
Task/Exceptions/Ada/exceptions-4.ada
LaudateCorpus1/RosettaCodeData
1
10759
<reponame>LaudateCorpus1/RosettaCodeData procedure Call_Foo is begin Foo; exception when Foo_Error => ... -- do something when others => ... -- this catches all other exceptions end Call_Foo;
agda-stdlib-0.9/src/Function/Injection.agda
qwe2/try-agda
1
5527
<gh_stars>1-10 ------------------------------------------------------------------------ -- The Agda standard library -- -- Injections ------------------------------------------------------------------------ module Function.Injection where open import Function as Fun using () renaming (_∘_ to _⟨∘⟩_) open import Level open import Relation.Binary open import Function.Equality as F using (_⟶_; _⟨$⟩_) renaming (_∘_ to _⟪∘⟫_) import Relation.Binary.PropositionalEquality as P -- Injective functions. Injective : ∀ {a₁ a₂ b₁ b₂} {A : Setoid a₁ a₂} {B : Setoid b₁ b₂} → A ⟶ B → Set _ Injective {A = A} {B} f = ∀ {x y} → f ⟨$⟩ x ≈₂ f ⟨$⟩ y → x ≈₁ y where open Setoid A renaming (_≈_ to _≈₁_) open Setoid B renaming (_≈_ to _≈₂_) -- The set of all injections between two setoids. record Injection {f₁ f₂ t₁ t₂} (From : Setoid f₁ f₂) (To : Setoid t₁ t₂) : Set (f₁ ⊔ f₂ ⊔ t₁ ⊔ t₂) where field to : From ⟶ To injective : Injective to -- The set of all injections from one set to another. infix 3 _↣_ _↣_ : ∀ {f t} → Set f → Set t → Set _ From ↣ To = Injection (P.setoid From) (P.setoid To) -- Identity and composition. infixr 9 _∘_ id : ∀ {s₁ s₂} {S : Setoid s₁ s₂} → Injection S S id = record { to = F.id; injective = Fun.id } _∘_ : ∀ {f₁ f₂ m₁ m₂ t₁ t₂} {F : Setoid f₁ f₂} {M : Setoid m₁ m₂} {T : Setoid t₁ t₂} → Injection M T → Injection F M → Injection F T f ∘ g = record { to = to f ⟪∘⟫ to g ; injective = (λ {_} → injective g) ⟨∘⟩ injective f } where open Injection
src/Ada/ewok-sleep.ads
wookey-project/ewok-legacy
0
25844
-- -- Copyright 2018 The wookey project team <<EMAIL>> -- - <NAME> -- - <NAME> -- - <NAME> -- - <NAME> -- - <NAME> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- with applications; use applications; with ewok.exported.sleep; use ewok.exported.sleep; with m4.systick; package ewok.sleep with spark_mode => off is type t_sleep_info is record sleep_until : m4.systick.t_tick; interruptible : boolean; end record; sleep_info : array (t_real_task_id'range) of t_sleep_info := (others => (0, false)); -- -- \brief declare a time to sleep. -- -- This function is called in a syscall context and make the task -- unschedulable for at least the given sleep_until. Only external events -- (ISR, IPC) can awake the task during this period. If no external events -- happend, the task is marked as schedulable at the end of the sleep -- period, which means that the task is schedule *after* the sleep time, -- not exactly at the sleep time end. -- The variation of the time to wait between the end of the sleep time and -- the effective time execution depends on the scheduling policy, the task -- priority and the number of tasks on the system. -- -- \param id -- --e task id requesting to sleep -- \param sleep_until the sleep duration in unit given by unit argument -- \param mode -- sleep mode (preemptible by ISR or IPC, or not) -- procedure sleeping (task_id : in t_real_task_id; ms : in milliseconds; mode : in t_sleep_mode) with global => (Output => sleep_info); -- -- This function is called at each sched time of the systick handler, to -- decrement the sleep_until of each task of 1. -- If the speeptime reaches 0, the task mainthread is awoken. -- -- WARNING: there is case where the task is awoken *before* the end of -- its sleep period: -- - when an ISR arise -- - when an IPC targeting the task is pushed -- -- In theses two cases, the sleep_cancel() function must be called in order -- to cancel the current sleep round. The task is awoken by the corresponding -- kernel module instead. -- procedure check_is_awoke with global => (In_Out => sleep_info); -- -- As explain in sleep_round function explanations, some external events -- may awake the main thread. In that case, the sleep process must be -- canceled as the awoking process is made by another module. -- tasks that have requested locked sleep will continue to sleep -- procedure try_waking_up (task_id : in t_real_task_id) with global => (In_Out => sleep_info); -- -- \brief check if a task is currently sleeping -- -- \param id the task id to check -- -- return true if a task is sleeping, or false -- function is_sleeping (task_id : in t_real_task_id) return boolean with global => (Input => sleep_info); end ewok.sleep;
oeis/189/A189334.asm
neoneye/loda-programs
11
165994
; A189334: Expansion of (1-6*x+x^2)/(1-10*x+5*x^2) ; Submitted by <NAME>(s1) ; 1,4,36,340,3220,30500,288900,2736500,25920500,245522500,2325622500,22028612500,208658012500,1976437062500,18721080562500,177328620312500,1679680800312500,15910164901562500,150703245014062500,1427481625632812500 seq $0,165225 ; a(0)=1, a(1)=5, a(n) = 10*a(n-1) - 5*a(n-2) for n > 1. mul $0,8 div $0,5 sub $0,3 div $0,2 add $0,2
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca.log_21829_1175.asm
ljhsiun2/medusa
9
86979
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r13 push %r9 push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_A_ht+0x1c8ee, %rsi lea addresses_WT_ht+0x220e, %rdi nop nop nop mfence mov $53, %rcx rep movsl nop nop nop nop sub %rbx, %rbx lea addresses_WC_ht+0xfcee, %rdi nop nop nop add $55516, %r13 mov $0x6162636465666768, %r9 movq %r9, (%rdi) nop nop nop nop sub %r9, %r9 lea addresses_WT_ht+0xe0ce, %rdi nop nop nop xor $19978, %rsi mov $0x6162636465666768, %r13 movq %r13, %xmm4 movups %xmm4, (%rdi) nop nop and %rdi, %rdi lea addresses_UC_ht+0x190ee, %rbx nop nop nop nop nop inc %rsi movw $0x6162, (%rbx) nop and $53505, %rcx lea addresses_WT_ht+0x1acee, %rcx clflush (%rcx) nop nop nop dec %rdx mov $0x6162636465666768, %r9 movq %r9, (%rcx) nop nop nop cmp %rbx, %rbx lea addresses_WC_ht+0xa8ee, %rsi nop nop cmp %r13, %r13 mov $0x6162636465666768, %rbx movq %rbx, %xmm4 movups %xmm4, (%rsi) nop nop nop nop nop add $62693, %r13 lea addresses_WT_ht+0x1c8ee, %rbx nop nop nop nop nop add %rdi, %rdi mov $0x6162636465666768, %r13 movq %r13, %xmm5 movups %xmm5, (%rbx) and $58523, %rcx lea addresses_WC_ht+0x1882e, %rsi nop nop nop nop nop and %rdi, %rdi mov (%rsi), %r9w nop nop nop mfence lea addresses_WC_ht+0x38ee, %rbx nop nop nop nop and %rsi, %rsi mov (%rbx), %r13 nop nop cmp %rcx, %rcx lea addresses_normal_ht+0x1dc8e, %rsi nop nop nop nop nop xor %rbx, %rbx vmovups (%rsi), %ymm6 vextracti128 $0, %ymm6, %xmm6 vpextrq $0, %xmm6, %r9 nop nop nop sub $63926, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r13 ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %r8 push %rcx push %rdi // Faulty Load lea addresses_US+0x110ee, %r8 nop nop nop nop add $46517, %r15 mov (%r8), %ecx lea oracles, %r12 and $0xff, %rcx shlq $12, %rcx mov (%r12,%rcx,1), %rcx pop %rdi pop %rcx pop %r8 pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_US', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 10}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 5}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': True, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WT_ht', 'same': True, 'AVXalign': False, 'congruent': 5}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_UC_ht', 'same': True, 'AVXalign': False, 'congruent': 9}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 11}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_WT_ht', 'same': True, 'AVXalign': False, 'congruent': 8}} {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 2}} {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 10}} {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 5}} {'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 */
src/LibraBFT/Impl/OBM/Prelude.agda
LaudateCorpus1/bft-consensus-agda
0
340
{- Byzantine Fault Tolerant Consensus Verification in Agda, version 0.9. Copyright (c) 2021, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://opensource.oracle.com/licenses/upl -} open import Util.KVMap as Map open import Util.Prelude module LibraBFT.Impl.OBM.Prelude where lookupOrInsert : ∀ {K V : Set} → K → V → Map.KVMap K V → Map.KVMap K V lookupOrInsert k v m = if Map.kvm-member k m then m else Map.insert k v m
Transynther/x86/_processed/NC/_st_zr_/i9-9900K_12_0xa0_notsx.log_21829_136.asm
ljhsiun2/medusa
9
165251
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r8 push %r9 push %rax push %rcx push %rdi push %rsi lea addresses_UC_ht+0x26ed, %r8 nop add $6855, %r14 movw $0x6162, (%r8) nop nop nop sub %rsi, %rsi lea addresses_UC_ht+0x82ed, %rdi nop nop nop nop add %r9, %r9 movb $0x61, (%rdi) nop nop nop add $64979, %r8 lea addresses_UC_ht+0x92ed, %rsi lea addresses_UC_ht+0x155cd, %rdi nop nop nop nop inc %r8 mov $127, %rcx rep movsq nop nop nop cmp $42714, %rsi pop %rsi pop %rdi pop %rcx pop %rax pop %r9 pop %r8 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r15 push %r8 push %rbx push %rcx push %rsi // Store lea addresses_WC+0xd479, %rcx nop nop and %rsi, %rsi movw $0x5152, (%rcx) nop nop cmp %rbx, %rbx // Store lea addresses_RW+0xe6ed, %rbx nop nop nop add %r8, %r8 mov $0x5152535455565758, %r11 movq %r11, %xmm4 movups %xmm4, (%rbx) nop nop nop cmp %rbx, %rbx // Store lea addresses_PSE+0x86ed, %rbx nop nop nop nop nop add $48823, %r13 movw $0x5152, (%rbx) add $7727, %r15 // Faulty Load mov $0x70eda000000006ed, %r11 nop cmp %r13, %r13 movups (%r11), %xmm5 vpextrq $0, %xmm5, %rcx lea oracles, %r13 and $0xff, %rcx shlq $12, %rcx mov (%r13,%rcx,1), %rcx pop %rsi pop %rcx pop %rbx pop %r8 pop %r15 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 9}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 10}} [Faulty Load] {'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 11}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 10}} {'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}} {'58': 5, '52': 21407, '00': 417} 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 00 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 00 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 */
programs/oeis/055/A055278.asm
jmorken/loda
1
5703
<filename>programs/oeis/055/A055278.asm ; A055278: Number of rooted trees with n nodes and 3 leaves. ; 1,3,8,18,35,62,103,161,241,348,487,664,886,1159,1491,1890,2364,2922,3574,4329,5198,6192,7322,8600,10039,11651,13450,15450,17665,20110,22801,25753,28983,32508,36345,40512,45028,49911,55181,60858,66962,73514,80536 mov $15,$0 mov $17,$0 add $17,1 lpb $17 clr $0,15 mov $0,$15 sub $17,1 sub $0,$17 mov $12,$0 mov $14,$0 add $14,1 lpb $14 clr $0,12 mov $0,$12 sub $14,1 sub $0,$14 mov $9,$0 mov $11,$0 add $11,1 lpb $11 mov $0,$9 sub $11,1 sub $0,$11 mov $1,4 add $1,$0 add $0,$1 gcd $0,6 div $0,5 gcd $0,2 add $1,2 div $1,2 add $1,$0 mul $1,5 sub $1,20 div $1,5 add $10,$1 lpe add $13,$10 lpe add $16,$13 lpe mov $1,$16
alloy4fun_models/trashltl/models/9/Xym4gcrRmXNNEpBcS.als
Kaixi26/org.alloytools.alloy
0
2602
open main pred idXym4gcrRmXNNEpBcS_prop10 { always all p: Protected | p' in Protected } pred __repair { idXym4gcrRmXNNEpBcS_prop10 } check __repair { idXym4gcrRmXNNEpBcS_prop10 <=> prop10o }
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_4694_1852.asm
ljhsiun2/medusa
9
17226
<filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_4694_1852.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r10 push %r12 push %r9 push %rbp push %rcx push %rdi push %rsi lea addresses_D_ht+0x513c, %r12 nop and %rdi, %rdi mov (%r12), %r10w nop nop and $7534, %rbp lea addresses_D_ht+0x100bc, %rsi lea addresses_normal_ht+0x94fe, %rdi clflush (%rsi) nop nop nop cmp $49738, %r9 mov $20, %rcx rep movsq nop nop xor %r10, %r10 lea addresses_WT_ht+0x198bc, %r9 nop nop nop sub $2543, %rdi movups (%r9), %xmm0 vpextrq $1, %xmm0, %r10 nop nop nop nop add $30539, %rsi lea addresses_WC_ht+0x178bc, %rcx cmp $59655, %r10 movw $0x6162, (%rcx) nop nop nop add $12022, %rcx pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 pop %r12 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r14 push %r8 push %rbx push %rcx push %rdi // Load lea addresses_D+0x11a34, %r10 nop nop nop nop nop xor $36678, %r14 mov (%r10), %ecx nop nop nop nop sub %r10, %r10 // Store lea addresses_RW+0x6fbc, %r8 nop nop nop sub %rbx, %rbx mov $0x5152535455565758, %r10 movq %r10, (%r8) and $20603, %r10 // Store mov $0x93c, %r10 nop nop nop nop sub $8697, %rcx mov $0x5152535455565758, %rbx movq %rbx, %xmm2 vmovups %ymm2, (%r10) nop nop nop nop sub $32663, %rcx // Store lea addresses_A+0x2bbc, %r8 nop cmp %r10, %r10 movw $0x5152, (%r8) nop nop nop nop inc %r8 // Load lea addresses_D+0xbf3c, %r8 nop and %r13, %r13 movb (%r8), %bl nop nop nop nop sub %rcx, %rcx // Store lea addresses_RW+0x18cbc, %rcx nop nop nop inc %r10 movb $0x51, (%rcx) nop nop nop nop and $18079, %r10 // Store mov $0x3b0f88000000010c, %r8 nop nop nop nop dec %rcx movw $0x5152, (%r8) nop nop nop nop nop xor $53341, %rcx // Store lea addresses_UC+0x163c, %r14 nop nop nop nop inc %rdi movb $0x51, (%r14) nop xor $58618, %rdi // Faulty Load lea addresses_RW+0xf0bc, %rdi nop nop and $41870, %rbx mov (%rdi), %r14 lea oracles, %r13 and $0xff, %r14 shlq $12, %r14 mov (%r13,%r14,1), %r14 pop %rdi pop %rcx pop %rbx pop %r8 pop %r14 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 3, 'size': 4, 'same': False, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 7, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 8, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 7, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 10, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 6, 'size': 1, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 7, 'size': 2, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 10, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 11, 'size': 2, 'same': False, 'NT': False}} {'32': 4694} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
test/Succeed/Issue1435.agda
cruhland/agda
1,989
5925
-- Reported by nils.anders.danielsson, Feb 17, 2015 -- See also Issue 292 , Issue 1406 , and Issue 1427. -- The code below is accepted by Agda 2.4.2.2, but not by the current -- maintenance or master branches. data Box (A : Set) : Set where [_] : A → Box A data _≡_ (A : Set) : Set → Set₁ where refl : A ≡ A data _≅_ {A : Set₁} (x : A) : {B : Set₁} → B → Set₂ where refl : x ≅ x -- C could be a typed DSEL. data C : Set → Set₁ where c₁ c₂ : (A : Set) → C (Box A) -- If A is considered forced, the code no longer type-checks. -- D could be some kind of semantics for C. data D : {A : Set} → C A → Set₂ where d₁ : (A : Set) → D (c₁ A) d₂ : (A : Set) → D (c₂ A) module Doesn't-work where -- Let's try to write an eliminator for the part of the semantics -- that concerns c₁ programs. The basic approach doesn't work: D-elim-c₁ : (P : {A : Set} → D (c₁ A) → Set₂) → ((A : Set) → P (d₁ A)) → {A : Set} (x : D (c₁ A)) → P x D-elim-c₁ P p (d₁ A) = p A -- The following trick also fails (but for some reason the absurd -- case is accepted): -- Jesper 2015-12-18 update: this is no longer accepted by the new unifier. --D-elim-c₁-helper : -- (P : {A B : Set} {c : C A} → -- D c → A ≡ Box B → c ≅ c₁ B → Set₂) → -- ((A : Set) → P (d₁ A) refl refl) → -- {A B : Set} {c : C A} -- (x : D c) (eq₂ : c ≅ c₁ B) (eq₁ : A ≡ Box B) → P x eq₁ eq₂ --D-elim-c₁-helper P p (d₂ A) () _ --D-elim-c₁-helper P p (d₁ A) refl refl = p A module Works where -- I can define the eliminators by first defining and proving no -- confusion (following McBride, Goguen and McKinna). However, this -- requires a fair amount of work, and easy dependent pattern -- matching is arguably one of the defining features of Agda. -- -- A quote from "A Few Constructions on Constructors": "The Epigram -- language and system [25, 23] takes these constructions for -- granted. We see no reason why the users of other systems should -- work harder than we do." data ⊥ : Set₁ where No-confusion : ∀ {A B} → C A → C B → Set₁ No-confusion (c₁ A) (c₁ B) = A ≡ B No-confusion (c₂ A) (c₂ B) = A ≡ B No-confusion _ _ = ⊥ no-confusion : ∀ {A B} (x : C A) (y : C B) → A ≡ B → x ≅ y → No-confusion x y no-confusion (c₁ A) .(c₁ A) refl refl = refl no-confusion (c₂ A) .(c₂ A) refl refl = refl D-elim-c₁-helper : (P : {A B : Set} {c : C A} → D c → A ≡ Box B → c ≅ c₁ B → Set₂) → ((A : Set) → P (d₁ A) refl refl) → {A B : Set} {c : C A} (x : D c) (eq₂ : c ≅ c₁ B) (eq₁ : A ≡ Box B) → P x eq₁ eq₂ D-elim-c₁-helper P p (d₁ A) eq₂ eq₁ with no-confusion _ _ eq₁ eq₂ D-elim-c₁-helper P p (d₁ B) refl refl | refl = p B D-elim-c₁-helper P p (d₂ A) eq₂ eq₁ with no-confusion _ _ eq₁ eq₂ D-elim-c₁-helper P p (d₂ A) eq₂ eq₁ | () cast : {A B : Set} {x : C A} {y : C B} → A ≡ B → x ≅ y → D x → D y cast refl refl x = x D-elim-c₁ : (P : {A : Set} → D (c₁ A) → Set₂) → ((A : Set) → P (d₁ A)) → {A : Set} (x : D (c₁ A)) → P x D-elim-c₁ P p x = D-elim-c₁-helper (λ x eq₁ eq₂ → P (cast eq₁ eq₂ x)) p x refl refl -- should type-check
project/src/instructionset_hpp.ads
corentingay/ada_epita
0
22574
<gh_stars>0 pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with word_operations_hpp; with System; package instructionset_hpp is -- skipped empty struct Instruction subtype OpCode is word_operations_hpp.uint16_t; -- ./instructionset.hpp:6 -- -1 invalid instruction -- otherwise, the number of arguments it takes -- Function not safe on its own, use isOpCodeValid() first type InstructionSet_map_array is array (0 .. 53246) of System.Address; package Class_InstructionSet is type InstructionSet is limited record map : InstructionSet_map_array; -- ./instructionset.hpp:21 end record; pragma Import (CPP, InstructionSet); function New_InstructionSet return InstructionSet; -- ./instructionset.hpp:11 pragma CPP_Constructor (New_InstructionSet, "_ZN14InstructionSetC1Ev"); function isValidOpCode (this : access InstructionSet; the_opcode : OpCode) return int; -- ./instructionset.hpp:15 pragma Import (CPP, isValidOpCode, "_ZN14InstructionSet13isValidOpCodeEt"); function getInstruction (this : access InstructionSet; the_opcode : OpCode) return System.Address; -- ./instructionset.hpp:18 pragma Import (CPP, getInstruction, "_ZN14InstructionSet14getInstructionEt"); end; use Class_InstructionSet; end instructionset_hpp;
simple-models/no-solution/trivial.als
c-luu/alloy-specs
89
1051
<filename>simple-models/no-solution/trivial.als<gh_stars>10-100 //a trivial model whose command has no solution sig S {} fact { 1=2 } run {some S} expect 0
src/drivers/zumo_lsm303.adb
yannickmoy/SPARKZumo
6
13393
<gh_stars>1-10 -- pragma SPARK_Mode; with Wire; use Wire; with Interfaces; use Interfaces; package body Zumo_LSM303 is LM_Addr : constant := 2#0001_1101#; -- 16#1D# 10#29# LM_ID : constant := 2#0100_1001#; -- 16#49# 10#73# procedure Check_WHOAMI is ID : Byte; begin ID := Wire.Read_Byte (Addr => LM_Addr, Reg => Regs (WHO_AM_I)); if ID /= LM_ID then raise LSM303_Exception; end if; end Check_WHOAMI; procedure Init is Init_Seq : constant Byte_Array := (Regs (CTRL0), 2#0000_0000#, Regs (CTRL1), 2#0101_0111#, Regs (CTRL2), 2#0000_0000#, Regs (CTRL3), 2#0000_0000#, Regs (CTRL4), 2#0000_0000#, Regs (CTRL5), 2#1110_0100#, Regs (CTRL6), 2#0010_0000#, Regs (CTRL7), 2#0000_0000#); Status : Wire.Transmission_Status_Index; Index : Byte := Init_Seq'First; begin Check_WHOAMI; while Index <= Init_Seq'Last loop Status := Wire.Write_Byte (Addr => LM_Addr, Reg => Init_Seq (Index), Data => Init_Seq (Index + 1)); if Status /= Wire.Success then raise LSM303_Exception; end if; Index := Index + 2; end loop; Initd := True; end Init; function Read_M_Status return Byte is begin return Wire.Read_Byte (Addr => LM_Addr, Reg => Regs (STATUS_M)); end Read_M_Status; function Read_A_Status return Byte is begin return Wire.Read_Byte (Addr => LM_Addr, Reg => Regs (STATUS_A)); end Read_A_Status; procedure Read_Mag (Data : out Axis_Data) is Reg_Arr : constant array (Axises) of Reg_Index := (OUT_X_L_M, OUT_Y_L_M, OUT_Z_L_M); Arr : Byte_Array (1 .. 2); begin for I in Reg_Arr'Range loop Read_Bytes (Addr => LM_Addr, Reg => Regs (Reg_Arr (I)), Data => Arr); declare Val : Unsigned_16 with Address => Data (I)'Address; begin Val := Shift_Left (Value => Unsigned_16 (Arr (2)), Amount => 8); Val := Val or Unsigned_16 (Arr (1)); end; end loop; end Read_Mag; procedure Read_Acc (Data : out Axis_Data) is Raw_Arr : Byte_Array (1 .. Data'Length * 2) with Address => Data'Address; begin Wire.Read_Bytes (Addr => LM_Addr, Reg => Regs (OUT_X_L_A), Data => Raw_Arr); end Read_Acc; function Read_Temp return short is Arr : Byte_Array (1 .. 2) := (others => 0); Sign_Bit : constant Byte := 2#0000_1000#; Ret_Val : short with Address => Arr'Address; begin Wire.Read_Bytes (Addr => LM_Addr, Reg => Regs (TEMP_OUT_L), Data => Arr); if (Arr (Arr'Last) and Sign_Bit) > 0 then Arr (Arr'Last) := Arr (Arr'Last) or 2#1111_0000#; else Arr (Arr'Last) := Arr (Arr'Last) and 2#0000_0111#; end if; return Ret_Val; end Read_Temp; end Zumo_LSM303;
Assembler/sandbox/text_mod_v1/listener.asm
egormkn/Study-courses
1
27942
<gh_stars>1-10 [BITS 16] [ORG 0x7C00] init: jmp main_loop main_loop: call wait_input call print_input_char jmp main_loop wait_input: xor ax, ax int 0x16 ret print_input_char: cmp al, 0x0D ; Enter key (13d) je .print_enter cmp al, 0x08 ; Backspace key (8d) je .print_backspace cmp al, 0x48 ; Left arrow (75d) je .move_left mov ah, 0x0E int 0x10 ret .print_enter: mov ah, 0x0E mov al, 0x0D int 0x10 mov al, 0x0A int 0x10 ret .print_backspace: mov al, 0x08 int 0x10 mov al, 0x20 int 0x10 mov al, 0x08 int 0x10 ret .move_left: mov al, 0x08 int 0x10 ret jmp init TIMES 510 - ($ - $$) db 0 DW 0xAA55
Commands/Miscellaneous Commands suite/system info/home directory of (get system info).applescript
looking-for-a-job/applescript-examples
1
1541
#!/usr/bin/osascript home directory of (get system info)
subs/perform.asm
DigitalMars/optlink
28
6126
<reponame>DigitalMars/optlink<filename>subs/perform.asm TITLE PERFORM INCLUDE MACROS PUBLIC PERFORM_VERIFY_A,PERFORM_VERIFY_B .CODE MIDDLE_TEXT PERFORM_VERIFY_A PROC ; ; ; RET PERFORM_VERIFY_A ENDP PERFORM_VERIFY_B EQU PERFORM_VERIFY_A END
examples/example.asm
NickHerrig/bronzebeard
0
241264
<reponame>NickHerrig/bronzebeard # constants FOO = 42 BAR = FOO * 2 ADDR = 0x20000000 # basic labels, jumping, and branching start: addi t0, zero, BAR jal zero, end middle: beq t0, zero, main addi t0, t0, -1 end: jal zero, %offset(middle) # string literals string hello string world string hello world string hello world # same as above, whitespace gets compressed by the lexer # bytes literals bytes 1 2 0x03 0b100 5 0x06 0b111 8 # packed values pack <B, 0 pack <B, 255 pack <I, ADDR pack <f, 3.14159 # align to 4-byte (32-bit) boundary align 4 main: # without nestable exprs under hi / lo lui t0, %hi(ADDR) addi t0, t0, %lo(ADDR) addi t0, t0, main # with nestable exprs under hi / lo lui t0, %hi(%position(main, ADDR)) addi t0, t0, %lo(%position(main, ADDR))
src/fltk-images-shared.ads
micahwelf/FLTK-Ada
1
17851
with FLTK.Images.RGB; package FLTK.Images.Shared is type Shared_Image is new Image with private; type Shared_Image_Reference (Data : not null access Shared_Image'Class) is limited null record with Implicit_Dereference => Data; package Forge is function Create (Filename : in String; W, H : in Integer) return Shared_Image; function Create (From : in FLTK.Images.RGB.RGB_Image'Class) return Shared_Image; function Find (Name : in String; W, H : in Integer := 0) return Shared_Image; end Forge; function Copy (This : in Shared_Image; Width, Height : in Natural) return Shared_Image'Class; function Copy (This : in Shared_Image) return Shared_Image'Class; procedure Color_Average (This : in out Shared_Image; Col : in Color; Amount : in Blend); procedure Desaturate (This : in out Shared_Image); function Name (This : in Shared_Image) return String; procedure Reload (This : in out Shared_Image); procedure Set_Scaling_Algorithm (To : in Scaling_Kind); procedure Scale (This : in out Shared_Image; W, H : in Integer; Proportional : in Boolean := True; Can_Expand : in Boolean := False); procedure Draw (This : in Shared_Image; X, Y, W, H : in Integer; CX, CY : in Integer := 0); procedure Draw (This : in Shared_Image; X, Y : in Integer); private type Shared_Image is new Image with null record; overriding procedure Finalize (This : in out Shared_Image); pragma Inline (Copy); pragma Inline (Color_Average); pragma Inline (Desaturate); pragma Inline (Name); pragma Inline (Reload); pragma Inline (Set_Scaling_Algorithm); pragma Inline (Scale); pragma Inline (Draw); end FLTK.Images.Shared;
dev/emm386/vminit.asm
minblock/msdos
0
172977
<filename>dev/emm386/vminit.asm<gh_stars>0 .386p page 58,132 ;****************************************************************************** title VMINIT.ASM - Initialization routines for VM-DOS ;****************************************************************************** ; ; (C) Copyright MICROSOFT Corp. 1986-1991 ; (C) Copyright COMPAQ Computer Corp. 1986-1991 ; ; Title: EMM386.EXE - MICROSOFT Expanded Memory Manager 386 Driver ; ; Module: VMINIT - Initialization routines for CEMM/ VDM ; ; Version: 0.04 ; ; Date: January 30, 1986 ; ; Author: <NAME> ; ;****************************************************************************** ; ; Change log: ; ; DATE REVISION DESCRIPTION ; -------- -------- ------------------------------------------------------- ; 01/30/86 Original ; 04/07/86 A-SBP Added InitBitMap ; 05/12/86 B-RRH Cleanup and segment reorganization ; 06/18/86 0.01 Re-arranged comments, etc. ; 06/28/86 0.02 Name change from CEMM386 to CEMM (SBP). ; 07/03/86 0.03 Added call to Kybd_Watch (SBP). ; 07/06/86 0.04 changed assume to _DATA (SBP). ; ;****************************************************************************** ; ; Functional Description: ; ; This module contains various initialization routines for Virtual DOS ; ;****************************************************************************** .lfcond ; list false conditionals page ;****************************************************************************** ; P U B L I C D E C L A R A T I O N S ;****************************************************************************** ; ;LEO public vminit ; module label public InitBitMap ; init I/O Bit Map public PortTrap ; set bit(s) in I/O Bit Map public PortTrapFar public PortClear ; clear bit(s) in I/O Bit Map ;LEO public BitOFF ; bit offset calculation page ;****************************************************************************** ; L O C A L C O N S T A N T S ;****************************************************************************** ; include VDMseg.inc include VDMsel.inc include desc.inc include dma.inc include emmfunct.inc include emmdata.inc page ;****************************************************************************** ; E X T E R N A L R E F E R E N C E S ;****************************************************************************** ; ifdef TSSQLEO TSS segment extrn IOBitMap:byte ; Bit Map in Tss TSS ends endif _TEXT segment extrn Kybd_Watch:near ; (a20trap.asm) _TEXT ends ; ;****************************************************************************** ; S E G M E N T D E F I N I T I O N ;****************************************************************************** ; ;------------------------------------------------------------------------------ _TEXT segment assume cs:_TEXT, ds:_DATA, es:_DATA, ss:_DATA vminit label byte page ;****************************************************************************** ; InitBitMap - Initialize 386 Tss I/O bit map for Virtual mode I/O trapping. ; ; ENTRY: Real Mode ; DS = _DATA ; I/O bit map all zeroes (no trapping) except last byte. ; EXIT: Real Mode ; I/O bit map in Tss initialized. ; USED: Flags ; STACK: ;------------------------------------------------------------------------------ InitBitMap proc far ; push ax push bx push si ;TSSQLEO push es push gs ; ifdef TSSQLEO mov ax,seg TSS mov es,ax ; set ES to I/O Bit Map seg endif mov ax,seg R_CODE mov gs,ax ifdef TSSQLEO ASSUME ES:TSS,gs:R_CODE xor bx,bx ; ES:[BX] = pts to TSS ; ; initialize BitMapBase in Tss ; mov ax,offset TSS:IOBitMap mov ES:[bx.BitMapBase],ax ; set Bit Map base in Tss ; ; set ports for return to real trap ; mov ax,84h call BitOFF or ES:IOBitMap[bx],al mov ax,85h call BitOFF or ES:IOBitMap[bx],al endif ; ; initialize BitMapBase in Tss ; mov [TSS][BitMapBase],IOBitMap ; set Bit Map base in Tss ; ; set ports for return to real trap ; mov ax,84h call BitOFF add bx,IOBitMap or [TSS][bx],al mov ax,85h call BitOFF add bx,IOBitMap or [TSS][bx],al ; ; Turn on Keyboard watching for A20 disable ; call Kybd_Watch IB_exit: pop gs ;TSSQLEO pop es ASSUME ES:_DATA,gs:nothing pop si pop bx pop ax ret ; *** RETURN *** InitBitMap endp ;****************************************************************************** ; PortTrap - sets bit(s) in I/O bit map to enable trapping at an I/O address ; ; This function sets the appropriate bits in the I/O bit map to enable ; trapping of the desired I/O address. Since some I/O ports on the AT system ; board are selected via only 10 bits of address lines, these ports appear ; at every 1K in the I/O address space. When trapping these "system board" ; ports, the trap bits in the I/O bit map must be set for every 1k instance ; of the port. ; ; ENTRY: AX = byte I/O address to set in Bit Map ; BH = high bit set => set traps bits for this address @ every 1K ;TSSQLEO ES = TSS ; ; EXIT: none. ; ; USED: Flags ; STACK: ;------------------------------------------------------------------------------ PortTrapFar proc far call PortTrap retf PortTrapFar endp PortTrap proc near ; ;TSSQLEO ASSUME ES:TSS push ax push bx push cx ; mov cx,1 ; once by default test bh,80h ;Q: map it every 1K ? jz SHORT PT_loop ; N: do it once mov cx,64 ; Y: do it 64 times (once per 1k) PT_loop: push ax ; map it. save this address call BitOFF ; get offset and bit add bx,IOBitMap or [TSS][bx],al ;TSSQLEO or ES:IOBitMap[bx],al ; trap this address pop ax ; restore this address add ax,400h ; add 1k for next address loop PT_loop ; and continue ... ; pop cx pop bx pop ax ret ASSUME ES:_DATA ; PortTrap endp ;****************************************************************************** ; PortClear - clears bit(s) in I/O bit map to disable trapping at an I/O ; address ; ; This function clears the appropriate bits in the I/O bit map to disable ; trapping of the desired I/O address. Since some I/O ports on the AT system ; board are selected via only 10 bits of address lines, these ports appear ; at every 1K in the I/O address space. When clearing these "system board" ; ports, the trap bits in the I/O bit map must be cleared at every 1k instance ; of the port. ; ; ENTRY: AX = byte I/O address to clear in Bit Map ; BH = high bit set => clear traps bits for this address @ every 1K ;TSSQLEO ES = data segment for I/O bit map ; ; EXIT: none. ; ; USED: Flags ; STACK: ; NOTE: This implementation does not account for a port being multiply set ; for many purposes. (ie. If a port is set 3 times, it still only takes one ; PortClear call to clear it.) If this is a problem, a counter for each ; enabled port will have to be added. ; ;------------------------------------------------------------------------------ PortClear proc near ; ;TSSQLEO ASSUME ES:TSS push ax push bx push cx ; mov cx,1 ; once by default test bh,80h ;Q: map it every 1K ? jz SHORT PC_loop ; N: do it once mov cx,64 ; Y: do it 64 times (once per 1k) PC_loop: push ax ; map it. save this address call BitOFF ; get offset and bit not al add bx,IOBitMap and [TSS][bx],al ;TSSQLEO and ES:IOBitMap[bx],al ; clear this address pop ax ; restore this address add ax,400h ; add 1k for next address loop PC_loop ; and continue ... ; pop cx pop bx pop ax ret ASSUME ES:_DATA ; PortClear endp ;****************************************************************************** ; BitOFF - sets up byte and bit for I/O address in I/O Bit Map ; ; ENTRY: AX = byte I/O address to set in Bit Map ; ; EXIT: BX = byte offset ; AL = bit to OR in to set proper bit ; ; USED: Flags ; STACK: ;------------------------------------------------------------------------------ BitOFF proc near ; push cx mov cx,ax and cx,07h ; CL = bit pos for this port shr ax,3 ; AX = byte offset for this bit mov bx,ax ; BX = byte offset for port mov ax,1 shl ax,cl ; AL = bit mask for this port pop cx ret ; BitOFF endp ; _TEXT ends ; end of segment ; end ; end of module 
programs/oeis/157/A157331.asm
karttu/loda
1
179699
<gh_stars>1-10 ; A157331: a(n) = 128*n^2 - 32*n + 1. ; 97,449,1057,1921,3041,4417,6049,7937,10081,12481,15137,18049,21217,24641,28321,32257,36449,40897,45601,50561,55777,61249,66977,72961,79201,85697,92449,99457,106721,114241,122017,130049,138337,146881,155681,164737,174049,183617,193441,203521,213857,224449,235297,246401,257761,269377,281249,293377,305761,318401,331297,344449,357857,371521,385441,399617,414049,428737,443681,458881,474337,490049,506017,522241,538721,555457,572449,589697,607201,624961,642977,661249,679777,698561,717601,736897,756449,776257,796321,816641,837217,858049,879137,900481,922081,943937,966049,988417,1011041,1033921,1057057,1080449,1104097,1128001,1152161,1176577,1201249,1226177,1251361,1276801,1302497,1328449,1354657,1381121,1407841,1434817,1462049,1489537,1517281,1545281,1573537,1602049,1630817,1659841,1689121,1718657,1748449,1778497,1808801,1839361,1870177,1901249,1932577,1964161,1996001,2028097,2060449,2093057,2125921,2159041,2192417,2226049,2259937,2294081,2328481,2363137,2398049,2433217,2468641,2504321,2540257,2576449,2612897,2649601,2686561,2723777,2761249,2798977,2836961,2875201,2913697,2952449,2991457,3030721,3070241,3110017,3150049,3190337,3230881,3271681,3312737,3354049,3395617,3437441,3479521,3521857,3564449,3607297,3650401,3693761,3737377,3781249,3825377,3869761,3914401,3959297,4004449,4049857,4095521,4141441,4187617,4234049,4280737,4327681,4374881,4422337,4470049,4518017,4566241,4614721,4663457,4712449,4761697,4811201,4860961,4910977,4961249,5011777,5062561,5113601,5164897,5216449,5268257,5320321,5372641,5425217,5478049,5531137,5584481,5638081,5691937,5746049,5800417,5855041,5909921,5965057,6020449,6076097,6132001,6188161,6244577,6301249,6358177,6415361,6472801,6530497,6588449,6646657,6705121,6763841,6822817,6882049,6941537,7001281,7061281,7121537,7182049,7242817,7303841,7365121,7426657,7488449,7550497,7612801,7675361,7738177,7801249,7864577,7928161,7992001 mov $1,4 mul $1,$0 add $1,7 mul $1,$0 mul $1,32 add $1,97
Mitch-Guthrie-Assembly-HW4.asm
mitchGuthrieDev/Assembly-code
0
178130
#<NAME> 001215440 - HW 4 .data A: .word 110, 160, 20, 70, 60, 140,150, 80, 90,100, 10, 30, 40,120,130,50 size: .word 16 # length of array A shiftAmount: .word 4 # use to divide and multiply by 16 min: .word 0 max: .word 0 sum: .word 0 average: .word 0 largestInt: .word 2147483647 # use this for min procedure" maxMessage: .asciiz "\nThe maximum is: " minMessage: .asciiz "\nThe minimum is: " avgMessage: .asciiz "\nThe average is: " sumMessage: .asciiz "\nThe sum is: " .text jal findMMA findMMA: li $t3,0 #sets sum to 0 li $t5,0 #sets max to 0 la $t4, ($t1) #sets min to last num of array li $s6,0 #sets avg to 0 li $t0,0 #clears index to 0 li $s2,0 #clears count to 0 while: beq $t2,16,avg lw $t1, A($t0) addu $t3,$t3,$t1 #calcs sum bgt $t1,$t4,chkmax #checks for min move $t4,$t1 #changes min chkmax: blt $s1,$t5,avg #checks for max move $t5,$s1 #changes max addi $t0,$t0,4 #increments address addi $t2,$t2,1 #increments count j while avg: div $t6,$s3,$t2 #calcs average li $v0,4 #service number la $a0,maxMessage syscall #prints message li $v0,4 move $a0, $t5 syscall li $v0,4 la $a0,minMessage syscall li $v0,4 move $a0,$t4 syscall li $v0,4 la $a0, avgMessage syscall li $v0,4 move $a0,$t6 syscall li $v0,10 syscall
alloy4fun_models/trashltl/models/17/v5Z6b24W57CSwC3dS.als
Kaixi26/org.alloytools.alloy
0
1887
open main pred idv5Z6b24W57CSwC3dS_prop18 { all f: File | always (f in Protected until f in Trash) } pred __repair { idv5Z6b24W57CSwC3dS_prop18 } check __repair { idv5Z6b24W57CSwC3dS_prop18 <=> prop18o }
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_21829_1362.asm
ljhsiun2/medusa
9
27153
.global s_prepare_buffers s_prepare_buffers: push %r15 push %r8 push %r9 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_WT_ht+0x49cb, %rsi lea addresses_D_ht+0x16373, %rdi clflush (%rsi) dec %r15 mov $60, %rcx rep movsq nop cmp $18576, %rbx lea addresses_normal_ht+0x14933, %rbp nop nop nop sub %r8, %r8 mov $0x6162636465666768, %rdi movq %rdi, %xmm7 vmovups %ymm7, (%rbp) and $55711, %rdi lea addresses_A_ht+0x1953, %rsi lea addresses_A_ht+0x3b7d, %rdi nop nop nop add %r15, %r15 mov $94, %rcx rep movsl nop nop nop cmp $24694, %r8 lea addresses_normal_ht+0x1b4c6, %rsi lea addresses_A_ht+0x93b3, %rdi nop xor %r9, %r9 mov $115, %rcx rep movsl nop nop dec %rcx lea addresses_WT_ht+0x14a7d, %rsi lea addresses_UC_ht+0x15013, %rdi nop nop nop and $29935, %rbp mov $78, %rcx rep movsq nop nop nop nop and $42194, %rbx lea addresses_normal_ht+0x1c033, %rsi lea addresses_A_ht+0x17b1e, %rdi clflush (%rsi) nop cmp $20923, %rbx mov $75, %rcx rep movsw nop nop nop nop sub %r9, %r9 pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r9 pop %r8 pop %r15 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r8 push %rax push %rbp push %rbx // Faulty Load lea addresses_WC+0x10433, %r8 add $59567, %r13 movb (%r8), %r12b lea oracles, %rax and $0xff, %r12 shlq $12, %r12 mov (%rax,%r12,1), %r12 pop %rbx pop %rbp pop %rax pop %r8 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 8, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
code/cpudef/cpudef.asm
thecodewarrior/rust-computer
0
89808
<gh_stars>0 #cpudef { #bits 8 nop -> 0[7:0] pop -> 1[7:0] @ 0[7:0] dup -> 1[7:0] @ 1[7:0] swap -> 1[7:0] @ 2[7:0] push {value} -> 1[7:0] @ 3[7:0] @ value[31:0] frame {value} -> 1[7:0] @ 4[7:0] @ value[31:0] popframe -> 1[7:0] @ 5[7:0] store {value} -> 1[7:0] @ 6[7:0] @ value[31:0] load {value} -> 1[7:0] @ 7[7:0] @ value[31:0] uadd -> 4[7:0] @ 0[7:0] usub -> 4[7:0] @ 1[7:0] umul -> 4[7:0] @ 2[7:0] udiv -> 4[7:0] @ 3[7:0] urem -> 4[7:0] @ 4[7:0] ushl -> 4[7:0] @ 4[7:0] ushr -> 4[7:0] @ 6[7:0] unot -> 4[7:0] @ 7[7:0] uand -> 4[7:0] @ 8[7:0] uor -> 4[7:0] @ 9[7:0] uxor -> 4[7:0] @ 10[7:0] imath -> 5[7:0] fmath -> 6[7:0] jmp {label} -> 7[7:0] @ label[31:0] ujmp_ez {label} -> 8[7:0] @ 0[7:0] @ label[31:0] ujmp_nz {label} -> 8[7:0] @ 1[7:0] @ label[31:0] ujmp_eq {label} -> 8[7:0] @ 2[7:0] @ label[31:0] ujmp_ne {label} -> 8[7:0] @ 3[7:0] @ label[31:0] ujmp_lt {label} -> 8[7:0] @ 4[7:0] @ label[31:0] ujmp_gt {label} -> 8[7:0] @ 5[7:0] @ label[31:0] ujmp_le {label} -> 8[7:0] @ 6[7:0] @ label[31:0] ujmp_ge {label} -> 8[7:0] @ 7[7:0] @ label[31:0] ijmp {label} -> 9[7:0] @ label[31:0] fjmp {label} -> 10[7:0] @ label[31:0] }
programs/oeis/047/A047946.asm
neoneye/loda
22
98684
<reponame>neoneye/loda<filename>programs/oeis/047/A047946.asm ; A047946: a(n) = 5*F(n)^2 + 3*(-1)^n where F(n) are the Fibonacci numbers A000045. ; 3,2,8,17,48,122,323,842,2208,5777,15128,39602,103683,271442,710648,1860497,4870848,12752042,33385283,87403802,228826128,599074577,1568397608,4106118242,10749957123,28143753122,73681302248 mov $2,$0 seq $0,240926 ; a(n) = 2 + L(2*n) = 2 + A005248(n), n >= 0, with the Lucas numbers (A000032). gcd $2,2 mul $2,2 add $0,$2 sub $0,5
src/PSSParser.g4
PSSTools/py-pss-parser
0
1865
/**************************************************************************** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. ****************************************************************************/ parser grammar PSSParser; options {tokenVocab=PSSLexer;} compilation_unit : portable_stimulus_description* EOF ; portable_stimulus_description : package_body_item | package_declaration | component_declaration ; /** * Annotations allow meta-data to be associated with model elements */ annotation: TOK_AT identifier (TOK_LPAREN annotation_values? TOK_RPAREN)? ; annotation_values: annotation_value (TOK_COMMA annotation_value)* ; annotation_value: identifier TOK_SINGLE_EQ expression ; package_declaration: annotation* TOK_PACKAGE name=package_identifier TOK_LCBRACE package_body_item* TOK_RCBRACE ; package_body_item: abstract_action_declaration | struct_declaration | enum_declaration | covergroup_declaration | function_decl | import_class_decl | pss_function_defn | function_qualifiers | target_template_function | export_action | typedef_declaration | import_stmt | extend_stmt | const_field_declaration | static_const_field_declaration | compile_assert_stmt | package_body_compile_if // >>= PSS 1.1 | component_declaration // <<= PSS 1.1 | TOK_SEMICOLON ; import_stmt: TOK_IMPORT package_import_pattern TOK_SEMICOLON ; package_import_pattern: type_identifier (TOK_DOUBLE_COLON wildcard=TOK_ASTERISK)? ; extend_stmt: ( (TOK_EXTEND ext_type=TOK_ACTION type_identifier TOK_LCBRACE action_body_item* TOK_RCBRACE ) | (TOK_EXTEND ext_type=TOK_COMPONENT type_identifier TOK_LCBRACE component_body_item* TOK_RCBRACE ) | (TOK_EXTEND struct_kind type_identifier TOK_LCBRACE struct_body_item* TOK_RCBRACE ) | (TOK_EXTEND ext_type=TOK_ENUM type_identifier TOK_LCBRACE (enum_item (TOK_COMMA enum_item)*)? TOK_RCBRACE ) ) ; const_field_declaration : TOK_CONST const_data_declaration ; const_data_declaration: scalar_data_type const_data_instantiation (TOK_COMMA const_data_instantiation)* TOK_SEMICOLON ; const_data_instantiation: identifier TOK_SINGLE_EQ init=constant_expression ; static_const_field_declaration : TOK_STATIC TOK_CONST const_data_declaration ; action_declaration: annotation* TOK_ACTION action_identifier template_param_decl_list? (action_super_spec)? TOK_LCBRACE action_body_item* TOK_RCBRACE ; abstract_action_declaration : annotation* TOK_ABSTRACT TOK_ACTION action_identifier template_param_decl_list? (action_super_spec)? TOK_LCBRACE action_body_item* TOK_RCBRACE ; action_super_spec: TOK_COLON type_identifier ; action_body_item: activity_declaration | overrides_declaration | constraint_declaration | action_field_declaration | symbol_declaration | covergroup_declaration | exec_block_stmt | static_const_field_declaration | action_scheduling_constraint //TODO | attr_group | compile_assert_stmt | covergroup_instantiation | action_body_compile_if | inline_covergroup // >>= PSS 1.1 | TOK_SEMICOLON // <<= PSS 1.1 ; activity_declaration: TOK_ACTIVITY TOK_LCBRACE activity_stmt* TOK_RCBRACE ; action_field_declaration: // >>= PSS 1.1 object_ref_declaration // <<= PSS 1.1 | attr_field | activity_data_field | attr_group | action_handle_declaration | activity_data_field ; // >>= PSS 1.1 object_ref_declaration: flow_ref_declaration | resource_ref_declaration ; // <<= PSS 1.1 // >>= PSS 1.1 flow_ref_declaration: (is_input=TOK_INPUT | is_output=TOK_OUTPUT) flow_object_type object_ref_field (TOK_COMMA object_ref_field)* TOK_SEMICOLON ; resource_ref_declaration: (lock=TOK_LOCK | share=TOK_SHARE) resource_object_type object_ref_field (TOK_COMMA object_ref_field)* TOK_SEMICOLON ; object_ref_field: identifier array_dim? ; // <<= PSS 1.1 flow_object_type: type_identifier ; resource_object_type: type_identifier ; attr_field: access_modifier? rand=TOK_RAND? declaration=data_declaration ; access_modifier: TOK_PUBLIC | TOK_PROTECTED | TOK_PRIVATE ; attr_group: access_modifier TOK_COLON ; // NOTE: refactored grammar action_handle_declaration: action_type_identifier action_instantiation (TOK_COMMA action_instantiation)* TOK_SEMICOLON ; action_instantiation: action_identifier array_dim? ; //action_instantiation: // ids+=action_identifier (array_dim)? (TOK_COMMA ids+=action_identifier (array_dim)? )* // ; activity_data_field: TOK_ACTION data_declaration ; // TODO: BNF has hierarchical_id action_scheduling_constraint: TOK_CONSTRAINT (is_parallel=TOK_PARALLEL | is_sequence=TOK_SEQUENCE) TOK_LCBRACE variable_ref_path TOK_COMMA variable_ref_path (TOK_COMMA variable_ref_path)* TOK_RCBRACE TOK_SEMICOLON ; // Exec exec_block_stmt: target_file_exec_block | exec_block | target_code_exec_block ; exec_block: TOK_EXEC exec_kind_identifier TOK_LCBRACE exec_stmt* TOK_RCBRACE ; exec_kind_identifier: TOK_PRE_SOLVE | TOK_POST_SOLVE | TOK_BODY | TOK_HEADER | TOK_DECLARATION | TOK_RUN_START | TOK_RUN_END | TOK_INIT // >>= PSS 1.1 | TOK_INIT_UP | TOK_INIT_DOWN // <<= PSS 1.1 ; exec_stmt: procedural_stmt | exec_super_stmt ; exec_super_stmt: TOK_SUPER TOK_SEMICOLON ; assign_op: TOK_SINGLE_EQ | TOK_PLUS_EQ | TOK_MINUS_EQ | TOK_SHL_EQ | TOK_SHR_EQ | TOK_OR_EQ | TOK_AND_EQ ; target_code_exec_block: TOK_EXEC exec_kind_identifier language_identifier TOK_SINGLE_EQ string TOK_SEMICOLON ; target_file_exec_block: TOK_EXEC TOK_FILE filename_string TOK_SINGLE_EQ string TOK_SEMICOLON ; // == PSS-1.1 struct_declaration: annotation* struct_kind identifier template_param_decl_list? (struct_super_spec)? TOK_LCBRACE struct_body_item* TOK_RCBRACE ; struct_kind: img=TOK_STRUCT | object_kind ; object_kind: img=TOK_BUFFER | img=TOK_STREAM | img=TOK_STATE | img=TOK_RESOURCE ; struct_super_spec : TOK_COLON type_identifier ; struct_body_item: constraint_declaration | attr_field | typedef_declaration | covergroup_declaration | exec_block_stmt | static_const_field_declaration | attr_group | compile_assert_stmt | covergroup_instantiation | struct_body_compile_if // >>= PSS 1.1 | TOK_SEMICOLON // <<= PSS 1.1 ; function_decl: TOK_FUNCTION method_prototype TOK_SEMICOLON ; method_prototype: method_return_type method_identifier method_parameter_list_prototype ; method_return_type: TOK_VOID | data_type ; method_parameter_list_prototype: TOK_LPAREN ( method_parameter (TOK_COMMA method_parameter)* )? TOK_RPAREN ; method_parameter: method_parameter_dir? data_type identifier ; method_parameter_dir: TOK_INPUT |TOK_OUTPUT |TOK_INOUT ; function_qualifiers: (TOK_IMPORT import_function_qualifiers? TOK_FUNCTION type_identifier TOK_SEMICOLON) | (TOK_IMPORT import_function_qualifiers? TOK_FUNCTION method_prototype TOK_SEMICOLON) ; import_function_qualifiers: method_qualifiers (language_identifier)? | language_identifier ; method_qualifiers: TOK_TARGET | TOK_SOLVE ; target_template_function: TOK_TARGET language_identifier TOK_FUNCTION method_prototype TOK_SINGLE_EQ string TOK_SEMICOLON ; // TODO: method_parameter_list appears unused method_parameter_list: TOK_LPAREN (expression (TOK_COMMA expression)*)? TOK_RPAREN ; // >>= PSS 1.1 pss_function_defn: annotation* method_qualifiers? TOK_FUNCTION method_prototype TOK_LCBRACE procedural_stmt* TOK_RCBRACE ; procedural_stmt: procedural_block_stmt | procedural_expr_stmt | procedural_return_stmt | procedural_if_else_stmt | procedural_match_stmt | procedural_repeat_stmt | procedural_foreach_stmt | procedural_break_stmt | procedural_continue_stmt | procedural_var_decl_stmt // TODO: positioning this first causes assign to be incorrectly recognized as data_declaration | TOK_SEMICOLON // TODO: need to incorporate ; procedural_block_stmt: (annotation* TOK_SEQUENCE)? TOK_LCBRACE procedural_stmt* TOK_RCBRACE ; procedural_var_decl_stmt: data_declaration ; procedural_expr_stmt: (expression TOK_SEMICOLON) | (variable_ref_path assign_op expression TOK_SEMICOLON) ; procedural_return_stmt: TOK_RETURN expression? TOK_SEMICOLON ; procedural_if_else_stmt: TOK_IF TOK_LPAREN expression TOK_RPAREN procedural_stmt ( TOK_ELSE procedural_stmt )? ; procedural_match_stmt: TOK_MATCH TOK_LPAREN expression TOK_RPAREN TOK_LCBRACE procedural_match_choice procedural_match_choice* TOK_RCBRACE ; procedural_match_choice: (TOK_LSBRACE open_range_list TOK_RSBRACE TOK_COLON procedural_stmt) | (TOK_DEFAULT TOK_COLON procedural_stmt) ; procedural_repeat_stmt: (is_while=TOK_WHILE TOK_LPAREN expression TOK_RPAREN procedural_stmt) | (is_repeat=TOK_REPEAT TOK_LPAREN (identifier TOK_COLON)? expression TOK_RPAREN procedural_stmt) | (is_repeat_while=TOK_REPEAT procedural_stmt TOK_WHILE TOK_LPAREN expression TOK_RPAREN TOK_SEMICOLON) ; procedural_foreach_stmt: TOK_FOREACH TOK_LPAREN (iterator_identifier TOK_COLON)? expression (TOK_LSBRACE index_identifier TOK_RSBRACE)? TOK_RPAREN procedural_stmt ; procedural_break_stmt: TOK_BREAK TOK_SEMICOLON ; procedural_continue_stmt: TOK_CONTINUE TOK_SEMICOLON ; // <<= PSS 1.1 // == PSS-1.1 component_declaration: TOK_COMPONENT component_identifier template_param_decl_list? (component_super_spec)? TOK_LCBRACE component_body_item* TOK_RCBRACE ; component_super_spec : TOK_COLON type_identifier ; component_body_item: overrides_declaration | component_field_declaration | action_declaration | object_bind_stmt | exec_block // >>= PSS 1.1 -- replace package_body_item | abstract_action_declaration | struct_declaration | enum_declaration | covergroup_declaration | function_decl | import_class_decl | pss_function_defn | function_qualifiers | target_template_function | export_action | typedef_declaration | import_stmt | extend_stmt | const_field_declaration | static_const_field_declaration | compile_assert_stmt // <<= PSS 1.1 | attr_group | component_body_compile_if // >>= PSS 1.1 | TOK_SEMICOLON // <<= PSS 1.1 ; component_field_declaration: component_data_declaration | component_pool_declaration ; component_data_declaration: (is_static=TOK_STATIC is_const=TOK_CONST)? data_declaration ; component_pool_declaration: TOK_POOL (TOK_LSBRACE expression TOK_RSBRACE)? type_identifier identifier (TOK_COMMA identifier)* TOK_SEMICOLON ; object_bind_stmt: TOK_BIND hierarchical_id object_bind_item_or_list TOK_SEMICOLON ; object_bind_item_or_list: component_path | (TOK_LCBRACE component_path (TOK_COMMA component_path)* TOK_RCBRACE) ; // TODO: I believe component_identifier should allow array component_path: (component_identifier (TOK_DOT component_path_elem)*) | is_wildcard=TOK_ASTERISK ; // TODO: Arrayed flow-object references require arrayed access component_path_elem: component_action_identifier (TOK_LSBRACE constant_expression TOK_RSBRACE)? | is_wildcard=TOK_ASTERISK ; activity_stmt: (identifier TOK_COLON)? labeled_activity_stmt | activity_data_field | activity_bind_stmt | action_handle_declaration | activity_constraint_stmt | action_scheduling_constraint // >>= PSS 1.1 | activity_replicate_stmt // <<= PSS 1.1 ; labeled_activity_stmt: activity_if_else_stmt | activity_repeat_stmt | activity_foreach_stmt | activity_action_traversal_stmt | activity_sequence_block_stmt | activity_select_stmt | activity_match_stmt | activity_parallel_stmt | activity_schedule_stmt | activity_super_stmt | function_symbol_call // >>= PSS 1.1 // TODO: need to change align-semicolon spec | TOK_SEMICOLON // <<= PSS 1.1 ; activity_if_else_stmt: TOK_IF TOK_LPAREN expression TOK_RPAREN activity_stmt (TOK_ELSE activity_stmt)? ; activity_repeat_stmt: ( (is_while=TOK_WHILE TOK_LPAREN expression TOK_RPAREN activity_stmt) | (is_repeat=TOK_REPEAT TOK_LPAREN (loop_var=identifier TOK_COLON)? expression TOK_RPAREN activity_stmt) | (is_do_while=TOK_REPEAT activity_stmt is_do_while=TOK_WHILE TOK_LPAREN expression TOK_RPAREN TOK_SEMICOLON) ) ; activity_replicate_stmt: TOK_REPLICATE TOK_LPAREN (index_identifier TOK_COLON)? expression TOK_RPAREN ( identifier TOK_LSBRACE TOK_RSBRACE TOK_COLON)? labeled_activity_stmt ; activity_sequence_block_stmt: (TOK_SEQUENCE)? TOK_LCBRACE activity_stmt* TOK_RCBRACE ; activity_constraint_stmt: TOK_CONSTRAINT constraint_set ; activity_foreach_stmt: TOK_FOREACH TOK_LPAREN (it_id=iterator_identifier)? expression (TOK_LSBRACE idx_id=index_identifier TOK_RSBRACE)? TOK_RPAREN activity_stmt ; activity_action_traversal_stmt: (identifier (TOK_LSBRACE expression TOK_RSBRACE)? TOK_SEMICOLON) | (identifier (TOK_LSBRACE expression TOK_RSBRACE)? TOK_WITH constraint_set) | (is_do=TOK_DO type_identifier TOK_SEMICOLON) | (is_do=TOK_DO type_identifier TOK_WITH constraint_set) ; activity_select_stmt: TOK_SELECT TOK_LCBRACE select_branch select_branch select_branch* TOK_RCBRACE ; select_branch: ( (TOK_LPAREN guard=expression TOK_RPAREN (TOK_LSBRACE weight=expression TOK_RSBRACE)? TOK_COLON) | (TOK_LSBRACE weight=expression TOK_RSBRACE TOK_COLON) )? activity_stmt ; activity_match_stmt: TOK_MATCH TOK_LPAREN expression TOK_RPAREN TOK_LCBRACE match_choice match_choice match_choice* TOK_RCBRACE ; match_choice: (TOK_LSBRACE open_range_list TOK_RSBRACE TOK_COLON activity_stmt) | (is_default=TOK_DEFAULT TOK_COLON activity_stmt) ; activity_parallel_stmt: TOK_PARALLEL activity_join_spec? TOK_LCBRACE activity_stmt* TOK_RCBRACE ; activity_schedule_stmt: TOK_SCHEDULE activity_join_spec? TOK_LCBRACE activity_stmt* TOK_RCBRACE ; // >>= PSS 1.1 activity_join_spec: activity_join_branch_spec | activity_join_select_spec | activity_join_none_spec | activity_join_first_spec ; activity_join_branch_spec: TOK_JOIN_BRANCH TOK_LPAREN label_identifier (TOK_COMMA label_identifier)* TOK_RPAREN ; activity_join_select_spec: TOK_JOIN_SELECT TOK_LPAREN expression TOK_RPAREN ; activity_join_none_spec: TOK_JOIN_NONE ; activity_join_first_spec: TOK_JOIN_FIRST TOK_LPAREN expression TOK_RPAREN ; // <<= PSS 1.1 activity_bind_stmt: TOK_BIND hierarchical_id activity_bind_item_or_list TOK_SEMICOLON ; activity_bind_item_or_list: hierarchical_id | (TOK_LCBRACE hierarchical_id (TOK_COMMA hierarchical_id)* TOK_RCBRACE) ; symbol_declaration: TOK_SYMBOL identifier (TOK_LPAREN symbol_paramlist TOK_RPAREN)? TOK_LCBRACE activity_stmt* TOK_RCBRACE ; symbol_paramlist: (symbol_param (TOK_COMMA symbol_param)*)? ; symbol_param: data_type identifier ; activity_super_stmt: TOK_SUPER TOK_SEMICOLON ; overrides_declaration: TOK_OVERRIDE TOK_LCBRACE override_stmt* TOK_RCBRACE ; override_stmt: type_override | instance_override // >>= PSS 1.1 | TOK_SEMICOLON // <<= PSS 1.1 ; type_override: TOK_TYPE target=type_identifier TOK_WITH override=type_identifier TOK_SEMICOLON ; instance_override: TOK_INSTANCE target=hierarchical_id TOK_WITH override=type_identifier TOK_SEMICOLON ; data_declaration: data_type data_instantiation (TOK_COMMA data_instantiation)* TOK_SEMICOLON ; data_instantiation: identifier (array_dim)? (TOK_SINGLE_EQ constant_expression)? ; /* covergroup_portmap_list: ( // Name-mapped port binding (covergroup_portmap (TOK_COMMA covergroup_portmap)*) // Positional port binding | (hierarchical_id (TOK_COMMA hierarchical_id)*) )? ; covergroup_portmap: TOK_DOT identifier TOK_LPAREN hierarchical_id TOK_RPAREN ; */ array_dim: TOK_LSBRACE constant_expression TOK_RSBRACE ; data_type: scalar_data_type // >>= PSS 1.1 | container_type // <<= PSS 1.1 | user_defined_datatype ; // >>= PSS 1.1 container_type: | (TOK_ARRAY TOK_LT container_elem_type TOK_COMMA array_size_expression TOK_GT) | (TOK_LIST TOK_LT container_elem_type TOK_GT) | (TOK_MAP TOK_LT container_key_type TOK_COMMA container_elem_type TOK_GT) | (TOK_SET TOK_LT container_key_type TOK_GT) ; array_size_expression: constant_expression ; container_elem_type: container_type | scalar_data_type | type_identifier ; container_key_type: scalar_data_type | enum_identifier ; // <<= PSS 1.1 scalar_data_type: chandle_type | integer_type | string_type | bool_type ; chandle_type: TOK_CHANDLE ; integer_type: integer_atom_type (TOK_LSBRACE lhs=expression (TOK_COLON rhs=expression)? TOK_RSBRACE)? (is_in=TOK_IN TOK_LSBRACE domain=domain_open_range_list TOK_RSBRACE)? ; integer_atom_type: TOK_INT | TOK_BIT ; domain_open_range_list: domain_open_range_value (TOK_COMMA domain_open_range_value)* ; domain_open_range_value: lhs=expression (limit_high=TOK_ELIPSIS (rhs=expression)?)? | lhs=expression limit_high=TOK_ELIPSIS | (limit_low=TOK_ELIPSIS rhs=expression) | lhs=expression ; string_type: TOK_STRING ( TOK_IN TOK_LSBRACE DOUBLE_QUOTED_STRING (TOK_COMMA DOUBLE_QUOTED_STRING)* TOK_RSBRACE)? ; bool_type: TOK_BOOL ; user_defined_datatype: type_identifier ; enum_declaration: TOK_ENUM enum_identifier TOK_LCBRACE (enum_item (TOK_COMMA enum_item)*)? TOK_RCBRACE ; enum_item: identifier (TOK_SINGLE_EQ constant_expression)? ; enum_type: enum_type_identifier (TOK_IN TOK_LSBRACE open_range_list TOK_RSBRACE)? ; enum_type_identifier: type_identifier ; typedef_declaration: TOK_TYPEDEF data_type type_identifier TOK_SEMICOLON ; // >>= PSS-1.1 template_param_decl_list: TOK_LT template_param_decl ( TOK_COMMA template_param_decl )* TOK_GT ; template_param_decl: type_param_decl | value_param_decl ; type_param_decl: generic_type_param_decl | category_type_param_decl ; generic_type_param_decl: TOK_TYPE identifier ( TOK_SINGLE_EQ type_identifier )? ; category_type_param_decl: type_category identifier ( type_restriction )? ( TOK_SINGLE_EQ type_identifier )? ; type_restriction: TOK_COLON type_identifier ; type_category: TOK_ACTION | TOK_COMPONENT | struct_kind ; value_param_decl: data_type identifier ( TOK_SINGLE_EQ constant_expression )? ; template_param_value_list: TOK_LT ( template_param_value ( TOK_COMMA template_param_value )* )? TOK_GT ; template_param_value: constant_expression | type_identifier ; // <<= PSS-1.1 constraint_declaration: ( // Note: 1.0 doesn't allow a semicolon after the block constraint forms, // despite examples showing this ((is_dynamic=TOK_DYNAMIC)? TOK_CONSTRAINT identifier TOK_LCBRACE constraint_body_item* TOK_RCBRACE ) | (TOK_CONSTRAINT constraint_set ) ) ; //constraint_declaration ::= // [ dynamic ] constraint identifier { { constraint_body_item } } // | constraint constraint_set constraint_body_item: expression_constraint_item | implication_constraint_item | foreach_constraint_item | if_constraint_item | unique_constraint_item // >>= PSS 1.1 | default_constraint_item | forall_constraint_item | TOK_SEMICOLON // <<= PSS 1.1 ; // >>= PSS 1.1 default_constraint_item: default_constraint | default_disable_constraint ; default_constraint: TOK_DEFAULT hierarchical_id TOK_DOUBLE_EQ constant_expression TOK_SEMICOLON ; default_disable_constraint: TOK_DEFAULT TOK_DISABLE hierarchical_id TOK_SEMICOLON ; forall_constraint_item: TOK_FORALL TOK_LPAREN identifier TOK_COLON type_identifier (TOK_IN variable_ref_path)? TOK_RPAREN constraint_set ; // <<= PSS 1.1 expression_constraint_item: expression TOK_SEMICOLON ; implication_constraint_item: expression TOK_IMPLIES constraint_set ; constraint_set: constraint_body_item | constraint_block ; constraint_block: TOK_LCBRACE constraint_body_item* TOK_RCBRACE ; foreach_constraint_item: TOK_FOREACH TOK_LPAREN (it_id=iterator_identifier TOK_COLON)? expression (TOK_LSBRACE idx_id=index_identifier TOK_RSBRACE)? TOK_RPAREN constraint_set ; if_constraint_item: TOK_IF TOK_LPAREN expression TOK_RPAREN constraint_set (TOK_ELSE constraint_set )? ; unique_constraint_item: TOK_UNIQUE TOK_LCBRACE hierarchical_id_list TOK_RCBRACE TOK_SEMICOLON ; single_stmt_constraint: expression_constraint_item | unique_constraint_item ; covergroup_declaration: TOK_COVERGROUP name=covergroup_identifier (TOK_LPAREN covergroup_port (TOK_COMMA covergroup_port)* TOK_RPAREN)? TOK_LCBRACE covergroup_body_item* TOK_RCBRACE ; covergroup_port: data_type identifier ; covergroup_body_item: covergroup_option | covergroup_coverpoint | covergroup_cross // >>= PSS 1.1 | TOK_SEMICOLON // <<= PSS 1.1 ; covergroup_option: TOK_OPTION TOK_DOT identifier TOK_SINGLE_EQ constant_expression TOK_SEMICOLON ; covergroup_instantiation: covergroup_type_instantiation | inline_covergroup ; inline_covergroup: TOK_COVERGROUP TOK_LCBRACE covergroup_body_item* TOK_RCBRACE identifier TOK_SEMICOLON ; covergroup_type_instantiation: covergroup_type_identifier covergroup_identifier TOK_LPAREN covergroup_portmap_list TOK_RPAREN (TOK_WITH TOK_LCBRACE (covergroup_option)? TOK_RCBRACE)? TOK_SEMICOLON ; covergroup_portmap_list: ( (covergroup_portmap (TOK_COMMA covergroup_portmap)?) | hierarchical_id_list ) ; covergroup_portmap: TOK_DOT identifier TOK_LPAREN hierarchical_id TOK_RPAREN ; covergroup_coverpoint: (data_type? coverpoint_identifier TOK_COLON)? TOK_COVERPOINT target=expression (TOK_IFF TOK_LPAREN iff=expression TOK_RPAREN)? bins_or_empty ; bins_or_empty: (TOK_LCBRACE covergroup_coverpoint_body_item* TOK_RCBRACE ) | TOK_SEMICOLON ; covergroup_coverpoint_body_item: covergroup_option | covergroup_coverpoint_binspec ; covergroup_coverpoint_binspec: ( (bins_keyword identifier (is_array=TOK_LSBRACE constant_expression? TOK_RSBRACE)? TOK_SINGLE_EQ coverpoint_bins) ) ; coverpoint_bins: ( (TOK_LSBRACE covergroup_range_list TOK_RSBRACE (TOK_WITH TOK_LPAREN covergroup_expression TOK_RPAREN)? TOK_SEMICOLON) | (coverpoint_identifier TOK_WITH TOK_LPAREN covergroup_expression TOK_RPAREN TOK_SEMICOLON) | is_default=TOK_DEFAULT TOK_SEMICOLON ) ; covergroup_range_list: covergroup_value_range (TOK_COMMA covergroup_value_range)* ; covergroup_value_range: expression | (expression TOK_ELIPSIS expression?) | (expression? TOK_ELIPSIS expression) ; bins_keyword: TOK_BINS | TOK_ILLEGAL_BINS | TOK_IGNORE_BINS ; covergroup_cross: identifier TOK_COLON TOK_CROSS coverpoint_identifier (TOK_COMMA coverpoint_identifier)* (TOK_IFF TOK_LPAREN iff=expression TOK_RPAREN)? cross_item_or_null ; cross_item_or_null: (TOK_LCBRACE covergroup_cross_body_item* TOK_RCBRACE ) | TOK_SEMICOLON ; covergroup_cross_body_item: covergroup_option | covergroup_cross_binspec ; covergroup_cross_binspec: bins_type=bins_keyword name=identifier TOK_SINGLE_EQ covercross_identifier TOK_WITH TOK_LPAREN expr=covergroup_expression TOK_RPAREN TOK_SEMICOLON ; // TODO: no definition in the BNF covergroup_expression: expression ; package_body_compile_if: TOK_COMPILE TOK_IF TOK_LPAREN cond=constant_expression TOK_RPAREN true_body=package_body_compile_if_item (TOK_ELSE false_body=package_body_compile_if_item)? ; package_body_compile_if_item: package_body_item | (TOK_LCBRACE package_body_item* TOK_RCBRACE) ; action_body_compile_if: TOK_COMPILE TOK_IF TOK_LPAREN cond=constant_expression TOK_RPAREN true_body=action_body_compile_if_item (TOK_ELSE false_body=action_body_compile_if_item)? ; action_body_compile_if_item: action_body_item | (TOK_LCBRACE action_body_item* TOK_RCBRACE) ; component_body_compile_if: TOK_COMPILE TOK_IF TOK_LPAREN cond=constant_expression TOK_RPAREN true_body=component_body_compile_if_item (TOK_ELSE false_body=component_body_compile_if_item)? ; component_body_compile_if_item: component_body_item | (TOK_LCBRACE component_body_item* TOK_RCBRACE) ; struct_body_compile_if: TOK_COMPILE TOK_IF TOK_LPAREN cond=constant_expression TOK_RPAREN true_body=struct_body_compile_if_item (TOK_ELSE false_body=struct_body_compile_if_item)? ; struct_body_compile_if_item: struct_body_item | (TOK_LCBRACE struct_body_item* TOK_RCBRACE) ; // == PSS 1.1 -- replace static_ref with static_ref_path compile_has_expr: TOK_COMPILE TOK_HAS TOK_LPAREN static_ref_path TOK_RPAREN ; compile_assert_stmt : TOK_COMPILE TOK_ASSERT TOK_LPAREN cond=constant_expression (TOK_COMMA msg=string)? TOK_RPAREN TOK_SEMICOLON ; constant_expression: expression; expression: unary_op lhs=expression | lhs=expression exp_op rhs=expression | lhs=expression mul_div_mod_op rhs=expression | lhs=expression add_sub_op rhs=expression | lhs=expression shift_op rhs=expression | lhs=expression inside_expr_term | lhs=expression logical_inequality_op rhs=expression | lhs=expression eq_neq_op rhs=expression | lhs=expression binary_and_op rhs=expression | lhs=expression binary_xor_op rhs=expression | lhs=expression binary_or_op rhs=expression | lhs=expression logical_and_op rhs=expression | lhs=expression logical_or_op rhs=expression | lhs=expression conditional_expr | primary ; conditional_expr : TOK_COND true_expr=expression TOK_COLON false_expr=expression ; logical_or_op : TOK_DOUBLE_OR; logical_and_op : TOK_DOUBLE_AND; binary_or_op : TOK_SINGLE_OR; binary_xor_op : TOK_CARET; binary_and_op : TOK_SINGLE_AND; inside_expr_term : TOK_IN TOK_LSBRACE open_range_list TOK_RSBRACE ; open_range_list: open_range_value (TOK_COMMA open_range_value)* ; open_range_value: lhs=expression (TOK_ELIPSIS rhs=expression)? ; logical_inequality_op: TOK_LT|TOK_LTE|TOK_GT|TOK_GTE ; unary_op: TOK_PLUS | TOK_MINUS | TOK_NOT | TOK_NEG | TOK_SINGLE_AND | TOK_SINGLE_OR | TOK_CARET; exp_op: TOK_EXP; primary: number | bool_literal | paren_expr | string | variable_ref_path | method_function_symbol_call | static_ref_path | is_super=TOK_SUPER TOK_DOT variable_ref_path | compile_has_expr | cast_expression // TODO: File Jama issue ; paren_expr: TOK_LPAREN expression TOK_RPAREN ; // TODO: casting_type is undefined cast_expression: TOK_LPAREN casting_type TOK_RPAREN expression ; casting_type: data_type ; variable_ref_path: hierarchical_id (TOK_LSBRACE expression (TOK_COLON expression)? TOK_RSBRACE)? ; method_function_symbol_call: method_call | function_symbol_call ; // TODO: trailing TOK_SEMICOLON is incorrect method_call: hierarchical_id method_parameter_list /*TOK_SEMICOLON*/ ; // TODO: trailing TOK_SEMICOLON is incorrect function_symbol_call: function_symbol_id method_parameter_list /*TOK_SEMICOLON*/ ; function_symbol_id: function_id | symbol_identifier ; function_id: identifier (TOK_DOUBLE_COLON identifier)* ; static_ref_path: is_global=TOK_DOUBLE_COLON? static_ref_path_elem (TOK_DOUBLE_COLON static_ref_path_elem)* ; static_ref_path_elem: identifier template_param_value_list? ; mul_div_mod_op: TOK_ASTERISK | TOK_DIV | TOK_MOD; add_sub_op: TOK_PLUS | TOK_MINUS; // Note: Implementation difference vs spec // shift_op: '<<' | '>>'; shift_op: TOK_DOUBLE_LT | TOK_GT TOK_GT; eq_neq_op: TOK_DOUBLE_EQ | TOK_NE; constant: number | identifier ; identifier: ID | ESCAPED_ID ; hierarchical_id_list: hierarchical_id (TOK_COMMA hierarchical_id)* ; hierarchical_id: hierarchical_id_elem (TOK_DOT hierarchical_id_elem)* ; hierarchical_id_elem: identifier (TOK_LSBRACE expression TOK_RSBRACE)? ; action_type_identifier: type_identifier; // == PSS 1.1 type_identifier: (is_global=TOK_DOUBLE_COLON)? type_identifier_elem (TOK_DOUBLE_COLON type_identifier_elem)* ; // >>= PSS 1.1 type_identifier_elem: identifier template_param_value_list? ; // <<= PSS 1.1 package_identifier: identifier ; // TODO: unused? covercross_identifier : identifier; covergroup_identifier : identifier; coverpoint_target_identifier : hierarchical_id; action_identifier: identifier; struct_identifier: identifier; component_identifier: identifier; component_action_identifier: identifier; coverpoint_identifier : identifier; enum_identifier: identifier; import_class_identifier: identifier; // >>= PSS 1.1 label_identifier: identifier; // <<= PSS 1.1 language_identifier: identifier; method_identifier: identifier; symbol_identifier: identifier; variable_identifier: identifier; iterator_identifier: identifier; index_identifier: identifier; buffer_type_identifier: type_identifier; covergroup_type_identifier: type_identifier; resource_type_identifier: type_identifier; state_type_identifier: type_identifier; stream_type_identifier: type_identifier; // Move to LexicalRules //filename_string: DOUBLE_QUOTED_STRING; bool_literal: TOK_TRUE|TOK_FALSE ; number: based_hex_number | based_dec_number | based_bin_number | based_oct_number | dec_number | oct_number | hex_number ; string: DOUBLE_QUOTED_STRING | TRIPLE_DOUBLE_QUOTED_STRING; filename_string: DOUBLE_QUOTED_STRING; based_hex_number: DEC_LITERAL? BASED_HEX_LITERAL; based_dec_number: DEC_LITERAL? BASED_DEC_LITERAL; dec_number: DEC_LITERAL; based_bin_number: DEC_LITERAL? BASED_BIN_LITERAL; based_oct_number: DEC_LITERAL? BASED_OCT_LITERAL; oct_number: OCT_LITERAL; hex_number: HEX_LITERAL; export_action: TOK_EXPORT (method_qualifiers)? action_type_identifier method_parameter_list_prototype TOK_SEMICOLON ; import_class_decl: TOK_IMPORT TOK_CLASS import_class_identifier (import_class_extends)? TOK_LCBRACE import_class_method_decl* TOK_RCBRACE ; import_class_extends: TOK_COLON type_identifier (TOK_COMMA type_identifier)* ; import_class_method_decl: method_prototype TOK_SEMICOLON ;
TreeFold.agda
oisdk/agda-playground
6
464
{-# OPTIONS --cubical --safe #-} module TreeFold where open import Prelude open import Data.List open import Algebra using (Associative) open import Data.List.Properties using (foldr-fusion; foldl-fusion; foldl′-foldl) infixr 5 _^_&_ data Spine (A : Type a) : Type a where &0 : Spine A _^_&_ : A → ℕ → Spine A → Spine A private variable n : ℕ module Cons (f : A → A → A) where infixr 5 _^_∹_ _^_∹_ : A → ℕ → Spine A → Spine A x ^ n ∹ &0 = x ^ n & &0 x ^ n ∹ y ^ zero & xs = f x y ^ suc n ∹ xs x ^ n ∹ y ^ suc m & xs = x ^ n & y ^ m & xs _∹_ : A → Spine A → Spine A _∹_ = _^ zero ∹_ module TreeFoldR (f : A → A → A) (z : A) where open Cons f public fold : Spine A → A fold &0 = z fold (x ^ n & xs) = f x (fold xs) spine : List A → Spine A spine = foldr _∹_ &0 treeFold : List A → A treeFold = fold ∘ spine ∹-hom : Associative f → ∀ x xs → fold (x ^ n ∹ xs) ≡ f x (fold xs) ∹-hom p x &0 = refl ∹-hom p x (y ^ zero & xs) = ∹-hom p (f x y) xs ; p x y (fold xs) ∹-hom p x (y ^ suc n & xs) = refl treeFoldHom : Associative f → ∀ xs → treeFold xs ≡ foldr f z xs treeFoldHom f-assoc = foldr-fusion fold &0 (∹-hom f-assoc) module TreeFold1 (f : A → A → A) where open import Data.Maybe open import Data.Maybe.Properties open import Data.List.Properties f? : Maybe A → Maybe A → Maybe A f? nothing = id f? (just x) = just ∘ maybe x (f x) open TreeFoldR f? nothing treeFoldMay : List A → Maybe A treeFoldMay = treeFold ∘ map just treeFoldMayHom : Associative f → ∀ xs → treeFoldMay xs ≡ foldrMay f xs treeFoldMayHom f-assoc xs = treeFoldHom f?-assoc (map just xs) ; map-fusion f? nothing just xs where f?-assoc : Associative f? f?-assoc nothing y z = refl f?-assoc (just x) nothing z = refl f?-assoc (just x) (just y) nothing = refl f?-assoc (just x) (just y) (just z) = cong just (f-assoc x y z) isJustSpine? : Spine (Maybe A) → Bool isJustSpine? &0 = false isJustSpine? (x ^ y & xs) = is-just x IsJustSpine : Spine (Maybe A) → Type IsJustSpine = T ∘ isJustSpine? isJust-cons : ∀ x n xs → IsJustSpine (just x ^ n ∹ xs) isJust-cons x n &0 = tt isJust-cons x n (y ^ zero & xs) = isJust-cons (maybe x (f x) y) (suc n) xs isJust-cons x n (y ^ suc m & xs) = tt isJust-spine : ∀ xs → NonEmpty xs → IsJustSpine (spine (map just xs)) isJust-spine (x ∷ xs) p = isJust-cons x 0 (spine (map just xs)) isJust-fold : ∀ xs → IsJustSpine xs → IsJust (fold xs) isJust-fold (just _ ^ _ & _) _ = tt isJust-treeFoldMay : ∀ xs → NonEmpty xs → IsJust (treeFoldMay xs) isJust-treeFoldMay xs xsne = isJust-fold (spine (map just xs)) (isJust-spine xs xsne) treeFold1 : (xs : List A) → ⦃ NonEmpty xs ⦄ → A treeFold1 xs ⦃ xsne ⦄ = fromJust (treeFoldMay xs) where instance _ = isJust-treeFoldMay xs xsne -- treeFold1-hom : Associative f → ∀ xs → ⦃ xsne : NonEmpty xs ⦄ → treeFold1 xs ≡ foldr1 f xs -- treeFold1-hom f-assoc xs ⦃ xsne ⦄ = {!!} open TreeFold1 using (treeFoldMay; treeFoldMayHom; treeFold1) public open TreeFoldR using (treeFold; treeFoldHom) public module TreeFoldL (f : A → A → A) (z : A) where open TreeFoldR (flip f) z using (_∹_; fold; ∹-hom) public spine : List A → Spine A spine = foldl (flip _∹_) &0 treeFoldL : List A → A treeFoldL = fold ∘ spine treeFoldLHom : Associative f → ∀ xs → treeFoldL xs ≡ foldl f z xs treeFoldLHom p = foldl-fusion fold &0 (flip (∹-hom λ x y z → sym (p z y x))) open TreeFoldL using (treeFoldL; treeFoldLHom) public module StrictCons (f : A → A → A) where infixr 5 _^_∹_ _^_∹_ : A → ℕ → Spine A → Spine A x ^ n ∹ &0 = x ^ n & &0 x ^ n ∹ y ^ zero & xs = (_^ suc n ∹ xs) $! (f x y) x ^ n ∹ y ^ suc m & xs = x ^ n & y ^ m & xs _∹_ : A → Spine A → Spine A _∹_ = _^ zero ∹_ private module Lazy = Cons f strict-lazy-cons : ∀ x n xs → x ^ n ∹ xs ≡ x Lazy.^ n ∹ xs strict-lazy-cons x n &0 = refl strict-lazy-cons x n (y ^ zero & xs) = $!-≡ (_^ suc n ∹ xs) (f x y) ; strict-lazy-cons (f x y) (suc n) xs strict-lazy-cons x n (y ^ suc m & xs) = refl module TreeFoldL′ (f : A → A → A) (z : A) where open StrictCons (flip f) spine : List A → Spine A spine = foldl′ (flip _∹_) &0 private module Lazy = TreeFoldL f z open Lazy using (fold) treeFoldL′ : List A → A treeFoldL′ = fold ∘ spine treeFoldL′Hom : Associative f → ∀ xs → treeFoldL′ xs ≡ foldl f z xs treeFoldL′Hom p xs = cong fold (foldl′-foldl (flip _∹_) &0 xs ; cong (λ c → foldl c &0 xs) (funExt λ ys → funExt λ y → strict-lazy-cons y 0 ys)) ; Lazy.treeFoldLHom p xs open TreeFoldL′ using (treeFoldL′; treeFoldL′Hom) public
languages/ada/soci-mysql.ads
thishome153/soci
999
4471
<reponame>thishome153/soci -- Copyright (C) 2008-2011 <NAME> -- Distributed under the Boost Software License, Version 1.0. -- (See accompanying file LICENSE_1_0.txt or copy at -- http://www.boost.org/LICENSE_1_0.txt) package SOCI.MySQL is -- -- Registers the MySQL backend so that it is ready for use -- by the dynamic backend loader. -- procedure Register_Factory_MySQL; pragma Import (C, Register_Factory_MySQL, "register_factory_mysql"); end SOCI.MySQL;
bb-runtimes/src/a-intnam__xps.ads
JCGobbi/Nucleo-STM32G474RE
0
13000
<filename>bb-runtimes/src/a-intnam__xps.ads ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- A D A . I N T E R R U P T S . N A M E S -- -- -- -- S p e c -- -- -- -- Copyright (C) 2011-2020, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- ------------------------------------------------------------------------------ -- This is the version for the Xilinx XPS INTC pragma Restrictions (No_Elaboration_Code); package Ada.Interrupts.Names is -- All identifiers in this unit are implementation defined pragma Implementation_Defined; External_Interrupt_0 : constant Interrupt_ID := 0; External_Interrupt_1 : constant Interrupt_ID := 1; External_Interrupt_2 : constant Interrupt_ID := 2; External_Interrupt_3 : constant Interrupt_ID := 3; External_Interrupt_4 : constant Interrupt_ID := 4; External_Interrupt_5 : constant Interrupt_ID := 5; External_Interrupt_6 : constant Interrupt_ID := 6; External_Interrupt_7 : constant Interrupt_ID := 7; External_Interrupt_8 : constant Interrupt_ID := 8; External_Interrupt_9 : constant Interrupt_ID := 9; External_Interrupt_10 : constant Interrupt_ID := 10; External_Interrupt_11 : constant Interrupt_ID := 11; External_Interrupt_12 : constant Interrupt_ID := 12; External_Interrupt_13 : constant Interrupt_ID := 13; External_Interrupt_14 : constant Interrupt_ID := 14; External_Interrupt_15 : constant Interrupt_ID := 15; External_Interrupt_16 : constant Interrupt_ID := 16; External_Interrupt_17 : constant Interrupt_ID := 17; External_Interrupt_18 : constant Interrupt_ID := 18; External_Interrupt_19 : constant Interrupt_ID := 19; External_Interrupt_20 : constant Interrupt_ID := 20; External_Interrupt_21 : constant Interrupt_ID := 21; External_Interrupt_22 : constant Interrupt_ID := 22; External_Interrupt_23 : constant Interrupt_ID := 23; External_Interrupt_24 : constant Interrupt_ID := 24; External_Interrupt_25 : constant Interrupt_ID := 25; External_Interrupt_26 : constant Interrupt_ID := 26; External_Interrupt_27 : constant Interrupt_ID := 27; External_Interrupt_28 : constant Interrupt_ID := 28; External_Interrupt_29 : constant Interrupt_ID := 29; External_Interrupt_30 : constant Interrupt_ID := 30; External_Interrupt_31 : constant Interrupt_ID := 31; end Ada.Interrupts.Names;
src/gnat/elists.adb
My-Colaborations/dynamo
15
15734
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- E L I S T S -- -- -- -- B o d y -- -- -- -- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- WARNING: There is a C version of this package. Any changes to this -- source file must be properly reflected in the C header a-elists.h. with Alloc; with Debug; use Debug; with Output; use Output; with Table; package body Elists is ------------------------------------- -- Implementation of Element Lists -- ------------------------------------- -- Element lists are composed of three types of entities. The element -- list header, which references the first and last elements of the -- list, the elements themselves which are singly linked and also -- reference the nodes on the list, and finally the nodes themselves. -- The following diagram shows how an element list is represented: -- +----------------------------------------------------+ -- | +------------------------------------------+ | -- | | | | -- V | V | -- +-----|--+ +-------+ +-------+ +-------+ | -- | Elmt | | 1st | | 2nd | | Last | | -- | List |--->| Elmt |--->| Elmt ---...-->| Elmt ---+ -- | Header | | | | | | | | | | -- +--------+ +---|---+ +---|---+ +---|---+ -- | | | -- V V V -- +-------+ +-------+ +-------+ -- | | | | | | -- | Node1 | | Node2 | | Node3 | -- | | | | | | -- +-------+ +-------+ +-------+ -- The list header is an entry in the Elists table. The values used for -- the type Elist_Id are subscripts into this table. The First_Elmt field -- (Lfield1) points to the first element on the list, or to No_Elmt in the -- case of an empty list. Similarly the Last_Elmt field (Lfield2) points to -- the last element on the list or to No_Elmt in the case of an empty list. -- The elements themselves are entries in the Elmts table. The Next field -- of each entry points to the next element, or to the Elist header if this -- is the last item in the list. The Node field points to the node which -- is referenced by the corresponding list entry. ------------------------- -- Element List Tables -- ------------------------- type Elist_Header is record First : Elmt_Id; Last : Elmt_Id; end record; package Elists is new Table.Table ( Table_Component_Type => Elist_Header, Table_Index_Type => Elist_Id'Base, Table_Low_Bound => First_Elist_Id, Table_Initial => Alloc.Elists_Initial, Table_Increment => Alloc.Elists_Increment, Table_Name => "Elists"); type Elmt_Item is record Node : Node_Or_Entity_Id; Next : Union_Id; end record; package Elmts is new Table.Table ( Table_Component_Type => Elmt_Item, Table_Index_Type => Elmt_Id'Base, Table_Low_Bound => First_Elmt_Id, Table_Initial => Alloc.Elmts_Initial, Table_Increment => Alloc.Elmts_Increment, Table_Name => "Elmts"); ----------------- -- Append_Elmt -- ----------------- procedure Append_Elmt (N : Node_Or_Entity_Id; To : Elist_Id) is L : constant Elmt_Id := Elists.Table (To).Last; begin Elmts.Increment_Last; Elmts.Table (Elmts.Last).Node := N; Elmts.Table (Elmts.Last).Next := Union_Id (To); if L = No_Elmt then Elists.Table (To).First := Elmts.Last; else Elmts.Table (L).Next := Union_Id (Elmts.Last); end if; Elists.Table (To).Last := Elmts.Last; if Debug_Flag_N then Write_Str ("Append new element Elmt_Id = "); Write_Int (Int (Elmts.Last)); Write_Str (" to list Elist_Id = "); Write_Int (Int (To)); Write_Str (" referencing Node_Or_Entity_Id = "); Write_Int (Int (N)); Write_Eol; end if; end Append_Elmt; --------------------- -- Append_New_Elmt -- --------------------- procedure Append_New_Elmt (N : Node_Or_Entity_Id; To : in out Elist_Id) is begin if To = No_Elist then To := New_Elmt_List; end if; Append_Elmt (N, To); end Append_New_Elmt; ------------------------ -- Append_Unique_Elmt -- ------------------------ procedure Append_Unique_Elmt (N : Node_Or_Entity_Id; To : Elist_Id) is Elmt : Elmt_Id; begin Elmt := First_Elmt (To); loop if No (Elmt) then Append_Elmt (N, To); return; elsif Node (Elmt) = N then return; else Next_Elmt (Elmt); end if; end loop; end Append_Unique_Elmt; -------------- -- Contains -- -------------- function Contains (List : Elist_Id; N : Node_Or_Entity_Id) return Boolean is Elmt : Elmt_Id; begin if Present (List) then Elmt := First_Elmt (List); while Present (Elmt) loop if Node (Elmt) = N then return True; end if; Next_Elmt (Elmt); end loop; end if; return False; end Contains; -------------------- -- Elists_Address -- -------------------- function Elists_Address return System.Address is begin return Elists.Table (First_Elist_Id)'Address; end Elists_Address; ------------------- -- Elmts_Address -- ------------------- function Elmts_Address return System.Address is begin return Elmts.Table (First_Elmt_Id)'Address; end Elmts_Address; ---------------- -- First_Elmt -- ---------------- function First_Elmt (List : Elist_Id) return Elmt_Id is begin pragma Assert (List > Elist_Low_Bound); return Elists.Table (List).First; end First_Elmt; ---------------- -- Initialize -- ---------------- procedure Initialize is begin Elists.Init; Elmts.Init; end Initialize; ----------------------- -- Insert_Elmt_After -- ----------------------- procedure Insert_Elmt_After (N : Node_Or_Entity_Id; Elmt : Elmt_Id) is Nxt : constant Union_Id := Elmts.Table (Elmt).Next; begin pragma Assert (Elmt /= No_Elmt); Elmts.Increment_Last; Elmts.Table (Elmts.Last).Node := N; Elmts.Table (Elmts.Last).Next := Nxt; Elmts.Table (Elmt).Next := Union_Id (Elmts.Last); if Nxt in Elist_Range then Elists.Table (Elist_Id (Nxt)).Last := Elmts.Last; end if; end Insert_Elmt_After; ------------------------ -- Is_Empty_Elmt_List -- ------------------------ function Is_Empty_Elmt_List (List : Elist_Id) return Boolean is begin return Elists.Table (List).First = No_Elmt; end Is_Empty_Elmt_List; ------------------- -- Last_Elist_Id -- ------------------- function Last_Elist_Id return Elist_Id is begin return Elists.Last; end Last_Elist_Id; --------------- -- Last_Elmt -- --------------- function Last_Elmt (List : Elist_Id) return Elmt_Id is begin return Elists.Table (List).Last; end Last_Elmt; ------------------ -- Last_Elmt_Id -- ------------------ function Last_Elmt_Id return Elmt_Id is begin return Elmts.Last; end Last_Elmt_Id; ----------------- -- List_Length -- ----------------- function List_Length (List : Elist_Id) return Nat is Elmt : Elmt_Id; N : Nat; begin if List = No_Elist then return 0; else N := 0; Elmt := First_Elmt (List); loop if No (Elmt) then return N; else N := N + 1; Next_Elmt (Elmt); end if; end loop; end if; end List_Length; ---------- -- Lock -- ---------- procedure Lock is begin Elists.Locked := True; Elmts.Locked := True; Elists.Release; Elmts.Release; end Lock; -------------------- -- New_Copy_Elist -- -------------------- function New_Copy_Elist (List : Elist_Id) return Elist_Id is Result : Elist_Id; Elmt : Elmt_Id; begin if List = No_Elist then return No_Elist; -- Replicate the contents of the input list while preserving the -- original order. else Result := New_Elmt_List; Elmt := First_Elmt (List); while Present (Elmt) loop Append_Elmt (Node (Elmt), Result); Next_Elmt (Elmt); end loop; return Result; end if; end New_Copy_Elist; ------------------- -- New_Elmt_List -- ------------------- function New_Elmt_List return Elist_Id is begin Elists.Increment_Last; Elists.Table (Elists.Last).First := No_Elmt; Elists.Table (Elists.Last).Last := No_Elmt; if Debug_Flag_N then Write_Str ("Allocate new element list, returned ID = "); Write_Int (Int (Elists.Last)); Write_Eol; end if; return Elists.Last; end New_Elmt_List; --------------- -- Next_Elmt -- --------------- function Next_Elmt (Elmt : Elmt_Id) return Elmt_Id is N : constant Union_Id := Elmts.Table (Elmt).Next; begin if N in Elist_Range then return No_Elmt; else return Elmt_Id (N); end if; end Next_Elmt; procedure Next_Elmt (Elmt : in out Elmt_Id) is begin Elmt := Next_Elmt (Elmt); end Next_Elmt; -------- -- No -- -------- function No (List : Elist_Id) return Boolean is begin return List = No_Elist; end No; function No (Elmt : Elmt_Id) return Boolean is begin return Elmt = No_Elmt; end No; ---------- -- Node -- ---------- function Node (Elmt : Elmt_Id) return Node_Or_Entity_Id is begin if Elmt = No_Elmt then return Empty; else return Elmts.Table (Elmt).Node; end if; end Node; ---------------- -- Num_Elists -- ---------------- function Num_Elists return Nat is begin return Int (Elmts.Last) - Int (Elmts.First) + 1; end Num_Elists; ------------------ -- Prepend_Elmt -- ------------------ procedure Prepend_Elmt (N : Node_Or_Entity_Id; To : Elist_Id) is F : constant Elmt_Id := Elists.Table (To).First; begin Elmts.Increment_Last; Elmts.Table (Elmts.Last).Node := N; if F = No_Elmt then Elists.Table (To).Last := Elmts.Last; Elmts.Table (Elmts.Last).Next := Union_Id (To); else Elmts.Table (Elmts.Last).Next := Union_Id (F); end if; Elists.Table (To).First := Elmts.Last; end Prepend_Elmt; ------------- -- Present -- ------------- function Present (List : Elist_Id) return Boolean is begin return List /= No_Elist; end Present; function Present (Elmt : Elmt_Id) return Boolean is begin return Elmt /= No_Elmt; end Present; ------------ -- Remove -- ------------ procedure Remove (List : Elist_Id; N : Node_Or_Entity_Id) is Elmt : Elmt_Id; begin if Present (List) then Elmt := First_Elmt (List); while Present (Elmt) loop if Node (Elmt) = N then Remove_Elmt (List, Elmt); exit; end if; Next_Elmt (Elmt); end loop; end if; end Remove; ----------------- -- Remove_Elmt -- ----------------- procedure Remove_Elmt (List : Elist_Id; Elmt : Elmt_Id) is Nxt : Elmt_Id; Prv : Elmt_Id; begin Nxt := Elists.Table (List).First; -- Case of removing only element in the list if Elmts.Table (Nxt).Next in Elist_Range then pragma Assert (Nxt = Elmt); Elists.Table (List).First := No_Elmt; Elists.Table (List).Last := No_Elmt; -- Case of removing the first element in the list elsif Nxt = Elmt then Elists.Table (List).First := Elmt_Id (Elmts.Table (Nxt).Next); -- Case of removing second or later element in the list else loop Prv := Nxt; Nxt := Elmt_Id (Elmts.Table (Prv).Next); exit when Nxt = Elmt or else Elmts.Table (Nxt).Next in Elist_Range; end loop; pragma Assert (Nxt = Elmt); Elmts.Table (Prv).Next := Elmts.Table (Nxt).Next; if Elmts.Table (Prv).Next in Elist_Range then Elists.Table (List).Last := Prv; end if; end if; end Remove_Elmt; ---------------------- -- Remove_Last_Elmt -- ---------------------- procedure Remove_Last_Elmt (List : Elist_Id) is Nxt : Elmt_Id; Prv : Elmt_Id; begin Nxt := Elists.Table (List).First; -- Case of removing only element in the list if Elmts.Table (Nxt).Next in Elist_Range then Elists.Table (List).First := No_Elmt; Elists.Table (List).Last := No_Elmt; -- Case of at least two elements in list else loop Prv := Nxt; Nxt := Elmt_Id (Elmts.Table (Prv).Next); exit when Elmts.Table (Nxt).Next in Elist_Range; end loop; Elmts.Table (Prv).Next := Elmts.Table (Nxt).Next; Elists.Table (List).Last := Prv; end if; end Remove_Last_Elmt; ------------------ -- Replace_Elmt -- ------------------ procedure Replace_Elmt (Elmt : Elmt_Id; New_Node : Node_Or_Entity_Id) is begin Elmts.Table (Elmt).Node := New_Node; end Replace_Elmt; --------------- -- Tree_Read -- --------------- procedure Tree_Read is begin Elists.Tree_Read; Elmts.Tree_Read; end Tree_Read; ---------------- -- Tree_Write -- ---------------- procedure Tree_Write is begin Elists.Tree_Write; Elmts.Tree_Write; end Tree_Write; ------------ -- Unlock -- ------------ procedure Unlock is begin Elists.Locked := False; Elmts.Locked := False; end Unlock; end Elists;
libsrc/target/laser500/graphics/xor_MODE0.asm
jpoikela/z88dk
0
10514
<filename>libsrc/target/laser500/graphics/xor_MODE0.asm SECTION code_clib PUBLIC xor_MODE0 .xor_MODE0 defc NEEDxor = 1 INCLUDE "graphics/generic_console/pixel.asm"
Library/SpecUI/CommonUI/CView/cviewScrollbarData.asm
steakknife/pcgeos
504
87970
COMMENT @---------------------------------------------------------------------- Copyright (c) GeoWorks 1988 -- All Rights Reserved PROJECT: PC GEOS MODULE: OpenLook/View FILE: openScrollbarData.asm REVISION HISTORY: Name Date Description ---- ---- ----------- Chris 5/89 Initial version DESCRIPTION: Contains the data for drawing scrollbars. Good luck understanding how it all works. See OpenTrace for implementation details. $Id: cviewScrollbarData.asm,v 1.1 97/04/07 10:51:28 newdeal Exp $ ------------------------------------------------------------------------------@ ; This file ain't used noe moe. See specific UI's viewScrollbarDraw.asm.
src/wiki-filters-toc.adb
jquorning/ada-wiki
18
3163
<gh_stars>10-100 ----------------------------------------------------------------------- -- wiki-filters-toc -- Filter for the creation of Table Of Contents -- Copyright (C) 2016, 2018, 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. ----------------------------------------------------------------------- with Ada.Strings.Wide_Wide_Fixed; with Wiki.Nodes.Lists; package body Wiki.Filters.TOC is -- ------------------------------ -- Add a text content with the given format to the document. -- ------------------------------ overriding procedure Add_Text (Filter : in out TOC_Filter; Document : in out Wiki.Documents.Document; Text : in Wiki.Strings.WString; Format : in Wiki.Format_Map) is use Ada.Strings.Wide_Wide_Fixed; First : Natural := Text'First; Pos : Natural; begin while First <= Text'Last loop Pos := Index (Text (First .. Text'Last), "__TOC__"); if Pos > 0 then Filter_Type (Filter).Add_Text (Document, Text (First .. Pos - 1), Format); Filter.Add_Node (Document, Wiki.Nodes.N_TOC_DISPLAY); First := Pos + 7; else Pos := Index (Text (First .. Text'Last), "__NOTOC__"); if Pos > 0 then Filter_Type (Filter).Add_Text (Document, Text (First .. Pos - 1), Format); Document.Hide_TOC; First := Pos + 9; else Filter_Type (Filter).Add_Text (Document, Text (First .. Text'Last), Format); exit; end if; end if; end loop; end Add_Text; -- ------------------------------ -- Add a section header with the given level in the document. -- ------------------------------ overriding procedure Add_Header (Filter : in out TOC_Filter; Document : in out Wiki.Documents.Document; Header : in Wiki.Strings.WString; Level : in Natural) is T : Wiki.Nodes.Lists.Node_List_Ref; begin Document.Get_TOC (T); Wiki.Nodes.Lists.Append (T, new Wiki.Nodes.Node_Type '(Kind => Wiki.Nodes.N_TOC_ENTRY, Len => Header'Length, Header => Header, Parent => null, Level => Level)); Filter_Type (Filter).Add_Header (Document, Header, Level); end Add_Header; end Wiki.Filters.TOC;
llvm-gcc-4.2-2.9/gcc/ada/prj-makr.adb
vidkidz/crossbridge
1
20241
<filename>llvm-gcc-4.2-2.9/gcc/ada/prj-makr.adb ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P R J . <NAME> -- -- -- -- B o d y -- -- -- -- Copyright (C) 2001-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- -- Boston, MA 02110-1301, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with Csets; with Namet; use Namet; with Opt; with Output; with Osint; use Osint; with Prj; use Prj; with Prj.Com; with Prj.Part; with Prj.PP; with Prj.Tree; use Prj.Tree; with Prj.Util; use Prj.Util; with Snames; use Snames; with Table; use Table; with Ada.Characters.Handling; use Ada.Characters.Handling; with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.Regexp; use GNAT.Regexp; with System.Case_Util; use System.Case_Util; with System.CRTL; package body Prj.Makr is function Dup (Fd : File_Descriptor) return File_Descriptor; procedure Dup2 (Old_Fd, New_Fd : File_Descriptor); Gcc : constant String := "gcc"; Gcc_Path : String_Access := null; Non_Empty_Node : constant Project_Node_Id := 1; -- Used for the With_Clause of the naming project type Matched_Type is (True, False, Excluded); Naming_File_Suffix : constant String := "_naming"; Source_List_File_Suffix : constant String := "_source_list.txt"; Output_FD : File_Descriptor; -- To save the project file and its naming project file procedure Write_Eol; -- Output an empty line procedure Write_A_Char (C : Character); -- Write one character to Output_FD procedure Write_A_String (S : String); -- Write a String to Output_FD package Processed_Directories is new Table.Table (Table_Component_Type => String_Access, Table_Index_Type => Natural, Table_Low_Bound => 0, Table_Initial => 10, Table_Increment => 10, Table_Name => "Prj.Makr.Processed_Directories"); --------- -- Dup -- --------- function Dup (Fd : File_Descriptor) return File_Descriptor is begin return File_Descriptor (System.CRTL.dup (Integer (Fd))); end Dup; ---------- -- Dup2 -- ---------- procedure Dup2 (Old_Fd, New_Fd : File_Descriptor) is Fd : Integer; pragma Warnings (Off, Fd); begin Fd := System.CRTL.dup2 (Integer (Old_Fd), Integer (New_Fd)); end Dup2; ---------- -- Make -- ---------- procedure Make (File_Path : String; Project_File : Boolean; Directories : Argument_List; Name_Patterns : Argument_List; Excluded_Patterns : Argument_List; Foreign_Patterns : Argument_List; Preproc_Switches : Argument_List; Very_Verbose : Boolean) is Tree : constant Project_Node_Tree_Ref := new Project_Node_Tree_Data; Path_Name : String (1 .. File_Path'Length + Project_File_Extension'Length); Path_Last : Natural := File_Path'Length; Directory_Last : Natural := 0; Output_Name : String (Path_Name'Range); Output_Name_Last : Natural; Output_Name_Id : Name_Id; Project_Node : Project_Node_Id := Empty_Node; Project_Declaration : Project_Node_Id := Empty_Node; Source_Dirs_List : Project_Node_Id := Empty_Node; Current_Source_Dir : Project_Node_Id := Empty_Node; Project_Naming_Node : Project_Node_Id := Empty_Node; Project_Naming_Decl : Project_Node_Id := Empty_Node; Naming_Package : Project_Node_Id := Empty_Node; Naming_Package_Comments : Project_Node_Id := Empty_Node; Source_Files_Comments : Project_Node_Id := Empty_Node; Source_Dirs_Comments : Project_Node_Id := Empty_Node; Source_List_File_Comments : Project_Node_Id := Empty_Node; Project_Naming_File_Name : String (1 .. Output_Name'Length + Naming_File_Suffix'Length); Project_Naming_Last : Natural; Project_Naming_Id : Name_Id := No_Name; Excluded_Expressions : array (Excluded_Patterns'Range) of Regexp; Regular_Expressions : array (Name_Patterns'Range) of Regexp; Foreign_Expressions : array (Foreign_Patterns'Range) of Regexp; Source_List_Path : String (1 .. Output_Name'Length + Source_List_File_Suffix'Length); Source_List_Last : Natural; Source_List_FD : File_Descriptor; Args : Argument_List (1 .. Preproc_Switches'Length + 6); type SFN_Pragma is record Unit : Name_Id; File : Name_Id; Index : Int := 0; Spec : Boolean; end record; package SFN_Pragmas is new Table.Table (Table_Component_Type => SFN_Pragma, Table_Index_Type => Natural, Table_Low_Bound => 0, Table_Initial => 50, Table_Increment => 50, Table_Name => "Prj.Makr.SFN_Pragmas"); procedure Process_Directory (Dir_Name : String; Recursively : Boolean); -- Look for Ada and foreign sources in a directory, according to the -- patterns. When Recursively is True, after looking for sources in -- Dir_Name, look also in its subdirectories, if any. ----------------------- -- Process_Directory -- ----------------------- procedure Process_Directory (Dir_Name : String; Recursively : Boolean) is Matched : Matched_Type := False; Str : String (1 .. 2_000); Canon : String (1 .. 2_000); Last : Natural; Dir : Dir_Type; Process : Boolean := True; Temp_File_Name : String_Access := null; Save_Last_Pragma_Index : Natural := 0; File_Name_Id : Name_Id := No_Name; SFN_Prag : SFN_Pragma; begin -- Avoid processing the same directory more than once for Index in 1 .. Processed_Directories.Last loop if Processed_Directories.Table (Index).all = Dir_Name then Process := False; exit; end if; end loop; if Process then if Opt.Verbose_Mode then Output.Write_Str ("Processing directory """); Output.Write_Str (Dir_Name); Output.Write_Line (""""); end if; Processed_Directories. Increment_Last; Processed_Directories.Table (Processed_Directories.Last) := new String'(Dir_Name); -- Get the source file names from the directory. Fails if the -- directory does not exist. begin Open (Dir, Dir_Name); exception when Directory_Error => Prj.Com.Fail ("cannot open directory """, Dir_Name, """"); end; -- Process each regular file in the directory File_Loop : loop Read (Dir, Str, Last); exit File_Loop when Last = 0; -- Copy the file name and put it in canonical case to match -- against the patterns that have themselves already been put -- in canonical case. Canon (1 .. Last) := Str (1 .. Last); Canonical_Case_File_Name (Canon (1 .. Last)); if Is_Regular_File (Dir_Name & Directory_Separator & Str (1 .. Last)) then Matched := True; Name_Len := Last; Name_Buffer (1 .. Name_Len) := Str (1 .. Last); File_Name_Id := Name_Find; -- First, check if the file name matches at least one of -- the excluded expressions; for Index in Excluded_Expressions'Range loop if Match (Canon (1 .. Last), Excluded_Expressions (Index)) then Matched := Excluded; exit; end if; end loop; -- If it does not match any of the excluded expressions, -- check if the file name matches at least one of the -- regular expressions. if Matched = True then Matched := False; for Index in Regular_Expressions'Range loop if Match (Canon (1 .. Last), Regular_Expressions (Index)) then Matched := True; exit; end if; end loop; end if; if Very_Verbose or else (Matched = True and then Opt.Verbose_Mode) then Output.Write_Str (" Checking """); Output.Write_Str (Str (1 .. Last)); Output.Write_Line (""": "); end if; -- If the file name matches one of the regular expressions, -- parse it to get its unit name. if Matched = True then declare FD : File_Descriptor; Success : Boolean; Saved_Output : File_Descriptor; Saved_Error : File_Descriptor; begin -- If we don't have the path of the compiler yet, -- get it now. The compiler name may have a prefix, -- so we get the potentially prefixed name. if Gcc_Path = null then declare Prefix_Gcc : String_Access := Program_Name (Gcc); begin Gcc_Path := Locate_Exec_On_Path (Prefix_Gcc.all); Free (Prefix_Gcc); end; if Gcc_Path = null then Prj.Com.Fail ("could not locate " & Gcc); end if; end if; -- If we don't have yet the file name of the -- temporary file, get it now. if Temp_File_Name = null then Create_Temp_File (FD, Temp_File_Name); if FD = Invalid_FD then Prj.Com.Fail ("could not create temporary file"); end if; Close (FD); Delete_File (Temp_File_Name.all, Success); end if; Args (Args'Last) := new String' (Dir_Name & Directory_Separator & Str (1 .. Last)); -- Create the temporary file FD := Create_Output_Text_File (Name => Temp_File_Name.all); if FD = Invalid_FD then Prj.Com.Fail ("could not create temporary file"); end if; -- Save the standard output and error Saved_Output := Dup (Standout); Saved_Error := Dup (Standerr); -- Set standard output and error to the temporary file Dup2 (FD, Standout); Dup2 (FD, Standerr); -- And spawn the compiler Spawn (Gcc_Path.all, Args, Success); -- Restore the standard output and error Dup2 (Saved_Output, Standout); Dup2 (Saved_Error, Standerr); -- Close the temporary file Close (FD); -- And close the saved standard output and error to -- avoid too many file descriptors. Close (Saved_Output); Close (Saved_Error); -- Now that standard output is restored, check if -- the compiler ran correctly. -- Read the lines of the temporary file: -- they should contain the kind and name of the unit. declare File : Text_File; Text_Line : String (1 .. 1_000); Text_Last : Natural; begin Open (File, Temp_File_Name.all); if not Is_Valid (File) then Prj.Com.Fail ("could not read temporary file"); end if; Save_Last_Pragma_Index := SFN_Pragmas.Last; if End_Of_File (File) then if Opt.Verbose_Mode then if not Success then Output.Write_Str (" (process died) "); end if; end if; else Line_Loop : while not End_Of_File (File) loop Get_Line (File, Text_Line, Text_Last); -- Find the first closing parenthesis Char_Loop : for J in 1 .. Text_Last loop if Text_Line (J) = ')' then if J >= 13 and then Text_Line (1 .. 4) = "Unit" then -- Add entry to SFN_Pragmas table Name_Len := J - 12; Name_Buffer (1 .. Name_Len) := Text_Line (6 .. J - 7); SFN_Prag := (Unit => Name_Find, File => File_Name_Id, Index => 0, Spec => Text_Line (J - 5 .. J) = "(spec)"); SFN_Pragmas.Increment_Last; SFN_Pragmas.Table (SFN_Pragmas.Last) := SFN_Prag; end if; exit Char_Loop; end if; end loop Char_Loop; end loop Line_Loop; end if; if Save_Last_Pragma_Index = SFN_Pragmas.Last then if Opt.Verbose_Mode then Output.Write_Line (" not a unit"); end if; else if SFN_Pragmas.Last > Save_Last_Pragma_Index + 1 then for Index in Save_Last_Pragma_Index + 1 .. SFN_Pragmas.Last loop SFN_Pragmas.Table (Index).Index := Int (Index - Save_Last_Pragma_Index); end loop; end if; for Index in Save_Last_Pragma_Index + 1 .. SFN_Pragmas.Last loop SFN_Prag := SFN_Pragmas.Table (Index); if Opt.Verbose_Mode then if SFN_Prag.Spec then Output.Write_Str (" spec of "); else Output.Write_Str (" body of "); end if; Output.Write_Line (Get_Name_String (SFN_Prag.Unit)); end if; if Project_File then -- Add the corresponding attribute in the -- Naming package of the naming project. declare Decl_Item : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Declarative_Item, In_Tree => Tree); Attribute : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Attribute_Declaration, In_Tree => Tree); Expression : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Expression, And_Expr_Kind => Single, In_Tree => Tree); Term : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Term, And_Expr_Kind => Single, In_Tree => Tree); Value : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Literal_String, And_Expr_Kind => Single, In_Tree => Tree); begin Set_Next_Declarative_Item (Decl_Item, To => First_Declarative_Item_Of (Naming_Package, Tree), In_Tree => Tree); Set_First_Declarative_Item_Of (Naming_Package, To => Decl_Item, In_Tree => Tree); Set_Current_Item_Node (Decl_Item, To => Attribute, In_Tree => Tree); -- Is it a spec or a body? if SFN_Prag.Spec then Set_Name_Of (Attribute, Tree, To => Name_Spec); else Set_Name_Of (Attribute, Tree, To => Name_Body); end if; -- Get the name of the unit Get_Name_String (SFN_Prag.Unit); To_Lower (Name_Buffer (1 .. Name_Len)); Set_Associative_Array_Index_Of (Attribute, Tree, To => Name_Find); Set_Expression_Of (Attribute, Tree, To => Expression); Set_First_Term (Expression, Tree, To => Term); Set_Current_Term (Term, Tree, To => Value); -- And set the name of the file Set_String_Value_Of (Value, Tree, To => File_Name_Id); Set_Source_Index_Of (Value, Tree, To => SFN_Prag.Index); end; end if; end loop; if Project_File then -- Add source file name to source list -- file. Last := Last + 1; Str (Last) := ASCII.LF; if Write (Source_List_FD, Str (1)'Address, Last) /= Last then Prj.Com.Fail ("disk full"); end if; end if; end if; Close (File); Delete_File (Temp_File_Name.all, Success); end; end; -- File name matches none of the regular expressions else -- If file is not excluded, see if this is foreign source if Matched /= Excluded then for Index in Foreign_Expressions'Range loop if Match (Canon (1 .. Last), Foreign_Expressions (Index)) then Matched := True; exit; end if; end loop; end if; if Very_Verbose then case Matched is when False => Output.Write_Line ("no match"); when Excluded => Output.Write_Line ("excluded"); when True => Output.Write_Line ("foreign source"); end case; end if; if Project_File and Matched = True then -- Add source file name to source list file Last := Last + 1; Str (Last) := ASCII.LF; if Write (Source_List_FD, Str (1)'Address, Last) /= Last then Prj.Com.Fail ("disk full"); end if; end if; end if; end if; end loop File_Loop; Close (Dir); end if; -- If Recursively is True, call itself for each subdirectory. -- We do that, even when this directory has already been processed, -- because all of its subdirectories may not have been processed. if Recursively then Open (Dir, Dir_Name); loop Read (Dir, Str, Last); exit when Last = 0; -- Do not call itself for "." or ".." if Is_Directory (Dir_Name & Directory_Separator & Str (1 .. Last)) and then Str (1 .. Last) /= "." and then Str (1 .. Last) /= ".." then Process_Directory (Dir_Name & Directory_Separator & Str (1 .. Last), Recursively => True); end if; end loop; Close (Dir); end if; end Process_Directory; -- Start of processing for Make begin -- Do some needed initializations Csets.Initialize; Namet.Initialize; Snames.Initialize; Prj.Initialize (No_Project_Tree); Prj.Tree.Initialize (Tree); SFN_Pragmas.Set_Last (0); Processed_Directories.Set_Last (0); -- Initialize the compiler switches Args (1) := new String'("-c"); Args (2) := new String'("-gnats"); Args (3) := new String'("-gnatu"); Args (4 .. 3 + Preproc_Switches'Length) := Preproc_Switches; Args (4 + Preproc_Switches'Length) := new String'("-x"); Args (5 + Preproc_Switches'Length) := new String'("ada"); -- Get the path and file names if File_Names_Case_Sensitive then Path_Name (1 .. Path_Last) := File_Path; else Path_Name (1 .. Path_Last) := To_Lower (File_Path); end if; Path_Name (Path_Last + 1 .. Path_Name'Last) := Project_File_Extension; -- Get the end of directory information, if any for Index in reverse 1 .. Path_Last loop if Path_Name (Index) = Directory_Separator then Directory_Last := Index; exit; end if; end loop; if Project_File then if Path_Last < Project_File_Extension'Length + 1 or else Path_Name (Path_Last - Project_File_Extension'Length + 1 .. Path_Last) /= Project_File_Extension then Path_Last := Path_Name'Last; end if; Output_Name (1 .. Path_Last) := To_Lower (Path_Name (1 .. Path_Last)); Output_Name_Last := Path_Last - Project_File_Extension'Length; -- If there is already a project file with the specified name, parse -- it to get the components that are not automatically generated. if Is_Regular_File (Output_Name (1 .. Path_Last)) then if Opt.Verbose_Mode then Output.Write_Str ("Parsing already existing project file """); Output.Write_Str (Output_Name (1 .. Output_Name_Last)); Output.Write_Line (""""); end if; Part.Parse (In_Tree => Tree, Project => Project_Node, Project_File_Name => Output_Name (1 .. Output_Name_Last), Always_Errout_Finalize => False, Store_Comments => True); -- Fail if parsing was not successful if Project_Node = Empty_Node then Fail ("parsing of existing project file failed"); else -- If parsing was successful, remove the components that are -- automatically generated, if any, so that they will be -- unconditionally added later. -- Remove the with clause for the naming project file declare With_Clause : Project_Node_Id := First_With_Clause_Of (Project_Node, Tree); Previous : Project_Node_Id := Empty_Node; begin while With_Clause /= Empty_Node loop if Prj.Tree.Name_Of (With_Clause, Tree) = Project_Naming_Id then if Previous = Empty_Node then Set_First_With_Clause_Of (Project_Node, Tree, To => Next_With_Clause_Of (With_Clause, Tree)); else Set_Next_With_Clause_Of (Previous, Tree, To => Next_With_Clause_Of (With_Clause, Tree)); end if; exit; end if; Previous := With_Clause; With_Clause := Next_With_Clause_Of (With_Clause, Tree); end loop; end; -- Remove attribute declarations of Source_Files, -- Source_List_File, Source_Dirs, and the declaration of -- package Naming, if they exist, but preserve the comments -- attached to these nodes. declare Declaration : Project_Node_Id := First_Declarative_Item_Of (Project_Declaration_Of (Project_Node, Tree), Tree); Previous : Project_Node_Id := Empty_Node; Current_Node : Project_Node_Id := Empty_Node; Name : Name_Id; Kind_Of_Node : Project_Node_Kind; Comments : Project_Node_Id; begin while Declaration /= Empty_Node loop Current_Node := Current_Item_Node (Declaration, Tree); Kind_Of_Node := Kind_Of (Current_Node, Tree); if Kind_Of_Node = N_Attribute_Declaration or else Kind_Of_Node = N_Package_Declaration then Name := Prj.Tree.Name_Of (Current_Node, Tree); if Name = Name_Source_Files or else Name = Name_Source_List_File or else Name = Name_Source_Dirs or else Name = Name_Naming then Comments := Tree.Project_Nodes.Table (Current_Node).Comments; if Name = Name_Source_Files then Source_Files_Comments := Comments; elsif Name = Name_Source_List_File then Source_List_File_Comments := Comments; elsif Name = Name_Source_Dirs then Source_Dirs_Comments := Comments; elsif Name = Name_Naming then Naming_Package_Comments := Comments; end if; if Previous = Empty_Node then Set_First_Declarative_Item_Of (Project_Declaration_Of (Project_Node, Tree), Tree, To => Next_Declarative_Item (Declaration, Tree)); else Set_Next_Declarative_Item (Previous, Tree, To => Next_Declarative_Item (Declaration, Tree)); end if; else Previous := Declaration; end if; end if; Declaration := Next_Declarative_Item (Declaration, Tree); end loop; end; end if; end if; if Directory_Last /= 0 then Output_Name (1 .. Output_Name_Last - Directory_Last) := Output_Name (Directory_Last + 1 .. Output_Name_Last); Output_Name_Last := Output_Name_Last - Directory_Last; end if; -- Get the project name id Name_Len := Output_Name_Last; Name_Buffer (1 .. Name_Len) := Output_Name (1 .. Name_Len); Output_Name_Id := Name_Find; -- Create the project naming file name Project_Naming_Last := Output_Name_Last; Project_Naming_File_Name (1 .. Project_Naming_Last) := Output_Name (1 .. Project_Naming_Last); Project_Naming_File_Name (Project_Naming_Last + 1 .. Project_Naming_Last + Naming_File_Suffix'Length) := Naming_File_Suffix; Project_Naming_Last := Project_Naming_Last + Naming_File_Suffix'Length; -- Get the project naming id Name_Len := Project_Naming_Last; Name_Buffer (1 .. Name_Len) := Project_Naming_File_Name (1 .. Name_Len); Project_Naming_Id := Name_Find; Project_Naming_File_Name (Project_Naming_Last + 1 .. Project_Naming_Last + Project_File_Extension'Length) := Project_File_Extension; Project_Naming_Last := Project_Naming_Last + Project_File_Extension'Length; -- Create the source list file name Source_List_Last := Output_Name_Last; Source_List_Path (1 .. Source_List_Last) := Output_Name (1 .. Source_List_Last); Source_List_Path (Source_List_Last + 1 .. Source_List_Last + Source_List_File_Suffix'Length) := Source_List_File_Suffix; Source_List_Last := Source_List_Last + Source_List_File_Suffix'Length; -- Add the project file extension to the project name Output_Name (Output_Name_Last + 1 .. Output_Name_Last + Project_File_Extension'Length) := Project_File_Extension; Output_Name_Last := Output_Name_Last + Project_File_Extension'Length; end if; -- Change the current directory to the directory of the project file, -- if any directory information is specified. if Directory_Last /= 0 then begin Change_Dir (Path_Name (1 .. Directory_Last)); exception when Directory_Error => Prj.Com.Fail ("unknown directory """, Path_Name (1 .. Directory_Last), """"); end; end if; if Project_File then -- Delete the source list file, if it already exists declare Discard : Boolean; begin Delete_File (Source_List_Path (1 .. Source_List_Last), Success => Discard); end; -- And create a new source list file. -- Fail if file cannot be created. Source_List_FD := Create_New_File (Name => Source_List_Path (1 .. Source_List_Last), Fmode => Text); if Source_List_FD = Invalid_FD then Prj.Com.Fail ("cannot create file """, Source_List_Path (1 .. Source_List_Last), """"); end if; end if; -- Compile the regular expressions. Fails immediately if any of -- the specified strings is in error. for Index in Excluded_Expressions'Range loop if Very_Verbose then Output.Write_Str ("Excluded pattern: """); Output.Write_Str (Excluded_Patterns (Index).all); Output.Write_Line (""""); end if; begin Excluded_Expressions (Index) := Compile (Pattern => Excluded_Patterns (Index).all, Glob => True); exception when Error_In_Regexp => Prj.Com.Fail ("invalid regular expression """, Excluded_Patterns (Index).all, """"); end; end loop; for Index in Foreign_Expressions'Range loop if Very_Verbose then Output.Write_Str ("Foreign pattern: """); Output.Write_Str (Foreign_Patterns (Index).all); Output.Write_Line (""""); end if; begin Foreign_Expressions (Index) := Compile (Pattern => Foreign_Patterns (Index).all, Glob => True); exception when Error_In_Regexp => Prj.Com.Fail ("invalid regular expression """, Foreign_Patterns (Index).all, """"); end; end loop; for Index in Regular_Expressions'Range loop if Very_Verbose then Output.Write_Str ("Pattern: """); Output.Write_Str (Name_Patterns (Index).all); Output.Write_Line (""""); end if; begin Regular_Expressions (Index) := Compile (Pattern => Name_Patterns (Index).all, Glob => True); exception when Error_In_Regexp => Prj.Com.Fail ("invalid regular expression """, Name_Patterns (Index).all, """"); end; end loop; if Project_File then if Opt.Verbose_Mode then Output.Write_Str ("Naming project file name is """); Output.Write_Str (Project_Naming_File_Name (1 .. Project_Naming_Last)); Output.Write_Line (""""); end if; -- If there were no already existing project file, or if the parsing -- was unsuccessful, create an empty project node with the correct -- name and its project declaration node. if Project_Node = Empty_Node then Project_Node := Default_Project_Node (Of_Kind => N_Project, In_Tree => Tree); Set_Name_Of (Project_Node, Tree, To => Output_Name_Id); Set_Project_Declaration_Of (Project_Node, Tree, To => Default_Project_Node (Of_Kind => N_Project_Declaration, In_Tree => Tree)); end if; -- Create the naming project node, and add an attribute declaration -- for Source_Files as an empty list, to indicate there are no -- sources in the naming project. Project_Naming_Node := Default_Project_Node (Of_Kind => N_Project, In_Tree => Tree); Set_Name_Of (Project_Naming_Node, Tree, To => Project_Naming_Id); Project_Naming_Decl := Default_Project_Node (Of_Kind => N_Project_Declaration, In_Tree => Tree); Set_Project_Declaration_Of (Project_Naming_Node, Tree, Project_Naming_Decl); Naming_Package := Default_Project_Node (Of_Kind => N_Package_Declaration, In_Tree => Tree); Set_Name_Of (Naming_Package, Tree, To => Name_Naming); declare Decl_Item : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Declarative_Item, In_Tree => Tree); Attribute : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Attribute_Declaration, In_Tree => Tree, And_Expr_Kind => List); Expression : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Expression, In_Tree => Tree, And_Expr_Kind => List); Term : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Term, In_Tree => Tree, And_Expr_Kind => List); Empty_List : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Literal_String_List, In_Tree => Tree); begin Set_First_Declarative_Item_Of (Project_Naming_Decl, Tree, To => Decl_Item); Set_Next_Declarative_Item (Decl_Item, Tree, Naming_Package); Set_Current_Item_Node (Decl_Item, Tree, To => Attribute); Set_Name_Of (Attribute, Tree, To => Name_Source_Files); Set_Expression_Of (Attribute, Tree, To => Expression); Set_First_Term (Expression, Tree, To => Term); Set_Current_Term (Term, Tree, To => Empty_List); end; -- Add a with clause on the naming project in the main project, if -- there is not already one. declare With_Clause : Project_Node_Id := First_With_Clause_Of (Project_Node, Tree); begin while With_Clause /= Empty_Node loop exit when Prj.Tree.Name_Of (With_Clause, Tree) = Project_Naming_Id; With_Clause := Next_With_Clause_Of (With_Clause, Tree); end loop; if With_Clause = Empty_Node then With_Clause := Default_Project_Node (Of_Kind => N_With_Clause, In_Tree => Tree); Set_Next_With_Clause_Of (With_Clause, Tree, To => First_With_Clause_Of (Project_Node, Tree)); Set_First_With_Clause_Of (Project_Node, Tree, To => With_Clause); Set_Name_Of (With_Clause, Tree, To => Project_Naming_Id); -- We set the project node to something different than -- Empty_Node, so that Prj.PP does not generate a limited -- with clause. Set_Project_Node_Of (With_Clause, Tree, Non_Empty_Node); Name_Len := Project_Naming_Last; Name_Buffer (1 .. Name_Len) := Project_Naming_File_Name (1 .. Project_Naming_Last); Set_String_Value_Of (With_Clause, Tree, To => Name_Find); end if; end; Project_Declaration := Project_Declaration_Of (Project_Node, Tree); -- Add a renaming declaration for package Naming in the main project declare Decl_Item : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Declarative_Item, In_Tree => Tree); Naming : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Package_Declaration, In_Tree => Tree); begin Set_Next_Declarative_Item (Decl_Item, Tree, To => First_Declarative_Item_Of (Project_Declaration, Tree)); Set_First_Declarative_Item_Of (Project_Declaration, Tree, To => Decl_Item); Set_Current_Item_Node (Decl_Item, Tree, To => Naming); Set_Name_Of (Naming, Tree, To => Name_Naming); Set_Project_Of_Renamed_Package_Of (Naming, Tree, To => Project_Naming_Node); -- Attach the comments, if any, that were saved for package -- Naming. Tree.Project_Nodes.Table (Naming).Comments := Naming_Package_Comments; end; -- Add an attribute declaration for Source_Dirs, initialized as an -- empty list. Directories will be added as they are read from the -- directory list file. declare Decl_Item : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Declarative_Item, In_Tree => Tree); Attribute : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Attribute_Declaration, In_Tree => Tree, And_Expr_Kind => List); Expression : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Expression, In_Tree => Tree, And_Expr_Kind => List); Term : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Term, In_Tree => Tree, And_Expr_Kind => List); begin Set_Next_Declarative_Item (Decl_Item, Tree, To => First_Declarative_Item_Of (Project_Declaration, Tree)); Set_First_Declarative_Item_Of (Project_Declaration, Tree, To => Decl_Item); Set_Current_Item_Node (Decl_Item, Tree, To => Attribute); Set_Name_Of (Attribute, Tree, To => Name_Source_Dirs); Set_Expression_Of (Attribute, Tree, To => Expression); Set_First_Term (Expression, Tree, To => Term); Source_Dirs_List := Default_Project_Node (Of_Kind => N_Literal_String_List, In_Tree => Tree, And_Expr_Kind => List); Set_Current_Term (Term, Tree, To => Source_Dirs_List); -- Attach the comments, if any, that were saved for attribute -- Source_Dirs. Tree.Project_Nodes.Table (Attribute).Comments := Source_Dirs_Comments; end; -- Add an attribute declaration for Source_List_File with the -- source list file name that will be created. declare Decl_Item : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Declarative_Item, In_Tree => Tree); Attribute : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Attribute_Declaration, In_Tree => Tree, And_Expr_Kind => Single); Expression : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Expression, In_Tree => Tree, And_Expr_Kind => Single); Term : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Term, In_Tree => Tree, And_Expr_Kind => Single); Value : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Literal_String, In_Tree => Tree, And_Expr_Kind => Single); begin Set_Next_Declarative_Item (Decl_Item, Tree, To => First_Declarative_Item_Of (Project_Declaration, Tree)); Set_First_Declarative_Item_Of (Project_Declaration, Tree, To => Decl_Item); Set_Current_Item_Node (Decl_Item, Tree, To => Attribute); Set_Name_Of (Attribute, Tree, To => Name_Source_List_File); Set_Expression_Of (Attribute, Tree, To => Expression); Set_First_Term (Expression, Tree, To => Term); Set_Current_Term (Term, Tree, To => Value); Name_Len := Source_List_Last; Name_Buffer (1 .. Name_Len) := Source_List_Path (1 .. Source_List_Last); Set_String_Value_Of (Value, Tree, To => Name_Find); -- If there was no comments for attribute Source_List_File, put -- those for Source_Files, if they exist. if Source_List_File_Comments /= Empty_Node then Tree.Project_Nodes.Table (Attribute).Comments := Source_List_File_Comments; else Tree.Project_Nodes.Table (Attribute).Comments := Source_Files_Comments; end if; end; end if; -- Process each directory for Index in Directories'Range loop declare Dir_Name : constant String := Directories (Index).all; Last : Natural := Dir_Name'Last; Recursively : Boolean := False; begin if Dir_Name'Length >= 4 and then (Dir_Name (Last - 2 .. Last) = "/**") then Last := Last - 3; Recursively := True; end if; if Project_File then -- Add the directory in the list for attribute Source_Dirs declare Expression : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Expression, In_Tree => Tree, And_Expr_Kind => Single); Term : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Term, In_Tree => Tree, And_Expr_Kind => Single); Value : constant Project_Node_Id := Default_Project_Node (Of_Kind => N_Literal_String, In_Tree => Tree, And_Expr_Kind => Single); begin if Current_Source_Dir = Empty_Node then Set_First_Expression_In_List (Source_Dirs_List, Tree, To => Expression); else Set_Next_Expression_In_List (Current_Source_Dir, Tree, To => Expression); end if; Current_Source_Dir := Expression; Set_First_Term (Expression, Tree, To => Term); Set_Current_Term (Term, Tree, To => Value); Name_Len := Dir_Name'Length; Name_Buffer (1 .. Name_Len) := Dir_Name; Set_String_Value_Of (Value, Tree, To => Name_Find); end; end if; Process_Directory (Dir_Name (Dir_Name'First .. Last), Recursively); end; end loop; if Project_File then Close (Source_List_FD); end if; declare Discard : Boolean; begin -- Delete the file if it already exists Delete_File (Path_Name (Directory_Last + 1 .. Path_Last), Success => Discard); -- Create a new one if Opt.Verbose_Mode then Output.Write_Str ("Creating new file """); Output.Write_Str (Path_Name (Directory_Last + 1 .. Path_Last)); Output.Write_Line (""""); end if; Output_FD := Create_New_File (Path_Name (Directory_Last + 1 .. Path_Last), Fmode => Text); -- Fails if project file cannot be created if Output_FD = Invalid_FD then Prj.Com.Fail ("cannot create new """, Path_Name (1 .. Path_Last), """"); end if; if Project_File then -- Output the project file Prj.PP.Pretty_Print (Project_Node, Tree, W_Char => Write_A_Char'Access, W_Eol => Write_Eol'Access, W_Str => Write_A_String'Access, Backward_Compatibility => False); Close (Output_FD); -- Delete the naming project file if it already exists Delete_File (Project_Naming_File_Name (1 .. Project_Naming_Last), Success => Discard); -- Create a new one if Opt.Verbose_Mode then Output.Write_Str ("Creating new naming project file """); Output.Write_Str (Project_Naming_File_Name (1 .. Project_Naming_Last)); Output.Write_Line (""""); end if; Output_FD := Create_New_File (Project_Naming_File_Name (1 .. Project_Naming_Last), Fmode => Text); -- Fails if naming project file cannot be created if Output_FD = Invalid_FD then Prj.Com.Fail ("cannot create new """, Project_Naming_File_Name (1 .. Project_Naming_Last), """"); end if; -- Output the naming project file Prj.PP.Pretty_Print (Project_Naming_Node, Tree, W_Char => Write_A_Char'Access, W_Eol => Write_Eol'Access, W_Str => Write_A_String'Access, Backward_Compatibility => False); Close (Output_FD); else -- Write to the output file each entry in the SFN_Pragmas table -- as an pragma Source_File_Name. for Index in 1 .. SFN_Pragmas.Last loop Write_A_String ("pragma Source_File_Name"); Write_Eol; Write_A_String (" ("); Write_A_String (Get_Name_String (SFN_Pragmas.Table (Index).Unit)); Write_A_String (","); Write_Eol; if SFN_Pragmas.Table (Index).Spec then Write_A_String (" Spec_File_Name => """); else Write_A_String (" Body_File_Name => """); end if; Write_A_String (Get_Name_String (SFN_Pragmas.Table (Index).File)); Write_A_String (""""); if SFN_Pragmas.Table (Index).Index /= 0 then Write_A_String (", Index =>"); Write_A_String (SFN_Pragmas.Table (Index).Index'Img); end if; Write_A_String (");"); Write_Eol; end loop; Close (Output_FD); end if; end; end Make; ---------------- -- Write_Char -- ---------------- procedure Write_A_Char (C : Character) is begin Write_A_String ((1 => C)); end Write_A_Char; --------------- -- Write_Eol -- --------------- procedure Write_Eol is begin Write_A_String ((1 => ASCII.LF)); end Write_Eol; -------------------- -- Write_A_String -- -------------------- procedure Write_A_String (S : String) is Str : String (1 .. S'Length); begin if S'Length > 0 then Str := S; if Write (Output_FD, Str (1)'Address, Str'Length) /= Str'Length then Prj.Com.Fail ("disk full"); end if; end if; end Write_A_String; end Prj.Makr;
4A-119ec0013-Pravallika-MpMcP-07-10-2021.asm
Invisible-Luna/8086emu_program
1
243002
<gh_stars>1-10 ; <NAME> ; 119EC0013 ; ========== Finding Maximum and Minimum Numbers ======== include 'emu8086.inc' org 100h mov si,5000h mov [si],69h mov [si+1],96h mov [si+2],12h mov [si+3],77h mov [si+4],42h mov [si+5],68h mov [si+6],32h mov [si+7],11h mov [si+8],84h mov [si+9],93h mov [si+10],66h mov [si+11],52h mov [si+12],56h mov [si+13],10h mov [si+14],84h mov [si+15],98h mov [si+16],21h mov [si+17],2h ;mini mov [si+18],99h ;max mov [si+19],18h miniNu DB ? maxNu DB ? ;al -> mini bl -> max ;Finding Minimum Number mov dx,13h ;check RAM mov al,[si] ;69h -> al inc si ;address increment loop1: mov bl,[si] ; 96h -> bl cmp al,bl ;compare (zero flag, carry flag...) jc compare1 ;Jump If Carry to loop ab, It checks whether the carry flag is set or not. ;If yes, then jump takes place, that is: If CF = 1, then jump mov al,bl compare1: inc si dec dx JNZ loop1 ;Jump if Not Zero mov si,5020h mov [si],al ;storing mini value in 5020 address mov si,5000h ;starting the adressing again mov di,5040h ;destination index register mov dx,14h loop2: ;Finding Maximum Number mov al,[si] mov [di],al ;copying the initial values to addresses starting from 5040 inc si inc di dec dx JNZ loop2 mov di,5040h ;starting mov dx,13h mov al,[di] inc di loop3: mov bl,[di] cmp al,bl jnc compare2 ;Jump if Not Carry, t checks whether the carry flag is reset or not. ;If yes, then jump takes place, that is: If CF = 0, then jump mov al,bl compare2: inc di dec dx JNZ loop3 mov si,5060h ;storing max value here mov [si],al ;Storing and Printing Minimum and Maximum values ;STORING & Printing ;minimum mov cl, dl mov si,5020h mov al,[si] mov miniNu, al mov dl, al add dl, 48 mov ah, 02 int 21h mov dx, 13 mov ah, 2 int 21h mov dx, 10 ;new line mov ah,2 int 21h ;maximum mov si,5060h mov bl,[si] mov maxNu, bl mov bl, 10 div bl mov dl, bl add dl, 48 mov ah, 02 int 21h mov dl, bl add dl, 48 mov ah, 02 int 21h MOV AH, 4Ch ;exit INT 21h ret
asm/exercise_6.3/string_loop.asm
severinkaderli/BTI7061-CSBas
1
100158
<gh_stars>1-10 section .data String: db "Hello, World!" StringLength: equ $ - String PrintTimes: db 5 section .text global _start EXTERN printText, printNewline, convertNumberToString _start: mov bl, [PrintTimes] loop: mov rcx, String mov rdx, StringLength call printText call printNewline dec rbx jnz loop exit: mov rax, 1 mov rbx, 0 int 0x80
accessibility.asm
tcprescott/z3randomizer
0
172374
<reponame>tcprescott/z3randomizer<filename>accessibility.asm ;================================================================================ ; Accessibility Fixes ;================================================================================ FlipGreenPendant: LDA $0C : CMP #$38 : BNE + ; check if we have green pendant ORA #$40 : STA $0C ; flip it + LDA $0D : STA $0802, X ; stuff we wrote over "Set CHR, palette, and priority of the sprite" LDA $0C : STA $0803, X RTL ;================================================================================ ConditionalLightning: CMP.b #$05 : BEQ ++ CMP.b #$2C : BEQ ++ CMP.b #$5A : BEQ ++ LDA.l DisableFlashing : BNE ++ LDA.b #$32 : STA.w $9A RTL ++ LDA.b #$72 STA $9A RTL ;================================================================================ ConditionalWhitenBg: LDX.b #$00 LDA.l DisableFlashing REP #$20 : BNE + LDA $00,X JSR WhitenLoopReal RTL + LDA $00 JSR WhitenLoopDummy RTL ;================================================================================ WhitenLoopReal: - LDA $7EC340, X : JSL Filter_Majorly_Whiten_Color : STA $7EC540, X LDA $7EC350, X : JSL Filter_Majorly_Whiten_Color : STA $7EC550, X LDA $7EC360, X : JSL Filter_Majorly_Whiten_Color : STA $7EC560, X LDA $7EC370, X : JSL Filter_Majorly_Whiten_Color : STA $7EC570, X LDA $7EC380, X : JSL Filter_Majorly_Whiten_Color : STA $7EC580, X LDA $7EC390, X : JSL Filter_Majorly_Whiten_Color : STA $7EC590, X LDA $7EC3A0, X : JSL Filter_Majorly_Whiten_Color : STA $7EC5A0, X LDA $7EC3B0, X : JSL Filter_Majorly_Whiten_Color : STA $7EC5B0, X LDA $7EC3C0, X : JSL Filter_Majorly_Whiten_Color : STA $7EC5C0, X LDA $7EC3D0, X : JSL Filter_Majorly_Whiten_Color : STA $7EC5D0, X LDA $7EC3E0, X : JSL Filter_Majorly_Whiten_Color : STA $7EC5E0, X INX #2 : CPX.b #$10 : BEQ + JMP - + LDA $7EC3F0 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F0 LDA $7EC3F2 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F2 LDA $7EC3F4 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F4 LDA $10 : CMP.w #$07 : BNE + LDA $048E CMP.w #$3C : BEQ ++ ; hookshot cave CMP.w #$9D : BEQ ++ ; gt right CMP.w #$9C : BEQ ++ ; gt big room CMP.w #$A5 : BEQ ++ ; wizzrobes 1 + LDA $7EC3F6 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F6 LDA $7EC3F8 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F8 BRA +++ ++ LDA $7EC3F6 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F6 LDA $7EC3F8 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F8 BRA +++ +++ LDA $7EC3FA : JSL Filter_Majorly_Whiten_Color : STA $7EC5FA LDA $7EC3FC : JSL Filter_Majorly_Whiten_Color : STA $7EC5FC LDA $7EC3FE : JSL Filter_Majorly_Whiten_Color : STA $7EC5FE REP #$10 LDA $7EC540 : TAY LDA $7EC300 : BNE + TAY + TYA : STA $7EC500 SEP #$30 RTS ;================================================================================ WhitenLoopDummy: - LDA $7EC340, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC540, X LDA $7EC350, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC550, X LDA $7EC360, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC560, X LDA $7EC370, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC570, X LDA $7EC380, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC580, X LDA $7EC390, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC590, X LDA $7EC3A0, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC5A0, X LDA $7EC3B0, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC5B0, X LDA $7EC3C0, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC5C0, X LDA $7EC3D0, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC5D0, X LDA $7EC3E0, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC5E0, X INX #2 : CPX.b #$10 : BEQ + JMP - + LDA $7EC3F0 : JSL Filter_Majorly_Whiten_Color : LDA $7EC5F0 LDA $7EC3F2 : JSL Filter_Majorly_Whiten_Color : LDA $7EC5F2 LDA $7EC3F4 : JSL Filter_Majorly_Whiten_Color : LDA $7EC5F4 LDA $10 : CMP.w #$07 : BNE + ; only light invisifloor if we're in dungeon submodule LDA $048E CMP.w #$3C : BEQ ++ ; hookshot cave CMP.w #$9D : BEQ ++ ; gt right CMP.w #$9C : BEQ ++ ; gt big room CMP.w #$A5 : BEQ ++ ; wizzrobes 1 + LDA $7EC3F6 : JSL Filter_Majorly_Whiten_Color : LDA $7EC5F6 LDA $7EC3F8 : JSL Filter_Majorly_Whiten_Color : LDA $7EC5F8 BRA +++ ++ LDA $7EC3F6 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F6 LDA $7EC3F8 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F8 BRA +++ +++ LDA $7EC3FA : JSL Filter_Majorly_Whiten_Color : LDA $7EC5FA LDA $7EC3FC : JSL Filter_Majorly_Whiten_Color : LDA $7EC5FC LDA $7EC3FE : JSL Filter_Majorly_Whiten_Color : LDA $7EC5FE REP #$10 LDA $7EC540 : TAY LDA $7EC300 : BNE + TAY + TYA : STA $7EC500 SEP #$30 RTS ;================================================================================ RestoreBgEther: LDX.b #$00 LDA.l DisableFlashing : REP #$20 : BNE + - LDA $00,X LDA $7EC340, X : STA $7EC540, X LDA $7EC350, X : STA $7EC550, X LDA $7EC360, X : STA $7EC560, X LDA $7EC370, X : STA $7EC570, X LDA $7EC380, X : STA $7EC580, X LDA $7EC390, X : STA $7EC590, X LDA $7EC3A0, X : STA $7EC5A0, X LDA $7EC3B0, X : STA $7EC5B0, X LDA $7EC3C0, X : STA $7EC5C0, X LDA $7EC3D0, X : STA $7EC5D0, X LDA $7EC3E0, X : STA $7EC5E0, X LDA $7EC3F0, X : STA $7EC5F0, X INX #2 : CPX.b #$10 : BNE - BRA ++ + - LDA $00 LDA $7EC340, X : LDA $7EC540, X LDA $7EC350, X : LDA $7EC550, X LDA $7EC360, X : LDA $7EC560, X LDA $7EC370, X : LDA $7EC570, X LDA $7EC380, X : LDA $7EC580, X LDA $7EC390, X : LDA $7EC590, X LDA $7EC3A0, X : LDA $7EC5A0, X LDA $7EC3B0, X : LDA $7EC5B0, X LDA $7EC3C0, X : LDA $7EC5C0, X LDA $7EC3D0, X : LDA $7EC5D0, X LDA $7EC3E0, X : LDA $7EC5E0, X LDA $7EC3F0, X : LDA $7EC5F0, X INX #2 : CPX.b #$10 : BNE - BRA ++ ++ JML $02FF51 ;================================================================================ DDMConditionalLightning: LDA.l DisableFlashing REP #$20 BNE + LDA.w $0000 LDX.b #$02 JML $07FA7F + LDA.b $00 : LDX.b #$02 : LDY #$00 - LDA $F4EB, Y : LDA $7EC560, X LDA $F4F9, Y : LDA $7EC570, X LDA $F507, Y : LDA $7EC590, X LDA $F515, Y : LDA $7EC5E0, X LDA $F523, Y : LDA $7EC5F0, X INY #2 INX #2 : CPX.b #$10 : BNE - JML $07FAAC ;================================================================================ ConditionalGTFlash: LDA.l DisableFlashing REP #$20 BNE + LDA $0000 - LDA $F9C1, Y : STA $7EC5D0, X INY #2 INX #2 : CPX.b #$10 : BNE - RTL + LDA $00 - LDA $F9C1, Y : LDA $7EC5D0, X INY #2 INX #2 : CPX.b #$10 : BNE - RTL ;================================================================================ ConditionalRedFlash: LDA.l DisableFlashing REP #$20 : BNE + LDA $00,X LDA.w #$1D59 : STA $7EC5DA LDA.w #$25FF : STA $7EC5DC LDA.w #$001A RTL + LDA $00 LDA.w #$1D59 : LDA $7EC5DA LDA.w #$25FF : LDA $7EC5DC LDA.w #$0000 RTL ;================================================================================ ConditionalPedAncilla: LDA.l DisableFlashing REP #$20 : BNE + LDA $00,X LDA $00 : STA $04 LDA $02 : STA $06 RTL + LDA $00 LDA $00 : LDA $04 LDA $02 : LDA $06 RTL ;================================================================================ ConditionalChangeGearPalette: PHY STA $00 SEP #$20 LDA.l DisableFlashing : REP #$20 : BNE + LDA $00,X - LDA [$00] : STA $7EC300, X : STA $7EC500, X INC $00 : INC $00 INX #2 DEY : BPL - BRA ++ + LDA $00 - LDA [$00] : LDA $7EC300, X : LDA $7EC500, X INC $00 : INC $00 INX #2 DEY : BPL - BRA ++ ++ PLY ; use what was in Y register to determine which p flags to set CPY #$000E : BNE + SEP #$20 + SEP #$10 RTL
main/Graphs/Definition.agda
awswan/nielsenschreier-hott
0
10169
{-# OPTIONS --without-K --exact-split --rewriting #-} open import lib.Basics open import lib.types.Bool module Graphs.Definition where {- A graph consists of types of Edges and Vertices together with two endpoint maps. We often just talk about the types and the endpoint maps are clear from the context (i.e. derived by instance resolution). -} record Graph {i j : ULevel} (E : Type i) (V : Type j) : Type (lmax i j) where constructor graph field π₀ : E → V π₁ : E → V open Graph ⦃...⦄ public -- see agda documentation on instance arguments
kv-avm-actor_pool.ads
davidkristola/vole
4
25165
with kv.avm.Executables; with kv.avm.Actor_References; package kv.avm.Actor_Pool is procedure Add (Actor : in kv.avm.Executables.Executable_Access; Reference : out kv.avm.Actor_References.Actor_Reference_Type); procedure Delete (Reference : in kv.avm.Actor_References.Actor_Reference_Type); function Resolve(Reference : kv.avm.Actor_References.Actor_Reference_Type) return kv.avm.Executables.Executable_Access; procedure Empty_Actor_Pool; end kv.avm.Actor_Pool;
lab2-3/ascii.asm
Winterpuma/bmstu_MDPL
14
299
<reponame>Winterpuma/bmstu_MDPL SSEG SEGMENT PARA STACK 'STACK' DB 64 DUP(0) SSEG ENDS DSEG SEGMENT PARA 'DATA' ; DATA DSEG ENDS CSEG SEGMENT PARA 'CODE' ASSUME CS:CSEG, DS:DSEG, SS:SSEG OUTPUT PROC CMP DL, 9 JA M1 ADD DL, '0' ; if dec digit JMP M2 M1: ADD DL, 'A' ; if hex digit SUB DL, 10 ; minus offset M2: MOV AH, 2 INT 21H RET OUTPUT ENDP START PROC FAR MOV AH,7 INT 21H MOV DL, AL MOV CL, 4 SHR DL, CL ; shift by 4 bytes to get first digit MOV BL, AL ; after outputing dl al will change CALL OUTPUT MOV DL, BL AND DL, 00001111B ; last digit CALL OUTPUT MOV AH,4CH INT 21H START ENDP CSEG ENDS END START
src/main/antlr/FunctionDef.g4
Jacarte/astminer
1
2185
<reponame>Jacarte/astminer /*** Grammar copied from joern project: https://github.com/octopus-platform/joern ***/ grammar FunctionDef; import ModuleLex; function_def : template_decl_start? return_type? function_name function_param_list ctor_list? compound_statement; return_type : (function_decl_specifiers* type_name) ptr_operator*; function_param_list : '(' parameter_decl_clause? ')' CV_QUALIFIER* exception_specification?; parameter_decl_clause: (parameter_decl (',' parameter_decl)*) (',' '...')? | VOID; parameter_decl : param_decl_specifiers parameter_id; parameter_id: ptrs? ('(' parameter_id ')' | parameter_name) type_suffix?; compound_statement: OPENING_CURLY { skipToEndOfObject(); }; ctor_list: ':' ctor_initializer (',' ctor_initializer)*; ctor_initializer: initializer_id ctor_expr; initializer_id : '::'? identifier; ctor_expr: '(' expr? ')'; function_name: '(' function_name ')' | identifier | OPERATOR operator; exception_specification : THROW '(' type_id_list ')'; type_id_list: no_brackets* ('(' type_id_list ')' no_brackets*)*;
08/FunctionCalls_tests/Call/Call.asm
ashiroji/Nand2Tetris
0
175565
<filename>08/FunctionCalls_tests/Call/Call.asm //push constant 123 @123 //A=index D=A //D is now the constant @SP A=M //A = @SP M=D //M[A] = value to push @SP M=M+1 //sp+1 //push constant 456 @456 //A=index D=A //D is now the constant @SP A=M //A = @SP M=D //M[A] = value to push @SP M=M+1 //sp+1 //push returnAddress @returnAddress0 D=A //D=returnAddress0 @SP A=M //A = @SP M=D //M[A] = value to push @SP M=M+1 //sp+1 //push LCL @LCL D=M //D=LCL @SP A=M //A = @SP M=D //M[A] = value to push @SP M=M+1 //sp+1 //push ARG @ARG D=M //D=ARG @SP A=M //A = @SP M=D //M[A] = value to push @SP M=M+1 //sp+1 //push THIS @THIS D=M //D=THIS @SP A=M //A = @SP M=D //M[A] = value to push @SP M=M+1 //sp+1 //push THAT @THAT D=M //D=THAT @SP A=M //A = @SP M=D //M[A] = value to push @SP M=M+1 //sp+1 //ARG = SP - nArgs - 5 @SP D=M //D=SP @2 D=D-A //D = SP-nArgs @5 D=D-A //D=SP-5 @ARG M=D //ARG= SP - nArgs -5 //LCL = SP @SP D=M //D=SP @LCL M=D //LCL = SP //goto Call.fn @Call.fn//label to go to 0;JMP //unconditional jump //label returnAddress0 (returnAddress0) //label declaration //label loop (loop) //label declaration //goto loop @loop//label to go to 0;JMP //unconditional jump (Call.fn) //function name //label halt (halt) //label declaration //goto halt @halt//label to go to 0;JMP //unconditional jump
source/league/matreshka-internals-strings-c.ads
svn2github/matreshka
24
7004
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, <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 package provides UTF-16 encoded string utilities to interface Ada and -- C. It is used by Oracle database driver, SQLite3 database driver and on -- Windows. ------------------------------------------------------------------------------ with League.Strings; package Matreshka.Internals.Strings.C is pragma Preelaborate; type Utf16_Code_Unit_Access is access all Matreshka.Internals.Utf16.Utf16_Code_Unit; pragma Convention (C, Utf16_Code_Unit_Access); function To_Valid_Universal_String (Text : Utf16_Code_Unit_Access) return League.Strings.Universal_String; -- Converts null-terminated text segment starting at specified position -- into Universal_String. String is trimed when invalid data is found. function To_Valid_Universal_String (Text : Utf16_Code_Unit_Access; Size : Matreshka.Internals.Utf16.Utf16_String_Index) return League.Strings.Universal_String; -- Converts text segment starting at specified position into -- Universal_String. String is trimed when invalid data is found. procedure Validate_And_Fixup (String : in out Shared_String_Access; Valid : out Boolean); -- Validates data in the specified null-terminated string to be valid -- UTF-16, fixup Unused and Length and writes null terminator. Sets Valid -- to True when data is valid UTF-16, and to False otherwise. Invalid -- string is truncated to be valid, empty string is replaced by empty -- shared string. procedure Validate_And_Fixup (String : in out Shared_String_Access; Size : Matreshka.Internals.Utf16.Utf16_String_Index; Valid : out Boolean); -- Validates data in the specified string of size Size to be valid UTF-16, -- fixup Length and write null terminator. Sets Valid to True when data is -- valid UTF-16, and to False otherwise. Invalid string is truncated to be -- valid, empty string is replaced by empty shared string. end Matreshka.Internals.Strings.C;
libsrc/target/pmd85/stdio/generic_console.asm
Frodevan/z88dk
640
25289
<reponame>Frodevan/z88dk<filename>libsrc/target/pmd85/stdio/generic_console.asm SECTION code_clib PUBLIC generic_console_cls PUBLIC generic_console_printc PUBLIC generic_console_scrollup PUBLIC generic_console_set_ink PUBLIC generic_console_set_paper PUBLIC generic_console_set_attribute PUBLIC generic_console_xypos EXTERN CONSOLE_COLUMNS EXTERN CONSOLE_ROWS EXTERN generic_console_font32 EXTERN generic_console_udg32 EXTERN generic_console_flags EXTERN conio_map_colour EXTERN __pmd85_attribute EXTERN __pmd85_attribute2 defc DISPLAY = 0xc000 generic_console_set_paper: generic_console_set_attribute: ret generic_console_set_ink: call conio_map_colour rrca rrca ld c,a and @11000000 ld (__pmd85_attribute),a ld a,c rrca rrca and @11000000 ld (__pmd85_attribute2),a ret generic_console_scrollup: push bc push de ld de,DISPLAY ld hl,DISPLAY+512 ld c,256 - 8 sloop1: ld b,48 sloop2: ld a,(hl) ld (de),a inc hl inc de djnz sloop2 ld de,16 add hl,de ld d,h ld e,l dec d dec d dec c jr nz,sloop1 ld c,8 sloop3: ld b,48 sloop4: xor a ld (de),a inc de dec b jr nz,sloop4 ld hl,16 add hl,de ex de,hl dec c jr nz,sloop3 pop de pop bc ret generic_console_cls: ld hl,DISPLAY ld c,0 loop1: ld b,48 loop2: ld (hl),0 inc hl djnz loop2 ld de,16 add hl,de dec c jr nz,loop1 ret generic_console_printc: ld e,d ld d,0 ld a,e ld hl,(generic_console_font32) rlca jr nc,not_udg ld a,e and 127 ld e,a ld hl,(generic_console_udg32) inc h ;We decrement later not_udg: ex de,hl add hl,hl add hl,hl add hl,hl add hl,de dec h ; -32 characters ex de,hl ; de = font call generic_console_xypos ld a,(generic_console_flags) rlca sbc a,a ld c,a ;x = 0 / 255 ld b,4 loop: push bc ld a,(generic_console_flags) and @000010000 ld a,(de) jr z,not_bold ld b,a rrca or b not_bold: xor c ;Handle inverse ;Now, mirror bits ld c,a rlca rlca xor c and 0xaa xor c ld c,a rlca rlca rlca ld b,a ld a,c rrca ld c,a ld a,b xor c and 0x66 xor c and @00111111 ld c,a ld a,(__pmd85_attribute) or c ld (hl),a inc de ld bc,64 ;Move to next row add hl,bc ; 2nd row pop bc push bc ld a,(generic_console_flags) and @000010000 ld a,(de) jr z,not_bold2 ld b,a rrca or b not_bold2: xor c ;Handle inverse ld c,a ;Mirror rlca rlca xor c and 0xaa xor c ld c,a rlca rlca rlca ld b,a ld a,c rrca ld c,a ld a,b xor c and 0x66 xor c and @00111111 ;Get required bits ld c,a ld a,(__pmd85_attribute2) ;second attribute or c ld (hl),a inc de ld bc,64 ;Move to next row add hl,bc pop bc djnz loop ; And now underline ld a,(generic_console_flags) and @000001000 ret z ld bc,-64 add hl,bc ld a,(__pmd85_attribute2) or @00111111 ld (hl),a ret ; Entry: b = row ; c = column ; Exit: hl = address generic_console_xypos: ; 512 bytes per row ld h,b ;* 256 ld l,0 add hl,hl ld b,+(DISPLAY / 256) add hl,bc ret ret
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/mak.lzh/mak/kart-pers.asm
prismotizm/gigaleak
0
171292
Name: kart-pers.asm Type: file Size: 14825 Last-Modified: '1992-08-06T07:17:25Z' SHA-1: E023811EBE5F9029C9E35ADCA6A4099334DBCA27 Description: null
my Projects/RunningLights/runlight.asm
simonbrennan/PicMicroASM
1
86828
<gh_stars>1-10 ; ********************************************************** ; * Programmer : <NAME> * ; * Date : 19/10/2003 * ; * Description : This program is a simple running light * ; * circuit (Night Rider) * ; * * ; * Inputs : Address 03h -> Status * ; * Address 88h -> TrisD * ; * Address 85h -> TrisA * ; * Address 20h -> Loop1 * ; * Address 21h -> Loop2 * ; * Address 22h -> Loop3 * ; * Address 05h -> PortA * ; * Address 9Fh -> Adcon1 * ; * Outputs: Address 03h -> PortD * ; * * ; * Version: 0.1 - Make Lights run in one direction * ; ********************************************************** list p=16F877 rp0 EQU 05h ; Bit 5 of Status Register (Ram bank select) f EQU 01h ; Result of operation into File w EQU 00h ; Result of operation into Working Register zflag EQU 02h ; Zflag of status register pcl EQU 02h ; Address of program counter latch status EQU 03h ; Address of status register porta EQU 05h ; Address of Port A. portd EQU 08h ; Address of Port D. loop1 EQU 20h ; Count variable for the first loop loop2 EQU 21h ; Count variable for the second loop loop3 EQU 22h ; Count variable for the third loop counter EQU 23h ; Counter variable for running lights. trisa EQU 85h ; Address of Tristate Buffer A. trisd EQU 88h ; Address of Tristate Buffer D. adcon1 EQU 9Fh ; Address of Adcon1. ORG 0000h INIT bsf status,rp0 ; Switch to Rambank 1 movlw 0FFh ; Set all bits on PortA to digital using Adcon1 movwf adcon1 ; // movlw 0ffh ; Set all bits on PortA to input movwf trisa ; // clrf trisd ; Set all bits on PortD to output (For Led's) bcf status,rp0 ; Switch to Rambank 0 clrf portd ; Switch off all Led's on portd clrf counter ; Switch START clrf portd ; btfsc porta,5 ; check if the switch has been pressed goto START ; do nothing if the switch is not pressed movf counter,w ; Check if the counter is at zero btfsc status,zflag ; // call GOUP ; If it is at zero then go and count up (Move LED's to right) sublw 03h ; Check if counter is a 7 (Must start going other way) btfsc status,zflag ; // call GODOWN ; If it is at seven then go and count down (Move LED's to left) goto START ; loop this code forever GOUP call DELAY ; Give us a delay movf counter,w ; use lookup table to get led value call LIGHTCODE ; // movwf portd ; Put returned value into portd incf counter ; increment the counter movf counter,w ; check if counter is at 7 sublw 03h ; // btfsc status,zflag ; return ; goto GOUP ; GODOWN call DELAY ; Give us a delay movf counter,w ; use lookup table to get led value call LIGHTCODE ; // movwf portd ; Put returned value into portd decf counter ; decrement the counter movf counter,w ; check if counter is at 0 btfsc status,zflag ; return ; goto GODOWN ; LIGHTCODE movf counter,w ; // addwf pcl,f ; Set the value on seven segment display to counter retlw b'10000001' ;Decode retlw b'01000010' ;Decode retlw b'00100100' ;Decode retlw b'00011000' ;Decode retlw b'00011000' ;Decode retlw b'00100100' ;Decode retlw b'01000010' ;Decode retlw b'10000001' ;Decode DELAY ;return ;Used for simulation purposes movlw 01h ;Set delay for 0.1 Second (100ms) movwf loop3 ;Set Loop3 to Loop 3 Times LOOP decfsz loop1,1 ;Loop 255 times then move to next loop goto LOOP ;Go Back to the beginning of the Loop decfsz loop2,1 ;Loop 255 times then move to next loop goto LOOP ;Go Back to the beginning of the Loop decfsz loop3,1 ;Loop 5 times then move to next loop goto LOOP ;Go Back to the beginning of the Loop return ;Go back and execute instruction after last call end ;End of Source
src/compiling/ANTLR/grammar/SubroutineCalls.g4
jecassis/VSCode-SystemVerilog
75
2270
grammar SubroutineCalls; import Expressions; tf_call : ps_or_hierarchical_tf_identifier ( attribute_instance )* ( '(' list_of_arguments ')' )? ; system_tf_call : SYSTEM_TF_IDENTIFIER ( '(' list_of_arguments ')' )? | SYSTEM_TF_IDENTIFIER '(' data_type ( ',' expression )? ')' | SYSTEM_TF_IDENTIFIER '(' expression ( ',' ( expression )? )* ( ',' ( clocking_event )? )? ')' ; subroutine_call : tf_call | system_tf_call | ( ( primary_literal | ( class_qualifier | package_scope )? hierarchical_identifier select | empty_unpacked_array_concatenation | concatenation ( '[' range_expression ']' )? | multiple_concatenation ( '[' range_expression ']' )? | let_expression | '(' mintypmax_expression ')' | ( ( simple_type | signing | 'string' | 'const' ) APOSTROPHE '(' expression ')' ) | ( primary_literal | ps_parameter_identifier constant_select | specparam_identifier ( '[' constant_range_expression ']' )? | genvar_identifier | formal_port_identifier constant_select | ( package_scope | class_scope )? enum_identifier | constant_concatenation ( '[' constant_range_expression ']' )? | constant_multiple_concatenation ( '[' constant_range_expression ']' )? | constant_let_expression | '(' constant_mintypmax_expression ')' | ( ( simple_type | signing | 'string' | 'const' ) APOSTROPHE '(' constant_expression ')' ) | ( primary_literal | ps_parameter_identifier constant_select | specparam_identifier ( '[' constant_range_expression ']' )? | genvar_identifier | formal_port_identifier constant_select | ( package_scope | class_scope )? enum_identifier | constant_concatenation ( '[' constant_range_expression ']' )? | constant_multiple_concatenation ( '[' constant_range_expression ']' )? | constant_let_expression | '(' constant_mintypmax_expression ')' | constant_assignment_pattern_expression | type_reference | 'null' ) APOSTROPHE '(' constant_expression ')' | constant_assignment_pattern_expression | type_reference | 'null' ) APOSTROPHE '(' expression ')' | assignment_pattern_expression | streaming_concatenation | sequence_method_call | 'this' | '$' | 'null' | implicit_class_handle ) '.' method_call_body ) | subroutine_call ( ( APOSTROPHE '(' constant_expression ')' )? APOSTROPHE '(' expression ')' )? '.' method_call_body | ( 'std' '::' )? randomize_call ; function_subroutine_call : subroutine_call ; list_of_arguments : ( expression )? ( ',' ( expression )? )* ( ',' '.' identifier '(' ( expression )? ')' )* | '.' identifier '(' ( expression )? ')' ( ',' '.' identifier '(' ( expression )? ')' )* ; list_of_arguments_with_strings : ( string_or_expression )? ( ',' ( string_or_expression )? )* ( ',' '.' identifier '(' ( expression )? ')' )* | '.' identifier '(' ( expression )? ')' ( ',' '.' identifier '(' ( expression )? ')' )* ; method_call_body : method_identifier ( attribute_instance )* ( '(' list_of_arguments ')' )? | built_in_method_call ; built_in_method_call : array_manipulation_call | randomize_call ; array_manipulation_call : array_method_name ( attribute_instance )* ( '(' list_of_arguments ')' )? ( 'with' '(' expression ')' )? | array_method_call ; array_method_call : expression '.' array_method_name ( attribute_instance )* ( ( '(' iterator_argument ')' )? 'with' '(' expression ')' )? ; iterator_argument : identifier ; randomize_call : 'randomize' ( attribute_instance )* ( '(' ( variable_identifier_list | 'null' )? ')' )? ( 'with' ( '(' ( identifier_list )? ')' )? constraint_block )? ; array_method_name : method_identifier | 'unique' | 'and' | 'or' | 'xor' ;
oeis/279/A279395.asm
neoneye/loda-programs
11
2208
<gh_stars>10-100 ; A279395: a(n) = Sum_{ d >= 1, d divides n} (-1)^(n-d)*d^4. ; Submitted by <NAME> ; 1,15,82,271,626,1230,2402,4367,6643,9390,14642,22222,28562,36030,51332,69903,83522,99645,130322,169646,196964,219630,279842,358094,391251,428430,538084,650942,707282,769980,923522,1118479,1200644,1252830,1503652,1800253,1874162,1954830,2342084,2733742,2825762,2954460,3418802,3967982,4158518,4197630,4879682,5732046,5767203,5868765,6848804,7740302,7890482,8071260,9165892,10489534,10686404,10609230,12117362,13910972,13845842,13852830,15956486,17895695,17879812,18009660,20151122,22634462,22947044 add $0,1 mov $2,$0 lpb $0 div $1,-1 mov $3,$2 dif $3,$0 cmp $3,$2 cmp $3,0 mul $3,$0 sub $0,1 pow $3,4 add $1,$3 lpe add $1,1 gcd $0,$1
src/open_weather_map-api-service-group.ads
Jellix/open_weather_map_api
1
16098
<reponame>Jellix/open_weather_map_api<filename>src/open_weather_map-api-service-group.ads -------------------------------------------------------------------------------- -- Copyright (C) 2020 by Heisenbug Ltd. (<EMAIL>) -- -- This work is free. You can redistribute it and/or modify it under the -- terms of the Do What The Fuck You Want To Public License, Version 2, -- as published by Sam Hocevar. See the LICENSE file for more details. -------------------------------------------------------------------------------- pragma License (Unrestricted); -------------------------------------------------------------------------------- --% @summary --% Open_Weather_Map.API.Service.Group -- --% @description --% Provides the query object implementing a group query (i.e. a list of Ids for --% which weather information shall be retrieved). -------------------------------------------------------------------------------- package Open_Weather_Map.API.Service.Group is ----------------------------------------------------------------------------- -- API: Current weather data (by list of city IDs) ----------------------------------------------------------------------------- type T is new Service.T with private; ----------------------------------------------------------------------------- -- Initialize ----------------------------------------------------------------------------- procedure Initialize (Self : out T; Configuration : in GNATCOLL.JSON.JSON_Value; Connection : not null Client.T_Access; Max_Cache_Interval : in Ada.Real_Time.Time_Span := Default_Cache_Interval; Ids : in Group_List); --% Initializes the group query instance. -- --% @param Self --% The instance of the group query to initialize. -- --% @param Configuration --% Used to configure necessary internals (proxy server etc.). -- --% @param Connection --% Access to the connection object to be used for client server --% communication. -- --% @param Max_Cache_Interval --% Denotes the maximum frequency of actual queries sent to the server. -- --% @param Ids --% The list of location ids to be queried. private type T is new Service.T with null record; ----------------------------------------------------------------------------- -- Decode_Response ----------------------------------------------------------------------------- overriding function Decode_Response (Self : in T; Root : in GNATCOLL.JSON.JSON_Value) return Data_Set; --% Decodes a group query response. -- --% @param Self --% The group query instance. -- --% @param Root --% The root of the JSON response sent by the server. -- --% @return --% The data set decoded from the JSON data in Root. end Open_Weather_Map.API.Service.Group;
040-monoid.agda
mcmtroffaes/agda-proofs
2
810
module 040-monoid where -- We need semigroups. open import 030-semigroup -- The next useful structure is a monoid, which is a semigroup with -- (left and right) identity element. record Monoid {M : Set} (_==_ : M -> M -> Set) (_*_ : M -> M -> M) (id : M) : Set1 where field semigroup : SemiGroup _==_ _*_ r*id==r : ∀ {r} -> (r * id) == r id*r==r : ∀ {r} -> (id * r) == r open SemiGroup semigroup public -- Should we define powers? We cannot do this yet: we need natural -- numbers first, which we do not have yet. -- Let us prove some facts. -- Identity can occur on either side of the equality. r==r*id : ∀ {r} -> r == (r * id) r==r*id = symm r*id==r r==id*r : ∀ {r} -> r == (id * r) r==id*r = symm id*r==r -- The identity element is unique (both left and right). idleftunique : ∀ {r} -> (∀ {s} -> (r * s) == s) -> (r == id) idleftunique r*s==s = trans r==r*id r*s==s idrightunique : ∀ {r} -> (∀ {s} -> (s * r) == s) -> (r == id) idrightunique s*r==s = trans r==id*r s*r==s
oeis/021/A021743.asm
neoneye/loda-programs
11
95404
<filename>oeis/021/A021743.asm ; A021743: Decimal expansion of 1/739. ; Submitted by <NAME>(s1) ; 0,0,1,3,5,3,1,7,9,9,7,2,9,3,6,4,0,0,5,4,1,2,7,1,9,8,9,1,7,4,5,6,0,2,1,6,5,0,8,7,9,5,6,6,9,8,2,4,0,8,6,6,0,3,5,1,8,2,6,7,9,2,9,6,3,4,6,4,1,4,0,7,3,0,7,1,7,1,8,5,3,8,5,6,5,6,2,9,2,2,8,6,8,7,4,1,5,4,2 add $0,1 mov $2,10 pow $2,$0 div $2,739 mov $0,$2 mod $0,10
src/Categories/Category/Dagger/Instance/Rels.agda
Trebor-Huang/agda-categories
279
13955
<filename>src/Categories/Category/Dagger/Instance/Rels.agda {-# OPTIONS --without-K --safe #-} module Categories.Category.Dagger.Instance.Rels where open import Data.Product open import Function open import Relation.Binary.PropositionalEquality open import Level open import Categories.Category.Dagger open import Categories.Category.Instance.Rels RelsHasDagger : ∀ {o ℓ} → HasDagger (Rels o ℓ) RelsHasDagger = record { _† = flip ; †-identity = (lift ∘ sym ∘ lower) , (lift ∘ sym ∘ lower) ; †-homomorphism = (map₂ swap) , (map₂ swap) ; †-resp-≈ = λ p → (proj₁ p) , (proj₂ p) -- it's the implicits that need flipped ; †-involutive = λ _ → id , id } RelsDagger : ∀ o ℓ → DaggerCategory (suc o) (suc (o ⊔ ℓ)) (o ⊔ ℓ) RelsDagger o ℓ = record { C = Rels o ℓ ; hasDagger = RelsHasDagger }
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-btgbso.ads
orb-zhuchen/Orb
0
28155
------------------------------------------------------------------------------ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- -- ADA.CONTAINERS.RED_BLACK_TREES.GENERIC_BOUNDED_SET_OPERATIONS -- -- -- -- S p e c -- -- -- -- Copyright (C) 2004-2019, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- This unit was originally developed by <NAME>. -- ------------------------------------------------------------------------------ -- Tree_Type is used to implement ordered containers. This package declares -- set-based tree operations. with Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations; generic with package Tree_Operations is new Generic_Bounded_Operations (<>); type Set_Type is new Tree_Operations.Tree_Types.Tree_Type with private; use Tree_Operations.Tree_Types, Tree_Operations.Tree_Types.Implementation; with procedure Assign (Target : in out Set_Type; Source : Set_Type); with procedure Insert_With_Hint (Dst_Set : in out Set_Type; Dst_Hint : Count_Type; Src_Node : Node_Type; Dst_Node : out Count_Type); with function Is_Less (Left, Right : Node_Type) return Boolean; package Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations is pragma Pure; procedure Set_Union (Target : in out Set_Type; Source : Set_Type); -- Attempts to insert each element of Source in Target. If Target is -- busy then Program_Error is raised. We say "attempts" here because -- if these are unique-element sets, then the insertion should fail -- (not insert a new item) when the insertion item from Source is -- equivalent to an item already in Target. If these are multisets -- then of course the attempt should always succeed. function Set_Union (Left, Right : Set_Type) return Set_Type; -- Makes a copy of Left, and attempts to insert each element of -- Right into the copy, then returns the copy. procedure Set_Intersection (Target : in out Set_Type; Source : Set_Type); -- Removes elements from Target that are not equivalent to items in -- Source. If Target is busy then Program_Error is raised. function Set_Intersection (Left, Right : Set_Type) return Set_Type; -- Returns a set comprising all the items in Left equivalent to items in -- Right. procedure Set_Difference (Target : in out Set_Type; Source : Set_Type); -- Removes elements from Target that are equivalent to items in Source. If -- Target is busy then Program_Error is raised. function Set_Difference (Left, Right : Set_Type) return Set_Type; -- Returns a set comprising all the items in Left not equivalent to items -- in Right. procedure Set_Symmetric_Difference (Target : in out Set_Type; Source : Set_Type); -- Removes from Target elements that are equivalent to items in Source, -- and inserts into Target items from Source not equivalent elements in -- Target. If Target is busy then Program_Error is raised. function Set_Symmetric_Difference (Left, Right : Set_Type) return Set_Type; -- Returns a set comprising the union of the elements in Left not -- equivalent to items in Right, and the elements in Right not equivalent -- to items in Left. function Set_Subset (Subset : Set_Type; Of_Set : Set_Type) return Boolean; -- Returns False if Subset contains at least one element not equivalent to -- any item in Of_Set; returns True otherwise. function Set_Overlap (Left, Right : Set_Type) return Boolean; -- Returns True if at least one element of Left is equivalent to an item in -- Right; returns False otherwise. end Ada.Containers.Red_Black_Trees.Generic_Bounded_Set_Operations;
maps/PoketchCompany2F.asm
AtmaBuster/pokecrystal16-493-plus
1
22569
<filename>maps/PoketchCompany2F.asm object_const_def ; object_event constants PoketchCompany2F_MapScripts: db 0 ; scene scripts db 0 ; callbacks PoketchCompany2F_MapEvents: db 0, 0 ; filler db 2 ; warp events warp_event 9, 0, POKETCH_COMPANY_1F, 5 warp_event 4, 0, POKETCH_COMPANY_3F, 1 db 0 ; coord events db 0 ; bg events db 0 ; object events
danagy/fln.asm
DW0RKiN/Floating-point-Library-for-Z80
12
91454
if not defined @FLN include "fadd.asm" ; logaritmus naturalis ; Input: HL ; Output: HL = ln(abs(HL)) +- lowest bit (with exponent -1($7E) the error is bigger...) ; ln(2^e*m) = ln(2^e) + ln(m) = e*ln(2) + ln(m) = ln2_exp[e] + ln_m[m] ; Pollutes: AF, B, DE @FLN: if not defined FLN ; ***************************************** FLN ; * ; ***************************************** endif if fix_ln ; fixes input errors with exponent equal to -1 LD A, H ; 1:4 ADD A, A ; 1:4 XOR 2*$3F ; 2:7 JR z, FLN_FIX ; 2:12/7 endif LD A, H ; 1:4 save LD H, high LN_M ; 2:7 LN_M[] LD E, (HL) ; 1:7 INC H ; 1:4 hi LN_M[] LD D, (HL) ; 1:7 ADD A, A ; 1:4 sign out, HL = abs(HL) LD L, A ; 1:4 CP 2*BIAS ; 2:7 JR z, FLN_NO_ADD ; 2:7/11 INC H ; 1:4 LN2_EXP[] LD A, (HL) ; 1:7 INC L ; 1:4 LD H, (HL) ; 1:7 LD L, A ; 1:4 LD A, D ; 1:4 OR E ; 1:4 JP nz, FADD ; 3:10 HL = HL + DE = +-LN2_EXP[] + LN_M[] RET ; 1:10 if fix_ln FLN_FIX: LD H, high LN_FIX ; 2:7 LD E, (HL) ; 1:7 INC H ; 1:4 LD D, (HL) ; 1:7 endif FLN_NO_ADD: EX DE, HL ; 1:4 RET ; 1:10 endif
programs/oeis/082/A082841.asm
jmorken/loda
1
103821
; A082841: a(n) = 4*a(n-1) - a(n-2) for n>1, a(0)=3, a(1)=9. ; 3,9,33,123,459,1713,6393,23859,89043,332313,1240209,4628523,17273883,64467009,240594153,897909603,3351044259,12506267433,46674025473,174189834459,650085312363,2426151414993,9054520347609,33791929975443,126113199554163,470660868241209,1756530273410673,6555460225401483 mov $1,3 lpb $0 sub $0,1 add $2,$1 add $2,$1 add $1,$2 lpe
src/globals.asm
headkaze/zxnext_chess_demo
1
170272
<reponame>headkaze/zxnext_chess_demo SECTION rodata_user PUBLIC _breakpoint _breakpoint: DEFB $dd, $01 ret
programs/oeis/320/A320065.asm
neoneye/loda
22
26180
<reponame>neoneye/loda ; A320065: a(n) is the smallest integer i such that binomial(2i,i) > n. ; 1,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 add $0,1 div $0,2 mov $1,254 lpb $0 mul $0,2 add $0,1 div $0,7 add $1,1 lpe sub $1,253 mov $0,$1
oeis/086/A086946.asm
neoneye/loda-programs
11
103878
<reponame>neoneye/loda-programs ; A086946: a(n) = k where R(k+6) = 2. ; 14,194,1994,19994,199994,1999994,19999994,199999994,1999999994,19999999994,199999999994,1999999999994,19999999999994,199999999999994,1999999999999994,19999999999999994,199999999999999994,1999999999999999994,19999999999999999994,199999999999999999994,1999999999999999999994,19999999999999999999994,199999999999999999999994,1999999999999999999999994,19999999999999999999999994,199999999999999999999999994,1999999999999999999999999994,19999999999999999999999999994,199999999999999999999999999994 add $0,1 mov $1,10 pow $1,$0 sub $1,3 mul $1,2 mov $0,$1
Task/Parametric-polymorphism/Ada/parametric-polymorphism-2.ada
LaudateCorpus1/RosettaCodeData
1
18760
package body Container is procedure Replace_All(The_Tree : in out Tree; New_Value : Element_Type) is begin The_Tree.Value := New_Value; If The_Tree.Left /= null then The_Tree.Left.all.Replace_All(New_Value); end if; if The_tree.Right /= null then The_Tree.Right.all.Replace_All(New_Value); end if; end Replace_All; end Container;
src/Implicits/Resolution/GenericFinite/Resolution.agda
metaborg/ts.agda
4
7589
<reponame>metaborg/ts.agda open import Prelude hiding (_<_) module Implicits.Resolution.GenericFinite.Resolution where open import Coinduction open import Data.List open import Data.List.Any open Membership-≡ open import Data.Fin.Substitution open import Relation.Binary using (Rel) open import Implicits.Syntax open import Implicits.Syntax.Type.Unification open import Implicits.Substitutions open import Implicits.Substitutions.Lemmas.MetaType open import Implicits.Resolution.Termination open import Implicits.Resolution.GenericFinite.TerminationCondition private module M = MetaTypeMetaSubst module ResolutionRules (cond : TerminationCondition) where open TerminationCondition cond mutual data _,_⊢_↓_ {ν} (Δ : ICtx ν) : (Φ : TCtx) → Type ν → SimpleType ν → Set where i-simp : ∀ {Φ} a → Δ , Φ ⊢ simpl a ↓ a i-iabs : ∀ {Φ ρ₁ ρ₂ a} → let Φ' = (step Φ Δ ρ₁ ρ₂ a) in Φ' < Φ → Δ , Φ' ⊢ᵣ ρ₁ → Δ , Φ ⊢ ρ₂ ↓ a → Δ , Φ ⊢ ρ₁ ⇒ ρ₂ ↓ a i-tabs : ∀ {Φ ρ a} b → Δ , Φ ⊢ ρ tp[/tp b ] ↓ a → Δ , Φ ⊢ ∀' ρ ↓ a data _,_⊢ᵣ_ {ν} (Δ : ICtx ν) : TCtx → Type ν → Set where r-simp : ∀ {Φ r τ} → r ∈ Δ → Δ , Φ ⊢ r ↓ τ → Δ , Φ ⊢ᵣ simpl τ r-iabs : ∀ {Φ} ρ₁ {ρ₂} → ((ρ₁ ∷ Δ) , Φ ⊢ᵣ ρ₂) → Δ , Φ ⊢ᵣ (ρ₁ ⇒ ρ₂) r-tabs : ∀ {Φ ρ} → ictx-weaken Δ , Φ ⊢ᵣ ρ → Δ , Φ ⊢ᵣ ∀' ρ
tests/lsc_internal_test_aes_cbc.adb
Componolit/libsparkcrypto
30
6648
------------------------------------------------------------------------------- -- This file is part of libsparkcrypto. -- -- Copyright (C) 2010, <NAME> -- Copyright (C) 2010, secunet Security Networks AG -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- -- * Neither the name of the nor the names of its contributors may be used -- to endorse or promote products derived from this software without -- specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS -- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------- with LSC.Internal.Types; with LSC.Internal.AES; with LSC.Internal.AES.CBC; with AUnit.Assertions; use AUnit.Assertions; with Util; use Util; pragma Elaborate_All (Util); pragma Style_Checks ("-s"); pragma Warnings (Off, "formal parameter ""T"" is not referenced"); use type LSC.Internal.Types.Word32_Array_Type; package body LSC_Internal_Test_AES_CBC is subtype Msg_Index is Natural range 1 .. 10; subtype Msg_Type is LSC.Internal.AES.Message_Type (Msg_Index); Plaintext : constant Msg_Type := Msg_Type' (LSC.Internal.AES.Block_Type'(M (16#6bc1bee2#), M (16#2e409f96#), M (16#e93d7e11#), M (16#7393172a#)), LSC.Internal.AES.Block_Type'(M (16#ae2d8a57#), M (16#1e03ac9c#), M (16#9eb76fac#), M (16#45af8e51#)), LSC.Internal.AES.Block_Type'(M (16#30c81c46#), M (16#a35ce411#), M (16#e5fbc119#), M (16#1a0a52ef#)), LSC.Internal.AES.Block_Type'(M (16#f69f2445#), M (16#df4f9b17#), M (16#ad2b417b#), M (16#e66c3710#)), others => LSC.Internal.AES.Null_Block); IV : constant LSC.Internal.AES.Block_Type := LSC.Internal.AES.Block_Type' (M (16#00010203#), M (16#04050607#), M (16#08090a0b#), M (16#0c0d0e0f#)); --------------------------------------------------------------------------- function Equal (Left : Msg_Type; Right : Msg_Type; Length : Msg_Index) return Boolean is Result : Boolean := True; begin for I in Msg_Index range Left'First .. Length loop if Left (I) /= Right (I) then Result := False; exit; end if; end loop; return Result; end Equal; --------------------------------------------------------------------------- procedure Test_AES128_CBC (T : in out Test_Cases.Test_Case'Class) is Key : LSC.Internal.AES.AES128_Key_Type; Ciphertext : Msg_Type; Enc_Context : LSC.Internal.AES.AES_Enc_Context; Dec_Context : LSC.Internal.AES.AES_Dec_Context; Result : Msg_Type; begin Key := LSC.Internal.AES.AES128_Key_Type' (M (16#2b7e1516#), M (16#28aed2a6#), M (16#abf71588#), M (16#09cf4f3c#)); Ciphertext := Msg_Type' (LSC.Internal.AES.Block_Type'(M (16#7649abac#), M (16#8119b246#), M (16#cee98e9b#), M (16#12e9197d#)), (LSC.Internal.AES.Block_Type'(M (16#5086cb9b#), M (16#507219ee#), M (16#95db113a#), M (16#917678b2#))), (LSC.Internal.AES.Block_Type'(M (16#73bed6b8#), M (16#e3c1743b#), M (16#7116e69e#), M (16#22229516#))), (LSC.Internal.AES.Block_Type'(M (16#3ff1caa1#), M (16#681fac09#), M (16#120eca30#), M (16#7586e1a7#))), others => LSC.Internal.AES.Null_Block); -- Encryption Enc_Context := LSC.Internal.AES.Create_AES128_Enc_Context (Key); LSC.Internal.AES.CBC.Encrypt (Enc_Context, IV, Plaintext, 4, Result); Assert (Equal (Result, Ciphertext, 4), "Invalid ciphertext"); -- Decryption Dec_Context := LSC.Internal.AES.Create_AES128_Dec_Context (Key); LSC.Internal.AES.CBC.Decrypt (Dec_Context, IV, Ciphertext, 4, Result); Assert (Equal (Result, Plaintext, 4), "Invalid plaintext"); end Test_AES128_CBC; --------------------------------------------------------------------------- procedure Test_AES192_CBC (T : in out Test_Cases.Test_Case'Class) is Key : LSC.Internal.AES.AES192_Key_Type; Ciphertext : Msg_Type; Enc_Context : LSC.Internal.AES.AES_Enc_Context; Dec_Context : LSC.Internal.AES.AES_Dec_Context; Result : Msg_Type; begin Key := LSC.Internal.AES.AES192_Key_Type' (M (16#8e73b0f7#), M (16#da0e6452#), M (16#c810f32b#), M (16#809079e5#), M (16#62f8ead2#), M (16#522c6b7b#)); Ciphertext := Msg_Type' (LSC.Internal.AES.Block_Type'(M (16#4f021db2#), M (16#43bc633d#), M (16#7178183a#), M (16#9fa071e8#)), LSC.Internal.AES.Block_Type'(M (16#b4d9ada9#), M (16#ad7dedf4#), M (16#e5e73876#), M (16#3f69145a#)), LSC.Internal.AES.Block_Type'(M (16#571b2420#), M (16#12fb7ae0#), M (16#7fa9baac#), M (16#3df102e0#)), LSC.Internal.AES.Block_Type'(M (16#08b0e279#), M (16#88598881#), M (16#d920a9e6#), M (16#4f5615cd#)), others => LSC.Internal.AES.Null_Block); -- Encryption Enc_Context := LSC.Internal.AES.Create_AES192_Enc_Context (Key); LSC.Internal.AES.CBC.Encrypt (Enc_Context, IV, Plaintext, 4, Result); Assert (Equal (Result, Ciphertext, 4), "Invalid ciphertext"); -- Decryption Dec_Context := LSC.Internal.AES.Create_AES192_Dec_Context (Key); LSC.Internal.AES.CBC.Decrypt (Dec_Context, IV, Ciphertext, 4, Result); Assert (Equal (Result, Plaintext, 4), "Invalid plaintext"); end Test_AES192_CBC; --------------------------------------------------------------------------- procedure Test_AES256_CBC (T : in out Test_Cases.Test_Case'Class) is Key : LSC.Internal.AES.AES256_Key_Type; Ciphertext : Msg_Type; Enc_Context : LSC.Internal.AES.AES_Enc_Context; Dec_Context : LSC.Internal.AES.AES_Dec_Context; Result : Msg_Type; begin Key := LSC.Internal.AES.AES256_Key_Type' (M (16#603deb10#), M (16#15ca71be#), M (16#2b73aef0#), M (16#857d7781#), M (16#1f352c07#), M (16#3b6108d7#), M (16#2d9810a3#), M (16#0914dff4#)); Ciphertext := Msg_Type' (LSC.Internal.AES.Block_Type'(M (16#f58c4c04#), M (16#d6e5f1ba#), M (16#779eabfb#), M (16#5f7bfbd6#)), LSC.Internal.AES.Block_Type'(M (16#9cfc4e96#), M (16#7edb808d#), M (16#679f777b#), M (16#c6702c7d#)), LSC.Internal.AES.Block_Type'(M (16#39f23369#), M (16#a9d9bacf#), M (16#a530e263#), M (16#04231461#)), LSC.Internal.AES.Block_Type'(M (16#b2eb05e2#), M (16#c39be9fc#), M (16#da6c1907#), M (16#8c6a9d1b#)), others => LSC.Internal.AES.Null_Block); -- Encryption Enc_Context := LSC.Internal.AES.Create_AES256_Enc_Context (Key); LSC.Internal.AES.CBC.Encrypt (Enc_Context, IV, Plaintext, 4, Result); Assert (Equal (Result, Ciphertext, 4), "Invalid ciphertext"); -- Decryption Dec_Context := LSC.Internal.AES.Create_AES256_Dec_Context (Key); LSC.Internal.AES.CBC.Decrypt (Dec_Context, IV, Ciphertext, 4, Result); Assert (Equal (Result, Plaintext, 4), "Invalid plaintext"); end Test_AES256_CBC; --------------------------------------------------------------------------- procedure Register_Tests (T : in out Test_Case) is use AUnit.Test_Cases.Registration; begin Register_Routine (T, Test_AES128_CBC'Access, "128 (F.2.1/F.2.2)"); Register_Routine (T, Test_AES192_CBC'Access, "192 (F.2.3/F.2.4)"); Register_Routine (T, Test_AES256_CBC'Access, "256 (F.2.5/F.2.6)"); end Register_Tests; --------------------------------------------------------------------------- function Name (T : Test_Case) return Test_String is begin return Format ("AES-CBC"); end Name; end LSC_Internal_Test_AES_CBC;